Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
6d3529b606
@ -43,6 +43,8 @@ accessforbidden();
|
|||||||
$type=GETPOST('type', 'alpha');
|
$type=GETPOST('type', 'alpha');
|
||||||
$value=GETPOST('value', 'alpha');
|
$value=GETPOST('value', 'alpha');
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
$label = GETPOST('label', 'alpha');
|
||||||
$scandir = GETPOST('scan_dir','alpha');
|
$scandir = GETPOST('scan_dir','alpha');
|
||||||
|
|
||||||
$specimenthirdparty=new Societe($db);
|
$specimenthirdparty=new Societe($db);
|
||||||
|
|||||||
@ -48,12 +48,15 @@ if ($action == 'presend')
|
|||||||
|
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
$ref = dol_sanitizeFileName($object->ref);
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
// Special case
|
||||||
//
|
|
||||||
if ($object->element == 'invoice_supplier')
|
if ($object->element == 'invoice_supplier')
|
||||||
{
|
{
|
||||||
$fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+');
|
$fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+');
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||||
|
}
|
||||||
|
|
||||||
$file = $fileparams['fullname'];
|
$file = $fileparams['fullname'];
|
||||||
}
|
}
|
||||||
@ -86,16 +89,27 @@ if ($action == 'presend')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build document if it not exists
|
// Build document if it not exists
|
||||||
if (! in_array($object->element, array('societe', 'user', 'member')))
|
$forcebuilddoc=true;
|
||||||
|
if (in_array($object->element, array('societe', 'user', 'member'))) $forcebuilddoc=false;
|
||||||
|
if ($object->element == 'invoice_supplier' && empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)) $forcebuilddoc=false;
|
||||||
|
if ($forcebuilddoc) // If there is no default value for supplier invoice, we do not generate file, even if modelpdf was set by a manual generation
|
||||||
{
|
{
|
||||||
if ((! $file || ! is_readable($file)) && method_exists($object, 'generateDocument'))
|
if ((! $file || ! is_readable($file)) && method_exists($object, 'generateDocument'))
|
||||||
{
|
{
|
||||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0) {
|
if ($result < 0) {
|
||||||
dol_print_error($db, $object->error, $object->errors);
|
dol_print_error($db, $object->error, $object->errors);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
if ($object->element == 'invoice_supplier')
|
||||||
|
{
|
||||||
|
$fileparams = dol_most_recent_file($diroutput . '/' . get_exdir($object->id,2,0,0,$object,$object->element).$ref, preg_quote($ref,'/').'([^\-])+');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fileparams = dol_most_recent_file($diroutput . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
||||||
|
}
|
||||||
|
|
||||||
$file = $fileparams['fullname'];
|
$file = $fileparams['fullname'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user