81 global $user, $langs, $conf;
82 $langs->load(
"boxes");
86 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
87 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
88 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
89 $staticmember =
new Adherent($this->db);
93 $this->info_box_head = array(
'text' => $langs->trans(
"LastSubscriptionsModified", $max));
95 if ($user->hasRight(
'adherent',
'lire')) {
96 $sql =
"SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
97 $sql .=
" a.gender, a.email, a.photo, a.morphy,";
98 $sql .=
" a.datefin as date_end_subscription,";
99 $sql .=
" ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription,";
100 $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";
101 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as a, ".MAIN_DB_PREFIX.
"adherent_type as ta, ".MAIN_DB_PREFIX.
"subscription as c";
102 $sql .=
" WHERE a.entity IN (".getEntity(
'adherent').
")";
103 $sql .=
" AND a.fk_adherent_type = ta.rowid";
104 $sql .=
" AND c.fk_adherent = a.rowid";
105 $sql .= $this->db->order(
"c.tms",
"DESC");
106 $sql .= $this->db->plimit($max, 0);
108 $result = $this->db->query($sql);
110 $num = $this->db->num_rows($result);
113 while ($line < $num) {
114 $obj = $this->db->fetch_object($result);
115 $staticmember->id = $obj->rowid;
116 $staticmember->ref = $obj->rowid;
117 $staticmember->lastname = $obj->lastname;
118 $staticmember->firstname = $obj->firstname;
119 $staticmember->gender = $obj->gender;
120 $staticmember->email = $obj->email;
121 $staticmember->photo = $obj->photo;
122 $staticmember->morphy = $obj->morphy;
123 $staticmember->statut = $obj->status;
124 $staticmember->need_subscription = $obj->need_subscription;
125 $staticmember->datefin = $this->db->jdate($obj->date_end_subscription);
126 if (!empty($obj->fk_soc)) {
127 $staticmember->fk_soc = $obj->fk_soc;
128 $staticmember->fetch_thirdparty();
129 $staticmember->name = $staticmember->thirdparty->name;
131 $staticmember->name = $obj->company;
134 $subscriptionstatic->id = $obj->cid;
135 $subscriptionstatic->ref = $obj->cid;
137 $this->info_box_contents[$line][] = array(
138 'td' =>
'class="tdoverflowmax100 maxwidth100onsmartphone"',
139 'text' => $subscriptionstatic->getNomUrl(1),
143 $this->info_box_contents[$line][] = array(
144 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
145 'text' => $staticmember->getNomUrl(-1, 32,
'card'),
149 $daterange =
get_date_range($this->db->jdate($obj->date_start), $this->db->jdate($obj->date_end));
150 $this->info_box_contents[$line][] = array(
151 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone" title="'.
dol_escape_htmltag($daterange).
'"',
152 'text' => $daterange,
155 $this->info_box_contents[$line][] = array(
156 'td' =>
'class="nowraponall right amount" width="18"',
157 'text' =>
price($obj->subscription),
160 $this->info_box_contents[$line][] = array(
161 'td' =>
'class="right tdoverflowmax150 maxwidth150onsmartphone" title="'.
dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($obj->datem,
'dayhour',
'tzuserrel')).
'"',
162 'text' =>
dol_print_date($this->db->jdate($obj->datem ? $obj->datem : $obj->datec),
'dayhour',
'tzuserrel'),
169 $this->info_box_contents[$line][0] = array(
170 'td' =>
'class="center"',
171 'text'=>
'<span class="opacitymedium">'.$langs->trans(
"NoRecordedMembers").
'</span>',
175 $this->db->free($result);
177 $this->info_box_contents[0][0] = array(
180 'text' => ($this->db->error().
' sql='.$sql),
184 $this->info_box_contents[0][0] = array(
185 'td' =>
'class="nohover left"',
186 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'