From f7c11ec7f4d54eb4c9fb33c51c5f777b1af1bb9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jan 2019 17:06:24 +0100 Subject: [PATCH] Fix unit test on accounting --- .travis.yml | 4 ++-- htdocs/accountancy/class/accountingaccount.class.php | 8 ++++---- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index de9b10d4fda73..91305ba80b269 100644 --- a/.travis.yml +++ b/.travis.yml @@ -312,8 +312,8 @@ script: - | echo "Upgrading Dolibarr" - # Ensure we catch errors - set +e + # Ensure we catch errors. Set this to +e if you want to go to the end to see log files. + set -e cd htdocs/install php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 85f9ee39c6176..9325e144d8934 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -273,11 +273,11 @@ function create($user, $notrigger = 0) $sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'"); $sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->db->escape($this->pcg_subtype) . "'"); $sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'"); - $sql .= ", " . (empty($this->account_parent) ? '0' : "'" . $this->db->escape($this->account_parent) . "'"); - $sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'"); - $sql .= ", " . (empty($this->account_category) ? 0 : $this->db->escape($this->account_category)); + $sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->db->escape($this->account_parent)); + $sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'"); + $sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->db->escape($this->account_category)); $sql .= ", " . $user->id; - $sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active)); + $sql .= ", " . (empty($this->active) ? 0 : (int) $this->active); $sql .= ")"; $this->db->begin(); diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index b2842a39548b5..0987317b75efa 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -255,3 +255,5 @@ CREATE TABLE llx_pos_cash_fence( import_key VARCHAR(14) ) ENGINE=innodb; +-- VMYSQL4.3 ALTER TABLE llx_accounting_account MODIFY COLUMN account_number varchar(32) NOT NULL; +-- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_number SET NOT NULL;