Exemplo n.º 1
0
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->loan->delete) {
    $db->begin();
    $result = $payment->delete($user);
    if ($result > 0) {
        $db->commit();
        header("Location: " . DOL_URL_ROOT . "/loan/index.php");
        exit;
    } else {
        setEventMessage($payment->error, 'errors');
        $db->rollback();
    }
}
// Create payment
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->loan->write) {
    $db->begin();
    $result = $payment->valide();
    if ($result > 0) {
        $db->commit();
        $factures = array();
        // TODO Get all id of invoices linked to this payment
        foreach ($factures as $id) {
            $fac = new Facture($db);
            $fac->fetch($id);
            $outputlangs = $langs;
            if (!empty($_REQUEST['lang_id'])) {
                $outputlangs = new Translate("", $conf);
                $outputlangs->setDefaultLang($_REQUEST['lang_id']);
            }
            if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
                $fac->generateDocument($fac->modelpdf, $outputlangs);
            }