Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into 10.0

Conflicts:
	htdocs/core/class/html.form.class.php
	htdocs/product/list.php
This commit is contained in:
Laurent Destailleur 2020-01-10 13:51:29 +01:00
commit c4d62e0ea3
2 changed files with 9 additions and 8 deletions

View File

@ -575,15 +575,14 @@ 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">';
@ -592,6 +591,8 @@ class Form
// 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
// 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>';

View File

@ -441,14 +441,14 @@ if ($resql)
//'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"),
);
if ($user->rights->produit->supprimer) $arrayofmassactions['predelete']="<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
$rightskey='produit';
if ($type == Product::TYPE_SERVICE) $rightskey='service';
if ($user->rights->{$rightskey}->supprimer) $arrayofmassactions['predelete']="<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
$rightskey='produit';
if($type == Product::TYPE_SERVICE) $rightskey='service';
if($user->rights->{$rightskey}->creer)
if ($user->rights->{$rightskey}->creer)
{
$oldtype=$type;
if ($type === "") {
@ -458,7 +458,7 @@ if ($resql)
$label='NewProduct';
if($type == Product::TYPE_SERVICE) $label='NewService';
$newcardbutton.= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&amp;type='.$type);
$type=$oldtype;
$type=$oldtype;
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';