From 1dec4c432008cd4d49aa2d7a148eb78523c6f2a5 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Thu, 14 Jun 2018 10:37:40 +0200 Subject: [PATCH 001/141] FIX: supplier order: product supplier ref not saved on addline --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index efa8be0f951..9783fc9911e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -409,7 +409,7 @@ if (empty($reshook)) $localtax2_tx, $idprod, $productsupplier->product_fourn_price_id, - $productsupplier->fourn_ref, + $productsupplier->ref_supplier, $remise_percent, 'HT', $pu_ttc, From a80e1c601ccf0a6fc158dfa32bd91c5a4c417dbd Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Thu, 14 Jun 2018 10:43:01 +0200 Subject: [PATCH 002/141] NEW: supplier order/order lines export: add supplier product ref --- htdocs/core/modules/modFournisseur.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index d8ed86907fd..280104b0e28 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -455,16 +455,16 @@ class modFournisseur extends DolibarrModules $this->export_icon[$r]='order'; $this->export_permission[$r]=array(array("fournisseur","commande","export")); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.date_livraison'=>"DateDeliveryPlanned",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId', - 'p.ref'=>'ProductRef','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel'); + 'p.ref'=>'ProductRef','fd.ref'=>'RefSupplier','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel'); if (empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) { unset($this->export_fields_array['f.date_approve2']); unset($this->export_fields_array['ua2.login']); } $this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.date_livraison'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label', - 'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text'); + 'p.ref'=>'Text','fd.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text'); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product', - 'p.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project'); + 'p.ref'=>'product','fd.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project'); $this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur'"; From e9d65ea751cf068b04a2e1f333c74da7462e8e5f Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 14 Jun 2018 11:56:22 +0200 Subject: [PATCH 003/141] FIX : need to filter on aa.entity for same accounting accounts available in several entities --- htdocs/accountancy/customer/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index f675c010b37..d5d828ef626 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -235,6 +235,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; } $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy +$sql .= " AND aa.entity = " . $conf->entity; // Add where from hooks $parameters=array(); @@ -439,4 +440,4 @@ if ($result) { } llxFooter(); -$db->close(); \ No newline at end of file +$db->close(); From f9a86ba43f0f56f163f7994dda9ab0e8db884a01 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 14 Jun 2018 14:01:05 +0200 Subject: [PATCH 004/141] Fix: MEMBER_MODIFY trigger not called if i change only extrafields --- htdocs/adherents/class/adherent.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 507695b0ffd..8736500757f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -599,14 +599,14 @@ class Adherent extends CommonObject $error++; } } + } - if (! $error && ! $notrigger) - { - // Call trigger - $result=$this->call_trigger('MEMBER_MODIFY',$user); - if ($result < 0) { $error++; } - // End call triggers - } + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('MEMBER_MODIFY',$user); + if ($result < 0) { $error++; } + // End call triggers } if (! $error) From d5a3e63e05c13e043136a6371dde3371c66d5c0a Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Fri, 15 Jun 2018 09:47:28 +0200 Subject: [PATCH 005/141] Fix missing paramater for generateDocument --- htdocs/adherents/class/adherent.class.php | 5 +++-- htdocs/comm/propal/class/propal.class.php | 6 ++++-- htdocs/commande/class/commande.class.php | 6 ++++-- htdocs/contrat/class/contrat.class.php | 6 ++++-- htdocs/expedition/class/expedition.class.php | 6 ++++-- htdocs/expensereport/class/expensereport.class.php | 6 ++++-- htdocs/fichinter/class/fichinter.class.php | 6 ++++-- htdocs/fourn/class/fournisseur.commande.class.php | 6 ++++-- htdocs/fourn/class/fournisseur.facture.class.php | 6 ++++-- htdocs/fourn/class/paiementfourn.class.php | 6 ++++-- htdocs/supplier_proposal/class/supplier_proposal.class.php | 6 ++++-- htdocs/user/class/user.class.php | 6 ++++-- htdocs/user/class/usergroup.class.php | 6 ++++-- 13 files changed, 51 insertions(+), 26 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fec649823f7..97a10b49584 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2159,9 +2159,10 @@ class Adherent extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -2180,7 +2181,7 @@ class Adherent extends CommonObject $modelpath = "core/modules/member/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1f6c27a1c05..703ed95a1b2 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -3579,9 +3580,10 @@ class Propal extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -3600,7 +3602,7 @@ class Propal extends CommonObject $modelpath = "core/modules/propale/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref,$moreparams); } /** diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ccdc03da9ab..a9970a95a51 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2016-2017 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -3677,9 +3678,10 @@ class Commande extends CommonOrder * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -3698,7 +3700,7 @@ class Commande extends CommonOrder $modelpath = "core/modules/commande/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e32ebaff987..461f76d543c 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015-2017 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2303,9 +2304,10 @@ class Contrat extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -2324,7 +2326,7 @@ class Contrat extends CommonObject $modelpath = "core/modules/contract/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } /** diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index fd49a6b3ac2..4042b202300 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2014-2017 Francis Appels * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2216,9 +2217,10 @@ class Expedition extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0,$moreparams=null) { global $conf,$langs; @@ -2239,7 +2241,7 @@ class Expedition extends CommonObject $this->fetch_origin(); - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref,$moreparams); } /** diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index d9a79789298..e01ab071e1f 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2146,9 +2147,10 @@ class ExpenseReport extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -2167,7 +2169,7 @@ class ExpenseReport extends CommonObject $modelpath = "core/modules/expensereport/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref,$moreparams); } /** diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 60369f1acb7..dcf2ac367be 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Charlie Benke + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -575,9 +576,10 @@ class Fichinter extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -596,7 +598,7 @@ class Fichinter extends CommonObject $modelpath = "core/modules/fichinter/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref,$moreparams); } /** diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b1a82c6c97b..a413d1b1760 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2810,9 +2811,10 @@ class CommandeFournisseur extends CommonOrder * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $langs; @@ -2831,7 +2833,7 @@ class CommandeFournisseur extends CommonOrder $modelpath = "core/modules/supplier_order/pdf/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } /** diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b10be70dd40..8ce8b796892 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Alexandre Spangaro + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2467,9 +2468,10 @@ class FactureFournisseur extends CommonInvoice * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int <0 if KO, 0 if nothing done, >0 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $user, $langs; @@ -2496,7 +2498,7 @@ class FactureFournisseur extends CommonInvoice { $modelpath = "core/modules/supplier_invoice/pdf/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } } diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index fd794758330..49a24acf72b 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2014 Marcos García + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -698,9 +699,10 @@ class PaiementFourn extends Paiement * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int <0 if KO, 0 if nothing done, >0 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $user, $langs; @@ -727,7 +729,7 @@ class PaiementFourn extends Paiement { $modelpath = "core/modules/supplier_payment/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 4b012e31c2d..54672da2b75 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2582,9 +2583,10 @@ class SupplierProposal extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $langs; @@ -2603,7 +2605,7 @@ class SupplierProposal extends CommonObject $modelpath = "core/modules/supplier_proposal/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 032eb2112d8..5b7416dbaa6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2013-2014 Philippe Grand * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2976,9 +2977,10 @@ class User extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$user,$langs; @@ -2999,7 +3001,7 @@ class User extends CommonObject $modelpath = "core/modules/user/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } /** diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index def96bac0bd..2400c855a6d 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Alexis Algoud + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -952,9 +953,10 @@ class UserGroup extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$user,$langs; @@ -975,7 +977,7 @@ class UserGroup extends CommonObject $modelpath = "core/modules/usergroup/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } } From cb3704b67eb44aec8907ff4d6bed3ee138b2c252 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 15 Jun 2018 11:02:46 +0200 Subject: [PATCH 006/141] Fix can't add an attribute simply --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9dcd4c67035..1cf2f33980e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2010,7 +2010,7 @@ class Societe extends CommonObject $hookmanager=new HookManager($this->db); } $hookmanager->initHooks(array('societedao')); - $parameters=array('id'=>$this->id); + $parameters=array('id'=>$this->id, 'linkclose'=>$linkclose); $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; } From a21e138c7046a11baf65bdba6e62b8b511f9fb6f Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 15 Jun 2018 11:19:04 +0200 Subject: [PATCH 007/141] Fix: Avoid converting into reduction twice and draft invoice --- htdocs/compta/facture/card.php | 4 +- .../compta/paiement/class/paiement.class.php | 62 ++++++++++--------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 67de173dff7..055a100848a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014-2018 Ferran Marcet * Copyright (C) 2015-2016 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -4408,7 +4408,7 @@ else if ($id > 0 || ! empty($ref)) print ''; } // For deposit invoice - if ($object->type == Facture::TYPE_DEPOSIT && $user->rights->facture->creer && empty($discount->id)) + if ($object->type == Facture::TYPE_DEPOSIT && $user->rights->facture->creer && $object->statut > 0 && empty($discount->id)) { print ''; } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 42106c1cb13..6a8628da6c3 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet * * 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 @@ -288,39 +289,40 @@ class Paiement extends CommonObject { $amount_ht = $amount_tva = $amount_ttc = array(); - // Loop on each vat rate - $i = 0; - foreach ($invoice->lines as $line) - { - if ($line->total_ht!=0) - { // no need to create discount if amount is null - $amount_ht[$line->tva_tx] += $line->total_ht; - $amount_tva[$line->tva_tx] += $line->total_tva; - $amount_ttc[$line->tva_tx] += $line->total_ttc; - $i ++; - } - } + // Insert one discount by VAT rate category + $discount = new DiscountAbsolute($this->db); + $discount->fetch('',$invoice->id); + if (empty($discount->id)) { - // Insert one discount by VAT rate category - $discount = new DiscountAbsolute($this->db); - $discount->description = '(DEPOSIT)'; - $discount->fk_soc = $invoice->socid; - $discount->fk_facture_source = $invoice->id; - foreach ($amount_ht as $tva_tx => $xxx) - { - $discount->amount_ht = abs($amount_ht[$tva_tx]); - $discount->amount_tva = abs($amount_tva[$tva_tx]); - $discount->amount_ttc = abs($amount_ttc[$tva_tx]); - $discount->tva_tx = abs($tva_tx); + $discount->description = '(DEPOSIT)'; + $discount->fk_soc = $invoice->socid; + $discount->fk_facture_source = $invoice->id; - $result = $discount->create($user); - if ($result < 0) - { - $error++; - break; - } - } + // Loop on each vat rate + $i = 0; + foreach ($invoice->lines as $line) { + if ($line->total_ht != 0) { // no need to create discount if amount is null + $amount_ht[$line->tva_tx] += $line->total_ht; + $amount_tva[$line->tva_tx] += $line->total_tva; + $amount_ttc[$line->tva_tx] += $line->total_ttc; + $i++; + } + } + + foreach ($amount_ht as $tva_tx => $xxx) { + $discount->amount_ht = abs($amount_ht[$tva_tx]); + $discount->amount_tva = abs($amount_tva[$tva_tx]); + $discount->amount_ttc = abs($amount_ttc[$tva_tx]); + $discount->tva_tx = abs($tva_tx); + + $result = $discount->create($user); + if ($result < 0) { + $error++; + break; + } + } + } if ($error) { From 79cbdf7fd193234db9542b39efb9d27151d69f1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Jun 2018 15:29:19 +0200 Subject: [PATCH 008/141] Code comment --- htdocs/public/payment/newpayment.php | 4 +++- htdocs/stripe/config.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index af30cf2ff57..a531a821d29 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -444,10 +444,12 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) $thirdparty = new Societe($db); $thirdparty->fetch($thirdparty_id); + // Create Stripe customer include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $stripe = new Stripe($db); $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); + // Create Stripe card from Token $card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata)); if (empty($card)) @@ -1559,7 +1561,7 @@ if (preg_match('/^dopayment/',$action)) ?> - // Create a Stripe client + // Create a Stripe client. var stripe = Stripe(''); // Create an instance of Elements diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 1e9eb7a5181..c61de994874 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -46,11 +46,11 @@ $stripearrayofkeysbyenv = array( $stripearrayofkeys = array(); if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')) { - $stripearrayofkeys = $stripearrayofkeysbyenv[0]; + $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test } else { - $stripearrayofkeys = $stripearrayofkeysbyenv[1]; + $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live } \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); From 5d6cd381b9999c6f615904c54217c4721965f6d5 Mon Sep 17 00:00:00 2001 From: altatof Date: Fri, 15 Jun 2018 15:59:14 +0200 Subject: [PATCH 009/141] Fix
detection --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6e9261fdd81..c0fbfb68010 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5067,6 +5067,7 @@ function dol_textishtml($msg,$option=0) { if (preg_match('//i',$msg)) return true; elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; From 3c80ce501bf9962d7dc4ec2c40ab43b0d5ccb5b5 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 15 Jun 2018 16:05:50 +0200 Subject: [PATCH 010/141] Fix missing hook on usercard (addMoreActionsButtons) --- htdocs/user/card.php | 127 ++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 61 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3779e3ed6fa..9d9b73bad09 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1619,85 +1619,90 @@ else print '
'; - if (! empty($object->email)) + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { - $langs->load("mails"); - print ''; - } - else - { - $langs->load("mails"); - print ''; - } - - if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) + if (! empty($object->email)) { - print ''; + $langs->load("mails"); + print ''; } else { - print ''; + $langs->load("mails"); + print ''; } - } - elseif ($caneditpassword && ! $object->ldap_sid && - (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - print ''; - } - // Si on a un gestionnaire de generation de mot de passe actif - if ($conf->global->USER_PASSWORD_GENERATED != 'none') - { - if ($object->statut == 0) + if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) + { + print ''; + } + else + { + print ''; + } } - elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + elseif ($caneditpassword && ! $object->ldap_sid && + (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + { + print ''; + } + + // Si on a un gestionnaire de generation de mot de passe actif + if ($conf->global->USER_PASSWORD_GENERATED != 'none') + { + if ($object->statut == 0) + { + print ''; + } + elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + { + print ''; + } + + if ($object->statut == 0) + { + print ''; + } + else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + { + if ($object->email) print ''; + else print ''; + } + } + + // Activer + if ($user->id <> $id && $candisableuser && $object->statut == 0 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + print ''; } - - if ($object->statut == 0) - { - print ''; - } - else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + // Desactiver + if ($user->id <> $id && $candisableuser && $object->statut == 1 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - if ($object->email) print ''; - else print ''; + print ''; } - } - - // Activer - if ($user->id <> $id && $candisableuser && $object->statut == 0 && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - print ''; - } - // Desactiver - if ($user->id <> $id && $candisableuser && $object->statut == 1 && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - print ''; - } - // Delete - if ($user->id <> $id && $candisableuser && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin + // Delete + if ($user->id <> $id && $candisableuser && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; - } - else - { - print ''; + if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin + { + print ''; + } + else + { + print ''; + } } } - + print "
\n"; From c0d4715bdb44ad3782dcd7c03d5cb9c1bd1640f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Jun 2018 16:29:26 +0200 Subject: [PATCH 011/141] Clean code --- htdocs/public/payment/newpayment.php | 47 +++++++++++++--------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index a531a821d29..ec2f43841f5 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1607,43 +1607,40 @@ if (preg_match('/^dopayment/',$action)) console.log(form); form.addEventListener('submit', function(event) { event.preventDefault(); - - global->STRIPE_USE_3DSECURE)) // Ask credit card directly, no 3DS test { ?> - /* Use token */ - stripe.createToken(card).then(function(result) { - if (result.error) { - // Inform the user if there was an error - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - // Send the token to your server - stripeTokenHandler(result.token); - } - }); + /* Use token */ + stripe.createToken(card).then(function(result) { + if (result.error) { + // Inform the user if there was an error + var errorElement = document.getElementById('card-errors'); + errorElement.textContent = result.error.message; + } else { + // Send the token to your server + stripeTokenHandler(result.token); + } + }); - /* Use 3DS source */ - stripe.createSource(card).then(function(result) { - if (result.error) { - // Inform the user if there was an error - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - // Send the source to your server - stripeSourceHandler(result.source); - } - }); + /* Use 3DS source */ + stripe.createSource(card).then(function(result) { + if (result.error) { + // Inform the user if there was an error + var errorElement = document.getElementById('card-errors'); + errorElement.textContent = result.error.message; + } else { + // Send the source to your server + stripeSourceHandler(result.source); + } + }); - }); From 5908fc147111724ad99e586388e0e4e3535d1fcf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 13:15:24 +0200 Subject: [PATCH 012/141] Trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e4ecc5f0888..c40a8541d67 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -497,7 +497,7 @@ Module25Desc=Customer order management Module30Name=Invoices Module30Desc=Invoice and credit note management for customers. Invoice management for suppliers Module40Name=Suppliers -Module40Desc=Supplier management and buying (orders and invoices) +Module40Desc=Suppliers and purchase management (purchase orders and billing) Module42Name=Debug Logs Module42Desc=Logging facilities (file, syslog, ...). Such logs are for technical/debug purposes. Module49Name=Editors From 92952aea2867c081a1a1be8433663088a6bcbae6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 13:23:58 +0200 Subject: [PATCH 013/141] Trans --- htdocs/langs/en_US/stocks.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index d1b1f85224f..98aae045517 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -203,4 +203,4 @@ RegulateStock=Regulate Stock ListInventory=List StockSupportServices=Stock management support services StockSupportServicesDesc=By default, you can stock only product with type "product". If on, and if module service is on, you can also stock a product with type "service" -ReceiveProducts=Receive products \ No newline at end of file +ReceiveProducts=Receive items \ No newline at end of file From 4898f10fa283407023cfee58ff6337fa09c60da8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 13:49:28 +0200 Subject: [PATCH 014/141] FIX Adding a product with no supplier price defined yet --- htdocs/fourn/class/fournisseur.commande.class.php | 9 +++++---- htdocs/fourn/commande/card.php | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b1a82c6c97b..e585ab5c84e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1568,6 +1568,7 @@ class CommandeFournisseur extends CommonOrder } $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx,$pu_ht_devise); + $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -3280,10 +3281,10 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql.= ($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'":"null"); $sql.= ", ".($this->fk_multicurrency ? $this->fk_multicurrency : "null"); $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; - $sql.= ", ".price2num($this->multicurrency_subprice); - $sql.= ", ".price2num($this->multicurrency_total_ht); - $sql.= ", ".price2num($this->multicurrency_total_tva); - $sql.= ", ".price2num($this->multicurrency_total_ttc); + $sql.= ", ".($this->multicurrency_subprice ? price2num($this->multicurrency_subprice) : '0'); + $sql.= ", ".($this->multicurrency_total_ht ? price2num($this->multicurrency_total_ht) : '0'); + $sql.= ", ".($this->multicurrency_total_tva ? price2num($this->multicurrency_total_tva) : '0'); + $sql.= ", ".($this->multicurrency_total_ttc ? price2num($this->multicurrency_total_ttc) : '0'); $sql.= ")"; dol_syslog(get_class($this)."::insert", LOG_DEBUG); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 29a9d21cc54..9b635f05418 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -400,9 +400,12 @@ if (empty($reshook)) $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); + $pu = $productsupplier->fourn_pu; + if (empty($pu)) $pu = 0; // If pu is '' or null, we force to have a numeric value + $result=$object->addline( $desc, - $productsupplier->fourn_pu, + $pu, $qty, $tva_tx, $localtax1_tx, From 7981bd08b7c511db2cf2028590ceeefa17813a4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 14:47:33 +0200 Subject: [PATCH 015/141] Fix price+sql error when adding product when no supplier price defined --- htdocs/fourn/commande/card.php | 31 +++++++++++++++------- htdocs/fourn/facture/card.php | 36 +++++++++++++++++++------- htdocs/product/class/product.class.php | 10 +++---- htdocs/supplier_proposal/card.php | 29 +++++++++++++++------ 4 files changed, 73 insertions(+), 33 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 9b635f05418..6a073fb305d 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -365,20 +365,33 @@ if (empty($reshook)) $productsupplier = new ProductFournisseur($db); $idprod=0; - if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) - if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice'), $reg)) + if (GETPOST('idprodfournprice','alpha') == -1 || GETPOST('idprodfournprice','alpha') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) + if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice','alpha'), $reg)) { $idprod=$reg[1]; - $res=$productsupplier->fetch($idprod); - // Call to init properties of $productsupplier + $res=$productsupplier->fetch($idprod); // Load product from its ID + // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price - $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist + if (! empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) + { + $fksoctosearch = 0; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + if ($productsupplier->fourn_socid != $socid) // The price we found is for another supplier, so we clear supplier price + { + $productsupplier->ref_supplier = ''; + } + } + else + { + $fksoctosearch = $object->thirdparty->id; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + } } - elseif (GETPOST('idprodfournprice') > 0) + elseif (GETPOST('idprodfournprice','alpha') > 0) { $qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. //$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist - $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch); + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice','alpha'), $qtytosearch); $res=$productsupplier->fetch($idprod); } @@ -394,8 +407,8 @@ if (empty($reshook)) $ref_supplier = $productsupplier->ref_supplier; - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); if (empty($tva_tx)) $tva_npr=0; $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 2a0d212788f..f171aa272ff 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1172,21 +1172,34 @@ if (empty($reshook)) $productsupplier=new ProductFournisseur($db); $idprod=0; - if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) + if (GETPOST('idprodfournprice','alpha') == -1 || GETPOST('idprodfournprice','alpha') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) - if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice'), $reg)) + if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice','alpha'), $reg)) { $idprod=$reg[1]; - $res=$productsupplier->fetch($idprod); - // Call to init properties of $productsupplier + $res=$productsupplier->fetch($idprod); // Load product from its id + // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price - $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist + if (! empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) + { + $fksoctosearch = 0; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + if ($productsupplier->fourn_socid != $socid) // The price we found is for another supplier, so we clear supplier price + { + $productsupplier->ref_supplier = ''; + } + } + else + { + $fksoctosearch = $object->thirdparty->id; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + } } - elseif (GETPOST('idprodfournprice') > 0) + elseif (GETPOST('idprodfournprice','alpha') > 0) { $qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. //$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist - $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch); + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice','alpha'), $qtytosearch); $res=$productsupplier->fetch($idprod); } @@ -1202,15 +1215,18 @@ if (empty($reshook)) $ref_supplier = $productsupplier->ref_supplier; - $tva_tx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + $tva_tx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); if (empty($tva_tx)) $tva_npr=0; $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); + $pu = $productsupplier->fourn_pu; + if (empty($pu)) $pu = 0; // If pu is '' or null, we force to have a numeric value + $result=$object->addline( $desc, - $productsupplier->fourn_pu, + $pu, $tva_tx, $localtax1_tx, $localtax2_tx, diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ae2d3a4e8b1..7d7cbf7c282 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -275,14 +275,10 @@ class Product extends CommonObject public $fk_price_expression; - /** - * @deprecated - * @see fourn_pu - */ - public $buyprice; + /* To store supplier price found */ public $fourn_pu; - public $fourn_price_base_type; + public $fourn_socid; /** * @deprecated @@ -1544,6 +1540,7 @@ class Product extends CommonObject $this->buyprice = $obj->price; // deprecated $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier $this->fourn_price_base_type = 'HT'; // Price base type + $this->fourn_socid = $obj->fk_soc; // Company that offer this price $this->ref_fourn = $obj->ref_fourn; // deprecated $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed @@ -1599,6 +1596,7 @@ class Product extends CommonObject $this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier $this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier + $this->fourn_socid = $obj->fk_soc; // Company that offer this price $this->ref_fourn = $obj->ref_supplier; // deprecated $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 113ef3db88c..e3e91b6c38f 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -589,21 +589,34 @@ if (empty($reshook)) $productsupplier = new ProductFournisseur($db); $idprod=0; - if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) + if (GETPOST('idprodfournprice','alpha') == -1 || GETPOST('idprodfournprice','alpha') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) - if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice'), $reg)) + if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice','alpha'), $reg)) { $idprod=$reg[1]; $res=$productsupplier->fetch($idprod); - // Call to init properties of $productsupplier + // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price - $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist + if (! empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) + { + $fksoctosearch = 0; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + if ($productsupplier->fourn_socid != $socid) // The price we found is for another supplier, so we clear supplier price + { + $productsupplier->ref_supplier = ''; + } + } + else + { + $fksoctosearch = $object->thirdparty->id; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + } } - elseif (GETPOST('idprodfournprice') > 0) + elseif (GETPOST('idprodfournprice','alpha') > 0) { //$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. $qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist - $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch); + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice','alpha'), $qtytosearch); $res=$productsupplier->fetch($idprod); } @@ -621,8 +634,8 @@ if (empty($reshook)) $ref_supplier = $productsupplier->ref_supplier; - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); if (empty($tva_tx)) $tva_npr=0; $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); From 186f08e67bde4f9443d2639a5248f77328843c09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 15:08:13 +0200 Subject: [PATCH 016/141] Fix preview of PDF for supplier objects --- htdocs/core/lib/functions.lib.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b6108ca2f16..de0357740dc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1387,17 +1387,20 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick")) { $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->$modulepart->multidir_output[$entity] . "/"; + $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity]) . "/"; if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) { - $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart).$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it here + $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart); + $subdir.= ((! empty($subdir) && ! preg_match('/\/$/',$subdir))?'/':'').$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end } else { $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart); } + if (empty($subdir)) $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path $filepath = $dir_output . $subdir . "/"; + $file = $filepath . $objectref . ".pdf"; $relativepath = $subdir.'/'.$objectref.'.pdf'; @@ -5331,7 +5334,9 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart) // TODO // We will enhance here a common way of forging path for document storage // Here, object->id, object->ref and modulepart are required. - if (in_array($modulepart, array('thirdparty','contact','member','propal','proposal','commande','order','facture','invoice','shipment','contract','expensereport'))) + //var_dump($modulepart); + if (in_array($modulepart, array('thirdparty','contact','member','propal','proposal','commande','order','facture','invoice', + 'supplier_order','supplier_proposal','shipment','contract','expensereport'))) { $path=($object->ref?$object->ref:$object->id); } From 5524784421fc343275cd7b0974fd1cf4605d9f6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 15:24:31 +0200 Subject: [PATCH 017/141] FIX prefilled date of order must have hours too --- htdocs/fourn/commande/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 6a073fb305d..af87ef4f6ee 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2460,7 +2460,8 @@ elseif (! empty($object->id)) print ''; //print ''; print ''; From 7ad086bbdf8b75c31c83098c232c2632455a5bb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 17:18:17 +0200 Subject: [PATCH 018/141] FIX Duplicate select2 when we split a supplier order receipt item --- htdocs/fourn/commande/card.php | 3 ++- htdocs/fourn/commande/dispatch.php | 10 +++++----- htdocs/fourn/js/lib_dispatch.js | 11 +++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index af87ef4f6ee..9a527ec1b2b 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2517,7 +2517,8 @@ elseif (! empty($object->id)) print '
'.$langs->trans("ToOrder").'
'.$langs->trans("OrderDate").''; - $date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $date_com = dol_mktime(GETPOST('rehour','int'), GETPOST('remin','int'), GETPOST('resec','int'), GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int')); + if (empty($date_com)) $date_com=dol_now(); print $form->select_date($date_com,'',1,1,'',"commande",1,1,1); print '
'; //print ''; print '\n"; print "'; - print ''; - print ''; @@ -685,9 +685,9 @@ if ($id > 0 || ! empty($ref)) { // Warehouse print ''; } // date - print ''; + print ''; print "\n"; diff --git a/htdocs/fourn/js/lib_dispatch.js b/htdocs/fourn/js/lib_dispatch.js index 2b39c18cbb2..c92a4a6688c 100644 --- a/htdocs/fourn/js/lib_dispatch.js +++ b/htdocs/fourn/js/lib_dispatch.js @@ -32,10 +32,10 @@ function addDispatchLine(index, type, mode) { mode = mode || 'qtymissing' - console.log("Split line type="+type+" index="+index+" mode="+mode); - var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object + console.log("fourn/js/lib_dispatch.js Split line type="+type+" index="+index+" mode="+mode); + var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length, // position of line for batch - qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows + qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()), qtyDispatched; @@ -62,8 +62,11 @@ function addDispatchLine(index, type, mode) $row.attr('name',type+'_'+nbrTrs+'_'+index); //insert new row before last row $("tr[name^='"+type+"_'][name$='_"+index+"']:last").after($row); + //remove cloned select2 with duplicate id. - $("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); + $("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); // old way to find duplicated select2 component + $(".csswarehouse_"+nbrTrs+"_"+index+":first-child").parents("span.selection").parents(".select2").detach(); + /* Suffix of lines are: _ trs.length _ index */ $("#qty_"+nbrTrs+"_"+index).focus(); $("#qty_dispatched_0_"+index).val(qtyDispatched); From 8c748505db0bca8c988cfc450420dbbef0d9eb91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 17:25:16 +0200 Subject: [PATCH 019/141] Use parent instead of parents --- htdocs/fourn/js/lib_dispatch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/js/lib_dispatch.js b/htdocs/fourn/js/lib_dispatch.js index c92a4a6688c..c2c570643f8 100644 --- a/htdocs/fourn/js/lib_dispatch.js +++ b/htdocs/fourn/js/lib_dispatch.js @@ -65,7 +65,7 @@ function addDispatchLine(index, type, mode) //remove cloned select2 with duplicate id. $("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); // old way to find duplicated select2 component - $(".csswarehouse_"+nbrTrs+"_"+index+":first-child").parents("span.selection").parents(".select2").detach(); + $(".csswarehouse_"+nbrTrs+"_"+index+":first-child").parent("span.selection").parent(".select2").detach(); /* Suffix of lines are: _ trs.length _ index */ $("#qty_"+nbrTrs+"_"+index).focus(); From 187127ce6f8315180f0f67afa1b32b8a40fce111 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 21:19:50 +0200 Subject: [PATCH 020/141] Fix CSS --- htdocs/fourn/commande/dispatch.php | 4 ++-- htdocs/theme/eldy/style.css.php | 3 +++ htdocs/theme/md/style.css.php | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 5951972dfd8..5b4adc39638 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -624,7 +624,7 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; print ''; print ''; print ''; // Status From f461ab5f96cce539695d6c4d58c694ce986369dd Mon Sep 17 00:00:00 2001 From: hythamsoliman81 Date: Sun, 17 Jun 2018 00:12:06 +0200 Subject: [PATCH 022/141] SQL synatx error at llx_website_page.sql --- htdocs/install/mysql/tables/llx_website_page.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index d413b60e25f..c795fa254dc 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_website_page ( rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, fk_website integer NOT NULL, - type_container varchar(16) NOT NULL DEFAULT 'page' + type_container varchar(16) NOT NULL DEFAULT 'page', pageurl varchar(255) NOT NULL, aliasalt varchar(255), title varchar(255), From 7c7ee568320c23e16836494a10012115589d3ce5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Jun 2018 01:50:10 +0200 Subject: [PATCH 023/141] Fix missing email Fix avoid warning --- htdocs/compta/index.php | 7 ++++--- htdocs/core/class/smtps.class.php | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 0416fa875e0..112b7479621 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -313,7 +313,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- print '
'; -// Last modified customer invoices +// Latest modified customer invoices if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $langs->load("boxes"); @@ -323,7 +323,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $sql.= ", f.date_lim_reglement as datelimite"; $sql.= ", s.nom as name"; $sql.= ", s.rowid as socid"; - $sql.= ", s.code_client, s.code_compta"; + $sql.= ", s.code_client, s.code_compta, s.email"; $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; @@ -338,7 +338,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $sql.=$hookmanager->resPrint; $sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; - $sql.= " s.nom, s.rowid, s.code_client, s.code_compta"; + $sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email"; $sql.= " ORDER BY f.tms DESC "; $sql.= $db->plimit($max, 0); @@ -374,6 +374,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $thirdpartystatic->id=$obj->socid; $thirdpartystatic->name=$obj->name; + $thirdpartystatic->email=$obj->email; $thirdpartystatic->client=1; $thirdpartystatic->code_client = $obj->code_client; //$thirdpartystatic->code_fournisseur = $obj->code_fournisseur; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 417f175422f..5eafb29d330 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1828,9 +1828,12 @@ class SMTPs { $_errMsg = array(); - foreach ( $this->_smtpsErrors as $_err => $_info ) + if (is_array($this->_smtpsErrors)) { - $_errMsg[] = 'Error [' . $_info['num'] .']: '. $_info['msg']; + foreach ( $this->_smtpsErrors as $_err => $_info ) + { + $_errMsg[] = 'Error [' . $_info['num'] .']: '. $_info['msg']; + } } return implode("\n", $_errMsg); From 118d22cf1e29e08209e512e917785e9f588461bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 17 Jun 2018 12:07:11 +0200 Subject: [PATCH 024/141] Fix date format --- scripts/cron/cron_run_jobs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 74822e34d3c..c690d7b63ef 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -73,7 +73,7 @@ $error=0; $now=dol_now(); @set_time_limit(0); -print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=" . $userlogin . " ***** " . dol_print_date($now, 'dayrfc') . " *****\n"; +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=" . $userlogin . " ***** " . dol_print_date($now, 'dayhourrfc') . " *****\n"; // Check module cron is activated if (empty($conf->cron->enabled)) From 4c08e2ebf342bb243b16544d7e07349940e2869c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 17 Jun 2018 14:33:29 +0200 Subject: [PATCH 025/141] clean and update code --- htdocs/compta/clients.php | 4 ---- htdocs/compta/index.php | 9 --------- htdocs/compta/paiement.php | 3 --- htdocs/compta/paiement_charge.php | 5 +---- htdocs/compta/recap-compta.php | 1 - htdocs/compta/salaries/index.php | 1 - htdocs/compta/sociales/index.php | 1 - htdocs/compta/sociales/payments.php | 11 +++-------- htdocs/compta/stats/cabyuser.php | 3 +-- htdocs/compta/tva/list.php | 1 - 10 files changed, 5 insertions(+), 34 deletions(-) diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index aba6460d8e2..ceb9324961e 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -172,14 +172,10 @@ if ($resql) print ''; print "
\n"; - $var=true; - while ($i < min($num,$conf->liste_limit)) { $obj = $db->fetch_object($resql); - - print ''; print ''; if ($num) { - $var = true; $total_ttc = $totalam = $total = 0; - $var=true; while ($i < $num && $i < $max) { $objp = $db->fetch_object($result); @@ -632,7 +630,6 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $resql = $db->query($sql); if ( $resql ) { - $var = false; $num = $db->num_rows($resql); print '
'.$langs->trans("Receive").'
'.$langs->trans("DeliveryDate").''; - print $form->select_date('','',1,1,'',"commande",1,1,1); + $datepreselected = dol_now(); + print $form->select_date($datepreselected,'',1,1,'',"commande",1,1,1); print "
".$langs->trans("Delivery")."\n"; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index c55183921f2..5951972dfd8 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -626,11 +626,11 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; print ''; + print ''; $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year')); $form->select_date($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, ""); print ''; + print ''; $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo' . $suffix . 'month'), GETPOST('dluo' . $suffix . 'day'), GETPOST('dluo' . $suffix . 'year')); $form->select_date($dluodatesuffix, 'dluo' . $suffix, '', '', 1, ""); print ''; if (count($listwarehouses) > 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1); + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); } elseif (count($listwarehouses) == 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1); + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); } else { $langs->load("errors"); print $langs->trans("ErrorNoWarehouseDefined"); @@ -852,7 +852,7 @@ if ($id > 0 || ! empty($ref)) { print '' . dol_print_date($objp->datec) . '' . dol_print_date($objp->datec, "dayhour") . '
'; - print ''; + print ''; print ''; $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year')); @@ -665,7 +665,7 @@ if ($id > 0 || ! empty($ref)) { // Qty to dispatch print ''; - print ''; + print ''; print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 3d2fa9ca7d7..3979b351473 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -586,6 +586,9 @@ th .button { .soixantepercent { width: 60%; } +.quatrevingtquinzepercent { + width: 95%; +} textarea.centpercent { width: 96%; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3d24df3d6ee..9ab8b814b81 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -578,6 +578,9 @@ th .button { .soixantepercent { width: 60%; } +.quatrevingtquinzepercent { + width: 95%; +} textarea.centpercent { width: 96%; } From dcd43b715aae9e1520e2207f42082fb4af32c5e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Jun 2018 23:51:30 +0200 Subject: [PATCH 021/141] Fix look and feel v8 --- htdocs/cron/list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 9d07ee2aa33..238bd17d5c5 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -519,7 +519,11 @@ if ($num > 0) print ''; - if(!empty($obj->datenextrun)) {print dol_print_date($db->jdate($obj->datenextrun),'dayhour');} + if(!empty($obj->datenextrun)) { + if (empty($obj->status)) print ''; + print dol_print_date($db->jdate($obj->datenextrun),'dayhour'); + if (empty($obj->status)) print ''; + } print '
'; $thirdpartystatic->id=$obj->rowid; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 112b7479621..09a528b1ce7 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -568,10 +568,8 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) print '
'; @@ -664,7 +661,6 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print ''; $tot_ttc+=$obj->amount; - $var = !$var; $i++; } @@ -722,7 +718,6 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $resql = $db->query($sql); if ( $resql ) { - $var=false; $num = $db->num_rows($resql); if ($num) @@ -838,7 +833,6 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $resql = $db->query($sql); if ($resql) { - $var=false; $num = $db->num_rows($resql); $i = 0; @@ -972,7 +966,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $resql=$db->query($sql); if ($resql) { - $var=false; $num = $db->num_rows($resql); print '
'; @@ -1023,7 +1016,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $total_ttc += $obj->total_ttc; $totalam += $obj->am; $i++; - $var = !$var; } print '
'; @@ -1057,7 +1049,6 @@ if ($resql) print '
'.$chargestatic->getLibStatut(3).'
'.$langs->trans("Total").'   ('.$langs->trans("RemainderToPay").': '.price($total_ttc-$totalam).')
'; print ''.$langs->trans("TasksToDo").''; print "\n"; - $var = true; $i = 0; while ($i < $db->num_rows($resql)) { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 6c9f8014e19..c2ce95dd827 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -589,7 +589,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print "\n"; - $var=true; $total=0; $totalrecu=0; $totalrecucreditnote=0; @@ -599,7 +598,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { $objp = $db->fetch_object($resql); - $soc = new Societe($db); $soc->fetch($objp->socid); @@ -842,7 +840,6 @@ if (! GETPOST('action','aZ09')) { $num = $db->num_rows($resql); $i = 0; - $var=true; print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); print '
 
'; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index cadf897c57f..fba8723d818 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -272,7 +272,6 @@ if ($action == 'create') print ''; print "\n"; - $var=true; $total=0; $totalrecu=0; @@ -280,8 +279,6 @@ if ($action == 'create') { $objp = $charge; - - print ''; if ($objp->date_ech > 0) @@ -325,7 +322,7 @@ if ($action == 'create') if ($i > 1) { // Print total - print ""; + print ''; print ''; print ""; print ""; diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index b6e2ea26647..3a22666e2f7 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -129,7 +129,6 @@ if ($id > 0) $resql=$db->query($sql); if ($resql) { - $var=true; $num = $db->num_rows($resql); // Boucle sur chaque facture diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 8b8d732e9b8..0b70275654f 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -140,7 +140,6 @@ if ($result) $num = $db->num_rows($result); $i = 0; $total = 0 ; - $var=true; $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index c5f9cfcbead..bd323c972fe 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -137,7 +137,6 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $var=true; $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 379abd7af09..3b7f68f8c83 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -158,12 +158,10 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $total = 0; $totalnb = 0; $totalpaye = 0; - $var=true; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); - $var = !$var; print ''; // Ref payment $payment_sc_static->id=$obj->pid; @@ -253,14 +251,13 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; - $var=1; + while ($i < $num) { $obj = $db->fetch_object($result); $total = $total + $obj->amount; - print ''; print ''."\n"; @@ -355,14 +352,13 @@ while($j<$numlt) print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; - $var=1; + while ($i < $num) { $obj = $db->fetch_object($result); $total = $total + $obj->amount; - print ''; print ''."\n"; @@ -437,14 +433,13 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; - $var=1; + while ($i < $num) { $obj = $db->fetch_object($result); $total = $total + $obj->amount; - print ''; print ''."\n"; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 8b1e1f0f106..dbd5d46e61a 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -327,8 +327,7 @@ print_liste_field_titre( "", 'align="center" width="20%"' ); -print "\n"; -$var=true; +print "\n"; if (count($amount)) { $arrayforsort=$name; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 97932d7b1ba..d835b0264e1 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -141,7 +141,6 @@ if ($result) $num = $db->num_rows($result); $i = 0; $total = 0 ; - $var=true; $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; From ddbf5e59e1bff8b4b30121a2d25ad36a07bff8ce Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 18 Jun 2018 10:12:19 +0200 Subject: [PATCH 026/141] clean and update code --- htdocs/contrat/services_list.php | 1 - htdocs/don/payment/payment.php | 5 +---- htdocs/expensereport/list.php | 1 - htdocs/exports/class/export.class.php | 3 --- htdocs/exports/export.php | 12 ++---------- htdocs/exports/index.php | 6 +----- 6 files changed, 4 insertions(+), 24 deletions(-) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index c94be74b0b8..290226f815e 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -531,7 +531,6 @@ print "\n"; $contractstatic=new Contrat($db); $productstatic=new Product($db); -$var=true; $i=0; $totalarray=array(); while ($i < min($num,$limit)) diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index fe4197dbc15..d1cfaa6f0ad 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -249,7 +249,6 @@ if (GETPOST('action','aZ09') == 'create') print ''; print "\n"; - $var=true; $total=0; $totalrecu=0; @@ -257,8 +256,6 @@ if (GETPOST('action','aZ09') == 'create') { $objp = $don; - - print ''; print '"; @@ -288,7 +285,7 @@ if (GETPOST('action','aZ09') == 'create') if ($i > 1) { // Print total - print ""; + print ''; print ''; print ""; print ""; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 0caf115690d..5565512f7f5 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -644,7 +644,6 @@ if ($resql) if ($num > 0) { $i=0; - $var=true; $totalarray=array(); while ($i < min($num,$limit)) { diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 8a662c83dcf..050318944d6 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -80,7 +80,6 @@ class Export dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); - $var=true; $i=0; // Define list of modules directories into modulesdir @@ -595,8 +594,6 @@ class Export // Genere ligne de titre $objmodel->write_title($this->array_export_fields[$indice],$array_selected,$outputlangs,$this->array_export_TypeFields[$indice]); - $var=true; - while ($obj = $this->db->fetch_object($resql)) { // Process special operations diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 0a0d225e750..6d65418be3c 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -585,12 +585,10 @@ if ($step == 2 && $datatoexport) // $this->array_export_entities[0]=$module->export_fields_entities[$r]; // $this->array_export_alias[0]=$module->export_fields_alias[$r]; - $var=true; $i = 0; foreach($fieldsarray as $code=>$label) { - print ''; $i++; @@ -779,7 +777,6 @@ if ($step == 3 && $datatoexport) // Select request if all fields are selected $sqlmaxforexport=$objexport->build_sql(0, array(), array()); - $var=true; $i = 0; // on boucle sur les champs foreach($fieldsarray as $code => $label) @@ -977,7 +974,6 @@ if ($step == 4 && $datatoexport) //print ''; print ''; - $var=true; foreach($array_selected as $code=>$value) { print ''; @@ -1074,7 +1070,7 @@ if ($step == 4 && $datatoexport) print ''; print ''; print ''; - $var=false; + print ''; print ''; // Stock From afda5288a8b7ff971c029113661ee6cd4b4d03e0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 22 Jun 2018 16:27:11 +0200 Subject: [PATCH 084/141] clean and update code --- htdocs/comm/mailing/cibles.php | 9 ++------- htdocs/comm/propal/tpl/linkedobjectblock.tpl.php | 3 +-- htdocs/commande/tpl/linkedobjectblock.tpl.php | 3 +-- htdocs/compta/facture/tpl/linkedobjectblock.tpl.php | 3 +-- .../compta/facture/tpl/linkedobjectblockForRec.tpl.php | 5 ++--- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 3 +-- htdocs/expedition/tpl/linkedobjectblock.tpl.php | 3 +-- htdocs/externalsite/admin/externalsite.php | 2 -- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 3 +-- 9 files changed, 10 insertions(+), 24 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index ef3fa3d81a9..91d9fc1a423 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -76,8 +76,6 @@ if ($action == 'add') $module=GETPOST("module"); $result=-1; - $var=true; - foreach ($modulesdir as $dir) { // Load modules attributes in arrays (name, numero, orders) from dir directory @@ -278,8 +276,6 @@ if ($object->fetch($id) >= 0) clearstatcache(); - $var = true; - foreach ($modulesdir as $dir) { $modulenames=array(); @@ -332,16 +328,15 @@ if ($object->fetch($id) >= 0) // Si le module mailing est qualifie if ($qualified) { - $var = !$var; if ($allowaddtarget) { - print '
'; + print ''; print ''; } else { - print '
'; + print '
'; } print '
'; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index bb8f6f623bb..cd49ca863e6 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -45,12 +45,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("propal"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?>
diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 5381143d8ac..758a37eddb8 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -40,12 +40,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("orders"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 3964800fd2b..1a55771b963 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -39,12 +39,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("bills"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index 91056746565..5f224bc2026 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -39,15 +39,14 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("bills"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > + diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index a4b18716039..328be816327 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -39,12 +39,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("contracts"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index dacf9417313..72abfe2c4d9 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -38,12 +38,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("sendings"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/externalsite/admin/externalsite.php b/htdocs/externalsite/admin/externalsite.php index d76c23e11b0..6e585921ddb 100644 --- a/htdocs/externalsite/admin/externalsite.php +++ b/htdocs/externalsite/admin/externalsite.php @@ -92,8 +92,6 @@ print ""; print ""; print ""; -$var=true; - print ''; print '"; diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 9f57fc35c8d..8ba0884fa6a 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -40,12 +40,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("bills"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> From ca04ffe42011b5b156ab1b9e3cd1f9a787a72014 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jun 2018 17:07:49 +0200 Subject: [PATCH 085/141] Load lang --- htdocs/accountancy/admin/journals_list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 971fdc20811..f2f862a9cdd 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -30,9 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; -$langs->load("admin"); -$langs->load("compta"); -$langs->load("accountancy"); +$langs->loadLangs(array("admin","compta","accountancy")); $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $confirm=GETPOST('confirm','alpha'); From 27a27e02a1decf4e7d025a60340a5b5bf9b8cc6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jun 2018 22:53:53 +0200 Subject: [PATCH 086/141] Fix css --- htdocs/adherents/list.php | 2 +- htdocs/asset/list.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/compta/bank/list.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/contact/list.php | 4 ++-- htdocs/contrat/list.php | 2 +- htdocs/contrat/services_list.php | 2 +- htdocs/don/list.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/fichinter/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/holiday/list.php | 2 +- htdocs/modulebuilder/template/myobject_list.php | 2 +- htdocs/product/inventory/list.php | 2 +- htdocs/product/list.php | 2 +- htdocs/product/stock/list.php | 2 +- htdocs/product/stock/mouvement.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/projet/tasks/list.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/societe/website.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- htdocs/theme/eldy/style.css.php | 7 +++++++ htdocs/theme/md/style.css.php | 7 +++++++ htdocs/ticket/list.php | 2 +- htdocs/user/group/list.php | 8 +------- htdocs/user/list.php | 2 +- 32 files changed, 45 insertions(+), 37 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 7b1d9416dc2..3a1dd04443f 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -379,7 +379,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . implode(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } // Filter on categories diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 903ebc83aad..bcc2329f870 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -317,7 +317,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'
'; } $moreforfilter = ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 08860bc3c08..1a23c0b8728 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -488,7 +488,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'
'; } $i = 0; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 22d2e00a0c2..a63847421eb 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -526,7 +526,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index a262a63e045..e52e285742c 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -257,7 +257,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9d3e87f2d3c..8858577c91e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -633,7 +633,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } // If the user can view prospects other than his' diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 7a5503d07ca..d98eed5decb 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -448,11 +448,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } if ($search_firstlast_only) { - print $langs->trans("FilterOnInto", $search_firstlast_only) . $langs->trans("Lastname").", ".$langs->trans("Firstname"); + print '
'.$langs->trans("FilterOnInto", $search_firstlast_only) . $langs->trans("Lastname").", ".$langs->trans("Firstname").'
'; } $moreforfilter=''; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 49b35fdf7e1..18e78c7ff0a 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -401,7 +401,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 290226f815e..de44410e505 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -336,7 +336,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $morefilter = ''; diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 6c1e3b7efbc..1e7d93302d8 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -160,7 +160,7 @@ if ($resql) if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } print '
'; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 99b44e72fc1..14f9eb41f44 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -298,7 +298,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 5565512f7f5..b8f88210780 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -488,7 +488,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 9b054e66545..96a1199255c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -306,7 +306,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index f0e9793f9a1..773e9da06c0 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -711,7 +711,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 8c77feb2187..7f96bab0b09 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -547,7 +547,7 @@ if ($resql) if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } // If the user can view prospects other than his' diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 070b735d09d..5df3fdb314b 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -399,7 +399,7 @@ else if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index b6e2b351494..0e43aedc4e7 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -369,7 +369,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter = ''; diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 3a483291a75..74422cc2601 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -333,7 +333,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter = ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index cc985eada40..d1ea3d08a4c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -473,7 +473,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } // Filter on categories diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 6ec624bb281..aba8655fae1 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -151,7 +151,7 @@ if ($result) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 02498dbe8ff..410396a152b 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -735,7 +735,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 5ea3df84839..7c15b3fa7c5 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -302,7 +302,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } /*$moreforfilter = ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 49250154455..779091d069f 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -487,7 +487,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 02549454e8e..14703f6d3eb 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -437,7 +437,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } $morehtmlfilter = ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ec31cefdd52..411c0d4c2d5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -642,7 +642,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } // Filter on categories diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 2ff40f83764..3ce1477a9c3 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -343,7 +343,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } /*$moreforfilter = ''; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 7ab88474bac..3dcf9601944 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -415,7 +415,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $i = 0; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index fe23817ecc7..57905f6954d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -692,6 +692,13 @@ div.divsearchfield { margin-bottom: 4px; padding-left: 2px; } +.divsearchfieldfilter { + text-overflow: clip; + overflow: auto; + white-space: nowrap; + padding-bottom: 5px; + opacity: 0.6; +} div.confirmmessage { padding-top: 6px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a5d2d404571..dc330685b9c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -685,6 +685,13 @@ div.divsearchfield { margin-bottom: 4px; padding-left: 2px; } +.divsearchfieldfilter { + text-overflow: clip; + overflow: auto; + white-space: nowrap; + padding-bottom: 5px; + opacity: 0.6; +} div.confirmmessage { padding-top: 6px; } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index d654c763f9b..b3df986cde7 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -471,7 +471,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } print '
'; diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index b478f99bd59..946ba132af8 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -162,13 +162,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); - } - - if ($sall) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 29a3d0fc647..a1f0cdd5471 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -298,7 +298,7 @@ print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sorto if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; From 83f4cf67e66bc18b1c9a18c65150ef3553f30697 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jun 2018 23:21:16 +0200 Subject: [PATCH 087/141] css --- htdocs/main.inc.php | 5 ++++- htdocs/theme/eldy/style.css.php | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5139c49674a..ed44352f97d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1904,7 +1904,10 @@ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinpu $ret.=($accesskey?' accesskey="'.$accesskey.'"':''); $ret.=' placeholder="'.strip_tags($title).'"'; $ret.=' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />'; - $ret.=''; + //$ret.=''; + $ret.=''; $ret.="\n"; return $ret; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 57905f6954d..c66975046af 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2059,6 +2059,8 @@ input.vmenusearchselectcombo[type=text] { #menu_contenu_logo { /* padding-top: 0; */ } .companylogo { } .searchform { padding-top: 10px; } +.searchform input { font-size: 16px; } + a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu { white-space: nowrap; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } From 7daee6dc6bf6c840d27d3b921f117c5c9991241a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 00:07:56 +0200 Subject: [PATCH 088/141] A lot of fix of css and look and feel v8 --- htdocs/accountancy/bookkeeping/balance.php | 10 +++++----- htdocs/accountancy/bookkeeping/card.php | 6 ++++-- htdocs/accountancy/index.php | 2 +- htdocs/compta/facture/invoicetemplate_list.php | 4 ++-- htdocs/compta/facture/list.php | 6 +++--- htdocs/core/class/conf.class.php | 12 ++++++------ htdocs/langs/en_US/accountancy.lang | 1 + htdocs/theme/eldy/style.css.php | 7 ++++++- htdocs/theme/md/style.css.php | 7 ++++++- 9 files changed, 34 insertions(+), 21 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index f9cf6eec5e5..284ead4fb56 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -38,8 +38,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; $langs->loadLangs(array("accountancy")); $page = GETPOST("page"); -$sortorder = GETPOST("sortorder"); -$sortfield = GETPOST("sortfield"); +$sortorder = GETPOST("sortorder", 'alpha'); +$sortfield = GETPOST("sortfield", 'alpha'); $action = GETPOST('action', 'alpha'); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); @@ -53,7 +53,7 @@ if ($search_accountancy_code_end == - 1) { $search_accountancy_code_end = ''; } -if (GETPOST("exportcsv")) $action = 'export_csv'; +if (GETPOST("exportcsv",'alpha')) $action = 'export_csv'; $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -186,8 +186,8 @@ else { print ''; print ''; - $button = 'global->ACCOUNTING_EXPORT_FORMAT.')" />'; - print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button); + $button = 'global->ACCOUNTING_EXPORT_FORMAT.')" />'; + print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, $button, $result, $result, 'title_accountancy', 0); $moreforfilter = ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 10b3b5434fd..92c5713880c 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -555,8 +555,9 @@ if ($action == 'create') */ print "
'.$langs->trans("Amount").'
'.$langs->trans("Total").':".price($total_ttc)."".price($totalrecu)."
'.dol_print_date($db->jdate($obj->dm),'day').'
'.dol_print_date($db->jdate($obj->dm),'day').'
'.dol_print_date($db->jdate($obj->dateep),'day').'
'.$langs->trans("Amount").'
'.price($objp->amount)."
'.$langs->trans("Total").':".price($total_ttc)."".price($totalrecu)."
'.$langs->trans("FieldsTitle").'
'.$langs->trans("ExportModelName").' 
'; print ''; @@ -1091,10 +1087,8 @@ if ($step == 4 && $datatoexport) { $num = $db->num_rows($resql); $i = 0; - $var=false; while ($i < $num) { - $obj = $db->fetch_object($resql); print '
'; print $obj->label; @@ -1229,8 +1223,7 @@ if ($step == 5 && $datatoexport) print $langs->trans("NowClickToGenerateToBuildExportFile").'
'; - // Liste des formats d'exports disponibles - $var=true; + // List of available export formats print ''; print ''; print ''; @@ -1248,7 +1241,6 @@ if ($step == 5 && $datatoexport) unset($liste[$key]); } - print ''; print ''; print ''; //print ''; print ''; -$var=true; if (count($export->array_export_code)) { foreach ($export->array_export_code as $key => $value) @@ -112,8 +111,7 @@ print '
'; //print '
'; -// List of available export format -$var=true; +// List of available export formats print '
'.$langs->trans("AvailableFormats").'
'.img_picto_common($key,$objmodelexport->getPictoForKey($key)).' '; $text=$objmodelexport->getDriverDescForKey($key); diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index 01a663dc484..b23d1ff6ab7 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -60,7 +60,6 @@ print ''.$langs->trans("Module").''.$langs->trans("ExportableDatas").' 
'; print ''; print ''; @@ -125,7 +123,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; $model=new ModeleExports($db); $liste=$model->liste_modeles($db); // This is not a static method for exports because method load non static properties -$var=true; foreach($liste as $key => $val) { if (preg_match('/__\(Disabled\)__/',$liste[$key])) @@ -133,7 +130,6 @@ foreach($liste as $key => $val) $liste[$key]=preg_replace('/__\(Disabled\)__/','('.$langs->transnoentitiesnoconv("Disabled").')',$liste[$key]); } - print ''; print ''; $text=$model->getDriverDescForKey($key); From 63fb82931cb0d8427503cb27f437ac6eb6704082 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jun 2018 10:41:11 +0200 Subject: [PATCH 027/141] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c0fbfb68010..8c3bea14dae 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5067,8 +5067,8 @@ function dol_textishtml($msg,$option=0) { if (preg_match('//i',$msg)) return true; + elseif (preg_match('//i',$msg)) return true; elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true; From 95ee3325fc448a913b570a44d3cf64f0e26a7524 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jun 2018 11:11:07 +0200 Subject: [PATCH 028/141] Part of fix of #8972 --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 67de173dff7..055a100848a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014-2018 Ferran Marcet * Copyright (C) 2015-2016 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -4408,7 +4408,7 @@ else if ($id > 0 || ! empty($ref)) print ''; } // For deposit invoice - if ($object->type == Facture::TYPE_DEPOSIT && $user->rights->facture->creer && empty($discount->id)) + if ($object->type == Facture::TYPE_DEPOSIT && $user->rights->facture->creer && $object->statut > 0 && empty($discount->id)) { print ''; } From 56322281536b3f8ebd5f8f8c7925e84cd16095c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jun 2018 11:23:36 +0200 Subject: [PATCH 029/141] Update modFournisseur.class.php --- htdocs/core/modules/modFournisseur.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 01036834b35..2b5ee5c13fd 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -494,8 +494,8 @@ class modFournisseur extends DolibarrModules 'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2', 'f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription", 'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC", - 'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId', - 'p.ref'=>'ProductRef','fd.ref'=>'RefSupplier','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel' + 'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.ref'=>'RefSupplier','fd.fk_product'=>'ProductId', + 'p.ref'=>'ProductRef','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel' ); if (empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) { @@ -507,8 +507,8 @@ class modFournisseur extends DolibarrModules 's.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text", 'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.date_livraison'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric", 'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text", - 'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric", - 'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label','p.ref'=>'Text','fd.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text' + 'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.fk_product'=>'List:product:label', + 'fd.product_type'=>'Numeric','p.ref'=>'Text','fd.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text' ); $this->export_entities_array[$r]=array( 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company', From e993a411606ed3b59a216c43e3cd39d3599e61be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jun 2018 11:24:58 +0200 Subject: [PATCH 030/141] Update modFournisseur.class.php --- htdocs/core/modules/modFournisseur.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 2b5ee5c13fd..0b9ec720a46 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -507,8 +507,8 @@ class modFournisseur extends DolibarrModules 's.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text", 'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.date_livraison'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric", 'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text", - 'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.fk_product'=>'List:product:label', - 'fd.product_type'=>'Numeric','p.ref'=>'Text','fd.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text' + 'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric", + 'fd.product_type'=>'Numeric','fd.ref'=>'Text','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text' ); $this->export_entities_array[$r]=array( 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company', From 5675c8fc011f8d499b56d1274dec93e04801f42d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jun 2018 11:26:03 +0200 Subject: [PATCH 031/141] Update modFournisseur.class.php --- htdocs/core/modules/modFournisseur.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 0b9ec720a46..0dc4284df7c 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -514,8 +514,8 @@ class modFournisseur extends DolibarrModules 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company', 's.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user', 'ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line", - 'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product', - 'p.ref'=>'product','fd.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project' + 'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.ref'=>'order_line','fd.fk_product'=>'product', + 'p.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project' ); $this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object From fed61930d5e50916eaed657211b2ba943032db3b Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 18 Jun 2018 11:37:15 +0200 Subject: [PATCH 032/141] FIX : clause must not be there --- htdocs/accountancy/customer/list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index d5d828ef626..850e5cae6a9 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -198,7 +198,7 @@ $sql.=$hookmanager->resPrint; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $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"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON (p.accountancy_code_sell = aa.account_number AND aa.entity = ".$conf->entity.")"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND product_type <= 2"; @@ -235,7 +235,6 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; } $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy -$sql .= " AND aa.entity = " . $conf->entity; // Add where from hooks $parameters=array(); From 3e9bc75c9c50a4123f25fb4578b0495b5b8ffb68 Mon Sep 17 00:00:00 2001 From: a-schild Date: Mon, 18 Jun 2018 12:23:27 +0200 Subject: [PATCH 033/141] Added mailings to thirdparties Allows to select third parties as mailing targets, depending client/lead and active/inactive status --- .../mailings/thirdparties_clients.modules.php | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 htdocs/core/modules/mailings/thirdparties_clients.modules.php diff --git a/htdocs/core/modules/mailings/thirdparties_clients.modules.php b/htdocs/core/modules/mailings/thirdparties_clients.modules.php new file mode 100644 index 00000000000..060c993460f --- /dev/null +++ b/htdocs/core/modules/mailings/thirdparties_clients.modules.php @@ -0,0 +1,218 @@ + + * +* This file is an example to follow to add your own email selector inside +* the Dolibarr email tool. +* Follow instructions given in README file to know what to change to build +* your own emailing list selector. +* Code that need to be changed in this file are marked by "CHANGE THIS" tag. +*/ + +/** + * \file htdocs/core/modules/mailings/thirdparties_clients.modules.php + * \ingroup mailing + * \brief File of class to offer a selector of emailing targets with Rule 'services expired'. + */ +include_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + + +/** + * Class to offer a selector of emailing targets with Rule 'services expired'. + */ +class mailing_thirdparties_clients extends MailingTargets +{ + var $name='DolibarrClients'; + // This label is used if no translation is found for key XXX neither MailingModuleDescXXX where XXX=name is found + var $desc='Third parties by client'; + var $require_admin=0; + + var $require_module=array('contrat'); + var $picto='company'; + var $db; + var $arrayofclient=array(); + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + global $conf, $langs; + + $this->db=$db; + $langs->load("companies"); + + $this->arrayofclient=array(); + + $this->arrayofclient= array(2 => $langs->trans('Prospect'), 1 => $langs->trans('Customer'), 0 => $langs->trans('NorProspectNorCustomer')); + } + + + /** + * This is the main function that returns the array of emails + * + * @param int $mailing_id Id of mailing. No need to use it. + * @param array $filtersarray If you used the formFilter function. Empty otherwise. + * @return int <0 if error, number of emails added if ok + */ + function add_to_target($mailing_id,$filtersarray=array()) + { + $target = array(); + + // ----- Your code start here ----- + + $cibles = array(); + $j = 0; + + foreach($filtersarray as $key) + { + $clientstatus=$key; + } + + $now=dol_now(); + + // La requete doit retourner: id, email, name + $sql = "SELECT s.rowid as id, s.email, s.nom as name"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; + $sql.= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; + if ($clientstatus != -1) + { + $sql.= " AND s.client= '".$clientstatus."'"; + } + if (isset($_POST["filter_status"]) && $_POST["filter_status"] == '1') $sql.= " AND s.status=1"; + if (isset($_POST["filter_status"]) && $_POST["filter_status"] == '0') $sql.= " AND s.status=0"; + $sql.= " ORDER BY s.email"; + + // Stocke destinataires dans cibles + $result=$this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows($result); + $i = 0; + + dol_syslog(get_class($this)."::add_to_target ".$num." targets found"); + + $old = ''; + while ($i < $num) + { + $obj = $this->db->fetch_object($result); + if ($old <> $obj->email) + { + $cibles[$j] = array( + 'email' => $obj->email, + 'lastname' => $obj->name, // For thirdparties, lastname must be name + 'firstname' => '', // For thirdparties, firstname is '' + 'other' => + ('ContactLine='.$obj->cdid), + 'source_url' => $this->url($obj->id), + 'source_id' => $obj->id, + 'source_type' => 'thirdparty' + ); + $old = $obj->email; + $j++; + } + + $i++; + } + } + else + { + dol_syslog($this->db->lasterror()); + $this->error=$this->db->lasterror(); + return -1; + } + + // ----- Your code end here ----- + + return parent::add_to_target($mailing_id, $cibles); + } + + + /** + * On the main mailing area, there is a box with statistics. + * If you want to add a line in this report you must provide an + * array of SQL request that returns two field: + * One called "label", One called "nb". + * + * @return array Array with SQL requests + */ + function getSqlArrayForStats() + { + + //var $statssql=array(); + //$this->statssql[0]="SELECT field1 as label, count(distinct(email)) as nb FROM mytable WHERE email IS NOT NULL"; + + return array(); + } + + + /** + * Return here number of distinct emails returned by your selector. + * For example if this selector is used to extract 500 different + * emails from a text file, this function must return 500. + * + * @param string $sql SQL request to use to count + * @return int Number of recipients + */ + function getNbOfRecipients($sql='') + { + $now=dol_now(); + + // Example: return parent::getNbOfRecipients("SELECT count(*) as nb from dolibarr_table"); + // Example: return 500; + $sql = "SELECT count(*) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; + $sql.= " AND s.email != ''"; + + $a=parent::getNbOfRecipients($sql); + + return $a; + } + + /** + * This is to add a form filter to provide variant of selector + * If used, the HTML select must be called "filter" + * + * @return string A html select zone + */ + function formFilter() + { + global $langs; + + $s=''; + $s.=' '; + $s.=$langs->trans("Status"); + $s.=': '; + return $s; + } + + + /** + * Can include an URL link on each record provided by selector shown on target page. + * + * @param int $id ID + * @return string Url link + */ + function url($id) + { + return ''.img_object('',"company").''; + } + +} + From 62586c7c5d91a12a9b82b984f7b399524ff8fb84 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 18 Jun 2018 12:47:17 +0200 Subject: [PATCH 034/141] clean and upsdate code --- .../project/doc/doc_generic_project_odt.modules.php | 9 +++------ .../core/modules/societe/doc/doc_generic_odt.modules.php | 9 +++------ htdocs/core/tpl/contacts.tpl.php | 6 +----- htdocs/core/tpl/resource_view.tpl.php | 7 +++---- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index d2dc063df78..2f393e50002 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -452,11 +452,9 @@ class doc_generic_project_odt extends ModelePDFProjects if (! is_object($outputlangs)) $outputlangs=$langs; $sav_charset_output=$outputlangs->charset_output; $outputlangs->charset_output='UTF-8'; - - $outputlangs->load("main"); - $outputlangs->load("dict"); - $outputlangs->load("companies"); - $outputlangs->load("projects"); + + // Load translation files required by the page + $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); if ($conf->projet->dir_output) { @@ -951,7 +949,6 @@ class doc_generic_project_odt extends ModelePDFProjects $elementarray = $object->get_element_list($keyref, $tablename); if (count($elementarray)>0 && is_array($elementarray)) { - $var=true; $total_ht = 0; $total_ttc = 0; $num=count($elementarray); 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 c3472cc690a..6aa4267d827 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -197,11 +197,9 @@ class doc_generic_odt extends ModeleThirdPartyDoc if (! is_object($outputlangs)) $outputlangs=$langs; $sav_charset_output=$outputlangs->charset_output; $outputlangs->charset_output='UTF-8'; - - $outputlangs->load("main"); - $outputlangs->load("dict"); - $outputlangs->load("companies"); - $outputlangs->load("projects"); + + // Load translation files required by the page + $outputlangs->loadLangs(array("main", "dict", "companies", "projects")); if ($conf->societe->multidir_output[$object->entity]) { @@ -282,7 +280,6 @@ class doc_generic_odt extends ModeleThirdPartyDoc $result = $this->db->query($sql); $num = $this->db->num_rows($result); - $var=true; if ($num) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 0ecf01f9dd1..a6e895d5fed 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -78,7 +78,6 @@ if ($permission) {   - - -
"> +
trans("User"); ?> trans("ThirdPartyContact"); ?> diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 1603d3ff001..aff342191cb 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -36,7 +36,6 @@ else if( (array) $linked_resources && count($linked_resources) > 0) { - $var=true; foreach ($linked_resources as $linked_resource) { @@ -48,7 +47,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid')) { - print ''; + print ''; print ''; print ''; print ''; @@ -68,7 +67,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) if ($linked_resource['rowid'] == GETPOST('lineid')) $style='style="background: orange;"'; - print ''; + print ''; print '
'; print $object_resource->getNomUrl(1); @@ -102,7 +101,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) } else { - print ''; + print ''; print '
'.$langs->trans('NoResourceLinked').'
'; print '
'; print '
'; From 102f9aa84ffa09da522d826ee5d12e12044a5b59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jun 2018 13:14:35 +0200 Subject: [PATCH 035/141] FIX Problems in accountancy module when using multicompany module. --- htdocs/accountancy/customer/index.php | 61 ++++++++++------------ htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 6 +-- htdocs/accountancy/expensereport/index.php | 59 ++++++++++----------- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/supplier/index.php | 59 ++++++++++----------- htdocs/accountancy/supplier/lines.php | 3 +- htdocs/accountancy/supplier/list.php | 2 +- 8 files changed, 89 insertions(+), 105 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index aedaeda0e5b..28657e352b4 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -70,38 +70,53 @@ $year_current = $year_start; $action = GETPOST('action','aZ09'); - /* * Actions */ +if ($action == 'clean' || $action == 'validatehistory') +{ + // Clean database + $db->begin(); + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; + $sql1 .= " SET fk_code_ventilation = 0"; + $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN'; + $sql1 .= ' (SELECT accnt.rowid '; + $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; + $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; + $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ' AND accnt.entity = '.$conf->entity.')'; + $sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture WHERE entity = '.$conf->entity.')'; + $sql1 .= ' AND fk_code_ventilation <> 0'; + + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); + $resql1 = $db->query($sql1); + if (! $resql1) { + $error ++; + $db->rollback(); + setEventMessage($db->lasterror(), 'errors'); + } else { + $db->commit(); + } + // End clean database +} + if ($action == 'validatehistory') { $error = 0; $db->begin(); - // First clean corrupted data - $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sqlclean .= " SET fk_code_ventilation = 0"; - $sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN '; - $sqlclean .= ' (SELECT accnt.rowid '; - $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; - $sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; - $sqlclean .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; - $resql = $db->query($sqlclean); - // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0"; } else { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; } @@ -131,26 +146,6 @@ $textnextyear = ' begin(); -$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; -$sql1 .= " SET fk_code_ventilation = 0"; -$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN '; -$sql1 .= ' (SELECT accnt.rowid '; -$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; -$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; -$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; -dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); -$resql1 = $db->query($sql1); -if (! $resql1) { - $error ++; - $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); -} else { - $db->commit(); -} -// End clean database - print $langs->trans("DescVentilCustomer") . '
'; print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
'; print '
'; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index e696b4774d1..a475461f973 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -180,7 +180,7 @@ $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, $sql .= " fd.situation_percent, co.label as country, s.tva_intra"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; +$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $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 "; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 4d9d7532d7e..3719fd85650 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -219,9 +219,9 @@ $sql.=$hookmanager->resPrint; $sql.= " FROM " . MAIN_DB_PREFIX . "facture as f"; $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $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.fk_pcg_version = '" . $chartaccountcode."'"; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."'"; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."'"; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number 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.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.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 diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index cec7fbdced4..fd3c342b0c7 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -72,33 +72,48 @@ $action = GETPOST('action','aZ09'); * Actions */ +if ($action == 'clean' || $action == 'validatehistory') +{ + // Clean database + $db->begin(); + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; + $sql1 .= " SET fk_code_ventilation = 0"; + $sql1 .= ' WHERE erd.fk_code_ventilation NOT IN'; + $sql1 .= ' (SELECT accnt.rowid '; + $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; + $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; + $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ' AND accnt.entity = '.$conf->entity.')'; + $sql1 .= ' AND erd.fk_expensereport IN (SELECT rowid FROM ' . MAIN_DB_PREFIX . 'expensereport WHERE entity = '.$conf->entity.')'; + $sql1 .= ' AND fk_code_ventilation <> 0'; + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); + $resql1 = $db->query($sql1); + if (! $resql1) { + $error ++; + $db->rollback(); + setEventMessage($db->lasterror(), 'errors'); + } else { + $db->commit(); + } + // End clean database +} + if ($action == 'validatehistory') { $error = 0; $db->begin(); - // First clean corrupted data - $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; - $sqlclean .= " SET fk_code_ventilation = 0"; - $sqlclean .= ' WHERE erd.fk_code_ventilation NOT IN '; - $sqlclean .= ' (SELECT accnt.rowid '; - $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; - $sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; - $sqlclean .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; - $resql = $db->query($sqlclean); - // Now make the binding if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "c_type_fees as t, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " WHERE " . MAIN_DB_PREFIX . "expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " WHERE " . MAIN_DB_PREFIX . "expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number"; $sql1 .= " AND " . MAIN_DB_PREFIX . "expensereport_det.fk_code_ventilation = 0"; } else { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd, " . MAIN_DB_PREFIX . "c_type_fees as t, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; $sql1 .= " SET erd.fk_code_ventilation = accnt.rowid"; - $sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number"; $sql1 .= " AND erd.fk_code_ventilation = 0"; } @@ -128,26 +143,6 @@ $textnextyear = ' 
begin(); -$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; -$sql1 .= " SET fk_code_ventilation = 0"; -$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN '; -$sql1 .= ' (SELECT accnt.rowid '; -$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; -$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; -$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; -dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); -$resql1 = $db->query($sql1); -if (! $resql1) { - $error ++; - $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); -} else { - $db->commit(); -} -// End clean database - print $langs->trans("DescVentilExpenseReport") . '
'; print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
'; print '
'; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 2a24aa2f656..d4d67655314 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -200,7 +200,7 @@ $sql.= " aa.rowid as aarowid"; $sql.= " FROM " . MAIN_DB_PREFIX . "expensereport as er"; $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees"; -$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'"; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; $sql.= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0"; // Add search filter like if (strlen(trim($search_expensereport))) { diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index e9935fc8d78..0c0bcf256ed 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -73,33 +73,48 @@ $action = GETPOST('action','aZ09'); * Actions */ +if ($action == 'clean' || $action == 'validatehistory') +{ + // Clean database + $db->begin(); + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; + $sql1 .= " SET fk_code_ventilation = 0"; + $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN'; + $sql1 .= ' (SELECT accnt.rowid '; + $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; + $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; + $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ' AND accnt.entity = '.$conf->entity.')'; + $sql1 .= ' AND fd.fk_facture_fourn IN (SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture_fourn WHERE entity = '.$conf->entity.')'; + $sql1 .= ' AND fk_code_ventilation <> 0'; + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); + $resql1 = $db->query($sql1); + if (! $resql1) { + $error ++; + $db->rollback(); + setEventMessage($db->lasterror(), 'errors'); + } else { + $db->commit(); + } + // End clean database +} + if ($action == 'validatehistory') { $error = 0; $db->begin(); - // First clean corrupted data - $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sqlclean .= " SET fk_code_ventilation = 0"; - $sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN '; - $sqlclean .= ' (SELECT accnt.rowid '; - $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; - $sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; - $sqlclean .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; - $resql = $db->query($sqlclean); - // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; $sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0"; } else { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; } @@ -129,26 +144,6 @@ $textnextyear = ' 
begin(); -$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; -$sql1 .= " SET fk_code_ventilation = 0"; -$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN '; -$sql1 .= ' (SELECT accnt.rowid '; -$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; -$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; -$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; -dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); -$resql1 = $db->query($sql1); -if (! $resql1) { - $error ++; - $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); -} else { - $db->commit(); -} -// End clean database - print $langs->trans("DescVentilSupplier") . '
'; print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
'; print '
'; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 6ad8731a415..b12d4da70bc 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -179,12 +179,11 @@ $sql.= " aa.label, aa.account_number, "; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l"; $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 aa.rowid = l.fk_code_ventilation"; +$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = l.fk_code_ventilation"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn"; $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.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 "; -$sql.= " AND aa.rowid = l.fk_code_ventilation"; if ($search_lineid) { $sql .= natural_search("l.rowid", $search_lineid, 1); } diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index c19e1d2716c..ab03b2f433e 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -220,7 +220,7 @@ $sql.=$hookmanager->resPrint; $sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $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_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'"; +$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.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 494d6dcfef4574a29ee0c1dcb5cbd763c0662d6e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 18 Jun 2018 13:50:58 +0200 Subject: [PATCH 036/141] Fix: libelle is deprecated, use label instead --- htdocs/product/canvas/product/tpl/card_create.tpl.php | 2 +- htdocs/product/canvas/product/tpl/card_edit.tpl.php | 2 +- htdocs/product/canvas/service/tpl/card_create.tpl.php | 2 +- htdocs/product/canvas/service/tpl/card_edit.tpl.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/canvas/product/tpl/card_create.tpl.php b/htdocs/product/canvas/product/tpl/card_create.tpl.php index e763605f701..bc4b5409688 100644 --- a/htdocs/product/canvas/product/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_create.tpl.php @@ -55,7 +55,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
- + diff --git a/htdocs/product/canvas/product/tpl/card_edit.tpl.php b/htdocs/product/canvas/product/tpl/card_edit.tpl.php index c64c5dbe1e4..6c13bddb6a1 100644 --- a/htdocs/product/canvas/product/tpl/card_edit.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_edit.tpl.php @@ -55,7 +55,7 @@ dol_htmloutput_errors($object->error,$object->errors); - + diff --git a/htdocs/product/canvas/service/tpl/card_create.tpl.php b/htdocs/product/canvas/service/tpl/card_create.tpl.php index 46db54d63b8..b9dc10fd5dc 100644 --- a/htdocs/product/canvas/service/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_create.tpl.php @@ -52,7 +52,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe - + diff --git a/htdocs/product/canvas/service/tpl/card_edit.tpl.php b/htdocs/product/canvas/service/tpl/card_edit.tpl.php index 06d1b3ff612..6fc3bf3273a 100644 --- a/htdocs/product/canvas/service/tpl/card_edit.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_edit.tpl.php @@ -52,7 +52,7 @@ dol_htmloutput_errors($object->error,$object->errors); - + From 54a333c37413eb06b64ea2b0913ff56e8dda7659 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 18 Jun 2018 13:54:14 +0200 Subject: [PATCH 037/141] Fix: use label instead libelle --- htdocs/product/canvas/product/actions_card_product.class.php | 2 +- htdocs/product/canvas/service/actions_card_service.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 09508f5c2cb..6e263cde36c 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -101,7 +101,7 @@ class ActionsCardProduct $this->tpl['ref'] = $this->ref; // Label - $this->tpl['label'] = $this->libelle; + $this->tpl['label'] = $this->label; // Description $this->tpl['description'] = nl2br($this->description); diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 171e3960299..8e1ec2f9ce7 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -100,7 +100,7 @@ class ActionsCardService $this->tpl['ref'] = $this->ref; // Label - $this->tpl['label'] = $this->libelle; + $this->tpl['label'] = $this->label; // Description $this->tpl['description'] = nl2br($this->description); From 41a01758272bfa24f4baeaa39a2f82be9d628f2e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Mon, 18 Jun 2018 14:17:43 +0200 Subject: [PATCH 038/141] clean and upsdate code --- htdocs/admin/barcode.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 7c6792e1a02..a7a863c4725 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -369,7 +369,6 @@ if ($conf->produit->enabled) } $modBarCode = new $file(); - $var = !$var; print ''; print '\n"; + $i++; } - print ''; - } - else - { - dol_print_error($db); + + $db->free($resql); + + print "
'.$langs->trans("AvailableFormats").'
'.img_picto_common($model->getDriverLabelForKey($key),$model->getPictoForKey($key)).'
trans("Label"); ?>
trans("Label"); ?>
trans("Label"); ?>
trans("Label"); ?>
'.(isset($modBarCode->name)?$modBarCode->name:$modBarCode->nom)."\n"; From ce5514bd68a5c7f4e782c7c1600db88c8f43920b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jun 2018 14:37:16 +0200 Subject: [PATCH 039/141] Fix sql begin at wrong place --- htdocs/accountancy/customer/lines.php | 4 ++-- htdocs/accountancy/expensereport/lines.php | 4 ++-- htdocs/accountancy/supplier/lines.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index a475461f973..88b57dcb4a3 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -116,10 +116,10 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); } - $db->begin(); - if (! $error) { + $db->begin(); + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l"; $sql1 .= " SET l.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0'); $sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')'; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 28a44d23a5e..ff86778c7c1 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -109,10 +109,10 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); } - $db->begin(); - if (! $error) { + $db->begin(); + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql1 .= " SET erd.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0'); $sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')'; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index b12d4da70bc..bcfd87f4df4 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -117,10 +117,10 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); } - $db->begin(); - if (! $error) { + $db->begin(); + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l"; $sql1 .= " SET l.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0'); $sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')'; From 31067b62500a74e7fd8ae3347a81e16d77af2b38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Jun 2018 14:43:32 +0200 Subject: [PATCH 040/141] FIX picto for type in product link in accountany list is wrong --- htdocs/accountancy/customer/lines.php | 6 +++--- htdocs/accountancy/supplier/lines.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 88b57dcb4a3..b3de47879a9 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -174,9 +174,9 @@ print ''; $form = new Form($db); $formadvtargetemaling = new FormAdvTargetEmailing($db); @@ -490,487 +462,9 @@ if ($object->fetch($id) >= 0) { // Show email selectors if ($object->statut == 0 && $user->rights->mailing->creer) { - print_fiche_titre($langs->trans("AdvTgtTitle")); - - print '
' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - - print '' . "\n"; - - print '' . "\n"; - - // Customer name - print '' . "\n"; - - // Code Client - print '' . "\n"; - - // Address Client - print '' . "\n"; - - // Zip Client - print '' . "\n"; - - // City Client - print '' . "\n"; - - // Customer Country - print '' . "\n"; - - // State Customer - print '' . "\n"; - - // Mother Company - print '' . "\n"; - - // Prospect/Customer - $selected = $array_query['cust_typecust']; - print '' . "\n"; - - // Prospection status - print '' . "\n"; - - // Prospection comm status - print '' . "\n"; - - // Customer Type - print '' . "\n"; - - // Staff number - print '' . "\n"; - - // Sales manager - print '' . "\n"; - - // Customer Default Langauge - if (! empty($conf->global->MAIN_MULTILANGS)) { - - print '' . "\n"; - } - - if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { - // Customer Categories - print '' . "\n"; - } - - // Standard Extrafield feature - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - // fetch optionals attributes and labels - dol_include_once('/core/class/extrafields.class.php'); - $extrafields = new ExtraFields($db); - $extralabels = $extrafields->fetch_name_optionals_label('societe'); - foreach ( $extralabels as $key => $val ) { - if ($key != 'ts_nameextra' && $key != 'ts_payeur') { - print '' . "\n"; - } - } - } else { - $std_soc = new Societe($db); - $action_search = 'query'; - - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($db); - $hookmanager->initHooks(array ('thirdpartycard')); - - $parameters=array(); - if (! empty($advTarget->id)) { - $parameters = array('array_query' => $advTarget->filtervalue); - } - // Other attributes - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search); - print $hookmanager->resPrint; - } - - // State Contact - print '' . "\n"; - - // Civility - print ''; - - // contact name - print '' . "\n"; - print '' . "\n"; - - // Contact Country - print '' . "\n"; - - // Never send mass mailing - print '' . "\n"; - - // Contact Date Create - print '' . "\n"; - - // Contact update Create - print '' . "\n"; - - if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { - // Customer Categories - print '' . "\n"; - } - - // Standard Extrafield feature - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - // fetch optionals attributes and labels - dol_include_once('/core/class/extrafields.class.php'); - $extrafields = new ExtraFields($db); - $extralabels = $extrafields->fetch_name_optionals_label('socpeople'); - foreach($extrafields->attribute_type as $key=>&$value) { - if($value == 'radio')$value = 'select'; - } - - - foreach ( $extralabels as $key => $val ) { - - print '' . "\n"; - } - } - - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '
' . "\n"; - - print '' . "\n"; - - print '
' . $langs->trans('AdvTgtNameTemplate') . ''; - if (! empty($template_id)) { - $default_template = $template_id; - } else { - $default_template = $advTarget->id; - } - print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template); - print ''; - print ''; - print ''; - print $langs->trans('AdvTgtOrCreateNewFilter'); - print ''; - print ''; - print '' . "\n"; - print '
' . $langs->trans('AdvTgtTypeOfIncude') . ''; - print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']); - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help'); - print '
' . $langs->trans('ThirdPartyName'); - if (! empty($array_query['cust_name'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('CustomerCode'); - if (! empty($array_query['cust_code'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Address'); - if (! empty($array_query['cust_adress'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Zip'); - if (! empty($array_query['cust_zip'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Town'); - if (! empty($array_query['cust_city'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans("Country"); - if (count($array_query['cust_country']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']); - print '' . "\n"; - print '
' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty'); - if (count($array_query['cust_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray('cust_status', array ( - '0' => $langs->trans('ActivityCeased'), - '1' => $langs->trans('InActivity') - ), $array_query['cust_status']); - print '' . "\n"; - print '
' . $langs->trans("Maison mère"); - if (! empty($array_query['cust_mothercompany'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print ''; - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty'); - if (count($array_query['cust_typecust']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - $options_array = array ( - 2 => $langs->trans('Prospect'), - 3 => $langs->trans('ProspectCustomer'), - 1 => $langs->trans('Customer'), - 0 => $langs->trans('NorProspectNorCustomer') - ); - print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']); - print '' . "\n"; - print '
' . $langs->trans('ProspectLevel'); - if (count($array_query['cust_prospect_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1); - print '' . "\n"; - print '
' . $langs->trans('StatusProsp'); - if (count($array_query['cust_comm_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']); - print '' . "\n"; - print '
' . $langs->trans("ThirdPartyType"); - if (count($array_query['cust_typeent']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']); - print '' . "\n"; - print '
' . $langs->trans("Staff"); - if (count($array_query['cust_effectif_id']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']); - print '' . "\n"; - print '
' . $langs->trans("SalesRepresentatives"); - if (count($array_query['cust_saleman']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user); - print '' . "\n"; - print '
' . $langs->trans("DefaultLang"); - if (count($array_query['cust_language']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']); - print '' . "\n"; - print '
' . $langs->trans("CustomersCategoryShort"); - if (count($array_query['cust_categ']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']); - print '' . "\n"; - print '
' . $extrafields->attribute_label[$key]; - if (! empty($array_query['options_' . $key]) || (is_array($array_query['options_' . $key]) && count($array_query['options_' . $key]) > 0)) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { - print $langs->trans("AdvTgtMinVal") . ''; - print $langs->trans("AdvTgtMaxVal") . ''; - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { - - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->select_date('', 'options_' . $key . '_st_dt'); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->select_date('', 'options_' . $key . '_end_dt'); - print '
'; - - print '
' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'boolean')) { - print $form->selectarray('options_' . $key, array ( - '' => '', - '1' => $langs->trans('Yes'), - '0' => $langs->trans('No') - ), $array_query['options_' . $key]); - print '' . "\n"; - } elseif (($extrafields->attribute_type[$key] == 'select')) { - print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); - print '' . "\n"; - } elseif (($extrafields->attribute_type[$key] == 'sellist')) { - print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); - print '' . "\n"; - } else { - - print ''; - print '
'; - if (is_array($array_query['options_' . $key])) { - print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key])); - } else { - print $extrafields->showInputField($key, $array_query['options_' . $key]); - } - print '
'; - - print '
' . "\n"; - } - print '
' . $langs->trans('Status') . ' ' . $langs->trans('Contact'); - if (count($array_query['contact_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray('contact_status', array ( - '0' => $langs->trans('ActivityCeased'), - '1' => $langs->trans('InActivity') - ), $array_query['contact_status']); - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help'); - print '
' . $langs->trans("UserTitle"); - if (count($array_query['contact_civility']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']); - print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname'); - if (! empty($array_query['contact_lastname'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname'); - if (! empty($array_query['contact_firstname'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("Country"); - if (count($array_query['contact_country']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']); - print '' . "\n"; - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email"); - if (! empty($array_query['contact_no_email'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->selectarray('contact_no_email', array ( - '' => '', - '1' => $langs->trans('Yes'), - '0' => $langs->trans('No') - ), $array_query['contact_no_email']); - print '' . "\n"; - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation"); - if (! empty($array_query['contact_create_st_dt'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->select_date($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->select_date($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1); - print '
'; - print '
' . "\n"; - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification"); - if (! empty($array_query['contact_update_st_dt'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->select_date($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->select_date($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1); - print '
'; - print '
' . "\n"; - print '
' . $langs->trans("ContactCategoriesShort"); - if (count($array_query['contact_categ']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']); - print '' . "\n"; - print '
' . $extrafields->attribute_label[$key]; - if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { - print $langs->trans("AdvTgtMinVal") . ''; - print $langs->trans("AdvTgtMaxVal") . ''; - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { - - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->select_date('', 'options_' . $key . '_st_dt' . '_cnct'); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->select_date('', 'options_' . $key . '_end_dt' . '_cnct'); - print '
'; - - print '
' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'boolean')) { - print $form->selectarray('options_' . $key . '_cnct', array ( - '' => '', - '1' => $langs->trans('Yes'), - '0' => $langs->trans('No') - ), $array_query['options_' . $key . '_cnct']); - print '' . "\n"; - } elseif (($extrafields->attribute_type[$key] == 'select')) { - print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); - print '' . "\n"; - } elseif (($extrafields->attribute_type[$key] == 'sellist')) { - print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); - print '' . "\n"; - } else { - - print ''; - print '
'; - if (is_array($array_query['options_' . $key . '_cnct'])) { - print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct'); - } else { - print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct'); - } - print '
'; - - print '
' . "\n"; - } - print '
' . "\n"; - - print '' . "\n"; - - print '
' . "\n"; - print '' . "\n"; - print '
' . "\n"; - - print '
'; - print ''; - print_titre($langs->trans("ToClearAllRecipientsClickHere")); - print ''; - print ''; - print ''; - print ''; - print '
'; - print '
'; - print '
'; + + include DOL_DOCUMENT_ROOT . '/core/tpl/advtarget.tpl.php'; + } } diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 70efeccead3..890f107614d 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -39,7 +39,8 @@ class AdvanceTargetingMailing extends CommonObject var $name; var $entity; - var $fk_mailing; + var $fk_element; + var $type_element; var $filtervalue; var $fk_user_author; var $datec=''; @@ -92,7 +93,9 @@ class AdvanceTargetingMailing extends CommonObject $error=0; // Clean parameters - if (isset($this->fk_mailing)) $this->fk_mailing=trim($this->fk_mailing); + if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element); + if (isset($this->type_element)) $this->type_element=trim($this->type_element); + if (isset($this->name)) $this->name=trim($this->name); if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue); if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); @@ -108,7 +111,8 @@ class AdvanceTargetingMailing extends CommonObject $sql.= "name,"; $sql.= "entity,"; - $sql.= "fk_mailing,"; + $sql.= "fk_element,"; + $sql.= "type_element,"; $sql.= "filtervalue,"; $sql.= "fk_user_author,"; $sql.= "datec,"; @@ -119,7 +123,8 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " ".(! isset($this->name)?'NULL':"'".$this->db->escape($this->name)."'").","; $sql.= " ".$conf->entity.","; - $sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->db->escape($this->fk_mailing)."'").","; + $sql.= " ".(! isset($this->fk_element)?'NULL':"'".$this->db->escape($this->fk_element)."'").","; + $sql.= " ".(! isset($this->type_element)?'NULL':"'".$this->db->escape($this->type_element)."'").","; $sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").","; $sql.= " ".$user->id.","; $sql.= " '".$this->db->idate(dol_now())."',"; @@ -184,7 +189,8 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " t.name,"; $sql.= " t.entity,"; - $sql.= " t.fk_mailing,"; + $sql.= " t.fk_element,"; + $sql.= " t.type_element,"; $sql.= " t.filtervalue,"; $sql.= " t.fk_user_author,"; $sql.= " t.datec,"; @@ -206,7 +212,8 @@ class AdvanceTargetingMailing extends CommonObject $this->name = $obj->name; $this->entity = $obj->entity; - $this->fk_mailing = $obj->fk_mailing; + $this->fk_element = $obj->fk_element; + $this->type_element = $obj->type_element; $this->filtervalue = $obj->filtervalue; $this->fk_user_author = $obj->fk_user_author; $this->datec = $this->db->jdate($obj->datec); @@ -240,7 +247,8 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " t.name,"; $sql.= " t.entity,"; - $sql.= " t.fk_mailing,"; + $sql.= " t.fk_element,"; + $sql.= " t.type_element,"; $sql.= " t.filtervalue,"; $sql.= " t.fk_user_author,"; $sql.= " t.datec,"; @@ -249,9 +257,9 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t"; if (!empty($id)) { - $sql.= " WHERE t.fk_mailing = ".$id; + $sql.= " WHERE t.fk_element = ".$id." AND type_element='mailing'"; }else { - $sql.= " WHERE t.fk_mailing = ".$this->fk_mailing; + $sql.= " WHERE t.fk_element = ".$this->fk_element." AND type_element='mailing'"; } dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); @@ -266,7 +274,73 @@ class AdvanceTargetingMailing extends CommonObject $this->name = $obj->name; $this->entity = $obj->entity; - $this->fk_mailing = $obj->fk_mailing; + $this->fk_element = $obj->fk_element; + $this->type_element = $obj->type_element; + $this->filtervalue = $obj->filtervalue; + $this->fk_user_author = $obj->fk_user_author; + $this->datec = $this->db->jdate($obj->datec); + $this->fk_user_mod = $obj->fk_user_mod; + $this->tms = $this->db->jdate($obj->tms); + + } + $this->db->free($resql); + + return 1; + } + else + { + $this->error="Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); + return -1; + } + } + + + + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @return int <0 if KO, >0 if OK + */ + function fetch_by_element($id=0,$type_element='mailing') + { + global $langs; + $sql = "SELECT"; + $sql.= " t.rowid,"; + + $sql.= " t.name,"; + $sql.= " t.entity,"; + $sql.= " t.fk_element,"; + $sql.= " t.type_element,"; + $sql.= " t.filtervalue,"; + $sql.= " t.fk_user_author,"; + $sql.= " t.datec,"; + $sql.= " t.fk_user_mod,"; + $sql.= " t.tms"; + + $sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t"; + if (!empty($id)) { + $sql.= " WHERE t.fk_element = ".$id." AND type_element='$type_element'"; + }else { + $sql.= " WHERE t.fk_element = ".$this->fk_element." AND type_element='$type_element'"; + } + + dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + + $this->name = $obj->name; + $this->entity = $obj->entity; + $this->fk_element = $obj->fk_element; + $this->type_element = $obj->type_element; $this->filtervalue = $obj->filtervalue; $this->fk_user_author = $obj->fk_user_author; $this->datec = $this->db->jdate($obj->datec); @@ -299,7 +373,8 @@ class AdvanceTargetingMailing extends CommonObject $error=0; // Clean parameters - if (isset($this->fk_mailing)) $this->fk_mailing=trim($this->fk_mailing); + if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element); + if (isset($this->type_element)) $this->type_element=trim($this->type_element); if (isset($this->name)) $this->name=trim($this->name); if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue); if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); @@ -315,14 +390,14 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " name=".(isset($this->name)?"'".$this->db->escape($this->name)."'":"''").","; $sql.= " entity=".$conf->entity.","; - $sql.= " fk_mailing=".(isset($this->fk_mailing)?$this->fk_mailing:"null").","; + $sql.= " fk_element=".(isset($this->fk_element)?$this->fk_element:"null").","; + $sql.= " type_element=".(isset($this->type_element)?"'".$this->db->escape($this->type_element)."'":"null").","; $sql.= " filtervalue=".(isset($this->filtervalue)?"'".$this->db->escape($this->filtervalue)."'":"null").","; $sql.= " fk_user_mod=".$user->id; $sql.= " WHERE rowid=".$this->id; $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -432,7 +507,7 @@ class AdvanceTargetingMailing extends CommonObject global $langs,$conf; if (!empty($arrayquery)) { - $result=$this->fetch_by_mailing($this->fk_mailing); + $result=$this->fetch_by_mailing($this->fk_element); $this->filtervalue=json_encode($arrayquery); if ($result<0) { return -1; diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index c7f425f8f7a..370fe720a6d 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -417,13 +417,14 @@ class FormAdvTargetEmailing extends Form * * @return string HTML combo */ - public function selectAdvtargetemailingTemplate($htmlname='template_id',$selected=0,$showempty=0) { + public function selectAdvtargetemailingTemplate($htmlname='template_id',$selected=0,$showempty=0,$type_element='mailing') { global $conf, $user, $langs; $out = ''; - $sql = "SELECT c.rowid, c.name, c.fk_mailing"; + $sql = "SELECT c.rowid, c.name, c.fk_element"; $sql .= " FROM " . MAIN_DB_PREFIX . "advtargetemailing as c"; + $sql .= " WHERE type_element='$type_element'"; $sql .= " ORDER BY c.name"; dol_syslog ( get_class ( $this ) . "::".__METHOD__, LOG_DEBUG ); @@ -441,7 +442,7 @@ class FormAdvTargetEmailing extends Form $obj = $this->db->fetch_object ( $resql ); $label = $obj->name; if (empty($label)) { - $label=$obj->fk_mailing; + $label=$obj->fk_element; } if ($selected > 0 && $selected == $obj->rowid) { diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php new file mode 100644 index 00000000000..e1104ef84f6 --- /dev/null +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -0,0 +1,521 @@ + + $(document).ready(function() { + + // Click Function + $(":button[name=addcontact]").click(function() { + $(":hidden[name=action]").val("add"); + $("#find_customer").submit(); + }); + + $(":button[name=loadfilter]").click(function() { + $(":hidden[name=action]").val("loadfilter"); + $("#find_customer").submit(); + }); + + $(":button[name=deletefilter]").click(function() { + $(":hidden[name=action]").val("deletefilter"); + $("#find_customer").submit(); + }); + + $(":button[name=savefilter]").click(function() { + $(":hidden[name=action]").val("savefilter"); + $("#find_customer").submit(); + }); + + $(":button[name=createfilter]").click(function() { + $(":hidden[name=action]").val("createfilter"); + $("#find_customer").submit(); + }); + }); +'; + + + print_fiche_titre($langs->trans("AdvTgtTitle")); + + print '
' . "\n"; + print '
' . "\n"; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + + print '' . "\n"; + + print '' . "\n"; + + // Customer name + print '' . "\n"; + + // Code Client + print '' . "\n"; + + // Address Client + print '' . "\n"; + + // Zip Client + print '' . "\n"; + + // City Client + print '' . "\n"; + + // Customer Country + print '' . "\n"; + + // State Customer + print '' . "\n"; + + // Mother Company + print '' . "\n"; + + // Prospect/Customer + $selected = $array_query['cust_typecust']; + print '' . "\n"; + + // Prospection status + print '' . "\n"; + + // Prospection comm status + print '' . "\n"; + + // Customer Type + print '' . "\n"; + + // Staff number + print '' . "\n"; + + // Sales manager + print '' . "\n"; + + // Customer Default Langauge + if (! empty($conf->global->MAIN_MULTILANGS)) { + + print '' . "\n"; + } + + if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + // Customer Categories + print '' . "\n"; + } + + // Standard Extrafield feature + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + // fetch optionals attributes and labels + dol_include_once('/core/class/extrafields.class.php'); + $extrafields = new ExtraFields($db); + $extralabels = $extrafields->fetch_name_optionals_label('societe'); + foreach ( $extralabels as $key => $val ) { + if ($key != 'ts_nameextra' && $key != 'ts_payeur') { + print '' . "\n"; + } + } + } else { + $std_soc = new Societe($db); + $action_search = 'query'; + + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context + include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($db); + $hookmanager->initHooks(array ('thirdpartycard')); + + $parameters=array(); + if (! empty($advTarget->id)) { + $parameters = array('array_query' => $advTarget->filtervalue); + } + // Other attributes + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search); + print $hookmanager->resPrint; + } + + // State Contact + print '' . "\n"; + + // Civility + print ''; + + // contact name + print '' . "\n"; + print '' . "\n"; + + // Contact Country + print '' . "\n"; + + // Never send mass mailing + print '' . "\n"; + + // Contact Date Create + print '' . "\n"; + + // Contact update Create + print '' . "\n"; + + if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + // Customer Categories + print '' . "\n"; + } + + // Standard Extrafield feature + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + // fetch optionals attributes and labels + dol_include_once('/core/class/extrafields.class.php'); + $extrafields = new ExtraFields($db); + $extralabels = $extrafields->fetch_name_optionals_label('socpeople'); + foreach($extrafields->attribute_type as $key=>&$value) { + if($value == 'radio')$value = 'select'; + } + + + foreach ( $extralabels as $key => $val ) { + + print '' . "\n"; + } + } + + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print '
' . "\n"; + + print '' . "\n"; + + print '
' . $langs->trans('AdvTgtNameTemplate') . ''; + if (! empty($template_id)) { + $default_template = $template_id; + } else { + $default_template = $advTarget->id; + } + print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template); + print ''; + print ''; + print ''; + print $langs->trans('AdvTgtOrCreateNewFilter'); + print ''; + print ''; + print '' . "\n"; + print '
' . $langs->trans('AdvTgtTypeOfIncude') . ''; + print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']); + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help'); + print '
' . $langs->trans('ThirdPartyName'); + if (! empty($array_query['cust_name'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('CustomerCode'); + if (! empty($array_query['cust_code'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Address'); + if (! empty($array_query['cust_adress'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Zip'); + if (! empty($array_query['cust_zip'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Town'); + if (! empty($array_query['cust_city'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans("Country"); + if (count($array_query['cust_country']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']); + print '' . "\n"; + print '
' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty'); + if (count($array_query['cust_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->advMultiselectarray('cust_status', array ( + '0' => $langs->trans('ActivityCeased'), + '1' => $langs->trans('InActivity') + ), $array_query['cust_status']); + print '' . "\n"; + print '
' . $langs->trans("Maison mère"); + if (! empty($array_query['cust_mothercompany'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print ''; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty'); + if (count($array_query['cust_typecust']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + $options_array = array ( + 2 => $langs->trans('Prospect'), + 3 => $langs->trans('ProspectCustomer'), + 1 => $langs->trans('Customer'), + 0 => $langs->trans('NorProspectNorCustomer') + ); + print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']); + print '' . "\n"; + print '
' . $langs->trans('ProspectLevel'); + if (count($array_query['cust_prospect_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1); + print '' . "\n"; + print '
' . $langs->trans('StatusProsp'); + if (count($array_query['cust_comm_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']); + print '' . "\n"; + print '
' . $langs->trans("ThirdPartyType"); + if (count($array_query['cust_typeent']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']); + print '' . "\n"; + print '
' . $langs->trans("Staff"); + if (count($array_query['cust_effectif_id']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']); + print '' . "\n"; + print '
' . $langs->trans("SalesRepresentatives"); + if (count($array_query['cust_saleman']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user); + print '' . "\n"; + print '
' . $langs->trans("DefaultLang"); + if (count($array_query['cust_language']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']); + print '' . "\n"; + print '
' . $langs->trans("CustomersCategoryShort"); + if (count($array_query['cust_categ']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']); + print '' . "\n"; + print '
' . $extrafields->attribute_label[$key]; + if (! empty($array_query['options_' . $key]) || (is_array($array_query['options_' . $key]) && count($array_query['options_' . $key]) > 0)) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { + print $langs->trans("AdvTgtMinVal") . ''; + print $langs->trans("AdvTgtMaxVal") . ''; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { + + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->select_date('', 'options_' . $key . '_st_dt'); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->select_date('', 'options_' . $key . '_end_dt'); + print '
'; + + print '
' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'boolean')) { + print $form->selectarray('options_' . $key, array ( + '' => '', + '1' => $langs->trans('Yes'), + '0' => $langs->trans('No') + ), $array_query['options_' . $key]); + print '' . "\n"; + } elseif (($extrafields->attribute_type[$key] == 'select')) { + print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); + print '' . "\n"; + } elseif (($extrafields->attribute_type[$key] == 'sellist')) { + print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); + print '' . "\n"; + } else { + + print ''; + print '
'; + if (is_array($array_query['options_' . $key])) { + print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key])); + } else { + print $extrafields->showInputField($key, $array_query['options_' . $key]); + } + print '
'; + + print '
' . "\n"; + } + print '
' . $langs->trans('Status') . ' ' . $langs->trans('Contact'); + if (count($array_query['contact_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->advMultiselectarray('contact_status', array ( + '0' => $langs->trans('ActivityCeased'), + '1' => $langs->trans('InActivity') + ), $array_query['contact_status']); + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help'); + print '
' . $langs->trans("UserTitle"); + if (count($array_query['contact_civility']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']); + print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname'); + if (! empty($array_query['contact_lastname'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname'); + if (! empty($array_query['contact_firstname'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Contact') . ' ' . $langs->trans("Country"); + if (count($array_query['contact_country']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']); + print '' . "\n"; + print '
' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email"); + if (! empty($array_query['contact_no_email'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->selectarray('contact_no_email', array ( + '' => '', + '1' => $langs->trans('Yes'), + '0' => $langs->trans('No') + ), $array_query['contact_no_email']); + print '' . "\n"; + print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation"); + if (! empty($array_query['contact_create_st_dt'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->select_date($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->select_date($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1); + print '
'; + print '
' . "\n"; + print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification"); + if (! empty($array_query['contact_update_st_dt'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->select_date($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->select_date($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1); + print '
'; + print '
' . "\n"; + print '
' . $langs->trans("ContactCategoriesShort"); + if (count($array_query['contact_categ']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']); + print '' . "\n"; + print '
' . $extrafields->attribute_label[$key]; + if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { + print $langs->trans("AdvTgtMinVal") . ''; + print $langs->trans("AdvTgtMaxVal") . ''; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { + + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->select_date('', 'options_' . $key . '_st_dt' . '_cnct'); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->select_date('', 'options_' . $key . '_end_dt' . '_cnct'); + print '
'; + + print '
' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'boolean')) { + print $form->selectarray('options_' . $key . '_cnct', array ( + '' => '', + '1' => $langs->trans('Yes'), + '0' => $langs->trans('No') + ), $array_query['options_' . $key . '_cnct']); + print '' . "\n"; + } elseif (($extrafields->attribute_type[$key] == 'select')) { + print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); + print '' . "\n"; + } elseif (($extrafields->attribute_type[$key] == 'sellist')) { + print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); + print '' . "\n"; + } else { + + print ''; + print '
'; + if (is_array($array_query['options_' . $key . '_cnct'])) { + print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct'); + } else { + print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct'); + } + print '
'; + + print '
' . "\n"; + } + print '
' . "\n"; + + print '' . "\n"; + + print '
' . "\n"; + print '
' . "\n"; + print '
' . "\n"; + + print '
'; + print ''; + print_titre($langs->trans("ToClearAllRecipientsClickHere")); + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'; + print '
'; \ No newline at end of file diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b8126b4fcc8..adfe8cea7e9 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','7.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','7.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index cf0a8c8cc49..1b56391db18 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -710,3 +710,14 @@ ALTER TABLE llx_facture_rec_extrafields ADD INDEX idx_facture_rec_extrafields (f UPDATE llx_cronjob set entity = 1 where entity = 0 and label in ('RecurringInvoices', 'SendEmailsReminders'); UPDATE llx_cronjob set entity = 0 where entity = 1 and label in ('PurgeDeleteTemporaryFilesShort', 'MakeLocalDatabaseDumpShort'); + + + + +-- advtargetmailing + +ALTER TABLE llx_advtargetemailing ADD COLUMN fk_element integer NOT NULL; +ALTER TABLE llx_advtargetemailing ADD COLUMN type_element varchar(180) NOT NULL; +UPDATE llx_advtargetemailing SET fk_element = fk_mailing, type_element="mailing"; +ALTER TABLE llx_advtargetemailing DROP COLUMN fk_mailing; + diff --git a/htdocs/install/mysql/tables/llx_advtargetemailing.sql b/htdocs/install/mysql/tables/llx_advtargetemailing.sql index 395558c700f..3698e5e6626 100644 --- a/htdocs/install/mysql/tables/llx_advtargetemailing.sql +++ b/htdocs/install/mysql/tables/llx_advtargetemailing.sql @@ -22,7 +22,8 @@ CREATE TABLE llx_advtargetemailing rowid integer NOT NULL auto_increment PRIMARY KEY, name varchar(180) NOT NULL, entity integer NOT NULL DEFAULT 1, - fk_mailing integer NOT NULL, + fk_element integer NOT NULL, + type_element varchar(180) NOT NULL, filtervalue text, fk_user_author integer NOT NULL, datec datetime NOT NULL, From 81497687e9cbb4925a50961ebb5747fe64643882 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jun 2018 10:55:36 +0200 Subject: [PATCH 077/141] Fix missing oldcopy in trigger call --- htdocs/contrat/card.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index d1b53e58495..83b8e75a8fd 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -897,10 +897,7 @@ if (empty($reshook)) $cancelbutton = GETPOST('cancel','alpha'); if (!$cancelbutton) { - $result = $object->fetch($id); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } + $object->oldcopy = dol_clone($object); $result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { @@ -922,10 +919,7 @@ if (empty($reshook)) if (!$cancelbutton) { - $result = $object->fetch($id); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } + $object->oldcopy = dol_clone($object); $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { From d8ebb5da8d9535b44339908ca61c6a48592ed8aa Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Fri, 22 Jun 2018 11:02:20 +0200 Subject: [PATCH 078/141] FIX trans --- htdocs/langs/fr_FR/mails.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index b4454b00234..c3e377ecf8c 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -107,7 +107,7 @@ MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer par l'interfac ConfirmSendingEmailing=Si vous souhaitez envoyer l'e-mailing depuis cet écran, veuillez confirmer son envoi maintenant, depuis votre navigateur. LimitSendingEmailing=Remarque: L'envoi d'Emailings à partir de l'interface web se fait en plusieurs fois pour des raisons de sécurité et de timeout, %s bénéficiaires à la fois pour chaque session d'envoi. TargetsReset=Vider liste -ToClearAllRecipientsClickHere=Pour vider la liste des destinataires de cet emailing, cliquez sur le bouton +ToClearAllRecipientsClickHere=Pour vider la liste des destinataires, cliquez sur le bouton ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous NbOfEMailingsReceived=Emailings de masse reçus NbOfEMailingsSend=Emailings de masse envoyés From 45451f08b02ca6eaaca77bde406ad0333860ad88 Mon Sep 17 00:00:00 2001 From: dolibarr95 <24292300+dolibarr95@users.noreply.github.com> Date: Fri, 22 Jun 2018 12:25:14 +0200 Subject: [PATCH 079/141] Add rights check Add rights check when edit parcel informations(weight, tracking...) of a shipping --- htdocs/expedition/card.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c9e86e95619..ab860ced2e9 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -503,12 +503,16 @@ if (empty($reshook)) } // Action update - else if ($action == 'settracking_number' || $action == 'settracking_url' - || $action == 'settrueWeight' - || $action == 'settrueWidth' - || $action == 'settrueHeight' - || $action == 'settrueDepth' - || $action == 'setshipping_method_id') + else if ( + ($action == 'settracking_number' + || $action == 'settracking_url' + || $action == 'settrueWeight' + || $action == 'settrueWidth' + || $action == 'settrueHeight' + || $action == 'settrueDepth' + || $action == 'setshipping_method_id') + && $user->rights->expedition->creer + ) { $error=0; From 77e7b5793ff5bdf160849595bf71ba357cdbe49b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jun 2018 14:31:45 +0200 Subject: [PATCH 080/141] Fix translation --- htdocs/langs/en_US/bills.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index e158f7a691d..d06b1512cc6 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -110,8 +110,8 @@ SendRemindByMail=Send reminder by EMail DoPayment=Enter payment DoPaymentBack=Enter refund ConvertToReduc=Mark as credit available -ConvertExcessReceivedToReduc=Convert excess received into future discount -ConvertExcessPaidToReduc=Convert excess paid into future discount +ConvertExcessReceivedToReduc=Convert excess received into available credit +ConvertExcessPaidToReduc=Convert excess paid into available discount EnterPaymentReceivedFromCustomer=Enter payment received from customer EnterPaymentDueToCustomer=Make payment due to customer DisabledBecauseRemainderToPayIsZero=Disabled because remaining unpaid is zero From 5bee3245785a5ab475c463bbd69b85ca5818ccee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jun 2018 14:34:59 +0200 Subject: [PATCH 081/141] Update paiement.class.php --- htdocs/compta/paiement/class/paiement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 6a8628da6c3..088e14c5543 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -292,7 +292,7 @@ class Paiement extends CommonObject // Insert one discount by VAT rate category $discount = new DiscountAbsolute($this->db); $discount->fetch('',$invoice->id); - if (empty($discount->id)) { + if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here) $discount->description = '(DEPOSIT)'; From 0f80508be1c20c69f67d49ac50b4b57d6653c9d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jun 2018 14:51:47 +0200 Subject: [PATCH 082/141] Fix canvas on list is a feature going in the wall so i clean this. --- htdocs/product/list.php | 1272 +++++++++++++++++++-------------------- 1 file changed, 632 insertions(+), 640 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index de4051a933c..cc985eada40 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -242,751 +242,743 @@ if (empty($reshook)) $htmlother=new FormOther($db); -if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) -{ - $objcanvas->assign_values($action); // This must contains code to load data (must call LoadListDatas($limit, $offset, $sortfield, $sortorder)) - $objcanvas->display_canvas($action); // This is code to show template -} -else -{ - $title=$langs->trans("ProductsAndServices"); +$title=$langs->trans("ProductsAndServices"); - if ($search_type != '' && $search_type != '-1') +if ($search_type != '' && $search_type != '-1') +{ + if ($search_type == 1) { - if ($search_type == 1) - { - $texte = $langs->trans("Services"); - } - else - { - $texte = $langs->trans("Products"); - } + $texte = $langs->trans("Services"); } else { - $texte = $langs->trans("ProductsAndServices"); + $texte = $langs->trans("Products"); } +} +else +{ + $texte = $langs->trans("ProductsAndServices"); +} - $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; - $sql.= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; - $sql.= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; - $sql.= ' p.datec as date_creation, p.tms as date_update, p.pmp,'; - $sql.= ' MIN(pfp.unitprice) as minsellprice'; - if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { - $sql .= ', pac.rowid prod_comb_id'; - } - // Add fields from extrafields - if (! empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); - } - // Add fields from hooks - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; - $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; - if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)"; - if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; - // multilang - if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$langs->getDefaultLang() ."'"; - if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; - } +$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; +$sql.= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; +$sql.= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; +$sql.= ' p.datec as date_creation, p.tms as date_update, p.pmp,'; +$sql.= ' MIN(pfp.unitprice) as minsellprice'; +if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { + $sql .= ', pac.rowid prod_comb_id'; +} +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +} +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)"; +if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; +// multilang +if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$langs->getDefaultLang() ."'"; +if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; +} - $sql.= ' WHERE p.entity IN ('.getEntity('product').')'; - if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); - // if the type is not 1, we show all products (type = 0,2,3) - if (dol_strlen($search_type) && $search_type != '-1') +$sql.= ' WHERE p.entity IN ('.getEntity('product').')'; +if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); +// if the type is not 1, we show all products (type = 0,2,3) +if (dol_strlen($search_type) && $search_type != '-1') +{ + if ($search_type == 1) $sql.= " AND p.fk_product_type = 1"; + else $sql.= " AND p.fk_product_type <> 1"; +} +if ($search_ref) $sql .= natural_search('p.ref', $search_ref); +if ($search_label) $sql .= natural_search('p.label', $search_label); +if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode); +if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($search_tosell); +if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($search_tobuy); +if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; +if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid; +if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL"; +if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$db->escape($search_categ); +if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL"; +if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id; +if ($search_tobatch != '' && $search_tobatch >= 0) $sql.= " AND p.tobatch = ".$db->escape($search_tobatch); +if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell); +if ($search_accountancy_code_buy) $sql.= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy); +if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) $sql .= " AND pac.rowid IS NULL"; +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; +$sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; +$sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp'; +if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) $sql .= ', pac.rowid'; +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); +} +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +//if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet +$sql.= $db->order($sortfield,$sortorder); + +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 { - if ($search_type == 1) $sql.= " AND p.fk_product_type = 1"; - else $sql.= " AND p.fk_product_type <> 1"; + $page = 0; + $offset = 0; } - if ($search_ref) $sql .= natural_search('p.ref', $search_ref); - if ($search_label) $sql .= natural_search('p.label', $search_label); - if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode); - if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($search_tosell); - if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($search_tobuy); - if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; - if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid; - if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL"; - if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$db->escape($search_categ); - if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL"; - if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id; - if ($search_tobatch != '' && $search_tobatch >= 0) $sql.= " AND p.tobatch = ".$db->escape($search_tobatch); - if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell); - if ($search_accountancy_code_buy) $sql.= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy); - if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) $sql .= " AND pac.rowid IS NULL"; - // Add where from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; - // Add where from hooks - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; - $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; - $sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; - $sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp'; - if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) $sql .= ', pac.rowid'; - // Add fields from extrafields - if (! empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); - } - // Add fields from hooks - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; - //if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet - $sql.= $db->order($sortfield,$sortorder); +} - $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +$sql.= $db->plimit($limit + 1, $offset); + +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + + $arrayofselected=is_array($toselect)?$toselect:array(); + + if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/product/card.php?id='.$id); + exit; + } + + $helpurl=''; + if ($search_type != '') + { + if ($search_type == 0) { - $page = 0; - $offset = 0; + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + } + else if ($search_type == 1) + { + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } } - $sql.= $db->plimit($limit + 1, $offset); + llxHeader('',$title,$helpurl,''); - $resql = $db->query($sql); - if ($resql) + // Displays product removal confirmation + if (GETPOST('delprod')) { + setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs'); + } + + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sall) $param.="&sall=".urlencode($sall); + if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ); + if ($search_ref) $param="&search_ref=".urlencode($search_ref); + if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier); + if ($search_barcode) $param.=($search_barcode?"&search_barcode=".urlencode($search_barcode):""); + if ($search_label) $param.="&search_label=".urlencode($search_label); + if ($search_tosell != '') $param.="&search_tosell=".urlencode($search_tosell); + if ($search_tobuy != '') $param.="&search_tobuy=".urlencode($search_tobuy); + if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:""); + if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):""); + if ($type != '') $param.='&type='.urlencode($type); + if ($search_type != '') $param.='&search_type='.urlencode($search_type); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_tobatch) $param="&search_ref_supplier=".urlencode($search_ref_supplier); + if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell); + if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy); + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + + // List of mass actions available + $arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + if ($user->rights->produit->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + $newcardbutton=''; + $rightskey='produit'; + if($type == Product::TYPE_SERVICE) $rightskey='service'; + if($user->rights->{$rightskey}->creer) { - $num = $db->num_rows($resql); + $label='NewProduct'; + if($type == Product::TYPE_SERVICE) $label='NewService'; + $newcardbutton=''.$langs->trans($label).''; + $newcardbutton.= ''; + $newcardbutton.= ''; + } - $arrayofselected=is_array($toselect)?$toselect:array(); + print '
'; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if (empty($arrayfields['p.fk_product_type']['checked'])) print ''; - if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, $newcardbutton, '', $limit); + + $topicmail="Information"; + $modelmail="product"; + $objecttmp=new Product($db); + $trackid='prod'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + + if (! empty($catid)) + { + print "
"; + $c = new Categorie($db); + $ways = $c->print_all_ways(' > ','product/list.php'); + print " > ".$ways[0]."
\n"; + print "

"; + } + + if (! empty($canvas) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$canvas.'/actions_card_'.$canvas.'.class.php')) + { + $fieldlist = $object->field_list; + $datas = $object->list_datas; + $picto='title.png'; + $title_picto = img_picto('',$picto); + $title_text = $title; + + // Default templates directory + $template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$canvas.'/tpl/'; + // Check if a custom template is present + if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/list.tpl.php')) + { + $template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/'; + } + + include $template_dir.'list.tpl.php'; // Include native PHP templates + } + else + { + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + } + + // Filter on categories + $moreforfilter=''; + if (! empty($conf->categorie->enabled)) + { + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1); + $moreforfilter.='
'; + } + + //Show/hide child products. Hidden by default + if (!empty($conf->variants->enabled) && $search_type === 0) { + $moreforfilter.='
'; + $moreforfilter.= ''; + $moreforfilter.= ' '; + $moreforfilter.='
'; + } + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint; + else $moreforfilter=$hookmanager->resPrint; + + if ($moreforfilter) + { + print '
'; + print $moreforfilter; + print '
'; + } + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + + print '
'; + print ''."\n"; + + // Lines with input filters + print ''; + if (! empty($arrayfields['p.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['pfp.ref_fourn']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.label']['checked'])) + { + print ''; + } + // Type + if (! empty($arrayfields['p.fk_product_type']['checked'])) + { + print ''; + } + // Barcode + if (! empty($arrayfields['p.barcode']['checked'])) + { + print ''; + } + // Duration + if (! empty($arrayfields['p.duration']['checked'])) + { + print ''; + } + // Sell price + if (! empty($arrayfields['p.sellprice']['checked'])) + { + print ''; + } + // Minimum buying Price + if (! empty($arrayfields['p.minbuyprice']['checked'])) + { + print ''; + } + // Number buying Price + if (! empty($arrayfields['p.numbuyprice']['checked'])) + { + print ''; + } + // WAP + if (! empty($arrayfields['p.pmp']['checked'])) + { + print ''; + } + // Limit for alert + if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) + { + print ''; + } + // Desired stock + if (! empty($arrayfields['p.desiredstock']['checked'])) + { + print ''; + } + // Stock + if (! empty($arrayfields['p.stock']['checked'])) print ''; + // Stock + if (! empty($arrayfields['stock_virtual']['checked'])) print ''; + // To batch + if (! empty($arrayfields['p.tobatch']['checked'])) print ''; + // Accountancy code sell + if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print ''; + // Accountancy code sell + if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print ''; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['p.datec']['checked'])) + { + print ''; + } + // Date modification + if (! empty($arrayfields['p.tms']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.tosell']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.tobuy']['checked'])) + { + print ''; + } + print ''; + + print ''; + + print ''; + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"],"pfp.ref_fourn","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.fk_product_type']['checked'])) print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"],"p.fk_product_type","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.numbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.pmp']['checked'])) print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder); + // 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); + $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'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($arrayfields['p.tosell']['label'],$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($arrayfields['p.tobuy']['label'],$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + + $product_static=new Product($db); + $product_fourn =new ProductFournisseur($db); + + $i = 0; + $totalarray=array(); + while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/product/card.php?id='.$id); - exit; - } - $helpurl=''; - if ($search_type != '') - { - if ($search_type == 0) + // Multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { - $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; - } - else if ($search_type == 1) - { - $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; - } - } + $sql = "SELECT label"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; + $sql.= " WHERE fk_product=".$obj->rowid; + $sql.= " AND lang='". $db->escape($langs->getDefaultLang()) ."'"; + $sql.= " LIMIT 1"; - llxHeader('',$title,$helpurl,''); - - // Displays product removal confirmation - if (GETPOST('delprod')) { - setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs'); - } - - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.="&sall=".urlencode($sall); - if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ); - if ($search_ref) $param="&search_ref=".urlencode($search_ref); - if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier); - if ($search_barcode) $param.=($search_barcode?"&search_barcode=".urlencode($search_barcode):""); - if ($search_label) $param.="&search_label=".urlencode($search_label); - if ($search_tosell != '') $param.="&search_tosell=".urlencode($search_tosell); - if ($search_tobuy != '') $param.="&search_tobuy=".urlencode($search_tobuy); - if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:""); - if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):""); - if ($type != '') $param.='&type='.urlencode($type); - if ($search_type != '') $param.='&search_type='.urlencode($search_type); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($search_tobatch) $param="&search_ref_supplier=".urlencode($search_ref_supplier); - if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell); - if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy); - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - - // List of mass actions available - $arrayofmassactions = array( - //'presend'=>$langs->trans("SendByMail"), - //'builddoc'=>$langs->trans("PDFMerge"), - ); - if ($user->rights->produit->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); - if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - - $newcardbutton=''; - $rightskey='produit'; - if($type == Product::TYPE_SERVICE) $rightskey='service'; - if($user->rights->{$rightskey}->creer) - { - $label='NewProduct'; - if($type == Product::TYPE_SERVICE) $label='NewService'; - $newcardbutton=''.$langs->trans($label).''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } - - print ''; - if ($optioncss != '') print ''; - print ''; - 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, 'title_products.png', 0, $newcardbutton, '', $limit); - - $topicmail="Information"; - $modelmail="product"; - $objecttmp=new Product($db); - $trackid='prod'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; - - if (! empty($catid)) - { - print "
"; - $c = new Categorie($db); - $ways = $c->print_all_ways(' > ','product/list.php'); - print " > ".$ways[0]."
\n"; - print "

"; - } - - if (! empty($canvas) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$canvas.'/actions_card_'.$canvas.'.class.php')) - { - $fieldlist = $object->field_list; - $datas = $object->list_datas; - $picto='title.png'; - $title_picto = img_picto('',$picto); - $title_text = $title; - - // Default templates directory - $template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$canvas.'/tpl/'; - // Check if a custom template is present - if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/list.tpl.php')) - { - $template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/'; + $result = $db->query($sql); + if ($result) + { + $objtp = $db->fetch_object($result); + if (! empty($objtp->label)) $obj->label = $objtp->label; + } } - include $template_dir.'list.tpl.php'; // Include native PHP templates - } - else - { - if ($sall) + $product_static->id = $obj->rowid; + $product_static->ref = $obj->ref; + $product_static->ref_fourn = $obj->ref_supplier; + $product_static->label = $obj->label; + $product_static->type = $obj->fk_product_type; + $product_static->status_buy = $obj->tobuy; + $product_static->status = $obj->tosell; + $product_static->status_batch = $obj->tobatch; + $product_static->entity = $obj->entity; + $product_static->pmp = $obj->pmp; + $product_static->accountancy_code_sell = $obj->accountancy_code_sell; + $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export; + $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; + $product_static->accountancy_code_buy = $obj->accountancy_code_buy; + + if ((! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || ! empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + if ($obj->fk_product_type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Not a service + { + $product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock() + } } - // Filter on categories - $moreforfilter=''; - if (! empty($conf->categorie->enabled)) - { - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1); - $moreforfilter.='
'; - } - //Show/hide child products. Hidden by default - if (!empty($conf->variants->enabled) && $search_type === 0) { - $moreforfilter.='
'; - $moreforfilter.= ''; - $moreforfilter.= ' '; - $moreforfilter.='
'; - } + print ''; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint; - else $moreforfilter=$hookmanager->resPrint; - - if ($moreforfilter) - { - print '
'; - print $moreforfilter; - print '
'; - } - - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); - - print '
'; - print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $array=array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); + print $form->selectarray('search_type', $array, $search_type); + print ''; + print ''; + print ''; + print ' '; + print ''; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print ' '; + print '  '.$form->selectyesno($search_tobatch, '', '', '', 1).''; + print ''; + print ''; + print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$search_tosell,1); + print ''; + print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$search_tobuy,1); + print ''; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
'."\n"; - - // Lines with input filters - print ''; + // Ref if (! empty($arrayfields['p.ref']['checked'])) { - print ''; + print '\n"; + if (! $i) $totalarray['nbfield']++; } + // Ref supplier if (! empty($arrayfields['pfp.ref_fourn']['checked'])) { - print ''; + print '\n"; + if (! $i) $totalarray['nbfield']++; } + // Label if (! empty($arrayfields['p.label']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } + // Type if (! empty($arrayfields['p.fk_product_type']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } + // Barcode if (! empty($arrayfields['p.barcode']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } + // Duration if (! empty($arrayfields['p.duration']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } + // Sell price if (! empty($arrayfields['p.sellprice']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } - // Minimum buying Price + + // Better buy price if (! empty($arrayfields['p.minbuyprice']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } - // Number buying Price + + // Number of buy prices if (! empty($arrayfields['p.numbuyprice']['checked'])) { - print ''; } + // WAP if (! empty($arrayfields['p.pmp']['checked'])) { - print ''; } - // Limit for alert + + // Limit alert if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } // Desired stock if (! empty($arrayfields['p.desiredstock']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; + } + // Stock real + if (! empty($arrayfields['p.stock']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Stock virtual + if (! empty($arrayfields['stock_virtual']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Lot/Serial + if (! empty($arrayfields['p.tobatch']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; } - // Stock - if (! empty($arrayfields['p.stock']['checked'])) print ''; - // Stock - if (! empty($arrayfields['stock_virtual']['checked'])) print ''; - // To batch - if (! empty($arrayfields['p.tobatch']['checked'])) print ''; // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print ''; + if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print ''; + if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (! empty($arrayfields['p.datec']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } // Date modification if (! empty($arrayfields['p.tms']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } + + // Status (to sell) if (! empty($arrayfields['p.tosell']['checked'])) { - print ''; - } - if (! empty($arrayfields['p.tobuy']['checked'])) - { - print ''; - } - print ''; - - print ''; - - print ''; - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"],"pfp.ref_fourn","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.fk_product_type']['checked'])) print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"],"p.fk_product_type","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.numbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.pmp']['checked'])) print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder); - // 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); - $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'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($arrayfields['p.tosell']['label'],$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($arrayfields['p.tobuy']['label'],$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - - - $product_static=new Product($db); - $product_fourn =new ProductFournisseur($db); - - $i = 0; - $totalarray=array(); - while ($i < min($num,$limit)) - { - $obj = $db->fetch_object($resql); - - // Multilangs - if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active - { - $sql = "SELECT label"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; - $sql.= " WHERE fk_product=".$obj->rowid; - $sql.= " AND lang='". $db->escape($langs->getDefaultLang()) ."'"; - $sql.= " LIMIT 1"; - - $result = $db->query($sql); - if ($result) - { - $objtp = $db->fetch_object($result); - if (! empty($objtp->label)) $obj->label = $objtp->label; - } - } - - $product_static->id = $obj->rowid; - $product_static->ref = $obj->ref; - $product_static->ref_fourn = $obj->ref_supplier; - $product_static->label = $obj->label; - $product_static->type = $obj->fk_product_type; - $product_static->status_buy = $obj->tobuy; - $product_static->status = $obj->tosell; - $product_static->status_batch = $obj->tobatch; - $product_static->entity = $obj->entity; - $product_static->pmp = $obj->pmp; - $product_static->accountancy_code_sell = $obj->accountancy_code_sell; - $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export; - $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; - $product_static->accountancy_code_buy = $obj->accountancy_code_buy; - - if ((! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || ! empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock - { - if ($obj->fk_product_type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Not a service - { - $product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock() - } - } - - - print ''; - - // Ref - if (! empty($arrayfields['p.ref']['checked'])) - { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } - // Ref supplier - if (! empty($arrayfields['pfp.ref_fourn']['checked'])) - { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } - // Label - if (! empty($arrayfields['p.label']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Type - if (! empty($arrayfields['p.fk_product_type']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Barcode - if (! empty($arrayfields['p.barcode']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Duration - if (! empty($arrayfields['p.duration']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Sell price - if (! empty($arrayfields['p.sellprice']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Better buy price - if (! empty($arrayfields['p.minbuyprice']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Number of buy prices - if (! empty($arrayfields['p.numbuyprice']['checked'])) - { - print ''; - } - - // WAP - if (! empty($arrayfields['p.pmp']['checked'])) - { - print ''; - } - - // Limit alert - if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Desired stock - if (! empty($arrayfields['p.desiredstock']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Stock real - if (! empty($arrayfields['p.stock']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Stock virtual - if (! empty($arrayfields['stock_virtual']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Lot/Serial - if (! empty($arrayfields['p.tobatch']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); - $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (! empty($arrayfields['p.datec']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Date modification - if (! empty($arrayfields['p.tms']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Status (to sell) - if (! empty($arrayfields['p.tosell']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Status (to buy) - if (! empty($arrayfields['p.tobuy']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Action - print ''; if (! $i) $totalarray['nbfield']++; - - print "\n"; - $i++; } + // Status (to buy) + if (! empty($arrayfields['p.tobuy']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Action + print ''; + if (! $i) $totalarray['nbfield']++; - $db->free($resql); - - print "
'; - print ''; - print ''; + print $product_static->getNomUrl(1); + print "'; - print ''; - print ''; + print $product_static->getNomUrl(1); + print "'; - print ''; - print ''.dol_trunc($obj->label,40).''; - $array=array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); - print $form->selectarray('search_type', $array, $search_type); - print ''.$obj->fk_product_type.''; - print ''; - print ''.$obj->barcode.''; - print ' '; + print ''; + if (preg_match('/([^a-z]+)[a-z]/i',$obj->duration)) + { + if (preg_match('/([^a-z]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); + elseif (preg_match('/([^a-z]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); + elseif (preg_match('/([^a-z]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); + elseif (preg_match('/([^a-z]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); + //elseif (preg_match('/([^a-z]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); + else print $obj->duration; + } print ''; + print ''; + if ($obj->tosell) + { + if ($obj->price_base_type == 'TTC') print price($obj->price_ttc).' '.$langs->trans("TTC"); + else print price($obj->price).' '.$langs->trans("HT"); + } print ''; - print ' '; + print ''; + if ($obj->tobuy && $obj->minsellprice != '') + { + //print price($obj->minsellprice).' '.$langs->trans("HT"); + if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) + { + if ($product_fourn->product_fourn_price_id > 0) + { + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) + { + $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1); + print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"),$htmltext); + } + else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); + } + } + } print ''; - print ' '; + print ''; + if ($obj->tobuy) + { + if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) + { + $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList); + print $form->textwithpicto(count($productFournList),$htmltext); + } + } print ''; - print ' '; + print ''; + print price($product_static->pmp, 1, $langs); print ''; - print ' '; + print ''; + if ($obj->fk_product_type != 1) + { + print $obj->seuil_stock_alerte; + } print ''; - print ' '; + print ''; + if ($obj->fk_product_type != 1) + { + print $obj->desiredstock; + } print ''; + if ($obj->fk_product_type != 1) + { + if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; + print $product_static->stock_reel; + } + print ''; + if ($obj->fk_product_type != 1) + { + if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; + print $product_static->stock_theorique; + } + print ''; + print yn($obj->tobatch); + print '  '.$form->selectyesno($search_tobatch, '', '', '', 1).''.$obj->accountancy_code_sell.''.$obj->accountancy_code_buy.''; + print ''; + print dol_print_date($obj->date_creation, 'dayhour', 'tzuser'); print ''; + print ''; + print dol_print_date($obj->date_update, 'dayhour', 'tzuser'); print ''; - print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$search_tosell,1); - print ''; - print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$search_tobuy,1); - print ''; - $searchpicto=$form->showFilterButtons(); - print $searchpicto; - print '
'; - print $product_static->getNomUrl(1); - print "'; - print $product_static->getNomUrl(1); - print "'.dol_trunc($obj->label,40).''.$obj->fk_product_type.''.$obj->barcode.''; - if (preg_match('/([^a-z]+)[a-z]/i',$obj->duration)) - { - if (preg_match('/([^a-z]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); - elseif (preg_match('/([^a-z]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); - elseif (preg_match('/([^a-z]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); - elseif (preg_match('/([^a-z]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); - //elseif (preg_match('/([^a-z]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); - else print $obj->duration; - } - print ''; - if ($obj->tosell) - { - if ($obj->price_base_type == 'TTC') print price($obj->price_ttc).' '.$langs->trans("TTC"); - else print price($obj->price).' '.$langs->trans("HT"); - } - print ''; - if ($obj->tobuy && $obj->minsellprice != '') - { - //print price($obj->minsellprice).' '.$langs->trans("HT"); - if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) - { - if ($product_fourn->product_fourn_price_id > 0) - { - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) - { - $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1); - print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"),$htmltext); - } - else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); - } - } - } - print ''; - if ($obj->tobuy) - { - if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) - { - $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList); - print $form->textwithpicto(count($productFournList),$htmltext); - } - } - print ''; - print price($product_static->pmp, 1, $langs); - print ''; - if ($obj->fk_product_type != 1) - { - print $obj->seuil_stock_alerte; - } - print ''; - if ($obj->fk_product_type != 1) - { - print $obj->desiredstock; - } - print ''; - if ($obj->fk_product_type != 1) - { - if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; - print $product_static->stock_reel; - } - print ''; - if ($obj->fk_product_type != 1) - { - if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; - print $product_static->stock_theorique; - } - print ''; - print yn($obj->tobatch); - print ''.$obj->accountancy_code_sell.''.$obj->accountancy_code_buy.''; - print dol_print_date($obj->date_creation, 'dayhour', 'tzuser'); - print ''; - print dol_print_date($obj->date_update, 'dayhour', 'tzuser'); - print ''; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); - } else { - print $product_static->LibStatut($obj->tosell,5,0); - } - print ''; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); - } else { - print $product_static->LibStatut($obj->tobuy,5,1); - } - print ''; - 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 ''; + print ''; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); + } else { + print $product_static->LibStatut($obj->tosell,5,0); } print '
'; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); + } else { + print $product_static->LibStatut($obj->tobuy,5,1); + } + print ''; + 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 ''; + } + print '
"; - print "
"; + print "
"; + print ""; } + print ''; +} +else +{ + dol_print_error($db); } From 6f1101a2d60f80d5dce685ef284aea5e0998ab5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jun 2018 15:51:26 +0200 Subject: [PATCH 083/141] Update card.php --- htdocs/product/composition/card.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 7656cdd8f72..70f14f9edf5 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -342,6 +342,7 @@ if ($id > 0 || ! empty($ref)) $class='pair'; + $totalsell=0; if (count($prods_arbo)) { foreach($prods_arbo as $value) @@ -374,7 +375,7 @@ if ($id > 0 || ! empty($ref)) $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); + $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); $total+=$totalline; print '
'; @@ -385,12 +386,17 @@ if ($id > 0 || ! empty($ref)) $pricesell=$productstatic->price; if (! empty($conf->global->PRODUIT_MULTIPRICES)) { - //$pricesell='Variable'; FIXME A non-numeric value encountered + $pricesell='Variable'; + } + else + { + $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); + $totalsell+=$totallinesell; } - $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); - $totalsell+=$totallinesell; print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($pricesell,'','',0,0,-1,$conf->currency)); + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : ''); + if (is_numeric($pricesell)) print price($pricesell,'','',0,0,-1,$conf->currency)); + else print $langs->trans($pricesell); print '
trans("RepeatableInvoice"); ?> getNomUrl(1); ?>
".$langs->trans("Value")."".$langs->trans("Examples")."
'.$langs->trans("Label")."
\n"; - print ''; - print ''; + print ''; + + dol_fiche_end(); print '
'; @@ -712,5 +713,6 @@ if ($action == 'create') } dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index c1f0fb0572b..2881de98132 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -76,7 +76,7 @@ if ($conf->accounting->enabled) print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); print "
\n"; $step++; diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 87310d9b215..13db00a02c2 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -425,7 +425,7 @@ if ($resql) { print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); print ''; } @@ -434,7 +434,7 @@ if ($resql) { print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; $formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); print ''; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8858577c91e..3d983e3216a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -457,7 +457,7 @@ if ($search_month > 0) else if ($search_year > 0 && ! empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $serch_year))."'"; else - $sql.= " AND date_format(f.datef, '%m') = '".$month."'"; + $sql.= " AND date_format(f.datef, '%m') = '".$search_month."'"; } else if ($search_year > 0) { @@ -730,7 +730,7 @@ if ($resql) { print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print ''; } @@ -739,7 +739,7 @@ if ($resql) { print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; $formother->select_year($search_year_lim?$search_year_lim:-1,'search_year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print '
'.$langs->trans("Late"); print ''; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 5d07b7f4619..264d3e9c236 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -311,25 +311,25 @@ class Conf // For user storage $this->user->multidir_output = array($this->entity => $rootfordata."/users"); - $this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp"); + $this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp"); // For backward compatibility $this->user->dir_output=$rootforuser."/users"; $this->user->dir_temp=$rootforuser."/users/temp"; - // UserGroup + // For usergroup storage $this->usergroup->dir_output=$rootforuser."/usergroups"; $this->usergroup->dir_temp=$rootforuser."/usergroups/temp"; - // For propal storage + // For proposal storage $this->propal->multidir_output = array($this->entity => $rootfordata."/propale"); - $this->propal->multidir_temp = array($this->entity => $rootfordata."/propale/temp"); + $this->propal->multidir_temp = array($this->entity => $rootfordata."/propale/temp"); // For backward compatibility $this->propal->dir_output=$rootfordata."/propale"; $this->propal->dir_temp=$rootfordata."/propale/temp"; // For medias storage $this->medias->multidir_output = array($this->entity => $rootfordata."/medias"); - $this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp"); + $this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp"); // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility. @@ -399,7 +399,7 @@ class Conf // Set some default values - + //$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month $this->global->MAIN_ACTIVATE_HTML5=1; $this->global->MAIN_MAIL_USE_MULTI_PART=1; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 134d9761180..266b2fae483 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -55,6 +55,7 @@ AccountancyAreaDescChartModel=STEP %s: Create a model of chart of account from m AccountancyAreaDescChart=STEP %s: Create or check content of your chart of account from menu %s AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this, use the menu entry %s. +AccountancyAreaDescDefault=STEP %s: Define default accounting accounts. For this, use the menu entry %s. AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of expense report. For this, use the menu entry %s. AccountancyAreaDescSal=STEP %s: Define default accounting accounts for payment of salaries. For this, use the menu entry %s. AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for special expences (miscellaneous taxes). For this, use the menu entry %s. diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c66975046af..1287bf6d234 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -285,8 +285,13 @@ input.select2-input { .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], .liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create], -.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], +.liste_titre input[name=day_date_when], .liste_titre input[name=dayvalid], .liste_titre input[name=search_orderday], .liste_titre input[name=search_deliveryday], +.liste_titre input[name=search_sday], .liste_titre input[name=search_day], .liste_titre input[name=search_eday], .liste_titre input[name=sday], .liste_titre input[name=day], .liste_titre select[name=day], +.liste_titre input[name=day_lim], .liste_titre input[name=day_start], .liste_titre input[name=day_end], .liste_titre input[name=day_create], +.liste_titre input[name=search_day_lim], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create], +.liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], +.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth] { margin-right: 4px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index dc330685b9c..a3675177388 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -289,8 +289,13 @@ textarea.cke_source:focus .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], .liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create], +.liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], +.liste_titre input[name=day_date_when], .liste_titre input[name=dayvalid], .liste_titre input[name=search_orderday], .liste_titre input[name=search_deliveryday], +.liste_titre input[name=search_sday], .liste_titre input[name=search_day], .liste_titre input[name=search_eday], .liste_titre input[name=sday], .liste_titre input[name=day], .liste_titre select[name=day], +.liste_titre input[name=day_lim], .liste_titre input[name=day_start], .liste_titre input[name=day_end], .liste_titre input[name=day_create], +.liste_titre input[name=search_day_lim], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create], +.liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], -.liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] .liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth] { margin-right: 4px; From c871e81a522b885e184116bddf7a0dd022d73c8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 00:15:57 +0200 Subject: [PATCH 089/141] Trans --- htdocs/langs/en_US/ticket.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index a2b10dfb556..6cc31a25bfd 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -140,7 +140,7 @@ TicketStatByStatus=Tickets by status # Ticket=Incident ticket TicketCard=Ticket card -CreateTicket=Create new ticket +CreateTicket=Create ticket EditTicket=Edit ticket TicketsManagement=Tickets Management CreatedBy=Created by From 604a5a356814698d52f9fc270a604ba276844c62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 00:19:47 +0200 Subject: [PATCH 090/141] trans --- htdocs/langs/en_US/banks.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index fbd381bdde3..f95d0e18bf4 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - banks Bank=Bank -MenuBankCash=Bank/Cash +MenuBankCash=Bank | Cash MenuVariousPayment=Miscellaneous payments MenuNewVariousPayment=New Miscellaneous payment BankName=Bank name @@ -132,7 +132,7 @@ PaymentDateUpdateSucceeded=Payment date updated successfully PaymentDateUpdateFailed=Payment date could not be updated Transactions=Transactions BankTransactionLine=Bank entry -AllAccounts=All bank/cash accounts +AllAccounts=All bank and cash accounts BackToAccount=Back to account ShowAllAccounts=Show for all accounts FutureTransaction=Transaction in futur. No way to conciliate. From f2ac5dab4af01e68c08be7e97a5dd193d76b2755 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 10:28:06 +0200 Subject: [PATCH 091/141] Fix contextpage of some menu entries --- htdocs/core/menus/init_menu_auguria.sql | 6 +++--- htdocs/core/menus/standard/eldy.lib.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 76973a1571c..f5ef2d8eae0 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -71,11 +71,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=f&leftmenu=suppliers&contextpage=supplierslist', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=p&leftmenu=prospects&contextpage=prospectslist', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=c&leftmenu=customers&contextpage=customerslist', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -- Third parties - Contacts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 6d244f8d748..9883f10fe13 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -637,7 +637,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); + $newmenu->add("/societe/list.php?type=p&leftmenu=prospects&contextpage=customerslist", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); /* no more required, there is a filter that can do more if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); @@ -653,7 +653,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers'); + $newmenu->add("/societe/list.php?type=c&leftmenu=customers&contextpage=customerslist", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers'); $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 2, $user->rights->societe->creer); //$newmenu->add("/contact/list.php?leftmenu=customers&type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire); @@ -663,7 +663,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled)) { $langs->load("suppliers"); - $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); + $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers&contextpage=supplierlist", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire); } From 4dcc74d08f4ed20e673eb16c2f1513fd06fb90e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 11:55:04 +0200 Subject: [PATCH 092/141] Fix the "back to list" link also restore the contextpage --- htdocs/core/lib/functions.lib.php | 28 ++++++++++++++------- htdocs/core/menus/init_menu_auguria.sql | 6 ++--- htdocs/core/menus/standard/eldy.lib.php | 6 ++--- htdocs/main.inc.php | 33 +++++++++++++++++++------ htdocs/societe/list.php | 22 ++++++++--------- 5 files changed, 62 insertions(+), 33 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index de0357740dc..9201083035e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -293,7 +293,6 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu if (empty($method) || $method == 3 || $method == 4) { - $relativepathstring = $_SERVER["PHP_SELF"]; // Clean $relativepathstring if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); @@ -303,21 +302,32 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu //var_dump($user->default_values); // Code for search criteria persistence. - // Retrieve values if restore_lastsearch_values is set and there is saved values - if (! empty($_GET['restore_lastsearch_values']) && ! empty($_SESSION['lastsearch_values_'.$relativepathstring])) // Keep $_GET here + // Retrieve values if restore_lastsearch_values + if (! empty($_GET['restore_lastsearch_values'])) // Use $_GET here and not GETPOST { - $tmp=json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true); - if (is_array($tmp)) + if (! empty($_SESSION['lastsearch_values_'.$relativepathstring])) // If there is saved values { - foreach($tmp as $key => $val) + $tmp=json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true); + if (is_array($tmp)) { - if ($key == $paramname) + foreach($tmp as $key => $val) { - $out=$val; - break; + if ($key == $paramname) // We are on the requested parameter + { + $out=$val; + break; + } } } } + if (! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) // If there is saved contextpage + { + if ($paramname == 'contextpage') + { + $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; + //var_dump($paramname.' '.$out); + } + } } // Else, retreive default values if we are not doing a sort elseif (! isset($_GET['sortfield'])) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index f5ef2d8eae0..76973a1571c 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -71,11 +71,11 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=f&leftmenu=suppliers&contextpage=supplierslist', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=p&leftmenu=prospects&contextpage=prospectslist', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=c&leftmenu=customers&contextpage=customerslist', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -- Third parties - Contacts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 9883f10fe13..c854812f8ec 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -637,7 +637,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=p&leftmenu=prospects&contextpage=customerslist", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); + $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); /* no more required, there is a filter that can do more if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); @@ -653,7 +653,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=c&leftmenu=customers&contextpage=customerslist", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers'); + $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers'); $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 2, $user->rights->societe->creer); //$newmenu->add("/contact/list.php?leftmenu=customers&type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire); @@ -663,7 +663,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled)) { $langs->load("suppliers"); - $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers&contextpage=supplierlist", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); + $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire); } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index ed44352f97d..3b4c0178516 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -707,7 +707,7 @@ if (! defined('NOLOGIN')) $hookmanager->initHooks(array('main')); // Code for search criteria persistence. - if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here + if (! empty($_GET['save_lastsearch_values'])) // We must use $_GET here { $relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]); $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server @@ -720,9 +720,15 @@ if (! defined('NOLOGIN')) // We click on a link that leave a page we have to save search criteria. We save them from tmp to no tmp if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) { - $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; + $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); } + // We also save contextpage + if (! empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) + { + $_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); + } } $action = ''; @@ -1928,7 +1934,7 @@ if (! function_exists("llxFooter")) function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0) { global $conf, $langs, $user, $object; - global $delayedhtmlcontent; + global $delayedhtmlcontent, $contextpage; $ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); @@ -1936,24 +1942,37 @@ if (! function_exists("llxFooter")) dol_htmloutput_events($disabledoutputofmessages); // Code for search criteria persistence. - // Save $user->lastsearch_values if defined (define on list pages when a form field search_xxx exists) + // $user->lastsearch_values was set by the GETPOST when form field search_xxx exists if (is_object($user) && ! empty($user->lastsearch_values_tmp) && is_array($user->lastsearch_values_tmp)) { - // Clean data + // Clean and save data foreach($user->lastsearch_values_tmp as $key => $val) { - unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean arry to rebuild it just after + unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean array to rebuild it just after if (count($val) && empty($_POST['button_removefilter'])) // If there is search criteria to save and we did not click on 'Clear filter' button { if (empty($val['sortfield'])) unset($val['sortfield']); if (empty($val['sortorder'])) unset($val['sortorder']); - dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criteria)"); + dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criterias)"); $_SESSION['lastsearch_values_tmp_'.$key]=json_encode($val); unset($_SESSION['lastsearch_values_'.$key]); } } } + + $relativepathstring = $_SERVER["PHP_SELF"]; + // Clean $relativepathstring + if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); + $relativepathstring = preg_replace('/^\//', '', $relativepathstring); + $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); + if (preg_match('/list\.php$/', $relativepathstring)) + { + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); + if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage; + unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); + } + // Core error message if (! empty($conf->global->MAIN_CORE_ERROR)) { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 411c0d4c2d5..d25ffcba2e2 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -91,9 +91,9 @@ $search_level_to = GETPOST("search_level_to","alpha"); $search_stcomm=GETPOST('search_stcomm','int'); $search_import_key = GETPOST("search_import_key","alpha"); -$type=GETPOST('type'); +$type=GETPOST('type','alpha'); $optioncss=GETPOST('optioncss','alpha'); -$mode=GETPOST("mode"); +$mode=GETPOST("mode",''); $diroutputmassaction=$conf->societe->dir_output . '/temp/massgeneration/'.$user->id; @@ -108,9 +108,9 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if ($type == 'c') { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } -if ($type == 'p') { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } -if ($type == 'f') { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } +if ($type == 'c' && (empty($contextpage) || $contextpage == 'thirdpartylist')) { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } +if ($type == 'p' && (empty($contextpage) || $contextpage == 'thirdpartylist')) { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } +if ($type == 'f' && (empty($contextpage) || $contextpage == 'thirdpartylist')) { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Societe($db); @@ -533,20 +533,20 @@ $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty"),$help_url); $param=''; -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($search_all != '') $param = "&sall=".urlencode($search_all); if ($sall != '') $param.= "&sall=".urlencode($sall); -if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); -if ($search_categ_sup > 0) $param.='&search_categ_sup='.urlencode($search_categ_sup); -if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); +if ($search_categ_cus > 0) $param.= '&search_categ_cus='.urlencode($search_categ_cus); +if ($search_categ_sup > 0) $param.= '&search_categ_sup='.urlencode($search_categ_sup); +if ($search_sale > 0) $param.= '&search_sale='.urlencode($search_sale); if ($search_id > 0) $param.= "&search_id=".urlencode($search_id); if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom); if ($search_alias != '') $param.= "&search_alias=".urlencode($search_alias); if ($search_town != '') $param.= "&search_town=".urlencode($search_town); if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone); -if ($search_fax != '') $param.= "&search_fax=".urlencode($search_fax); +if ($search_fax != '') $param.= "&search_fax=".urlencode($search_fax); if ($search_email != '') $param.= "&search_email=".urlencode($search_email); if ($search_url != '') $param.= "&search_url=".urlencode($search_url); if ($search_state != '') $param.= "&search_state=".urlencode($search_state); From 06342ff80c0487adef4482192d18a5aa57a77fb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 12:06:17 +0200 Subject: [PATCH 093/141] FIX contextpage on contact list --- htdocs/contact/list.php | 15 ++++++++------- htdocs/core/lib/functions.lib.php | 6 ------ htdocs/societe/list.php | 6 +++--- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index d98eed5decb..d837a6c6421 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -42,6 +42,7 @@ $massaction=GETPOST('massaction','alpha'); $show_files=GETPOST('show_files','int'); $confirm=GETPOST('confirm','alpha'); $toselect = GETPOST('toselect', 'array'); +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contactlist'; // Security check $id = GETPOST('id','int'); @@ -81,8 +82,8 @@ if ($search_status=='') $search_status=1; // always display activ customer first $optioncss = GETPOST('optioncss','alpha'); -$type=GETPOST("type"); -$view=GETPOST("view"); +$type=GETPOST("type",'aZ'); +$view=GETPOST("view",'alpha'); $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); @@ -95,29 +96,28 @@ if (! $sortfield) $sortfield="p.lastname"; if (empty($page) || $page < 0) { $page = 0; } $offset = $limit * $page; -$contextpage='contactlist'; $titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); if ($type == "p") { - $contextpage='contactprospectlist'; + if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactprospectlist'; $titre.=' ('.$langs->trans("ThirdPartyProspects").')'; $urlfiche="card.php"; } if ($type == "c") { - $contextpage='contactcustomerlist'; + if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactcustomerlist'; $titre.=' ('.$langs->trans("ThirdPartyCustomers").')'; $urlfiche="card.php"; } else if ($type == "f") { - $contextpage='contactsupplierlist'; + if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactsupplierlist'; $titre.=' ('.$langs->trans("ThirdPartySuppliers").')'; $urlfiche="card.php"; } else if ($type == "o") { - $contextpage='contactotherlist'; + if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactotherlist'; $titre.=' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; $urlfiche=""; } @@ -435,6 +435,7 @@ print ''; print ''; print ''; +print ''; print ''; print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, $newcardbutton, '', $limit); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9201083035e..a4a874e792b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4072,10 +4072,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m $options=preg_replace('/&+/i','&',$options); if (! preg_match('/^&/',$options)) $options='&'.$options; - //print " "; - //$sortimg.= ''; - //$sortimg.= ''; - if (! $sortorder || $field1 != $sortfield1) { //$out.= ''.img_down("A-Z",0).''; @@ -4094,8 +4090,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m $sortimg.= ''.img_down("A-Z",0).''; } } - - //$sortimg.= ''; } $out.=$sortimg; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index d25ffcba2e2..ac08d1251e2 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -108,9 +108,9 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if ($type == 'c' && (empty($contextpage) || $contextpage == 'thirdpartylist')) { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } -if ($type == 'p' && (empty($contextpage) || $contextpage == 'thirdpartylist')) { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } -if ($type == 'f' && (empty($contextpage) || $contextpage == 'thirdpartylist')) { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } +if ($type == 'c') { if (empty($contextpage) || $contextpage == 'thirdpartylist') $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } +if ($type == 'p') { if (empty($contextpage) || $contextpage == 'thirdpartylist') $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } +if ($type == 'f') { if (empty($contextpage) || $contextpage == 'thirdpartylist') $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Societe($db); From eb88f1e5c96d5de3b5a35acd861f38bbd65fffa2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 12:41:03 +0200 Subject: [PATCH 094/141] Fix look and feel v8 --- htdocs/langs/en_US/users.lang | 2 +- htdocs/product/index.php | 6 ++++-- htdocs/societe/index.php | 2 +- htdocs/user/home.php | 10 +++++++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 57df8cc540d..9f840556f75 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -48,7 +48,7 @@ PasswordChangeRequest=Request to change password for %s PasswordChangeRequestSent=Request to change password for %s sent to %s. ConfirmPasswordReset=Confirm password reset MenuUsersAndGroups=Users & Groups -LastGroupsCreated=Latest %s created groups +LastGroupsCreated=Latest %s groups created LastUsersCreated=Latest %s users created ShowGroup=Show group ShowUser=Show user diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 9ea0176a553..9f11813fdee 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -302,10 +302,12 @@ if ($result) print '
'; print ''; - $colnb=5; + $colnb=4; if (empty($conf->global->PRODUIT_MULTIPRICES)) $colnb++; - print ''; + print ''; + print ''; while ($i < $num) { diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index ea1925afc08..1bed6e635a0 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -296,7 +296,7 @@ if ($result) print ''; print ''; - print ''; + print ''; print ''."\n"; while ($i < $num) diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 5dbec430687..6ace60c2fca 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -124,7 +124,9 @@ if ($resql) { $num = $db->num_rows($resql); print '
'.$transRecordedType.'
'.$transRecordedType.''.$langs->trans("FullList").''; + print '
'.$transRecordedType.' '.$langs->trans('Status').''.$langs->trans("FullList").'
'; - print ''; + print ''; + print ''; + print ''; $i = 0; while ($i < $num && $i < $max) @@ -233,11 +235,13 @@ if ($canreadperms) $resql=$db->query($sql); if ($resql) { - $colspan=2; + $colspan=1; if (! empty($conf->multicompany->enabled)) $colspan++; $num = $db->num_rows($resql); print '
'.$langs->trans("LastUsersCreated",min($num,$max)).'
'.$langs->trans("LastUsersCreated",min($num,$max)).''.$langs->trans("FullList").'
'; - print ''; + print ''; + print ''; + print ''; $i = 0; $grouptemp = new UserGroup($db); From edec89ef1e23b0310b77a60b71110a15533110b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 12:44:30 +0200 Subject: [PATCH 095/141] Prepare 7.0.3 --- ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7e319d3aabe..62bcbb19754 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,43 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 7.0.3 compared to 7.0.2 ***** +FIX: 7.0 task contact card without withproject parameters +FIX: #8722 +FIX: #8762 +FIX: #8813 +FIX: #8858 #8860 Backport better compatibility fix +FIX: #8893 to get formatted price as substitution vars +FIX: Avoid converting into reduction twice and draft invoice +FIX: bad result on fetch ProductStockEntrepot +FIX: Bad substitution key used for default send proposal email +FIX: button to pay still visible when amount null used +FIX: clause must not be there +FIX: Contact tab not visible when using canvas +FIX: dol_delete_file must work in a context without db handler loaded +FIX: entity test must be on product_fourn_price table and not product table +FIX: Fetch shipping will now fetch project id +FIX: If we enable 3 steps for supplier order approbation, we must not delete all fourn rights def. +FIX: intervention: extrafield error when calling insertExtrafields +FIX: It's not possible to remove a contact which is assigned to an event #8852 +FIX: javascript showempty error +FIX: Keep supplier proposal price for supplier order +FIX: link for projets not linked to a thirdparties +FIX: Missing extrafields in export of stock or products +FIX: missing filters during ordering +FIX: missing filters during reordering +FIX: missing parenthesis +FIX: need to filter on aa.entity for same accounting accounts available in several entities +FIX: picto for type in product link in accountany list is wrong +FIX: Problems in accountancy module when using multicompany module. +FIX: proposal: missing contact type translation key +FIX: pu_ht_devise was not converted to numeric so decimals were lost when calculating total_ht_devise +FIX: Select user on add time spent form +FIX: shipment: fk_proje(c)t not handled in fetch() and update() methods +FIX: sometimes amounts are identical but php find them different. +FIX: supplier order: product supplier ref not saved on addline +FIX: test is_erasable() must be done before call function delete() too to avoid delete invoice with &action=delete in url +FIX: wrong var name $search_month_lim ***** ChangeLog for 7.0.2 compared to 7.0.1 ***** FIX: #8023 From dbb90e80a3dc74b518b80145d5ce444e3830beb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 12:57:41 +0200 Subject: [PATCH 096/141] Fix syntax error --- htdocs/product/composition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 70f14f9edf5..7d2caabc8f8 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -395,7 +395,7 @@ if ($id > 0 || ! empty($ref)) } print ''; From 6dba88ab6e9d85b0bd183eaa83c6c56667b89063 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 14:23:07 +0200 Subject: [PATCH 097/141] Several fixes in look and feel --- htdocs/contrat/card.php | 19 +++++++++-- htdocs/core/tpl/extrafields_view.tpl.php | 4 +-- htdocs/exports/index.php | 4 +-- htdocs/imports/import.php | 41 +++++++++++++----------- htdocs/imports/index.php | 2 +- htdocs/theme/eldy/style.css.php | 24 ++++++++------ htdocs/theme/md/style.css.php | 2 +- 7 files changed, 59 insertions(+), 37 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 83b8e75a8fd..d0120d130df 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2147,13 +2147,28 @@ else if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) { - print ''; + if ($user->rights->contrat->activer) + { + print ''; + } + else + { + print ''; + } } if ($object->nbofservicesclosed < $nbofservices) { + if ($user->rights->contrat->desactiver) + { + print ''; + } + else + { + print ''; + } + //if (! $numactive) //{ - print ''; //} //else //{ diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index dca4578e4a8..52586490a43 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -90,11 +90,11 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] else { print ''; - print ''; $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; - print ' diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index b0d085838a8..15b75495c38 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1403,7 +1403,6 @@ else if ($id > 0 || ! empty($ref)) print ''; print "\n"; } - $var=true; while ($i < $num) { $objp = $db->fetch_object($resql); diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 474c6774f26..6b8ce71bfb5 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -143,7 +143,6 @@ if ($resql) print ''; } - $var=true; $bool=false; foreach ($listofstatus as $status) { @@ -198,10 +197,8 @@ if (! empty($conf->ficheinter->enabled)) if ($num) { $i = 0; - $var = true; while ($i < $num) { - $obj = $db->fetch_object($resql); print ''; print ''; @@ -319,10 +314,8 @@ if (! empty($conf->ficheinter->enabled)) if ($num) { $i = 0; - $var = true; while ($i < $num) { - $obj = $db->fetch_object($resql); print ''; print ''; print ''; $oldyear=0; -$var=true; foreach ($data as $val) { $year = $val['year']; @@ -293,7 +292,7 @@ foreach ($data as $val) { // If we have empty year $oldyear--; - print ''; + print ''; print ''; print ''; @@ -306,7 +305,7 @@ foreach ($data as $val) } - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php index dca78609c61..8bed3f28fe2 100644 --- a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php @@ -36,12 +36,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("interventions"); $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 773e9da06c0..971f99717f4 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -935,13 +935,11 @@ if ($resql) $projectstatic=new Project($db); $i=0; - $var=true; $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; $objectstatic->ref_supplier = $obj->ref_supplier; diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index bdcfb3fdca8..4ce44845bf6 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -38,12 +38,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("orders"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 7f96bab0b09..c5c726eec81 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002-2006 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García @@ -44,10 +44,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (!$user->rights->fournisseur->facture->lire) accessforbidden(); -$langs->load("bills"); -$langs->load("companies"); -$langs->load('products'); -$langs->load('projects'); +// Load translation files required by the page +$langs->loadLangs(array('products', 'bills', 'companies', 'projects')); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); @@ -823,7 +821,6 @@ if ($resql) { $i=0; - $var=true; $totalarray=array(); while ($i < min($num,$limit)) { diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index ee7f5f99769..c20b26b1263 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -146,17 +146,15 @@ if ($year) print ''; print ''; print ''; - $var=true; if (is_resource($handle)) { while (($file = readdir($handle))!==false) { if (preg_match('/^supplier_payment/i',$file)) { - $tfile = $dir . '/'.$year.'/'.$file; $relativepath = $year.'/'.$file; - print "".''; + print ''.''; print ''; print ''; } diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index fc5821b96f8..e680c18074e 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -26,8 +26,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -$langs->load("companies"); -$langs->load("bills"); +// Load translation files required by the page +$langs->loadLangs(array('bills', 'companies')); // Security check $socid = GETPOST("socid",'int'); @@ -82,7 +82,6 @@ if ($socid > 0) $resql=$db->query($sql); if ($resql) { - $var=true; $num = $db->num_rows($resql); print ''; @@ -116,7 +115,6 @@ if ($socid > 0) } $totalpaye = $fac->getSommePaiement(); - print ''; print "\n"; From 459fe7189d1bfdaee9cf856ef43958e80b9daf17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 17:55:03 +0200 Subject: [PATCH 114/141] Fix phpunit --- .../class/html.formadvtargetemailing.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 370fe720a6d..7408bb27d37 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -409,15 +409,15 @@ class FormAdvTargetEmailing extends Form } /** - * selectAdvtargetemailingTemplate + * Return a combo list to select emailing target selector * - * @param string $htmlname control name - * @param integer $selected defaut selected - * @param integer $showempty empty lines - * - * @return string HTML combo + * @param string $htmlname control name + * @param integer $selected defaut selected + * @param integer $showempty empty lines + * @param string $type_element Type element. Example: 'mailing' + * @return string HTML combo */ - public function selectAdvtargetemailingTemplate($htmlname='template_id',$selected=0,$showempty=0,$type_element='mailing') { + public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') { global $conf, $user, $langs; $out = ''; From 8693775fc5336f8cfeb44789816bfce982b936da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 18:15:49 +0200 Subject: [PATCH 115/141] Fix phpunit --- .../mailing/class/advtargetemailing.class.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 890f107614d..50d9faf0637 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -95,7 +95,7 @@ class AdvanceTargetingMailing extends CommonObject // Clean parameters if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element); if (isset($this->type_element)) $this->type_element=trim($this->type_element); - + if (isset($this->name)) $this->name=trim($this->name); if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue); if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); @@ -294,17 +294,18 @@ class AdvanceTargetingMailing extends CommonObject return -1; } } - - - - + + + + /** * Load object in memory from the database * - * @param int $id Id object - * @return int <0 if KO, >0 if OK + * @param int $id Id object + * @param string $type_element Type target + * @return int <0 if KO, >0 if OK */ - function fetch_by_element($id=0,$type_element='mailing') + function fetch_by_element($id=0, $type_element='mailing') { global $langs; $sql = "SELECT"; From c664d0c2fdaf387b43616ed924765512f5af8b17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 18:26:35 +0200 Subject: [PATCH 116/141] Fix phpunit --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index e0b5b3966dd..6882405e47e 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -539,6 +539,6 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE -- advtargetmailing ALTER TABLE llx_advtargetemailing ADD COLUMN fk_element integer NOT NULL; ALTER TABLE llx_advtargetemailing ADD COLUMN type_element varchar(180) NOT NULL; -UPDATE llx_advtargetemailing SET fk_element = fk_mailing, type_element="mailing"; +UPDATE llx_advtargetemailing SET fk_element = fk_mailing, type_element='mailing'; ALTER TABLE llx_advtargetemailing DROP COLUMN fk_mailing; From 2520ebcfaede89775c00aa4acfa1f2cb842eb553 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 18:56:49 +0200 Subject: [PATCH 117/141] Fix line --- htdocs/admin/orderdet_extrafields.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index fc6322fac64..c75551cf9f0 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -75,7 +75,7 @@ print "
\n"; $head = order_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines', $langs->trans("OrderLines"), -1, 'order'); +dol_fiche_head($head, 'attributeslines', $langs->trans("Orders"), -1, 'order'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; From bc716852583ceaef638ec674b714215737f5084a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Jun 2018 08:30:37 +0200 Subject: [PATCH 118/141] Fix migration error --- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 5 +++++ htdocs/install/mysql/migration/repair.sql | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index cf0a8c8cc49..ee4fd5f15b4 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -36,6 +36,11 @@ ALTER TABLE llx_accounting_account DROP FOREIGN KEY fk_accountingaccount_fk_pcg_ -- Drop foreign key, so next alter will be a success -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account DROP FOREIGN KEY fk_accounting_account_fk_pcg_version; +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; + -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY fk_pcg_version VARCHAR(20) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY fk_pcg_version VARCHAR(20) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_system MODIFY pcg_version VARCHAR(20) CHARACTER SET utf8; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 5f2851fd142..bcf3daaa37f 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -387,6 +387,11 @@ drop table tmp_bank_url_expense_user; -- where price = 17.5 +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; + -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_expensereport set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; From a6729b0bd125324759c9f5c0c8479e234f5703ee Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 25 Jun 2018 09:10:24 +0200 Subject: [PATCH 119/141] Fix: change field name and remove obsolete data --- htdocs/admin/dict.php | 10 +-- htdocs/core/class/html.formother.class.php | 4 +- htdocs/install/mysql/data/llx_c_ecotaxe.sql | 75 ------------------- .../install/mysql/migration/7.0.0-8.0.0.sql | 2 + htdocs/install/mysql/tables/llx_c_ecotaxe.sql | 18 ++--- 5 files changed, 18 insertions(+), 91 deletions(-) delete mode 100644 htdocs/install/mysql/data/llx_c_ecotaxe.sql diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 65ceb912ea9..696f8a0131f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -183,7 +183,7 @@ $tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.l $tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; $tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = " . getEntity($tabname[12]); $tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]); -$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1"; +$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1"; $tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; $tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; $tabsql[17]= "SELECT id as rowid, code, label, accountancy_code, active FROM ".MAIN_DB_PREFIX."c_type_fees"; @@ -261,7 +261,7 @@ $tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_ $tabfield[11]= "element,source,code,libelle,position"; $tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity"; $tabfield[13]= "code,libelle,type,entity"; -$tabfield[14]= "code,libelle,price,organization,country_id,country"; +$tabfield[14]= "code,label,price,organization,country_id,country"; $tabfield[15]= "code,libelle,width,height,unit"; $tabfield[16]= "code,libelle,sortorder"; $tabfield[17]= "code,label,accountancy_code"; @@ -300,7 +300,7 @@ $tabfieldvalue[10]= "country,code,taux,localtax1_type,localtax1,localtax2_type,l $tabfieldvalue[11]= "element,source,code,libelle,position"; $tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder"; $tabfieldvalue[13]= "code,libelle,type"; -$tabfieldvalue[14]= "code,libelle,price,organization,country"; +$tabfieldvalue[14]= "code,label,price,organization,country"; $tabfieldvalue[15]= "code,libelle,width,height,unit"; $tabfieldvalue[16]= "code,libelle,sortorder"; $tabfieldvalue[17]= "code,label,accountancy_code"; @@ -339,7 +339,7 @@ $tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type, $tabfieldinsert[11]= "element,source,code,libelle,position"; $tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity"; $tabfieldinsert[13]= "code,libelle,type,entity"; -$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays"; +$tabfieldinsert[14]= "code,label,price,organization,fk_pays"; $tabfieldinsert[15]= "code,label,width,height,unit"; $tabfieldinsert[16]= "code,label,sortorder"; $tabfieldinsert[17]= "code,label,accountancy_code"; @@ -419,7 +419,7 @@ $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[14]= (! empty($conf->product->enabled) && ! empty($conf->ecotax->enabled)); +$tabcond[14]= (! empty($conf->product->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)); diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 4eb59a1c1ce..098b75a81b6 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -165,7 +165,7 @@ class FormOther { global $langs; - $sql = "SELECT e.rowid, e.code, e.libelle, e.price, e.organization,"; + $sql = "SELECT e.rowid, e.code, e.label, e.price, e.organization,"; $sql.= " c.label as country"; $sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_country as c"; $sql.= " WHERE e.active = 1 AND e.fk_pays = c.rowid"; @@ -191,7 +191,7 @@ class FormOther else { print '
'; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 1305a6b25f0..b19f63e0ab3 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -868,12 +868,13 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print ''; print ''; print ''; print ''; From 3d9b1918069eb4a448c46e3fb0f9eb3a5cfaf806 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 25 Jun 2018 12:16:02 +0200 Subject: [PATCH 122/141] Fix: restore and update example data --- htdocs/install/mysql/data/llx_c_ecotaxe.sql | 52 +++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 htdocs/install/mysql/data/llx_c_ecotaxe.sql diff --git a/htdocs/install/mysql/data/llx_c_ecotaxe.sql b/htdocs/install/mysql/data/llx_c_ecotaxe.sql new file mode 100644 index 00000000000..f500c215aaf --- /dev/null +++ b/htdocs/install/mysql/data/llx_c_ecotaxe.sql @@ -0,0 +1,52 @@ +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2009 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2018 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- +-- 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 . +-- +-- + +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l'install et tous les sigles '--' sont supprimés. +-- + +-- +-- Eco-Taxes +-- + +-- France (Organisme Eco-systèmes) +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (1, '25040', 'PETIT APPAREILS MENAGERS', 0.25, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (2, '25050', 'TRES PETIT APPAREILS MENAGERS', 0.08, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (3, '32070', 'ECRAN POIDS < 5 KG', 2.08, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (4, '32080', 'ECRAN POIDS > 5 KG', 1.25, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (5, '32051', 'ORDINATEUR PORTABLE', 0.42, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (6, '32061', 'TABLETTE INFORMATIQUE', 0.84, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (7, '36011', 'ORDINATEUR FIXE (UC)', 1.15, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (8, '36021', 'IMPRIMANTES', 0.83, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (9, '36030', 'IT (INFORMATIQUE ET TELECOMS)', 0.83, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (10, '36040', 'PETIT IT (CLAVIERS / SOURIS)', 0.08, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (11, '36050', 'TELEPHONIE MOBILE', 0.02, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (12, '36060', 'CONNECTIQUE CABLES', 0.02, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (13, '45010', 'GROS MATERIEL GRAND PUBLIC (TELEAGRANDISSEURS)', 1.67, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (14, '45020', 'MOYEN MATERIEL GRAND PUBLIC (LOUPES ELECTRONIQUES)', 0.42, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (15, '45030', 'PETIT MATERIEL GRAND PUBLIC (VIE QUOTIDIENNE)', 0.08, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (16, '75030', 'JOUETS < 0,5 KG', 0.08, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (17, '75040', 'JOUETS ENTRE 0,5 KG ET 10 KG', 0.17, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (18, '74050', 'JOUETS > 10 KG', 1.67, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (19, '85010', 'EQUIPEMENT MEDICAL < 0,5 KG', 0.08, 'Eco-systèmes', 1, 1); From a78ba20c9b31095f5b7d9a5712510de42ca9c987 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 25 Jun 2018 12:20:08 +0200 Subject: [PATCH 123/141] Fix: update price format --- htdocs/install/mysql/data/llx_c_ecotaxe.sql | 38 ++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_ecotaxe.sql b/htdocs/install/mysql/data/llx_c_ecotaxe.sql index f500c215aaf..845ffa1e685 100644 --- a/htdocs/install/mysql/data/llx_c_ecotaxe.sql +++ b/htdocs/install/mysql/data/llx_c_ecotaxe.sql @@ -31,22 +31,22 @@ -- -- France (Organisme Eco-systèmes) -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (1, '25040', 'PETIT APPAREILS MENAGERS', 0.25, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (2, '25050', 'TRES PETIT APPAREILS MENAGERS', 0.08, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (3, '32070', 'ECRAN POIDS < 5 KG', 2.08, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (4, '32080', 'ECRAN POIDS > 5 KG', 1.25, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (5, '32051', 'ORDINATEUR PORTABLE', 0.42, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (6, '32061', 'TABLETTE INFORMATIQUE', 0.84, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (7, '36011', 'ORDINATEUR FIXE (UC)', 1.15, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (8, '36021', 'IMPRIMANTES', 0.83, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (9, '36030', 'IT (INFORMATIQUE ET TELECOMS)', 0.83, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (10, '36040', 'PETIT IT (CLAVIERS / SOURIS)', 0.08, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (11, '36050', 'TELEPHONIE MOBILE', 0.02, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (12, '36060', 'CONNECTIQUE CABLES', 0.02, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (13, '45010', 'GROS MATERIEL GRAND PUBLIC (TELEAGRANDISSEURS)', 1.67, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (14, '45020', 'MOYEN MATERIEL GRAND PUBLIC (LOUPES ELECTRONIQUES)', 0.42, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (15, '45030', 'PETIT MATERIEL GRAND PUBLIC (VIE QUOTIDIENNE)', 0.08, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (16, '75030', 'JOUETS < 0,5 KG', 0.08, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (17, '75040', 'JOUETS ENTRE 0,5 KG ET 10 KG', 0.17, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (18, '74050', 'JOUETS > 10 KG', 1.67, 'Eco-systèmes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (19, '85010', 'EQUIPEMENT MEDICAL < 0,5 KG', 0.08, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (1, '25040', 'PETIT APPAREILS MENAGERS', 0.25000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (2, '25050', 'TRES PETIT APPAREILS MENAGERS', 0.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (3, '32070', 'ECRAN POIDS < 5 KG', 2.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (4, '32080', 'ECRAN POIDS > 5 KG', 1.25000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (5, '32051', 'ORDINATEUR PORTABLE', 0.42000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (6, '32061', 'TABLETTE INFORMATIQUE', 0.84000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (7, '36011', 'ORDINATEUR FIXE (UC)', 1.15000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (8, '36021', 'IMPRIMANTES', 0.83000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (9, '36030', 'IT (INFORMATIQUE ET TELECOMS)', 0.83000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (10, '36040', 'PETIT IT (CLAVIERS / SOURIS)', 0.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (11, '36050', 'TELEPHONIE MOBILE', 0.02000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (12, '36060', 'CONNECTIQUE CABLES', 0.02000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (13, '45010', 'GROS MATERIEL GRAND PUBLIC (TELEAGRANDISSEURS)', 1.67000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (14, '45020', 'MOYEN MATERIEL GRAND PUBLIC (LOUPES ELECTRONIQUES)', 0.42000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (15, '45030', 'PETIT MATERIEL GRAND PUBLIC (VIE QUOTIDIENNE)', 0.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (16, '75030', 'JOUETS < 0,5 KG', 0.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (17, '75040', 'JOUETS ENTRE 0,5 KG ET 10 KG', 0.17000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (18, '74050', 'JOUETS > 10 KG', 1.67000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (19, '85010', 'EQUIPEMENT MEDICAL < 0,5 KG', 0.08000000, 'Eco-systèmes', 1, 1); From 9f1cfbdb7214c92c7c90c69445cb5487e19ceeb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Jun 2018 12:25:43 +0200 Subject: [PATCH 124/141] For better compatibility --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 696f8a0131f..c50985be5fc 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -419,7 +419,7 @@ $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[14]= (! empty($conf->product->enabled) && ! empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY)); +$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)); From 36402c22eef49d60edd73a2f312f8e28fe0bd1cb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Jun 2018 14:06:09 +0200 Subject: [PATCH 125/141] FIX SQL Injections reported by mu shcor (ADLab of Venustech) --- htdocs/core/class/html.form.class.php | 5 +++- htdocs/main.inc.php | 16 +++++++---- htdocs/product/card.php | 40 +++++++++++++-------------- htdocs/societe/ajax/company.php | 2 +- 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 57783c09885..547bd8ad4e4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1044,7 +1044,7 @@ class Form * * @param string $selected Preselected type * @param string $htmlname Name of field in form - * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)') + * @param string $filter Optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)') * @param string $showempty Add an empty field (Can be '1' or text to use on empty line like 'SelectThirdParty') * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use standard HTML select component without beautification @@ -1064,6 +1064,9 @@ class Form $num=0; $outarray=array(); + // Clean $filter that may contains sql conditions so sql code + if (function_exists('test_sql_and_script_inject')) $filter = test_sql_and_script_inject($filter, 3); + // On recherche les societes $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX ."societe as s"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e9b17ed23ba..daa0dda21a5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -72,24 +72,30 @@ if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* deprecated in PHP * Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF). * * @param string $val Value - * @param string $type 1=GET, 0=POST, 2=PHP_SELF + * @param string $type 1=GET, 0=POST, 2=PHP_SELF, 3=GET without sql reserved keywords (the less tolerant test) * @return int >0 if there is an injection, 0 if none */ function test_sql_and_script_inject($val, $type) { $inj = 0; // For SQL Injection (only GET are used to be included into bad escaped SQL requests) - if ($type == 1) + if ($type == 1 || $type == 3) { - $inj += preg_match('/updatexml\(/i', $val); $inj += preg_match('/delete\s+from/i', $val); $inj += preg_match('/create\s+table/i', $val); $inj += preg_match('/insert\s+into/i', $val); $inj += preg_match('/select\s+from/i', $val); $inj += preg_match('/into\s+(outfile|dumpfile)/i', $val); + $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login + $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database } - if ($type != 2) // Not common, we can check on POST + if ($type == 3) { + $inj += preg_match('/select|update|delete|replace|group\s+by|concat|count|from/i', $val); + } + if ($type != 2) // Not common key strings, so we can check them both on GET and POST + { + $inj += preg_match('/updatexml\(/i', $val); $inj += preg_match('/update.+set.+=/i', $val); $inj += preg_match('/union.+select/i', $val); $inj += preg_match('/(\.\.%2f)+/i', $val); @@ -1558,8 +1564,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a print "\n"; print ''; - //unset($form); - print '
'; print "\n\n"; } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index e06d2c4569d..1e6995fff35 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -289,8 +289,8 @@ if (empty($reshook)) $object->url = GETPOST('url'); $object->note_private = dol_htmlcleanlastbr(GETPOST('note_private','none')); $object->note = $object->note_private; // deprecated - $object->customcode = GETPOST('customcode'); - $object->country_id = GETPOST('country_id'); + $object->customcode = GETPOST('customcode','alpha'); + $object->country_id = GETPOST('country_id','int'); $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0; @@ -306,13 +306,13 @@ if (empty($reshook)) $object->surface_units = GETPOST('surface_units'); $object->volume = GETPOST('volume'); $object->volume_units = GETPOST('volume_units'); - $object->finished = GETPOST('finished'); - $object->fk_unit = GETPOST('units'); + $object->finished = GETPOST('finished','alpha'); + $object->fk_unit = GETPOST('units','alpha'); - $accountancy_code_sell = GETPOST('accountancy_code_sell'); - $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra'); - $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export'); - $accountancy_code_buy = GETPOST('accountancy_code_buy'); + $accountancy_code_sell = GETPOST('accountancy_code_sell','alpha'); + $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra','alpha'); + $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export','alpha'); + $accountancy_code_buy = GETPOST('accountancy_code_buy','alpha'); if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; } if ($accountancy_code_sell_intra <= 0) { $object->accountancy_code_sell_intra = ''; } else { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; } @@ -385,11 +385,11 @@ if (empty($reshook)) $object->note_private = dol_htmlcleanlastbr(GETPOST('note_private','none')); $object->note = $object->note_private; } - $object->customcode = GETPOST('customcode'); - $object->country_id = GETPOST('country_id'); - $object->status = GETPOST('statut'); - $object->status_buy = GETPOST('statut_buy'); - $object->status_batch = GETPOST('status_batch'); + $object->customcode = GETPOST('customcode','alpha'); + $object->country_id = GETPOST('country_id','int'); + $object->status = GETPOST('statut','int'); + $object->status_buy = GETPOST('statut_buy','int'); + $object->status_batch = GETPOST('status_batch','aZ09'); // removed from update view so GETPOST always empty /* $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); @@ -410,7 +410,7 @@ if (empty($reshook)) $object->surface_units = GETPOST('surface_units'); $object->volume = GETPOST('volume'); $object->volume_units = GETPOST('volume_units'); - $object->finished = GETPOST('finished'); + $object->finished = GETPOST('finished','alpha'); $units = GETPOST('units', 'int'); @@ -437,10 +437,10 @@ if (empty($reshook)) $object->barcode_type_coder = $stdobject->barcode_type_coder; $object->barcode_type_label = $stdobject->barcode_type_label; - $accountancy_code_sell = GETPOST('accountancy_code_sell'); - $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra'); - $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export'); - $accountancy_code_buy = GETPOST('accountancy_code_buy'); + $accountancy_code_sell = GETPOST('accountancy_code_sell','alpha'); + $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra','alpha'); + $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export','alpha'); + $accountancy_code_buy = GETPOST('accountancy_code_buy','alpha'); if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; } if ($accountancy_code_sell_intra <= 0) { $object->accountancy_code_sell_intra = ''; } else { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; } @@ -1303,7 +1303,7 @@ else print ''; // Batch number managment - if ($conf->productbatch->enabled) + if ($conf->productbatch->enabled) { if ($object->isProduct() || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { @@ -1723,7 +1723,7 @@ else print ''; // Batch number management (to batch) - if (! empty($conf->productbatch->enabled)) + if (! empty($conf->productbatch->enabled)) { if ($object->isProduct() || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { diff --git a/htdocs/societe/ajax/company.php b/htdocs/societe/ajax/company.php index 349e19b0c26..d62c8a445d6 100644 --- a/htdocs/societe/ajax/company.php +++ b/htdocs/societe/ajax/company.php @@ -87,7 +87,7 @@ else if (! $searchkey) return; - $form = new Form($db); + if (! is_object($form)) $form = new Form($db); $arrayresult=$form->select_thirdparty_list(0, $htmlname, $filter, 1, $showtype, 0, null, $searchkey, $outjson); $db->close(); From 9b46ae50f01e78e8cdef2f474cbf32630be399e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Jun 2018 16:25:37 +0200 Subject: [PATCH 126/141] Fix left join on expensereport lines --- htdocs/expensereport/class/expensereport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index c50b4ce2cb3..c6debbe60ff 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2428,7 +2428,7 @@ class ExpenseReportLine $sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'; $sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'; $sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde'; - $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON fde.fk_c_type_fees=ctf.id'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON fde.fk_c_type_fees=ctf.id'; // Sometimes type of expense report has been removed, so we use a left join here. $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pjt ON fde.fk_projet=pjt.rowid'; $sql.= ' WHERE fde.rowid = '.$rowid; From 9f77ea0ece8d9ecf427fc4862127e80cd1fdc612 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Jun 2018 17:01:37 +0200 Subject: [PATCH 127/141] Code comment --- 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 b38f770e071..b79f4f7d806 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -398,7 +398,7 @@ function societe_admin_prepare_head() * @param Translate $outputlangs Langs object for output translation * @param int $entconv 0=Return value without entities and not converted to output charset, 1=Ready for html output * @param int $searchlabel Label of country to search (warning: searching on label is not reliable) - * @return mixed String with country code or translated country name or Array('id','code','label') + * @return mixed Integer with country id or String with country code or translated country name or Array('id','code','label') or 'NotDefined' */ function getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='') { From 52eddbf809d0976c11ff6b57d1dba877b7c38e86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jun 2018 00:29:50 +0200 Subject: [PATCH 128/141] Sync transifex --- htdocs/langs/fr_FR/other.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index b39175a16c3..cb8bf69a4e3 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -82,7 +82,7 @@ PredefinedMailTest=__(Hello)__,\nCeci est un mail de test envoyé à __EMAIL__.\ PredefinedMailTestHtml=__(Hello)__\nCeci est un message de test (le mot test doit être en gras).
Les 2 lignes sont séparées par un retour à la ligne.

__SIGNATURE__ PredefinedMailContentSendInvoice=__(Hello)__\n\nVous trouverez ci-joint la facture __REF__\n\nVoici le lien pour effectuer votre paiement en ligne si elle n'est pas déjà été payée:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nNous souhaitons vous prévenir que la facture __REF__ ne semble pas avoir été payée. Voici donc la facture en pièce jointe, à titre de rappel.\n\nVoici le lien pour effectuer votre paiement en ligne:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ -PredefinedMailContentSendProposal=__(Hello)__\n\nVeuillez trouver, ci-joint, la proposition commerciale __PREF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ +PredefinedMailContentSendProposal=__(Hello)__\n\nVeuillez trouver, ci-joint, la proposition commerciale __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendSupplierProposal=__(Hello)__\n\nVeuillez trouver, ci-joint, une demande de prix avec la référence __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendOrder=__(Hello)__\n\nVeuillez trouver, ci-joint, la commande __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendSupplierOrder=__(Hello)__\n\nVeuillez trouver, ci-joint, notre commande __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ From 7f8570f7202da188aa581fa1ef731987b6a16c11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jun 2018 00:48:43 +0200 Subject: [PATCH 129/141] Fix lang loading --- htdocs/compta/facture/fiche-rec.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index bb6358ed160..4519fd24f6a 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -43,10 +43,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; -$langs->load('bills'); -$langs->load('compta'); -$langs->load('admin'); -$langs->load('other'); +$langs->loadLangs(array('bills','compta','admin','other','products')); $action = GETPOST('action','alpha'); $massaction = GETPOST('massaction','alpha'); From 969b272576366b2bc77851078e5b5b2d0fdeb2f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jun 2018 11:18:31 +0200 Subject: [PATCH 130/141] Rename menu entries and report title for better understanding --- htdocs/compta/facture/list.php | 23 +++++++++------ htdocs/compta/stats/byratecountry.php | 25 ++++++++++++---- htdocs/compta/stats/cabyprodserv.php | 27 ++++++++++++++---- htdocs/compta/stats/cabyuser.php | 28 ++++++++++++++---- htdocs/compta/stats/casoc.php | 38 ++++++++++++++++++------- htdocs/compta/stats/index.php | 14 ++++----- htdocs/core/menus/standard/eldy.lib.php | 27 ++++++++++++++---- htdocs/langs/en_US/compta.lang | 25 +++++++++------- htdocs/theme/eldy/style.css.php | 4 +-- 9 files changed, 151 insertions(+), 60 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3d983e3216a..d5d320e6d32 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -79,7 +79,7 @@ $search_montant_vat=GETPOST('search_montant_vat','alpha'); $search_montant_localtax1=GETPOST('search_montant_localtax1','alpha'); $search_montant_localtax2=GETPOST('search_montant_localtax2','alpha'); $search_montant_ttc=GETPOST('search_montant_ttc','alpha'); -$search_status=GETPOST('search_status','int'); +$search_status=GETPOST('search_status','intcomma'); $search_paymentmode=GETPOST('search_paymentmode','int'); $search_town=GETPOST('search_town','alpha'); $search_zip=GETPOST('search_zip','alpha'); @@ -108,7 +108,7 @@ $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; -if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == 1) $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; +if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == '1') $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='f.datef'; $pageprev = $page - 1; @@ -442,12 +442,19 @@ if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $searc if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; -if ($search_status != '' && $search_status >= 0) +if ($search_status != '') { - if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft - if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed - if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) - if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned + if (is_numeric($search_status) && $search_status >= 0) + { + if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft + if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed + if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) + if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned + } + else + { + $sql.= " AND f.fk_statut IN (".$search_status.")"; // When search_status is '1,2' for example + } } if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); if ($search_month > 0) @@ -854,7 +861,7 @@ if ($resql) if (! empty($arrayfields['f.fk_statut']['checked'])) { print '
'; } diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 78a9187be57..2c43db42d13 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -190,13 +190,15 @@ $namesup=$namecust; +// TODO Report from bookkeeping not yet available, so we switch on report on business events +if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES"; +if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES"; // Show report header -$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByVatRate"); - if ($modecompta=="CREANCES-DETTES") { + $name=$langs->trans("Turnover").', '.$langs->trans("ByVatRate"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -206,14 +208,27 @@ if ($modecompta=="CREANCES-DETTES") { } $builddate=dol_now(); -} else { +} +else if ($modecompta=="RECETTES-DEPENSES") +{ + $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByVatRate"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); +} +else if ($modecompta=="BOOKKEEPING") +{ + + +} +else if ($modecompta=="BOOKKEEPINGCOLLECTED") +{ + + } $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().''.img_next().''; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 5c2a50325a7..5d28ab3e077 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -158,12 +158,15 @@ llxHeader(); $form=new Form($db); $formother = new FormOther($db); -// Show report header -$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices"); +// TODO Report from bookkeeping not yet available, so we switch on report on business events +if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES"; +if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES"; +// Show report header if ($modecompta=="CREANCES-DETTES") { + $name=$langs->trans("Turnover").', '.$langs->trans("ByProductsAndServices"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -173,15 +176,29 @@ if ($modecompta=="CREANCES-DETTES") { } $builddate=dol_now(); -} else { +} +else if ($modecompta=="RECETTES-DEPENSES") +{ + $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); } +else if ($modecompta=="BOOKKEEPING") +{ + + +} +else if ($modecompta=="BOOKKEEPINGCOLLECTED") +{ + + +} + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().''.img_next().''; else $periodlink = ''; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index dbd5d46e61a..ccb286c1420 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -142,24 +142,40 @@ llxHeader(); $form=new Form($db); +// TODO Report from bookkeeping not yet available, so we switch on report on business events +if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES"; +if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES"; + // Show report header if ($modecompta=="CREANCES-DETTES") { - $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); + $name=$langs->trans("Turnover").', '.$langs->trans("ByUserAuthorOfInvoice"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} else { - $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); +} +else if ($modecompta=="RECETTES-DEPENSES") +{ + $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByUserAuthorOfInvoice"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); +} +else if ($modecompta=="BOOKKEEPING") +{ + + +} +else if ($modecompta=="BOOKKEEPINGCOLLECTED") +{ + + } $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().''.img_next().''; @@ -327,7 +343,7 @@ print_liste_field_titre( "", 'align="center" width="20%"' ); -print "\n"; +print "\n"; if (count($amount)) { $arrayforsort=$name; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 1555b3c79ac..8e00dfe5fbe 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -167,25 +167,41 @@ $form=new Form($db); $thirdparty_static=new Societe($db); $formother = new FormOther($db); +// TODO Report from bookkeeping not yet available, so we switch on report on business events +if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES"; +if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES"; + // Show report header if ($modecompta=="CREANCES-DETTES") { - $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); + $name=$langs->trans("Turnover").', '.$langs->trans("ByThirdParties"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} else { - $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); +} +else if ($modecompta=="RECETTES-DEPENSES") +{ + $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByThirdParties"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); +} +else if ($modecompta=="BOOKKEEPING") +{ + + +} +else if ($modecompta=="BOOKKEEPINGCOLLECTED") +{ + + } $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().''.img_next().''; @@ -230,8 +246,8 @@ if ($modecompta == 'CREANCES-DETTES') { $sql.=" AND cs.fk_soc is null"; } else if ($selected_cat) { // Into a specific category - $sql.= " AND (c.rowid = ".$selected_cat; - if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; + $sql.= " AND (c.rowid = ".$db->escape($selected_cat); + if ($subcat) $sql.=" OR c.fk_parent = " . $db->escape($selected_cat); $sql.= ")"; $sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid"; } @@ -270,10 +286,10 @@ if ($modecompta == 'CREANCES-DETTES') { $sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid"; } } -if(!empty($search_societe)) $sql.= ' AND s.nom LIKE "%'.$search_societe.'%"'; -if(!empty($search_zip)) $sql.= ' AND s.zip LIKE "%'.$search_zip.'%"'; -if(!empty($search_town)) $sql.= ' AND s.town LIKE "%'.$search_town.'%"'; -if($search_country > 0) $sql.= ' AND s.fk_pays = '.$search_country.''; +if (!empty($search_societe)) $sql.= natural_search('s.nom', $search_societe); +if (!empty($search_zip)) $sql.= natural_search('s.zip', $search_zip); +if (!empty($search_town)) $sql.= natural_search('s.town', $search_town); +if ($search_country > 0) $sql.= ' AND s.fk_pays = '.$search_country.''; $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays"; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index dd24a6cd507..c255d236664 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -115,9 +115,9 @@ $form=new Form($db); // Affiche en-tete du rapport if ($modecompta=="CREANCES-DETTES") { - $name=$langs->trans("SalesTurnover"); + $name=$langs->trans("Turnover"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()."".img_next()."":""); @@ -129,10 +129,10 @@ if ($modecompta=="CREANCES-DETTES") } else if ($modecompta=="RECETTES-DEPENSES") { - $name=$langs->trans("SalesTurnover"); + $name=$langs->trans("TurnoverCollected"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesCAIn"); @@ -142,10 +142,10 @@ else if ($modecompta=="RECETTES-DEPENSES") } else if ($modecompta=="BOOKKEEPING") { - $name=$langs->trans("SalesTurnover"); + $name=$langs->trans("Turnover"); $calcmode=$langs->trans("CalcModeBookkeeping"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesCATotalSaleJournal"); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5cb7547d0f4..a6f19a68086 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1099,11 +1099,28 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("MenuReportInOut"),2,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByPredefinedAccountGroups"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report",$langs->trans("ByPersonalizedAccountGroups"),3,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report", $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); + + $modecompta='CREANCES-DETTES'; + if(! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta='BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + if ($modecompta) + { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); + } + + $modecompta='RECETTES-DEPENSES'; + //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + if ($modecompta) + { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ReportTurnoverCollected"),2,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire); + //if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); + //if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); + } } // Accountancy (simple) diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index ce70a9748a0..196ab114d6f 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -19,7 +19,8 @@ Income=Income Outcome=Expense MenuReportInOut=Income / Expense ReportInOut=Balance of income and expenses -ReportTurnover=Turnover +ReportTurnover=Turnover invoiced +ReportTurnoverCollected=Turnover collected PaymentsNotLinkedToInvoice=Payments not linked to any invoice, so not linked to any third party PaymentsNotLinkedToUser=Payments not linked to any user Profit=Profit @@ -117,8 +118,9 @@ CustomerAccountancyCodeShort=Cust. account. code SupplierAccountancyCodeShort=Sup. account. code AccountNumber=Account number NewAccountingAccount=New account -SalesTurnover=Sales turnover -SalesTurnoverMinimum=Minimum sales turnover +Turnover=Turnover invoiced +TurnoverCollected=Turnover collected +SalesTurnoverMinimum=Minimum turnover ByExpenseIncome=By expenses & incomes ByThirdParties=By third parties ByUserAuthorOfInvoice=By invoice author @@ -138,8 +140,8 @@ ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fisc ExportDataset_tax_1=Social and fiscal taxes and payments CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. -CalcModeDebt=Mode %sClaims-Debts%s said Commitment accounting. -CalcModeEngagement=Mode %sIncomes-Expenses%s said cash accounting +CalcModeDebt=Analysis of known recorded invoices even if they are not yet accounted in ledger. +CalcModeEngagement=Analysis of known recorded payments, even if they are not yet accounted in Ledger. CalcModeBookkeeping=Analysis of data journalized in Bookkeeping Ledger table CalcModeLT1= Mode %sRE on customer invoices - suppliers invoices%s CalcModeLT1Debt=Mode %sRE on customer invoices%s @@ -152,9 +154,9 @@ AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary AnnualByCompanies=Balance of income and expenses, by predefined groups of account AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by predefined groups, mode %sClaims-Debts%s said Commitment accounting. AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by predefined groups, mode %sIncomes-Expenses%s said cash accounting. -SeeReportInInputOutputMode=See report %sIncomes-Expenses%s said cash accounting for a calculation on actual payments made -SeeReportInDueDebtMode=See report %sClaims-Debts%s said commitment accounting for a calculation on issued invoices -SeeReportInBookkeepingMode=See report %sBookeeping%s for a calculation on bookkeeping table analysis +SeeReportInInputOutputMode=See %sanalysis of payments%s for a calculation on actual payments made, if they are not yet accounted in Ledger. +SeeReportInDueDebtMode=See %sanalysis of invoices%s for a calculation based on known recorded invoices even, if they are not yet accounted in Ledger. +SeeReportInBookkeepingMode=See %sBookeeping report%s for a calculation on Bookkeeping Ledger table RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whether they are paid or not. Is also includes paid salaries.
- It is based on the validation date of invoices and VAT and on the due date for expenses. For salaries defined with Salary module, the value date of payment is used. RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries.
- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation. @@ -219,8 +221,8 @@ Mode1=Method 1 Mode2=Method 2 CalculationRuleDesc=To calculate total VAT, there is two methods:
Method 1 is rounding vat on each line, then summing them.
Method 2 is summing all vat on each line, then rounding result.
Final result may differs from few cents. Default mode is mode %s. CalculationRuleDescSupplier=According to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier. -TurnoverPerProductInCommitmentAccountingNotRelevant=The Turnover report per product, when using a cash accounting mode is not relevant. This report is only available when using commitment accounting mode (see setup of accountancy module). -TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant=The Turnover report per sale tax rate, when using a cash accounting mode is not relevant. This report is only available when using commitment accounting mode (see setup of accountancy module). +TurnoverPerProductInCommitmentAccountingNotRelevant=The report of Turnover collected per product is not available. This report is only available for turnover invoiced. +TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant=The report of Turnover collected per sale tax rate is not available. This report is only available for turnover invoiced. CalculationMode=Calculation mode AccountancyJournal=Accounting code journal ACCOUNTING_VAT_SOLD_ACCOUNT=Accounting account by default for VAT on sales (used if not defined on VAT dictionary setup) @@ -252,5 +254,6 @@ VATDue=Sale tax claimed ClaimedForThisPeriod=Claimed for the period PaidDuringThisPeriod=Paid during this period ByVatRate=By sale tax rate -TurnoverbyVatrate=Turnover by sale tax rate +TurnoverbyVatrate=Turnover invoiced by sale tax rate +TurnoverCollectedbyVatrate=Turnover collected by sale tax rate PurchasebyVatrate=Purchase by sale tax rate \ No newline at end of file diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 49536d340b0..79aed1eaf68 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1445,8 +1445,8 @@ div.statusrefbis { } img.photoref, div.photoref { border: 1px solid #DDD; - -webkit-box-shadow: 1px 1px 4px #DDD; - box-shadow: 1px 1px 4px #DDD; + -webkit-box-shadow: 0px 0px 6px #DDD; + box-shadow: 0px 0px 6px #DDD; padding: 4px; height: 80px; width: 80px; From 8147152ec88a819601a635ddd51edb22a78459ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jun 2018 11:25:28 +0200 Subject: [PATCH 131/141] Fix look and feel v8 --- htdocs/core/ajax/ajaxdirtree.php | 2 +- htdocs/core/class/html.formfile.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 907a3cea79e..cfff81749de 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -202,7 +202,7 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE print ''; + print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').''; // Add link //print ''; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7ae9dc29e18..7c457accadf 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1200,7 +1200,7 @@ class FormFile print ''; // Date - print ''; + print ''; // 140px = width for date with PM format // Preview if (empty($useinecm)) @@ -1271,7 +1271,7 @@ class FormFile print '
'.$langs->trans("LastGroupsCreated",($num ? $num : $max)).'
'.$langs->trans("LastGroupsCreated",($num ? $num : $max)).''.$langs->trans("FullList").'
'; print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : ''); - if (is_numeric($pricesell)) print price($pricesell,'','',0,0,-1,$conf->currency)); + if (is_numeric($pricesell)) print price($pricesell,'','',0,0,-1,$conf->currency); else print $langs->trans($pricesell); print '
'; + print ''; print ''; print ''; print 'attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; print '">'; diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index b23d1ff6ab7..bccf25f1be8 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -93,11 +93,11 @@ if (count($export->array_export_code)) { if ($user->rights->export->creer) { - print ''.$langs->trans("NewExport").''; + print ''.$langs->trans("NewExport").''; } else { - print ''.$langs->trans("NewExport").''; + print ''.$langs->trans("NewExport").''; } /* print '
'; print ''; - print $langs->trans("ChooseFormatOfFileToImport",img_picto('','filenew')).'
'; + print ''.$langs->trans("ChooseFormatOfFileToImport",img_picto('','filenew')).'

'; print '
'; $filetoimport=''; @@ -552,12 +552,12 @@ if ($step == 3 && $datatoimport) print ''; print ''; + print ''.$langs->trans("ChooseFileToImport",img_picto('','filenew')).'

'; + print '
'; $filetoimport=''; - print ''; - //print ''; // Input file name box @@ -835,8 +835,8 @@ if ($step == 4 && $datatoimport) print ''; print ''; print ''; - print '
'.$langs->trans("ChooseFileToImport",img_picto('','filenew')).'
'.$langs->trans("FileWithDataToImport").'
'; - print $langs->trans("SelectImportFields",img_picto('','uparrow','')).' '; + print '
'; + print $langs->trans("SelectImportFields",img_picto('','grip_title','')).' '; $htmlother->select_import_model($importmodelid,'importmodelid',$datatoimport,1); print ''; print '
'; @@ -869,7 +869,7 @@ if ($step == 4 && $datatoimport) $lefti=1; foreach ($array_match_file_to_database as $key => $val) { - + $var=!$var; show_elem($fieldssource,$key,$val,$var); // key is field number in source file //print '> '.$lefti.'-'.$key.'-'.$val; $listofkeys[$key]=1; @@ -886,7 +886,7 @@ if ($step == 4 && $datatoimport) $num=count($fieldssource); while ($lefti <= $num) { - + $var=!$var; $newkey=getnewkey($fieldssource,$listofkeys); show_elem($fieldssource,$newkey,'',$var); // key start after field number in source file //print '> '.$lefti.'-'.$newkey; @@ -905,11 +905,12 @@ if ($step == 4 && $datatoimport) $height=24; $i = 0; $mandatoryfieldshavesource=true; + $var=true; print ''; foreach($fieldstarget as $code=>$label) { - - print ''; + $var = !$var; + print ''; $i++; $entity=(! empty($objimport->array_import_entities[0][$code])?$objimport->array_import_entities[0][$code]:$objimport->array_import_icon[0]); @@ -1124,7 +1125,7 @@ if ($step == 4 && $datatoimport) print ''; print ''; print ''; - + print ''; print ''; + // Keys for update print ''; print ''; print ''; print ''; print ''; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'badcustomer' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'badcustomer') { @@ -4332,7 +4332,7 @@ else if ($id > 0 || ! empty($ref)) print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); print ''; // $resteapayeraffiche=0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'product_returned' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'product_returned') { @@ -4340,7 +4340,7 @@ else if ($id > 0 || ! empty($ref)) print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); print ''; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'abandon' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'abandon') { @@ -4351,7 +4351,7 @@ else if ($id > 0 || ! empty($ref)) print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); print ''; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Billed diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f171aa272ff..d409ba35b86 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2838,7 +2838,7 @@ else print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); print ''; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'badsupplier' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'badsupplier') { @@ -2846,7 +2846,7 @@ else print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); print ''; // $resteapayeraffiche=0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'product_returned' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'product_returned') { @@ -2854,7 +2854,7 @@ else print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); print ''; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'abandon' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'abandon') { @@ -2865,7 +2865,7 @@ else print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); print ''; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Billed @@ -2878,12 +2878,12 @@ else else print $langs->trans('ExcessPaid'); print ' :'; - print ''; + print ''; print ''; } else // Credit note { - $cssforamountpaymentcomplete=''; + $cssforamountpaymentcomplete='amountpaymentneutral'; // Total already paid back print ''; - print ''; + print ''; print ''; // Sold credit note diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 51108766369..b68013fd40d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -201,8 +201,8 @@ $nbtopmenuentries=$menumanager->showmenu('topnb'); $minwidthtmenu=66; /* minimum width for one top menu entry */ -$heightmenu=46; /* height of top menu, part with image */ -$heightmenu2=48; /* height of top menu, part with login */ +$heightmenu=48; /* height of top menu, part with image */ +$heightmenu2=49; /* height of top menu, part with login */ $disableimages = 0; $maxwidthloginblock = 130; if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; } @@ -816,6 +816,10 @@ select.flat.selectlimit { font-weight: bold; font-size: 1.4em; } +.amountpaymentneutral { + font-weight: bold; + font-size: 1.4em; +} .savingdocmask { margin-top: 6px; margin-bottom: 12px; @@ -2403,7 +2407,7 @@ span.butAction, span.butActionDelete { } .butAction { - background: rgb(230, 238, 230) + background: rgb(230, 236, 230) /* background: rgb(230, 232, 239); */ } .butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fce36df5b2b..8c5f819d855 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -807,6 +807,10 @@ select.flat.selectlimit { .amountremaintopayback { font-weight: bold; } +.amountpaymentneutral { + font-weight: bold; + font-size: 1.4em; +} .savingdocmask { margin-top: 6px; margin-bottom: 12px; From 16f940b637453cdb76361dab71f21ad6285f93c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 14:55:33 +0200 Subject: [PATCH 099/141] Prepare 7.0.4 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b8126b4fcc8..adfe8cea7e9 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','7.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','7.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); From 00165871bd74119ce313f29936fe097c007ef93b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 15:10:44 +0200 Subject: [PATCH 100/141] CSS --- htdocs/core/class/commonobject.class.php | 7 ++++--- htdocs/expensereport/list.php | 4 ++-- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 7 +++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f3e34486f9e..97942687fe4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1458,11 +1458,11 @@ abstract class CommonObject if ($trigkey) { // call trigger with updated object values - if (empty($this->fields) && method_exists($this, 'fetch')) + if (empty($this->fields) && method_exists($this, 'fetch')) { $result = $this->fetch($id); - } - else + } + else { $result = $this->fetchCommon($id); } @@ -6140,6 +6140,7 @@ abstract class CommonObject $labeltoshow = $langs->trans($label); $out .= ''; } @@ -544,7 +544,7 @@ if ($resql) if (! empty($arrayfields['d.date_fin']['checked'])) { print ''; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b68013fd40d..792ee7f02a0 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -36,7 +36,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Colors -$colorbackhmenu1='80,90,120'; // topmenu +$colorbackhmenu1='60,70,100'; // topmenu $colorbackvmenu1='248,248,248'; // vmenu $colortopbordertitle1='200,200,200'; // top border of title $colorbacktitle1='220,220,223'; // title of tables,list diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8c5f819d855..a7c102d16eb 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -872,11 +872,10 @@ div.fiche>form>div.div-table-responsive { flex: 1 1 150px; } .thumbstat, .thumbstat150 { - /* flex-grow: 1; */ - /* flex-shrink: 1; */ + flex-grow: 1; + flex-shrink: 1; /* flex-basis: 140px; */ - display: inline; - width: 100%; + min-width: 150px; justify-content: flex-start; align-self: flex-start; } From 2db2ea3627bc067b340cb7d65fa1d8e5f8545829 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 15:13:39 +0200 Subject: [PATCH 101/141] Fix colspan --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index dc7d0d5a452..c27b69f95b0 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1095,7 +1095,7 @@ else } // Other attributes - $parameters=array('cols' => 3); + $parameters=array('colspan' => 3); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) From 3fa5649040cfe9c36e7c6b4dd0b96f63906c1971 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 15:22:39 +0200 Subject: [PATCH 102/141] Fix bad test (dev journal visible when dev option on) --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index c854812f8ec..5cb7547d0f4 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1062,7 +1062,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($objp->nature == 9) $nature="hasnew"; // To enable when page exists - if (! empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) + if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { if ($nature == 'various' || $nature == 'hasnew' || $nature == 'inventory') $nature=''; } From e9b4141dd980341de89d17007eb68da1dddd1b1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 17:11:19 +0200 Subject: [PATCH 103/141] Fix syntax error --- htdocs/product/composition/card.php | 2 +- htdocs/theme/eldy/style.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 7d2caabc8f8..a1cd63eea12 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -394,7 +394,7 @@ if ($id > 0 || ! empty($ref)) $totalsell+=$totallinesell; } print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 792ee7f02a0..5b5aebfd20d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3187,7 +3187,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { background: #f8f8f8; border: 1px solid #eee; - box-shadow: 1px 1px 6px #bbb; + box-shadow: 1px 1px 8px #ddd; border-radius: 0px; } .boxstats, .boxstats130, .boxstatscontent { From 4f533be01a23b2e1031aa8d9413bbcca49a54c79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 10:26:08 +0200 Subject: [PATCH 104/141] For #9006 --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 05fc5defcee..e0b5b3966dd 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -536,3 +536,9 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 5, 'SKR04', 'Standardkontenrahmen SKR 04', 1); +-- advtargetmailing +ALTER TABLE llx_advtargetemailing ADD COLUMN fk_element integer NOT NULL; +ALTER TABLE llx_advtargetemailing ADD COLUMN type_element varchar(180) NOT NULL; +UPDATE llx_advtargetemailing SET fk_element = fk_mailing, type_element="mailing"; +ALTER TABLE llx_advtargetemailing DROP COLUMN fk_mailing; + From 1b5c5cfafb07dcb6d5adb0603054dd3709733555 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 10:42:07 +0200 Subject: [PATCH 105/141] Fix select status --- .../core/modules/mailings/thirdparties.modules.php | 12 ++++++------ .../thirdparties_services_expired.modules.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index c341b45cf69..57a69475000 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -131,7 +131,7 @@ class mailing_thirdparties extends MailingTargets } else { - $sql.= " AND s.status=0"; + $sql.= " AND s.status=0"; $addDescription.= $langs->trans("Disabled"); } } @@ -239,7 +239,7 @@ class mailing_thirdparties extends MailingTargets $langs->load("companies"); - $s=''; + $s=$langs->trans("Categories").': '; $s.=''; $s.= ''; - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) + if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { $s.= ''; } @@ -297,12 +297,12 @@ class mailing_thirdparties extends MailingTargets $s.= ''; $s.=' '; - + $s.=$langs->trans("Status"); $s.=': '; return $s; diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 786cfa1f756..08473f3cb6d 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -213,7 +213,7 @@ class mailing_thirdparties_services_expired extends MailingTargets { global $langs; - $s=''; + $s=$langs->trans("ProductOrService"); $s.=''; } else From 21ca374c2742a686b9fe2fb2ecfeee9aa137ae6c Mon Sep 17 00:00:00 2001 From: Philippe Grand Date: Sun, 24 Jun 2018 10:57:53 +0200 Subject: [PATCH 107/141] Update cibles.php Fixes --- htdocs/comm/mailing/cibles.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index f2b9a1dadc2..d3a627a1695 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -336,7 +336,7 @@ if ($object->fetch($id) >= 0) } else { - print '
'; + print '
'; } print '
'; From 5819333b80fff101230dc188e53e772fc24b609f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 11:30:44 +0200 Subject: [PATCH 108/141] Css --- htdocs/comm/card.php | 60 ++++++++++++++++++++++++++------- htdocs/theme/eldy/style.css.php | 13 ++++--- 2 files changed, 55 insertions(+), 18 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index c27f2f4f79f..83db0e0f1d2 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -679,7 +679,8 @@ if ($object->id > 0) $num = $db->num_rows($resql); if ($num > 0) { - print '
'.$langs->trans("ImportModelName").' 
'; print ''; @@ -1314,6 +1315,7 @@ if ($step == 5 && $datatoimport) if ($action == 'launchsimu') print '   '.$langs->trans("Modify").''; print '
'; print $langs->trans("KeysToUseForUpdates"); print ''; @@ -1331,15 +1333,15 @@ if ($step == 5 && $datatoimport) } print '   '.$langs->trans("Modify").''; } else { - if (count($objimport->array_import_updatekeys[0])) - { - print $form->multiselectarray('updatekeys', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '80%'); - } + if (count($objimport->array_import_updatekeys[0])) + { + print $form->multiselectarray('updatekeys', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '80%'); + print $form->textwithpicto("", $langs->trans("SelectPrimaryColumnsForUpdateAttempt")); + } else { - print ''.$langs->trans("UpdateNotYetSupportedForThisImport").''; + print ''.$langs->trans("UpdateNotYetSupportedForThisImport").''; } - print $form->textwithpicto("", $langs->trans("SelectPrimaryColumnsForUpdateAttempt")); } /*echo '
';
 	print_r($objimport->array_import_updatekeys);
@@ -1427,7 +1429,8 @@ if ($step == 5 && $datatoimport)
     if ($action != 'launchsimu')
     {
         // Show import id
-        print $langs->trans("NowClickToTestTheImport",$langs->transnoentitiesnoconv("RunSimulateImportFile")).'
'; + print '
'; + print $langs->trans("NowClickToTestTheImport",$langs->transnoentitiesnoconv("RunSimulateImportFile")).'
'; print '
'; // Actions @@ -1943,7 +1946,7 @@ function show_elem($fieldssource,$pos,$key,$var,$nostyle='') { print '
'; - print img_picto(($pos>0?$langs->trans("MoveField",$pos):''),'uparrow','class="boxhandle" style="cursor:move;"'); + print img_picto(($pos>0?$langs->trans("MoveField",$pos):''),'grip_title','class="boxhandle" style="cursor:move;"'); print ''; print $langs->trans("NoFields"); @@ -1966,7 +1969,7 @@ function show_elem($fieldssource,$pos,$key,$var,$nostyle='') print '
'; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object - print img_picto($langs->trans("MoveField",$pos),'uparrow','class="boxhandle" style="cursor:move;"'); + print img_picto($langs->trans("MoveField",$pos),'grip_title','class="boxhandle" style="cursor:move;"'); print ''; print $langs->trans("Field").' '.$pos; diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index ed391d65292..cd67a90e4dd 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -92,7 +92,7 @@ if (count($import->array_import_code)) { //if ($user->rights->import->run) //{ - print ''.$langs->trans("NewImport").''; + print ''.$langs->trans("NewImport").''; //} //else //{ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 1287bf6d234..51108766369 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1440,9 +1440,9 @@ div.statusrefbis { vertical-align: text-bottom; } img.photoref, div.photoref { - border: 1px solid #CCC; - -webkit-box-shadow: 2px 2px 4px #ccc; - box-shadow: 2px 2px 4px #ccc; + border: 1px solid #DDD; + -webkit-box-shadow: 1px 1px 4px #DDD; + box-shadow: 1px 1px 4px #DDD; padding: 4px; height: 80px; width: 80px; @@ -2402,6 +2402,10 @@ span.butAction, span.butActionDelete { cursor: pointer; } +.butAction { + background: rgb(230, 238, 230) + /* background: rgb(230, 232, 239); */ +} .butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active { text-decoration: none; text-transform: uppercase; @@ -2410,14 +2414,14 @@ span.butAction, span.butActionDelete { margin: 0em em !important; padding: 0.6em em; font-family: ; - border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); display: inline-block; text-align: center; cursor: pointer; /* color: #fff; */ /* background: rgb(); */ - color: #000; - border: 1px solid #aaa; + color: #444; + /* border: 1px solid #aaa; */ + /* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */ border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; @@ -2432,13 +2436,13 @@ span.butAction, span.butActionDelete { margin: 0em 0.3em 0 0.3em !important; padding: 0.2em em 0.3em; font-family: ; - border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); display: inline-block; /* text-align: center; New button are on right of screen */ cursor: pointer; /*color: #fff !important; background: rgb(); border: 1px solid rgb();*/ + border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; @@ -2454,8 +2458,8 @@ a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-ci } .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete { - /* background: #633; */ - border: 1px solid #633; + background: rgb(239, 232, 230); + /* border: 1px solid #633; */ color: #633; } @@ -2749,7 +2753,7 @@ div.refidpadding { } div.refid { font-weight: bold; - color: #625; + color: rgb(); font-size: 1.2em; } div.refidno { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a3675177388..fce36df5b2b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2731,7 +2731,7 @@ div.refidpadding { } div.refid { font-weight: bold; - color: #766; + color: rgb(); font-size: 160%; } div.refidno { From 0170906524cde951db35ce24c5baa2c7ae39d166 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jun 2018 14:39:24 +0200 Subject: [PATCH 098/141] Look and feel --- htdocs/compta/facture/card.php | 8 ++++---- htdocs/fourn/facture/card.php | 14 +++++++------- htdocs/theme/eldy/style.css.php | 10 +++++++--- htdocs/theme/md/style.css.php | 4 ++++ 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7f52efd6a4f..68a24a20933 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4324,7 +4324,7 @@ else if ($id > 0 || ! empty($ref)) print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' 
' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' 
' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' 
' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' 
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . price($resteapayeraffiche) . '' . price($resteapayeraffiche) . ' 
'; @@ -2900,7 +2900,7 @@ else else print $langs->trans('ExcessPaydBack'); print ' :' . price($sign * $resteapayeraffiche) . '' . price($sign * $resteapayeraffiche) . ' 
'; if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$object->table_element]['help'][$key]); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index b8f88210780..70a7f8158fc 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -536,7 +536,7 @@ if ($resql) if (! empty($arrayfields['d.date_debut']['checked'])) { print ''; - print ''; + print ''; $formother->select_year($year_start,'year_start',1, $min_year, $max_year); print ''; - print ''; + print ''; $formother->select_year($year_end,'year_end',1, $min_year, $max_year); print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : ''); + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '')); if (is_numeric($pricesell)) print price($pricesell,'','',0,0,-1,$conf->currency); else print $langs->trans($pricesell); print '
'; + print '
'; + print '
'; print ''; print '
'; @@ -712,7 +713,11 @@ if ($object->id > 0) } $db->free($resql); - if ($num > 0) print "
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' '.$num.'
"; + if ($num > 0) + { + print "
"; + print ''; + } } else { @@ -759,6 +764,7 @@ if ($object->id > 0) $orders2invoice = $db->num_rows($resql2); $db->free($resql2); + print '
'; print ''; print ''; @@ -793,7 +799,11 @@ if ($object->id > 0) } $db->free($resql); - if ($num >0) print "
"; + if ($num >0) + { + print "
"; + print ''; + } } else { @@ -830,7 +840,8 @@ if ($object->id > 0) $num = $db->num_rows($resql); if ($num > 0) { - print ''; + print '
'; + print '
'; print ''; print '
'; @@ -864,7 +875,10 @@ if ($object->id > 0) $db->free($resql); if ($num > 0) + { print "
'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSendings").' '.$num.'
"; + print ''; + } } else { dol_print_error($db); } @@ -890,7 +904,8 @@ if ($object->id > 0) $num = $db->num_rows($resql); if ($num >0) { - print ''; + print '
'; + print '
'; print ''; print '
'; @@ -909,6 +924,7 @@ if ($object->id > 0) $contrat->ref=$objp->ref?$objp->ref:$objp->id; $contrat->ref_customer=$objp->refcus; $contrat->ref_supplier=$objp->refsup; + $contrat->fetch_lines(); print ''; print '\n"; print '\n"; print ''; - print '\n"; print ''; @@ -927,7 +942,11 @@ if ($object->id > 0) } $db->free($resql); - if ($num > 0) print "
'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'
'; @@ -918,8 +934,7 @@ if ($object->id > 0) print ''.dol_print_date($db->jdate($objp->dc),'day')."'.dol_print_date($db->jdate($objp->dcon),'day')." '; - $contrat->fetch_lines(); + print ''; print $contrat->getLibStatut(4); print "
"; + if ($num > 0) + { + print "
"; + print ''; + } } else { @@ -955,7 +974,8 @@ if ($object->id > 0) $num = $db->num_rows($resql); if ($num > 0) { - print ''; + print '
'; + print '
'; print ''; print '
'; @@ -983,7 +1003,11 @@ if ($object->id > 0) } $db->free($resql); - if ($num > 0) print "
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.'
"; + if ($num > 0) + { + print "
"; + print ''; + } } else { @@ -1023,6 +1047,7 @@ if ($object->id > 0) $num = $db->num_rows($resql); if ($num > 0) { + print '
'; print ''; print ''; @@ -1086,7 +1111,11 @@ if ($object->id > 0) } $db->free($resql); - if ($num > 0) print "
"; + if ($num > 0) + { + print "
"; + print ''; + } } else { @@ -1123,7 +1152,8 @@ if ($object->id > 0) $num = $db->num_rows($resql); if ($num > 0) { - print ''; + print '
'; + print '
'; print ''; print '
'; @@ -1173,7 +1203,11 @@ if ($object->id > 0) } $db->free($resql); - if ($num > 0) print "
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' '.$num.'
"; + if ($num > 0) + { + print "
"; + print ''; + } } else { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 5b5aebfd20d..49536d340b0 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2415,8 +2415,8 @@ span.butAction, span.butActionDelete { text-transform: uppercase; font-weight: bold; - margin: 0em em !important; - padding: 0.6em em; + margin: 0em em !important; + padding: 0.6em em; font-family: ; display: inline-block; text-align: center; @@ -2479,14 +2479,17 @@ a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-ci white-space: nowrap !important; cursor: not-allowed !important; - margin: 0em em; - padding: 0.6em em; + margin: 0em em; + padding: 0.6em em; font-family: !important; display: inline-block; text-align: center; cursor: pointer; color: #999 !important; - border: 1px solid #bbb; + border: 1px solid #ccc; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; } .butActionNewRefused, .butActionNewRefused:link, .butActionNewRefused:visited, .butActionNewRefused:hover, .butActionNewRefused:active { text-decoration: none !important; From 25b1d063ae62b3d0df5b61909551fa599bcbce5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 11:45:10 +0200 Subject: [PATCH 109/141] Fix length of hidden password --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9d164325fd6..839528ddc20 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1717,7 +1717,7 @@ class ExtraFields } elseif ($type == 'password') { - $value=preg_replace('/./i','*',$value); + $value=dol_trunc(preg_replace('/./i','*',$value), 8, 'right', 'UTF-8', 1); } else { diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 52586490a43..7253474c36b 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -129,7 +129,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] print '
'; + print ''; // Convert date into timestamp format if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) From 848c8cdc4b42f10e0a9b460ceb77e63fe0423b0f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 13:59:37 +0200 Subject: [PATCH 110/141] Fix mode SYSLOG_FILE_ONEPERSESSION to work as expected --- htdocs/core/modules/syslog/mod_syslog_file.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index b8cc257a7d9..207462b942a 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -109,9 +109,16 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface if (empty($conf->global->SYSLOG_FILE)) $tmp=DOL_DATA_ROOT.'/dolibarr.log'; else $tmp=str_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, $conf->global->SYSLOG_FILE); - if (! empty($conf->global->SYSLOG_FILE_ONEPERSESSION)) // file depend on session name (Note that session name is same for all users and is not a per user value) + if (! empty($conf->global->SYSLOG_FILE_ONEPERSESSION)) { - $suffixinfilename = '_'.session_name(); + if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) // file depend on session key name (Note that session name is same for all users and is not a per user value) + { + $suffixinfilename = '_'.session_name(); + } + if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) // file depend on session value sor per user + { + $suffixinfilename = '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"]; + } } return $suffixinfilename?preg_replace('/\.log$/i', $suffixinfilename.'.log', $tmp):$tmp; From 2649c136cfc20940841ac5ee70aa80fb8aee0553 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 14:31:03 +0200 Subject: [PATCH 111/141] Fix SYSLOG_FILE_ONEPERSESSION --- htdocs/core/modules/syslog/mod_syslog_file.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 207462b942a..df33a697d59 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -113,11 +113,11 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface { if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) // file depend on session key name (Note that session name is same for all users and is not a per user value) { - $suffixinfilename = '_'.session_name(); + $suffixinfilename .= '_'.session_name(); } if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) // file depend on session value sor per user { - $suffixinfilename = '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"]; + $suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"]; } } From 3615b7b45d3fe36af6cb47627fd2091becf58137 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jun 2018 15:44:13 +0200 Subject: [PATCH 112/141] Fix missing translation --- htdocs/install/inc.php | 15 +++++++-------- htdocs/langs/en_US/install.lang | 4 ++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 7c2895eb835..f51254620af 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -172,12 +172,11 @@ if (! empty($dolibarr_main_document_root_alt)) // Security check (old method, when directory is renamed /install.lock) if (preg_match('/install\.lock/i',$_SERVER["SCRIPT_FILENAME"])) { - print 'Install pages have been disabled for security reason (directory renamed with .lock suffix).'; + print $langs->trans("YouTryInstallDisabledByDirLock"); if (! empty($dolibarr_main_url_root)) { - print 'Click on following link. '; - print ''; - print 'Click here to go to Dolibarr'; + print 'Click on following link, '; + print $langs->trans("ClickHereToGoToApp"); print ''; } exit; @@ -191,13 +190,12 @@ if (constant('DOL_DATA_ROOT') === null) { } if (@file_exists($lockfile)) { - print 'Install pages have been disabled for security reason (by lock file install.lock into dolibarr documents directory).
'; + print $langs->trans("YouTryInstallDisabledByFileLock"); if (! empty($dolibarr_main_url_root)) { - print 'Click on following link. '; - print 'If you always reach this page, you must remove install.lock file manually.
'; + print $langs->trans("ClickOnLinkOrRemoveManualy").'
'; print ''; - print 'Click here to go to Dolibarr'; + print $langs->trans("ClickHereToGoToApp"); print ''; } else @@ -370,6 +368,7 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='',$css global $langs; $langs->load("main"); $langs->load("admin"); + $langs->load("install"); $jquerytheme='base'; diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index acdddfe3f59..00d4be864ff 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -204,3 +204,7 @@ MigrationResetBlockedLog=Reset module BlockedLog for v7 algorithm ShowNotAvailableOptions=Show not available options HideNotAvailableOptions=Hide not available options ErrorFoundDuringMigration=Error were reported during migration process so next step is not available. To ignore errors, you can click here, but application or some features may not work correctly until fixed. +YouTryInstallDisabledByDirLock=The application try to sefl upgrade, but install/upgrade pages have been disabled for security reason (directory renamed with .lock suffix).
+YouTryInstallDisabledByFileLock=The application try to sefl upgrade, but install/upgrade pages pages have been disabled for security reason (by lock file install.lock into dolibarr documents directory).
+ClickHereToGoToApp=Click here to go to your application +ClickOnLinkOrRemoveManualy=Click on following link and if you always reach this page, you must remove the file install.lock into documents directory manually \ No newline at end of file From 1bb91c7860aa17799546d402b06dfb23ae7e7940 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 24 Jun 2018 16:20:27 +0200 Subject: [PATCH 113/141] update and clean code --- htdocs/core/ajax/ajaxdirtree.php | 2 -- htdocs/don/tpl/linkedobjectblock.tpl.php | 3 +-- htdocs/fichinter/card.php | 1 - htdocs/fichinter/index.php | 7 ------- htdocs/fichinter/stats/index.php | 5 ++--- htdocs/fichinter/tpl/linkedobjectblock.tpl.php | 3 +-- htdocs/fourn/commande/list.php | 2 -- htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php | 3 +-- htdocs/fourn/facture/list.php | 9 +++------ htdocs/fourn/facture/rapport.php | 4 +--- htdocs/fourn/recap-fourn.php | 6 ++---- 11 files changed, 11 insertions(+), 34 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 59fe3385c61..907a3cea79e 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -321,10 +321,8 @@ if (empty($conf->use_javascript_ajax) || ! empty($conf->global->MAIN_ECM_DISABLE $nbofentries=0; $oldvallevel=0; - $var=true; foreach($sqltree as $key => $val) { - $var=false; $ecmdirstatic->id=$val['id']; $ecmdirstatic->ref=$val['label']; diff --git a/htdocs/don/tpl/linkedobjectblock.tpl.php b/htdocs/don/tpl/linkedobjectblock.tpl.php index fdf6ae71c2f..d7ad6587845 100644 --- a/htdocs/don/tpl/linkedobjectblock.tpl.php +++ b/htdocs/don/tpl/linkedobjectblock.tpl.php @@ -33,12 +33,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("donations"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?>
 
'; @@ -248,10 +245,8 @@ if ($resql) if ($num) { $i = 0; - $var = true; while ($i < $num) { - $obj = $db->fetch_object($resql); print '
'; diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index b00b1391003..7a68bef34ec 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -285,7 +285,6 @@ print '%
0?'&userid='.$userid:'').'">'.$oldyear.'0
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).'
'.$langs->trans("Size").''.$langs->trans("Date").'
'.img_pdf().' '.$file.'
'.img_pdf().' '.$file.''.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile),"dayhour").'
".dol_print_date($fac->date)."
'.$langs->trans("User").''; + if (empty($user->rights->holiday->write_all)) { - print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); + print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300'); //print ''; } - else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); + else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300'); print '
'; - $liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled")); + $liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '1,2'=>$langs->trans("BillShortStatusNotPaid").'+'.$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled")); print $form->selectarray('search_status', $liststatus, $search_status, 1); print '
'.img_view($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle"').''.img_edit_add().''.dol_print_date($file['date'],"dayhour","tzuser").''.dol_print_date($file['date'],"dayhour","tzuser").''; if ($useinecm == 1) { - print ''.img_view('default', 0, 'class="paddingrightonly"').''; + print ''.img_edit('default', 0, 'class="paddingrightonly"').''; } if (! $useinecm || $useinecm == 2) { From 4170e754d640df2e1d6fc47d51d1c5e0112f335f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jun 2018 18:16:25 +0200 Subject: [PATCH 132/141] Fix trad --- htdocs/langs/en_US/products.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index abf262ec9ba..21c2e1dc62c 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -251,8 +251,8 @@ PriceNumeric=Number DefaultPrice=Default price ComposedProductIncDecStock=Increase/Decrease stock on parent change ComposedProduct=Sub-product -MinSupplierPrice=Minimum supplier price -MinCustomerPrice=Minimum customer price +MinSupplierPrice=Minimum buying price +MinCustomerPrice=Minimum selling price DynamicPriceConfiguration=Dynamic price configuration DynamicPriceDesc=On product card, with this module enabled, you should be able to set mathematic functions to calculate Customer or Supplier prices. Such function can use all mathematic operators, some constants and variables. You can set here the variables you want to be able to use and if the variable need an automatic update, the external URL to use to ask Dolibarr to update automaticaly the value. AddVariable=Add Variable From 668608db5ee389e46cdf485892dda39cbdd00602 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jun 2018 18:26:44 +0200 Subject: [PATCH 133/141] Fix error message with old usage of childtables --- htdocs/core/class/commonobject.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 97942687fe4..a165704c058 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3322,7 +3322,14 @@ abstract class CommonObject $langs->load("errors"); //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; $haschild += $obj->nb; - $this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname)); + if (is_numeric($elementname)) // old usage + { + $this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $table); + } + else // new usage: $elementname=Translation key + { + $this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname)); + } break; // We found at least one, we stop here } } From a30789e4234ef68df821bf8be50c710f4965f7d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Jun 2018 00:34:45 +0200 Subject: [PATCH 134/141] Fix table name --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 017f272b986..7ca1d16d67e 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -100,7 +100,7 @@ ALTER TABLE llx_inventory MODIFY COLUMN fk_warehouse integer DEFAULT NULL; ALTER TABLE llx_c_type_fees DROP COLUMN llx_c_type_fees; ALTER TABLE llx_c_type_fees ADD COLUMN type integer DEFAULT 0; -ALTER TABLE llx_c_ecotax CHANGE COLUMN libelle label varchar(255); +ALTER TABLE llx_c_ecotaxe CHANGE COLUMN libelle label varchar(255); ALTER TABLE llx_product_fournisseur_price DROP COLUMN unitcharges; From ff6ffa473825c52189fc715868cc442727ed926e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Jun 2018 00:38:42 +0200 Subject: [PATCH 135/141] Fix data in tooltip --- htdocs/core/boxes/box_clients.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index a293b5166a2..7ab2de66a7b 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -87,7 +87,10 @@ class box_clients extends ModeleBoxes $sql.= ", s.client"; $sql.= ", s.code_fournisseur"; $sql.= ", s.fournisseur"; + $sql.= ", s.code_compta"; + $sql.= ", s.code_compta_fournisseur"; $sql.= ", s.logo"; + $sql.= ", s.email"; $sql.= ", s.datec, s.tms, s.status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -114,9 +117,12 @@ class box_clients extends ModeleBoxes $thirdpartystatic->name = $objp->name; $thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->code_compta = $objp->code_compta; + $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdpartystatic->client = $objp->client; $thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->logo = $objp->logo; + $thirdpartystatic->email = $objp->email; $this->info_box_contents[$line][] = array( 'td' => '', From a0e97c7640cdb7393f6ab67d7256c88c1935508e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Jun 2018 01:31:53 +0200 Subject: [PATCH 136/141] Option to solve autovalidation --- htdocs/contrat/class/contrat.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 24fbabb7772..640793b7f37 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -407,7 +407,10 @@ class Contrat extends CommonObject $this->fetch_thirdparty(); // A contract is validated so we can move thirdparty to status customer - $result=$this->thirdparty->set_as_client(); + if (empty($conf->global->CONTRACT_DISABLE_AUTOSET_AS_CLIENT_ON_CONTRACT_VALIDATION)) + { + $result=$this->thirdparty->set_as_client(); + } // Define new ref if ($force_number) From ac758e02a9a59985d07c024b215e4ebefe5865ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jun 2018 18:26:44 +0200 Subject: [PATCH 137/141] Fix error message with old usage of childtables --- htdocs/core/class/commonobject.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 97942687fe4..a165704c058 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3322,7 +3322,14 @@ abstract class CommonObject $langs->load("errors"); //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; $haschild += $obj->nb; - $this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname)); + if (is_numeric($elementname)) // old usage + { + $this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $table); + } + else // new usage: $elementname=Translation key + { + $this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname)); + } break; // We found at least one, we stop here } } From f292c1c662e7bc9c4015d55d2a998ce6bab79c4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Jun 2018 01:31:53 +0200 Subject: [PATCH 138/141] Option to solve autovalidation --- htdocs/contrat/class/contrat.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 24fbabb7772..640793b7f37 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -407,7 +407,10 @@ class Contrat extends CommonObject $this->fetch_thirdparty(); // A contract is validated so we can move thirdparty to status customer - $result=$this->thirdparty->set_as_client(); + if (empty($conf->global->CONTRACT_DISABLE_AUTOSET_AS_CLIENT_ON_CONTRACT_VALIDATION)) + { + $result=$this->thirdparty->set_as_client(); + } // Define new ref if ($force_number) From a076d4b461952dceb777ce622ad6ef68bf7a94ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Jun 2018 01:53:36 +0200 Subject: [PATCH 139/141] Fix translation during install --- htdocs/install/inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index f51254620af..810e289d7e3 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -172,6 +172,12 @@ if (! empty($dolibarr_main_document_root_alt)) // Security check (old method, when directory is renamed /install.lock) if (preg_match('/install\.lock/i',$_SERVER["SCRIPT_FILENAME"])) { + if (! is_object($langs)) + { + $langs = new Translate('..'); + $langs->setDefaultLang('auto'); + } + $langs->load("install"); print $langs->trans("YouTryInstallDisabledByDirLock"); if (! empty($dolibarr_main_url_root)) { @@ -190,6 +196,12 @@ if (constant('DOL_DATA_ROOT') === null) { } if (@file_exists($lockfile)) { + if (! is_object($langs)) + { + $langs = new Translate('..'); + $langs->setDefaultLang('auto'); + } + $langs->load("install"); print $langs->trans("YouTryInstallDisabledByFileLock"); if (! empty($dolibarr_main_url_root)) { From 9eaca045e465151b3cb0209bfe4ee3fab71e2263 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Jun 2018 11:34:40 +0200 Subject: [PATCH 140/141] Fix default message with online payment link must be hidden when no online payment mode exists. --- htdocs/core/class/html.formmail.class.php | 19 +++++++++++++---- htdocs/core/lib/payments.lib.php | 26 +++++++++++++++++++++++ htdocs/langs/en_US/other.lang | 5 +++-- htdocs/langs/en_US/paypal.lang | 1 - htdocs/public/payment/newpayment.php | 2 ++ 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 4dd07f13313..d1132bb642c 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -917,7 +917,7 @@ class FormMail extends Form } // Complete substitution array with the url to make online payment - $paymenturl=''; + $paymenturl=''; $validpaymentmethod=array(); if (empty($this->substit['__REF__'])) { $paymenturl=''; @@ -926,16 +926,27 @@ class FormMail extends Form { // Set the online payment url link into __ONLINE_PAYMENT_URL__ key require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; - $langs->load('paypal'); + $langs->loadLangs(array('paypal','other')); $typeforonlinepayment='free'; if ($this->param["models"]=='order' || $this->param["models"]=='order_send') $typeforonlinepayment='order'; // TODO use detection on something else than template if ($this->param["models"]=='invoice' || $this->param["models"]=='facture_send') $typeforonlinepayment='invoice'; // TODO use detection on something else than template if ($this->param["models"]=='member') $typeforonlinepayment='member'; // TODO use detection on something else than template $url=getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']); $paymenturl=$url; + + $validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod); + } + var_dump($validpaymentmethod); + if (count($validpaymentmethod) > 0) + { + $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$langs->trans("PredefinedMailContentLink", $paymenturl):''); + $this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl; + } + else + { + $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=''; + $this->substit['__ONLINE_PAYMENT_URL__']=''; } - $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$langs->trans("PredefinedMailContentLink", $paymenturl):''); - $this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl; //Add lines substitution key from each line $lines = ''; diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index df97b133522..d56a7e2311c 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -87,6 +87,32 @@ function payment_supplier_prepare_head(Paiement $object) { return $head; } +/** + * Return array of valid payment mode + * + * @param string $paymentmethod Filter on this payment method + * @return array Array of valid payment method + */ +function getValidOnlinePaymentMethods($paymentmethod='') +{ + global $conf; + + $validpaymentmethod=array(); + + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled)) + { + $validpaymentmethod['paypal']='valid'; + } + if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) + { + $validpaymentmethod['paybox']='valid'; + } + if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled)) + { + $validpaymentmethod['stripe']='valid'; + } + return $validpaymentmethod; +} /** * Return string with full Url diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index fa98516c989..10ca033662d 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -80,8 +80,8 @@ LinkedObject=Linked object NbOfActiveNotifications=Number of notifications (nb of recipient emails) PredefinedMailTest=__(Hello)__\nThis is a test mail sent to __EMAIL__.\nThe two lines are separated by a carriage return.\n\n__USER_SIGNATURE__ PredefinedMailTestHtml=__(Hello)__\nThis is a test mail (the word test must be in bold).
The two lines are separated by a carriage return.

__USER_SIGNATURE__ -PredefinedMailContentSendInvoice=__(Hello)__\n\nYou will find here the invoice __REF__\n\nThis is the link to make your online payment if this invoice is not already payed:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ -PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nWe would like to warn you that the invoice __REF__ seems to not be payed. So this is the invoice in attachment again, as a reminder.\n\nThis is the link to make your online payment:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ +PredefinedMailContentSendInvoice=__(Hello)__\n\nYou will find here the invoice __REF__\n\n__ONLINE_PAYMENT_TEXT_AND_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ +PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nWe would like to warn you that the invoice __REF__ seems to not be payed. So this is the invoice in attachment again, as a reminder.\n\n__ONLINE_PAYMENT_TEXT_AND_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendProposal=__(Hello)__\n\nYou will find here the commercial proposal __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendSupplierProposal=__(Hello)__\n\nYou will find here the price request __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendOrder=__(Hello)__\n\nYou will find here the order __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ @@ -91,6 +91,7 @@ PredefinedMailContentSendShipping=__(Hello)__\n\nYou will find here the shipping PredefinedMailContentSendFichInter=__(Hello)__\n\nYou will find here the intervention __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentThirdparty=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ +PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.

%s

DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available. ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfilMore=...or build your own profile
(manual module selection) diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index 2cbe4289654..547b188b4a5 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -14,7 +14,6 @@ PaypalModeOnlyPaypal=PayPal only ONLINE_PAYMENT_CSS_URL=Optionnal URL of CSS style sheet on online payment page ThisIsTransactionId=This is id of transaction: %s PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail -PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.

%s

YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode NewOnlinePaymentReceived=New online payment received NewOnlinePaymentFailed=New online payment tried but failed diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index ec2f43841f5..a189781c8c1 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -208,6 +208,8 @@ if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stri $validpaymentmethod['stripe']='valid'; } +// TODO Replace previous set of $validpaymentmethod with this line: +//$validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod); // Check security token From 6fc6a743c89351f98eda7ce0ea3fa031f553dadc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Jun 2018 12:11:49 +0200 Subject: [PATCH 141/141] Fix template email message html/nohtml --- htdocs/core/class/html.formmail.class.php | 8 ++++---- htdocs/langs/en_US/other.lang | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index d1132bb642c..ffe22b580e7 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -936,10 +936,10 @@ class FormMail extends Form $validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod); } - var_dump($validpaymentmethod); - if (count($validpaymentmethod) > 0) + + if (count($validpaymentmethod) > 0 && $paymenturl) { - $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$langs->trans("PredefinedMailContentLink", $paymenturl):''); + $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n',"\n",$langs->transnoentities("PredefinedMailContentLink", $paymenturl)); $this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl; } else @@ -963,7 +963,7 @@ class FormMail extends Form $defaultmessage=str_replace('\n',"\n",$defaultmessage); // Deal with format differences between message and signature (text / HTML) - if(dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) { + if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $this->substit['__USER_SIGNATURE__'] = dol_nl2br($this->substit['__USER_SIGNATURE__']); } else if(!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $defaultmessage = dol_nl2br($defaultmessage); diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 10ca033662d..8ef8cc30090 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -91,7 +91,7 @@ PredefinedMailContentSendShipping=__(Hello)__\n\nYou will find here the shipping PredefinedMailContentSendFichInter=__(Hello)__\n\nYou will find here the intervention __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentThirdparty=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ -PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.

%s

+PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available. ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfilMore=...or build your own profile
(manual module selection)