Exemplo n.º 1
0
        {
            $outputlangs = new Translate("",$conf);
            $outputlangs->setDefaultLang($_REQUEST['lang_id']);
        }
        //supplier_invoice_pdf_create($db, $fac->id, $fac->modelpdf, $outputlangs);
    }
}

if ($_GET['action'] == 'reopen' && $user->rights->fournisseur->facture->creer)
{
    $fac = new FactureFournisseur($db);
    $result = $fac->fetch($_GET['facid']);
    if ($fac->statut == 2
    || ($fac->statut == 3 && $fac->close_code != 'replaced'))
    {
        $result = $fac->set_unpaid($user);
        if ($result > 0)
        {
            Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$_GET['facid']);
            exit;
        }
        else
        {
            $mesg='<div class="error">'.$fac->error.'</div>';
        }
    }
}


/*********************************************************************
 *
Exemplo n.º 2
0
    //$ventilExportCompta = $object->getVentilExportCompta();
    // On verifie si aucun paiement n'a ete effectue
    if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) {
        $object->set_draft($user);
        $outputlangs = $langs;
        if (!empty($_REQUEST['lang_id'])) {
            $outputlangs = new Translate("", $conf);
            $outputlangs->setDefaultLang($_REQUEST['lang_id']);
        }
        //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
        $action = '';
    }
} elseif ($action == 'reopen' && $user->rights->fournisseur->facture->creer) {
    $result = $object->fetch($id);
    if ($object->statut == 2 || $object->statut == 3 && $object->close_code != 'replaced') {
        $result = $object->set_unpaid($user);
        if ($result > 0) {
            header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
            exit;
        } else {
            $mesg = '<div class="error">' . $object->error . '</div>';
        }
    }
}
// Add file in email form
if (GETPOST('addfile')) {
    require_once DOL_DOCUMENT_ROOT . '/core/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';
    dol_add_file_process($upload_dir_tmp, 0, 0);