5-pick-up-library-not-defaulting-to-patrons-home-library
authorJason Etheridge <jason@EquinoxInitiative.org>
Fri, 22 Jun 2018 18:59:11 +0000 (14:59 -0400)
committerJason Etheridge <jason@EquinoxInitiative.org>
Fri, 22 Jun 2018 18:59:11 +0000 (14:59 -0400)
when creating new requests, given a user, default to the user's pickup library
preference setting, or absent a preference, default to their home library.

Absent a user, default to the pickup library selector value from the request
list, if it's of an org type that can have volumes.  Otherwise, default to the
workstation library.  Technically, the without-a-user behavior is going to be
mooted whenever a user is chosen.

Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>
Open-ILS/web/js/ui/default/staff/acq/services/requests.js

index 453a8f5..d5bbc60 100644 (file)
@@ -206,7 +206,10 @@ function($uibModal , $q , egCore , egOrg , ngToast) {
                         $m_scope.request.pickup_lib =
                             egCore.idl.fromHash('aou',request.pickup_lib);
                     } else {
-                        $m_scope.request.pickup_lib = context_ou;
+                        $m_scope.request.pickup_lib =
+                            egOrg.CanHaveVolumes(context_ou)
+                            ? context_ou
+                            : egOrg.get( egCore.auth.user().ws_ou() );
                     }
                     if (request.cancel_reason) {
                         $m_scope.request.cancel_reason =
@@ -278,6 +281,7 @@ function($uibModal , $q , egCore , egOrg , ngToast) {
                                 var usr = egCore.idl.toHash(users[0]);
                                 $m_scope.extra.user_obj = usr;
                                 $m_scope.request.usr = usr.id;
+                                $m_scope.request.pickup_lib = egOrg.get(usr.home_ou.id);
                                 angular.forEach(usr.settings, function(s) {
                                     if (s.name == 'opac.hold_notify') {
                                         if (s.value.match('phone')) {
@@ -334,6 +338,7 @@ function($uibModal , $q , egCore , egOrg , ngToast) {
                             ).then(function(users) {
                                 var usr = egCore.idl.toHash(users[0]);
                                 aur_obj.usr = usr.id;
+                                aur_obj.pickup_lib = egOrg.get(usr.home_ou.id);
                                 angular.forEach(usr.settings, function(s) {
                                     if (s.name == 'opac.hold_notify') {
                                         if (s.value.match('email')) {