LP1712646: Require a Billing Type to Bill User
authorJason Boyer <jboyer@library.in.gov>
Thu, 4 Jan 2018 18:38:00 +0000 (13:38 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 5 Jan 2018 15:54:05 +0000 (10:54 -0500)
Previously billing a user without choosing a billing type
would either fail silently or default to misc. This patch
requires staff to choose a billing type before the new
bill window can be dismissed.

Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/templates/staff/circ/share/t_bill_patron_dialog.tt2
Open-ILS/web/js/ui/default/staff/circ/services/billing.js

index f6d55aa..dd10c8b 100644 (file)
           [% l('Billing Type:') %]
         </label>
         <div class="col-md-8">
-          <select ng-model="billArgs.billingType" class="form-control"
-            ng-change="updateDefaultPrice()">
-            <option ng-repeat="type in billingTypes | orderBy:'name()'" value="{{type.id()}}">
-              {{type.name()}}
-            </option>
+          <select str-to-int ng-required="true" ng-model="billArgs.billingType" class="form-control"
+            ng-change="updateDefaultPrice()"
+            ng-options="type.id() as type.name() for type in billingTypes | orderBy: 'name()'" >
+           <option value=""></option>
           </select>
         </div>
       </div>
@@ -71,7 +70,7 @@
         <label for="bill-dialog-amount" class="control-label col-md-4">[% l('Amount:') %]</label>
         <div class="col-md-8">
           <input type="number" min="0" step="any" class="form-control" 
-            focus-me='focus' required id="bill-dialog-amount" 
+            focus-me='focus' ng-required="true" id="bill-dialog-amount"
             ng-model="billArgs.amount"/>
         </div>
       </div>
index 08acd99..3abd6da 100644 (file)
@@ -64,8 +64,9 @@ function($uibModal , $q , egCore) {
     // fetch the org-focused billing types
     // Cache on egEnv
     service.fetchBillingTypes = function() {
-        if (egCore.env.cbt) 
+        if (egCore.env.cbt) {
             return $q.when(egCore.env.cbt.list);
+        }
 
         return egCore.pcrud.search('cbt', 
             {   // first 100 are reserved for system-generated bills
@@ -171,6 +172,3 @@ function($uibModal , $q , egCore) {
     return service;
 }]);
 
-
-
-