diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index f9ec739e63d..efa9fc03c78 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -537,7 +537,7 @@ if ($action == 'create') {
print '';
print '';
- // Date document creation
+ // Date document export
print '
';
print '| '.$langs->trans("DateExport").' | ';
print '';
@@ -545,7 +545,7 @@ if ($action == 'create') {
print ' | ';
print '
';
- // Date document creation
+ // Date document validation
print '';
print '| '.$langs->trans("DateValidation").' | ';
print '';
@@ -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,11 +644,14 @@ if ($action == 'create') {
print " |
\n";
- // Empty line is the first line of $object->linesmvt
- // So we must get the first line (the empty one) and pu it at the end of the array
- // in order to display it correctly to the user
- $empty_line = array_shift($object->linesmvt);
- $object->linesmvt[]= $empty_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..c6dd938ed78 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();
@@ -1649,11 +1653,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);
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));
}
/**
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 3d1637019e9..7c5773363c4 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -890,7 +890,7 @@ class Societe extends CommonObject
$sql .= ", accountancy_code_buy";
$sql .= ", accountancy_code_sell";
}
- $sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".$this->db->escape($this->entity).", '".$this->db->idate($now)."'";
+ $sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".((int) $this->entity).", '".$this->db->idate($now)."'";
$sql .= ", ".(!empty($user->id) ? ((int) $user->id) : "null");
$sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null");
$sql .= ", ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null");