Exemplo n.º 1
0
$langs->load('bills');
$langs->load('banks');
$langs->load('companies');
$langs->load('loan');
// Security check
$id = GETPOST("id");
$action = GETPOST("action");
$confirm = GETPOST('confirm');
if ($user->societe_id) {
    $socid = $user->societe_id;
}
// TODO ajouter regle pour restreindre acces paiement
//$result = restrictedArea($user, 'facture', $id,'');
$payment = new PaymentLoan($db);
if ($id > 0) {
    $result = $payment->fetch($id);
    if (!$result) {
        dol_print_error($db, 'Failed to get payment id ' . $id);
    }
}
/*
 * Actions
 */
// Delete payment
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;