[open-ils-commits] [GIT] Evergreen ILS branch master updated. a378a358cf0abdc21c74e730262838fd77f25450

Evergreen Git git at git.evergreen-ils.org
Fri Oct 28 11:07:58 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  a378a358cf0abdc21c74e730262838fd77f25450 (commit)
       via  a0d2b8817ae38824043674aef7d054d6064ae389 (commit)
      from  2578112ce9f93acb950f8e20c5dd1ef12fb4daac (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a378a358cf0abdc21c74e730262838fd77f25450
Author: Mike Rylander <mrylander at gmail.com>
Date:   Fri Oct 28 11:09:32 2011 -0400

    Stamping upgrade script for YAOUS-target-when-closed
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 9234024..31a7ac4 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0643', :eg_version); -- miker/tsbere
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0644', :eg_version); -- senator/miker
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.YAOUS-target-when-closed.sql b/Open-ILS/src/sql/Pg/upgrade/0644.data.YAOUS-target-when-closed.sql
similarity index 95%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.data.YAOUS-target-when-closed.sql
rename to Open-ILS/src/sql/Pg/upgrade/0644.data.YAOUS-target-when-closed.sql
index 0ab7a08..de9a16b 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.YAOUS-target-when-closed.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0644.data.YAOUS-target-when-closed.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0644', :eg_version);
 
 INSERT into config.org_unit_setting_type (name, grp, label, description, datatype) VALUES
 ( 'circ.holds.target_when_closed', 'circ',

commit a0d2b8817ae38824043674aef7d054d6064ae389
Author: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Date:   Wed Sep 28 14:28:35 2011 -0400

    Add and use two YAOUS to allow hold targeting on copies at closed OUs
    
    One YAOUS completely ignores the closedness of the circ lib of the copy
    being tested for potential targeting.
    
    The other YAOUS ignores the closedness of the circ lib IFF the circ lib of
    the copy being tested matches the pickup lib of the hold request.
    
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
index eff589c..fb58c35 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
@@ -2,7 +2,7 @@ package OpenILS::Application::Storage::Publisher::action;
 use parent qw/OpenILS::Application::Storage::Publisher/;
 use strict;
 use warnings;
-use OpenSRF::Utils::Logger qw/:level/;
+use OpenSRF::Utils::Logger qw/:level :logger/;
 use OpenSRF::Utils qw/:datetime/;
 use OpenSRF::Utils::JSON;
 use OpenSRF::AppSession;
@@ -23,6 +23,24 @@ sub isTrue {
 	return 0;
 }
 
+sub ou_ancestor_setting_value_or_cache {
+	# cache should be specific to setting
+	my ($actor, $org_id, $setting, $cache) = @_;
+
+	if (not exists $cache->{$org_id}) {
+		my $r = $actor->request(
+			'open-ils.actor.ou_setting.ancestor_default', $org_id, $setting
+		)->gather(1);
+
+		if ($r) {
+			$cache->{$org_id} = $r->{value};
+		} else {
+			$cache->{$org_id} = undef;
+		}
+	}
+	return $cache->{$org_id};
+}
+
 my $parser = DateTime::Format::ISO8601->new;
 my $log = 'OpenSRF::Utils::Logger';
 
@@ -1108,6 +1126,9 @@ sub new_hold_copy_targeter {
 	my @successes;
 	my $actor = OpenSRF::AppSession->create('open-ils.actor');
 
+	my $target_when_closed = {};
+	my $target_when_closed_if_at_pickup_lib = {};
+
 	for my $hold (@$holds) {
 		try {
 			#start a transaction if needed
@@ -1274,8 +1295,38 @@ sub new_hold_copy_targeter {
 				# current target
 				next if ($c->id eq $hold->current_copy);
 
-				# circ lib is closed
-				next if ( grep { ''.$_->org_unit eq ''.$c->circ_lib } @closed );
+				# skip on circ lib is closed IFF we care
+				my $ignore_closing;
+
+				if (''.$hold->pickup_lib eq ''.$c->circ_lib) {
+					$ignore_closing = ou_ancestor_setting_value_or_cache(
+                        $actor,
+						''.$c->circ_lib,
+						'circ.holds.target_when_closed_if_at_pickup_lib',
+						$target_when_closed_if_at_pickup_lib
+					) || 0;
+				}
+				if (not $ignore_closing) {  # one more chance to find a reason
+											# to ignore OU closedness.
+					$ignore_closing = ou_ancestor_setting_value_or_cache(
+                        $actor,
+						''.$c->circ_lib,
+						'circ.holds.target_when_closed',
+						$target_when_closed
+					) || 0;
+				}
+
+#				$logger->info(
+#					"For hold " . $hold->id . " and copy with circ_lib " .
+#					$c->circ_lib . " we " .
+#					($ignore_closing ? "ignore" : "respect")
+#					. " closed dates"
+#				);
+
+				next if (
+					(not $ignore_closing) and
+					(grep { ''.$_->org_unit eq ''.$c->circ_lib } @closed)
+				);
 
 				# target of another hold
 				next if (action::hold_request
diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 9ea1baa..686471e 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -4456,6 +4456,23 @@ INSERT into config.org_unit_setting_type
         'If unset, the OPAC (only when wrapped in the staff client!) will default to showing you your ten most recent searches on the left side of the results and record details pages.  If you actually don''t want to see this feature at all, set this value to zero at the top of your organizational tree.',
         'coust', 'description'),
     'integer', null)
+,( 'circ.holds.target_when_closed', 'circ',
+    oils_i18n_gettext('circ.holds.target_when_closed',
+        'Target copies for a hold even if copy''s circ lib is closed',
+        'coust', 'label'),
+    oils_i18n_gettext('circ.holds.target_when_closed',
+        'If this setting is true at a given org unit or one of its ancestors, the hold targeter will target copies from this org unit even if the org unit is closed (according to the actor.org_unit.closed_date table).',
+        'coust', 'description'),
+    'bool', null)
+,( 'circ.holds.target_when_closed_if_at_pickup_lib', 'circ',
+    oils_i18n_gettext('circ.holds.target_when_closed_if_at_pickup_lib',
+        'Target copies for a hold even if copy''s circ lib is closed IF the circ lib is the hold''s pickup lib',
+        'coust', 'label'),
+    oils_i18n_gettext('circ.holds.target_when_closed_if_at_pickup_lib',
+        'If this setting is true at a given org unit or one of its ancestors, the hold targeter will target copies from this org unit even if the org unit is closed (according to the actor.org_unit.closed_date table) IF AND ONLY IF the copy''s circ lib is the same as the hold''s pickup lib.',
+        'coust', 'description'),
+    'bool', null)
+
 
 ,( 'opac.staff.jump_to_details_on_single_hit', 'opac',
     oils_i18n_gettext('opac.staff.jump_to_details_on_single_hit',
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.YAOUS-target-when-closed.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.YAOUS-target-when-closed.sql
new file mode 100644
index 0000000..0ab7a08
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.YAOUS-target-when-closed.sql
@@ -0,0 +1,24 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT into config.org_unit_setting_type (name, grp, label, description, datatype) VALUES
+( 'circ.holds.target_when_closed', 'circ',
+    oils_i18n_gettext('circ.holds.target_when_closed',
+        'Target copies for a hold even if copy''s circ lib is closed',
+        'coust', 'label'),
+    oils_i18n_gettext('circ.holds.target_when_closed',
+        'If this setting is true at a given org unit or one of its ancestors, the hold targeter will target copies from this org unit even if the org unit is closed (according to the actor.org_unit.closed_date table).',
+        'coust', 'description'),
+    'bool'),
+( 'circ.holds.target_when_closed_if_at_pickup_lib', 'circ',
+    oils_i18n_gettext('circ.holds.target_when_closed_if_at_pickup_lib',
+        'Target copies for a hold even if copy''s circ lib is closed IF the circ lib is the hold''s pickup lib',
+        'coust', 'label'),
+    oils_i18n_gettext('circ.holds.target_when_closed_if_at_pickup_lib',
+        'If this setting is true at a given org unit or one of its ancestors, the hold targeter will target copies from this org unit even if the org unit is closed (according to the actor.org_unit.closed_date table) IF AND ONLY IF the copy''s circ lib is the same as the hold''s pickup lib.',
+        'coust', 'description'),
+    'bool')
+;
+
+COMMIT;

-----------------------------------------------------------------------

Summary of changes:
 .../Application/Storage/Publisher/action.pm        |   57 ++++++++++++++++++-
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |   17 ++++++
 .../upgrade/0644.data.YAOUS-target-when-closed.sql |   24 ++++++++
 4 files changed, 96 insertions(+), 4 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0644.data.YAOUS-target-when-closed.sql


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list