From 4d72cafa52a31e504219197c848053f6118ddb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Oct 2018 13:47:51 +0200 Subject: [PATCH 01/11] code comment --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 304abf46432..60a51074d58 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -122,7 +122,7 @@ class Setup extends DolibarrApi * @param string $filter To filter the countries by name * @param string $lang Code of the language the label of the countries must be translated to * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" - * @return List of countries + * @return array List of countries * * @url GET dictionary/countries * From fab10acc15f3f8e4350b71e1763786da21d42d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Oct 2018 16:23:43 +0200 Subject: [PATCH 02/11] change class name from lettering to Lettering --- htdocs/accountancy/class/lettering.class.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 70d7a88c55b..d37b29961f2 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -1,7 +1,8 @@ - * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013 Alexandre Spangaro +/* Copyright (C) 2004-2005 Rodolphe Quiedeville + * Copyright (C) 2013 Olivier Geffroy + * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,8 +19,8 @@ */ /** - * \file accountancy/class/bookkeeping.class.php - * \ingroup Accounting Expert + * \file htdocs/accountancy/class/lettering.class.php + * \ingroup accountancy * \brief Fichier de la classe des comptes comptable */ @@ -29,9 +30,9 @@ include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; /** - * Class lettering + * Class Lettering */ -class lettering extends BookKeeping +class Lettering extends BookKeeping { /** * lettrageTiers @@ -48,10 +49,10 @@ class lettering extends BookKeeping $object->fetch($socid); - if( $object->code_compta == '411CUSTCODE') + if ($object->code_compta == '411CUSTCODE') $object->code_compta = ''; - if( $object->code_compta_fournisseur == '401SUPPCODE') + if ($object->code_compta_fournisseur == '401SUPPCODE') $object->code_compta_fournisseur = ''; From d3022413ef2aa26c00d60a011a2b843b0324425e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Oct 2018 16:25:57 +0200 Subject: [PATCH 03/11] Update thirdparty_lettrage.php --- htdocs/accountancy/bookkeeping/thirdparty_lettrage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php index 9ffffb4d1ed..8717f7b46a1 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php @@ -4,6 +4,7 @@ * Copyright (C) 2013 Olivier Geffroy * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,7 +64,7 @@ $object->fetch($socid); $form = new Form($db); -$BookKeeping = new lettering($db); +$BookKeeping = new Lettering($db); $formaccounting = new FormAccounting($db); From 02954931d8c6b6e8525a8d4285c46f23ba901828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 20 Oct 2018 16:27:15 +0200 Subject: [PATCH 04/11] Update thirdparty_lettrage_supplier.php --- .../bookkeeping/thirdparty_lettrage_supplier.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php index 05315fe13ad..8fa6cd4a3d5 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php @@ -4,6 +4,7 @@ * Copyright (C) 2013 Olivier Geffroy * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,8 +22,8 @@ */ /** - * \file accounting/bookkeeping/thirdparty_lettrage.php - * \ingroup Accounting Expert + * \file htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php + * \ingroup accountancy * \brief Onglet de gestion de parametrages des ventilations */ @@ -65,7 +66,7 @@ $object->id = $socid; $object->fetch($socid); $form = new Form($db); -$BookKeeping = new lettering($db); +$BookKeeping = new Lettering($db); $formaccounting = new FormAccounting($db); From 5bac6a92e66b2893e30aee4ec9e6d8416d2f9b70 Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Tue, 23 Oct 2018 00:00:05 +0100 Subject: [PATCH 05/11] Fix:empty value instead of 0 for empty links --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2650c48b573..197f61735c3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6219,6 +6219,7 @@ abstract class CommonObject return 'Error bad setup of extrafield'; } } + else $value=''; } elseif ($type == 'text' || $type == 'html') { From 7e7473e7df80d9e4696911b30d9aad9afd68f8ff Mon Sep 17 00:00:00 2001 From: Abbes Bahfir Date: Tue, 23 Oct 2018 01:25:26 +0100 Subject: [PATCH 06/11] New : parameter for getnomurl in field dpecification --- htdocs/core/class/commonobject.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2650c48b573..bfb657f6216 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6203,6 +6203,7 @@ abstract class CommonObject $InfoFieldList = explode(":", $param_list[0]); $classname=$InfoFieldList[0]; $classpath=$InfoFieldList[1]; + $getnomurlparam=$InfoFieldList[2]; if (! empty($classpath)) { dol_include_once($InfoFieldList[1]); @@ -6210,7 +6211,7 @@ abstract class CommonObject { $object = new $classname($this->db); $object->fetch($value); - $value=$object->getNomUrl(3); + $value=$object->getNomUrl(!empty($getnomurlparam)?$getnomurlparam:3); } } else From e40ee879dcfa23cd96ff1da6f5a9d75fa918f863 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 23 Oct 2018 13:07:09 +0200 Subject: [PATCH 07/11] New: works with variants: - If product is variant disable prices modify - Add function isVariant for knowing if product is a Variant --- htdocs/langs/en_US/products.lang | 1 + htdocs/product/class/product.class.php | 30 ++++++++++++++++ htdocs/product/price.php | 47 ++++++++++++++------------ 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 8390eb5439d..95b93aba4e9 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -331,6 +331,7 @@ NbProducts=No. of products ParentProduct=Parent product HideChildProducts=Hide variant products ShowChildProducts=Show variant products +NoEditVariants=Go to Parent product card and edit variants price impact in the variants tab ConfirmCloneProductCombinations=Would you like to copy all the product variants to the other parent product with the given reference? CloneDestinationReference=Destination product reference ErrorCopyProductCombinations=There was an error while copying the product variants diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2d2e7b75ed2..f8326a60721 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3529,6 +3529,36 @@ class Product extends CommonObject return $nb; } + + /** + * Return if loaded product is a variant + * + * @return int + */ + function isVariant() + { + global $conf; + if (!empty($conf->variants->enabled)) { + $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_attribute_combination WHERE fk_product_child = " . $this->id . " AND entity IN (" . getEntity('product') . ")"; + + $query = $this->db->query($sql); + + if ($query) { + if (!$this->db->num_rows($query)) { + return false; + } + return true; + } else { + dol_print_error($this->db); + return -1; + } + + } else { + return false; + } + + } + /** * Return all parent products for current product (first level only) * diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a72ea28928b..9fb67aaa86c 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2014 Florian Henry - * Copyright (C) 2014-2016 Juanjo Menent + * Copyright (C) 2014-2018 Juanjo Menent * Copyright (C) 2014-2018 Philippe Grand * Copyright (C) 2014 Ion agorria * Copyright (C) 2015 Alexandre Spangaro @@ -1109,30 +1109,33 @@ if (! $action || $action == 'delete' || $action == 'showlog_customer_price' || $ { print "\n" . '
' . "\n"; - if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) - { - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; - } - } + if ($object->isVariant()) { + if ($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + } + } else { + if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + if ($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + } + } - if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) - { - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; - } - } + if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + if ($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + } + } - if (! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) - { - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; - } + if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + if ($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + } - if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; - } - } + if ($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + } + } + } print "\n
\n"; } From d9965d19864f7d0dda16b8aeb0710fb24023f581 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 23 Oct 2018 17:18:30 +0200 Subject: [PATCH 08/11] Fix travis messages --- .../commande/doc/pdf_eratosthene.modules.php | 17 +++++++++++------ .../modules/facture/doc/pdf_sponge.modules.php | 15 ++++++++++----- .../modules/propale/doc/pdf_cyan.modules.php | 13 ++++++++----- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 89297d1bdc6..0a14e50326d 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -145,7 +145,7 @@ class pdf_eratosthene extends ModelePDFCommandes $this->atleastonediscount=0; } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Function to build pdf onto disk * * @param Object $object Object to generate @@ -158,6 +158,7 @@ class pdf_eratosthene extends ModelePDFCommandes */ function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0) { + // phpcs:enable global $user, $langs, $conf, $mysoc, $db, $hookmanager, $nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; @@ -711,7 +712,7 @@ class pdf_eratosthene extends ModelePDFCommandes } } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Show payments table * * @param TCPDF $pdf Object PDF @@ -722,11 +723,12 @@ class pdf_eratosthene extends ModelePDFCommandes */ function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { - + // phpcs:enable + } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF @@ -737,6 +739,7 @@ class pdf_eratosthene extends ModelePDFCommandes */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { + // phpcs:enable global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -912,7 +915,7 @@ class pdf_eratosthene extends ModelePDFCommandes } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Show total to pay * * @param TCPDF $pdf Object PDF @@ -924,6 +927,7 @@ class pdf_eratosthene extends ModelePDFCommandes */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { + // phpcs:enable global $conf,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1485,7 +1489,8 @@ class pdf_eratosthene extends ModelePDFCommandes * @param int $hideref Do not show ref * @return null */ - function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){ + function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) + { global $conf, $hookmanager; diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index ca27bd09aff..2a5aeb3fadd 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -159,7 +159,7 @@ class pdf_sponge extends ModelePDFFactures } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Function to build pdf onto disk * * @param Object $object Object to generate @@ -172,6 +172,7 @@ class pdf_sponge extends ModelePDFFactures */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; @@ -846,7 +847,7 @@ class pdf_sponge extends ModelePDFFactures } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Show payments table * * @param PDF $pdf Object PDF @@ -857,6 +858,7 @@ class pdf_sponge extends ModelePDFFactures */ function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { + // phpcs:enable global $conf; $sign=1; @@ -986,7 +988,7 @@ class pdf_sponge extends ModelePDFFactures } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Show miscellaneous information (payment mode, payment term, ...) * * @param PDF $pdf Object PDF @@ -997,6 +999,7 @@ class pdf_sponge extends ModelePDFFactures */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { + // phpcs:enable global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1143,7 +1146,7 @@ class pdf_sponge extends ModelePDFFactures } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Show total to pay * * @param PDF $pdf Object PDF @@ -1155,6 +1158,7 @@ class pdf_sponge extends ModelePDFFactures */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { + // phpcs:enable global $conf,$mysoc; $sign=1; @@ -1838,7 +1842,8 @@ class pdf_sponge extends ModelePDFFactures * @param int $hideref Do not show ref * @return null */ - function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){ + function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) + { global $conf, $hookmanager; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index e1f874b6853..509173a0aa7 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -117,7 +117,7 @@ class pdf_cyan extends ModelePDFPropales $this->atleastonediscount=0; } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Function to build pdf onto disk * * @param Object $object Object to generate @@ -130,6 +130,7 @@ class pdf_cyan extends ModelePDFPropales */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$db,$hookmanager,$nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; @@ -872,7 +873,7 @@ class pdf_cyan extends ModelePDFPropales } } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Show payments table * * @param TCPDF $pdf Object PDF @@ -883,11 +884,11 @@ class pdf_cyan extends ModelePDFPropales */ function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { - + // phpcs:enable } - /** + /** phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps * Show miscellaneous information (payment mode, payment term, ...) * * @param TCPDF $pdf Object PDF @@ -898,6 +899,7 @@ class pdf_cyan extends ModelePDFPropales */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { + // phpcs:enable global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1701,7 +1703,8 @@ class pdf_cyan extends ModelePDFPropales * @param int $hideref Do not show ref * @return null */ - function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0){ + function defineColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) + { global $conf, $hookmanager; From 0fe2c63bc09e0094787ee874dc860900cfb665e0 Mon Sep 17 00:00:00 2001 From: atm-john Date: Tue, 23 Oct 2018 22:10:30 +0200 Subject: [PATCH 09/11] FIX missing print button for delivery form --- htdocs/core/actions_printing.inc.php | 18 ++++++++++++++---- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/livraison/card.php | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index d2d34cd523a..d5c40c17ad0 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -47,11 +47,21 @@ if ($action == 'print_file' && $user->rights->printing->read) { { $printerfound++; - $subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':''); + $subdir=''; $module = GETPOST('printer', 'alpha'); - if ($module =='commande_fournisseur') { - $module = 'fournisseur'; - $subdir = 'commande'; + switch ($module ) + { + case 'livraison' : + $subdir = 'receipt'; + $module = 'expedition'; + break; + case 'expedition' : + $subdir = 'sending'; + break; + case 'commande_fournisseur' : + $module = 'fournisseur'; + $subdir = 'commande'; + break; } try { $ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e4c5b9a84b5..bfc67880a96 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -310,7 +310,7 @@ class FormFile $param.= 'entity='.(!empty($object->entity)?$object->entity:$conf->entity); $printer=0; - if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur', 'expensereport'))) // The direct print feature is implemented only for such elements + if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur', 'expensereport','livraison'))) // The direct print feature is implemented only for such elements { $printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled))?true:false; } diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 44eb12299d9..2fee2e100ba 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -292,6 +292,7 @@ elseif ($action == 'remove_file') } */ +include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; /* * View From 82f40fb4b930ad83d9669ce98b80677493b38cb9 Mon Sep 17 00:00:00 2001 From: atm-john Date: Tue, 23 Oct 2018 23:21:30 +0200 Subject: [PATCH 10/11] NEW hidden conf to search by supplier ref --- htdocs/core/class/html.form.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1cc02f0939a..5391dc0bd37 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2071,6 +2071,12 @@ class Form $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid"; } + + // include search in supplier ref + if(!empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) + { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; + } //Price by customer if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { @@ -2124,6 +2130,7 @@ class Form if ($i > 0) $sql.=" AND "; $sql.="(p.ref LIKE '".$db->escape($prefix.$crit)."%' OR p.label LIKE '".$db->escape($prefix.$crit)."%'"; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.=" OR pl.label LIKE '".$db->escape($prefix.$crit)."%'"; + if (! empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) $sql.=" OR pfp.ref_fourn LIKE '".$db->escape($prefix.$crit)."%'"; $sql.=")"; $i++; } From d5285ca359365cd2a809e5fd5ae4d3bcf3eab163 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Oct 2018 01:53:07 +0200 Subject: [PATCH 11/11] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bfb657f6216..ef42301b228 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6203,7 +6203,7 @@ abstract class CommonObject $InfoFieldList = explode(":", $param_list[0]); $classname=$InfoFieldList[0]; $classpath=$InfoFieldList[1]; - $getnomurlparam=$InfoFieldList[2]; + $getnomurlparam=(empty($InfoFieldList[2]) ? 3 : $InfoFieldList[2]); if (! empty($classpath)) { dol_include_once($InfoFieldList[1]); @@ -6211,7 +6211,7 @@ abstract class CommonObject { $object = new $classname($this->db); $object->fetch($value); - $value=$object->getNomUrl(!empty($getnomurlparam)?$getnomurlparam:3); + $value=$object->getNomUrl($getnomurlparam); } } else