I am trying to automate a process in my system where if a status of returned is entered, a series of automatic updates happens thus reducing the workload on the end-user. I was trying to do this with an AfterEdit custom code event, but I'm getting a php error of type 2, Missing Argument 1 for AfterEdit(). Any suggestions?
function AfterEdit(&$values, $where)
{
//********** Custom code ************
// put your custom code here
//Define SQL strings
$adopt_update = "update `adoption_records` set `Adoption_Fee_1` = 0, `Adoption_Fee_2` = 0, `Adoption_Fee_3` = 0 where `Intake_ID` = '$values[Intake_ID]' and `Adoption_ID` in (select max(`Adoption_ID`) where `adoption_records`.`Intake_ID` = '$values[Intake_ID]'";
$inventory_update = "update `inventory` set `Status` = 'Available' where `Intake_ID` = '$values[Intake_ID]'";
//Define SQL connection
global $conn;
if($values['Status'] == 'Returned') {
db_query($adopt_update,$conn);
db_query($inventory_update,$conn);
echo "Cat's status reset to available and previous adoption fees zeroed.";
}
else {
}
}
Thanks for any help you can offer.