From 2d3b0a7d43b529913dce11579207d4b34c50a9f2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Sep 2019 20:05:13 +0200 Subject: [PATCH 1/7] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1b516e1c94e..28667cb047f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -581,6 +581,7 @@ class Adherent extends CommonObject $sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid); $sql.= ", morphy = '".$this->db->escape($this->morphy)."'"; $sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null"); + if ($this->socid) $sql.= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a thirdpart if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member $sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest From a83c0670811683075c684ff07d92dbeccb79475e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Sep 2019 20:08:32 +0200 Subject: [PATCH 2/7] Update card.php --- htdocs/adherents/card.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 5836bf48332..d443eb6e462 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -866,6 +866,18 @@ else $object->country_code=$tmparray['code']; $object->country=$tmparray['label']; } + + if (!empty($socid)) { +$object = new Societe($db); +if ($socid > 0) $object->fetch($socid); + +if (! ($object->id > 0)) +{ + $langs->load("errors"); + print($langs->trans('ErrorRecordNotFound')); + exit; +} + } $adht = new AdherentType($db); @@ -905,6 +917,7 @@ else print '
'; print ''; print ''; + print ''; if ($backtopage) print ''; dol_fiche_head(''); From 1368236d29c060e59235ef88b9c30f2ff7ac2ae5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Sep 2019 20:15:05 +0200 Subject: [PATCH 3/7] Update card.php --- htdocs/societe/card.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ab224245de8..2d26747df32 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2664,6 +2664,16 @@ else { print ''."\n"; } + + if (! empty($conf->adherent->enabled)) + { + $adh = new Adherent($db); + $result=$adh->fetch('','',$object->id); + if (!$result && $object->client == 1) + { + print ''.$langs->trans("NewMember").''; + } + } if ($user->rights->societe->supprimer) { From e37875f70a597e011514b233d5dcaded2a0851be Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 8 Sep 2019 20:16:05 +0200 Subject: [PATCH 4/7] Update card.php --- htdocs/societe/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 2d26747df32..ee6ca0288ef 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -47,7 +47,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -$langs->loadLangs(array("companies","commercial","bills","banks","users")); +$langs->loadLangs(array("companies", "commercial", "bills", "banks", "users")); +if (! empty($conf->adherent->enabled)) $langs->load("members"); if (! empty($conf->categorie->enabled)) $langs->load("categories"); if (! empty($conf->incoterm->enabled)) $langs->load("incoterm"); if (! empty($conf->notification->enabled)) $langs->load("mails"); From 2e63e7bc27ffcd53e9c3c89764244613451ed019 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 8 Sep 2019 18:17:51 +0000 Subject: [PATCH 5/7] Fixing style errors. --- htdocs/societe/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ee6ca0288ef..8c1db93c53b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2669,11 +2669,11 @@ else if (! empty($conf->adherent->enabled)) { $adh = new Adherent($db); - $result=$adh->fetch('','',$object->id); + $result=$adh->fetch('', '', $object->id); if (!$result && $object->client == 1) { print ''.$langs->trans("NewMember").''; - } + } } if ($user->rights->societe->supprimer) From da5890e584d10cc99f1b61394f534f862f9f12c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Oct 2019 20:32:51 +0200 Subject: [PATCH 6/7] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 28667cb047f..631ad61684c 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -581,7 +581,7 @@ class Adherent extends CommonObject $sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid); $sql.= ", morphy = '".$this->db->escape($this->morphy)."'"; $sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null"); - if ($this->socid) $sql.= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a thirdpart + if ($this->socid) $sql.= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a third-party if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member $sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest From eba3d96293a3820782655eff1ba0cbba5aede01a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Oct 2019 20:36:48 +0200 Subject: [PATCH 7/7] Update card.php NEW Add option MEMBER_CAN_CONVERT_CUSTOMERS_TO_MEMBERS --- htdocs/societe/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8c1db93c53b..5be134286e5 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2668,12 +2668,12 @@ else if (! empty($conf->adherent->enabled)) { - $adh = new Adherent($db); - $result=$adh->fetch('', '', $object->id); - if (!$result && $object->client == 1) - { - print ''.$langs->trans("NewMember").''; - } + $adh = new Adherent($db); + $result=$adh->fetch('', '', $object->id); + if ($result == 0 && ($object->client == 1 || $object->client == 3) && ! empty($conf->global->MEMBER_CAN_CONVERT_CUSTOMERS_TO_MEMBERS)) + { + print ''.$langs->trans("NewMember").''; + } } if ($user->rights->societe->supprimer)