commit
feda146bca
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2021 Frédéric France <frederic.france@netlgic.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
|
||||
@ -29,6 +30,7 @@ require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$hookmanager = new HookManager($db);
|
||||
|
||||
@ -42,17 +44,40 @@ $langs->loadLangs(array("companies", "members"));
|
||||
$result = restrictedArea($user, 'adherent');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('addbox')) {
|
||||
// Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("BoxAdded"), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
$resultboxes = FormOther::getBoxesArea($user, "2");
|
||||
|
||||
llxHeader('', $langs->trans("Members"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
$staticmember = new Adherent($db);
|
||||
$statictype = new AdherentType($db);
|
||||
$subscriptionstatic = new Subscription($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("MembersArea"), '', 'member');
|
||||
print load_fiche_titre($langs->trans("MembersArea"), $resultboxes['selectboxlist'], 'members');
|
||||
|
||||
$Adherents = array();
|
||||
$AdherentsAValider = array();
|
||||
@ -125,10 +150,7 @@ if ($result) {
|
||||
$db->free();
|
||||
}
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
$searchbox = '';
|
||||
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is useless due to the global search combo
|
||||
// Search contact/address
|
||||
if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire) {
|
||||
@ -136,27 +158,27 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel
|
||||
}
|
||||
|
||||
if (count($listofsearchfields)) {
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
$searchbox .='<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||
$searchbox .='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$searchbox .='<div class="div-table-responsive-no-min">';
|
||||
$searchbox .='<table class="noborder nohover centpercent">';
|
||||
$i = 0;
|
||||
foreach ($listofsearchfields as $key => $value) {
|
||||
if ($i == 0) {
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
$searchbox .='<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
}
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
$searchbox .='<tr class="oddeven">';
|
||||
$searchbox .='<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) {
|
||||
print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
$searchbox .='<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
$searchbox .='</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
$searchbox .='</table>';
|
||||
$searchbox .='</div>';
|
||||
$searchbox .='</form>';
|
||||
$searchbox .='<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,12 +186,12 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel
|
||||
/*
|
||||
* Statistics
|
||||
*/
|
||||
|
||||
$boxgraph = '';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||
print '<tr><td class="center" colspan="2">';
|
||||
$boxgraph .='<div class="div-table-responsive-no-min">';
|
||||
$boxgraph .='<table class="noborder nohover centpercent">';
|
||||
$boxgraph .='<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||
$boxgraph .='<tr><td class="center" colspan="2">';
|
||||
|
||||
$SommeA = 0;
|
||||
$SommeB = 0;
|
||||
@ -207,17 +229,26 @@ if ($conf->use_javascript_ajax) {
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
$boxgraph .=$dolgraph->show($total ? 0 : 1);
|
||||
|
||||
print '</td></tr>';
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
|
||||
print $SommeA + $SommeB + $SommeC + $SommeD;
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
$boxgraph .= '</td></tr>';
|
||||
$boxgraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
|
||||
$boxgraph .= $SommeA + $SommeB + $SommeC + $SommeD;
|
||||
$boxgraph .= '</td></tr>';
|
||||
$boxgraph .= '</table>';
|
||||
$boxgraph .= '</div>';
|
||||
$boxgraph .= '<br>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
// boxes
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<div class="fichecenter fichecenterbis">';
|
||||
|
||||
print '<div class="twocolumns">';
|
||||
|
||||
print '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
|
||||
print $searchbox;
|
||||
print $boxgraph;
|
||||
|
||||
// List of subscription by year
|
||||
$Total = array();
|
||||
@ -257,7 +288,7 @@ print "</tr>\n";
|
||||
|
||||
krsort($Total);
|
||||
$i = 0;
|
||||
foreach ($Total as $key => $value) {
|
||||
foreach ($Total as $key=>$value) {
|
||||
if ($i >= 8) {
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>...</td>";
|
||||
@ -284,17 +315,21 @@ print '<td class="right">'.price($tot)."</td>";
|
||||
print "<td class=\"right\">".price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT'))."</td>";
|
||||
print "</tr>\n";
|
||||
print "</table></div>";
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
print $resultboxes['boxlista'];
|
||||
print '</div>'."\n";
|
||||
|
||||
print '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
|
||||
/*
|
||||
* 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 = "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.tms as datem, a.datefin as date_end_subscription,";
|
||||
$sql .= " ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription";
|
||||
@ -318,7 +353,7 @@ if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$staticmember->id = $obj->rowid;
|
||||
$staticmember->ref = $obj->ref;
|
||||
$staticmember->ref = $obj->rowid;
|
||||
$staticmember->lastname = $obj->lastname;
|
||||
$staticmember->firstname = $obj->firstname;
|
||||
$staticmember->gender = $obj->gender;
|
||||
@ -457,7 +492,12 @@ print '</tr>';
|
||||
print "</table>\n";
|
||||
print "</div>";
|
||||
|
||||
print '</div></div></div>';
|
||||
print $resultboxes['boxlistb'];
|
||||
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
$parameters = array('user' => $user);
|
||||
$reshook = $hookmanager->executeHooks('dashboardMembers', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -66,7 +66,7 @@ class AgendaEvents extends DolibarrApi
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->myactions->read) {
|
||||
throw new RestException(401, "Insufficient rights to read an event");
|
||||
}
|
||||
if ($id == 0) {
|
||||
if ($id === 0) {
|
||||
$result = $this->actioncomm->initAsSpecimen();
|
||||
} else {
|
||||
$result = $this->actioncomm->fetch($id);
|
||||
|
||||
2
htdocs/compta/tva/card.php
Normal file → Executable file
2
htdocs/compta/tva/card.php
Normal file → Executable file
@ -549,7 +549,7 @@ if ($id) {
|
||||
print '</td></tr>';
|
||||
|
||||
if ($action == 'edit') {
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . $object->amount . '"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . price($object->amount) . '"></td></tr>';
|
||||
} else {
|
||||
print '<tr><td>' . $langs->trans("Amount") . '</td><td>' . price($object->amount) . '</td></tr>';
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ class box_members extends ModeleBoxes
|
||||
$sql = "SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||
$sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
|
||||
$sql .= ' a.photo, a.email, a.gender, a.morphy,';
|
||||
$sql .= " t.subscription";
|
||||
$sql .= " t.subscription, t.libelle as label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('member').")";
|
||||
$sql .= " AND a.fk_adherent_type = t.rowid";
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
197
htdocs/core/boxes/box_members_last_modified.php
Normal file
197
htdocs/core/boxes/box_members_last_modified.php
Normal file
@ -0,0 +1,197 @@
|
||||
<?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_last_modified_members.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_last_modified_members extends ModeleBoxes
|
||||
{
|
||||
public $boxcode = "box_last_modified_members";
|
||||
public $boximg = "object_user";
|
||||
public $boxlabel = "BoxLastModifiedMembers";
|
||||
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("BoxTitleLastModifiedMembers", $max));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
$sql = "SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
|
||||
$sql .= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
|
||||
$sql .= ' a.photo, a.email, a.gender, a.morphy,';
|
||||
$sql .= " t.rowid as typeid, t.subscription, t.libelle as label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('member').")";
|
||||
$sql .= " AND a.fk_adherent_type = t.rowid";
|
||||
$sql .= " ORDER BY a.tms DESC";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$line = 0;
|
||||
while ($line < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$datec = $this->db->jdate($objp->datec);
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
|
||||
$memberstatic->lastname = $objp->lastname;
|
||||
$memberstatic->firstname = $objp->firstname;
|
||||
$memberstatic->id = $objp->rowid;
|
||||
$memberstatic->ref = $objp->ref;
|
||||
$memberstatic->photo = $objp->photo;
|
||||
$memberstatic->gender = $objp->gender;
|
||||
$memberstatic->email = $objp->email;
|
||||
$memberstatic->morphy = $objp->morphy;
|
||||
$memberstatic->company = $objp->company;
|
||||
$memberstatic->statut = $objp->status;
|
||||
$memberstatic->need_subscription = $objp->subscription;
|
||||
$memberstatic->datefin = $this->db->jdate($objp->date_end_subscription);
|
||||
if (!empty($objp->fk_soc)) {
|
||||
$memberstatic->socid = $objp->fk_soc;
|
||||
$memberstatic->fetch_thirdparty();
|
||||
$memberstatic->name = $memberstatic->thirdparty->name;
|
||||
} else {
|
||||
$memberstatic->name = $objp->company;
|
||||
}
|
||||
$statictype->id = $objp->typeid;
|
||||
$statictype->label = $objp->label;
|
||||
$statictype->subscription = $objp->subscription;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => $memberstatic->getNomUrl(-1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => $statictype->getNomUrl(1, 32),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => dol_print_date($datem, "day"),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $memberstatic->LibStatut($objp->status, $objp->subscription, $this->db->jdate($objp->date_end_subscription), 3),
|
||||
);
|
||||
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=>$langs->trans("NoRecordedCustomers"),
|
||||
);
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
202
htdocs/core/boxes/box_members_last_subscriptions.php
Normal file
202
htdocs/core/boxes/box_members_last_subscriptions.php
Normal file
@ -0,0 +1,202 @@
|
||||
<?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_last_members_subscriptions.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_last_members_subscriptions extends ModeleBoxes
|
||||
{
|
||||
public $boxcode = "box_last_members_subscriptions";
|
||||
public $boximg = "object_user";
|
||||
public $boxlabel = "BoxLastMembersSubscriptions";
|
||||
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';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
$staticmember = new Adherent($this->db);
|
||||
$statictype = new AdherentType($this->db);
|
||||
$subscriptionstatic = new Subscription($this->db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("LastSubscriptionsModified", $max));
|
||||
|
||||
if ($user->rights->adherent->lire) {
|
||||
$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 .= $this->db->order("c.tms", "DESC");
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$line = 0;
|
||||
while ($line < $num) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$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 = $this->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;
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
|
||||
'text' => $subscriptionstatic->getNomUrl(1),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => $staticmember->getNomUrl(-1, 32, 'subscription'),
|
||||
'asis' => 1,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => get_date_range($this->db->jdate($obj->date_start), $this->db->jdate($obj->date_end)),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => price($obj->subscription),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => dol_print_date($this->db->jdate($obj->datem ? $obj->datem : $obj->datec), 'dayhour'),
|
||||
);
|
||||
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=>$langs->trans("NoRecordedCustomers"),
|
||||
);
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
242
htdocs/core/boxes/box_members_subscriptions_by_year.php
Normal file
242
htdocs/core/boxes/box_members_subscriptions_by_year.php
Normal file
@ -0,0 +1,242 @@
|
||||
<?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;
|
||||
// List of subscription by year
|
||||
$Total = array();
|
||||
$Number = array();
|
||||
$tot = 0;
|
||||
$numb = 0;
|
||||
|
||||
$sql = "SELECT c.subscription, c.dateadh as dateh";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as d, " . MAIN_DB_PREFIX . "subscription as c";
|
||||
$sql .= " WHERE d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND d.rowid = c.fk_adherent";
|
||||
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$year = dol_print_date($this->db->jdate($objp->dateh), "%Y");
|
||||
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
|
||||
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
|
||||
$tot += $objp->subscription;
|
||||
$numb += 1;
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$line = 0;
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_titre"',
|
||||
'text' => $langs->trans("Year"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $langs->trans("Subscriptions"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $langs->trans("AmountTotal"),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $langs->trans("AmountAverage"),
|
||||
);
|
||||
|
||||
$line++;
|
||||
|
||||
krsort($Total);
|
||||
$i = 0;
|
||||
foreach ($Total as $key => $value) {
|
||||
if ($i >= 8) {
|
||||
// print '<tr class="oddeven">';
|
||||
// print "<td>...</td>";
|
||||
// print "<td class=\"right\"></td>";
|
||||
// print "<td class=\"right\"></td>";
|
||||
// print "<td class=\"right\"></td>";
|
||||
// print "</tr>\n";
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => '...',
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => '',
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => '',
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => '',
|
||||
);
|
||||
$line++;
|
||||
break;
|
||||
}
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||
'text' => '<a href="./subscription/list.php?date_select='.$key.'">'.$key.'</a>',
|
||||
'asis' => 1,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $Number[$key],
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => price($value),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => price(price2num($value / $Number[$key], 'MT')),
|
||||
);
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text' => $langs->trans("NoRecordedMembers"),
|
||||
);
|
||||
} 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' => $numb,
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => price($tot),
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="liste_total right"',
|
||||
'text' => price(price2num($numb > 0 ? ($tot / $numb) : 0, 'MT')),
|
||||
);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,8 @@ class HookManager
|
||||
if ($resaction) {
|
||||
$controlclassname = 'Actions'.ucfirst($module);
|
||||
$actionInstance = new $controlclassname($this->db);
|
||||
$this->hooks[$context][$module] = $actionInstance;
|
||||
$priority = empty($actionInstance->priority) ? 50 : $actionInstance->priority;
|
||||
$this->hooks[$context][$priority.':'.$module] = $actionInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,6 +131,10 @@ class HookManager
|
||||
dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG);
|
||||
}
|
||||
|
||||
if (!empty($this->hooks[$context])) {
|
||||
ksort($this->hooks[$context], SORT_NATURAL);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -238,8 +243,10 @@ class HookManager
|
||||
$error = 0;
|
||||
foreach ($this->hooks as $context => $modules) { // $this->hooks is an array with context as key and value is an array of modules that handle this context
|
||||
if (!empty($modules)) {
|
||||
// Loop on each active hooks of module for this context
|
||||
foreach ($modules as $module => $actionclassinstance) {
|
||||
//print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."<br>\n";
|
||||
$module = preg_replace('/^\d+:/', '', $module);
|
||||
//print "Before hook ".get_class($actionclassinstance)." method=".$method." module=".$module." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."<br>\n";
|
||||
|
||||
// test to avoid running twice a hook, when a module implements several active contexts
|
||||
if (in_array($module, $modulealreadyexecuted)) {
|
||||
|
||||
@ -40,6 +40,9 @@ class InfoBox
|
||||
if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
return array(
|
||||
0 => 'Home',
|
||||
1 => 'userhome',
|
||||
2 => 'membersindex',
|
||||
3 => 'thirdpartiesindex',
|
||||
27 => 'AccountancyHome'
|
||||
);
|
||||
} else {
|
||||
@ -151,7 +154,7 @@ class InfoBox
|
||||
$box->box_order = (empty($obj->box_order) ? '' : $obj->box_order);
|
||||
$box->fk_user = (empty($obj->fk_user) ? 0 : $obj->fk_user);
|
||||
$box->sourcefile = $relsourcefile;
|
||||
$box->class = $boxname;
|
||||
$box->class = $boxname;
|
||||
|
||||
if ($mode == 'activated' && !is_object($user)) { // List of activated box was not yet personalized into database
|
||||
if (is_numeric($box->box_order)) {
|
||||
|
||||
@ -1183,7 +1183,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
$lastid = $this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def", "rowid");
|
||||
|
||||
foreach ($pos_name as $key2 => $val2) {
|
||||
//print 'key2='.$key2.'-val2='.$val2."<br>\n";
|
||||
//print 'key2='.$key2.'-val2='.$val2."<br>\n";
|
||||
if ($enabledbydefaulton && $val2 != $enabledbydefaulton) {
|
||||
continue; // Not enabled by default onto this page.
|
||||
}
|
||||
@ -1202,8 +1202,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
if (!$err) {
|
||||
$this->db->commit();
|
||||
} else {
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
}
|
||||
}
|
||||
// else box already registered into database
|
||||
|
||||
@ -192,8 +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')
|
||||
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
|
||||
@ -399,19 +403,17 @@ class modAdherent extends DolibarrModules
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
//ODT template
|
||||
// ODT template
|
||||
/*
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt';
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/orders';
|
||||
$dest=$dirodt.'/template_order.odt';
|
||||
|
||||
if (file_exists($src) && ! file_exists($dest))
|
||||
{
|
||||
if (file_exists($src) && ! file_exists($dest)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_mkdir($dirodt);
|
||||
$result=dol_copy($src,$dest,0,0);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
|
||||
return 0;
|
||||
|
||||
@ -30,7 +30,7 @@ require 'main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
// If not defined, we select menu "home"
|
||||
$_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ?GETPOST('mainmenu', 'aZ09') : 'home';
|
||||
$_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home';
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$hookmanager->initHooks(array('index'));
|
||||
|
||||
@ -18,9 +18,12 @@ BoxLastActions=Latest actions
|
||||
BoxLastContracts=Latest contracts
|
||||
BoxLastContacts=Latest contacts/addresses
|
||||
BoxLastMembers=Latest members
|
||||
BoxLastModifiedMembers=Latest modified members
|
||||
BoxFicheInter=Latest interventions
|
||||
BoxCurrentAccounts=Open accounts balance
|
||||
BoxTitleMemberNextBirthdays=Birthdays of this month (members)
|
||||
BoxTitleMembersByType=Members by type
|
||||
BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year
|
||||
BoxTitleLastRssInfos=Latest %s news from %s
|
||||
BoxTitleLastProducts=Products/Services: last %s modified
|
||||
BoxTitleProductsAlertStock=Products: stock alert
|
||||
@ -87,8 +90,8 @@ BoxTitleLatestModifiedSupplierOrders=Vendor Orders: last %s modified
|
||||
BoxTitleLastModifiedCustomerBills=Customer Invoices: last %s modified
|
||||
BoxTitleLastModifiedCustomerOrders=Sales Orders: last %s modified
|
||||
BoxTitleLastModifiedPropals=Latest %s modified proposals
|
||||
BoxTitleLatestModifiedJobPositions=Latest %s modified jobs
|
||||
BoxTitleLatestModifiedCandidatures=Latest %s modified candidatures
|
||||
BoxTitleLatestModifiedJobPositions=Latest %s modified jobs
|
||||
BoxTitleLatestModifiedCandidatures=Latest %s modified candidatures
|
||||
ForCustomersInvoices=Customers invoices
|
||||
ForCustomersOrders=Customers orders
|
||||
ForProposals=Proposals
|
||||
|
||||
@ -165,9 +165,10 @@ class Products extends DolibarrApi
|
||||
* @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service)
|
||||
* @param int $category Use this param to filter list by category
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)"
|
||||
* @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long)
|
||||
* @return array Array of product objects
|
||||
*/
|
||||
public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '')
|
||||
public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
@ -219,9 +220,13 @@ class Products extends DolibarrApi
|
||||
$i = 0;
|
||||
while ($i < $min) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$product_static = new Product($this->db);
|
||||
if ($product_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = $this->_cleanObjectDatas($product_static);
|
||||
if (!$ids_only) {
|
||||
$product_static = new Product($this->db);
|
||||
if ($product_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = $this->_cleanObjectDatas($product_static);
|
||||
}
|
||||
} else {
|
||||
$obj_ret[] = $obj->rowid;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -1794,24 +1799,24 @@ class Products extends DolibarrApi
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of a product object
|
||||
*
|
||||
* Get properties of 1 product object.
|
||||
* Return an array with product information.
|
||||
*
|
||||
* @param int $id ID of product
|
||||
* @param string $ref Ref of element
|
||||
* @param string $ref_ext Ref ext of element
|
||||
* @param string $barcode Barcode of element
|
||||
* @param int $includestockdata Load also information about stock (slower)
|
||||
* @param bool $includesubproducts Load information about subproducts (if product is a virtual product)
|
||||
* @param bool $includeparentid Load also ID of parent product (if product is a variant of a parent product)
|
||||
* @return array|mixed Data without useless information
|
||||
* @param int $id ID of product
|
||||
* @param string $ref Ref of element
|
||||
* @param string $ref_ext Ref ext of element
|
||||
* @param string $barcode Barcode of element
|
||||
* @param int $includestockdata Load also information about stock (slower)
|
||||
* @param bool $includesubproducts Load information about subproducts (if product is a virtual product)
|
||||
* @param bool $includeparentid Load also ID of parent product (if product is a variant of a parent product)
|
||||
* @param bool $includeifobjectisused Check if product object is used and set is_object_used with result.
|
||||
* @return array|mixed Data without useless information
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 403
|
||||
* @throws RestException 404
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0, $includesubproducts = false, $includeparentid = false)
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $barcode = '', $includestockdata = 0, $includesubproducts = false, $includeparentid = false, $includeifobjectisused = false)
|
||||
{
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($barcode)) {
|
||||
throw new RestException(400, 'bad value for parameter id, ref, ref_ext or barcode');
|
||||
@ -1866,6 +1871,10 @@ class Products extends DolibarrApi
|
||||
}
|
||||
}
|
||||
|
||||
if ($includeifobjectisused) {
|
||||
$this->product->is_object_used = ($this->product->isObjectUsed() > 0);
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->product);
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,10 +92,10 @@ class Product extends CommonObject
|
||||
|
||||
public $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into images.lib.php
|
||||
|
||||
/*
|
||||
* @deprecated
|
||||
* @see label
|
||||
*/
|
||||
/**
|
||||
* @deprecated
|
||||
* @see $label
|
||||
*/
|
||||
public $libelle;
|
||||
|
||||
/**
|
||||
@ -407,6 +407,14 @@ class Product extends CommonObject
|
||||
*/
|
||||
public $supplierprices;
|
||||
|
||||
/**
|
||||
* Property set to save result of isObjectUsed(). Used for example by Product API.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $is_object_used;
|
||||
|
||||
|
||||
/**
|
||||
* @var array fields of object product
|
||||
*/
|
||||
|
||||
@ -156,7 +156,6 @@ if ($action == 'add' && empty($cancel)) {
|
||||
$object->dateep = $dateep;
|
||||
$object->note = GETPOST("note", 'restricthtml');
|
||||
$object->type_payment = ($type_payment > 0 ? $type_payment : 0);
|
||||
$object->num_payment = GETPOST("num_payment", 'alphanohtml');
|
||||
$object->fk_user_author = $user->id;
|
||||
$object->fk_project = $projectid;
|
||||
|
||||
|
||||
@ -64,7 +64,6 @@ class Salary extends CommonObject
|
||||
public $fk_project;
|
||||
|
||||
public $type_payment;
|
||||
public $num_payment;
|
||||
|
||||
/**
|
||||
* @var string salary payments label
|
||||
@ -141,7 +140,6 @@ class Salary extends CommonObject
|
||||
$sql .= " amount=".price2num($this->amount).",";
|
||||
$sql .= " fk_projet=".((int) $this->fk_project).",";
|
||||
$sql .= " fk_typepayment=".$this->type_payment.",";
|
||||
$sql .= " num_payment='".$this->db->escape($this->num_payment)."',";
|
||||
$sql .= " label='".$this->db->escape($this->label)."',";
|
||||
$sql .= " datesp='".$this->db->idate($this->datesp)."',";
|
||||
$sql .= " dateep='".$this->db->idate($this->dateep)."',";
|
||||
@ -206,7 +204,6 @@ class Salary extends CommonObject
|
||||
$sql .= " s.amount,";
|
||||
$sql .= " s.fk_projet as fk_project,";
|
||||
$sql .= " s.fk_typepayment,";
|
||||
$sql .= " s.num_payment,";
|
||||
$sql .= " s.label,";
|
||||
$sql .= " s.datesp,";
|
||||
$sql .= " s.dateep,";
|
||||
@ -238,7 +235,6 @@ class Salary extends CommonObject
|
||||
$this->amount = $obj->amount;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->type_payment = $obj->fk_typepayment;
|
||||
$this->num_payment = $obj->num_payment;
|
||||
$this->label = $obj->label;
|
||||
$this->datesp = $this->db->jdate($obj->datesp);
|
||||
$this->dateep = $this->db->jdate($obj->dateep);
|
||||
@ -393,7 +389,6 @@ class Salary extends CommonObject
|
||||
$sql .= ", salary";
|
||||
$sql .= ", fk_typepayment";
|
||||
$sql .= ", fk_account";
|
||||
$sql .= ", num_payment";
|
||||
if ($this->note) $sql .= ", note";
|
||||
$sql .= ", label";
|
||||
$sql .= ", datesp";
|
||||
@ -412,7 +407,6 @@ class Salary extends CommonObject
|
||||
$sql .= ", ".($this->salary > 0 ? $this->salary : "null");
|
||||
$sql .= ", ".($this->type_payment > 0 ? $this->type_payment : 0);
|
||||
$sql .= ", ".($this->accountid > 0 ? $this->accountid : "null");
|
||||
$sql .= ", '".$this->db->escape($this->num_payment)."'";
|
||||
if ($this->note) $sql .= ", '".$this->db->escape($this->note)."'";
|
||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||
$sql .= ", '".$this->db->idate($this->datesp)."'";
|
||||
|
||||
@ -570,7 +570,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
}
|
||||
|
||||
// Type
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018 Pierre Chéné <pierre.chene44@gmail.com>
|
||||
* Copyright (C) 2019 Cedric Ancelin <icedo.anc@gmail.com>
|
||||
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020-2021 Frédéric 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
|
||||
@ -1845,7 +1845,7 @@ class Thirdparties extends DolibarrApi
|
||||
if (!DolibarrApiAccess::$user->rights->societe->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if ($rowid == 0) {
|
||||
if ($rowid === 0) {
|
||||
$result = $this->company->initAsSpecimen();
|
||||
} else {
|
||||
$result = $this->company->fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias);
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$hookmanager = new HookManager($db);
|
||||
|
||||
@ -47,6 +48,25 @@ $result = restrictedArea($user, 'societe', 0, '', '', '', '');
|
||||
|
||||
$thirdparty_static = new Societe($db);
|
||||
|
||||
if (!isset($form) || !is_object($form)) {
|
||||
$form = new Form($db);
|
||||
}
|
||||
// Load $resultboxes
|
||||
$resultboxes = FormOther::getBoxesArea($user, "3");
|
||||
|
||||
if (GETPOST('addbox')) {
|
||||
// Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("BoxAdded"), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -56,11 +76,8 @@ $transAreaType = $langs->trans("ThirdPartiesArea");
|
||||
$helpurl = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Terceros';
|
||||
|
||||
llxHeader("", $langs->trans("ThirdParties"), $helpurl);
|
||||
$linkback = '';
|
||||
print load_fiche_titre($transAreaType, $linkback, 'companies');
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print load_fiche_titre($transAreaType, $resultboxes['selectboxlist'], 'companies');
|
||||
|
||||
|
||||
/*
|
||||
@ -115,11 +132,11 @@ if ($result) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">'."\n";
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||
$thirdpartygraph = '<div class="div-table-responsive-no-min">';
|
||||
$thirdpartygraph .= '<table class="noborder nohover centpercent">'."\n";
|
||||
$thirdpartygraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||
if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + (round($third['customer']) ? 1 : 0) + (round($third['supplier']) ? 1 : 0) + (round($third['other']) ? 1 : 0) >= 2)) {
|
||||
print '<tr><td class="center" colspan="2">';
|
||||
$thirdpartygraph .= '<tr><td class="center" colspan="2">';
|
||||
$dataseries = array();
|
||||
if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
|
||||
$dataseries[] = array($langs->trans("Prospects"), round($third['prospect']));
|
||||
@ -141,8 +158,8 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) +
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphthirdparties');
|
||||
print $dolgraph->show();
|
||||
print '</td></tr>'."\n";
|
||||
$thirdpartygraph .= $dolgraph->show();
|
||||
$thirdpartygraph .= '</td></tr>'."\n";
|
||||
} else {
|
||||
if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) {
|
||||
$statstring = "<tr>";
|
||||
@ -159,25 +176,23 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) +
|
||||
$statstring2 .= '<td><a href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("Suppliers").'</a></td><td class="right">'.round($third['supplier']).'</td>';
|
||||
$statstring2 .= "</tr>";
|
||||
}
|
||||
print $statstring;
|
||||
print $statstring2;
|
||||
$thirdpartygraph .= $statstring;
|
||||
$thirdpartygraph .= $statstring2;
|
||||
}
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("UniqueThirdParties").'</td><td class="right">';
|
||||
print $total;
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
$thirdpartygraph .= '<tr class="liste_total"><td>'.$langs->trans("UniqueThirdParties").'</td><td class="right">';
|
||||
$thirdpartygraph .= $total;
|
||||
$thirdpartygraph .= '</td></tr>';
|
||||
$thirdpartygraph .= '</table>';
|
||||
$thirdpartygraph .= '</div>';
|
||||
|
||||
if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$elementtype = 'societe';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
|
||||
print '<tr><td class="center" colspan="2">';
|
||||
$thirdpartycateggraph .= '<div class="div-table-responsive-no-min">';
|
||||
$thirdpartycateggraph .= '<table class="noborder nohover centpercent">';
|
||||
$thirdpartycateggraph .= '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Categories").'</th></tr>';
|
||||
$thirdpartycateggraph .= '<tr><td class="center" colspan="2">';
|
||||
$sql = "SELECT c.label, count(*) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
|
||||
@ -218,27 +233,25 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphcateg');
|
||||
print $dolgraph->show();
|
||||
$thirdpartycateggraph .= $dolgraph->show();
|
||||
} else {
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven"><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
|
||||
$thirdpartycateggraph .= '<tr class="oddeven"><td>'.$obj->label.'</td><td>'.$obj->nb.'</td></tr>';
|
||||
$total += $obj->nb;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
|
||||
print $total;
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
$thirdpartycateggraph .= '</td></tr>';
|
||||
$thirdpartycateggraph .= '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
|
||||
$thirdpartycateggraph .= $total;
|
||||
$thirdpartycateggraph .= '</td></tr>';
|
||||
$thirdpartycateggraph .= '</table>';
|
||||
$thirdpartycateggraph .= '</div>';
|
||||
}
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
/*
|
||||
* Latest modified third parties
|
||||
@ -279,14 +292,14 @@ if ($result) {
|
||||
if ($num > 0) {
|
||||
$transRecordedType = $langs->trans("LastModifiedThirdParties", $max);
|
||||
|
||||
print "\n<!-- last thirdparties modified -->\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
$lastmodified = "\n<!-- last thirdparties modified -->\n";
|
||||
$lastmodified .= '<div class="div-table-responsive-no-min">';
|
||||
$lastmodified .= '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre"><th colspan="2">'.$transRecordedType.'</th>';
|
||||
print '<th> </th>';
|
||||
print '<th class="right"><a href="'.DOL_URL_ROOT.'/societe/list.php?sortfield=s.tms&sortorder=DESC">'.$langs->trans("FullList").'</th>';
|
||||
print '</tr>'."\n";
|
||||
$lastmodified .= '<tr class="liste_titre"><th colspan="2">'.$transRecordedType.'</th>';
|
||||
$lastmodified .= '<th> </th>';
|
||||
$lastmodified .= '<th class="right"><a href="'.DOL_URL_ROOT.'/societe/list.php?sortfield=s.tms&sortorder=DESC">'.$langs->trans("FullList").'</th>';
|
||||
$lastmodified .= '</tr>'."\n";
|
||||
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
@ -306,37 +319,63 @@ if ($result) {
|
||||
$thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdparty_static->code_compta = $objp->code_compta;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
$lastmodified .= '<tr class="oddeven">';
|
||||
// Name
|
||||
print '<td class="nowrap tdoverflowmax200">';
|
||||
print $thirdparty_static->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
$lastmodified .= '<td class="nowrap tdoverflowmax200">';
|
||||
$lastmodified .= $thirdparty_static->getNomUrl(1);
|
||||
$lastmodified .= "</td>\n";
|
||||
// Type
|
||||
print '<td class="center">';
|
||||
print $thirdparty_static->getTypeUrl();
|
||||
print '</td>';
|
||||
$lastmodified .= '<td class="center">';
|
||||
$lastmodified .= $thirdparty_static->getTypeUrl();
|
||||
$lastmodified .= '</td>';
|
||||
// Last modified date
|
||||
print '<td class="right tddate">';
|
||||
print dol_print_date($thirdparty_static->date_modification, 'day');
|
||||
print "</td>";
|
||||
print '<td class="right nowrap">';
|
||||
print $thirdparty_static->getLibStatut(3);
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
$lastmodified .= '<td class="right tddate">';
|
||||
$lastmodified .= dol_print_date($thirdparty_static->date_modification, 'day');
|
||||
$lastmodified .= "</td>";
|
||||
$lastmodified .= '<td class="right nowrap">';
|
||||
$lastmodified .= $thirdparty_static->getLibStatut(3);
|
||||
$lastmodified .= "</td>";
|
||||
$lastmodified .= "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
print "<!-- End last thirdparties modified -->\n";
|
||||
$lastmodified .= "</table>\n";
|
||||
$lastmodified .= '</div>';
|
||||
$lastmodified .= "<!-- End last thirdparties modified -->\n";
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</div></div></div>';
|
||||
//print '</div></div></div>';
|
||||
|
||||
// boxes
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<div class="fichecenter fichecenterbis">';
|
||||
|
||||
$boxlist = '<div class="twocolumns">';
|
||||
|
||||
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
|
||||
$boxlist .= $thirdpartygraph;
|
||||
$boxlist .= '<br>';
|
||||
$boxlist .= $thirdpartycateggraph;
|
||||
$boxlist .= '<br>';
|
||||
$boxlist .= $resultboxes['boxlista'];
|
||||
$boxlist .= '</div>'."\n";
|
||||
|
||||
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
$boxlist .= $lastmodified;
|
||||
$boxlist .= '<br>';
|
||||
$boxlist .= $resultboxes['boxlistb'];
|
||||
$boxlist .= '</div>'."\n";
|
||||
|
||||
$boxlist .= '</div>';
|
||||
|
||||
print $boxlist;
|
||||
|
||||
print '</div>';
|
||||
|
||||
$parameters = array('user' => $user);
|
||||
$reshook = $hookmanager->executeHooks('dashboardThirdparties', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@ -1829,7 +1829,7 @@ div.fichehalfleft {
|
||||
print "float: ".$left.";\n";
|
||||
} ?>
|
||||
<?php if ($conf->browser->layout != 'phone') {
|
||||
print "width: calc(50% - 10px);\n";
|
||||
print "width: calc(50% - 14px);\n";
|
||||
} ?>
|
||||
}
|
||||
div.fichehalfright {
|
||||
@ -1837,7 +1837,7 @@ div.fichehalfright {
|
||||
print "float: ".$right.";\n";
|
||||
} ?>
|
||||
<?php if ($conf->browser->layout != 'phone') {
|
||||
print "width: calc(50% - 10px);\n";
|
||||
print "width: calc(50% - 14px);\n";
|
||||
} ?>
|
||||
}
|
||||
div.fichehalfright {
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userhome'; // To manage different context of search
|
||||
|
||||
@ -52,7 +53,24 @@ $fuserstatic = new User($db);
|
||||
|
||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
|
||||
$hookmanager->initHooks(array('userhome'));
|
||||
if (!isset($form) || !is_object($form)) {
|
||||
$form = new Form($db);
|
||||
}
|
||||
// Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
$resultboxes = FormOther::getBoxesArea($user, "1");
|
||||
|
||||
if (GETPOST('addbox')) {
|
||||
// Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("BoxAdded"), null);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -61,40 +79,35 @@ $hookmanager->initHooks(array('userhome'));
|
||||
llxHeader();
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("MenuUsersAndGroups"), '', 'user');
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print load_fiche_titre($langs->trans("MenuUsersAndGroups"), $resultboxes['selectboxlist'], 'user');
|
||||
|
||||
|
||||
// Search User
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$searchbox = '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||
$searchbox .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr><td>';
|
||||
print $langs->trans("User").':</td><td><input class="flat inputsearch" type="text" name="search_user" size="18"></td></tr>';
|
||||
$searchbox .= '<table class="noborder nohover centpercent">';
|
||||
$searchbox .= '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Search").'</td></tr>';
|
||||
$searchbox .= '<tr><td>';
|
||||
$searchbox .= $langs->trans("User").':</td><td><input class="flat inputsearch" type="text" name="search_user" size="18"></td></tr>';
|
||||
|
||||
// Search Group
|
||||
if ($canreadperms) {
|
||||
print '<tr><td>';
|
||||
print $langs->trans("Group").':</td><td><input class="flat inputsearch" type="text" name="search_group" size="18"></td></tr>';
|
||||
$searchbox .= '<tr><td>';
|
||||
$searchbox .= $langs->trans("Group").':</td><td><input class="flat inputsearch" type="text" name="search_group" size="18"></td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td class="center" colspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print "</table><br>\n";
|
||||
$searchbox .= '<tr><td class="center" colspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
$searchbox .= "</table><br>\n";
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
$searchbox .= '</form>';
|
||||
|
||||
|
||||
/*
|
||||
* Latest created users
|
||||
*/
|
||||
$max = 10;
|
||||
|
||||
$lastcreatedbox = '';
|
||||
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_soc, u.datec, u.statut";
|
||||
$sql .= ", u.entity";
|
||||
$sql .= ", u.ldap_sid";
|
||||
@ -124,11 +137,11 @@ $resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("LastUsersCreated", min($num, $max)).'</td>';
|
||||
print '<td class="right" colspan="2"><a class="commonlink" href="'.DOL_URL_ROOT.'/user/list.php?sortfield=u.datec&sortorder=DESC">'.$langs->trans("FullList").'</td>';
|
||||
print '</tr>'."\n";
|
||||
$lastcreatedbox .='<div class="div-table-responsive-no-min">';
|
||||
$lastcreatedbox .='<table class="noborder centpercent">';
|
||||
$lastcreatedbox .='<tr class="liste_titre"><td colspan="3">'.$langs->trans("LastUsersCreated", min($num, $max)).'</td>';
|
||||
$lastcreatedbox .='<td class="right" colspan="2"><a class="commonlink" href="'.DOL_URL_ROOT.'/user/list.php?sortfield=u.datec&sortorder=DESC">'.$langs->trans("FullList").'</td>';
|
||||
$lastcreatedbox .='</tr>'."\n";
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num && $i < $max) {
|
||||
@ -149,24 +162,24 @@ if ($resql) {
|
||||
$companystatic->code_client = $obj->code_client;
|
||||
$companystatic->canvas = $obj->canvas;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
print $fuserstatic->getNomUrl(-1);
|
||||
$lastcreatedbox .='<tr class="oddeven">';
|
||||
$lastcreatedbox .='<td class="nowraponall">';
|
||||
$lastcreatedbox .=$fuserstatic->getNomUrl(-1);
|
||||
if (!empty($conf->multicompany->enabled) && $obj->admin && !$obj->entity) {
|
||||
print img_picto($langs->trans("SuperAdministrator"), 'redstar');
|
||||
$lastcreatedbox .=img_picto($langs->trans("SuperAdministrator"), 'redstar');
|
||||
} elseif ($obj->admin) {
|
||||
print img_picto($langs->trans("Administrator"), 'star');
|
||||
$lastcreatedbox .=img_picto($langs->trans("Administrator"), 'star');
|
||||
}
|
||||
print "</td>";
|
||||
print '<td>'.$obj->login.'</td>';
|
||||
print "<td>";
|
||||
$lastcreatedbox .="</td>";
|
||||
$lastcreatedbox .='<td>'.$obj->login.'</td>';
|
||||
$lastcreatedbox .="<td>";
|
||||
if ($obj->fk_soc) {
|
||||
print $companystatic->getNomUrl(1);
|
||||
$lastcreatedbox .=$companystatic->getNomUrl(1);
|
||||
} else {
|
||||
print $langs->trans("InternalUser");
|
||||
$lastcreatedbox .=$langs->trans("InternalUser");
|
||||
}
|
||||
if ($obj->ldap_sid) {
|
||||
print ' ('.$langs->trans("DomainUser").')';
|
||||
$lastcreatedbox .=' ('.$langs->trans("DomainUser").')';
|
||||
}
|
||||
|
||||
$entity = $obj->entity;
|
||||
@ -180,19 +193,19 @@ if ($resql) {
|
||||
$entitystring = $mc->label;
|
||||
}
|
||||
}
|
||||
print ($entitystring ? ' ('.$entitystring.')' : '');
|
||||
$lastcreatedbox .=($entitystring ? ' ('.$entitystring.')' : '');
|
||||
|
||||
print '</td>';
|
||||
print '<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour').'</td>';
|
||||
print '<td class="right">';
|
||||
print $fuserstatic->getLibStatut(3);
|
||||
print '</td>';
|
||||
$lastcreatedbox .='</td>';
|
||||
$lastcreatedbox .='<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec), 'dayhour').'</td>';
|
||||
$lastcreatedbox .='<td class="right">';
|
||||
$lastcreatedbox .=$fuserstatic->getLibStatut(3);
|
||||
$lastcreatedbox .='</td>';
|
||||
|
||||
print '</tr>';
|
||||
$lastcreatedbox .='</tr>';
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print "</div><br>";
|
||||
$lastcreatedbox .="</table>";
|
||||
$lastcreatedbox .="</div><br>";
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
@ -203,6 +216,7 @@ if ($resql) {
|
||||
/*
|
||||
* Last groups created
|
||||
*/
|
||||
$lastgroupbox = '';
|
||||
if ($canreadperms) {
|
||||
$max = 5;
|
||||
|
||||
@ -224,11 +238,11 @@ if ($canreadperms) {
|
||||
}
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td colspan="'.$colspan.'">'.$langs->trans("LastGroupsCreated", ($num ? $num : $max)).'</td>';
|
||||
print '<td class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/user/group/list.php?sortfield=g.datec&sortorder=DESC">'.$langs->trans("FullList").'</td>';
|
||||
print '</tr>';
|
||||
$lastgroupbox .='<div class="div-table-responsive-no-min">';
|
||||
$lastgroupbox .='<table class="noborder centpercent">';
|
||||
$lastgroupbox .='<tr class="liste_titre"><td colspan="'.$colspan.'">'.$langs->trans("LastGroupsCreated", ($num ? $num : $max)).'</td>';
|
||||
$lastgroupbox .='<td class="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/user/group/list.php?sortfield=g.datec&sortorder=DESC">'.$langs->trans("FullList").'</td>';
|
||||
$lastgroupbox .='</tr>';
|
||||
$i = 0;
|
||||
|
||||
$grouptemp = new UserGroup($db);
|
||||
@ -240,25 +254,25 @@ if ($canreadperms) {
|
||||
$grouptemp->name = $obj->name;
|
||||
$grouptemp->note = $obj->note;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $grouptemp->getNomUrl(1);
|
||||
$lastgroupbox .='<tr class="oddeven">';
|
||||
$lastgroupbox .='<td>';
|
||||
$lastgroupbox .=$grouptemp->getNomUrl(1);
|
||||
if (!$obj->entity) {
|
||||
print img_picto($langs->trans("GlobalGroup"), 'redstar');
|
||||
$lastgroupbox .=img_picto($langs->trans("GlobalGroup"), 'redstar');
|
||||
}
|
||||
print "</td>";
|
||||
$lastgroupbox .="</td>";
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
|
||||
$mc->getInfo($obj->entity);
|
||||
print '<td>';
|
||||
print $mc->label;
|
||||
print '</td>';
|
||||
$lastgroupbox .='<td>';
|
||||
$lastgroupbox .=$mc->label;
|
||||
$lastgroupbox .='</td>';
|
||||
}
|
||||
print '<td class="nowrap right">'.dol_print_date($db->jdate($obj->datec), 'dayhour').'</td>';
|
||||
print "</tr>";
|
||||
$lastgroupbox .='<td class="nowrap right">'.dol_print_date($db->jdate($obj->datec), 'dayhour').'</td>';
|
||||
$lastgroupbox .="</tr>";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print "</div><br>";
|
||||
$lastgroupbox .= "</table>";
|
||||
$lastgroupbox .= "</div><br>";
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
@ -266,7 +280,28 @@ if ($canreadperms) {
|
||||
}
|
||||
}
|
||||
|
||||
print '</div></div></div>';
|
||||
// boxes
|
||||
print '<div class="clearboth"></div>';
|
||||
print '<div class="fichecenter fichecenterbis">';
|
||||
|
||||
$boxlist = '<div class="twocolumns">';
|
||||
|
||||
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
|
||||
$boxlist .= $searchbox;
|
||||
$boxlist .= $resultboxes['boxlista'];
|
||||
$boxlist .= '</div>'."\n";
|
||||
|
||||
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
$boxlist .= $lastcreatedbox;
|
||||
$boxlist .= $lastgroupbox;
|
||||
$boxlist .= $resultboxes['boxlistb'];
|
||||
$boxlist .= '</div>'."\n";
|
||||
|
||||
$boxlist .= '</div>';
|
||||
|
||||
print $boxlist;
|
||||
|
||||
print '</div>';
|
||||
|
||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
|
||||
$parameters = array('user' => $user);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user