From b6724f60616413527aaf274c369c3aea3f898ac7 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 7 Jun 2022 16:43:49 +0200 Subject: [PATCH 1/3] FIX #20696 --- htdocs/accountancy/bookkeeping/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f9ec739e63d..0eaeed73d9e 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -533,23 +533,23 @@ if ($action == 'create') { print ''; print ''.$langs->trans("DateCreation").''; print ''; - print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; + print $object->date_creation ? dol_print_date($db->jdate($object->date_creation), 'day') : ' '; print ''; print ''; - // Date document creation + // Date document export print ''; print ''.$langs->trans("DateExport").''; print ''; - print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; + print $object->date_export ? dol_print_date($db->jdate($object->date_export), 'dayhour') : ' '; print ''; print ''; - // Date document creation + // Date document validation print ''; print ''.$langs->trans("DateValidation").''; print ''; - print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + print $object->date_validation ? dol_print_date($db->jdate($object->date_validation), 'dayhour') : ' '; print ''; print ''; From f0a8765ee6d62fe94d0e2830561174b5726c2a83 Mon Sep 17 00:00:00 2001 From: Faustin Date: Wed, 8 Jun 2022 16:05:44 +0200 Subject: [PATCH 2/3] FIX #20696 --- htdocs/accountancy/bookkeeping/card.php | 6 +++--- htdocs/accountancy/class/bookkeeping.class.php | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 0eaeed73d9e..148608116e7 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -533,7 +533,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans("DateCreation").''; print ''; - print $object->date_creation ? dol_print_date($db->jdate($object->date_creation), 'day') : ' '; + print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; print ''; print ''; @@ -541,7 +541,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans("DateExport").''; print ''; - print $object->date_export ? dol_print_date($db->jdate($object->date_export), 'dayhour') : ' '; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; print ''; print ''; @@ -549,7 +549,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans("DateValidation").''; print ''; - print $object->date_validation ? dol_print_date($db->jdate($object->date_validation), 'dayhour') : ' '; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; print ''; print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5f3def1d3ee..5d2a9d63f9a 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1649,11 +1649,10 @@ class BookKeeping extends CommonObject $this->doc_date = $this->db->jdate($obj->doc_date); $this->doc_ref = $obj->doc_ref; $this->doc_type = $obj->doc_type; - $this->date_creation = $obj->date_creation; - $this->date_modification = $obj->date_modification; - $this->date_export = $obj->date_export; - $this->date_validation = $obj->date_validated; - $this->date_validation = $obj->date_validation; + $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_modification = $this->db->jdate($obj->date_modification); + $this->date_export = $this->db->jdate($obj->date_export); + $this->date_validation = $this->db->jdate($obj->date_validation); } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(__METHOD__.$this->error, LOG_ERR); From a4ca81d4ceb2e4c1ea3360ae8e327f84eb9a597c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Jun 2022 12:46:13 +0200 Subject: [PATCH 3/3] FIX #21174 --- htdocs/accountancy/bookkeeping/card.php | 12 +++++++++--- htdocs/accountancy/class/bookkeeping.class.php | 4 ++++ htdocs/core/lib/functions.lib.php | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index b05fe8588bc..ad30e232334 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -604,6 +604,7 @@ if ($action == 'create') { print '
'; $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { @@ -643,9 +644,14 @@ if ($action == 'create') { print "\n"; - // Add an empty line - $line = new BookKeepingLine(); - $object->linesmvt[] = $line; + // Add an empty line if there is not yet + if (!empty($object->linesmvt[0])) { + $tmpline = $object->linesmvt[0]; + if (!empty($tmpline->numero_compte)) { + $line = new BookKeepingLine(); + $object->linesmvt[] = $line; + } + } foreach ($object->linesmvt as $line) { print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 5f3def1d3ee..32bc27565fc 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -597,9 +597,13 @@ class BookKeeping extends CommonObject if (empty($this->credit)) { $this->credit = 0; } + if (empty($this->montant)) { + $this->montant = 0; + } $this->debit = price2num($this->debit, 'MT'); $this->credit = price2num($this->credit, 'MT'); + $this->montant = price2num($this->montant, 'MT'); $now = dol_now(); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 19fa4cd5c63..2f9cb532708 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -290,7 +290,7 @@ function dol_shutdown() $depth = $db->transaction_opened; $disconnectdone = $db->close(); } - dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ?LOG_WARNING:LOG_INFO)); + dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO)); } /**