From fe99114fc10dcc2a478ab2a46549f3f2585ea8b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Dec 2023 19:42:23 +0100 Subject: [PATCH] Debug v19 --- htdocs/compta/bank/line.php | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index cda42de38d3..449866b5e74 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -258,25 +258,38 @@ if ($user->hasRight('banque', 'consolidate') && ($action == 'num_releve' || $act } $sql .= " WHERE rowid = ".((int) $rowid); - dol_syslog("line.php", LOG_DEBUG); + $updatePathFile = true; + $update_dir = true; + + dol_syslog("line.php update bank line to set the new bank receipt nuber", LOG_DEBUG); + $result = $db->query($sql); + + // We must not rename the directory of the bank receipt when we change 1 line of bank receipt. Other lines may share the same old ref. + // Renaming can be done when we rename globaly a bank receipt but not when changing 1 line from one receipt into another one. + /* if ($result) { - $oldfilepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$oldNum_rel); - $filepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$num_rel); + if ($oldNum_rel) { + if ($num_rel) { + $oldfilepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$oldNum_rel); + $filepath = dol_sanitizePathName("bank/".((int) $id)."/statement/".$num_rel); - $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_files"; - $sql .= " SET filepath = '".$db->escape($filepath)."'"; - $sql .= " WHERE filepath = '".$db->escape($oldfilepath)."'"; - $updatePathFile = $db->query($sql); + $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_files"; + $sql .= " SET filepath = '".$db->escape($filepath)."'"; + $sql .= " WHERE filepath = '".$db->escape($oldfilepath)."'"; + $updatePathFile = $db->query($sql); - $srcdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$oldNum_rel); - $destdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$num_rel); + $srcdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$oldNum_rel); + $destdir = dol_sanitizePathName(DOL_DATA_ROOT."/bank/".((int) $id)."/statement/".$num_rel); - $update_dir = true; - if (dol_is_dir($srcdir)) { - $update_dir = dol_move_dir($srcdir, $destdir, 1); + if (dol_is_dir($srcdir)) { + $update_dir = dol_move_dir($srcdir, $destdir, 1); + } + } } } + */ + if ($result && $updatePathFile && $update_dir) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit();