From 74795b87e543cf566b9e277d60ce23f871d7c7e8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 31 Jan 2021 12:46:54 +0100 Subject: [PATCH 01/29] FIX avoid undefined url and missing token --- htdocs/core/js/lib_head.js.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 382f12840d7..7d2888e870e 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -529,6 +529,7 @@ function hideMessage(fieldId,message) { * @param string token Token */ function setConstant(url, code, input, entity, strict, forcereload, userid, token) { + var $url = url; /* avoid undefined url */ $.post( url, { action: "set", name: code, @@ -573,11 +574,12 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke $.each(data, function(key, value) { $("#set_" + key).hide(); $("#del_" + key).show(); - $.get( url, { + $.post( $url, { action: "set", name: key, value: value, - entity: entity + entity: entity, + token: token }); }); } @@ -602,6 +604,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke * @param string token Token */ function delConstant(url, code, input, entity, strict, forcereload, userid, token) { + var $url = url; /* avoid undefined url */ $.post( url, { action: "del", name: code, @@ -643,10 +646,11 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke $.each(data, function(key, value) { $("#del_" + value).hide(); $("#set_" + value).show(); - $.get( url, { + $.get( $url, { action: "del", name: value, - entity: entity + entity: entity, + token: token }); }); } From 5217a38359ebc0498ddfac53f74778b8106823e5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 31 Jan 2021 12:51:13 +0100 Subject: [PATCH 02/29] FIX use post instead get --- htdocs/core/js/lib_head.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 7d2888e870e..151c15f3f48 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -646,7 +646,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke $.each(data, function(key, value) { $("#del_" + value).hide(); $("#set_" + value).show(); - $.get( $url, { + $.post( $url, { action: "del", name: value, entity: entity, From 0a3d1ab92ef1016d36c70a45fbc37f3c0a01f32e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 23 Feb 2021 16:56:45 +0100 Subject: [PATCH 03/29] FIX use var "saved_url" instead global var "$url" --- htdocs/core/js/lib_head.js.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 83a161e35d6..c0d4f0f3829 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -530,7 +530,7 @@ function hideMessage(fieldId,message) { * @param string token Token */ function setConstant(url, code, input, entity, strict, forcereload, userid, token) { - var $url = url; /* avoid undefined url */ + var saved_url = url; /* avoid undefined url */ $.post( url, { action: "set", name: code, @@ -575,7 +575,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke $.each(data, function(key, value) { $("#set_" + key).hide(); $("#del_" + key).show(); - $.post( url, { + $.post( saved_url, { action: "set", name: key, value: value, @@ -605,7 +605,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke * @param string token Token */ function delConstant(url, code, input, entity, strict, forcereload, userid, token) { - var $url = url; /* avoid undefined url */ + var saved_url = url; /* avoid undefined url */ $.post( url, { action: "del", name: code, @@ -647,7 +647,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke $.each(data, function(key, value) { $("#del_" + value).hide(); $("#set_" + value).show(); - $.post( url, { + $.post( saved_url, { action: "del", name: value, entity: entity, From d5566dbf8f4d5d71fe655f923506fbb550941f11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Feb 2021 19:18:03 +0100 Subject: [PATCH 04/29] FIX #16431 --- .../bookkeeping/balancebymonth.php | 136 ------------------ .../thirdparty_lettering_customer.php | 2 +- .../thirdparty_lettering_supplier.php | 2 +- .../class/accountancyexport.class.php | 64 ++++----- .../accountancy/class/bookkeeping.class.php | 26 ++-- htdocs/core/modules/modAccounting.class.php | 6 +- .../install/mysql/migration/12.0.0-13.0.0.sql | 5 + .../tables/llx_accounting_bookkeeping.sql | 2 +- 8 files changed, 61 insertions(+), 182 deletions(-) delete mode 100644 htdocs/accountancy/bookkeeping/balancebymonth.php diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php deleted file mode 100644 index f27d535f57c..00000000000 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ /dev/null @@ -1,136 +0,0 @@ - - * Copyright (C) 2013-2014 Alexandre Spangaro - * Copyright (C) 2014 Florian Henry - * Copyright (C) 2015 Jean-François Ferry - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/** - * \file htdocs/accountancy/bookkeeping/balancebymonth.php - * \ingroup Accountancy (Double entries) - * \brief Balance by month - */ -require '../../main.inc.php'; - -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array("bills", "compta", "accountancy", "other")); - -// Filter -$year = GETPOST("year", 'int'); -if ($year == 0) { - $year_current = strftime("%Y", time()); - $year_start = $year_current; -} else { - $year_current = $year; - $year_start = $year; -} - - -/* - * View - */ - -llxHeader('', $langs->trans("Bookkeeping")); - -$textprevyear = ''.img_previous().''; -$textnextyear = ' '.img_next().''; - -print load_fiche_titre($langs->trans("AccountBalanceByMonth").' '.$textprevyear.' '.$langs->trans("Year").' '.$year_start.' '.$textnextyear); - -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet as fd"; -$sql .= " , ".MAIN_DB_PREFIX."facture as f"; -$sql .= " WHERE fd.fk_code_ventilation = 0"; -$sql .= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1;"; - -dol_syslog('accountancy/bookkeeping/balancebymonth.php:: $sql='.$sql); -$result = $db->query($sql); -if ($result) { - $row = $db->fetch_row($result); - $nbfac = $row[0]; - - $db->free($result); -} - -$y = $year_current; - -print ''; -print ''; -print ''; -for ($i = 1; $i <= 12; $i++) -{ - print ''; -} -print ''; -print ''; - -$sql = "SELECT bk.numero_compte AS 'compte',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=1,bk.montant,0)),2) AS 'Janvier',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=2,bk.montant,0)),2) AS 'Fevrier',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=3,bk.montant,0)),2) AS 'Mars',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=4,bk.montant,0)),2) AS 'Avril',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=5,bk.montant,0)),2) AS 'Mai',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=6,bk.montant,0)),2) AS 'Juin',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=7,bk.montant,0)),2) AS 'Juillet',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=8,bk.montant,0)),2) AS 'Aout',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=9,bk.montant,0)),2) AS 'Septembre',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=10,bk.montant,0)),2) AS 'Octobre',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=11,bk.montant,0)),2) AS 'Novembre',"; -$sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=12,bk.montant,0)),2) AS 'Decembre',"; -$sql .= " ROUND(SUM(bk.montant),2) as 'Total'"; -$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; -$sql .= " WHERE bk.doc_date >= '".$db->idate(dol_get_first_day($y, 1, false))."'"; -$sql .= " AND bk.doc_date <= '".$db->idate(dol_get_last_day($y, 12, false))."'"; -$sql .= " GROUP BY bk.numero_compte"; - -$resql = $db->query($sql); -if ($resql) { - $i = 0; - $num = $db->num_rows($resql); - - while ($i < $num) { - $row = $db->fetch_row($resql); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $i++; - } - $db->free($resql); -} else { - print $db->lasterror(); -} -print "
'.$langs->trans("Label").''.$langs->trans("MonthShort".sprintf("%02s", $i)).''.$langs->trans("Total").'
'.length_accountg($row[0]).''.price($row[1]).''.price($row[2]).''.price($row[3]).''.price($row[4]).''.price($row[5]).''.price($row[6]).''.price($row[7]).''.price($row[8]).''.price($row[9]).''.price($row[10]).''.price($row[11]).''.price($row[12]).''.price($row[13]).'
\n"; - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index e831e21f814..8635946ad38 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -145,7 +145,7 @@ print dol_get_fiche_end(); $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; -$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code "; +$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; $sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )"; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index b5620f3ec25..1558fe9b288 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -144,7 +144,7 @@ print dol_get_fiche_end(); $sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, "; $sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, "; -$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code, bk.date_validated "; +$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code, bk.date_validated "; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk"; $sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta_fournisseur)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)."' )"; if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) { diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 3e8aab64479..25bea39f22f 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -359,7 +359,7 @@ class AccountancyExport print length_accountg($line->numero_compte).$separator; print length_accounta($line->subledger_account).$separator; print $line->sens.$separator; - print price2fec(abs($line->montant)).$separator; + print price2fec(abs($line->debit - $line->credit)).$separator; print dol_string_unaccent($line->label_operation).$separator; print dol_string_unaccent($line->doc_ref); print $end_line; @@ -387,11 +387,11 @@ class AccountancyExport print $line->label_operation.$separator; print $date.$separator; if ($line->sens == 'D') { - print price($line->montant).$separator; + print price($line->debit).$separator; print ''.$separator; } elseif ($line->sens == 'C') { print ''.$separator; - print price($line->montant).$separator; + print price($line->credit).$separator; } print $line->doc_ref.$separator; print $line->label_operation.$separator; @@ -492,7 +492,7 @@ class AccountancyExport $Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12); $Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11); $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).dol_string_unaccent($data->label_operation), 25), 25); - $Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT); + $Tab['montant'] = str_pad(abs($data->debit - $data->credit), 13, ' ', STR_PAD_LEFT); $Tab['type_montant'] = str_pad($data->sens, 1); $Tab['vide'] = str_repeat(' ', 18); $Tab['intitule_compte'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 34), 34); @@ -539,6 +539,7 @@ class AccountancyExport $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20); // Credit invoice - invert sens + /* if ($data->montant < 0) { if ($data->sens == 'C') { $Tab['sens'] = 'D'; @@ -549,10 +550,12 @@ class AccountancyExport } else { $Tab['sens'] = $data->sens; // C or D $Tab['signe_montant'] = '+'; - } - + }*/ + $Tab['sens'] = $data->sens; // C or D + $Tab['signe_montant'] = '+'; + // The amount must be in centimes without decimal points. - $Tab['montant'] = str_pad(abs($data->montant * 100), 12, '0', STR_PAD_LEFT); + $Tab['montant'] = str_pad(abs(($data->debit - $abs->credit) * 100), 12, '0', STR_PAD_LEFT); $Tab['contrepartie'] = str_repeat(' ', 8); // Force date format : %d%m%y @@ -637,13 +640,13 @@ class AccountancyExport $Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0'); if ($data->sens == 'D') { - $Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); + $Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); } else { $Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); - $Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); + $Tab['montant_crebit'] = str_pad(number_format($data->credit), 2, ',', ''), 13, ' ', STR_PAD_LEFT); } $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); @@ -704,7 +707,7 @@ class AccountancyExport //print substr(length_accountg($line->numero_compte), 0, 2) . $separator; print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"'.$separator; print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator; - print price2num(abs($line->montant)).$separator; + print price2num(abs($line->debit - $line->credit)).$separator; print $line->sens.$separator; print $date.$separator; //print 'EUR'; @@ -744,7 +747,7 @@ class AccountancyExport print self::toAnsi($line->doc_ref).$separator; print price($line->debit).$separator; print price($line->credit).$separator; - print price($line->montant).$separator; + print price(abs($line->debit - $line->credit)).$separator; print $line->sens.$separator; print $line->lettering_code.$separator; print $line->code_journal; @@ -807,7 +810,7 @@ class AccountancyExport $tab[] = length_accounta($line->subledger_account); $tab[] = price2num($line->debit); $tab[] = price2num($line->credit); - $tab[] = price2num($line->montant); + $tab[] = price2num($line->debit - $line->credit); $tab[] = $line->code_journal; print implode($separator, $tab).$this->end_line; @@ -849,7 +852,7 @@ class AccountancyExport foreach ($objectLines as $line) { if ($line->debit == 0 && $line->credit == 0) { - unset($array[$line]); + //unset($array[$line]); } else { $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_document = dol_print_date($line->doc_date, '%Y%m%d'); @@ -950,7 +953,7 @@ class AccountancyExport foreach ($objectLines as $line) { if ($line->debit == 0 && $line->credit == 0) { - unset($array[$line]); + //unset($array[$line]); } else { $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_document = dol_print_date($line->doc_date, '%Y%m%d'); @@ -1105,12 +1108,7 @@ class AccountancyExport // Code print '""'.$this->separator; // Netto - if ($line->montant >= 0) - { - print $line->montant.$this->separator; - } else { - print ($line->montant * -1).$this->separator; - } + print abs($line->debit - $line->credit).$this->separator; // Steuer print "0.00".$this->separator; // FW-Betrag @@ -1190,13 +1188,13 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if ($line->montant < 0) { + if (($line->debit - $line->credit) > 0) { $nature_piece = 'AF'; } else { $nature_piece = 'FF'; } } elseif ($line->doc_type == 'customer_invoice') { - if ($line->montant < 0) { + if (($line->debit - $line->credit) < 0) { $nature_piece = 'AC'; } else { $nature_piece = 'FC'; @@ -1220,7 +1218,7 @@ class AccountancyExport print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead // MONT - print price(abs($line->montant), 0, '', 1, 2, 2).$separator; + print price(abs($line->debit - $line->credit), 0, '', 1, 2, 2).$separator; // CODC print $line->sens.$separator; // CPTG @@ -1452,13 +1450,13 @@ class AccountancyExport print $date_lim_reglement.$separator; // CNPI if ($line->doc_type == 'supplier_invoice') { - if ($line->montant < 0) { + if (($line->debit - $line->credit) > 0) { $nature_piece = 'AF'; } else { $nature_piece = 'FF'; } } elseif ($line->doc_type == 'customer_invoice') { - if ($line->montant < 0) { + if (($line->debit - $line->credit) < 0) { $nature_piece = 'AC'; } else { $nature_piece = 'FC'; @@ -1482,7 +1480,7 @@ class AccountancyExport print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead // MONT - print price(abs($line->montant), 0, '', 1, 2).$separator; + print price(abs($line->debit - $line->credit), 0, '', 1, 2).$separator; // CODC print $line->sens.$separator; // CPTG @@ -1602,7 +1600,7 @@ class AccountancyExport print self::trunc($line->label_compte, 60).$separator; //Account label print self::trunc($line->doc_ref, 20).$separator; //Piece print self::trunc($line->label_operation, 60).$separator; //Operation label - print price(abs($line->montant)).$separator; //Amount + print price(abs($line->debit - $line->credit)).$separator; //Amount print $line->sens.$separator; //Direction print $separator; //Analytic print $separator; //Analytic @@ -1631,7 +1629,7 @@ class AccountancyExport $supplier_invoices_infos = array(); foreach ($objectLines as $line) { if ($line->debit == 0 && $line->credit == 0) { - unset($array[$line]); + //unset($array[$line]); } else { $date = dol_print_date($line->doc_date, '%d/%m/%Y'); @@ -1699,8 +1697,8 @@ class AccountancyExport print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator; //Devise print 'EUR' . $this->separator; - //Montant - print price2num(abs($line->montant)) . $this->separator; + //Amount + print price2num(abs($line->debit - $line->credit)) . $this->separator; //Sens print $line->sens . $this->separator; //Code lettrage @@ -1726,14 +1724,14 @@ class AccountancyExport foreach ($objectLines as $line) { if ($line->debit == 0 && $line->credit == 0) { - unset($array[$line]); + //unset($array[$line]); } else { $date = dol_print_date($line->doc_date, '%d%m%Y'); print $line->id . $this->separator; print $date . $this->separator; print substr($line->code_journal, 0, 4) . $this->separator; - if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { + if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { // TODO No hard code value print length_accountg($line->subledger_account) . $this->separator; } else { print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; @@ -1742,7 +1740,7 @@ class AccountancyExport //print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator; print '"' . dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1) . '"' . $this->separator; print '"' . dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . '"' . $this->separator; - print price2num($line->montant) . $this->separator; + print price2num(abs($line->debit - $line->credit)) . $this->separator; print $line->sens . $this->separator; print $date . $this->separator; print $this->separator; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0c7dd333901..957259c946c 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -135,6 +135,7 @@ class BookKeeping extends CommonObject /** * @var float FEC:Amount (Not necessary) + * @deprecated No more used */ public $amount; @@ -239,6 +240,9 @@ class BookKeeping extends CommonObject if (isset($this->montant)) { $this->montant = (float) $this->montant; } + if (isset($this->amount)) { + $this->amount = (float) $this->amount; + } if (isset($this->sens)) { $this->sens = trim($this->sens); } @@ -554,6 +558,9 @@ class BookKeeping extends CommonObject if (isset($this->montant)) { $this->montant = trim($this->montant); } + if (isset($this->amount)) { + $this->amount = trim($this->amount); + } if (isset($this->sens)) { $this->sens = trim($this->sens); } @@ -695,7 +702,7 @@ class BookKeeping extends CommonObject $sql .= " t.label_operation,"; $sql .= " t.debit,"; $sql .= " t.credit,"; - $sql .= " t.montant,"; + $sql .= " t.montant as amount,"; $sql .= " t.sens,"; $sql .= " t.fk_user_author,"; $sql .= " t.import_key,"; @@ -734,7 +741,8 @@ class BookKeeping extends CommonObject $this->label_operation = $obj->label_operation; $this->debit = $obj->debit; $this->credit = $obj->credit; - $this->montant = $obj->montant; + $this->montant = $obj->amount; + $this->amount = $obj->amount; $this->sens = $obj->sens; $this->fk_user_author = $obj->fk_user_author; $this->import_key = $obj->import_key; @@ -1197,8 +1205,8 @@ class BookKeeping extends CommonObject if (isset($this->credit)) { $this->credit = trim($this->credit); } - if (isset($this->montant)) { - $this->montant = trim($this->montant); + if (isset($this->amount)) { + $this->amount = trim($this->amount); } if (isset($this->sens)) { $this->sens = trim($this->sens); @@ -1641,7 +1649,7 @@ class BookKeeping extends CommonObject $sql = "SELECT rowid, doc_date, doc_type,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " numero_compte, label_compte, label_operation, debit, credit,"; - $sql .= " montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation"; + $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")"; @@ -1667,7 +1675,8 @@ class BookKeeping extends CommonObject $line->label_operation = $obj->label_operation; $line->debit = $obj->debit; $line->credit = $obj->credit; - $line->montant = $obj->montant; + $line->montant = $obj->amount; + $line->amount = $obj->amount; $line->sens = $obj->sens; $line->code_journal = $obj->code_journal; $line->journal_label = $obj->journal_label; @@ -1700,7 +1709,7 @@ class BookKeeping extends CommonObject $sql = "SELECT rowid, doc_date, doc_type,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " numero_compte, label_compte, label_operation, debit, credit,"; - $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; + $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE entity IN (".getEntity('accountancy').")"; @@ -1730,7 +1739,8 @@ class BookKeeping extends CommonObject $line->label_operation = $obj->label_operation; $line->debit = $obj->debit; $line->credit = $obj->credit; - $line->montant = $obj->montant; + $line->montant = $obj->amount; + $line->amount = $obj->amount; $line->sens = $obj->sens; $line->code_journal = $obj->code_journal; $line->piece_num = $obj->piece_num; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 811dd57544e..057122ec648 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -292,7 +292,8 @@ class modAccounting extends DolibarrModules 'b.subledger_label'=>'SubledgerAccountLabel', 'b.label_operation'=>'LabelOperation', 'b.debit'=>"Debit", - 'b.credit'=>"Credit" + 'b.credit'=>"Credit", + 'b.sens'=>'Direction' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit ); $this->import_fieldshidden_array[$r] = array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r] = array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); @@ -309,7 +310,8 @@ class modAccounting extends DolibarrModules 'b.subledger_label'=>'', 'b.label_operation'=>"Sale of ABC", 'b.debit'=>"0", - 'b.credit'=>"100" + 'b.credit'=>"100", + 'b.sens'=>'C' // This field is still used by accounting export. We can remove it once it has been replace into accountancyexport.class.php by a detection using ->debit and ->credit ); // Chart of accounts diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index a19f8d34279..cc0bb4224b2 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -579,3 +579,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4); + +-- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8) NULL; +-- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN montant DROP NOT NULL; + + diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index cf7897bf7a2..90de3fd02fe 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -35,7 +35,7 @@ CREATE TABLE llx_accounting_bookkeeping label_operation varchar(255), -- FEC:EcritureLib | label of the operation debit double(24,8) NOT NULL, -- FEC:Debit credit double(24,8) NOT NULL, -- FEC:Credit - montant double(24,8) NOT NULL, -- FEC:Montant (Not necessary) + montant double(24,8) NULL, -- FEC:Montant (Not necessary) sens varchar(1) DEFAULT NULL, -- FEC:Sens (Not necessary) multicurrency_amount double(24,8), -- FEC:Montantdevise multicurrency_code varchar(255), -- FEC:Idevise From 2cc635fd096c93e06ea677608672748b27075904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Feb 2021 08:00:02 +0100 Subject: [PATCH 05/29] FIX https://github.com/Dolibarr/dolibarr/issues/16465 --- htdocs/core/class/commonobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 730546e0e6b..605df1397b0 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2190,7 +2190,8 @@ abstract class CommonObject $this->updateline( $line->id, ($line->description ? $line->description : $line->desc), $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, false, - $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice + $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, + $line->ref_supplier ); break; case 'invoice_supplier': From 8bfa7565bdd8c14f90881ed96cd89f1b7ebc1b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 27 Feb 2021 08:52:40 +0100 Subject: [PATCH 06/29] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 605df1397b0..e2005dad7d8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2198,7 +2198,8 @@ abstract class CommonObject $this->updateline( $line->id, ($line->description ? $line->description : $line->desc), $line->subprice, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->qty, 0, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, false, - $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice + $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, + $line->ref_supplier ); break; default: From 4cf2d2317faa72b404c1165214f3fce3c9198ad4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2021 19:16:14 +0100 Subject: [PATCH 07/29] FIX Status in popup of member in widget --- htdocs/core/boxes/box_members.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 2d0ad45a266..8bc47731325 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -117,6 +117,10 @@ class box_members extends ModeleBoxes $memberstatic->morphy = $objp->morphy; $memberstatic->company = $objp->company; $memberstatic->statut = $objp->status; + $memberstatic->date_creation = $datec; + $memberstatic->date_modification = $datem; + $memberstatic->need_subscription = $objp->subscription; + $memberstatic->datefin = $this->db->jdate($objp->date_end_subscription); if (!empty($objp->fk_soc)) { $memberstatic->socid = $objp->fk_soc; From 753b1d1e116fee2794f1c5b855098d5b7a39c4a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Feb 2021 19:43:56 +0100 Subject: [PATCH 08/29] FIX status on tooltip on widgets --- htdocs/core/boxes/box_factures.php | 8 +++++--- htdocs/core/boxes/box_factures_fourn.php | 10 +++++++--- htdocs/core/boxes/box_factures_fourn_imp.php | 11 +++++++---- htdocs/core/boxes/box_factures_imp.php | 8 +++++--- htdocs/core/boxes/box_ficheinter.php | 5 +++-- htdocs/core/boxes/box_propales.php | 8 +++++--- htdocs/core/boxes/box_supplier_orders.php | 5 +++-- .../boxes/box_supplier_orders_awaiting_reception.php | 7 +++---- htdocs/core/class/commonobject.class.php | 4 ++++ htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++++ 11 files changed, 49 insertions(+), 27 deletions(-) diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 011342d8a30..12875bd914c 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -93,7 +93,7 @@ class box_factures extends ModeleBoxes $sql .= ", f.tva as total_tva"; $sql .= ", f.total_ttc"; $sql .= ", f.datef as df"; - $sql .= ", f.paye, f.fk_statut, f.datec, f.tms"; + $sql .= ", f.paye, f.fk_statut as status, f.datec, f.tms"; $sql .= ", f.date_lim_reglement as datelimite"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -131,8 +131,10 @@ class box_factures extends ModeleBoxes $facturestatic->total_ht = $objp->total_ht; $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; - $facturestatic->statut = $objp->fk_statut; + $facturestatic->statut = $objp->status; + $facturestatic->status = $objp->status; $facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite); + $facturestatic->alreadypaid = $objp->paye; $societestatic->id = $objp->socid; $societestatic->name = $objp->name; @@ -181,7 +183,7 @@ class box_factures extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3), + 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->paye), ); $line++; diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 26f24d41ab3..ba8873280f8 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -86,6 +86,8 @@ class box_factures_fourn extends ModeleBoxes if ($user->rights->fournisseur->facture->lire) { + $langs->load("bills"); + $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; $sql .= ", s.logo, s.email, s.entity"; @@ -93,7 +95,7 @@ class box_factures_fourn extends ModeleBoxes $sql .= ", f.total_ht"; $sql .= ", f.total_tva"; $sql .= ", f.total_ttc"; - $sql .= ", f.paye, f.fk_statut"; + $sql .= ", f.paye, f.fk_statut as status"; $sql .= ', f.datef as df'; $sql .= ', f.datec as datec'; $sql .= ', f.date_lim_reglement as datelimite, f.tms, f.type'; @@ -118,6 +120,7 @@ class box_factures_fourn extends ModeleBoxes while ($line < $num) { $objp = $this->db->fetch_object($result); + $datelimite = $this->db->jdate($objp->datelimite); $date = $this->db->jdate($objp->df); $datem = $this->db->jdate($objp->tms); @@ -128,7 +131,8 @@ class box_factures_fourn extends ModeleBoxes $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; $facturestatic->date_echeance = $datelimite; - $facturestatic->statut = $objp->fk_statut; + $facturestatic->statut = $objp->status; + $facturestatic->status = $objp->status; $facturestatic->ref_supplier = $objp->ref_supplier; $thirdpartystatic->id = $objp->socid; @@ -182,7 +186,7 @@ class box_factures_fourn extends ModeleBoxes $alreadypaid = $fac->getSommePaiement(); $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type), + 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type), ); $line++; diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 99848d916f4..585566b78e3 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -82,6 +82,8 @@ class box_factures_fourn_imp extends ModeleBoxes if ($user->rights->fournisseur->facture->lire) { + $langs->load("bills"); + $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; $sql .= ", s.logo, s.email, s.entity"; @@ -90,13 +92,13 @@ class box_factures_fourn_imp extends ModeleBoxes $sql .= ", f.total_ht as total_ht"; $sql .= ", f.tva as total_tva"; $sql .= ", f.total_ttc"; - $sql .= ", f.paye, f.fk_statut, f.type"; + $sql .= ", f.paye, f.fk_statut as status, f.type"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."facture_fourn as f"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND f.entity = ".$conf->entity; - $sql .= " AND f.paye=0"; + $sql .= " AND f.paye = 0"; $sql .= " AND fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; @@ -126,7 +128,8 @@ class box_factures_fourn_imp extends ModeleBoxes $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; $facturestatic->date_echeance = $datelimite; - $facturestatic->statut = $objp->fk_statut; + $facturestatic->statut = $objp->status; + $facturestatic->status = $objp->status; $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; @@ -173,7 +176,7 @@ class box_factures_fourn_imp extends ModeleBoxes $alreadypaid = $fac->getSommePaiement(); $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $alreadypaid, $objp->type), + 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $alreadypaid, $objp->type), ); $line++; diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index b47f948f4ca..0b93ea3267c 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -98,7 +98,7 @@ class box_factures_imp extends ModeleBoxes $sql .= ", f.total as total_ht"; $sql .= ", f.tva as total_tva"; $sql .= ", f.total_ttc"; - $sql .= ", f.paye, f.fk_statut, f.rowid as facid"; + $sql .= ", f.paye, f.fk_statut as status, f.rowid as facid"; $sql .= ", sum(pf.amount) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -136,8 +136,10 @@ class box_factures_imp extends ModeleBoxes $facturestatic->total_ht = $objp->total_ht; $facturestatic->total_tva = $objp->total_tva; $facturestatic->total_ttc = $objp->total_ttc; - $facturestatic->statut = $objp->fk_statut; + $facturestatic->statut = $objp->status; + $facturestatic->status = $objp->status; $facturestatic->date_lim_reglement = $this->db->jdate($objp->datelimite); + $facturestatic->alreadypaid = $objp->paye; $societestatic->id = $objp->socid; $societestatic->name = $objp->name; @@ -186,7 +188,7 @@ class box_factures_imp extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 3, $objp->am), + 'text' => $facturestatic->LibStatut($objp->paye, $objp->status, 3, $objp->am), ); $line++; diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index 6cc213f98cb..186d57b831a 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -82,7 +82,7 @@ class box_ficheinter extends ModeleBoxes if (!empty($user->rights->ficheinter->lire)) { - $sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut"; + $sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut as status"; $sql .= ", f.datec"; $sql .= ", f.date_valid as datev"; $sql .= ", f.tms as datem"; @@ -113,7 +113,8 @@ class box_ficheinter extends ModeleBoxes $objp = $this->db->fetch_object($resql); $datec = $this->db->jdate($objp->datec); - $ficheinterstatic->statut = $objp->fk_statut; + $ficheinterstatic->statut = $objp->status; + $ficheinterstatic->status = $objp->status; $ficheinterstatic->id = $objp->rowid; $ficheinterstatic->ref = $objp->ref; diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index f98e0f1e347..a8b7c0190dd 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -88,7 +88,7 @@ class box_propales extends ModeleBoxes $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.logo, s.email, s.entity"; - $sql .= ", p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms"; + $sql .= ", p.rowid, p.ref, p.fk_statut as status, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -121,6 +121,8 @@ class box_propales extends ModeleBoxes $propalstatic->total_ht = $objp->total_ht; $propalstatic->total_tva = $objp->total_tva; $propalstatic->total_ttc = $objp->total_ttc; + $propalstatic->statut = $objp->status; + $propalstatic->status = $objp->status; $societestatic->id = $objp->socid; $societestatic->name = $objp->name; @@ -133,7 +135,7 @@ class box_propales extends ModeleBoxes $societestatic->entity = $objp->entity; $late = ''; - if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { + if ($objp->status == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } @@ -162,7 +164,7 @@ class box_propales extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', - 'text' => $propalstatic->LibStatut($objp->fk_statut, 3), + 'text' => $propalstatic->LibStatut($objp->status, 3), ); $line++; diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 151c1df6bcb..dd555edaa96 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -90,7 +90,7 @@ class box_supplier_orders extends ModeleBoxes $sql .= ", c.total_ht"; $sql .= ", c.tva as total_tva"; $sql .= ", c.total_ttc"; - $sql .= ", c.fk_statut"; + $sql .= ", c.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -115,6 +115,7 @@ class box_supplier_orders extends ModeleBoxes $supplierorderstatic->id = $objp->rowid; $supplierorderstatic->ref = $objp->ref; + $supplierorderstatic->statut = $objp->status; $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; @@ -150,7 +151,7 @@ class box_supplier_orders extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right" width="18"', - 'text' => $supplierorderstatic->LibStatut($objp->fk_statut, 3), + 'text' => $supplierorderstatic->LibStatut($objp->status, 3), ); $line++; diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 80fdbc2f4a2..7744a96530f 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -90,7 +90,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $sql .= ", c.total_ht"; $sql .= ", c.tva as total_tva"; $sql .= ", c.total_ttc"; - $sql .= ", c.fk_statut"; + $sql .= ", c.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -115,11 +115,10 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $delivery_date = $this->db->jdate($objp->delivery_date); $datem = $this->db->jdate($objp->tms); - $supplierorderstatic->delivery_date = $delivery_date; - $supplierorderstatic->statut = $objp->fk_statut; - $supplierorderstatic->id = $objp->rowid; $supplierorderstatic->ref = $objp->ref; + $supplierorderstatic->delivery_date = $delivery_date; + $supplierorderstatic->statut = $objp->status; $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0b4565ab08f..013e4670775 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -485,6 +485,10 @@ abstract class CommonObject */ public $sendtoid; + /** + * @var float Amount already paid (used to show correct status) + */ + public $alreadypaid; /** * @var array List of child tables. To test if we can delete object. diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e2889c4d6d3..21457b37848 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3272,7 +3272,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'help', 'holiday', 'intervention', 'label', 'language', 'link', 'list', 'listlight', 'lot', 'map-marker-alt', 'member', 'money-bill-alt', 'mrp', 'note', 'next', - 'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom', + 'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billr', 'object_billd', 'object_bom', 'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice', @@ -3312,7 +3312,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $arrayconvpictotofa = array( 'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book', - 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes', + 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billr'=>'file-invoice-dollar', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'conversation'=>'comments', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly', @@ -3381,7 +3381,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $arrayconvpictotomorcess = array( 'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', - 'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billd'=>'infobox-commande', + 'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande', 'cash-register'=>'infobox-bank_account', 'contract'=>'infobox-contrat', 'check'=>'font-status4', 'conversation'=>'infobox-contrat', 'donation'=>'infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'infobox-action', 'hrm'=>'infobox-adherent', 'group'=>'infobox-adherent', 'intervention'=>'infobox-contrat', diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 74be7bcf762..d8d9aa7a4a3 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2299,6 +2299,10 @@ class FactureFournisseur extends CommonInvoice if ($this->type == self::TYPE_REPLACEMENT) $label = ''.$langs->transnoentitiesnoconv("InvoiceReplace").''; elseif ($this->type == self::TYPE_CREDIT_NOTE) $label = ''.$langs->transnoentitiesnoconv("CreditNote").''; elseif ($this->type == self::TYPE_DEPOSIT) $label = ''.$langs->transnoentitiesnoconv("Deposit").''; + if (isset($this->status)) { + $alreadypaid = -1; + $label .= ' '.$this->getLibStatut(5, $alreadypaid); + } if (!empty($this->ref)) $label .= '
'.$langs->trans('Ref').': '.$this->ref; if (!empty($this->ref_supplier)) From 3a19cbb062550b3edf054ab655c36071da7848c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 12:47:24 +0100 Subject: [PATCH 09/29] FIX #16420 #16423 #16488 #16477 --- htdocs/admin/mails_templates.php | 2 + htdocs/core/class/html.formmail.class.php | 137 +++++++++++++--------- 2 files changed, 86 insertions(+), 53 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 6538d5c3011..615dd7041e3 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -840,6 +840,7 @@ if ($resql) print "\n"; } else { + // If template is for a module, check module is enabled. if ($obj->module) { $tempmodulekey = $obj->module; if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) { @@ -847,6 +848,7 @@ if ($resql) continue; } } + $keyforobj = 'type_template'; if (!in_array($obj->$keyforobj, array_keys($elementList))) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 46fcd5e331b..14e0d9c02d1 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -329,9 +329,8 @@ class FormMail extends Form // Load translation files required by the page $langs->loadLangs(array('other', 'mails')); - // Clear temp files. Must be done at beginning, before call of triggers - if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) - { + // Clear temp files. Must be done before call of triggers, at beginning (mode = init), or when we select a new template + if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { $this->clear_attached_files(); } @@ -1201,6 +1200,8 @@ class FormMail extends Form */ public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '') { + global $conf; + $ret = new ModelMail(); if ($id == -2 && empty($label)) { @@ -1214,7 +1215,7 @@ class FormMail extends Form $languagetosearchmain = $tmparray[0].'_'.strtoupper($tmparray[0]); if ($languagetosearchmain == $languagetosearch) $languagetosearchmain = ''; - $sql = "SELECT rowid, label, topic, joinfiles, content, content_lines, lang"; + $sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang"; $sql .= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql .= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')"; $sql .= " AND entity IN (".getEntity('c_email_templates').")"; @@ -1226,72 +1227,92 @@ class FormMail extends Form if ($id == -1) $sql .= " AND position=0"; if ($languagetosearch) $sql .= $db->order("position,lang,label", "ASC,DESC,ASC"); // We want line with lang set first, then with lang null or '' else $sql .= $db->order("position,lang,label", "ASC,ASC,ASC"); // If no language provided, we give priority to lang not defined - $sql .= $db->plimit(1); + //$sql .= $db->plimit(1); //print $sql; $resql = $db->query($sql); - if ($resql) + if (!$resql) { - // Get first found + dol_print_error($db); + return -1; + } + + // Get first found + while (1) { $obj = $db->fetch_object($resql); if ($obj) { + // If template is for a module, check module is enabled; if not, take next template + if ($obj->module) { + $tempmodulekey = $obj->module; + if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) { + continue; + } + } + + // If a record was found $ret->id = $obj->rowid; + $ret->module = $obj->module; $ret->label = $obj->label; $ret->lang = $obj->lang; $ret->topic = $obj->topic; $ret->content = $obj->content; $ret->content_lines = $obj->content_lines; $ret->joinfiles = $obj->joinfiles; - } elseif ($id == -2) { - // Not found with the provided label - return -1; - } else { // If there is no template at all - $defaultmessage = ''; - if ($type_template == 'body') { - // Special case to use this->withbody as content - $defaultmessage = $this->withbody; - } elseif ($type_template == 'facture_send') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoice"); - } elseif ($type_template == 'facture_relance') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); - } elseif ($type_template == 'propal_send') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendProposal"); - } elseif ($type_template == 'supplier_proposal_send') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierProposal"); - } elseif ($type_template == 'order_send') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendOrder"); - } elseif ($type_template == 'order_supplier_send') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); - } elseif ($type_template == 'invoice_supplier_send') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); - } elseif ($type_template == 'shipping_send') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendShipping"); - } elseif ($type_template == 'fichinter_send') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter"); - } elseif ($type_template == 'actioncomm_send') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm"); - } elseif ($type_template == 'thirdparty') { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty"); - } elseif (!empty($type_template)) { - $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric"); + break; + } else { + // If no record found + if ($id == -2) { + // Not found with the provided label + return -1; + } else { + // If there is no template at all + $defaultmessage = ''; + + if ($type_template == 'body') { + // Special case to use this->withbody as content + $defaultmessage = $this->withbody; + } elseif ($type_template == 'facture_send') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoice"); + } elseif ($type_template == 'facture_relance') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); + } elseif ($type_template == 'propal_send') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendProposal"); + } elseif ($type_template == 'supplier_proposal_send') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierProposal"); + } elseif ($type_template == 'order_send') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendOrder"); + } elseif ($type_template == 'order_supplier_send') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); + } elseif ($type_template == 'invoice_supplier_send') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); + } elseif ($type_template == 'shipping_send') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendShipping"); + } elseif ($type_template == 'fichinter_send') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter"); + } elseif ($type_template == 'actioncomm_send') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendActionComm"); + } elseif ($type_template == 'thirdparty') { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty"); + } elseif (!empty($type_template)) { + $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric"); + } + + $ret->label = 'default'; + $ret->lang = $outputlangs->defaultlang; + $ret->topic = ''; + $ret->joinfiles = 1; + $ret->content = $defaultmessage; + $ret->content_lines = ''; + + break; } - - $ret->label = 'default'; - $ret->lang = $outputlangs->defaultlang; - $ret->topic = ''; - $ret->joinfiles = 1; - $ret->content = $defaultmessage; - $ret->content_lines = ''; } - - $db->free($resql); - return $ret; - } else { - dol_print_error($db); - return -1; } + + $db->free($resql); + return $ret; } /** @@ -1338,7 +1359,9 @@ class FormMail extends Form */ public function fetchAllEMailTemplate($type_template, $user, $outputlangs, $active = 1) { - $sql = "SELECT rowid, label, topic, content, content_lines, lang, fk_user, private, position"; + global $conf; + + $sql = "SELECT rowid, module, label, topic, content, content_lines, lang, fk_user, private, position"; $sql .= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql .= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')"; $sql .= " AND entity IN (".getEntity('c_email_templates').")"; @@ -1355,6 +1378,14 @@ class FormMail extends Form $this->lines_model = array(); while ($obj = $this->db->fetch_object($resql)) { + // If template is for a module, check module is enabled. + if ($obj->module) { + $tempmodulekey = $obj->module; + if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) { + continue; + } + } + $line = new ModelMail(); $line->id = $obj->rowid; $line->label = $obj->label; From 2ce76133f4e6611ed36013b975b72ce4398b2e07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 12:59:58 +0100 Subject: [PATCH 10/29] FIX #16487 --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a018438bc48..3d06d3cc0e0 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -784,7 +784,7 @@ if (empty($reshook)) } } } - } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) { + } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') { // Define vat_rate $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); $vat_rate = str_replace('*', '', $vat_rate); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d50cbbeeb25..3a519e9801a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -615,7 +615,7 @@ if (empty($reshook)) $result = $object->set_remise($user, GETPOST('remise_percent')); } elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); - } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) { + } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') { // Define vat_rate $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); $vat_rate = str_replace('*', '', $vat_rate); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c871304905f..77c64f26b72 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1878,7 +1878,7 @@ if (empty($reshook)) $_GET["originid"] = $_POST["originid"]; setEventMessages($object->error, $object->errors, 'errors'); } - } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) { + } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') { // Define vat_rate $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); $vat_rate = str_replace('*', '', $vat_rate); From 1149de1aca062a7ffd90600d7e6b5b2540ac1970 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 13:15:24 +0100 Subject: [PATCH 11/29] FIX #16485 --- htdocs/core/tpl/objectline_title.tpl.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 8a7c38f8ada..096c52500da 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -69,13 +69,15 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; - print img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"'); - print ''; - print ''; + + print 'id.'">'.img_edit($langs->trans("UpdateForAllLines"), 0, 'class="clickvatforalllines opacitymedium paddingleft cursorpointer"').''; + //print ''; + if (GETPOST('mode', 'aZ09') == 'vatforalllines') { + print '
'; + print $form->load_tva('vatforalllines', '', $mysoc, $object->thirdparty, 0, 0, '', false, 1); + print ''; + print '
'; + } } print ''; From 0a0c7fdeb151cc1e63a06cde5250d84b67048695 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 21:15:40 +0100 Subject: [PATCH 12/29] FIX hourglass and hide button to pay --- htdocs/public/payment/newpayment.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 8672fa1c2bf..8f3bb23a362 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2089,6 +2089,10 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment } else { + /* Disable button to pay and show hourglass cursor */ + jQuery('#hourglasstopay').show(); + jQuery('#buttontopay').hide(); + stripe.handleCardPayment( clientSecret, cardElement, { payment_method_data: { From 5406de13eefa70a10ca1690a7150966a5f51076c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 21:33:13 +0100 Subject: [PATCH 13/29] css --- htdocs/adherents/subscription/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 05a0567a8d9..eeeafea5d6a 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -418,7 +418,7 @@ while ($i < min($num, $limit)) { // Ref if (!empty($arrayfields['d.ref']['checked'])) { - print ''.$subscription->getNomUrl(1).''; + print ''.$subscription->getNomUrl(1).''; if (!$i) $totalarray['nbfield']++; } // Type From de241eced3dbf36dc7f8bec1b03835dcf85a7a98 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 28 Feb 2021 22:22:20 +0100 Subject: [PATCH 14/29] FIX: Total_ht not show in contract link element --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7f8831bec96..30225e45baa 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7133,7 +7133,7 @@ class Form 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'), 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('invoice').')'), 'contrat'=>array('enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract', - 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'), + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'), From 490faec547f92172e49b0d8bfdfb4649d4fbdff2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 22:44:11 +0100 Subject: [PATCH 15/29] FIX Timezone problems Conflicts: htdocs/core/lib/date.lib.php test/phpunit/DateLibTest.php --- htdocs/core/lib/date.lib.php | 64 +++++++-------------------------- test/phpunit/DateLibTest.php | 68 ++++++++++++++++++++---------------- 2 files changed, 49 insertions(+), 83 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 74b091865ff..4117249a66c 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -620,7 +620,7 @@ function dol_get_first_day_week($day, $month, $year, $gm = false) */ function getGMTEasterDatetime($year) { - $base = new DateTime("$year-03-21"); + $base = new DateTime("$year-03-21", new DateTimeZone("UTC")); $days = easter_days($year); // Return number of days between 21 march and easter day. $tmp = $base->add(new DateInterval("P{$days}D")); return $tmp->getTimestamp(); @@ -628,11 +628,11 @@ function getGMTEasterDatetime($year) /** * Return the number of non working days including saturday and sunday (or not) between 2 dates in timestamp. - * Dates must be UTC with hour, day, min to 0. + * Dates must be UTC with hour, min, sec to 0. * Called by function num_open_day() * - * @param int $timestampStart Timestamp de debut - * @param int $timestampEnd Timestamp de fin + * @param int $timestampStart Timestamp start (UTC with hour, min, sec = 0) + * @param int $timestampEnd Timestamp end (UTC with hour, min, sec = 0) * @param string $country_code Country code * @param int $lastday Last day is included, 0: no, 1:yes * @param int $includesaturday Include saturday as non working day (-1=use setup, 0=no, 1=yes) @@ -721,32 +721,20 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Calculation for the monday of easter date $date_paques = getGMTEasterDatetime($annee); - $date_lundi_paques = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 1, - gmdate("Y", $date_paques) - ); + //print 'PPP'.$date_paques.' '.dol_print_date($date_paques, 'dayhour', 'gmt')." "; + $date_lundi_paques = $date_paques + (3600 * 24); $jour_lundi_paques = gmdate("d", $date_lundi_paques); $mois_lundi_paques = gmdate("m", $date_lundi_paques); if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) $ferie = true; // Easter (monday) + //print 'annee='.$annee.' $jour='.$jour.' $mois='.$mois.' $jour_lundi_paques='.$jour_lundi_paques.' $mois_lundi_paques='.$mois_lundi_paques."\n"; } if (in_array('ascension', $specialdayrule)) { // Calcul du jour de l'ascension (39 days after easter day) $date_paques = getGMTEasterDatetime($annee); - $date_ascension = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 39, - gmdate("Y", $date_paques) - ); + $date_ascension = $date_paques + (3600 * 24 * 39); $jour_ascension = gmdate("d", $date_ascension); $mois_ascension = gmdate("m", $date_ascension); if ($jour_ascension == $jour && $mois_ascension == $mois) $ferie = true; @@ -757,14 +745,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Calculation of "Pentecote" (49 days after easter day) $date_paques = getGMTEasterDatetime($annee); - $date_pentecote = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 49, - gmdate("Y", $date_paques) - ); + $date_pentecote = $date_paques + (3600 * 24 * 49); $jour_pentecote = gmdate("d", $date_pentecote); $mois_pentecote = gmdate("m", $date_pentecote); if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true; @@ -774,14 +755,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Calculation of "Pentecote" (49 days after easter day) $date_paques = getGMTEasterDatetime($annee); - $date_pentecote = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 50, - gmdate("Y", $date_paques) - ); + $date_pentecote = $date_paques + (3600 * 24 * 50); $jour_pentecote = gmdate("d", $date_pentecote); $mois_pentecote = gmdate("m", $date_pentecote); if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true; @@ -792,14 +766,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Viernes Santo $date_paques = getGMTEasterDatetime($annee); - $date_viernes = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) - 2, - gmdate("Y", $date_paques) - ); + $date_viernes = $date_paques - (3600 * 24 * 2); $jour_viernes = gmdate("d", $date_viernes); $mois_viernes = gmdate("m", $date_viernes); if ($jour_viernes == $jour && $mois_viernes == $mois) $ferie = true; @@ -810,14 +777,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', { // Fronleichnam (60 days after easter sunday) $date_paques = getGMTEasterDatetime($annee); - $date_fronleichnam = mktime( - gmdate("H", $date_paques), - gmdate("i", $date_paques), - gmdate("s", $date_paques), - gmdate("m", $date_paques), - gmdate("d", $date_paques) + 60, - gmdate("Y", $date_paques) - ); + $date_fronleichnam = $date_paques + (3600 * 24 * 60); $jour_fronleichnam = gmdate("d", $date_fronleichnam); $mois_fronleichnam = gmdate("m", $date_fronleichnam); if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) $ferie = true; diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 2d5598f49b3..c9ed3be64aa 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -69,7 +69,13 @@ class DateLibTest extends PHPUnit\Framework\TestCase $this->savlangs=$langs; $this->savdb=$db; + $langs->load("admin"); + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + + print "\n".$langs->trans("CurrentTimeZone").' : '.getServerTimeZoneString(); + print "\n".$langs->trans("CurrentHour").' : '.dol_print_date(dol_now('gmt'), 'dayhour', 'tzserver'); + //print " - db ".$db->db; print "\n"; } @@ -139,8 +145,8 @@ class DateLibTest extends PHPUnit\Framework\TestCase $db=$this->savdb; // With same hours - $date1=dol_mktime(0, 0, 0, 1, 1, 2012); - $date2=dol_mktime(0, 0, 0, 1, 2, 2012); + $date1=dol_mktime(0, 0, 0, 1, 1, 2012, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 2, 2012, 'gmt'); $result=num_between_day($date1, $date2, 1); print __METHOD__." result=".$result."\n"; @@ -151,8 +157,8 @@ class DateLibTest extends PHPUnit\Framework\TestCase $this->assertEquals(1, $result); // With different hours - $date1=dol_mktime(0, 0, 0, 1, 1, 2012); - $date2=dol_mktime(12, 0, 0, 1, 2, 2012); + $date1=dol_mktime(0, 0, 0, 1, 1, 2012, 'gmt'); + $date2=dol_mktime(12, 0, 0, 1, 2, 2012, 'gmt'); $result=num_between_day($date1, $date2, 1); print __METHOD__." result=".$result."\n"; @@ -190,26 +196,27 @@ class DateLibTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; - // With same hours - Tuesday/Wednesday jan 2013 - $date1=dol_mktime(0, 0, 0, 1, 1, 2013); - $date2=dol_mktime(0, 0, 0, 1, 2, 2013); - $date3=dol_mktime(0, 0, 0, 1, 3, 2013); + // With same hours - Tuesday/Wednesday jan 2013 + $date1=dol_mktime(0, 0, 0, 1, 1, 2013, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 2, 2013, 'gmt'); + $date3=dol_mktime(0, 0, 0, 1, 3, 2013, 'gmt'); - $result=num_public_holiday($date1, $date2, 'FR', 1); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 closed days (country france) + $result=num_public_holiday($date1, $date2, 'FR', 1); + print __METHOD__." for Tuesday 1 - Wednesday 2 jan 2013 for FR result=".$result."\n"; + $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 closed days (country france) - $result=num_public_holiday($date1, $date2, 'XX', 1); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 closed days (country unknown) + $result=num_public_holiday($date1, $date2, 'XX', 1); + print __METHOD__." for Tuesday 1 - Wednesday 2 jan 2013 for XX result=".$result."\n"; + $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 closed days (country unknown) - $result=num_public_holiday($date2, $date3, 'FR', 1); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(0, $result, 'NumPublicHoliday for Wednesday 2 - Thursday 3 jan 2013 for FR'); // no closed days + print '----'."\n"; + $result=num_public_holiday($date2, $date3, 'FR', 1); + print __METHOD__." for Wednesday 2 - Thursday 3 jan 2013 for FR result=".$result."\n"; + $this->assertEquals(0, $result, 'NumPublicHoliday for Wednesday 2 - Thursday 3 jan 2013 for FR'); // no closed days - // Check with easter monday - $date1=dol_mktime(0, 0, 0, 4, 21, 2019); - $date2=dol_mktime(0, 0, 0, 4, 23, 2019); + // Check with easter monday + $date1=dol_mktime(0, 0, 0, 4, 21, 2019, 'gmt'); + $date2=dol_mktime(0, 0, 0, 4, 23, 2019, 'gmt'); $result=num_public_holiday($date1, $date2, 'XX', 1); print __METHOD__." result=".$result."\n"; @@ -219,9 +226,9 @@ class DateLibTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals(2, $result, 'NumPublicHoliday including eastermonday for FR'); // 1 opened day, 2 closed days (sunday + easter monday) - // Check for sunday/saturday - Friday 4 - Sunday 6 jan 2013 - $date1=dol_mktime(0, 0, 0, 1, 4, 2013); - $date2=dol_mktime(0, 0, 0, 1, 6, 2013); + // Check for sunday/saturday - Friday 4 - Sunday 6 jan 2013 + $date1=dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 6, 2013, 'gmt'); $result=num_public_holiday($date1, $date2, 'FR', 1); print __METHOD__." result=".$result."\n"; @@ -257,10 +264,10 @@ class DateLibTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; - // With same hours - Tuesday/Wednesday jan 2013 - $date1=dol_mktime(0, 0, 0, 1, 1, 2013); - $date2=dol_mktime(0, 0, 0, 1, 2, 2013); - $date3=dol_mktime(0, 0, 0, 1, 3, 2013); + // With same hours - Tuesday/Wednesday jan 2013 + $date1=dol_mktime(0, 0, 0, 1, 1, 2013, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 2, 2013, 'gmt'); + $date3=dol_mktime(0, 0, 0, 1, 3, 2013, 'gmt'); $result=num_open_day($date1, $date2, 0, 1, 0, 'FR'); print __METHOD__." result=".$result."\n"; @@ -274,9 +281,9 @@ class DateLibTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals(2, $result, 'NumOpenDay Wednesday 2 - Thursday 3 jan 2013 for FR'); // 2 opened days - // With same hours - Friday/Sunday jan 2013 - $date1=dol_mktime(0, 0, 0, 1, 4, 2013); - $date2=dol_mktime(0, 0, 0, 1, 6, 2013); + // With same hours - Friday/Sunday jan 2013 + $date1=dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); + $date2=dol_mktime(0, 0, 0, 1, 6, 2013, 'gmt'); $result=num_open_day($date1, $date2, 0, 1, 0, 'FR'); print __METHOD__." result=".$result."\n"; @@ -328,7 +335,6 @@ class DateLibTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertSame('1 '.$langs->trans("Day"), $result); - return $result; } From 3e52c33bde45bad0ab401aa08f68aa57f0011e20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 22:52:41 +0100 Subject: [PATCH 16/29] Fix manual phpunit --- test/phpunit/DateLibTzFranceTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/DateLibTzFranceTest.php b/test/phpunit/DateLibTzFranceTest.php index 7e96e39030e..b77d13fd0c0 100644 --- a/test/phpunit/DateLibTzFranceTest.php +++ b/test/phpunit/DateLibTzFranceTest.php @@ -83,8 +83,8 @@ class DateLibTzFranceTest extends PHPUnit\Framework\TestCase { global $conf,$user,$langs,$db; - if (getServerTimeZoneString() != 'Europe/Paris') { - print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ+1 Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(); + if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') { + print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(); } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. From bcdfdae10c74aae5900c39c87917dfe9ce630d45 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 23:43:07 +0100 Subject: [PATCH 17/29] FIX #16480 --- .../societe/canvas/company/tpl/card_create.tpl.php | 4 ++-- htdocs/societe/canvas/company/tpl/card_edit.tpl.php | 4 ++-- .../canvas/individual/tpl/card_create.tpl.php | 4 ++-- .../societe/canvas/individual/tpl/card_edit.tpl.php | 4 ++-- htdocs/societe/card.php | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/societe/canvas/company/tpl/card_create.tpl.php b/htdocs/societe/canvas/company/tpl/card_create.tpl.php index e79c1cea177..039f4c4b9e7 100644 --- a/htdocs/societe/canvas/company/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_create.tpl.php @@ -74,7 +74,7 @@ if (empty($conf) || !is_object($conf)) - +
control->tpl['help_customercode']; ?>
@@ -89,7 +89,7 @@ if (empty($conf) || !is_object($conf)) - +
control->tpl['help_suppliercode']; ?>
diff --git a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php index 57b8a06b019..e03d0fa7b6e 100644 --- a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php @@ -75,7 +75,7 @@ $contact = $GLOBALS['objcanvas']->control->object; control->tpl['ismodifiable_customercode']) { ?> - + control->tpl['customercode']; ?> @@ -96,7 +96,7 @@ $contact = $GLOBALS['objcanvas']->control->object; control->tpl['ismodifiable_suppliercode']) { ?> - + control->tpl['suppliercode']; ?> diff --git a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php index 649d1bf8aca..389b36e50f5 100644 --- a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php @@ -84,7 +84,7 @@ if (empty($conf) || !is_object($conf)) - +
control->tpl['help_customercode']; ?>
@@ -99,7 +99,7 @@ if (empty($conf) || !is_object($conf)) - +
control->tpl['help_suppliercode']; ?>
diff --git a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php index b5f57544c5f..ffdbe2c3016 100644 --- a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php @@ -73,7 +73,7 @@ if (empty($conf) || !is_object($conf)) control->tpl['ismodifiable_customercode']) { ?> - + control->tpl['customercode']; ?> @@ -94,7 +94,7 @@ if (empty($conf) || !is_object($conf)) control->tpl['ismodifiable_suppliercode']) { ?> - + control->tpl['suppliercode']; ?> diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 21f4f4e78fb..4afb596fbda 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1253,7 +1253,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; print ''; + // Gender + print ''; + print ''; + // Company print ''; @@ -460,6 +466,15 @@ if ($rowid > 0) { // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''; } - print '
'; $tmpcode = $object->code_client; if (empty($tmpcode) && !empty($modCodeClient->code_auto)) $tmpcode = $modCodeClient->getNextValue($object, 0); - print ''; + print ''; print ''; $s = $modCodeClient->getToolTip($langs, $object, 0); print $form->textwithpicto('', $s, 1); @@ -1285,7 +1285,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; + print '
'; $tmpcode = $object->code_fournisseur; if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) $tmpcode = $modCodeFournisseur->getNextValue($object, 1); - print ''; + print ''; print ''; $s = $modCodeFournisseur->getToolTip($langs, $object, 1); print $form->textwithpicto('', $s, 1); @@ -1840,10 +1840,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $tmpcode = $object->code_client; if (empty($tmpcode) && !empty($object->oldcopy->code_client)) $tmpcode = $object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && !empty($modCodeClient->code_auto)) $tmpcode = $modCodeClient->getNextValue($object, 0); - print ''; + print ''; } elseif ($object->codeclient_modifiable()) { - print ''; + print ''; } else { print $object->code_client; print ''; @@ -1878,10 +1878,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $tmpcode = $object->code_fournisseur; if (empty($tmpcode) && !empty($object->oldcopy->code_fournisseur)) $tmpcode = $object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) $tmpcode = $modCodeFournisseur->getNextValue($object, 1); - print ''; + print ''; } elseif ($object->codefournisseur_modifiable()) { - print ''; + print ''; } else { print $object->code_fournisseur; print ''; From 77151bd560e93fbc1b9be61bbc394c2aa1dd1ec0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Feb 2021 23:53:20 +0100 Subject: [PATCH 18/29] Standardize tabs --- htdocs/adherents/card.php | 64 +++++++++++++++-------------- htdocs/adherents/subscription.php | 67 +++++++++++++++++++------------ 2 files changed, 75 insertions(+), 56 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 94904d877e7..a3fe601ae6e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1490,10 +1490,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print '
'.$langs->trans("Password").''.preg_replace('/./i', '*', $object->pass); - if ($object->pass) print preg_replace('/./i', '*', $object->pass); - else { - if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; - else print $langs->trans("Hidden"); + if ($object->pass) { + print preg_replace('/./i', '*', $object->pass); + } else { + if ($user->admin) { + print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; + } else { + print $langs->trans("Hidden"); + } } if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) { $langs->load("errors"); @@ -1523,6 +1527,32 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print '
'; + + print ''; + + print '
'; + print '
'; + + print ''; + + // Birth Date + print ''; + + // Public + print ''; + + // Categories + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + print ''; + print ''; + } + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + // Third party Dolibarr if (!empty($conf->societe->enabled)) { print ''; - print '
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); + print '
'; @@ -1571,29 +1601,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print '
'; - - print '
'; - - print '
'; - print '
'; - - print ''; - - // Birth Date - print ''; - - // Public - print ''; - - // Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { - print ''; - print ''; - } - //VCard print ''; - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - print "
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); - print '
'; print $langs->trans("VCard").''; @@ -1603,9 +1610,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print '
\n"; print "
\n"; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index a00c52b88e5..799f043c4df 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -450,6 +450,12 @@ if ($rowid > 0) { print '
'.$langs->trans("MemberNature").''.$object->getmorphylib().'
'.$langs->trans("Gender").''; + if ($object->gender) print $langs->trans("Gender".$object->gender); + print '
'.$langs->trans("Company").''.$object->company.'
'.$langs->trans("Password").''.preg_replace('/./i', '*', $object->pass); + if ($object->pass) { + print preg_replace('/./i', '*', $object->pass); + } else { + if ($user->admin) { + print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; + } else { + print $langs->trans("Hidden"); + } + } if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) { $langs->load("errors"); $htmltext = $langs->trans("WarningPasswordSetWithNoAccount"); @@ -468,32 +483,6 @@ if ($rowid > 0) { print '
'; - - print ''; - print '
'; - - print '
'; - print ''; - - // Birthday - print ''; - - // Public - print ''; - - // Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { - print ''; - print ''; - } - - // Other attributes - $cols = 2; - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - // Date end subscription print ''; + print '
'.$langs->trans("Birthday").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); - print '
'.$langs->trans("SubscriptionEndDate").''; if ($object->datefin) { @@ -512,6 +501,32 @@ if ($rowid > 0) { } print '
'; + + print '
'; + print '
'; + + print '
'; + print ''; + + // Birthday + print ''; + + // Public + print ''; + + // Categories + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + print ''; + print ''; + } + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + // Third party Dolibarr if (!empty($conf->societe->enabled)) { print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; $i++; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 453651f1708..3b519458cbc 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1115,3 +1115,4 @@ EventReminder=Event Reminder UpdateForAllLines=Update for all lines OnHold=On hold Civility=Civility +InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into account. From 3b1a9cd668d76f9ee4758b23b97a205f59975af5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 1 Mar 2021 03:18:14 +0100 Subject: [PATCH 20/29] FIX: Total_ht not show in contract link element --- htdocs/langs/en_US/main.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 3b519458cbc..7a666acc146 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1115,4 +1115,4 @@ EventReminder=Event Reminder UpdateForAllLines=Update for all lines OnHold=On hold Civility=Civility -InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into account. +InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration. From 0abe576fdc9324b7aad904edabe925fb6858b547 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 1 Mar 2021 04:49:06 +0100 Subject: [PATCH 21/29] FIX: Various payment - Missing fields for check transmitter & bank name --- .../bank/class/paymentvarious.class.php | 10 ++- htdocs/compta/bank/various_payment/card.php | 75 +++++++++++++++---- 2 files changed, 67 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index d05e2d339a6..edb030ff912 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2021 Alexandre Spangaro * Copyright (C) 2018-2020 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -70,6 +70,8 @@ class PaymentVarious extends CommonObject public $amount; public $type_payment; public $num_payment; + public $chqemetteur; + public $chqbank; public $category_transaction; /** @@ -424,7 +426,7 @@ class PaymentVarious extends CommonObject $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("BankAccount")); return -6; } - if (!empty($conf->banque->enabled) && (empty($this->type_payment) || $this->type_payment <= 0)) + if (!empty($conf->banque->enabled) && (empty($this->type_payment))) { $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); return -7; @@ -499,8 +501,8 @@ class PaymentVarious extends CommonObject $this->num_payment, ($this->category_transaction > 0 ? $this->category_transaction : 0), $user, - '', - '', + $this->chqemetteur, + $this->chqbank, '', $this->datev ); diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 0c2db362e75..94f671c6dd5 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -49,7 +49,7 @@ $accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; $label = GETPOST("label", "alpha"); $sens = GETPOST("sens", "int"); $amount = price2num(GETPOST("amount", "alpha")); -$paymenttype = GETPOST("paymenttype", "int"); +$paymenttype = GETPOST("paymenttype", "aZ09"); $accountancy_code = GETPOST("accountancy_code", "alpha"); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); if (!empty($conf->accounting->enabled) && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { @@ -113,8 +113,10 @@ if (empty($reshook)) $object->amount = price2num(GETPOST("amount", 'alpha')); $object->label = GETPOST("label", 'restricthtml'); $object->note = GETPOST("note", 'restricthtml'); - $object->type_payment = GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0; + $object->type_payment = dol_getIdFromCode($db, GETPOST('paymenttype'), 'c_paiement', 'code', 'id', 1); $object->num_payment = GETPOST("num_payment", 'alpha'); + $object->chqemetteur = GETPOST("chqemetteur", 'alpha'); + $object->chqbank = GETPOST("chqbank", 'alpha'); $object->fk_user_author = $user->id; $object->category_transaction = GETPOST("category_transaction", 'alpha'); @@ -345,6 +347,43 @@ foreach ($bankcateg->fetchAll() as $bankcategory) { /* ************************************************************************** */ if ($action == 'create') { + // Update fields properties in realtime + if (!empty($conf->use_javascript_ajax)) + { + print "\n".''."\n"; + } + print '
'; print ''; print ''; @@ -390,20 +429,28 @@ if ($action == 'create') } // Type payment - print '
'; + print '\n"; + print ''; // Number - if (!empty($conf->banque->enabled)) - { - // Number - print ''; - print ''."\n"; - } + print ''; + print ''."\n"; + + // Check transmitter + print ''; + print ''; + + // Bank name + print ''; + print ''; // Accountancy account if (!empty($conf->accounting->enabled)) { From 0796bc45b14bd244526b7672d72c5fb5fd5c35a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 10:39:27 +0100 Subject: [PATCH 22/29] Fix amount for some language on public payment page --- htdocs/public/payment/newpayment.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 8f3bb23a362..bda79d7d97d 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -869,7 +869,7 @@ if (!$source) print '\n"; print ''; print "\n"; +if (!empty($conf->societe->enabled)) { + print ''; + print ''; + print '\n"; + print "\n"; +} + print ''; print ''; print ''; -print ''; -print ''; -print '\n"; -print "\n"; - print ''; print ''; // Ref - print ''; + print ''; // Company if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { // Thirdparty - print ''; - if ($soc->id > 0 && !GETPOST('fac_rec', 'alpha')) + if ($soc->id > 0) { - print ''; + print ''; } else { - print ''; + print ''; } print ''."\n"; @@ -545,11 +549,15 @@ if (!empty($id) && $action == 'edit') print ""; print "\n"; - if ($object->socid && !empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { + if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { $company = new Societe($db); - $result = $company->fetch($object->socid); - print ''; + print ''; } else { $langs->load("companies"); print ''; @@ -707,11 +715,15 @@ if (!empty($id) && $action != 'edit') print yn($object->public); print ''; - if ($object->socid) { + if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { $company = new Societe($db); - $result = $company->fetch($object->socid); - print ''; + print ''; } else { print ''; print ''; diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 2f897556d5c..d512abb2eea 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -32,4 +32,4 @@ DONATION_ART238=Show article 238 from CGI if you are concerned DONATION_ART885=Show article 885 from CGI if you are concerned DonationPayment=Donation payment DonationValidated=Donation %s validated -DonationUseThirdparties=Ask a thirdparty on each donation record +DonationUseThirdparties=Use an existing thirdparty as coordinates of donators From 5cddd0465c4dfd6089154ea4224398fe046e4133 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 13:25:54 +0100 Subject: [PATCH 26/29] Fix trans --- htdocs/langs/en_US/dict.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index ec315d97142..0524cf1ca18 100644 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -21,7 +21,7 @@ CountryNL=Netherlands CountryHU=Hungary CountryRU=Russia CountrySE=Sweden -CountryCI=Ivoiry Coast +CountryCI=Ivory Coast CountrySN=Senegal CountryAR=Argentina CountryCM=Cameroon From 96eb7a341a63d8e83f0eb92777fa25079463a330 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Mon, 1 Mar 2021 16:14:38 +0100 Subject: [PATCH 27/29] FIX: Bad project filter in ticket list --- htdocs/ticket/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 1a276c75f5f..5e8d9f640c5 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -362,7 +362,7 @@ foreach ($search as $key => $val) } if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -//if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2); +if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2); if ($search_date_start) $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'"; if ($search_date_end) $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'"; if ($search_dateread_start) $sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'"; From 0ac5e370669b6ebd62529384467825b6977d50c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 19:41:51 +0100 Subject: [PATCH 28/29] Update date of ticket in demo --- dev/initdemo/updatedemo.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 5da0d4a2498..207cd07488c 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -73,7 +73,8 @@ $tables=array( 'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'), 'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'), 'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'), - 'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel') + 'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel'), + 'ticket'=>array(0=>'datec', 1=>'date_read', 2=>'date_close') ); $year=2010; From 6e61ae8e56696e100a324a74ea568355efe39fa3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 19:50:35 +0100 Subject: [PATCH 29/29] Fix responsive --- htdocs/ticket/class/ticket.class.php | 4 ++-- htdocs/ticket/list.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 306f861097b..4571cbd679c 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -254,7 +254,7 @@ class Ticket extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), - 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax125 maxwidth150onsmartphone'), 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200 tdoverflowmax200', 'autofocusoncreate'=>1), 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth125 tdoverflowmax50'), @@ -266,7 +266,7 @@ class Ticket extends CommonObject 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), - 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax150'), + 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax125'), 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 5e8d9f640c5..e9b36a2d364 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -667,7 +667,7 @@ foreach ($object->fields as $key => $val) print ''; } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') { print ''; } elseif ($key == 'fk_statut') { $arrayofstatus = array(); @@ -681,7 +681,7 @@ foreach ($object->fields as $key => $val) //var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key])); $selectedarray = null; if ($search[$key]) $selectedarray = array_values($search[$key]); - print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', ''); + print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth100 maxwidth150', 1, 0, '', '', ''); print ''; } elseif ($key == "fk_soc") { print '';
'.$langs->trans("DateOfBirth").''.dol_print_date($object->birth, 'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); + print '
'; From 0d954cb1c7b995c4886d714a5ad122775ba6b6a5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 1 Mar 2021 03:09:36 +0100 Subject: [PATCH 19/29] FIX: Total_ht not show in contract link element --- htdocs/core/class/html.form.class.php | 7 ++++++- htdocs/langs/en_US/main.lang | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 30225e45baa..b7912e93dc4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7206,7 +7206,12 @@ class Form print ''.$objp->ref.''.$objp->ref_client.''.price($objp->total_ht).''; + if ($possiblelink[label] == 'LinkToContract') { + $form = new Form($db); + print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; + } + print price($objp->total_ht).''.$objp->name.'
'; - print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).''; - $form->select_types_paiements($paymenttype, "paymenttype"); - print '
'.$langs->trans('PaymentMode').''; + $form->select_types_paiements($paymenttype, 'paymenttype', '', 2); + print "
'; if (empty($amount) || !is_numeric($amount)) { - print ''; + print ''; print ''; } else { print ''.price($amount).''; @@ -915,7 +915,7 @@ if ($source == 'order') if ($action != 'dopayment') // Do not change amount if we just click on first dopayment { $amount = $order->total_ttc; - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount); } @@ -961,7 +961,7 @@ if ($source == 'order') print ''; if (empty($amount) || !is_numeric($amount)) { - print ''; + print ''; print ''; } else { print ''.price($amount).''; @@ -1033,7 +1033,7 @@ if ($source == 'invoice') if ($action != 'dopayment') // Do not change amount if we just click on first dopayment { $amount = price2num($invoice->total_ttc - ($invoice->getSommePaiement() + $invoice->getSumCreditNotesUsed() + $invoice->getSumDepositsUsed())); - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount); } @@ -1082,7 +1082,7 @@ if ($source == 'invoice') } elseif (empty($object->paye)) { if (empty($amount) || !is_numeric($amount)) { - print ''; + print ''; print ''; } else { print ''.price($amount).''; @@ -1198,7 +1198,7 @@ if ($source == 'contractline') } } - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount); } @@ -1286,7 +1286,7 @@ if ($source == 'contractline') print ''; if (empty($amount) || !is_numeric($amount)) { - print ''; + print ''; print ''; } else { print ''.price($amount).''; @@ -1359,8 +1359,8 @@ if ($source == 'membersubscription') if ($action != 'dopayment') // Do not change amount if we just click on first dopayment { $amount = $subscription->total_ttc; - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); - $amount = price2num($amount); + if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); + $amount = price2num($amount, 'MT'); } if (GETPOST('fulltag', 'alpha')) { @@ -1448,8 +1448,8 @@ if ($source == 'membersubscription') { //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); - print ''; - print ''; + print ''; + print 'global->MEMBER_NEWFORM_EDITAMOUNT)?' disabled':' ').'>'; } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); @@ -1521,7 +1521,7 @@ if ($source == 'donation') if ($action != 'dopayment') // Do not change amount if we just click on first dopayment { $amount = $subscription->total_ttc; - if (GETPOST("amount", 'int')) $amount = GETPOST("amount", 'int'); + if (GETPOST("amount", 'alpha')) $amount = GETPOST("amount", 'alpha'); $amount = price2num($amount); } @@ -1587,7 +1587,7 @@ if ($source == 'donation') { //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); - print ''; + print ''; print ''; } else { $valtoshow = $amount; From c80151717e242eff919672be9bc20a0f4ee9e03a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 10:45:37 +0100 Subject: [PATCH 23/29] Fix set of payment --- htdocs/public/payment/newpayment.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index bda79d7d97d..641c791f1c1 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1449,7 +1449,12 @@ if ($source == 'membersubscription') //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''; - print 'global->MEMBER_NEWFORM_EDITAMOUNT)?' disabled':' ').'>'; + if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + print ''; + print ''; + } else { + print ''; + } } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); From a68721c5b4143806fd6ad5ba7132d4caba0f09fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 10:58:06 +0100 Subject: [PATCH 24/29] Fix missing translation --- htdocs/don/admin/donation.php | 30 +++++++++++++++------------- htdocs/langs/en_US/donations.lang | 1 + htdocs/public/payment/newpayment.php | 10 ++++++++-- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index 7b0896134e0..6b4588536c9 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -322,24 +322,26 @@ print ''.$langs->trans("Value")."
'; + print $langs->trans("DonationUseThirdparties"); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('DONATION_USE_THIRDPARTIES'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("DONATION_USE_THIRDPARTIES", $arrval, $conf->global->DONATION_USE_THIRDPARTIES); + } + print "
'; -print $form->textwithpicto($langs->trans("DonationUserThirdparties"), $langs->trans("DonationUserThirdpartiesDesc")); -print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('DONATION_USE_THIRDPARTIES'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("DONATION_USE_THIRDPARTIES", $arrval, $conf->global->DONATION_USE_THIRDPARTIES); -} -print "
'; $label = $langs->trans("AccountAccounting"); diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index de4bdf68f03..2f897556d5c 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -32,3 +32,4 @@ DONATION_ART238=Show article 238 from CGI if you are concerned DONATION_ART885=Show article 885 from CGI if you are concerned DonationPayment=Donation payment DonationValidated=Donation %s validated +DonationUseThirdparties=Ask a thirdparty on each donation record diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 641c791f1c1..e16355d902e 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1457,7 +1457,10 @@ if ($source == 'membersubscription') } } else { $valtoshow = $amount; - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { + $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + $amount = $valtoshow; + } print ''.price($valtoshow).''; print ''; print ''; @@ -1596,7 +1599,10 @@ if ($source == 'donation') print ''; } else { $valtoshow = $amount; - if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) { + $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); + $amount = $valtoshow; + } print ''.price($valtoshow).''; print ''; print ''; From 81f1bee10ce5e6ef224e074d24c016aefd71f03f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 11:18:14 +0100 Subject: [PATCH 25/29] Fix option DONATION_USE_THIRDPARTIES --- htdocs/don/card.php | 46 +++++++++++++++++++------------ htdocs/langs/en_US/donations.lang | 2 +- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index c55751e913f..dd7de85430e 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -44,7 +44,7 @@ if (!empty($conf->projet->enabled)) { } require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -$langs->loadLangs(array("bills", "companies", "donations")); +$langs->loadLangs(array("bills", "companies", "donations", "users")); $id = GETPOST('rowid') ?GETPOST('rowid', 'int') : GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); @@ -179,15 +179,18 @@ if ($action == 'add') $error = 0; - if (empty($donation_date)) - { + if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES) && !(GETPOST("socid", 'int') > 0)) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors'); + $action = "create"; + $error++; + } + if (empty($donation_date)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = "create"; $error++; } - if (empty($amount)) - { + if (empty($amount)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); $action = "create"; $error++; @@ -347,16 +350,16 @@ if ($action == 'create') print '
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Customer').''; + print ''.$langs->trans('ThirdParty').''; print $soc->getNomUrl(1); print ''; // Outstanding Bill @@ -372,7 +375,8 @@ if ($action == 'create') print ')'; print ''; + print ''.$langs->trans('ThirdParty').''; print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer informations. Note, this clear other input if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) @@ -389,7 +393,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '; print '
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
'.$langs->trans("ThirdParty").''; + if ($object->socid > 0) { + $result = $company->fetch($object->socid); + print $company->getNomUrl(1); + } + print '
'.$langs->trans("Company").'
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
'.$langs->trans("ThirdParty").''; + if ($object->socid > 0) { + $result = $company->fetch($object->socid); + print $company->getNomUrl(1); + } + print '
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("Lastname").''.$object->lastname.'
'; - print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth150')); + print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth125')); print '