From 25509e74d3b443ee8751fa66606cdaff2e0f143a Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 9 Jul 2020 17:27:14 +0200 Subject: [PATCH 1/6] FIX : order by amount ht uses wrong column --- htdocs/product/stats/facture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 109332a1f98..2c38f74c03c 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -225,7 +225,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $option, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "f.total", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "d.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; From fd955519404f0488df23e1f28b8ce2beb28ebd20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 18:07:51 +0200 Subject: [PATCH 2/6] Fix upload of file in import module Conflicts: htdocs/core/lib/security.lib.php --- htdocs/core/lib/security.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 7c4a10f3a18..225dab1332c 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -309,6 +309,10 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; } + } elseif ($feature == 'import') { + if (!$user->rights->import->run) { $createok = 0; $nbko++; } + } elseif ($feature == 'ecm') { + if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; } } elseif (!empty($feature2)) // This is for permissions on one level { From a36c6a8ddaadea8787b8107f092dca19c37adb19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Jul 2020 02:46:59 +0200 Subject: [PATCH 3/6] FIX #14209 --- htdocs/projet/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index c9007dc6d8a..1fb01bb52bb 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1112,7 +1112,7 @@ elseif ($object->id > 0) // Description print ''.$langs->trans("Description").''; - print nl2br($object->description); + print dol_htmlentitiesbr($object->description); print ''; // Categories From 86744a2e0c6644ea12b1c8b561c5b2469c515bc6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Jul 2020 05:13:24 +0200 Subject: [PATCH 4/6] FIX Fails to retraive accounting code of social contribution sometimes --- htdocs/accountancy/journal/bankjournal.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 3372105cd85..69112d6bb52 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -254,6 +254,8 @@ if ($result) { } else { $tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60); } + + // Load of url links to the line into llx_bank $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) //var_dump($i); @@ -320,6 +322,7 @@ if ($result) { $chargestatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2); + $reg = array(); if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { if ($reg[1] == 'socialcontribution') $reg[1] = 'SocialContribution'; @@ -331,11 +334,13 @@ if ($result) { $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); $tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id; + // Retreive the accounting code of the social contribution of the payment from link of payment. + // Note: We have the social contribution id, it can be faster to get accounting code from social contribution id. $sqlmid = 'SELECT cchgsoc.accountancy_code'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc "; $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; + $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."bank_url as bkurl ON bkurl.url_id=paycharg.rowid AND bkurl.type = 'payment_sc'"; $sqlmid .= " WHERE bkurl.fk_bank=".$obj->rowid; dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG); From 79a6246666567034845ce09afb6405cb0cc0b4c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Jul 2020 05:13:24 +0200 Subject: [PATCH 5/6] FIX Fails to retraive accounting code of social contribution sometimes Conflicts: htdocs/accountancy/journal/bankjournal.php --- htdocs/accountancy/journal/bankjournal.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index d849496d965..699bbf1eebc 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -254,7 +254,9 @@ if ($result) { } else { $tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60); } - $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) + + // Load of url links to the line into llx_bank + $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) //var_dump($i); //var_dump($tabpay); @@ -319,7 +321,8 @@ if ($result) { $chargestatic->id = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); + $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2); + $reg = array(); if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { if ($reg[1] == 'socialcontribution') $reg[1] = 'SocialContribution'; @@ -331,12 +334,14 @@ if ($result) { $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); $tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id; + // Retreive the accounting code of the social contribution of the payment from link of payment. + // Note: We have the social contribution id, it can be faster to get accounting code from social contribution id. $sqlmid = 'SELECT cchgsoc.accountancy_code'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; - $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; + $sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc"; + $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; + $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; + $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."bank_url as bkurl ON bkurl.url_id=paycharg.rowid AND bkurl.type = 'payment_sc'"; + $sqlmid .= " WHERE bkurl.fk_bank=".$obj->rowid; dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid); From 071b909d38a626c9e3b28cfb24473789eae6933c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Jul 2020 05:13:24 +0200 Subject: [PATCH 6/6] FIX Fails to retraive accounting code of social contribution sometimes Conflicts: htdocs/accountancy/journal/bankjournal.php --- htdocs/accountancy/journal/bankjournal.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index d2ad7a0503e..070e58f5c0d 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -255,7 +255,9 @@ if ($result) { } else { $tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60); } - $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) + + // Load of url links to the line into llx_bank + $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) //var_dump($i); //var_dump($tabpay); @@ -322,7 +324,8 @@ if ($result) { $chargestatic->id = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id']; - $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); + $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2); + $reg = array(); if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { if ($reg[1] == 'socialcontribution') $reg[1] = 'SocialContribution'; @@ -334,12 +337,14 @@ if ($result) { $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); $tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id; + // Retreive the accounting code of the social contribution of the payment from link of payment. + // Note: We have the social contribution id, it can be faster to get accounting code from social contribution id. $sqlmid = 'SELECT cchgsoc.accountancy_code'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; - $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; + $sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc"; + $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; + $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; + $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."bank_url as bkurl ON bkurl.url_id=paycharg.rowid AND bkurl.type = 'payment_sc'"; + $sqlmid .= " WHERE bkurl.fk_bank=".$obj->rowid; dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid);