From 3a4ee6417cb4e146d9b30b7666de93bb64b02c86 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 28 Jan 2020 21:25:32 +0100 Subject: [PATCH 1/4] NEW: add member to validate on dashboard --- htdocs/index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 250a0c1736b..9e6ef1b7bf8 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -268,6 +268,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies', DOL_URL_ROOT.'/contact/list.php?mainmenu=companies', DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members', + DOL_URL_ROOT.'/adherents/list.php?statut=-1&mainmenu=members', DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products', DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products', DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', @@ -457,7 +458,8 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->socid) { include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; $board = new Adherent($db); - $dashboardlines['Adherent'] = $board->load_board($user); + $dashboardlines[$board->element . '_expired'] = $board->load_board($user, 'expired'); + $dashboardlines[$board->element . '_shift'] = $board->load_board($user, 'shift'); } // Number of expense reports to approve @@ -563,7 +565,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { 'groupName' => 'Members', 'globalStatsKey' => 'members', 'stats' => - array('Adherent'), + array('member_expired', 'member_shift'), ), 'ExpenseReport' => array( From ae1dbdd34f646ba130d90cfa42aed2b294711a5c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 28 Jan 2020 21:27:11 +0100 Subject: [PATCH 2/4] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 32 +++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index ec4042cdf88..e1a25465a6c 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2264,9 +2264,10 @@ class Adherent extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user + * @param string $mode "expired" for membership to renew, "shift" for member to validate * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - public function load_board($user) + public function load_board($user, $mode) { // phpcs:enable global $conf, $langs; @@ -2279,20 +2280,41 @@ class Adherent extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql.= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " WHERE a.fk_adherent_type = t.rowid"; + if ($mode == 'expired') + { $sql.= " AND a.statut = 1"; $sql.= " AND a.entity IN (".getEntity('adherent').")"; $sql.= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = 1)"; + } + elseif ($mode == 'shift') + { + $sql.= " AND a.statut = -1"; + $sql.= " AND a.entity IN (".getEntity('adherent').")"; + } $resql=$this->db->query($sql); if ($resql) { $langs->load("members"); + + if ($mode == 'expired') { + $warning_delay = $conf->adherent->subscription->warning_delay/60/60/24; + $label = $langs->trans("MembersWithSubscriptionToReceive"); + $labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort"); + $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; + } + elseif ($mode == 'shift') { + $warning_delay = $conf->adherent->subscription->warning_delay/60/60/24; + $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=-1&filter=outofdate'; + $label = $langs->trans("MembersListToValid"); + $labelShort = $langs->trans("MemberStatusDraft"); + } $response = new WorkboardResponse(); - $response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24; - $response->label=$langs->trans("MembersWithSubscriptionToReceive"); - $response->labelShort=$langs->trans("MembersWithSubscriptionToReceiveShort"); - $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; + $response->warning_delay=$warning_delay; + $response->label=$label; + $response->labelShort=$labelShort; + $response->url=$url; $response->img=img_object('', "user"); $adherentstatic = new Adherent($this->db); From ab0d60065d0d7597b12e7f1f5a386c046ec25059 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 28 Jan 2020 21:27:45 +0100 Subject: [PATCH 3/4] Update delais.php --- htdocs/admin/delais.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index ac893c1d658..5b756c21017 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -107,6 +107,10 @@ $modules = array( array( 'code' => 'MAIN_DELAY_MEMBERS', 'img' => 'user' + ), + array( + 'code' => 'MAIN_DELAY_MEMBERS_SHIFT', + 'img' => 'user' ) ), 'expensereport' => array( From 1c261397890a79b9a12f5e9abbfc46a549eb86fc Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 28 Jan 2020 20:29:17 +0000 Subject: [PATCH 4/4] Fixing style errors. --- htdocs/adherents/class/adherent.class.php | 14 +++++++------- htdocs/index.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index e1a25465a6c..dd4706b068e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2280,23 +2280,23 @@ class Adherent extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql.= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " WHERE a.fk_adherent_type = t.rowid"; - if ($mode == 'expired') + if ($mode == 'expired') { - $sql.= " AND a.statut = 1"; - $sql.= " AND a.entity IN (".getEntity('adherent').")"; - $sql.= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = 1)"; + $sql.= " AND a.statut = 1"; + $sql.= " AND a.entity IN (".getEntity('adherent').")"; + $sql.= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = 1)"; } elseif ($mode == 'shift') { - $sql.= " AND a.statut = -1"; - $sql.= " AND a.entity IN (".getEntity('adherent').")"; + $sql.= " AND a.statut = -1"; + $sql.= " AND a.entity IN (".getEntity('adherent').")"; } $resql=$this->db->query($sql); if ($resql) { $langs->load("members"); - + if ($mode == 'expired') { $warning_delay = $conf->adherent->subscription->warning_delay/60/60/24; $label = $langs->trans("MembersWithSubscriptionToReceive"); diff --git a/htdocs/index.php b/htdocs/index.php index 9e6ef1b7bf8..228b5870868 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -268,7 +268,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies', DOL_URL_ROOT.'/contact/list.php?mainmenu=companies', DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members', - DOL_URL_ROOT.'/adherents/list.php?statut=-1&mainmenu=members', + DOL_URL_ROOT.'/adherents/list.php?statut=-1&mainmenu=members', DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products', DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products', DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals',