$mesg = $shipping->error; } $mesg = '<div class="error">' . $mesg . '</div>'; $action = ""; } /* * Build doc */ if ($action == 'builddoc') { require_once DOL_DOCUMENT_ROOT . "/includes/modules/expedition/pdf/ModelePdfExpedition.class.php"; // Sauvegarde le dernier modele choisi pour generer un document $shipment = new Expedition($db); $shipment->fetch($id); $shipment->fetch_thirdparty(); if ($_REQUEST['model']) { $shipment->setDocModel($user, $_REQUEST['model']); } // Define output language $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $shipment->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = expedition_pdf_create($db, $shipment, $_REQUEST['model'], $outputlangs);
if ($shipping->update($user) >= 0) { Header("Location: fiche.php?id=" . $shipping->id); exit; } $mesg = $shipping->error; } $mesg = '<div class="error">' . $mesg . '</div>'; $action = ""; } else { if ($action == 'builddoc') { // Sauvegarde le dernier modele choisi pour generer un document $shipment = new Expedition($db); $shipment->fetch($id); $shipment->fetch_thirdparty(); if (GETPOST('model', 'alpha')) { $shipment->setDocModel($user, GETPOST('model', 'alpha')); } // Define output language $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) { $newlang = GETPOST('lang_id', 'alpha'); } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $shipment->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = expedition_pdf_create($db, $shipment, GETPOST('model', 'alpha'), $outputlangs);