From 3e02dc2465533591ffa45a78fa0563de72a78566 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 26 Apr 2019 13:23:30 +0200 Subject: [PATCH 1/3] FIX : dolibarrize fk_soc ->socid for member --- htdocs/adherents/class/adherent.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 201b6610817..00534dd3879 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -86,6 +86,7 @@ class Adherent extends CommonObject * @var int Thirdparty ID */ public $fk_soc; + public $socid; /** * @var string Address @@ -1275,6 +1276,7 @@ class Adherent extends CommonObject $this->societe = $obj->company; $this->company = $obj->company; $this->fk_soc = $obj->fk_soc; + $this->socid = $obj->fk_soc; $this->address = $obj->address; $this->zip = $obj->zip; $this->town = $obj->town; From 9b9295ab50d544f91189c54cab21a8704ded4790 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 26 Apr 2019 14:25:58 +0200 Subject: [PATCH 2/3] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 00534dd3879..9c32417efb4 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2015-2018 Frédéric France * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2018-2019 Thibault FOUCART * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -86,7 +87,6 @@ class Adherent extends CommonObject * @var int Thirdparty ID */ public $fk_soc; - public $socid; /** * @var string Address @@ -558,7 +558,7 @@ class Adherent extends CommonObject $sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null"); $sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null"); - $sql.= ", fk_soc = ".($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null"); + $sql.= ", fk_soc = ".($this->socid > 0?$this->db->escape($this->socid):"null"); $sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null"); $sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null"); $sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null"); @@ -1276,7 +1276,6 @@ class Adherent extends CommonObject $this->societe = $obj->company; $this->company = $obj->company; $this->fk_soc = $obj->fk_soc; - $this->socid = $obj->fk_soc; $this->address = $obj->address; $this->zip = $obj->zip; $this->town = $obj->town; From 423c5c3ac8adadaddd39d4ed9297104591175a13 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 26 Apr 2019 14:26:50 +0200 Subject: [PATCH 3/3] Update card.php --- htdocs/adherents/card.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 9903255e52f..5d57208eb0e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -82,7 +82,7 @@ if (! empty($canvas)) } // Security check -$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid', $objcanvas); +$result=restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas); if ($id > 0) { @@ -163,10 +163,10 @@ if (empty($reshook)) $error=0; if (! $error) { - if ($socid != $object->fk_soc) // If link differs from currently in database + if ($socid != $object->socid) // If link differs from currently in database { $sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; - $sql.=" WHERE fk_soc = '".$socid."'"; + $sql.=" WHERE socid = '".$socid."'"; $sql.=" AND entity = ".$conf->entity; $resql = $db->query($sql); if ($resql) @@ -492,7 +492,7 @@ if (empty($reshook)) //$object->note = $comment; $object->morphy = $morphy; $object->user_id = $userid; - $object->fk_soc = $socid; + $object->socid = $socid; $object->public = $public; // Fill array 'array_options' with data from add form @@ -1333,10 +1333,10 @@ else if (! empty($conf->societe->enabled)) { print ''.$langs->trans("LinkedToDolibarrThirdParty").''; - if ($object->fk_soc) + if ($object->socid) { $company=new Societe($db); - $result=$company->fetch($object->fk_soc); + $result=$company->fetch($object->socid); print $company->getNomUrl(1); } else @@ -1421,7 +1421,7 @@ else $text=$langs->trans("ConfirmCreateLogin").'
'; if (! empty($conf->societe->enabled)) { - if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); + if ($object->socid > 0) $text.=$langs->trans("UserWillBeExternalUser"); else $text.=$langs->trans("UserWillBeInternalUser"); } print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes'); @@ -1688,17 +1688,17 @@ else print ''; print ''; print ''; print ''; print '
'; - print $form->select_company($object->fk_soc, 'socid', '', 1); + print $form->select_company($object->socid, 'socid', '', 1); print '
'; } else { - if ($object->fk_soc) + if ($object->socid) { $company=new Societe($db); - $result=$company->fetch($object->fk_soc); + $result=$company->fetch($object->socid); print $company->getNomUrl(1); } else @@ -1848,7 +1848,7 @@ else } // Create third party - if (! empty($conf->societe->enabled) && ! $object->fk_soc) + if (! empty($conf->societe->enabled) && ! $object->socid) { if ($user->rights->societe->creer) {