From 0a8c7f76392b99607a404fcd0c55919cb9b15ddd Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 9 Aug 2013 13:59:37 +0200 Subject: [PATCH] Generate auto supplier invoice --- ChangeLog | 1 + htdocs/fourn/facture/fiche.php | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) 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=''; }