This commit is contained in:
Laurent Destailleur 2021-06-22 17:09:02 +02:00
parent 618184f94a
commit bcffbe3d67
3 changed files with 18 additions and 13 deletions

View File

@ -44,16 +44,20 @@ jobs:
#allow_failures: #allow_failures:
#- php: nightly #- php: nightly
include: include:
- if: type = push - stage: PHP 5.6
if: type = push
php: '5.6' php: '5.6'
env: DB=postgresql env: DB=postgresql
- if: type = pull_request OR type = push - stage: PHP 7.4
if: type = pull_request OR type = push
php: '7.4' php: '7.4'
env: DB=mysql env: DB=mysql
- if: type = push AND branch = develop - stage: PHP Dev
if: type = push AND branch = develop
php: nightly php: nightly
env: DB=mysql env: DB=mysql
- if: type = push AND branch = 14.0 - stage: PHP Dev
if: type = push AND branch = 14.0
php: nightly php: nightly
env: DB=mysql env: DB=mysql
@ -412,7 +416,6 @@ script:
- | - |
echo "Enabling new modules" echo "Enabling new modules"
# Enable modules not enabled into original dump # 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_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_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 php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_RECEPTION,MAIN_MODULE_RECRUITMENT >> $TRAVIS_BUILD_DIR/enablemodule.log

View File

@ -1095,7 +1095,7 @@ abstract class CommonObject
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} else { } else {
$this->error = $this->db->error(); $this->error = $this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -1119,7 +1119,6 @@ abstract class CommonObject
$contacts = $objFrom->liste_contact(-1, $source); $contacts = $objFrom->liste_contact(-1, $source);
foreach ($contacts as $contact) { foreach ($contacts as $contact) {
if ($this->add_contact($contact['id'], $contact['fk_c_type_contact'], $contact['source']) < 0) { if ($this->add_contact($contact['id'], $contact['fk_c_type_contact'], $contact['source']) < 0) {
$this->error = $this->db->lasterror();
return -1; return -1;
} }
} }
@ -5760,8 +5759,10 @@ abstract class CommonObject
$table_element = 'categories'; // For compatibility $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); 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); $resql = $this->db->query($sql_del);
if (!$resql) { if (!$resql) {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
@ -8467,7 +8468,7 @@ abstract class CommonObject
$result = $line->create($user, 1); $result = $line->create($user, 1);
if ($result < 0) { if ($result < 0) {
$this->error = $this->db->lasterror(); $this->error = $line->error;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -8498,8 +8499,8 @@ abstract class CommonObject
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
* @param int $id Id object * @param int $id Id object
* @param string $ref Ref * @param string $ref Ref
* @param string $morewhere More SQL filters (' AND ...') * @param string $morewhere More SQL filters (' AND ...')
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
@ -8808,8 +8809,8 @@ abstract class CommonObject
if (!$error) { if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.((int) $this->id); $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.((int) $this->id);
$res = $this->db->query($sql); $resql = $this->db->query($sql);
if ($res === false) { if (!$resql) {
$error++; $error++;
$this->errors[] = $this->db->lasterror(); $this->errors[] = $this->db->lasterror();
} }

View File

@ -757,6 +757,7 @@ class DoliDBPgsql extends DoliDB
$errorlabel = pg_last_error($this->db); $errorlabel = pg_last_error($this->db);
$errorcode = ''; $errorcode = '';
$reg = array();
if (preg_match('/: *([0-9P]+):/', $errorlabel, $reg)) { if (preg_match('/: *([0-9P]+):/', $errorlabel, $reg)) {
$errorcode = $reg[1]; $errorcode = $reg[1];
if (isset($errorcode_map[$errorcode])) { if (isset($errorcode_map[$errorcode])) {