Merge pull request #11326 from atm-greg/FIX_massaction_presend

Fix massaction presend
This commit is contained in:
Laurent Destailleur 2019-06-12 12:37:03 +02:00 committed by GitHub
commit 4f5f03b893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -257,9 +257,20 @@ if (! $error && $massaction == 'confirm_presend')
{
// TODO Use future field $objectobj->fullpathdoc to know where is stored default file
// TODO If not defined, use $objectobj->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
$filename=dol_sanitizeFileName($objectobj->ref).'.pdf';
$filedir=$uploaddir . '/' . dol_sanitizeFileName($objectobj->ref);
$filename = dol_sanitizeFileName($objectobj->ref).'.pdf';
$subdir = '';
// TODO Set subdir to be compatible with multi levels dir trees
// $subdir = get_exdir($objectobj->id, 2, 0, 0, $objectobj, $objectobj->element)
$filedir = $uploaddir . '/' . $subdir . dol_sanitizeFileName($objectobj->ref);
$file = $filedir . '/' . $filename;
// For supplier invoices, we use the file provided by supplier, not the one we generate
if ($objectobj->element == 'invoice_supplier')
{
$fileparams = dol_most_recent_file($uploaddir . '/' . get_exdir($objectobj->id,2,0,0,$objectobj,$objectobj->element).$objectobj->ref, preg_quote($objectobj->ref,'/').'([^\-])+');
$file = $fileparams['fullname'];
}
$mime = dol_mimetype($file);
if (dol_is_file($file))

View File

@ -359,6 +359,7 @@ class FormMail extends Form
if ($this->param['models'] != 'none')
{
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
if ($result < 0)
{
setEventMessages($this->error, $this->errors, 'errors');

View File

@ -496,7 +496,7 @@ if ($resql)
print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
$topicmail="SendBillRef";
$modelmail="supplier_invoice_send";
$modelmail="invoice_supplier_send";
$objecttmp=new FactureFournisseur($db);
$trackid='sinv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';