[open-ils-commits] r12151 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Feb 11 15:43:05 EST 2009
Author: erickson
Date: 2009-02-11 15:43:00 -0500 (Wed, 11 Feb 2009)
New Revision: 12151
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Log:
use copy buckets instead (for precats) and verify the copy bucket mechanism is globally configured
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2009-02-11 18:55:11 UTC (rev 12150)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2009-02-11 20:43:00 UTC (rev 12151)
@@ -2367,46 +2367,57 @@
return undef unless
$self->is_checkout and
$self->patron and
- $self->title and
- !$self->is_precat and
+ $self->copy and
!$self->is_noncat;
my $e = new_editor(xact => 1, requestor => $self->editor->requestor);
+ # verify history is globally enabled and uses the bucket mechanism
+ my $htype = OpenSRF::Utils::SettingsClient->new->config_value(
+ apps => 'open-ils.circ' => app_settings => 'checkout_history_mechanism');
+
+ unless($htype eq 'bucket') {
+ $e->rollback;
+ return undef;
+ }
+
+ # verify the patron wants to retain the hisory
my $setting = $e->search_actor_user_setting(
- {usr => $self->patron->id,, name => 'circ.keep_checkout_history_list'})->[0];
+ {usr => $self->patron->id, name => 'circ.keep_checkout_history'})->[0];
- return undef unless $setting and $setting->value;
+ unless($setting and $setting->value) {
+ $e->rollback;
+ return undef;
+ }
- my $bkt = $e->search_container_biblio_record_entry_bucket(
- {owner => $self->patron->id, btype => 'reading_list'})->[0];
+ my $bkt = $e->search_container_copy_bucket(
+ {owner => $self->patron->id, btype => 'circ_history'})->[0];
my $pos = 1;
if($bkt) {
- # find the next position
- my $last_item = $e->search_container_biblio_record_entry_bucket_item(
- {bucket => $bkt->id}, {order_by => {'cbrebi' => 'pos desc'}, limit => 1})->[0];
+ # find the next item position
+ my $last_item = $e->search_container_copy_bucket_item(
+ {bucket => $bkt->id}, {order_by => {ccbi => 'pos desc'}, limit => 1})->[0];
$pos = $last_item->pos + 1 if $last_item;
} else {
- $bkt = Fieldmapper::container::biblio_record_entry_bucket->new;
+ # create the history bucket if necessary
+ $bkt = Fieldmapper::container::copy_bucket->new;
$bkt->owner($self->patron->id);
$bkt->name('');
$bkt->btype('reading_list');
$bkt->pub('f');
- $e->create_container_biblio_record_entry_bucket($bkt) or return $e->die_event;
-
+ $e->create_container_copy_bucket($bkt) or return $e->die_event;
}
- my $item = Fieldmapper::container::biblio_record_entry_bucket_item->new;
+ my $item = Fieldmapper::container::copy_bucket_item->new;
+
$item->bucket($bkt->id);
- $item->target_biblio_record_entry($self->title->id);
+ $item->target_copy($self->copy->id);
$item->pos($pos);
- $e->create_container_biblio_record_entry_bucket_item($item)
- or return $e->die_event;
-
+ $e->create_container_copy_bucket_item($item) or return $e->die_event;
$e->commit;
return undef;
More information about the open-ils-commits
mailing list