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 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
79 $staticmember =
new Adherent($this->db);
83 $this->info_box_head = array(
'text' => $langs->trans(
"LastSubscriptionsModified", $max));
85 if ($user->hasRight(
'adherent',
'lire')) {
86 $sql =
"SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
87 $sql .=
" a.gender, a.email, a.photo, a.morphy,";
88 $sql .=
" a.datefin as date_end_subscription,";
89 $sql .=
" ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription,";
90 $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";
91 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as a, ".MAIN_DB_PREFIX.
"adherent_type as ta, ".MAIN_DB_PREFIX.
"subscription as c";
92 $sql .=
" WHERE a.entity IN (".getEntity(
'adherent').
")";
93 $sql .=
" AND a.fk_adherent_type = ta.rowid";
94 $sql .=
" AND c.fk_adherent = a.rowid";
95 $sql .= $this->db->order(
"c.tms",
"DESC");
96 $sql .= $this->db->plimit($max, 0);
98 $result = $this->db->query($sql);
100 $num = $this->db->num_rows($result);
103 while ($line < $num) {
104 $obj = $this->db->fetch_object($result);
105 $staticmember->id = $obj->rowid;
106 $staticmember->ref = $obj->rowid;
107 $staticmember->lastname = $obj->lastname;
108 $staticmember->firstname = $obj->firstname;
109 $staticmember->gender = $obj->gender;
110 $staticmember->email = $obj->email;
111 $staticmember->photo = $obj->photo;
112 $staticmember->morphy = $obj->morphy;
113 $staticmember->status = $obj->status;
114 $staticmember->need_subscription = $obj->need_subscription;
115 $staticmember->datefin = $this->db->jdate($obj->date_end_subscription);
116 if (!empty($obj->fk_soc)) {
117 $staticmember->fk_soc = $obj->fk_soc;
118 $staticmember->fetch_thirdparty();
119 $staticmember->name = $staticmember->thirdparty->name;
121 $staticmember->name = $obj->company;
124 $subscriptionstatic->id = $obj->cid;
125 $subscriptionstatic->ref = $obj->cid;
127 $this->info_box_contents[$line][] = array(
128 'td' =>
'class="tdoverflowmax100 maxwidth100onsmartphone"',
129 'text' => $subscriptionstatic->getNomUrl(1),
133 $this->info_box_contents[$line][] = array(
134 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
135 'text' => $staticmember->getNomUrl(-1, 32,
'card'),
139 $daterange =
get_date_range($this->db->jdate($obj->date_start), $this->db->jdate($obj->date_end));
140 $this->info_box_contents[$line][] = array(
141 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone" title="'.
dol_escape_htmltag($daterange).
'"',
142 'text' => $daterange,
145 $this->info_box_contents[$line][] = array(
146 'td' =>
'class="nowraponall right amount" width="18"',
147 'text' =>
price($obj->subscription),
150 $this->info_box_contents[$line][] = array(
151 'td' =>
'class="right tdoverflowmax150 maxwidth150onsmartphone" title="'.
dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($obj->datem,
'dayhour',
'tzuserrel')).
'"',
152 'text' =>
dol_print_date($this->db->jdate($obj->datem ? $obj->datem : $obj->datec),
'dayhour',
'tzuserrel'),
159 $this->info_box_contents[$line][0] = array(
160 'td' =>
'class="center"',
161 'text'=>
'<span class="opacitymedium">'.$langs->trans(
"NoRecordedMembers").
'</span>',
165 $this->db->free($result);
167 $this->info_box_contents[0][0] = array(
170 'text' => ($this->db->error().
' sql='.$sql),
174 $this->info_box_contents[0][0] = array(
175 'td' =>
'class="nohover left"',
176 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'