diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php
index 61e131ff47d..a275fc07ff4 100644
--- a/htdocs/accountancy/bookkeeping/card.php
+++ b/htdocs/accountancy/bookkeeping/card.php
@@ -647,11 +647,9 @@ 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 put 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
+ $line = new BookKeepingLine();
+ $object->linesmvt[] = $line;
foreach ($object->linesmvt as $line) {
print '
';
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 335cb8832db..83fe2b22282 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -942,8 +942,8 @@ class Societe extends CommonObject
$sql .= ", accountancy_code_sell";
}
$sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".((int) $this->entity).", '".$this->db->idate($now)."'";
- $sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null");
$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");
$sql .= ", ".((int) $this->status);
$sql .= ", ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null");