dolibarr  9.0.0
extrafields_list_print_fields.tpl.php
1 <?php
2 
3 // Protection to avoid direct call of template
4 if (empty($conf) || ! is_object($conf))
5 {
6  print "Error, template page can't be called as URL";
7  exit;
8 }
9 
10 if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
11 
12 // Loop to show all columns of extrafields from $obj, $extrafields and $db
13 if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
14 {
15  if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
16  {
17  foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
18  {
19  if (! empty($arrayfields["ef.".$key]['checked']))
20  {
21  $align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey);
22  print '<td';
23  if ($align) print ' align="'.$align.'"';
24  print '>';
25  $tmpkey='options_'.$key;
26  if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey))
27  {
28  $datenotinstring = $obj->$tmpkey;
29  if (! is_numeric($obj->$tmpkey)) // For backward compatibility
30  {
31  $datenotinstring = $db->jdate($datenotinstring);
32  }
33  $value = $datenotinstring;
34  }
35  else
36  {
37  $value = $obj->$tmpkey;
38  }
39 
40  print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey);
41  print '</td>';
42  if (! $i) $totalarray['nbfield']++;
43 
44  if ($extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) {
45  if (! $i) {
46  // we keep position for the first line
47  $totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield'];
48  }
49  $totalarray['totalizable'][$key]['total'] += $obj->$tmpkey;
50  }
51  if (! empty($val['isameasure']))
52  {
53  if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey;
54  $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey;
55  }
56  }
57  }
58  }
59 }
print
Draft customers invoices.
Definition: index.php:91