Connector beforeDelete custom operation problem

Hi!

I have a wee problem. I’m trying to do a custom operation using the beforeDelete event. In this doc page:
docs.dhtmlx.com/doku.php?id=dhtm … ex_queries

it says to do the following:

//fully custom code function my_update($data){ global $conn; $price=$data->get_value("price"); $id=$data->get_value("id"); $conn->sql->query("UPDATE some_table SET price='{$price}' where id={$id}"); $data->success(); //success() marks operation as finished and stops any further action processing } $conn->event->attach("beforeUpdate","my_update")

I have changed that to the following query:

[code]//Creates and runs own update statement using values in request, cancels default delete
function NotDelete($action){

// New query:
// mysql_query("UPDATE wp_app_appointments SET status = 'cancelled' WHERE ID = {$action->get_id()};");
$scheduler->sql->query("UPDATE wp_app_appointments SET status = 'cancelled' WHERE ID = {$action->get_id()};");

// Log it:
LogMaster::log("Didn't delete booking ".$action->get_id().". Set status to 'cancelled'.");

// Skip over default action and return:
$action->success();

}

$scheduler->event->attach(“beforeDelete”,“NotDelete”);
[/code]

However, I get the following PHP error:

PHP Fatal error:  Call to a member function query() on a non-object in …

Any idea what is going on?

Of course, seconds later I realise I missed the “global $scheduler” line. Works fine. 3 hours of head scratching was down to that. Gah! :unamused: