FIX : if we search something with global search, and after with form fields, we want to stay on Products AND Services list

This commit is contained in:
gauthier 2019-10-22 16:11:59 +02:00
parent 6079a4d159
commit 44ced0cbeb

View File

@ -450,6 +450,7 @@ if ($resql)
if($type == Product::TYPE_SERVICE) $rightskey='service'; if($type == Product::TYPE_SERVICE) $rightskey='service';
if($user->rights->{$rightskey}->creer) if($user->rights->{$rightskey}->creer)
{ {
$oldtype=$type;
if ($type === "") { if ($type === "") {
$newcardbutton.= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0'); $newcardbutton.= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0');
$type = Product::TYPE_SERVICE; $type = Product::TYPE_SERVICE;
@ -457,6 +458,7 @@ if ($resql)
$label='NewProduct'; $label='NewProduct';
if($type == Product::TYPE_SERVICE) $label='NewService'; if($type == Product::TYPE_SERVICE) $label='NewService';
$newcardbutton.= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type); $newcardbutton.= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type);
$type=$oldtype;
} }
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';