From 29d1424413f56414b07536f461aca77862223d3a Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 5 May 2022 11:05:34 +0200 Subject: [PATCH 1/8] fix merge conflict Add missing error translation key --- htdocs/langs/en_US/errors.lang | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 37cc7a1b6fd..66c5d0e240d 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -274,6 +274,7 @@ ErrorExecIdFailed=Can't execute command "id" ErrorBadCharIntoLoginName=Unauthorized character in the login name ErrorInvoiceLoadThirdParty=Can't load third-party object for invoice "%s" ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s" +ErrorDeleteLineNotAllowedByObjectStatus=Delete line is not allowed by actual object status # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. @@ -307,8 +308,5 @@ WarningTheHiddenOptionIsOn=Warning, the hidden option %s is on. WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection. WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here. -<<<<<<< HEAD WarningPaypalPaymentNotCompatibleWithStrict=The value 'Strict' makes the online payment features not working correctly. Use 'Lax' instead. -======= ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git From 10e13286d376d3c263e3f1cae5ecedba8027abad Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 5 May 2022 11:04:27 +0200 Subject: [PATCH 2/8] Add missing reception back to draft error handling --- htdocs/reception/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index fda5a3910b7..9a679c067f8 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -197,6 +197,8 @@ if (empty($reshook)) { $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } + } else { + setEventMessages($object->error, $object->errors, 'errors'); } } From 2256f8811dffc6d0046e8968dae105b9efe332db Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 6 May 2022 11:24:53 +0200 Subject: [PATCH 3/8] FIX : in salary stats and payment list, we must check right perms as well as salary list --- htdocs/salaries/class/salariesstats.class.php | 20 +++++++++---------- htdocs/salaries/payments.php | 2 +- htdocs/salaries/stats/index.php | 6 +++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/salaries/class/salariesstats.class.php b/htdocs/salaries/class/salariesstats.class.php index b3e6c20a0ca..41898bb7341 100644 --- a/htdocs/salaries/class/salariesstats.class.php +++ b/htdocs/salaries/class/salariesstats.class.php @@ -23,7 +23,7 @@ * \brief Fichier de la classe de gestion des stats des salaires */ include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php'; -include_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; +include_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; /** * Classe permettant la gestion des stats des salaires @@ -58,7 +58,7 @@ class SalariesStats extends Stats $this->socid = $socid; $this->userid = $userid; - $object = new PaymentSalary($this->db); + $object = new Salary($this->db); $this->from = MAIN_DB_PREFIX.$object->table_element; $this->field = 'amount'; @@ -81,7 +81,7 @@ class SalariesStats extends Stats */ public function getNbByYear() { - $sql = "SELECT YEAR(datep) as dm, count(*)"; + $sql = "SELECT YEAR(dateep) as dm, count(*)"; $sql .= " FROM ".$this->from; $sql .= " WHERE ".$this->where; $sql .= " GROUP BY dm DESC"; @@ -99,9 +99,9 @@ class SalariesStats extends Stats */ public function getNbByMonth($year, $format = 0) { - $sql = "SELECT MONTH(datep) as dm, count(*)"; + $sql = "SELECT MONTH(dateep) as dm, count(*)"; $sql .= " FROM ".$this->from; - $sql .= " WHERE YEAR(datep) = ".((int) $year); + $sql .= " WHERE YEAR(dateep) = ".((int) $year); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -121,9 +121,9 @@ class SalariesStats extends Stats */ public function getAmountByMonth($year, $format = 0) { - $sql = "SELECT date_format(datep,'%m') as dm, sum(".$this->field.")"; + $sql = "SELECT date_format(dateep,'%m') as dm, sum(".$this->field.")"; $sql .= " FROM ".$this->from; - $sql .= " WHERE date_format(datep,'%Y') = '".$this->db->escape($year)."'"; + $sql .= " WHERE date_format(dateep,'%Y') = '".$this->db->escape($year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -141,9 +141,9 @@ class SalariesStats extends Stats */ public function getAverageByMonth($year) { - $sql = "SELECT date_format(datep,'%m') as dm, avg(".$this->field.")"; + $sql = "SELECT date_format(dateep,'%m') as dm, avg(".$this->field.")"; $sql .= " FROM ".$this->from; - $sql .= " WHERE date_format(datep,'%Y') = '".$this->db->escape($year)."'"; + $sql .= " WHERE date_format(dateep,'%Y') = '".$this->db->escape($year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -158,7 +158,7 @@ class SalariesStats extends Stats */ public function getAllByYear() { - $sql = "SELECT date_format(datep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; + $sql = "SELECT date_format(dateep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; $sql .= " FROM ".$this->from; $sql .= " WHERE ".$this->where; $sql .= " GROUP BY year"; diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index f129e6304ab..964c2521f3c 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -234,7 +234,7 @@ $sql .= " ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = sal.fk_user"; $sql .= " AND s.entity IN (".getEntity('payment_salaries').")"; if (empty($user->rights->salaries->readall)) { - $sql .= " AND s.fk_user IN (".$db->sanitize(join(',', $childids)).")"; + $sql .= " AND sal.fk_user IN (".$db->sanitize(join(',', $childids)).")"; } // Search criteria diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index ecc62c2a237..bfacd908c12 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -74,6 +74,10 @@ dol_mkdir($dir); $useridtofilter = $userid; // Filter from parameters +if (empty($user->rights->salaries->readall) && empty($useridtofilter)) { + $useridtofilter = $user->getAllChildIds(1); +} + $stats = new SalariesStats($db, $socid, $useridtofilter); @@ -204,7 +208,7 @@ print ''.$langs->tra // User print ''.$langs->trans("Employee").''; print img_picto('', 'user', 'class="pictofixedwidth"'); -print $form->select_dolusers(($userid ? $userid : -1), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); +print $form->select_dolusers(($userid ? $userid : -1), 'userid', 1, '', 0, empty($user->rights->salaries->readall) ? 'hierarchyme' : '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); print ''; // Year print ''.$langs->trans("Year").''; From ec00c6fef2e939532b4a87ff35ba9832d245e133 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Mon, 9 May 2022 09:49:07 +0200 Subject: [PATCH 4/8] line deleted when updated after rapproched Fix an issue that deletes line when we update data after its rappro. --- htdocs/compta/bank/line.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index b3675feb63e..ce8644afe9b 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -607,7 +607,11 @@ if ($result) { print dol_get_fiche_end(); - print '

'; + if (!$objp->rappro) { + print '

'; + }else{ + print '

'; + } print ""; From 017eb99e8603302eeb8c96b3ca73d4feb4b911a7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 9 May 2022 07:53:37 +0000 Subject: [PATCH 5/8] Fixing style errors. --- htdocs/compta/bank/line.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index ce8644afe9b..d1750a0bb94 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -609,9 +609,9 @@ if ($result) { if (!$objp->rappro) { print '

'; - }else{ - print '

'; - } + } else { + print '

'; + } print ""; From 333b22b961507a60156802a2ccbf9b8de9bfc383 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 9 May 2022 14:32:47 +0200 Subject: [PATCH 6/8] fix: limit filename lenght to show glasses --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c01ff5af541..a9f79095242 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -892,7 +892,7 @@ class FormFile } $out .= '>'; $out .= img_mime($file["name"], $langs->trans("File").': '.$file["name"]); - $out .= dol_trunc($file["name"], 150); + $out .= dol_trunc($file["name"], 40); $out .= ''."\n"; $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param); $out .= ''; From 8ef75ecc7c1dd5f47e59c7af5f676cf2870e8ff3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 May 2022 15:27:43 +0200 Subject: [PATCH 7/8] Better fix fox #20807 --- htdocs/compta/bank/line.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index d1750a0bb94..90a35b30c86 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -52,11 +52,12 @@ if (!empty($conf->salaries->enabled)) { $id = GETPOST('rowid', 'int'); -$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int')); +$rowid = GETPOST("rowid", 'int'); +$accountoldid = GETPOST('account', 'int'); // GETPOST('account') is old account id +$accountid = GETPOST('accountid', 'int'); // GETPOST('accountid') is new account id $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); -$rowid = GETPOST("rowid", 'int'); $orig_account = GETPOST("orig_account"); $backtopage = GETPOST('backtopage', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); @@ -68,7 +69,7 @@ if ($user->socid) { $socid = $user->socid; } -$result = restrictedArea($user, 'banque', $accountid, 'bank_account'); +$result = restrictedArea($user, 'banque', $accountoldid, 'bank_account'); if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) { accessforbidden(); } @@ -126,15 +127,19 @@ if ($user->rights->banque->modifier && $action == "update") { $acline->fetch($rowid); $acsource = new Account($db); - $acsource->fetch($id); + $acsource->fetch($accountoldid); $actarget = new Account($db); if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) { // We ask to change bank account $actarget->fetch(GETPOST('accountid', 'int')); } else { - $actarget->fetch($id); + $actarget->fetch($accountoldid); } + if (!($actarget->id > 0)) { + setEventMessages($langs->trans("ErrorFailedToLoadBankAccount"), null, 'errors'); + $error++; + } if ($actarget->courant == Account::TYPE_CASH && GETPOST('value', 'alpha') != 'LIQ') { setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors'); $error++; @@ -228,7 +233,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == $db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."bank"; - $sql .= " SET num_releve=".($num_rel ? "'".$db->escape($num_rel)."'" : "null"); + $sql .= " SET num_releve = ".($num_rel ? "'".$db->escape($num_rel)."'" : "null"); if (empty($num_rel)) { $sql .= ", rappro = 0"; } else { @@ -302,7 +307,6 @@ if ($result) { print ''; print ''; print ''; - print ''; print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0); @@ -607,11 +611,7 @@ if ($result) { print dol_get_fiche_end(); - if (!$objp->rappro) { - print '

'; - } else { - print '

'; - } + print '

'; print ""; From c9a0dd327f8e2886329a56421759f119a7d5d09b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 May 2022 16:04:20 +0200 Subject: [PATCH 8/8] Fix default value --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 4bf8a0e7219..e98a25ddbee 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -271,7 +271,7 @@ function societe_prepare_head(Societe $object) $h++; } - if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'thirdparty') { + if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'thirdparty') { if (!empty($user->rights->partnership->read)) { $langs->load("partnership"); $nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0;