From f68c3c17aaaddd90703a3341ad9aed6f110438c1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 21 Oct 2021 15:50:04 +0200 Subject: [PATCH 001/117] fix php warning --- htdocs/core/extrafieldsinexport.inc.php | 2 +- htdocs/core/modules/modSociete.class.php | 21 +++++++++++++++++++ .../societe/mod_codeclient_elephant.php | 4 ++-- htdocs/societe/admin/societe.php | 6 +++--- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 70dd0077e57..fc2210eabd8 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -48,7 +48,7 @@ if ($resql) { // This can fail when class is used on old database (during mig case 'sellist': $tmp = ''; $tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) { + if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { $tmpkeys = array_keys($tmpparam['options']); $tmp = array_shift($tmpkeys); } diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index c3eba65673b..2cba93e29b7 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -121,6 +121,27 @@ class modSociete extends DolibarrModules $this->const[$r][4] = 0; $r++; + $this->const[$r][0] = "SOCIETE_SHOW_VAT_IN_LIST"; + $this->const[$r][1] = "yesno"; + $this->const[$r][2] = "0"; + $this->const[$r][3] = "Display customer ref into select list"; + $this->const[$r][4] = 0; + $r++; + + $this->const[$r][0] = "COMPANY_USE_SEARCH_TO_SELECT"; + $this->const[$r][1] = "yesno"; + $this->const[$r][2] = "0"; + $this->const[$r][3] = "Use easy find customer"; + $this->const[$r][4] = 0; + $r++; + + $this->const[$r][0] = "CONTACT_USE_SEARCH_TO_SELECT"; + $this->const[$r][1] = "yesno"; + $this->const[$r][2] = "0"; + $this->const[$r][3] = "use easy find contact"; + $this->const[$r][4] = 0; + $r++; + // Boxes $this->boxes = array( 0=>array('file'=>'box_clients.php', 'enabledbydefaulton'=>'Home'), diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index c18b768a724..8bb3a7bb2a1 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -132,7 +132,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode // Parametrage du prefix customers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -140,7 +140,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode // Parametrage du prefix suppliers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("SupplierCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 18bc3a3785b..536eb0546cc 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -746,7 +746,7 @@ if (!$conf->use_javascript_ajax) { '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', ); - print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); + print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'COMPANY_USE_SEARCH_TO_SELECT')?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print ''; print ''; print ""; @@ -767,7 +767,7 @@ if (!$conf->use_javascript_ajax) { '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', ); - print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); + print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'CONTACT_USE_SEARCH_TO_SELECT')?$conf->global->CONTACT_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print ''; print ''; print ""; @@ -870,7 +870,7 @@ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { print ''; print ''.$langs->trans("DefaultCustomerType").''; print ''; - print $formcompany->selectProspectCustomerType($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT, 'defaultcustomertype', 'defaultcustomertype', 'admin'); + print $formcompany->selectProspectCustomerType((property_exists($conf->global, 'THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')?$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT:''), 'defaultcustomertype', 'defaultcustomertype', 'admin'); print ''; print ''; print ''; From 3f211417c2218b927b31a1c3335d7797f3265182 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 22 Oct 2021 12:19:16 +0200 Subject: [PATCH 002/117] review --- htdocs/core/modules/modSociete.class.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 2cba93e29b7..c3eba65673b 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -121,27 +121,6 @@ class modSociete extends DolibarrModules $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "SOCIETE_SHOW_VAT_IN_LIST"; - $this->const[$r][1] = "yesno"; - $this->const[$r][2] = "0"; - $this->const[$r][3] = "Display customer ref into select list"; - $this->const[$r][4] = 0; - $r++; - - $this->const[$r][0] = "COMPANY_USE_SEARCH_TO_SELECT"; - $this->const[$r][1] = "yesno"; - $this->const[$r][2] = "0"; - $this->const[$r][3] = "Use easy find customer"; - $this->const[$r][4] = 0; - $r++; - - $this->const[$r][0] = "CONTACT_USE_SEARCH_TO_SELECT"; - $this->const[$r][1] = "yesno"; - $this->const[$r][2] = "0"; - $this->const[$r][3] = "use easy find contact"; - $this->const[$r][4] = 0; - $r++; - // Boxes $this->boxes = array( 0=>array('file'=>'box_clients.php', 'enabledbydefaulton'=>'Home'), From b94d74f194e0b96aa9f382b94a0cdb00242e2650 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 22 Oct 2021 14:58:09 +0200 Subject: [PATCH 003/117] fix php8 warning --- .../tpl/extrafields_list_print_fields.tpl.php | 3 +++ htdocs/societe/consumption.php | 24 ++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 7d547d52dea..280be4de434 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -50,6 +50,9 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); print ''; if (!$i) { + if (empty($totalarray)) { + $totalarray['nbfield'] = 0; + } $totalarray['nbfield']++; } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index c4bd26e1fc2..bbaf9e1c5de 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -50,6 +50,8 @@ $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'); +$optioncss = GETPOST('optioncss', 'alpha'); + if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 @@ -160,16 +162,16 @@ if ($object->client) { $obj = $db->fetch_object($resql); $nbFactsClient = $obj->nb; $thirdTypeArray['customer'] = $langs->trans("customer"); - if ($conf->propal->enabled && $user->rights->propal->lire) { + if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); } - if ($conf->commande->enabled && $user->rights->commande->lire) { + if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); } - if ($conf->facture->enabled && $user->rights->facture->lire) { + if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { $elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices'); } - if ($conf->contrat->enabled && $user->rights->contrat->lire) { + if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) { $elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts'); } } @@ -232,7 +234,7 @@ $sql_select = ''; if ($type_element == 'fichinter') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; $documentstatic = new Fichinter($db); - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, '; + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, NULL as paid,'; $tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines. $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where .= " AND f.entity = ".$conf->entity; @@ -254,7 +256,7 @@ if ($type_element == 'invoice') { // Customer : show products from invoices if ($type_element == 'propal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $documentstatic = new Propal($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, NULL as paid,'; $tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where .= " AND d.fk_propal = c.rowid"; @@ -266,7 +268,7 @@ if ($type_element == 'propal') { if ($type_element == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $documentstatic = new Commande($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, NULL as paid, '; $tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where .= " AND d.fk_commande = c.rowid"; @@ -290,7 +292,7 @@ if ($type_element == 'supplier_invoice') { // Supplier : Show products from inv if ($type_element == 'supplier_proposal') { require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; $documentstatic = new SupplierProposal($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, NULL as paid, '; $tables_from = MAIN_DB_PREFIX."supplier_proposal as c,".MAIN_DB_PREFIX."supplier_proposaldet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where .= " AND d.fk_supplier_proposal = c.rowid"; @@ -302,7 +304,7 @@ if ($type_element == 'supplier_proposal') { if ($type_element == 'supplier_order') { // Supplier : Show products from orders. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $documentstatic = new CommandeFournisseur($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, NULL as paid, '; $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where .= " AND d.fk_commande = c.rowid"; @@ -315,7 +317,7 @@ if ($type_element == 'contract') { // Order require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $documentstatic = new Contrat($db); $documentstaticline = new ContratLigne($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, NULL as paid,'; $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where .= " AND d.fk_contrat = c.rowid"; @@ -423,7 +425,7 @@ if ($sql_select) { if ($year) { $param .= "&year=".urlencode($year); } - if ($optioncss != '') { + if ($optioncss) { $param .= '&optioncss='.urlencode($optioncss); } From 5d0f5439a063ff89d65ed822d553d47a4c251d9a Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 22 Oct 2021 14:59:48 +0200 Subject: [PATCH 004/117] fix php8 warning --- htdocs/societe/consumption.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index bbaf9e1c5de..9f6a444dc63 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -221,6 +221,7 @@ print '
'; print ''; $sql_select = ''; +$documentstaticline = ''; /*if ($type_element == 'action') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -343,7 +344,7 @@ if (!empty($sql_select)) { $sql .= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; } if ($type_element != 'fichinter') { - $sql .= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; + $sql .= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity, NULL as total_ht'; } $sql .= " s.rowid as socid "; if ($type_element != 'fichinter') { @@ -654,7 +655,7 @@ if ($sql_select) { $total_qty += $objp->prod_qty; print ''.price($objp->total_ht).''; - $total_ht += $objp->total_ht; + $total_ht += (float) $objp->total_ht; print ''.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).''; From 5faf5e08b36c0b14db5b176b5b1efb5fb50e5d37 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 22 Oct 2021 15:09:34 +0200 Subject: [PATCH 005/117] fix php8 warning --- htdocs/societe/consumption.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 9f6a444dc63..d9abbd61c22 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -235,7 +235,8 @@ $documentstaticline = ''; if ($type_element == 'fichinter') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; $documentstatic = new Fichinter($db); - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, NULL as paid,'; + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, NULL as paid, '; + $sql_select .= 'NULL as fk_product, NULL as info_bits, NULL as date_start, NULL as date_end, NULL as prod_qty, NULL as total_ht, '; $tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines. $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where .= " AND f.entity = ".$conf->entity; @@ -245,7 +246,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices if ($type_element == 'invoice') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $documentstatic = new Facture($db); - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, '; + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, d.fk_remise_except, '; $tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid); $where .= " AND d.fk_facture = f.rowid"; @@ -344,7 +345,7 @@ if (!empty($sql_select)) { $sql .= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, '; } if ($type_element != 'fichinter') { - $sql .= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity, NULL as total_ht'; + $sql .= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity, '; } $sql .= " s.rowid as socid "; if ($type_element != 'fichinter') { @@ -570,6 +571,7 @@ if ($sql_select) { description) { + require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) { $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); @@ -655,6 +657,9 @@ if ($sql_select) { $total_qty += $objp->prod_qty; print ''.price($objp->total_ht).''; + if (empty($total_ht)) { + $total_ht = 0; + } $total_ht += (float) $objp->total_ht; print ''.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).''; From 87ac58efb66d526fac07017c42de4627c9cf1d3f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 22 Oct 2021 15:27:36 +0200 Subject: [PATCH 006/117] fix php 8 --- htdocs/core/lib/pdf.lib.php | 20 +++++++++---------- .../bank/doc/pdf_sepamandate.modules.php | 2 +- htdocs/document.php | 1 + htdocs/societe/paymentmodes.php | 18 +++++++++-------- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e9b2e558595..420921bcc9e 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1045,7 +1045,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $line2 .= ($line2 ? " - " : "").$fromcompany->email; } } - if ($showdetails == 2 || $showdetails == 3 || ($fromcompany->country_code == 'DE')) { + if ($showdetails == 2 || $showdetails == 3 || (!empty($fromcompany->country_code) && $fromcompany->country_code == 'DE')) { // Managers if ($fromcompany->managers) { $line2 .= ($line2 ? " - " : "").$fromcompany->managers; @@ -1054,11 +1054,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Line 3 of company infos // Juridical status - if ($fromcompany->forme_juridique_code) { + if (!empty($fromcompany->forme_juridique_code) && $fromcompany->forme_juridique_code) { $line3 .= ($line3 ? " - " : "").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); } // Capital - if ($fromcompany->capital) { + if (!empty($fromcompany->capital) && $fromcompany->capital) { $tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) { $line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency)); @@ -1067,7 +1067,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } } // Prof Id 1 - if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) { + if (!empty($fromcompany->idprof1) && $fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) { $field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code); if (preg_match('/\((.*)\)/i', $field, $reg)) { $field = $reg[1]; @@ -1075,7 +1075,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $line3 .= ($line3 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1); } // Prof Id 2 - if ($fromcompany->idprof2) { + if (!empty($fromcompany->idprof2) && $fromcompany->idprof2) { $field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code); if (preg_match('/\((.*)\)/i', $field, $reg)) { $field = $reg[1]; @@ -1085,7 +1085,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Line 4 of company infos // Prof Id 3 - if ($fromcompany->idprof3) { + if (!empty($fromcompany->idprof3) && $fromcompany->idprof3) { $field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code); if (preg_match('/\((.*)\)/i', $field, $reg)) { $field = $reg[1]; @@ -1093,7 +1093,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3); } // Prof Id 4 - if ($fromcompany->idprof4) { + if (!empty($fromcompany->idprof4) && $fromcompany->idprof4) { $field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code); if (preg_match('/\((.*)\)/i', $field, $reg)) { $field = $reg[1]; @@ -1101,7 +1101,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4); } // Prof Id 5 - if ($fromcompany->idprof5) { + if (!empty($fromcompany->idprof5) && $fromcompany->idprof5) { $field = $outputlangs->transcountrynoentities("ProfId5", $fromcompany->country_code); if (preg_match('/\((.*)\)/i', $field, $reg)) { $field = $reg[1]; @@ -1109,7 +1109,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof5); } // Prof Id 6 - if ($fromcompany->idprof6) { + if (!empty($fromcompany->idprof6) && $fromcompany->idprof6) { $field = $outputlangs->transcountrynoentities("ProfId6", $fromcompany->country_code); if (preg_match('/\((.*)\)/i', $field, $reg)) { $field = $reg[1]; @@ -1117,7 +1117,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof6); } // IntraCommunautary VAT - if ($fromcompany->tva_intra != '') { + if (!empty($fromcompany->tva_intra) && $fromcompany->tva_intra != '') { $line4 .= ($line4 ? " - " : "").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra); } diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 49e311f1c89..2259897f044 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -282,7 +282,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $sepaname = '______________________________________________'; if ($thirdparty->id > 0) { - $sepaname = $thirdparty->name.($object->account_owner ? ' ('.$object->account_owner.')' : ''); + $sepaname = $thirdparty->name.($object->proprio ? ' ('.$object->proprio.')' : ''); } $posY = $pdf->GetY(); $posY += 3; diff --git a/htdocs/document.php b/htdocs/document.php index 3c06801c9a0..611517b0258 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -138,6 +138,7 @@ if (in_array($modulepart, array('facture_paiement', 'unpaid'))) { */ // If we have a hash public (hashp), we guess the original_file. +$ecmfile=''; if (!empty($hashp)) { include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; $ecmfile = new EcmFiles($db); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 6a0b9fac742..d1bf19b069d 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -773,16 +773,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $obj = $db->fetch_object($resql); $nbFactsClient = $obj->nb; $thirdTypeArray['customer'] = $langs->trans("customer"); - if ($conf->propal->enabled && $user->rights->propal->lire) { + if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); } - if ($conf->commande->enabled && $user->rights->commande->lire) { + if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); } - if ($conf->facture->enabled && $user->rights->facture->lire) { + if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { $elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices'); } - if ($conf->contrat->enabled && $user->rights->contrat->lire) { + if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) { $elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts'); } @@ -1304,7 +1304,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } print_liste_field_titre("DefaultRIB", '', '', '', '', '', '', '', 'center '); print_liste_field_titre('', '', '', '', '', '', '', '', 'center '); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch '); print "\n"; foreach ($rib_list as $rib) { @@ -1393,7 +1393,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $out = ''; if (is_array($modellist) && count($modellist)) { - $out .= ''; + $out .= 'global->MAIN_JUMP_TAG) ? '' : '#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">'; $out .= ''; $out .= ''; $out .= ''; @@ -1407,14 +1407,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $modelselected = $conf->global->BANKADDON_PDF; } - $out .= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + $out .= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100'); $out .= ajax_combobox('modelrib'.$rib->id); + $allowgenifempty = 0; + // Language code (if multilang) if ($conf->global->MAIN_MULTILANGS) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - $defaultlang = $codelang ? $codelang : $langs->getDefaultLang(); + $defaultlang = $langs->getDefaultLang(); $morecss = 'maxwidth150'; if ($conf->browser->layout == 'phone') { $morecss = 'maxwidth100'; From 3d8a5d745a87f774e2d635ea3ee6dbe2de727ff1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 22 Oct 2021 17:42:57 +0200 Subject: [PATCH 007/117] fix php 8 warning --- htdocs/ticket/list.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 04e411b54a6..666758a907a 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -390,7 +390,11 @@ foreach ($search as $key => $val) { } continue; } - $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + if (array_key_exists($key, $object->fields)) { + $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); + } else { + $mode_search = 0; + } if ($search[$key] != '') { $sql .= natural_search($key, $search[$key], $mode_search); } @@ -912,6 +916,7 @@ if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_a // -------------------------------------------------------------------- $i = 0; $totalarray = array(); +$totalarray['nbfield']=0; $cacheofoutputfield = array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -946,15 +951,17 @@ while ($i < min($num, $limit)) { } if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; From 1f1e01aa88ee4a7bc72184cbeedf2f6585dedf04 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 22 Oct 2021 23:38:35 +0200 Subject: [PATCH 008/117] fix php 8 warning --- htdocs/comm/action/card.php | 2 +- htdocs/contact/list.php | 1 + htdocs/product/card.php | 7 ++-- htdocs/product/fournisseurs.php | 57 ++++++++++++++++++--------------- 4 files changed, 37 insertions(+), 30 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index e56a2e89fcf..f852d7e9938 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -2207,7 +2207,7 @@ if ($id > 0) { $delallowed = $user->rights->agenda->myactions->create; - print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $object->default_lang); + print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $langs->getDefaultLang()); print '
'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 71e888540b2..3808c651cae 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1019,6 +1019,7 @@ print "\n"; $i = 0; $totalarray = array(); +$totalarray['nbfield'] = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b4c951a953f..ce633975af8 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2175,8 +2175,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ManageLotSerial").''; print $object->getLibStatut(0, 2); print ''; - if ((($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') - || ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) { + if ((($object->status_batch == '1' && !empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') + || ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && !empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)))) { print ''.$langs->trans("ManageLotMask").''; print $object->batch_mask; print ''; @@ -2686,7 +2686,6 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') { // Documents $objectref = dol_sanitizeFileName($object->ref); - $relativepath = $comref.'/'.$objectref.'.pdf'; if (!empty($conf->product->multidir_output[$object->entity])) { $filedir = $conf->product->multidir_output[$object->entity].'/'.$objectref; //Check repertories of current entities } else { @@ -2696,7 +2695,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') { $genallowed = $usercanread; $delallowed = $usercancreate; - print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); + print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $langs->getDefaultLang(), '', $object); $somethingshown = $formfile->numoffiles; print '
'; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index a3ae38184e9..02e0211c01d 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -931,7 +931,7 @@ END; 'pfp.fk_availability'=>array('label'=>$langs->trans("Availability"), 'enabled' => !empty($conf->global->FOURN_PRODUCT_AVAILABILITY), 'checked'=>0, 'position'=>4), 'pfp.quantity'=>array('label'=>$langs->trans("QtyMin"), 'checked'=>1, 'position'=>5), 'pfp.unitprice'=>array('label'=>$langs->trans("UnitPriceHT"), 'checked'=>1, 'position'=>9), - 'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => $conf->multicurrency->enabled, 'checked'=>0, 'position'=>10), + 'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => (!empty($conf->multicurrency->enabled)), 'checked'=>0, 'position'=>10), 'pfp.delivery_time_days'=>array('label'=>$langs->trans("NbDaysToDelivery"), 'checked'=>1, 'position'=>13), 'pfp.supplier_reputation'=>array('label'=>$langs->trans("ReputationForThisProduct"), 'checked'=>1, 'position'=>14), 'pfp.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => $conf->barcode->enabled, 'checked'=>0, 'position'=>15), @@ -942,14 +942,19 @@ END; // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label("product_fournisseur_price"); - $extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; + if ($extrafields->attributes["product_fournisseur_price"] && array_key_exists('label', $extrafields->attributes["product_fournisseur_price"])) { + $extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; - if (!empty($extralabels)) { - foreach ($extralabels as $key => $value) { - // Show field if not hidden - if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { - $extratitle = $langs->trans($value); - $arrayfields['ef.'.$key] = array('label'=>$extratitle, 'checked'=>0, 'position'=>(end($arrayfields)['position'] + 1), 'langfile'=>$extrafields->attributes["product_fournisseur_price"]['langfile'][$key], 'help'=>$extrafields->attributes["product_fournisseur_price"]['help'][$key]); + if (!empty($extralabels)) { + foreach ($extralabels as $key => $value) { + // Show field if not hidden + if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { + $extratitle = $langs->trans($value); + $arrayfields['ef.' . $key] = array('label' => $extratitle, 'checked' => 0, + 'position' => (end($arrayfields)['position'] + 1), + 'langfile' => $extrafields->attributes["product_fournisseur_price"]['langfile'][$key], + 'help' => $extrafields->attributes["product_fournisseur_price"]['help'][$key]); + } } } } @@ -1023,29 +1028,31 @@ END; // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label("product_fournisseur_price"); - $extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; + if ($extrafields->attributes["product_fournisseur_price"] && array_key_exists('label', $extrafields->attributes["product_fournisseur_price"])) { + $extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; - if (!empty($extralabels)) { - foreach ($extralabels as $key => $value) { - // Show field if not hidden - if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { - if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) { - $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); - } - if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) { - $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); - } else { - $extratitle = $langs->trans($value); - } - if (!empty($arrayfields['ef.'.$key]['checked'])) { - print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.'.$key, '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($extralabels)) { + foreach ($extralabels as $key => $value) { + // Show field if not hidden + if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { + if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) { + $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); + } + if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) { + $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); + } else { + $extratitle = $langs->trans($value); + } + if (!empty($arrayfields['ef.' . $key]['checked'])) { + print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.' . $key, '', $param, '', $sortfield, $sortorder, 'right '); + } } } } } if (is_object($hookmanager)) { - $parameters = array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id); + $parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); } print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); @@ -1213,7 +1220,7 @@ END; } if (is_object($hookmanager)) { - $parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>$id_fourn, 'prod_id'=>$object->id); + $parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); } From ede0c60e2e5add07107e665f4fc8dbf3f72c386a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 13:50:22 +0200 Subject: [PATCH 009/117] fix not defined --- htdocs/projet/tasks/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 53b1a85e889..512b0adc7d0 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -604,7 +604,7 @@ print ''; print ''; print ''; print ''; -print ''; +// print ''; print ''; // Show description of content From 3765a89283a815bc4f30cef1359fcaaf26922af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 13:57:04 +0200 Subject: [PATCH 010/117] fix warnings in task list --- htdocs/projet/tasks/list.php | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 53b1a85e889..1d7d967c20c 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -67,8 +67,9 @@ $search_task_user = GETPOST('search_task_user', 'int'); $search_task_progress = GETPOST('search_task_progress'); $search_task_budget_amount = GETPOST('search_task_budget_amount'); $search_societe = GETPOST('search_societe'); +$search_opp_status = GETPOST("search_opp_status", 'alpha'); -$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0; +$mine = (GETPOSTISSET('mode') && GETPOST('mode', 'alpha') == 'mine') ? 1 : 0; if ($mine) { $search_task_user = $user->id; $mine = 0; } @@ -346,7 +347,7 @@ $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; } -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; } if ($search_project_user > 0) { @@ -864,7 +865,29 @@ if (!empty($arrayfields['t.billed']['checked'])) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$totalarray = array(); +$totalarray['nbfield'] = 0; +$totalarray['val'] = array(); +$totalarray['val']['t.planned_workload'] = 0; +$totalarray['val']['t.duration_effective'] = 0; +$totalarray['val']['t.progress'] = 0; +$totalarray['val']['t.budget_amount'] = 0; +$totalarray['totalplannedworkload'] = 0; +$totalarray['totaldurationeffective'] = 0; +$totalarray['totaldurationdeclared'] = 0; +$totalarray['totaltobillfield'] = array(); +$totalarray['totalbilledfield'] = 0; +$totalarray['totalbudget_amountfield'] = 0; +$totalarray['totalbudgetamount'] = 0; +$totalarray['totaltobill'] = 0; +$totalarray['totalbilled'] = 0; +$parameters = array( + 'arrayfields'=>$arrayfields, + 'param'=>$param, + 'sortfield'=>$sortfield, + 'sortorder'=>$sortorder, + 'totalarray' => $totalarray, +); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['t.datec']['checked'])) { @@ -887,7 +910,6 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) { } $i = 0; -$totalarray = array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -1148,7 +1170,7 @@ while ($i < min($num, $limit)) { } $totalarray['val']['t.budget_amount'] += $obj->budget_amount; if (!$i) { - $totalarray['totalbudget_amount'] = $totalarray['nbfield']; + $totalarray['totalbudget_amountfield'] = $totalarray['nbfield']; } $totalarray['totalbudgetamount'] += $obj->budget_amount; print ''; @@ -1269,7 +1291,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota print ''.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).''; } elseif ($totalarray['totalbilledfield'] == $i) { print ''.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).''; - } elseif ($totalarray['totalbudget_amount'] == $i) { + } elseif ($totalarray['totalbudget_amountfield'] == $i) { print ''.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).''; } else { print ''; From 5ef5075f8fb4ea705be1971e6e56f44b380ddbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 14:00:05 +0200 Subject: [PATCH 011/117] fix warnings in task list --- htdocs/projet/tasks/list.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 1d7d967c20c..fa9d18bf2a5 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -69,9 +69,10 @@ $search_task_budget_amount = GETPOST('search_task_budget_amount'); $search_societe = GETPOST('search_societe'); $search_opp_status = GETPOST("search_opp_status", 'alpha'); -$mine = (GETPOSTISSET('mode') && GETPOST('mode', 'alpha') == 'mine') ? 1 : 0; +$mine = GETPOST('mode', 'alpha') == 'mine' ? 1 : 0; if ($mine) { - $search_task_user = $user->id; $mine = 0; + $search_task_user = $user->id; + $mine = 0; } $search_date_startday = GETPOST('search_date_startday', 'int'); @@ -882,11 +883,11 @@ $totalarray['totalbudgetamount'] = 0; $totalarray['totaltobill'] = 0; $totalarray['totalbilled'] = 0; $parameters = array( - 'arrayfields'=>$arrayfields, - 'param'=>$param, - 'sortfield'=>$sortfield, - 'sortorder'=>$sortorder, - 'totalarray' => $totalarray, + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, + 'totalarray' => &$totalarray, ); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 5f198c78a9ca21795438302055277f7f5b109cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 14:08:44 +0200 Subject: [PATCH 012/117] fix warnings in task list --- htdocs/projet/tasks/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index fa9d18bf2a5..b40031f5f25 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -636,7 +636,7 @@ if ($search_all) { print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } -$morehtmlfilter = ''; +$moreforfilter = ''; // Filter on categories if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { From 8cd4b0bc83ef9f3d007bfbd68ec095a4c0225757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 14:25:05 +0200 Subject: [PATCH 013/117] fix warnings in task list --- htdocs/projet/tasks/list.php | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index b40031f5f25..eefa1f05a5a 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -863,25 +863,27 @@ if (!empty($arrayfields['t.tobill']['checked'])) { if (!empty($arrayfields['t.billed']['checked'])) { print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); } +// Hook fields +$totalarray = array( + 'nbfield' => 0, + 'val' => array( + 't.planned_workload' => 0, + 't.duration_effective' => 0, + 't.progress' => 0, + 't.budget_amount' => 0, + ), + 'totalplannedworkload' => 0, + 'totaldurationeffective' => 0, + 'totaldurationdeclared' => 0, + 'totaltobillfield' => 0, + 'totalbilledfield' => 0, + 'totalbudget_amountfield' => 0, + 'totalbudgetamount' => 0, + 'totaltobill' => 0, + 'totalbilled' => 0, +); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; -// Hook fields -$totalarray = array(); -$totalarray['nbfield'] = 0; -$totalarray['val'] = array(); -$totalarray['val']['t.planned_workload'] = 0; -$totalarray['val']['t.duration_effective'] = 0; -$totalarray['val']['t.progress'] = 0; -$totalarray['val']['t.budget_amount'] = 0; -$totalarray['totalplannedworkload'] = 0; -$totalarray['totaldurationeffective'] = 0; -$totalarray['totaldurationdeclared'] = 0; -$totalarray['totaltobillfield'] = array(); -$totalarray['totalbilledfield'] = 0; -$totalarray['totalbudget_amountfield'] = 0; -$totalarray['totalbudgetamount'] = 0; -$totalarray['totaltobill'] = 0; -$totalarray['totalbilled'] = 0; $parameters = array( 'arrayfields' => $arrayfields, 'param' => $param, From db44f4082b37c720ea41dc05c3da063cb56ee51f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 14:26:43 +0200 Subject: [PATCH 014/117] fix warnings in task list --- htdocs/projet/tasks/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index eefa1f05a5a..efb74f1036d 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -863,7 +863,6 @@ if (!empty($arrayfields['t.tobill']['checked'])) { if (!empty($arrayfields['t.billed']['checked'])) { print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); } -// Hook fields $totalarray = array( 'nbfield' => 0, 'val' => array( @@ -884,6 +883,7 @@ $totalarray = array( ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields $parameters = array( 'arrayfields' => $arrayfields, 'param' => $param, From 677ac4635d25ab99d9ce98cbdb5be039f85286bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 14:34:47 +0200 Subject: [PATCH 015/117] fix warnings in propal list --- htdocs/comm/propal/list.php | 22 ++++++++++++++------- htdocs/core/class/html.formpropal.class.php | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3535ae0cde1..1ccbd22d511 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1383,10 +1383,24 @@ if ($resql) { if (!empty($arrayfields['sale_representative']['checked'])) { print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); } + $totalarray = array( + 'nbfield' => 0, + 'val' => array( + 'p.total_ht' => 0, + 'p.total_tva' => 0, + 'p.total_ttc' => 0, + ), + ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $parameters = array( + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, + 'totalarray' => &$totalarray, + ); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) { @@ -1412,12 +1426,6 @@ if ($resql) { $now = dol_now(); $i = 0; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalarray['val'] = array(); - $totalarray['val']['p.total_ht'] = 0; - $totalarray['val']['p.total_tva'] = 0; - $totalarray['val']['p.total_ttc'] = 0; $typenArray = null; while ($i < min($num, $limit)) { diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index b78ff5cfa8e..2773ece2569 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -104,6 +104,7 @@ class FormPropal print ''; } + $i = 0; foreach ($listofstatus as $key => $obj) { if ($excludedraft) { if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT') { From ead9b396c6bc6d04a6c3d5c0ff05b6f03cba9474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 16:02:59 +0200 Subject: [PATCH 016/117] fix warning --- htdocs/compta/paiement/cheque/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 9b235926421..33e14407dd6 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2016 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015-2016 Alexandre Spangaro - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -388,7 +388,7 @@ if ($action == 'new') { $i = 0; while ($obj = $db->fetch_object($resql)) { $accounts[$obj->bid] = $obj->label; - $lines[$obj->bid][$i]["date"] = $db->jdate($obj->date); + $lines[$obj->bid][$i]["date"] = $db->jdate($obj->datec); $lines[$obj->bid][$i]["amount"] = $obj->amount; $lines[$obj->bid][$i]["emetteur"] = $obj->emetteur; $lines[$obj->bid][$i]["numero"] = $obj->num_chq; @@ -398,6 +398,7 @@ if ($action == 'new') { $lines[$obj->bid][$i]["label"] = $obj->transactionlabel; $lines[$obj->bid][$i]["paymentid"] = $obj->paymentid; $lines[$obj->bid][$i]["paymentref"] = $obj->paymentref; + $lines[$obj->bid][$i]["paymentdate"] = $db->jdate($obj->date); $i++; } @@ -468,6 +469,7 @@ if ($action == 'new') { print ''; $paymentstatic->id = $value["paymentid"]; $paymentstatic->ref = $value["paymentref"]; + $paymentstatic->date = $value["paymentdate"]; if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); } else { From c21593a5ab23508be39eb8b52b8937e967ca8466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 16:28:18 +0200 Subject: [PATCH 017/117] fix search --- 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 eabe47e54ca..25245bac7d2 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -8,7 +8,7 @@ * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * * This program is free software; you can redistribute it and/or modify @@ -1050,7 +1050,7 @@ if ($resql) { print ''; } if (!empty($arrayfields['bu.label']['checked'])) { - print ''; + print ''; } if (!empty($arrayfields['ba.ref']['checked'])) { print ''; From de312cf8b4512b88b9e4cd0b6c4256c9cb64ae6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 16:39:57 +0200 Subject: [PATCH 018/117] Update bankentries_list.php --- htdocs/compta/bank/bankentries_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 25245bac7d2..6c03fd7b725 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -68,7 +68,7 @@ $contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); -if ($fielvalue) { +if ($fieldvalue) { if ($user->socid) { $socid = $user->socid; } From f6cd0818b3418a74a0864cc2e5794fc1cdffbc51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 16:47:01 +0200 Subject: [PATCH 019/117] fix warnings in bankentrie list --- htdocs/compta/bank/bankentries_list.php | 39 +++++++++++++------------ htdocs/compta/bank/line.php | 2 ++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index eabe47e54ca..ebf4e23dc58 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -64,11 +64,12 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id); +$massaction = GETPOST('massaction', 'alpha'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); -if ($fielvalue) { +if ($fieldvalue) { if ($user->socid) { $socid = $user->socid; } @@ -97,6 +98,8 @@ $search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search $search_req_nb = GETPOST("req_nb", 'alpha'); $search_num_releve = GETPOST("search_num_releve", 'alpha'); $search_conciliated = GETPOST("search_conciliated", 'int'); +$optioncss = GETPOST('optioncss', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $num_releve = GETPOST("num_releve", "alpha"); if (empty($dateop)) { $dateop = -1; @@ -222,7 +225,7 @@ if (empty($reshook)) { $objectclass = 'Account'; $objectlabel = 'BankTransaction'; $permissiontoread = $user->rights->banque->lire; - $permissiontodelete = $user->rights->banque->supprimer; + $permissiontodelete = $user->rights->banque->modifier; $uploaddir = $conf->bank->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -484,6 +487,11 @@ if ($optioncss != '') { if ($action == 'reconcile') { $param .= '&action=reconcile'; } +$totalarray = array( + 'nbfield' => 0, + 'totalcred' => 0, + 'totaldeb' => 0, +); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -574,7 +582,7 @@ if ($search_bid > 0) { } $sql .= " ".MAIN_DB_PREFIX."bank_account as ba,"; $sql .= " ".MAIN_DB_PREFIX."bank as b"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)"; } $sql .= " WHERE b.fk_account = ba.rowid"; @@ -732,7 +740,7 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $arrayofselected = is_array($toselect) ? $toselect : array(); + $arrayofselected = (!empty($toselect) && is_array($toselect)) ? $toselect : array(); // List of mass actions available $arrayofmassactions = array( @@ -759,7 +767,9 @@ if ($resql) { print ''; print ''; print ''; - print ''; + if (!empty($view)) { + print ''; + } print ''; print ''; print ''; @@ -939,6 +949,7 @@ if ($resql) { } } + $morehtml = ''; /*$morehtml = '
'; $morehtml .= ' "; // ' Page '; $morehtml .= ''; @@ -1050,7 +1061,7 @@ if ($resql) { print ''; } if (!empty($arrayfields['bu.label']['checked'])) { - print ''; + print ''; } if (!empty($arrayfields['ba.ref']['checked'])) { print ''; @@ -1160,7 +1171,6 @@ if ($resql) { // Loop on each record $sign = 1; - $totalarray = array(); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); $links = $bankaccountstatic->get_url($objp->rowid); @@ -1296,18 +1306,10 @@ if ($resql) { $backgroundcolor = "class='oddeven'"; } else { if ($objp->amount < 0) { - if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR1)) { - $color = '#fca955'; - } else { - $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR1; - } + $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955'); $backgroundcolor = 'style="background: '.$color.';"'; } else { - if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR2)) { - $color = '#7fdb86'; - } else { - $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR2; - } + $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86'); $backgroundcolor = 'style="background: '.$color.';"'; } } @@ -1333,7 +1335,7 @@ if ($resql) { $titletoshow = ''; $reg = array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction - if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) { + if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) { $labeltoshow = $langs->trans($reg[1]); } else { if ($objp->label == '(payment_salary)') { @@ -1357,6 +1359,7 @@ if ($resql) { } elseif ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; $paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment + $paymentstatic->date = $db->jdate($objp->do); print ' '.$paymentstatic->getNomUrl(2); } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 5567678c366..76c0046884f 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -63,6 +63,7 @@ $cancel = GETPOST('cancel', 'alpha'); // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); +$socid = 0; if ($user->socid) { $socid = $user->socid; } @@ -568,6 +569,7 @@ if ($result) { // Bank line print ''.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1); + $arrayselected = array(); print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%"); print ""; } From 71541fa299cb3ad8da02b6eefb564c827db5c2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 16:52:02 +0200 Subject: [PATCH 020/117] fix warnings in bankentrie list --- htdocs/compta/bank/bankentries_list.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index ebf4e23dc58..8fd2f9552f8 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -214,6 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_thirdparty_user = ''; $search_num_releve = ''; $search_conciliated = ''; + $toselect = ''; $search_account = ""; if ($id > 0 || !empty($ref)) { @@ -224,14 +225,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' if (empty($reshook)) { $objectclass = 'Account'; $objectlabel = 'BankTransaction'; - $permissiontoread = $user->rights->banque->lire; - $permissiontodelete = $user->rights->banque->modifier; + $permissiontoread = !empty($user->rights->banque->lire); + $permissiontodelete = !empty($user->rights->banque->modifier); $uploaddir = $conf->bank->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } // Conciliation -if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && $user->rights->banque->consolidate +if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && !empty($user->rights->banque->consolidate) && (!GETPOSTISSET('pageplusone') || (GETPOST('pageplusone') == GETPOST('pageplusoneold')))) { $error = 0; @@ -313,7 +314,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' } -if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) { +if (GETPOST('save') && !$cancel && !empty($user->rights->banque->modifier)) { $error = 0; if (price2num(GETPOST("addcredit")) > 0) { @@ -373,7 +374,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) { } } -if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) { +if ($action == 'confirm_delete' && $confirm == 'yes' && !empty($user->rights->banque->modifier)) { $accline = new AccountLine($db); $result = $accline->fetch(GETPOST("rowid", "int")); $result = $accline->delete($user); @@ -843,7 +844,7 @@ if ($resql) { } // Form to add a transaction with no invoice - if ($user->rights->banque->modifier && $action == 'addline' && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { + if (!empty($user->rights->banque->modifier) && $action == 'addline' && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { print load_fiche_titre($langs->trans("AddBankRecordLong"), '', ''); print ''; From b1555bc4fc27d62784e05aef0768f674ea577ef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 17:06:37 +0200 Subject: [PATCH 021/117] fix set categories for bank line --- htdocs/compta/bank/line.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 76c0046884f..f86c50f31cc 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -570,6 +570,11 @@ if ($result) { print '"; } From 10d35ee4aa9c7a9d36369122468fdc4d763e2cab Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Oct 2021 17:40:44 +0200 Subject: [PATCH 022/117] Fix excluded member display in takepos --- htdocs/takepos/invoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3b40d726a77..016f9c48c51 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1159,7 +1159,7 @@ $( document ).ready(function() { $result = $adh->fetch('', '', $invoice->socid); if ($result > 0) { $adh->ref = $adh->getFullName($langs); - if (empty($adh->statut)) { + if (empty($adh->statut) || $adh->statut = -2) { $s .= ""; } $s .= $adh->getFullName($langs); @@ -1175,7 +1175,7 @@ $( document ).ready(function() { $s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated } } - if (empty($adh->statut)) { + if (empty($adh->statut) || $adh->statut = -2) { $s .= ""; } } else { From 68979578d9218ffc434f46ed8a6c6b24d81efcb9 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Oct 2021 17:56:41 +0200 Subject: [PATCH 023/117] Update invoice.php --- htdocs/takepos/invoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 016f9c48c51..df17e376f65 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1159,7 +1159,7 @@ $( document ).ready(function() { $result = $adh->fetch('', '', $invoice->socid); if ($result > 0) { $adh->ref = $adh->getFullName($langs); - if (empty($adh->statut) || $adh->statut = -2) { + if (empty($adh->statut) || $adh->statut == -2) { $s .= ""; } $s .= $adh->getFullName($langs); @@ -1175,7 +1175,7 @@ $( document ).ready(function() { $s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated } } - if (empty($adh->statut) || $adh->statut = -2) { + if (empty($adh->statut) || $adh->statut == -2) { $s .= ""; } } else { From 72a665b90199afdf670cfc4e64a2569bd29511e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 19:19:32 +0200 Subject: [PATCH 024/117] fix warning --- htdocs/core/tpl/commonfields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 53f846c1713..29bf3943cea 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -156,7 +156,7 @@ foreach ($object->fields as $key => $val) { if ($val['type'] == 'text') { print ' wordbreak'; } - if ($val['cssview']) { + if (!empty($val['cssview'])) { print ' '.$val['cssview']; } print '">'; From b322ae383ba4e29561b61056a12067ba1434e691 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Oct 2021 19:21:51 +0200 Subject: [PATCH 025/117] Update invoice.php --- htdocs/takepos/invoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index df17e376f65..65ac3d2d0d3 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1159,7 +1159,7 @@ $( document ).ready(function() { $result = $adh->fetch('', '', $invoice->socid); if ($result > 0) { $adh->ref = $adh->getFullName($langs); - if (empty($adh->statut) || $adh->statut == -2) { + if (empty($adh->statut) || $adh->statut == Adherent::STATUS_EXCLUDED ) { $s .= ""; } $s .= $adh->getFullName($langs); @@ -1175,7 +1175,7 @@ $( document ).ready(function() { $s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated } } - if (empty($adh->statut) || $adh->statut == -2) { + if (empty($adh->statut) || $adh->statut == Adherent::STATUS_EXCLUDED) { $s .= ""; } } else { From 03a8c5f0cbd80972b6ff7ddcf09aa0d0d3a43688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Oct 2021 19:21:58 +0200 Subject: [PATCH 026/117] Update commonfields_edit.tpl.php --- htdocs/core/tpl/commonfields_edit.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php index abf3144de8f..39103fdbb0a 100644 --- a/htdocs/core/tpl/commonfields_edit.tpl.php +++ b/htdocs/core/tpl/commonfields_edit.tpl.php @@ -86,7 +86,7 @@ foreach ($object->fields as $key => $val) { $value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $object->$key; } //var_dump($val.' '.$key.' '.$value); - if ($val['noteditable']) { + if (!empty($val['noteditable'])) { print $object->showOutputField($val, $key, $value, '', '', '', 0); } else { if ($key == 'lang') { From 28c5b105baefe9a8872f92c1fe285d9d9ce548ee Mon Sep 17 00:00:00 2001 From: atm-florian Date: Mon, 25 Oct 2021 11:20:28 +0200 Subject: [PATCH 027/117] FIX: remove two lines of javascript referring to DOM elements that no longer exist in Dolibarr (form#move_event) --- htdocs/comm/action/pertype.php | 1 - htdocs/comm/action/peruser.php | 1 - 2 files changed, 2 deletions(-) diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 08cef7dd80a..9a88c4f18a2 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -377,7 +377,6 @@ if ($conf->use_javascript_ajax) { $s .= 'jQuery(".family_birthday").toggle();'."\n"; if ($action == "show_week" || $action == "show_month" || empty($action)) { $s .= 'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {'; - $s .= 'var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n"; } $s .= '});'."\n"; $s .= ''."\n"; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 0d1567ee274..dc546141aca 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -387,7 +387,6 @@ if ($conf->use_javascript_ajax) { $s .= 'jQuery(".family_birthday").toggle();'."\n"; if ($action == "show_week" || $action == "show_month" || empty($action)) { $s .= 'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {'; - $s .= 'var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n"; } $s .= '});'."\n"; $s .= ''."\n"; From 02564df769fba68369c7accf8c7d980427e9fd03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 25 Oct 2021 20:34:19 +0200 Subject: [PATCH 028/117] fix warning --- htdocs/user/notify/card.php | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 48cbad46799..d6bbd300093 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -349,21 +349,17 @@ if ($result > 0) { foreach($conf->global as $key => $val) { if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; print ''; @@ -384,9 +379,7 @@ if ($result > 0) { print ''; print ''; }*/ - /*if ($user->admin) - { - $var = ! $var; + /*if ($user->admin) { print ''; @@ -403,7 +396,7 @@ if ($result > 0) { // List $sql = "SELECT n.rowid, n.daten, n.email, n.objet_type as object_type, n.objet_id as object_id, n.type,"; - $sql .= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail,"; + $sql .= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail, c.statut as status,"; $sql .= " a.code, a.label"; $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql .= " ".MAIN_DB_PREFIX."notify as n"; @@ -477,6 +470,8 @@ if ($result > 0) { $userstatic->id = $obj->id; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; + $userstatic->statut = $obj->status; + $userstatic->email = $obj->email; print $userstatic->getNomUrl(1); print $obj->email ? ' <'.$obj->email.'>' : $langs->trans("NoMail"); } else { @@ -497,13 +492,12 @@ if ($result > 0) { print ''; // TODO Add link to object here for other types /*print '';*/ + print '';*/ // print print''; print ''; From c4fbf7c422a9abf13913bf3a880ef5e95f3a3e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 25 Oct 2021 20:48:45 +0200 Subject: [PATCH 029/117] fix warning --- htdocs/ticket/list.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 76e2208ba0b..7973861b25a 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -886,10 +886,19 @@ foreach ($object->fields as $key => $val) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; } } +$totalarray = array( + 'nbfield' => 0, +); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array( + 'arrayfields' => $arrayfields, + 'param' => $param, + 'sortfield' => $sortfield, + 'sortorder' => $sortorder, + 'totalarray' => &$totalarray, +); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; @@ -910,7 +919,6 @@ if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_a // Loop on record // -------------------------------------------------------------------- $i = 0; -$totalarray = array(); $cacheofoutputfield = array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -945,15 +953,15 @@ while ($i < min($num, $limit)) { } if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; From 8c08786182701b19ffc901bdbb1f7cf7156d98d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 25 Oct 2021 20:51:56 +0200 Subject: [PATCH 030/117] Update list.php --- htdocs/ticket/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 7973861b25a..8458d2ed459 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -953,7 +953,7 @@ while ($i < min($num, $limit)) { } if (!empty($arrayfields['t.'.$key]['checked'])) { print 'rights->bookmark->lire; -$permissiontoadd = $user->rights->bookmark->write; -$permissiontodelete = $user->rights->bookmark->delete; +$permissiontoread = !empty($user->rights->bookmark->lire); +$permissiontoadd = !empty($user->rights->bookmark->creer); +$permissiontodelete = !empty($user->rights->bookmark->supprimer); /* From 8803fe64dc368241c746a327acbb9be3056fbb88 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 25 Oct 2021 21:45:00 +0200 Subject: [PATCH 032/117] fix scrutinizer --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 7ccd80eb4bd..bf089e0cd5b 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -749,7 +749,7 @@ if ($type == Categorie::TYPE_CONTACT) { $permission = $user->rights->societe->creer; $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($contacts < 0) { + if (!is_array($contacts) && $contacts < 0) { dol_print_error($db, $object->error, $object->errors); } else { print ''; From cfd88cb6e5cc48b343cea190998aa8a4a681e1d1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 25 Oct 2021 21:50:27 +0200 Subject: [PATCH 033/117] fix scrutinizer error --- .../societe/doc/doc_generic_odt.modules.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 8b8069ff34f..6427a6a60a3 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -320,17 +320,22 @@ class doc_generic_odt extends ModeleThirdPartyDoc foreach ($contact_arrray as $array_key => $contact_id) { $res_contact = $contactstatic->fetch($contact_id); - $tmparray = $this->get_substitutionarray_contact($contactstatic, $outputlangs, 'contact'); - foreach ($tmparray as $key => $val) { - try { - $listlines->setVars($key, $val, true, 'UTF-8'); - } catch (OdfException $e) { - dol_syslog($e->getMessage(), LOG_INFO); - } catch (SegmentException $e) { - dol_syslog($e->getMessage(), LOG_INFO); + if ((int) $res_contact > 0) { + $tmparray = $this->get_substitutionarray_contact($contactstatic, $outputlangs, 'contact'); + foreach ($tmparray as $key => $val) { + try { + $listlines->setVars($key, $val, true, 'UTF-8'); + } catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } catch (SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } } + $listlines->merge(); + } else { + $this->error = $contactstatic->error; + dol_syslog($this->error, LOG_WARNING); } - $listlines->merge(); } $odfHandler->mergeSegment($listlines); } catch (OdfException $e) { From 9a2e1df94a1813dcbb78f2d5d2e33498f47e2112 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 25 Oct 2021 21:54:56 +0200 Subject: [PATCH 034/117] fix scrutinizer error --- htdocs/resource/class/html.formresource.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index a8b17665fa1..99916b8ed70 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -224,8 +224,9 @@ class FormResource $value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); } elseif ($format == 3) { $value = $arraytypes['code']; + } elseif (empty($value)) { + print ' '; } - print $value ? $value : ' '; print ''; } } From 7638a2a8a07c5dc7b774d19ba473400455e93317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 25 Oct 2021 22:00:45 +0200 Subject: [PATCH 035/117] fix warnings --- htdocs/comm/action/list.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 985a403b086..7f3cb247c59 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2017 Open-DSI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2020 Tobias Sekan * * This program is free software; you can redistribute it and/or modify @@ -636,7 +636,9 @@ if (empty($reshook)) { } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } - +$viewyear = is_object($object) ? dol_print_date($object->datep, '%Y') : ''; +$viewmonth = is_object($object) ? dol_print_date($object->datep, '%m') : ''; +$viewday = is_object($object) ? dol_print_date($object->datep, '%d') : ''; $viewmode = ''; $viewmode .= ''; //$viewmode .= ''; @@ -644,25 +646,25 @@ $viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewm //$viewmode .= ''; $viewmode .= ''.$langs->trans("ViewList").''; -$viewmode .= ''; +$viewmode .= ''; //$viewmode .= ''; $viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"'); //$viewmode .= ''; $viewmode .= ''.$langs->trans("ViewCal").''; -$viewmode .= ''; +$viewmode .= ''; //$viewmode .= ''; $viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"'); //$viewmode .= ''; $viewmode .= ''.$langs->trans("ViewWeek").''; -$viewmode .= ''; +$viewmode .= ''; //$viewmode .= ''; $viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"'); //$viewmode .= ''; $viewmode .= ''.$langs->trans("ViewDay").''; -$viewmode .= ''; +$viewmode .= ''; //$viewmode .= ''; $viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"'); //$viewmode .= ''; From e3f4c70aeaf02bbc16cd2262601888dd32b2ce79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 25 Oct 2021 22:01:36 +0200 Subject: [PATCH 036/117] Update list.php --- htdocs/comm/action/list.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 7f3cb247c59..7273ebad1c3 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -629,7 +629,8 @@ print $nav; $s = $newtitle; // Calendars from hooks -$parameters = array(); $object = null; +$parameters = array(); +$object = null; $reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action); if (empty($reshook)) { $s .= $hookmanager->resPrint; @@ -673,7 +674,8 @@ $viewmode .= ''; // Add more views from hooks -$parameters = array(); $object = null; +$parameters = array(); +$object = null; $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); if (empty($reshook)) { $viewmode .= $hookmanager->resPrint; From 5469d49102e99c7b539ac5bc69de012c2a6b120e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 25 Oct 2021 22:04:19 +0200 Subject: [PATCH 037/117] fix warning --- htdocs/comm/action/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 985a403b086..b1b1de6d955 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -681,7 +681,7 @@ if (empty($reshook)) { $tmpforcreatebutton = dol_getdate(dol_now(), true); -$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; +$newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; //$param='month='.$monthshown.'&year='.$year; $hourminsec = '100000'; From 0c915dc052c71577c8f221f55229e3b065145576 Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Tue, 26 Oct 2021 09:54:08 +0200 Subject: [PATCH 038/117] FIX: Can't create new attendee Field date_subscription is mandatory when creating a new attendee. --- htdocs/public/eventorganization/attendee_new.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index ede24103bdb..b350ece39f4 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -268,6 +268,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } else { // Need to create a confattendee $confattendee->date_creation = dol_now(); + $confattendee->date_subscription = dol_now(); $confattendee->email = $email; $confattendee->fk_project = $project->id; $confattendee->fk_actioncomm = $id; From 89ba133c61429071b2c64ab007f7d888fb659f92 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 26 Oct 2021 14:11:51 +0200 Subject: [PATCH 039/117] fix: categorie display if none --- htdocs/modulebuilder/template/admin/setup.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 9007eab60cc..6cae58ecf2e 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -354,13 +354,14 @@ if ($action == 'edit') { $result = $c->fetch($conf->global->{$constname}); if ($result < 0) { setEventMessages(null, $c->errors, 'errors'); + } elseif ($result > 0 ) { + $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text + $toprint = array(); + foreach ($ways as $way) { + $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '
  • '; + } + print '
      ' . implode(' ', $toprint) . '
    '; } - $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text - $toprint = array(); - foreach ($ways as $way) { - $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '
  • '; - } - print '
      ' . implode(' ', $toprint) . '
    '; } elseif (preg_match('/thirdparty_type/', $val['type'])) { if ($conf->global->{$constname}==2) { print $langs->trans("Prospect"); From e4b3dda7f0e9cae4e1e0326368ccfc89b4cf68e3 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Tue, 26 Oct 2021 15:27:12 +0200 Subject: [PATCH 040/117] Update functions.lib.php FIX : Duplicate entry in array FIX : Unasigned variable FIX : Type mismatch FIX : Wrong variable --- htdocs/core/lib/functions.lib.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 897b248824f..d6d8bc8600f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2390,7 +2390,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = // Analyze date $reg = array(); if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 - dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]); + dol_print_error('',"Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]); return ''; } elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) { // Still available to solve problems in extrafields of type date // This part of code should not be used anymore. @@ -3659,9 +3659,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', 'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'sign-out'=>'sign-out-alt', - 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', - 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', - 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', + 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', + 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter', + 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', @@ -3671,7 +3671,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house', 'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', - 'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', + 'supplier'=>'building', 'technic'=>'cogs', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', 'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card', @@ -4462,7 +4462,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss $result = ($nodiv ? '' : '
    ').' '.$text.($nodiv ? '' : '
    '); if ($textfordropdown) { - $tmpresult .= ''.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').''; + $tmpresult = ''.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').''; $tmpresult .= '
    '.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1); $arrayselected = array(); + $c = new Categorie($db); + $cats = $c->containing($bankline->id, Categorie::TYPE_BANK_LINE); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%"); print "
    '; - $listtmp=explode(',',$val); + $listtmp=explode(',', $val); $first=1; - foreach($listtmp as $keyemail => $valemail) - { + foreach($listtmp as $keyemail => $valemail) { if (! $first) print ', '; $first=0; $valemail=trim($valemail); //print $keyemail.' - '.$valemail.' - '.$reg[1].'
    '; - if (isValidEmail($valemail, 1)) - { + if (isValidEmail($valemail, 1)) { if ($valemail == '__SUPERVISOREMAIL__') print $valemail; else print ' <'.$valemail.'>'; - } - else - { + } else { print ' '.img_warning().' '.$langs->trans("ErrorBadEMail",$valemail); } } @@ -373,8 +369,7 @@ if ($result > 0) { $notifcodecond=preg_replace('/^.*_(THRESHOLD_)/','$1',$reg[1]); $label=($langs->trans("Notify_".$notifcode)!="Notify_".$notifcode?$langs->trans("Notify_".$notifcode):$notifcode); print $label; - if (preg_match('/^THRESHOLD_HIGHER_(.*)$/',$notifcodecond,$regcond) && ($regcond[1] > 0)) - { + if (preg_match('/^THRESHOLD_HIGHER_(.*)$/',$notifcodecond,$regcond) && ($regcond[1] > 0)) { print ' - '.$langs->trans("IfAmountHigherThan",$regcond[1]); } print '
    '.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'
    '; print '+ '.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''; print '
    '; - if ($obj->object_type == 'order') - { + if ($obj->object_type == 'order') { $orderstatic->id=$obj->object_id; $orderstatic->ref=... print $orderstatic->getNomUrl(1); } - print ''.dol_print_date($db->jdate($obj->daten), 'dayhour').'