1<?php 2/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com> 4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> 5 * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net> 6 * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> 7 * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> 8 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> 9 * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 3 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program. If not, see <https://www.gnu.org/licenses/>. 23 */ 24 25/** 26 * \file htdocs/societe/website.php 27 * \ingroup website 28 * \brief Page of web sites accounts 29 */ 30 31require '../main.inc.php'; 32require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; 33require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; 34require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; 35require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; 36require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; 37 38$langs->loadLangs(array("companies", "website")); 39 40$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... 41$show_files = GETPOST('show_files', 'int'); 42$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search 43$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page 44$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') 45 46$search_status = GETPOST('search_status'); 47 48// Security check 49$id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); 50if ($user->socid) $socid = $user->socid; 51$result = restrictedArea($user, 'societe', $socid, '&societe'); 52 53$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; 54$sortfield = GETPOST("sortfield", 'alpha'); 55$sortorder = GETPOST("sortorder", 'alpha'); 56$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); 57if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 58$offset = $limit * $page; 59$pageprev = $page - 1; 60$pagenext = $page + 1; 61if (!$sortfield) $sortfield = 't.login'; 62if (!$sortorder) $sortorder = 'ASC'; 63 64// Initialize technical objects 65$object = new Societe($db); 66$objectwebsiteaccount = new SocieteAccount($db); 67$extrafields = new ExtraFields($db); 68$diroutputmassaction = $conf->website->dir_output.'/temp/massgeneration/'.$user->id; 69$hookmanager->initHooks(array('websitethirdpartylist')); // Note that conf->hooks_modules contains array 70 71// Fetch optionals attributes and labels 72$extrafields->fetch_name_optionals_label($objectwebsiteaccount->table_element); 73 74$search_array_options = $extrafields->getOptionalsFromPost($objectwebsiteaccount->table_element, '', 'search_'); 75 76unset($objectwebsiteaccount->fields['fk_soc']); // Remove this field, we are already on the thirdparty 77 78// Initialize array of search criterias 79$search_all = GETPOST("search_all", 'alpha'); 80$search = array(); 81foreach ($objectwebsiteaccount->fields as $key => $val) 82{ 83 if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); 84} 85 86// List of fields to search into when doing a "search in all" 87$fieldstosearchall = array(); 88foreach ($objectwebsiteaccount->fields as $key => $val) 89{ 90 if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label']; 91} 92 93// Definition of fields for list 94$arrayfields = array(); 95foreach ($objectwebsiteaccount->fields as $key => $val) 96{ 97 // If $val['visible']==0, then we never show the field 98 if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']); 99} 100 101// Extra fields 102include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; 103 104$object->fields = dol_sort_array($object->fields, 'position'); 105$arrayfields = dol_sort_array($arrayfields, 'position'); 106 107 108if ($id > 0) 109{ 110 $result = $object->fetch($id); 111} 112 113 114/* 115 * Actions 116 */ 117 118$parameters = array('id'=>$socid); 119$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks 120if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); 121 122if (empty($reshook)) 123{ 124 // Cancel 125 if (GETPOST('cancel', 'alpha') && !empty($backtopage)) 126 { 127 header("Location: ".$backtopage); 128 exit; 129 } 130 131 // Selection of new fields 132 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; 133 134 // Purge search criteria 135 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers 136 { 137 foreach ($objectwebsiteaccount->fields as $key => $val) 138 { 139 $search[$key] = ''; 140 } 141 $toselect = ''; 142 $search_array_options = array(); 143 } 144 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') 145 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) 146 { 147 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation 148 } 149 150 // Mass actions 151 $objectclass = 'WebsiteAccount'; 152 $objectlabel = 'WebsiteAccount'; 153 $permissiontoread = $user->rights->societe->lire; 154 $permissiontodelete = $user->rights->societe->supprimer; 155 $uploaddir = $conf->societe->dir_output; 156 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; 157} 158 159 160 161/* 162 * View 163 */ 164 165$contactstatic = new Contact($db); 166 167$form = new Form($db); 168 169$langs->load("companies"); 170 171$title = $langs->trans("WebsiteAccounts"); 172llxHeader('', $title); 173 174$param = ''; 175if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); 176if ($id > 0) $param .= '&id='.urlencode($id); 177if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); 178foreach ($search as $key => $val) 179{ 180 $param .= '&search_'.$key.'='.urlencode($search[$key]); 181} 182if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); 183// Add $param from extra fields 184include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; 185 186$head = societe_prepare_head($object); 187 188print dol_get_fiche_head($head, 'website', $langs->trans("ThirdParty"), - 1, 'company'); 189 190$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; 191 192dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); 193 194print '<div class="fichecenter">'; 195 196print '<div class="underbanner clearboth"></div>'; 197 198print '<table class="border centpercent">'; 199 200// Prefix 201if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field 202{ 203 print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>'; 204} 205 206if ($object->client) { 207 print '<tr><td class="titlefield">'; 208 print $langs->trans('CustomerCode').'</td><td colspan="3">'; 209 print $object->code_client; 210 $tmpcheck = $object->check_codeclient(); 211 if ($tmpcheck != 0 && $tmpcheck != -5) { 212 print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>'; 213 } 214 print '</td></tr>'; 215} 216 217if ($object->fournisseur) { 218 print '<tr><td class="titlefield">'; 219 print $langs->trans('SupplierCode').'</td><td colspan="3">'; 220 print $object->code_fournisseur; 221 $tmpcheck = $object->check_codefournisseur(); 222 if ($tmpcheck != 0 && $tmpcheck != -5) { 223 print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>'; 224 } 225 print '</td></tr>'; 226} 227 228print '</table>'; 229 230print '</div>'; 231 232print dol_get_fiche_end(); 233 234$newcardbutton = ''; 235if (!empty($conf->website->enabled)) { 236 if (!empty($user->rights->societe->lire)) { 237 $newcardbutton .= dolGetButtonTitle($langs->trans("AddWebsiteAccount"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id)); 238 } else { 239 $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', 0); 240 } 241} 242 243print '<br>'; 244 245 246 247// Build and execute select 248// -------------------------------------------------------------------- 249$sql = 'SELECT '; 250foreach ($objectwebsiteaccount->fields as $key => $val) 251{ 252 $sql .= 't.'.$key.', '; 253} 254// Add fields from extrafields 255if (!empty($extrafields->attributes[$object->table_element]['label'])) 256 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); 257// Add fields from hooks 258$parameters = array(); 259$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook 260$sql .= $hookmanager->resPrint; 261$sql = preg_replace('/, $/', '', $sql); 262$sql .= " FROM ".MAIN_DB_PREFIX."societe_account as t"; 263if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; 264if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity('societeaccount').")"; 265else $sql .= " WHERE 1 = 1"; 266$sql .= " AND fk_soc = ".$object->id; 267foreach ($search as $key => $val) 268{ 269 $mode_search = (($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key])) ? 1 : 0); 270 if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); 271} 272if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); 273// Add where from extra fields 274include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; 275// Add where from hooks 276$parameters = array(); 277$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook 278$sql .= $hookmanager->resPrint; 279 280/* If a group by is required 281$sql.= " GROUP BY " 282foreach($objectwebsiteaccount->fields as $key => $val) 283{ 284 $sql.='t.'.$key.', '; 285} 286// Add fields from extrafields 287if (! empty($extrafields->attributes[$object->table_element]['label'])) { 288 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); 289// Add where from hooks 290$parameters=array(); 291$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $objectwebsiteaccount may have been modified by hook 292$sql.=$hookmanager->resPrint; 293*/ 294 295$sql .= $db->order($sortfield, $sortorder); 296 297// Count total nb of records 298$nbtotalofrecords = ''; 299if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) 300{ 301 $result = $db->query($sql); 302 $nbtotalofrecords = $db->num_rows($result); 303 if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 304 { 305 $page = 0; 306 $offset = 0; 307 } 308} 309 310$sql .= $db->plimit($limit + 1, $offset); 311 312$resql = $db->query($sql); 313if (!$resql) 314{ 315 dol_print_error($db); 316 exit; 317} 318 319$num = $db->num_rows($resql); 320 321$arrayofselected = is_array($toselect) ? $toselect : array(); 322 323// List of mass actions available 324$arrayofmassactions = array( 325//'presend'=>$langs->trans("SendByMail"), 326//'builddoc'=>$langs->trans("PDFMerge"), 327); 328if ($user->rights->mymodule->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); 329if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); 330$massactionbutton = $form->selectMassAction('', $arrayofmassactions); 331 332print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; 333if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; 334print '<input type="hidden" name="token" value="'.newToken().'">'; 335print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; 336print '<input type="hidden" name="action" value="list">'; 337print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; 338print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; 339print '<input type="hidden" name="page" value="'.$page.'">'; 340print '<input type="hidden" name="id" value="'.$id.'">'; 341print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; 342 343print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit); 344 345$topicmail = "Information"; 346$modelmail = "societeaccount"; 347$objecttmp = new SocieteAccount($db); 348$trackid = 'thi'.$object->id; 349include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; 350 351/*if ($sall) 352{ 353 foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); 354 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>'; 355}*/ 356 357$moreforfilter = ''; 358/*$moreforfilter.='<div class="divsearchfield">'; 359$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">'; 360$moreforfilter.= '</div>';*/ 361 362$parameters = array(); 363$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook 364if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; 365else $moreforfilter = $hookmanager->resPrint; 366 367if (!empty($moreforfilter)) 368{ 369 print '<div class="liste_titre liste_titre_bydiv centpercent">'; 370 print $moreforfilter; 371 print '</div>'; 372} 373 374$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; 375$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields 376$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); 377 378print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table 379print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; 380 381 382// Fields title search 383// -------------------------------------------------------------------- 384print '<tr class="liste_titre">'; 385foreach ($objectwebsiteaccount->fields as $key => $val) 386{ 387 $align = ''; 388 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center'; 389 if (in_array($val['type'], array('timestamp'))) $align .= ' nowrap'; 390 if ($key == 'status') $align .= ($align ? ' ' : '').'center'; 391 if (!empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align ? ' '.$align : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; 392} 393// Extra fields 394include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; 395// Fields from hook 396$parameters = array('arrayfields'=>$arrayfields); 397$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook 398print $hookmanager->resPrint; 399// Action column 400print '<td class="liste_titre maxwidthsearch">'; 401$searchpicto = $form->showFilterButtons(); 402print $searchpicto; 403print '</td>'; 404print '</tr>'."\n"; 405 406 407// Fields title label 408// -------------------------------------------------------------------- 409print '<tr class="liste_titre">'; 410foreach ($objectwebsiteaccount->fields as $key => $val) 411{ 412 $align = ''; 413 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center'; 414 if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap'; 415 if ($key == 'status') $align .= ($align ? ' ' : '').'center'; 416 if (!empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n"; 417} 418// Extra fields 419// Extra fields 420include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; 421// Hook fields 422$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); 423$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook 424print $hookmanager->resPrint; 425print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; 426print '</tr>'."\n"; 427 428 429// Detect if we need a fetch on each output line 430$needToFetchEachLine = 0; 431if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) 432{ 433 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) 434 { 435 if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object 436 } 437} 438 439// Loop on record 440// -------------------------------------------------------------------- 441$i = 0; 442$totalarray = array(); 443while ($i < min($num, $limit)) 444{ 445 $obj = $db->fetch_object($resql); 446 if (empty($obj)) break; // Should not happen 447 448 // Store properties in $object 449 $objectwebsiteaccount->id = $obj->rowid; 450 $objectwebsiteaccount->login = $obj->login; 451 $objectwebsiteaccount->ref = $obj->login; 452 foreach ($objectwebsiteaccount->fields as $key => $val) 453 { 454 if (property_exists($obj, $key)) $object->$key = $obj->$key; 455 } 456 457 // Show here line of result 458 print '<tr class="oddeven">'; 459 foreach ($objectwebsiteaccount->fields as $key => $val) 460 { 461 $align = ''; 462 if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center'; 463 if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap'; 464 if ($key == 'status') $align .= ($align ? ' ' : '').'center'; 465 if (!empty($arrayfields['t.'.$key]['checked'])) 466 { 467 print '<td'; 468 if ($align) print ' class="'.$align.'"'; 469 print '>'; 470 if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1); 471 else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, ''); 472 print '</td>'; 473 if (!$i) $totalarray['nbfield']++; 474 if (!empty($val['isameasure'])) 475 { 476 if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; 477 $totalarray['val']['t.'.$key] += $obj->$key; 478 } 479 } 480 } 481 // Extra fields 482 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; 483 // Fields from hook 484 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); 485 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook 486 print $hookmanager->resPrint; 487 // Action column 488 print '<td class="nowrap center">'; 489 if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined 490 { 491 $selected = 0; 492 if (in_array($obj->rowid, $arrayofselected)) $selected = 1; 493 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>'; 494 } 495 print '</td>'; 496 if (!$i) $totalarray['nbfield']++; 497 498 print '</tr>'; 499 500 $i++; 501} 502 503// Show total line 504include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; 505 506 507// If no record found 508if ($num == 0) 509{ 510 $colspan = 1; 511 foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } 512 print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; 513} 514 515 516$db->free($resql); 517 518$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); 519$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook 520print $hookmanager->resPrint; 521 522print '</table>'."\n"; 523print '</div>'."\n"; 524 525print '</form>'."\n"; 526 527if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) 528{ 529 $hidegeneratedfilelistifempty = 1; 530 if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0; 531 532 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; 533 $formfile = new FormFile($db); 534 535 // Show list of available documents 536 $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; 537 $urlsource .= str_replace('&', '&', $param); 538 539 $filedir = $diroutputmassaction; 540 $genallowed = $user->rights->mymodule->read; 541 $delallowed = $user->rights->mymodule->create; 542 543 print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); 544} 545 546// End of page 547llxFooter(); 548$db->close(); 549