diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index ac0d2ed72e1..caf9c88428e 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -272,8 +272,11 @@ class Conf
// Define default dir_output and dir_temp for directories of modules
foreach($this->modules as $module)
{
- $this->$module->dir_output=$rootfordata."/".$module;
- $this->$module->dir_temp=$rootfordata."/".$module."/temp";
+ $this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
+ $this->$module->multidir_temp = array($this->entity => $rootfordata."/".$module."/temp");
+ // For backward compatibility
+ $this->$module->dir_output = $rootfordata."/".$module;
+ $this->$module->dir_temp = $rootfordata."/".$module."/temp";
}
// For mycompany storage
@@ -285,6 +288,9 @@ class Conf
$this->admin->dir_temp=$rootfordata.'/admin/temp';
// For user storage
+ $this->user->multidir_output = array($this->entity => $rootfordata."/users");
+ $this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp");
+ // For backward compatibility
$this->user->dir_output=$rootforuser."/users";
$this->user->dir_temp=$rootforuser."/users/temp";
@@ -305,11 +311,18 @@ class Conf
$this->fournisseur->commande->dir_temp =$rootfordata."/fournisseur/commande/temp";
$this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture";
$this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp";
+
// Module product/service
- $this->product->dir_output=array($this->entity => $rootfordata."/produit");
- $this->product->dir_temp =array($this->entity => $rootfordata."/produit/temp");
- $this->service->dir_output=array($this->entity => $rootfordata."/produit");
- $this->service->dir_temp =array($this->entity => $rootfordata."/produit/temp");
+ $this->product->multidir_output=array($this->entity => $rootfordata."/produit");
+ $this->product->multidir_temp =array($this->entity => $rootfordata."/produit/temp");
+ $this->service->multidir_output=array($this->entity => $rootfordata."/produit");
+ $this->service->multidir_temp =array($this->entity => $rootfordata."/produit/temp");
+ // For backward compatibility
+ $this->product->dir_output=$rootfordata."/produit";
+ $this->product->dir_temp =$rootfordata."/produit/temp";
+ $this->service->dir_output=$rootfordata."/produit";
+ $this->service->dir_temp =$rootfordata."/produit/temp";
+
// Module contrat
$this->contrat->dir_output=$rootfordata."/contracts";
$this->contrat->dir_temp =$rootfordata."/contracts/temp";
diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php
index 46cd33e57a9..5724411047c 100644
--- a/htdocs/core/photos_resize.php
+++ b/htdocs/core/photos_resize.php
@@ -69,9 +69,9 @@ if ($id > 0)
{
$result = $object->fetch($id);
if ($result <= 0) dol_print_error($db,'Failed to load object');
- $dir=$conf->product->dir_output[$object->entity]; // By default
- if ($object->type == 0) $dir=$conf->product->dir_output[$object->entity];
- if ($object->type == 1) $dir=$conf->service->dir_output[$object->entity];
+ $dir=$conf->product->multidir_output[$object->entity]; // By default
+ if ($object->type == 0) $dir=$conf->product->multidir_output[$object->entity];
+ if ($object->type == 1) $dir=$conf->service->multidir_output[$object->entity];
}
/*
diff --git a/htdocs/document.php b/htdocs/document.php
index b62bd0f9c8a..ee6f7fb6d33 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -310,8 +310,8 @@ if ($modulepart)
{
$accessallowed=1;
}
- if ($conf->product->enabled) $original_file=$conf->product->dir_output[GETPOST('entity','int')].'/'.$original_file;
- elseif ($conf->service->enabled) $original_file=$conf->service->dir_output[GETPOST('entity','int')].'/'.$original_file;
+ if ($conf->product->enabled) $original_file=$conf->product->multidir_output[GETPOST('entity','int')].'/'.$original_file;
+ elseif ($conf->service->enabled) $original_file=$conf->service->multidir_output[GETPOST('entity','int')].'/'.$original_file;
}
// Wrapping pour les contrats
diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php
index 140f608a54f..d877fa6b067 100644
--- a/htdocs/fourn/product/photos.php
+++ b/htdocs/fourn/product/photos.php
@@ -42,7 +42,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
$result = $object->fetch($id);
- $object->add_photo($conf->product->dir_output[$object->entity], $_FILES['photofile']);
+ $object->add_photo($conf->product->multidir_output[$object->entity], $_FILES['photofile']);
}
}
/*
@@ -139,7 +139,7 @@ if ($id)
$nbbyrow=5;
$pdir = get_exdir($object->id,2) . $object->id ."/photos/";
- $dir = $conf->product->dir_output[$object->entity] . '/'. $pdir;
+ $dir = $conf->product->multidir_output[$object->entity] . '/'. $pdir;
print '
| ';
- if ($showphoto) print $object->show_photos($conf->product->dir_output[$object->entity],1,1,0,0,0,80);
+ if ($showphoto) print $object->show_photos($conf->product->multidir_output[$object->entity],1,1,0,0,0,80);
if ($showphoto && $showbarcode) print ' '; if ($showbarcode) print $form->showbarcode($object); print ' | ';
diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php
index 8e0c34b6792..e5aa4bf123d 100644
--- a/htdocs/product/photos.php
+++ b/htdocs/product/photos.php
@@ -49,7 +49,7 @@ $object = new Product($db);
if ($id > 0 || ! empty($ref))
{
$result = $object->fetch($id, $ref);
- $dir = (! empty($conf->product->dir_output[$object->entity])?$conf->product->dir_output[$object->entity]:$conf->service->dir_output[$object->entity]);
+ $dir = (! empty($conf->product->multidir_output[$object->entity])?$conf->product->multidir_output[$object->entity]:$conf->service->multidir_output[$object->entity]);
}
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index dcb075c90dd..c6045df5920 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -130,14 +130,14 @@ print '';
// Label
print '||
| '.$langs->trans("Label").' | '.$object->libelle.' | '; -$isphoto=$object->is_photo_available($conf->product->dir_output[$object->entity]); +$isphoto=$object->is_photo_available($conf->product->multidir_output[$object->entity]); $nblignes=5; if ($isphoto) { // Photo print ''; - print $object->show_photos($conf->product->dir_output[$object->entity],1,1,0,0,0,80); + print $object->show_photos($conf->product->multidir_output[$object->entity],1,1,0,0,0,80); print ' | '; } diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index fbbd37bc1df..24b1444ddcc 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -111,7 +111,7 @@ if (! empty($id) || ! empty($ref)) // Generation des graphs $WIDTH=380; $HEIGHT=160; - $dir = (! empty($conf->product->dir_temp[$object->entity])?$conf->product->dir_temp[$object->entity]:$conf->service->dir_temp[$object->entity]); + $dir = (! empty($conf->product->multidir_temp[$object->entity])?$conf->product->multidir_temp[$object->entity]:$conf->service->multidir_temp[$object->entity]); if (! file_exists($dir.'/'.$object->id)) { if (dol_mkdir($dir.'/'.$object->id) < 0) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index a8233cad6d9..3d70e4a8b35 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -197,13 +197,13 @@ if ($modulepart) elseif (preg_match('/^productstats_/i',$modulepart)) { if ($user->rights->produit->lire || $user->rights->service->lire) $accessallowed=1; - $original_file=(!empty($conf->product->dir_temp[GETPOST('entity','int')])?$conf->product->dir_temp[GETPOST('entity','int')]:$conf->service->dir_temp[GETPOST('entity','int')]).'/'.$original_file; + $original_file=(!empty($conf->product->multidir_temp[GETPOST('entity','int')])?$conf->product->multidir_temp[GETPOST('entity','int')]:$conf->service->multidir_temp[GETPOST('entity','int')]).'/'.$original_file; } // Wrapping for products or services elseif ($modulepart == 'product') { if ($user->rights->produit->lire || $user->rights->service->lire) $accessallowed=1; - $original_file=(! empty($conf->product->dir_output[GETPOST('entity','int')])?$conf->product->dir_output[GETPOST('entity','int')]:$conf->service->dir_output[GETPOST('entity','int')]).'/'.$original_file; + $original_file=(! empty($conf->product->multidir_output[GETPOST('entity','int')])?$conf->product->multidir_output[GETPOST('entity','int')]:$conf->service->multidir_output[GETPOST('entity','int')]).'/'.$original_file; } // Wrapping for products or services elseif ($modulepart == 'tax') @@ -239,7 +239,7 @@ if ($modulepart) elseif ($modulepart == 'graph_product') { $accessallowed=1; - $original_file=$conf->product->dir_temp[GETPOST('entity','int')].'/'.$original_file; + $original_file=$conf->product->multidir_temp[GETPOST('entity','int')].'/'.$original_file; } // Wrapping pour les code barre elseif ($modulepart == 'barcode')