diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 8502801d295..37aceb7cbf6 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -22,6 +22,14 @@ * $Source$ * */ + +/*! + \file htdocs/compta/bank/ligne.php + \ingroup compta + \brief Page édition d'une écriture bancaire + \version $Revision$ +*/ + require("./pre.inc.php"); if (!$user->rights->banque->modifier) @@ -46,30 +54,32 @@ if ($_GET["action"] == 'dvprev') -if ($_POST["action"] == 'confirm_delete_categ' && $_POST["confirm"] == yes) +if ($_POST["action"] == 'confirm_delete_categ' && $_POST["confirm"] == "yes") { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = $rowid AND fk_categ = $cat1"; - $db->query($sql); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = $rowid AND fk_categ = ".$_GET["cat1"]; + if (! $db->query($sql)) + { + dolibarr_print_error($db); + } } if ($_POST["action"] == 'class') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = $rowid AND fk_categ = $cat1"; - $db->query($sql); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)"; - if ($db->query($sql)) + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = $rowid AND fk_categ = ".$_POST["cat1"]; + if (! $db->query($sql)) { - + dolibarr_print_error($db); } - else + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$_GET["rowid"].", ".$_POST["cat1"].")"; + if (! $db->query($sql)) { - print $db->error(); + dolibarr_print_error($db); } } -if ($_POST["action"] == 'UPDATE') +if ($_POST["action"] == $langs->trans("Update")) { // Avant de modifier la date ou le montant, on controle si ce n'est pas encore rapproche if (!empty($_POST['amount'])) @@ -112,7 +122,7 @@ if ($result) $var=True; $num = $db->num_rows(); $i = 0; - $options = ""; + $options = ""; while ($i < $num) { $obj = $db->fetch_object($result); @@ -122,22 +132,26 @@ if ($result) $db->free(); } -if ($_POST["action"] == 'delete_categ') -{ - $html = new Form($db); - $html->form_confirm("ligne.php?rowid=$rowid&cat1=$fk_categ","Supprimer dans la catégorie","Etes-vous sûr de vouloir supprimer le classement dans la catégorie ?","confirm_delete_categ"); -} print_titre("Edition de la ligne"); -print ''; -print ""; -print ''; -print ""; -print ""; + + +if ($_GET["action"] == 'delete_categ') +{ + $html = new Form($db); + $html->form_confirm("ligne.php?rowid=".$_GET["rowid"]."&cat1=".$_GET["fk_categ"],"Supprimer dans la catégorie","Etes-vous sûr de vouloir supprimer le classement dans la catégorie ?","confirm_delete_categ"); +} + +$var=False; + +print '
Date'.$langs->trans("Description").'DebitCredit
'; +print ""; +print ''; +print ""; +print ""; print ""; print ""; - -print "\n"; +print "\n"; $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.author, b.num_chq, b.fk_type, fk_account"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b WHERE rowid=$rowid"; @@ -145,10 +159,8 @@ $sql .= " ORDER BY dateo ASC"; $result = $db->query($sql); if ($result) { - $var=True; - $num = $db->num_rows(); $i = 0; $total = 0; - while ($i < $num) + if ($db->num_rows()) { $objp = $db->fetch_object($result); $total = $total + $objp->amount; @@ -157,11 +169,7 @@ if ($result) $acct->fetch($objp->fk_account); $account = $acct->id; - $var=!$var; print ""; - print ""; - print ""; - print "\n"; print ""; if ($objp->amount < 0) @@ -170,7 +178,7 @@ if ($result) } else { - print "\n"; + print "\n"; } print ""; @@ -178,7 +186,7 @@ if ($result) print ""; print ""; - print '\n"; + print '\n"; print ''; + print ""; + print ""; - print "'; - print ""; - - print ""; - - print ""; - print "rowid\">"; - print ""; + print "trans("Update")."\">"; - print ""; + print "trans("Update")."\">"; print ""; if (!$objp->rappro) { - print ""; + print "trans("Update")."\">"; print ""; - print ""; + print "trans("Update")."\">"; print ""; } print ""; @@ -240,9 +239,21 @@ if ($result) print ''; print ""; + print "trans("Update")."\">"; print ""; + print ""; + + // Categorie + print ""; + print ""; + + print "'; + print ""; + print ""; $i++; @@ -251,9 +262,9 @@ if ($result) } print "
'.$langs->trans("Date").''.$langs->trans("Description").'".$langs->trans("Debit")."".$langs->trans("Credit")."Releve".$langs->trans("Author")."
".strftime("%d %b %Y",$objp->do)."$objp->label ".price($objp->amount)." ".price($objp->amount)."num_releve&ve=1&account=$account\">$objp->num_releve
Date de valeur : '.strftime("%d %b %Y",$objp->dv)."'.$langs->trans("DateValue").''.strftime("%d %b %Y",$objp->dv)."'; print img_previous() . " "; @@ -187,6 +195,8 @@ if ($result) print '
".$langs->trans("Account")."".$acct->label."
 "; print "rowid\">"; @@ -199,39 +209,28 @@ if ($result) print ''; print ""; print $objp->num_chq?" - $objp->num_chq":''; - print ""; + print "trans("Update")."\">"; print ""; print "
Catégorie"; - print " "; - print '
Compte".$acct->label."
Libellé"; + print "
".$langs->trans("Label").""; print ''; - print "
Date"; + print "
".$langs->trans("Date").""; print 'do).'">'; - print "
Montant"; + print "
".$langs->trans("Amount").""; print ''; - print "
Relevé"; print ''; - print "
".$langs->trans("Category").""; + print " "; + print '
"; -print "

Classé dans

"; +print "
Classé dans:
"; -print ''; +print '
'; print ""; print ''; print "\n"; @@ -276,7 +287,7 @@ if ($result) print ""; print ""; - print ""; + print ""; print ""; $i++;
'.$langs->trans("Description").'
$objp->labelrowid\">voirrowid\">Supprimerrowid\">".img_delete($langs->trans("Remove"))."