# WARNING: head commit changed in the meantime

Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 15.0
This commit is contained in:
Laurent Destailleur 2022-02-25 19:00:10 +01:00
commit f8a5749fc4
7 changed files with 51 additions and 42 deletions

View File

@ -66,7 +66,7 @@ function printDropdownBookmarksList()
// Url to list bookmark // Url to list bookmark
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('Bookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >'; $listbtn = '<a class="top-menu-dropdown-link" title="'.dol_escape_htmltag($langs->trans('Bookmarks')).'" href="'.DOL_URL_ROOT.'/bookmarks/list.php">';
$listbtn .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').'</a>'; $listbtn .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').'</a>';
// Url to go on create new bookmark page // Url to go on create new bookmark page

View File

@ -1955,7 +1955,7 @@ if ($action == 'create') {
// We verify whether the object is provisionally numbering // We verify whether the object is provisionally numbering
$ref = substr($object->ref, 1, 4); $ref = substr($object->ref, 1, 4);
if ($ref == 'PROV') { if ($ref == 'PROV' || $ref == '') {
$numref = $object->getNextNumRef($soc); $numref = $object->getNextNumRef($soc);
if (empty($numref)) { if (empty($numref)) {
$error++; $error++;

View File

@ -1902,8 +1902,12 @@ if ($action == 'create' && $usercancreate) {
if ($action == 'validate') { if ($action == 'validate') {
// We check that object has a temporary ref // We check that object has a temporary ref
$ref = substr($object->ref, 1, 4); $ref = substr($object->ref, 1, 4);
if ($ref == 'PROV') { if ($ref == 'PROV' || $ref == '') {
$numref = $object->getNextNumRef($soc); $numref = $object->getNextNumRef($soc);
if (empty($numref)) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
} else { } else {
$numref = $object->ref; $numref = $object->ref;
} }
@ -1954,9 +1958,10 @@ if ($action == 'create' && $usercancreate) {
if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>'; if ($nbMandated > 0 ) $text .= '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
if (!$error) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
} }
}
// Confirm back to draft status // Confirm back to draft status
if ($action == 'modif') { if ($action == 'modif') {

View File

@ -934,33 +934,29 @@ if ($modecompta == 'BOOKKEEPING') {
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
//$column = 's.dateep'; // We use the date of salary $column = 's.dateep'; // We use the date of end of period of salary
$column = 'p.datep';
} else {
$column = 'p.datep';
}
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount"; $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, s.label as label, date_format($column,'%Y-%m') as dm, sum(s.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
$sql .= " WHERE s.entity IN (".getEntity('salary').")"; $sql .= " WHERE s.entity IN (".getEntity('salary').")";
if (!empty($date_start) && !empty($date_end)) { if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
} }
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm"; $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, s.label, dm";
} else {
// For backward compatibility with old module salary
$column = 'p.datep'; $column = 'p.datep';
$sql .= " UNION ";
$sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount"; $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid = p.fk_salary";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user";
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")"; $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
if (!empty($date_start) && !empty($date_end)) { if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
} }
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
}
$newsortfield = $sortfield; $newsortfield = $sortfield;
if ($newsortfield == 's.nom, s.rowid') { if ($newsortfield == 's.nom, s.rowid') {
@ -975,7 +971,7 @@ if ($modecompta == 'BOOKKEEPING') {
$sql .= $db->order($newsortfield, $sortorder); $sql .= $db->order($newsortfield, $sortorder);
} }
dol_syslog("get payment salaries"); dol_syslog("get salaries");
$result = $db->query($sql); $result = $db->query($sql);
$subtotal_ht = 0; $subtotal_ht = 0;
$subtotal_ttc = 0; $subtotal_ttc = 0;

View File

@ -615,23 +615,31 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
//$column = 's.dateep'; // we use the date of salary $column = 's.dateep'; // we use the date of end of period of salary
$column = 'p.datep';
$sql = "SELECT s.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(s.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
$sql .= " WHERE s.entity IN (".getEntity('salary').")";
if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
}
$sql .= " GROUP BY s.label, dm";
} }
if ($modecompta == "RECETTES-DEPENSES") { if ($modecompta == "RECETTES-DEPENSES") {
$column = 'p.datep'; $column = 'p.datep';
}
$subtotal_ht = 0;
$subtotal_ttc = 0;
$sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount"; $sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p, ".MAIN_DB_PREFIX."salary as s"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql .= " WHERE p.fk_salary = s.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON p.fk_salary = s.rowid";
$sql .= " AND s.entity IN (".getEntity('salary').")"; $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
if (!empty($date_start) && !empty($date_end)) { if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'"; $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
} }
$sql .= " GROUP BY p.label, dm"; $sql .= " GROUP BY p.label, dm";
}
$subtotal_ht = 0;
$subtotal_ttc = 0;
dol_syslog("get social salaries payments"); dol_syslog("get social salaries payments");
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -1393,7 +1393,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
$note = $prodser->multilangs[$outputlangs->defaultlang]["other"]; $note = $prodser->multilangs[$outputlangs->defaultlang]["other"];
} }
} }
} elseif ($object->element == 'facture' || $object->element == 'facturefourn') { } elseif (($object->element == 'facture' || $object->element == 'facturefourn') && preg_match('/^\(DEPOSIT\).+/', $desc)) { // We must not replace '(DEPOSIT)' when it is alone, it will be translated and detailed later
$desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc); $desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc);
} }

View File

@ -112,7 +112,7 @@ if ($object->statut == Holiday::STATUS_DRAFT && $user->rights->holiday->write &&
if ($user->socid) { if ($user->socid) {
$socid = $user->socid; $socid = $user->socid;
} }
$result = restrictedArea($user, 'holiday', $object->id, 'holiday'); $result = restrictedArea($user, 'holiday', $object->id, 'holiday', '', '', 'rowid', $object->statut);
/* /*
@ -1414,7 +1414,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
// Confirmation messages // Confirmation messages
if ($action == 'delete') { if ($action == 'delete') {
if ($user->rights->holiday->delete) { if ($candelete) {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleDeleteCP"), $langs->trans("ConfirmDeleteCP"), "confirm_delete", '', 0, 1); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("TitleDeleteCP"), $langs->trans("ConfirmDeleteCP"), "confirm_delete", '', 0, 1);
} }
} }