From: erickson Date: Thu, 29 May 2008 22:27:08 +0000 (+0000) Subject: Merged revisions 9714-9715,9718,9721,9723,9726,9728,9730 via svnmerge from X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5f1713bf4928220d9d7a22e1ff0b1ff033547e72;p=Evergreen.git Merged revisions 9714-9715,9718,9721,9723,9726,9728,9730 via svnmerge from 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 --- diff --git a/Evergreen/conf/lib_ips.txt b/Evergreen/conf/lib_ips.txt index 15c0ae43e1..c800660de7 100644 --- a/Evergreen/conf/lib_ips.txt +++ b/Evergreen/conf/lib_ips.txt @@ -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 diff --git a/Evergreen/src/javascript/backend/circ/circ_item_config.js b/Evergreen/src/javascript/backend/circ/circ_item_config.js index d98f762393..a7339ded95 100644 --- a/Evergreen/src/javascript/backend/circ/circ_item_config.js +++ b/Evergreen/src/javascript/backend/circ/circ_item_config.js @@ -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' + }, } diff --git a/Evergreen/src/javascript/backend/circ/circ_permit_hold.js b/Evergreen/src/javascript/backend/circ/circ_permit_hold.js index c40e88561e..dd845dc866 100644 --- a/Evergreen/src/javascript/backend/circ/circ_permit_hold.js +++ b/Evergreen/src/javascript/backend/circ/circ_permit_hold.js @@ -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'); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index d1109b49c9..a28d94ff62 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -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); diff --git a/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js b/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js index e01bbe805f..e65dcb35f9 100644 --- a/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js +++ b/Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js @@ -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; diff --git a/Open-ILS/web/js/dojo/openils/User.js b/Open-ILS/web/js/dojo/openils/User.js index 66013c563d..cb04539556 100644 --- a/Open-ILS/web/js/dojo/openils/User.js +++ b/Open-ILS/web/js/dojo/openils/User.js @@ -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; diff --git a/Open-ILS/xul/staff_client/server/cat/copy_browser.xul b/Open-ILS/xul/staff_client/server/cat/copy_browser.xul index e8a9e3965f..34ca6d4a94 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_browser.xul +++ b/Open-ILS/xul/staff_client/server/cat/copy_browser.xul @@ -130,7 +130,7 @@ vim:noet:sw=4:ts=4: - + diff --git a/Open-ILS/xul/staff_client/server/main/ws_info.xul b/Open-ILS/xul/staff_client/server/main/ws_info.xul index f2764ec25b..141a275dd9 100644 --- a/Open-ILS/xul/staff_client/server/main/ws_info.xul +++ b/Open-ILS/xul/staff_client/server/main/ws_info.xul @@ -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;