do not show filter for categories if none exist

This commit is contained in:
Uwe Steinmann 2023-10-31 14:42:26 +01:00
parent 0aedf55ec6
commit 929129abac

View File

@ -610,20 +610,22 @@ $(document).ready(function() {
$tmpcatids[] = $tmpcat->getID();
$options = array();
$allcategories = $dms->getDocumentCategories();
foreach($allcategories as $acategory) {
$options[] = array($acategory->getID(), $acategory->getName(), in_array($acategory->getId(), $tmpcatids));
if($allcategories) {
foreach($allcategories as $acategory) {
$options[] = array($acategory->getID(), $acategory->getName(), in_array($acategory->getId(), $tmpcatids));
}
$this->formField(
getMLText("categories"),
array(
'element'=>'select',
'class'=>'chzn-select',
'name'=>'category[]',
'multiple'=>true,
'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
'options'=>$options
)
);
}
$this->formField(
getMLText("categories"),
array(
'element'=>'select',
'class'=>'chzn-select',
'name'=>'category[]',
'multiple'=>true,
'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
'options'=>$options
)
);
$options = array();
if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
if($workflowmode == 'traditional') {