new box replace
This commit is contained in:
parent
742c12f9d6
commit
d68de8617b
@ -307,176 +307,6 @@ print "<br>\n";
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
/*
|
||||
* Latest modified members
|
||||
*/
|
||||
/*
|
||||
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
$sql = "SELECT a.rowid, a.ref, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||
$sql .= " a.gender, a.email, a.photo, a.morphy,";
|
||||
$sql .= " a.tms as datem, a.datefin as date_end_subscription,";
|
||||
$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND a.fk_adherent_type = ta.rowid";
|
||||
$sql .= $db->order("a.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="4">'.$langs->trans("LastMembersModified", $max).'</th></tr>';
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num) {
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$staticmember->id = $obj->rowid;
|
||||
$staticmember->ref = $obj->ref;
|
||||
$staticmember->lastname = $obj->lastname;
|
||||
$staticmember->firstname = $obj->firstname;
|
||||
$staticmember->gender = $obj->gender;
|
||||
$staticmember->email = $obj->email;
|
||||
$staticmember->photo = $obj->photo;
|
||||
$staticmember->morphy = $obj->morphy;
|
||||
$staticmember->statut = $obj->status;
|
||||
$staticmember->need_subscription = $obj->need_subscription;
|
||||
$staticmember->datefin = $db->jdate($obj->date_end_subscription);
|
||||
if (!empty($obj->fk_soc)) {
|
||||
$staticmember->fk_soc = $obj->fk_soc;
|
||||
$staticmember->fetch_thirdparty();
|
||||
$staticmember->name = $staticmember->thirdparty->name;
|
||||
} else {
|
||||
$staticmember->name = $obj->company;
|
||||
}
|
||||
|
||||
$statictype->id = $obj->typeid;
|
||||
$statictype->label = $obj->label;
|
||||
$statictype->subscription = $obj->need_subscription;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32).'</td>';
|
||||
print '<td>'.$statictype->getNomUrl(1, 32).'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datem), 'dayhour').'</td>';
|
||||
print '<td class="right">'.$staticmember->getLibStatut(3).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table></div>";
|
||||
print "<br>";
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Last modified subscriptions
|
||||
*/
|
||||
/*
|
||||
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
$sql = "SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||
$sql .= " a.gender, a.email, a.photo, a.morphy,";
|
||||
$sql .= " a.datefin as date_end_subscription,";
|
||||
$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription,";
|
||||
$sql .= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta, ".MAIN_DB_PREFIX."subscription as c";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND a.fk_adherent_type = ta.rowid";
|
||||
$sql .= " AND c.fk_adherent = a.rowid";
|
||||
$sql .= $db->order("c.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified", $max).'</th></tr>';
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num) {
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$staticmember->id = $obj->rowid;
|
||||
$staticmember->ref = $obj->rowid;
|
||||
$staticmember->lastname = $obj->lastname;
|
||||
$staticmember->firstname = $obj->firstname;
|
||||
$staticmember->gender = $obj->gender;
|
||||
$staticmember->email = $obj->email;
|
||||
$staticmember->photo = $obj->photo;
|
||||
$staticmember->morphy = $obj->morphy;
|
||||
$staticmember->statut = $obj->status;
|
||||
$staticmember->need_subscription = $obj->need_subscription;
|
||||
$staticmember->datefin = $db->jdate($obj->date_end_subscription);
|
||||
if (!empty($obj->fk_soc)) {
|
||||
$staticmember->fk_soc = $obj->fk_soc;
|
||||
$staticmember->fetch_thirdparty();
|
||||
$staticmember->name = $staticmember->thirdparty->name;
|
||||
} else {
|
||||
$staticmember->name = $obj->company;
|
||||
}
|
||||
|
||||
$subscriptionstatic->id = $obj->cid;
|
||||
$subscriptionstatic->ref = $obj->cid;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">'.$subscriptionstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$staticmember->getNomUrl(-1, 32, 'subscription').'</td>';
|
||||
print '<td class="nowraponall">'.get_date_range($db->jdate($obj->date_start), $db->jdate($obj->date_end)).'</td>';
|
||||
print '<td class="right">'.price($obj->subscription).'</td>';
|
||||
//print '<td class="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
||||
print '<td class="right nowraponall">'.dol_print_date($db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour').'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table></div>";
|
||||
print "<br>";
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
*/
|
||||
|
||||
// Summary of members by type
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("MembersTypes").'</th>';
|
||||
print '<th class=right>'.$langs->trans("MembersStatusToValid").'</th>';
|
||||
print '<th class=right>'.$langs->trans("OutOfDate").'</th>';
|
||||
print '<th class=right>'.$langs->trans("UpToDate").'</th>';
|
||||
print '<th class=right>'.$langs->trans("MembersStatusResiliated").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($AdherentType as $key => $adhtype) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
|
||||
print '<td class="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '').' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '').' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
|
||||
print '<td class="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '').' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="liste_total right">'.$SommeA.' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="liste_total right">'.$SommeB.' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="liste_total right">'.$SommeC.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
|
||||
print '<td class="liste_total right">'.$SommeD.' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>\n";
|
||||
print "</div>";
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
// boxes
|
||||
|
||||
277
htdocs/core/boxes/box_members_by_type.php
Normal file
277
htdocs/core/boxes/box_members_by_type.php
Normal file
@ -0,0 +1,277 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/boxes/box_members_by_type.php
|
||||
* \ingroup adherent
|
||||
* \brief Module to show box of members
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/boxes/modules_boxes.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage the box to show last modofied members
|
||||
*/
|
||||
class box_members_by_type extends ModeleBoxes
|
||||
{
|
||||
public $boxcode = "box_members_by_type";
|
||||
public $boximg = "object_user";
|
||||
public $boxlabel = "BoxMembersByType";
|
||||
public $depends = array("adherent");
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $param;
|
||||
public $enabled = 1;
|
||||
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
public function __construct($db, $param = '')
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !($user->rights->adherent->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
* @param int $max Maximum number of records to load
|
||||
* @return void
|
||||
*/
|
||||
public function loadBox($max = 5)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
$langs->load("boxes");
|
||||
|
||||
$this->max = $max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent_type.class.php';
|
||||
$staticmember = new Adherent($this->db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersByType", $max));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
$MembersToValidate = array();
|
||||
$MembersValidated = array();
|
||||
$MemberUpToDate = array();
|
||||
$MembersResiliated = array();
|
||||
|
||||
$SommeA = 0;
|
||||
$SommeB = 0;
|
||||
$SommeC = 0;
|
||||
$SommeD = 0;
|
||||
|
||||
$AdherentType = array();
|
||||
|
||||
// Type of membership
|
||||
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
|
||||
$sql .= " d.statut, count(d.rowid) as somme";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent_type as t";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "adherent as d";
|
||||
$sql .= " ON t.rowid = d.fk_adherent_type";
|
||||
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " WHERE t.entity IN (" . getEntity('member_type') . ")";
|
||||
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
|
||||
|
||||
dol_syslog("box_members_by_type::select nb of members per type", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$adhtype = new AdherentType($this->db);
|
||||
$adhtype->id = $objp->rowid;
|
||||
$adhtype->subscription = $objp->subscription;
|
||||
$adhtype->label = $objp->label;
|
||||
$AdherentType[$objp->rowid] = $adhtype;
|
||||
|
||||
if ($objp->statut == -1) {
|
||||
$MembersToValidate[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == 1) {
|
||||
$MembersValidated[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
if ($objp->statut == 0) {
|
||||
$MembersResiliated[$objp->rowid] = $objp->somme;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
$now = dol_now();
|
||||
|
||||
// Members up to date list
|
||||
// current rule: uptodate = the end date is in future whatever is type
|
||||
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
|
||||
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d, " . MAIN_DB_PREFIX . "adherent_type as t";
|
||||
$sql .= " WHERE d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND d.statut = 1 AND (d.datefin >= '" . $this->db->idate($now) . "' OR t.subscription = 0)";
|
||||
$sql .= " AND t.rowid = d.fk_adherent_type";
|
||||
$sql .= " GROUP BY d.fk_adherent_type";
|
||||
|
||||
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num2 = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num2) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$MemberUpToDate[$objp->fk_adherent_type] = $objp->somme;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
|
||||
$line = 0;
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_titre"',
|
||||
'text' => $langs->trans("MembersTypes"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $langs->trans("MembersStatusToValid"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $langs->trans("OutOfDate"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $langs->trans("UpToDate"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $langs->trans("MembersStatusResiliated"),
|
||||
);
|
||||
$line++;
|
||||
foreach ($AdherentType as $key => $adhtype) {
|
||||
$SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0;
|
||||
$SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0;
|
||||
$SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0;
|
||||
$SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0;
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => $adhtype->getNomUrl(1, dol_size(32)),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '') . ' ' . $staticmember->LibStatut(-1, $adhtype->subscription, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : '') . ' ' . $staticmember->LibStatut(1, $adhtype->subscription, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(1, $adhtype->subscription, $now, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => (isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '') . ' ' . $staticmember->LibStatut(0, $adhtype->subscription, 0, 3),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text' => $langs->trans("NoRecordedMembersByType"),
|
||||
);
|
||||
} else {
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total"',
|
||||
'text' => $langs->trans("Total"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SommeA.' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SommeB.' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SommeC.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => $SommeD.' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => '',
|
||||
'maxlength' => 500,
|
||||
'text' => ($this->db->error() . ' sql=' . $sql),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'class="nohover opacitymedium left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to show box
|
||||
*
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return string
|
||||
*/
|
||||
public function showBox($head = null, $contents = null, $nooutput = 0)
|
||||
{
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
}
|
||||
132
htdocs/core/boxes/box_members_subscriptions_by_year.php
Normal file
132
htdocs/core/boxes/box_members_subscriptions_by_year.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015-2021 Frederic France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/boxes/box_members_subscriptions_by_year.php
|
||||
* \ingroup adherent
|
||||
* \brief Module to show box of members
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage the box to show last modofied members
|
||||
*/
|
||||
class box_members_subscriptions_by_year extends ModeleBoxes
|
||||
{
|
||||
public $boxcode = "box_members_subscriptions_by_year";
|
||||
public $boximg = "object_user";
|
||||
public $boxlabel = "BoxMembersSubscriptionsByYear";
|
||||
public $depends = array("adherent");
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $param;
|
||||
public $enabled = 1;
|
||||
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
public function __construct($db, $param = '')
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// disable module for such cases
|
||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||
if (!in_array('adherent', $listofmodulesforexternal) && !empty($user->socid)) {
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !($user->rights->adherent->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data into info_box_contents array to show array later.
|
||||
*
|
||||
* @param int $max Maximum number of records to load
|
||||
* @return void
|
||||
*/
|
||||
public function loadBox($max = 5)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
$langs->load("boxes");
|
||||
|
||||
$this->max = $max;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
$memberstatic = new Adherent($this->db);
|
||||
$statictype = new AdherentType($this->db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleMembersSubscriptionsByYear", $max));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
$num = 0;
|
||||
$line = 0;
|
||||
if (1) {
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=>$langs->trans("NoRecordedMembers"),
|
||||
);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => '',
|
||||
'maxlength'=>500,
|
||||
'text' => ($this->db->error().' sql='.$sql),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'td' => 'class="nohover opacitymedium left"',
|
||||
'text' => $langs->trans("ReadPermissionNotAllowed")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to show box
|
||||
*
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return string
|
||||
*/
|
||||
public function showBox($head = null, $contents = null, $nooutput = 0)
|
||||
{
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
}
|
||||
@ -192,10 +192,12 @@ class modAdherent extends DolibarrModules
|
||||
// Boxes
|
||||
//-------
|
||||
$this->boxes = array(
|
||||
0=>array('file'=>'box_members.php', 'enabledbydefaulton'=>'Home'),
|
||||
2=>array('file'=>'box_birthdays_members.php', 'enabledbydefaulton'=>'Home'),
|
||||
3=>array('file'=>'box_members_last_modified', 'enabledbydefaulton'=>'membersindex'),
|
||||
4=>array('file'=>'box_members_last_subscriptions', 'enabledbydefaulton'=>'membersindex'),
|
||||
0 => array('file'=>'box_members.php', 'enabledbydefaulton'=>'Home'),
|
||||
2 => array('file'=>'box_birthdays_members.php', 'enabledbydefaulton'=>'Home'),
|
||||
3 => array('file'=>'box_members_last_modified', 'enabledbydefaulton'=>'membersindex'),
|
||||
4 => array('file'=>'box_members_last_subscriptions', 'enabledbydefaulton'=>'membersindex'),
|
||||
5 => array('file'=>'box_members_subscriptions_by_year', 'enabledbydefaulton'=>'membersindex'),
|
||||
6 => array('file'=>'box_members_by_type', 'enabledbydefaulton'=>'membersindex'),
|
||||
);
|
||||
|
||||
// Permissions
|
||||
|
||||
@ -22,6 +22,7 @@ BoxLastModifiedMembers=Latest modified members
|
||||
BoxFicheInter=Latest interventions
|
||||
BoxCurrentAccounts=Open accounts balance
|
||||
BoxTitleMemberNextBirthdays=Birthdays of this month (members)
|
||||
BoxTitleMembersByType=Members by type
|
||||
BoxTitleLastRssInfos=Latest %s news from %s
|
||||
BoxTitleLastProducts=Products/Services: last %s modified
|
||||
BoxTitleProductsAlertStock=Products: stock alert
|
||||
|
||||
Loading…
Reference in New Issue
Block a user