From ae2ddb1f1e30fd3aa14f47fe1c39352ce6fa8ad4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 14 Nov 2019 16:36:07 +0100 Subject: [PATCH 1/9] Fix adherent type v11 --- .../adherents/class/adherent_type.class.php | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 5d992b168d4..56410c6439a 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -507,6 +507,7 @@ class AdherentType extends CommonObject $this->label = $obj->label; $this->morphy = $obj->morphy; $this->statut = $obj->statut; + $this->status = $obj->statut; $this->duration = $obj->duration; $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1); $this->duration_unit = substr($obj->duration, -1); @@ -668,14 +669,42 @@ class AdherentType extends CommonObject return $result; } - /** - * getLibStatut - * - * @return string Return status of a type of member - */ - public function getLibStatut() - { - return ''; + /** + * Return label of status (activity, closed) + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status + */ + public function getLibStatut($mode = 0) + { + return $this->LibStatut($this->status, $mode); + } + + /** + * Return the label of a given status + * + * @param int $status Status id + * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Status label + */ + public function LibStatut($status, $mode = 0) + { + // phpcs:enable + global $langs; + $langs->load('companies'); + + $statusType = 'status4'; + if ($status == 0) $statusType = 'status5'; + + if (empty($this->labelStatus) || empty($this->labelStatusShort)) + { + $this->labelStatus[0] = $langs->trans("ActivityCeased"); + $this->labelStatus[1] = $langs->trans("InActivity"); + $this->labelStatusShort[0] = $langs->trans("ActivityCeased"); + $this->labelStatusShort[1] = $langs->trans("InActivity"); + } + + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 280c0a56b6e0912cb6a712dc8fbb3b3610a99d11 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 14 Nov 2019 15:37:54 +0000 Subject: [PATCH 2/9] Fixing style errors. --- htdocs/adherents/class/adherent_type.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 56410c6439a..77fa991d07f 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -679,7 +679,7 @@ class AdherentType extends CommonObject { return $this->LibStatut($this->status, $mode); } - + /** * Return the label of a given status * From fee8e33e2b6f8d41a422a73975ae30d53bee4d78 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 14 Nov 2019 16:58:17 +0100 Subject: [PATCH 3/9] Update type.php --- htdocs/adherents/type.php | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index d98dcd9f693..f49dd73874a 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -226,7 +226,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { //dol_fiche_head(''); - $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut, d.morphy"; + $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut as status, d.morphy"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.entity IN (".getEntity('member_type').")"; @@ -280,7 +280,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') $membertype->id = $objp->rowid; $membertype->ref = $objp->rowid; $membertype->label = $objp->rowid; - + $membertype->status = $objp->status; + print ''; print ''; print $membertype->getNomUrl(1); @@ -294,13 +295,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') print ''; print ''.yn($objp->subscription).''; print ''.yn($objp->vote).''; - print ''; - if (!empty($objp->statut)) { - print img_picto($langs->trans("InActivity"), 'statut4'); - } else { - print img_picto($langs->trans("ActivityCeased"), 'statut5'); - } - print ''; + print ''.$membertype->getLibStatut(5).''; if ($user->rights->adherent->configurer) print 'rowid.'">'.img_edit().''; else @@ -432,15 +427,7 @@ if ($rowid > 0) print ''; - print ''; - - // Morphy + // Morphy print ''; print ''; From 07880dd835521f4d856b476de60b498b90c2e4a5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 14 Nov 2019 16:00:08 +0000 Subject: [PATCH 4/9] Fixing style errors. --- htdocs/adherents/type.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index f49dd73874a..b1b18e3ed31 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -280,8 +280,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') $membertype->id = $objp->rowid; $membertype->ref = $objp->rowid; $membertype->label = $objp->rowid; - $membertype->status = $objp->status; - + $membertype->status = $objp->status; + print ''; print '
'.$langs->trans("Status").''; - if (!empty($object->statut)) { - print img_picto($langs->trans('TypeStatusActive'), 'statut4').' '.$langs->trans("InActivity"); - } else { - print img_picto($langs->trans('TypeStatusInactive'), 'statut5').' '.$langs->trans("ActivityCeased"); - } - print '
'.$langs->trans("MemberNature").''.$object->getmorphylib($object->morphy).'
'; print $membertype->getNomUrl(1); @@ -427,7 +427,7 @@ if ($rowid > 0) print ''; - // Morphy + // Morphy print ''; print ''; From 892b61f1c2872d4218ba44a839356021564d5fdb Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 14 Nov 2019 20:02:44 +0100 Subject: [PATCH 5/9] Update adherent_type.class.php --- htdocs/adherents/class/adherent_type.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 77fa991d07f..304f54b4c30 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -627,7 +627,8 @@ class AdherentType extends CommonObject return -1; } } - + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return translated label by the nature of a adherent (physical or moral) * @@ -642,7 +643,8 @@ class AdherentType extends CommonObject else return $langs->trans("MorPhy"); //return $morphy; } - + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return clicable name (with picto eventually) * From f369fa06a61aca17ab8b3ecb7bc44341c3798d1f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 14 Nov 2019 19:04:18 +0000 Subject: [PATCH 6/9] Fixing style errors. --- htdocs/adherents/class/adherent_type.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 304f54b4c30..cb1f80bb081 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -627,7 +627,7 @@ class AdherentType extends CommonObject return -1; } } - + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return translated label by the nature of a adherent (physical or moral) @@ -643,7 +643,7 @@ class AdherentType extends CommonObject else return $langs->trans("MorPhy"); //return $morphy; } - + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return clicable name (with picto eventually) From fc2e0d4f9544b2df718c3c2ba112da9088bddc1e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 14 Nov 2019 20:09:36 +0100 Subject: [PATCH 7/9] Update adherent_type.class.php --- htdocs/adherents/class/adherent_type.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index cb1f80bb081..a658cff86b8 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -671,6 +671,7 @@ class AdherentType extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return label of status (activity, closed) * From 332c91aa11ccdd91d118e248b8689871cb80c94c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 14 Nov 2019 20:10:14 +0100 Subject: [PATCH 8/9] Update adherent_type.class.php --- htdocs/adherents/class/adherent_type.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index a658cff86b8..14a0c0186a5 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -628,7 +628,6 @@ class AdherentType extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return translated label by the nature of a adherent (physical or moral) * @@ -644,7 +643,6 @@ class AdherentType extends CommonObject //return $morphy; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return clicable name (with picto eventually) * From d2aa4ba54e3d2b3dc2492c8ce24d8116c370f55c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 16 Nov 2019 00:41:55 +0100 Subject: [PATCH 9/9] Update adherent_type.class.php --- htdocs/adherents/class/adherent_type.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 14a0c0186a5..5006becb053 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -489,7 +489,7 @@ class AdherentType extends CommonObject { global $langs, $conf; - $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.duration, d.subscription, d.mail_valid, d.note, d.vote"; + $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.mail_valid, d.note, d.vote"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " WHERE d.rowid = ".(int) $rowid; @@ -506,8 +506,8 @@ class AdherentType extends CommonObject $this->ref = $obj->rowid; $this->label = $obj->label; $this->morphy = $obj->morphy; - $this->statut = $obj->statut; - $this->status = $obj->statut; + $this->statut = $obj->status; // deprecated + $this->status = $obj->status; $this->duration = $obj->duration; $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1); $this->duration_unit = substr($obj->duration, -1);
'.$langs->trans("MemberNature").''.$object->getmorphylib($object->morphy).'