From 7e5330496b5cec1b3a4afb2c224294457070d4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 5 Mar 2021 22:50:28 +0100 Subject: [PATCH 01/19] fis tyo --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4571cbd679c..5f95c7f0dc5 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -711,7 +711,7 @@ class Ticket extends CommonObject if (!empty($filter)) { foreach ($filter as $key => $value) { if (strpos($key, 'date')) { // To allow $filter['YEAR(s.dated)']=>$year - $sql .= ' AND '.$key." = '".$this->db->scape($value)."'"; + $sql .= ' AND '.$key." = '".$this->db->escape($value)."'"; } elseif (($key == 't.fk_user_assign') || ($key == 't.type_code') || ($key == 't.category_code') || ($key == 't.severity_code') || ($key == 't.fk_soc')) { $sql .= " AND ".$key." = '".$this->db->escape($value)."'"; } elseif ($key == 't.fk_statut') { From 4666c7f09022b461eb66d99ba15838c1065bbe46 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Mar 2021 18:41:07 +0100 Subject: [PATCH 02/19] Fix responsive --- htdocs/product/price.php | 36 +++++++++++++++----------------- htdocs/theme/eldy/global.inc.php | 9 +++++++- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 5036a7d0bb8..7538e2875be 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1192,6 +1192,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) print dol_get_fiche_head(''); + print '
'; print ''; // VAT @@ -1279,6 +1280,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print '
'; + print '
'; print dol_get_fiche_end(); @@ -1326,6 +1328,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) print $langs->trans('UseMultipriceRules').' price_autogen ? 'checked' : '').'>

'; } + print '
'; print ''; print ''; @@ -1399,6 +1402,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) print ''; print '
'; + print '
'; //print dol_get_fiche_end(); @@ -1496,7 +1500,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul print ''; // Date - print "".dol_print_date($db->jdate($objp->dp), "dayhour").""; + print "".dol_print_date($db->jdate($objp->dp), "dayhour", 'tzuserrel').""; // Price level if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { @@ -1855,6 +1859,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ''; + print '
'; print ''; print ''; @@ -1906,7 +1911,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ""; - print ""; + print ""; print '"; print ''; } print "
".$staticsoc->getNomUrl(1)."".dol_print_date($line->datec, "dayhour")."".dol_print_date($line->datec, "dayhour", 'tzuserrel')."'.$langs->trans($line->price_base_type)."'; @@ -1943,6 +1948,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print '
"; + print '
'; } else { print $langs->trans('None'); } @@ -1970,6 +1976,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ''; + print '
'; print ''; if (count($prodcustprice->lines) > 0 || $search_soc) @@ -2005,7 +2012,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ''; print ''; - print ''; + print ''; print ''; // Line for default price @@ -2062,15 +2069,14 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; if ($user->rights->produit->supprimer || $user->rights->service->supprimer) { - print ''; } print "\n"; @@ -2107,8 +2113,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ""; - print ""; - + print ""; print '"; print '"; print '"; - if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") - { + if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") { //print '"; print ''; } else { @@ -2162,16 +2167,9 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print "\n"; } } - /*else - { - $colspan=9; - if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan+=1; - print ""; - print ''; - print ""; - }*/ print "
'.$langs->trans("MinPrice").' '.$langs->trans("HT").''.$langs->trans("MinPrice").' '.$langs->trans("TTC").''.$langs->trans("ChangedBy").' 
'; - print 'id.'">'; + print ''; + print 'id.'">'; print img_info($langs->trans('PriceByCustomerLog')); print ''; print ' '; - print 'id.'">'; + print 'id.'">'; print img_edit('default', 0, 'style="vertical-align: middle;"'); print ''; - print '   '; print '
".$staticsoc->getNomUrl(1)."".dol_print_date($line->datec, "dayhour")."".dol_print_date($line->datec, "dayhour", 'tzuserrel')."'.$langs->trans($line->price_base_type)."'; @@ -2117,13 +2122,13 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) if (price2num($line->localtax1_type)) $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax1_tx); if (price2num($line->localtax2_type)) $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax2_tx); if (empty($positiverates)) $positiverates = '0'; + echo vatrate($positiverates.($line->default_vat_code ? ' ('.$line->default_vat_code.')' : ''), '%', ($line->tva_npr ? $line->tva_npr : $line->recuperableonly)); print "'.price($line->price)."' . price($line->price_ttc) . "'.price($resultarray[2]).'
'.$langs->trans('None').'
"; + print '
'; print ""; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index bc6bf8327e9..d6bf65947dd 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1581,7 +1581,7 @@ td.showDragHandle { float: left; } .classforhorizontalscrolloftabs #id-right { - width:calc(100% - 210px); + width: calc(100% - 210px); display: inline-block; } @@ -1685,10 +1685,17 @@ div.vmenu, td.vmenu { /* rule to reduce top menu - 3rd reduction: The menu for user is on left */ @media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3) ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */ { + /* no side-nav */ body.sidebar-collapse .side-nav { display: none; } + /* if no side-nav, we don't need to have width forced */ + .classforhorizontalscrolloftabs #id-right { + width: unset; + display: unset; + } + body.sidebar-collapse .login_block { display: none; } From 142f87863357fc409e3926b2e60de08c310e5eb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Mar 2021 18:56:16 +0100 Subject: [PATCH 03/19] Fix look and feel v13 --- htdocs/product/price.php | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 7538e2875be..b783ad5c002 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1649,8 +1649,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $filter['soc.nom'] = $search_soc; } - if ($action == 'add_customer_price') - { + if ($action == 'add_customer_price') { // Form to add a new customer price $maxpricesupplier = $object->min_recommended_price(); @@ -1661,13 +1660,11 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ''; - print dol_get_fiche_head(); - print ''; print ''; print ''; print ''; print ''; @@ -1714,14 +1711,13 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print '
'.$langs->trans('ThirdParty').''; - print $form->select_company('', 'socid', 's.client IN (1,2,3)', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300'); + print img_picto('', 'company').$form->select_company('', 'socid', 's.client IN (1,2,3)', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300'); print '
'; - print dol_get_fiche_end(); print '
'; // Update all child soc print '
'; - print ' '; - print $langs->trans('ForceUpdateChildPriceSoc'); + print ' '; + print ''; print '
'; print ''; @@ -1747,23 +1743,21 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ''; - print dol_get_fiche_head(); - print ''; print ''; - print ''; + print ''; $staticsoc = new Societe($db); $staticsoc->fetch($prodcustprice->fk_soc); - print ""; + print ""; print ''; // VAT - print ''; // Price base - print ''; print ''; // Price - print ''; - // Update all child soc - print ''; - print ''; - print ''; - print '
'.$langs->trans('ThirdParty').''.$langs->trans('ThirdParty').'".$staticsoc->getNomUrl(1)."".$staticsoc->getNomUrl(1)."
'.$langs->trans("DefaultTaxRate").''; + print '
'.$langs->trans("DefaultTaxRate").''; print $form->load_tva("tva_tx", $prodcustprice->default_vat_code ? $prodcustprice->tva_tx.' ('.$prodcustprice->default_vat_code.')' : $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly, $object->type, false, 1); print '
'; + print '
'; print $langs->trans('PriceBase'); print ''; @@ -1772,7 +1766,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print '
'; + print '
'; $text = $langs->trans('SellingPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); print ''; @@ -1800,21 +1794,13 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) } print '
'; - print ''; - print '
'; - print dol_get_fiche_end(); print '
'; print '
'; - print ' '; - print $langs->trans('ForceUpdateChildPriceSoc'); + print ' '; + print ''; print "
"; print ''; From 91245e22d4c503a40d01a38356e5580a86defe01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Mar 2021 19:16:09 +0100 Subject: [PATCH 04/19] Fix phpunit phpv8 --- htdocs/compta/facture/class/facture-rec.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 80b49ec7c8c..72096aff0a8 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -79,13 +79,14 @@ class FactureRec extends CommonInvoice */ public $title; + public $socid; public $number; public $date; public $remise; + public $remise_absolue; + public $remise_percent; public $tva; public $total; - public $db_table; - public $propalid; public $date_last_gen; public $date_when; @@ -107,6 +108,7 @@ class FactureRec extends CommonInvoice public $usenewprice = 0; + public $date_lim_reglement; public $suspended; // status public $auto_validate; @@ -528,7 +530,6 @@ class FactureRec extends CommonInvoice $this->title = $obj->title; $this->ref = $obj->title; $this->suspended = $obj->suspended; - $this->date = $obj->df; $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; $this->remise = $obj->remise; @@ -537,8 +538,6 @@ class FactureRec extends CommonInvoice $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; $this->total_ttc = $obj->total_ttc; - $this->close_code = $obj->close_code; - $this->close_note = $obj->close_note; $this->socid = $obj->fk_soc; $this->date_lim_reglement = $this->db->jdate($obj->dlr); $this->mode_reglement_id = $obj->fk_mode_reglement; From 0f7085154b71610f3e2e00662a5ecaa638ffe940 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Mar 2021 19:47:55 +0100 Subject: [PATCH 05/19] Fix phpunit --- htdocs/compta/facture/class/facture-rec.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 72096aff0a8..45b81b844ec 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -93,6 +93,8 @@ class FactureRec extends CommonInvoice public $nb_gen_done; public $nb_gen_max; + public $user_author; + /** * @var int Frequency */ @@ -111,7 +113,8 @@ class FactureRec extends CommonInvoice public $date_lim_reglement; public $suspended; // status - public $auto_validate; + public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice + public $generate_pdf; // 1 to generate PDF on invoice generation (default) /** @@ -549,7 +552,6 @@ class FactureRec extends CommonInvoice $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; $this->fk_project = $obj->fk_project; $this->fk_account = $obj->fk_account; - $this->fk_facture_source = $obj->fk_facture_source; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->user_author = $obj->fk_user_author; From 1ca3e433d2520063ba2f081eae9fa039f2188082 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Mar 2021 19:55:09 +0100 Subject: [PATCH 06/19] Fix phpunit --- htdocs/compta/facture/class/facture-rec.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 45b81b844ec..7d15674e7e7 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -557,7 +557,6 @@ class FactureRec extends CommonInvoice $this->user_author = $obj->fk_user_author; $this->modelpdf = $obj->model_pdf; // deprecated $this->model_pdf = $obj->model_pdf; - $this->rang = $obj->rang; $this->special_code = $obj->special_code; $this->frequency = $obj->frequency; $this->unit_frequency = $obj->unit_frequency; From 1affaa8c8705fd7b50e7d1daf5e8828c120e9892 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Mar 2021 20:26:36 +0100 Subject: [PATCH 07/19] fix phpunit --- htdocs/compta/facture/class/facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 7d15674e7e7..7c966fc1b1f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -557,7 +557,7 @@ class FactureRec extends CommonInvoice $this->user_author = $obj->fk_user_author; $this->modelpdf = $obj->model_pdf; // deprecated $this->model_pdf = $obj->model_pdf; - $this->special_code = $obj->special_code; + //$this->special_code = $obj->special_code; $this->frequency = $obj->frequency; $this->unit_frequency = $obj->unit_frequency; $this->date_when = $this->db->jdate($obj->date_when); From ff97a413865e0cbfaec7b3e5c66d2be2b81a0f8e Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 8 Mar 2021 09:00:52 +0100 Subject: [PATCH 08/19] FIX : num_payment on llx_salary is useless --- htdocs/salaries/card.php | 1 - htdocs/salaries/class/salary.class.php | 13 ------------- htdocs/salaries/list.php | 4 ++-- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 91330cf318e..eb4a6958045 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -148,7 +148,6 @@ if ($action == 'add' && empty($cancel)) $object->dateep = $dateep; $object->note = GETPOST("note", 'none'); $object->type_payment = ($type_payment > 0 ? $type_payment : 0); - $object->num_payment = GETPOST("num_payment", 'alphanohtml'); $object->fk_user_author = $user->id; $object->fk_project = $projectid; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 224b6e74c4a..979adfd18e4 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -64,7 +64,6 @@ class Salary extends CommonObject public $fk_project; public $type_payment; - public $num_payment; /** * @var string salary payments label @@ -142,7 +141,6 @@ class Salary extends CommonObject $sql .= " amount=".price2num($this->amount).","; $sql .= " fk_projet=".((int) $this->fk_project).","; $sql .= " fk_typepayment=".$this->type_payment.","; - $sql .= " num_payment='".$this->db->escape($this->num_payment)."',"; $sql .= " label='".$this->db->escape($this->label)."',"; $sql .= " datesp='".$this->db->idate($this->datesp)."',"; $sql .= " dateep='".$this->db->idate($this->dateep)."',"; @@ -215,7 +213,6 @@ class Salary extends CommonObject $sql .= " s.amount,"; $sql .= " s.fk_projet as fk_project,"; $sql .= " s.fk_typepayment,"; - $sql .= " s.num_payment,"; $sql .= " s.label,"; $sql .= " s.datesp,"; $sql .= " s.dateep,"; @@ -249,7 +246,6 @@ class Salary extends CommonObject $this->amount = $obj->amount; $this->fk_project = $obj->fk_project; $this->type_payment = $obj->fk_typepayment; - $this->num_payment = $obj->num_payment; $this->label = $obj->label; $this->datesp = $this->db->jdate($obj->datesp); $this->dateep = $this->db->jdate($obj->dateep); @@ -410,7 +406,6 @@ class Salary extends CommonObject $sql .= ", salary"; $sql .= ", fk_typepayment"; $sql .= ", fk_account"; - $sql .= ", num_payment"; if ($this->note) $sql .= ", note"; $sql .= ", label"; $sql .= ", datesp"; @@ -429,7 +424,6 @@ class Salary extends CommonObject $sql .= ", ".($this->salary > 0 ? $this->salary : "null"); $sql .= ", ".($this->type_payment > 0 ? $this->type_payment : 0); $sql .= ", ".($this->accountid > 0 ? $this->accountid : "null"); - $sql .= ", '".$this->db->escape($this->num_payment)."'"; if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'"; $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", '".$this->db->idate($this->datesp)."'"; @@ -450,13 +444,6 @@ class Salary extends CommonObject { if (!empty($conf->banque->enabled) && !empty($this->amount)) { - // Insert into llx_bank - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - - $acc = new Account($this->db); - $result = $acc->fetch($this->accountid); - if ($result <= 0) dol_print_error($this->db); - // Update extrafield if (!$error) { if (!$error) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 89e5703ff56..33ec9a6b1ae 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -112,7 +112,7 @@ $userstatic = new User($db); $accountstatic = new Account($db); $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_soc as fk_soc, u.statut as status,"; -$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp as datesp, s.dateep as dateep, s.fk_typepayment as type, s.num_payment, s.fk_bank,"; +$sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp as datesp, s.dateep as dateep, s.fk_typepayment as type, s.fk_bank,"; $sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,"; $sql .= " pst.code as payment_code,"; $sql .= " SUM(ps.amount) as alreadypayed"; @@ -310,7 +310,7 @@ if ($result) if (!$i) $totalarray['nbfield']++; // Type - print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; + print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).''; if (!$i) $totalarray['nbfield']++; // Account From a1d97274fb52e3d37179c014330e3a5c1f721fb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 09:14:23 +0100 Subject: [PATCH 09/19] Clean code for php8 --- .../facture/class/facture-rec.class.php | 10 +++++++ htdocs/compta/facture/class/facture.class.php | 26 ++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 7c966fc1b1f..360bba67e34 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -116,6 +116,12 @@ class FactureRec extends CommonInvoice public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice public $generate_pdf; // 1 to generate PDF on invoice generation (default) + /** + * @var int 1 if status is draft + * @deprecated + */ + public $brouillon; + /** * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') @@ -837,6 +843,7 @@ class FactureRec extends CommonInvoice $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); // Clean vat code + $reg = array(); $vat_src_code = ''; if (preg_match('/\((.*)\)/', $txtva, $reg)) { $vat_src_code = $reg[1]; @@ -1277,6 +1284,8 @@ class FactureRec extends CommonInvoice $facture->type = self::TYPE_STANDARD; $facture->brouillon = 1; + $facture->statut = self::STATUS_DRAFT; + $facture->status = self::STATUS_DRAFT; $facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. $facture->socid = $facturerec->socid; @@ -1602,6 +1611,7 @@ class FactureRec extends CommonInvoice // Initialize parameters $this->id = 0; $this->ref = 'SPECIMEN'; + $this->title = 'SPECIMEN'; $this->specimen = 1; $this->socid = 1; $this->date = $nownotime; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a78fc550150..96af87b81b5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -99,6 +99,12 @@ class Facture extends CommonInvoice */ protected $table_ref_field = 'ref'; + /** + * @var int 1 if status is draft + * @deprecated + */ + public $brouillon; + /** * @var int thirdparty ID */ @@ -446,6 +452,8 @@ class Facture extends CommonInvoice $this->mode_reglement_id = 0; } $this->brouillon = 1; + $this->status = self::STATUS_DRAFT; + $this->statut = self::STATUS_DRAFT; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) { @@ -537,6 +545,8 @@ class Facture extends CommonInvoice $this->mode_reglement_id = 0; } $this->brouillon = 1; + $this->status = self::STATUS_DRAFT; + $this->statut = self::STATUS_DRAFT; $this->linked_objects = $_facrec->linkedObjectsIds; // We do not add link to template invoice or next invoice will be linked to all generated invoices @@ -1683,7 +1693,7 @@ class Facture extends CommonInvoice $this->fetchPreviousNextSituationInvoice(); } - if ($this->statut == self::STATUS_DRAFT) { + if ($this->status == self::STATUS_DRAFT) { $this->brouillon = 1; } @@ -2584,8 +2594,8 @@ class Facture extends CommonInvoice $this->fetch_lines(); // Check parameters - if (!$this->brouillon) { - dol_syslog(get_class($this)."::validate no draft status", LOG_WARNING); + if ($this->statut != self::STATUS_DRAFT) { + dol_syslog(get_class($this)."::validate status is not draft. operation canceled.", LOG_WARNING); return 0; } if (count($this->lines) <= 0) { @@ -2849,6 +2859,7 @@ class Facture extends CommonInvoice $this->ref = $num; $this->ref = $num; $this->statut = self::STATUS_VALIDATED; + $this->status = self::STATUS_VALIDATED; $this->brouillon = 0; $this->date_validation = $now; $i = 0; @@ -2887,7 +2898,7 @@ class Facture extends CommonInvoice * Update price of next invoice * * @param Translate $langs Translate object - * @return bool false if KO, true if OK + * @return bool false if KO, true if OK */ public function updatePriceNextInvoice(&$langs) { @@ -2900,6 +2911,7 @@ class Facture extends CommonInvoice } $next_invoice->brouillon = 1; + foreach ($next_invoice->lines as $line) { $result = $next_invoice->updateline( $line->id, @@ -2995,12 +3007,14 @@ class Facture extends CommonInvoice $old_statut = $this->statut; $this->brouillon = 1; $this->statut = self::STATUS_DRAFT; + $this->status = self::STATUS_DRAFT; // Call trigger $result = $this->call_trigger('BILL_UNVALIDATE', $user); if ($result < 0) { $error++; $this->statut = $old_statut; + $this->status = $old_statut; $this->brouillon = 0; } // End call triggers @@ -3362,7 +3376,7 @@ class Facture extends CommonInvoice dol_syslog(get_class($this)."::updateline rowid=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, date_start=$date_start, date_end=$date_end, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, type=$type, fk_parent_line=$fk_parent_line pa_ht=$pa_ht, special_code=$special_code, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); - if ($this->brouillon) { + if ($this->statut == self::STATUS_DRAFT) { if (!$this->is_last_in_cycle() && empty($this->error)) { if (!$this->checkProgressLine($rowid, $situation_percent)) { if (!$this->error) { @@ -3631,7 +3645,7 @@ class Facture extends CommonInvoice dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG); - if (!$this->brouillon) { + if ($this->statut != self::STATUS_DRAFT) { $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; return -1; } From 4d409e23f56e80e3243d80c147052b5cb55da745 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 09:16:33 +0100 Subject: [PATCH 10/19] Missing declaration of properties --- htdocs/compta/facture/class/facture-rec.class.php | 3 +++ htdocs/compta/facture/class/facture.class.php | 1 + 2 files changed, 4 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 360bba67e34..1c4d0e8326f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -111,6 +111,9 @@ class FactureRec extends CommonInvoice public $usenewprice = 0; public $date_lim_reglement; + public $cond_reglement_code; // Code in llx_c_paiement + public $mode_reglement_code; // Code in llx_c_paiement + public $suspended; // status public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 96af87b81b5..dfd50147109 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -177,6 +177,7 @@ class Facture extends CommonInvoice //! id of source invoice if replacement invoice or credit note public $fk_facture_source; public $linked_objects = array(); + public $date_lim_reglement; public $cond_reglement_code; // Code in llx_c_paiement public $mode_reglement_code; // Code in llx_c_paiement From f9a1b5fd3e9971186bfefa4b4e5ef213ddb4fa68 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 8 Mar 2021 09:21:03 +0100 Subject: [PATCH 11/19] FIX : quote forgotten in merge --- htdocs/salaries/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index e4946858cfd..7bc75f52793 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -570,7 +570,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } // Type - print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).'; + print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).''; if (!$i) { $totalarray['nbfield']++; } From c0e0300eb33ec2f00967ec3b9038661d707c8837 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 11:08:58 +0100 Subject: [PATCH 12/19] Enhance the page security --- htdocs/accountancy/admin/subaccount.php | 5 +++-- htdocs/admin/system/phpinfo.php | 3 ++- htdocs/admin/system/security.php | 19 ++++++++++++++----- htdocs/admin/system/xdebug.php | 9 ++++++--- htdocs/langs/en_US/admin.lang | 4 +++- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 4b7d4d029b5..341fddf113c 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -118,9 +118,10 @@ if (empty($reshook)) { $form = new Form($db); +$help_url = ''; $title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger'); -llxHeader('', $title); +llxHeader('', $title, $help_url); // Customer $sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity"; @@ -314,7 +315,7 @@ if ($resql) { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); - print '
'.$langs->trans("WarningCreateSubAccounts").'
'; + print '
'.$langs->trans("WarningCreateSubAccounts").'
'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 1f8b7680563..ac51ce33dc3 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -309,8 +309,9 @@ function getResultColumn($name, array $activated, array $loaded, array $function } if (strtolower($name) == 'xdebug') { $html .= ' '.$langs->trans("ModuleActivated", "xdebug"); + $html .= ' - '.$langs->trans("ModuleActivatedMayExposeInformation"); } else { - $html .= ' '.$langs->trans("PHPSupport", $name); + $html .= ' '.$langs->trans("PHPSupport", $name).''; } } else { if (strtolower($name) == 'xdebug') { diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index f69e520bb9b..745b732b6e1 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -76,7 +76,7 @@ if ($test) { print '
'; print '
'; -print load_fiche_titre($langs->trans("ConfigurationFile"), '', 'folder'); +print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffile.')', '', 'folder'); print ''.$langs->trans("dolibarr_main_prod").': '.$dolibarr_main_prod; if (empty($dolibarr_main_prod)) { @@ -98,7 +98,7 @@ print '
'; print '
'; print '
'; -print load_fiche_titre($langs->trans("Permissions"), '', 'folder'); +print load_fiche_titre($langs->trans("PermissionsOnFiles"), '', 'folder'); print ''.$langs->trans("PermissionsOnFilesInWebRoot").': '; // TODO Check permission are read only except for custom dir @@ -151,9 +151,18 @@ print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), //print ''.$langs->trans("PasswordEncryption").': '; print 'MAIN_SECURITY_HASH_ALGO = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? $langs->trans("Undefined") : '')."   "; -print '   If unset: \'md5\' '; -print ' - Recommanded value: \'password_hash\'
'; -print 'MAIN_SECURITY_SALT = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : '').'
'; +print '     If unset: \'md5\'
'; +if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') { + print 'MAIN_SECURITY_SALT = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : $conf->global->MAIN_SECURITY_SALT).'
'; +} +if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') { + print 'The recommanded value for MAIN_SECURITY_HASH_ALGO is now \'password_hash\' but setting it now will make ALL existing passwords of all users not valid, so update is not possible.
'; + print 'If you really want to switch, you must:
'; + print '- Go on home - setup - other and add constant MAIN_SECURITY_HASH_ALGO to value \'password_hash\'
'; + print '- In same session, WITHOUT LOGGING OUT, go into your admin user record and set a new password
'; + print '- You can now logout and login with this new password. You must now reset password of all other users.
'; + print '

'; +} print '
'; // TODO diff --git a/htdocs/admin/system/xdebug.php b/htdocs/admin/system/xdebug.php index 186edc02dbd..fd10aad05e8 100644 --- a/htdocs/admin/system/xdebug.php +++ b/htdocs/admin/system/xdebug.php @@ -37,15 +37,18 @@ llxHeader(); print load_fiche_titre("XDebug", '', 'title_setup'); -print "
\n"; - - if (!function_exists('xdebug_is_enabled')) { + print "
\n"; print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.'; llxFooter(); exit; } +print ''; +print $langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug")); +print ''; + +print '

'; if (function_exists('socket_create')) { $address = ini_get('xdebug.remote_host') ?ini_get('xdebug.remote_host') : '127.0.0.1'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a94eaa75dcf..d7c2132a5e9 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -37,6 +37,7 @@ UnlockNewSessions=Remove connection lock YourSession=Your session Sessions=Users Sessions WebUserGroup=Web server user/group +PermissionsOnFiles=Permissions on files PermissionsOnFilesInWebRoot=Permissions on files in web root directory PermissionsOnFile=Permissions on file %s NoSessionFound=Your PHP configuration seems to not allow listing of active sessions. The directory used to save sessions (%s) may be protected (for example by OS permissions or by PHP directive open_basedir). @@ -62,6 +63,7 @@ IfModuleEnabled=Note: yes is effective only if module %s is enabled RemoveLock=Remove/rename file %s if it exists, to allow usage of the Update/Install tool. RestoreLock=Restore file %s, with read permission only, to disable any further use of the Update/Install tool. SecuritySetup=Security setup +PHPSetup=PHP setup SecurityFilesDesc=Define here options related to security about uploading files. ErrorModuleRequirePHPVersion=Error, this module requires PHP version %s or higher ErrorModuleRequireDolibarrVersion=Error, this module requires Dolibarr version %s or higher @@ -2098,7 +2100,7 @@ SwitchThisForABetterSecurity=Switching this value to %s is recommended for more DictionaryProductNature= Nature of product CountryIfSpecificToOneCountry=Country (if specific to a given country) YouMayFindSecurityAdviceHere=You may find security advisory here -ModuleActivatedMayExposeInformation=This module may expose sensitive data. If you don't need it, disable it. +ModuleActivatedMayExposeInformation=This PHP extension may expose sensitive data. If you don't need it, disable it. ModuleActivatedDoNotUseInProduction=A module designed for the development has been enabled. Do not enable it on a production environment. CombinationsSeparator=Separator character for product combinations SeeLinkToOnlineDocumentation=See link to online documention on top menu for examples From ab89d8509518d56096af65485cd6e45fcc9261ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 11:33:07 +0100 Subject: [PATCH 13/19] Fix for php8 --- .../facture/class/facture-rec.class.php | 21 ++++++++--- htdocs/core/class/commoninvoice.class.php | 36 +++++++++++++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 1c4d0e8326f..09efdb60f29 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -649,10 +649,7 @@ class FactureRec extends CommonInvoice $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, '; $sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,'; $sql .= ' l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price, l.buy_price_ht as pa_ht,'; - //$sql.= ' l.situation_percent, l.fk_prev_id,'; - //$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,'; $sql .= ' l.rang, l.special_code,'; - //$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price, l.buy_price_ht as pa_ht,'; $sql .= ' l.fk_unit, l.fk_contract_line,'; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; @@ -674,12 +671,12 @@ class FactureRec extends CommonInvoice $line->rowid = $objp->rowid; $line->desc = $objp->description; // Description line $line->description = $objp->description; // Description line - $line->product_type = $objp->product_type; // Type of line $line->ref = $objp->product_ref; // Ref product $line->product_ref = $objp->product_ref; // Ref product $line->libelle = $objp->product_label; // deprecated $line->product_label = $objp->product_label; // Label product $line->product_desc = $objp->product_desc; // Description product + $line->product_type = $objp->product_type; // Type of line $line->fk_product_type = $objp->fk_product_type; // Type of product $line->qty = $objp->qty; $line->subprice = $objp->subprice; @@ -693,7 +690,7 @@ class FactureRec extends CommonInvoice $line->localtax1_type = $objp->localtax1_type; $line->localtax2_type = $objp->localtax2_type; $line->remise_percent = $objp->remise_percent; - $line->fk_remise_except = $objp->fk_remise_except; + //$line->fk_remise_except = $objp->fk_remise_except; $line->fk_product = $objp->fk_product; $line->date_start_fill = $objp->date_start_fill; $line->date_end_fill = $objp->date_end_fill; @@ -1925,6 +1922,18 @@ class FactureLigneRec extends CommonInvoiceLine public $table_element = 'facturedet_rec'; + public $fk_product_fournisseur_price; + public $fk_fournprice; // For backward compatibility + + public $rang; + + public $desc; + public $description; + + public $fk_product_type; // Use instead product_type + + public $fk_contract_line; + /** * Delete line in database @@ -2048,7 +2057,9 @@ class FactureLigneRec extends CommonInvoiceLine $this->multicurrency_total_ht = $objp->multicurrency_total_ht; $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $this->buy_price_ht = $objp->buy_price_ht; + $this->fk_product_fournisseur_price = $objp->fk_product_fournisseur_price; $this->fk_user_author = $objp->fk_user_author; $this->fk_user_modif = $objp->fk_user_modif; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index d951807976f..6366cf52756 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -875,6 +875,13 @@ abstract class CommonInvoiceLine extends CommonObjectLine */ public $subprice; + /** + * Unit price before taxes + * @var float + * @deprecated + */ + public $price; + /** * Id of corresponding product * @var int @@ -905,12 +912,31 @@ abstract class CommonInvoiceLine extends CommonObjectLine */ public $localtax2_tx; + /** + * Local tax 1 type + * @var string + */ + public $localtax1_type; + + /** + * Local tax 2 type + * @var string + */ + public $localtax2_type; + /** * Percent of discount * @var float */ public $remise_percent; + /** + * Fixed discount + * @var float + * @deprecated + */ + public $remise; + /** * Total amount before taxes * @var float @@ -944,6 +970,13 @@ abstract class CommonInvoiceLine extends CommonObjectLine public $date_start_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_start at creation public $date_end_fill; // If set to 1, when invoice is created from a template invoice, it will also auto set the field date_end at creation + public $buy_price_ht; + public $buyprice; // For backward compatibility + public $pa_ht; // For backward compatibility + + public $marge_tx; + public $marque_tx; + /** * List of cumulative options: * Bit 0: 0 for common VAT - 1 if VAT french NPR @@ -960,4 +993,7 @@ abstract class CommonInvoiceLine extends CommonObjectLine public $multicurrency_total_ht; public $multicurrency_total_tva; public $multicurrency_total_ttc; + + public $fk_user_author; + public $fk_user_modif; } From 4f4829ea700b7a0ab8ea4e3723c3ec2cc0875b14 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 8 Mar 2021 11:33:37 +0100 Subject: [PATCH 14/19] FIX missing user get rights --- htdocs/public/cron/cron_run_jobs_by_url.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index e5636e4245a..aaf7e38cac8 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -107,6 +107,8 @@ if ($result < 0) { exit; } } +$user->getrights(); + $id = GETPOST('id', 'alpha'); // We accept non numeric id. We will filter later. From e087c6ffe01d4f424306912a3a3631f33da967c6 Mon Sep 17 00:00:00 2001 From: x Date: Mon, 8 Mar 2021 11:35:59 +0100 Subject: [PATCH 15/19] FIX : Rounding amount on card updating --- htdocs/compta/tva/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 htdocs/compta/tva/card.php diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php old mode 100644 new mode 100755 index 9b0de34a1ed..7c7514f1559 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -590,9 +590,9 @@ if ($id) print ''; if ($action == 'edit') { - print '' . $langs->trans("Amount") . ''; + print '' . $langs->trans("Amount") . ''; } else { - print '' . $langs->trans("Amount") . '' . price($object->amount) . ''; + print '' . $langs->trans("Amount") . '' . price($object->amount, 0, $outputlangs, 1, -1, 2, $conf->currency) . ''; } // Mode of payment From 9d8ec0441b7614c43fa4336d0ecda1aa3cb15ffe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 11:43:03 +0100 Subject: [PATCH 16/19] css --- htdocs/theme/eldy/global.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 84546f0068d..ce30f636301 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1774,8 +1774,8 @@ div.vmenu, td.vmenu { div.fiche { - margin-: dol_optimize_smallscreen) ? '30' : '6')); ?>px; - margin-: dol_optimize_smallscreen) ? '28' : '6')); ?>px; + margin-: dol_optimize_smallscreen) ? '32' : '6')); ?>px; + margin-: dol_optimize_smallscreen) ? '30' : '6')); ?>px; @@ -1822,7 +1822,7 @@ div.fichetwothirdright { } ?> } div.fichetwothirdright div.ficheaddleft { - padding-: 20px; + padding-: 28px; } div.fichehalfleft { browser->layout != 'phone') { From 89066e50f894d003a6d8ecadd6603f2a06a9158c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 12:07:01 +0100 Subject: [PATCH 17/19] css --- htdocs/admin/const.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 1e98a1f8736..177a38e382b 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -266,16 +266,16 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; print ''; // Note print ''; - print ''; + print ''; print ''; // Date last change - print ''; + print ''; print dol_print_date($db->jdate($obj->tms), 'dayhour'); print ''; From 7bd93aa3ad6e1cd6b12f46d0b172ebccf66053b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 14:31:02 +0100 Subject: [PATCH 18/19] Fix price format --- htdocs/compta/tva/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 97643714df9..40261cb7f05 100755 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -549,9 +549,9 @@ if ($id) { print ''; if ($action == 'edit') { - print '' . $langs->trans("Amount") . ''; + print '' . $langs->trans("Amount") . ''; } else { - print '' . $langs->trans("Amount") . '' . price($object->amount, 0, $outputlangs, 1, -1, 2, $conf->currency) . ''; + print '' . $langs->trans("Amount") . '' . price($object->amount) . ''; } // Mode of payment From 1aba0c2bc9b60bda1a1361dec71a5383ad587651 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 15:56:41 +0100 Subject: [PATCH 19/19] NEW Can set order of execution of hooks --- htdocs/core/class/hookmanager.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 9d3ea8f39d6..ff6d364b8fe 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -120,7 +120,8 @@ class HookManager if ($resaction) { $controlclassname = 'Actions'.ucfirst($module); $actionInstance = new $controlclassname($this->db); - $this->hooks[$context][$module] = $actionInstance; + $priority = empty($actionInstance->priority) ? 50 : $actionInstance->priority; + $this->hooks[$context][$priority.':'.$module] = $actionInstance; } } } @@ -130,6 +131,8 @@ class HookManager dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG); } + ksort($this->hooks[$context], SORT_NATURAL); + return 1; } @@ -238,8 +241,10 @@ class HookManager $error = 0; foreach ($this->hooks as $context => $modules) { // $this->hooks is an array with context as key and value is an array of modules that handle this context if (!empty($modules)) { + // Loop on each active hooks of module for this context foreach ($modules as $module => $actionclassinstance) { - //print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."
\n"; + $module = preg_replace('/^\d+:/', '', $module); + //print "Before hook ".get_class($actionclassinstance)." method=".$method." module=".$module." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."
\n"; // test to avoid running twice a hook, when a module implements several active contexts if (in_array($module, $modulealreadyexecuted)) {