do not allow to select category if no categories exists

This commit is contained in:
Uwe Steinmann 2021-12-03 11:31:37 +01:00
parent 14d8a1bd91
commit 004af591a9
2 changed files with 43 additions and 39 deletions

View File

@ -223,9 +223,10 @@ console.log(params);
getMLText("keywords"), getMLText("keywords"),
$this->getKeywordChooserHtml('adddocform') $this->getKeywordChooserHtml('adddocform')
); );
$categories = $dms->getDocumentCategories();
if($categories) {
if(!$nodocumentformfields || !in_array('categories', $nodocumentformfields)) { if(!$nodocumentformfields || !in_array('categories', $nodocumentformfields)) {
$options = array(); $options = array();
$categories = $dms->getDocumentCategories();
foreach($categories as $category) { foreach($categories as $category) {
$options[] = array($category->getID(), $category->getName()); $options[] = array($category->getID(), $category->getName());
} }
@ -241,6 +242,7 @@ console.log(params);
) )
); );
} }
}
if(!$nodocumentformfields || !in_array('sequence', $nodocumentformfields)) { if(!$nodocumentformfields || !in_array('sequence', $nodocumentformfields)) {
$this->formField(getMLText("sequence"), $this->getSequenceChooser($folder->getDocuments('s')).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : '')); $this->formField(getMLText("sequence"), $this->getSequenceChooser($folder->getDocuments('s')).($orderby != 's' ? "<br />".getMLText('order_by_sequence_off') : ''));
} else { } else {

View File

@ -134,9 +134,10 @@ $(document).ready( function() {
) )
); );
} }
$categories = $dms->getDocumentCategories();
if($categories) {
if(!$nodocumentformfields || !in_array('categories', $nodocumentformfields)) { if(!$nodocumentformfields || !in_array('categories', $nodocumentformfields)) {
$options = array(); $options = array();
$categories = $dms->getDocumentCategories();
foreach($categories as $category) { foreach($categories as $category) {
$options[] = array($category->getID(), $category->getName(), in_array($category, $document->getCategories())); $options[] = array($category->getID(), $category->getName(), in_array($category, $document->getCategories()));
} }
@ -165,6 +166,7 @@ $(document).ready( function() {
); );
} }
} }
}
if(!$nodocumentformfields || !in_array('expires', $nodocumentformfields)) { if(!$nodocumentformfields || !in_array('expires', $nodocumentformfields)) {
$options = array(); $options = array();
$options[] = array('never', getMLText('does_not_expire')); $options[] = array('never', getMLText('does_not_expire'));