From 9910b523c63615188c2ee43ddffad0bc6929b276 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Sat, 9 Sep 2017 19:49:53 +1000 Subject: [PATCH] bugfix --- booking.regn_node.inc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/booking.regn_node.inc b/booking.regn_node.inc index a2790d9..0bd1c81 100644 --- a/booking.regn_node.inc +++ b/booking.regn_node.inc @@ -290,12 +290,19 @@ function booking_load($nodes) { } function booking_insert($node) { + //TODO: Generalise this by using the keys from $node instead of hard coding everything - //$default_keys = array('nid', 'type', 'language', 'created', 'promote', 'changed', 'status', 'title'); $data = array(); - watchdog('booking_debug', "
Inserting node:\n@info
", array('@info' => print_r($node, TRUE))); - db_insert('booking_person')->fields($node)->execute(); + foreach ($node as $key => $value) { + //check if the key is a field that belongs in the database + if ((strpos($key, "booking_") === 0) || $key === "nid") { + $data[$key] = $value; + } + } + + watchdog('booking_debug', "
Inserting node:\n@info
", array('@info' => print_r($data, TRUE))); + db_insert('booking_person')->fields($data)->execute(); /* db_insert('booking_person')