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

Conflicts:
	htdocs/fourn/facture/card.php
This commit is contained in:
Laurent Destailleur 2019-11-24 18:15:25 +01:00
commit bc5270ce76
2 changed files with 10 additions and 8 deletions

View File

@ -422,7 +422,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (! empty($objectid) && $objectid > 0) if (! empty($objectid) && $objectid > 0)
{ {
$ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select); $ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select);
return $ok ? 1 : accessforbidden(); $params=array('objectid' => $objectid, 'features' => join(',', $featuresarray), 'features2' => $feature2);
return $ok ? 1 : accessforbidden('', 1, 1, 0, $params);
} }
return 1; return 1;
@ -660,13 +661,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
* Show a message to say access is forbidden and stop program * Show a message to say access is forbidden and stop program
* Calling this function terminate execution of PHP. * Calling this function terminate execution of PHP.
* *
* @param string $message Force error message * @param string $message Force error message
* @param int $printheader Show header before * @param int $printheader Show header before
* @param int $printfooter Show footer after * @param int $printfooter Show footer after
* @param int $showonlymessage Show only message parameter. Otherwise add more information. * @param int $showonlymessage Show only message parameter. Otherwise add more information.
* @param array|null $params Send params
* @return void * @return void
*/ */
function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0) function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null)
{ {
global $conf, $db, $user, $langs, $hookmanager; global $conf, $db, $user, $langs, $hookmanager;
if (! is_object($langs)) if (! is_object($langs))
@ -697,7 +699,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('main')); $hookmanager->initHooks(array('main'));
} }
$parameters = array('message'=>$message); $parameters = array('message'=>$message, 'params'=>$params);
$reshook=$hookmanager->executeHooks('getAccessForbiddenMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('getAccessForbiddenMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) if (empty($reshook))

View File

@ -2675,7 +2675,7 @@ else
if ($calculationrule == 'totalofround') $calculationrulenum = 1; if ($calculationrule == 'totalofround') $calculationrulenum = 1;
else $calculationrulenum = 2; else $calculationrulenum = 2;
// Show link for "recalculate" // Show link for "recalculate"
if (empty($object->getVentilExportCompta())) { if ($object->getVentilExportCompta() == 0) {
$s = $langs->trans("ReCalculate").' '; $s = $langs->trans("ReCalculate").' ';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>'; $s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>';
$s .= ' / '; $s .= ' / ';