Exemple #1
0
    $object = new Fichinter($db);
    $object->fetch($id);
    $object->fetch_thirdparty();
    $object->line_down($_GET['rowid']);

    // 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);
    }
    fichinter_create($db, $object, $object->modelpdf, $outputlangs);
    Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'#'.$_GET['rowid']);
    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';
Exemple #2
0
 $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);
     $outputlangs->load('interventions');
 }
 // Build document if it not exists
 if (!$file || !is_readable($file)) {
     $result = fichinter_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->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/') . '[^\\-]+');
     $file = $fileparams['fullname'];
 }
 print '<div class="clearboth"></div>';
 print '<br>';
 print load_fiche_titre($langs->trans('SendInterventionByMail'));
 dol_fiche_head('');
 // Create form object
 include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
 $formmail = new FormMail($db);
 $formmail->param['langsmodels'] = empty($newlang) ? $langs->defaultlang : $newlang;
Exemple #3
0
    /**
     * testFichinterBuild
     *
     * @return int
     */
    public function testFichinterBuild()
    {
        global $conf,$user,$langs,$db;
        $conf=$this->savconf;
        $user=$this->savuser;
        $langs=$this->savlangs;
        $db=$this->savdb;

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

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

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

        return 0;
    }