Fixed: Location for file storage from tab attached files was not at same
place than from tab images.
This commit is contained in:
parent
35129f2192
commit
553181a5d9
@ -57,11 +57,6 @@ function product_prepare_head($object, $user)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$object->id;
|
|
||||||
$head[$h][1] = $langs->trans("Photos");
|
|
||||||
$head[$h][2] = 'photos';
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
// Show category tab
|
// Show category tab
|
||||||
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire)
|
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire)
|
||||||
{
|
{
|
||||||
@ -116,14 +111,19 @@ function product_prepare_head($object, $user)
|
|||||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'product');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'product');
|
||||||
|
|
||||||
// Attachments
|
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Photos");
|
||||||
|
$head[$h][2] = 'photos';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
// Attachments
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||||
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';
|
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||||
$head[$h][2] = 'documents';
|
$head[$h][2] = 'documents';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
|||||||
@ -3101,10 +3101,14 @@ class Product extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
|
function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/photos";
|
|
||||||
|
$dir = $sdir;
|
||||||
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2) . $this->id ."/photos";
|
||||||
|
|
||||||
dol_mkdir($dir);
|
dol_mkdir($dir);
|
||||||
|
|
||||||
@ -3156,8 +3160,8 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$pdir = get_exdir($this->id,2) . $this->id ."/photos/";
|
$dir = $sdir;
|
||||||
$dir = $sdir . '/'. $pdir;
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2) . $this->id ."/photos";
|
||||||
|
|
||||||
$nbphoto=0;
|
$nbphoto=0;
|
||||||
|
|
||||||
@ -3199,8 +3203,19 @@ class Product extends CommonObject
|
|||||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
||||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
|
include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
|
||||||
|
|
||||||
$pdir = get_exdir($this->id,2) . $this->id ."/photos/";
|
$dir = $sdir . '/';
|
||||||
$dir = $sdir . '/'. $pdir;
|
$pdir = '/';
|
||||||
|
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||||
|
{
|
||||||
|
$dir .= get_exdir($this->id,2) . $this->id ."/photos/";
|
||||||
|
$pdir .= get_exdir($this->id,2) . $this->id ."/photos/";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$dir .= $this->ref.'/';
|
||||||
|
$pdir .= $this->ref.'/';
|
||||||
|
}
|
||||||
|
|
||||||
$dirthumb = $dir.'thumbs/';
|
$dirthumb = $dir.'thumbs/';
|
||||||
$pdirthumb = $pdir.'thumbs/';
|
$pdirthumb = $pdir.'thumbs/';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user