This commit is contained in:
2017-09-09 19:49:53 +10:00
parent f200fbc9b2
commit 9910b523c6

View File

@@ -290,12 +290,19 @@ function booking_load($nodes) {
} }
function booking_insert($node) { function booking_insert($node) {
//TODO: Generalise this by using the keys from $node instead of hard coding everything //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(); $data = array();
watchdog('booking_debug', "<pre>Inserting node:\n@info</pre>", array('@info' => print_r($node, TRUE))); foreach ($node as $key => $value) {
db_insert('booking_person')->fields($node)->execute(); //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', "<pre>Inserting node:\n@info</pre>", array('@info' => print_r($data, TRUE)));
db_insert('booking_person')->fields($data)->execute();
/* /*
db_insert('booking_person') db_insert('booking_person')