From a7bd734ece65606a657d1bcfb242909c43caad1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Jun 2019 21:18:49 +0200 Subject: [PATCH] Rename ->produit into ->product. Still permissions to rename. --- htdocs/admin/barcode.php | 2 +- htdocs/core/class/conf.class.php | 1 + htdocs/core/lib/product.lib.php | 4 ++-- htdocs/core/modules/DolibarrModules.class.php | 2 +- htdocs/core/modules/modCategorie.class.php | 2 +- .../product/doc/doc_generic_product_odt.modules.php | 12 ++++++------ .../modules/product/doc/pdf_standard.modules.php | 6 +++--- .../stock/doc/doc_generic_stock_odt.modules.php | 10 +++++----- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/product/admin/price_rules.php | 2 +- htdocs/product/admin/product.php | 2 +- htdocs/product/admin/product_extrafields.php | 2 +- htdocs/product/card.php | 6 +++--- htdocs/product/list.php | 10 +++++----- 15 files changed, 33 insertions(+), 32 deletions(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 993af489989..f844b135a4a 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -365,7 +365,7 @@ print '
'; // Select barcode numbering module -if ($conf->produit->enabled) +if ($conf->product->enabled) { print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', ''); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 62c7f0f9e24..9dbf7ccd125 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -672,6 +672,7 @@ class Conf if (isset($this->commande)) $this->order=$this->commande; if (isset($this->contrat)) $this->contract=$this->contrat; if (isset($this->categorie)) $this->category=$this->categorie; + if (isset($this->project)) $this->project=$this->projet; // Object $mc if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled)) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 4d79d0d4db3..68a6d9082f2 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -127,7 +127,7 @@ function product_prepare_head($object) $h++; } } - + // Tab to link resources if (!empty($conf->resource->enabled)) { @@ -173,7 +173,7 @@ function product_prepare_head($object) if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->produit->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; + if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; $nbFiles += count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); } diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 9a695788b47..4a8135800ae 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1297,7 +1297,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate 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->product->enabled) || ! empty($conf->service->enabled)) { dol_syslog("We discard disabling of module ".$file." because another module still active require it."); continue; } diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index d8f8b6915f3..092d5ac10b7 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -230,7 +230,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r]='category_'.$r; $this->export_label[$r]='CatProdList'; $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->produit->enabled'; + $this->export_enabled[$r]='$conf->product->enabled || $conf->service->enabled'; $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire")); $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref'); $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text'); diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 49dc1b7598c..f8861380b2f 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -244,7 +244,7 @@ class doc_generic_product_odt extends ModelePDFProduct // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); - if ($conf->produit->dir_output) + if ($conf->product->dir_output) { // If $object is id instead of object if (! is_object($object)) @@ -262,7 +262,7 @@ class doc_generic_product_odt extends ModelePDFProduct $supplierprices = $productFournisseur->list_product_fournisseur_price($object->id); $object->supplierprices = $supplierprices; - $dir = $conf->produit->dir_output; + $dir = $conf->product->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref; $file = $dir . "/" . $objectref . ".odt"; @@ -302,9 +302,9 @@ class doc_generic_product_odt extends ModelePDFProduct //print "newdir=".$dir; //print "newfile=".$newfile; //print "file=".$file; - //print "conf->produit->dir_temp=".$conf->produit->dir_temp; + //print "conf->product->dir_temp=".$conf->product->dir_temp; - dol_mkdir($conf->produit->dir_temp); + dol_mkdir($conf->product->dir_temp); // If CUSTOMER contact defined on product, we use it @@ -357,10 +357,10 @@ class doc_generic_product_odt extends ModelePDFProduct // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->produit->dir_temp, + 'PATH_TO_TMP' => $conf->product->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 04d566248b9..89f0f67ae53 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -174,18 +174,18 @@ class pdf_standard extends ModelePDFProduct $nblignes = count($object->lines); - if ($conf->produit->dir_output) + if ($conf->product->dir_output) { // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->produit->dir_output; + $dir = $conf->product->dir_output; $file = $dir . "/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->produit->dir_output . "/" . $objectref; + $dir = $conf->product->dir_output . "/" . $objectref; $file = $dir . "/" . $objectref . ".pdf"; } diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 35c467c110c..ac9c0423694 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -244,7 +244,7 @@ class doc_generic_stock_odt extends ModelePDFStock // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); - if ($conf->produit->dir_output) + if ($conf->product->dir_output) { // If $object is id instead of object if (! is_object($object)) @@ -262,7 +262,7 @@ class doc_generic_stock_odt extends ModelePDFStock $supplierprices = $stockFournisseur->list_stock_fournisseur_price($object->id); $object->supplierprices = $supplierprices; - $dir = $conf->produit->dir_output; + $dir = $conf->product->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref; $file = $dir . "/" . $objectref . ".odt"; @@ -302,9 +302,9 @@ class doc_generic_stock_odt extends ModelePDFStock //print "newdir=".$dir; //print "newfile=".$newfile; //print "file=".$file; - //print "conf->produit->dir_temp=".$conf->produit->dir_temp; + //print "conf->product->dir_temp=".$conf->product->dir_temp; - dol_mkdir($conf->produit->dir_temp); + dol_mkdir($conf->product->dir_temp); // If CUSTOMER contact defined on stock, we use it @@ -360,7 +360,7 @@ class doc_generic_stock_odt extends ModelePDFStock $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->produit->dir_temp, + 'PATH_TO_TMP' => $conf->product->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index da2930ed667..94eeef8da38 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; if (! empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; -if (!empty($conf->produit->enabled)) +if (!empty($conf->product->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (!empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c25b0afa15b..4f1340a27d8 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -41,7 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -if (!empty($conf->produit->enabled)) { +if (!empty($conf->product->enabled)) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; } if (!empty($conf->projet->enabled)) { diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index d50e474026e..5b2e931e7b6 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -113,7 +113,7 @@ while ($result = $db->fetch_object($query)) { $title = $langs->trans('ProductServiceSetup'); $tab = $langs->trans("ProductsAndServices"); -if (empty($conf->produit->enabled)) { +if (empty($conf->product->enabled)) { $title = $langs->trans('ServiceSetup'); $tab = $langs->trans('Services'); } elseif (empty($conf->service->enabled)) { diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 888863e5e66..95f61d2f20a 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -272,7 +272,7 @@ $formbarcode=new FormBarCode($db); $title = $langs->trans('ProductServiceSetup'); $tab = $langs->trans("ProductsAndServices"); -if (empty($conf->produit->enabled)) +if (empty($conf->product->enabled)) { $title = $langs->trans('ServiceSetup'); $tab = $langs->trans('Services'); diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index a01ba46b624..e70e09a9640 100644 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -61,7 +61,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; $title = $langs->trans('ProductServiceSetup'); $textobject = $langs->trans("ProductsAndServices"); -if (empty($conf->produit->enabled)) +if (empty($conf->product->enabled)) { $title = $langs->trans('ServiceSetup'); $textobject = $langs->trans('Services'); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 847c6325b50..cdd94ae4a3c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -148,7 +148,7 @@ if (empty($reshook)) } // Actions to build doc - $upload_dir = $conf->produit->dir_output; + $upload_dir = $conf->product->dir_output; $permissioncreate = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; @@ -1601,7 +1601,7 @@ else print ''; // Type - if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) + if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) { // TODO change for compatibility with edit in place $typeformat='select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); @@ -2158,7 +2158,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') // Documents $objectref = dol_sanitizeFileName($object->ref); $relativepath = $comref . '/' . $objectref . '.pdf'; - $filedir = $conf->produit->dir_output . '/' . $objectref; + $filedir = $conf->product->dir_output . '/' . $objectref; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed=$usercanread; $delallowed=$usercancreate; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 7d766452186..1a9b5fa1f6f 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -165,13 +165,13 @@ $arrayfields=array( 'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), //'pfp.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), 'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->service->enabled))), + 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->service->enabled))), 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))), - 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled))), - 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SIZE))), - 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SURFACE))), - 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->global->PRODUCT_DISABLE_VOLUME))), + 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled))), + 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SURFACE))), + 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_VOLUME))), '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))),