Merged revisions 9714-9715,9718,9721,9723,9726,9728,9730 via svnmerge from
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 May 2008 22:27:08 +0000 (22:27 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 May 2008 22:27:08 +0000 (22:27 +0000)
svn://svn.open-ils.org/ILS/trunk

........
  r9714 | erickson | 2008-05-27 22:55:59 -0400 (Tue, 27 May 2008) | 1 line

  added function to return a flat list of org + descendants
........
  r9715 | erickson | 2008-05-27 22:56:35 -0400 (Tue, 27 May 2008) | 1 line

  retrieving high perm org IDs instead of objects now and taking advantage of existing org tree
........
  r9718 | erickson | 2008-05-28 09:18:20 -0400 (Wed, 28 May 2008) | 1 line

  gapines rule for eventpass
........
  r9721 | erickson | 2008-05-28 16:44:58 -0400 (Wed, 28 May 2008) | 1 line

  updated policy name
........
  r9723 | dbs | 2008-05-28 23:42:15 -0400 (Wed, 28 May 2008) | 2 lines

  Fix a broken entity
........
  r9726 | erickson | 2008-05-29 11:15:39 -0400 (Thu, 29 May 2008) | 1 line

  added org unit setting to force patron penalty checks on renewals
........
  r9728 | phasefx | 2008-05-29 11:18:05 -0400 (Thu, 29 May 2008) | 1 line

  just in case JSON returns that value as a string instead of a number
........
  r9730 | erickson | 2008-05-29 18:23:31 -0400 (Thu, 29 May 2008) | 1 line

  adding Davids org perm store caching with some slight modification.  using existing perm_org_set function instead of manually invoking
........

git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9731 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/conf/lib_ips.txt
Evergreen/src/javascript/backend/circ/circ_item_config.js
Evergreen/src/javascript/backend/circ/circ_permit_hold.js
Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js
Open-ILS/web/js/dojo/openils/User.js
Open-ILS/xul/staff_client/server/cat/copy_browser.xul
Open-ILS/xul/staff_client/server/main/ws_info.xul

index 15c0ae4..c800660 100644 (file)
@@ -101,7 +101,7 @@ MGRL-JO     168.10.139.0    168.10.139.63
 MGRL-MA        168.10.139.64   168.10.139.127
 MGRL-MO        168.10.129.193  168.10.129.255
 MGRL-OG        168.10.139.128  168.10.139.191
-MGRL-RC        168.10.132.65   168.10.132.128
+MGRL-LC        168.10.132.65   168.10.132.128
 MGRL-RV        168.10.132.0    168.10.132.64
 MGRL-SH        168.10.132.129  168.10.132.191
 MGRL-TW        168.10.139.192  168.10.139.255
@@ -311,7 +311,7 @@ MGRL-JO     168.13.135.1    168.13.135.254
 MGRL-MA        168.13.136.1    168.13.136.254
 MGRL-MO        168.13.137.1    168.13.137.254
 MGRL-OG        168.13.138.1    168.13.138.254
-MGRL-RC        168.13.140.1    168.13.140.254
+MGRL-LC        168.13.140.1    168.13.140.254
 MGRL-RO        168.13.131.1    168.13.131.254
 MGRL-RV        168.13.139.1    168.13.139.254
 MGRL-SH        168.13.141.1    168.13.141.254
index d98f762..a7339de 100644 (file)
@@ -360,7 +360,7 @@ var CIRC_MOD_MAP = {
                SIPMediaType                    : '005',
                magneticMedia                   : 'f',
                durationRule                    : '14_days_2_renew',
-               recurringFinesRule      : '10_cent_per_day',
+               recurringFinesRule          : '10_cent_per_day',
                maxFine                                 : 'overdue_mid'
        },
 
@@ -377,10 +377,17 @@ var CIRC_MOD_MAP = {
                SIPMediaType                    : '001',
                magneticMedia                   : 'f',
                durationRule                    : '7_days_2_renew',
-               recurringFinesRule      : '10_cent_per_day',
+               recurringFinesRule          : '10_cent_per_day',
                maxFine                                 : 'overdue_mid'
        },
 
+       'eventpass'     : {
+               SIPMediaType                    : '001',
+               magneticMedia                   : 'f',
+               durationRule                    : '7_day_1_renew',
+               recurringFinesRule          : '3_dollar_per_day',
+               maxFine                                 : 'overdue_mid'
+       },
 }
 
 
index c40e885..dd845dc 100644 (file)
@@ -43,7 +43,7 @@ log_info("circ-modifier = "+mod);
 log_info("marc-type = "+marcItemType);
 
 
-if( mod == 'bestsellernh' )
+if(mod == 'bestsellernh' || mod == 'eventpass')
        result.events.push('ITEM_NOT_HOLDABLE');
 
 
index d1109b4..a28d94f 100644 (file)
@@ -5,6 +5,8 @@ use OpenSRF::EX qw(:try);
 use OpenSRF::Utils::SettingsClient;
 use OpenSRF::Utils::Logger qw(:logger);
 use OpenILS::Const qw/:const/;
+use OpenILS::Application::AppUtils;
+my $U = "OpenILS::Application::AppUtils";
 
 my %scripts;
 my $script_libs;
@@ -154,6 +156,9 @@ sub run_method {
     # --------------------------------------------------------------------------
     $circulator->is_renewal(1) if $api =~ /renew/;
     $circulator->is_checkin(1) if $api =~ /checkin/;
+    $circulator->check_penalty_on_renew(1) if
+        $circulator->is_renewal and $U->ou_ancestor_setting_value(
+            $circulator->editor->requestor->ws_ou, 'circ.renew.check_penalty', $circulator->editor);
     $circulator->mk_script_runner;
     return circ_events($circulator) if $circulator->bail_out;
 
@@ -284,7 +289,6 @@ use OpenILS::Utils::CStoreEditor qw/:funcs/;
 use OpenILS::Application::Circ::ScriptBuilder;
 use OpenILS::Const qw/:const/;
 
-my $U               = "OpenILS::Application::AppUtils";
 my $holdcode    = "OpenILS::Application::Circ::Holds";
 my $transcode   = "OpenILS::Application::Circ::Transit";
 
@@ -309,6 +313,7 @@ my @AUTOLOAD_FIELDS = qw/
     volume
     title
     is_renewal
+    check_penalty_on_renew
     is_noncat
     is_precat
     is_checkin
@@ -548,7 +553,8 @@ sub do_permit {
     $self->run_patron_permit_scripts();
     $self->run_copy_permit_scripts() 
         unless $self->is_precat or $self->is_noncat;
-    $self->override_events() unless $self->is_renewal;
+    $self->override_events() unless 
+        $self->is_renewal and not $self->check_penalty_on_renew;
     return if $self->bail_out;
 
     if( $self->is_precat ) {
@@ -659,7 +665,9 @@ sub run_patron_permit_scripts {
     my $runner      = $self->script_runner;
     my $patronid    = $self->patron->id;
 
-    $self->send_penalty_request() unless $self->is_renewal;
+    $self->send_penalty_request() unless
+        $self->is_renewal and not $self->check_penalty_on_renew;
+
 
     # ---------------------------------------------------------------------
     # Now run the patron permit script 
@@ -671,13 +679,8 @@ sub run_patron_permit_scripts {
     my $patron_events = $result->{events};
     my @allevents; 
 
-
-    # ---------------------------------------------------------------------
-    # this is policy directly in the code, not a good idea in general, but
-    # the penalty server doesn't know anything about renewals, so we
-    # have to strip the event out here
-    my $penalties = ($self->is_renewal) ? [] : $self->gather_penalty_request();
-    # ---------------------------------------------------------------------
+    my $penalties = ($self->is_renewal and not $self->check_penalty_on_renew) ? 
+        [] : $self->gather_penalty_request();
 
     push( @allevents, OpenILS::Event->new($_)) for (@$penalties, @$patron_events);
 
index e01bbe8..e65dcb3 100644 (file)
@@ -185,6 +185,23 @@ if(!dojo._hasResource["fieldmapper.OrgUtils"]){
                return false;
        }
 
+    /** Given an org id, returns an array of org units including
+     * the org for the ID provided and all descendant orgs */
+    fieldmapper.aou.descendantNodeList = function(orgId) {
+        var list = [];
+        function addNode(node) {
+            if(!node) return;
+            list.push(node);
+            var children = node.children();
+            if(children) {
+                for(var i = 0; i < children.length; i++) 
+                    addNode(children[i]);
+            }
+        }
+        addNode(fieldmapper.aou.findOrgUnit(orgId));
+        return list;
+    }
+
        dojo.addOnUnload( function () {
                for (var i in fieldmapper.aou.OrgCache) {
                        x=fieldmapper.aou.OrgCache[i].treePtr;
index 66013c5..cb04539 100644 (file)
@@ -42,7 +42,7 @@ if(!dojo._hasResource["openils.User"]) {
             this.login_type = kwargs.login_type;
             this.location = kwargs.location;
             this.authcookie = kwargs.authcookie || openils.User.authcookie;
-           this.orgCache = {perm: null, store: null};
+            this.permOrgStoreCache = {}; /* permName => permOrgUnitStore map */
 
             if (this.id && this.authtoken) this.user = this.getById( this.id );
             else if (this.authtoken) this.getBySession();
@@ -170,17 +170,16 @@ if(!dojo._hasResource["openils.User"]) {
          * has the given permission.
          */
         getPermOrgList : function(perm, onload) {
-    
-            var req = OpenSRF.CachedClientSession('open-ils.actor').request(
-                'open-ils.actor.user.work_perm.highest_org_set',
-                this.authtoken, perm);
-    
-            req.oncomplete = function(r) {
-                org_list = r.recv().content();
-                onload(org_list);
-            }
-    
-            req.send();
+            fieldmapper.standardRequest(
+                ['open-ils.actor', 'open-ils.actor.user.work_perm.highest_org_set'],
+                {   async: true,
+                    params: [this.authtoken, perm],
+                    oncomplete: function(r) {
+                        org_list = r.recv().content();
+                        onload(org_list);
+                    }
+                }
+            );
         },
     
         /**
@@ -230,33 +229,28 @@ if(!dojo._hasResource["openils.User"]) {
     
             dojo.require('dojo.data.ItemFileReadStore');
 
-           function hookupStore(store) {
-               selector.store = store;
+            function hookupStore(store) {
+                selector.store = store;
                 selector.startup();
                 selector.setValue(_u.user.ws_ou());
-           }
+            }
 
-            function buildTreePicker(r) {
-                var orgList = r.recv().content();
-                var store = new dojo.data.ItemFileReadStore({data:aou.toStoreData(orgList)});
-               hookupStore(store);
-               _u.orgCache.perm = perm;
-               _u.orgCache.orgStore = store;
+            function buildTreePicker(orgList) {
+                var orgNodeList = [];
+                for(var i = 0; i < orgList.length; i++) 
+                    orgNodeList = orgNodeList.concat(
+                        fieldmapper.aou.descendantNodeList(orgList[i]));
+
+                var store = new dojo.data.ItemFileReadStore({data:aou.toStoreData(orgNodeList)});
+                hookupStore(store);
+                _u.permOrgStoreCache[perm] = store;
             }
     
-           if (this.orgCache.orgStore && (perm == this.orgCache.perm)) {
-               hookupStore(this.orgCache.orgStore);
-           } else {
-               fieldmapper.standardRequest(
-                    ['open-ils.actor', 'open-ils.actor.user.work_perm.org_unit_list'],
-                    {   params: [this.authtoken, perm],
-                       oncomplete: buildTreePicker,
-                       async: true
-                    }
-               )
-           }
-        },
-
+               if (_u.permOrgStoreCache[perm])
+                       hookupStore(_u.permOrgStoreCache[perm]);
+               else
+                _u.getPermOrgList(perm, buildTreePicker);
+        }
     });
 
        openils.User.user = null;
index e8a9e39..34ca6d4 100644 (file)
@@ -130,7 +130,7 @@ vim:noet:sw=4:ts=4:
        </popupset>
 
        <groupbox flex="1" class="my_overflow">
-               <caption label="staff.cat.copy_browser.holdings_maintenance.caption"/>
+               <caption label="&staff.cat.copy_browser.holdings_maintenance.caption;"/>
                <hbox><label id="legend" style="font-size: large" class="has_copies" value="&staff.cat.copy_browser.holdings_maintenance.legend;" hidden="true"/></hbox>
                <hbox>
                        <hbox id="x_lib_menu"/>
index f2764ec..141a275 100644 (file)
@@ -77,7 +77,7 @@
                                'PERM_RETRIEVE_HIGHEST_ORG',
                                [ xulG.auth.session.key, g.user.id(), 'REGISTER_WORKSTATION']
                        );
-                       if (highest_org_id == -1) {
+                       if (highest_org_id == -1 || highest_org_id == '-1') {
                                alert(document.getElementById('commonStrings').getString('staff.main.gen_offline_widgets.workstation_registration_denied'));
                                xulG.auth.logoff();
                                return;