diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 9157bcf74e5..eb5533fb46e 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -34,9 +34,25 @@ if ($action == 'class') if ($action == 'update') { $author = $GLOBALS["REMOTE_USER"]; - - $sql = "update llx_bank set label='$label' where rowid = $rowid;"; - $result = $db->query($sql); + //avant de modifier la date ou le montant, on controle si ce n'est pas encore rapproche +//print_r ($_POST); + if (!empty($_POST['amount'])) + { + $sql = "SELECT b.rappro FROM llx_bank as b WHERE rowid=$rowid"; + $result = $db->query($sql); + if ($result) + { + $var=True; + $num = $db->num_rows(); + $objp = $db->fetch_object( 0); + if ($objp->rappro) + die ("Vous ne pouvez pas modifier une écriture déjà rapprochée"); + $sql = "update llx_bank set label='$label' , dateo = '$date', amount='$amount' where rowid = $rowid;"; + } + } + else + $sql = "update llx_bank set label='$label' where rowid = $rowid;"; +$result = $db->query($sql); } if ($action == 'type') @@ -94,6 +110,7 @@ if ($result) print ""; print "rowid\">"; + print "