* @param $entity_subtype string\r
* @param $name string\r
*/\r
- function get_annotations_sum($entity_guid, $entity_type = "", $entity_subtype = "", $name = "")\r
+ function get_annotations_sum($entity_guid, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0)\r
{\r
- return __get_annotations_calculate_x("sum", $entity_guid, $entity_type, $entity_subtype, $name);\r
+ return __get_annotations_calculate_x("sum", $entity_guid, $entity_type, $entity_subtype, $name, $value, $value_type, $owner_guid);\r
}\r
\r
/**\r
* @param $entity_subtype string\r
* @param $name string\r
*/\r
- function get_annotations_max($entity_guid, $entity_type = "", $entity_subtype = "", $name = "")\r
+ function get_annotations_max($entity_guid, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0)\r
{\r
- return __get_annotations_calculate_x("max", $entity_guid, $entity_type, $entity_subtype, $name);\r
+ return __get_annotations_calculate_x("max", $entity_guid, $entity_type, $entity_subtype, $name, $value, $value_type, $owner_guid);\r
}\r
\r
/**\r
* @param $entity_subtype string\r
* @param $name string\r
*/\r
- function get_annotations_min($entity_guid, $entity_type = "", $entity_subtype = "", $name = "")\r
+ function get_annotations_min($entity_guid, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0)\r
{\r
- return __get_annotations_calculate_x("min", $entity_guid, $entity_type, $entity_subtype, $name);\r
+ return __get_annotations_calculate_x("min", $entity_guid, $entity_type, $entity_subtype, $name, $value, $value_type, $owner_guid);\r
}\r
\r
/**\r
* @param $entity_subtype string\r
* @param $name string\r
*/\r
- function get_annotations_avg($entity_guid, $entity_type = "", $entity_subtype = "", $name = "")\r
+ function get_annotations_avg($entity_guid, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0)\r
{\r
- return __get_annotations_calculate_x("avg", $entity_guid, $entity_type, $entity_subtype, $name);\r
+ return __get_annotations_calculate_x("avg", $entity_guid, $entity_type, $entity_subtype, $name, $value, $value_type, $owner_guid);\r
}\r
\r
/**\r
*/\r
function count_annotations($entity_guid = 0, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0)\r
{\r
- return __get_annotations_calculate_x("count", $entity_guid, $entity_type, $entity_subtype, $name);\r
+ return __get_annotations_calculate_x("count", $entity_guid, $entity_type, $entity_subtype, $name, $value, $value_type, $owner_guid);\r
}\r
\r
/**\r
* @param $entity_subtype string\r
* @param $name string\r
*/\r
- function __get_annotations_calculate_x($sum = "avg", $entity_guid, $entity_type = "", $entity_subtype = "", $name = "")\r
+ function __get_annotations_calculate_x($sum = "avg", $entity_guid, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $value_type = "", $owner_guid = 0)\r
{\r
global $CONFIG;\r
\r
$entity_guid = (int)$entity_guid;\r
$entity_type = sanitise_string($entity_type);\r
$entity_subtype = get_subtype_id($entity_type, $entity_subtype);\r
- if ($name != '') $name = get_metastring_id($name);\r
+ if ($name != '') $name = get_metastring_id($name);
+ if ($value != '') $value = get_metastring_id($value);
+ $value_type = sanitise_string($value_type);
+ $owner_guid = (int)$owner_guid;\r
\r
// if (empty($name)) return 0;\r
\r
if ($entity_subtype)\r
$where[] = "e.subtype=$entity_subtype";\r
if ($name!="")\r
- $where[] = "a.name_id='$name'";\r
+ $where[] = "a.name_id='$name'";
+ if ($value!="")
+ $where[] = "a.value_id='$value'";
+ if ($value_type!="")
+ $where[] = "a.value_type='$value_type'";
+ if ($owner_guid)
+ $where[] = "a.owner_guid='$owner_guid'";\r
\r
if ($sum != "count")\r
$where[] = "a.value_type='integer'"; // Limit on integer types\r