Okay, first of all I should probably mention that I noticed this while I was going through the 5.x-1.7 code, but while my familiarity with Conditional Actions is negligible it does appear to have been carried over to 6.x-2.x.
The description of the postcode pattern is as follows:
Specify a postal code or postal code pattern. Use "*" as a wild card to specify a range of postal codes.
That seems like very useful functionality. Unfortunately the postal code processing functions don't exactly treat the * as a wildcard...
<?php
// Check an order's delivery postal code.
function uc_order_condition_delivery_postal_code($order, $settings) {
// Trim the wildcard off the pattern.
$pattern = rtrim($settings['pattern'], '*');
// Return TRUE if the delivery postal code begins with the pattern.
return strpos($order->delivery_postal_code, $pattern) === 0;
}
?>This code simply removes the wildcard - but only if it occurs at the end of the pattern - and then checks whether the remaining pattern is at the beginning of the postal code regardless of whether there was a wildcard. The wildcard is both broken and unnecessary. (FWIW, the ...billing_postal_code function is identical save the postal code used.)
In my opinion, either the code needs to treat the asterisk as an actual wildcard (perhaps by assembling a regular expression?), or the reference to it should be removed from the #description and replaced with a description of the actual behaviour. Or, if we want to keep the behaviour but give the wildcard a purpose, carry out the trim and strpos only when the wildcard is present, with a generic equality comparison being performed otherwise. And the #description updated to describe that behaviour. Whatever happens, the #description needs to change to match the behaviour.
Well, that is what I think, anyway.


