瀏覽代碼

Fix unit test on accounting

Laurent Destailleur 6 年之前
父節點
當前提交
f7c11ec7f4

+ 2 - 2
.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

+ 4 - 4
htdocs/accountancy/class/accountingaccount.class.php

@@ -273,11 +273,11 @@ class AccountingAccount extends CommonObject
 		$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();

+ 2 - 0
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;