From 7eff311963192a7e1675dbcfb290f0ae41b7fe6d Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 21 Dec 2006 14:52:14 +0000 Subject: [PATCH] Gestion suppression et validation --- htdocs/compta/paiement/cheque/fiche.php | 52 +++++++++++++++++-------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index 6b1322f8a3a..4a4d2645b8a 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -51,7 +51,7 @@ if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banq $result = $remise->Create($user, $_GET["accountid"]); if ($result === 0) { - Header("Location: index.php"); + Header("Location: fiche.php?id=".$remise->id); exit; } else @@ -67,7 +67,8 @@ if ($_GET['action'] == 'remove' && $_GET["id"] > 0 && $_GET["lineid"] > 0 && $us $result = $remise->RemoveCheck($_GET["lineid"]); if ($result === 0) { - + Header("Location: fiche.php?id=".$remise->id); + exit; } else { @@ -91,6 +92,21 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user- } } +if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->banque) +{ + $remise = new RemiseCheque($db); + $remise->id = $_GET["id"]; + $result = $remise->Validate($user); + if ($result == 0) + { + Header("Location: fiche.php?id=".$remise->id); + exit; + } + else + { + $mesg='
'.$paiement->error.'
'; + } +} /* * Visualisation de la fiche @@ -142,7 +158,7 @@ else if ($_GET['action'] == 'valide') { $facid = $_GET['facid']; - $html->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), 'Etes-vous sûr de vouloir valider ce règlement, auncune modification n\'est possible une fois le règlement validé ?', 'confirm_valide'); + $html->form_confirm('fiche.php?id='.$remise->id, $langs->trans("ValidateCheckReceipt"), 'Etes-vous sûr de vouloir valider ce bordereau, auncune modification n\'est possible une fois le bordereau validé ?', 'confirm_valide'); print '
'; } } @@ -158,6 +174,12 @@ if ($_GET['action'] == 'new') { $accounts = array(); $lines = array(); + + print ''; + print ''; + print '
'.$langs->trans('Date').''.dolibarr_print_date(time()).'

'; + + $sql = "SELECT ba.rowid as bid, ".$db->pdate("b.dateo")." as date,"; $sql.= " b.amount, ba.label, b.emetteur"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b "; @@ -231,7 +253,7 @@ else print '
'; - $sql = "SELECT p.rowid,".$db->pdate("p.datep")." as dp, p.amount,b.banque,b.emetteur,"; + $sql = "SELECT b.rowid,".$db->pdate("p.datep")." as dp, p.amount,b.banque,b.emetteur,"; $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.label"; @@ -250,7 +272,6 @@ else { $num = $db->num_rows($resql); $i = 0; - $total = 0; print ''; print ''; print_liste_field_titre($langs->trans("Date"),"liste.php","dp","",$paramlist,'align="center"',$sortfield); @@ -258,7 +279,7 @@ else print_liste_field_titre($langs->trans("Amount"),"liste.php","p.amount","",$paramlist,'align="right"',$sortfield); print_liste_field_titre($langs->trans("Bank"),"liste.php","p.amount","",$paramlist,'align="right"',$sortfield); print_liste_field_titre($langs->trans("CheckTransmitter"),"liste.php","p.amount","",$paramlist,'align="right"',$sortfield); - print "\n"; + print "\n"; $var=true; while ( $objp = $db->fetch_object($resql) ) @@ -272,20 +293,19 @@ else print ''; print ''; print ''; + if($remise->statut == 0) + { + print ''; + } + else + { + print ''; + } + print ''; - $total += $objp->amount; $i++; $var=!$var; } - - print ""; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "
 
'.price($objp->amount).''.stripslashes($objp->banque).''.stripslashes($objp->emetteur).''.img_delete().' 
 '.$langs->trans("Total").''.price($total).'  
"; } else