diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php index be335107839..88087882233 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 @@ -88,7 +89,7 @@ if ($result < 0) } $form = new Form($db); -$BookKeeping = new lettering($db); +$BookKeeping = new Lettering($db); $formaccounting = new FormAccounting($db); /* diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php index 905361b4c8e..197c71b3123 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,7 +22,7 @@ */ /** - * \file accountancy/bookkeeping/thirdparty_lettrage_supplier.php + * \file htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php * \ingroup Advanced accountancy * \brief Tab to setup lettering */ @@ -92,7 +93,7 @@ if ($result<0) } $form = new Form($db); -$BookKeeping = new lettering($db); +$BookKeeping = new Lettering($db); $formaccounting = new FormAccounting($db); /* diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 0ddbaeb5026..78b555fcce5 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,7 +19,7 @@ */ /** - * \file accountancy/class/bookkeeping.class.php + * \file htdocs/accountancy/class/lettering.class.php * \ingroup Advanced accountancy * \brief File of class for lettering */ @@ -27,9 +28,9 @@ include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php"; /** - * Class lettering + * Class Lettering */ -class lettering extends BookKeeping +class Lettering extends BookKeeping { /** * lettrageTiers @@ -47,6 +48,7 @@ class lettering extends BookKeeping $object->id = $socid; $object->fetch($socid); + if ($object->code_compta == '411CUSTCODE') { $object->code_compta = ''; } 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 * 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/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2650c48b573..4729e11ff85 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=(empty($InfoFieldList[2]) ? 3 : $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($getnomurlparam); } } else @@ -6219,6 +6220,7 @@ abstract class CommonObject return 'Error bad setup of extrafield'; } } + else $value=''; } elseif ($type == 'text' || $type == 'html') { 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++; } 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/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; 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/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 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"; }