75 global $user, $langs,
$conf;
76 $langs->load(
"boxes");
80 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
81 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
82 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
83 $staticmember =
new Adherent($this->db);
87 $this->info_box_head = array(
'text' => $langs->trans(
"LastSubscriptionsModified", $max));
89 if ($user->hasRight(
'adherent',
'lire')) {
90 $sql =
"SELECT a.rowid, a.statut as status, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
91 $sql .=
" a.gender, a.email, a.photo, a.morphy,";
92 $sql .=
" a.datefin as date_end_subscription,";
93 $sql .=
" ta.rowid as typeid, ta.libelle as label, ta.subscription as need_subscription,";
94 $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";
95 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as a, ".MAIN_DB_PREFIX.
"adherent_type as ta, ".MAIN_DB_PREFIX.
"subscription as c";
96 $sql .=
" WHERE a.entity IN (".getEntity(
'adherent').
")";
97 $sql .=
" AND a.fk_adherent_type = ta.rowid";
98 $sql .=
" AND c.fk_adherent = a.rowid";
99 $sql .= $this->db->order(
"c.tms",
"DESC");
100 $sql .= $this->db->plimit($max, 0);
102 $result = $this->db->query($sql);
104 $num = $this->db->num_rows($result);
107 while ($line < $num) {
108 $obj = $this->db->fetch_object($result);
109 $staticmember->id = $obj->rowid;
110 $staticmember->ref = $obj->rowid;
111 $staticmember->lastname = $obj->lastname;
112 $staticmember->firstname = $obj->firstname;
113 $staticmember->gender = $obj->gender;
114 $staticmember->email = $obj->email;
115 $staticmember->photo = $obj->photo;
116 $staticmember->morphy = $obj->morphy;
117 $staticmember->status = $obj->status;
118 $staticmember->need_subscription = $obj->need_subscription;
119 $staticmember->datefin = $this->db->jdate($obj->date_end_subscription);
120 if (!empty($obj->fk_soc)) {
121 $staticmember->fk_soc = $obj->fk_soc;
122 $staticmember->fetch_thirdparty();
123 $staticmember->name = $staticmember->thirdparty->name;
125 $staticmember->name = $obj->company;
128 $subscriptionstatic->id = $obj->cid;
129 $subscriptionstatic->ref = $obj->cid;
131 $this->info_box_contents[$line][] = array(
132 'td' =>
'class="tdoverflowmax100 maxwidth100onsmartphone"',
133 'text' => $subscriptionstatic->getNomUrl(1),
137 $this->info_box_contents[$line][] = array(
138 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
139 'text' => $staticmember->getNomUrl(-1, 32,
'card'),
143 $daterange =
get_date_range($this->db->jdate($obj->date_start), $this->db->jdate($obj->date_end));
144 $this->info_box_contents[$line][] = array(
145 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone" title="'.
dol_escape_htmltag($daterange).
'"',
146 'text' => $daterange,
149 $this->info_box_contents[$line][] = array(
150 'td' =>
'class="nowraponall right amount" width="18"',
151 'text' =>
price($obj->subscription),
154 $this->info_box_contents[$line][] = array(
155 'td' =>
'class="right tdoverflowmax150 maxwidth150onsmartphone" title="'.
dol_escape_htmltag($langs->trans(
"DateModification").
': '.
dol_print_date($obj->datem,
'dayhour',
'tzuserrel')).
'"',
156 'text' =>
dol_print_date($this->db->jdate($obj->datem ? $obj->datem : $obj->datec),
'dayhour',
'tzuserrel'),
163 $this->db->free($result);
165 $this->info_box_contents[0][0] = array(
168 'text' => ($this->db->error().
' sql='.$sql),
172 $this->info_box_contents[0][0] = array(
173 'td' =>
'class="nohover left"',
174 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'