$result = $paiement->delete($user); if ($result > 0) { $db->commit(); Header("Location: " . DOL_URL_ROOT . "/compta/charges/index.php?mode=sconly"); exit; } else { $mesg = '<div class="error">' . $paiement->error . '</div>'; $db->rollback(); } } // Create payment if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->tax->charges->creer) { $db->begin(); $paiement = new PaymentSocialContribution($db); $paiement->id = $_REQUEST['id']; if ($paiement->valide() > 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)) { facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager); } }
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->charges->supprimer) { $db->begin(); $result = $paiement->delete($user); if ($result > 0) { $db->commit(); header("Location: " . DOL_URL_ROOT . "/compta/charges/index.php?mode=sconly"); exit; } else { setEventMessage($paiement->error, 'errors'); $db->rollback(); } } // Create payment if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->charges->creer) { $db->begin(); $result = $paiement->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)) { facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs); }