dolibarr 21.0.0-alpha
extrafields_list_search_input.tpl.php
1<?php
2
3print '<!-- extrafields_list_search_input.tpl.php -->'."\n";
4
5// Protection to avoid direct call of template
6if (empty($conf) || !is_object($conf)) {
7 print "Error, template page can't be called as URL";
8 exit(1);
9}
10
11if (empty($extrafieldsobjectkey) && is_object($object)) {
12 $extrafieldsobjectkey = $object->table_element;
13}
14
15// Loop to show all columns of extrafields for the search title line
16if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
17 if (!empty($extrafields->attributes[$extrafieldsobjectkey]['label']) && is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) {
18 if (empty($extrafieldsobjectprefix)) {
19 $extrafieldsobjectprefix = 'ef.';
20 }
21 if (empty($search_options_pattern)) {
22 $search_options_pattern = 'search_options_';
23 }
24
25 foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) {
26 if (!empty($arrayfields[$extrafieldsobjectprefix.$key]['checked'])) {
27 if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') {
28 continue;
29 }
30 $cssclass = $extrafields->getAlignFlag($key, $extrafieldsobjectkey);
31 $typeofextrafield = $extrafields->attributes[$extrafieldsobjectkey]['type'][$key];
32 print '<td class="liste_titre'.($cssclass ? ' '.$cssclass : '').'">';
33 $tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key);
34 if (in_array($typeofextrafield, array('varchar', 'mail', 'ip', 'url', 'int', 'double')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) {
35 $searchclass = '';
36 if (in_array($typeofextrafield, array('varchar', 'mail', 'ip', 'url'))) {
37 $searchclass = 'searchstring';
38 }
39 if (in_array($typeofextrafield, array('int', 'double'))) {
40 $searchclass = 'searchnum';
41 }
42 print '<input class="flat'.($searchclass ? ' '.$searchclass : '').'" size="4" type="text" name="'.$search_options_pattern.$tmpkey.'" value="'.dol_escape_htmltag((empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey])).'">';
43 } elseif (in_array($typeofextrafield, array('date', 'datetime', 'timestamp'))) {
44 $morecss = '';
45 $preselectedvalues = (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]);
46 // Here $preselectedvalues can be an array('start'=>int, 'end'=>int) or an int
47 print $extrafields->showInputField($key, $preselectedvalues, '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
48 } else {
49 // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
50 $morecss = '';
51 if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) {
52 $morecss = 'maxwidth200';
53 }
54 print $extrafields->showInputField($key, (!isset($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
55 }
56 print '</td>';
57 }
58 }
59 }
60}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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...