[open-ils-commits] r14044 - in trunk/Open-ILS/src: perlmods/OpenILS/Application/Circ sql/Pg sql/Pg/upgrade (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Sep 17 16:03:35 EDT 2009
Author: erickson
Date: 2009-09-17 16:03:30 -0400 (Thu, 17 Sep 2009)
New Revision: 14044
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0004.data.org-setting-precat-circ-lib.sql
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
Added org setting for overriding the circ lib when creating a new pre-cat copy. This allows the lib to automatically
route all pre-cat copies to a different branch at post-circ checkin time.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2009-09-17 16:40:18 UTC (rev 14043)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2009-09-17 20:03:30 UTC (rev 14044)
@@ -1603,23 +1603,41 @@
return;
}
- $logger->info("circulator: Creating a new precataloged ".
+ $logger->info("circulator: Creating a new precataloged ".
"copy in checkout with barcode " . $self->copy_barcode);
- $copy = Fieldmapper::asset::copy->new;
- $copy->circ_lib($self->circ_lib);
- $copy->creator($self->editor->requestor->id);
- $copy->editor($self->editor->requestor->id);
- $copy->barcode($self->copy_barcode);
- $copy->call_number(OILS_PRECAT_CALL_NUMBER);
- $copy->loan_duration(OILS_PRECAT_COPY_LOAN_DURATION);
- $copy->fine_level(OILS_PRECAT_COPY_FINE_LEVEL);
+ $copy = Fieldmapper::asset::copy->new;
+ $copy->circ_lib($self->circ_lib);
+ $copy->creator($self->editor->requestor->id);
+ $copy->editor($self->editor->requestor->id);
+ $copy->barcode($self->copy_barcode);
+ $copy->call_number(OILS_PRECAT_CALL_NUMBER);
+ $copy->loan_duration(OILS_PRECAT_COPY_LOAN_DURATION);
+ $copy->fine_level(OILS_PRECAT_COPY_FINE_LEVEL);
- $copy->dummy_title($self->dummy_title || "");
- $copy->dummy_author($self->dummy_author || "");
- $copy->dummy_isbn($self->dummy_isbn || "");
- $copy->circ_modifier($self->circ_modifier);
+ $copy->dummy_title($self->dummy_title || "");
+ $copy->dummy_author($self->dummy_author || "");
+ $copy->dummy_isbn($self->dummy_isbn || "");
+ $copy->circ_modifier($self->circ_modifier);
+
+ # See if we need to override the circ_lib for the copy with a configured circ_lib
+ # Setting is shortname of the org unit
+ my $precat_circ_lib = $U->ou_ancestor_setting_value(
+ $self->circ_lib, 'circ.pre_cat_copy_circ_lib', $self->editor);
+
+ if($precat_circ_lib) {
+ my $org = $self->editor->search_actor_org_unit({shortname => $precat_circ_lib})->[0];
+
+ if(!$org) {
+ $self->bail_on_events($self->editor->event);
+ return;
+ }
+
+ $copy->circ_lib($org->id);
+ }
+
+
unless( $self->copy($self->editor->create_asset_copy($copy)) ) {
$self->bail_out(1);
$self->push_events($self->editor->event);
@@ -1928,7 +1946,7 @@
my $copy = $self->copy;
if( $self->is_precat and ($copy->status != OILS_COPY_STATUS_CATALOGING) ) {
- $copy->status(OILS_COPY_STATUS_CATALOGING);
+ $copy->status(OILS_COPY_STATUS_CATALOGING);
$self->update_copy();
$self->checkin_changed(1);
$self->push_events(OpenILS::Event->new('ITEM_NOT_CATALOGED'));
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-09-17 16:40:18 UTC (rev 14043)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-09-17 20:03:30 UTC (rev 14044)
@@ -2184,3 +2184,13 @@
'integer'
);
+
+-- Org setting for overriding the circ lib of a precat copy
+INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
+ 'circ.pre_cat_copy_circ_lib',
+ 'Pre-cat Item Circ Lib',
+ 'Override the default circ lib of "here" with a pre-configured circ lib for pre-cat items. The value should be the "shortname" (aka policy name) of the org unit',
+ 'string'
+);
+
+
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0004.data.org-setting-precat-circ-lib.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0004.data.org-setting-precat-circ-lib.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0004.data.org-setting-precat-circ-lib.sql 2009-09-17 20:03:30 UTC (rev 14044)
@@ -0,0 +1,13 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0004.data.org-setting-precat-circ-lib.sql');
+
+INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VALUES (
+ 'circ.pre_cat_copy_circ_lib',
+ 'Pre-cat Item Circ Lib',
+ 'Override the default circ lib of "here" with a pre-configured circ lib for pre-cat items. The value should be the "shortname" (aka policy name) of the org unit',
+ 'string'
+);
+
+COMMIT;
+
More information about the open-ils-commits
mailing list