JBAS-2101 Payment grid shows A/D login
authorBill Erickson <berickxx@gmail.com>
Thu, 1 Nov 2018 20:53:21 +0000 (16:53 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
In the XUL client transaction details payment grid:

1. Rename the existing "Staff" column to "Login" (i.e. shared ILS login)
2. Add a new column labeled "Staff" which shows the KCLS login (first
   part of email) of the staff that accepted a lost payment.  Column
   will be empty for non-lost payments.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/RefundablePayment.pm
Open-ILS/xul/staff_client/server/patron/util.js

index 18bad4b..8327a46 100644 (file)
@@ -473,6 +473,32 @@ sub generate_refundable_payment_receipt {
     }
 }
 
+__PACKAGE__->register_method(
+    method    => 'retrieve_refundable_payment',
+    api_name  => 'open-ils.circ.refundable_payment.retrieve.by_payment',
+    signature => {
+        desc   => q/Return a refundable payment by money.payment.id/,
+        params => [
+            {desc => 'Authentication token', type => 'string'},
+            {desc => 'Payment (mp.id) ID', type => 'number'}
+        ],
+        return => {
+            desc => 'Refundable payment object on success, undef on not-found'
+        }
+    }
+);
+
+# NOTE: adding this for XUL client -- browser client just uses pcrud.
+sub retrieve_refundable_payment {
+    my ($self, $client, $auth, $payment_id) = @_;
+
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('STAFF_LOGIN');
+
+    return $e->search_money_refundable_payment({payment => $payment_id})->[0]; 
+}
 1;
 
 
index ce36b6e..0abd475 100644 (file)
@@ -269,9 +269,26 @@ patron.util.mp_columns = function(modify,params) {
             'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { return my.mp.cash_drawer().name(); }
         },
         {
-            'id' : 'mp_staff', 'label' : commonStrings.getString('staff.mp_accepting_usr_label'), 'flex' : 1,
+            'id' : 'mp_staff', 'label' : 'Login', 'flex' : 1,
             'primary' : false, 'hidden' : false, 'editable' : false, 'render' : function(my) { var s = my.mp.accepting_usr(); if (s && typeof s != "object") s = patron.util.retrieve_fleshed_au_via_id(ses(),s,["card"]); return s.family_name() + " (" + s.card().barcode() + ") @ " + data.hash.aou[ s.home_ou() ].shortname(); }
         },
+        {   // KCLS  JBAS-2101
+            'id' : 'mp_lost_staff', 'label' : 'Staff', 'flex' : 1,
+            'primary' : false, 'hidden' : false, 'editable' : false,
+            'render' : function(my) { 
+                var rf_payment = g.network.request(
+                    'open-ils.circ',
+                    'open-ils.circ.refundable_payment.retrieve.by_payment',
+                    [ses(), my.mp.id()]
+                );
+
+                if (rf_payment) {
+                    return rf_payment.staff_email().replace(/@.*/g, ''); // remove @kcls.org
+                } else {
+                    return '';
+                }
+            }
+        },
         {
             'id' : 'mp_xact', 'label' : commonStrings.getString('staff.mp_xact_label'), 'flex' : 1,
             'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return my.mp.xact(); }