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 (array_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 if ($extrafields->attributes[$extrafieldsobjectkey][
'type'][$key] ==
'separate') {
26 $cssclass = $extrafields->getAlignFlag($key, $extrafieldsobjectkey);
28 $tmpkey =
'options_'.$key;
30 if (in_array($extrafields->attributes[$extrafieldsobjectkey][
'type'][$key], array(
'date',
'datetime',
'timestamp')) && isset($obj->$tmpkey) && !is_numeric($obj->$tmpkey)) {
31 $datenotinstring = $obj->$tmpkey;
32 if (!is_numeric($obj->$tmpkey)) {
33 $datenotinstring = $db->jdate($datenotinstring);
35 $value = $datenotinstring;
36 } elseif (in_array($extrafields->attributes[$extrafieldsobjectkey][
'type'][$key], array(
'int'))) {
37 $value = (!empty($obj->$tmpkey) || $obj->$tmpkey ===
'0' ? $obj->$tmpkey :
'');
40 $value = (isset($obj->$tmpkey) ? $obj->$tmpkey :
41 (isset($obj->array_options[$tmpkey]) ? $obj->array_options[$tmpkey] :
'') );
44 if ($extrafields->attributes[$extrafieldsobjectkey][
'computed'][$key]) {
46 $value =
dol_eval((
string) $extrafields->attributes[$extrafieldsobjectkey][
'computed'][$key], 1, 1,
'2');
47 if (is_numeric(
price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey][
'totalizable'][$key]) {
52 $valuetoshow = $extrafields->showOutputField($key, $value,
'', $extrafieldsobjectkey);
55 print
'<td'.($cssclass ?
' class="'.$cssclass.
'"' :
'');
56 print
' data-key="'.$extrafieldsobjectkey.
'.'.$key.
'"';
63 if (empty($totalarray)) {
64 $totalarray[
'nbfield'] = 0;
66 $totalarray[
'nbfield']++;
69 if (!empty($extrafields->attributes[$extrafieldsobjectkey][
'totalizable'][$key])) {
72 $totalarray[
'totalizable'][$key][
'pos'] = $totalarray[
'nbfield'];
74 if (isset($obj->$tmpkey) && is_numeric($obj->$tmpkey)) {
75 if (!isset($totalarray[
'totalizable'][$key][
'total'])) {
76 $totalarray[
'totalizable'][$key][
'total'] = 0;
78 $totalarray[
'totalizable'][$key][
'total'] += $obj->$tmpkey;
82 if (!empty($extrafields->attributes[$extrafieldsobjectkey][
'totalizable'][$key]) && $extrafields->attributes[$extrafieldsobjectkey][
'totalizable'][$key] == 1) {
84 $totalarray[
'pos'][$totalarray[
'nbfield']] = $extrafieldsobjectprefix.$tmpkey;
86 if (!isset($totalarray[
'val'])) {
87 $totalarray[
'val'] = array();
89 if (!isset($totalarray[
'val'][$extrafieldsobjectprefix.$tmpkey])) {
90 $totalarray[
'val'][$extrafieldsobjectprefix.$tmpkey] = 0;
92 if (isset($obj->$tmpkey) && is_numeric($obj->$tmpkey)) {
93 if (!isset($totalarray[
'val'][$extrafieldsobjectprefix.$tmpkey])) {
94 $totalarray[
'val'][$extrafieldsobjectprefix.$tmpkey] = 0;
96 $totalarray[
'val'][$extrafieldsobjectprefix.$tmpkey] += $obj->$tmpkey;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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=1, $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...