27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33 $langs->loadLangs(array(
"members",
"companies"));
35 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
36 $massaction =
GETPOST(
'massaction',
'alpha');
37 $show_files =
GETPOST(
'show_files',
'int');
38 $confirm =
GETPOST(
'confirm',
'alpha');
39 $cancel =
GETPOST(
'cancel',
'alpha');
40 $toselect =
GETPOST(
'toselect',
'array');
41 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
42 $backtopage =
GETPOST(
'backtopage',
'alpha');
43 $optioncss =
GETPOST(
'optioncss',
'aZ');
47 $search_ref =
GETPOST(
'search_ref',
'alpha');
48 $search_type =
GETPOST(
'search_type',
'alpha');
49 $search_lastname =
GETPOST(
'search_lastname',
'alpha');
50 $search_firstname =
GETPOST(
'search_firstname',
'alpha');
51 $search_login =
GETPOST(
'search_login',
'alpha');
52 $search_note =
GETPOST(
'search_note',
'alpha');
53 $search_account =
GETPOST(
'search_account',
'int');
54 $search_amount =
GETPOST(
'search_amount',
'alpha');
57 $date_select =
GETPOST(
"date_select",
'alpha');
60 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
61 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
62 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
64 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
68 $offset = $limit * $page;
69 $pageprev = $page - 1;
70 $pagenext = $page + 1;
75 $sortfield =
"c.dateadh";
81 $hookmanager->initHooks(array(
'subscriptionlist'));
84 $extrafields->fetch_name_optionals_label($object->table_element);
86 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
89 $fieldstosearchall = array(
92 'd.ref'=>array(
'label'=>
"Ref",
'checked'=>1),
93 'd.fk_type'=>array(
'label'=>
"Type",
'checked'=>1),
94 'd.lastname'=>array(
'label'=>
"Lastname",
'checked'=>1),
95 'd.firstname'=>array(
'label'=>
"Firstname",
'checked'=>1),
96 'd.login'=>array(
'label'=>
"Login",
'checked'=>1),
97 't.libelle'=>array(
'label'=>
"Label",
'checked'=>1),
98 'd.bank'=>array(
'label'=>
"BankAccount",
'checked'=>1,
'enabled'=>(
isModEnabled(
'banque'))),
101 'c.dateadh'=>array(
'label'=>
"DateSubscription",
'checked'=>1,
'position'=>100),
102 'c.datef'=>array(
'label'=>
"EndSubscription",
'checked'=>1,
'position'=>101),
103 'd.amount'=>array(
'label'=>
"Amount",
'checked'=>1,
'position'=>102),
104 'c.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
105 'c.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
110 $result =
restrictedArea($user,
'adherent',
'',
'',
'cotisation');
112 $permissiontodelete = $user->hasRight(
'adherent',
'cotisation',
'creer');
119 if (
GETPOST(
'cancel',
'alpha')) {
123 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
127 $parameters = array(
'socid'=>isset($socid) ? $socid :
null);
128 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
133 if (empty($reshook)) {
135 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
138 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
141 $search_lastname =
"";
142 $search_firstname =
"";
146 $search_account =
"";
148 $search_array_options = array();
150 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
151 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
156 $objectclass =
'Subscription';
157 $objectlabel =
'Subscription';
158 $uploaddir = $conf->adherent->dir_output;
159 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
170 $accountstatic =
new Account($db);
175 $sql =
"SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo, d.statut,";
176 $sql .=
" d.gender, d.email, d.morphy,";
177 $sql .=
" c.rowid as crowid, c.fk_type, c.subscription,";
178 $sql .=
" c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,";
179 $sql .=
" c.fk_bank as bank, c.note as note_private,";
180 $sql .=
" b.fk_account";
182 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
183 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
184 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
188 $parameters = array();
189 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
190 $sql .= $hookmanager->resPrint;
191 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
195 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent as d";
196 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"subscription as c on d.rowid = c.fk_adherent";
197 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_extrafields as ef on (d.rowid = ef.fk_object)";
198 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON c.fk_bank = b.rowid";
199 $sql .=
" WHERE d.entity IN (".getEntity(
'adherent').
")";
200 if (isset($date_select) && $date_select !=
'') {
201 $sql .=
" AND c.dateadh >= '".((int) $date_select).
"-01-01 00:00:00'";
202 $sql .=
" AND c.dateadh < '".((int) $date_select + 1).
"-01-01 00:00:00'";
205 if (is_numeric($search_ref)) {
206 $sql .=
" AND c.rowid = ".((int) $search_ref);
208 $sql .=
" AND 1 = 2";
214 if ($search_lastname) {
217 if ($search_firstname) {
226 if ($search_account > 0) {
227 $sql .=
" AND b.fk_account = ".((int) $search_account);
229 if ($search_amount) {
236 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
238 $parameters = array();
239 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
240 $sql .= $hookmanager->resPrint;
243 $nbtotalofrecords =
'';
246 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
247 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
248 $resql = $db->query($sqlforcount);
250 $objforcount = $db->fetch_object($resql);
251 $nbtotalofrecords = $objforcount->nbtotalofrecords;
256 if (($page * $limit) > $nbtotalofrecords) {
264 $sql .= $db->order($sortfield, $sortorder);
266 $sql .= $db->plimit($limit + 1, $offset);
269 $resql = $db->query(
$sql);
275 $num = $db->num_rows($resql);
279 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
280 $obj = $db->fetch_object($resql);
282 header(
"Location: ".DOL_URL_ROOT.
'/adherents/subscription/card.php?id='.$id);
289 $title = $langs->trans(
"Subscriptions");
290 if (!empty($date_select)) {
291 $title .=
' ('.$langs->trans(
"Year").
' '.$date_select.
')';
293 $help_url =
'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
297 $arrayofselected = is_array($toselect) ? $toselect : array();
301 $param .=
'&mode='.urlencode($mode);
303 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
304 $param .=
'&contextpage='.urlencode($contextpage);
306 if ($limit > 0 && $limit != $conf->liste_limit) {
307 $param .=
'&limit='.((int) $limit);
310 $param .=
"&statut=".urlencode($statut);
313 $param .=
"&search_type=".urlencode($search_type);
316 $param .=
"&date_select=".urlencode($date_select);
318 if ($search_lastname) {
319 $param .=
"&search_lastname=".urlencode($search_lastname);
322 $param .=
"&search_login=".urlencode($search_login);
324 if ($search_account) {
325 $param .=
"&search_account=".urlencode($search_account);
327 if ($search_amount) {
328 $param .=
"&search_amount=".urlencode($search_amount);
330 if ($optioncss !=
'') {
331 $param .=
'&optioncss='.urlencode($optioncss);
334 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
336 $parameters = array();
337 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
338 $param .= $hookmanager->resPrint;
341 $arrayofmassactions = array(
345 if (!empty($permissiontodelete)) {
346 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
348 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete'))) {
349 $arrayofmassactions = array();
351 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
353 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
354 if ($optioncss !=
'') {
355 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
357 print
'<input type="hidden" name="token" value="'.newToken().
'">';
358 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
359 print
'<input type="hidden" name="action" value="list">';
360 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
361 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
362 print
'<input type="hidden" name="page" value="'.$page.
'">';
363 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
364 print
'<input type="hidden" name="date_select" value="'.$date_select.
'">';
365 print
'<input type="hidden" name="page_y" value="">';
366 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
369 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
370 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
371 if ($user->hasRight(
'adherent',
'cotisation',
'creer')) {
373 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewSubscription'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/adherents/list.php?status=-1,1');
376 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $subscription->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
378 $topicmail =
"Information";
379 $modelmail =
"subscription";
381 $trackid =
'sub'.$object->id;
382 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
386 foreach ($fieldstosearchall as $key => $val) {
387 $fieldstosearchall[$key] = $langs->trans($val);
388 $setupstring .= $key.
"=".$val.
";";
390 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
391 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
399 $parameters = array();
400 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
401 if (empty($reshook)) {
402 $moreforfilter .= $hookmanager->resPrint;
404 $moreforfilter = $hookmanager->resPrint;
407 if (!empty($moreforfilter)) {
408 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
409 print $moreforfilter;
410 $parameters = array();
411 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
412 print $hookmanager->resPrint;
416 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
417 $selectedfields = ($mode !=
'kanban' ?
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
418 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
420 print
'<div class="div-table-responsive">';
421 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
425 print
'<tr class="liste_titre_filter">';
428 print
'<td class="liste_titre center maxwidthsearch">';
429 $searchpicto =
$form->showFilterButtons(
'left');
434 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
435 print
'<td class="liste_titre"> </td>';
439 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
440 print
'<td class="liste_titre left">';
441 print
'<input class="flat maxwidth50" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'"></td>';
445 if (!empty($arrayfields[
'd.fk_type'][
'checked'])) {
446 print
'<td class="liste_titre left">';
447 print
'<input class="flat maxwidth50" type="text" name="search_type" value="'.dol_escape_htmltag($search_type).
'">';
451 if (!empty($arrayfields[
'd.lastname'][
'checked'])) {
452 print
'<td class="liste_titre left">';
453 print
'<input class="flat maxwidth75" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).
'"></td>';
456 if (!empty($arrayfields[
'd.firstname'][
'checked'])) {
457 print
'<td class="liste_titre left">';
458 print
'<input class="flat maxwidth75" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).
'"></td>';
461 if (!empty($arrayfields[
'd.login'][
'checked'])) {
462 print
'<td class="liste_titre left">';
463 print
'<input class="flat maxwidth75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'"></td>';
466 if (!empty($arrayfields[
't.libelle'][
'checked'])) {
467 print
'<td class="liste_titre">';
472 if (!empty($arrayfields[
'd.bank'][
'checked'])) {
473 print
'<td class="liste_titre">';
474 $form->select_comptes($search_account,
'search_account', 0,
'', 1,
'', 0,
'maxwidth100');
478 if (!empty($arrayfields[
'c.dateadh'][
'checked'])) {
479 print
'<td class="liste_titre"> </td>';
482 if (!empty($arrayfields[
'c.datef'][
'checked'])) {
483 print
'<td class="liste_titre"> </td>';
486 if (!empty($arrayfields[
'd.amount'][
'checked'])) {
487 print
'<td class="liste_titre right">';
488 print
'<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).
'" size="4">';
492 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
495 $parameters = array(
'arrayfields'=>$arrayfields);
496 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
497 print $hookmanager->resPrint;
499 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
500 print
'<td class="liste_titre">';
504 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
505 print
'<td class="liste_titre">';
511 print
'<td class="liste_titre center maxwidthsearch">';
512 $searchpicto =
$form->showFilterButtons();
518 $totalarray = array();
519 $totalarray[
'nbfield'] = 0;
523 print
'<tr class="liste_titre">';
526 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'align="center"', $sortfield, $sortorder,
'maxwidthsearch ');
527 $totalarray[
'nbfield']++;
529 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
530 print_liste_field_titre($arrayfields[
'd.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.rowid", $param,
"",
"", $sortfield, $sortorder);
531 $totalarray[
'nbfield']++;
533 if (!empty($arrayfields[
'd.fk_type'][
'checked'])) {
534 print_liste_field_titre($arrayfields[
'd.fk_type'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_type", $param,
"",
"", $sortfield, $sortorder);
535 $totalarray[
'nbfield']++;
537 if (!empty($arrayfields[
'd.lastname'][
'checked'])) {
538 print_liste_field_titre($arrayfields[
'd.lastname'][
'label'], $_SERVER[
"PHP_SELF"],
"d.lastname", $param,
"",
"", $sortfield, $sortorder);
539 $totalarray[
'nbfield']++;
541 if (!empty($arrayfields[
'd.firstname'][
'checked'])) {
542 print_liste_field_titre($arrayfields[
'd.firstname'][
'label'], $_SERVER[
"PHP_SELF"],
"d.firstname", $param,
"",
"", $sortfield, $sortorder);
543 $totalarray[
'nbfield']++;
545 if (!empty($arrayfields[
'd.login'][
'checked'])) {
546 print_liste_field_titre($arrayfields[
'd.login'][
'label'], $_SERVER[
"PHP_SELF"],
"d.login", $param,
"",
"", $sortfield, $sortorder);
547 $totalarray[
'nbfield']++;
549 if (!empty($arrayfields[
't.libelle'][
'checked'])) {
550 print_liste_field_titre($arrayfields[
't.libelle'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note", $param,
"",
'', $sortfield, $sortorder);
551 $totalarray[
'nbfield']++;
553 if (!empty($arrayfields[
'd.bank'][
'checked'])) {
554 print_liste_field_titre($arrayfields[
'd.bank'][
'label'], $_SERVER[
"PHP_SELF"],
"b.fk_account", $param,
"",
"", $sortfield, $sortorder);
555 $totalarray[
'nbfield']++;
557 if (!empty($arrayfields[
'c.dateadh'][
'checked'])) {
558 print_liste_field_titre($arrayfields[
'c.dateadh'][
'label'], $_SERVER[
"PHP_SELF"],
"c.dateadh", $param,
"",
'', $sortfield, $sortorder,
'center nowraponall ');
559 $totalarray[
'nbfield']++;
561 if (!empty($arrayfields[
'c.datef'][
'checked'])) {
562 print_liste_field_titre($arrayfields[
'c.datef'][
'label'], $_SERVER[
"PHP_SELF"],
"c.datef", $param,
"",
'', $sortfield, $sortorder,
'center nowraponall ');
563 $totalarray[
'nbfield']++;
565 if (!empty($arrayfields[
'd.amount'][
'checked'])) {
566 print_liste_field_titre($arrayfields[
'd.amount'][
'label'], $_SERVER[
"PHP_SELF"],
"c.subscription", $param,
"",
'', $sortfield, $sortorder,
'right ');
567 $totalarray[
'nbfield']++;
571 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
574 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
575 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
576 print $hookmanager->resPrint;
577 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
578 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.datec",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
580 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
581 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'align="center" class="nowrap"', $sortfield, $sortorder);
585 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
586 $totalarray[
'nbfield']++;
593 $savnbfield = $totalarray[
'nbfield'];
594 $totalarray = array();
595 $totalarray[
'nbfield'] = 0;
596 $imaxinloop = ($limit ? min($num, $limit) : $num);
597 while ($i < $imaxinloop) {
598 $obj = $db->fetch_object($resql);
603 $subscription->ref = $obj->crowid;
604 $subscription->id = $obj->crowid;
605 $subscription->dateh = $db->jdate($obj->dateadh);
606 $subscription->datef = $db->jdate($obj->datef);
607 $subscription->amount = $obj->subscription;
608 $subscription->fk_adherent = $obj->rowid;
610 $adherent->lastname = $obj->lastname;
611 $adherent->firstname = $obj->firstname;
612 $adherent->ref = $obj->rowid;
613 $adherent->id = $obj->rowid;
614 $adherent->statut = $obj->statut;
615 $adherent->login = $obj->login;
616 $adherent->photo = $obj->photo;
617 $adherent->gender = $obj->gender;
618 $adherent->morphy = $obj->morphy;
619 $adherent->email = $obj->email;
620 $adherent->typeid = $obj->fk_type;
621 $adherent->datefin = $db->jdate($obj->datef);
623 $typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid);
625 $adht->fetch($typeid);
627 $adherent->need_subscription = $adht->subscription;
629 if ($mode ==
'kanban') {
631 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
632 print
'<div class="box-flex-container kanban">';
635 if ($massactionbutton || $massaction) {
637 if (in_array($object->id, $arrayofselected)) {
644 if ($obj->fk_account > 0) {
645 $accountstatic->id = $obj->fk_account;
646 $accountstatic->fetch($obj->fk_account);
649 print $subscription->getKanbanView(
'', array(
'selected' => in_array($object->id, $arrayofselected),
'adherent_type' => $adht,
'member' => $adherent,
'bank'=>($obj->fk_account > 0 ? $accountstatic :
null)));
650 if ($i == ($imaxinloop - 1)) {
657 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
660 print
'<td class="nowrap center">';
661 if ($massactionbutton || $massaction) {
663 if (in_array($obj->crowid, $arrayofselected)) {
666 print
'<input id="cb'.$obj->crowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->crowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
670 $totalarray[
'nbfield']++;
674 if (!empty($arrayfields[
'd.ref'][
'checked'])) {
675 print
'<td>'.$subscription->getNomUrl(1).
'</td>';
677 $totalarray[
'nbfield']++;
681 if (!empty($arrayfields[
'd.fk_type'][
'checked'])) {
682 print
'<td class="nowraponall">';
684 print $adht->getNomUrl(1);
688 $totalarray[
'nbfield']++;
693 if (!empty($arrayfields[
'd.lastname'][
'checked'])) {
694 print
'<td class="tdoverflowmax125">'.$adherent->getNomUrl(-1, 0,
'card',
'lastname').
'</td>';
696 $totalarray[
'nbfield']++;
700 if (!empty($arrayfields[
'd.firstname'][
'checked'])) {
701 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($adherent->firstname).
'">'.
dol_escape_htmltag($adherent->firstname).
'</td>';
703 $totalarray[
'nbfield']++;
708 if (!empty($arrayfields[
'd.login'][
'checked'])) {
709 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).
'">'.
dol_escape_htmltag($adherent->login).
'</td>';
711 $totalarray[
'nbfield']++;
716 if (!empty($arrayfields[
't.libelle'][
'checked'])) {
717 print
'<td class="tdoverflowmax400" title="'.dol_escape_htmltag($obj->note_private).
'">';
721 $totalarray[
'nbfield']++;
726 if (!empty($arrayfields[
'd.bank'][
'checked'])) {
727 print
'<td class="tdmaxoverflow100">';
728 if ($obj->fk_account > 0) {
729 $accountstatic->id = $obj->fk_account;
730 $accountstatic->fetch($obj->fk_account);
732 print $accountstatic->getNomUrl(1);
736 $totalarray[
'nbfield']++;
741 if (!empty($arrayfields[
'c.dateadh'][
'checked'])) {
742 print
'<td class="center">'.dol_print_date($db->jdate($obj->dateadh),
'day').
"</td>\n";
744 $totalarray[
'nbfield']++;
748 if (!empty($arrayfields[
'c.datef'][
'checked'])) {
749 print
'<td class="center">'.dol_print_date($db->jdate($obj->datef),
'day').
"</td>\n";
751 $totalarray[
'nbfield']++;
755 if (!empty($arrayfields[
'd.amount'][
'checked'])) {
756 print
'<td class="right amount">'.price($obj->subscription).
'</td>';
758 $totalarray[
'nbfield']++;
761 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'd.amount';
763 if (empty($totalarray[
'val'][
'd.amount'])) {
764 $totalarray[
'val'][
'd.amount'] = $obj->subscription;
766 $totalarray[
'val'][
'd.amount'] += $obj->subscription;
770 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
772 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
773 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
774 print $hookmanager->resPrint;
776 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
777 print
'<td class="nowrap center">';
778 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
781 $totalarray[
'nbfield']++;
785 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
786 print
'<td class="nowrap center">';
787 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
790 $totalarray[
'nbfield']++;
795 print
'<td class="nowrap center">';
796 if ($massactionbutton || $massaction) {
798 if (in_array($obj->crowid, $arrayofselected)) {
801 print
'<input id="cb'.$obj->crowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->crowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
805 $totalarray[
'nbfield']++;
815 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
821 foreach ($arrayfields as $key => $val) {
822 if (!empty($val[
'checked'])) {
826 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
831 $parameters = array(
'arrayfields'=>$arrayfields,
'sql' =>
$sql);
832 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
833 print $hookmanager->resPrint;
835 print
'</table>'.
"\n";
838 print
'</form>'.
"\n";