Enable auto update PDF on update note

Generate order/invoice PDF on update public note
This commit is contained in:
All3kcis 2018-06-27 15:32:22 +02:00 committed by GitHub
parent a2b570bac6
commit 4c10efb7d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2511,6 +2511,27 @@ abstract class CommonObject
$this->note = $note; // deprecated
$this->note_private = $note;
}
if($suffix != '_private' && in_array($this->table_element, array('commande_fournisseur', 'commande', 'propal', 'facture_fourn', 'facture' ))){
global $conf;
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$this->modelpdf;
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
$result=$this->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db,$result);
}
}
return 1;
}
else