handle booking_passport_issue_date properly
This commit is contained in:
@@ -384,6 +384,8 @@ function booking_update($node) {
|
|||||||
global $event;
|
global $event;
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
|
//TODO: make sure these exclusions match with admin selected options (eg passport details)
|
||||||
|
|
||||||
//these fields should be stored in the database as Y or N, but come back from the FAPI as 1 or 0
|
//these fields should be stored in the database as Y or N, but come back from the FAPI as 1 or 0
|
||||||
$boolean_keys = array('booking_baptised', 'booking_married', 'booking_help_praying', 'booking_help_meditations', 'booking_help_reading',
|
$boolean_keys = array('booking_baptised', 'booking_married', 'booking_help_praying', 'booking_help_meditations', 'booking_help_reading',
|
||||||
'booking_help_chairing', 'booking_help_readgroup_lead', 'booking_help_discussgroup_lead', 'booking_lifesaver',
|
'booking_help_chairing', 'booking_help_readgroup_lead', 'booking_help_discussgroup_lead', 'booking_lifesaver',
|
||||||
@@ -411,19 +413,20 @@ function booking_update($node) {
|
|||||||
foreach ($node as $key => $value) {
|
foreach ($node as $key => $value) {
|
||||||
//check if the key is a field that belongs in the database
|
//check if the key is a field that belongs in the database
|
||||||
if ((strpos($key, "booking_") === 0) || $key === "nid") {
|
if ((strpos($key, "booking_") === 0) || $key === "nid") {
|
||||||
//do we need to treat this field carefully?
|
//what special handling does this field need?
|
||||||
if (strpos($key, "booking_dob") === 0) {
|
//handle dates properly
|
||||||
|
if ((strpos($key, "booking_dob") === 0) || (strpos($key, "booking_passport_issue_date") === 0)) {
|
||||||
$data[$key] = _date_to_ts($value);
|
$data[$key] = _date_to_ts($value);
|
||||||
}
|
}
|
||||||
|
elseif (in_array($key, $excluded_keys, FALSE)) {
|
||||||
|
//skip these fields from the update of booking_person
|
||||||
|
}
|
||||||
elseif (in_array($key, $boolean_keys, FALSE)) {
|
elseif (in_array($key, $boolean_keys, FALSE)) {
|
||||||
$data[$key] = $value == 1 ? 'Y' : 'N';
|
$data[$key] = $value == 1 ? 'Y' : 'N';
|
||||||
}
|
}
|
||||||
elseif (in_array($key, $default_zero_keys, FALSE)) {
|
elseif (in_array($key, $default_zero_keys, FALSE)) {
|
||||||
$data[$key] = $value == '' ? 0 : $value;
|
$data[$key] = $value == '' ? 0 : $value;
|
||||||
}
|
}
|
||||||
elseif (in_array($key, $excluded_keys, FALSE)) {
|
|
||||||
//skip these fields from the update of booking_person
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
$data[$key] = _booking_remove_emoji($value);
|
$data[$key] = _booking_remove_emoji($value);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user