4if (empty($conf) || !is_object($conf)) {
5 print
"Error, template page can't be called as URL";
9if (empty($extrafieldsobjectkey) && is_object($object)) {
10 $extrafieldsobjectkey = $object->table_element;
14if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafieldsobjectkey])) {
15 if (key_exists(
'label', $extrafields->attributes[$extrafieldsobjectkey]) && is_array($extrafields->attributes[$extrafieldsobjectkey][
'label']) && count($extrafields->attributes[$extrafieldsobjectkey][
'label'])) {
16 if (empty($extrafieldsobjectprefix)) {
17 $extrafieldsobjectprefix =
'ef.';
20 foreach ($extrafields->attributes[$extrafieldsobjectkey][
'label'] as $key => $val) {
21 if (!empty($arrayfields[$extrafieldsobjectprefix.$key][
'checked'])) {
22 $cssclass = $extrafields->getAlignFlag($key, $extrafieldsobjectkey);
24 $tmpkey =
'options_'.$key;
26 if (in_array($extrafields->attributes[$extrafieldsobjectkey][
'type'][$key], array(
'date',
'datetime',
'timestamp')) && isset($obj->$tmpkey) && !is_numeric($obj->$tmpkey)) {
27 $datenotinstring = $obj->$tmpkey;
28 if (!is_numeric($obj->$tmpkey)) {
29 $datenotinstring = $db->jdate($datenotinstring);
31 $value = $datenotinstring;
33 $value = (!empty($obj->$tmpkey) ? $obj->$tmpkey :
'');
36 if ($extrafields->attributes[$extrafieldsobjectkey][
'computed'][$key]) {
41 $value =
dol_eval($extrafields->attributes[$extrafieldsobjectkey][
'computed'][$key], 1, 1,
'0');
42 if (is_numeric(
price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey][
'totalizable'][$key]) {
48 $valuetoshow = $extrafields->showOutputField($key, $value,
'', $extrafieldsobjectkey);
51 print
'<td'.($cssclass ?
' class="'.$cssclass.
'"' :
'');
52 print
' data-key="'.$extrafieldsobjectkey.
'.'.$key.
'"';
59 if (empty($totalarray)) {
60 $totalarray[
'nbfield'] = 0;
62 $totalarray[
'nbfield']++;
65 if ($extrafields->attributes[$extrafieldsobjectkey][
'totalizable'][$key]) {
68 $totalarray[
'totalizable'][$key][
'pos'] = $totalarray[
'nbfield'];
70 if (isset($obj->$tmpkey) && is_numeric($obj->$tmpkey)) {
71 if (!isset($totalarray[
'totalizable'][$key][
'total'])) {
72 $totalarray[
'totalizable'][$key][
'total'] = 0;
74 $totalarray[
'totalizable'][$key][
'total'] += $obj->$tmpkey;
77 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
79 $totalarray[
'pos'][$totalarray[
'nbfield']] = $extrafieldsobjectprefix.$tmpkey;
81 if (!isset($totalarray[
'val'])) {
82 $totalarray[
'val'] = array();
84 if (!isset($totalarray[
'val'][$extrafieldsobjectprefix.$tmpkey])) {
85 $totalarray[
'val'][$extrafieldsobjectprefix.$tmpkey] = 0;
87 $totalarray[
'val'][$extrafieldsobjectprefix.$tmpkey] += $obj->$tmpkey;
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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...