Merged revisions 10331-10341,10344 via svnmerge from
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 13 Aug 2008 01:41:32 +0000 (01:41 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 13 Aug 2008 01:41:32 +0000 (01:41 +0000)
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.
........

git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@10345 dcc99617-32d9-48b4-a31d-7c20da2025e4

24 files changed:
Open-ILS/src/c-apps/oils_auth.c
Open-ILS/src/c-apps/oils_utils.c
Open-ILS/src/extras/import/parallel_pg_loader.pl
Open-ILS/src/extras/import/pg_loader.pl
Open-ILS/src/offline/offline.pl
Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/sql/Pg/030.schema.metabib.sql
Open-ILS/src/sql/Pg/1.4-shadow_full_rec-upgade-db.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/800.fkeys.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/reporter-schema.sql
Open-ILS/web/opac/locale/en-US/opac.dtd
Open-ILS/web/opac/skin/default/js/holds.js
Open-ILS/web/opac/skin/default/js/myopac.js
Open-ILS/web/opac/skin/default/xml/common/holds.xml
Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml
Open-ILS/web/opac/theme/default/css/colors.css
Open-ILS/xul/staff_client/server/admin/transit_list.xul
Open-ILS/xul/staff_client/server/circ/checkin.xul
Open-ILS/xul/staff_client/server/circ/copy_status.xul
Open-ILS/xul/staff_client/server/patron/holds.xul
Open-ILS/xul/staff_client/server/patron/items.xul

index 59ff65d..0dd9805 100644 (file)
@@ -320,7 +320,10 @@ static oilsEvent* oilsAuthVerifyWorkstation(
                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");
index 6743b52..fa8d755 100644 (file)
@@ -231,11 +231,12 @@ jsonObject* oilsUtilsFetchWorkstation( long id ) {
 }
 
 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;
 }
 
 
+
index 5d16f4b..5e586aa 100755 (executable)
@@ -80,6 +80,9 @@ while ( my $rec = <> ) {
                          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
index ef07a05..25b540f 100755 (executable)
@@ -62,6 +62,9 @@ while ( my $rec = <> ) {
                          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} }];
index d163d5d..fa18a7a 100755 (executable)
@@ -13,6 +13,8 @@ use Digest::MD5 qw/md5_hex/;
 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 $U = "OpenILS::Application::AppUtils";
 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 @@ sub ol_runtime_init {
                $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 @@ sub ol_handle_register {
        # 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', 
index ce9ff84..1731114 100644 (file)
@@ -67,9 +67,10 @@ __PACKAGE__->register_method(
        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(
index 8cefede..5ff9ca7 100644 (file)
@@ -521,14 +521,14 @@ sub mk_env {
         }
     }
 
+    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 ) {
 
index 7456a86..e71c383 100644 (file)
@@ -142,10 +142,12 @@ sub create_hold {
                }
 
         # 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,12 +544,46 @@ sub update_hold {
         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 
index a57f305..45de893 100644 (file)
@@ -136,9 +136,11 @@ CREATE INDEX metabib_rec_descriptor_vr_format_idx ON metabib.rec_descriptor (vr_
 
 */
 
+-- 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,15 +149,60 @@ CREATE TABLE metabib.full_rec (
        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,
diff --git a/Open-ILS/src/sql/Pg/1.4-shadow_full_rec-upgade-db.sql b/Open-ILS/src/sql/Pg/1.4-shadow_full_rec-upgade-db.sql
new file mode 100644 (file)
index 0000000..bf44934
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2008  Equinox Software, Inc.
+ * Mike Rylander <miker@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;
+
index 2679d69..baa9185 100644 (file)
@@ -60,7 +60,7 @@ ALTER TABLE metabib.keyword_field_entry ADD CONSTRAINT metabib_keyword_field_ent
 
 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;
index 76f4dc2..af91a90 100644 (file)
@@ -1147,6 +1147,7 @@ INSERT INTO permission.perm_list (code) VALUES ('UPDATE_XML_TRANSFORM');
 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
index f2101ef..27a7aa2 100644 (file)
@@ -199,11 +199,11 @@ END;
 $$ 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 @@ CREATE OR REPLACE FUNCTION reporter.enable_materialized_simple_record_trigger ()
         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;
index 0ef11d9..862543a 100644 (file)
@@ -223,6 +223,7 @@ If an item has already been selected to fulfill the hold, it will not be suspend
 <!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 
index b201d35..0e44dab 100644 (file)
@@ -108,10 +108,16 @@ function _holdsUpdateEditHold() {
        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 @@ function _holdsUpdateEditHold() {
                $('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 @@ function __holdsDrawWindow() {
                }
        }
 
-    //if(!G.user.email()) {
     if(!holdArgs.recipient.email()) {
                $('holds_enable_email').checked = false;        
                $('holds_enable_email').disabled = true;
@@ -473,6 +480,13 @@ function __holdsDrawWindow() {
     $('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 @@ function holdsBuildHoldFromWindow() {
        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');
index a3a4fdc..4deca43 100644 (file)
@@ -358,11 +358,23 @@ function myOPACDrawHolds(r) {
 
         $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) {
index b5899e7..ea7aec0 100644 (file)
                                        </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;
index 3644764..0553754 100644 (file)
@@ -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;'>
index 9bfe478..93365a7 100644 (file)
@@ -96,3 +96,6 @@ a:focus { background: #E0F0E0; color: #000000;}
 #myopac_holds_thaw_date_form { border: 1px solid #E0E0E0; } 
 
 .invalid_field { border: 3px solid red; }
+
+.hold_expire_warning { color:red; }
+
index 9401ee6..07c8ddf 100644 (file)
@@ -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>
index 2a1686a..0314bcd 100644 (file)
@@ -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" />
 
index c1ec687..872f6ef 100644 (file)
@@ -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">
index 0c0d285..9b7f25c 100644 (file)
@@ -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">
index fa2fc90..2829e54 100644 (file)
@@ -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" />