So here's the situation: I have two Tiki-Wiki trackers: One called Orders and the other called Customers. When a new item is added to the Orders tracker, one of the fields required is the customer, selected from the Customer tracker. Occasionally we have delinquent customers and need to "blacklist" them, preventing new order items being created for this customer. What is the best way to accomplish this?
I figured the best way to do this it to build a custom validator, as seen here: https://doc.tiki.org/Tracker+Field+Validation. I would then have a new field in the customers tracker that would indicate if they are on the blacklist. The validator would look up the customer and if they are blacklisted, disallow entering a new order.
My (poor) attempt at this is below:
<?php
function validator_Blacklist($input, $parameter = '', $message = '')
{
$trklib = TikiLib::lib('trk');
//parse_str($parameter, $arr);
//$info = $trklib->get_tracker_field($arr['fieldId']);
$bl = $trklib->get_item(4,204,$input);
if($bl>=1)
return tra("Customer is blacklisted.");
return true;
}
?>