I am trying to create a hook that will insert a value into a field "district" if another field "store" equals a certain value. Any help would be appreciated. I am assuming this needs to added at the before_insert line..
function waste_reporting_before_insert(&$data, $memberInfo, &$args){
if($data['store'] === "160") $data['district'] = "DST21";
if($data['store'] === "208") $data['district'] = "DST21";
if($data['store'] === "39") $data['district'] = "DST21";
return TRUE;
}
Help needed with hook inserting value using if statement
Re: Help needed with hook inserting value using if statement
I actually thing you could accomplish this by using a lookup tablethat has the store number and district in it and using the autofill feature to fill in the district based on the store number entered.
Re: Help needed with hook inserting value using if statement
If it helps, I am using version 5.60...