fix the problems with freezeUnreserved
smbaker [Tue, 6 Nov 2012 05:55:47 +0000 (21:55 -0800)]
apps/gacksadmin/action.php
apps/gacksadmin/gacks_functions.php
apps/gacksadmin/user_confirm_service.php

index e901c23..e0fdad3 100644 (file)
@@ -178,7 +178,7 @@ try {
             $account_name = $_POST['account_name'];
             $level = $_POST['level'];
             $autoRenew = $_POST['autoRenew'];
-            $freezeUnreserved = $_POST['freezeUnreserved'];
+            $enableBestEffort = $_POST['enableBestEffort'];
             $confirmed = $_POST['confirmed'];
             $billingContacts = $_POST['billingContacts'];
 
@@ -191,21 +191,21 @@ try {
             if (($level != NULL) and ($level!="")) {
                 $fields['level'] = $level;
                 if ($confirmed!='yes') {
-                    plc_redirect(l_gacks_confirm_service($account_name, $level, $autoRenew, $freezeUnreserved));
+                    plc_redirect(l_gacks_confirm_service($account_name, $level, $autoRenew, $enableBestEffort));
                     return;
                 }
             }
 
-            if ($billingContacts) {
+            if ($billingContacts !== NULL) {
                 $fields['billingContacts'] = $billingContacts;
             }
 
-            if ($autoRenew) {
+            if ($autoRenew !== NULL) {
                 $fields['autoRenew'] = $autoRenew;
             }
 
-            if ($freezeUnreserved) {
-                $fields['freezeUnreserved'] = $freezeUnreserved;
+            if ($enableBestEffort !== NULL) {
+                $fields['freezeUnreserved'] = !$enableBestEffort;
             }
 
             $gacksapi->update_account($fields, "restricted");
index 003ddf6..d27cef1 100644 (file)
@@ -33,7 +33,7 @@ function l_gacks_user_reservations() { return "/db/gacks/user_reservations.php";
 function l_gacks_edit($item)       { return "/db/gacks/edit.php"; }
 function l_gacks_delete($item)     { $timeStart=$item['timeStart']; $timeStop=$item['timeStop']; $id=$item['id']; $lastAllocator=end($item['allocatorHRNs']); return "/db/gacks/action.php?action=delete-reservation&timeStart=$timeStart&timeStop=$timeStop&resource_id=$id&lastAllocator=$lastAllocator"; }
 function l_gacks_service_level()   { return "/db/gacks/user_service_level.php"; }
-function l_gacks_confirm_service($acct, $level, $autoRenew, $freezeUnreserved) { return "/db/gacks/user_confirm_service.php?account_name=$acct&level=$level&autoRenew=$autoRenew&freezeUnreserved=$freezeUnreserved"; }
+function l_gacks_confirm_service($acct, $level, $autoRenew, $enableBestEffort) { return "/db/gacks/user_confirm_service.php?account_name=$acct&level=$level&autoRenew=$autoRenew&enableBestEffort=$enableBestEffort"; }
 function l_gacks_add_reservation() { return "/db/gacks/user_add_reservation.php"; }
 function l_gacks_persons()         { return "/db/gacks/user_persons.php"; }
 function l_gacks_advanced($value, $url)        { $eurl=urlencode($url); return "/db/gacks/action.php?action=set-advanced&value=$value&url=$eurl"; }
index 5203137..668981a 100644 (file)
@@ -28,8 +28,6 @@ $gacksapi = new GACKSAPI();
 \r
 $account_name = $_GET['account_name'];\r
 $level = $_GET['level'];\r
-$autoRenew = $_GET['autoRenew'];\r
-$freezeUnreserved = $_GET['freezeUnreserved'];\r
 \r
 $account = $gacksapi->get_account(gacksid($account_name), "user", True);\r
 \r
@@ -52,8 +50,6 @@ if ($account == NULL) {
     $form = new PlekitForm(l_gacks_actions(), array("action"=>$action,\r
                                                     "account_name"=> $account_name,
                                                     "level"=> $level,
-                                                    "autoRenew"=> $autoRenew,
-                                                    "freezeUnreserved"=> $freezeUnreserved,
                                                     "confirmed"=> "yes"));
     $form->start();\r
 \r