[open-ils-commits] [GIT] Evergreen ILS branch rel_2_12 updated. 1002130544a3678aff6d87524758ae709900a2cc

Evergreen Git git at git.evergreen-ils.org
Mon Jun 19 10:59:31 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_12 has been updated
       via  1002130544a3678aff6d87524758ae709900a2cc (commit)
      from  a499aff6c7e0933d6834d56610ea43f56c2eaf6e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1002130544a3678aff6d87524758ae709900a2cc
Author: Jason Etheridge <jason at equinoxinitiative.org>
Date:   Mon Jun 12 11:07:59 2017 -0400

    lp1671603 webstaff: add confirm step for voiding billings
    
    This patch adds a confirmation step for  both Void All Bills
    in the main billing UI, and Void Billings in the Full Details UI
    
    Signed-off-by: Jason Etheridge <jason at equinoxinitiative.org>
    Signed-off-by: Andrea Neiman <abneiman at equinoxinitiative.org>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    
    Conflicts:
    	Open-ILS/src/templates/staff/circ/patron/index.tt2

diff --git a/Open-ILS/src/templates/staff/circ/patron/index.tt2 b/Open-ILS/src/templates/staff/circ/patron/index.tt2
index b017f19..95701fe 100644
--- a/Open-ILS/src/templates/staff/circ/patron/index.tt2
+++ b/Open-ILS/src/templates/staff/circ/patron/index.tt2
@@ -35,6 +35,8 @@
 <script>
 angular.module('egCoreMod').run(['egStrings', function(s) {
   s.ANNOTATE_PAYMENT_MSG = "[% l('Please annotate this payment') %]";
+  s.CONFIRM_VOID_BILLINGS = 
+    "[% l('Are you sure you would like to void $[_1] for these line-item billings? [_2]','{{amount|number:2}}','{{billIds}}') %]";
   s.CONFIRM_REFUND_PAYMENT = 
     "[% |l('{{xactIds}}') -%]Are you sure you would like to refund excess payment on bills [_1]?  This action will simply put the amount in the Payment Pending column as a negative value.  You must still select Apply Payment!  Certain types of payments may not be refunded.  The refund may be applied to checked transactions that follow the refunded transaction.[% END %]";
   s.EDIT_BILL_PAY_NOTE = "[% l('Enter new note for #[_1]:','{{ids}}') %]";
diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
index 601956a..ea71279 100644
--- a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
+++ b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js
@@ -505,32 +505,43 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
     }
 
     $scope.voidAllBillings = function(items) {
+        var promises = [];
+        var bill_ids = [];
+        var cents = 0;
         angular.forEach(items, function(item) {
+            promises.push(
+                billSvc.fetchBills(item.id).then(function(bills) {
+                    angular.forEach(bills, function(b) {
+                        if (b.voided() != 't') {
+                            cents += b.amount() * 100;
+                            bill_ids.push(b.id())
+                        }
+                    });
 
-            billSvc.fetchBills(item.id).then(function(bills) {
-                var bill_ids = [];
-                var cents = 0;
-                angular.forEach(bills, function(b) {
-                    if (b.voided() != 't') {
-                        cents += b.amount() * 100;
-                        bill_ids.push(b.id())
+                    if (bill_ids.length == 0) {
+                        // TODO: warn
+                        return;
                     }
-                });
 
-                $scope.session_voided = 
-                    ($scope.session_voided * 100 + cents) / 100;
+                })
+            );
+        });
 
-                if (bill_ids.length == 0) {
-                    // TODO: warn
-                    return;
+        $q.all(promises).then(function(){
+            egCore.audio.play('warning.circ.void_billings_confirmation');
+            egConfirmDialog.open(
+                egCore.strings.CONFIRM_VOID_BILLINGS, '', 
+                {   billIds : ''+bill_ids,
+                    amount : ''+(cents/100),
+                    ok : function() {
+                        billSvc.voidBills(bill_ids).then(function() {
+                            $scope.session_voided = 
+                                ($scope.session_voided * 100 + cents) / 100;
+                            refreshDisplay();
+                        });
+                    }
                 }
-
-                // TODO: alert of pending voiding
-
-                billSvc.voidBills(bill_ids).then(function() {
-                    refreshDisplay();
-                });
-            });
+            );
         });
     }
 
@@ -576,8 +587,8 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
  * Displays details of a single transaction
  */
 .controller('XactDetailsCtrl',
-       ['$scope','$q','$routeParams','egCore','egGridDataProvider','patronSvc','billSvc','egPromptDialog','egBilling',
-function($scope,  $q , $routeParams , egCore , egGridDataProvider , patronSvc , billSvc , egPromptDialog , egBilling) {
+       ['$scope','$q','$routeParams','egCore','egGridDataProvider','patronSvc','billSvc','egPromptDialog','egBilling','egConfirmDialog',
+function($scope,  $q , $routeParams , egCore , egGridDataProvider , patronSvc , billSvc , egPromptDialog , egBilling , egConfirmDialog ) {
 
     $scope.initTab('bills', $routeParams.id);
     var xact_id = $routeParams.xact_id;
@@ -595,8 +606,12 @@ function($scope,  $q , $routeParams , egCore , egGridDataProvider , patronSvc ,
     // -- actions
     $scope.voidBillings = function(bill_list) {
         var bill_ids = [];
+        var cents = 0;
         angular.forEach(bill_list, function(b) {
-            if (b.voided != 't') bill_ids.push(b.id);
+            if (b.voided != 't') {
+                cents += b.amount * 100;
+                bill_ids.push(b.id)
+            }
         });
 
         if (bill_ids.length == 0) {
@@ -604,18 +619,28 @@ function($scope,  $q , $routeParams , egCore , egGridDataProvider , patronSvc ,
             return;
         }
 
-        billSvc.voidBills(bill_ids).then(function() {
+        egCore.audio.play('warning.circ.void_billings_confirmation');
+        egConfirmDialog.open(
+            egCore.strings.CONFIRM_VOID_BILLINGS, '', 
+            {   billIds : ''+bill_ids,
+                amount : ''+(cents/100),
+                ok : function() {
+                    billSvc.voidBills(bill_ids).then(function() {
+                        // TODO? $scope.session_voided = ...
 
-            // refresh bills and summary data
-            // note: no need to update payments
-            patronSvc.fetchUserStats();
+                        // refresh bills and summary data
+                        // note: no need to update payments
+                        patronSvc.fetchUserStats();
 
-            egBilling.fetchXact(xact_id).then(function(xact) {
-                $scope.xact = xact
-            });
+                        egBilling.fetchXact(xact_id).then(function(xact) {
+                            $scope.xact = xact
+                        });
 
-            xactGrid.refresh();
-        });
+                        xactGrid.refresh();
+                    });
+                }
+            }
+        );
     }
 
     // batch-edit billing and payment notes, depending on 'type'

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/templates/staff/circ/patron/index.tt2 |    2 +
 .../web/js/ui/default/staff/circ/patron/bills.js   |   91 +++++++++++++-------
 2 files changed, 60 insertions(+), 33 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list