From da03f9a9515e59e8a7e68d9e1e4c0738934c0757 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 9 Jan 2012 17:52:22 +0800 Subject: [PATCH] =?UTF-8?q?[bug=20#274]=20Article=20reste=20apr=C3=A8s=20s?= =?UTF-8?q?uppression=20article?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/fourn/commande/fiche.php | 41 ++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 09935f1fe47..422742fd164 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -310,21 +310,36 @@ if ($action == 'updateligne' && $user->rights->fournisseur->commande->creer && $ } } -if ($action == 'confirm_deleteproductline' && $confirm == 'yes') +if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer) { - if ($user->rights->fournisseur->commande->creer) - { - $object->fetch($id); - $result = $object->deleteline($_GET['lineid']); + $object->fetch($id); - $outputlangs = $langs; - if (! empty($_REQUEST['lang_id'])) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); - } - supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref')); - } + $result = $object->deleteline(GETPOST('lineid')); + if ($result >= 0) + { + $outputlangs = $langs; + if (! empty($_REQUEST['lang_id'])) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($_REQUEST['lang_id']); + } + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + { + $ret=$object->fetch($id); // Reload to get new records + supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref')); + } + } + else + { + $error++; + $mesg=$object->error; + } + + if (! $error) + { + Header("Location: fiche.php?id=".$id); + exit; + } } if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fournisseur->commande->valider)