From 71a2c20d4bb205a8e945160fbd78e9891345e15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 9 Feb 2021 14:32:04 +0100 Subject: [PATCH 01/63] massaction validate invoice do not regenerate pdf --- htdocs/core/actions_massactions.inc.php | 35 +++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 77fbea3c36a..abcdd690d5c 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -3,7 +3,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * * 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 @@ -1167,7 +1167,38 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) $error++; break; } - else $nbok++; + else { + // validate() rename pdf but do not regenerate + // Define output language + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + $newlang = $objecttmp->thirdparty->default_lang; + } + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); + } + $model = $objecttmp->model_pdf; + $ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records + // To be sure vars is defined + $hidedetails = !empty($hidedetails) ? $hidedetails : 0; + $hidedesc = !empty($hidedesc) ? $hidedesc : 0; + $hideref = !empty($hideref) ? $hideref : 0; + $moreparams = !empty($moreparams) ? $moreparams : null; + + $result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result < 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + } + } + $nbok++; + } } else { From bacafd326e0757705039d5999f9945d55ee83928 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 18 Feb 2021 16:13:40 +0100 Subject: [PATCH 02/63] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a79e9289458..1af905493d4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6377,8 +6377,14 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null); $substitutionarray['__NOTE_PRIVATE__'] = (isset($object->note_private) ? $object->note_private : null); - $substitutionarray['__DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); + $datedelivery = dol_getdate($object->date_livraison, true); + $substitutionarray['__DATE_DELIVERY_DAY__'] = (isset($object->date_livraison) ? sprintf("%02d", $datedelivery['mday']) : ''); + $substitutionarray['__DATE_DELIVERY_MON__'] = (isset($object->date_livraison) ? sprintf("%02d", $datedelivery['mon']) : ''); + $substitutionarray['__DATE_DELIVERY_YEAR__'] = (isset($object->date_livraison) ? $datedelivery['year'] : ''); + $substitutionarray['__DATE_DELIVERY_HH__'] = (isset($object->date_livraison) ? sprintf("%02d", $datedelivery['hours']) : ''); + $substitutionarray['__DATE_DELIVERY_MM__'] = (isset($object->date_livraison) ? sprintf("%02d", $datedelivery['minutes']) : ''); + $substitutionarray['__DATE_DELIVERY_SS__'] = (isset($object->date_livraison) ? sprintf("%02d", $datedelivery['seconds']) : ''); // For backward compatibility $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); From 1017d480f927034b623e61087a19ae06cb940e71 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 20 Feb 2021 07:08:37 +0100 Subject: [PATCH 03/63] Code enhanced - Standardize field name #14697 --- ChangeLog | 3 ++- htdocs/core/class/commonobject.class.php | 2 +- .../install/mysql/migration/13.0.0-14.0.0.sql | 4 ++++ .../mysql/tables/llx_supplier_proposal.sql | 4 ++-- .../class/supplier_proposal.class.php | 13 ++++++------ htdocs/supplier_proposal/list.php | 20 +++++++++---------- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c88dec9f5e..795379c40ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,7 +19,8 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * The ICS value for direct debit or credit transfer is now store on each bank account instead of into the global setup. * API /setup/shipment_methods has been replaced with API /setup/shipping_methods - +* Field tva move to total_tva in llx_supplier_proposal +* Field total move to total_ttc in llx_supplier_proposal ***** ChangeLog for 13.0.1 compared to 13.0.0 ***** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0c0de66840b..335c56e989f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3232,7 +3232,7 @@ abstract class CommonObject if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva = 'total_tva'; if ($this->element == 'propal') $fieldttc = 'total'; if ($this->element == 'expensereport') $fieldtva = 'total_tva'; - if ($this->element == 'supplier_proposal') $fieldttc = 'total'; + if ($this->element == 'supplier_proposal') $fieldtva = 'total_tva'; if (empty($nodatabaseupdate)) { diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index bf3c9183b91..c166c97428e 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -173,3 +173,7 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailSubsEvent', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOragnisationEventEventSubscriptionWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailAttendes', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendes)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOragnisationEventBulkMailToAttendes)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailSpeakers', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOragnisationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); + +-- Code enhanced - Standardize field name +ALTER TABLE llx_supplier_proposal CHANGE COLUMN tva total_tva double(24,8) default 0; +ALTER TABLE llx_supplier_proposal CHANGE COLUMN total total_ttc double(24,8) default 0; diff --git a/htdocs/install/mysql/tables/llx_supplier_proposal.sql b/htdocs/install/mysql/tables/llx_supplier_proposal.sql index e63c4ff64c7..cf64d76d7d1 100644 --- a/htdocs/install/mysql/tables/llx_supplier_proposal.sql +++ b/htdocs/install/mysql/tables/llx_supplier_proposal.sql @@ -37,10 +37,10 @@ CREATE TABLE llx_supplier_proposal ( remise_absolue double DEFAULT 0, remise double DEFAULT 0, total_ht double(24,8) DEFAULT 0, - tva double(24,8) DEFAULT 0, + total_tva double(24,8) DEFAULT 0, localtax1 double(24,8) DEFAULT 0, localtax2 double(24,8) DEFAULT 0, - total double(24,8) DEFAULT 0, + total_ttc double(24,8) DEFAULT 0, fk_account integer DEFAULT NULL, fk_currency varchar(3) DEFAULT NULL, fk_cond_reglement integer DEFAULT NULL, diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 405c34734f3..c56fac31a3f 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -906,8 +906,8 @@ class SupplierProposal extends CommonObject $sql .= ", remise"; $sql .= ", remise_percent"; $sql .= ", remise_absolue"; - $sql .= ", tva"; - $sql .= ", total"; + $sql .= ", total_tva"; + $sql .= ", total_ttc"; $sql .= ", datec"; $sql .= ", ref"; $sql .= ", fk_user_author"; @@ -1200,7 +1200,7 @@ class SupplierProposal extends CommonObject global $conf; $sql = "SELECT p.rowid, p.entity, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; - $sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; + $sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht"; $sql .= ", p.datec"; $sql .= ", p.date_valid as datev"; $sql .= ", p.date_livraison as delivery_date"; @@ -1239,12 +1239,11 @@ class SupplierProposal extends CommonObject $this->remise = $obj->remise; $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; - $this->total = $obj->total; // TODO deprecated $this->total_ht = $obj->total_ht; - $this->total_tva = $obj->tva; + $this->total_tva = $obj->total_tva; $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; - $this->total_ttc = $obj->total; + $this->total_ttc = $obj->total_ttc; $this->socid = $obj->fk_soc; $this->fk_project = $obj->fk_project; $this->model_pdf = $obj->model_pdf; @@ -2784,7 +2783,7 @@ class SupplierProposalLine extends CommonObjectLine // Bit 0: 0 si TVA normal - 1 si TVA NPR // Bit 1: 0 ligne normale - 1 si ligne de remise fixe - public $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne + public $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne public $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne public $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 9826c2a409d..04bafe19297 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -152,7 +152,7 @@ $arrayfields = array( 'sp.date_valid'=>array('label'=>$langs->trans("Date"), 'checked'=>1), 'sp.date_livraison'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1), 'sp.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), - 'sp.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), + 'sp.total_tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'sp.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), 'sp.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), 'sp.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), @@ -253,7 +253,7 @@ if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DI $sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; -$sql .= ' sp.rowid, sp.note_private, sp.total_ht, sp.tva as total_vat, sp.total as total_ttc, sp.localtax1, sp.localtax2, sp.ref, sp.fk_statut as status, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,'; +$sql .= ' sp.rowid, sp.note_private, sp.total_ht, sp.total_tva, sp.total_ttc, sp.localtax1, sp.localtax2, sp.ref, sp.fk_statut as status, sp.fk_user_author, sp.date_valid, sp.date_livraison as dp,'; $sql .= ' sp.fk_multicurrency, sp.multicurrency_code, sp.multicurrency_tx, sp.multicurrency_total_ht, sp.multicurrency_total_tva as multicurrency_total_vat, sp.multicurrency_total_ttc,'; $sql .= ' sp.datec as date_creation, sp.tms as date_update,'; $sql .= " p.rowid as project_id, p.ref as project_ref,"; @@ -299,8 +299,8 @@ if ($search_ref) $sql .= natural_search('sp.ref', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_login) $sql .= natural_search('u.login', $search_login); if ($search_montant_ht) $sql .= natural_search('sp.total_ht=', $search_montant_ht, 1); -if ($search_montant_vat != '') $sql .= natural_search("sp.tva", $search_montant_vat, 1); -if ($search_montant_ttc != '') $sql .= natural_search("sp.total", $search_montant_ttc, 1); +if ($search_montant_vat != '') $sql .= natural_search("sp.total_tva", $search_montant_vat, 1); +if ($search_montant_ttc != '') $sql .= natural_search("sp.total_ttc", $search_montant_ttc, 1); if ($search_multicurrency_code != '') $sql .= ' AND sp.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"'; if ($search_multicurrency_tx != '') $sql .= natural_search('sp.multicurrency_tx', $search_multicurrency_tx, 1); if ($search_multicurrency_montant_ht != '') $sql .= natural_search('sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1); @@ -552,7 +552,7 @@ if ($resql) print ''; print ''; } - if (!empty($arrayfields['sp.total_vat']['checked'])) + if (!empty($arrayfields['sp.total_tva']['checked'])) { // Amount print ''; @@ -653,7 +653,7 @@ if ($resql) if (!empty($arrayfields['sp.date_valid']['checked'])) print_liste_field_titre($arrayfields['sp.date_valid']['label'], $_SERVER["PHP_SELF"], 'sp.date_valid', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['sp.date_livraison']['checked'])) print_liste_field_titre($arrayfields['sp.date_livraison']['label'], $_SERVER["PHP_SELF"], 'sp.date_livraison', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['sp.total_ht']['checked'])) print_liste_field_titre($arrayfields['sp.total_ht']['label'], $_SERVER["PHP_SELF"], 'sp.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); - if (!empty($arrayfields['sp.total_vat']['checked'])) print_liste_field_titre($arrayfields['sp.total_vat']['label'], $_SERVER["PHP_SELF"], 'sp.total_vat', '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['sp.total_tva']['checked'])) print_liste_field_titre($arrayfields['sp.total_tva']['label'], $_SERVER["PHP_SELF"], 'sp.total_tva', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['sp.total_ttc']['checked'])) print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['sp.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['sp.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_code', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['sp.multicurrency_tx']['checked'])) print_liste_field_titre($arrayfields['sp.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'sp.multicurrency_tx', '', $param, '', $sortfield, $sortorder); @@ -803,12 +803,12 @@ if ($resql) $totalarray['val']['sp.total_ht'] += $obj->total_ht; } // Amount VAT - if (!empty($arrayfields['sp.total_vat']['checked'])) + if (!empty($arrayfields['sp.total_tva']['checked'])) { - print ''.price($obj->total_vat)."\n"; + print ''.price($obj->total_tva)."\n"; if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_vat'; - $totalarray['val']['sp.total_vat'] += $obj->total_vat; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_tva'; + $totalarray['val']['sp.total_tva'] += $obj->total_tva; } // Amount TTC if (!empty($arrayfields['sp.total_ttc']['checked'])) From 3dcfe40e71eb1db956ae5da96ef703cf0122716a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 20 Feb 2021 08:00:27 +0100 Subject: [PATCH 04/63] Code enhanced - Standardize field name #14697 --- ChangeLog | 2 +- htdocs/comm/card.php | 2 +- htdocs/comm/index.php | 4 ++-- htdocs/commande/class/commande.class.php | 6 +++--- htdocs/commande/list.php | 6 +++--- htdocs/compta/index.php | 4 ++-- htdocs/core/boxes/box_commandes.php | 2 +- htdocs/core/class/commonobject.class.php | 1 + htdocs/core/modules/modCommande.class.php | 2 +- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_commande.sql | 2 +- 11 files changed, 19 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c88dec9f5e..9dca78c16a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,7 +19,7 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * The ICS value for direct debit or credit transfer is now store on each bank account instead of into the global setup. * API /setup/shipment_methods has been replaced with API /setup/shipping_methods - +* Field tva move to total_tva in llx_commande ***** ChangeLog for 13.0.1 compared to 13.0.0 ***** diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 2f5cb064a5e..407280d2204 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -815,7 +815,7 @@ if ($object->id > 0) { $sql = "SELECT s.nom, s.rowid"; $sql .= ", c.rowid as cid, c.total_ht"; - $sql .= ", c.tva as total_tva"; + $sql .= ", c.total_tva"; $sql .= ", c.total_ttc"; $sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture"; $sql .= ", c.date_commande as dc"; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 46636f93812..fec8622d77a 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -318,7 +318,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa * Draft customer orders */ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { - $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, c.fk_statut as status"; + $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; @@ -875,7 +875,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { * Opened (validated) order */ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { - $sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; + $sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6b75d57d082..cb16e419ee8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -313,7 +313,7 @@ class Commande extends CommonOrder 'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110), 'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115), //'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120), - 'tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1), + 'total_tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1), 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1), 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), @@ -1791,7 +1791,7 @@ class Commande extends CommonOrder if (empty($id) && empty($ref) && empty($ref_ext)) return -1; $sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut'; - $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; + $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; $sql .= ', c.fk_account'; $sql .= ', c.date_commande, c.date_valid, c.tms'; $sql .= ', c.date_livraison as delivery_date'; @@ -3297,7 +3297,7 @@ class Commande extends CommonOrder $sql .= " fk_soc=".(isset($this->socid) ? $this->socid : "null").","; $sql .= " date_commande=".(strval($this->date_commande) != '' ? "'".$this->db->idate($this->date_commande)."'" : 'null').","; $sql .= " date_valid=".(strval($this->date_validation) != '' ? "'".$this->db->idate($this->date_validation)."'" : 'null').","; - $sql .= " tva=".(isset($this->total_tva) ? $this->total_tva : "null").","; + $sql .= " total_tva=".(isset($this->total_tva) ? $this->total_tva : "null").","; $sql .= " localtax1=".(isset($this->total_localtax1) ? $this->total_localtax1 : "null").","; $sql .= " localtax2=".(isset($this->total_localtax2) ? $this->total_localtax2 : "null").","; $sql .= " total_ht=".(isset($this->total_ht) ? $this->total_ht : "null").","; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 8b4a79f4dda..a5f548d6e6a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -286,7 +286,7 @@ if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DI $sql .= ' s.rowid as socid, s.nom as name, s.name_alias as name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; -$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,'; +$sql .= ' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,'; $sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,'; $sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,'; $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,'; @@ -369,7 +369,7 @@ if ($search_company_alias) $sql .= natural_search('s.name_alia if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1); -if ($search_total_vat != '') $sql .= natural_search('c.tva', $search_total_vat, 1); +if ($search_total_vat != '') $sql .= natural_search('c.total_tva', $search_total_vat, 1); if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1); if ($search_warehouse != '' && $search_warehouse != '-1') $sql .= natural_search('c.fk_warehouse', $search_warehouse, 1); if ($search_multicurrency_code != '') $sql .= ' AND c.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"'; @@ -941,7 +941,7 @@ if ($resql) if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['c.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "c.fk_cond_reglement", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['c.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "c.fk_mode_reglement", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); - if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.total_tva', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['c.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['c.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_code', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['c.multicurrency_tx']['checked'])) print_liste_field_titre($arrayfields['c.multicurrency_tx']['label'], $_SERVER['PHP_SELF'], 'c.multicurrency_tx', '', $param, '', $sortfield, $sortorder); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index dc397d286cc..8a50619f17c 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -831,7 +831,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user $sql .= ", s.nom as name, s.email"; $sql .= ", s.rowid as socid"; $sql .= ", s.code_client, s.code_compta"; - $sql .= ", c.rowid, c.ref, c.facture, c.fk_statut as status, c.total_ht, c.tva as total_tva, c.total_ttc,"; + $sql .= ", c.rowid, c.ref, c.facture, c.fk_statut as status, c.total_ht, c.total_tva, c.total_ttc,"; $sql .= " cc.rowid as country_id, cc.code as country_code"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -849,7 +849,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user $reshook = $hookmanager->executeHooks('printFieldListWhereCustomerOrderToBill', $parameters); $sql .= $hookmanager->resPrint; - $sql .= " GROUP BY s.nom, s.email, s.rowid, s.code_client, s.code_compta, c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva, c.total_ttc, cc.rowid, cc.code"; + $sql .= " GROUP BY s.nom, s.email, s.rowid, s.code_client, s.code_compta, c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.total_tva, c.total_ttc, cc.rowid, cc.code"; $resql = $db->query($sql); if ($resql) diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 9b020a05711..f13f7ffa1f9 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -98,7 +98,7 @@ class box_commandes extends ModeleBoxes $sql .= ", c.fk_user_valid"; $sql .= ", c.facture"; $sql .= ", c.total_ht"; - $sql .= ", c.tva as total_tva"; + $sql .= ", c.total_tva"; $sql .= ", c.total_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande as c"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0c0de66840b..503fa93abe2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3233,6 +3233,7 @@ abstract class CommonObject if ($this->element == 'propal') $fieldttc = 'total'; if ($this->element == 'expensereport') $fieldtva = 'total_tva'; if ($this->element == 'supplier_proposal') $fieldttc = 'total'; + if ($this->element == 'commande') $fieldtva = 'total_tva'; if (empty($nodatabaseupdate)) { diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index f257c6e3132..8cc0dedec6c 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -288,7 +288,7 @@ class modCommande extends DolibarrModules 'c.fk_user_valid' => 'ValidatedById', 'c.fk_statut' => 'Status*', 'c.remise_percent' => 'GlobalDiscount', - 'c.tva' => 'TotalTVA', + 'c.total_tva' => 'TotalTVA', 'c.total_ht' => 'TotalHT', 'c.total_ttc' => 'TotalTTC', 'c.note_private' => 'NotePrivate', diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index bf3c9183b91..1e169632a85 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -173,3 +173,6 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailSubsEvent', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOragnisationEventEventSubscriptionWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailAttendes', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendes)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOragnisationEventBulkMailToAttendes)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailSpeakers', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOragnisationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); + +-- Code enhanced - Standardize field name +ALTER TABLE llx_commande CHANGE COLUMN tva total_tva double(24,8) default 0; diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index add836ce5d5..e3a075933c2 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -47,7 +47,7 @@ create table llx_commande remise_percent real default 0, remise_absolue real default 0, remise real default 0, - tva double(24,8) default 0, + total_tva double(24,8) default 0, localtax1 double(24,8) default 0, -- total localtax1 localtax2 double(24,8) default 0, -- total localtax2 total_ht double(24,8) default 0, From ba80f35b7eac82e0fb744978911f1803b1ff8c1b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 20 Feb 2021 08:06:30 +0100 Subject: [PATCH 05/63] Code enhanced - Standardize field name --- htdocs/comm/index.php | 2 +- htdocs/fourn/card.php | 2 +- htdocs/product/stats/supplier_proposal.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- htdocs/supplier_proposal/index.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index fec8622d77a..49e9eba4980 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -228,7 +228,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { * Draft supplier proposals */ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { - $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.fk_statut as status"; + $sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 9d18f3cfd1a..9794ea3cc11 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -550,7 +550,7 @@ if ($object->id > 0) { $langs->loadLangs(array("supplier_proposal")); - $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total as total_ttc"; + $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p "; $sql .= " WHERE p.fk_soc =".$object->id; $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")"; diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index b4816028d98..15c3f1db230 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -204,7 +204,7 @@ if ($id > 0 || !empty($ref)) print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("DatePropal", $_SERVER["PHP_SELF"], "p.date_valid", "", $option, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "p.total", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "p.total_ttc", "", $option, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 405c34734f3..e4c9266a523 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1200,7 +1200,7 @@ class SupplierProposal extends CommonObject global $conf; $sql = "SELECT p.rowid, p.entity, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; - $sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; + $sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht"; $sql .= ", p.datec"; $sql .= ", p.date_valid as datev"; $sql .= ", p.date_livraison as delivery_date"; diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 476c2a14db2..495bd1f3d68 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -304,7 +304,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa $now = dol_now(); - $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as supplier_proposalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datec as dp"; + $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as supplier_proposalid, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datec as dp"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."supplier_proposal as p"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; From 542af217bb3fa88d1a1cdc04f9632666e1177471 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 20 Feb 2021 08:08:41 +0100 Subject: [PATCH 06/63] Revert "Code enhanced - Standardize field name" This reverts commit ba80f35b7eac82e0fb744978911f1803b1ff8c1b. --- htdocs/comm/index.php | 2 +- htdocs/fourn/card.php | 2 +- htdocs/product/stats/supplier_proposal.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- htdocs/supplier_proposal/index.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 49e9eba4980..fec8622d77a 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -228,7 +228,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { * Draft supplier proposals */ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { - $sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; + $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 9794ea3cc11..9d18f3cfd1a 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -550,7 +550,7 @@ if ($object->id > 0) { $langs->loadLangs(array("supplier_proposal")); - $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.total_tva, p.total_ttc"; + $sql = "SELECT p.rowid, p.ref, p.date_valid as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total as total_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p "; $sql .= " WHERE p.fk_soc =".$object->id; $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")"; diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 15c3f1db230..b4816028d98 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -204,7 +204,7 @@ if ($id > 0 || !empty($ref)) print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("DatePropal", $_SERVER["PHP_SELF"], "p.date_valid", "", $option, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "p.total_ttc", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "p.total", "", $option, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index e4c9266a523..405c34734f3 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1200,7 +1200,7 @@ class SupplierProposal extends CommonObject global $conf; $sql = "SELECT p.rowid, p.entity, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; - $sql .= ", p.total_ttc, p.total_tva, p.localtax1, p.localtax2, p.total_ht"; + $sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql .= ", p.datec"; $sql .= ", p.date_valid as datev"; $sql .= ", p.date_livraison as delivery_date"; diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 495bd1f3d68..476c2a14db2 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -304,7 +304,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa $now = dol_now(); - $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as supplier_proposalid, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datec as dp"; + $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as supplier_proposalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datec as dp"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."supplier_proposal as p"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; From 9a2e99e9e9678f1f781248dfb0b6e3e16022fc1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Feb 2021 11:09:23 +0100 Subject: [PATCH 07/63] Clean packager --- build/generate_filelist_xml.php | 6 ++++-- build/makepack-dolibarr.pl | 2 -- htdocs/main.inc.php | 2 +- htdocs/viewimage.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 50eb6c84def..6bfbb9c5c9c 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -153,6 +153,7 @@ $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom $regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; $regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); + $dir=''; $needtoclose=0; foreach ($files as $filetmp) { @@ -160,9 +161,10 @@ foreach ($files as $filetmp) { //$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file)); $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); if ($newdir!=$dir) { - if ($needtoclose) + if ($needtoclose) { fputs($fp, ' '."\n"); - fputs($fp, ' '."\n"); + } + fputs($fp, ' '."\n"); $dir = $newdir; $needtoclose=1; } diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 5c5baaac3bc..0fe73fd9fb8 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -579,7 +579,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`; @@ -624,7 +623,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 78ed3d82bda..9872ac67fc3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -38,7 +38,7 @@ // For optional tuning. Enabled if environment variable MAIN_SHOW_TUNING_INFO is defined. $micro_start_time = 0; -if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) +if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO']) ) { list($usec, $sec) = explode(" ", microtime()); $micro_start_time = ((float) $usec + (float) $sec); diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 983c7996898..b81931cc999 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -34,7 +34,7 @@ if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Some value of modulepart can be used to get resources that are public so no login are required. // Note that only directory logo is free to access without login. From 910fa6c041cb095738dcdd04dc24b639864a8bfd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Feb 2021 11:16:26 +0100 Subject: [PATCH 08/63] Fix missing dir for fedora rpm --- build/rpm/dolibarr_fedora.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 99061b24eab..d50c91d1f05 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -212,6 +212,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/public +%_datadir/dolibarr/htdocs/recruitment %_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/salaries From 6f6352d9c467c69f4b300f1238cf4cd8d3414127 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Feb 2021 11:33:25 +0100 Subject: [PATCH 09/63] Fix syntax --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 9872ac67fc3..78ed3d82bda 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -38,7 +38,7 @@ // For optional tuning. Enabled if environment variable MAIN_SHOW_TUNING_INFO is defined. $micro_start_time = 0; -if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO']) ) +if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) { list($usec, $sec) = explode(" ", microtime()); $micro_start_time = ((float) $usec + (float) $sec); From 104cf5bdb5cf5b9e9d3e9c387206768644896aa1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Feb 2021 11:34:11 +0100 Subject: [PATCH 10/63] Fix syntax --- htdocs/viewimage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index b81931cc999..983c7996898 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -34,7 +34,7 @@ if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Some value of modulepart can be used to get resources that are public so no login are required. // Note that only directory logo is free to access without login. From 8f91dd48c97ed7c403b828b9957d9cbddd368700 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Feb 2021 11:46:48 +0100 Subject: [PATCH 11/63] Fix file integrity message --- htdocs/admin/system/filecheck.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 4ed21144346..42ebe6b97e5 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -374,14 +374,6 @@ if (!$error && $xml) } $out .= ''; $out .= ''; - - // Show warning - if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3)) - { - setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings'); - } } else { print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile; $error++; @@ -407,6 +399,8 @@ if (!$error && $xml) var_dump($checksumtoget); var_dump($checksumget == $checksumtoget);*/ + $resultcomment = ''; + $outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown")); if ($checksumget == $checksumtoget) { @@ -414,7 +408,7 @@ if (!$error && $xml) { $resultcode = 'warning'; $resultcomment = 'FileIntegrityIsOkButFilesWereAdded'; - $outcurrentchecksum = $checksumget.' - '.$langs->trans("FileIntegrityIsOkButFilesWereAdded").''; + $outcurrentchecksum = $checksumget.' - '.$langs->trans($resultcomment).''; } else { $resultcode = 'ok'; $resultcomment = 'Success'; @@ -426,7 +420,18 @@ if (!$error && $xml) $outcurrentchecksum = ''.$checksumget.''; } - print load_fiche_titre($langs->trans("GlobalChecksum")).'
'; + // Show warning + if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3) && $resultcode == 'ok') { + setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs'); + } else { + if ($resultcode == 'warning') { + setEventMessages($langs->trans($resultcomment), null, 'warnings'); + } else { + setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'errors'); + } + } + + print load_fiche_titre($langs->trans("GlobalChecksum")); print $langs->trans("ExpectedChecksum").' = '.$outexpectedchecksum.'
'; print $langs->trans("CurrentChecksum").' = '.$outcurrentchecksum; From 6eb179a6fb5cabf12b1dbc69aa42138d89048f7a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sat, 20 Feb 2021 13:14:27 +0100 Subject: [PATCH 12/63] Update ChangeLog minor addings for 13.0.1 --- ChangeLog | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b08a59db9d..6556db79da2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,13 +10,13 @@ FIX: 11.0 when a mandatory extrafield of type sellist contains '0' it should be FIX: 11.0 when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized FIX: create MO, Column 'tms' cannot be null FIX: #14290 #15900 -FIX: #16076 -FIX: #16077 -FIX: #16079 -FIX: #16080 -FIX: 16084 +FIX: #16076 patch user/list.php for extrafields +FIX: #16077 patch wrong timezone +FIX: #16079 error of service date at duplicated invoice +FIX: #16080 mailing list title +FIX: #16084 DB error at projects FIX: #16107 -FIX: #16118 Timezone problem on some fields +FIX: #16118 Timezone problem on some fields FIX: #16131 FIX: #16135 FIX: #16143 @@ -47,7 +47,7 @@ FIX: select default mail template FIX: Select transport mode function when creating a supplier invoice and add unique key to the table llx_c_transport_mode in migrate sql FIX: Merge of thirdparties : "unknow column fk_soc" + "Delivery" label FIX: SQL Error in group by with postgres or mysql strict mode -FIX: takepos : load date function +FIX: TakePOS : load date function FIX: Timeout during import FIX: Trigger on expense report was not fired FIX: User creation of expense report not visible From 997dee67afedcd4ac728aff00616d059e16e35fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Feb 2021 17:42:51 +0100 Subject: [PATCH 13/63] fix propal box --- htdocs/core/boxes/box_propales.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 6efd56c01db..747bae87cf7 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2015-2019 Frederic France + * Copyright (C) 2015-2021 Frederic France * Copyright (C) 2020 Pierre Ardoin * * This program is free software; you can redistribute it and/or modify @@ -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, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.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"; From aa7b7101e4e19e04b28ae8f7454a92f481528860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Feb 2021 17:45:55 +0100 Subject: [PATCH 14/63] Update index.php --- htdocs/comm/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 46636f93812..cce0b202603 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -137,7 +137,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { * Draft customer proposals */ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { - $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.fk_statut as status"; + $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total as total_ttc, p.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; @@ -765,7 +765,7 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // T * Opened (validated) proposals */ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { - $sql = "SELECT p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; + $sql = "SELECT p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; From e94c78deafdfd739c59809dbc3a7693b004aeec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Feb 2021 17:47:12 +0100 Subject: [PATCH 15/63] Update card.php --- htdocs/comm/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 2f5cb064a5e..faffe18a8e6 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -7,7 +7,7 @@ * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2013 Alexandre Spangaro - * Copyright (C) 2015-2019 Frédéric France + * Copyright (C) 2015-2021 Frédéric France * Copyright (C) 2015 Marcos García * Copyright (C) 2020 Open-Dsi * @@ -741,12 +741,11 @@ if ($object->id > 0) /* * Latest proposals */ - if (!empty($conf->propal->enabled) && $user->rights->propal->lire) - { + if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { $langs->load("propal"); $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht"; - $sql .= ", p.tva as total_tva"; + $sql .= ", p.total_tva"; $sql .= ", p.total as total_ttc"; $sql .= ", p.ref, p.ref_client, p.remise"; $sql .= ", p.datep as dp, p.fin_validite as date_limit"; From da37497a38938c8736646c12c766b90d722ead6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Feb 2021 20:47:01 +0100 Subject: [PATCH 16/63] memcached can set expire --- htdocs/core/lib/memory.lib.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index 232b5a9d94a..484b3933e42 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -61,10 +61,11 @@ $shmoffset = 1000; // Max number of entries found into a language file. If too l * * @param string $memoryid Memory id of shared area * @param mixed $data Data to save. It must not be a null value. + * @param int $expire ttl in seconds, 0 never expire * @return int <0 if KO, 0 if nothing is done, Nb of bytes written if OK * @see dol_getcache() */ -function dol_setcache($memoryid, $data) +function dol_setcache($memoryid, $data, $expire = 0) { global $conf; $result = 0; @@ -85,7 +86,7 @@ function dol_setcache($memoryid, $data) $memoryid = session_name() . '_' . $memoryid; //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); - $dolmemcache->add($memoryid, $data); // This fails if key already exists + $dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists $rescode = $dolmemcache->getResultCode(); if ($rescode == 0) { return count($data); @@ -104,7 +105,7 @@ function dol_setcache($memoryid, $data) $memoryid = session_name() . '_' . $memoryid; //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); - $result = $dolmemcache->add($memoryid, $data); // This fails if key already exists + $result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists if ($result) { return count($data); } else { @@ -112,7 +113,7 @@ function dol_setcache($memoryid, $data) } } elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { // This is a really not reliable cache ! Use Memcached instead. // Using shmop - $result = dol_setshmop($memoryid, $data); + $result = dol_setshmop($memoryid, $data, $expire); } return $result; @@ -226,9 +227,10 @@ function dol_listshmop() * * @param int $memoryid Memory id of shared area ('main', 'agenda', ...) * @param string $data Data to save. Must be a not null value. + * @param int $expire ttl in seconds, 0 never expire * @return int <0 if KO, 0=Caching not available, Nb of bytes written if OK */ -function dol_setshmop($memoryid, $data) +function dol_setshmop($memoryid, $data, $expire) { global $shmkeys, $shmoffset; From 65925e60b9a3e9d524b58165d7e47a70862ff06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Feb 2021 20:48:59 +0100 Subject: [PATCH 17/63] memcached can set expire --- htdocs/core/lib/company.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 4d56fd9697a..1cc2945fef3 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -71,7 +71,7 @@ function societe_prepare_head(Societe $object) $nbContact = $obj->nb; } - dol_setcache($cachekey, $nbContact); // If setting cache fails, this is not a problem, so we do not test result. + dol_setcache($cachekey, $nbContact, 120); // If setting cache fails, this is not a problem, so we do not test result. } $head[$h][0] = DOL_URL_ROOT.'/societe/contact.php?socid='.$object->id; @@ -290,7 +290,7 @@ function societe_prepare_head(Societe $object) } else { dol_print_error($db); } - dol_setcache($cachekey, $nbNotif); // If setting cache fails, this is not a problem, so we do not test result. + dol_setcache($cachekey, $nbNotif, 120); // If setting cache fails, this is not a problem, so we do not test result. } $head[$h][0] = DOL_URL_ROOT.'/societe/notify/card.php?socid='.$object->id; @@ -356,7 +356,7 @@ function societe_prepare_head(Societe $object) } else { dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR); } - dol_setcache($cachekey, $nbEvent); // If setting cache fails, this is not a problem, so we do not test result. + dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result. } $head[$h][1] .= '/'; From 518826ad3d3299dcc81c0568e683fd7bbf8b483b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Feb 2021 22:03:11 +0100 Subject: [PATCH 18/63] add project --- htdocs/core/lib/company.lib.php | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 1cc2945fef3..02754798681 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -129,22 +129,30 @@ function societe_prepare_head(Societe $object) } if (!empty($conf->projet->enabled) && (!empty($user->rights->projet->lire))) { - $nbNote = 0; - $sql = "SELECT COUNT(n.rowid) as nb"; - $sql .= " FROM ".MAIN_DB_PREFIX."projet as n"; - $sql .= " WHERE fk_soc = ".$object->id; - $sql .= " AND entity IN (".getEntity('project').")"; - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - $nbNote = $obj->nb; + $nbProject = 0; + $cachekey = 'count_projects_thirdparty_'.$object->id; + $dataretrieved = dol_getcache($cachekey); + + if (!is_null($dataretrieved)) { + $nbProject = $dataretrieved; } else { - dol_print_error($db); + $sql = "SELECT COUNT(n.rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as n"; + $sql .= " WHERE fk_soc = ".$object->id; + $sql .= " AND entity IN (".getEntity('project').")"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $nbProject = $obj->nb; + } else { + dol_print_error($db); + } + dol_setcache($cachekey, $nbProject, 120); // If setting cache fails, this is not a problem, so we do not test result. } $head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id; $head[$h][1] = $langs->trans("Projects"); - if ($nbNote > 0) { - $head[$h][1] .= ''.$nbNote.''; + if ($nbProject > 0) { + $head[$h][1] .= ''.$nbProject.''; } $head[$h][2] = 'project'; $h++; From 41b89ae6774b64d5428b5744c31d9009cb489988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 21 Feb 2021 09:50:58 +0100 Subject: [PATCH 19/63] add files and links --- htdocs/core/lib/company.lib.php | 39 +++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 02754798681..310f34a86fb 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -52,10 +52,10 @@ function societe_prepare_head(Societe $object) if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) { if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->societe->contact->lire) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; - //$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); $nbContact = 0; + // Enable caching of thirdrparty count Contacts + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_contacts_thirdparty_'.$object->id; $dataretrieved = dol_getcache($cachekey); @@ -130,6 +130,8 @@ function societe_prepare_head(Societe $object) if (!empty($conf->projet->enabled) && (!empty($user->rights->projet->lire))) { $nbProject = 0; + // Enable caching of thirdrparty count projects + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_projects_thirdparty_'.$object->id; $dataretrieved = dol_getcache($cachekey); @@ -279,10 +281,9 @@ function societe_prepare_head(Societe $object) if ($user->socid == 0) { // Notifications if (!empty($conf->notification->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; - $nbNotif = 0; // Enable caching of thirdrparty count notifications + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_notifications_thirdparty_'.$object->id; $dataretrieved = dol_getcache($cachekey); if (!is_null($dataretrieved)) { @@ -326,17 +327,28 @@ function societe_prepare_head(Societe $object) $head[$h][2] = 'note'; $h++; - // Attached files - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id; - $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); - $nbLinks = Link::count($db, $object->element, $object->id); + // Attached files and Links + $totalAttached = 0; + // Enable caching of thirdrparty count attached files and links + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_attached_thirdparty_'.$object->id; + $dataretrieved = dol_getcache($cachekey); + if (!is_null($dataretrieved)) { + $totalAttached = $dataretrieved; + } else { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; + $upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id; + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); + $nbLinks = Link::count($db, $object->element, $object->id); + $totalAttached = $nbFiles + $nbLinks; + dol_setcache($cachekey, $totalAttached, 120); // If setting cache fails, this is not a problem, so we do not test result. + } $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; $head[$h][1] = $langs->trans("Documents"); - if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; + if (($totalAttached) > 0) { + $head[$h][1] .= ''.($totalAttached).''; } $head[$h][2] = 'document'; $h++; @@ -345,10 +357,9 @@ function societe_prepare_head(Societe $object) $head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; $head[$h][1] = $langs->trans("Events"); if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; - $nbEvent = 0; // Enable caching of thirdrparty count actioncomm + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_events_thirdparty_'.$object->id; $dataretrieved = dol_getcache($cachekey); if (!is_null($dataretrieved)) { From 5096c5bf2d3c70ad0006c9fdb6e131826c445034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 21 Feb 2021 10:18:05 +0100 Subject: [PATCH 20/63] cache socialnetworks array --- htdocs/core/lib/functions.lib.php | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7d994616e5c..28098dab45b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2450,21 +2450,32 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64, function getArrayOfSocialNetworks() { global $conf, $db; - $sql = "SELECT rowid, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks"; - $sql .= " WHERE entity=".$conf->entity; + $socialnetworks = array(); - $resql = $db->query($sql); - if ($resql) { - while ($obj = $db->fetch_object($resql)) { - $socialnetworks[$obj->code] = array( - 'rowid' => $obj->rowid, - 'label' => $obj->label, - 'url' => $obj->url, - 'icon' => $obj->icon, - 'active' => $obj->active, - ); + // Enable caching of array + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'socialnetworks_' . $conf->entity; + $dataretrieved = dol_getcache($cachekey); + if (!is_null($dataretrieved)) { + $socialnetworks = $dataretrieved; + } else { + $sql = "SELECT rowid, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks"; + $sql .= " WHERE entity=".$conf->entity; + $resql = $db->query($sql); + if ($resql) { + while ($obj = $db->fetch_object($resql)) { + $socialnetworks[$obj->code] = array( + 'rowid' => $obj->rowid, + 'label' => $obj->label, + 'url' => $obj->url, + 'icon' => $obj->icon, + 'active' => $obj->active, + ); + } } + dol_setcache($cachekey, $socialnetworks); // If setting cache fails, this is not a problem, so we do not test result. } + return $socialnetworks; } From 0d01041166f71498df9428fbbcf574de474c6486 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Feb 2021 12:10:07 +0100 Subject: [PATCH 21/63] css --- htdocs/admin/system/dolibarr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 2b3bb6e8d21..46ed0c75934 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -120,7 +120,7 @@ if (function_exists('curl_init')) print $langs->trans("LastStableVersion").' : '.$langs->trans("UpdateServerOffline").''; } } else { - print $langs->trans("LastStableVersion").' : '.$langs->trans("Check").''; + print $langs->trans("LastStableVersion").' : '.$langs->trans("Check").''; } } From d3a98c7680178da9811a579773c47aeb580254f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 21 Feb 2021 13:00:31 +0100 Subject: [PATCH 22/63] replace ... by one char in dol_trunc --- htdocs/core/lib/functions.lib.php | 75 ++++++++++++++++++------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7d994616e5c..39ac3b7a80e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3178,10 +3178,10 @@ function dol_substr($string, $start, $length, $stringencoding = '', $trunconbyte * MAIN_DISABLE_TRUNC=1 can disable all truncings * * @param string $string String to truncate - * @param int $size Max string size visible (excluding ...). 0 for no limit. WARNING: Final string size can have 3 more chars (if we added ..., or if size was max+1 or max+2 or max+3 so it does not worse to replace with ...) + * @param int $size Max string size visible (excluding …). 0 for no limit. WARNING: Final string size can have 3 more chars (if we added ..., or if size was max+1 or max+2 or max+3 so it does not worse to replace with ...) * @param string $trunc Where to trunc: 'right', 'left', 'middle' (size must be a 2 power), 'wrap' * @param string $stringencoding Tell what is source string encoding - * @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation. + * @param int $nodot Truncation do not add … after truncation. So it's an exact truncation. * @param int $display Trunc is used to display data and can be changed for small screen. TODO Remove this param (must be dealt with CSS) * @return string Truncated string. WARNING: length is never higher than $size if $nodot is set, but can be 3 chars higher otherwise. */ @@ -3189,42 +3189,53 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF { global $conf; - if ($size == 0 || !empty($conf->global->MAIN_DISABLE_TRUNC)) return $string; + if ($size == 0 || !empty($conf->global->MAIN_DISABLE_TRUNC)) { + return $string; + } - if (empty($stringencoding)) $stringencoding = 'UTF-8'; + if (empty($stringencoding)) { + $stringencoding = 'UTF-8'; + } // reduce for small screen - if ($conf->dol_optimize_smallscreen == 1 && $display == 1) $size = round($size / 3); + // if ($conf->dol_optimize_smallscreen == 1 && $display == 1) $size = round($size / 3); // We go always here - if ($trunc == 'right') - { - $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string; - if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... - return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '...'); - else //return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string; - return $string; - } elseif ($trunc == 'middle') - { - $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string; - if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size + 1)) - { + if ($trunc == 'right') { + $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; + if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 1))) { + // If nodot is 0 and size is 1 chars more, we don't trunc and don't add … + return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '…'); + } else { + //return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string; + return $string; + } + } elseif ($trunc == 'middle') { + $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; + if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size + 1)) { $size1 = round($size / 2); $size2 = round($size / 2); - return dol_substr($newstring, 0, $size1, $stringencoding).'...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); - } else return $string; - } elseif ($trunc == 'left') - { - $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string; - if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... - return '...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); - else return $string; - } elseif ($trunc == 'wrap') - { - $newstring = dol_textishtml($string) ?dol_string_nohtmltag($string, 1) : $string; - if (dol_strlen($newstring, $stringencoding) > ($size + 1)) - return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); - else return $string; - } else return 'BadParam3CallingDolTrunc'; + return dol_substr($newstring, 0, $size1, $stringencoding).'…'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); + } else { + return $string; + } + } elseif ($trunc == 'left') { + $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; + if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 1))) { + // If nodot is 0 and size is 1 chars more, we don't trunc and don't add … + return '…'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); + } else { + return $string; + } + } elseif ($trunc == 'wrap') { + $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; + if (dol_strlen($newstring, $stringencoding) > ($size + 1)) { + return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); + } else { + return $string; + } + } else { + return 'BadParam3CallingDolTrunc'; + } } /** From 1bb27f8f18f2a90c44be4fb1484ccec9c5350c75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Feb 2021 13:12:16 +0100 Subject: [PATCH 23/63] Responsive --- htdocs/compta/facture/list.php | 2 +- htdocs/theme/eldy/global.inc.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 7b60dd639f6..249df885435 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1376,7 +1376,7 @@ if ($resql) // Alias if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; + print ''; print $obj->name_alias; print ''; if (!$i) $totalarray['nbfield']++; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d2c8ffdbcc4..515a42bd8f1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3503,6 +3503,7 @@ table.hidepaginationnext .paginationnext { } + /* Set the color for hover lines */ .oddeven:hover, .evenodd:hover, .impair:hover, .pair:hover { From 6e3a1a1d418a083e15c95aff536bd2a811f7d577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 21 Feb 2021 13:32:54 +0100 Subject: [PATCH 24/63] fix tests --- htdocs/core/lib/functions.lib.php | 6 +++--- test/phpunit/FunctionsLibTest.php | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 39ac3b7a80e..efe3824c5c4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3173,12 +3173,12 @@ function dol_substr($string, $start, $length, $stringencoding = '', $trunconbyte /** - * Truncate a string to a particular length adding '...' if string larger than length. - * If length = max length+1, we do no truncate to avoid having just 1 char replaced with '...'. + * Truncate a string to a particular length adding '…' if string larger than length. + * If length = max length+1, we do no truncate to avoid having just 1 char replaced with '…'. * MAIN_DISABLE_TRUNC=1 can disable all truncings * * @param string $string String to truncate - * @param int $size Max string size visible (excluding …). 0 for no limit. WARNING: Final string size can have 3 more chars (if we added ..., or if size was max+1 or max+2 or max+3 so it does not worse to replace with ...) + * @param int $size Max string size visible (excluding …). 0 for no limit. WARNING: Final string size can have 3 more chars (if we added …, or if size was max+1 so it does not worse to replace with ...) * @param string $trunc Where to trunc: 'right', 'left', 'middle' (size must be a 2 power), 'wrap' * @param string $stringencoding Tell what is source string encoding * @param int $nodot Truncation do not add … after truncation. So it's an exact truncation. diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 4f6bfb1963e..fe9d0563167 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -765,21 +765,21 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase */ public function testDolTrunc() { - // Default trunc (will add ... if truncation truncation or keep last char if only one char) + // Default trunc (will add … if truncation truncation or keep last char if only one char) $input="éeéeéeàa"; $after=dol_trunc($input, 3); - $this->assertEquals("éeé...", $after, 'Test A1'); + $this->assertEquals("éeé…", $after, 'Test A1'); $after=dol_trunc($input, 2); - $this->assertEquals("ée...", $after, 'Test A2'); + $this->assertEquals("ée…", $after, 'Test A2'); $after=dol_trunc($input, 1); - $this->assertEquals("é...", $after, 'Test A3'); + $this->assertEquals("é…", $after, 'Test A3'); $input="éeéeé"; $after=dol_trunc($input, 3); $this->assertEquals("éeéeé", $after, 'Test B1'); $after=dol_trunc($input, 2); $this->assertEquals("éeéeé", $after, 'Test B2'); $after=dol_trunc($input, 1); - $this->assertEquals("é...", $after, 'Test B3'); + $this->assertEquals("é…", $after, 'Test B3'); $input="éeée"; $after=dol_trunc($input, 3); $this->assertEquals("éeée", $after, 'Test C1'); @@ -794,7 +794,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase $this->assertEquals("éeé", $after, 'Test D'); $after=dol_trunc($input, 1); $this->assertEquals("éeé", $after, 'Test E'); - // Trunc with no ... + // Trunc with no … $input="éeéeéeàa"; $after=dol_trunc($input, 3, 'right', 'UTF-8', 1); $this->assertEquals("éeé", $after, 'Test F'); @@ -809,7 +809,7 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase $this->assertEquals("é", $after, 'Test J'); $input="éeéeéeàa"; $after=dol_trunc($input, 4, 'middle'); - $this->assertEquals("ée...àa", $after, 'Test K'); + $this->assertEquals("ée…àa", $after, 'Test K'); return true; } From 548820011a702f2bafc086fbe0da4836bb7f7175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 21 Feb 2021 13:39:59 +0100 Subject: [PATCH 25/63] fix tests --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index efe3824c5c4..3604308708b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3202,7 +3202,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF // We go always here if ($trunc == 'right') { $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; - if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 1))) { + if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 2))) { // If nodot is 0 and size is 1 chars more, we don't trunc and don't add … return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '…'); } else { @@ -3220,7 +3220,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF } } elseif ($trunc == 'left') { $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; - if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 1))) { + if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 2))) { // If nodot is 0 and size is 1 chars more, we don't trunc and don't add … return '…'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); } else { From 0a7e692fbf57f26b59b86a53fa6b3b11fb17ab3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Feb 2021 14:46:52 +0100 Subject: [PATCH 26/63] Wip website module --- htdocs/core/lib/website.lib.php | 8 ++++---- htdocs/theme/eldy/global.inc.php | 4 ++++ htdocs/theme/md/style.css.php | 4 ++++ htdocs/website/index.php | 32 +++++++++++++++++--------------- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 75a20ac6852..07112ed66d9 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -205,7 +205,7 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c /** * Render a string of an HTML content and output it. - * Used to ouput the page when viewed from server (Dolibarr or Apache). + * Used to ouput the page when viewed from a server (Dolibarr or Apache). * * @param string $content Content string * @param string $contenttype Content type @@ -231,7 +231,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor + if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor (this case should not happen) { // We remove the part of content if ($contenttype == 'html') @@ -296,7 +296,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') if (empty($includehtmlcontentopened)) { $content = str_replace('!~!~!~', '', $content); } - } else // REPLACEMENT OF LINKS When page called from virtual host + } else // REPLACEMENT OF LINKS When page called from virtual host web server { $symlinktomediaexists = 1; if ($website->virtualhost) { @@ -355,7 +355,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') } } - $content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content); + //$content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content); if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) { $content = str_replace(''."\n"; print '
'; - print '
'; + + print '
'; // Button include dynamic contant + print $langs->trans("ShowSubcontainers"); + if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE)) + { + print ''.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').''; + } + else { + print ''.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').''; + } + print '
'; + + print '
'; // Button edit inline print ''."\n"; print ''."\n"; @@ -2812,17 +2824,7 @@ if (!GETPOST('hide_websitemenu')) } print '
'; - print ''; + print '
'; // Set page as homepage @@ -4275,7 +4277,7 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa // REPLACEMENT OF LINKS When page called by website editor $out .= ''."\n"; - $out .= '