From ca61ba7c072c17f73591c2d44c61a0db4dd2d1ec Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 17 Sep 2009 20:03:30 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.open-ils.org/ILS/trunk@14044 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Circ/Circulate.pm | 46 +++++++++++++------ Open-ILS/src/sql/Pg/950.data.seed-values.sql | 10 ++++ .../0004.data.org-setting-precat-circ-lib.sql | 13 ++++++ 3 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0004.data.org-setting-precat-circ-lib.sql diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index 886d6b491e..b86c330011 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -1603,22 +1603,40 @@ sub make_precat_copy { 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); + + + # 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); + } - $copy->dummy_title($self->dummy_title || ""); - $copy->dummy_author($self->dummy_author || ""); - $copy->dummy_isbn($self->dummy_isbn || ""); - $copy->circ_modifier($self->circ_modifier); unless( $self->copy($self->editor->create_asset_copy($copy)) ) { $self->bail_out(1); @@ -1928,7 +1946,7 @@ sub checkin_handle_precat { 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')); 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 383831b186..4e7807922d 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -2184,3 +2184,13 @@ INSERT INTO config.org_unit_setting_type (name, label, description, datatype) VA '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' +); + + diff --git a/Open-ILS/src/sql/Pg/upgrade/0004.data.org-setting-precat-circ-lib.sql b/Open-ILS/src/sql/Pg/upgrade/0004.data.org-setting-precat-circ-lib.sql new file mode 100644 index 0000000000..ff678b0874 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0004.data.org-setting-precat-circ-lib.sql @@ -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; + -- 2.43.2