From 02244a01c42d8e56eed32701ae7c7042eb1afe3d Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 19 Jun 2009 20:01:08 +0000 Subject: [PATCH] cron script to run the clear-expired-circ-history items proc git-svn-id: svn://svn.open-ils.org/ILS/trunk@13415 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Cat/AuthCommon.pm | 24 ++++++++++++++ Open-ILS/src/perlmods/OpenILS/Event.pm | 2 +- .../clear_expired_circ_history.srfsh | 2 ++ .../web/js/dojo/openils/widget/AutoGrid.js | 31 ++++++++++++++++--- Open-ILS/web/templates/base.tt2 | 2 +- 5 files changed, 54 insertions(+), 7 deletions(-) create mode 100755 Open-ILS/src/support-scripts/clear_expired_circ_history.srfsh diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Cat/AuthCommon.pm b/Open-ILS/src/perlmods/OpenILS/Application/Cat/AuthCommon.pm index a8ef1f0bcb..1c55b8642b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Cat/AuthCommon.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Cat/AuthCommon.pm @@ -36,6 +36,10 @@ sub import_authority_record { $rec->edit_date('now'); $rec->marc($U->entityize($marc_doc->documentElement->toString)); + my ($arn, $evt) = find_arn($e, $marc_doc); + return $evt if $evt; + $rec->arn_value($arn); + $rec = $e->create_authority_record_entry($rec) or return $e->die_event; # we don't care about the result, just fire off the request @@ -64,4 +68,24 @@ sub overlay_authority_record { return $rec; } +sub find_arn { + my($e, $marc_doc) = @_; + + my $xpath = '//marc:controlfield[@tag="001"]'; + my ($arn) = $marc_doc->documentElement->findvalue($xpath); + + if(my $existing_rec = $e->search_authority_record_entry({arn_value => $arn, deleted => 'f'})->[0]) { + # this arn is taken + return ( + undef, + OpenILS::Event->new( + 'AUTHORITY_RECORD_NUMBER_EXISTS', + payload => {existing_record => $existing_rec, arn => $arn} + ) + ); + } + + return ($arn); +} + 1; diff --git a/Open-ILS/src/perlmods/OpenILS/Event.pm b/Open-ILS/src/perlmods/OpenILS/Event.pm index b33cd80de6..28c9c3a38d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Event.pm +++ b/Open-ILS/src/perlmods/OpenILS/Event.pm @@ -23,7 +23,7 @@ sub new { _load_events() unless $events; throw OpenSRF::EX ("Bad event name: $event") unless $event; - my $e = $events->{$event}; + my $e = $events->{$event} || -1; my( $m, $f, $l ) = caller(0); my( $mm, $ff, $ll ) = caller(1); diff --git a/Open-ILS/src/support-scripts/clear_expired_circ_history.srfsh b/Open-ILS/src/support-scripts/clear_expired_circ_history.srfsh new file mode 100755 index 0000000000..16628ec1f5 --- /dev/null +++ b/Open-ILS/src/support-scripts/clear_expired_circ_history.srfsh @@ -0,0 +1,2 @@ +#!BINDIR/srfsh +request open-ils.cstore open-ils.cstore.json_query {"from":["container.clear_all_expired_circ_history_items"]} diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 6fb19edbe1..d20f166e35 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -447,7 +447,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { onresponse : function(r) { var item = openils.Util.readResponse(r); self.store.newItem(item.toStoreItem()); - } + }, }); if(search) new openils.PermaCrud().search(this.fmClass, search, opts); @@ -471,10 +471,31 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { fmField: this.field, widgetValue : val, readOnly : true, - forceSync : true }); - //autoWidget.build(); - return autoWidget.getDisplayString(); - } + + var syncTest = 0; + var self = this; + + autoWidget.build( + function(w, ww) { + if(syncTest == 1) { //async + var node = self.grid.views.views[0].getCellNode(rowIndex, self.index); + if(node && !node.__autogrid_value_set) { + node.innerHTML = ww.getDisplayString(); + node.__autogrid_value_set = true; + } + } + syncTest = 2; + } + ); + + var val = ''; + + if(syncTest == 2) // sync + val = autoWidget.getDisplayString(); // sync + + syncTest = 1; + return val; + }; } diff --git a/Open-ILS/web/templates/base.tt2 b/Open-ILS/web/templates/base.tt2 index 5fdf662e8a..df9502ccac 100644 --- a/Open-ILS/web/templates/base.tt2 +++ b/Open-ILS/web/templates/base.tt2 @@ -10,7 +10,7 @@ + djConfig="parseOnLoad: true, isDebug:true"> -- 2.43.2