[open-ils-commits] SPAM: r10345 - in branches/acq-experiment: . Open-ILS/src/c-apps Open-ILS/src/extras/import Open-ILS/src/offline Open-ILS/src/perlmods/OpenILS/Application Open-ILS/src/perlmods/OpenILS/Application/Circ Open-ILS/src/sql/Pg Open-ILS/web/opac/locale/en-US Open-ILS/web/opac/skin/default/js Open-ILS/web/opac/skin/default/xml/common Open-ILS/web/opac/skin/default/xml/myopac Open-ILS/web/opac/theme/default/css Open-ILS/xul/staff_client/server/admin Open-ILS/xul/staff_client/server/circ Open-ILS/xul/staff_client/server/patron

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Aug 12 21:41:34 EDT 2008


Author: erickson
Date: 2008-08-12 21:41:32 -0400 (Tue, 12 Aug 2008)
New Revision: 10345

Added:
   branches/acq-experiment/Open-ILS/src/sql/Pg/1.4-shadow_full_rec-upgade-db.sql
Modified:
   branches/acq-experiment/
   branches/acq-experiment/Open-ILS/src/c-apps/oils_auth.c
   branches/acq-experiment/Open-ILS/src/c-apps/oils_utils.c
   branches/acq-experiment/Open-ILS/src/extras/import/parallel_pg_loader.pl
   branches/acq-experiment/Open-ILS/src/extras/import/pg_loader.pl
   branches/acq-experiment/Open-ILS/src/offline/offline.pl
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
   branches/acq-experiment/Open-ILS/src/sql/Pg/030.schema.metabib.sql
   branches/acq-experiment/Open-ILS/src/sql/Pg/800.fkeys.sql
   branches/acq-experiment/Open-ILS/src/sql/Pg/950.data.seed-values.sql
   branches/acq-experiment/Open-ILS/src/sql/Pg/reporter-schema.sql
   branches/acq-experiment/Open-ILS/web/opac/locale/en-US/opac.dtd
   branches/acq-experiment/Open-ILS/web/opac/skin/default/js/holds.js
   branches/acq-experiment/Open-ILS/web/opac/skin/default/js/myopac.js
   branches/acq-experiment/Open-ILS/web/opac/skin/default/xml/common/holds.xml
   branches/acq-experiment/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml
   branches/acq-experiment/Open-ILS/web/opac/theme/default/css/colors.css
   branches/acq-experiment/Open-ILS/xul/staff_client/server/admin/transit_list.xul
   branches/acq-experiment/Open-ILS/xul/staff_client/server/circ/checkin.xul
   branches/acq-experiment/Open-ILS/xul/staff_client/server/circ/copy_status.xul
   branches/acq-experiment/Open-ILS/xul/staff_client/server/patron/holds.xul
   branches/acq-experiment/Open-ILS/xul/staff_client/server/patron/items.xul
Log:
Merged revisions 10331-10341,10344 via svnmerge from 
svn://svn.open-ils.org/ILS/trunk

........
  r10331 | erickson | 2008-08-11 11:11:35 -0400 (Mon, 11 Aug 2008) | 1 line
  
  return workstation not found even if the results is a JSON NULL.  free the NULL object
........
  r10332 | phasefx | 2008-08-11 11:34:37 -0400 (Mon, 11 Aug 2008) | 1 line
  
  use of the cat.util library is widespread, and since it doesn't load its own strings....
........
  r10333 | erickson | 2008-08-11 11:35:43 -0400 (Mon, 11 Aug 2008) | 1 line
  
  changed workstation by name fetcher to cstore
........
  r10334 | erickson | 2008-08-11 13:05:16 -0400 (Mon, 11 Aug 2008) | 1 line
  
  no need to fetch patron on item checkin
........
  r10335 | erickson | 2008-08-11 13:06:35 -0400 (Mon, 11 Aug 2008) | 1 line
  
  allow the pickup lib on a hold to be altered (and subsequently put item into transit to new lib) given permissions.  still need to put a perm-check in the opac to prevent giving the option
........
  r10336 | erickson | 2008-08-11 13:32:34 -0400 (Mon, 11 Aug 2008) | 1 line
  
  disable org select if requestor does not have the change-pickup-lib while on holds shelf perm
........
  r10337 | erickson | 2008-08-11 14:35:35 -0400 (Mon, 11 Aug 2008) | 1 line
  
  pull circ mods from the db and not the settings server
........
  r10338 | erickson | 2008-08-11 15:29:33 -0400 (Mon, 11 Aug 2008) | 1 line
  
  if hold expire time is set, do not clobber
........
  r10339 | erickson | 2008-08-11 15:30:50 -0400 (Mon, 11 Aug 2008) | 1 line
  
  show default expiration date in hold editor and allow for expire date editing.  pass a JS date to the dijit datebox setValue call
........
  r10340 | erickson | 2008-08-11 16:49:21 -0400 (Mon, 11 Aug 2008) | 4 lines
  
  
  display expire date on myopac hold list.  if hold expire is less than the expire alert interval, style the expire date
........
  r10341 | erickson | 2008-08-11 19:01:17 -0400 (Mon, 11 Aug 2008) | 1 line
  
  setting expire interval based on perm_interval of group
........
  r10344 | miker | 2008-08-12 21:06:40 -0400 (Tue, 12 Aug 2008) | 1 line
  
  Moving metabib.full_rec out of the way, replacing it with a suitably constrained and ruled-up view.  This addresses an indexing issue caused by the length of values stored in the, um, value column.  The purpose is to allow extremely large note and ToC fields without adding explicit support for over-long indexed fields directly to Postgres.  While possible, it can be a pain.
........



Property changes on: branches/acq-experiment
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk:1-10325
   + /trunk:1-10344

Modified: branches/acq-experiment/Open-ILS/src/c-apps/oils_auth.c
===================================================================
--- branches/acq-experiment/Open-ILS/src/c-apps/oils_auth.c	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/c-apps/oils_auth.c	2008-08-13 01:41:32 UTC (rev 10345)
@@ -320,7 +320,10 @@
 		const osrfMethodContext* ctx, jsonObject* userObj, const char* ws ) {
 	osrfLogInfo(OSRF_LOG_MARK, "Attaching workstation to user at login: %s", ws);
 	jsonObject* workstation = oilsUtilsFetchWorkstationByName(ws);
-	if(!workstation) return oilsNewEvent(OSRF_LOG_MARK, "WORKSTATION_NOT_FOUND");
+	if(!workstation || workstation->type == JSON_NULL) {
+        jsonObjectFree(workstation);
+        return oilsNewEvent(OSRF_LOG_MARK, "WORKSTATION_NOT_FOUND");
+    }
 	long wsid = oilsFMGetObjectId(workstation);
 	LONG_TO_STRING(wsid);
 	char* orgid = oilsFMGetString(workstation, "owning_lib");

Modified: branches/acq-experiment/Open-ILS/src/c-apps/oils_utils.c
===================================================================
--- branches/acq-experiment/Open-ILS/src/c-apps/oils_utils.c	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/c-apps/oils_utils.c	2008-08-13 01:41:32 UTC (rev 10345)
@@ -231,11 +231,12 @@
 }
 
 jsonObject* oilsUtilsFetchWorkstationByName( const char* name ) {
-	jsonObject* p = jsonParseStringFmt("[\"%s\"]", name);
-	jsonObject* r = oilsUtilsStorageReq(
-		"open-ils.storage.direct.actor.workstation.search.name", p );
+	jsonObject* p = jsonParseStringFmt("{\"name\":\"%s\"}", name);
+    jsonObject* r = oilsUtilsCStoreReq(
+        "open-ils.cstore.direct.actor.workstation.search", p);
 	jsonObjectFree(p);
-	return r;
+    return r;
 }
 
 
+

Modified: branches/acq-experiment/Open-ILS/src/extras/import/parallel_pg_loader.pl
===================================================================
--- branches/acq-experiment/Open-ILS/src/extras/import/parallel_pg_loader.pl	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/extras/import/parallel_pg_loader.pl	2008-08-13 01:41:32 UTC (rev 10345)
@@ -80,6 +80,9 @@
 			  fields => \@cols,
 			};
 
+        #XXX it burnnnsssessss
+        $fieldcache{$hint}{table} =~ s/\.full_rec/.real_full_rec/o if ($hint eq 'mfr');
+
 		my $fields = join(',', @{ $fieldcache{$hint}{fields} });
 		$main_out->print( "DELETE FROM $fieldcache{$hint}{table};\n" ) if (grep {$_ eq $hint } @wipe);
 		# Speed up loading of bib records

Modified: branches/acq-experiment/Open-ILS/src/extras/import/pg_loader.pl
===================================================================
--- branches/acq-experiment/Open-ILS/src/extras/import/pg_loader.pl	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/extras/import/pg_loader.pl	2008-08-13 01:41:32 UTC (rev 10345)
@@ -62,6 +62,9 @@
 			  pkey => $class->Identity,
 			  fields => \@cols,
 			};
+
+        #XXX it burnnnsssessss
+        $fieldcache{$hint}{table} =~ s/\.full_rec/.real_full_rec/o if ($hint eq 'mfr');
 	}
 
 	push @{ $lineset{$hint} }, [map { $row->$_ } @{ $fieldcache{$hint}{fields} }];

Modified: branches/acq-experiment/Open-ILS/src/offline/offline.pl
===================================================================
--- branches/acq-experiment/Open-ILS/src/offline/offline.pl	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/offline/offline.pl	2008-08-13 01:41:32 UTC (rev 10345)
@@ -13,6 +13,8 @@
 use OpenSRF::Utils qw/:daemon/;
 use OpenILS::Utils::OfflineStore;
 use OpenSRF::Utils::SettingsClient;
+use OpenSRF::Utils;
+use DateTime;
 
 use DBI;
 $DBI::trace = 1;
@@ -21,6 +23,7 @@
 my $DB = "OpenILS::Utils::OfflineStore";
 my $SES = "${DB}::Session";
 my $SCRIPT = "OpenILS::Utils::OfflineStore::Script";
+my $user_groups;
 
 # --------------------------------------------------------------------
 # Load the config
@@ -92,6 +95,9 @@
 		$org = $requestor->ws_ou unless $org;
 		ol_handle_result(OpenILS::Event->new('OFFLINE_NO_ORG')) unless $org;
 	}
+
+    $user_groups = $U->simplereq(
+        'open-ils.actor', 'open-ils.actor.groups.retrieve');
 }
 
 
@@ -770,6 +776,15 @@
 	# pull all of the rest of the data from the command blob
 	$actor->$_( $command->{user}->{$_} ) for keys %{$command->{user}};
 
+    # calculate the expire date for the patron based on the profile group
+    my ($grp) = grep {$_->id == $actor->profile} @$user_groups;
+    if($grp) {
+        my $seconds = OpenSRF::Utils->interval_to_seconds($grp->perm_interval);
+        my $expire_date = DateTime->from_epoch(epoch => DateTime->now->epoch + $seconds);
+		$logger->debug("offline: setting expire date to $expire_date");
+        $actor->expire_date($U->epoch2ISO8601($expire_date));
+    }
+
 	$logger->debug("offline: creating user object...");
 	$actor = $U->simplereq(
 		'open-ils.actor', 

Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2008-08-13 01:41:32 UTC (rev 10345)
@@ -521,14 +521,14 @@
         }
     }
 
+    return undef if $self->is_checkin;
 
     # --------------------------------------------------------------------------
     # Grab the patron
     # --------------------------------------------------------------------------
     my $patron;
-    my $p_evt;
 	if( $self->patron_id ) {
-		$patron = $e->retrieve_actor_user($self->patron_id) or $p_evt = $e->event;
+		$patron = $e->retrieve_actor_user($self->patron_id) or return $e->event;
 
 	} elsif( $self->patron_barcode ) {
 

Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2008-08-13 01:41:32 UTC (rev 10345)
@@ -142,10 +142,12 @@
 		}
 
         # set the configured expire time
-        my $interval = $U->ou_ancestor_setting_value($recipient->home_ou, OILS_SETTING_HOLD_EXPIRE);
-        if($interval) {
-            my $date = DateTime->now->add(seconds => OpenSRF::Utils::interval_to_seconds($interval));
-            $hold->expire_time($U->epoch2ISO8601($date->epoch));
+        unless($hold->expire_time) {
+            my $interval = $U->ou_ancestor_setting_value($recipient->home_ou, OILS_SETTING_HOLD_EXPIRE);
+            if($interval) {
+                my $date = DateTime->now->add(seconds => OpenSRF::Utils::interval_to_seconds($interval));
+                $hold->expire_time($U->epoch2ISO8601($date->epoch));
+            }
         }
 
 		$hold->requestor($e->requestor->id); 
@@ -542,13 +544,47 @@
         return $e->die_event unless $e->allowed('UPDATE_HOLD', $usr->home_ou);
     }
 
+    # --------------------------------------------------------------
+    # if the hold is on the holds shelf and the pickup lib changes, 
+    # we need to create a new transit
+    # --------------------------------------------------------------
+    if( ($orig_hold->pickup_lib ne $hold->pickup_lib) and (_hold_status($e, $hold) == 4)) {
+        return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF', $orig_hold->pickup_lib);
+        return $e->die_event unless $e->allowed('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF', $hold->pickup_lib);
+        my $evt = transit_hold($e, $orig_hold, $hold, 
+            $e->retrieve_asset_copy($hold->current_copy));
+        return $evt if $evt;
+    }
+
     update_hold_if_frozen($self, $e, $hold, $orig_hold);
     $e->update_action_hold_request($hold) or return $e->die_event;
     $e->commit;
     return $hold->id;
 }
 
+sub transit_hold {
+    my($e, $orig_hold, $hold, $copy) = @_;
+    my $src = $orig_hold->pickup_lib;
+    my $dest = $hold->pickup_lib;
 
+    $logger->info("putting hold into transit on pickup_lib update");
+
+    my $transit = Fieldmapper::action::transit_copy->new;
+    $transit->source($src);
+    $transit->dest($dest);
+    $transit->target_copy($copy->id);
+    $transit->source_send_time('now');
+    $transit->copy_status(OILS_COPY_STATUS_ON_HOLDS_SHELF);
+
+    $copy->status(OILS_COPY_STATUS_IN_TRANSIT);
+    $copy->editor($e->requestor->id);
+    $copy->edit_date('now');
+
+    $e->create_action_transit_copy($transit) or return $e->die_event;
+    $e->update_asset_copy($copy) or return $e->die_event;
+    return undef;
+}
+
 # if the hold is frozen, this method ensures that the hold is not "targeted", 
 # that is, it clears the current_copy and prev_check_time to essentiallly 
 # reset the hold.  If it is being activated, it runs the targeter in the background

Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2008-08-13 01:41:32 UTC (rev 10345)
@@ -67,9 +67,10 @@
 	method => 'fetch_circ_mods',
 	api_name => 'open-ils.circ.circ_modifier.retrieve.all');
 sub fetch_circ_mods {
-	my $conf = OpenSRF::Utils::SettingsClient->new;
-	return $conf->config_value(
-		'apps', 'open-ils.circ', 'app_settings', 'circ_modifiers', 'mod' );
+    my($self, $conn, $args) = @_;
+    my $mods = new_editor()->retrieve_all_config_circ_modifier;
+    return [ map {$_->code} @$mods ] unless $$args{full};
+    return $mods;
 }
 
 __PACKAGE__->register_method(

Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/030.schema.metabib.sql
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/030.schema.metabib.sql	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/030.schema.metabib.sql	2008-08-13 01:41:32 UTC (rev 10345)
@@ -136,9 +136,11 @@
 
 */
 
+-- Use a sequence that matches previous version, for easier upgrading.
+CREATE SEQUENCE metabib.full_rec_id_seq;
 
-CREATE TABLE metabib.full_rec (
-	id		BIGSERIAL	PRIMARY KEY,
+CREATE TABLE metabib.real_full_rec (
+	id		    BIGINT	NOT NULL DEFAULT NEXTVAL('metabib.full_rec_id_seq'::REGCLASS),
 	record		BIGINT		NOT NULL,
 	tag		CHAR(3)		NOT NULL,
 	ind1		TEXT,
@@ -147,16 +149,61 @@
 	value		TEXT		NOT NULL,
 	index_vector	tsvector	NOT NULL
 );
-CREATE INDEX metabib_full_rec_tag_subfield_idx ON metabib.full_rec (tag,subfield);
---CREATE INDEX metabib_full_rec_value_idx ON metabib.full_rec (value);
-CREATE INDEX metabib_full_rec_record_idx ON metabib.full_rec (record);
+ALTER TABLE metabib.real_full_rec ADD PRIMARY KEY (id);
+
+CREATE INDEX metabib_full_rec_tag_subfield_idx ON metabib.real_full_rec (tag,subfield);
+CREATE INDEX metabib_full_rec_value_idx ON metabib.real_full_rec (substring(value,1,1024));
+CREATE INDEX metabib_full_rec_record_idx ON metabib.real_full_rec (record);
+CREATE INDEX metabib_full_rec_index_vector_idx ON metabib.real_full_rec USING GIST (index_vector);
+
 CREATE TRIGGER metabib_full_rec_fti_trigger
-	BEFORE UPDATE OR INSERT ON metabib.full_rec
+	BEFORE UPDATE OR INSERT ON metabib.real_full_rec
 	FOR EACH ROW EXECUTE PROCEDURE oils_tsearch2('default');
 
-CREATE INDEX metabib_full_rec_index_vector_idx ON metabib.full_rec USING GIST (index_vector);
+CREATE OR REPLACE VIEW metabib.full_rec AS
+    SELECT  id,
+            record,
+            tag,
+            ind1,
+            ind2,
+            subfield,
+            SUBSTRING(value,1,1024) AS value,
+            index_vector
+      FROM  metabib.real_full_rec;
 
+CREATE OR REPLACE RULE metabib_full_rec_insert_rule
+    AS ON INSERT TO metabib.full_rec
+    DO INSTEAD
+    INSERT INTO metabib.real_full_rec VALUES (
+        COALESCE(NEW.id, NEXTVAL('metabib.full_rec_id_seq'::REGCLASS)),
+        NEW.record,
+        NEW.tag,
+        NEW.ind1,
+        NEW.ind2,
+        NEW.subfield,
+        NEW.value,
+        NEW.index_vector
+    );
 
+CREATE OR REPLACE RULE metabib_full_rec_update_rule
+    AS ON UPDATE TO metabib.full_rec
+    DO INSTEAD
+    UPDATE  metabib.real_full_rec SET
+        id = NEW.id,
+        record = NEW.record,
+        tag = NEW.tag,
+        ind1 = NEW.ind1,
+        ind2 = NEW.ind2,
+        subfield = NEW.subfield,
+        value = NEW.value,
+        index_vector = NEW.index_vector
+      WHERE id = OLD.id;
+
+CREATE OR REPLACE RULE metabib_full_rec_delete_rule
+    AS ON DELETE TO metabib.full_rec
+    DO INSTEAD
+    DELETE FROM metabib.real_full_rec WHERE id = OLD.id;
+
 CREATE TABLE metabib.metarecord_source_map (
 	id		BIGSERIAL	PRIMARY KEY,
 	metarecord	BIGINT		NOT NULL,

Copied: branches/acq-experiment/Open-ILS/src/sql/Pg/1.4-shadow_full_rec-upgade-db.sql (from rev 10344, trunk/Open-ILS/src/sql/Pg/1.4-shadow_full_rec-upgade-db.sql)
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/1.4-shadow_full_rec-upgade-db.sql	                        (rev 0)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/1.4-shadow_full_rec-upgade-db.sql	2008-08-13 01:41:32 UTC (rev 10345)
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2008  Equinox Software, Inc.
+ * Mike Rylander <miker at esilibrary.com> 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+
+BEGIN;
+
+-- To avoid any updates while we're doin' our thing...
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+
+-- This index, right here, is the reason for this change.
+DROP INDEX metabib.metabib_full_rec_value_idx;
+
+-- So, on to it.
+-- Move the table out of the way ...
+ALTER TABLE metabib.full_rec RENAME TO real_full_rec;
+
+-- ... and let the trigger management functions know about the change ...
+CREATE OR REPLACE FUNCTION reporter.disable_materialized_simple_record_trigger () RETURNS VOID AS $$
+    DROP TRIGGER zzz_update_materialized_simple_record_tgr ON metabib.real_full_rec;
+$$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION reporter.enable_materialized_simple_record_trigger () RETURNS VOID AS $$
+
+    TRUNCATE TABLE reporter.materialized_simple_record;
+
+    INSERT INTO reporter.materialized_simple_record
+        (id,fingerprint,quality,tcn_source,tcn_value,title,author,publisher,pubdate,isbn,issn)
+        SELECT DISTINCT ON (id) * FROM reporter.old_super_simple_record;
+
+    CREATE TRIGGER zzz_update_materialized_simple_record_tgr
+        AFTER INSERT OR UPDATE OR DELETE ON metabib.real_full_rec
+        FOR EACH ROW EXECUTE PROCEDURE reporter.simple_rec_sync();
+
+$$ LANGUAGE SQL;
+
+-- ... replace the table with a suitable view, which applies the index contstraint we'll use ...
+CREATE OR REPLACE VIEW metabib.full_rec AS
+    SELECT  id,
+            record,
+            tag,
+            ind1,
+            ind2,
+            subfield,
+            SUBSTRING(value,1,1024) AS value,
+            index_vector
+      FROM  metabib.real_full_rec;
+
+-- ... now some rules to transform DML against the view into DML against the underlying table ...
+CREATE OR REPLACE RULE metabib_full_rec_insert_rule
+    AS ON INSERT TO metabib.full_rec
+    DO INSTEAD
+    INSERT INTO metabib.real_full_rec VALUES (
+        COALESCE(NEW.id, NEXTVAL('metabib.full_rec_id_seq'::REGCLASS)),
+        NEW.record,
+        NEW.tag,
+        NEW.ind1,
+        NEW.ind2,
+        NEW.subfield,
+        NEW.value,
+        NEW.index_vector
+    );
+
+CREATE OR REPLACE RULE metabib_full_rec_update_rule
+    AS ON UPDATE TO metabib.full_rec
+    DO INSTEAD
+    UPDATE  metabib.real_full_rec SET
+        id = NEW.id,
+        record = NEW.record,
+        tag = NEW.tag,
+        ind1 = NEW.ind1,
+        ind2 = NEW.ind2,
+        subfield = NEW.subfield,
+        value = NEW.value,
+        index_vector = NEW.index_vector
+      WHERE id = OLD.id;
+
+CREATE OR REPLACE RULE metabib_full_rec_delete_rule
+    AS ON DELETE TO metabib.full_rec
+    DO INSTEAD
+    DELETE FROM metabib.real_full_rec WHERE id = OLD.id;
+
+-- ... and last, but not least, create a fore-shortened index on the value column.
+CREATE INDEX metabib_full_rec_value_idx ON metabib.real_full_rec (substring(value,1,1024));
+
+-- Wheeee...
+COMMIT;
+

Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/800.fkeys.sql
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/800.fkeys.sql	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/800.fkeys.sql	2008-08-13 01:41:32 UTC (rev 10345)
@@ -60,7 +60,7 @@
 
 ALTER TABLE metabib.rec_descriptor ADD CONSTRAINT metabib_rec_descriptor_record_fkey FOREIGN KEY (record) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
-ALTER TABLE metabib.full_rec ADD CONSTRAINT metabib_full_rec_record_fkey FOREIGN KEY (record) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE metabib.real_full_rec ADD CONSTRAINT metabib_full_rec_record_fkey FOREIGN KEY (record) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 
 ALTER TABLE metabib.metarecord_source_map ADD CONSTRAINT metabib_metarecord_source_map_source_fkey FOREIGN KEY (source) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
 ALTER TABLE metabib.metarecord_source_map ADD CONSTRAINT metabib_metarecord_source_map_metarecord_fkey FOREIGN KEY (metarecord) REFERENCES metabib.metarecord (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;

Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2008-08-13 01:41:32 UTC (rev 10345)
@@ -1147,6 +1147,7 @@
 INSERT INTO permission.perm_list (code) VALUES ('MERGE_BIB_RECORDS');
 INSERT INTO permission.perm_list (code, description) VALUES ('ADMIN_CURRENCY_TYPE', 
     oils_i18n_gettext('Allow a user to create/view/update/delete a currency_type'));
+INSERT INTO permission.perm_list (code) VALUES ('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF');
 
 
 INSERT INTO permission.grp_tree (id, name, parent, description, perm_interval, usergroup, application_perm) VALUES

Modified: branches/acq-experiment/Open-ILS/src/sql/Pg/reporter-schema.sql
===================================================================
--- branches/acq-experiment/Open-ILS/src/sql/Pg/reporter-schema.sql	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/src/sql/Pg/reporter-schema.sql	2008-08-13 01:41:32 UTC (rev 10345)
@@ -199,11 +199,11 @@
 $$ LANGUAGE PLPGSQL;
 
 CREATE TRIGGER zzz_update_materialized_simple_record_tgr
-    AFTER INSERT OR UPDATE OR DELETE ON metabib.full_rec
+    AFTER INSERT OR UPDATE OR DELETE ON metabib.real_full_rec
     FOR EACH ROW EXECUTE PROCEDURE reporter.simple_rec_sync();
 
 CREATE OR REPLACE FUNCTION reporter.disable_materialized_simple_record_trigger () RETURNS VOID AS $$
-    DROP TRIGGER zzz_update_materialized_simple_record_tgr ON metabib.full_rec;
+    DROP TRIGGER zzz_update_materialized_simple_record_tgr ON metabib.real_full_rec;
 $$ LANGUAGE SQL;
 
 CREATE OR REPLACE FUNCTION reporter.enable_materialized_simple_record_trigger () RETURNS VOID AS $$
@@ -215,7 +215,7 @@
         SELECT DISTINCT ON (id) * FROM reporter.old_super_simple_record;
 
     CREATE TRIGGER zzz_update_materialized_simple_record_tgr
-        AFTER INSERT OR UPDATE OR DELETE ON metabib.full_rec
+        AFTER INSERT OR UPDATE OR DELETE ON metabib.real_full_rec
         FOR EACH ROW EXECUTE PROCEDURE reporter.simple_rec_sync();
 
 $$ LANGUAGE SQL;

Modified: branches/acq-experiment/Open-ILS/web/opac/locale/en-US/opac.dtd
===================================================================
--- branches/acq-experiment/Open-ILS/web/opac/locale/en-US/opac.dtd	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/web/opac/locale/en-US/opac.dtd	2008-08-13 01:41:32 UTC (rev 10345)
@@ -223,6 +223,7 @@
 <!ENTITY opac.holds.freeze "Suspend this hold">
 <!ENTITY opac.holds.freeze.help "A suspended hold will retain its place in the queue, but will not be fulfilled until it has been activated.">
 <!ENTITY opac.holds.freeze.thaw_date "Automatically activate hold on:">
+<!ENTITY opac.holds.expire_time "Expiration date">
 
 <!--	================================================================= 
 	MyOPAC Preferences Page 

Modified: branches/acq-experiment/Open-ILS/web/opac/skin/default/js/holds.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/opac/skin/default/js/holds.js	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/web/opac/skin/default/js/holds.js	2008-08-13 01:41:32 UTC (rev 10345)
@@ -108,10 +108,16 @@
 	setSelector(orgsel, hold.pickup_lib());
 
 	if( hold.capture_time() || status > 2 ) {
-		orgsel.disabled = true;
         frozenbox.disabled = true;
         $('holds_frozen_thaw_input').disabled = true;
-
+        if(status == 3) {
+            // no pickup lib changes while in-transit
+		    orgsel.disabled = true;
+        } else {
+            var orgs = fetchPermOrgs('UPDATE_PICKUP_LIB_FROM_HOLDS_SHELF');
+            if(orgs[0] == -1)
+		        orgsel.disabled = true;
+        }
     } else {
 		orgsel.disabled = false;
         frozenbox.disabled = false;
@@ -137,12 +143,14 @@
 		$('holds_enable_email').checked = false;
 	}
 
+    dijit.byId('holds_expire_time').setValue(dojo.date.stamp.fromISOString(hold.expire_time()));
+
     /* populate the hold freezing info */
     if(!frozenbox.disabled && isTrue(hold.frozen())) {
         frozenbox.checked = true;
         unHideMe($('hold_frozen_thaw_row'));
         if(hold.thaw_date()) {
-            dijit.byId('holds_frozen_thaw_input').setValue(hold.thaw_date());
+            dijit.byId('holds_frozen_thaw_input').setValue(dojo.date.stamp.fromISOString(hold.thaw_date()));
         } else {
             dijit.byId('holds_frozen_thaw_input').setValue('');
         }
@@ -445,7 +453,6 @@
 		}
 	}
 
-    //if(!G.user.email()) {
     if(!holdArgs.recipient.email()) {
 		$('holds_enable_email').checked = false;	
 		$('holds_enable_email').disabled = true;
@@ -473,6 +480,13 @@
     $('holds_frozen_chkbox').checked = false;
     hideMe($('hold_frozen_thaw_row'));
 
+    var interval = fetchOrgSettingDefault(holdArgs.recipient.home_ou(), 'circ.hold_expire_interval');
+    var secs = 0;
+    if(interval)
+        secs = interval_to_seconds(interval);
+    var expire = new Date();
+    expire.setTime(expire.getTime() + Number(secs + '000'));
+    dijit.byId('holds_expire_time').setValue(expire);
 }
 
 function holdsParseMRFormats(str) {
@@ -711,6 +725,13 @@
 	hold.target(target);
 	hold.hold_type(holdArgs.type);
 
+    var expireDate = dojo.date.stamp.toISOString(dijit.byId('holds_expire_time').getValue())
+    expireDate = holdsVerifyThawDate(expireDate); 
+    if(expireDate)
+        hold.expire_time(expireDate);
+    else 
+        return;
+
     // see if this hold should be frozen and for how long
     if($('holds_frozen_chkbox').checked) {
         hold.frozen('t');

Modified: branches/acq-experiment/Open-ILS/web/opac/skin/default/js/myopac.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/opac/skin/default/js/myopac.js	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/web/opac/skin/default/js/myopac.js	2008-08-13 01:41:32 UTC (rev 10345)
@@ -358,11 +358,23 @@
 
         $n(row, 'myopac_holds_selected_chkbx').checked = false;
 
+        var exp_date = dojo.date.stamp.fromISOString(h.expire_time());
+        $n(row, 'myopac_hold_expire_time').appendChild(
+            text(dojo.date.locale.format(exp_date, {selector:'date'})));
+
 		unHideMe(row);
 
-		myOPACDrawHoldTitle(h);
-		myOPACDrawHoldStatus(h);
-	}
+        var interval = fetchOrgSettingDefault(G.user.home_ou(), 'circ.hold_expire_alert_interval');
+        if(interval) {
+            secs = interval_to_seconds(interval) * 1000;
+            var diff = exp_date.getTime() - new Date().getTime();
+            if(diff < secs)
+                addCSSClass($n(row, 'myopac_hold_expire_time'), 'hold_expire_warning');
+        }
+
+        myOPACDrawHoldTitle(h);
+        myOPACDrawHoldStatus(h);
+    }
 }
 
 function myOPACEditHold(holdid) {

Modified: branches/acq-experiment/Open-ILS/web/opac/skin/default/xml/common/holds.xml
===================================================================
--- branches/acq-experiment/Open-ILS/web/opac/skin/default/xml/common/holds.xml	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/web/opac/skin/default/xml/common/holds.xml	2008-08-13 01:41:32 UTC (rev 10345)
@@ -119,6 +119,13 @@
 					</td>
 				</tr>
 
+				<tr>
+					<td class='holds_cell'>&opac.holds.expire_time;</td>
+					<td class='holds_cell'>
+                        <input dojoType="dijit.form.DateTextBox" size='10' maxlength='10' id='holds_expire_time' />
+					</td>
+				</tr>
+
                 <tr>
                     <td class='holds_cell'>
                         &opac.holds.freeze;

Modified: branches/acq-experiment/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml
===================================================================
--- branches/acq-experiment/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml	2008-08-13 01:41:32 UTC (rev 10345)
@@ -47,6 +47,7 @@
 				<td>&common.status;</td>
 				<td>&myopac.holds.unfrozen;</td>
 				<td>&myopac.holds.frozen.until;</td>
+				<td>&opac.holds.expire_time;</td>
                 <td width='15%'>&common.select;
                     (<a id='myopac_select_all_holds' onclick='myopacSelectAllHolds();' 
                         class='classic_link' href='javascript:void(0);'>&common.all;</a>/<a id='myopac_select_none_holds' 
@@ -96,7 +97,9 @@
                     <span name='myopac_hold_unfrozen_true' class='hide_me check_mark'>&common.yes;</span>
                 </td>
 
+
                 <td name='myopac_holds_frozen_until'></td>
+                <td name='myopac_hold_expire_time'></td>
                 <td><input type='checkbox' name='myopac_holds_selected_chkbx'/></td>
 
 				<td name='myopac_holds_cancel' style='border-left: 3px solid #E0E0E0; border-right: 3px solid #E0E0E0;'>

Modified: branches/acq-experiment/Open-ILS/web/opac/theme/default/css/colors.css
===================================================================
--- branches/acq-experiment/Open-ILS/web/opac/theme/default/css/colors.css	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/web/opac/theme/default/css/colors.css	2008-08-13 01:41:32 UTC (rev 10345)
@@ -96,3 +96,6 @@
 #myopac_holds_thaw_date_form { border: 1px solid #E0E0E0; } 
 
 .invalid_field { border: 3px solid red; }
+
+.hold_expire_warning { color:red; }
+

Modified: branches/acq-experiment/Open-ILS/xul/staff_client/server/admin/transit_list.xul
===================================================================
--- branches/acq-experiment/Open-ILS/xul/staff_client/server/admin/transit_list.xul	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/xul/staff_client/server/admin/transit_list.xul	2008-08-13 01:41:32 UTC (rev 10345)
@@ -55,6 +55,7 @@
 
 	<messagecatalog id="adminStrings" src='/xul/server/locale/<!--#echo var="locale"-->/admin.properties'/>
 	<messagecatalog id="circStrings" src='/xul/server/locale/<!--#echo var="locale"-->/circ.properties'/>
+	<messagecatalog id="catStrings" src='/xul/server/locale/<!--#echo var="locale"-->/cat.properties'/>
 
 	<vbox flex="1" class="my_overflow">
 		<hbox>

Modified: branches/acq-experiment/Open-ILS/xul/staff_client/server/circ/checkin.xul
===================================================================
--- branches/acq-experiment/Open-ILS/xul/staff_client/server/circ/checkin.xul	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/xul/staff_client/server/circ/checkin.xul	2008-08-13 01:41:32 UTC (rev 10345)
@@ -99,6 +99,7 @@
 
     <messagecatalog id="commonStrings" src="/xul/server/locale/<!--#echo var='locale'-->/common.properties"/>
     <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties"/>
+    <messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale'-->/cat.properties"/>
 
 	<box id="checkin_main" />
 

Modified: branches/acq-experiment/Open-ILS/xul/staff_client/server/circ/copy_status.xul
===================================================================
--- branches/acq-experiment/Open-ILS/xul/staff_client/server/circ/copy_status.xul	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/xul/staff_client/server/circ/copy_status.xul	2008-08-13 01:41:32 UTC (rev 10345)
@@ -95,6 +95,7 @@
 	</script>
 
 	<messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties" />
+	<messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale'-->/cat.properties" />
 	<messagecatalog id="commonStrings" src="/xul/server/locale/<!--#echo var='locale'-->/common.properties" />
 
 	<commandset id="copy_status_cmds">

Modified: branches/acq-experiment/Open-ILS/xul/staff_client/server/patron/holds.xul
===================================================================
--- branches/acq-experiment/Open-ILS/xul/staff_client/server/patron/holds.xul	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/xul/staff_client/server/patron/holds.xul	2008-08-13 01:41:32 UTC (rev 10345)
@@ -69,6 +69,7 @@
 	</script>
 
 	<messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale' -->/circ.properties"/>
+	<messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale' -->/cat.properties"/>
 	<messagecatalog id="commonStrings" src="/xul/server/locale/<!--#echo var='locale'-->/common.properties" />
 
 	<commandset id="holds_cmds">

Modified: branches/acq-experiment/Open-ILS/xul/staff_client/server/patron/items.xul
===================================================================
--- branches/acq-experiment/Open-ILS/xul/staff_client/server/patron/items.xul	2008-08-13 01:06:40 UTC (rev 10344)
+++ branches/acq-experiment/Open-ILS/xul/staff_client/server/patron/items.xul	2008-08-13 01:41:32 UTC (rev 10345)
@@ -65,6 +65,7 @@
 	</script>
 
 	<messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale' -->/circ.properties"/>
+	<messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale' -->/cat.properties"/>
 	<messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties"/>
 	<messagecatalog id="commonStrings" src="/xul/server/locale/<!--#echo var='locale'-->/common.properties" />
 



More information about the open-ils-commits mailing list