diff --git a/ChangeLog b/ChangeLog index ecd5a6b7160..dd037efb3df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,7 @@ For users: saved clicks again). - When creating a contract, sales representative are preset to user. This save 2 clicks. + - Can edit several fields in bank transaction line page into one update. - New: Add graph using Jquery Flot. - New: Usage of Jquery Notify to show result or error messages on action. - New: If a service contains subproducts, subrpoducts are decrease when service @@ -58,6 +59,8 @@ For users: - New: Can filter on date when building cheque receipts. - New: Paypal module can show paypal list of transaction and convert one into an order. +- New: task #10958 : Add link to cheque receipts into bank transaction + line if exists - Fix: Better Postgresql compatibility. - Fix: Numbering module for invoices use same number for invoice and credit note if mask is same. diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 0afaa00a754..7f812bb2c1e 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -37,9 +37,12 @@ $langs->load("bills"); $langs->load("categories"); if ($conf->adherent->enabled) $langs->load("members"); -$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; -$ref=isset($_GET["ref"])?$_GET["ref"]:$_POST["ref"]; -$orig_account=isset($_GET["orig_account"])?$_GET["orig_account"]:$_POST["orig_account"]; +$action=GETPOST('action'); +$rowid=GETPOST("rowid"); +$ref=GETPOST("ref"); +$orig_account=GETPOST("orig_account"); +$accountid=GETPOST('accountid'); +$confirm=GETPOST('confirm'); $html = new Form($db); @@ -59,18 +62,18 @@ if ($user->rights->banque->consolidate && $_GET["action"] == 'dvprev') $ac->datev_previous($_GET["rowid"]); } -if ($_POST["action"] == 'confirm_delete_categ' && $_POST["confirm"] == "yes") +if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->banque->modifier) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = $rowid AND fk_categ = ".$_GET["cat1"]; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".GETPOST("cat1"); if (! $db->query($sql)) { dol_print_error($db); } } -if ($_POST["action"] == 'class') +if ($action == 'class') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = $rowid AND fk_categ = ".$_POST["cat1"]; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".$_POST["cat1"]; if (! $db->query($sql)) { dol_print_error($db); @@ -83,16 +86,16 @@ if ($_POST["action"] == 'class') } } -if ($_POST["action"] == "update") +if ($action == "update") { // Avant de modifier la date ou le montant, on controle si ce n'est pas encore rapproche + $conciliated=0; $sql = "SELECT b.rappro FROM ".MAIN_DB_PREFIX."bank as b WHERE rowid=".$rowid; $result = $db->query($sql); if ($result) { $objp = $db->fetch_object($result); - if ($objp->rappro) - die ("Conciliation of a line already conciliated is not possible"); + $conciliated=$objp->rappro; } $db->begin(); @@ -101,15 +104,27 @@ if ($_POST["action"] == "update") $dateop = dol_mktime(12,0,0,$_POST["dateomonth"],$_POST["dateoday"],$_POST["dateoyear"]); $dateval= dol_mktime(12,0,0,$_POST["datevmonth"],$_POST["datevday"],$_POST["datevyear"]); $sql = "UPDATE ".MAIN_DB_PREFIX."bank"; - $sql.= " SET label='".$db->escape($_POST["label"])."',"; - if (isset($_POST['amount'])) $sql.=" amount='$amount',"; - $sql.= " dateo = '".$db->idate($dateop)."', datev = '".$db->idate($dateval)."',"; - $sql.= " fk_account = ".$_POST['accountid']; + $sql.= " SET "; + // Always opened + if (isset($_POST['value'])) $sql.=" fk_type='".$db->escape($_POST['value'])."',"; + if (isset($_POST['num_chq'])) $sql.=" num_chq='".$db->escape($_POST["num_chq"])."',"; + if (isset($_POST['banque'])) $sql.=" banque='".$db->escape($_POST["banque"])."',"; + if (isset($_POST['emetteur'])) $sql.=" emetteur='".$db->escape($_POST["emetteur"])."',"; + // Blocked when conciliated + if (! $conciliated) + { + if (isset($_POST['label'])) $sql.=" label='".$db->escape($_POST["label"])."',"; + if (isset($_POST['amount'])) $sql.=" amount='".$amount."',"; + if (isset($_POST['dateomonth'])) $sql.=" dateo = '".$db->idate($dateop)."',"; + if (isset($_POST['datevmonth'])) $sql.=" datev = '".$db->idate($dateval)."',"; + } + $sql.= " fk_account = ".$accountid; $sql.= " WHERE rowid = ".$rowid; $result = $db->query($sql); if ($result) { + $mesg=$langs->trans("RecordSaved"); $db->commit(); } else @@ -119,26 +134,8 @@ if ($_POST["action"] == "update") } } -if ($_POST["action"] == 'type') -{ - $sql = "UPDATE ".MAIN_DB_PREFIX."bank set fk_type='".$_POST["value"]."', num_chq='".$_POST["num_chq"]."' WHERE rowid = $rowid;"; - $result = $db->query($sql); -} - -if ($_POST["action"] == 'banque') -{ - $sql = "UPDATE ".MAIN_DB_PREFIX."bank set banque='".$db->escape($_POST["banque"])."' WHERE rowid = $rowid;"; - $result = $db->query($sql); -} - -if ($_POST["action"] == 'emetteur') -{ - $sql = "UPDATE ".MAIN_DB_PREFIX."bank set emetteur='".$db->escape($_POST["emetteur"])."' WHERE rowid = $rowid;"; - $result = $db->query($sql); -} - // Reconcile -if ($user->rights->banque->consolidate && ($_POST["action"] == 'num_releve' || $_POST["action"] == 'setreconcile')) +if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == 'setreconcile')) { $num_rel=trim($_POST["num_rel"]); $rappro=$_POST['reconciled']?1:0; @@ -164,6 +161,7 @@ if ($user->rights->banque->consolidate && ($_POST["action"] == 'num_releve' || $ $result = $db->query($sql); if ($result) { + $mesg=$langs->trans("RecordSaved"); $db->commit(); } else @@ -217,11 +215,12 @@ $h++; dol_fiche_head($head, $hselected, $langs->trans('LineRecord'),0,'account'); -if ($mesg) print '
| $objp->label | "; - print "rowid\">".$langs->trans("ListBankTransactions")." | "; - print "rowid\">".img_delete($langs->trans("Remove"))." | "; + print "".$objp->label." | "; + print "rowid."\">".$langs->trans("ListBankTransactions")." | "; + if ($user->rights->banque->modifier) + { + print "rowid\">".img_delete($langs->trans("Remove"))." | "; + } print "