Fix Check array of action after kooks

This commit is contained in:
Dev2a 2020-01-07 21:39:20 +01:00
parent 8e3eaed280
commit 0214d15c55

View File

@ -591,23 +591,24 @@ class Form
* Generate select HTML to choose massaction
*
* @param string $selected Value auto selected when at least one record is selected. Not a preselected value. Use '0' by default.
* @param int $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action.
* @param array $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action.
* @param int $alwaysvisible 1=select button always visible
* @return string Select list
* @return string|void Select list
*/
public function selectMassAction($selected, $arrayofaction, $alwaysvisible = 0)
{
global $conf, $langs, $hookmanager;
if (count($arrayofaction) == 0) return;
$disabled = 0;
$ret = '<div class="centpercent center">';
$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' massaction massactionselect valignmiddle" name="massaction"'.($disabled ? ' disabled="disabled"' : '').'>';
// Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks.
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreMassActions', $parameters); // Note that $action and $object may have been modified by hook
$parameters=array();
$reshook=$hookmanager->executeHooks('addMoreMassActions',$parameters); // Note that $action and $object may have been modified by hook
// check if there is a mass action
if (count($arrayofaction) == 0 && empty($hookmanager->resPrint)) return;
if (empty($reshook))
{
$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>';