Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into 14.0

Conflicts:
	htdocs/core/actions_massactions.inc.php
	htdocs/core/ajax/objectonoff.php
This commit is contained in:
Laurent Destailleur
2021-11-30 16:11:12 +01:00
6 changed files with 23 additions and 22 deletions

View File

@@ -1298,6 +1298,12 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
continue;
}
if ($objectclass == 'Holiday' && ! in_array($objecttmp->statut, array(Holiday::STATUS_DRAFT, Holiday::STATUS_CANCELED, Holiday::STATUS_REFUSED))) {
$nbignored++;
$resaction .= '<div class="error">'.$langs->trans('ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref).'</div><br>';
continue;
}
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) {
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".((int) $objecttmp->id);
$res = $db->query($sql);
@@ -1331,8 +1337,10 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
} elseif ($nbok > 0) {
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
}
$db->commit();
} else {

View File

@@ -65,9 +65,14 @@ if (!empty($user->socid)) {
$socid = $user->socid;
}
/*if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set');
}*/
if (in_array($field, array('status'))) {
restrictedArea($user, $element, $id);
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
} else {
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
exit;
}
/*
@@ -78,15 +83,6 @@ top_httphead();
print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
if (in_array($field, array('status'))) {
restrictedArea($user, $element, $id);
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
} else {
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
exit;
}
// Registering new values
if (($action == 'set') && !empty($id)) {
$triggerkey = strtoupper($element).'_UPDATE';