Rename ->produit into ->product. Still permissions to rename.

This commit is contained in:
Laurent Destailleur 2019-06-24 21:18:49 +02:00
parent ad0ed2bb19
commit a7bd734ece
15 changed files with 33 additions and 32 deletions

View File

@ -365,7 +365,7 @@ print '<br>';
// Select barcode numbering module
if ($conf->produit->enabled)
if ($conf->product->enabled)
{
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');

View File

@ -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))

View File

@ -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)$'));
}

View File

@ -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.'<br>';
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;
}

View File

@ -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');

View File

@ -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' => '}'

View File

@ -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";
}

View File

@ -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' => '}'

View File

@ -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';

View File

@ -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)) {

View File

@ -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)) {

View File

@ -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');

View File

@ -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');

View File

@ -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 '<table class="border tableforfield" width="100%">';
// 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;

View File

@ -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))),