Пример #1
0
    Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#' . $_GET['rowid']));
    exit;
}
if ($action == 'builddoc') {
    // Build document
    // Sauvegarde le dernier module	choisi pour	generer	un document
    $object->fetch($_REQUEST['id']);
    if ($_REQUEST['model']) {
        $object->setDocModel($user, $_REQUEST['model']);
    }
    $outputlangs = $langs;
    if (!empty($_REQUEST['lang_id'])) {
        $outputlangs = new Translate("", $conf);
        $outputlangs->setDefaultLang($_REQUEST['lang_id']);
    }
    $result = supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
    if ($result <= 0) {
        dol_print_error($db, $result);
        exit;
    } else {
        Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
        exit;
    }
}
// Delete file in doc form
if ($action == 'remove_file') {
    require_once DOL_DOCUMENT_ROOT . "/lib/files.lib.php";
    if ($object->fetch($id)) {
        $upload_dir = $conf->fournisseur->commande->dir_output . "/";
        $file = $upload_dir . '/' . $_GET['file'];
        dol_delete_file($file);
Пример #2
0
 // Build document if it not exists
 if (!$file || !is_readable($file)) {
     // 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 = $object->client->default_lang;
     }
     if (!empty($newlang)) {
         $outputlangs = new Translate("", $conf);
         $outputlangs->setDefaultLang($newlang);
     }
     $result = supplier_order_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
     if ($result <= 0) {
         dol_print_error($db, $result);
         exit;
     }
     $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/'));
     $file = $fileparams['fullname'];
 }
 print '<br>';
 print_titre($langs->trans('SendOrderByMail'));
 // Cree l'objet formulaire mail
 include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
 $formmail = new FormMail($db);
 $formmail->fromtype = 'user';
 $formmail->fromid = $user->id;
 $formmail->fromname = $user->getFullName($langs);
Пример #3
0
    /**
     * testCommandeFournisseurBuild
      *
    * @return int
    */
    public function testCommandeFournisseurBuild()
    {
        global $conf,$user,$langs,$db;
        $conf=$this->savconf;
        $user=$this->savuser;
        $langs=$this->savlangs;
        $db=$this->savdb;

        $conf->fournisseur->commande->dir_output.='/temp';
        $localobject=new CommandeFournisseur($this->savdb);
        $localobject->initAsSpecimen();

        // Muscadet
        $localobject->modelpdf='muscadet';
        $result=supplier_order_pdf_create($db, $localobject, $localobject->modelpdf, $langs);

        $this->assertLessThan($result, 0);
        print __METHOD__." result=".$result."\n";

        return 0;
        }