コード例 #1
0
ファイル: fiche.php プロジェクト: netors/dolibarr
        $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 ($result <= 0) {
        dol_print_error($db, $result);
        exit;
    }
}
/*
 * Add file in email form
 */
if ($_POST['addfile']) {
    require_once DOL_DOCUMENT_ROOT . "/lib/files.lib.php";
    // Set tmp user directory TODO Use a dedicated directory for temp mails files
    $vardir = $conf->user->dir_output . "/" . $user->id;
    $upload_dir_tmp = $vardir . '/temp';
    $mesg = dol_add_file_process($upload_dir_tmp, 0, 0);
    $action = 'presend';
コード例 #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 = expedition_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->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/'));
     $file = $fileparams['fullname'];
 }
 print '<br>';
 print_titre($langs->trans('SendShippingByEMail'));
 // 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
ファイル: BuildDocTest.php プロジェクト: nrjacker4/crm-php
    /**
     * testExpeditionBuild
     *
     * @return int
     */
    public function testExpeditionBuild()
    {
        global $conf,$user,$langs,$db;
        $conf=$this->savconf;
        $user=$this->savuser;
        $langs=$this->savlangs;
        $db=$this->savdb;

        $conf->expedition->dir_output.='/temp';
        $localobject=new Expedition($this->savdb);
        $localobject->initAsSpecimen();

        // Soleil
        $localobject->modelpdf='merou';
        $result=expedition_pdf_create($db, $localobject, $localobject->modelpdf, $langs);

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

        // Soleil
        $localobject->modelpdf='rouget';
        $result=expedition_pdf_create($db, $localobject, $localobject->modelpdf, $langs);

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

        return 0;
    }
 function shipment_generate_pdf(&$shipment, $hidedetails, $hidedesc, $hideref)
 {
     global $conf, $langs;
     $db =& $this->db;
     // Il faut recharger les lignes qui viennent juste d'être créées
     $shipment->fetch($shipment->id);
     /*echo '<pre>';
     		print_r($shipment);
     		exit;*/
     $outputlangs = $langs;
     if ($conf->global->MAIN_MULTILANGS) {
         $newlang = $shipment->client->default_lang;
     }
     if (!empty($newlang)) {
         $outputlangs = new Translate("", $conf);
         $outputlangs->setDefaultLang($newlang);
     }
     $result = expedition_pdf_create($db, $shipment, $shipment->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
     if ($result > 0) {
         $objectref = dol_sanitizeFileName($shipment->ref);
         $dir = $conf->expedition->dir_output . "/sending/" . $objectref;
         $file = $dir . "/" . $objectref . ".pdf";
         return $file;
     }
     return '';
 }