diff --git a/ChangeLog b/ChangeLog index bf9ac07542f..965f70d316f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -47,6 +47,7 @@ For users: - New: [ task #918 ] Stock replenishment - Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count - New : Add pdf link into supplier invoice list and supplier order list +- New : Genrate auto the PDF for supplier invoice For translators: diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index aaf36409b81..ebcb324f557 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -28,6 +28,10 @@ * \brief Page for supplier invoice card (view, edit, validate) */ +error_reporting(E_ALL); +ini_set('display_errors', true); +ini_set('html_errors', false); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; @@ -456,6 +460,16 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) else { $db->commit(); + + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + } + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } @@ -608,7 +622,14 @@ elseif ($action == 'addline') $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + } unset($_POST['qty']); unset($_POST['type']); @@ -659,7 +680,14 @@ elseif ($action == 'edit' && $user->rights->fournisseur->facture->creer) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + } $action=''; }