From 9935f57135ccf9973fd5589f82b24143e899e136 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 30 Jun 2014 15:44:05 -0400 Subject: [PATCH] checkout repairs for data consistency w/ egCirc Signed-off-by: Bill Erickson --- .../src/templates/staff/circ/patron/t_checkout.tt2 | 69 ++++++++++++++++------ .../src/templates/staff/circ/renew/t_renew.tt2 | 1 - .../staff/circ/share/t_circ_exists_dialog.tt2 | 16 +++-- .../staff/share/print_templates/t_checkout.tt2 | 8 +-- .../js/ui/default/staff/circ/patron/checkout.js | 48 +++++++-------- .../web/js/ui/default/staff/circ/services/circ.js | 17 +++--- 6 files changed, 94 insertions(+), 65 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 index b64c4686ee..945f2dba4a 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -60,29 +60,60 @@ - - + + + + + + + + + {{item.copy_barcode}} + + + + + + + - - + path='circ.due_date' dateformat='short'> + + + + + + + + + + {{item.title}} + + + - - - + path="author" hidden> + + + + + + +
diff --git a/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 b/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 index ee38361713..c2880c1b2e 100644 --- a/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 +++ b/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 @@ -43,7 +43,6 @@ diff --git a/Open-ILS/src/templates/staff/circ/share/t_circ_exists_dialog.tt2 b/Open-ILS/src/templates/staff/circ/share/t_circ_exists_dialog.tt2 index f7516f0da2..3a8b5d194e 100644 --- a/Open-ILS/src/templates/staff/circ/share/t_circ_exists_dialog.tt2 +++ b/Open-ILS/src/templates/staff/circ/share/t_circ_exists_dialog.tt2 @@ -7,10 +7,18 @@

    -
  1. -
    {{circ.title}}
    +
  2. +
    {{checkout.title}}
    [% l('Barcode: [_1] Due: [_2]', - '{{circ.target_copy.barcode}}', - '{{circ.due_date | date:"short"}}') %]
    + '{{checkout.copy.barcode}}', + '{{checkout.circ.due_date | date:"short"}}') %]

diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index 94314a2996..5be1d4b075 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -116,15 +116,13 @@ function($scope , $q , $modal , $routeParams , egCore , egUser , patronSvc , // each checkout. patronSvc.patron_stats.checkouts.out++ - // TODO: munge from egCirc - - munge_checkout_resp(co_resp); - // copy the response event into the original grid row item // note: angular.copy clobbers the destination - angular.forEach(co_resp.evt, function(v, k) { - row_item[k] = v; + row_item.evt = co_resp.evt; + angular.forEach(co_resp.data, function(val, key) { + row_item[key] = val; }); + munge_checkout_resp(co_resp, row_item); }, function() { // Circ was rejected somewhere along the way. @@ -148,26 +146,14 @@ function($scope , $q , $modal , $routeParams , egCore , egUser , patronSvc , }); } - // move some stuff around so it will play nice w/ the template - function munge_checkout_resp(co_resp) { - var payload = co_resp.evt.payload; + // add some checkout-specific additions for display + function munge_checkout_resp(co_resp, row_item) { var params = co_resp.params; - - if (!payload) return; - - if (params.precat) { - payload.record = { - title : params.dummy_title, - author : params.dummy_author, - isbn : params.dummy_isbn - }; - } else if (params.noncat) { - payload.record = { - title : egCore.env.cnct.map[params.noncat_type].name() - }; - co_resp.evt.noncat_count = params.noncat_count; - payload.circ = new egCore.idl.circ(); - payload.circ.due_date(payload.noncat_circ.duedate()); + if (params.noncat) { + row_item.title = egCore.env.cnct.map[params.noncat_type].name(); + row_item.noncat_count = params.noncat_count; + row_item.circ = new egCore.idl.circ(); + row_item.circ.due_date(co_resp.evt.payload.noncat_circ.duedate()); } } @@ -177,9 +163,15 @@ function($scope , $q , $modal , $routeParams , egCore , egUser , patronSvc , if ($scope.checkouts.length == 0) return $q.when(); angular.forEach($scope.checkouts, function(co) { - var circ = egCore.idl.toHash(co.payload.circ); - circ.title = co.payload.record.title; - print_data.circulations.push(circ); + if (co.circ) { + print_data.circulations.push({ + circ : egCore.idl.toHash(co.circ), + copy : egCore.idl.toHash(co.acp), + call_number : egCore.idl.toHash(co.acn), + title : co.title, + author : co.author + }) + }; }); return egCore.print.print({ diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js index ca5b31165b..a18f0502fe 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js @@ -770,24 +770,23 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) { } service.circ_exists_dialog = function(evt, params, options) { + + var openCirc = evt.payload.old_circ; + var sameUser = openCirc.usr() == params.patron_id; + return $modal.open({ templateUrl: './circ/share/t_circ_exists_dialog', controller: - ['$scope','$modalInstance','openCirc', - function($scope , $modalInstance , openCirc) { + ['$scope','$modalInstance', + function($scope , $modalInstance) { $scope.circDate = openCirc.xact_start(); + $scope.sameUser = sameUser; $scope.ok = function() { $modalInstance.close() } $scope.cancel = function($event) { $modalInstance.dismiss(); $event.preventDefault(); // form, avoid calling ok(); } - }], - resolve : { - // fetch the conflicting open circulation - openCirc : function() { - return service.last_copy_circ(evt.payload.copy.id()); - } - } + }] }).result.then( function() { -- 2.11.0