allow user to edit billing contacts
smbaker [Wed, 17 Oct 2012 03:08:38 +0000 (20:08 -0700)]
apps/gacks/API.py
apps/gacksadmin/action.php
apps/gacksadmin/user_service_level.php

index 5b5101d..90f1e4e 100644 (file)
@@ -855,7 +855,7 @@ class RemoteApi(AuthenticatedApi):
                 raise GacksNotAuthorized("You don't have permission to update %s using objectGID %s" % (name, objectGID.get_hrn()) )
 
         if (mode in ["user", "restricted"]):
-            user_allowed_fields = ["name", "kind", "level", "autoRenew", "freezeUnreserved"];
+            user_allowed_fields = ["name", "kind", "level", "autoRenew", "freezeUnreserved", "billingContacts"];
             for field in args:
                 if not (field in user_allowed_fields):
                     raise GacksFieldNotAllowed("you are not allowed to change %s" % field)
index 5bf35ce..e901c23 100644 (file)
@@ -180,6 +180,7 @@ try {
             $autoRenew = $_POST['autoRenew'];
             $freezeUnreserved = $_POST['freezeUnreserved'];
             $confirmed = $_POST['confirmed'];
+            $billingContacts = $_POST['billingContacts'];
 
             // XXX we need a permission check here.
 
@@ -195,11 +196,15 @@ try {
                 }
             }
 
-            if (($autoRenew != NULL) and ($autoRenew != "")) {
+            if ($billingContacts) {
+                $fields['billingContacts'] = $billingContacts;
+            }
+
+            if ($autoRenew) {
                 $fields['autoRenew'] = $autoRenew;
             }
 
-            if (($freezeUnreserved != NULL) and ($freezeUnreserved != "")) {
+            if ($freezeUnreserved) {
                 $fields['freezeUnreserved'] = $freezeUnreserved;
             }
 
index a1de621..5c87efe 100644 (file)
@@ -108,6 +108,13 @@ $freeze_combo
 EOF;\r
     }\r
 \r
+    print <<< EOF\r
+<br><br><p>Please enter the email addresses of your billing contacts below.\r
+You may enter multiple contacts separated by a comma. Invoices will be emailed\r
+to these contacts once per week</p>\r
+EOF;\r
+    print $form->input_html("text", "billingContacts", $account['billingContacts'], array("size"=>"80"));\r
+\r
     print "<br><br>";\r
     print $form->submit_html("submit", "submit");\r
 \r