65 $listofmodulesforexternal = explode(
',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
66 if (!in_array(
'adherent', $listofmodulesforexternal) && !empty($user->socid)) {
70 $this->hidden = !(isModEnabled(
'adherent') && $user->hasRight(
'adherent',
'lire'));
81 global $user, $langs, $conf;
82 $langs->loadLangs(array(
"boxes",
"members"));
86 include_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent.class.php';
87 require_once DOL_DOCUMENT_ROOT .
'/adherents/class/adherent_type.class.php';
88 $memberstatic =
new Adherent($this->db);
91 $this->info_box_head = array(
'text' => $langs->trans(
"BoxTitleMembersSubscriptionsByYear", $max));
93 if ($user->hasRight(
'adherent',
'lire')) {
102 $sql =
"SELECT c.subscription, c.dateadh as dateh";
103 $sql .=
" FROM " . MAIN_DB_PREFIX .
"adherent as d, " . MAIN_DB_PREFIX .
"subscription as c";
104 $sql .=
" WHERE d.entity IN (" .
getEntity(
'adherent') .
")";
105 $sql .=
" AND d.rowid = c.fk_adherent";
108 $result = $this->db->query($sql);
110 $num = $this->db->num_rows($result);
113 $objp = $this->db->fetch_object($result);
115 $Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
116 $Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
117 $tot += $objp->subscription;
124 $this->info_box_contents[$line][] = array(
126 'text' => $langs->trans(
"Year"),
128 $this->info_box_contents[$line][] = array(
129 'td' =>
'class="right"',
130 'text' => $langs->trans(
"Subscriptions"),
132 $this->info_box_contents[$line][] = array(
133 'td' =>
'class="right"',
134 'text' => $langs->trans(
"AmountTotal"),
136 $this->info_box_contents[$line][] = array(
137 'td' =>
'class="right"',
138 'text' => $langs->trans(
"AmountAverage"),
145 foreach ($Total as $key => $value) {
153 $this->info_box_contents[$line][] = array(
154 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
157 $this->info_box_contents[$line][] = array(
158 'td' =>
'class="right"',
161 $this->info_box_contents[$line][] = array(
162 'td' =>
'class="right"',
165 $this->info_box_contents[$line][] = array(
166 'td' =>
'class="right"',
172 $this->info_box_contents[$line][] = array(
173 'td' =>
'class="tdoverflowmax150 maxwidth150onsmartphone"',
174 'text' =>
'<a href="./subscription/list.php?date_select='.$key.
'">'.$key.
'</a>',
177 $this->info_box_contents[$line][] = array(
178 'td' =>
'class="right"',
179 'text' => $Number[$key],
181 $this->info_box_contents[$line][] = array(
182 'td' =>
'class="nowraponall right amount"',
183 'text' =>
price($value),
185 $this->info_box_contents[$line][] = array(
186 'td' =>
'class="nowraponall right amount"',
193 $this->info_box_contents[$line][0] = array(
194 'td' =>
'colspan="4" class="center"',
195 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"NoRecordedMembers").
'</span>',
198 $this->info_box_contents[$line][] = array(
199 'tr' =>
'class="liste_total"',
200 'td' =>
'class="liste_total"',
201 'text' => $langs->trans(
"Total"),
203 $this->info_box_contents[$line][] = array(
204 'td' =>
'class="liste_total right"',
207 $this->info_box_contents[$line][] = array(
208 'td' =>
'class="liste_total nowraponall right amount"',
209 'text' =>
price($tot),
211 $this->info_box_contents[$line][] = array(
212 'td' =>
'class="liste_total nowraponall right amount"',
217 $this->info_box_contents[0][0] = array(
220 'text' => ($this->db->error() .
' sql=' . $sql),
224 $this->info_box_contents[0][0] = array(
225 'td' =>
'class="nohover opacitymedium left"',
226 'text' => $langs->trans(
"ReadPermissionNotAllowed")