[guadec-web] Add code to verify if there are some rooms left
- From: Pascal Terjan <pterjan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [guadec-web] Add code to verify if there are some rooms left
- Date: Mon, 14 Jul 2014 16:25:50 +0000 (UTC)
commit 7a1e91a1b2c663ebc72e1672b5a4aac76b5db134
Author: Pascal Terjan <pterjan gmail com>
Date: Sun Jul 13 20:09:58 2014 +0000
Add code to verify if there are some rooms left
guadec/js/calculate.php | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/guadec/js/calculate.php b/guadec/js/calculate.php
index 899d833..f86496a 100644
--- a/guadec/js/calculate.php
+++ b/guadec/js/calculate.php
@@ -61,7 +61,18 @@
}
break;
-
+ case 'roomAvailable':
+ # room_type
+ if( !is_array($_POST['arguments']) || (count($_POST['arguments']) < 1 ||
($_POST['arguments'][0] != 'single' && $_POST['arguments'][0]) != 'double') ) {
+ $aResult = 'error';
+ }
+ else {
+ $room_type = $_POST['arguments'][0];
+ $booked = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM wp_guadec2014_registrations
WHERE accom = 'YES' AND room=%s", $room_type);
+ $total_beds = $room_type == 'single' ? 14 : 26;
+ $aResult = ($total_beds>$booked) ? 'true' : 'false';
+ }
+ break;
default:
$aResult = 'error';
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]