From f740a039f77bd41922a1b4089346093ffd84ec51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Mar 2023 12:34:01 +0100 Subject: [PATCH] Debug v17 --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 1 + htdocs/partnership/class/partnership.class.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 9d0a5a776d6..4ec2e7228b2 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -64,6 +64,7 @@ ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_percent (percent); UPDATE llx_c_paiement SET code = 'BANCON' WHERE code = 'BAN' AND libelle = 'Bancontact'; +ALTER TABLE llx_partnership DROP FOREIGN KEY llx_partnership_fk_user_creat; -- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN fk_user_creat integer NULL; -- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN fk_user_creat DROP NOT NULL; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 013323f3193..130d24eb032 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -550,10 +550,15 @@ class Partnership extends CommonObject */ public function update(User $user, $notrigger = false) { + global $user; + if ($this->fk_soc <= 0 && $this->fk_member <= 0) { $this->error[] = "ErrorThirpdartyOrMemberidIsMandatory"; return -1; } + if (empty($this->fk_user_creat)) { // Fot the case the object was created with empty user. + $this->fk_user_creat = $user->id; + } return $this->updateCommon($user, $notrigger); }