From e7056a9ade7e88414bc688e7d21893306dac7f26 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Thu, 12 Mar 2020 11:00:17 +0100 Subject: [PATCH 001/162] NEW add a parameter to group same product --- htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/langs/fr_FR/cashdesk.lang | 1 + htdocs/takepos/admin/setup.php | 7 +++++++ htdocs/takepos/invoice.php | 18 +++++++++++++++++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index d4355566872..ef939b31258 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -92,3 +92,4 @@ PrintMethod=Print method ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud. ByTerminal=By terminal TakeposNumpadUsePaymentIcon=Use payment icon on numpad +TakeposGroupSameProduct=Group same products lines diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 03ca0155daa..dc4e47cb868 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -83,3 +83,4 @@ ProductSupplements=Suppléments de produit SupplementCategory=Catégorie des suppléments SortProductField=Champ pour le tri des produits TakeposNumpadUsePaymentIcon=Utilisation d'icônes sur les touches des modes de règlement du pavé numérique +TakeposGroupSameProduct=Regrouper les mêmes lignes de produits diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index fce4d6d324f..830ca9154f2 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -76,6 +76,7 @@ if (GETPOST('action', 'alpha') == 'set') $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, 'TAKEPOS_GROUP_SAME_PRODUCT', GETPOST('TAKEPOS_GROUP_SAME_PRODUCT', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); @@ -179,6 +180,12 @@ $array = array('rowid' => 'ID', 'ref' => 'Ref', 'label' => 'Label', 'datec' => ' print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0, '', 1); print "\n"; +print ''; +print $langs->trans('TakeposGroupSameProduct'); +print ''; +print ajax_constantonoff("TAKEPOS_GROUP_SAME_PRODUCT", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 60854bf2407..d80e593f3cb 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -318,7 +318,23 @@ if ($action == "addline") } } - $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, 0, '', 0, 100, '', null, 0); + $idoflineadded = 0; + if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) { + foreach ($invoice->lines as $line) { + if ($line->product_ref == $prod->ref) { + $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty+1, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); + if ($result < 0) { + dol_htmloutput_errors($invoice->error, $invoice->errors, 1); + } else { + $idoflineadded = $line->id; + } + break; + } + } + } + if ($idoflineadded <= 0) { + $idoflineadded = $invoice->addline($prod->description, $price, 1, $tva_tx, $localtax1_tx, $localtax2_tx, $idproduct, $customer->remise_percent, '', 0, 0, 0, '', $price_base_type, $price_ttc, $prod->type, -1, 0, '', 0, $parent_line, null, 0, '', 0, 100, '', null, 0); + } $invoice->fetch($placeid); } From 8192e9dc67abfcd572c386bac761d93889bb7d87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Mar 2020 03:02:49 +0100 Subject: [PATCH 002/162] FIX Missing token in form --- htdocs/adherents/stats/index.php | 2 ++ htdocs/comm/propal/stats/index.php | 2 ++ htdocs/commande/stats/index.php | 2 ++ htdocs/compta/deplacement/stats/index.php | 2 ++ htdocs/compta/facture/stats/index.php | 2 ++ htdocs/expensereport/stats/index.php | 2 ++ htdocs/fichinter/stats/index.php | 2 ++ htdocs/projet/stats/index.php | 1 + htdocs/projet/tasks/stats/index.php | 1 + htdocs/salaries/stats/index.php | 2 ++ htdocs/ticket/stats/index.php | 1 - 11 files changed, 18 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index f02c012a48e..10eca32ac13 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -145,6 +145,8 @@ print '
'; // Show filter box /*print '
'; +print ''; + print ''; print ''; print '\n"; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 20b62da4650..195e5bc306f 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -59,9 +59,11 @@ if ($resql) { $action = GETPOST('action', 'alpha'); + /* * Actions */ + $error = 0; if ($action == 'set') @@ -186,8 +188,7 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - $var=!$var; - print ''; @@ -313,7 +314,7 @@ $htmltext .= ''; print '\n"; diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 8624948e6ff..6a067a76268 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -132,7 +132,7 @@ function updatename(rowid) { } function LoadPlace(place){ - parent.location.href='takepos.php?place='+place; + parent.location.href='index.php?place='+place; } diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/index.php similarity index 99% rename from htdocs/takepos/takepos.php rename to htdocs/takepos/index.php index 2df16d7877f..9685e14ffd8 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/index.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/takepos/takepos.php + * \file htdocs/takepos/index.php * \ingroup takepos * \brief Main TakePOS screen */ @@ -48,7 +48,7 @@ if ($setterminal > 0) $_SESSION["takeposterminal"] = $setterminal; } -$_SESSION["urlfrom"] = '/takepos/takepos.php'; +$_SESSION["urlfrom"] = '/takepos/index.php'; $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); @@ -179,7 +179,7 @@ function ClearSearch() { // Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically function setFocusOnSearchField() { - console.log("Call setFocusOnSearchField in page takepos.php"); + console.log("Call setFocusOnSearchField in page index.php"); browser->layout == 'classic') { ?> console.log("has keyboard from localStorage, so we can force focus on search field"); $("#search").focus(); @@ -636,14 +636,14 @@ function TerminalsDialog() modal: true, buttons: { 'trans("Terminal")) ?> 1': function() { - location.href='takepos.php?setterminal=1'; + location.href='index.php?setterminal=1'; } global->TAKEPOS_NUM_TERMINALS; $i++) { print ", '".dol_escape_js($langs->trans("Terminal"))." ".$i."': function() { - location.href='takepos.php?setterminal=".$i."'; + location.href='index.php?setterminal=".$i."'; } "; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 880e3971763..3ca20a9ddee 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -53,7 +53,7 @@ if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") $_SESSION["takeposterminal"] = 1; else { - header("Location: takepos.php"); + header("Location: ".DOL_URL_ROOT."/takepos/index.php"); exit; } } @@ -746,7 +746,7 @@ $( document ).ready(function() { use_javascript_ajax)) { @@ -754,7 +754,7 @@ if (!empty($conf->use_javascript_ajax)) print ''."\n"; } - +print ''."\n"; print '
'; print '
'.$langs->trans("Filter").'
'.$langs->trans("Member").''; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 4a2b8dea419..030db477631 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -242,7 +242,9 @@ print '
'; //{ // Show filter box print ''; + print ''; print ''; + print ''; print ''; // Company diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index e9eca9dafa9..c465cdcb8c9 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -255,7 +255,9 @@ print '
'; // Show filter box print ''; +print ''; print ''; + print '
'.$langs->trans("Filter").'
'; print ''; // Company diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index c9c48fd9b93..cf745b784fc 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -227,7 +227,9 @@ print '
'; // Show filter box print ''; +print ''; print ''; + print '
'.$langs->trans("Filter").'
'; print ''; // Company diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index bd749e02dee..a72b03b47a3 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -235,7 +235,9 @@ print '
'; // Show filter box print ''; +print ''; print ''; + print '
'.$langs->trans("Filter").'
'; print ''; // Company diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 60ab9001972..359f49f2dea 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -211,7 +211,9 @@ print '
'; // Show filter box print ''; +print ''; print ''; + print '
'.$langs->trans("Filter").'
'; print ''; // Company diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index 78f3289d638..d2efb5bb3ed 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -225,7 +225,9 @@ print '
'; //{ // Show filter box print ''; + print ''; print ''; + print '
'.$langs->trans("Filter").'
'; print ''; // Company diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 38fa476fcab..00747e55d0e 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -272,6 +272,7 @@ dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1, ''); print '
'; print ''; +print ''; print '
'.$langs->trans("Filter").'
'; print ''; diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index dafd5ae0071..c758664d2c6 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -139,6 +139,7 @@ dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1, ''); print '
'; print ''; +print ''; print '
'.$langs->trans("Filter").'
'; print ''; diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index e96b6776664..25c5be2c79d 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -193,6 +193,8 @@ print '
'; // Show filter box print ''; +print ''; + print '
'.$langs->trans("Filter").'
'; print ''; // User diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index 1f5f06ccc1f..cf8ed28db96 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -229,7 +229,6 @@ print '
'; print ''; print ''; - print '
'.$langs->trans("Filter").'
'; print ''; // Company From 37fce0d3eeece5032fad40731f7eedc9de48119b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Mar 2020 14:45:37 +0100 Subject: [PATCH 003/162] Fix position on merou Fix preselected value on contact --- htdocs/core/class/html.formcompany.class.php | 1 + htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 6 +++--- htdocs/core/tpl/contacts.tpl.php | 7 ++++++- htdocs/expedition/contact.php | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 10ee91ad50f..58291fb75f0 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -730,6 +730,7 @@ class FormCompany extends Form if (is_object($object) && method_exists($object, 'liste_type_contact')) { $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); + print ''; - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconciliable']['checked'])) print ''; } + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print ''; } if (!empty($arrayfields['aa.active']['checked'])) print ''; print '\n"; @@ -450,9 +450,9 @@ if ($resql) if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // Activated or not reconciliation on accounting account - if (!empty($arrayfields['aa.reconciliable']['checked'])) { + if (!empty($arrayfields['aa.reconcilable']['checked'])) { print '\n"; From debecabe69f10e3e0074437d75d8d53396cbabb5 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Mon, 16 Mar 2020 08:38:01 +0100 Subject: [PATCH 009/162] FIX missing "contact_" substitution in supplier proposal --- ...c_generic_supplier_proposal_odt.modules.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 3b4a39288ea..5b49aee1711 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -330,11 +330,20 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } // Recipient name + $contactobject = null; if (!empty($usecontact)) { // On peut utiliser le nom de la societe du contact - if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; - else $socobject = $object->thirdparty; + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) + { + $socobject = $object->contact; + } + else + { + $socobject = $object->thirdparty; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } } else { @@ -405,7 +414,10 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs); $array_other = $this->get_substitutionarray_other($outputlangs); - $tmparray = array_merge($substitutionarray, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other); + $array_thirdparty_contact = array(); + if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); + + $tmparray = array_merge($substitutionarray, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook From fd4e8072111357e0167888b6c6d24e758d576722 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 16 Mar 2020 07:40:10 +0000 Subject: [PATCH 010/162] Fixing style errors. --- .../doc/doc_generic_supplier_proposal_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 5b49aee1711..c97d2f94d63 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -416,7 +416,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $array_thirdparty_contact = array(); if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact'); - + $tmparray = array_merge($substitutionarray, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); From 301b97f6d230d3519ee27a82ab20064f0bbfe941 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 16 Mar 2020 10:05:22 +0100 Subject: [PATCH 011/162] FIX Update fiscalyear.class.php to filter on entity --- htdocs/core/class/fiscalyear.class.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 0eed1a56580..10015e3c363 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -1,5 +1,7 @@ +/* Copyright (C) 2014-2020 Alexandre Spangaro + * Copyright (C) 2020 OScss-Shop + * * * 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 @@ -381,13 +383,19 @@ class Fiscalyear extends CommonObject * @param int $dateend Date end to scan * @return string Number of entries */ - public function getAccountancyEntriesByFiscalYear($datestart, $dateend) + public function getAccountancyEntriesByFiscalYear($datestart = '', $dateend = '') { global $conf; + if(empty($datestart) ) + $datestart = $this->date_start; + if(empty($dateend) ) + $dateend = $this->date_end; + $sql = "SELECT count(DISTINCT piece_num) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping "; - $sql.= " WHERE doc_date >= '".$datestart."' and doc_date <= '".$dateend."'"; + $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; + $sql.= " WHERE entity IN (".getEntity('bookkeeping', 0).")"; + $sql.= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'"; $resql=$this->db->query($sql); if ($resql) @@ -407,13 +415,19 @@ class Fiscalyear extends CommonObject * @param int $dateend Date end to scan * @return string Number of movements */ - public function getAccountancyMovementsByFiscalYear($datestart, $dateend) + public function getAccountancyMovementsByFiscalYear($datestart = '', $dateend = '') { global $conf; + if(empty($datestart) ) + $datestart = $this->date_start; + if(empty($dateend) ) + $dateend = $this->date_end; + $sql = "SELECT count(rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping "; - $sql.= " WHERE doc_date >= '".$datestart."' AND doc_date <= '".$dateend."'"; + $sql.= " WHERE entity IN (".getEntity('bookkeeping', 0).")"; + $sql.= " AND doc_date >= '".$this->db->idate($datestart)."' and doc_date <= '".$this->db->idate($dateend)."'"; $resql=$this->db->query($sql); if ($resql) From 117ff5f4eb692553654c8857709b48a528a2ed82 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 16 Mar 2020 11:49:03 +0100 Subject: [PATCH 012/162] add hook to add sql filter in where clause on select users --- htdocs/core/class/html.form.class.php | 6 +++++- htdocs/core/class/html.formother.class.php | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0db01a84656..3d7bceadcf3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1618,7 +1618,7 @@ class Form public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false) { // phpcs:enable - global $conf, $user, $langs; + global $conf, $user, $langs, $hookmanager; // If no preselected user defined, we take current user if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected = $user->id; @@ -1679,6 +1679,10 @@ class Form if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql .= " AND u.statut <> 0"; if (!empty($morefilter)) $sql .= " ".$morefilter; + //Add hook to filter on user (for exemple on usergroup define in custom modules) + $reshook = $hookmanager->executeHooks('addSQLWhereFilterOnSelectUsers', array(), $this, $action); + if (!empty($reshook)) $sql .= $hookmanager->resPrint; + if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname { $sql .= " ORDER BY u.firstname ASC"; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 829a3f9c72f..b245f5f013b 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -424,7 +424,7 @@ class FormOther public function select_salesrepresentatives($selected, $htmlname, $user, $showstatus = 0, $showempty = 1, $morecss = '', $norepresentative = 0) { // phpcs:enable - global $conf, $langs; + global $conf, $langs, $hookmanager; $langs->load('users'); @@ -440,6 +440,9 @@ class FormOther $out.=$comboenhancement; } } + + $reshook = $hookmanager->executeHooks('addSQLWhereFilterOnSelectSalesRep', array(), $this, $action); + // Select each sales and print them in a select input $out.='
'.$langs->trans("Filter").'
   '; $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); @@ -371,7 +371,7 @@ if ($resql) if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left '); if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']); - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconciliable']['checked'])) print_liste_field_titre($arrayfields['aa.reconciliable']['label'], $_SERVER["PHP_SELF"], 'aa.reconciliable', '', $param, '', $sortfield, $sortorder); } + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print_liste_field_titre($arrayfields['aa.reconciliable']['label'], $_SERVER["PHP_SELF"], 'aa.reconciliable', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "
'; - if (empty($obj->reconciliable)) { + if (empty($obj->reconcilable)) { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 0178f87a32d..58e6bd600f6 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -136,9 +136,9 @@ class AccountingAccount extends CommonObject public $active; /** - * @var int reconciliable + * @var int reconcilable */ - public $reconciliable; + public $reconcilable; /** * Constructor @@ -167,7 +167,7 @@ class AccountingAccount extends CommonObject global $conf; if ($rowid || $account_number) { - $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconciliable"; + $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconcilable"; $sql .= ", ca.label as category_label"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid"; @@ -208,7 +208,7 @@ class AccountingAccount extends CommonObject $this->fk_user_modif = $obj->fk_user_modif; $this->active = $obj->active; $this->status = $obj->active; - $this->reconciliable = $obj->reconciliable; + $this->reconcilable = $obj->reconcilable; return $this->id; } else { @@ -267,7 +267,7 @@ class AccountingAccount extends CommonObject $sql .= ", fk_accounting_category"; $sql .= ", fk_user_author"; $sql .= ", active"; - $sql .= ", reconciliable"; + $sql .= ", reconcilable"; $sql .= ") VALUES ("; $sql .= " '" . $this->db->idate($now) . "'"; $sql .= ", " . $conf->entity; @@ -280,7 +280,7 @@ class AccountingAccount extends CommonObject $sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category); $sql .= ", " . $user->id; $sql .= ", " . (int) $this->active; - $sql .= ", " . (int) $this->reconciliable; + $sql .= ", " . (int) $this->reconcilable; $sql .= ")"; $this->db->begin(); @@ -348,7 +348,7 @@ class AccountingAccount extends CommonObject $sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category); $sql .= " , fk_user_modif = " . $user->id; $sql .= " , active = " . (int) $this->active; - $sql .= " , reconciliable = " . (int) $this->reconciliable; + $sql .= " , reconcilable = " . (int) $this->reconcilable; $sql .= " WHERE rowid = " . $this->id; dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); @@ -588,7 +588,7 @@ class AccountingAccount extends CommonObject } elseif ($mode == 1) { - $fieldtouse = 'reconciliable'; + $fieldtouse = 'reconcilable'; } if ($result > 0) { @@ -619,7 +619,7 @@ class AccountingAccount extends CommonObject * Account activated * * @param int $id Id - * @param int $mode 0=field active, 1=field reconciliable, 2=field active_customer_list, 3=field_active_supplier_list + * @param int $mode 0=field active, 1=field reconcilable * @return int <0 if KO, >0 if OK */ public function account_activate($id, $mode = 0) @@ -633,7 +633,7 @@ class AccountingAccount extends CommonObject } elseif ($mode == 1) { - $fieldtouse = 'reconciliable'; + $fieldtouse = 'reconcilable'; } $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 0a61a6d9c58..e8d11378768 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -193,4 +193,4 @@ ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype; ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER accountancy_code_buy; ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_export varchar(32) AFTER accountancy_code_buy_intra; -ALTER TABLE llx_accounting_account ADD COLUMN reconciliable tinyint DEFAULT 0 NOT NULL after active; +ALTER TABLE llx_accounting_account ADD COLUMN reconcilable tinyint DEFAULT 0 NOT NULL after active; diff --git a/htdocs/install/mysql/tables/llx_accounting_account.sql b/htdocs/install/mysql/tables/llx_accounting_account.sql index a3bf8b90b79..7af83585c7f 100644 --- a/htdocs/install/mysql/tables/llx_accounting_account.sql +++ b/htdocs/install/mysql/tables/llx_accounting_account.sql @@ -35,7 +35,7 @@ create table llx_accounting_account fk_user_author integer DEFAULT NULL, fk_user_modif integer DEFAULT NULL, active tinyint DEFAULT 1 NOT NULL, - reconciliable tinyint DEFAULT 0 NOT NULL, + reconcilable tinyint DEFAULT 0 NOT NULL, import_key varchar(14), extraparams varchar(255) -- for other parameters with json format )ENGINE=innodb; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 36b5fbcf55c..ba34d38f36e 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -239,7 +239,7 @@ HideOpeningBalance=Hide opening balance Pcgtype=Group of account PcgtypeDesc=Group of account are used as predefined 'filter' and 'grouping' criteria for some accounting reports. For example, 'INCOME' or 'EXPENSE' are used as groups for accounting accounts of products to build the expense/income report. -Reconciliable=Reconcilable +Reconcilable=Reconcilable TotalVente=Total turnover before tax TotalMarge=Total sales margin From c50f2b32d8abab18bcbf7a3447128e6cfa3ae311 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Mon, 16 Mar 2020 07:58:44 +0100 Subject: [PATCH 007/162] Add substitution for "user_civility" for ODT --- .../core/class/commondocgenerator.class.php | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 279eb1f7a6b..bd3dcb01e76 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -267,33 +267,34 @@ abstract class CommonDocGenerator $object->state = getState($object->state_code, 0); } - $array_contact = array( - $array_key.'_fullname' => $object->getFullName($outputlangs, 1), - $array_key.'_lastname' => $object->lastname, - $array_key.'_firstname' => $object->firstname, - $array_key.'_address' => $object->address, - $array_key.'_zip' => $object->zip, - $array_key.'_town' => $object->town, - $array_key.'_state_id' => $object->state_id, - $array_key.'_state_code' => $object->state_code, - $array_key.'_state' => $object->state, - $array_key.'_country_id' => $object->country_id, - $array_key.'_country_code' => $object->country_code, - $array_key.'_country' => $object->country, - $array_key.'_poste' => $object->poste, - $array_key.'_socid' => $object->socid, - $array_key.'_statut' => $object->statut, - $array_key.'_code' => $object->code, - $array_key.'_email' => $object->email, - $array_key.'_jabberid' => $object->jabberid, - $array_key.'_phone_pro' => $object->phone_pro, - $array_key.'_phone_perso' => $object->phone_perso, - $array_key.'_phone_mobile' => $object->phone_mobile, - $array_key.'_fax' => $object->fax, - $array_key.'_birthday' => $object->birthday, - $array_key.'_default_lang' => $object->default_lang, - $array_key.'_note_public' => $object->note_public, - $array_key.'_note_private' => $object->note_private + $array_contact = array ( + $array_key . '_fullname' => $object->getFullName($outputlangs, 1), + $array_key . '_lastname' => $object->lastname, + $array_key . '_firstname' => $object->firstname, + $array_key . '_address' => $object->address, + $array_key . '_zip' => $object->zip, + $array_key . '_town' => $object->town, + $array_key . '_state_id' => $object->state_id, + $array_key . '_state_code' => $object->state_code, + $array_key . '_state' => $object->state, + $array_key . '_country_id' => $object->country_id, + $array_key . '_country_code' => $object->country_code, + $array_key . '_country' => $object->country, + $array_key . '_poste' => $object->poste, + $array_key . '_socid' => $object->socid, + $array_key . '_statut' => $object->statut, + $array_key . '_code' => $object->code, + $array_key . '_email' => $object->email, + $array_key . '_jabberid' => $object->jabberid, // deprecated + $array_key . '_phone_pro' => $object->phone_pro, + $array_key . '_phone_perso' => $object->phone_perso, + $array_key . '_phone_mobile' => $object->phone_mobile, + $array_key . '_fax' => $object->fax, + $array_key . '_birthday' => $object->birthday, + $array_key . '_default_lang' => $object->default_lang, + $array_key . '_note_public' => $object->note_public, + $array_key . '_note_private' => $object->note_private, + $array_key . '_civility' => $object->civility, ); // Retrieve extrafields From 191374cc8f740ea4a11800dadca67c4edb7ddb2e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 16 Mar 2020 08:07:05 +0100 Subject: [PATCH 008/162] Work on reconcilation of accouting account --- htdocs/accountancy/admin/account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 52148f40140..1afe2ecca18 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -371,7 +371,7 @@ if ($resql) if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left '); if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']); - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print_liste_field_titre($arrayfields['aa.reconciliable']['label'], $_SERVER["PHP_SELF"], 'aa.reconciliable', '', $param, '', $sortfield, $sortorder); } + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "
'; -if ($invoice->socid != $conf->global->$constforcompanyid) -{ - print '

'; - - $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; - if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") - { - $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; - $warehouse = new Entrepot($db); - $warehouse->fetch($conf->global->$constantforkey); - print '
'.$langs->trans("Warehouse").': '.$warehouse->ref; - } - - // Module Adherent - if (!empty($conf->adherent->enabled)) - { - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $langs->load("members"); - print '
'.$langs->trans("Member").': '; - $adh = new Adherent($db); - $result = $adh->fetch('', '', $invoice->socid); - if ($result > 0) - { - $adh->ref = $adh->getFullName($langs); - print $adh->getFullName($langs); - print '
'.$langs->trans("Type").': '.$adh->type; - if ($adh->datefin) - { - print '
'.$langs->trans("SubscriptionEndDate").': '.dol_print_date($adh->datefin, 'day'); - if ($adh->hasDelay()) { - print " ".img_warning($langs->trans("Late")); - } - } - else - { - print '
'.$langs->trans("SubscriptionNotReceived"); - if ($adh->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } - } - else - { - print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; - } - } - print '

'; -} - if ($action == "search") { print '
diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index c5f0b69b38a..2df16d7877f 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -690,14 +690,16 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
'; - print $langs->trans('ShowCustomer'); + print $langs->trans('PrintCustomerOnReceipts'); print ''; print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); print "
'.$module->nom."\n"; + print '
'.$module->nom."\n"; print $module->info(); print '
'; print $langs->trans("ColorTheme"); print ''; -$array = array(0=>"eldy", 1=>$langs->trans("Colorful")); +$array = array(0=>"Eldy", 1=>$langs->trans("Colorful")); print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0); print "
'; print ''; From 97639c46481605d87e972c6e647cf68dcd29f07f Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 16 Mar 2020 15:41:54 +0100 Subject: [PATCH 023/162] Create README.txt --- htdocs/includes/adodbtime/README.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 htdocs/includes/adodbtime/README.txt diff --git a/htdocs/includes/adodbtime/README.txt b/htdocs/includes/adodbtime/README.txt new file mode 100644 index 00000000000..3e2969a2868 --- /dev/null +++ b/htdocs/includes/adodbtime/README.txt @@ -0,0 +1,7 @@ +README +====== + +ADOdb Date Library, part of the ADOdb abstraction library + +See Wiki: https://adodb.org/dokuwiki/doku.php?id=v5:datetime:datetime_index +Download: https://github.com/ADOdb/ADOdb/blob/master/adodb-time.inc.php From c66f9476a88b7758e4e98c8e31f60e6c48b8566e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Mar 2020 15:49:58 +0100 Subject: [PATCH 024/162] Show owner of card in list --- htdocs/societe/paymentmodes.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 185c7aaf6ea..c9fe7c41001 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1095,6 +1095,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print img_credit_card($companypaymentmodetemp->type); print ''; print ''; + // Information print ''; + print ''; if (!$i) $totalarray['nbfield']++; // Account diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php index 7539d6165ea..c14c29f3179 100644 --- a/htdocs/compta/paiement/tovalidate.php +++ b/htdocs/compta/paiement/tovalidate.php @@ -64,7 +64,7 @@ if (! $sortfield) $sortfield="p.rowid"; llxHeader(); $sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut"; -$sql.=", c.libelle as paiement_type, p.num_paiement"; +$sql.=", c.libelle as paiement_type, p.num_paiement as num_payment"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id"; if ($socid) { @@ -119,7 +119,7 @@ if ($resql) print ''; print ''; print '\n"; - print "\n"; + print "\n"; print ''; print ''; - print ''."\n"; + print ''."\n"; print ''; print ''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 4050d081fe4..41f1ebf5a62 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -484,7 +484,7 @@ class BonPrelevement extends CommonObject $paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice $paiement->paiementid = 3; // $paiement->num_payment = $this->ref; // Set ref of direct debit note - $paiement->num_paiement = $this->ref; // For bacward compatibility + $paiement->num_paiement = $this->ref; // For backward compatibility $paiement->id_prelevement = $this->id; $paiement_id = $paiement->create($user); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 740a1e47784..c78dbd06259 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -154,6 +154,7 @@ class RejetPrelevement $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal $pai->num_paiement = $fac->ref; + $pai->num_payment = $fac->ref; if ($pai->create($this->user) < 0) // we call with no_commit { diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 69ad435c64c..d7f20622a43 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -603,7 +603,7 @@ if ($id > 0) /* * Payments */ - $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; + $sql = "SELECT p.rowid, p.num_paiement as num_payment, datep as dp, p.amount,"; $sql .= " c.code as type_code,c.libelle as paiement_type,"; $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal'; $sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; @@ -647,7 +647,7 @@ if ($id > 0) print ''.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''; print '\n"; $labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type; - print "\n"; + print "\n"; if (!empty($conf->banque->enabled)) { $bankaccountstatic->id = $objp->baid; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 629a73578b2..02c15b099b9 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -69,8 +69,17 @@ class PaymentSocialContribution extends CommonObject */ public $fk_typepaiement; + /** + * @var string + * @deprecated + */ public $num_paiement; + /** + * @var string + */ + public $num_payment; + /** * @var int ID */ @@ -125,7 +134,8 @@ class PaymentSocialContribution extends CommonObject if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge; if (isset($this->amount)) $this->amount = trim($this->amount); if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); + if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated + if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; @@ -149,11 +159,11 @@ class PaymentSocialContribution extends CommonObject if ($totalamount != 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiementcharge (fk_charge, datec, datep, amount,"; - $sql .= " fk_typepaiement, num_paiement, note, fk_user_creat, fk_bank)"; + $sql .= " fk_typepaiement, num_paiement as num_payment, note, fk_user_creat, fk_bank)"; $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',"; $sql .= " '".$this->db->idate($this->datepaye)."',"; $sql .= " ".$totalamount.","; - $sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.","; + $sql .= " ".$this->paiementtype.", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".$user->id.","; $sql .= " 0)"; $resql = $this->db->query($sql); @@ -231,7 +241,7 @@ class PaymentSocialContribution extends CommonObject $sql.= " t.datep,"; $sql.= " t.amount,"; $sql.= " t.fk_typepaiement,"; - $sql.= " t.num_paiement,"; + $sql.= " t.num_paiement as num_payment,"; $sql.= " t.note,"; $sql.= " t.fk_bank,"; $sql.= " t.fk_user_creat,"; @@ -260,7 +270,8 @@ class PaymentSocialContribution extends CommonObject $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; $this->fk_typepaiement = $obj->fk_typepaiement; - $this->num_paiement = $obj->num_paiement; + $this->num_paiement = $obj->num_payment; + $this->num_payment = $obj->num_payment; $this->note = $obj->note; $this->fk_bank = $obj->fk_bank; $this->fk_user_creat = $obj->fk_user_creat; @@ -301,7 +312,8 @@ class PaymentSocialContribution extends CommonObject if (isset($this->fk_charge)) $this->fk_charge = (int) $this->fk_charge; if (isset($this->amount)) $this->amount = trim($this->amount); if (isset($this->fk_typepaiement)) $this->fk_typepaiement = (int) $this->fk_typepaiement; - if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); + if (isset($this->num_paiement)) $this->num_paiement = trim($this->num_paiement); // deprecated + if (isset($this->num_payment)) $this->num_payment = trim($this->num_payment); if (isset($this->note)) $this->note = trim($this->note); if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; @@ -511,8 +523,9 @@ class PaymentSocialContribution extends CommonObject $this->datep = ''; $this->amount = ''; $this->fk_typepaiement = ''; - $this->num_paiement = ''; - $this->note = ''; + $this->num_payment = ''; + $this->note_private = ''; + $this->note_public = ''; $this->fk_bank = ''; $this->fk_user_creat = ''; $this->fk_user_modif = ''; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 7393f0e198d..163ba420fc7 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -181,8 +181,7 @@ class pdf_paiement switch ($this->doc_type) { case "client": $sql = "SELECT p.datep as dp, f.ref"; - //$sql .= ", c.libelle as paiement_type, p.num_paiement"; - $sql.= ", c.code as paiement_code, p.num_paiement"; + $sql.= ", c.code as paiement_code, p.num_paiement as num_payment"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", pf.amount as pf_amount"; if (! empty($conf->banque->enabled)) @@ -212,8 +211,7 @@ class pdf_paiement break; case "fourn": $sql = "SELECT p.datep as dp, f.ref as ref"; - //$sql .= ", c.libelle as paiement_type, p.num_paiement"; - $sql.= ", c.code as paiement_code, p.num_paiement"; + $sql.= ", c.code as paiement_code, p.num_paiement as num_payment"; $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; $sql.= ", pf.amount as pf_amount"; if (! empty($conf->banque->enabled)) @@ -257,7 +255,7 @@ class pdf_paiement $lines[$i][0] = $objp->ref; $lines[$i][1] = dol_print_date($this->db->jdate($objp->dp), "day", false, $outputlangs, true); $lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code); - $lines[$i][3] = $objp->num_paiement; + $lines[$i][3] = $objp->num_payment; $lines[$i][4] = price($objp->paiement_amount); $lines[$i][5] = price($objp->facture_amount); $lines[$i][6] = price($objp->pf_amount); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 79e418206a5..77c2cf07f8e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2029,7 +2029,8 @@ else $paymentexpensereportstatic->id = $objp->rowid; $paymentexpensereportstatic->datepaye = $db->jdate($objp->dp); $paymentexpensereportstatic->ref = $objp->rowid; - $paymentexpensereportstatic->num_paiement = $objp->num_paiement; + $paymentexpensereportstatic->num_paiement = $objp->num_payment; + $paymentexpensereportstatic->num_payment = $objp->num_payment; $paymentexpensereportstatic->payment_code = $objp->payment_code; print ''; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 204471bc9e7..65ae5677c87 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -388,7 +388,7 @@ class SupplierInvoices extends DolibarrApi * @param int $paiementid {@from body} Payment mode Id {@min 1} * @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no} * @param int $accountid {@from body} Account Id {@min 1} - * @param string $num_paiement {@from body} Payment number (optional) + * @param string $num_payment {@from body} Payment number (optional) * @param string $comment {@from body} Note (optional) * @param string $chqemetteur {@from body} Payment issuer (mandatory if paiementcode = 'CHQ') * @param string $chqbank {@from body} Issuer bank name (optional) @@ -400,7 +400,7 @@ class SupplierInvoices extends DolibarrApi * @throws RestException 401 * @throws RestException 404 */ - public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') + public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_payment = '', $comment = '', $chqemetteur = '', $chqbank = '') { global $conf; @@ -455,7 +455,7 @@ class SupplierInvoices extends DolibarrApi $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paiement->paiementid = $paiementid; $paiement->paiementcode = dol_getIdFromCode($this->db, $paiementid, 'c_paiement', 'id', 'code', 1); - $paiement->num_payment = $num_paiement; + $paiement->num_payment = $num_payment; $paiement->note_public = $comment; $paiement_id = $paiement->create(DolibarrApiAccess::$user, ($closepaidinvoices=='yes'?1:0)); // This include closing invoices diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 6c4f5ff95b1..f45160b427e 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -299,10 +299,12 @@ if (empty($reshook)) $paiement->multicurrency_amounts = $multicurrency_amounts; $paiement->paiementid = GETPOST('paiementid', 'int'); - $paiement->num_payment = GETPOST('num_paiement', 'alpha'); + $paiement->num_payment = GETPOST('num_paiement', 'alphanohtml'); $paiement->note_private = GETPOST('comment', 'alpha'); - $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility - $paiement->note = $paiement->note_private; // For bacward compatibility + $paiement->num_paiement = $paiement->num_payment; // For backward compatibility + $paiement->num_payment = $paiement->num_payment; + $paiement->note = $paiement->note_private; // For backward compatibility + $paiement->note_private = $paiement->note_private; if (!$error) { diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 603f15d2779..ec86076ac22 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -16,6 +16,7 @@ AddThisArticle=Add this article RestartSelling=Go back on sell SellFinished=Sale complete PrintTicket=Print ticket +SendTicket=Send ticket NoProductFound=No article found ProductFound=product found NoArticle=No article diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 5029d717a10..28060a6d71e 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -658,6 +658,7 @@ if ($ispaymentok) } $paiement->paiementid = $paymentTypeId; $paiement->num_paiement = ''; + $paiement->num_payment = ''; $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; $paiement->ext_payment_id = $TRANSACTIONID; $paiement->ext_payment_site = $service; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 9f0705b967d..a822e2f53e6 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -45,6 +45,12 @@ $idproduct = GETPOST('idproduct', 'int'); $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant $placeid = 0; // $placeid is ID of invoice +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + + if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == 'phone') { // DIRECT LINK TO THIS PAGE FROM MOBILE AND NO TERMINAL SELECTED @@ -70,11 +76,6 @@ if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == '; } -if (empty($user->rights->takepos->run)) { - access_forbidden(); -} - - /** * Abort invoice creationg with a given error message * @@ -920,7 +921,7 @@ if ($placeid > 0) if ($line->desc) $tooltiptext .= '
'; $tooltiptext .= $line->desc; } - $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : $line->product_ref, $tooltiptext); + $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : ($line->product_ref ? $line->product_ref : dolGetFirstLineOfText($line->desc, 1)), $tooltiptext); } else { if ($line->product_label) $htmlforlines .= $line->product_label; if ($line->product_label != $line->desc) diff --git a/htdocs/webservices/server_payment.php b/htdocs/webservices/server_payment.php index 3ccf3dafcaa..4f4490d4707 100644 --- a/htdocs/webservices/server_payment.php +++ b/htdocs/webservices/server_payment.php @@ -97,7 +97,7 @@ $server->wsdl->addComplexType( '', array( 'amount' => array('name'=>'amount','type'=>'xsd:double'), - 'num_paiement' => array('name'=>'num_paiement','type'=>'xsd:string'), + 'num_payment' => array('name'=>'num_payment','type'=>'xsd:string'), 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'), 'bank_account' => array('name'=>'bank_account','type'=>'xsd:int'), 'payment_mode_id' => array('name'=>'payment_mode_id','type'=>'xsd:int'), @@ -167,14 +167,14 @@ function createPayment($authentication, $payment) $soc = new Societe($db); $res = $soc->fetch($payment['thirdparty_id']); - $new_payment = new Paiement($db); - $new_payment->amount = doubleval($payment['amount']); - $new_payment->num_paiement = $payment['num_paiement']; - $new_payment->bank_account = intval($payment['bank_account']); - $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; - $new_payment->datepaye = $now; - $new_payment->author = $payment['thirdparty_id']; - $new_payment->amounts = array(); + $new_payment = new Paiement($db); + $new_payment->amount = doubleval($payment['amount']); + $new_payment->num_payment = $payment['num_payment']; + $new_payment->fk_account = intval($payment['bank_account']); + $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; + $new_payment->datepaye = $now; + $new_payment->author = $payment['thirdparty_id']; + $new_payment->amounts = array(); if (intval($payment['invoice_id']) > 0) { $new_payment->amounts[ $payment['invoice_id'] ] = $new_payment->amount; From 94750ed350c68a38b45a6f4de46138894f157765 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 01:31:48 +0100 Subject: [PATCH 031/162] css --- htdocs/core/class/html.formfile.class.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 2 ++ htdocs/theme/md/style.css.php | 1 + htdocs/website/index.php | 4 ++-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 111605d38b7..e84feb90601 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -125,7 +125,7 @@ class FormFile $out .= ''; } - $out .= '
'; + if ($companypaymentmodetemp->proprio) print ''.$companypaymentmodetemp->proprio.'
'; if ($companypaymentmodetemp->last_four) print '....'.$companypaymentmodetemp->last_four; if ($companypaymentmodetemp->exp_date_month || $companypaymentmodetemp->exp_date_year) print ' - '.sprintf("%02d", $companypaymentmodetemp->exp_date_month).'/'.$companypaymentmodetemp->exp_date_year.''; print '
'; @@ -1210,6 +1211,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; } print''; if ($src->object == 'card') { @@ -1225,7 +1227,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } elseif ($src->object == 'source' && $src->type == 'card') { - print $src->owner->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; + print ''.$src->owner->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '
'; if ($src->card->country) @@ -1238,7 +1240,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { - print 'info sepa'; + print 'SEPA debit'; print ''; if ($src->sepa_debit->country) { @@ -1250,7 +1252,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } elseif ($src->object == 'payment_method' && $src->type == 'card') { - print $src->billing_details->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; + print ''.$src->billing_details->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '
'; if ($src->card->country) @@ -1263,7 +1265,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { - print 'info sepa'; + print 'SEPA debit'; print ''; if ($src->sepa_debit->country) { From 1212a63365390a364888702c4c11a5d3796153a1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Mar 2020 15:53:00 +0100 Subject: [PATCH 025/162] css --- htdocs/takepos/css/pos.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index a0a6ce8a247..32b7d7b7104 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -485,7 +485,7 @@ div.description_content { div#moreinfo, div#infowarehouse { color: #aaa; - padding: 0 4px 0 4px; + padding: 0 8px 0 8px; } From 105c2e99787bb3b7baf9173cefc278e91c686efc Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 16 Mar 2020 17:31:16 +0100 Subject: [PATCH 026/162] fix ldcompta10 --- .../class/accountancyexport.class.php | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index bb1f1b8679c..7cfdde49402 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1088,9 +1088,24 @@ class AccountancyExport { $soc = $this->db->fetch_object($resql); - $address = str_replace(array("\t", "\n", "\r"), " ", $soc->address); + $address=array('','',''); + if (strpos($soc->address,"\n")!==false) { + $address = explode("\n",$soc->address); + if (is_array($address) && count($address)>0) { + foreach($address as $key=>$data) { + $address[$key]=str_replace(array("\t", "\n", "\r"), "", $data); + $address[$key]=dol_trunc($address[$key],40,'right','UTF-8',1); + } + } + } else { + $address[0] = substr(str_replace(array("\t", "\r"), " ", $soc->address),0,40); + $address[1] = substr(str_replace(array("\t", "\r"), " ", $soc->address),41,40); + $address[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address),82,40); + + } $type_enregistrement = 'C'; + //TYPE print $type_enregistrement.$separator; //NOCL print $soc->code_client.$separator; @@ -1099,15 +1114,15 @@ class AccountancyExport //LIBI print $separator; //TITR - print getFormeJuridiqueLabel($soc->fk_forme_juridique).$separator; + print $separator; //RSSO print $soc->nom.$separator; //CAD1 - print substr($address, 0, 40).$separator; + print $address[0].$separator; //CAD2 - print substr($address, 41, 40).$separator; + print $address[1].$separator; //CAD3 - print substr($address, 82, 40).$separator; + print $address[2].$separator; //COPO print $soc->zip.$separator; //BUDI @@ -1129,7 +1144,7 @@ class AccountancyExport //COMM print $separator; //SIRE - print $soc->siret.$separator; + print str_replace(" ", "", $soc->siret).$separator; //RIBP print $separator; //DOBQ @@ -1267,8 +1282,6 @@ class AccountancyExport } else { print $separator; } - // SECT - print $separator; // CTRE print $separator; // NORL @@ -1286,13 +1299,13 @@ class AccountancyExport // CDES print $separator; // QTUE - print '0'.$separator; + print $separator; // MTDV - print $separator; - // CODV print '0'.$separator; - // TXDV + // CODV print $separator; + // TXDV + print '0'.$separator; // MOPM print $separator; // BONP From 74655b759cab6e8649891c8f6857dc762ad0694b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 16 Mar 2020 16:34:28 +0000 Subject: [PATCH 027/162] Fixing style errors. --- .../accountancy/class/accountancyexport.class.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 7cfdde49402..6c628ae52c3 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1089,19 +1089,18 @@ class AccountancyExport $soc = $this->db->fetch_object($resql); $address=array('','',''); - if (strpos($soc->address,"\n")!==false) { - $address = explode("\n",$soc->address); + if (strpos($soc->address, "\n")!==false) { + $address = explode("\n", $soc->address); if (is_array($address) && count($address)>0) { foreach($address as $key=>$data) { $address[$key]=str_replace(array("\t", "\n", "\r"), "", $data); - $address[$key]=dol_trunc($address[$key],40,'right','UTF-8',1); + $address[$key]=dol_trunc($address[$key], 40, 'right', 'UTF-8', 1); } } } else { - $address[0] = substr(str_replace(array("\t", "\r"), " ", $soc->address),0,40); - $address[1] = substr(str_replace(array("\t", "\r"), " ", $soc->address),41,40); - $address[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address),82,40); - + $address[0] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 0, 40); + $address[1] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 41, 40); + $address[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 82, 40); } $type_enregistrement = 'C'; From ffc861d4e2a5f5b75ccf52ee2b99ad676e04c82d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Mar 2020 18:04:22 +0100 Subject: [PATCH 028/162] FIX Autoadd product when barcode match Show barcode value in tooltips --- htdocs/takepos/ajax/ajax.php | 17 +++++++++--- htdocs/takepos/css/pos.css.php | 20 ++++++++++++-- htdocs/takepos/floors.php | 14 ++++++++++ htdocs/takepos/freezone.php | 4 +++ htdocs/takepos/index.php | 50 +++++++++++++++++++++++++++++----- htdocs/takepos/invoice.php | 5 ++++ htdocs/takepos/pay.php | 4 +++ htdocs/takepos/phone.php | 5 ++++ htdocs/takepos/receipt.php | 4 +++ htdocs/takepos/reduction.php | 4 +++ htdocs/takepos/send.php | 5 ++++ htdocs/takepos/smpcb.php | 12 +++++++- 12 files changed, 129 insertions(+), 15 deletions(-) diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 07de9e50a51..56c30b69283 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -85,10 +85,10 @@ elseif ($action == 'search' && $term != '') { } } - $sql = 'SELECT rowid, ref, label, tosell, tobuy FROM '.MAIN_DB_PREFIX.'product as p'; + $sql = 'SELECT rowid, ref, label, tosell, tobuy, barcode, price FROM '.MAIN_DB_PREFIX.'product as p'; $sql .= ' WHERE entity IN ('.getEntity('product').')'; if ($filteroncategids) { - $sql.= ' AND rowid IN (SELECT DISTINCT fk_product FROM '.MAIN_DB_PREFIX.'categorie_product WHERE fk_categorie IN ('.$filteroncategids.'))'; + $sql.= ' AND EXISTS (SELECT cp.fk_product FROM '.MAIN_DB_PREFIX.'categorie_product as cp WHERE cp.fk_product = p.rowid AND cp.fk_categorie IN ('.$filteroncategids.'))'; } $sql .= ' AND tosell = 1'; $sql .= natural_search(array('ref', 'label', 'barcode'), $term); @@ -96,8 +96,17 @@ elseif ($action == 'search' && $term != '') { if ($resql) { $rows = array(); - while ($row = $db->fetch_object($resql)) { - $rows[] = $row; + while ($obj = $db->fetch_object($resql)) { + $rows[] = array( + 'rowid' => $obj->rowid, + 'ref' => $obj->ref, + 'label' => $obj->label, + 'tosell' => $obj->tosell, + 'tobuy' => $obj->tobuy, + 'barcode' => $obj->barcode, + 'price' => $obj->price + //'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency) + ); } echo json_encode($rows); } diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index 32b7d7b7104..b541cdd6bad 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -286,7 +286,7 @@ div.paymentbordline .row1withhead{ margin: 0 auto; width: 100%; - height: calc(50% - 50px); + height: calc(45% - 50px); padding-top: 5px; } @@ -299,7 +299,7 @@ div.paymentbordline .row2withhead{ margin: 0 auto; width: 100%; - height: 50%; + height: 55%; } .div1{ @@ -488,6 +488,20 @@ div#moreinfo, div#infowarehouse { padding: 0 8px 0 8px; } +.productprice { + position: absolute; + top: 5px; + right: 5px; + background: var(--colorbackhmenu1); + color: var(--colortextbackhmenu); + font-size: 2em; + padding: 5px; + border-radius: 2px; + opacity: 0.9; + padding-left: 8px; + padding-right: 8px; +} + @media screen and (min-width: 892px) { .actionbutton{ @@ -561,7 +575,7 @@ div#moreinfo, div#infowarehouse { } .row1withhead{ - height: calc(50% - 100px); + height: calc(45% - 100px); } diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 6a067a76268..260813dd3b6 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -47,6 +47,15 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $newname = GETPOST('newname', 'alpha'); $mode = GETPOST('mode', 'alpha'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + +/* + * Actions + */ + if ($action == "getTables") { $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; @@ -81,6 +90,11 @@ if ($action == "add") $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names } + +/* + * View + */ + // Title $title = 'TakePOS - Dolibarr '.DOL_VERSION; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index e8cce00abb3..5e58910928a 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -40,6 +40,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $idline = GETPOST('idline', 'int'); $action = GETPOST('action', 'alpha'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + /* * View diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 9685e14ffd8..9615f90d539 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -263,6 +263,8 @@ function LoadProducts(position, issubcat) { if (currentcat==val.fk_parent) { $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(val.label); + $("#proprice"+ishow).attr("class", "hidden"); + $("#proprice"+ishow).html(""); $("#proimg"+ishow).attr("src","genimg/index.php?query=cat&id="+val.rowid); $("#prodiv"+ishow).data("rowid",val.rowid); $("#prodiv"+ishow).data("iscat",1); @@ -281,6 +283,8 @@ function LoadProducts(position, issubcat) { if (typeof (data[idata]) == "undefined") { $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); + $("#proprice"+ishow).attr("class", "hidden"); + $("#proprice"+ishow).html(""); $("#proimg"+ishow).attr("title",""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); @@ -289,9 +293,17 @@ function LoadProducts(position, issubcat) { ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { // Only show products with status=1 (for sell) - var titlestring = 'transnoentities('Ref').': '); ?>'+data[idata]['ref']; + transnoentities('Ref').': ')."' + data[idata]['ref']"; + $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[idata]['barcode']"; + ?> + var titlestring = ; $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); + if (data[parseInt(idata)]['price_formated']) { + $("#proprice"+ishow).attr("class", "productprice"); + $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); + } $("#proimg"+ishow).attr("title", titlestring); $("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid", data[idata]['id']); @@ -337,6 +349,8 @@ function MoreProducts(moreorless) { if (typeof (data[idata]) == "undefined") { $("#prodivdesc"+ishow).hide(); $("#prodesc"+ishow).text(""); + $("#proprice"+ishow).attr("class", ""); + $("#proprice"+ishow).html(""); $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); ishow++; //Next product to show after print data product @@ -345,6 +359,10 @@ function MoreProducts(moreorless) { //Only show products with status=1 (for sell) $("#prodivdesc"+ishow).show(); $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); + if (data[parseInt(idata)]['price_formated']) { + $("#proprice"+ishow).attr("class", "productprice"); + $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); + } $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("iscat",0); @@ -462,7 +480,7 @@ function New() { * return {void} */ function Search2(keyCodeForEnter) { - console.log("Search2 Call ajax search to replace products"); + console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter); var search = false; var eventKeyCode = window.event.keyCode; @@ -477,20 +495,37 @@ function Search2(keyCodeForEnter) { for (i = 0; i < ; i++) { if (typeof (data[i]) == "undefined") { $("#prodesc" + i).text(""); + $("#proprice" + i).attr("class", "hidden"); + $("#proprice" + i).html(""); $("#proimg" + i).attr("src", "genimg/empty.png"); $("#prodiv" + i).data("rowid", ""); continue; } - var titlestring = 'transnoentities('Ref').': '); ?>' + data[i]['ref']; + transnoentities('Ref').': ')."' + data[i]['ref']"; + $titlestring .= " + ' - ".dol_escape_js($langs->trans("Barcode").': ')."' + data[i]['barcode']"; + ?> + var titlestring = ; $("#prodesc" + i).text(data[i]['label']); $("#prodivdesc" + i).show(); + if (data[i]['price_formated']) { + $("#proprice" + i).attr("class", "productprice"); + $("#proprice" + i).html(data[i]['price_formated']); + } $("#proimg" + i).attr("title", titlestring); $("#proimg" + i).attr("src", "genimg/index.php?query=pro&id=" + data[i]['rowid']); $("#prodiv" + i).data("rowid", data[i]['rowid']); $("#prodiv" + i).data("iscat", 0); } }).always(function (data) { - if ($('#search').val().length > 0 && data.length == 1) ClickProduct(0); + // If there is only 1 answer + if ($('#search').val().length > 0 && data.length == 1) { + console.log($('#search').val()+' - '+data[0]['barcode']); + if ($('#search').val() == data[0]['barcode']) { + console.log("There is only 1 answer with barcode matching the search, so we add the product in basket"); + ClickProduct(0); + } + } }); } } @@ -924,15 +959,16 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { '; - echo ''; + print ''; } elseif ($count == ($MAXPRODUCT - 1)) { //echo ''; - echo ''; + print ''; } else { - echo ''; + print '
'; + print ''; } ?> diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3ca20a9ddee..bf68713a806 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -70,6 +70,11 @@ if ($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == '; } +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + /** * Abort invoice creationg with a given error message * diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index fb2442b5aba..f79e310f36b 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -38,6 +38,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $invoiceid = GETPOST('invoiceid', 'int'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + /* * View diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 5d0346a495c..c32561d3f52 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -48,6 +48,11 @@ if ($setterminal > 0) $langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter")); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + /* * View */ diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 66043f7139c..31390c347bd 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -34,6 +34,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $facid = GETPOST('facid', 'int'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + /* * View diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index a2d57ea3a6e..613b78d5578 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -38,6 +38,10 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $invoiceid = GETPOST('invoiceid', 'int'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + /* * View diff --git a/htdocs/takepos/send.php b/htdocs/takepos/send.php index 0b16f555e2f..8078ddc1787 100644 --- a/htdocs/takepos/send.php +++ b/htdocs/takepos/send.php @@ -37,6 +37,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $invoiceid = GETPOST('facid', 'int'); +if (empty($user->rights->takepos->run)) { + access_forbidden(); +} + + /* * View */ diff --git a/htdocs/takepos/smpcb.php b/htdocs/takepos/smpcb.php index 445bc6da9cc..6bf81b1cdf6 100644 --- a/htdocs/takepos/smpcb.php +++ b/htdocs/takepos/smpcb.php @@ -1,5 +1,15 @@ rights->takepos->run)) { + access_forbidden(); +} if (isset($_GET['status'])) { die(strtoupper($_SESSION['SMP_CURRENT_PAYMENT'])); From 01724894ad294df212dc90667d2015ad86201965 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Mar 2020 18:33:06 +0100 Subject: [PATCH 029/162] Fix useless BR --- htdocs/takepos/invoice.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index bf68713a806..9f0705b967d 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -916,14 +916,16 @@ if ($placeid > 0) if (empty($conf->global->TAKEPOS_SHOW_N_FIRST_LINES)) { $tooltiptext = ''.$langs->trans("Ref").' : '.$line->product_ref.'
'; $tooltiptext .= ''.$langs->trans("Label").' : '.$line->product_label.'
'; - $tooltiptext .= '
'; - $tooltiptext .= $line->desc; + if ($line->product_label != $line->desc) { + if ($line->desc) $tooltiptext .= '
'; + $tooltiptext .= $line->desc; + } $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : $line->product_ref, $tooltiptext); } else { if ($line->product_label) $htmlforlines .= $line->product_label; - if ($line->product_label && $line->desc) $htmlforlines .= '
'; if ($line->product_label != $line->desc) { + if ($line->product_label && $line->desc) $htmlforlines .= '
'; $firstline = dolGetFirstLineOfText($line->desc, $conf->global->TAKEPOS_SHOW_N_FIRST_LINES); if ($firstline != $line->desc) { From 73f2e9e5de7538d372350f74f71da5a846c7fe38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Mar 2020 19:23:18 +0100 Subject: [PATCH 030/162] WIP migrate num_paiement into num_payment Fix label for free product in takepos --- htdocs/cashdesk/validation_verif.php | 1 + htdocs/compta/facture/class/facture.class.php | 6 ++-- htdocs/compta/paiement/list.php | 6 ++-- htdocs/compta/paiement/tovalidate.php | 4 +-- htdocs/compta/paiement_charge.php | 9 +++--- .../class/bonprelevement.class.php | 2 +- .../class/rejetprelevement.class.php | 1 + htdocs/compta/sociales/card.php | 4 +-- .../class/paymentsocialcontribution.class.php | 29 ++++++++++++++----- .../modules/rapport/pdf_paiement.class.php | 8 ++--- htdocs/expensereport/card.php | 3 +- .../class/api_supplier_invoices.class.php | 6 ++-- htdocs/fourn/facture/paiement.php | 8 +++-- htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/public/payment/paymentok.php | 1 + htdocs/takepos/invoice.php | 13 +++++---- htdocs/webservices/server_payment.php | 18 ++++++------ 17 files changed, 70 insertions(+), 50 deletions(-) diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index b7b37054d91..7783bf7137a 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -305,6 +305,7 @@ switch ($action) $payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice(); $payment->paiementid=$invoice->mode_reglement_id; $payment->num_paiement=''; + $payment->num_payment=''; $paiement_id = $payment->create($user); if ($paiement_id > 0) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b0b78b3bf03..74d4c482c6a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2251,10 +2251,10 @@ class Facture extends CommonInvoice // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1 - * ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 + * Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1 + * or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 * - * @param User $user Objet utilisateur qui modifie + * @param User $user Object user that modify * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple) * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @return int <0 if KO, >0 if OK diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 926c0bfc87e..c78a010777a 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -115,7 +115,7 @@ if (GETPOST("orphelins", "alpha")) { // Payments not linked to an invoice. Should not happend. For debug only. $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; - $sql.= " p.statut, p.num_paiement,"; + $sql.= " p.statut, p.num_paiement as num_payment,"; $sql.= " c.code as paiement_code"; // Add fields from hooks $parameters=array(); @@ -133,7 +133,7 @@ if (GETPOST("orphelins", "alpha")) else { $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives - $sql.= " p.statut, p.num_paiement,"; + $sql.= " p.statut, p.num_paiement as num_payment,"; $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,"; $sql.= " s.rowid as socid, s.nom as name, s.email"; @@ -323,7 +323,7 @@ if ($resql) if (!$i) $totalarray['nbfield']++; // Payment number - print '
'.$objp->num_paiement.''.$objp->num_payment.'
'.img_object($langs->trans("ShowPayment"), "payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp), 'day')."$objp->paiement_type $objp->num_paiement$objp->paiement_type $objp->num_payment'.price($objp->amount).''; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 561120aead6..31e13a9d356 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -108,9 +108,10 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y $paiement->chid = $chid; $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Tableau de montant - $paiement->paiementtype = $_POST["paiementtype"]; - $paiement->num_paiement = $_POST["num_paiement"]; - $paiement->note = $_POST["note"]; + $paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml'); + $paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); + $paiement->note = GETPOST("note", 'none'); + $paiement->note_private = GETPOST("note", 'none'); if (!$error) { @@ -243,7 +244,7 @@ if ($action == 'create') print '
'.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')'; print '
'.$langs->trans("Comments").''.dol_print_date($db->jdate($objp->dp), 'day')."".$labeltype.' '.$objp->num_paiement."".$labeltype.' '.$objp->num_payment."
'; + $out .= '
'; $out .= ''; if (!empty($options)) $out .= ''; @@ -168,7 +168,7 @@ class FormFile $out .= ''; } - $out .= 'global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic') ? ' name="userfile"' : ' name="userfile[]" multiple'); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""'); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2bf5824477c..be847c73147 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1165,6 +1165,7 @@ table[summary="list_of_modules"] .fa-cog { .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth250onsmartphone { max-width: 250px; } .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } .minwidth50imp { min-width: 50px !important; } @@ -4161,6 +4162,7 @@ span[phptag] { background: #e6e6e6; display: inline-block; padding: 4px 0 4px 0; + z-index: 250; } .websitebar .buttonDelete, .websitebar .button { text-shadow: none; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8ad0df866c7..4715f6b72a9 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1245,6 +1245,7 @@ table[summary="list_of_modules"] .fa-cog { .maxwidth150onsmartphone { max-width: 120px; } .maxwidth150onsmartphoneimp { max-width: 120px !important; } .maxwidth200onsmartphone { max-width: 200px; } + .maxwidth250onsmartphone { max-width: 250px; } .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } .minwidth50imp { min-width: 50px !important; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index e8732c04673..2613d506c0b 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2074,7 +2074,7 @@ if (!GETPOST('hide_websitemenu')) // List of website print ''; $out = ''; - $out .= ''; if (empty($object->records)) $out .= ''; // Loop on each sites $i = 0; @@ -2260,7 +2260,7 @@ if (!GETPOST('hide_websitemenu')) if ($action != 'addcontainer') { - print ''.$formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action).''; + print ''.$formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action, 'maxwidth200onsmartphone').''; } else { From 42271bb7680ee09efa06f8e4df94aad6076ca6ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 02:30:19 +0100 Subject: [PATCH 032/162] CSS --- htdocs/theme/eldy/global.inc.php | 4 ++-- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index be847c73147..03ef2191a50 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1289,7 +1289,7 @@ td.showDragHandle { .side-nav-vert { position: sticky; top: 0px; - z-index: 210; + z-index: 1001; } @@ -4162,7 +4162,7 @@ span[phptag] { background: #e6e6e6; display: inline-block; padding: 4px 0 4px 0; - z-index: 250; + z-index: 1000; } .websitebar .buttonDelete, .websitebar .button { text-shadow: none; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 4715f6b72a9..33b9635bb68 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1440,7 +1440,7 @@ body.sidebar-collapse .side-nav, body.sidebar-collapse .login_block .side-nav-vert { position: sticky; top: 0px; - z-index: 210; + z-index: 1001; } From 5f255a6c14ae852046561f6616aed747fc837c06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 03:24:24 +0100 Subject: [PATCH 033/162] A new way to navigate between pages in list is available --- ChangeLog | 5 ++++- htdocs/contact/list.php | 6 +++--- htdocs/core/lib/functions.lib.php | 7 ++++--- htdocs/societe/list.php | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0483767ac50..6f48691d299 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,7 +8,10 @@ For Users: NEW: Module MO (Manufacturing Order) is available as stable module. For Developers or integrators: - +* A new way to navigate between pages in list is available. To use it, you must + - replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); + - remove input field in form '';' + - add parameter $pagenavastextinput to value 1 when calling print_barre_liste WARNING: diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 0335e203049..d7a8d025e21 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -108,7 +108,7 @@ $userid = GETPOST('userid', 'int'); $begin = GETPOST('begin'); if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "p.lastname"; -if (empty($page) || $page < 0) { $page = 0; } +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } $offset = $limit * $page; $titre = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); @@ -497,11 +497,11 @@ print ''; print ''; print ''; print ''; -print ''; +//print ''; print ''; print ''; -print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit); +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'address', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "contact"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8434755bef1..d544ffd6949 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4361,7 +4361,8 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', if ($cpt == $page) { $pagelist .= ''; - if (($cpt + 1) < $nbpages) $pagelist .= '/'; + $pagelist .= '/'; + //if (($cpt + 1) < $nbpages) $pagelist .= '/'; } } else { if ($cpt == $page) @@ -4386,9 +4387,9 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', } } else { //var_dump($page.' '.$cpt.' '.$nbpages); - if (($page + 1) < $nbpages) { + //if (($page + 1) < $nbpages) { $pagelist .= ''; - } + //} } } else diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index bf261a8076e..04ad577bff9 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -111,7 +111,7 @@ $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "s.nom"; -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; From 4f442905b2579aa96944df004b0ae4d6bc545e2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 03:31:58 +0100 Subject: [PATCH 034/162] A new way to navigate between pages in list is available --- htdocs/modulebuilder/template/myobject_list.php | 4 ++-- htdocs/product/list.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index e451a627d69..6697fd15da1 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -86,7 +86,7 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -367,7 +367,7 @@ print ''; print ''; print ''; -print ''; +//print ''; print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ae89e4c558c..a37acf91ebe 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -87,8 +87,8 @@ $diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user- $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); -$page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -536,11 +536,11 @@ if ($resql) print ''; print ''; print ''; - print ''; + //print ''; print ''; if (empty($arrayfields['p.fk_product_type']['checked'])) print ''; - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "product"; From f7cf5f878401171a35ebba74663afe83cef5aef2 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 17 Mar 2020 09:44:59 +0100 Subject: [PATCH 035/162] NEW add VAT rates in free zone for product/service in cash desk --- htdocs/takepos/css/pos.css.php | 16 +++++++- htdocs/takepos/freezone.php | 70 +++++++++++++++++++++++++++++----- htdocs/takepos/invoice.php | 9 ++++- 3 files changed, 83 insertions(+), 12 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index 32b7d7b7104..a95288f2f51 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -50,6 +50,7 @@ top_httphead('text/css'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); else header('Cache-Control: no-cache'); +header('Cache-Control: no-cache'); require DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; @@ -119,7 +120,7 @@ button.calcbutton2 { width: calc(25% - 2px); height: calc(25% - 2px); font-weight: bold; - font-size: 8pt; + font-size: 10pt; margin: 1px; } @@ -159,6 +160,19 @@ button.actionbutton { border-width: 0; } +button.item_value { + background: #bbbbbb; + border: #000000 1px solid; + border-radius: 4px; + padding: 8px; +} + +button.item_value.selected { + background: #ffffff; + color: #000000; + font-weight: bold; +} + div[aria-describedby="dialog-info"] button:before { content: "\f788"; font-family: "Font Awesome 5 Free"; diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php index e8cce00abb3..8861529d498 100644 --- a/htdocs/takepos/freezone.php +++ b/htdocs/takepos/freezone.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/takepos/floors.php + * \file htdocs/takepos/freezone.php * \ingroup takepos * \brief Popup to enter a free line */ @@ -32,6 +32,11 @@ if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); require '../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + +global $mysoc; $langs->loadLangs(array("bills", "cashdesk")); @@ -40,6 +45,20 @@ $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place $idline = GETPOST('idline', 'int'); $action = GETPOST('action', 'alpha'); +// get invoice +$invoice = new Facture($db); +if ($place > 0) { + $invoice->fetch($place); +} else { + $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$place.')'); +} + +// get default vat rate +$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION['takeposterminal']; +$soc = new Societe($db); +if ($invoice->socid > 0) $soc->fetch($invoice->socid); +else $soc->fetch($conf->global->$constforcompanyid); +$vatRateDefault = get_default_tva($mysoc, $soc); /* * View @@ -48,18 +67,34 @@ $action = GETPOST('action', 'alpha'); $arrayofcss = array('/takepos/css/pos.css.php'); $arrayofjs = array(); -top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); - +top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss); ?> @@ -72,6 +107,21 @@ if ($action == "addnote") echo ' +load_cache_vatrates("'" . $mysoc->country_code . "'"); + if ($num > 0) { + print '

'; + print $langs->trans('VAT') . ' : '; + foreach ($form->cache_vatrates as $rate) { + print ''; + } + } +} +?> diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3ca20a9ddee..93c91e2f55b 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +global $mysoc; + $langs->loadLangs(array("companies", "commercial", "bills", "cashdesk", "stocks")); $id = GETPOST('id', 'int'); @@ -327,7 +329,12 @@ if ($action == "freezone") { $customer = new Societe($db); $customer->fetch($invoice->socid); - $tva_tx = get_default_tva($mysoc, $customer); + $tva_tx = GETPOST('tva_tx', 'alpha'); + if ($tva_tx != '') { + $tva_tx = price2num($tva_tx); + } else { + $tva_tx = get_default_tva($mysoc, $customer); + } // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr); From a74dca4a203cbaf5148e16f584cf8d4b563ac002 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 17 Mar 2020 09:52:26 +0100 Subject: [PATCH 036/162] FIX resolve conflicts --- htdocs/takepos/css/pos.css.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index a95288f2f51..fb9bd1a0707 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -50,7 +50,6 @@ top_httphead('text/css'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); else header('Cache-Control: no-cache'); -header('Cache-Control: no-cache'); require DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; @@ -120,7 +119,7 @@ button.calcbutton2 { width: calc(25% - 2px); height: calc(25% - 2px); font-weight: bold; - font-size: 10pt; + font-size: 8pt; margin: 1px; } From 1d05531aa8f57a0e3483191c3f78347b41a18cdf Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 17 Mar 2020 10:10:54 +0100 Subject: [PATCH 037/162] fix wrong DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_ called --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 1ed1327684c..318e6dec614 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1559,7 +1559,7 @@ else // Other attributes $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_create.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Assign a sale representative print '
'; From cb43928a5d5659e0c25d247a915712f41ab07309 Mon Sep 17 00:00:00 2001 From: ATM john Date: Tue, 17 Mar 2020 12:29:14 +0100 Subject: [PATCH 038/162] Fix radio label target --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 611d7d791ec..c6220f647aa 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3017,7 +3017,7 @@ if ($action == 'create') // First situation invoice print '
'; $tmp = ' '; - $tmp = $tmp.''; + $tmp = $tmp.''; $desc = $form->textwithpicto($tmp, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; From 76fc7226386a44065ee80482a49eda4597670bca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 13:33:21 +0100 Subject: [PATCH 039/162] NEW Can get some variables (not available by default) --- htdocs/api/class/api_setup.class.php | 33 +++++++++++++++++++++++++++- htdocs/core/lib/functions.lib.php | 2 ++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index d3543683db2..5312add51ba 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1401,6 +1401,37 @@ class Setup extends DolibarrApi return $this->_cleanObjectDatas($mysoc); } + + /** + * Get value of a setup variables + * + * Note that conf variables that stores security key or password hashes can't be loaded with API. + * + * @url GET /conf + * + * @param string $confname Name of conf variable to get + * @return array|mixed Data without useless information + * @throws RestException 500 Error Bad or unknown value for constname + */ + public function getConf($confname) + { + global $conf; + + if (!DolibarrApiAccess::$user->admin + && (empty($conf->global->API_LOGIN_ALLOWED_FOR_ADMIN_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_ADMIN_CHECK)) { + throw new RestException(503, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK'); + } + + if (! preg_match('/[^a-zA-Z0-9_]/', $confname) || ! isset($conf->global->$confname)) { + throw new RestException(500, 'Error Bad or unknown value for constname'); + } + if (preg_match('/(_pass|password|secret|_key|key$)/i', $confname)) { + throw new RestException(503, 'Forbidden'); + } + + return $conf->global->$confname; + } + /** * Do a test of integrity for files and setup. * @@ -1418,7 +1449,7 @@ class Setup extends DolibarrApi if (!DolibarrApiAccess::$user->admin && (empty($conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK)) { - throw new RestException(503, 'Error API open to admin users only or to login user defined with constant API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK'); + throw new RestException(503, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK'); } require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d544ffd6949..87db67d3f17 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6463,6 +6463,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null) // Make substitution for language keys: __(AnyTranslationKey)__ or __(AnyTranslationKey|langfile)__ if (is_object($outputlangs)) { + $reg = array(); while (preg_match('/__\(([^\)]+)\)__/', $text, $reg)) { $msgishtml = 0; @@ -6478,6 +6479,7 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null) // Make substitution for constant keys. // Must be after the substitution of translation, so if the text of translation contains a string __[xxx]__, it is also converted. + $reg = array(); while (preg_match('/__\[([^\]]+)\]__/', $text, $reg)) { $msgishtml = 0; From 952528948896179635bf7f914a5781f749262f4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 13:50:20 +0100 Subject: [PATCH 040/162] Fix return code of some API --- htdocs/api/class/api_setup.class.php | 12 ++++++++---- htdocs/commande/class/api_orders.class.php | 3 ++- htdocs/compta/facture/class/api_invoices.class.php | 3 ++- htdocs/contrat/class/api_contracts.class.php | 3 ++- htdocs/user/class/api_users.class.php | 5 +++-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 5312add51ba..2afca6aedb5 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1411,7 +1411,9 @@ class Setup extends DolibarrApi * * @param string $confname Name of conf variable to get * @return array|mixed Data without useless information - * @throws RestException 500 Error Bad or unknown value for constname + * + * @throws RestException 403 Forbidden + * @throws RestException 500 Error Bad or unknown value for constname */ public function getConf($confname) { @@ -1419,14 +1421,14 @@ class Setup extends DolibarrApi if (!DolibarrApiAccess::$user->admin && (empty($conf->global->API_LOGIN_ALLOWED_FOR_ADMIN_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_ADMIN_CHECK)) { - throw new RestException(503, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK'); + throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK'); } if (! preg_match('/[^a-zA-Z0-9_]/', $confname) || ! isset($conf->global->$confname)) { throw new RestException(500, 'Error Bad or unknown value for constname'); } if (preg_match('/(_pass|password|secret|_key|key$)/i', $confname)) { - throw new RestException(503, 'Forbidden'); + throw new RestException(403, 'Forbidden'); } return $conf->global->$confname; @@ -1440,7 +1442,9 @@ class Setup extends DolibarrApi * * @url GET checkintegrity * - * @throws RestException + * @throws RestException 404 Signature file not found + * @throws RestException 500 Technical error + * @throws RestException 503 Forbidden */ public function getCheckIntegrity($target) { diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index eb3c165d447..289bbea2c7e 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -150,7 +150,8 @@ class Orders extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of order objects * - * @throws RestException + * @throws RestException 404 Not found + * @throws RestException 503 Error */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 969d351d1bb..961d07eda2e 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -158,7 +158,8 @@ class Invoices extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of invoice objects * - * @throws RestException + * @throws RestException 404 Not found + * @throws RestException 503 Error */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') { diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 71458e76050..ecd03ade1a6 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -99,7 +99,8 @@ class Contracts extends DolibarrApi * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of contract objects * - * @throws RestException + * @throws RestException 404 Not found + * @throws RestException 503 Error */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 373a8b55f0e..fb1da988ce4 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -290,7 +290,8 @@ class Users extends DolibarrApi * @param int $id Id of user * @return array Array of group objects * - * @throws RestException + * @throws RestException 403 Not allowed + * @throws RestException 404 Not found * * @url GET {id}/groups */ @@ -299,7 +300,7 @@ class Users extends DolibarrApi $obj_ret = array(); if (!DolibarrApiAccess::$user->rights->user->user->lire) { - throw new RestException(401); + throw new RestException(403); } $user = new User($this->db); From 033f7963980fc9c6232cf074f13397b67916db67 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 17 Mar 2020 14:51:48 +0100 Subject: [PATCH 041/162] Work on split module fournisseur --- htdocs/admin/dict.php | 6 +++--- htdocs/admin/fckeditor.php | 2 +- htdocs/admin/mails_templates.php | 4 ++-- htdocs/admin/stock.php | 4 ++-- htdocs/core/lib/company.lib.php | 3 ++- htdocs/core/modules/modBanque.class.php | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d634f547ff9..949037b92e1 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -437,15 +437,15 @@ $tabcond[8] = !empty($conf->societe->enabled); $tabcond[9] = true; $tabcond[10] = true; $tabcond[11] = (!empty($conf->societe->enabled)); -$tabcond[12] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled)); -$tabcond[13] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled)); +$tabcond[12] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled)); +$tabcond[13] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled)); $tabcond[14] = (!empty($conf->product->enabled) && (!empty($conf->ecotax->enabled) || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY))); $tabcond[15] = true; $tabcond[16] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)); $tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled)); $tabcond[18] = !empty($conf->expedition->enabled) || !empty($conf->reception->enabled); $tabcond[19] = !empty($conf->societe->enabled); -$tabcond[20] = !empty($conf->fournisseur->enabled); +$tabcond[20]= (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled)); $tabcond[21] = !empty($conf->propal->enabled); $tabcond[22] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled)); $tabcond[23] = true; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index efe8ca1117d..869a08047ec 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -57,7 +57,7 @@ $modules = array( $conditions = array( 'SOCIETE' => 1, 'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)), -'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled)), +'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)), 'USERSIGN' => 1, 'MAILING' => ! empty($conf->mailing->enabled), 'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)), diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index bb5fd72ec29..9969acc5415 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -160,8 +160,8 @@ if ($conf->expedition->enabled) $elementList['shipping_send'] = $langs->t if ($conf->reception->enabled) $elementList['reception_send'] = $langs->trans('MailToSendReception'); if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = $langs->trans('MailToSendIntervention'); if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = $langs->trans('MailToSendSupplierRequestForQuotation'); -if ($conf->fournisseur->enabled) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder'); -if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice'); +if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder'); +if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_invoice->enabled) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice'); if ($conf->societe->enabled) $elementList['thirdparty'] = $langs->trans('MailToThirdparty'); if ($conf->adherent->enabled) $elementList['member'] = $langs->trans('MailToMember'); if ($conf->contrat->enabled) $elementList['contract'] = $langs->trans('MailToSendContract'); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index f1cbea504d3..0b6987b1a9f 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -213,7 +213,7 @@ $found=0; print '
'; print ''; print ''; print ''; print ''; From a76392f94471f23572039443076d2c5a282a7ded Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Mar 2020 21:26:25 +0100 Subject: [PATCH 043/162] Responsive --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 012261ce592..4db05a87005 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1731,7 +1731,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin //$out.=''; // Linked object - $out .= ''; } +if (!empty($arrayfields['e.phone']['checked'])) +{ + print ''; +} +if (!empty($arrayfields['e.fax']['checked'])) +{ + print ''; +} if (!empty($arrayfields['stockqty']['checked'])) { print ''; @@ -462,6 +474,14 @@ if (!empty($arrayfields['e.town']['checked'])) { print_liste_field_titre($arrayfields['e.town']['label'], $_SERVER["PHP_SELF"], "e.town", "", $param, "", $sortfield, $sortorder); } +if (!empty($arrayfields['e.phone']['checked'])) +{ + print_liste_field_titre($arrayfields['e.phone']['label'], $_SERVER["PHP_SELF"], "e.phone", "", $param, "", $sortfield, $sortorder); +} +if (!empty($arrayfields['e.fax']['checked'])) +{ + print_liste_field_titre($arrayfields['e.fax']['label'], $_SERVER["PHP_SELF"], "e.fax", "", $param, "", $sortfield, $sortorder); +} if (!empty($arrayfields['stockqty']['checked'])) { print_liste_field_titre($arrayfields['stockqty']['label'], $_SERVER["PHP_SELF"], "stockqty", '', $param, '', $sortfield, $sortorder, 'right '); @@ -553,6 +573,18 @@ if ($num) print ''; } + // Phone + if (!empty($arrayfields['e.phone']['checked'])) + { + print ''; + } + + //Fax + if (!empty($arrayfields['e.fax']['checked'])) + { + print ''; + } + // Stock qty if (!empty($arrayfields['stockqty']['checked'])) { @@ -654,6 +686,14 @@ if ($num) { $emptyColumn++; } + if (!empty($arrayfields['e.phone']['checked'])) + { + $emptyColumn++; + } + if (!empty($arrayfields['e.fax']['checked'])) + { + $emptyColumn++; + } for ($i=0; $i < $emptyColumn; $i++) { From 71e22ee11b04f70e3b51b10cf4d9cd84b2877832 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 18 Mar 2020 00:55:20 +0100 Subject: [PATCH 045/162] Update 11.0.0-12.0.0.sql --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 0a61a6d9c58..6311af04a03 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -194,3 +194,6 @@ ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_export varchar(32) AFTER accountancy_code_buy_intra; ALTER TABLE llx_accounting_account ADD COLUMN reconciliable tinyint DEFAULT 0 NOT NULL after active; + +ALTER TABLE llx_entrepot ADD COLUMN fax varchar(20) DEFAULT NULL AFTER fk_pays; +ALTER TABLE llx_entrepot ADD COLUMN phone varchar(20) DEFAULT NULL AFTER fk_pays; From 82058f3a783aa1dd2238bfa368c7789ec9b0f261 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 18 Mar 2020 01:17:54 +0100 Subject: [PATCH 046/162] add phone --- htdocs/install/mysql/tables/llx_entrepot.sql | 2 ++ htdocs/product/stock/card.php | 13 +++++++++++++ htdocs/product/stock/class/entrepot.class.php | 18 +++++++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_entrepot.sql b/htdocs/install/mysql/tables/llx_entrepot.sql index 831e1f4a58e..2cabb457016 100644 --- a/htdocs/install/mysql/tables/llx_entrepot.sql +++ b/htdocs/install/mysql/tables/llx_entrepot.sql @@ -32,6 +32,8 @@ create table llx_entrepot town varchar(50), fk_departement integer, fk_pays integer DEFAULT 0, + phone varchar(20), -- phone number + fax varchar(20), -- fax number statut tinyint DEFAULT 1, -- 1 open, 0 close fk_user_author integer, model_pdf varchar(255), diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index d0a1fc5db76..c025f0d08aa 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -105,6 +105,8 @@ if (empty($reshook)) $object->zip = GETPOST("zipcode"); $object->town = GETPOST("town"); $object->country_id = GETPOST("country_id"); + $object->phone = GETPOST("phone"); + $object->fax = GETPOST("fax"); if (!empty($object->libelle)) { @@ -174,6 +176,8 @@ if (empty($reshook)) $object->zip = GETPOST("zipcode"); $object->town = GETPOST("town"); $object->country_id = GETPOST("country_id"); + $object->phone = GETPOST("phone"); + $object->fax = GETPOST("fax"); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); @@ -292,6 +296,11 @@ if ($action == 'create') print $form->select_country((!empty($object->country_id) ? $object->country_id : $mysoc->country_code), 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; + + // Phone / Fax + print ''; + print ''; + // Status print ''; + // Phone / Fax + print ''; + print ''; + // Status print ''; } - + //Fax if (!empty($arrayfields['e.fax']['checked'])) { From 1fe4e4415e07d428fa0e1e8bb2da1057c7c71722 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 18 Mar 2020 09:27:08 +0100 Subject: [PATCH 048/162] FIX: Bank movements color is not showing --- htdocs/compta/bank/bankentries_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 297f0dd91d4..d7951233f7b 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1157,14 +1157,14 @@ if ($resql) } else { $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR1; } - $backgroundcolor = 'style="background-color: '.$color.';"'; + $backgroundcolor = 'style="background: '.$color.';"'; } else { if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR2)) { $color = '#7fdb86'; } else { $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR2; } - $backgroundcolor = 'style="background-color: '.$color.';"'; + $backgroundcolor = 'style="background: '.$color.';"'; } } print ''; From 50a0bfef64ea1fbdbfa409ae56cc1a5ac98ab7f7 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 18 Mar 2020 09:53:13 +0100 Subject: [PATCH 049/162] NEW: Export module, add extrafields for Contract and Contract line --- htdocs/core/modules/modContrat.class.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 3b8a7aa3f8b..e50af779c5c 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -193,14 +193,20 @@ class modContrat extends DolibarrModules 'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'); + $keyforselect='contrat'; $keyforelement='contract'; $keyforaliasextra='coextra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='contratdet'; $keyforelement='contract_line'; $keyforaliasextra='codextra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contrat as co,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contratdet as cod'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cod.fk_product = p.rowid)'; - $this->export_sql_end[$r] .=' WHERE co.fk_soc = s.rowid and co.rowid = cod.fk_contrat'; - $this->export_sql_end[$r] .=' AND co.entity IN ('.getEntity('contract').')'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid'; + $this->export_sql_end[$r] .=' INNER JOIN '.MAIN_DB_PREFIX.'contrat as co ON co.fk_soc = s.rowid'; + $this->export_sql_end[$r] .=' INNER JOIN '.MAIN_DB_PREFIX.'contratdet as cod ON co.rowid = cod.fk_contrat'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (cod.fk_product = p.rowid)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'contrat_extrafields as coextra on (co.rowid = coextra.fk_object)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'contratdet_extrafields as codextra on (cod.rowid = codextra.fk_object)'; + $this->export_sql_end[$r] .=' WHERE co.entity IN ('.getEntity('contract').')'; } From 2e1554def4be9c37232c9b4fe37242b8a966d97c Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 18 Mar 2020 10:18:52 +0100 Subject: [PATCH 050/162] FIX : wrong include - replace extrafields_create.tpl.php to extrafields_add.tpl.php --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 1ed1327684c..318e6dec614 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1559,7 +1559,7 @@ else // Other attributes $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_create.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Assign a sale representative print ''; From d3aeec0a7c773fe4c8356da60c863f73177ae9ba Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 18 Mar 2020 10:30:15 +0100 Subject: [PATCH 051/162] Fix situation value transmission --- htdocs/compta/facture/card.php | 13 ++++++++++++- htdocs/compta/facture/class/facture.class.php | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 94298d14f29..dc2eb2c5308 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1699,7 +1699,18 @@ if (empty($reshook)) $object->fk_facture_source = $_POST['situations']; $object->type = Facture::TYPE_SITUATION; - if (!empty($origin) && !empty($originid)) + + $object->retained_warranty = GETPOST('retained_warranty', 'int'); + $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); + + $retained_warranty_date_limit = GETPOST('retained_warranty_date_limit'); + if (!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)) { + $object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit); + } + $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement); +var_dump('la', $object->retained_warranty); + + if (!empty($origin) && !empty($originid)) { $object->origin = $origin; $object->origin_id = $originid; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8c198b58a3e..c2c82424b77 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1052,6 +1052,11 @@ class Facture extends CommonInvoice $facture->situation_cycle_ref = $this->situation_cycle_ref; $facture->situation_final = $this->situation_final; + $facture->retained_warranty = $this->retained_warranty; + $facture->retained_warranty_fk_cond_reglement = $this->retained_warranty_fk_cond_reglement; + $facture->retained_warranty_date_limit = $this->retained_warranty_date_limit; + + // Loop on each line of new invoice foreach ($facture->lines as $i => $tmpline) { From 0a5f971eb514dda0f6cb1f42451a5f822f3c3d57 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 18 Mar 2020 09:32:34 +0000 Subject: [PATCH 052/162] Fixing style errors. --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index dc2eb2c5308..26ea6a28f24 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1708,7 +1708,7 @@ if (empty($reshook)) $object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit); } $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement); -var_dump('la', $object->retained_warranty); + var_dump('la', $object->retained_warranty); if (!empty($origin) && !empty($originid)) { From 7b8cafb710fce5979185df60aa5811cef03a3e3a Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 18 Mar 2020 10:34:44 +0100 Subject: [PATCH 053/162] remove var_dump --- htdocs/compta/facture/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index dc2eb2c5308..e75a8d35d7c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1708,7 +1708,6 @@ if (empty($reshook)) $object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit); } $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement); -var_dump('la', $object->retained_warranty); if (!empty($origin) && !empty($originid)) { From c767e553d3bd5b78cb39e9f4354f7580134091ca Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 18 Mar 2020 10:59:13 +0100 Subject: [PATCH 054/162] fix import line from object default value for situations --- htdocs/compta/facture/card.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c6220f647aa..f30e858f7f2 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2541,7 +2541,12 @@ if (empty($reshook)) $pa_ht = $originLine->pa_ht; $label = $originLine->label; $array_options = $originLine->array_options; - $situation_percent = 100; + if($object->type == Facture::TYPE_SITUATION){ + $situation_percent = 0; + } + else{ + $situation_percent = 100; + } $fk_prev_id = ''; $fk_unit = $originLine->fk_unit; $pu_ht_devise = $originLine->multicurrency_subprice; From 56e4fa1bb3c3e6131be211ff21a922afb3ce9614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 14:01:11 +0100 Subject: [PATCH 055/162] Trans --- dev/translation/txpull.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/translation/txpull.sh b/dev/translation/txpull.sh index 3f24bd0912d..fcccae98221 100755 --- a/dev/translation/txpull.sh +++ b/dev/translation/txpull.sh @@ -54,5 +54,5 @@ fi echo Think to launch also: echo "> dev/tools/fixaltlanguages.sh fix all" -echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with ''" +echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with '' on *.lang files" From cc93a40c4582fe9105b17b91ecedebdee4e538cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 14:06:15 +0100 Subject: [PATCH 056/162] Fix label of local tax --- htdocs/core/modules/modFacture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 984e28f4e31..991cd571f3e 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -216,7 +216,7 @@ class modFacture extends DolibarrModules 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT", - 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', + 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LT1', 'f.localtax2'=>'LT2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', 'none.rest'=>'Rest', 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'fd.rowid'=>'LineId', 'fd.description'=>"LineDescription", @@ -303,7 +303,7 @@ class modFacture extends DolibarrModules 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT", - 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LocalTax1', 'f.localtax2'=>'LocalTax2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', + 'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'f.localtax1'=>'LT1', 'f.localtax2'=>'LT2', 'f.paye'=>"InvoicePaidCompletely", 'f.fk_statut'=>'InvoiceStatus', 'f.close_code'=>'EarlyClosingReason', 'f.close_note'=>'EarlyClosingComment', 'none.rest'=>'Rest', 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'f.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', 'p.rowid'=>'PaymentId', 'p.ref'=>'PaymentRef', From 15614abc3fb29e113756a0d8da1796bd75b5819f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 18 Mar 2020 15:08:58 +0100 Subject: [PATCH 057/162] NEW: add csv separator setup in module admin --- htdocs/admin/export.php | 19 +++-- htdocs/admin/import.php | 99 +++++++++++++++++++++++++ htdocs/core/modules/modImport.class.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/exports.lang | 2 + 5 files changed, 117 insertions(+), 6 deletions(-) create mode 100644 htdocs/admin/import.php diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index 107954fa4cd..f18b2357cf6 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -23,9 +23,9 @@ */ /** - * \file htdocs/admin/expedition.php - * \ingroup expedition - * \brief Page d'administration/configuration du module Expedition + * \file htdocs/admin/export.php + * \ingroup export + * \brief config Page module Export */ require '../main.inc.php'; @@ -69,7 +69,7 @@ $head[$h][1] = $langs->trans("Setup"); $head[$h][2] = 'setup'; $h++; -dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "exports"); +dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "technic"); print '
'.$options.'
'.$langs->trans("ReStockOnBill").''; -if (! empty($conf->fournisseur->enabled)) +if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); @@ -234,7 +234,7 @@ $found++; print '
'.$langs->trans("ReStockOnValidateOrder").''; -if (! empty($conf->fournisseur->enabled)) +if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a3771d53cff..0ee3f32e015 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -104,7 +104,8 @@ function societe_prepare_head(Societe $object) $h++; } } - if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) + if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) $supplier_module_enabled=1; + if ($supplier_module_enabled==1 && $object->fournisseur && !empty($user->rights->fournisseur->lire)) { $head[$h][0] = DOL_URL_ROOT.'/fourn/card.php?socid='.$object->id; $head[$h][1] = $langs->trans("Supplier"); diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php index 6448dcd74ef..21e636364e3 100644 --- a/htdocs/core/modules/modBanque.class.php +++ b/htdocs/core/modules/modBanque.class.php @@ -161,7 +161,7 @@ class modBanque extends DolibarrModules "s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company" ); $this->export_special_array[$r]=array('-b.amount'=>'NULLIFNEG','b.amount'=>'NULLIFNEG'); - if (empty($conf->fournisseur->enabled)) + if (empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || empty($conf->supplier_order->enabled) || empty($conf->supplier_invoice->enabled)) { unset($this->export_fields_array[$r]['s.code_compta_fournisseur']); unset($this->export_entities_array[$r]['s.code_compta_fournisseur']); From 075757eb3df5ec2412ef85166b1330bec4d79a27 Mon Sep 17 00:00:00 2001 From: ATM john Date: Tue, 17 Mar 2020 16:49:05 +0100 Subject: [PATCH 042/162] Fix situation value transmission --- htdocs/compta/facture/card.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c6220f647aa..94298d14f29 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3304,14 +3304,28 @@ if ($action == 'create') } $retained_warranty = GETPOST('retained_warranty', 'int'); - $retained_warranty = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + if(empty($retained_warranty)){ + if(!empty($objectsrc->retained_warranty)){ // use previous situation value + $retained_warranty = $objectsrc->retained_warranty; + }else{ + $retained_warranty = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + } + } + print '
'.$langs->trans('RetainedWarranty').''; print '%'; // Retained warranty payment term print '
'.$langs->trans('PaymentConditionsShortRetainedWarranty').''; $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement) ? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + if(empty($retained_warranty_fk_cond_reglement)){ + $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value + $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; + }else{ + $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; + } + } $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); print '
'.dol_trunc($histo[$key]['note'], 40).''; + $out .= ''; if (isset($histo[$key]['elementtype']) && !empty($histo[$key]['fk_element'])) { $out .= dolGetElementUrl($histo[$key]['fk_element'], $histo[$key]['elementtype'], 1); From 9fa4f245cc1ca217ad9d259ea13ad699813e5022 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 18 Mar 2020 00:03:26 +0100 Subject: [PATCH 044/162] Update list.php --- htdocs/product/stock/list.php | 44 +++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index d5fdf711ea5..8b65d33890e 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -95,6 +95,8 @@ $fieldstosearchall = array( 'e.address'=>"Address", 'e.zip'=>'Zip', 'e.town'=>'Town', + 'e.phone'=>'Phone', + 'e.fax'=>'Fax', ); // Definition of fields for list @@ -105,6 +107,8 @@ $arrayfields = array( 'e.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0), 'e.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0), 'e.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0), + 'e.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>0), + 'e.fax'=>array('label'=>$langs->trans("Fax"), 'checked'=>0), 'stockqty'=>array('type'=>'float', 'label'=>$langs->trans("PhysicalStock"), 'enabled'=>1, 'visible'=>-2, 'position'=>70), 'estimatedvalue'=>array('type'=>'float', 'label'=>$langs->trans("EstimatedStockValue"), 'enabled'=>1, 'visible'=>-2, 'position'=>71), 'sellvalue'=>array('type'=>'float', 'label'=>$langs->trans("EstimatedStockValueSell"), 'enabled'=>1, 'visible'=>-2, 'position'=>72), @@ -182,7 +186,7 @@ $title = $langs->trans("ListOfWarehouses"); // Build and execute select // -------------------------------------------------------------------- -$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent,"; +$sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.phone, e.fax, e.fk_pays, e.fk_parent,"; $sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -222,7 +226,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent"; +$sql .= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.phone, e.fax, e.fk_parent"; $totalnboflines = 0; $result = $db->query($sql); if ($result) @@ -399,6 +403,14 @@ if (!empty($arrayfields['e.town']['checked'])) { print ''.$obj->town.''.$obj->phone.''.$obj->fax.'
'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'
'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$langs->trans("Status").''; print '
'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', '', $object, 0).'
'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$langs->trans("Status").''; print ''.$obj->phone.'
'; @@ -84,13 +84,22 @@ print ''; print ''; print ''; print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print '"; +print ''; +print ''; print ''; print '
'.$langs->trans("EXPORTS_SHARE_MODELS").' '; - print ''; print ''; print ''; echo ajax_constantonoff('EXPORTS_SHARE_MODELS'); print ''; +print '
'.$langs->trans("ExportCsvSeparator").''."global->EXPORT_CSV_SEPARATOR_TO_USE."\">
'; diff --git a/htdocs/admin/import.php b/htdocs/admin/import.php new file mode 100644 index 00000000000..898d5dc4900 --- /dev/null +++ b/htdocs/admin/import.php @@ -0,0 +1,99 @@ + + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2018 Philippe Grand + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/import.php + * \ingroup import + * \brief config page module import + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('admin', 'exports', 'other')); + +if (!$user->admin) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); +$value = GETPOST('value', 'alpha'); + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + + +/* + * View + */ + +$form = new Form($db); + +$page_name = "ImportSetup"; +llxHeader('', $langs->trans($page_name)); + +// Subheader +$linkback = ''.$langs->trans("BackToModuleList").''; + +print load_fiche_titre($langs->trans($page_name), $linkback); + +//$head = export_admin_prepare_head(); +$h = 0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT.'/admin/import.php'; +$head[$h][1] = $langs->trans("Setup"); +$head[$h][2] = 'setup'; +$h++; + +dol_fiche_head($head, 'setup', $langs->trans("ImportArea"), -1, "technic"); + + +print ''; +print ''; +print ''."\n"; +print ''; +print ''."\n"; + +print ''; +print ''; +print ''; +print ''; +print ''; + +print ''; +print '"; +print ''; +print ''; +print ''; + +print '
'.$langs->trans("Parameters").' 
'.$langs->trans("ImportCsvSeparator").''."global->IMPORT_CSV_SEPARATOR_TO_USE."\">
'; + +dol_fiche_end(); + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php index 6071f04fc44..c725660f239 100644 --- a/htdocs/core/modules/modImport.class.php +++ b/htdocs/core/modules/modImport.class.php @@ -57,7 +57,7 @@ class modImport extends DolibarrModules $this->dirs = array("/import/temp"); // Config pages - $this->config_page_url = array(); + $this->config_page_url = array("import.php"); // Dependencies $this->hidden = false; // A condition to hide module diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7a4de856ba2..62119428b9a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1959,6 +1959,7 @@ WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramatical ModuleActivated=Module %s is activated and slows the interface EXPORTS_SHARE_MODELS=Export models are share with everybody ExportSetup=Setup of module Export +ImportSetup=Setup of module Import InstanceUniqueID=Unique ID of the instance SmallerThan=Smaller than LargerThan=Larger than diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index 2dcf4317e00..3549e3f8b23 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -26,6 +26,8 @@ FieldTitle=Field title NowClickToGenerateToBuildExportFile=Now, select the file format in the combo box and click on "Generate" to build the export file... AvailableFormats=Available Formats LibraryShort=Library +ExportCsvSeparator=Csv caracter separator +ImportCsvSeparator=Csv caracter separator Step=Step FormatedImport=Import Assistant FormatedImportDesc1=This module allows you to update existing data or add new objects into the database from a file without technical knowledge, using an assistant. From 9bfc60064b93fa07a5cfb35f54b431f040f57c48 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 18 Mar 2020 15:12:02 +0100 Subject: [PATCH 058/162] ass credential --- htdocs/admin/import.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/import.php b/htdocs/admin/import.php index 898d5dc4900..3ead31ab0f3 100644 --- a/htdocs/admin/import.php +++ b/htdocs/admin/import.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2020 Floriazn Henry * * 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 From a3328c5ef3b238414cd198f1beaa58117c5a760e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 18:37:44 +0100 Subject: [PATCH 059/162] Fix div --- htdocs/core/tpl/contacts.tpl.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index b5df248b590..a9297d8c2e6 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -66,11 +66,12 @@ $userstatic = new User($db); ?> -
-
-
-
'."\n"; +print '
'."\n"; +print '
'."\n"; + if ($permission) { ?>
From b9f404b5fab2fb649beaa56285fc81d1551145f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 19:07:15 +0100 Subject: [PATCH 060/162] Fix form inside table --- htdocs/admin/export.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index 107954fa4cd..b92ab7d7091 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -71,6 +71,9 @@ $h++; dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "exports"); +print ''; +print ''; +print ''; print ''; print ''; @@ -78,23 +81,18 @@ print ''."\n"; print ''; print ''."\n"; - // Example with a yes / no select print ''; print ''; print ''; print ''; print '
'.$langs->trans("Parameters").' 
'.$langs->trans("EXPORTS_SHARE_MODELS").' '; - -print ''; -print ''; -print ''; echo ajax_constantonoff('EXPORTS_SHARE_MODELS'); -print ''; - print '
'; +print ''; + dol_fiche_end(); // End of page From 30b48a9ee3480fccf9e067ccd805874f695d6e22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 19:21:32 +0100 Subject: [PATCH 061/162] Fix update --- htdocs/admin/export.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index 2e788ede3fa..ef6a7c3108f 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -38,13 +38,15 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); -$value = GETPOST('value', 'alpha'); + /* * Actions */ -include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +if ($action == 'save') { + dolibarr_set_const($db, 'EXPORT_CSV_SEPARATOR_TO_USE', GETPOST('EXPORT_CSV_SEPARATOR_TO_USE', 'alphanohtml')); +} /* @@ -73,7 +75,7 @@ dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "technic"); print '
'; print ''; -print ''; +print ''; print ''; @@ -93,7 +95,7 @@ print ''; print ''; print ''; -print '"; +print '"; print ''; print ''; From 8c34a091b4b7663ddef57ccb20cdff909c29bd54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 19:24:11 +0100 Subject: [PATCH 062/162] Fix import --- htdocs/admin/import.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/import.php b/htdocs/admin/import.php index 3ead31ab0f3..37c9b205424 100644 --- a/htdocs/admin/import.php +++ b/htdocs/admin/import.php @@ -72,6 +72,10 @@ $h++; dol_fiche_head($head, 'setup', $langs->trans("ImportArea"), -1, "technic"); +print ''; +print ''; +print ''; +print ''; print '
'.$langs->trans("ExportCsvSeparator").''."global->EXPORT_CSV_SEPARATOR_TO_USE."\">'."global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE)."\">
'; print ''; @@ -80,19 +84,15 @@ print ''; print ''."\n"; print ''; -print ''; -print ''; -print ''; -print ''; - -print ''; -print '"; +print ''; +print '"; print ''; print ''; -print ''; print '
 
'.$langs->trans("ImportCsvSeparator").''."global->IMPORT_CSV_SEPARATOR_TO_USE."\">'.$langs->trans("ImportCsvSeparator").' ('.$langs->trans("ByDefault").')'."global->IMPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE)."\">
'; +print ''; + dol_fiche_end(); // End of page From ef1285f05018de5588ca702b491bc927ee3bbe33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 19:42:20 +0100 Subject: [PATCH 063/162] css --- htdocs/theme/eldy/global.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 03ef2191a50..e590532a11f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1552,7 +1552,7 @@ div.nopadding { td.nobordernopadding.widthpictotitle.opacityhigh.valignmiddle.col-picto { color: var(--colortexttitlenotab); - opacity: 0.65; + opacity: 0.45; } .pictotitle { margin-: 8px; From 54d3703c42af1b3837973a2ea58177655c180904 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 19:45:47 +0100 Subject: [PATCH 064/162] Prepare 11.0.3 --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 59b02bad4be..97923801971 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,7 @@ FIX: Remove unexisting link FIX: substitute lines dates values on doc generator (ODT, ...) FIX: Ticket - Load Cache Messages Ticket, wrong message's status FIX: Ticket Public - Private messages are displayed +FIX: wrong include - replace extrafields_create.tpl.php to extrafields_add.tpl.php ***** ChangeLog for 11.0.2 compared to 11.0.1 ***** FIX: #10309 From 6298071f83a1c05ec236f840b405a87cf59c2cd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 19:55:49 +0100 Subject: [PATCH 065/162] CSS --- htdocs/accountancy/customer/list.php | 4 ++-- htdocs/accountancy/supplier/list.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 9e4f73d8f7a..ec872726012 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -566,8 +566,8 @@ if ($result) { print ''.$objp->tva_intra.''; - // Current account - print ''; + // Found accounts + print ''; $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index b6c220c347a..a747985096e 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -548,7 +548,7 @@ if ($result) { // VAT Num print ''.$objp->tva_intra.''; - // Current account + // Found accounts print ''; $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; From 009746ab79e5e9b1af99efc7def33ad70214bb9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 19:59:18 +0100 Subject: [PATCH 066/162] Invert seller and buyer --- htdocs/accountancy/supplier/list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index a747985096e..6f4ad18b283 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -411,6 +411,10 @@ if ($result) { $facturefourn_static = new FactureFournisseur($db); $product_static = new Product($db); + $isBuyerInEEC = isInEEC($mysoc); + + $accountingaccount_codetotid_cache = array(); + while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); @@ -440,7 +444,7 @@ if ($result) { $code_buy_p_notset = ''; $objp->aarowid_suggest = ''; // Will be set later - $isBuyerInEEC = isInEEC($objp); + $isSellerInEEC = isInEEC($objp); $suggestedaccountingaccountbydefaultfor = ''; if ($objp->type_l == 1) { From 25b62646b673ac8ee45bffe8382b37a3c0407b0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 20:26:28 +0100 Subject: [PATCH 067/162] Fix we must supplier codes --- htdocs/accountancy/supplier/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 6f4ad18b283..302c4410111 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -225,9 +225,9 @@ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; // Add search filter like From 56d6c4691f302103b8f9e2cd282f1ec2f4407f9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Mar 2020 21:06:36 +0100 Subject: [PATCH 068/162] FIX #13382 Note will be concat to private note --- htdocs/commande/card.php | 3 +++ htdocs/fourn/class/fournisseur.commande.class.php | 10 ++++++++-- htdocs/fourn/commande/card.php | 5 ++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7db4d3c9767..148fa427fff 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -117,6 +117,9 @@ if (!empty($conf->expedition->enabled) && $conf->global->WAREHOUSE_ASK_WAREHOUSE if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) $object->warehouse_id = $user->fk_warehouse; } +$error = 0; + + /* * Actions */ diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9197c14be5c..797e3693614 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1223,8 +1223,13 @@ class CommandeFournisseur extends CommonOrder { $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".self::STATUS_ORDERSENT.", fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."'"; - $sql .= " WHERE rowid = ".$this->id; + $newnoteprivate = $this->note_private; + if ($comment) $newnoteprivate = dol_concatdesc($newnoteprivate, $langs->trans("Comment").': '.$comment); + + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; + $sql .= " SET fk_statut=".self::STATUS_ORDERSENT.", fk_input_method=".$methode.", date_commande='".$this->db->idate($date)."', "; + $sql .= " note_private='".$this->db->escape($newnoteprivate)."'"; + $sql .= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::commande", LOG_DEBUG); if ($this->db->query($sql)) @@ -1232,6 +1237,7 @@ class CommandeFournisseur extends CommonOrder $this->statut = self::STATUS_ORDERSENT; $this->methode_commande_id = $methode; $this->date_commande = $date; + $this->context = array('comments' => $comment); // Call trigger $result = $this->call_trigger('ORDER_SUPPLIER_SUBMIT', $user); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 16cc619949f..c8706d1b22e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -62,7 +62,6 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); -$comclientid = GETPOST('comid', 'int'); $socid = GETPOST('socid', 'int'); $projectid = GETPOST('projectid', 'int'); $cancel = GETPOST('cancel', 'alpha'); @@ -917,7 +916,7 @@ if (empty($reshook)) // Force mandatory order method if ($action == 'commande') { - $methodecommande = GETPOST('methodecommande'); + $methodecommande = GETPOST('methodecommande', 'int'); if ($methodecommande <= 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("OrderMode")), null, 'errors'); @@ -927,7 +926,7 @@ if (empty($reshook)) if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) { - $result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']); + $result = $object->commande($user, GETPOST("datecommande"), GETPOST("methode", 'int'), GETPOST('comment', 'alphanohtml')); if ($result > 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) From d38c6616e6a8dddb902346109128d1982d1fc9b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 09:53:20 +0100 Subject: [PATCH 069/162] Doc --- htdocs/core/class/commonobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f5553032a09..c193ae977dc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4086,7 +4086,7 @@ abstract class CommonObject */ public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0, $defaulttpldir = '/core/tpl') { - global $conf, $hookmanager, $langs, $user, $object, $form, $extrafields; + global $conf, $hookmanager, $langs, $user, $form, $extrafields, $object; // TODO We should not use global var for this global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $outputalsopricetotalwithtax; @@ -4110,6 +4110,7 @@ abstract class CommonObject { // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer + // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { From fca6d45baa8b7a0158cfce6d20ed637915c37efa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 10:15:34 +0100 Subject: [PATCH 070/162] NEW Overwrite tpl with module_part['tpl'] is deprecated. USe hooks instead. --- htdocs/core/class/commonobject.class.php | 16 ++++++---------- htdocs/core/tpl/objectline_view.tpl.php | 3 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e35eb214769..e1246d8bc3f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4083,6 +4083,7 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer + // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook 'formAddObjectLine'. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { @@ -4216,7 +4217,7 @@ abstract class CommonObject * @param string $buyer Object of buyer third party * @param int $selected Object line selected * @param Extrafields $extrafields Object of extrafields - * @param string $defaulttpldir Directory where to find the template + * @param string $defaulttpldir Directory where to find the template (deprecated) * @return void */ public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafields = null, $defaulttpldir = '/core/tpl') @@ -4229,15 +4230,9 @@ abstract class CommonObject $element = $this->element; - $text = ''; $description = ''; $type = 0; + $text = ''; $description = ''; - // Show product and description - $type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type); - // Try to enhance type detection using date_start and date_end for free lines where type was not saved. - if (!empty($line->date_start)) $type = 1; // deprecated - if (!empty($line->date_end)) $type = 1; // deprecated - - // Ligne en mode visu + // Line in view mode if ($action != 'editline' || $selected != $line->id) { // Product @@ -4288,6 +4283,7 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer + // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook printObjectLine and printObjectSubLine. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { @@ -4313,12 +4309,12 @@ abstract class CommonObject if ($this->statut == 0 && $action == 'editline' && $selected == $line->id) { $label = (!empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : '')); - $placeholder = ' placeholder="'.$langs->trans("Label").'"'; $line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU'); // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer + // Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook printObjectLine and printObjectSubLine. $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 59f2e1ef57c..ee1d85e3b54 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -35,7 +35,7 @@ * $object_rights->creer initialized from = $object->getRights() * $disableedit, $disablemove, $disableremove * - * $type, $text, $description, $line + * $text, $description, $line */ // Protection to avoid direct call of template @@ -127,6 +127,7 @@ else } else { + $type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type); if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); From 8e1ffa51444b87368915aea3aed81599fa01198a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 10:52:07 +0100 Subject: [PATCH 071/162] Fix management of token --- htdocs/compta/accounting-files.php | 12 +++++++++--- htdocs/core/lib/functions.lib.php | 13 ++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index af18b834edf..cb2c3d2fdff 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -16,11 +16,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -/** + + /** * \file htdocs/compta/accounting-files.php * \ingroup compta * \brief Page to show portoflio and files of a thirdparty and download it */ + +if ($_GET['action'] == 'dl' || $_POST['action'] == 'dl') { // To not replace token when downloading file + if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); +} + require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -106,7 +112,7 @@ $error = 0; $filesarray = array(); $result = false; -if (($action == "searchfiles" || $action == "dl")) { +if (($action == 'searchfiles' || $action == 'dl')) { if (empty($date_start)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart")), null, 'errors'); @@ -459,7 +465,7 @@ if (!empty($date_start) && !empty($date_stop)) $param .= '&date_stopyear='.GETPOST('date_stopyear', 'int'); print '
'."\n"; - print ''; + print ''; echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9842a3d59e0..6976b5fec40 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8574,7 +8574,8 @@ function isAFileWithExecutableContent($filename) } /** - * Return new session token + * Return the value of token currently saved into session with name 'newtoken'. + * This token must be send by any POST as it will be used by next page for comparison with value in session. * * @return string */ @@ -8582,3 +8583,13 @@ function newToken() { return $_SESSION['newtoken']; } + +/** + * Return the value of token currently saved into session with name 'token'. + * + * @return string + */ +function currentToken() +{ + return $_SESSION['token']; +} From a6227aeb6a0b5f5265c11b01d982dc08b3df67c5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 19 Mar 2020 11:53:42 +0100 Subject: [PATCH 072/162] FIX: Load the translation file for extrafields --- htdocs/core/class/extrafields.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index a9b908203fe..b5ac448be5d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -848,7 +848,7 @@ class ExtraFields public function fetch_name_optionals_label($elementtype, $forceload = false) { // phpcs:enable - global $conf; + global $langs, $conf; if (empty($elementtype)) return array(); @@ -912,6 +912,11 @@ class ExtraFields $array_name_label[$tab->name] = $tab->label; } + if (! empty($tab->langs)) + { + $langs->load($tab->langs); + } + // Old usage $this->attribute_type[$tab->name] = $tab->type; $this->attribute_label[$tab->name] = $tab->label; @@ -1944,6 +1949,10 @@ class ExtraFields { $align = "right"; } + elseif ($type == 'price') + { + $align="right"; + } elseif ($type == 'double') { $align = "right"; From 7eb45226364630cfe01d14bc15f5f835ada90219 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 11:59:57 +0100 Subject: [PATCH 073/162] FIX missing token and save of survey description --- htdocs/admin/modules.php | 2 +- htdocs/core/lib/functions.lib.php | 3 ++- htdocs/opensurvey/card.php | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 21d54908cf1..72eb8240c10 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -930,7 +930,7 @@ if ($mode == 'marketplace') ?> - +
trans('Keyword') ?>:
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6976b5fec40..6e71125cbd5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -508,6 +508,7 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text. if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) { + $reg = array(); $maxloop = 20; $loopnb = 0; // Protection against infinite loop while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side. { @@ -5579,7 +5580,7 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1) $allowed_tags_string = '<'.$allowed_tags_string.'>'; if ($cleanalsosomestyles) { - $stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/', '', $stringtoclean); // Note: If hacker try to introduce css comment into string to avoid this, string should be encoded by the dol_htmlentitiesbr so be harmless + $stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/', '', $stringtoclean); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless } $temp = strip_tags($stringtoclean, $allowed_tags_string); diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 302ecf5f1ff..28b8f2a7640 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -113,8 +113,8 @@ if (empty($reshook)) if (!$error) { $object->titre = GETPOST('nouveautitre', 'nohtml'); - $object->commentaires = GETPOST('nouveauxcommentaires', 'nohtml'); - $object->description = GETPOST('nouveauxcommentaires', 'nohtml'); + $object->commentaires = GETPOST('nouveauxcommentaires', 'restricthtml'); + $object->description = GETPOST('nouveauxcommentaires', 'restricthtml'); $object->mail_admin = GETPOST('nouvelleadresse', 'alpha'); $object->date_fin = $expiredate; $object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? true : false; @@ -208,6 +208,7 @@ $toutsujet = str_replace("@", "
", $toutsujet); $toutsujet = str_replace("°", "'", $toutsujet); print ''."\n"; +print ''; print ''; $head = opensurvey_prepare_head($object); @@ -395,6 +396,7 @@ print '
'; print ''."\n"; +print ''; print load_fiche_titre($langs->trans("CommentsOfVoters"), '', ''); From 303961b0a6c3dfe649019bbb6d7fc21ed4e9c2c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 12:10:22 +0100 Subject: [PATCH 074/162] Fix trans --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a6800e2de7a..4658af376f1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -279,8 +279,8 @@ class Facture extends CommonInvoice 'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>105), 'close_note' =>array('type'=>'varchar(128)', 'label'=>'EarlyClosingComment', 'enabled'=>1, 'visible'=>-1, 'position'=>110), 'tva' =>array('type'=>'double(24,8)', 'label'=>'TotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1), - 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1), - 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1), + 'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LT1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1), + 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LT2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1), 'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1), 'total' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), From c71da5d0132a689314ebae38f13405116b563111 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 15:43:06 +0100 Subject: [PATCH 075/162] FIX mass action on stock movements --- htdocs/core/actions_massactions.inc.php | 2 + .../stock/class/mouvementstock.class.php | 13 +++ htdocs/product/stock/movement_list.php | 84 ++++++++++++------- 3 files changed, 70 insertions(+), 29 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index c3f046431b0..17e063244df 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1215,6 +1215,8 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permissio $db->rollback(); } } + + // Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before) if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permissiontodelete) { diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 9e8dcc3184e..7b92af43ef0 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -1134,4 +1134,17 @@ class MouvementStock extends CommonObject return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } } diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index dea7580aeb7..48806ce51b8 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -54,8 +54,11 @@ $ref = GETPOST('ref', 'alpha'); $msid = GETPOST('msid', 'int'); $product_id = GETPOST("product_id", 'int'); $action = GETPOST('action', 'aZ09'); +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'movementlist'; +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list // Security check //$result=restrictedArea($user, 'stock', $id, 'entrepot&stock'); @@ -123,15 +126,19 @@ if (!$user->rights->stock->mouvement->lire) { accessforbidden(); } +$permissiontoread = $user->rights->stock->mouvement->lire; +$permissiontoadd = $user->rights->stock->mouvement->creer; +$permissiontodelete = $user->rights->stock->mouvement->creer; // There is no deletion permission for stock movement as we shoul dnever delete + +$usercanread = $user->rights->stock->mouvement->lire; +$usercancreate = $user->rights->stock->mouvement->creer; +$usercandelete = $user->rights->stock->mouvement->creer; + /* * Actions */ -$usercanread = (($user->rights->stock->mouvement->lire)); -$usercancreate = (($user->rights->stock->mouvement->creer)); -$usercandelete = (($user->rights->stock->mouvement->supprimer)); - if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } @@ -139,26 +146,35 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - -// Do we click on purge search criteria ? -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers +if (empty($reshook)) { - $year = ''; - $month = ''; - $search_ref = ''; - $search_movement = ""; - $search_type_mouvement = ""; - $search_inventorycode = ""; - $search_product_ref = ""; - $search_product = ""; - $search_warehouse = ""; - $search_user = ""; - $search_batch = ""; - $search_qty = ''; - $sall = ""; - $toselect = ''; - $search_array_options = array(); + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Do we click on purge search criteria ? + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers + { + $year = ''; + $month = ''; + $search_ref = ''; + $search_movement = ""; + $search_type_mouvement = ""; + $search_inventorycode = ""; + $search_product_ref = ""; + $search_product = ""; + $search_warehouse = ""; + $search_user = ""; + $search_batch = ""; + $search_qty = ''; + $sall = ""; + $toselect = ''; + $search_array_options = array(); + } + + // Mass actions + $objectclass = 'MouvementStock'; + $objectlabel = 'MouvementStock'; + $uploaddir = $conf->stock->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } // Correct stock @@ -600,8 +616,8 @@ if ($resql) $resqlbis = $db->query($sql); if ($resqlbis) { - $obj = $db->fetch_object($resqlbis); - $lastmovementdate = $db->jdate($obj->datem); + $objbis = $db->fetch_object($resqlbis); + $lastmovementdate = $db->jdate($objbis->datem); } else { @@ -694,8 +710,9 @@ if ($resql) // 'presend'=>$langs->trans("SendByMail"), // 'builddoc'=>$langs->trans("PDFMerge"), ); - //if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); - if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); + // By default, we should never accept deletion of stock movement. + if (! empty($conf->global->STOCK_ALLOW_DELETE_OF_MOVEMENT) && $permissiontodelete) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); + if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); print ''; @@ -713,6 +730,13 @@ if ($resql) if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit); else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); + // Add code for pre mass action (confirmation or email presend form) + $topicmail = "SendStockMovement"; + $modelmail = "movementstock"; + $objecttmp = new MouvementStock($db); + $trackid = 'mov'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($sall) { foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); @@ -961,6 +985,8 @@ if ($resql) $arrayofuniqueproduct = array(); + $i = 0; + $totalarray = array(); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); @@ -1126,8 +1152,8 @@ if ($resql) if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) $selected = 1; - print ''; + if (in_array($objp->mid, $arrayofselected)) $selected = 1; + print ''; } print ''; if (!$i) $totalarray['nbfield']++; From 9be4b28bea0d5a836051482cad3fabf68770aabc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 15:43:55 +0100 Subject: [PATCH 076/162] FIX mass action on stock movements --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 97923801971..fea73254f20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ FIX: missing global $conf FIX: Missing token in some forms (avoid unset POST errors) FIX: params of setEventMessage($langs->trans('ErrorProductClone')... FIX: Remove unexisting link +FIX: mass action on stock movements FIX: substitute lines dates values on doc generator (ODT, ...) FIX: Ticket - Load Cache Messages Ticket, wrong message's status FIX: Ticket Public - Private messages are displayed From d9f616d6e3c0ce9cd5ba15d4031fd7b1b46f9ba7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 15:59:49 +0100 Subject: [PATCH 077/162] Avoid file xxx_preview-1.png into export --- htdocs/compta/accounting-files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index cb2c3d2fdff..4eb368e72df 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -241,7 +241,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { { $result = true; - $files = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); + $files = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', '', SORT_ASC, 1); //var_dump($upload_dir); //var_dump($files); From 03b261d54ca8fa2e3c9cea637676311ac7cf64e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 19:11:34 +0100 Subject: [PATCH 078/162] Provide information of thirdparty, contact or project to SMS handler --- htdocs/core/class/CSMSFile.class.php | 15 +++++++++++++++ htdocs/core/class/html.formsms.class.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index a02f00fbac9..7c1713b9453 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -47,6 +47,11 @@ class CSMSFile public $message; public $nostop; + public $socid; + public $contactid; + + public $fk_project; + /** * CSMSFile @@ -125,7 +130,12 @@ class CSMSFile $sms->class=$this->class; $sms->nostop=$this->nostop; + $sms->socid=$this->socid; + $sms->contactid=$this->contactid; + $sms->project=$this->fk_project; + $res=$sms->SmsSend(); + if ($res <= 0) { $this->error=$sms->error; @@ -155,7 +165,12 @@ class CSMSFile $sms->message=$this->message; $sms->nostop=$this->nostop; + $sms->socid=$this->socid; + $sms->contactid=$this->contactid; + $sms->fk_project=$this->fk_project; + $res=$sms->SmsSend(); + $this->error = $sms->error; $this->errors = $sms->errors; if ($res <= 0) diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index d16ec9efc94..deb61bc0be8 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -293,7 +293,7 @@ function limitChars(textarea, limit, infodiv) //var_dump($_REQUEST);exit; print $form->selectarray("receiver", $liste, GETPOST("receiver"), 1); } - print ' '.$langs->trans("SmsInfoNumero"); + print ' '.$langs->trans("SmsInfoNumero").''; } print "\n"; } From a413e2861e4f3bef054eb09fd8fdc4c55c6a4709 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 21:13:15 +0100 Subject: [PATCH 079/162] Fix edit html --- htdocs/compta/deplacement/card.php | 4 ++-- htdocs/opensurvey/card.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index cabc3510ea4..c08be32242b 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -281,7 +281,7 @@ if ($action == 'create') print ''.$langs->trans('NotePublic').''; print ''; - $doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); + $doleditor = new DolEditor('note_public', GETPOST('note_public', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); print ''; @@ -293,7 +293,7 @@ if ($action == 'create') print ''.$langs->trans('NotePrivate').''; print ''; - $doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); + $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%'); print $doleditor->Create(1); print ''; diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 28b8f2a7640..64b270799a2 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -249,12 +249,12 @@ print ''; print ''.$langs->trans("Description").''; if ($action == 'edit') { - $doleditor = new DolEditor('nouveauxcommentaires', dol_htmlentities($object->commentaires), '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); + $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); $doleditor->Create(0, ''); } else { - print (dol_textishtml($object->commentaires) ? $object->commentaires : dol_nl2br($object->commentaires, 1, true)); + print (dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)); } print ''; @@ -264,7 +264,7 @@ if (!$object->fk_user_creat) { print ''.$langs->trans("EMail").''; if ($action == 'edit') { - print ''; + print ''; } else print dol_print_email($object->mail_admin, 0, 0, 1); print ''; From 87e808fec4d5116f4b5561fbd060bf85160603cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Mar 2020 22:07:20 +0100 Subject: [PATCH 080/162] Fix phpcs --- htdocs/compta/accounting-files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 4eb368e72df..b8e10e7d0e3 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -24,7 +24,7 @@ */ if ($_GET['action'] == 'dl' || $_POST['action'] == 'dl') { // To not replace token when downloading file - if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); + if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); } require '../main.inc.php'; From 5ffc57f3f077a1f008d6d4dfcf97e94cd99e1bbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 10:05:08 +0100 Subject: [PATCH 081/162] Update extrafields.class.php --- htdocs/core/class/extrafields.class.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b5ac448be5d..94504686718 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -848,7 +848,7 @@ class ExtraFields public function fetch_name_optionals_label($elementtype, $forceload = false) { // phpcs:enable - global $langs, $conf; + global $conf; if (empty($elementtype)) return array(); @@ -912,11 +912,6 @@ class ExtraFields $array_name_label[$tab->name] = $tab->label; } - if (! empty($tab->langs)) - { - $langs->load($tab->langs); - } - // Old usage $this->attribute_type[$tab->name] = $tab->type; $this->attribute_label[$tab->name] = $tab->label; From aae0be492fba8c2f80bee4b4e498733f2af60f59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 10:28:47 +0100 Subject: [PATCH 082/162] Dolibarr logo in puce css --- htdocs/theme/eldy/main_menu_fa_icons.inc.php | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index dd76f09a54f..81a6aa3b4c5 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -142,3 +142,34 @@ div.mainmenu.generic3::before { div.mainmenu.generic4::before { content: "\f249"; } + + +/* Define square Dolibarr logo in pure CSS */ +.fa-dolibarr-css{ + color: #235481; + background: currentColor; + height: 150px; + width: 150px; + position: relative; +} +.fa-dolibarr-css:before{ + content: ''; + position: absolute; + left: 19%; + top: 17%; + width: 25%; + height: 25%; + border: solid 30px white; + border-radius: 0% 200% 200% 0% / 0% 180% 180% 0%; +} +.fa-dolibarr-css:after{ + content: ''; + position: absolute; + left: 19%; + top: 17%; + width: 5px; + height: 25%; + border-bottom: solid 60px currentColor; + margin-left: 30px; +} + From f7b4e48d599844a532a5ee8e8d1b9e3dfb99c7cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 10:51:26 +0100 Subject: [PATCH 083/162] Code comment --- build/makepack-dolibarr.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index f68ca6a77f5..c6b8cd330c8 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -2,7 +2,7 @@ #---------------------------------------------------------------------------- # \file build/makepack-dolibarr.pl # \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps) -# \author (c)2004-2015 Laurent Destailleur +# \author (c)2004-2020 Laurent Destailleur # # This is list of constant you can set to have generated packages moved into a specific dir: #DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild' @@ -430,12 +430,14 @@ if ($nboftargetok) { $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; print 'Run git push -f --tags'."\n"; $ret=`git push -f --tags`; + #$ret=`git push -f origin "$MAJOR.$MINOR.$BUILD"`; } } else { print 'Run git push --tags'."\n"; $ret=`git push --tags`; + #$ret=`git push origin "$MAJOR.$MINOR.$BUILD"`; } chdir("$olddir"); } From e61222504af44c1f119cfc76bdb44c2d9ad20975 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 11:49:00 +0100 Subject: [PATCH 084/162] Look and feel --- htdocs/admin/emailcollector_card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 392e1a9e147..d4415c6c1b6 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -483,7 +483,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Filters - print ''; + print '
'; print ''; print ''; print ''; @@ -562,7 +562,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '

'; // Operations - print '
'.$langs->trans("Filters").'
'; + print '
'; print ''; print ''; print ''; From 4e007fe94c3aa1e57d2e99909355f91ad4923957 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 15:12:50 +0100 Subject: [PATCH 085/162] Import jommla news --- htdocs/admin/system/perf.php | 8 ++-- .../website/migrate_news_joomla2dolibarr.php | 40 ++++++++++++------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 3dae3c91f9d..42c66281450 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -53,10 +53,10 @@ print $langs->trans("YouMayFindPerfAdviceHere", 'https://wiki.dolibarr.org/index // Recupere la version de PHP $phpversion=version_php(); -print "
PHP - ".$langs->trans("Version").": ".$phpversion."
\n"; +print "
PHP - ".$langs->trans("Version").": ".$phpversion."
\n"; // Recupere la version du serveur web -print "
Web server - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."
\n"; +print "
Web server - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."
\n"; // XDebug print '
'; @@ -65,8 +65,8 @@ $test=!function_exists('xdebug_is_enabled'); if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); else { - print img_picto('', 'warning').' '.$langs->trans("XDebugInstalled"); - print ' '.$langs->trans("MoreInformation").' XDebug admin page'; + print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug")); + print ' - '.$langs->trans("MoreInformation").' XDebug admin page'; } print '
'; diff --git a/scripts/website/migrate_news_joomla2dolibarr.php b/scripts/website/migrate_news_joomla2dolibarr.php index 609ae59f128..4c8b7c462fb 100755 --- a/scripts/website/migrate_news_joomla2dolibarr.php +++ b/scripts/website/migrate_news_joomla2dolibarr.php @@ -37,15 +37,16 @@ define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); // Set this define to 0 if you want to $error = 0; -$mode = $argv[1]; -$websiteref = $argv[2]; -$joomlaserverinfo = $argv[3]; +$mode = empty($argv[1])?'':$argv[1]; +$websiteref = empty($argv[2])?'':$argv[2]; +$joomlaserverinfo = empty($argv[3])?'':$argv[3]; $image = 'image/__WEBSITE_KEY__/images/stories/dolibarr.png'; -$max = 1; +$max = empty($argv[4])?'10':$argv[4]; if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) { - print "Usage: $script_file (test|confirm) website login:pass@serverjoomla/tableprefix/databasejoomla\n"; + print '***** '.$script_file.' *****'."\n"; + print "Usage: $script_file (test|confirm) website login:pass@serverjoomla/tableprefix/databasejoomla [nbmaxrecord]\n"; print "\n"; print "Load joomla news and create them into Dolibarr database (if they don't alreay exist).\n"; exit(-1); @@ -94,8 +95,8 @@ if (! $resql) { $db->begin(); +$i = 0; while ($obj = $dbjoomla->fetch_object($resql)) { - $i = 0; if ($obj) { $i++; $id = $obj->id; @@ -104,37 +105,48 @@ while ($obj = $dbjoomla->fetch_object($resql)) { //$description = dol_string_nohtmltag($obj->introtext); $description = trim(dol_trunc(dol_string_nohtmltag($obj->metadesc), 250)); if (empty($description)) $description = trim(dol_trunc(dol_string_nohtmltag($obj->introtext), 250)); - $hmtltext = $obj->introtext.'
'."\n".'
'."\n".'
'."\n".$obj->fulltext; + $htmltext = '
'."\n"; + $htmltext .= $obj->introtext; + if ($obj->fulltext) { + $htmltext .= '
'."\n".'
'."\n".'
'."\n".$obj->fulltext; + } + $htmltext .= "\n
"; $language = ($obj->language && $obj->language != '*' ? $obj->language : 'en'); $keywords = $obj->metakey; $author_alias = $obj->username; $date_creation = $dbjoomla->jdate($obj->publish_up); - print $i.' '.$id.' '.$title.' '.$language.' '.$keywords.' '.$importid."\n"; + print '#'.$i.' id='.$id.' '.$title.' lang='.$language.' keywords='.$keywords.' importid='.$importid."\n"; $sqlinsert = 'INSERT INTO '.MAIN_DB_PREFIX.'website_page(fk_website, pageurl, aliasalt, title, description, keywords, content, status, type_container, lang, import_key, image, date_creation, author_alias)'; $sqlinsert .= " VALUES(".$websiteid.", '".$db->escape($alias)."', '', '".$db->escape($title)."', '".$db->escape($description)."', '".$db->escape($keywords)."', "; - $sqlinsert .= " '".$db->escape($hmtltext)."', '1', 'blogpost', '".$db->escape($language)."', '".$db->escape($importid)."', '".$db->escape($image)."', '".$db->idate($date_creation)."', '".$db->escape($author_alias)."')"; + $sqlinsert .= " '".$db->escape($htmltext)."', '1', 'blogpost', '".$db->escape($language)."', '".$db->escape($importid)."', '".$db->escape($image)."', '".$db->idate($date_creation)."', '".$db->escape($author_alias)."')"; print $sqlinsert."\n"; $result = $db->query($sqlinsert); if ($result <= 0) { - $error++; - print 'Error, '.$db->lasterror.": ".$sqlinsert."\n"; - break; + print 'ERROR: '.$db->lasterrno.": ".$sqlinsert."\n"; + if ($db->lasterrno != 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $error++; + } + } else { + $pageid = $db->last_insert_id(MAIN_DB_PREFIX.'website_page'); + print "Insert done - pageid = ".$pageid."\n"; } - if ($max && $i <= $max) { - print 'Nb max of record reached. We stop now.'."\n"; + if ($max && $i >= $max) { + print 'Nb max of record ('.$max.') reached. We stop now.'."\n"; break; } } } if ($mode == 'confirm' && ! $error) { + print "Commit\n"; $db->commit(); } else { + print "Rollback\n"; $db->rollback(); } From ac5d2fedc5da8a62319183e2671bfed2cc89bd48 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 20 Mar 2020 15:40:46 +0100 Subject: [PATCH 086/162] NEW add category type from hook --- htdocs/categories/class/categorie.class.php | 42 +++++++++++++++++++ htdocs/categories/index.php | 23 +++------- htdocs/categories/photos.php | 30 ++++++------- htdocs/categories/traduction.php | 25 +++++------ htdocs/categories/viewcat.php | 9 ++-- .../install/mysql/migration/11.0.0-12.0.0.sql | 1 + 6 files changed, 82 insertions(+), 48 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index e8296b96beb..2e8afdb0089 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -243,7 +243,49 @@ class Categorie extends CommonObject */ public function __construct($db) { + global $hookmanager; + $this->db = $db; + + if (is_object($hookmanager)) { + $hookmanager->initHooks(array('category')); + $parameters = array(); + $reshook = $hookmanager->executeHooks('constructCategory', $parameters, $this); // Note that $action and $object may have been modified by some hooks + if ($reshook >= 0 && !empty($hookmanager->resArray)) { + $mapList = $hookmanager->resArray; + $mapId = $mapList['id']; + $mapCode = $mapList['code']; + self::$MAP_ID_TO_CODE[$mapId] = $mapCode; + $this->MAP_ID[$mapCode] = $mapId; + $this->MAP_CAT_FK[$mapCode] = $mapList['cat_fk']; + $this->MAP_CAT_TABLE[$mapCode] = $mapList['cat_table']; + $this->MAP_OBJ_CLASS[$mapCode] = $mapList['obj_class']; + $this->MAP_OBJ_TABLE[$mapCode] = $mapList['obj_table']; + } + } + } + + /** + * Get map list + * + * @return array + */ + public function getMapList() + { + $mapList = array(); + + foreach ($this->MAP_ID as $mapCode => $mapId) { + $mapList[] = array( + 'id' => $mapId, + 'code' => $mapCode, + 'cat_fk' => $this->MAP_CAT_FK[$mapCode], + 'cat_table' => $this->MAP_CAT_TABLE[$mapCode], + 'obj_class' => $this->MAP_OBJ_CLASS[$mapCode], + 'obj_table' => $this->MAP_OBJ_TABLE[$mapCode] + ); + } + + return $mapList; } /** diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index d96fddca150..54a4ff9f1d2 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -40,6 +40,7 @@ $id = GETPOST('id', 'int'); $type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT); $catname = GETPOST('catname', 'alpha'); +$categstatic = new Categorie($db); if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility @@ -47,25 +48,13 @@ if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backwar * View */ -$categstatic = new Categorie($db); $form = new Form($db); -if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; } -elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; } -elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; } -elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; } -elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; } -elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='bank_account'; } -elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } -elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } -elseif ($type == Categorie::TYPE_WAREHOUSE) { $title=$langs->trans("StocksCategoriesArea"); $typetext='warehouse'; } -elseif ($type == Categorie::TYPE_ACTIONCOMM) { - $title = $langs->trans("ActionCommCategoriesArea"); - $typetext = 'actioncomm'; -} else { - $title = $langs->trans("CategoriesArea"); - $typetext = 'unknown'; -} +$typetext = $type; +if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea'); +elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea'); +elseif ($type == Categorie::TYPE_ACTIONCOMM) $title = $langs->trans('ActionCommCategoriesArea'); +else $title = $langs->trans(ucfirst($type). 'sCategoriesArea'); $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index ed6091e3568..b9fd23c1a3d 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -36,15 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; $langs->loadlangs(array('categories', 'bills')); -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref'); -$type = GETPOST('type'); -$action = GETPOST('action', 'aZ09'); +$id = GETPOST('id', 'int'); +$label = GETPOST('label', 'alpha'); +$type = GETPOST('type'); +$action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm'); -if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility - -if ($id == "") +if ($id == '' && $label == '') { dol_print_error('', 'Missing parameter id'); exit(); @@ -54,13 +52,17 @@ if ($id == "") $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); -if ($id > 0) -{ - $result = $object->fetch($id); - - $upload_dir = $conf->categorie->multidir_output[$object->entity]; +$result = $object->fetch($id, $label, $type); +if ($result <= 0) { + dol_print_error($db, $object->error); exit; } +$object->fetch_optionals(); +if ($result <= 0) { + dol_print_error($db, $object->error); exit; +} +$upload_dir = $conf->categorie->multidir_output[$object->entity]; +if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility /* * Actions @@ -126,7 +128,7 @@ if ($object->id) dol_fiche_head($head, 'photos', $title, -1, 'category'); $linkback = ''.$langs->trans("BackToList").''; - + $object->next_prev_filter = ' type = ' . $object->type; $object->ref = $object->label; $morehtmlref='
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); @@ -136,7 +138,7 @@ if ($object->id) } $morehtmlref.='
'; - dol_banner_tab($object, 'ref', $linkback, ($user->socid?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); + dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1); /* * Confirmation de la suppression de photo diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 03ca6e977bd..697db116881 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -36,18 +36,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->loadLangs(array('categories', 'languages')); $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$label = GETPOST('label', 'alpha'); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $type = GETPOST('type', 'aZ09'); -if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility - -// Security check -$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); -$fieldtype = (!empty($ref) ? 'ref' : 'rowid'); - -if ($id == "") +if ($id == '' && $label == '') { dol_print_error('', 'Missing parameter id'); exit(); @@ -57,7 +51,16 @@ if ($id == "") $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); +$result = $object->fetch($id, $label, $type); +if ($result <= 0) { + dol_print_error($db, $object->error); exit; +} +$object->fetch_optionals(); +if ($result <= 0) { + dol_print_error($db, $object->error); exit; +} +if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility /* * Actions @@ -159,8 +162,6 @@ $cancel != $langs->trans("Cancel") && } } -$result = $object->fetch($id, $ref); - /* * View @@ -197,7 +198,7 @@ if (!empty($object->multilangs)) dol_fiche_head($head, 'translation', $title, -1, 'category'); $linkback = ''.$langs->trans("BackToList").''; - +$object->next_prev_filter = ' type = ' . $object->type; $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); @@ -207,7 +208,7 @@ foreach ($ways as $way) } $morehtmlref .= '
'; -dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); +dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1); print '
'; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 62538da0273..727ef8b0610 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -71,7 +71,7 @@ if ($id == "" && $label == "") $result = restrictedArea($user, 'categorie', $id, '&category'); $object = new Categorie($db); -$result = $object->fetch($id, $label); +$result = $object->fetch($id, $label, $type); if ($result <= 0) { dol_print_error($db, $object->error); exit; } @@ -80,7 +80,6 @@ if ($result <= 0) { dol_print_error($db, $object->error); exit; } -$type = $object->type; if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility $extrafields = new ExtraFields($db); @@ -222,8 +221,8 @@ $head = categories_prepare_head($object, $type); dol_fiche_head($head, 'card', $title, -1, 'category'); $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); -$linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter=" type = ".$object->type; +$linkback = ''.$langs->trans("BackToList").''; +$object->next_prev_filter = ' type = ' . $object->type; $object->ref = $object->label; $morehtmlref='
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); @@ -233,7 +232,7 @@ foreach ($ways as $way) } $morehtmlref.='
'; -dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1); +dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1); /* diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index b2d0b9b0bd1..aef9692bf75 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -198,3 +198,4 @@ ALTER TABLE llx_entrepot ADD COLUMN phone varchar(20) DEFAULT NULL AFTER fk_pays ALTER TABLE llx_accounting_account ADD COLUMN reconcilable tinyint DEFAULT 0 NOT NULL after active; +ALTER TABLE llx_categorie CHANGE type type integer NOT NULL DEFAULT '1'; From 43763771a66d2b6a40e2233c8252c9ba5afaf868 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 15:47:50 +0100 Subject: [PATCH 087/162] FIX Backto link --- htdocs/website/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 2613d506c0b..d514f3f9294 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3495,6 +3495,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print '
'; print ''; print ''; if ($newkey == 'separator') @@ -233,17 +233,17 @@ if ($resql) $i = 0; while ($i < $num) - { - $obj = $db->fetch_object($resql); + { + $obj = $db->fetch_object($resql); - print ''; - print ''."\n"; - print ''."\n"; - if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled - print "\n"; + print ''; + print ''."\n"; + print ''."\n"; + if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled + print "\n"; - $i++; - } + $i++; + } } print '
'.$langs->trans("EmailcollectorOperations").'
'.$answerrecord->description.''; $param = '?action=replacesiteconfirm'; + $param .= '&websiteid='.$website->id; $param .= '&optioncontent='.GETPOST('optioncontent'); $param .= '&optionmeta='.GETPOST('optionmeta'); $param .= '&optionsitefiles='.GETPOST('optionsitefiles'); From d28eaf5824df48d59da0f14c162ec2e39c58c93f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 15:47:50 +0100 Subject: [PATCH 088/162] FIX Backto link --- htdocs/website/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ac255693b0d..88a369efdf2 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3397,6 +3397,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print ''.$answerrecord->description.''; $param = '?action=replacesiteconfirm'; + $param .= '&websiteid='.$website->id; $param .= '&optioncontent='.GETPOST('optioncontent'); $param .= '&optionmeta='.GETPOST('optionmeta'); $param .= '&optionsitefiles='.GETPOST('optionsitefiles'); From aa1f60152898f4119366272ae3997579aa7f400a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 16:30:45 +0100 Subject: [PATCH 089/162] FIX Backto link --- htdocs/core/lib/website.lib.php | 1 - htdocs/core/lib/website2.lib.php | 1 + htdocs/website/index.php | 12 +++++++++++- .../website/migrate_news_joomla2dolibarr.php | 19 ++++++++++++++++++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index bd46b975120..22c26b10b9b 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -21,7 +21,6 @@ * \brief Library for website module */ - /** * Remove PHP code part from a string. * diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 89df263b026..e8c7e7006e3 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -113,6 +113,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) // Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header) dol_syslog("We regenerate the tpl page filetpl=".$filetpl); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_delete_file($filetpl); $shortlangcode = ''; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index d514f3f9294..0ce0e2f1bbd 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3642,10 +3642,20 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa // If mode WEBSITE_SUBCONTAINERSINLINE is on if (!empty($conf->global->WEBSITE_SUBCONTAINERSINLINE)) { + // TODO Check file $filephp exists, if not create it. + //var_dump($filetpl); $filephp = $filetpl; ob_start(); - include $filephp; + try { + $res = include $filephp; + if (empty($res)) { + print "ERROR: Failed to include file '".$filephp."'. Try to edit and save page."; + } + } catch(Exception $e) + { + print $e->getMessage(); + } $newcontent = ob_get_contents(); ob_end_clean(); } diff --git a/scripts/website/migrate_news_joomla2dolibarr.php b/scripts/website/migrate_news_joomla2dolibarr.php index 4c8b7c462fb..46721446d3b 100755 --- a/scripts/website/migrate_news_joomla2dolibarr.php +++ b/scripts/website/migrate_news_joomla2dolibarr.php @@ -54,6 +54,8 @@ if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($w require $path."../../htdocs/master.inc.php"; include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; +include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php'; $langs->load('main'); @@ -95,7 +97,7 @@ if (! $resql) { $db->begin(); -$i = 0; +$i = 0; $nbimported = 0; $nbalreadyexists = 0; while ($obj = $dbjoomla->fetch_object($resql)) { if ($obj) { $i++; @@ -129,10 +131,23 @@ while ($obj = $dbjoomla->fetch_object($resql)) { print 'ERROR: '.$db->lasterrno.": ".$sqlinsert."\n"; if ($db->lasterrno != 'DB_ERROR_RECORD_ALREADY_EXISTS') { $error++; + } else { + $nbalreadyexists++; } } else { $pageid = $db->last_insert_id(MAIN_DB_PREFIX.'website_page'); + + if ($pageid > 0) { // We must also regenerate page on disk + global $dolibarr_main_data_root; + $pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteref; + $filetpl = $pathofwebsite.'/page'.$pageid.'.tpl.php'; + $websitepage = new WebsitePage($db); + $websitepage->fetch($pageid); + dolSavePageContent($filetpl, $website, $websitepage); + } + print "Insert done - pageid = ".$pageid."\n"; + $nbimported++; } if ($max && $i >= $max) { @@ -144,6 +159,8 @@ while ($obj = $dbjoomla->fetch_object($resql)) { if ($mode == 'confirm' && ! $error) { print "Commit\n"; + print $nbalreadyexists." page(s) already exists.\n"; + print $nbimported." page(s) imported with importid=".$importid."\n"; $db->commit(); } else { print "Rollback\n"; From f904ff5240783fbf555fd59903dc71a11333b824 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 17:10:35 +0100 Subject: [PATCH 090/162] Add dol_escape_json method --- htdocs/core/lib/functions.lib.php | 10 ++++++++ htdocs/core/lib/website.lib.php | 40 ++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9c7d64a6494..35462fcb2d9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -984,6 +984,16 @@ function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0) return strtr($stringtoescape, $substitjs); } +/** + * Returns text escaped for inclusion into javascript code + * + * @param string $stringtoescape String to escape + * @return string Escaped string for json content. + */ +function dol_escape_json($stringtoescape) +{ + return str_replace('"', '\"', $stringtoescape); +} /** * Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields. diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 22c26b10b9b..0d51f779afc 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -544,8 +544,8 @@ function getStructuredData($type, $data = array()) $ret .= '{ "@context": "https://schema.org", "@type": "SoftwareApplication", - "name": "'.$data['name'].'", - "operatingSystem": "'.$data['os'].'", + "name": "'.dol_escape_json($data['name']).'", + "operatingSystem": "'.dol_escape_json($data['os']).'", "applicationCategory": "https://schema.org/GameApplication", "aggregateRating": { "@type": "AggregateRating", @@ -570,6 +570,18 @@ function getStructuredData($type, $data = array()) if ($restmpuser > 0) { + $pageurl = $websitepage->pageurl; + $title = $websitepage->title; + $image = $websitepage->image; + $companyname = $mysoc->name; + $description = $websitepage->description; + + $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl); + $title = str_replace('__WEBSITE_KEY__', $website->ref, $title); + $image = str_replace('__WEBSITE_KEY__', $website->ref, $image); + $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname); + $description = str_replace('__WEBSITE_KEY__', $website->ref, $description); + $ret = ''."\n"; $ret .= ''."\n"; } @@ -610,19 +622,19 @@ function getStructuredData($type, $data = array()) $ret .= '{ "@context": "https://schema.org/", "@type": "Product", - "name": "'.$data['label'].'", + "name": "'.dol_escape_json($data['label']).'", "image": [ - "'.$data['image'].'", + "'.dol_escape_json($data['image']).'", ], - "description": "'.$data['description'].'", - "sku": "'.$data['ref'].'", + "description": "'.dol_escape_json($data['description']).'", + "sku": "'.dol_escape_json($data['ref']).'", "brand": { "@type": "Thing", - "name": "'.$data['brand'].'" + "name": "'.dol_escape_json($data['brand']).'" }, "author": { "@type": "Person", - "name": "'.$data['author'].'" + "name": "'.dol_escape_json($data['author']).'" } }, "offers": { @@ -634,7 +646,7 @@ function getStructuredData($type, $data = array()) "availability": "https://schema.org/InStock", "seller": { "@type": "Organization", - "name": "'.$mysoc->name.'" + "name": "'.dol_escape_json($mysoc->name).'" } } }'."\n"; From a2f9f72973d4438bc922f226814feaeb8fb4102d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 18:58:45 +0100 Subject: [PATCH 091/162] Enhance website module --- htdocs/core/lib/website.lib.php | 91 +++++++++---------- scripts/website/blogpost-footer.txt | 2 + scripts/website/blogpost-header.txt | 4 + .../website/migrate_news_joomla2dolibarr.php | 22 ++++- 4 files changed, 70 insertions(+), 49 deletions(-) create mode 100644 scripts/website/blogpost-footer.txt create mode 100644 scripts/website/blogpost-header.txt diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 0d51f779afc..095ffde1234 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -562,57 +562,54 @@ function getStructuredData($type, $data = array()) } elseif ($type == 'blogpost') { - if ($websitepage->fk_user_creat > 0) + if (! empty($websitepage->author_alias)) { - include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; - $tmpuser = new User($db); - $restmpuser = $tmpuser->fetch($websitepage->fk_user_creat); + //include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + //$tmpuser = new User($db); + //$restmpuser = $tmpuser->fetch($websitepage->fk_user_creat); - if ($restmpuser > 0) - { - $pageurl = $websitepage->pageurl; - $title = $websitepage->title; - $image = $websitepage->image; - $companyname = $mysoc->name; - $description = $websitepage->description; + $pageurl = $websitepage->pageurl; + $title = $websitepage->title; + $image = $websitepage->image; + $companyname = $mysoc->name; + $description = $websitepage->description; - $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl); - $title = str_replace('__WEBSITE_KEY__', $website->ref, $title); - $image = str_replace('__WEBSITE_KEY__', $website->ref, $image); - $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname); - $description = str_replace('__WEBSITE_KEY__', $website->ref, $description); + $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl); + $title = str_replace('__WEBSITE_KEY__', $website->ref, $title); + $image = str_replace('__WEBSITE_KEY__', $website->ref, $image); + $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname); + $description = str_replace('__WEBSITE_KEY__', $website->ref, $description); - $ret = ''."\n"; - $ret .= ''."\n"; - } + $ret = ''."\n"; + $ret .= ''."\n"; } } elseif ($type == 'product') diff --git a/scripts/website/blogpost-footer.txt b/scripts/website/blogpost-footer.txt new file mode 100644 index 00000000000..e79ea4f6a4a --- /dev/null +++ b/scripts/website/blogpost-footer.txt @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/scripts/website/blogpost-header.txt b/scripts/website/blogpost-header.txt new file mode 100644 index 00000000000..5c414286e77 --- /dev/null +++ b/scripts/website/blogpost-header.txt @@ -0,0 +1,4 @@ + +

title ?>

+ + \ No newline at end of file diff --git a/scripts/website/migrate_news_joomla2dolibarr.php b/scripts/website/migrate_news_joomla2dolibarr.php index 46721446d3b..ded2e6f1903 100755 --- a/scripts/website/migrate_news_joomla2dolibarr.php +++ b/scripts/website/migrate_news_joomla2dolibarr.php @@ -42,7 +42,7 @@ $websiteref = empty($argv[2])?'':$argv[2]; $joomlaserverinfo = empty($argv[3])?'':$argv[3]; $image = 'image/__WEBSITE_KEY__/images/stories/dolibarr.png'; -$max = empty($argv[4])?'10':$argv[4]; +$max = (empty($argv[4]) && $argv[4] !== '0')?'10':$argv[4]; if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) { print '***** '.$script_file.' *****'."\n"; @@ -95,6 +95,19 @@ if (! $resql) { exit; } +$blogpostheader = file_get_contents($path.'blogpost-header.txt'); +if ($blogpostheader === false) { + print "Error: Failed to load file content of 'blogpost-header.txt'\n"; + exit(-1); +} +$blogpostfooter = file_get_contents($path.'blogpost-footer.txt'); +if ($blogpostfooter === false) { + print "Error: Failed to load file content of 'blogpost-footer.txt'\n"; + exit(-1); +} + + + $db->begin(); $i = 0; $nbimported = 0; $nbalreadyexists = 0; @@ -107,12 +120,17 @@ while ($obj = $dbjoomla->fetch_object($resql)) { //$description = dol_string_nohtmltag($obj->introtext); $description = trim(dol_trunc(dol_string_nohtmltag($obj->metadesc), 250)); if (empty($description)) $description = trim(dol_trunc(dol_string_nohtmltag($obj->introtext), 250)); - $htmltext = '
'."\n"; + + $htmltext = ""; + if ($blogpostheader) $htmltext .= $blogpostheader."\n"; + $htmltext .= '
'."\n"; $htmltext .= $obj->introtext; if ($obj->fulltext) { $htmltext .= '
'."\n".'
'."\n".'
'."\n".$obj->fulltext; } $htmltext .= "\n
"; + if ($blogpostfooter) $htmltext .= "\n".$blogpostfooter; + $language = ($obj->language && $obj->language != '*' ? $obj->language : 'en'); $keywords = $obj->metakey; $author_alias = $obj->username; From 27015fc6f6bd96506a9c7626dd85e020cfe511fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 19:34:49 +0100 Subject: [PATCH 092/162] NEW Add method to add social network sharing buttons on blog posts --- htdocs/core/lib/website.lib.php | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 095ffde1234..08453c6bcb8 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -652,6 +652,57 @@ function getStructuredData($type, $data = array()) return $ret; } +/** + * Return HTML content to add structured data for an article, news or Blog Post. + * + * @return string HTML content + */ +function getSocialNetworkSharingLinks() +{ + global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers. + + $fullurl = $website->alias.'/'.$websitepage->pageurl.'.php'; + $hashtags = trim(join(' #', array_map('trim', explode(',', $websitepage->keywords)))); + + print ''."\n"; + print '\n"; + print ''."\n"; +} + /** * Return list of containers object that match a criteria. * WARNING: This function can be used by websites. From 68cadb58bb5d9a2f8a92d84010c84b92d38c7d2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 20:36:26 +0100 Subject: [PATCH 093/162] Fix better default sort order --- htdocs/comm/mailing/cibles.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 9babe88fd0b..d8d9873b88b 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -48,8 +48,8 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortfield) $sortfield = "email"; -if (!$sortorder) $sortorder = "ASC"; +if (!$sortfield) $sortfield = "mc.statut,email"; +if (!$sortorder) $sortorder = "DESC,ASC"; $id = GETPOST('id', 'int'); $rowid = GETPOST('rowid', 'int'); From 5d9e713a1c6a52e31fdd67ad1f74ff6e22d6c1de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 20:36:26 +0100 Subject: [PATCH 094/162] Fix better default sort order --- htdocs/comm/mailing/cibles.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 41e49ed09b3..b9f6396578e 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -48,8 +48,8 @@ if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortfield) $sortfield = "email"; -if (!$sortorder) $sortorder = "ASC"; +if (!$sortfield) $sortfield = "mc.statut,email"; +if (!$sortorder) $sortorder = "DESC,ASC"; $id = GETPOST('id', 'int'); $rowid = GETPOST('rowid', 'int'); From 599bf89f60e2a28973ac86926fa12d8d78068f77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 20:46:21 +0100 Subject: [PATCH 095/162] Fix can edit emailing after sending has started --- htdocs/comm/mailing/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 0900c5b032c..a21ea9d7d0a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -992,7 +992,7 @@ else print ''.$langs->trans("SetToDraft").''; } - if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer) + if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer) { if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { From 588692760afb4fd5456aa891220cb0e649e41ae7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 21:16:52 +0100 Subject: [PATCH 096/162] FIX Look and feel v11 --- htdocs/opensurvey/fonctions.php | 69 +++++++++++++++++++----- htdocs/opensurvey/results.php | 2 +- htdocs/opensurvey/wizard/choix_autre.php | 2 +- htdocs/public/opensurvey/studs.php | 7 ++- 4 files changed, 60 insertions(+), 20 deletions(-) diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 69dd0d4e0a7..22cd78ae8d7 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -67,31 +67,70 @@ function opensurvey_prepare_head(Opensurveysondage $object) * @param int $disablehead More content into html header * @param array $arrayofjs Array of complementary js files * @param array $arrayofcss Array of complementary css files + * @param string $numsondage Num survey * @return void */ -function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') +function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $numsondage = '') { - global $conf, $mysoc; + global $conf, $langs, $mysoc; + global $dolibarr_main_url_root; + + //$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers - print ''; + print ''; - // Print logo - if ($mysoc->logo) { - if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); - } - } - if (!$urllogo && (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))) + + print ''."\n"; + print '
'."\n"; + print ''."\n"; + print ''; + print ''."\n"; + print "\n"; + + + // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) + $width = 0; + // Define logo and logosmall + $logosmall = $mysoc->logo_small; + $logo = $mysoc->logo; + $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; + if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo; + elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall = $conf->global->ONLINE_PAYMENT_LOGO; + //print ''."\n"; + // Define urllogo + $urllogo = ''; + $urllogofull = ''; + if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $width = 150; + } + elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) + { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $width = 150; } - print '
Logo
'; - print '
'; + // Output html code for logo + if ($urllogo) + { + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; + } - print '
'; + print '

'; } /** @@ -102,6 +141,8 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ function llxFooterSurvey() { print '
'; + print ''; + print '
'; printCommonFooter('public'); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index a9b726a646b..beed90e3fdd 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -1093,6 +1093,6 @@ print ''."\n"; print ''."\n"; -llxFooterSurvey(); +llxFooter(); $db->close(); diff --git a/htdocs/opensurvey/wizard/choix_autre.php b/htdocs/opensurvey/wizard/choix_autre.php index cb3ed346a52..7a31e21c843 100644 --- a/htdocs/opensurvey/wizard/choix_autre.php +++ b/htdocs/opensurvey/wizard/choix_autre.php @@ -110,7 +110,7 @@ llxHeader('', $langs->trans("OpenSurvey"), "", '', 0, 0, $arrayofjs, $arrayofcss if (empty($_SESSION['titre'])) { dol_print_error('', $langs->trans('ErrorOpenSurveyFillFirstSection')); - llxFooterSurvey(); + llxFooter(); exit; } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index ab011dd219a..c9697e2e1e4 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -250,7 +250,8 @@ $form = new Form($db); $arrayofjs = array(); $arrayofcss = array('/opensurvey/css/style.css'); -llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); + +llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss, $numsondage); if (empty($object->ref)) // For survey, id is a hex string { @@ -274,6 +275,7 @@ foreach ($toutsujet as $value) $toutsujet = str_replace("°", "'", $toutsujet); + print '
'.$langs->trans("YouAreInivitedToVote").'
'; print $langs->trans("OpenSurveyHowTo").'

'; @@ -301,9 +303,6 @@ if (!$canbemodified) { exit; } -print '
'."\n"; -print ''; - print '
'."\n"; print '

'."\n"; From 640ee5277c4f0baf511a7cedd06116a714bed2f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 21:19:43 +0100 Subject: [PATCH 097/162] FIX Look and feel v11 --- htdocs/opensurvey/fonctions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 22cd78ae8d7..eb1a20800ce 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -130,7 +130,7 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; } - print '

'; + print '

'; } /** From 3e807b00ba9dd3e998176b85b10f5bbe81bf2f87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 21:16:52 +0100 Subject: [PATCH 098/162] FIX Look and feel v11 --- htdocs/opensurvey/fonctions.php | 69 +++++++++++++++++++----- htdocs/opensurvey/results.php | 2 +- htdocs/opensurvey/wizard/choix_autre.php | 2 +- htdocs/public/opensurvey/studs.php | 7 ++- 4 files changed, 60 insertions(+), 20 deletions(-) diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 69dd0d4e0a7..22cd78ae8d7 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -67,31 +67,70 @@ function opensurvey_prepare_head(Opensurveysondage $object) * @param int $disablehead More content into html header * @param array $arrayofjs Array of complementary js files * @param array $arrayofcss Array of complementary css files + * @param string $numsondage Num survey * @return void */ -function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') +function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $numsondage = '') { - global $conf, $mysoc; + global $conf, $langs, $mysoc; + global $dolibarr_main_url_root; + + //$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers - print ''; + print ''; - // Print logo - if ($mysoc->logo) { - if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); - } - } - if (!$urllogo && (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))) + + print ''."\n"; + print '
'."\n"; + print ''."\n"; + print ''; + print ''."\n"; + print "\n"; + + + // Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) + $width = 0; + // Define logo and logosmall + $logosmall = $mysoc->logo_small; + $logo = $mysoc->logo; + $paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; + if (!empty($conf->global->$paramlogo)) $logosmall = $conf->global->$paramlogo; + elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) $logosmall = $conf->global->ONLINE_PAYMENT_LOGO; + //print ''."\n"; + // Define urllogo + $urllogo = ''; + $urllogofull = ''; + if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png'; + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $width = 150; + } + elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) + { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $width = 150; } - print '
Logo
'; - print '
'; + // Output html code for logo + if ($urllogo) + { + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; + } - print '
'; + print '

'; } /** @@ -102,6 +141,8 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ function llxFooterSurvey() { print '
'; + print ''; + print '
'; printCommonFooter('public'); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index a9b726a646b..beed90e3fdd 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -1093,6 +1093,6 @@ print ''."\n"; print ''."\n"; -llxFooterSurvey(); +llxFooter(); $db->close(); diff --git a/htdocs/opensurvey/wizard/choix_autre.php b/htdocs/opensurvey/wizard/choix_autre.php index cb3ed346a52..7a31e21c843 100644 --- a/htdocs/opensurvey/wizard/choix_autre.php +++ b/htdocs/opensurvey/wizard/choix_autre.php @@ -110,7 +110,7 @@ llxHeader('', $langs->trans("OpenSurvey"), "", '', 0, 0, $arrayofjs, $arrayofcss if (empty($_SESSION['titre'])) { dol_print_error('', $langs->trans('ErrorOpenSurveyFillFirstSection')); - llxFooterSurvey(); + llxFooter(); exit; } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index ab011dd219a..c9697e2e1e4 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -250,7 +250,8 @@ $form = new Form($db); $arrayofjs = array(); $arrayofcss = array('/opensurvey/css/style.css'); -llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); + +llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss, $numsondage); if (empty($object->ref)) // For survey, id is a hex string { @@ -274,6 +275,7 @@ foreach ($toutsujet as $value) $toutsujet = str_replace("°", "'", $toutsujet); + print '
'.$langs->trans("YouAreInivitedToVote").'
'; print $langs->trans("OpenSurveyHowTo").'

'; @@ -301,9 +303,6 @@ if (!$canbemodified) { exit; } -print '
'."\n"; -print ''; - print '
'."\n"; print '

'."\n"; From ade07865d6367d400d2c13738d336b30228189d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 21:19:43 +0100 Subject: [PATCH 099/162] FIX Look and feel v11 --- htdocs/opensurvey/fonctions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 22cd78ae8d7..eb1a20800ce 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -130,7 +130,7 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; } - print '

'; + print '

'; } /** From 39af3635c5a227b1c356ab131a9cc545519b6e74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Mar 2020 21:50:34 +0100 Subject: [PATCH 100/162] Responsive --- htdocs/opensurvey/card.php | 6 ++---- htdocs/opensurvey/results.php | 14 ++++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 64b270799a2..32dde7ddb3e 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -392,8 +392,6 @@ if ($action == 'delete') -print '
'; - print ''."\n"; print ''; @@ -406,7 +404,7 @@ $comments = $object->getComments(); if ($comments) { foreach ($comments as $comment) { if ($user->rights->opensurvey->write) { - print ' '.img_picto('', 'delete.png').' '; + print ' '.img_picto('', 'delete.png', '', false, 0, 0, '', '', 0).' '; } print dol_htmlentities($comment->usercomment).': '.dol_nl2br(dol_htmlentities($comment->comment))."
"; @@ -423,7 +421,7 @@ print '
'; if ($object->allow_comments) { print $langs->trans("AddACommentForPoll").'
'; print '
'."\n"; - print $langs->trans("Name").':
'."\n"; + print $langs->trans("Name").': '."\n"; print '
'."\n"; if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide == "yes") { print "".$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")).""; diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index beed90e3fdd..fd5ff463eb8 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2013-2020 Laurent Destailleur * Copyright (C) 2014 Marcos García * Copyright (C) 2018 Frédéric France * @@ -503,6 +503,8 @@ dol_fiche_end(); print ''."\n"; +// Buttons + print '
'; print ''.$langs->trans("ExportSpreadsheet").' (.CSV)'.''; @@ -546,7 +548,7 @@ if (GETPOST('ajoutsujet')) for ($i = 1; $i < 32; $i++) { print ''."\n"; } - print ''."\n"; + print ''."\n"; print $formother->select_month('', 'nouveaumois', 1); @@ -560,14 +562,14 @@ if (GETPOST('ajoutsujet')) for ($i = 0; $i < 24; $i++) { print ''."\n"; } - print ''."\n"; + print ''."\n"; print ''."\n"; + print ''."\n"; print '

'.$langs->trans("AddEndHour").':

'."\n"; print ''."\n"; + print ''."\n"; print '

'; print' '."\n"; @@ -597,7 +599,7 @@ if (GETPOST('ajoutsujet')) } if ($user->rights->opensurvey->write) { - print '
'.$langs->trans("PollAdminDesc", img_picto('', 'delete'), $langs->trans("Add")).'
'; + print ''.$langs->trans("PollAdminDesc", img_picto('', 'delete'), $langs->trans("Add")).'
'; } $nbcolonnes = substr_count($object->sujet, ',') + 1; From 7370268b133724c55ce24dba1c0988d95c385b0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Mar 2020 11:04:33 +0100 Subject: [PATCH 101/162] Tool to regenerate files --- htdocs/core/lib/website2.lib.php | 6 +- htdocs/website/class/website.class.php | 2 +- htdocs/website/class/websitepage.class.php | 2 +- .../website/migrate_news_joomla2dolibarr.php | 4 +- scripts/website/regenerate_pages.php | 97 +++++++++++++++++++ 5 files changed, 105 insertions(+), 6 deletions(-) create mode 100755 scripts/website/regenerate_pages.php diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index e8c7e7006e3..78b9923d82d 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -49,7 +49,8 @@ function dolSaveMasterFile($filemaster) } /** - * Save content of a page on disk + * Save content of a page on disk. + * It can save file into root directory or into language subdirectory. * * @param string $filealias Full path of filename to generate * @param Website $object Object website @@ -98,7 +99,8 @@ function dolSavePageAlias($filealias, $object, $objectpage) /** - * Save content of a page on disk + * Save content of a page on disk. + * Page contents are always saved into root directory. * * @param string $filetpl Full path of filename to generate * @param Website $object Object website diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 275df563c53..ed82a4aa43e 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -353,7 +353,7 @@ class Website extends CommonObject /** - * Load object in memory from the database + * Load all object in memory ($this->records) from the database * * @param string $sortorder Sort Order * @param string $sortfield Sort field diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 516640d15fb..7d1f345d8c2 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -282,7 +282,7 @@ class WebsitePage extends CommonObject } /** - * Load list of objects in memory from the database. + * Return array of all web site pages. * * @param string $websiteid Web site * @param string $sortorder Sort Order diff --git a/scripts/website/migrate_news_joomla2dolibarr.php b/scripts/website/migrate_news_joomla2dolibarr.php index ded2e6f1903..e9f6c3c2295 100755 --- a/scripts/website/migrate_news_joomla2dolibarr.php +++ b/scripts/website/migrate_news_joomla2dolibarr.php @@ -17,7 +17,7 @@ */ /** - * \file scripts/website/migrate_newsèjoomla2dolibarr.php + * \file scripts/website/migrate_news_joomla2dolibarr.php * \ingroup scripts * \brief Migrate news from a Joomla databse into a Dolibarr website */ @@ -42,7 +42,7 @@ $websiteref = empty($argv[2])?'':$argv[2]; $joomlaserverinfo = empty($argv[3])?'':$argv[3]; $image = 'image/__WEBSITE_KEY__/images/stories/dolibarr.png'; -$max = (empty($argv[4]) && $argv[4] !== '0')?'10':$argv[4]; +$max = (!isset($argv[4]) || (empty($argv[4]) && $argv[4] !== '0'))?'10':$argv[4]; if (empty($argv[3]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) { print '***** '.$script_file.' *****'."\n"; diff --git a/scripts/website/regenerate_pages.php b/scripts/website/regenerate_pages.php new file mode 100755 index 00000000000..8ce78e0082d --- /dev/null +++ b/scripts/website/regenerate_pages.php @@ -0,0 +1,97 @@ +#!/usr/bin/env php + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file scripts/website/regenerate_pages.php + * \ingroup scripts + * \brief Regenerate all pages of a web site + */ + +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path = __DIR__.'/'; + +// Test if batch mode +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; + exit(-1); +} + +@set_time_limit(0); // No timeout for this script +define('EVEN_IF_ONLY_LOGIN_ALLOWED', 1); // Set this define to 0 if you want to lock your script when dolibarr setup is "locked to admin user only". + +$error = 0; + +$mode = empty($argv[1])?'':$argv[1]; +$websiteref = empty($argv[2])?'':$argv[2]; +$max = (!isset($argv[3]) || (empty($argv[3]) && $argv[3] !== '0'))?'10':$argv[3]; + +if (empty($argv[2]) || !in_array($argv[1], array('test', 'confirm')) || empty($websiteref)) { + print '***** '.$script_file.' *****'."\n"; + print "Usage: $script_file (test|confirm) website [nbmaxrecord]\n"; + print "\n"; + print "Regenerate all pages of a web site.\n"; + exit(-1); +} + +require $path."../../htdocs/master.inc.php"; +include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; +include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php'; + +$langs->load('main'); + +$website = new Website($db); +$result = $website->fetch(0, $websiteref); +if ($result <= 0) { + print 'Error, web site '.$websiteref.' not found'."\n"; + exit(-1); +} + +$websitepagestatic = new WebsitePage($db); + +$db->begin(); + +$listofpages = $websitepagestatic->fetchAll($website->id, '', $max); + +$nbgenerated = 0; +foreach($listofpages as $websitepage) { + global $dolibarr_main_data_root; + $pathofwebsite = $dolibarr_main_data_root.'/website/'.$websiteref; + $filealias = $pathofwebsite.'/'.$websitepage->pageurl.'.php'; + $filetpl = $pathofwebsite.'/page'.$websitepage->id.'.tpl.php'; + if ($mode == 'confirm') { + dolSavePageAlias($filealias, $website, $websitepage); + dolSavePageContent($filetpl, $website, $websitepage); + } + print "Generation of page done - pageid = ".$websitepage->id." - ".$websitepage->pageurl."\n"; + $nbgenerated++; + + if ($max && $nbgenerated >= $max) { + print 'Nb max of record ('.$max.') reached. We stop now.'."\n"; + break; + } +} + +if ($mode == 'confirm') { + print $nbgenerated." page(s) generated\n"; +} else { + print $nbgenerated." page(s) found but not generated (test mode)\n"; +} + +exit($error); From 4b7de1e5f5cea42b5c70d38fe26d5e94adb51fda Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sat, 21 Mar 2020 15:48:25 +0100 Subject: [PATCH 102/162] Remove vars to avoid conficts in TakePOS setup --- htdocs/takepos/admin/setup.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index a7967169db8..cec301cb934 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -71,20 +71,12 @@ if ($action == 'set') $db->begin(); if (GETPOST('socid', 'int') < 0) $_POST["socid"] = ''; - $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ADDON", GETPOST('TAKEPOS_ADDON', 'alpha'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { From 666b38b44a109bba486b4b75ba398b0071a02cfb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Mar 2020 17:31:09 +0100 Subject: [PATCH 103/162] Fix charset in RSS export --- htdocs/core/lib/xcal.lib.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index 7e7cbd9672e..e3f53b7588d 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -330,7 +330,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) * @param string $format "rss" * @param string $title Title of export * @param string $desc Description of export - * @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category") + * @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category") or Array of WebsitePage * @param string $outputfile Output file * @param string $filter (optional) Filter * @return int < 0 if ko, Nb of events in file if ok @@ -355,7 +355,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt $date = date("r"); // Print header - fwrite($fichier, 'charset_output.""?>'); + fwrite($fichier, 'charset_output.'"?>'); fwrite($fichier, "\n"); fwrite($fichier, ''); @@ -363,11 +363,13 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt fwrite($fichier, "\n".$title."\n"); - $form = ""."\n". + /* + fwrite($fichier, ""."\n". // "fr"."\n". "Dolibarr"."\n". "".$date.""."\n". - "Dolibarr"."\n"; + "Dolibarr"."\n"); + */ // Define $urlwithroot $urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root)); @@ -392,6 +394,19 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt if ($eventqualified) { + if (is_object($event) && get_class($event) == 'WebsitePage') { + // Convert object into an array + $tmpevent = array(); + $tmpevent['uid'] = $event->id; + $tmpevent['startdate'] = $event->date_creation; + $tmpevent['summary'] = $event->title; + $tmpevent['url'] = $event->urlpage.'.php'; + $tmpevent['author'] = $event->author_alias ? $event->author_alias : 'unknown'; + //$tmpevent['category'] = ''; + + $event = $tmpevent; + } + $uid = $event["uid"]; $startdate = $event["startdate"]; $summary = $event["summary"]; From 79086011f8a713d1a09a8a3fe5456685d386b8b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Mar 2020 17:31:44 +0100 Subject: [PATCH 104/162] Work on RSS export of blog posts --- htdocs/core/lib/website.lib.php | 35 +++--- htdocs/core/lib/website2.lib.php | 18 +++ .../samples/{wrapper.html => wrapper.php} | 111 +++++++++++++++++- 3 files changed, 142 insertions(+), 22 deletions(-) rename htdocs/website/samples/{wrapper.html => wrapper.php} (57%) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 08453c6bcb8..58f2be24da9 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -664,25 +664,25 @@ function getSocialNetworkSharingLinks() $fullurl = $website->alias.'/'.$websitepage->pageurl.'.php'; $hashtags = trim(join(' #', array_map('trim', explode(',', $websitepage->keywords)))); - print ''."\n"; - print '
'.$obj->name.''.$obj->value.''.$obj->entity.'
'.$obj->name.''.$obj->value.''.$obj->entity.'
'; diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 7a53b95fcf2..dce23de6270 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -54,17 +54,17 @@ $i=0; foreach($modulesdir as $dir) { $handle=@opendir(dol_osencode($dir)); - if (is_resource($handle)) - { - while (($file = readdir($handle))!==false) - { - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') - { - $modName = substr($file, 0, dol_strlen($file) - 10); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') + { + $modName = substr($file, 0, dol_strlen($file) - 10); - if ($modName) - { - //print 'xx'.$dir.$file.'
'; + if ($modName) + { + //print 'xx'.$dir.$file.'
'; if (in_array($file, $modules_files)) { // File duplicate @@ -77,13 +77,13 @@ foreach($modulesdir as $dir) if (class_exists($modName)) { try { - $objMod = new $modName($db); + $objMod = new $modName($db); - $modules[$objMod->numero]=$objMod; - $modules_names[$objMod->numero]=$objMod->name; - $modules_files[$objMod->numero]=$file; - $modules_fullpath[$file]=$dir.$file; - $picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic'; + $modules[$objMod->numero]=$objMod; + $modules_names[$objMod->numero]=$objMod->name; + $modules_files[$objMod->numero]=$file; + $modules_fullpath[$file]=$dir.$file; + $picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic'; } catch(Exception $e) { @@ -95,11 +95,11 @@ foreach($modulesdir as $dir) print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
"; } } - } - } - } - closedir($handle); - } + } + } + } + closedir($handle); + } } print '
'; @@ -120,15 +120,15 @@ foreach($sortorder as $numero=>$name) // Module print ''; $alt=$name.' - '.$modules_files[$numero]; - if (! empty($picto[$numero])) - { - if (preg_match('/^\//', $picto[$numero])) print img_picto($alt, $picto[$numero], 'width="14px"', 1); - else print img_object($alt, $picto[$numero], 'width="14px"'); - } - else - { - print img_object($alt, $picto[$numero], 'width="14px"'); - } + if (! empty($picto[$numero])) + { + if (preg_match('/^\//', $picto[$numero])) print img_picto($alt, $picto[$numero], 'width="14px"', 1); + else print img_object($alt, $picto[$numero], 'width="14px"'); + } + else + { + print img_object($alt, $picto[$numero], 'width="14px"'); + } print ' '.$modules[$numero]->getName(); print ""; // Version diff --git a/htdocs/admin/system/xdebug.php b/htdocs/admin/system/xdebug.php index 56b452706f5..9ea68431b1a 100644 --- a/htdocs/admin/system/xdebug.php +++ b/htdocs/admin/system/xdebug.php @@ -41,54 +41,54 @@ print "
\n"; if (!function_exists('xdebug_is_enabled')) { - print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.'; - llxFooter(); - exit; + print 'XDebug seems to be not installed. Function xdebug_is_enabled not found.'; + llxFooter(); + exit; } if (function_exists('socket_create')) { - $address = ini_get('xdebug.remote_host')?ini_get('xdebug.remote_host'):'127.0.0.1'; - $port = ini_get('xdebug.remote_port')?ini_get('xdebug.remote_port'):9000; + $address = ini_get('xdebug.remote_host')?ini_get('xdebug.remote_host'):'127.0.0.1'; + $port = ini_get('xdebug.remote_port')?ini_get('xdebug.remote_port'):9000; - print "Current xdebug setup:
\n"; - print "* Remote debug setup:
\n"; - print 'xdebug.remote_enable = '.ini_get('xdebug.remote_enable')."
\n"; - print 'xdebug.remote_host = '.$address."
\n"; - print 'xdebug.remote_port = '.$port."
\n"; - print "* Profiler setup "; - if (function_exists('xdebug_get_profiler_filename')) print xdebug_get_profiler_filename()?"(currently on into file ".xdebug_get_profiler_filename().")":"(currently off)"; - else print "(currenlty not available)"; - print ":
\n"; - print 'xdebug.profiler_enable = '.ini_get('xdebug.profiler_enable')."
\n"; - print 'xdebug.profiler_enable_trigger = '.ini_get('xdebug.profiler_enable_trigger')."
\n"; - print 'xdebug.profiler_output_dir = '.ini_get('xdebug.profiler_output_dir')."
\n"; - print 'xdebug.profiler_output_name = '.ini_get('xdebug.profiler_output_name')."
\n"; - print 'xdebug.profiler_append = '.ini_get('xdebug.profiler_append')."
\n"; - print "
\n"; + print "Current xdebug setup:
\n"; + print "* Remote debug setup:
\n"; + print 'xdebug.remote_enable = '.ini_get('xdebug.remote_enable')."
\n"; + print 'xdebug.remote_host = '.$address."
\n"; + print 'xdebug.remote_port = '.$port."
\n"; + print "* Profiler setup "; + if (function_exists('xdebug_get_profiler_filename')) print xdebug_get_profiler_filename()?"(currently on into file ".xdebug_get_profiler_filename().")":"(currently off)"; + else print "(currenlty not available)"; + print ":
\n"; + print 'xdebug.profiler_enable = '.ini_get('xdebug.profiler_enable')."
\n"; + print 'xdebug.profiler_enable_trigger = '.ini_get('xdebug.profiler_enable_trigger')."
\n"; + print 'xdebug.profiler_output_dir = '.ini_get('xdebug.profiler_output_dir')."
\n"; + print 'xdebug.profiler_output_name = '.ini_get('xdebug.profiler_output_name')."
\n"; + print 'xdebug.profiler_append = '.ini_get('xdebug.profiler_append')."
\n"; + print "
\n"; - echo "To run a debug session, add parameter
"; - echo "* XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.
\n"; - echo "To run a profiler session (when xdebug.profiler_enable_trigger=1), add parameter
\n"; - echo "* XDEBUG_PROFILE=aname on each URL.
"; - print "
"; + echo "To run a debug session, add parameter
"; + echo "* XDEBUG_SESSION_START=aname on your URL. To stop, remove cookie XDEBUG_SESSION_START.
\n"; + echo "To run a profiler session (when xdebug.profiler_enable_trigger=1), add parameter
\n"; + echo "* XDEBUG_PROFILE=aname on each URL.
"; + print "
"; - print "Test debugger server (Eclipse for example):
\n"; - $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - if (empty($socket)) die('Unable to prepare a socket'); - //socket_bind($sock, $address, $port) or die('Unable to bind on address='.$address.' port='.$port); - //socket_listen($sock); - //$client = socket_accept($sock); - $client=socket_connect($socket, $address, $port); - if ($client) - { - echo "Connection established: ".$client." - address=".$address." port=".$port."
\n"; - echo "There is a Remote debug server at this address.
\n"; - echo "
\n"; - echo "To be sure this debugger accepts input from your PHP server and xdebug, be sure to have\n"; - echo "your php.ini file with this :
\n"; - echo '\n"; - print "

\n"; - echo 'Then check in your debug server (Eclipse), you have setup:
+ print "

\n"; + echo 'Then check in your debug server (Eclipse), you have setup:
XDebug with same port than in php.ini
Allow Remote debug=yes or prompt
'."\n"; - print "
\n"; - } - else - { - print socket_strerror(socket_last_error()); - echo "Failed to connect to address=".$address." port=".$port."
\n"; - echo "There is no Remote debug server at this address.\n"; - } - socket_close($socket); + print "
\n"; + } + else + { + print socket_strerror(socket_last_error()); + echo "Failed to connect to address=".$address." port=".$port."
\n"; + echo "There is no Remote debug server at this address.\n"; + } + socket_close($socket); } else { - print "Can't test if PHPDebug is OK as PHP socket functions are not enabled."; + print "Can't test if PHPDebug is OK as PHP socket functions are not enabled."; } diff --git a/htdocs/admin/ticket_extrafields.php b/htdocs/admin/ticket_extrafields.php index 18d5eee40a6..d7be1d058e6 100644 --- a/htdocs/admin/ticket_extrafields.php +++ b/htdocs/admin/ticket_extrafields.php @@ -36,7 +36,7 @@ $form = new Form($db); $tmptype2label = ExtraFields::$type2label; $type2label = array(''); foreach ($tmptype2label as $key => $val) { - $type2label[$key] = $langs->trans($val); + $type2label[$key] = $langs->trans($val); } $action = GETPOST('action', 'alpha'); @@ -44,7 +44,7 @@ $attrname = GETPOST('attrname', 'alpha'); $elementtype = 'ticket'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) { - accessforbidden(); + accessforbidden(); } @@ -79,9 +79,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '"; + print '"; } /* ************************************************************************** */ @@ -91,10 +91,10 @@ if ($action != 'create' && $action != 'edit') { /* ************************************************************************** */ if ($action == 'create') { - print "
"; - print load_fiche_titre($langs->trans('NewAttribute')); + print "
"; + print load_fiche_titre($langs->trans('NewAttribute')); - include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -103,10 +103,10 @@ if ($action == 'create') { /* */ /* ************************************************************************** */ if ($action == 'edit' && !empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT . '/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php index 664cda18916..6d1f40ec4a0 100644 --- a/htdocs/admin/tools/update.php +++ b/htdocs/admin/tools/update.php @@ -54,9 +54,9 @@ $version='0.0'; if ($action == 'getlastversion') { - $result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); - //var_dump($result['content']); - $sfurl = simplexml_load_string($result['content']); + $result = getURLContent('http://sourceforge.net/projects/dolibarr/rss'); + //var_dump($result['content']); + $sfurl = simplexml_load_string($result['content']); } @@ -75,39 +75,39 @@ print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
'; if (function_exists('curl_init')) { - $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10; + $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10; - if ($action == 'getlastversion') - { - if ($sfurl) - { - $i=0; - while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) - { - $title=$sfurl->channel[0]->item[$i]->title; - if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) - { - $newversion=$reg[1]; - $newversionarray=explode('.', $newversion); - $versionarray=explode('.', $version); - //var_dump($newversionarray);var_dump($versionarray); - if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion; - } - $i++; - } + if ($action == 'getlastversion') + { + if ($sfurl) + { + $i=0; + while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) + { + $title=$sfurl->channel[0]->item[$i]->title; + if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) + { + $newversion=$reg[1]; + $newversionarray=explode('.', $newversion); + $versionarray=explode('.', $version); + //var_dump($newversionarray);var_dump($versionarray); + if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion; + } + $i++; + } - // Show version - print $langs->trans("LastStableVersion").' : '. (($version != '0.0')?$version:$langs->trans("Unknown")) .'
'; - } - else - { - print $langs->trans("LastStableVersion").' : ' .$langs->trans("UpdateServerOffline").'
'; - } - } - else - { - print $langs->trans("LastStableVersion").' : ' .$langs->trans("Check").'
'; - } + // Show version + print $langs->trans("LastStableVersion").' : '. (($version != '0.0')?$version:$langs->trans("Unknown")) .'
'; + } + else + { + print $langs->trans("LastStableVersion").' : ' .$langs->trans("UpdateServerOffline").'
'; + } + } + else + { + print $langs->trans("LastStableVersion").' : ' .$langs->trans("Check").'
'; + } } print '
'; diff --git a/htdocs/asset/admin/assets_extrafields.php b/htdocs/asset/admin/assets_extrafields.php index d4ae2bd2930..9d224fe079e 100644 --- a/htdocs/asset/admin/assets_extrafields.php +++ b/htdocs/asset/admin/assets_extrafields.php @@ -76,9 +76,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print ''; - print "
"; + print '
'; + print ''; + print "
"; } @@ -90,10 +90,10 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { - print "
"; - print load_fiche_titre($langs->trans('NewAttribute')); + print "
"; + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -103,10 +103,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 20f189dd99f..e298e0e6540 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -61,28 +61,28 @@ if (! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) $dir = dol_buildpath($dirroot, 0); $handle = @opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle))!==false) - { - if (preg_match('/^mod_barcode_product_.*php$/', $file)) - { - $file = substr($file, 0, dol_strlen($file)-4); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (preg_match('/^mod_barcode_product_.*php$/', $file)) + { + $file = substr($file, 0, dol_strlen($file)-4); - try { - dol_include_once($dirroot.$file.'.php'); - } - catch(Exception $e) - { - dol_syslog($e->getMessage(), LOG_ERR); - } + try { + dol_include_once($dirroot.$file.'.php'); + } + catch(Exception $e) + { + dol_syslog($e->getMessage(), LOG_ERR); + } - $modBarCodeProduct = new $file(); - break; - } - } - closedir($handle); - } + $modBarCodeProduct = new $file(); + break; + } + } + closedir($handle); + } } } diff --git a/htdocs/blockedlog/ajax/block-add.php b/htdocs/blockedlog/ajax/block-add.php index f38efde42b2..92ccd8af369 100644 --- a/htdocs/blockedlog/ajax/block-add.php +++ b/htdocs/blockedlog/ajax/block-add.php @@ -37,8 +37,8 @@ $element = GETPOST('element', 'alpha'); $action = GETPOST('action', 'alpha'); if ($element === 'facture') { - require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; - require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facture = new Facture($db); if($facture->fetch($id)>0) { diff --git a/htdocs/blockedlog/lib/blockedlog.lib.php b/htdocs/blockedlog/lib/blockedlog.lib.php index 13c7ac61d1a..998a97e9bab 100644 --- a/htdocs/blockedlog/lib/blockedlog.lib.php +++ b/htdocs/blockedlog/lib/blockedlog.lib.php @@ -53,13 +53,13 @@ function blockedlogadmin_prepare_head() $object=new stdClass(); - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'blockedlog'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'blockedlog', 'remove'); - return $head; + return $head; } diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 7122e1b6f59..fcfe9905bae 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -74,11 +74,11 @@ if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) { logo_small)) { - print 'Logo company'; + print 'Logo company'; } else { - print '
'.$mysoc->name.'
'; + print '
'.$mysoc->name.'
'; } ?>
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 31f608a9ee0..b9ad3015adf 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -143,19 +143,19 @@ if ($object->id > 0) // Project if (! empty($conf->projet->enabled)) { - $langs->load("projects"); - //$morehtmlref.='
'.$langs->trans('Project') . ' '; - $morehtmlref.=$langs->trans('Project') . ': '; - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - if ($proj->title) $morehtmlref.=' - '.$proj->title; - } else { - $morehtmlref.=''; - } + $langs->load("projects"); + //$morehtmlref.='
'.$langs->trans('Project') . ' '; + $morehtmlref.=$langs->trans('Project') . ': '; + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + if ($proj->title) $morehtmlref.=' - '.$proj->title; + } else { + $morehtmlref.=''; + } } $morehtmlref.='
'; @@ -253,9 +253,9 @@ if ($object->id > 0) print ''; - print '
'; + print '
'; - dol_fiche_end(); + dol_fiche_end(); $modulepart = 'actions'; diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index fc53f90ed55..a0530e8c262 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -85,9 +85,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -100,9 +100,9 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { print '
'; - print load_fiche_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -112,10 +112,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } // End of page diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index a3b754e0979..4da1ea48fd6 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -162,13 +162,13 @@ if ($resql) print ''; print ''; - $result=''; - $link=$linkend=''; - $link = ''; - $linkend=''; - $name=$obj->name; - $result.=($link.img_object($langs->trans("ShowCompany").': '.$name, 'company').$linkend); - $result.=$link.(dol_trunc($name, $maxlen)).$linkend; + $result=''; + $link=$linkend=''; + $link = ''; + $linkend=''; + $name=$obj->name; + $result.=($link.img_object($langs->trans("ShowCompany").': '.$name, 'company').$linkend); + $result.=$link.(dol_trunc($name, $maxlen)).$linkend; print $result; print ''; diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 55bf5e1f022..fdc1d622e90 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -54,15 +54,15 @@ $sql.= " AND pb.entity = ".$conf->entity; $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - if ( $num > 0 ) - { - $row = $db->fetch_row($resql); - $total = $row[0]; - $nbtotal = $row[1]; - } + if ( $num > 0 ) + { + $row = $db->fetch_row($resql); + $total = $row[0]; + $nbtotal = $row[1]; + } } @@ -150,15 +150,15 @@ $sql.= " AND pl.statut = 3"; $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - if ( $num > 0 ) - { - $row = $db->fetch_row($resql); - $total = $row[0]; - $nbtotal = $row[1]; - } + if ( $num > 0 ) + { + $row = $db->fetch_row($resql); + $total = $row[0]; + $nbtotal = $row[1]; + } } /* diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index e449f907bc8..7806e3e4cc1 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -27,8 +27,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (! empty($conf->projet->enabled)) { - include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } // Load translation files required by the page @@ -51,10 +51,10 @@ $object = new ChargeSociales($db); if ($action == 'setlib' && $user->rights->tax->charges->creer) { - $object->fetch($id); - $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); - if ($result < 0) - setEventMessages($object->error, $object->errors, 'errors'); + $object->fetch($id); + $result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY'); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); } @@ -84,17 +84,17 @@ $morehtmlref.=$form->editfieldval("Label", 'lib', $object->label, $object, $user // Project if (! empty($conf->projet->enabled)) { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' : '; - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; - } else { - $morehtmlref.=''; - } + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' : '; + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } } $morehtmlref.='
'; diff --git a/htdocs/contrat/admin/contract_extrafields.php b/htdocs/contrat/admin/contract_extrafields.php index 5f6bea09a3d..7696e3365d2 100644 --- a/htdocs/contrat/admin/contract_extrafields.php +++ b/htdocs/contrat/admin/contract_extrafields.php @@ -80,9 +80,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -95,9 +95,9 @@ if ($action != 'create' && $action != 'edit') if ($action == 'create') { print '
'; - print load_fiche_titre($langs->trans('NewAttribute')); + print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -108,9 +108,9 @@ if ($action == 'create') if ($action == 'edit' && ! empty($attrname)) { print '

'; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/contrat/admin/contractdet_extrafields.php b/htdocs/contrat/admin/contractdet_extrafields.php index 3a8340dfecc..a78669bec22 100644 --- a/htdocs/contrat/admin/contractdet_extrafields.php +++ b/htdocs/contrat/admin/contractdet_extrafields.php @@ -80,9 +80,9 @@ dol_fiche_end(); // Buttons if ($action != 'create' && $action != 'edit') { - print '
'; - print "".$langs->trans("NewAttribute").""; - print "
"; + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; } @@ -97,7 +97,7 @@ if ($action == 'create') print '
'; print load_fiche_titre($langs->trans('NewAttribute')); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; } /* ************************************************************************** */ @@ -107,10 +107,10 @@ if ($action == 'create') /* ************************************************************************** */ if ($action == 'edit' && ! empty($attrname)) { - print "
"; - print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); - require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; } llxFooter(); diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index 9fca4502dcf..ca5f05f5f4d 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -32,9 +32,9 @@ $addlinkid = GETPOST('idtolinkto', 'int'); // Link invoice to order if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel', 'alpha') && $id > 0 && $addlinkid > 0) { - $object->fetch($id); - $object->fetch_thirdparty(); - $result = $object->add_object_linked(GETPOST('addlink', 'alpha'), $addlinkid); + $object->fetch($id); + $object->fetch_thirdparty(); + $result = $object->add_object_linked(GETPOST('addlink', 'alpha'), $addlinkid); } // Delete link diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index fc0f25a1297..0671e998684 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -29,63 +29,63 @@ // Print file if ($action == 'print_file' && $user->rights->printing->read) { - $langs->load("printing"); - require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php'; - $objectprint = new PrintingDriver($db); - $list = $objectprint->listDrivers($db, 10); - if (! empty($list)) { - $errorprint=0; - $printerfound=0; - foreach ($list as $driver) { - require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; - $langs->load($driver); - $classname = 'printing_'.$driver; - $printer = new $classname($db); - //print '
'.print_r($printer, true).'
'; + $langs->load("printing"); + require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php'; + $objectprint = new PrintingDriver($db); + $list = $objectprint->listDrivers($db, 10); + if (! empty($list)) { + $errorprint=0; + $printerfound=0; + foreach ($list as $driver) { + require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; + $langs->load($driver); + $classname = 'printing_'.$driver; + $printer = new $classname($db); + //print '
'.print_r($printer, true).'
'; - if (! empty($conf->global->{$printer->active})) - { - $printerfound++; + if (! empty($conf->global->{$printer->active})) + { + $printerfound++; - $subdir=''; - $module = GETPOST('printer', 'alpha'); - switch ($module ) - { - case 'livraison' : - $subdir = 'receipt'; - $module = 'expedition'; - break; - case 'expedition' : - $subdir = 'sending'; - break; - case 'commande_fournisseur' : - $module = 'fournisseur'; - $subdir = 'commande'; - break; - } - try { - $ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir); - if ($ret > 0) { - //print '
'.print_r($printer->errors, true).'
'; - setEventMessages($printer->error, $printer->errors, 'errors'); - } - if ($ret==0) - { - //print '
'.print_r($printer->errors, true).'
'; - setEventMessages($printer->error, $printer->errors); - setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); - } - } - catch(Exception $e) - { - $ret = 1; - setEventMessages($e->getMessage(), null, 'errors'); - } - } - } - if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound", $langs->transnoentities("Module64000Name")), null, 'warnings'); - } else { - setEventMessages($langs->trans("NoModuleFound"), null, 'warnings'); - } - $action = ''; + $subdir=''; + $module = GETPOST('printer', 'alpha'); + switch ($module ) + { + case 'livraison' : + $subdir = 'receipt'; + $module = 'expedition'; + break; + case 'expedition' : + $subdir = 'sending'; + break; + case 'commande_fournisseur' : + $module = 'fournisseur'; + $subdir = 'commande'; + break; + } + try { + $ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir); + if ($ret > 0) { + //print '
'.print_r($printer->errors, true).'
'; + setEventMessages($printer->error, $printer->errors, 'errors'); + } + if ($ret==0) + { + //print '
'.print_r($printer->errors, true).'
'; + setEventMessages($printer->error, $printer->errors); + setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); + } + } + catch(Exception $e) + { + $ret = 1; + setEventMessages($e->getMessage(), null, 'errors'); + } + } + } + if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound", $langs->transnoentities("Module64000Name")), null, 'warnings'); + } else { + setEventMessages($langs->trans("NoModuleFound"), null, 'warnings'); + } + $action = ''; } diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 425204e00a4..8c8f23f9b0e 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -60,8 +60,8 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel } } } elseif ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('cancel', 'alpha')) { - // Set public note - if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before'); + // Set public note + if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before'); if (empty($object->id)) $object->fetch($id); // Fetch may not be already done $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private', 'none'), ENT_QUOTES), '_private'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/core/ajax/bankconciliate.php b/htdocs/core/ajax/bankconciliate.php index 690ebc80f85..f3e6c379392 100644 --- a/htdocs/core/ajax/bankconciliate.php +++ b/htdocs/core/ajax/bankconciliate.php @@ -51,46 +51,46 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ { // Increase date $al = new AccountLine($db); - $al->datev_next(GETPOST('rowid', 'int')); - $al->fetch(GETPOST('rowid', 'int')); + $al->datev_next(GETPOST('rowid', 'int')); + $al->fetch(GETPOST('rowid', 'int')); - print ''.dol_print_date($db->jdate($al->datev), "day").''; + print ''.dol_print_date($db->jdate($al->datev), "day").''; - exit; + exit; } if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvprev') { // Decrease date $al =new AccountLine($db); - $al->datev_previous(GETPOST('rowid', 'int')); - $al->fetch(GETPOST('rowid', 'int')); + $al->datev_previous(GETPOST('rowid', 'int')); + $al->fetch(GETPOST('rowid', 'int')); - print ''.dol_print_date($db->jdate($al->datev), "day").''; + print ''.dol_print_date($db->jdate($al->datev), "day").''; - exit; + exit; } if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'donext') { // Increase date $al = new AccountLine($db); - $al->dateo_next(GETPOST('rowid', 'int')); - $al->fetch(GETPOST('rowid', 'int')); + $al->dateo_next(GETPOST('rowid', 'int')); + $al->fetch(GETPOST('rowid', 'int')); - print ''.dol_print_date($db->jdate($al->dateo), "day").''; + print ''.dol_print_date($db->jdate($al->dateo), "day").''; - exit; + exit; } if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'doprev') { // Decrease date $al =new AccountLine($db); - $al->dateo_previous(GETPOST('rowid', 'int')); - $al->fetch(GETPOST('rowid', 'int')); + $al->dateo_previous(GETPOST('rowid', 'int')); + $al->fetch(GETPOST('rowid', 'int')); - print ''.dol_print_date($db->jdate($al->dateo), "day").''; + print ''.dol_print_date($db->jdate($al->dateo), "day").''; - exit; + exit; } diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index 5a3b18da55e..4e2252cee56 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -53,23 +53,23 @@ header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size'); switch ($_SERVER['REQUEST_METHOD']) { case 'OPTIONS': break; - case 'HEAD': - case 'GET': - $upload_handler->get(); - break; - case 'POST': - if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { - $upload_handler->delete(); - } else { - $upload_handler->post(); - } - break; - case 'DELETE': - $upload_handler->delete(); - break; - default: - header('HTTP/1.0 405 Method Not Allowed'); - exit; + case 'HEAD': + case 'GET': + $upload_handler->get(); + break; + case 'POST': + if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { + $upload_handler->delete(); + } else { + $upload_handler->post(); + } + break; + case 'DELETE': + $upload_handler->delete(); + break; + default: + header('HTTP/1.0 405 Method Not Allowed'); + exit; } $db->close(); diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index 0d662b6a0bd..e1a5c451ba5 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -68,4 +68,4 @@ else // Registering new values if (($action == 'set') && ! empty($id)) - $object->setValueFrom($field, $value, $element, $id); + $object->setValueFrom($field, $value, $element, $id); diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index 1cbede80339..39c2bf7b07f 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -44,8 +44,8 @@ if (isset($_GET['action']) && ! empty($_GET['action'])) { if ($_GET['action'] == 'getrandompassword' && $user->admin) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $generic = $_GET['generic'] ? true : false; + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; + $generic = $_GET['generic'] ? true : false; echo getRandomPassword($generic); } } diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php index df9f70da1df..72eb73f84e0 100644 --- a/htdocs/core/ajax/ziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -62,36 +62,36 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) if (! empty($conf->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) // Use zip-town table { - $sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country"; - $sql.= ", c.rowid as fk_country, c.code as country_code, c.label as country"; - $sql.= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_ziptown as z"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON z.fk_county = d.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region,"; - $sql.= " ".MAIN_DB_PREFIX."c_country as c"; - $sql.= " WHERE z.fk_pays = c.rowid"; - $sql.= " AND z.active = 1 AND c.active = 1"; - if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'"; - if ($town) $sql.=" AND z.town LIKE '%" . $db->escape($town) . "%'"; - $sql.= " ORDER BY z.zip, z.town"; - $sql.= $db->plimit(100); // Avoid pb with bad criteria + $sql = "SELECT z.rowid, z.zip, z.town, z.fk_county, z.fk_pays as fk_country"; + $sql.= ", c.rowid as fk_country, c.code as country_code, c.label as country"; + $sql.= ", d.rowid as fk_county, d.code_departement as county_code, d.nom as county"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_ziptown as z"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON z.fk_county = d.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r ON d.fk_region = r.code_region,"; + $sql.= " ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE z.fk_pays = c.rowid"; + $sql.= " AND z.active = 1 AND c.active = 1"; + if ($zipcode) $sql.=" AND z.zip LIKE '" . $db->escape($zipcode) . "%'"; + if ($town) $sql.=" AND z.town LIKE '%" . $db->escape($town) . "%'"; + $sql.= " ORDER BY z.zip, z.town"; + $sql.= $db->plimit(100); // Avoid pb with bad criteria } else // Use table of third parties { - $sql = "SELECT DISTINCT s.zip, s.town, s.fk_departement as fk_county, s.fk_pays as fk_country"; - $sql.= ", c.code as country_code, c.label as country"; - $sql.= ", d.code_departement as county_code , d.nom as county"; - $sql.= " FROM ".MAIN_DB_PREFIX.'societe as s'; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON s.fk_departement = d.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; - $sql.= " WHERE"; - if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'"; - if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'"; - $sql.= " ORDER BY s.fk_pays, s.zip, s.town"; - $sql.= $db->plimit(100); // Avoid pb with bad criteria + $sql = "SELECT DISTINCT s.zip, s.town, s.fk_departement as fk_county, s.fk_pays as fk_country"; + $sql.= ", c.code as country_code, c.label as country"; + $sql.= ", d.code_departement as county_code , d.nom as county"; + $sql.= " FROM ".MAIN_DB_PREFIX.'societe as s'; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."c_departements as d ON s.fk_departement = d.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; + $sql.= " WHERE"; + if ($zipcode) $sql.= " s.zip LIKE '".$db->escape($zipcode)."%'"; + if ($town) $sql.= " s.town LIKE '%" . $db->escape($town) . "%'"; + $sql.= " ORDER BY s.fk_pays, s.zip, s.town"; + $sql.= $db->plimit(100); // Avoid pb with bad criteria } - //print $sql; + //print $sql; $resql=$db->query($sql); //var_dump($db); if ($resql) @@ -103,11 +103,11 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town'])) $row_array['label'] = $row['zip'].' '.$row['town']; $row_array['label'] .= ($county || $country)?' (':''; - $row_array['label'] .= $county; + $row_array['label'] .= $county; $row_array['label'] .= ($county && $country?' - ':''); - $row_array['label'] .= $country; - $row_array['label'] .= ($county || $country)?')':''; - if ($zipcode) + $row_array['label'] .= $country; + $row_array['label'] .= ($county || $country)?')':''; + if ($zipcode) { $row_array['value'] = $row['zip']; $row_array['town'] = $row['town']; diff --git a/htdocs/core/antispamimage.php b/htdocs/core/antispamimage.php index 015f4597d12..38bb261e068 100644 --- a/htdocs/core/antispamimage.php +++ b/htdocs/core/antispamimage.php @@ -43,7 +43,7 @@ $number = strlen($letters); $string = ''; for($i = 0; $i < $length; $i++) { - $string .= $letters{mt_rand(0, $number - 1)}; + $string .= $letters{mt_rand(0, $number - 1)}; } //print $string; @@ -54,8 +54,8 @@ $_SESSION[$sessionkey]=$string; $img = imagecreate(80, 32); if (empty($img)) { - dol_print_error('', "Problem with GD creation"); - exit; + dol_print_error('', "Problem with GD creation"); + exit; } // Define mime type diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 023a2e6dc6d..448d1ffdf8d 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -50,13 +50,13 @@ abstract class CommonObjectLine extends CommonObject public $fk_unit; - /** - * Returns the translation key from units dictionary. - * A langs->trans() must be called on result to get translated value. - * - * @param string $type Label type (long or short) - * @return string|int <0 if ko, label if ok - */ + /** + * Returns the translation key from units dictionary. + * A langs->trans() must be called on result to get translated value. + * + * @param string $type Label type (long or short) + * @return string|int <0 if ko, label if ok + */ public function getLabelOfUnit($type = 'long') { global $langs; diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 4406d421745..c37041967c2 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -67,18 +67,18 @@ else // Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8) $tradTemp=array( - $langs->trans("January"), - $langs->trans("February"), - $langs->trans("March"), - $langs->trans("April"), - $langs->trans("May"), - $langs->trans("June"), - $langs->trans("July"), - $langs->trans("August"), - $langs->trans("September"), - $langs->trans("October"), - $langs->trans("November"), - $langs->trans("December") + $langs->trans("January"), + $langs->trans("February"), + $langs->trans("March"), + $langs->trans("April"), + $langs->trans("May"), + $langs->trans("June"), + $langs->trans("July"), + $langs->trans("August"), + $langs->trans("September"), + $langs->trans("October"), + $langs->trans("November"), + $langs->trans("December") ); print ''; From 2b33ef7e46a76405a0d8729f3b945ebaffdb8d63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Mar 2020 13:06:59 +0100 Subject: [PATCH 156/162] Align color of graph of status on status color --- htdocs/commande/class/commande.class.php | 4 +- htdocs/commande/index.php | 68 +++++++++++-------- htdocs/core/lib/project.lib.php | 6 +- htdocs/projet/activity/perday.php | 4 +- htdocs/projet/activity/permonth.php | 4 +- htdocs/projet/activity/perweek.php | 4 +- htdocs/supplier_proposal/card.php | 11 +-- .../class/supplier_proposal.class.php | 2 +- htdocs/supplier_proposal/index.php | 32 ++++++--- htdocs/theme/eldy/global.inc.php | 3 + 10 files changed, 81 insertions(+), 57 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 57eb78df405..b1b7b3c8fe5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3613,7 +3613,7 @@ class Commande extends CommonOrder if ($status == self::STATUS_CANCELED) { $labelStatus = $langs->trans('StatusOrderCanceled'); $labelStatusShort = $langs->trans('StatusOrderCanceledShort'); - $statusType = 'status5'; + $statusType = 'status9'; } elseif ($status == self::STATUS_DRAFT) { $labelStatus = $langs->trans('StatusOrderDraft'); @@ -3628,7 +3628,7 @@ class Commande extends CommonOrder elseif ($status == self::STATUS_SHIPMENTONPROCESS) { $labelStatus = $langs->trans('StatusOrderSentShort').$billedtext; $labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext; - $statusType = 'status3'; + $statusType = 'status4'; } elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderToBill'); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 072abe9625b..651ef2862e9 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -72,7 +72,6 @@ print '
'; if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo { // Search customer orders - $var = false; print '
'; print ''; print '
'; @@ -88,7 +87,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles * Statistics */ -$sql = "SELECT count(c.rowid), c.fk_statut"; +$sql = "SELECT count(c.rowid) as nb, c.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -117,7 +116,7 @@ if ($resql) //if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1)) { if (! isset($vals[$row[1]])) $vals[$row[1]]=0; - $vals[$row[1].$bool]+=$row[0]; + $vals[$row[1]]+=$row[0]; $totalinprocess+=$row[0]; } $total+=$row[0]; @@ -125,13 +124,32 @@ if ($resql) $i++; } $db->free($resql); + + include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + print '
'; print ''; print ''."\n"; $listofstatus=array(0,1,2,3,-1); foreach ($listofstatus as $status) { - $dataseries[]=array($commandestatic->LibStatut($status, $bool, 1), (isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0)); + $dataseries[] = array($commandestatic->LibStatut($status, 0, 1, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); + if ($status == Commande::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == Commande::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; + if ($status == Commande::STATUS_SHIPMENTONPROCESS) $colorseries[$status] = $badgeStatus4; + if ($status == Commande::STATUS_CLOSED && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) $colorseries[$status] = $badgeStatus6; + if ($status == Commande::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) $colorseries[$status] = $badgeStatus6; + if ($status == Commande::STATUS_CANCELED) $colorseries[$status] = $badgeStatus9; + + if (empty($conf->use_javascript_ajax)) + { + print ''; + print ''; + print ''; + print "\n"; + } } if ($conf->use_javascript_ajax) { @@ -140,6 +158,7 @@ if ($resql) include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); @@ -149,19 +168,6 @@ if ($resql) print ''; } - else - { - foreach ($listofstatus as $status) - { - print ''; - print ''; - print ''; - print "\n"; - } - } //if ($totalinprocess != $total) print ''; print "
'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'
'.$commandestatic->LibStatut($status, 0, 0, 1).''.(isset($vals[$status]) ? $vals[$status] : 0).' '; + print $commandestatic->LibStatut($status, 0, 3, 1); + print '
'.$commandestatic->LibStatut($status, $bool, 0).''.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' '; - print $commandestatic->LibStatut($status, $bool, 3); - print ''; - print '
'.$langs->trans("Total").''.$total.'

"; @@ -202,7 +208,6 @@ if (!empty($conf->commande->enabled)) if ($num) { $i = 0; - $var = true; while ($i < $num) { $obj = $db->fetch_object($resql); @@ -241,7 +246,7 @@ print '
'; $max = 5; /* - * Last modified orders + * Lattest modified orders */ $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,"; @@ -272,7 +277,6 @@ if ($resql) if ($num) { $i = 0; - $var = true; while ($i < $num) { $obj = $db->fetch_object($resql); @@ -320,6 +324,7 @@ if ($resql) } else dol_print_error($db); +$max = 10; /* * Orders to process @@ -335,7 +340,7 @@ if (!empty($conf->commande->enabled)) if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('commande').")"; - $sql .= " AND c.fk_statut = 1"; + $sql .= " AND c.fk_statut = ".Commande::STATUS_VALIDATED; if ($socid) $sql .= " AND c.fk_soc = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " ORDER BY c.rowid DESC"; @@ -344,16 +349,16 @@ if (!empty($conf->commande->enabled)) if ($resql) { $num = $db->num_rows($resql); + print '
'; print ''; print ''; - print ''; + print ''; if ($num) { $i = 0; - $var = true; - while ($i < $num) + while ($i < $num && $i < $max) { $obj = $db->fetch_object($resql); print ''; @@ -395,6 +400,9 @@ if (!empty($conf->commande->enabled)) print ''; $i++; } + if ($i < $num) { + print ''; + } } print "
'.$langs->trans("OrdersToProcess").' '.$num.'
'.$langs->trans("OrdersToProcess").' '.$num.'
'.$langs->trans("More").'...

"; @@ -403,7 +411,7 @@ if (!empty($conf->commande->enabled)) } /* - * Orders thar are in a shipping process + * Orders that are in process */ if (!empty($conf->commande->enabled)) { @@ -416,7 +424,7 @@ if (!empty($conf->commande->enabled)) if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('commande').")"; - $sql .= " AND c.fk_statut = 2 "; + $sql .= " AND c.fk_statut = ".Commande::STATUS_ACCEPTED; if ($socid) $sql .= " AND c.fk_soc = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " ORDER BY c.rowid DESC"; @@ -429,13 +437,12 @@ if (!empty($conf->commande->enabled)) print '
'; print ''; print ''; - print ''; + print ''; if ($num) { $i = 0; - $var = true; - while ($i < $num) + while ($i < $num && $i < $max) { $obj = $db->fetch_object($resql); print ''; @@ -477,6 +484,9 @@ if (!empty($conf->commande->enabled)) print ''; $i++; } + if ($i < $num) { + print ''; + } } print "
'.$langs->trans("OnProcessOrders").' '.$num.'
'.$langs->trans("OnProcessOrders").' '.$num.'
'.$langs->trans("More").'...

"; } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index ef9ee7f2cd7..a8af4262d58 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -830,7 +830,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) { - print ''."\n"; + print ''."\n"; print ''; print $projectstatic->getNomUrl(1, '', 0, $langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); if ($projectstatic->title) @@ -1449,7 +1449,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ if ($val['checked'] && substr($key, 0, 5) == 'efpt.') $addcolspan++; } - print ''."\n"; + print ''."\n"; print ''; print $projectstatic->getNomUrl(1, '', 0, ''.$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); @@ -1797,7 +1797,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) { - print ''."\n"; + print ''."\n"; print ''; print $projectstatic->getNomUrl(1, '', 0, ''.$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 2489104eb34..3ae9866d73f 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -606,8 +606,8 @@ if (!empty($arrayfields['t.progress']['checked'])) /*print ''.$langs->trans("TimeSpent").''; if ($usertoprocess->id == $user->id) print ''.$langs->trans("TimeSpentByYou").''; else print ''.$langs->trans("TimeSpentByUser").'';*/ -print ''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')'; -print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
('.dol_trunc($usertoprocess->firstname, 10).')' : '').''; +print ''.$langs->trans("TimeSpent").'
'.$langs->trans("Everybody").''; +print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.dol_trunc($usertoprocess->firstname, 10).'' : '').''; print ''.$langs->trans("HourStart").''; // By default, we can edit only tasks we are assigned to diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index b5d4bcc633d..7f337818c1d 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -500,8 +500,8 @@ print ''.$langs->trans("ProgressDeclared"). /*print ''.$langs->trans("TimeSpent").''; if ($usertoprocess->id == $user->id) print ''.$langs->trans("TimeSpentByYou").''; else print ''.$langs->trans("TimeSpentByUser").'';*/ -print ''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')'; -print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
('.dol_trunc($usertoprocess->firstname, 10).')' : '').''; +print ''.$langs->trans("TimeSpent").'
'.$langs->trans("Everybody").''; +print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.dol_trunc($usertoprocess->firstname, 10).'' : '').''; foreach ($TWeek as $week_number) { diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 7a153d41631..8b8ba5d7295 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -660,8 +660,8 @@ if (!empty($arrayfields['t.progress']['checked'])) /*print ''.$langs->trans("TimeSpent").''; if ($usertoprocess->id == $user->id) print ''.$langs->trans("TimeSpentByYou").''; else print ''.$langs->trans("TimeSpentByUser").'';*/ -print ''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')'; -print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
('.dol_trunc($usertoprocess->firstname, 10).')' : '').''; +print ''.$langs->trans("TimeSpent").'
'.$langs->trans("Everybody").''; +print ''.$langs->trans("TimeSpent").($usertoprocess->firstname ? '
'.dol_trunc($usertoprocess->firstname, 10).'' : '').''; for ($idw = 0; $idw < 7; $idw++) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5067a4935bc..133f0c1c0a6 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1557,7 +1557,7 @@ if ($action == 'create') print ''; print ''; if ($action == 'editdate_livraison') { - print ''; + print ''; print ''; print ''; print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); @@ -1806,12 +1806,13 @@ if ($action == 'create') if ($action == 'statut') { // Form to set proposal accepted/refused - $form_close = ''; - if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '

'.$langs->trans('SupplierProposalRefFournNotice').'

'; // TODO Suggest a permanent checkbox instead of option + $form_close = ''; $form_close .= ''; + $form_close .= ''; + + if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '

'.$langs->trans('SupplierProposalRefFournNotice').'

'; // TODO Suggest a permanent checkbox instead of option $form_close .= ''; $form_close .= ''; print ''; - print ''; + print ''; print ''; $i++; } diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index 48619dfc7d0..ed609ddbc87 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -1,9 +1,6 @@ -/*
' . $langs->trans("CloseAs") . ''; - $form_close .= ''; $form_close .= ''; print ''."\n"; $listofstatus = array(0, 1, 2, 3, 4); foreach ($listofstatus as $status) { - $dataseries[] = array($supplier_proposalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); - if (!$conf->use_javascript_ajax) - { - print ''; - print ''; - print ''; - print "\n"; - } + $dataseries[] = array($supplier_proposalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); + if ($status == SupplierProposal::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == SupplierProposal::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1; + if ($status == SupplierProposal::STATUS_SIGNED) $colorseries[$status] = $badgeStatus4; + if ($status == SupplierProposal::STATUS_NOTSIGNED) $colorseries[$status] = $badgeStatus9; + if ($status == SupplierProposal::STATUS_CLOSE) $colorseries[$status] = $badgeStatus6; + + if (empty($conf->use_javascript_ajax)) + { + print ''; + print ''; + print ''; + print "\n"; + } } if ($conf->use_javascript_ajax) { @@ -144,6 +153,7 @@ if ($resql) include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index eb1a2450521..2be4ec32f0b 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3224,6 +3224,9 @@ td.evenodd, tr.nohoverpair td, #trlinefordates td { border-bottom: 1pt solid black !important; /* background-color: # !important; */ } +.trforbreak.nobold td a, .trforbreak.nobold span.secondary { + font-weight: normal !important; +} table.dataTable td { padding: 5px 8px 5px 8px !important; From 1ff15e1fd9cd62df84e20209946196aa1586ab5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Mar 2020 13:10:35 +0100 Subject: [PATCH 157/162] FIX All forms must use newToken() --- .../bookkeeping/thirdparty_lettering_customer.php | 2 +- .../bookkeeping/thirdparty_lettering_supplier.php | 2 +- htdocs/adherents/cartes/carte.php | 6 +++--- htdocs/adherents/type.php | 2 +- htdocs/admin/agenda_other.php | 2 +- htdocs/admin/agenda_reminder.php | 2 +- htdocs/admin/clicktodial.php | 2 +- htdocs/admin/fckeditor.php | 2 +- htdocs/bom/bom_card.php | 2 +- htdocs/comm/action/pertype.php | 2 +- htdocs/comm/action/peruser.php | 2 +- htdocs/comm/propal/card.php | 8 ++++---- htdocs/commande/card.php | 8 ++++---- htdocs/compta/cashcontrol/cashcontrol_card.php | 4 ++-- htdocs/compta/facture/card-rec.php | 2 +- htdocs/compta/facture/card.php | 6 +++--- htdocs/core/lib/agenda.lib.php | 2 +- htdocs/expedition/card.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 2 +- htdocs/mrp/mo_card.php | 2 +- htdocs/product/price.php | 8 ++++---- htdocs/reception/card.php | 2 +- htdocs/societe/price.php | 4 ++-- htdocs/supplier_proposal/card.php | 8 ++++---- 24 files changed, 42 insertions(+), 42 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index 1dfb324599c..1a212c00b84 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -197,7 +197,7 @@ if ($resql) { $param="&socid=".$socid; print ''; - print ''; + print ''; print ''; $letteringbutton = ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 5a5a4d36c21..f71b41a9c28 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -195,7 +195,7 @@ if ($resql) { $param="&socid=".$socid; print ''; - print ''; + print ''; print ''; $letteringbutton = ''; diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index e7686a0a055..6736a22cd5d 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -259,7 +259,7 @@ print '
'; print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -279,7 +279,7 @@ print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print ''; -print ''; +print ''; print ''; print ''; print $langs->trans("DescADHERENT_CARD_TYPE").' '; @@ -299,7 +299,7 @@ print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' '; print ''; -print ''; +print ''; print ''; print ''; print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' '; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 99d6cceb296..969117c4bdc 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -607,7 +607,7 @@ if ($rowid > 0) } print ''; - print ''; + print ''; print ''; print '
'; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 5338010772f..4960f044065 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -324,7 +324,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } print ''; -print ''; +print ''; print ''; print '
'.$langs->trans("Statistics").' - '.$langs->trans("CommRequests").'
'.$supplier_proposalstatic->LibStatut($status, 0).''.(isset($vals[$status]) ? $vals[$status] : 0).'
'.$supplier_proposalstatic->LibStatut($status, 0).''.(isset($vals[$status]) ? $vals[$status] : 0).'
'."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 614d4ef4407..b641dd74fe2 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -180,7 +180,7 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action'); print ''; -print ''; +print ''; print ''; print '
'."\n"; diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 03c4eeb66cf..3fb3340a702 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -119,7 +119,7 @@ if (! empty($conf->global->CLICKTODIAL_URL)) if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest'); print ''; - print ''; + print ''; print $langs->trans("LinkToTestClickToDial", $user->login).' : '; print ''; print ''; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index cab7bfaecf0..ad077361fe8 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -185,7 +185,7 @@ else print '
'."\n"; print ''."\n"; - print ''; + print ''; // Skins show_skin(null, 1); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 81b5f858c9b..aedef905b7b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -546,7 +546,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $result = $object->getLinesArray(); print ' - + diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index b1d0ddc7ccc..6dfbc6c7f9c 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -248,7 +248,7 @@ $nav .= "   ('; -$nav .= ''; +$nav .= ''; $nav .= ''; $nav .= ''; $nav .= ''; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index e8f7be097fa..f2cce5c8023 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -289,7 +289,7 @@ $nav .= "   ".$langs->trans("Today").")"; /*$nav.='   '; -$nav.=''; +$nav.=''; $nav.=''; $nav.=''; $nav.=''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9430fce4634..279f72896f5 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1541,7 +1541,7 @@ if ($action == 'create') $object = new Propal($db); print ''; - print ''; + print ''; print ''; if ($origin != 'project' && $originid) { print ''; @@ -2052,7 +2052,7 @@ if ($action == 'create') print ''; print ''; - print ''; + print ''; print ''; $i++; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 1ef8510016c..2c23f578fb4 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1150,7 +1150,7 @@ if ($action == 'create') } else { print ''; } print ''."\n"; @@ -1230,8 +1230,8 @@ if ($action == 'create') print ''; print ''; print ''; @@ -1534,7 +1534,7 @@ if ($action == 'create') print '
'; if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdate' && $usercancreate) { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date, 're', '', '', 0, "editdate"); print ''; @@ -2078,7 +2078,7 @@ if ($action == 'create') print ''; if ($object->statut == Propal::STATUS_DRAFT && $action == 'editecheance' && $usercancreate) { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->fin_validite, 'ech', '', '', '', "editecheance"); print ''; @@ -2412,7 +2412,7 @@ if ($action == 'create') $result = $object->getLinesArray(); print ' - + diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 148fa427fff..10ba69601c1 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1602,7 +1602,7 @@ if ($action == 'create' && $usercancreate) } print ''; - print ''; + print ''; print ''; print ''."\n"; print ''; @@ -2184,7 +2184,7 @@ if ($action == 'create' && $usercancreate) print ''; if ($action == 'editdate') { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date, 'order_', '', '', '', "setdate"); print ''; @@ -2205,7 +2205,7 @@ if ($action == 'create' && $usercancreate) print ''; if ($action == 'editdate_livraison') { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date_livraison ? $object->date_livraison : - 1, 'liv_', '', '', '', "setdate_livraison"); print ''; @@ -2499,7 +2499,7 @@ if ($action == 'create' && $usercancreate) $result = $object->getLinesArray(); print ' - + '; diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 57d81c625fe..8dd3eca5e33 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -363,7 +363,7 @@ if ($action == "create" || $action == "start" || $action == 'close') print load_fiche_titre($langs->trans("CashControl")." - ".$langs->trans("New"), '', 'cash-register'); print ''; - print ''; + print ''; if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; @@ -680,7 +680,7 @@ if (empty($action) || $action == "view" || $action == "close") print '
'; } else { print ''; - print ''; + print ''; if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index dd295fa3112..26eee81375f 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1680,7 +1680,7 @@ else // Lines print ' - + diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 868ccc006d8..fbff955db47 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2854,7 +2854,7 @@ if ($action == 'create') } print ''; - print ''; + print ''; print ''; if ($soc->id > 0) print ''."\n"; print ''; @@ -4459,7 +4459,7 @@ elseif ($id > 0 || !empty($ref)) print '
'; if ($action == 'editrevenuestamp') { print ''; - print ''; + print ''; print ''; print ''; print $formother->select_revenue_stamp('', 'revenuestamp_type', $mysoc->country_code); @@ -4963,7 +4963,7 @@ elseif ($id > 0 || !empty($ref)) } print ' - + diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index dd1810fdf5f..e5d7422cf8a 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -59,7 +59,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh // Filters //print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index b465297fe34..d539835d309 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2012,7 +2012,7 @@ elseif ($id || $ref) if ($action == 'editline') { print ' - + diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index cc87e83d5c0..93eb7560aaa 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -401,7 +401,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $result = $object->getLinesArray(); print ' - + diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 572b5d8a2f7..ca17ce7677e 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -497,7 +497,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $object->fetchLines(); print ' - + diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a6697701a68..3f6a89cbddb 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1151,7 +1151,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se print load_fiche_titre($langs->trans("UpdateVAT"), ''); print ''; - print ''; + print ''; print ''; print ''; @@ -1185,7 +1185,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) { print ''."\n"; print ''; - print ''; + print ''; print ''; print ''; @@ -1660,7 +1660,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print load_fiche_titre($langs->trans('PriceByCustomer')); print ''; - print ''; + print ''; print ''; print ''; @@ -1747,7 +1747,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) } print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index b2723a0ce6a..83a28d55f48 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1610,7 +1610,7 @@ elseif ($id || $ref) if ($action == 'editline') { print ' - + '; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index b65f0486d17..6d69e692a96 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -256,7 +256,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print load_fiche_titre($langs->trans('PriceByCustomer')); print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -334,7 +334,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } print ''; - print ''; + print ''; print ''; print ''; print '
'; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 133f0c1c0a6..8f9a5698a59 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1125,7 +1125,7 @@ if ($action == 'create') $object = new SupplierProposal($db); print ''; - print ''; + print ''; print ''; if ($origin != 'project' && $originid) { print ''; @@ -1558,7 +1558,7 @@ if ($action == 'create') print ''; print ''; - print ''; + + print ''; print ''; $i++; } @@ -314,7 +315,7 @@ else dol_print_error($db); /* - * Opened proposals + * Open proposals */ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { @@ -381,9 +382,10 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) $companystatic->canvas = $obj->canvas; print ''."\n"; - print ''."\n"; + print ''."\n"; + print ''; + print ''."\n"; print ''."\n"; $i++; diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 651ef2862e9..8e1fa07c17a 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -315,7 +315,7 @@ if ($resql) print $companystatic->getNomUrl(1, 'company', 16); print ''; print ''; - print ''; + print ''; print ''; $i++; } @@ -331,7 +331,7 @@ $max = 10; */ if (!empty($conf->commande->enabled)) { - $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; $sql .= ", s.canvas"; @@ -353,7 +353,7 @@ if (!empty($conf->commande->enabled)) print '
'; print '
'; if ($action == 'editdate_livraison') { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); print ''; @@ -1762,7 +1762,7 @@ if ($action == 'create') $result = $object->getLinesArray(); print ' - + @@ -1807,7 +1807,7 @@ if ($action == 'create') { // Form to set proposal accepted/refused $form_close = ''; - $form_close .= ''; + $form_close .= ''; $form_close .= ''; if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '

'.$langs->trans('SupplierProposalRefFournNotice').'

'; // TODO Suggest a permanent checkbox instead of option From d922eb270da70982ce56c2df3f6790a2cb52989e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Mar 2020 13:25:45 +0100 Subject: [PATCH 158/162] FIX actions on supplier proposal not saved (bad trigger name) --- htdocs/supplier_proposal/card.php | 4 ++-- .../class/supplier_proposal.class.php | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 8f9a5698a59..1ef8510016c 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1041,7 +1041,7 @@ if (empty($reshook)) if (!$error) { - $result = $object->insertExtraFields('SUPPLIER_PROPOSAL_MODIFY'); + $result = $object->insertExtraFields('PROPOSAL_SUPPLIER_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -1433,7 +1433,7 @@ if ($action == 'create') require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; $notify = new Notify($db); $text .= '
'; - $text .= $notify->confirmMessage('SUPPLIER_PROPOSAL_VALIDATE', $object->socid, $object); + $text .= $notify->confirmMessage('PROPOSAL_SUPPLIER_VALIDATE', $object->socid, $object); } if (!$error) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 2f38de96c6e..f2371c5f558 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1481,7 +1481,7 @@ class SupplierProposal extends CommonObject if (!$error && !$notrigger) { // Call trigger - $result = $this->call_trigger('SUPPLIER_PROPOSAL_VALIDATE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_VALIDATE', $user); if ($result < 0) { $error++; } // End call triggers } @@ -1683,7 +1683,7 @@ class SupplierProposal extends CommonObject if (!$notrigger) { // Call trigger - $result = $this->call_trigger('SUPPLIER_PROPOSAL_REOPEN', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_REOPEN', $user); if ($result < 0) { $error++; } // End call triggers } @@ -1737,11 +1737,11 @@ class SupplierProposal extends CommonObject if ($resql) { $modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED : $this->modelpdf; - $triggerName = 'SUPPLIER_PROPOSAL_CLOSE_REFUSED'; + $triggerName = 'PROPOSAL_SUPPLIER_CLOSE_REFUSED'; if ($status == 2) { - $triggerName = 'SUPPLIER_PROPOSAL_CLOSE_SIGNED'; + $triggerName = 'PROPOSAL_SUPPLIER_CLOSE_SIGNED'; $modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL : $this->modelpdf; if (!empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists @@ -1751,7 +1751,7 @@ class SupplierProposal extends CommonObject } if ($status == 4) { - $triggerName = 'SUPPLIER_PROPOSAL_CLASSIFY_BILLED'; + $triggerName = 'PROPOSAL_SUPPLIER_CLASSIFY_BILLED'; } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) @@ -1916,7 +1916,7 @@ class SupplierProposal extends CommonObject if (!$error) { // Call trigger - $result = $this->call_trigger('SUPPLIER_PROPOSAL_UNVALIDATE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_UNVALIDATE', $user); if ($result < 0) $error++; } @@ -2034,7 +2034,7 @@ class SupplierProposal extends CommonObject if (!$notrigger) { // Call trigger - $result = $this->call_trigger('SUPPLIER_PROPOSAL_DELETE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_DELETE', $user); if ($result < 0) { $error++; } // End call triggers } From 62fefab5acc70d4d208b5fcef1e0d1691209c698 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Mar 2020 19:06:37 +0100 Subject: [PATCH 159/162] Standardize color of status --- htdocs/comm/propal/index.php | 10 ++- htdocs/commande/index.php | 22 +++-- htdocs/core/lib/functions.lib.php | 21 ++--- .../class/fournisseur.commande.class.php | 26 +++--- htdocs/fourn/commande/index.php | 82 +++++-------------- htdocs/supplier_proposal/card.php | 10 +-- .../class/supplier_proposal.class.php | 4 +- htdocs/supplier_proposal/index.php | 2 +- htdocs/theme/eldy/badges.inc.php | 26 +++--- htdocs/theme/eldy/theme_vars.inc.php | 8 +- 10 files changed, 93 insertions(+), 118 deletions(-) diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 66f4aa94fd2..a931af375c5 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -302,7 +302,8 @@ if ($resql) print '
'.$companystatic->getNomUrl(1, 'customer').''.dol_print_date($db->jdate($obj->datec), 'day').''.$propalstatic->LibStatut($obj->fk_statut, 5).''.$propalstatic->LibStatut($obj->fk_statut, 3).'
'.$companystatic->getNomUrl(1, 'customer', 44).''; - print dol_print_date($db->jdate($obj->dp), 'day').''.dol_print_date($db->jdate($obj->dp), 'day').''.price($obj->total_ttc).''.$propalstatic->LibStatut($obj->fk_statut, 3).'
'.dol_print_date($db->jdate($obj->datem), 'day').''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 5).''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).'
'; print ''; - print ''; + print ''; if ($num) { @@ -395,13 +395,15 @@ if (!empty($conf->commande->enabled)) print $companystatic->getNomUrl(1, 'company', 24); print ''; - print ''; + print ''."\n"; + + print ''; print ''; $i++; } if ($i < $num) { - print ''; + print ''; } } @@ -415,7 +417,7 @@ if (!empty($conf->commande->enabled)) */ if (!empty($conf->commande->enabled)) { - $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid"; + $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql .= ", s.client"; $sql .= ", s.code_client"; $sql .= ", s.canvas"; @@ -437,7 +439,7 @@ if (!empty($conf->commande->enabled)) print '
'; print '
'.$langs->trans("OrdersToProcess").' '.$num.'
'.$langs->trans("OrdersToProcess").' '.$num.'
'.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 5).''.dol_print_date($db->jdate($obj->date), 'day').''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).'
'.$langs->trans("More").'...
'.$langs->trans("More").'...
'; print ''; - print ''; + print ''; if ($num) { @@ -479,13 +481,15 @@ if (!empty($conf->commande->enabled)) print $companystatic->getNomUrl(1, 'company'); print ''; - print ''; + print ''."\n"; + + print ''; print ''; $i++; } if ($i < $num) { - print ''; + print ''; } } print "
'.$langs->trans("OnProcessOrders").' '.$num.'
'.$langs->trans("OnProcessOrders").' '.$num.'
'.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 5).''.dol_print_date($db->jdate($obj->date), 'day').''.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).'
'.$langs->trans("More").'...
'.$langs->trans("More").'...

"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9f244722a8f..3a3e0c33543 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3305,6 +3305,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ } // If we ask an image into $url/$mymodule/img (instead of default path) + $regs = array(); if (preg_match('/^([^@]+)@([^@]+)$/i', $picto, $regs)) { $picto = $regs[1]; $path = $regs[2]; // $path is $mymodule @@ -8425,16 +8426,16 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st // For backward compatibility. Image's filename are still in French, so we use this array to convert $statusImg = array( - 'status0' => 'statut0' - ,'status1' => 'statut1' - ,'status2' => 'statut2' - ,'status3' => 'statut3' - ,'status4' => 'statut4' - ,'status5' => 'statut5' - ,'status6' => 'statut6' - ,'status7' => 'statut7' - ,'status8' => 'statut8' - ,'status9' => 'statut9' + 'status0' => 'statut0', + 'status1' => 'statut1', + 'status2' => 'statut2', + 'status3' => 'statut3', + 'status4' => 'statut4', + 'status5' => 'statut5', + 'status6' => 'statut6', + 'status7' => 'statut7', + 'status8' => 'statut8', + 'status9' => 'statut9' ); if (!empty($statusImg[$statusType])) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 797e3693614..9906a679ce1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -104,6 +104,8 @@ class CommandeFournisseur extends CommonOrder // Note: billed or not is on another field "billed" public $statuts; // List of status + public $billed; + public $socid; public $fourn_id; public $date; @@ -354,6 +356,7 @@ class CommandeFournisseur extends CommonOrder $this->socid = $obj->fk_soc; $this->fourn_id = $obj->fk_soc; $this->statut = $obj->fk_statut; + $this->status = $obj->fk_statut; $this->billed = $obj->billed; $this->user_author_id = $obj->fk_user_author; $this->user_valid_id = $obj->fk_user_valid; @@ -694,7 +697,7 @@ class CommandeFournisseur extends CommonOrder * Return label of a status * * @param int $status Id statut - * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @param int $billed 1=Billed * @return string Label of status */ @@ -731,14 +734,14 @@ class CommandeFournisseur extends CommonOrder $statustrans = array( 0 => 'status0', - 1 => 'status1', - 2 => 'status3', - 3 => 'status3', - 4 => 'status3', - 5 => 'status4', - 6 => 'status5', - 7 => 'status5', - 9 => 'status5', + 1 => 'status1b', + 2 => 'status1', + 3 => 'status4', + 4 => 'status4b', + 5 => 'status6', + 6 => 'status9', + 7 => 'status9', + 9 => 'status9', ); $statusClass = 'status0'; @@ -747,9 +750,10 @@ class CommandeFournisseur extends CommonOrder } $billedtext = ''; - if ($mode == 4 && $billed) { - $billedtext = ' - '.$langs->trans("Billed"); + if ($billed) { + $billedtext = ' - '.$langs->trans("Billed"); } + if ($status == 5 && $billed) $statusClass = 'status6'; $statusLong = $langs->trans($this->statuts[$status]).$billedtext; $statusShort = $langs->trans($this->statutshort[$status]); diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index d1d102e55ea..fd14deabb43 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -76,7 +76,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles * Statistics */ -$sql = "SELECT count(cf.rowid), fk_statut"; +$sql = "SELECT count(cf.rowid) as nb, fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -93,7 +93,6 @@ if ($resql) $i = 0; $total = 0; - $totalinprocess = 0; $dataseries = array(); $vals = array(); // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially @@ -101,27 +100,36 @@ if ($resql) // -> 6=Canceled -> (reopen) 2=Approved while ($i < $num) { - $row = $db->fetch_row($resql); - if ($row) + $obj = $db->fetch_object($resql); + if ($obj) { - if ($row[1] != 7 && $row[1] != 6 && $row[1] != 5) - { - $vals[$row[1]] = $row[0]; - $totalinprocess += $row[0]; - } - $total += $row[0]; + $vals[($obj->status == CommandeFournisseur::STATUS_CANCELED_AFTER_ORDER ? CommandeFournisseur::STATUS_CANCELED : $obj->status)] = $obj->nb; + + $total += $obj->nb; } $i++; } $db->free($resql); + include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + print '
'; print ''; print ''; print "\n"; - foreach (array(0, 1, 2, 3, 4, 5, 6) as $status) + $listofstatus=array(0, 1, 2, 3, 4, 5, 6, 9); + foreach ($listofstatus as $status) { $dataseries[] = array($commandestatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0)); + if ($status == CommandeFournisseur::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0; + if ($status == CommandeFournisseur::STATUS_VALIDATED) $colorseries[$status] = '-'.$badgeStatus1; + if ($status == CommandeFournisseur::STATUS_ACCEPTED) $colorseries[$status] = $badgeStatus1; + if ($status == CommandeFournisseur::STATUS_REFUSED) $colorseries[$status] = $badgeStatus9; + if ($status == CommandeFournisseur::STATUS_ORDERSENT) $colorseries[$status] = $badgeStatus4; + if ($status == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY) $colorseries[$status] = '-'.$badgeStatus4; + if ($status == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $colorseries[$status] = $badgeStatus6; + if ($status == CommandeFournisseur::STATUS_CANCELED || $status == CommandeFournisseur::STATUS_CANCELED_AFTER_ORDER) $colorseries[$status] = $badgeStatus9; + if (!$conf->use_javascript_ajax) { print ''; @@ -137,6 +145,7 @@ if ($resql) include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); + $dolgraph->SetDataColor(array_values($colorseries)); $dolgraph->setShowLegend(2); $dolgraph->setShowPercent(1); $dolgraph->SetType(array('pie')); @@ -157,53 +166,6 @@ else dol_print_error($db); } -/* - * Legends / Status - */ - -$sql = "SELECT count(cf.rowid) as nb, cf.fk_statut"; -$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " WHERE cf.fk_soc = s.rowid"; -$sql .= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing -if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid; -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; -$sql .= " GROUP BY cf.fk_statut"; - -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - - print '
'; - print '
'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'
'; - - print ''; - print ''; - print "\n"; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - print ''; - print ''; - print ''; - - print "\n"; - $i++; - } - print "
'.$langs->trans("Status").''.$langs->trans("Nb").'
'.$commandestatic->LibStatut($obj->nb).''.$obj->nb.' '.$commandestatic->LibStatut($obj->fk_statut, 3).'

"; - $db->free($resql); -} -else -{ - dol_print_error($db); -} - - /* * Draft orders */ @@ -322,7 +284,7 @@ print '
'; */ $max = 5; -$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.tms, s.nom as name, s.rowid as socid"; +$sql = "SELECT c.rowid, c.ref, c.fk_statut as status, c.tms, c.billed, s.nom as name, s.rowid as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -376,7 +338,7 @@ if ($resql) print '
'.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.''.dol_print_date($db->jdate($obj->tms), 'day').''.$commandestatic->LibStatut($obj->fk_statut, 5).''.$commandestatic->LibStatut($obj->status, 3, $obj->billed).'
'; print $form->select_company('', 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); - print ' '.$langs->trans("AddThirdParty").''; + print ' '; print '
'.$langs->trans("Project").''; - $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">'.$langs->trans("AddProject").''; + $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); + print '   id).'">'; print '
'; - if ($action != 'editconditions' && $object->statut == SupplierProposal::STATUS_DRAFT) + if ($action != 'editconditions' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'
'; print '
'; @@ -1575,7 +1575,7 @@ if ($action == 'create') print ''; - if ($action != 'editmode' && $object->statut == $object::STATUS_VALIDATED) + if ($action != 'editmode' && $object->statut != SupplierProposal::STATUS_NOTSIGNED) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'
'; print '
'; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f2371c5f558..d1d3b08bc2d 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 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 @@ -2233,7 +2233,7 @@ class SupplierProposal extends CommonObject if ($status == self::STATUS_DRAFT) $statusnew = 'status0'; elseif ($status == self::STATUS_VALIDATED) $statusnew = 'status1'; elseif ($status == self::STATUS_SIGNED) $statusnew = 'status4'; - elseif ($status == self::STATUS_NOTSIGNED) $statusnew = 'status5'; + elseif ($status == self::STATUS_NOTSIGNED) $statusnew = 'status9'; elseif ($status == self::STATUS_CLOSE) $statusnew = 'status6'; return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusnew, $mode); diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 89663883084..b0c589010aa 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -292,7 +292,7 @@ if ($resql) print ''.$companystatic->getNomUrl(1, 'customer').''.dol_print_date($db->jdate($obj->datec), 'day').''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 5).''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 3).'