Merge pull request #12952 from ptibogxiv/patch-297
NEW: add member to validate on dashboard
This commit is contained in:
commit
936899e0e2
@ -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";
|
||||
$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)";
|
||||
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);
|
||||
|
||||
@ -107,6 +107,10 @@ $modules = array(
|
||||
array(
|
||||
'code' => 'MAIN_DELAY_MEMBERS',
|
||||
'img' => 'user'
|
||||
),
|
||||
array(
|
||||
'code' => 'MAIN_DELAY_MEMBERS_SHIFT',
|
||||
'img' => 'user'
|
||||
)
|
||||
),
|
||||
'expensereport' => array(
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user