forked from Wavyzz/dolibarr
Fix #yogosha15157
This commit is contained in:
@@ -238,11 +238,10 @@ class Members extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -103,11 +103,10 @@ class MembersTypes extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -101,11 +101,10 @@ class Subscriptions extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ class DolibarrApi
|
|||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Return if a $sqlfilters parameter is valid
|
* Return if a $sqlfilters parameter is valid
|
||||||
|
* Function no more used. Kept for backward compatibility with old APIs of modules
|
||||||
*
|
*
|
||||||
* @param string $sqlfilters sqlfilter string
|
* @param string $sqlfilters sqlfilter string
|
||||||
* @param string $error Error message
|
* @param string $error Error message
|
||||||
@@ -317,7 +318,8 @@ class DolibarrApi
|
|||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
/**
|
/**
|
||||||
* Function to forge a SQL criteria from a Generic filter string
|
* Function to forge a SQL criteria from a Generic filter string.
|
||||||
|
* Function no more used. Kept for backward compatibility with old APIs of modules
|
||||||
*
|
*
|
||||||
* @param array $matches Array of found string by regex search.
|
* @param array $matches Array of found string by regex search.
|
||||||
* Each entry is 1 and only 1 criteria.
|
* Each entry is 1 and only 1 criteria.
|
||||||
|
|||||||
@@ -77,11 +77,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -141,11 +140,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -206,11 +204,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -277,11 +274,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
@@ -378,11 +374,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
@@ -554,11 +549,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -669,11 +663,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -733,11 +726,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -802,11 +794,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -868,11 +859,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -943,11 +933,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1014,11 +1003,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
@@ -1088,11 +1076,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1153,11 +1140,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1213,11 +1199,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1274,11 +1259,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1337,11 +1321,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1396,11 +1379,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1462,11 +1444,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1523,11 +1504,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1586,11 +1566,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1650,11 +1629,10 @@ class Setup extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class Asset extends CommonObject
|
|||||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
||||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1', 'comment'=>"Reference of object"),
|
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1', 'comment'=>"Reference of object"),
|
||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2', 'validate'=>'1',),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2', 'validate'=>'1',),
|
||||||
'fk_asset_model' => array('type'=>'integer:AssetModel:asset/class/assetmodel.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'AssetModel', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'validate'=>'1',),
|
'fk_asset_model' => array('type'=>'integer:AssetModel:asset/class/assetmodel.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label'=>'AssetModel', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'validate'=>'1',),
|
||||||
'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>0, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp', 'validate'=>'1',),
|
'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>0, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp', 'validate'=>'1',),
|
||||||
'acquisition_type' => array('type'=>'smallint', 'label'=>'AssetAcquisitionType', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'AssetAcquisitionTypeNew', '1'=>'AssetAcquisitionTypeOccasion'), 'validate'=>'1',),
|
'acquisition_type' => array('type'=>'smallint', 'label'=>'AssetAcquisitionType', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'AssetAcquisitionTypeNew', '1'=>'AssetAcquisitionTypeOccasion'), 'validate'=>'1',),
|
||||||
'asset_type' => array('type'=>'smallint', 'label'=>'AssetType', 'enabled'=>'1', 'position'=>70, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'AssetTypeIntangible', '1'=>'AssetTypeTangible', '2'=>'AssetTypeInProgress', '3'=>'AssetTypeFinancial'), 'validate'=>'1',),
|
'asset_type' => array('type'=>'smallint', 'label'=>'AssetType', 'enabled'=>'1', 'position'=>70, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('0'=>'AssetTypeIntangible', '1'=>'AssetTypeTangible', '2'=>'AssetTypeInProgress', '3'=>'AssetTypeFinancial'), 'validate'=>'1',),
|
||||||
|
|||||||
@@ -150,11 +150,10 @@ class Boms extends DolibarrApi
|
|||||||
}
|
}
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class Booking extends CommonObject
|
|||||||
public $fields=array(
|
public $fields=array(
|
||||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
||||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1.2, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'validate'=>'1', 'comment'=>"Reference of object"),
|
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1.2, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'validate'=>'1', 'comment'=>"Reference of object"),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) and (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"LinkToThirparty", 'validate'=>'1',),
|
||||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'validate'=>'1',),
|
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'validate'=>'1',),
|
||||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',),
|
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',),
|
||||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),
|
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),
|
||||||
|
|||||||
@@ -149,11 +149,10 @@ class Categories extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -159,11 +159,10 @@ class AgendaEvents extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -204,11 +204,10 @@ class Proposals extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
@@ -309,14 +308,14 @@ class Proposals extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sqlfilters)) {
|
if (!empty($sqlfilters)) {
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
$errormessage = '';
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
$sql = forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
|
||||||
$filters = " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->propal->getLinesArray($filters);
|
$this->propal->getLinesArray($sql);
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ($this->propal->lines as $line) {
|
foreach ($this->propal->lines as $line) {
|
||||||
array_push($result, $this->_cleanObjectDatas($line));
|
array_push($result, $this->_cleanObjectDatas($line));
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ class Propal extends CommonObject
|
|||||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
|
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
|
||||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
||||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23),
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>24),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>24),
|
||||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||||
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||||
|
|||||||
@@ -208,11 +208,10 @@ class Orders extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ class Commande extends CommonOrder
|
|||||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
|
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
|
||||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
|
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
|
||||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>25),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>25),
|
||||||
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
|
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60),
|
||||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
|
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
|
||||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||||
|
|||||||
@@ -82,11 +82,10 @@ class BankAccounts extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
@@ -440,11 +439,10 @@ class BankAccounts extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= " ORDER BY rowid";
|
$sql .= " ORDER BY rowid";
|
||||||
|
|||||||
@@ -237,11 +237,10 @@ class Invoices extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice
|
|||||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
|
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
|
||||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
|
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
|
||||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>85),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>85),
|
||||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ class Facture extends CommonInvoice
|
|||||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>167),
|
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>167),
|
||||||
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>168),
|
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>168),
|
||||||
'fk_facture_source' =>array('type'=>'integer', 'label'=>'SourceInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
'fk_facture_source' =>array('type'=>'integer', 'label'=>'SourceInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||||
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
|
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
|
||||||
|
|||||||
@@ -148,11 +148,10 @@ class Contracts extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ class Contrat extends CommonObject
|
|||||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||||
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70),
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>75),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>75),
|
||||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||||
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
||||||
|
|||||||
@@ -7769,40 +7769,6 @@ class Form
|
|||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to forge a SQL criteria from a Dolibarr filter syntax string.
|
|
||||||
*
|
|
||||||
* @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL"
|
|
||||||
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
|
||||||
*/
|
|
||||||
protected static function forgeCriteriaCallback($matches)
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
|
|
||||||
//dol_syslog("Convert matches ".$matches[1]);
|
|
||||||
if (empty($matches[1])) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
$tmp = explode(':', $matches[1]);
|
|
||||||
if (count($tmp) < 3) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$tmpescaped = $tmp[2];
|
|
||||||
$regbis = array();
|
|
||||||
|
|
||||||
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
|
||||||
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
|
||||||
} else {
|
|
||||||
$tmpescaped = $db->escape($tmpescaped);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($tmp[1] == '!=') {
|
|
||||||
$tmp[1] = '<>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output html form to select an object.
|
* Output html form to select an object.
|
||||||
@@ -7916,12 +7882,11 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
if ($filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||||
/*if (! DolibarrApi::_checkFilters($filter))
|
$errormessage = '';
|
||||||
{
|
$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$filter);
|
if ($errormessage) {
|
||||||
}*/
|
return 'Error forging a SQL request from an universal criteria: '.$errormessage;
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
}
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'Form::forgeCriteriaCallback', $filter).")";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= $this->db->order($sortfield ? $sortfield : $fieldstoshow, "ASC");
|
$sql .= $this->db->order($sortfield ? $sortfield : $fieldstoshow, "ASC");
|
||||||
@@ -10275,14 +10240,12 @@ class Form
|
|||||||
$search_component_params_hidden .= '('.$search_component_params_hidden.')';
|
$search_component_params_hidden .= '('.$search_component_params_hidden.')';
|
||||||
}
|
}
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!dolCheckFilters($search_component_params_hidden, $errormessage)) {
|
$searchtags = forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage);
|
||||||
print 'ERROR in parsing search string';
|
if ($errormessage) {
|
||||||
|
print 'ERROR in parsing search string: '.dol_escape_htmltag($errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
//var_dump($searchtags);
|
||||||
//var_dump($search_component_params_hidden);
|
$ret .= '<span class="marginleftonlyshort valignmiddle tagsearch"><span class="tagsearchdelete select2-selection__choice__remove">x</span> '.dol_escape_htmltag($searchtags).'</span>';
|
||||||
$htmltags = preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $search_component_params_hidden);
|
|
||||||
//var_dump($htmltags);
|
|
||||||
$ret .= '<span class="marginleftonlyshort valignmiddle tagsearch"><span class="tagsearchdelete select2-selection__choice__remove">x</span> '.$htmltags.'</span>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//$ret .= '<button type="submit" class="liste_titre button_search paddingleftonly" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
//$ret .= '<button type="submit" class="liste_titre button_search paddingleftonly" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||||
|
|||||||
@@ -295,12 +295,7 @@ if (is_array($search_groupby) && count($search_groupby)) {
|
|||||||
$sqlfilters = GETPOST('search_component_params_hidden', 'alphanohtml');
|
$sqlfilters = GETPOST('search_component_params_hidden', 'alphanohtml');
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (dolCheckFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " WHERE (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $sqlfilters).")";
|
|
||||||
} else {
|
|
||||||
print $errormessage;
|
|
||||||
}
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$sql .= " LIMIT ".((int) ($MAXUNIQUEVALFORGROUP + 1));
|
$sql .= " LIMIT ".((int) ($MAXUNIQUEVALFORGROUP + 1));
|
||||||
@@ -681,11 +676,9 @@ if (!empty($search_measures) && !empty($search_xaxis)) {
|
|||||||
$sqlfilters = $search_component_params_hidden;
|
$sqlfilters = $search_component_params_hidden;
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (dolCheckFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
if ($errormessage) {
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $sqlfilters).")";
|
print dol_escape_htmltag($errormessage);
|
||||||
} else {
|
|
||||||
print $errormessage;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= " GROUP BY ";
|
$sql .= " GROUP BY ";
|
||||||
|
|||||||
@@ -11522,17 +11522,35 @@ function jsonOrUnserialize($stringtodecode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* forgeSQLFromUniversalSearchCriteria
|
||||||
|
*
|
||||||
|
* @param string $filter String with universal search string
|
||||||
|
* @param string $error Error message
|
||||||
|
* @return string Return forged SQL string
|
||||||
|
*/
|
||||||
|
function forgeSQLFromUniversalSearchCriteria($filter, &$error = '')
|
||||||
|
{
|
||||||
|
$regexstring = '\(([a-zA-Z0-9_\.]+:[<>!=insotlke]+:[^\(\)]+)\)'; // Must be (aaa:bbb:...) with aaa is a field name (with alias or not) and bbb is one of this operator '=', '<', '>', '<=', '>=', '!=', 'in', 'notin', 'like', 'notlike', 'is', 'isnot'
|
||||||
|
|
||||||
|
if (!dolCheckFilters($filter, $error)) {
|
||||||
|
return '1 = 2'; // Bad balance of parenthesis, we force a SQL not found
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test the filter syntax
|
||||||
|
$t = preg_replace_callback('/'.$regexstring.'/i', 'dolForgeDummyCriteriaCallback', $filter);
|
||||||
|
$t = str_replace(array('and','or','AND','OR',' '), '', $t); // Remove the only strings allowed between each () criteria
|
||||||
|
// If the string result contains something else than '()', the syntax was wrong
|
||||||
|
if (preg_match('/[^\(\)]/', $t)) {
|
||||||
|
$error = 'Bad syntax of the search string, filter criteria is inhalited';
|
||||||
|
return '1 = 3'; // Bad syntax of the search string, we force a SQL not found
|
||||||
|
}
|
||||||
|
|
||||||
|
return " AND (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $filter).")";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return if a $sqlfilters parameter is valid and will pass the preg_replace_callback() to replace Generic filter string with SQL filter string
|
* Return if a $sqlfilters parameter has a valid balance of parenthesis
|
||||||
* Example of usage:
|
|
||||||
* if ($sqlfilters) {
|
|
||||||
* $errormessage = '';
|
|
||||||
* if (dolCheckFilters($sqlfilters, $errormessage)) {
|
|
||||||
* $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
* $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $sqlfilters).")";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
*
|
||||||
* @param string $sqlfilters sqlfilter string
|
* @param string $sqlfilters sqlfilter string
|
||||||
* @param string $error Error message
|
* @param string $error Error message
|
||||||
@@ -11553,7 +11571,7 @@ function dolCheckFilters($sqlfilters, &$error = '')
|
|||||||
$counter--;
|
$counter--;
|
||||||
}
|
}
|
||||||
if ($counter < 0) {
|
if ($counter < 0) {
|
||||||
$error = "Bad sqlfilters=".$sqlfilters;
|
$error = "Wrond balance of parenthesis in sqlfilters=".$sqlfilters;
|
||||||
dol_syslog($error, LOG_WARNING);
|
dol_syslog($error, LOG_WARNING);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -11563,58 +11581,92 @@ function dolCheckFilters($sqlfilters, &$error = '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to forge a SQL criteria from a Generic filter string.
|
* Function to forge a SQL criteria from a Dolibarr filter syntax string.
|
||||||
* Example of usage:
|
* This method is called by forgeSQLFromUniversalSearchCriteria()
|
||||||
* if ($sqlfilters) {
|
|
||||||
* $errormessage = '';
|
|
||||||
* if (dolCheckFilters($sqlfilters, $errormessage)) {
|
|
||||||
* $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
* $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $sqlfilters).")";
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
*
|
||||||
* @param array $matches Array of found string by regex search.
|
* @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL"
|
||||||
* Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL"
|
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
||||||
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
*/
|
||||||
|
function dolForgeDummyCriteriaCallback($matches)
|
||||||
|
{
|
||||||
|
//dol_syslog("Convert matches ".$matches[1]);
|
||||||
|
if (empty($matches[1])) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$tmp = explode(':', $matches[1]);
|
||||||
|
if (count($tmp) < 3) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '()'; // An empty criteria
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to forge a SQL criteria from a Dolibarr filter syntax string.
|
||||||
|
* This method is called by forgeSQLFromUniversalSearchCriteria()
|
||||||
|
*
|
||||||
|
* @param array $matches Array of found string by regex search.
|
||||||
|
* Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL"
|
||||||
|
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
||||||
*/
|
*/
|
||||||
function dolForgeCriteriaCallback($matches)
|
function dolForgeCriteriaCallback($matches)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
dol_syslog("Convert matches ".$matches[1]);
|
//dol_syslog("Convert matches ".$matches[1]);
|
||||||
if (empty($matches[1])) {
|
if (empty($matches[1])) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$tmp = explode(':', $matches[1], 3);
|
$tmp = explode(':', $matches[1]);
|
||||||
|
|
||||||
if (count($tmp) < 3) {
|
if (count($tmp) < 3) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
|
|
||||||
|
|
||||||
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
||||||
if ($operator == 'NOTLIKE') {
|
if ($operator == 'NOTLIKE') {
|
||||||
$operator = 'NOT LIKE';
|
$operator = 'NOT LIKE';
|
||||||
}
|
}
|
||||||
|
if ($operator == 'ISNOT') {
|
||||||
|
$operator = 'IS NOT';
|
||||||
|
}
|
||||||
|
if ($operator == '!=') {
|
||||||
|
$operator = '<>';
|
||||||
|
}
|
||||||
|
|
||||||
$tmpescaped = trim($tmp[2]);
|
$tmpescaped = $tmp[2];
|
||||||
$regbis = array();
|
$regbis = array();
|
||||||
if ($operator == 'IN') {
|
|
||||||
$tmpescaped = "(".$db->sanitize($tmpescaped, 1).")";
|
if ($operator == 'IN') { // IN is allowed for list of ID or code only
|
||||||
|
//if (!preg_match('/^\(.*\)$/', $tmpescaped)) {
|
||||||
|
$tmpescaped = '('.$db->escape($db->sanitize($tmpescaped, 1, 0)).')';
|
||||||
|
//} else {
|
||||||
|
// $tmpescaped = $db->escape($db->sanitize($tmpescaped, 1));
|
||||||
|
//}
|
||||||
|
} elseif ($operator == 'LIKE' || $operator == 'NOT LIKE') {
|
||||||
|
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
||||||
|
$tmpescaped = $regbis[1];
|
||||||
|
}
|
||||||
|
//$tmpescaped = "'".$db->escapeforlike($db->escape($regbis[1]))."'";
|
||||||
|
$tmpescaped = "'".$db->escape($tmpescaped)."'"; // We do not escape the _ and % so the like will works
|
||||||
} elseif (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
} elseif (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
||||||
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||||
} else {
|
} else {
|
||||||
$tmpescaped = $db->sanitize($db->escape($tmpescaped));
|
if (strtoupper($tmpescaped) == 'NULL') {
|
||||||
|
$tmpescaped = 'NULL';
|
||||||
|
} elseif (is_int($tmpescaped)) {
|
||||||
|
$tmpescaped = (int) $tmpescaped;
|
||||||
|
} else {
|
||||||
|
$tmpescaped = (float) $tmpescaped;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped;
|
return $db->escape($tmp[0]).' '.strtoupper($operator).' '.$tmpescaped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get timeline icon
|
* Get timeline icon
|
||||||
|
*
|
||||||
* @param ActionComm $actionstatic actioncomm
|
* @param ActionComm $actionstatic actioncomm
|
||||||
* @param array $histo histo
|
* @param array $histo histo
|
||||||
* @param int $key key
|
* @param int $key key
|
||||||
|
|||||||
@@ -129,11 +129,10 @@ class Donations extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ class ConferenceOrBooth extends ActionComm
|
|||||||
'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
||||||
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"),
|
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"),
|
||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
|
||||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500', 'csslist'=>'width100'),
|
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:(t.usage_organize_event:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500', 'csslist'=>'width100'),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax125', 'css'=>'maxwidth500'),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax125', 'css'=>'maxwidth500'),
|
||||||
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3),
|
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3),
|
||||||
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'),
|
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'),
|
||||||
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
|
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',),
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class ConferenceOrBoothAttendee extends CommonObject
|
|||||||
'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1),
|
'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1),
|
||||||
'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1),
|
'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1),
|
||||||
'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1),
|
'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
|
||||||
'email_company' => array('type'=>'mail', 'label'=>'EmailCompany', 'enabled'=>'1', 'position'=>41, 'notnull'=>0, 'visible'=>-2, 'searchall'=>1),
|
'email_company' => array('type'=>'mail', 'label'=>'EmailCompany', 'enabled'=>'1', 'position'=>41, 'notnull'=>0, 'visible'=>-2, 'searchall'=>1),
|
||||||
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',),
|
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',),
|
||||||
'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'),
|
'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'$conf->facture->enabled', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'),
|
||||||
|
|||||||
@@ -145,11 +145,10 @@ class Shipments extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -118,11 +118,10 @@ class ExpenseReports extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -152,11 +152,10 @@ class Interventions extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class Fichinter extends CommonObject
|
|||||||
public $fields = array(
|
public $fields = array(
|
||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'isModEnabled("project")', 'visible'=>-1, 'position'=>20),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Fk projet', 'enabled'=>'isModEnabled("project")', 'visible'=>-1, 'position'=>20),
|
||||||
'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25),
|
'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25),
|
||||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
|
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
|
||||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
|
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
|
||||||
|
|||||||
@@ -160,11 +160,10 @@ class SupplierInvoices extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -176,11 +176,10 @@ class SupplierOrders extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1),
|
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1),
|
||||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
|
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35),
|
||||||
'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefOrderSupplierShort', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>1),
|
'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefOrderSupplierShort', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>1),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>45),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>45),
|
||||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||||
'date_approve' =>array('type'=>'datetime', 'label'=>'DateApprove', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
|
'date_approve' =>array('type'=>'datetime', 'label'=>'DateApprove', 'enabled'=>1, 'visible'=>-1, 'position'=>62),
|
||||||
'date_approve2' =>array('type'=>'datetime', 'label'=>'DateApprove2', 'enabled'=>1, 'visible'=>3, 'position'=>64),
|
'date_approve2' =>array('type'=>'datetime', 'label'=>'DateApprove2', 'enabled'=>1, 'visible'=>3, 'position'=>64),
|
||||||
|
|||||||
@@ -199,11 +199,10 @@ class KnowledgeManagement extends DolibarrApi
|
|||||||
}
|
}
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -156,11 +156,10 @@ class MyModuleApi extends DolibarrApi
|
|||||||
}
|
}
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class MyObject extends CommonObject
|
|||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1, 'alwayseditable'=>1),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1, 'alwayseditable'=>1),
|
||||||
'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1),
|
'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1),
|
||||||
'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1),
|
'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'),
|
||||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'),
|
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150'),
|
||||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1),
|
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1),
|
||||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'),
|
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'),
|
||||||
|
|||||||
@@ -148,11 +148,10 @@ class Mos extends DolibarrApi
|
|||||||
}
|
}
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -101,13 +101,13 @@ class Mo extends CommonObject
|
|||||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1),
|
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1),
|
||||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1', 'noteditable'=>1),
|
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1', 'noteditable'=>1),
|
||||||
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>'$conf->bom->enabled', 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall', 'picto'=>'bom'),
|
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:(t.status:=:1)', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>'$conf->bom->enabled', 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall', 'picto'=>'bom'),
|
||||||
'mrptype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>34, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
|
'mrptype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>34, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
|
||||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'),
|
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'),
|
||||||
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1),
|
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1),
|
||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200', 'alwayseditable'=>1),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200', 'alwayseditable'=>1),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'),
|
||||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'),
|
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'),
|
||||||
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'),
|
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'),
|
||||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,),
|
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,),
|
||||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,),
|
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,),
|
||||||
|
|||||||
@@ -156,11 +156,10 @@ class PartnershipApi extends DolibarrApi
|
|||||||
}
|
}
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ class Partnership extends CommonObject
|
|||||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
|
||||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
|
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
|
||||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>'1', 'position'=>15, 'notnull'=>1, 'visible'=>-2, 'default'=>'1', 'index'=>1,),
|
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>'1', 'position'=>15, 'notnull'=>1, 'visible'=>-2, 'default'=>'1', 'index'=>1,),
|
||||||
'fk_type' => array('type'=>'integer:PartnershipType:partnership/class/partnership_type.class.php:0:active=1', 'label'=>'Type', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflowmax100'),
|
'fk_type' => array('type'=>'integer:PartnershipType:partnership/class/partnership_type.class.php:0:(active:=:1)', 'label'=>'Type', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflowmax100'),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax125',),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax125',),
|
||||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
|
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
|
||||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
|
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
|
||||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
|
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
|
||||||
@@ -197,7 +197,7 @@ class Partnership extends CommonObject
|
|||||||
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
|
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') {
|
||||||
$this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member', 'csslist'=>'tdoverflowmax150');
|
$this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member', 'csslist'=>'tdoverflowmax150');
|
||||||
} else {
|
} else {
|
||||||
$this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150');
|
$this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
|
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
|
||||||
|
|||||||
@@ -222,12 +222,10 @@ class Products extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
//var_dump($sqlfilters);exit;
|
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; // We must accept datc:<:2020-01-01 10:10:10
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//this query will return total products with the filters given
|
//this query will return total products with the filters given
|
||||||
@@ -905,11 +903,10 @@ class Products extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
@@ -1033,11 +1030,10 @@ class Products extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -110,11 +110,10 @@ class StockMovements extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -117,11 +117,10 @@ class Warehouses extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ class Entrepot extends CommonObject
|
|||||||
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1),
|
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1),
|
||||||
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35, 'searchall'=>1),
|
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35, 'searchall'=>1),
|
||||||
'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>2, 'searchall'=>1),
|
'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>2, 'searchall'=>1),
|
||||||
'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:statut=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41),
|
'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41),
|
||||||
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>25),
|
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>25),
|
||||||
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45, 'searchall'=>1),
|
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45, 'searchall'=>1),
|
||||||
'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'searchall'=>1),
|
'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'searchall'=>1),
|
||||||
'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55, 'searchall'=>1),
|
'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55, 'searchall'=>1),
|
||||||
|
|||||||
@@ -119,12 +119,12 @@ class MouvementStock extends CommonObject
|
|||||||
'fk_origin' =>array('type'=>'integer', 'label'=>'Fk origin', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
'fk_origin' =>array('type'=>'integer', 'label'=>'Fk origin', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||||
'origintype' =>array('type'=>'varchar(32)', 'label'=>'Origintype', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
'origintype' =>array('type'=>'varchar(32)', 'label'=>'Origintype', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>70),
|
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>70),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>75),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>75),
|
||||||
'inventorycode' =>array('type'=>'varchar(128)', 'label'=>'InventoryCode', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
'inventorycode' =>array('type'=>'varchar(128)', 'label'=>'InventoryCode', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||||
'batch' =>array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
'batch' =>array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||||
'eatby' =>array('type'=>'date', 'label'=>'Eatby', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
'eatby' =>array('type'=>'date', 'label'=>'Eatby', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||||
'sellby' =>array('type'=>'date', 'label'=>'Sellby', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
'sellby' =>array('type'=>'date', 'label'=>'Sellby', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||||
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk project', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label'=>'Fk project', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class StockTransfer extends CommonObject
|
|||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth200'/*, 'help'=>"Help text"*/, 'showoncombobox'=>'1',),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth200'/*, 'help'=>"Help text"*/, 'showoncombobox'=>'1',),
|
||||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>3,),
|
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>3,),
|
||||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>32, 'notnull'=>-1, 'visible'=>-1, 'index'=>1,),
|
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>32, 'notnull'=>-1, 'visible'=>-1, 'index'=>1,),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1/*, 'help'=>"LinkToThirdparty"*/,),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1/*, 'help'=>"LinkToThirdparty"*/,),
|
||||||
'fk_warehouse_source' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Entrepôt source', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'help'=>'HelpWarehouseStockTransferSource',),
|
'fk_warehouse_source' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Entrepôt source', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'help'=>'HelpWarehouseStockTransferSource',),
|
||||||
'fk_warehouse_destination' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Entrepôt de destination', 'enabled'=>'1', 'position'=>51, 'notnull'=>0, 'visible'=>1, 'help'=>'HelpWarehouseStockTransferDestination'),
|
'fk_warehouse_destination' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Entrepôt de destination', 'enabled'=>'1', 'position'=>51, 'notnull'=>0, 'visible'=>1, 'help'=>'HelpWarehouseStockTransferDestination'),
|
||||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
|
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
|
||||||
|
|||||||
@@ -152,11 +152,10 @@ class Projects extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -150,11 +150,10 @@ class Tasks extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -145,11 +145,10 @@ class Receptions extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -194,11 +194,10 @@ class Recruitment extends DolibarrApi
|
|||||||
}
|
}
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
@@ -302,11 +301,10 @@ class Recruitment extends DolibarrApi
|
|||||||
}
|
}
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -120,11 +120,11 @@ class RecruitmentJobPosition extends CommonObject
|
|||||||
'label' => array('type'=>'varchar(255)', 'label'=>'JobLabel', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth500', 'csslist'=>'tdoverflowmax300', 'showoncombobox'=>'2', 'autofocusoncreate'=>1),
|
'label' => array('type'=>'varchar(255)', 'label'=>'JobLabel', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth500', 'csslist'=>'tdoverflowmax300', 'showoncombobox'=>'2', 'autofocusoncreate'=>1),
|
||||||
'qty' => array('type'=>'integer', 'label'=>'NbOfEmployeesExpected', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
'qty' => array('type'=>'integer', 'label'=>'NbOfEmployeesExpected', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
||||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500', 'picto'=>'project'),
|
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500', 'picto'=>'project'),
|
||||||
'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php:status=1', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'),
|
'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php:1:(statut:=:1)', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'),
|
||||||
'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'),
|
'email_recruiter' => array('type'=>'varchar(255)', 'label'=>'EmailRecruiter', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>-1, 'help'=>'ToUseAGenericEmail', 'picto'=>'email'),
|
||||||
'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php:t.statut = 1', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'),
|
'fk_user_supervisor' => array('type'=>'integer:User:user/class/user.class.php:1:(statut:=:1)', 'label'=>'FutureManager', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'user.rowid', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150', 'picto'=>'user'),
|
||||||
'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',),
|
'fk_establishment' => array('type'=>'integer:Establishment:hrm/class/establishment.class.php', 'label'=>'Establishment', 'enabled'=>'$conf->hrm->enabled', 'position'=>56, 'notnull'=>0, 'visible'=>-1, 'foreignkey'=>'establishment.rowid',),
|
||||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'WorkPlace', 'enabled'=>'$conf->societe->enabled', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'),
|
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'WorkPlace', 'enabled'=>'$conf->societe->enabled', 'position'=>57, 'notnull'=>-1, 'visible'=>-1, 'css'=>'maxwidth500', 'index'=>1, 'help'=>"IfJobIsLocatedAtAPartner", 'picto'=>'company'),
|
||||||
'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,),
|
'date_planned' => array('type'=>'date', 'label'=>'DateExpected', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,),
|
||||||
'remuneration_suggested' => array('type'=>'varchar(255)', 'label'=>'Remuneration', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>1,),
|
'remuneration_suggested' => array('type'=>'varchar(255)', 'label'=>'Remuneration', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>1,),
|
||||||
'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,),
|
'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>3,),
|
||||||
|
|||||||
@@ -225,11 +225,10 @@ class Contacts extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -203,11 +203,10 @@ class Thirdparties extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -140,11 +140,10 @@ class Supplierproposals extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -251,11 +251,10 @@ class Tickets extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -100,11 +100,10 @@ class Users extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
@@ -544,11 +543,10 @@ class Users extends DolibarrApi
|
|||||||
// Add sql filters
|
// Add sql filters
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -198,11 +198,10 @@ class Zapier extends DolibarrApi
|
|||||||
}
|
}
|
||||||
if ($sqlfilters) {
|
if ($sqlfilters) {
|
||||||
$errormessage = '';
|
$errormessage = '';
|
||||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
if ($errormessage) {
|
||||||
|
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||||
}
|
}
|
||||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
|
||||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
|
|||||||
@@ -167,6 +167,34 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase
|
|||||||
print __METHOD__."\n";
|
print __METHOD__."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testDolForgeCriteriaCallback
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function testDolForgeCriteriaCallback()
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
// An attempt for SQL injection
|
||||||
|
$filter='if(now()=sysdate()%2Csleep(6)%2C0)';
|
||||||
|
$sql = forgeSQLFromUniversalSearchCriteria($filter);
|
||||||
|
$this->assertEquals($sql, '1 = 3');
|
||||||
|
|
||||||
|
// A real search string
|
||||||
|
$filter='(((statut:=:1) or (entity:in:__AAA__)) and (abc:<:2.0) and (abc:!=:1.23))';
|
||||||
|
$sql = forgeSQLFromUniversalSearchCriteria($filter);
|
||||||
|
$this->assertEquals($sql, ' AND (((statut = 1 or entity IN (__AAA__)) and abc < 2 and abc = 1.23))');
|
||||||
|
|
||||||
|
$filter="(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.date_creation:<:'2016-01-01 12:30:00') or (t.nature:is:NULL)";
|
||||||
|
$sql = forgeSQLFromUniversalSearchCriteria($filter);
|
||||||
|
$this->assertEquals($sql, " AND (t.ref LIKE 'SO-%' or t.date_creation < '20160101' or t.date_creation < 0 or t.nature IS NULL)");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testDolClone
|
* testDolClone
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user