26require 
'../../main.inc.php';
 
   27require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
 
   28require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
 
   29require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
 
   30require_once DOL_DOCUMENT_ROOT.
'/asset/class/assetmodel.class.php';
 
   33$langs->loadLangs(array(
"assets", 
"other"));
 
   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') : 
'assetmodellist'; 
 
   42$backtopage   = 
GETPOST(
'backtopage', 
'alpha'); 
 
   43$optioncss    = 
GETPOST(
'optioncss', 
'aZ'); 
 
   48$limit = 
GETPOST(
'limit', 
'int') ? 
GETPOST(
'limit', 
'int') : $conf->liste_limit;
 
   49$sortfield = 
GETPOST(
'sortfield', 
'aZ09comma');
 
   50$sortorder = 
GETPOST(
'sortorder', 
'aZ09comma');
 
   51$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) : 
GETPOST(
"page", 
'int');
 
   52if (empty($page) || $page < 0 || 
GETPOST(
'button_search', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha') || (empty($toselect) && $massaction === 
'0')) {
 
   55$offset = $limit * $page;
 
   62$diroutputmassaction = $conf->asset->dir_output.
'/temp/massgeneration/'.$user->id;
 
   63$hookmanager->initHooks(array(
'assetmodellist')); 
 
   66$extrafields->fetch_name_optionals_label($object->table_element);
 
   69$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, 
'', 
'search_');
 
   73  reset($object->fields);         
 
   74  $sortfield = 
"t.".key($object->fields); 
 
   81$search_all = 
GETPOST(
'search_all', 
'alphanohtml');
 
   83foreach ($object->fields as $key => $val) {
 
   84  if ($key == 
'fk_pays' && !GETPOSTISSET(
'search_'.$key)) {
 
   85    $search[$key] = $mysoc->country_id;
 
   86  } elseif (
GETPOST(
'search_'.$key, 
'alpha') !== 
'') {
 
   87    $search[$key] = 
GETPOST(
'search_'.$key, 
'alpha');
 
   89  if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
 
   90    $search[$key.
'_dtstart'] = 
dol_mktime(0, 0, 0, 
GETPOST(
'search_'.$key.
'_dtstartmonth', 
'int'), 
GETPOST(
'search_'.$key.
'_dtstartday', 
'int'), 
GETPOST(
'search_'.$key.
'_dtstartyear', 
'int'));
 
   91    $search[$key.
'_dtend'] = 
dol_mktime(23, 59, 59, 
GETPOST(
'search_'.$key.
'_dtendmonth', 
'int'), 
GETPOST(
'search_'.$key.
'_dtendday', 
'int'), 
GETPOST(
'search_'.$key.
'_dtendyear', 
'int'));
 
   96$fieldstosearchall = array();
 
   97foreach ($object->fields as $key => $val) {
 
   98  if (!empty($val[
'searchall'])) {
 
   99    $fieldstosearchall[
't.'.$key] = $val[
'label'];
 
  104$arrayfields = array();
 
  105foreach ($object->fields as $key => $val) {
 
  107  if (!empty($val[
'visible'])) {
 
  108    $visible = (int) 
dol_eval($val[
'visible'], 1);
 
  109    $arrayfields[
't.'.$key] = array(
 
  110      'label'=>$val[
'label'],
 
  111      'checked'=>(($visible < 0) ? 0 : 1),
 
  112      'enabled'=>($visible != 3 && 
dol_eval($val[
'enabled'], 1)),
 
  113      'position'=>$val[
'position'],
 
  114      'help'=> isset($val[
'help']) ? $val[
'help'] : 
'' 
  119include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
 
  124$permissiontoread = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'asset', 
'read')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'asset', 
'model_advance', 
'read')));
 
  125$permissiontoadd = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'asset', 
'write')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'asset', 
'model_advance', 
'write')));
 
  126$permissiontodelete = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'asset', 
'delete')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'asset', 
'model_advance', 
'delete')));
 
  129if (!isModEnabled(
'asset')) {
 
  134if ($user->socid > 0) {
 
  138if ($user->socid > 0) {
 
  139  $socid = $user->socid;
 
  141$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
 
  142restrictedArea($user, 
'asset', $object->id, $object->table_element, 
'', 
'fk_soc', 
'rowid', $isdraft);
 
  143if (!isModEnabled(
'asset')) {
 
  146if (!$permissiontoread) {
 
  154if (
GETPOST(
'cancel', 
'alpha')) {
 
  158if (!
GETPOST(
'confirmmassaction', 
'alpha') && $massaction != 
'presend' && $massaction != 
'confirm_presend') {
 
  162$parameters = array();
 
  163$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action); 
 
  168if (empty($reshook)) {
 
  170  include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
 
  173  if (
GETPOST(
'button_removefilter_x', 
'alpha') || 
GETPOST(
'button_removefilter.x', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) { 
 
  174    foreach ($object->fields as $key => $val) {
 
  176      if ($key == 
'fk_pays') {
 
  177        $search[$key] = $mysoc->country_id;
 
  179      if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
 
  180        $search[$key.
'_dtstart'] = 
'';
 
  181        $search[$key.
'_dtend'] = 
'';
 
  185    $search_array_options = array();
 
  187  if (
GETPOST(
'button_removefilter_x', 
'alpha') || 
GETPOST(
'button_removefilter.x', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')
 
  188    || 
GETPOST(
'button_search_x', 
'alpha') || 
GETPOST(
'button_search.x', 
'alpha') || 
GETPOST(
'button_search', 
'alpha')) {
 
  193  $objectclass = 
'AssetModel';
 
  194  $objectlabel = 
'AssetModel';
 
  195  $uploaddir = $conf->asset->dir_output;
 
  196  include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
 
  205$form = 
new Form($db);
 
  210$title = $langs->trans(
'ListOf', $langs->transnoentitiesnoconv(
"AssetModels"));
 
  218$sql .= $object->getFieldList(
't');
 
  220if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
 
  221  foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
 
  222    $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] != 
'separate' ? 
", ef.".$key.
" as options_".$key : 
'');
 
  226$parameters = array();
 
  227$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object); 
 
  228$sql .= $hookmanager->resPrint;
 
  229$sql = preg_replace(
'/,\s*$/', 
'', $sql);
 
  230$sql .= 
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
 
  231if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
 
  232  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
 
  235$parameters = array();
 
  236$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object); 
 
  237$sql .= $hookmanager->resPrint;
 
  238if ($object->ismultientitymanaged == 1) {
 
  239  $sql .= 
" WHERE t.entity IN (".getEntity($object->element).
")";
 
  241  $sql .= 
" WHERE 1 = 1";
 
  243foreach ($search as $key => $val) {
 
  244  if (array_key_exists($key, $object->fields)) {
 
  245    if ($key == 
'status' && $search[$key] == -1) {
 
  248    $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
 
  249    if ((strpos($object->fields[$key][
'type'], 
'integer:') === 0) || (strpos($object->fields[$key][
'type'], 
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
 
  250      if ($search[$key] == 
'-1' || ($search[$key] === 
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
 
  255    if ($search[$key] != 
'') {
 
  256      $sql .= 
natural_search($key, $search[$key], (($key == 
'status') ? 2 : $mode_search));
 
  259    if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] != 
'') {
 
  260      $columnName = preg_replace(
'/(_dtstart|_dtend)$/', 
'', $key);
 
  261      if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
 
  262        if (preg_match(
'/_dtstart$/', $key)) {
 
  263          $sql .= 
" AND t.".$columnName.
" >= '".$db->idate($search[$key]).
"'";
 
  265        if (preg_match(
'/_dtend$/', $key)) {
 
  266          $sql .= 
" AND t." . $columnName . 
" <= '" . $db->idate($search[$key]) . 
"'";
 
  273  $sql .= 
natural_search(array_keys($fieldstosearchall), $search_all);
 
  277include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
 
  279$parameters = array();
 
  280$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object); 
 
  281$sql .= $hookmanager->resPrint;
 
  309$nbtotalofrecords = 
'';
 
  316  $sqlforcount = preg_replace(
'/^SELECT[a-z0-9\._\s\(\),]+FROM/Ui', 
'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
 
  318  $resql = $db->query($sqlforcount);
 
  320    $objforcount = $db->fetch_object($resql);
 
  321    $nbtotalofrecords = $objforcount->nbtotalofrecords;
 
  326  if (($page * $limit) > $nbtotalofrecords) { 
 
  334$sql .= $db->order($sortfield, $sortorder);
 
  336  $sql .= $db->plimit($limit + 1, $offset);
 
  339$resql = $db->query($sql);
 
  345$num = $db->num_rows($resql);
 
  349if ($num == 1 && 
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
 
  350  $obj = $db->fetch_object($resql);
 
  352  header(
"Location: ".DOL_URL_ROOT.
'/asset/model/card.php?id='.$id);
 
  360llxHeader(
'', $title, $help_url, 
'', 0, 0, $morejs, $morecss, 
'', 
'');
 
  362$arrayofselected = is_array($toselect) ? $toselect : array();
 
  365if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
 
  366  $param .= 
'&contextpage='.urlencode($contextpage);
 
  368if ($limit > 0 && $limit != $conf->liste_limit) {
 
  369  $param .= 
'&limit='.((int) $limit);
 
  371foreach ($search as $key => $val) {
 
  372  if (is_array($search[$key]) && count($search[$key])) {
 
  373    foreach ($search[$key] as $skey) {
 
  375        $param .= 
'&search_'.$key.
'[]='.urlencode($skey);
 
  378  } elseif ($search[$key] != 
'') {
 
  379    $param .= 
'&search_'.$key.
'='.urlencode($search[$key]);
 
  382if ($optioncss != 
'') {
 
  383  $param .= 
'&optioncss='.urlencode($optioncss);
 
  386include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
 
  388$parameters = array(
'param' => &$param);
 
  389$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object); 
 
  390$param .= $hookmanager->resPrint;
 
  393$arrayofmassactions = array(
 
  399if ($permissiontodelete) {
 
  400  $arrayofmassactions[
'predelete'] = 
img_picto(
'', 
'delete', 
'class="pictofixedwidth"').$langs->trans(
"Delete");
 
  402if (
GETPOST(
'nomassaction', 
'int') || in_array($massaction, array(
'presend', 
'predelete'))) {
 
  403  $arrayofmassactions = array();
 
  405$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
 
  407print 
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
 
  408if ($optioncss != 
'') {
 
  409  print 
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
 
  411print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  412print 
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
 
  413print 
'<input type="hidden" name="action" value="list">';
 
  414print 
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
 
  415print 
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
 
  416print 
'<input type="hidden" name="page" value="'.$page.
'">';
 
  417print 
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
 
  420$newcardbutton .= 
dolGetButtonTitle($langs->trans(
'New'), 
'', 
'fa fa-plus-circle', DOL_URL_ROOT.
'/asset/model/card.php?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']), 
'', $permissiontoadd);
 
  422print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 
'object_'.$object->picto, 0, $newcardbutton, 
'', $limit, 0, 0, 1);
 
  425$topicmail = 
"SendAssetModelRef";
 
  426$modelmail = 
"assetmodel";
 
  428$trackid = 
'assetmodel'.$object->id;
 
  429include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
 
  432  foreach ($fieldstosearchall as $key => $val) {
 
  433    $fieldstosearchall[$key] = $langs->trans($val);
 
  435  print 
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
 
  443$parameters = array();
 
  444$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object); 
 
  445if (empty($reshook)) {
 
  446  $moreforfilter .= $hookmanager->resPrint;
 
  448  $moreforfilter = $hookmanager->resPrint;
 
  451if (!empty($moreforfilter)) {
 
  452  print 
'<div class="liste_titre liste_titre_bydiv centpercent">';
 
  453  print $moreforfilter;
 
  457$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
 
  458$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage); 
 
  459$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) : 
'');
 
  461print 
'<div class="div-table-responsive">'; 
 
  462print 
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ? 
" listwithfilterbefore" : 
"").
'">'.
"\n";
 
  467print 
'<tr class="liste_titre">';
 
  468foreach ($object->fields as $key => $val) {
 
  469  $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ? 
'' : $val[
'css']) : $val[
'csslist']);
 
  470  if ($key == 
'status') {
 
  471    $cssforfield .= ($cssforfield ? 
' ' : 
'').
'center';
 
  472  } elseif (in_array($val[
'type'], array(
'date', 
'datetime', 
'timestamp'))) {
 
  473    $cssforfield .= ($cssforfield ? 
' ' : 
'').
'center';
 
  474  } elseif (in_array($val[
'type'], array(
'timestamp'))) {
 
  475    $cssforfield .= ($cssforfield ? 
' ' : 
'').
'nowrap';
 
  476  } elseif (in_array($val[
'type'], array(
'double(24,8)', 
'double(6,3)', 
'integer', 
'real', 
'price')) && $val[
'label'] != 
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
 
  477    $cssforfield .= ($cssforfield ? 
' ' : 
'').
'right';
 
  479  if (!empty($arrayfields[
't.'.$key][
'checked'])) {
 
  480    print 
'<td class="liste_titre'.($cssforfield ? 
' '.$cssforfield : 
'').
'">';
 
  481    if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
 
  482      print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] : 
''), $val[
'notnull'], 0, 0, 
'', 1, 0, 0, 
'', 
'maxwidth100', 1);
 
  483    } elseif ((strpos($val[
'type'], 
'integer:') === 0) || (strpos($val[
'type'], 
'sellist:') === 0)) {
 
  484      print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : 
''), 
'', 
'', 
'search_', 
'maxwidth125', 1);
 
  485    } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
 
  486      print 
'<div class="nowrap">';
 
  487      print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] : 
'', 
"search_".$key.
"_dtstart", 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'From'));
 
  489      print 
'<div class="nowrap">';
 
  490      print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] : 
'', 
"search_".$key.
"_dtend", 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'to'));
 
  492    } elseif ($key == 
'lang') {
 
  493      require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
 
  495      print $formadmin->select_language($search[$key], 
'search_lang', 0, 
null, 1, 0, 0, 
'minwidth150 maxwidth200', 2);
 
  497      print 
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] : 
'').
'">';
 
  503include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
 
  506$parameters = array(
'arrayfields'=>$arrayfields);
 
  507$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object); 
 
  508print $hookmanager->resPrint;
 
  510print 
'<td class="liste_titre maxwidthsearch">';
 
  511$searchpicto = $form->showFilterButtons();
 
  519print 
'<tr class="liste_titre">';
 
  520foreach ($object->fields as $key => $val) {
 
  521  $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ? 
'' : $val[
'css']) : $val[
'csslist']);
 
  522  if ($key == 
'status') {
 
  523    $cssforfield .= ($cssforfield ? 
' ' : 
'').
'center';
 
  524  } elseif (in_array($val[
'type'], array(
'date', 
'datetime', 
'timestamp'))) {
 
  525    $cssforfield .= ($cssforfield ? 
' ' : 
'').
'center';
 
  526  } elseif (in_array($val[
'type'], array(
'timestamp'))) {
 
  527    $cssforfield .= ($cssforfield ? 
' ' : 
'').
'nowrap';
 
  528  } elseif (in_array($val[
'type'], array(
'double(24,8)', 
'double(6,3)', 
'integer', 
'real', 
'price')) && $val[
'label'] != 
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
 
  529    $cssforfield .= ($cssforfield ? 
' ' : 
'').
'right';
 
  531  if (!empty($arrayfields[
't.'.$key][
'checked'])) {
 
  532    print 
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'], 
't.'.$key, 
'', $param, ($cssforfield ? 
'class="'.$cssforfield.
'"' : 
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' : 
'')).
"\n";
 
  536include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
 
  538$parameters = array(
'arrayfields'=>$arrayfields, 
'param'=>$param, 
'sortfield'=>$sortfield, 
'sortorder'=>$sortorder);
 
  539$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object); 
 
  540print $hookmanager->resPrint;
 
  542print 
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"], 
'', 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ').
"\n";
 
  547$needToFetchEachLine = 0;
 
  548if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
 
  549  foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
 
  550    if (!is_null($val) && preg_match(
'/\$object/', $val)) {
 
  551      $needToFetchEachLine++; 
 
  560$totalarray = array();
 
  561$totalarray[
'nbfield'] = 0;
 
  562while ($i < ($limit ? min($num, $limit) : $num)) {
 
  563  $obj = $db->fetch_object($resql);
 
  569  $object->setVarsFromFetchObj($obj);
 
  572  print 
'<tr class="oddeven">';
 
  573  foreach ($object->fields as $key => $val) {
 
  574    $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ? 
'' : $val[
'css']) : $val[
'csslist']);
 
  575    if (in_array($val[
'type'], array(
'date', 
'datetime', 
'timestamp'))) {
 
  576      $cssforfield .= ($cssforfield ? 
' ' : 
'').
'center';
 
  577    } elseif ($key == 
'status') {
 
  578      $cssforfield .= ($cssforfield ? 
' ' : 
'').
'center';
 
  581    if (in_array($val[
'type'], array(
'timestamp'))) {
 
  582      $cssforfield .= ($cssforfield ? 
' ' : 
'').
'nowrap';
 
  583    } elseif ($key == 
'ref') {
 
  584      $cssforfield .= ($cssforfield ? 
' ' : 
'').
'nowrap';
 
  587    if (in_array($val[
'type'], array(
'double(24,8)', 
'double(6,3)', 
'integer', 
'real', 
'price')) && !in_array($key, array(
'rowid', 
'status')) && empty($val[
'arrayofkeyval'])) {
 
  588      $cssforfield .= ($cssforfield ? 
' ' : 
'').
'right';
 
  592    if (!empty($arrayfields[
't.'.$key][
'checked'])) {
 
  593      print 
'<td'.($cssforfield ? 
' class="'.$cssforfield.
'"' : 
'').
'>';
 
  594      if ($key == 
'status') {
 
  595        print $object->getLibStatut(5);
 
  596      } elseif ($key == 
'rowid') {
 
  597        print $object->showOutputField($val, $key, $object->id, 
'');
 
  599        print $object->showOutputField($val, $key, $object->$key, 
'');
 
  603        $totalarray[
'nbfield']++;
 
  605      if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
 
  607          $totalarray[
'pos'][$totalarray[
'nbfield']] = 
't.'.$key;
 
  609        if (!isset($totalarray[
'val'])) {
 
  610          $totalarray[
'val'] = array();
 
  612        if (!isset($totalarray[
'val'][
't.'.$key])) {
 
  613          $totalarray[
'val'][
't.'.$key] = 0;
 
  615        $totalarray[
'val'][
't.'.$key] += $object->$key;
 
  620  include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
 
  622  $parameters = array(
'arrayfields'=>$arrayfields, 
'object'=>$object, 
'obj'=>$obj, 
'i'=>$i, 
'totalarray'=>&$totalarray);
 
  623  $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object); 
 
  624  print $hookmanager->resPrint;
 
  626  print 
'<td class="nowrap center">';
 
  627  if ($massactionbutton || $massaction) { 
 
  629    if (in_array($object->id, $arrayofselected)) {
 
  632    print 
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ? 
' checked="checked"' : 
'').
'>';
 
  636    $totalarray[
'nbfield']++;
 
  645include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
 
  650  foreach ($arrayfields as $key => $val) {
 
  651    if (!empty($val[
'checked'])) {
 
  655  print 
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
 
  661$parameters = array(
'arrayfields'=>$arrayfields, 
'sql'=>$sql);
 
  662$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object); 
 
  663print $hookmanager->resPrint;
 
  665print 
'</table>'.
"\n";
 
  670if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords === 
'' || $nbtotalofrecords)) {
 
  671  $hidegeneratedfilelistifempty = 1;
 
  672  if ($massaction == 
'builddoc' || $action == 
'remove_file' || $show_files) {
 
  673    $hidegeneratedfilelistifempty = 0;
 
  676  require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
 
  680  $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
 
  681  $urlsource .= str_replace(
'&', 
'&', $param);
 
  683  $filedir = $diroutputmassaction;
 
  684  $genallowed = $permissiontoread;
 
  685  $delallowed = $permissiontoadd;
 
  687  print $formfile->showdocuments(
'massfilesarea_asset', 
'', $filedir, $urlsource, 0, $delallowed, 
'', 1, 1, 0, 48, 1, $param, $title, 
'', 
'', 
'', 
null, $hidegeneratedfilelistifempty);
 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
 
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
 
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
 
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
 
dol_now($mode='auto')
Return date for now.
 
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
 
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
 
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
 
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
 
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
 
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
 
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
 
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
 
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
 
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.