dolibarr  7.0.0-beta
extrafieldsinexport.inc.php
1 <?php
2 
3 if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra))
4 {
5  //print $keyforselet.' - '.$keyforelement.' - '.$keyforaliasextra;
6  dol_print_error('', 'include of file extrafieldsinexport.inc.php was done but var $keyforselect or $keyforelement or $keyforaliasextra was not set');
7  exit;
8 }
9 
10 // Add extra fields
11 $sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')';
12 //print $sql;
13 $resql=$this->db->query($sql);
14 if ($resql) // This can fail when class is used on old database (during migration for example)
15 {
16  while ($obj=$this->db->fetch_object($resql))
17  {
18  $fieldname=$keyforaliasextra.'.'.$obj->name;
19  $fieldlabel=ucfirst($obj->label);
20  $typeFilter="Text";
21  $typefield=preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double
22  switch ($typefield) {
23  case 'int':
24  case 'integer':
25  case 'double':
26  case 'price':
27  $typeFilter="Numeric";
28  break;
29  case 'date':
30  case 'datetime':
31  case 'timestamp':
32  $typeFilter="Date";
33  break;
34  case 'boolean':
35  $typeFilter="Boolean";
36  break;
37  case 'sellist':
38  $tmp='';
39  $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
40  if ($tmpparam['options'] && is_array($tmpparam['options'])) {
41  $tmpkeys=array_keys($tmpparam['options']);
42  $tmp=array_shift($tmpkeys);
43  }
44  if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
45  break;
46  }
47  if ($obj->type!='separate')
48  {
49  // If not a computed field
50  if (empty($obj->fieldcomputed))
51  {
52  $this->export_fields_array[$r][$fieldname]=$fieldlabel;
53  $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
54  $this->export_entities_array[$r][$fieldname]=$keyforelement;
55  }
56  // If this is a computed field
57  else
58  {
59  $this->export_fields_array[$r][$fieldname]=$fieldlabel;
60  $this->export_TypeFields_array[$r][$fieldname]=$typeFilter.'Compute';
61  $this->export_special_array[$r][$fieldname]=$obj->fieldcomputed;
62  $this->export_entities_array[$r][$fieldname]=$keyforelement;
63  }
64  }
65  }
66 }
67 // End add axtra fields
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->societe->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1013