diff --git a/.travis.yml b/.travis.yml index df6e24a7e02..095a3c1e010 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,16 +44,20 @@ jobs: #allow_failures: #- php: nightly include: - - if: type = push + - stage: PHP 5.6 + if: type = push php: '5.6' env: DB=postgresql - - if: type = pull_request OR type = push + - stage: PHP 7.4 + if: type = pull_request OR type = push php: '7.4' env: DB=mysql - - if: type = push AND branch = develop + - stage: PHP Dev + if: type = push AND branch = develop php: nightly env: DB=mysql - - if: type = push AND branch = 14.0 + - stage: PHP Dev + if: type = push AND branch = 14.0 php: nightly env: DB=mysql @@ -412,7 +416,6 @@ script: - | echo "Enabling new modules" # Enable modules not enabled into original dump - cd htdocs/install php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_PRODUCTBATCH,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_STRIPE > $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKET,MAIN_MODULE_ACCOUNTING,MAIN_MODULE_MRP >> $TRAVIS_BUILD_DIR/enablemodule.log php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ce7efebba33..6804a0ec13b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1095,7 +1095,7 @@ abstract class CommonObject $this->db->rollback(); return -2; } else { - $this->error = $this->db->error(); + $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } @@ -1119,7 +1119,6 @@ abstract class CommonObject $contacts = $objFrom->liste_contact(-1, $source); foreach ($contacts as $contact) { if ($this->add_contact($contact['id'], $contact['fk_c_type_contact'], $contact['source']) < 0) { - $this->error = $this->db->lasterror(); return -1; } } @@ -5760,8 +5759,10 @@ abstract class CommonObject $table_element = 'categories'; // For compatibility } - $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id; dol_syslog(get_class($this)."::deleteExtraFields delete", LOG_DEBUG); + + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id; + $resql = $this->db->query($sql_del); if (!$resql) { $this->error = $this->db->lasterror(); @@ -8467,7 +8468,7 @@ abstract class CommonObject $result = $line->create($user, 1); if ($result < 0) { - $this->error = $this->db->lasterror(); + $this->error = $line->error; $this->db->rollback(); return -1; } @@ -8498,8 +8499,8 @@ abstract class CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $ref Ref + * @param int $id Id object + * @param string $ref Ref * @param string $morewhere More SQL filters (' AND ...') * @return int <0 if KO, 0 if not found, >0 if OK */ @@ -8808,8 +8809,8 @@ abstract class CommonObject if (!$error) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.((int) $this->id); - $res = $this->db->query($sql); - if ($res === false) { + $resql = $this->db->query($sql); + if (!$resql) { $error++; $this->errors[] = $this->db->lasterror(); } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 83d00ba8a2a..7db45911c1e 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -757,6 +757,7 @@ class DoliDBPgsql extends DoliDB $errorlabel = pg_last_error($this->db); $errorcode = ''; + $reg = array(); if (preg_match('/: *([0-9P]+):/', $errorlabel, $reg)) { $errorcode = $reg[1]; if (isset($errorcode_map[$errorcode])) {