24 use Luracast\Restler\RestException;
26 require_once DOL_DOCUMENT_ROOT.
'/main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/class/cstate.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/ccountry.class.php';
39 private $translations = null;
66 public function getOrderingMethods($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
70 if (!DolibarrApiAccess::$user->rights->commande->lire) {
71 throw new RestException(401);
74 $sql =
"SELECT rowid, code, libelle as label, module";
75 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_input_method as t";
76 $sql .=
" WHERE t.active = ".$active;
80 throw new RestException(400,
'error when validating parameter sqlfilters '.$sqlfilters);
82 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
83 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
87 $sql .= $this->
db->order($sortfield, $sortorder);
93 $offset = $limit * $page;
95 $sql .= $this->
db->plimit($limit, $offset);
98 $result = $this->
db->query($sql);
101 $num = $this->
db->num_rows($result);
102 $min = min($num, ($limit <= 0 ? $num : $limit));
103 for ($i = 0; $i < $min; $i++) {
104 $list[] = $this->
db->fetch_object($result);
107 throw new RestException(400, $this->
db->lasterror());
129 public function getOrderingOrigins($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
133 if (!DolibarrApiAccess::$user->rights->commande->lire) {
134 throw new RestException(401);
137 $sql =
"SELECT rowid, code, label, module";
138 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_input_reason as t";
139 $sql .=
" WHERE t.active = ".$active;
143 throw new RestException(400,
'error when validating parameter sqlfilters '.$sqlfilters);
145 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
146 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
150 $sql .= $this->
db->order($sortfield, $sortorder);
156 $offset = $limit * $page;
158 $sql .= $this->
db->plimit($limit, $offset);
161 $result = $this->
db->query($sql);
164 $num = $this->
db->num_rows($result);
165 $min = min($num, ($limit <= 0 ? $num : $limit));
166 for ($i = 0; $i < $min; $i++) {
167 $list[] = $this->
db->fetch_object($result);
170 throw new RestException(400, $this->
db->lasterror());
192 public function getPaymentTypes($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
196 if (!DolibarrApiAccess::$user->rights->propal->lire && !DolibarrApiAccess::$user->rights->commande->lire && !DolibarrApiAccess::$user->rights->facture->lire) {
197 throw new RestException(401);
200 $sql =
"SELECT id, code, type, libelle as label, module";
201 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_paiement as t";
202 $sql .=
" WHERE t.entity IN (".getEntity(
'c_paiement').
")";
203 $sql .=
" AND t.active = ".$active;
207 throw new RestException(400,
'error when validating parameter sqlfilters '.$sqlfilters);
209 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
210 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
214 $sql .= $this->
db->order($sortfield, $sortorder);
220 $offset = $limit * $page;
222 $sql .= $this->
db->plimit($limit, $offset);
225 $result = $this->
db->query($sql);
228 $num = $this->
db->num_rows($result);
229 $min = min($num, ($limit <= 0 ? $num : $limit));
230 for ($i = 0; $i < $min; $i++) {
231 $list[] = $this->
db->fetch_object($result);
234 throw new RestException(400, $this->
db->lasterror());
260 public function getListOfStates($sortfield =
"code_departement", $sortorder =
'ASC', $limit = 100, $page = 0, $filter =
'', $sqlfilters =
'')
266 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"c_departements as t";
267 $sql .=
" WHERE 1 = 1";
271 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
273 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
274 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
277 $sql .= $this->
db->order($sortfield, $sortorder);
283 $offset = $limit * $page;
285 $sql .= $this->
db->plimit($limit, $offset);
288 $result = $this->
db->query($sql);
291 $num = $this->
db->num_rows($result);
292 $min = min($num, ($limit <= 0 ? $num : $limit));
293 for ($i = 0; $i < $min; $i++) {
294 $obj = $this->
db->fetch_object($result);
296 if ($state->fetch($obj->rowid) > 0) {
297 if (empty($filter) || stripos($state->label, $filter) !==
false) {
303 throw new RestException(503,
'Error when retrieving list of states');
360 public function getListOfCountries($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $filter =
'', $lang =
'', $sqlfilters =
'')
366 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"c_country as t";
367 $sql .=
" WHERE 1 = 1";
371 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
373 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
374 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
377 $sql .= $this->
db->order($sortfield, $sortorder);
383 $offset = $limit * $page;
385 $sql .= $this->
db->plimit($limit, $offset);
388 $result = $this->
db->query($sql);
391 $num = $this->
db->num_rows($result);
392 $min = min($num, ($limit <= 0 ? $num : $limit));
393 for ($i = 0; $i < $min; $i++) {
394 $obj = $this->
db->fetch_object($result);
396 if ($country->fetch($obj->rowid) > 0) {
401 if (empty($filter) || stripos($country->label, $filter) !==
false) {
407 throw new RestException(503,
'Error when retrieving list of countries');
477 $result = $state->fetch($id, $code);
479 throw new RestException(503,
'Error when retrieving state : '.$state->error);
480 } elseif ($result == 0) {
481 throw new RestException(404,
'State not found');
503 $result = $country->fetch($id, $code, $iso);
506 throw new RestException(503,
'Error when retrieving country : '.$country->error);
507 } elseif ($result == 0) {
508 throw new RestException(404,
'Country not found');
532 public function getAvailability($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
536 if (!DolibarrApiAccess::$user->rights->commande->lire) {
537 throw new RestException(401);
540 $sql =
"SELECT rowid, code, label";
541 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_availability as t";
542 $sql .=
" WHERE t.active = ".$active;
546 throw new RestException(400,
'error when validating parameter sqlfilters '.$sqlfilters);
548 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
549 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
553 $sql .= $this->
db->order($sortfield, $sortorder);
559 $offset = $limit * $page;
561 $sql .= $this->
db->plimit($limit, $offset);
564 $result = $this->
db->query($sql);
567 $num = $this->
db->num_rows($result);
568 $min = min($num, ($limit <= 0 ? $num : $limit));
569 for ($i = 0; $i < $min; $i++) {
570 $list[] = $this->
db->fetch_object($result);
573 throw new RestException(400, $this->
db->lasterror());
589 $object = parent::_cleanObjectDatas($object);
591 unset($object->error);
592 unset($object->errors);
610 if ($this->translations == null || $this->translations->getDefaultLang() !== $lang) {
612 $this->translations =
new Translate(
'', $conf);
613 $this->translations->setDefaultLang($lang);
614 $this->translations->load(
'dict');
617 $key = $prefix.$object->code;
619 $translation = $this->translations->trans($key);
620 if ($translation != $key) {
621 $object->label = html_entity_decode($translation);
643 public function getListOfShipmentMethods($sortfield =
"rowid", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
646 $sql =
"SELECT t.rowid, t.code, t.libelle as label, t.description, t.tracking";
647 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_shipment_mode as t";
648 $sql .=
" WHERE t.active = ".$active;
652 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
654 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
655 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
659 $sql .= $this->
db->order($sortfield, $sortorder);
665 $offset = $limit * $page;
667 $sql .= $this->
db->plimit($limit, $offset);
670 $result = $this->
db->query($sql);
673 $num = $this->
db->num_rows($result);
674 $min = min($num, ($limit <= 0 ? $num : $limit));
675 for ($i = 0; $i < $min; $i++) {
676 $list[] = $this->
db->fetch_object($result);
679 throw new RestException(503,
'Error when retrieving list of shipment methods : '.$this->
db->lasterror());
702 public function getListOfEventTypes($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $type =
'', $module =
'', $active = 1, $sqlfilters =
'')
706 $sql =
"SELECT id, code, type, libelle as label, module";
707 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_actioncomm as t";
708 $sql .=
" WHERE t.active = ".$active;
710 $sql .=
" AND t.type LIKE '%".$this->db->escape($type).
"%'";
713 $sql .=
" AND t.module LIKE '%".$this->db->escape($module).
"%'";
718 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
720 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
721 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
725 $sql .= $this->
db->order($sortfield, $sortorder);
731 $offset = $limit * $page;
733 $sql .= $this->
db->plimit($limit, $offset);
736 $result = $this->
db->query($sql);
739 $num = $this->
db->num_rows($result);
740 $min = min($num, ($limit <= 0 ? $num : $limit));
741 for ($i = 0; $i < $min; $i++) {
742 $list[] = $this->
db->fetch_object($result);
745 throw new RestException(503,
'Error when retrieving list of events types : '.$this->
db->lasterror());
768 public function getListOfExpenseReportsTypes($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $module =
'', $active = 1, $sqlfilters =
'')
772 $sql =
"SELECT id, code, label, accountancy_code, active, module, position";
773 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_type_fees as t";
774 $sql .=
" WHERE t.active = ".$active;
776 $sql .=
" AND t.module LIKE '%".$this->db->escape($module).
"%'";
781 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
783 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
784 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
788 $sql .= $this->
db->order($sortfield, $sortorder);
794 $offset = $limit * $page;
796 $sql .= $this->
db->plimit($limit, $offset);
799 $result = $this->
db->query($sql);
802 $num = $this->
db->num_rows($result);
803 $min = min($num, ($limit <= 0 ? $num : $limit));
804 for ($i = 0; $i < $min; $i++) {
805 $list[] = $this->
db->fetch_object($result);
808 throw new RestException(503,
'Error when retrieving list of expense report types : '.$this->
db->lasterror());
832 public function getListOfContactTypes($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $type =
'', $module =
'', $active = 1, $sqlfilters =
'')
836 $sql =
"SELECT rowid, code, element as type, libelle as label, source, module, position";
837 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_type_contact as t";
838 $sql .=
" WHERE t.active = ".$active;
840 $sql .=
" AND type LIKE '%".$this->db->escape($type).
"%'";
843 $sql .=
" AND t.module LIKE '%".$this->db->escape($module).
"%'";
848 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
850 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
851 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
855 $sql .= $this->
db->order($sortfield, $sortorder);
861 $offset = $limit * $page;
863 $sql .= $this->
db->plimit($limit, $offset);
866 $result = $this->
db->query($sql);
869 $num = $this->
db->num_rows($result);
870 $min = min($num, ($limit <= 0 ? $num : $limit));
871 for ($i = 0; $i < $min; $i++) {
872 $list[] = $this->
db->fetch_object($result);
875 throw new RestException(503,
'Error when retrieving list of contacts types : '.$this->
db->lasterror());
897 public function getListOfCivilities($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $module =
'', $active = 1, $sqlfilters =
'')
901 $sql =
"SELECT rowid, code, label, module";
902 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_civility as t";
903 $sql .=
" WHERE t.active = ".$active;
905 $sql .=
" AND t.module LIKE '%".$this->db->escape($module).
"%'";
910 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
912 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
913 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
917 $sql .= $this->
db->order($sortfield, $sortorder);
923 $offset = $limit * $page;
925 $sql .= $this->
db->plimit($limit, $offset);
928 $result = $this->
db->query($sql);
931 $num = $this->
db->num_rows($result);
932 $min = min($num, ($limit <= 0 ? $num : $limit));
933 for ($i = 0; $i < $min; $i++) {
934 $list[] = $this->
db->fetch_object($result);
937 throw new RestException(503,
'Error when retrieving list of civility : '.$this->
db->lasterror());
959 public function getListOfCurrencies($multicurrency = 0, $sortfield =
"code_iso", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
962 $sql =
"SELECT t.code_iso, t.label, t.unicode";
963 if (!empty($multicurrency)) {
964 $sql .=
" , cr.date_sync, cr.rate ";
966 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_currencies as t";
967 if (!empty($multicurrency)) {
968 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"multicurrency as m ON m.code=t.code_iso";
969 $sql .=
" JOIN ".MAIN_DB_PREFIX.
"multicurrency_rate as cr ON (m.rowid = cr.fk_multicurrency)";
971 $sql .=
" WHERE t.active = ".$active;
972 if (!empty($multicurrency)) {
973 $sql .=
" AND m.entity IN (".getEntity(
'multicurrency').
")";
974 if (!empty($multicurrency) && $multicurrency != 2) {
975 $sql .=
" AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX.
"multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)";
982 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
984 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
985 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
989 $sql .= $this->
db->order($sortfield, $sortorder);
995 $offset = $limit * $page;
997 $sql .= $this->
db->plimit($limit, $offset);
1000 $result = $this->
db->query($sql);
1003 $num = $this->
db->num_rows($result);
1004 $min = min($num, ($limit <= 0 ? $num : $limit));
1005 for ($i = 0; $i < $min; $i++) {
1006 $list[] = $this->
db->fetch_object($result);
1009 throw new RestException(503,
'Error when retrieving list of currency : '.$this->
db->lasterror());
1032 if (!DolibarrApiAccess::$user->admin) {
1033 throw new RestException(401,
'Only an admin user can get list of extrafields');
1036 if ($type ==
'thirdparty') {
1039 if ($type ==
'contact') {
1040 $type =
'socpeople';
1043 $sql =
"SELECT t.rowid, t.name, t.label, t.type, t.size, t.elementtype, t.fieldunique, t.fieldrequired, t.param, t.pos, t.alwayseditable, t.perms, t.list, t.fielddefault, t.fieldcomputed";
1044 $sql .=
" FROM ".MAIN_DB_PREFIX.
"extrafields as t";
1045 $sql .=
" WHERE t.entity IN (".getEntity(
'extrafields').
")";
1046 if (!empty($type)) {
1047 $sql .=
" AND t.elementtype = '".$this->db->escape($type).
"'";
1052 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
1054 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
1055 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
1058 $sql .= $this->
db->order($sortfield, $sortorder);
1063 while ($tab = $this->
db->fetch_object(
$resql)) {
1065 $list[$tab->elementtype][$tab->name][
'type'] = $tab->type;
1066 $list[$tab->elementtype][$tab->name][
'label'] = $tab->label;
1067 $list[$tab->elementtype][$tab->name][
'size'] = $tab->size;
1068 $list[$tab->elementtype][$tab->name][
'elementtype'] = $tab->elementtype;
1069 $list[$tab->elementtype][$tab->name][
'default'] = $tab->fielddefault;
1070 $list[$tab->elementtype][$tab->name][
'computed'] = $tab->fieldcomputed;
1071 $list[$tab->elementtype][$tab->name][
'unique'] = $tab->fieldunique;
1072 $list[$tab->elementtype][$tab->name][
'required'] = $tab->fieldrequired;
1073 $list[$tab->elementtype][$tab->name][
'param'] = ($tab->param ? unserialize($tab->param) :
'');
1074 $list[$tab->elementtype][$tab->name][
'pos'] = $tab->pos;
1075 $list[$tab->elementtype][$tab->name][
'alwayseditable'] = $tab->alwayseditable;
1076 $list[$tab->elementtype][$tab->name][
'perms'] = $tab->perms;
1077 $list[$tab->elementtype][$tab->name][
'list'] = $tab->list;
1081 throw new RestException(503,
'Error when retrieving list of extra fields : '.$this->
db->lasterror());
1084 if (!count($list)) {
1085 throw new RestException(404,
'No extrafield found');
1109 public function getListOfTowns($sortfield =
"zip,town", $sortorder =
'ASC', $limit = 100, $page = 0, $zipcode =
'', $town =
'', $active = 1, $sqlfilters =
'')
1113 $sql =
"SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country";
1114 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_ziptown as t";
1115 $sql .=
" AND t.active = ".$active;
1117 $sql .=
" AND t.zip LIKE '%".$this->db->escape($zipcode).
"%'";
1120 $sql .=
" AND t.town LIKE '%".$this->db->escape($town).
"%'";
1125 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
1127 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
1128 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
1132 $sql .= $this->
db->order($sortfield, $sortorder);
1138 $offset = $limit * $page;
1140 $sql .= $this->
db->plimit($limit, $offset);
1143 $result = $this->
db->query($sql);
1146 $num = $this->
db->num_rows($result);
1147 $min = min($num, ($limit <= 0 ? $num : $limit));
1148 for ($i = 0; $i < $min; $i++) {
1149 $list[] = $this->
db->fetch_object($result);
1152 throw new RestException(503,
'Error when retrieving list of towns : '.$this->
db->lasterror());
1174 public function getPaymentTerms($sortfield =
"sortorder", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
1178 if (!DolibarrApiAccess::$user->rights->propal->lire && !DolibarrApiAccess::$user->rights->commande->lire && !DolibarrApiAccess::$user->rights->facture->lire) {
1179 throw new RestException(401);
1182 $sql =
"SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
1183 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_payment_term as t";
1184 $sql .=
" WHERE t.entity IN (".getEntity(
'c_payment_term').
")";
1185 $sql .=
" AND t.active = ".$active;
1189 throw new RestException(400,
'Error when validating parameter sqlfilters '.$sqlfilters);
1191 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
1192 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
1196 $sql .= $this->
db->order($sortfield, $sortorder);
1202 $offset = $limit * $page;
1204 $sql .= $this->
db->plimit($limit, $offset);
1207 $result = $this->
db->query($sql);
1210 $num = $this->
db->num_rows($result);
1211 $min = min($num, ($limit <= 0 ? $num : $limit));
1212 for ($i = 0; $i < $min; $i++) {
1213 $list[] = $this->
db->fetch_object($result);
1216 throw new RestException(400, $this->
db->lasterror());
1240 $sql =
"SELECT rowid as id, code, libelle as label, description, tracking, module";
1241 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_shipment_mode as t";
1242 $sql .=
" WHERE t.entity IN (".getEntity(
'c_shipment_mode').
")";
1243 $sql .=
" AND t.active = ".$active;
1247 throw new RestException(400,
'Error when validating parameter sqlfilters '.$sqlfilters);
1249 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
1250 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
1260 $offset = $limit * $page;
1262 $sql .= $this->
db->plimit($limit, $offset);
1265 $result = $this->
db->query($sql);
1268 $num = $this->
db->num_rows($result);
1269 $min = min($num, ($limit <= 0 ? $num : $limit));
1270 for ($i = 0; $i < $min; $i++) {
1271 $list[] = $this->
db->fetch_object($result);
1274 throw new RestException(400, $this->
db->lasterror());
1295 public function getListOfMeasuringUnits($sortfield =
"rowid", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
1300 $sql =
"SELECT t.rowid, t.code, t.label,t.short_label, t.active, t.scale, t.unit_type";
1301 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_units as t";
1302 $sql .=
" WHERE t.active = ".$active;
1306 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
1308 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
1309 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
1313 $sql .= $this->
db->order($sortfield, $sortorder);
1319 $offset = $limit * $page;
1321 $sql .= $this->
db->plimit($limit, $offset);
1324 $result = $this->
db->query($sql);
1327 $num = $this->
db->num_rows($result);
1328 $min = min($num, ($limit <= 0 ? $num : $limit));
1329 for ($i = 0; $i < $min; $i++) {
1330 $list[] = $this->
db->fetch_object($result);
1333 throw new RestException(503,
'Error when retrieving list of measuring units: '.$this->
db->lasterror());
1354 public function getListOfsocialNetworks($sortfield =
"rowid", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
1358 if (empty($conf->socialnetworks->enabled)) {
1359 throw new RestException(400,
'API not available: this dictionary is not enabled by setup');
1364 $sql =
"SELECT t.rowid, t.entity, t.code, t.label, t.url, t.icon, t.active";
1365 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_socialnetworks as t";
1366 $sql .=
" WHERE t.entity IN (".getEntity(
'c_socialnetworks').
")";
1367 $sql .=
" AND t.active = ".$active;
1371 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
1373 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
1374 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
1378 $sql .= $this->
db->order($sortfield, $sortorder);
1384 $offset = $limit * $page;
1386 $sql .= $this->
db->plimit($limit, $offset);
1389 $result = $this->
db->query($sql);
1392 $num = $this->
db->num_rows($result);
1393 $min = min($num, ($limit <= 0 ? $num : $limit));
1394 for ($i = 0; $i < $min; $i++) {
1395 $list[] = $this->
db->fetch_object($result);
1398 throw new RestException(503,
'Error when retrieving list of social networks: '.$this->
db->lasterror());
1419 public function getTicketsCategories($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
1423 $sql =
"SELECT rowid, code, pos, label, use_default, description";
1424 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_ticket_category as t";
1425 $sql .=
" WHERE t.active = ".$active;
1429 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
1431 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
1432 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
1436 $sql .= $this->
db->order($sortfield, $sortorder);
1442 $offset = $limit * $page;
1444 $sql .= $this->
db->plimit($limit, $offset);
1447 $result = $this->
db->query($sql);
1450 $num = $this->
db->num_rows($result);
1451 $min = min($num, ($limit <= 0 ? $num : $limit));
1452 for ($i = 0; $i < $min; $i++) {
1453 $list[] = $this->
db->fetch_object($result);
1456 throw new RestException(503,
'Error when retrieving list of ticket categories : '.$this->
db->lasterror());
1477 public function getTicketsSeverities($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
1481 $sql =
"SELECT rowid, code, pos, label, use_default, color, description";
1482 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_ticket_severity as t";
1483 $sql .=
" WHERE t.active = ".$active;
1487 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
1489 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
1490 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
1494 $sql .= $this->
db->order($sortfield, $sortorder);
1500 $offset = $limit * $page;
1502 $sql .= $this->
db->plimit($limit, $offset);
1505 $result = $this->
db->query($sql);
1508 $num = $this->
db->num_rows($result);
1509 $min = min($num, ($limit <= 0 ? $num : $limit));
1510 for ($i = 0; $i < $min; $i++) {
1511 $list[] = $this->
db->fetch_object($result);
1514 throw new RestException(503,
'Error when retrieving list of ticket severities : '.$this->
db->lasterror());
1535 public function getTicketsTypes($sortfield =
"code", $sortorder =
'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters =
'')
1539 $sql =
"SELECT rowid, code, pos, label, use_default, description";
1540 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_ticket_type as t";
1541 $sql .=
" WHERE t.active = ".(int) $active;
1547 throw new RestException(503,
'Error when validating parameter sqlfilters '.$sqlfilters);
1549 $regexstring =
'\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
1550 $sql .=
" AND (".preg_replace_callback(
'/'.$regexstring.
'/',
'DolibarrApi::_forge_criteria_callback', $sqlfilters).
")";
1554 $sql .= $this->
db->order($sortfield, $sortorder);
1560 $offset = $limit * $page;
1562 $sql .= $this->
db->plimit($limit, $offset);
1565 $result = $this->
db->query($sql);
1568 $num = $this->
db->num_rows($result);
1569 $min = min($num, ($limit <= 0 ? $num : $limit));
1570 for ($i = 0; $i < $min; $i++) {
1571 $list[] = $this->
db->fetch_object($result);
1574 throw new RestException(503,
'Error when retrieving list of ticket types : '.$this->
db->lasterror());
1591 global $conf, $mysoc;
1593 if (!DolibarrApiAccess::$user->admin
1594 && (empty($conf->global->API_LOGINS_ALLOWED_FOR_GET_COMPANY) || DolibarrApiAccess::$user->login != $conf->global->API_LOGINS_ALLOWED_FOR_GET_COMPANY)) {
1595 throw new RestException(403,
'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_GET_COMPANY');
1598 unset($mysoc->skype);
1599 unset($mysoc->twitter);
1600 unset($mysoc->facebook);
1601 unset($mysoc->linkedin);
1603 unset($mysoc->pays);
1604 unset($mysoc->note);
1607 unset($mysoc->lines);
1609 unset($mysoc->effectif);
1610 unset($mysoc->effectif_id);
1611 unset($mysoc->forme_juridique_code);
1612 unset($mysoc->forme_juridique);
1613 unset($mysoc->mode_reglement_supplier_id);
1614 unset($mysoc->cond_reglement_supplier_id);
1615 unset($mysoc->transport_mode_supplier_id);
1616 unset($mysoc->fk_prospectlevel);
1618 unset($mysoc->total_ht);
1619 unset($mysoc->total_tva);
1620 unset($mysoc->total_localtax1);
1621 unset($mysoc->total_localtax2);
1622 unset($mysoc->total_ttc);
1624 unset($mysoc->lastname);
1625 unset($mysoc->firstname);
1626 unset($mysoc->civility_id);
1628 unset($mysoc->client);
1629 unset($mysoc->prospect);
1630 unset($mysoc->fournisseur);
1631 unset($mysoc->contact_id);
1633 unset($mysoc->fk_incoterms);
1634 unset($mysoc->label_incoterms);
1635 unset($mysoc->location_incoterms);
1658 if (!DolibarrApiAccess::$user->admin
1659 && (empty($conf->global->API_LOGINS_ALLOWED_FOR_CONST_READ) || DolibarrApiAccess::$user->login != $conf->global->API_LOGINS_ALLOWED_FOR_CONST_READ)) {
1660 throw new RestException(403,
'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_CONST_READ');
1663 if (!preg_match(
'/^[a-zA-Z0-9_]+$/', $constantname) || !isset($conf->global->$constantname)) {
1664 throw new RestException(404,
'Error Bad or unknown value for constantname');
1667 throw new RestException(403,
'Forbidden. This parameter cant be read with APIs');
1670 return $conf->global->$constantname;
1688 global $langs, $conf;
1690 if (!DolibarrApiAccess::$user->admin
1691 && (empty($conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK)) {
1692 throw new RestException(403,
'Error API open to admin users only or to the users with logins defined into constant API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK');
1695 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
1696 require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
1698 $langs->load(
"admin");
1700 $outexpectedchecksum =
'';
1701 $outcurrentchecksum =
'';
1704 $file_list = array(
'missing' => array(),
'updated' => array());
1707 $xmlshortfile =
GETPOST(
'xmlshortfile') ?
GETPOST(
'xmlshortfile') :
'/install/filelist-'.DOL_VERSION.
'.xml';
1708 $xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile;
1710 $xmlremote = ($target ==
'default' ?
'' : $target);
1711 if (empty($xmlremote) && !empty($conf->global->MAIN_FILECHECK_URL)) {
1712 $xmlremote = $conf->global->MAIN_FILECHECK_URL;
1714 $param =
'MAIN_FILECHECK_URL_'.DOL_VERSION;
1715 if (empty($xmlremote) && !empty($conf->global->$param)) {
1716 $xmlremote = $conf->global->$param;
1718 if (empty($xmlremote)) {
1719 $xmlremote =
'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.
'.xml';
1722 if ($target ==
'local') {
1724 $xml = simplexml_load_file($xmlfile);
1726 throw new RestException(500, $langs->trans(
'XmlNotFound').
': '.$xmlfile);
1732 if (!$xmlarray[
'curl_error_no'] && $xmlarray[
'http_code'] !=
'400' && $xmlarray[
'http_code'] !=
'404') {
1733 $xmlfile = $xmlarray[
'content'];
1735 $xml = simplexml_load_string($xmlfile);
1737 $errormsg = $langs->trans(
'XmlNotFound').
': '.$xmlremote.
' - '.$xmlarray[
'http_code'].
' '.$xmlarray[
'curl_error_no'].
' '.$xmlarray[
'curl_error_msg'];
1738 throw new RestException(500, $errormsg);
1743 $checksumconcat = array();
1744 $file_list = array();
1748 if (is_object($xml->dolibarr_constants[0])) {
1751 $out .=
'<div class="div-table-responsive-no-min">';
1752 $out .=
'<table class="noborder">';
1753 $out .=
'<tr class="liste_titre">';
1754 $out .=
'<td>#</td>';
1755 $out .=
'<td>'.$langs->trans(
"Constant").
'</td>';
1756 $out .=
'<td class="center">'.$langs->trans(
"ExpectedValue").
'</td>';
1757 $out .=
'<td class="center">'.$langs->trans(
"Value").
'</td>';
1758 $out .=
'</tr>'.
"\n";
1761 foreach ($xml->dolibarr_constants[0]->constant as $constant) {
1762 $constname = $constant[
'name'];
1763 $constvalue = (string) $constant;
1764 $constvalue = (empty($constvalue) ?
'0' : $constvalue);
1767 if ($constname && $conf->global->$constname !=
'') {
1768 $value = $conf->global->$constname;
1770 $valueforchecksum = (empty($value) ?
'0' : $value);
1772 $checksumconcat[] = $valueforchecksum;
1775 $out .=
'<tr class="oddeven">';
1776 $out .=
'<td>'.$i.
'</td>'.
"\n";
1777 $out .=
'<td>'.$constname.
'</td>'.
"\n";
1778 $out .=
'<td class="center">'.$constvalue.
'</td>'.
"\n";
1779 $out .=
'<td class="center">'.$valueforchecksum.
'</td>'.
"\n";
1784 $out .=
'<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
1793 if (is_object($xml->dolibarr_htdocs_dir[0])) {
1794 $includecustom = (empty($xml->dolibarr_htdocs_dir[0][
'includecustom']) ? 0 : $xml->dolibarr_htdocs_dir[0][
'includecustom']);
1797 $regextoinclude =
'\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
1798 $regextoexclude =
'('.($includecustom ?
'' :
'custom|').
'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$';
1799 $scanfiles =
dol_dir_list(DOL_DOCUMENT_ROOT,
'files', 1, $regextoinclude, $regextoexclude);
1802 $ret =
getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0],
'', DOL_DOCUMENT_ROOT, $checksumconcat);
1804 foreach ($scanfiles as $keyfile => $valfile) {
1805 $tmprelativefilename = preg_replace(
'/^'.preg_quote(DOL_DOCUMENT_ROOT,
'/').
'/',
'', $valfile[
'fullname']);
1806 if (!in_array($tmprelativefilename, $file_list[
'insignature'])) {
1807 $md5newfile = @md5_file($valfile[
'fullname']);
1808 $file_list[
'added'][] = array(
'filename'=>$tmprelativefilename,
'md5'=>$md5newfile);
1815 $out .=
'<div class="div-table-responsive-no-min">';
1816 $out .=
'<table class="noborder">';
1817 $out .=
'<tr class="liste_titre">';
1818 $out .=
'<td>#</td>';
1819 $out .=
'<td>'.$langs->trans(
"Filename").
'</td>';
1820 $out .=
'<td class="center">'.$langs->trans(
"ExpectedChecksum").
'</td>';
1821 $out .=
'</tr>'.
"\n";
1822 $tmpfilelist =
dol_sort_array($file_list[
'missing'],
'filename');
1823 if (is_array($tmpfilelist) && count($tmpfilelist)) {
1825 foreach ($tmpfilelist as $file) {
1827 $out .=
'<tr class="oddeven">';
1828 $out .=
'<td>'.$i.
'</td>'.
"\n";
1829 $out .=
'<td>'.$file[
'filename'].
'</td>'.
"\n";
1830 $out .=
'<td class="center">'.$file[
'expectedmd5'].
'</td>'.
"\n";
1834 $out .=
'<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
1845 $out .=
'<div class="div-table-responsive-no-min">';
1846 $out .=
'<table class="noborder">';
1847 $out .=
'<tr class="liste_titre">';
1848 $out .=
'<td>#</td>';
1849 $out .=
'<td>'.$langs->trans(
"Filename").
'</td>';
1850 $out .=
'<td class="center">'.$langs->trans(
"ExpectedChecksum").
'</td>';
1851 $out .=
'<td class="center">'.$langs->trans(
"CurrentChecksum").
'</td>';
1852 $out .=
'<td class="right">'.$langs->trans(
"Size").
'</td>';
1853 $out .=
'<td class="right">'.$langs->trans(
"DateModification").
'</td>';
1854 $out .=
'</tr>'.
"\n";
1855 $tmpfilelist2 =
dol_sort_array($file_list[
'updated'],
'filename');
1856 if (is_array($tmpfilelist2) && count($tmpfilelist2)) {
1858 foreach ($tmpfilelist2 as $file) {
1860 $out .=
'<tr class="oddeven">';
1861 $out .=
'<td>'.$i.
'</td>'.
"\n";
1862 $out .=
'<td>'.$file[
'filename'].
'</td>'.
"\n";
1863 $out .=
'<td class="center">'.$file[
'expectedmd5'].
'</td>'.
"\n";
1864 $out .=
'<td class="center">'.$file[
'md5'].
'</td>'.
"\n";
1865 $size =
dol_filesize(DOL_DOCUMENT_ROOT.
'/'.$file[
'filename']);
1866 $totalsize += $size;
1867 $out .=
'<td class="right">'.dol_print_size($size).
'</td>'.
"\n";
1868 $out .=
'<td class="right">'.dol_print_date(
dol_filemtime(DOL_DOCUMENT_ROOT.
'/'.$file[
'filename']),
'dayhour').
'</td>'.
"\n";
1871 $out .=
'<tr class="liste_total">';
1872 $out .=
'<td></td>'.
"\n";
1873 $out .=
'<td>'.$langs->trans(
"Total").
'</td>'.
"\n";
1874 $out .=
'<td align="center"></td>'.
"\n";
1875 $out .=
'<td align="center"></td>'.
"\n";
1876 $out .=
'<td class="right">'.dol_print_size($totalsize).
'</td>'.
"\n";
1877 $out .=
'<td class="right"></td>'.
"\n";
1880 $out .=
'<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
1891 $out .=
'<div class="div-table-responsive-no-min">';
1892 $out .=
'<table class="noborder">';
1893 $out .=
'<tr class="liste_titre">';
1894 $out .=
'<td>#</td>';
1895 $out .=
'<td>'.$langs->trans(
"Filename").
'</td>';
1896 $out .=
'<td class="center">'.$langs->trans(
"ExpectedChecksum").
'</td>';
1897 $out .=
'<td class="center">'.$langs->trans(
"CurrentChecksum").
'</td>';
1898 $out .=
'<td class="right">'.$langs->trans(
"Size").
'</td>';
1899 $out .=
'<td class="right">'.$langs->trans(
"DateModification").
'</td>';
1900 $out .=
'</tr>'.
"\n";
1902 if (is_array($tmpfilelist3) && count($tmpfilelist3)) {
1904 foreach ($tmpfilelist3 as $file) {
1906 $out .=
'<tr class="oddeven">';
1907 $out .=
'<td>'.$i.
'</td>'.
"\n";
1908 $out .=
'<td>'.$file[
'filename'].
'</td>'.
"\n";
1909 $out .=
'<td class="center">'.$file[
'expectedmd5'].
'</td>'.
"\n";
1910 $out .=
'<td class="center">'.$file[
'md5'].
'</td>'.
"\n";
1911 $size =
dol_filesize(DOL_DOCUMENT_ROOT.
'/'.$file[
'filename']);
1912 $totalsize += $size;
1913 $out .=
'<td class="right">'.dol_print_size($size).
'</td>'.
"\n";
1914 $out .=
'<td class="right">'.dol_print_date(
dol_filemtime(DOL_DOCUMENT_ROOT.
'/'.$file[
'filename']),
'dayhour').
'</td>'.
"\n";
1917 $out .=
'<tr class="liste_total">';
1918 $out .=
'<td></td>'.
"\n";
1919 $out .=
'<td>'.$langs->trans(
"Total").
'</td>'.
"\n";
1920 $out .=
'<td align="center"></td>'.
"\n";
1921 $out .=
'<td align="center"></td>'.
"\n";
1922 $out .=
'<td class="right">'.dol_print_size($totalsize).
'</td>'.
"\n";
1923 $out .=
'<td class="right"></td>'.
"\n";
1926 $out .=
'<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
1933 if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3)) {
1939 throw new RestException(500,
'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile);
1944 asort($checksumconcat);
1945 $checksumget = md5(join(
',', $checksumconcat));
1946 $checksumtoget = trim((
string) $xml->dolibarr_htdocs_dir_checksum);
1948 $outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans(
"Unknown"));
1949 if ($checksumget == $checksumtoget) {
1950 if (count($file_list[
'added'])) {
1951 $resultcode =
'warning';
1952 $resultcomment =
'FileIntegrityIsOkButFilesWereAdded';
1954 $outcurrentchecksum = $checksumget;
1957 $resultcomment =
'Success';
1959 $outcurrentchecksum = $checksumget;
1962 $resultcode =
'error';
1963 $resultcomment =
'Error';
1965 $outcurrentchecksum = $checksumget;
1968 throw new RestException(404,
'No signature file known');
1971 return array(
'resultcode'=>$resultcode,
'resultcomment'=>$resultcomment,
'expectedchecksum'=> $outexpectedchecksum,
'currentchecksum'=> $outcurrentchecksum,
'out'=>$out);
1988 if (!DolibarrApiAccess::$user->admin
1989 && (empty($conf->global->API_LOGIN_ALLOWED_FOR_GET_MODULES) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_GET_MODULES)) {
1990 throw new RestException(403,
'Error API open to admin users only or to the users with logins defined into constant API_LOGIN_ALLOWED_FOR_GET_MODULES');
1993 sort($conf->modules);
getAvailability($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of delivery times.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getListOfContactTypes($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $type= '', $module= '', $active=1, $sqlfilters= '')
Get the list of contacts types.
getOrderingMethods($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of ordering methods.
getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path= '', $pathref= '', &$checksumconcat=array())
Function to get list of updated or modified files.
getListOfExtrafields($sortfield="t.pos", $sortorder= 'ASC', $type= '', $sqlfilters= '')
Get the list of extra fields.
_fetchCcountry($id, $code= '', $iso= '', $lang= '')
Get country.
getCountryByISO($iso, $lang= '')
Get country by Iso.
getCheckIntegrity($target)
Do a test of integrity for files and setup.
getOrderingOrigins($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of ordering origins.
getListOfStates($sortfield="code_departement", $sortorder= 'ASC', $limit=100, $page=0, $filter= '', $sqlfilters= '')
Get the list of states/provinces.
getListOfShipmentMethods($sortfield="rowid", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of shipment methods.
getTicketsTypes($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of tickets types.
isASecretKey($keyname)
Return if string has a name dedicated to store a secret.
dol_filesize($pathoffile)
Return size of a file.
getPaymentTypes($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of payments types.
Class to manage dictionary States (used by imports)
getListOfsocialNetworks($sortfield="rowid", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of social networks.
getURLContent($url, $postorget= 'GET', $param= '', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0)
Function to get a content from an URL (use proxy if proxy defined).
getShippingModes($limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of shipping methods.
$conf db
API class for accounts.
Class to manage dictionary Countries (used by imports)
__construct()
Constructor.
_checkFilters($sqlfilters)
Return if a $sqlfilters parameter is valid.
getCountryByCode($code, $lang= '')
Get country by Code.
getConf($constantname)
Get value of a setup variables.
getCompany()
Get properties of company.
getListOfExpenseReportsTypes($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $module= '', $active=1, $sqlfilters= '')
Get the list of Expense Report types.
getPaymentTerms($sortfield="sortorder", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of payments terms.
getListOfCurrencies($multicurrency=0, $sortfield="code_iso", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of currencies.
_fetchCstate($id, $code= '')
Get state.
getListOfMeasuringUnits($sortfield="rowid", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of measuring units.
getStateByID($id)
Get state by ID.
translateLabel($object, $lang, $prefix= 'Country')
Translate the name of the object to the given language.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
getListOfCivilities($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $module= '', $active=1, $sqlfilters= '')
Get the list of civilities.
getStateByCode($code)
Get state by Code.
getTicketsSeverities($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of tickets severity.
Class to manage translations.
getListOfCountries($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $filter= '', $lang= '', $sqlfilters= '')
Get the list of countries.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
dol_is_file($pathoffile)
Return if path is a file.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
getModules()
Get list of enabled modules.
dol_filemtime($pathoffile)
Return time of a file.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->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)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
_cleanObjectDatas($object)
Clean sensible object datas.
getTicketsCategories($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $active=1, $sqlfilters= '')
Get the list of tickets categories.
getListOfEventTypes($sortfield="code", $sortorder= 'ASC', $limit=100, $page=0, $type= '', $module= '', $active=1, $sqlfilters= '')
Get the list of events types.
getListOfTowns($sortfield="zip,town", $sortorder= 'ASC', $limit=100, $page=0, $zipcode= '', $town= '', $active=1, $sqlfilters= '')
Get the list of towns.
getCountryByID($id, $lang= '')
Get country by ID.