2
0
forked from Wavyzz/dolibarr

Maxi miscellaneous debug

This commit is contained in:
Laurent Destailleur
2017-05-05 12:33:49 +02:00
parent fecf5efa5b
commit 68b63927e0
22 changed files with 203 additions and 220 deletions

View File

@@ -1070,6 +1070,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
if (class_exists("Imagick"))
{
if ($object->element == 'propal') $modulepart='propal';
@@ -1077,7 +1078,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'facture') $modulepart='facture';
if ($object->element == 'fichinter') $modulepart='ficheinter';
if ($object->element == 'contrat') $modulepart='contract';
if ($object->element == 'order_supplier') $modulepart='supplier_order';
if ($object->element == 'supplier_proposal') $modulepart='supplier_proposal';
if ($object->element == 'order_supplier') $modulepart='supplier_order';
if ($object->element == 'invoice_supplier') $modulepart='supplier_invoice';
}
if ($object->element == 'product')
@@ -1107,14 +1110,22 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
{
$phototoshow='';
// Check if a preview file is available
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order')) && class_exists("Imagick"))
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice')) && class_exists("Imagick"))
{
$objectref = dol_sanitizeFileName($object->ref);
$dir_output = $conf->$modulepart->dir_output . "/";
$filepath = $dir_output . $objectref . "/";
if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice')))
{
$subdir = get_exdir($object->id, 2, 0, 0, $object, $modulepart).$objectref;
}
else
{
$subdir = get_exdir($object->id, 0, 0, 0, $object, $modulepart).$objectref;
}
$filepath = $dir_output . $subdir . "/";
$file = $filepath . $objectref . ".pdf";
$relativepath = $objectref.'/'.$objectref.'.pdf';
$relativepath = $subdir.'/'.$objectref.'.pdf';
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
$fileimage = $file.'_preview.png'; // If PDF has 1 page
$fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page
@@ -4465,7 +4476,8 @@ function yn($yesno, $case=1, $color=0)
/**
* Return a path to have a directory according to object.
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
* New usage: $conf->module->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
* or: $conf->module->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart') if multidir_output not defined.
* Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
*
* @param string $num Id of object (deprecated, $object will be used in future)
@@ -4486,7 +4498,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
if (! empty($level) && in_array($modulepart, $arrayforoldpath))
{
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided.
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);
else $num = preg_replace('/^.*\-/i','',$num);
$num = substr("000".$num, -$level);