Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[document repository] multiple issues with categories, and upload/downloads #9614 -fix #9662

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/document_repository/jsx/editForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ class DocEditForm extends React.Component {
(<SelectElement
name="hiddenFile"
label="Restrict access to the file?"
options={this.state.data.hiddenFile}
options={this.state.data.hiddenVideo}
sortByValue={false}
onUserInput={this.setFormData}
value={this.state.docData.hiddenFile}
value={this.state.docData.hiddenVideo}
/>)
}
<TextboxElement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Document_Repository extends \DataFrameworkMenu
'sites' => $siteList,
'instruments' => $instrumentsList,
'fileTypes' => $fileTypeList,
'hiddenFile' => ['yes' => "Yes", 'no' => "No"],
'hiddenVideo' => ['yes' => "Yes", 'no' => "No"],
];
}
/**
Expand Down
12 changes: 6 additions & 6 deletions modules/document_repository/php/files.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ class Files extends \NDB_Page
$req = json_decode((string)$req->getBody(), true);
$updateValues = [
'File_category' => $req['category'] ?? null,
'hidden_file' => !empty($req['hiddenFile']) ?
$req['hiddenFile'] : null,
'hidden_video' => !empty($req['hiddenVideo']) ?
$req['hiddenVideo'] : null,
'instrument' => $req['instrument'] ?? null,
'comments' => $req['comments'] ?? null,
'version' => $req['version'] ?? null,
Expand Down Expand Up @@ -243,7 +243,7 @@ class Files extends \NDB_Page
"visitLabel, " .
"Instrument as instrument, " .
"comments, " .
"hidden_file as hiddenFile," .
"hide_video as hiddenVideo," .
"File_Name as fileName, " .
"version " .
"FROM document_repository " .
Expand All @@ -256,7 +256,7 @@ class Files extends \NDB_Page
'sites' => $siteList,
'instruments' => $instrumentsList,
'docData' => $docData,
'hiddenFile' => ['yes' => "Yes", 'no' => "No"],
'hiddenVideo' => ['yes' => "Yes", 'no' => "No"],
];

return $result;
Expand Down Expand Up @@ -397,7 +397,7 @@ class Files extends \NDB_Page
$visit = !empty($body['visitLabel']) ? $body['visitLabel'] : null;
$comments = !empty($body['comments']) ? $body['comments'] : null;
$version = !empty($body['version']) ? $body['version'] : null;
$hidden = !empty($body['hiddenFile']) ? $body['hiddenFile'] : null;
$hidden = !empty($body['hiddenVideo']) ? $body['hiddenVideo'] : null;

$fileSize = $uploadedFile->getSize();
$fileType = pathinfo($filename, PATHINFO_EXTENSION);
Expand All @@ -410,7 +410,7 @@ class Files extends \NDB_Page
'For_site' => $site,
'comments' => $comments,
'version' => $version,
'hidden_file' => $hidden,
'hide_video' => $hidden,
'File_name' => $filename,
'File_size' => $fileSize,
'Data_dir' => "$name/$filename",
Expand Down
2 changes: 1 addition & 1 deletion modules/document_repository/php/uploadcategory.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class UploadCategory extends \NDB_Page
$parent_id = isset($req['parentId']) ? $req['parentId'] : 0;
$comments = isset($req['comments']) ? $req['comments'] : null;
//check duplicate name category
if ($this->existCategoryName($category_name, $parent_id)) {
if ($this->existCategoryName($category_name, intval($parent_id))) {
return false;
}
$DB->insert(
Expand Down
Loading