From 377c73036381d27b3197a0c5615724fe37d59397 Mon Sep 17 00:00:00 2001 From: Pierre Payet Date: Wed, 14 Apr 2021 21:27:53 +0200 Subject: [PATCH 01/67] add missing group by hook in fichinter list --- htdocs/fichinter/list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index d054f5e5bcc..b142613f051 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -259,6 +259,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; +// Add GroupBy from hooks +$parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall); +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; $sql .= $db->order($sortfield, $sortorder); // Count total nb of records From 38f54d058267d9b69f31c8ec2fd814388c3930c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Apr 2021 10:26:35 +0200 Subject: [PATCH 02/67] FIX Missing extrafields into export of agenda record --- htdocs/core/extrafieldsinexport.inc.php | 4 ++++ htdocs/core/modules/modAgenda.class.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index cef5f74d172..8b7cf3c81cc 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -1,5 +1,9 @@ 'project', ); + $keyforselect = 'actioncomm'; $keyforelement = 'action'; $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_extrafields as extra ON ac.id = extra.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; if (!empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; From 0cd567f256cf5bb98610457fd014556e29522d02 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 16 Apr 2021 10:37:42 +0200 Subject: [PATCH 03/67] fix double test --- htdocs/core/modules/modAgenda.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 559260a77c2..d3a78d01d90 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -413,7 +413,7 @@ class modAgenda extends DolibarrModules 'langs' => 'agenda', 'position' => 170, 'perms' => '$user->rights->agenda->allactions->read', - 'enabled' => '$conf->categorie->enabled&&$conf->categorie->enabled', + 'enabled' => '$conf->categorie->enabled', 'target' => '', 'user' => 2 ); From af9c2384ef3832e837fefffcbedad8833df6e254 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Apr 2021 19:14:01 +0200 Subject: [PATCH 04/67] Add warning --- htdocs/comm/mailing/cibles.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index bcf1e9c1e3b..fe3f4a76d96 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -689,6 +689,7 @@ if ($object->fetch($id) >= 0) // Search Icon print ''; + print ''; if ($obj->statut == 0) // Not sent yet { if ($user->rights->mailing->creer && $allowaddtarget) { From f4fa16797b6b7c28bf45a4c20fee13b0325259f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 16:00:48 +0200 Subject: [PATCH 05/67] Complete information on tab for files on salary --- htdocs/salaries/document.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index fddb5259da9..4c88cefb8de 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -123,8 +123,23 @@ if ($object->id) { print '
'; print ''; - print ''; - print ''; + + print ""; + print ''; + + print ""; + print ''; + + print ''; + + print ''; + + print ''; + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
' . $langs->trans("DateStartPeriod") . ''; + print dol_print_date($object->datesp, 'day'); + print '
' . $langs->trans("DateEndPeriod") . ''; + print dol_print_date($object->dateep, 'day'); + print '
' . $langs->trans("Amount") . '' . price($object->amount, 0, $langs, 1, -1, -1, $conf->currency) . '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; print ''; From c4f27cc29f1376d90d0c73bdd1f334ccb8649fd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 16:43:09 +0200 Subject: [PATCH 06/67] Debug module salary --- htdocs/salaries/card.php | 13 +++++----- htdocs/salaries/class/salary.class.php | 10 ++++++-- htdocs/salaries/list.php | 4 +++ htdocs/user/bank.php | 35 ++++++++++++++++++-------- 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index ad28bcca999..5b6134d192d 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -213,10 +213,11 @@ if ($action == 'add' && empty($cancel)) { } if (!$error) { + $db->begin(); + $ret = $object->create($user); if ($ret < 0) $error++; if (!empty($auto_create_paiement) && !$error) { - $db->begin(); // Create a line of payments $paiement = new PaymentSalary($db); $paiement->chid = $object->id; @@ -243,15 +244,11 @@ if ($action == 'add' && empty($cancel)) { setEventMessages($paiement->error, null, 'errors'); } } - - if (!$error) { - $db->commit(); - } else { - $db->rollback(); - } } if (empty($error)) { + $db->commit(); + if (GETPOST('saveandnew', 'alpha')) { setEventMessages($langs->trans("RecordSaved"), '', 'mesgs'); header("Location: card.php?action=create&fk_project=" . urlencode($projectid) . "&accountid=" . urlencode($accountid) . '&paymenttype=' . urlencode(GETPOST('paymenttype', 'az09')) . '&datepday=' . GETPOST("datepday", 'int') . '&datepmonth=' . GETPOST("datepmonth", 'int') . '&datepyear=' . GETPOST("datepyear", 'int')); @@ -260,6 +257,8 @@ if ($action == 'add' && empty($cancel)) { header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $object->id); exit; } + } else { + $db->rollback(); } } diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 85ccfc0a1db..94ede5d7a4d 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -498,6 +498,12 @@ class Salary extends CommonObject $label = ''.$langs->trans("Salary").''; $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; + if ($this->label) { + $label .= '
'.$langs->trans('Label').': '.$this->label; + } + if ($this->datesp && $this->dateep) { + $label .= '
'.$langs->trans('Period').': '.dol_print_date($this->datesp, 'day').' - '.dol_print_date($this->dateep, 'day'); + } $url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id; @@ -647,9 +653,9 @@ class Salary extends CommonObject /** * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) - * @return string Libelle + * @return string Label */ public function getLibStatut($mode = 0, $alreadypaid = -1) { diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index b35b890b994..382e05e4f0d 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -532,6 +532,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $salstatic->id = $obj->rowid; $salstatic->ref = $obj->rowid; + $salstatic->label = $obj->label; + $salstatic->paye = $obj->paye; + $salstatic->datesp = $db->jdate($obj->datesp); + $salstatic->dateep = $db->jdate($obj->dateep); // Show here line of result print ''; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index df5757992f0..356e23a5de0 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -40,6 +40,7 @@ if (!empty($conf->expensereport->enabled)) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } if (!empty($conf->salaries->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; } @@ -354,16 +355,18 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac // Latest payments of salaries if (!empty($conf->salaries->enabled) && - $user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id) + (($user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)) || (!empty($user->rights->salaries->readall))) ) { $payment_salary = new PaymentSalary($db); + $salary = new Salary($db); - $sql = "SELECT ps.rowid, s.datesp, s.dateep, ps.amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as ps"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON (s.rowid = ps.fk_salary)"; + $sql = "SELECT s.rowid as sid, s.ref as sref, s.label, s.datesp, s.dateep, s.paye, SUM(ps.amount) as alreadypaid"; + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (s.rowid = ps.fk_salary)"; $sql .= " WHERE s.fk_user = ".$object->id; - $sql .= " AND ps.entity = ".$conf->entity; - $sql .= " ORDER BY ps.rowid DESC"; + $sql .= " AND s.entity IN (".getEntity('salary').")"; + $sql .= " GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye"; + $sql .= " ORDER BY s.dateep DESC"; $resql = $db->query($sql); if ($resql) { @@ -372,7 +375,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print ''; print ''; - print '
'; + print ''; print ''; @@ -380,16 +383,26 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); + $payment_salary->id = $objp->rowid; + $payment_salary->ref = $objp->ref; + $payment_salary->datep = $db->jdate($objp->datep); + + $salary->id = $objp->sid; + $salary->ref = $objp->sref ? $objp->sref : $objp->sid; + $salary->label = $objp->label; + $salary->datesp = $db->jdate($objp->datesp); + $salary->dateep = $db->jdate($objp->dateep); + $salary->paye = $objp->paye; + print ''; print ''; print '\n"; print '\n"; - print ''; + //print ''; + print ''; print ''; $i++; From 55f114511cdaa166afe7da2fdd958e298b06821d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 16:56:55 +0200 Subject: [PATCH 07/67] Debug v14 --- htdocs/user/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 1eecf26664c..fe05c551945 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -595,7 +595,7 @@ $moreforfilter = ''; // Filter on categories if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('Categories').': '; + $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="paddingright"'); $moreforfilter .= $formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1); $moreforfilter .= '
'; } @@ -724,7 +724,7 @@ if (!empty($arrayfields['u.gender']['checked'])) { print_liste_field_titre("Gender", $_SERVER['PHP_SELF'], "u.gender", $param, "", "", $sortfield, $sortorder); } if (!empty($arrayfields['u.employee']['checked'])) { - print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['u.fk_user']['checked'])) { print_liste_field_titre("HierarchicalResponsible", $_SERVER['PHP_SELF'], "u.fk_user", $param, "", "", $sortfield, $sortorder); @@ -822,6 +822,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $li = $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1); print '
'; + if (!empty($arrayfields['u.login']['checked'])) { print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields['u.firstname']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } @@ -858,7 +859,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } } if (!empty($arrayfields['u.employee']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } From 2b894e8ab3378fa4c0a300e461a360413bd05477 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 20:13:18 +0200 Subject: [PATCH 08/67] css --- htdocs/install/default.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/default.css b/htdocs/install/default.css index eaefd6d5b2b..5363d9530e1 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -362,7 +362,7 @@ tr.choiceselected td .button { } a.button:link,a.button:visited,a.button:active { - color: #888; + color: #555; } .button { From 0c531984957095464f42d61904159ddc4b755773 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 20:18:38 +0200 Subject: [PATCH 09/67] Easier to click --- htdocs/install/step2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index d9321656355..2841ae8bdfe 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -572,7 +572,7 @@ dolibarr_install_syslog("- step2: end"); $out = ' '; -$out .= $langs->trans("MakeAnonymousPing"); +$out .= ''; $out .= ''; $out .= '
'.$langs->trans("LastSalaries", ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllSalaries").''.$num.''; print '
'.$langs->trans("LastSalaries", ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllSalaries").''.$num.'
'; - $payment_salary->id = $objp->rowid; - $payment_salary->ref = $objp->rowid; - print $payment_salary->getNomUrl(1); + print $salary->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->datesp), 'day')."'.dol_print_date($db->jdate($objp->dateep), 'day')."'.price($objp->amount).''.price($objp->amount).''.$salary->getLibStatut(5, $objp->alreadypaid).'
'; print $li; @@ -836,13 +837,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } } if (!empty($arrayfields['u.lastname']['checked'])) { - print ''.$obj->lastname.''.dol_escape_htmltag($obj->lastname).''.$obj->firstname.''.dol_escape_htmltag($obj->firstname).''.yn($obj->employee).''.yn($obj->employee).'