71 global $user, $langs, $conf;
72 $langs->load(
"boxes");
76 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
77 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
78 $memberstatic =
new Adherent($this->db);
81 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleLastModifiedMembers", $max));
83 if ($user->hasRight(
'adherent',
'lire')) {
84 $sql =
"SELECT a.rowid, a.ref, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
85 $sql .=
" a.datec, a.tms as datem, a.statut as status, a.datefin as date_end_subscription,";
86 $sql .=
' a.photo, a.email, a.gender, a.morphy,';
87 $sql .=
" t.rowid as typeid, t.subscription, t.libelle as label";
88 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as a, ".MAIN_DB_PREFIX.
"adherent_type as t";
89 $sql .=
" WHERE a.entity IN (".getEntity(
'member').
")";
90 $sql .=
" AND a.fk_adherent_type = t.rowid";
91 $sql .=
" ORDER BY a.tms DESC";
92 $sql .= $this->db->plimit($max, 0);
94 $result = $this->db->query($sql);
96 $num = $this->db->num_rows($result);
99 while ($line < $num) {
100 $objp = $this->db->fetch_object($result);
101 $datec = $this->db->jdate($objp->datec);
102 $datem = $this->db->jdate($objp->datem);
104 $memberstatic->lastname = $objp->lastname;
105 $memberstatic->firstname = $objp->firstname;
106 $memberstatic->id = $objp->rowid;
107 $memberstatic->ref = $objp->ref;
108 $memberstatic->photo = $objp->photo;
109 $memberstatic->gender = $objp->gender;
110 $memberstatic->email = $objp->email;
111 $memberstatic->morphy = $objp->morphy;
112 $memberstatic->company = $objp->company;
113 $memberstatic->status = $objp->status;
114 $memberstatic->date_creation = $datec;
115 $memberstatic->date_modification = $datem;
116 $memberstatic->need_subscription = $objp->subscription;
117 $memberstatic->datefin = $this->db->jdate($objp->date_end_subscription);
118 if (!empty($objp->fk_soc)) {
119 $memberstatic->socid = $objp->fk_soc;
120 $memberstatic->fetch_thirdparty();
121 $memberstatic->name = $memberstatic->thirdparty->name;
123 $memberstatic->name = $objp->company;
125 $statictype->id = $objp->typeid;
126 $statictype->label = $objp->label;
127 $statictype->subscription = $objp->subscription;
129 $this->info_box_contents[$line][] = array(
130 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
131 'text' => $memberstatic->getNomUrl(-1),
135 $this->info_box_contents[$line][] = array(
136 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
137 'text' =>$memberstatic->company,
140 $this->info_box_contents[$line][] = array(
141 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
142 'text' => $statictype->getNomUrl(1, 32),
146 $this->info_box_contents[$line][] = array(
151 $this->info_box_contents[$line][] = array(
152 'td' =>
'class="right" width="18"',
153 'text' => $memberstatic->LibStatut($objp->status, $objp->subscription, $this->db->jdate($objp->date_end_subscription), 3),
160 $this->info_box_contents[$line][0] = array(
161 'td' =>
'class="center"',
162 'text'=>$langs->trans(
"NoRecordedCustomers"),
166 $this->db->free($result);
168 $this->info_box_contents[0][0] = array(
171 'text' => ($this->db->error().
' sql='.$sql),
175 $this->info_box_contents[0][0] = array(
176 'td' =>
'class="nohover left"',
177 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'