add same functionality to hook_update()

This commit is contained in:
2016-06-18 16:20:19 +10:00
parent 9a0aadfbc6
commit 5a4ee8054f

View File

@@ -458,6 +458,24 @@ function booking_update($node) {
}
}
//repeat the process for bf/gf
if ($node->booking_bf_gf_nid != 0) {
$partner = db_query("Select booking_bf_gf_nid from {booking_person} where nid = :nid",
array(':nid' => $node->booking_bf_gf_nid))
->fetchObject();
if ($partner->booking_bf_gf_nid == 0) {
watchdog('booking', 'Updating bf/gf node !partner to refer to this node !nid',
array('!partner' => $node->booking_bf_gf_nid, '!nid' => $node->nid));
//update the partner id of the partner to refer to this node
db_update('booking_person')
->fields(array(
'booking_bf_gf_nid' => $node->nid,
))
->condition('nid', $node->booking_bf_gf_nid)
->execute();
}
}
//status change triggers start here
//check if someone has moved to not-coming list from the booked-in list