dolibarr 21.0.0-alpha
extrafields_list_search_param.tpl.php
1<?php
2
3// Protection to avoid direct call of template
4if (empty($conf) || !is_object($conf)) {
5 print "Error, template page can't be called as URL";
6 exit(1);
7}
8
9// Loop to complete $param for extrafields
10if (!empty($search_array_options) && is_array($search_array_options)) { // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
11 if (empty($search_options_pattern)) {
12 $search_options_pattern = 'search_options_';
13 }
14 if (empty($extrafieldsobjectkey) && is_object($object)) {
15 $extrafieldsobjectkey = $object->table_element;
16 }
17 foreach ($search_array_options as $key => $val) {
18 $crit = $val;
19 $tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key);
20 if (is_array($val) && array_key_exists('start', $val) && array_key_exists('end', $val)) {
21 // date range from list filters is stored as array('start' => <timestamp>, 'end' => <timestamp>)
22 // start date
23 $param .= '&'.$search_options_pattern.$tmpkey.'_startyear='.dol_print_date($val['start'], '%Y');
24 $param .= '&'.$search_options_pattern.$tmpkey.'_startmonth='.dol_print_date($val['start'], '%m');
25 $param .= '&'.$search_options_pattern.$tmpkey.'_startday='.dol_print_date($val['start'], '%d');
26 $param .= '&'.$search_options_pattern.$tmpkey.'_starthour='.dol_print_date($val['start'], '%H');
27 $param .= '&'.$search_options_pattern.$tmpkey.'_startmin='.dol_print_date($val['start'], '%M');
28 // end date
29 $param .= '&'.$search_options_pattern.$tmpkey.'_endyear='.dol_print_date($val['end'], '%Y');
30 $param .= '&'.$search_options_pattern.$tmpkey.'_endmonth='.dol_print_date($val['end'], '%m');
31 $param .= '&'.$search_options_pattern.$tmpkey.'_endday='.dol_print_date($val['end'], '%d');
32 $param .= '&'.$search_options_pattern.$tmpkey.'_endhour='.dol_print_date($val['end'], '%H');
33 $param .= '&'.$search_options_pattern.$tmpkey.'_endmin='.dol_print_date($val['end'], '%M');
34 $val = '';
35 }
36 if ($val !== '') {
37 if (is_array($val)) {
38 foreach ($val as $val2) {
39 $param .= '&'.$search_options_pattern.$tmpkey.'[]='.urlencode($val2);
40 }
41 } else {
42 // test if we have checkbox type, we add the _multiselect needed into param
43 $tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key);
44 if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey], array('checkbox', 'chkbxlst'))) {
45 $param .= '&'.$search_options_pattern.$tmpkey.'_multiselect='.urlencode($val);
46 }
47 // test if we have boolean type, we add the _booleand needed into param
48 if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey], array('boolean'))) {
49 $param .= '&'.$search_options_pattern.$tmpkey.'_boolean='.urlencode($val);
50 }
51
52 $param .= '&'.$search_options_pattern.$tmpkey.'='.urlencode($val);
53 }
54 }
55 }
56}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).