From 93477c102f725a449cc912dbc8b0ba168c9926e4 Mon Sep 17 00:00:00 2001 From: John Date: Mon, 26 Jun 2017 15:44:04 +0200 Subject: [PATCH 01/65] FIX delete linked element on facture rec --- htdocs/compta/facture/class/facture-rec.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index ef23a30b878..e39a4a7b994 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -475,7 +475,13 @@ class FactureRec extends CommonInvoice { $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid; dol_syslog($sql); - if (! $this->db->query($sql)) + if ($this->db->query($sql)) + { + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) $error=-3; + } + else { $this->error=$this->db->lasterror(); $error=-1; From 13e5c8ff7ac61bd3b22810d06a229f7c7d768166 Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 26 Jun 2017 22:44:56 +0200 Subject: [PATCH 02/65] Create patch Add Number of supplier prices and wap columns --- .../fourn/class/fournisseur.product.class.php | 28 ++++++++--- htdocs/langs/en_US/suppliers.lang | 1 + htdocs/product/list.php | 49 ++++++++++++++++++- 3 files changed, 70 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 4f576148099..e8a63e252d7 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -699,17 +699,33 @@ class ProductFournisseur extends Product /** * Display price of product * - * @param int $showunitprice Show "Unit price" into output string - * @param int $showsuptitle Show "Supplier" into output string - * @param int $maxlen Max length of name - * @param integer $notooltip 1=Disable tooltip + * @param int $showunitprice Show "Unit price" into output string + * @param int $showsuptitle Show "Supplier" into output string + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip + * @param array $productFournList list of ProductFournisseur objects to display in table format. * @return string String with supplier price */ - function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0) + function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0, $productFournList=array()) { global $langs; + + $out = ''; $langs->load("suppliers"); - $out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_unitcharges - $this->fourn_remise).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); + if (count($productFournList) > 0) { + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + foreach ($productFournList as $productFourn) { + $out.= ''; + $out.= ''; + $out.= ''; + } + $out .= '
'.($showunitprice?$langs->trans("Price").' '.$langs->trans("HT"):'').''.$langs->trans("Supplier").''.$langs->trans("SupplierRef").'
'.($showunitprice?price($productFourn->fourn_unitprice * (1 -$productFourn->fourn_remise_percent/100) + $productFourn->fourn_unitcharges - $productFourn->fourn_remise):'').''.$productFourn->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).''.$productFourn->fourn_ref.'
'; + } else { + $out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_unitcharges - $this->fourn_remise).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); + } return $out; } diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang index d84925d0676..079b588167f 100644 --- a/htdocs/langs/en_US/suppliers.lang +++ b/htdocs/langs/en_US/suppliers.lang @@ -43,3 +43,4 @@ NotTheGoodQualitySupplier=Wrong quality ReputationForThisProduct=Reputation BuyerName=Buyer name AllProductServicePrices=All product / service prices +BuyingPriceNumShort=Nbr of Buying prices diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 74f9c59cff3..fa0ee2cace7 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -164,6 +164,8 @@ $arrayfields=array( 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))), 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))), + 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))), + 'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))), 'p.seuil_stock_alerte'=>array('label'=>$langs->trans("StockLimit"), 'checked'=>0, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), 'p.desiredstock'=>array('label'=>$langs->trans("DesiredStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), 'p.stock'=>array('label'=>$langs->trans("PhysicalStock"), 'checked'=>1, 'enabled'=>(! empty($conf->stock->enabled) && $user->rights->stock->lire && $contextpage != 'service')), @@ -266,7 +268,7 @@ else $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_buy,'; - $sql.= ' p.datec as date_creation, p.tms as date_update,'; + $sql.= ' p.datec as date_creation, p.tms as date_update, p.pmp,'; //$sql.= ' pfp.ref_fourn as ref_supplier, '; $sql.= ' MIN(pfp.unitprice) as minsellprice'; if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { @@ -335,7 +337,7 @@ else $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_buy'; + $sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_buy, p.pmp'; if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { $sql .= ', pac.rowid'; } @@ -563,6 +565,20 @@ else print ''; print ' '; print ''; + } + // Number buying Price + if (! empty($arrayfields['p.numbuyprice']['checked'])) + { + print ''; + print ' '; + print ''; + } + // Number buying Price + if (! empty($arrayfields['p.pmp']['checked'])) + { + print ''; + print ' '; + print ''; } // Limit for alert if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) @@ -640,6 +656,8 @@ else 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); @@ -703,6 +721,7 @@ else $product_static->status_buy = $obj->tobuy; $product_static->status = $obj->tosell; $product_static->entity = $obj->entity; + $product_static->pmp = $obj->pmp; if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) // To optimize call of load_stock { @@ -798,6 +817,32 @@ else print ''; } + // Number of buy prices + if (! empty($arrayfields['p.numbuyprice']['checked'])) + { + print ''; + if ($obj->tobuy) + { + if (($productFournList = $product_fourn->list_product_fournisseur_price($product_fourn->id)) > 0) + { + $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList); + print $form->textwithpicto(count($productFournList),$htmltext); + } + } + print ''; + } + + // WAP + if (! empty($arrayfields['p.pmp']['checked'])) + { + print ''; + if ($obj->tobuy) + { + print price($product_static->pmp, 1, $langs, 1, 2, 1, 'auto'); + } + print ''; + } + // Limit alert if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) { From 3664956b8c98859e0f97b33cf219509889c208a4 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 28 Jun 2017 00:31:33 +0200 Subject: [PATCH 03/65] Update pdf_azur.modules.php --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 972a75eecc8..3eb284ec7fc 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -120,7 +120,7 @@ class pdf_azur extends ModelePDFPropales } $this->posxdiscount=162; $this->postotalht=174; - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { From cef5c0b37514c38ed370d996abf541d1f5d2438d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 28 Jun 2017 00:38:24 +0200 Subject: [PATCH 04/65] Fix column position in PDF when VAT is hidden --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index d31ed238965..54c1f546903 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -122,7 +122,7 @@ class pdf_einstein extends ModelePDFCommandes } $this->posxdiscount=162; $this->postotalht=174; - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index c1682c78087..7fb55b398bc 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -132,7 +132,7 @@ class pdf_crabe extends ModelePDFFactures $this->posxdiscount=162; $this->posxprogress=126; // Only displayed for situation invoices $this->postotalht=174; - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index c546aad91ad..10ea968c041 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -108,7 +108,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->posxqty=145; $this->posxdiscount=162; $this->postotalht=174; - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { From 58328d36b3e40534a78c0a6d36f28b6a8cf21aa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Jun 2017 15:32:36 +0200 Subject: [PATCH 05/65] To provide solution to get thirdparty when name is not unique. --- htdocs/societe/class/societe.class.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 097537ac71a..1423b53b9da 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1004,21 +1004,22 @@ class Societe extends CommonObject * @param int $rowid Id of third party to load * @param string $ref Reference of third party, name (Warning, this can return several records) * @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr) - * @param string $ref_int Internal reference of third party + * @param string $ref_int Internal reference of third party (not used by dolibarr) * @param string $idprof1 Prof id 1 of third party (Warning, this can return several records) * @param string $idprof2 Prof id 2 of third party (Warning, this can return several records) * @param string $idprof3 Prof id 3 of third party (Warning, this can return several records) * @param string $idprof4 Prof id 4 of third party (Warning, this can return several records) * @param string $idprof5 Prof id 5 of third party (Warning, this can return several records) * @param string $idprof6 Prof id 6 of third party (Warning, this can return several records) + * @param string $email Email (Warning, this can return several records) * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found. */ - function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='') + function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='', $email='') { global $langs; global $conf; - if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6)) return -1; + if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6) && empty($email)) return -1; $sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm'; $sql .= ', s.status'; @@ -1062,6 +1063,7 @@ class Societe extends CommonObject else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")"; + else if ($email) $sql .= " WHERE email = '".$this->db->escape($email)."' AND s.entity IN (".getEntity($this->element, 1).")"; $resql=$this->db->query($sql); dol_syslog(get_class($this)."::fetch ".$sql); @@ -1886,7 +1888,7 @@ class Societe extends CommonObject $label.= '' . $langs->trans("ShowMargin") . ''; $linkstart = ''; @@ -1949,7 +1951,7 @@ class Societe extends CommonObject $linkstart=''; $linkend=''; } - + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$linkstart.($maxlen?dol_trunc($name,$maxlen):$name).$linkend; @@ -3449,9 +3451,9 @@ class Societe extends CommonObject return 0; } } - + $modelpath = "core/modules/societe/doc/"; - + $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } @@ -3472,7 +3474,7 @@ class Societe extends CommonObject public function setCategories($categories, $type) { require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - + // Decode type if ($type == 'customer') { $type_id = Categorie::TYPE_CUSTOMER; From 2f8c0bb555a089fe5b36065a0ca830709ecacb58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Jun 2017 15:36:39 +0200 Subject: [PATCH 06/65] Revert "To provide solution to get thirdparty when name is not unique." This reverts commit 58328d36b3e40534a78c0a6d36f28b6a8cf21aa9. --- htdocs/societe/class/societe.class.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1423b53b9da..097537ac71a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1004,22 +1004,21 @@ class Societe extends CommonObject * @param int $rowid Id of third party to load * @param string $ref Reference of third party, name (Warning, this can return several records) * @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr) - * @param string $ref_int Internal reference of third party (not used by dolibarr) + * @param string $ref_int Internal reference of third party * @param string $idprof1 Prof id 1 of third party (Warning, this can return several records) * @param string $idprof2 Prof id 2 of third party (Warning, this can return several records) * @param string $idprof3 Prof id 3 of third party (Warning, this can return several records) * @param string $idprof4 Prof id 4 of third party (Warning, this can return several records) * @param string $idprof5 Prof id 5 of third party (Warning, this can return several records) * @param string $idprof6 Prof id 6 of third party (Warning, this can return several records) - * @param string $email Email (Warning, this can return several records) * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found. */ - function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='', $email='') + function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='') { global $langs; global $conf; - if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6) && empty($email)) return -1; + if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6)) return -1; $sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm'; $sql .= ', s.status'; @@ -1063,7 +1062,6 @@ class Societe extends CommonObject else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")"; - else if ($email) $sql .= " WHERE email = '".$this->db->escape($email)."' AND s.entity IN (".getEntity($this->element, 1).")"; $resql=$this->db->query($sql); dol_syslog(get_class($this)."::fetch ".$sql); @@ -1888,7 +1886,7 @@ class Societe extends CommonObject $label.= '' . $langs->trans("ShowMargin") . ''; $linkstart = ''; @@ -1951,7 +1949,7 @@ class Societe extends CommonObject $linkstart=''; $linkend=''; } - + if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$linkstart.($maxlen?dol_trunc($name,$maxlen):$name).$linkend; @@ -3451,9 +3449,9 @@ class Societe extends CommonObject return 0; } } - + $modelpath = "core/modules/societe/doc/"; - + $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } @@ -3474,7 +3472,7 @@ class Societe extends CommonObject public function setCategories($categories, $type) { require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; - + // Decode type if ($type == 'customer') { $type_id = Categorie::TYPE_CUSTOMER; From 7556a604e364a6d4cb3d5517605170012277bf84 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 29 Jun 2017 16:30:57 +0200 Subject: [PATCH 07/65] fix travis --- .../class/accountancycategory.class.php | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 7668756a046..a7bab16b30d 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -429,7 +429,7 @@ class AccountancyCategory return - 1; } } - + public function getCats() { global $db, $langs, $user, $mysoc; @@ -462,7 +462,7 @@ class AccountancyCategory if ($num) { while ( $i < $num ) { $obj = $this->db->fetch_object($resql); - + $data[] = array ( 'rowid' => $obj->rowid, 'code' => $obj->code, @@ -483,10 +483,10 @@ class AccountancyCategory return - 1; } } - - - // calcule - + + + // calcule + const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/'; const PARENTHESIS_DEPTH = 10; @@ -535,10 +535,12 @@ class AccountancyCategory return 0; } - + /** * get cpts of category * + * @param int $cat_id Id accounting account category + * * @return array Result in table */ public function getCptsCat($cat_id) { @@ -554,7 +556,7 @@ class AccountancyCategory $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " WHERE t.fk_accounting_category = ".$cat_id; $sql .= " ORDER BY t.account_number "; - + //echo $sql; $resql = $this->db->query($sql); @@ -582,5 +584,5 @@ class AccountancyCategory return -1; } } - + } From 7dc4eeddf04d0bfb6de78a5c4bcf6c793e32c405 Mon Sep 17 00:00:00 2001 From: KHELIFA Date: Thu, 29 Jun 2017 16:44:52 +0200 Subject: [PATCH 08/65] FIX: Function load_board in commande.class.php for warnings delay in dashboard --- htdocs/commande/class/commande.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 93df2f1aa0b..eb62d84ce48 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3243,7 +3243,8 @@ class Commande extends CommonOrder $response->nbtodo++; $generic_commande->statut = $obj->fk_statut; - $generic_commande->date_livraison = $obj->delivery_date; + $generic_commande->date_commande = $this->db->jdate($obj->date_commande); + $generic_commande->date_livraison = $this->db->jdate($obj->delivery_date); if ($generic_commande->hasDelay()) { $response->nbtodolate++; From 62f8aa8b40f1a45ee22a8ddfff25a54b462835f6 Mon Sep 17 00:00:00 2001 From: KHELIFA Date: Thu, 29 Jun 2017 16:49:30 +0200 Subject: [PATCH 09/65] Fix: In supplier order, show link Now for order date and delivery date --- htdocs/fourn/commande/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index bdd38ebc0b7..d49d9df85d2 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2704,7 +2704,7 @@ elseif (! empty($object->id)) //print ''.$langs->trans("ToOrder").''; print ''.$langs->trans("OrderDate").''; $date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - print $form->select_date($date_com,'',1,1,'',"commande",1,0,1); + print $form->select_date($date_com,'',1,1,'',"commande",1,1,1); print ''; print ''.$langs->trans("OrderMode").''; @@ -2756,7 +2756,7 @@ if ($action != 'makeorder') print ''; //print ''; print '\n"; print "
'.$langs->trans("Receive").'
'.$langs->trans("DeliveryDate").''; - print $form->select_date('','',1,1,'',"commande",1,0,1); + print $form->select_date('','',1,1,'',"commande",1,1,1); print "
".$langs->trans("Delivery")."\n"; From 7d4a093d9ebd49be669e43061e037dff7280f2d5 Mon Sep 17 00:00:00 2001 From: fappels Date: Fri, 30 Jun 2017 10:52:54 +0200 Subject: [PATCH 10/65] WAP alway decimal 2 digits --- .../fourn/class/fournisseur.product.class.php | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 38a1ea366c5..bcbaf18e9f5 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -699,12 +699,13 @@ class ProductFournisseur extends Product /** * Display price of product * - * @param int $showunitprice Show "Unit price" into output string - * @param int $showsuptitle Show "Supplier" into output string - * @param int $maxlen Max length of name - * @param integer $notooltip 1=Disable tooltip - * @param array $productFournList list of ProductFournisseur objects to display in table format. - * @return string String with supplier price + * @param int $showunitprice Show "Unit price" into output string + * @param int $showsuptitl Show "Supplier" into output string + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip + * @param array $productFournList list of ProductFournisseur objects + * to display in table format. + * @return string String with supplier price */ function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0, $productFournList=array()) { @@ -713,16 +714,18 @@ class ProductFournisseur extends Product $out = ''; $langs->load("suppliers"); if (count($productFournList) > 0) { - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; + $out .= '
'.($showunitprice?$langs->trans("Price").' '.$langs->trans("HT"):'').''.$langs->trans("Supplier").''.$langs->trans("SupplierRef").'
'; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; foreach ($productFournList as $productFourn) { $out.= ''; + $out.= ''; $out.= ''; $out.= ''; } - $out .= '
'.($showunitprice?$langs->trans("Price").' '.$langs->trans("HT"):'').''.($showunitprice?$langs->trans("QtyMin"):'').''.$langs->trans("Supplier").''.$langs->trans("SupplierRef").'
'.($showunitprice?price($productFourn->fourn_unitprice * (1 -$productFourn->fourn_remise_percent/100) + $productFourn->fourn_unitcharges - $productFourn->fourn_remise):'').''.($showunitprice?$productFourn->fourn_qty:'').''.$productFourn->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).''.$productFourn->fourn_ref.'
'; + $out .= '
'; } else { $out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_unitcharges - $this->fourn_remise).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); } From d0599cd9528dd9ad9e3e45d4930cf61bd6dd9159 Mon Sep 17 00:00:00 2001 From: fappels Date: Fri, 30 Jun 2017 10:54:04 +0200 Subject: [PATCH 11/65] Revert "WAP alway decimal 2 digits" This reverts commit 7d4a093d9ebd49be669e43061e037dff7280f2d5. --- .../fourn/class/fournisseur.product.class.php | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index bcbaf18e9f5..38a1ea366c5 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -699,13 +699,12 @@ class ProductFournisseur extends Product /** * Display price of product * - * @param int $showunitprice Show "Unit price" into output string - * @param int $showsuptitl Show "Supplier" into output string - * @param int $maxlen Max length of name - * @param integer $notooltip 1=Disable tooltip - * @param array $productFournList list of ProductFournisseur objects - * to display in table format. - * @return string String with supplier price + * @param int $showunitprice Show "Unit price" into output string + * @param int $showsuptitle Show "Supplier" into output string + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip + * @param array $productFournList list of ProductFournisseur objects to display in table format. + * @return string String with supplier price */ function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0, $productFournList=array()) { @@ -714,18 +713,16 @@ class ProductFournisseur extends Product $out = ''; $langs->load("suppliers"); if (count($productFournList) > 0) { - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; + $out .= '
'.($showunitprice?$langs->trans("Price").' '.$langs->trans("HT"):'').''.($showunitprice?$langs->trans("QtyMin"):'').''.$langs->trans("Supplier").''.$langs->trans("SupplierRef").'
'; + $out .= ''; + $out .= ''; + $out .= ''; foreach ($productFournList as $productFourn) { $out.= ''; - $out.= ''; $out.= ''; $out.= ''; } - $out .= '
'.($showunitprice?$langs->trans("Price").' '.$langs->trans("HT"):'').''.$langs->trans("Supplier").''.$langs->trans("SupplierRef").'
'.($showunitprice?price($productFourn->fourn_unitprice * (1 -$productFourn->fourn_remise_percent/100) + $productFourn->fourn_unitcharges - $productFourn->fourn_remise):'').''.($showunitprice?$productFourn->fourn_qty:'').''.$productFourn->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).''.$productFourn->fourn_ref.'
'; + $out .= ''; } else { $out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_unitcharges - $this->fourn_remise).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); } From 574590a59860e3cda4189a4d0e59573fd4996fc1 Mon Sep 17 00:00:00 2001 From: fappels Date: Fri, 30 Jun 2017 10:55:45 +0200 Subject: [PATCH 12/65] Add minimum qty column --- .../fourn/class/fournisseur.product.class.php | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 38a1ea366c5..bcbaf18e9f5 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -699,12 +699,13 @@ class ProductFournisseur extends Product /** * Display price of product * - * @param int $showunitprice Show "Unit price" into output string - * @param int $showsuptitle Show "Supplier" into output string - * @param int $maxlen Max length of name - * @param integer $notooltip 1=Disable tooltip - * @param array $productFournList list of ProductFournisseur objects to display in table format. - * @return string String with supplier price + * @param int $showunitprice Show "Unit price" into output string + * @param int $showsuptitl Show "Supplier" into output string + * @param int $maxlen Max length of name + * @param integer $notooltip 1=Disable tooltip + * @param array $productFournList list of ProductFournisseur objects + * to display in table format. + * @return string String with supplier price */ function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0, $productFournList=array()) { @@ -713,16 +714,18 @@ class ProductFournisseur extends Product $out = ''; $langs->load("suppliers"); if (count($productFournList) > 0) { - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; + $out .= '
'.($showunitprice?$langs->trans("Price").' '.$langs->trans("HT"):'').''.$langs->trans("Supplier").''.$langs->trans("SupplierRef").'
'; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; foreach ($productFournList as $productFourn) { $out.= ''; + $out.= ''; $out.= ''; $out.= ''; } - $out .= '
'.($showunitprice?$langs->trans("Price").' '.$langs->trans("HT"):'').''.($showunitprice?$langs->trans("QtyMin"):'').''.$langs->trans("Supplier").''.$langs->trans("SupplierRef").'
'.($showunitprice?price($productFourn->fourn_unitprice * (1 -$productFourn->fourn_remise_percent/100) + $productFourn->fourn_unitcharges - $productFourn->fourn_remise):'').''.($showunitprice?$productFourn->fourn_qty:'').''.$productFourn->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).''.$productFourn->fourn_ref.'
'; + $out .= ''; } else { $out=($showunitprice?price($this->fourn_unitprice * (1 - $this->fourn_remise_percent/100) + $this->fourn_unitcharges - $this->fourn_remise).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); } From 989084e4dece898320c368ac34f2561f8cb245eb Mon Sep 17 00:00:00 2001 From: fappels Date: Fri, 30 Jun 2017 10:56:05 +0200 Subject: [PATCH 13/65] WAP always 2 decimals --- htdocs/langs/en_US/suppliers.lang | 2 +- htdocs/product/list.php | 46 +++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang index 079b588167f..28c5fe39d0d 100644 --- a/htdocs/langs/en_US/suppliers.lang +++ b/htdocs/langs/en_US/suppliers.lang @@ -43,4 +43,4 @@ NotTheGoodQualitySupplier=Wrong quality ReputationForThisProduct=Reputation BuyerName=Buyer name AllProductServicePrices=All product / service prices -BuyingPriceNumShort=Nbr of Buying prices +BuyingPriceNumShort=Supplier prices diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 50bd61fad17..cb31de75892 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -829,31 +829,31 @@ else } // Number of buy prices - if (! empty($arrayfields['p.numbuyprice']['checked'])) - { - print ''; - if ($obj->tobuy) - { - if (($productFournList = $product_fourn->list_product_fournisseur_price($product_fourn->id)) > 0) - { - $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList); - print $form->textwithpicto(count($productFournList),$htmltext); - } - } - print ''; - } + if (! empty($arrayfields['p.numbuyprice']['checked'])) + { + print ''; + if ($obj->tobuy) + { + if (($productFournList = $product_fourn->list_product_fournisseur_price($product_fourn->id)) > 0) + { + $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList); + print $form->textwithpicto(count($productFournList),$htmltext); + } + } + print ''; + } // WAP - if (! empty($arrayfields['p.pmp']['checked'])) - { - print ''; - if ($obj->tobuy) - { - print price($product_static->pmp, 1, $langs, 1, 2, 1, 'auto'); - } - print ''; - } - + if (! empty($arrayfields['p.pmp']['checked'])) + { + print ''; + if ($obj->tobuy) + { + print price($product_static->pmp, 1, $langs, 1, 2, 2, 'auto'); + } + print ''; + } + // Limit alert if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) { From ea504a0516b2f521408270423803f6ef9d0992f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jun 2017 11:08:40 +0200 Subject: [PATCH 14/65] FIX We should be able to insert data with value '0' into const --- htdocs/core/modules/DolibarrModules.class.php | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 8e526baa241..f0dce5f37a1 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -50,13 +50,13 @@ class DolibarrModules // Can not be abstract, because we need to insta * @since 4.0.0 */ public $editor_name; - + /** * @var string URL of module at publisher site * @since 4.0.0 */ public $editor_url; - + /** * @var string Family * @see familyinfo @@ -80,13 +80,13 @@ class DolibarrModules // Can not be abstract, because we need to insta * */ public $familyinfo; - + /** * @var int Module position * @since 3.9.0 */ public $module_position=500; - + /** * @var string Module name * @@ -214,7 +214,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * HTML content supported. */ public $descriptionlong; - + /** * @var string[] Module language files */ @@ -254,7 +254,7 @@ class DolibarrModules // Can not be abstract, because we need to insta * @var bool Module is enabled globally (Multicompany support) */ public $core_enabled; - + /** * @var string Relative path to module style sheet * @deprecated @@ -573,9 +573,9 @@ class DolibarrModules // Can not be abstract, because we need to insta { global $langs; $langs->load("admin"); - + if (empty($this->descriptionlong)) return ''; - + // If module description translation does not exist using its unique id, we can use its name to find translation if (is_array($this->langfiles)) { @@ -586,7 +586,7 @@ class DolibarrModules // Can not be abstract, because we need to insta } return $langs->trans($this->descriptionlong); } - + /** * Gives the publisher name * @@ -596,7 +596,7 @@ class DolibarrModules // Can not be abstract, because we need to insta { return $this->editor_name; } - + /** * Gives the publisher url * @@ -606,7 +606,7 @@ class DolibarrModules // Can not be abstract, because we need to insta { return $this->editor_url; } - + /** * Gives module version (translated if param $translated is on) * For 'experimental' modules, gives 'experimental' translation @@ -709,7 +709,7 @@ class DolibarrModules // Can not be abstract, because we need to insta } } - + /** * Gives the last date of activation * @@ -718,11 +718,11 @@ class DolibarrModules // Can not be abstract, because we need to insta function getLastActivationDate() { global $conf; - + $sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->const_name."'"; $sql.= " AND entity IN (0, ".$conf->entity.")"; - + dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG); $resql=$this->db->query($sql); if (! $resql) $err++; @@ -731,11 +731,11 @@ class DolibarrModules // Can not be abstract, because we need to insta $obj=$this->db->fetch_object($resql); if ($obj) return $this->db->jdate($obj->tms); } - + return ''; } - - + + /** * Insert constants for module activation * @@ -836,7 +836,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $files[] = $file; } sort($files); - foreach ($files as $file) + foreach ($files as $file) { if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data') { @@ -854,7 +854,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $files[] = $file; } sort($files); - foreach ($files as $file) + foreach ($files as $file) { if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data') { @@ -872,7 +872,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $files[] = $file; } sort($files); - foreach ($files as $file) + foreach ($files as $file) { if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data') { @@ -890,7 +890,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $files[] = $file; } sort($files); - foreach ($files as $file) + foreach ($files as $file) { if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update') { @@ -1030,19 +1030,19 @@ class DolibarrModules // Can not be abstract, because we need to insta //$titre = $this->boxes[$key][0]; $file = $this->boxes[$key]['file']; //$note = $this->boxes[$key][2]; - + // TODO If the box is also included by another module and the other module is still on, we should not remove it. // For the moment, we manage this with hard coded exception //print "Remove box ".$file.'
'; if ($file == 'box_graph_product_distribution.php') { - if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) + if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) { dol_syslog("We discard disabling of module ".$file." because another module still active require it."); continue; } } - + if (empty($file)) $file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:''; // For backward compatibility if ($this->db->type == 'sqlite3') { @@ -1117,7 +1117,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:''; $priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:''; $test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be visible - + // Search if boxes def already present $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob"; $sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'"; @@ -1329,11 +1329,11 @@ class DolibarrModules // Can not be abstract, because we need to insta // Clean if (empty($visible)) $visible='0'; - if (empty($val)) $val=''; + if (empty($val) && $val != '0') $val=''; $sql = "SELECT count(*)"; $sql.= " FROM ".MAIN_DB_PREFIX."const"; - $sql.= " WHERE ".$this->db->decrypt('name')." = '".$name."'"; + $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($name)."'"; $sql.= " AND entity = ".$entity; $result=$this->db->query($sql); @@ -1347,7 +1347,7 @@ class DolibarrModules // Can not be abstract, because we need to insta $sql.= " VALUES ("; $sql.= $this->db->encrypt($name,1); $sql.= ",'".$type."'"; - $sql.= ",".($val?$this->db->encrypt($val,1):"''"); + $sql.= ",".(($val != '')?$this->db->encrypt($val,1):"''"); $sql.= ",".($note?"'".$this->db->escape($note)."'":"null"); $sql.= ",'".$visible."'"; $sql.= ",".$entity; @@ -1552,7 +1552,7 @@ class DolibarrModules // Can not be abstract, because we need to insta /** * Removes access rights - * + * * @return int Error count (0 if OK) */ function delete_permissions() @@ -1585,7 +1585,7 @@ class DolibarrModules // Can not be abstract, because we need to insta global $user; if (! is_array($this->menu) || empty($this->menu)) return 0; - + require_once DOL_DOCUMENT_ROOT . '/core/class/menubase.class.php'; $err=0; From 11cd4e1164d8e3dd0380afa9e70f4566e7497fe5 Mon Sep 17 00:00:00 2001 From: Darkjeff Date: Fri, 30 Jun 2017 11:29:37 +0200 Subject: [PATCH 15/65] Fix Binding Customer --- 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 75c1a59aa30..2663ab1d779 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -189,7 +189,8 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accounta $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"; -$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')"; +$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='' OR p.accountancy_code_sell NOT IN + (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))"; // Add search filter like if ($search_lineid) { $sql .= natural_search("l.rowid", $search_lineid, 1); From 2c795da664e5c932bade64139ae121849ddbd760 Mon Sep 17 00:00:00 2001 From: Darkjeff Date: Fri, 30 Jun 2017 11:30:20 +0200 Subject: [PATCH 16/65] Fix Binding Supplier --- htdocs/accountancy/supplier/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index ff39aad67f4..3077f8f337b 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -191,7 +191,8 @@ $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountan $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"; -$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')"; +$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy =''OR p.accountancy_code_buy NOT IN + (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid ='" . $conf->global->CHARTOFACCOUNTS . "'))"; // Add search filter like if ($search_lineid) { $sql .= natural_search("l.rowid", $search_lineid, 1); From f978b0795a5d1d119d5016cc5d6f3e83ae776deb Mon Sep 17 00:00:00 2001 From: Darkjeff Date: Fri, 30 Jun 2017 11:31:24 +0200 Subject: [PATCH 17/65] Fix action in journal --- htdocs/accountancy/journal/bankjournal.php | 6 +++--- htdocs/accountancy/journal/purchasesjournal.php | 6 +++--- htdocs/accountancy/journal/sellsjournal.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index ed8d1d7501a..056f3644770 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -75,7 +75,7 @@ $date_endyear = GETPOST('date_endyear'); $in_bookkeeping = GETPOST('in_bookkeeping'); $now = dol_now(); -$action = GETPOST('action','alpha'); +$action = GETPOST('action','aZ09'); // Security check if ($user->societe_id > 0 && empty($id_journal)) @@ -612,7 +612,7 @@ if (! $error && $action == 'writebookkeeping') { } // Export -if ($action == 'export_csv') { +if ($action == 'exportcsv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; @@ -760,7 +760,7 @@ if (empty($action) || $action == 'view') {