diff --git a/rules_shipping_base.php b/rules_shipping_base.php index e63a4bfc0242a3d9b6748ab546ac31d016babb72..c67b044f44538a03fe302efef64e759af3c39226 100644 --- a/rules_shipping_base.php +++ b/rules_shipping_base.php @@ -923,19 +923,31 @@ class ShippingRule { // Extract the array from the args, the $args varialbe will now only contain the elements to be checked: $array = array_shift($args); switch ($function) { - case "contains_any": + case "contains_any": // return true if one of the $args is in the $array foreach ($args as $a) { if (in_array($a, $array)) return true; } return false; - case "contains_all": + case "contains_all": // return false if one of the $args is NOT in the $array foreach ($args as $a) { if (!in_array($a, $array)) return false; } return true; + case "contains_only": // return false if one of the $array elements is NOT in $args + foreach ($array as $a) { + if (!in_array($a, $args)) + return false; + } + return true; + case "contains_none": // return false if one of the $args IS in the $array + foreach ($args as $a) { + if (in_array($a, $array)) + return false; + } + return true; default: JFactory::getApplication()->enqueueMessage(JText::sprintf('VMSHIPMENT_RULES_EVALUATE_LISTFUNCTION_UNKNOWN', $function, $this->rulestring), 'error'); return false;