do not show batch operation on categories if none are defined

This commit is contained in:
Uwe Steinmann 2023-01-19 07:08:04 +01:00
parent b6a52ee4de
commit 9ec87a727e

View File

@ -968,38 +968,39 @@ function typeahead() { /* {{{ */
ob_start();
$cats = $dms->getDocumentCategories();
$options = array();
$options[] = array("-1", getMLText("choose_category"));
foreach ($cats as $currcat) {
$options[] = array($currcat->getID(), htmlspecialchars($currcat->getName()), false);
if($cats) {
$options = array();
$options[] = array("-1", getMLText("choose_category"));
foreach ($cats as $currcat) {
$options[] = array($currcat->getID(), htmlspecialchars($currcat->getName()), false);
}
$this->formField(
null,
array(
'element'=>'select',
'id'=>'batchcategory',
'class'=>'chzn-select',
'options'=>$options,
'multiple'=>false,
'placeholder'=>getMLText('select_category'),
'attributes'=>array(array('style', 'width: 100%;'))
)
);
$this->formField(
getMLText("batch_remove_category"),
array(
'element'=>'input',
'type'=>'checkbox',
'id'=>'removecategory',
'value'=>'1',
)
);
print $this->html_link('Search', array_merge($_GET, array('action'=>'changecategory')), array('class'=>'btn btn-primary change-category-btn mt-4', 'id'=>'changecategory'), "<i class=\"fa fa-user\"></i> ".getMLText("batch_change_category"), false, true)."\n";
$content = ob_get_clean();
$this->printAccordion(getMLText('batch_change_category'), $content);
}
$this->formField(
null,
array(
'element'=>'select',
'id'=>'batchcategory',
'class'=>'chzn-select',
'options'=>$options,
'multiple'=>false,
'placeholder'=>getMLText('select_category'),
'attributes'=>array(array('style', 'width: 100%;'))
)
);
$this->formField(
getMLText("batch_remove_category"),
array(
'element'=>'input',
'type'=>'checkbox',
'id'=>'removecategory',
'value'=>'1',
)
);
// print $this->html_link('Search', array_merge($_GET, array('action'=>'changeowner')), array('class'=>'btn btn-primary', 'id'=>'changeowner'), "<i class=\"fa fa-user\"></i> ".getMLText("batch_change_owner"), false, true)."\n";
print $this->html_link('Search', array_merge($_GET, array('action'=>'changecategory')), array('class'=>'btn btn-primary change-category-btn mt-4', 'id'=>'changecategory'), "<i class=\"fa fa-user\"></i> ".getMLText("batch_change_category"), false, true)."\n";
$content = ob_get_clean();
$this->printAccordion(getMLText('batch_change_category'), $content);
}
// }}}