From 150f4c45d8d7a6a57d802506473e34b3d9921b6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Sep 2022 15:02:34 +0200 Subject: [PATCH] FIX default value for partnership status --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/install/mysql/tables/llx_partnership-partnership.sql | 2 +- htdocs/partnership/class/partnership.class.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 04f1c6239be..a1906123f62 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9007,7 +9007,7 @@ abstract class CommonObject // Clean and check mandatory foreach ($keys as $key) { - // If field is an implicit foreign key field + // If field is an implicit foreign key field (so type = 'integer:...') if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') { $values[$key] = ''; } @@ -9027,7 +9027,7 @@ abstract class CommonObject $values[$key] = $this->quote($this->fields[$key]['default'], $this->fields[$key]); } - // If field is an implicit foreign key field + // If field is an implicit foreign key field (so type = 'integer:...') if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) { if (isset($this->fields[$key]['default'])) { $values[$key] = ((int) $this->fields[$key]['default']); diff --git a/htdocs/install/mysql/tables/llx_partnership-partnership.sql b/htdocs/install/mysql/tables/llx_partnership-partnership.sql index 8f83e2e82e5..0be59af5ebf 100644 --- a/htdocs/install/mysql/tables/llx_partnership-partnership.sql +++ b/htdocs/install/mysql/tables/llx_partnership-partnership.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_partnership( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, ref varchar(128) DEFAULT '(PROV)' NOT NULL, - status smallint NOT NULL DEFAULT '0', + status smallint DEFAULT 0 NOT NULL, fk_type integer DEFAULT 0 NOT NULL, fk_soc integer, fk_member integer, diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 85787075f28..e1f23ba7014 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -118,7 +118,7 @@ class Partnership extends CommonObject 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Terminated'),), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>2, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Terminated'),), 'url_to_check' => array('type'=>'varchar(255)', 'label'=>'UrlToCheck', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>-1), 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',), 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>-2,),