Merge branch 'master' of git+ssh://yeti.esilibrary.com/home/evergreen/evergreen-equin... kcls-grey-screen-prod1
authorberick <berick@esilibrary.com>
Mon, 14 Mar 2011 17:17:19 +0000 (13:17 -0400)
committerberick <berick@esilibrary.com>
Mon, 14 Mar 2011 17:17:19 +0000 (13:17 -0400)
31 files changed:
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter/transforms.pm
Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql [deleted file]
Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql [deleted file]
Open-ILS/src/sql/Pg/000.english.pg83.fts-config.sql [deleted file]
Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql [deleted file]
Open-ILS/src/sql/Pg/000.english.pg90.fts-config.sql
Open-ILS/src/sql/Pg/002.functions.aggregate.sql
Open-ILS/src/sql/Pg/002.functions.general.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/005.schema.actors.sql
Open-ILS/src/sql/Pg/012.schema.vandelay.sql
Open-ILS/src/sql/Pg/990.schema.unapi.sql
Open-ILS/src/sql/Pg/build-db.sh
Open-ILS/src/sql/Pg/upgrade/0498.lowercase_via_perl.sql [new file with mode: 0644]
Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js
Open-ILS/web/js/dojo/fieldmapper/IDL.js
Open-ILS/web/js/dojo/fieldmapper/OrgUtils.js
Open-ILS/web/js/dojo/fieldmapper/dojoData.js
Open-ILS/web/js/dojo/fieldmapper/hash.js
Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/web/templates/default/conify/global/config/record_attr_definition.tt2
Open-ILS/xul/staff_client/chrome/content/main/menu.js
Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
Open-ILS/xul/staff_client/server/patron/search_form.js
Open-ILS/xul/staff_client/server/patron/search_form_overlay.xul
Open-ILS/xul/staff_client/server/patron/search_result.js

index 8c39296..3047e2a 100644 (file)
@@ -1684,7 +1684,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
        </class>
        <class id="cxt" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::xml_transform" oils_persist:tablename="config.xml_transform" reporter:label="XML/XSLT Transform Definition">
                <fields oils_persist:primary="name">
-                       <field reporter:label="Field Class" name="field_class" />
                        <field reporter:label="Name" name="name" reporter:datatype="text" />
                        <field reporter:label="Namespace URI" name="namespace_uri" reporter:datatype="text"/>
                        <field reporter:label="Namespace Prefix" name="prefix" reporter:datatype="text"/>
index 212dd45..3c6543a 100644 (file)
@@ -11,8 +11,6 @@ use DateTime::Format::ISO8601;
 use DateTime::Set;
 use DateTime::SpanSet;
 
-use Encode;
-
 my $_dt_parser = DateTime::Format::ISO8601->new;    
 
 my $log = 'OpenSRF::Utils::Logger';
@@ -643,20 +641,20 @@ sub patron_search {
        # group 2 = phone, ident
        # group 3 = barcode
 
-       my $usr = join ' AND ', map { "LOWER(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
-       my @usrv = map { "^" . encode_utf8($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
+       my $usr = join ' AND ', map { "evergreen.lowercase(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
+       my @usrv = map { "^" . $$search{$_}{value} } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
 
-       my $addr = join ' AND ', map { "LOWER(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
-       my @addrv = map { "^" . encode_utf8($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
+       my $addr = join ' AND ', map { "evergreen.lowercase(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
+       my @addrv = map { "^" . $$search{$_}{value} } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
 
-       my $pv = encode_utf8($$search{phone}{value});
-       my $iv = encode_utf8($$search{ident}{value});
-       my $nv = encode_utf8($$search{name}{value});
-       my $cv = encode_utf8($$search{card}{value});
+       my $pv = $$search{phone}{value};
+       my $iv = $$search{ident}{value};
+       my $nv = $$search{name}{value};
+       my $cv = $$search{card}{value};
 
        my $card = '';
        if ($cv) {
-           $card = 'JOIN (SELECT DISTINCT usr FROM actor.card WHERE LOWER(barcode) LIKE ?||\'%\') AS card ON (card.usr = users.id)';
+           $card = 'JOIN (SELECT DISTINCT usr FROM actor.card WHERE evergreen.lowercase(barcode) LIKE ?||\'%\') AS card ON (card.usr = users.id)';
            unshift(@usrv, $cv);
        }
 
@@ -665,7 +663,7 @@ sub patron_search {
        my @phonev;
        if ($pv) {
                for my $p ( qw/day_phone evening_phone other_phone/ ) {
-                       push @ps, "LOWER($p) ~ ?";
+                       push @ps, "evergreen.lowercase($p) ~ ?";
                        push @phonev, "^$pv";
                }
                $phone = '(' . join(' OR ', @ps) . ')';
@@ -676,7 +674,7 @@ sub patron_search {
        my @identv;
        if ($iv) {
                for my $i ( qw/ident_value ident_value2/ ) {
-                       push @is, "LOWER($i) ~ ?";
+                       push @is, "evergreen.lowercase($i) ~ ?";
                        push @identv, "^$iv";
                }
                $ident = '(' . join(' OR ', @is) . ')';
@@ -687,7 +685,7 @@ sub patron_search {
        my @namev;
        if (0 && $nv) {
                for my $n ( qw/first_given_name second_given_name family_name/ ) {
-                       push @ns, "LOWER($n) ~ ?";
+                       push @ns, "evergreen.lowercase($n) ~ ?";
                        push @namev, "^$nv";
                }
                $name = '(' . join(' OR ', @ns) . ')';
@@ -724,8 +722,8 @@ sub patron_search {
 
        return undef if (!$select && !$card);
 
-       my $order_by = join ', ', map { 'LOWER(CAST(users.'. (split / /,$_)[0] . ' AS text)) ' . (split / /,$_)[1] } @$sort;
-       my $distinct_list = join ', ', map { 'LOWER(CAST(users.'. (split / /,$_)[0] . ' AS text))' } @$sort;
+       my $order_by = join ', ', map { 'evergreen.lowercase(CAST(users.'. (split / /,$_)[0] . ' AS text)) ' . (split / /,$_)[1] } @$sort;
+       my $distinct_list = join ', ', map { 'evergreen.lowercase(CAST(users.'. (split / /,$_)[0] . ' AS text))' } @$sort;
     my $group_list = $distinct_list;
 
        if ($inactive) {
index 1311800..119e766 100644 (file)
@@ -869,10 +869,10 @@ sub owner_queue_retrieve {
 
     if($self->{record_type} eq 'bib') {
         $queues = $e->search_vandelay_bib_queue(
-            [$search, {order_by => {vbq => 'lower(name)'}}]);
+            [$search, {order_by => {vbq => 'evergreen.lowercase(name)'}}]);
     } else {
         $queues = $e->search_vandelay_authority_queue(
-            [$search, {order_by => {vaq => 'lower(name)'}}]);
+            [$search, {order_by => {vaq => 'evergreen.lowercase(name)'}}]);
     }
     $conn->respond($_) for @$queues;
     $e->rollback;
index 637cbc5..b7d7177 100644 (file)
@@ -596,7 +596,7 @@ sub toSQL {
        my $params = $self->resolve_param( $self->{_column}->{params} );
        my $start = $$params[0];
        my $len = $$params[1];
-       return 'LOWER("' . $self->{_relation} . '"."' . $self->name . '")';
+       return 'evergreen.lowercase("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
index 8123d15..dbf4dac 100644 (file)
@@ -57,7 +57,7 @@ our $dtype_xforms = {
                 'group' => 1 },
         'lower'         => {    
                 'label' => 'Transform string to lower case',
-                'select'        => 'LOWER(?COLNAME?)',
+                'select'        => 'evergreen.lowercase(?COLNAME?)',
                 'group' => 1 },
         'upper'         => {
                 'label' => 'Transform string to upper case',
diff --git a/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql
deleted file mode 100644 (file)
index 650005e..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2004-2008  Georgia Public Library Service
- * 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;
-
-CREATE OR REPLACE FUNCTION oils_tsearch2 () RETURNS TRIGGER AS $$
-BEGIN
-       NEW.index_vector = to_tsvector(TG_ARGV[0], NEW.value);
-       RETURN NEW;
-END;
-$$ LANGUAGE PLPGSQL;
-
-INSERT INTO pg_ts_cfg VALUES ('title', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('author', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('subject', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('keyword', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('identifier', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('series', 'default','C');
-
-INSERT INTO pg_ts_dict VALUES ('en_stem_nostop', 'snb_en_init(internal)', '', 'snb_lexize(internal,internal,integer)', 'English Stemmer. Snowball. No stop words.');
-
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'lhword', '{en_stem_nostop}');
-
-SELECT set_curcfg('default');
-
-COMMIT;
diff --git a/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql
deleted file mode 100644 (file)
index 650005e..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (C) 2004-2008  Georgia Public Library Service
- * 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;
-
-CREATE OR REPLACE FUNCTION oils_tsearch2 () RETURNS TRIGGER AS $$
-BEGIN
-       NEW.index_vector = to_tsvector(TG_ARGV[0], NEW.value);
-       RETURN NEW;
-END;
-$$ LANGUAGE PLPGSQL;
-
-INSERT INTO pg_ts_cfg VALUES ('title', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('author', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('subject', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('keyword', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('identifier', 'default','C');
-INSERT INTO pg_ts_cfg VALUES ('series', 'default','C');
-
-INSERT INTO pg_ts_dict VALUES ('en_stem_nostop', 'snb_en_init(internal)', '', 'snb_lexize(internal,internal,integer)', 'English Stemmer. Snowball. No stop words.');
-
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('title', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('author', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'lhword', '{en_stem_nostop}');
-
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'nlword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'word', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'email', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'url', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'host', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'sfloat', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'version', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'part_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'nlpart_hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'hword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'nlhword', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'uri', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'file', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'float', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'int', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'uint', '{simple}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'lword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'lpart_hword', '{en_stem_nostop}');
-INSERT INTO pg_ts_cfgmap VALUES ('series', 'lhword', '{en_stem_nostop}');
-
-SELECT set_curcfg('default');
-
-COMMIT;
diff --git a/Open-ILS/src/sql/Pg/000.english.pg83.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg83.fts-config.sql
deleted file mode 100644 (file)
index b0b1157..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2004-2008  Georgia Public Library Service
- * Copyright (C) 2008  Equinox Software, Inc., Laurentian University
- * Mike Rylander <miker@esilibrary.com>
- * Dan Scott <dscott@laurentian.ca>
- *
- * 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;
-
-CREATE OR REPLACE FUNCTION oils_tsearch2 () RETURNS TRIGGER AS $$
-BEGIN
-       NEW.index_vector = to_tsvector((TG_ARGV[0])::regconfig, NEW.value);
-       RETURN NEW;
-END;
-$$ LANGUAGE PLPGSQL;
-
-DROP TEXT SEARCH DICTIONARY IF EXISTS english_nostop CASCADE;
-
-CREATE TEXT SEARCH DICTIONARY english_nostop (TEMPLATE=pg_catalog.snowball, language='english');
-COMMENT ON TEXT SEARCH DICTIONARY english_nostop IS 'English snowball stemmer with no stopwords for ASCII words only.';
-
-CREATE TEXT SEARCH CONFIGURATION title ( COPY = pg_catalog.english );
-ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR word, hword, hword_part WITH pg_catalog.simple;
-ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH public.english_nostop;
-CREATE TEXT SEARCH CONFIGURATION author ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION subject ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION keyword ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION identifier ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION series ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION "default" ( COPY = title );
-
-COMMIT;
diff --git a/Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql
deleted file mode 100644 (file)
index b0b1157..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2004-2008  Georgia Public Library Service
- * Copyright (C) 2008  Equinox Software, Inc., Laurentian University
- * Mike Rylander <miker@esilibrary.com>
- * Dan Scott <dscott@laurentian.ca>
- *
- * 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;
-
-CREATE OR REPLACE FUNCTION oils_tsearch2 () RETURNS TRIGGER AS $$
-BEGIN
-       NEW.index_vector = to_tsvector((TG_ARGV[0])::regconfig, NEW.value);
-       RETURN NEW;
-END;
-$$ LANGUAGE PLPGSQL;
-
-DROP TEXT SEARCH DICTIONARY IF EXISTS english_nostop CASCADE;
-
-CREATE TEXT SEARCH DICTIONARY english_nostop (TEMPLATE=pg_catalog.snowball, language='english');
-COMMENT ON TEXT SEARCH DICTIONARY english_nostop IS 'English snowball stemmer with no stopwords for ASCII words only.';
-
-CREATE TEXT SEARCH CONFIGURATION title ( COPY = pg_catalog.english );
-ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR word, hword, hword_part WITH pg_catalog.simple;
-ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH public.english_nostop;
-CREATE TEXT SEARCH CONFIGURATION author ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION subject ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION keyword ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION identifier ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION series ( COPY = title );
-CREATE TEXT SEARCH CONFIGURATION "default" ( COPY = title );
-
-COMMIT;
index b0b1157..e4e50e4 100644 (file)
@@ -32,7 +32,7 @@ COMMENT ON TEXT SEARCH DICTIONARY english_nostop IS 'English snowball stemmer wi
 
 CREATE TEXT SEARCH CONFIGURATION title ( COPY = pg_catalog.english );
 ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR word, hword, hword_part WITH pg_catalog.simple;
-ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH public.english_nostop;
+ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH english_nostop;
 CREATE TEXT SEARCH CONFIGURATION author ( COPY = title );
 CREATE TEXT SEARCH CONFIGURATION subject ( COPY = title );
 CREATE TEXT SEARCH CONFIGURATION keyword ( COPY = title );
index 70dc588..fb0c311 100644 (file)
  *
  */
 
--- Allow these to fail gracelessly outside the transaction
--- because PostgreSQL 8.1 does not support IF EXISTS
-DROP AGGREGATE array_accum(anyelement) CASCADE;
-DROP AGGREGATE public.first(anyelement) CASCADE;
-DROP AGGREGATE public.last(anyelement) CASCADE;
-DROP AGGREGATE public.agg_text(text) CASCADE;
-DROP AGGREGATE public.agg_tsvector(tsvector) CASCADE;
-
 BEGIN;
 
+DROP AGGREGATE IF EXISTS array_accum(anyelement) CASCADE;
+DROP AGGREGATE IF EXISTS public.first(anyelement) CASCADE;
+DROP AGGREGATE IF EXISTS public.last(anyelement) CASCADE;
+DROP AGGREGATE IF EXISTS public.agg_text(text) CASCADE;
+DROP AGGREGATE IF EXISTS public.agg_tsvector(tsvector) CASCADE;
+
 CREATE AGGREGATE array_accum (
        sfunc = array_append,
        basetype = anyelement,
diff --git a/Open-ILS/src/sql/Pg/002.functions.general.sql b/Open-ILS/src/sql/Pg/002.functions.general.sql
new file mode 100644 (file)
index 0000000..f9407a5
--- /dev/null
@@ -0,0 +1,14 @@
+-- Rather than polluting the public schema with general Evergreen
+-- functions, carve out a dedicated schema
+
+DROP SCHEMA IF EXISTS evergreen CASCADE;
+
+BEGIN;
+
+CREATE SCHEMA evergreen;
+
+CREATE OR REPLACE FUNCTION evergreen.lowercase( TEXT ) RETURNS TEXT AS $$
+    return lc(shift);
+$$ LANGUAGE PLPERLU STRICT IMMUTABLE;
+
+COMMIT;
index daff4d7..018d806 100644 (file)
@@ -70,7 +70,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0497'); -- miker for tsbere
+INSERT INTO config.upgrade_log (version) VALUES ('0498'); -- dbs
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index a1ae60c..43fee34 100644 (file)
@@ -97,18 +97,18 @@ CREATE INDEX actor_usr_usrgroup_idx ON actor.usr (usrgroup);
 CREATE INDEX actor_usr_mailing_address_idx ON actor.usr (mailing_address);
 CREATE INDEX actor_usr_billing_address_idx ON actor.usr (billing_address);
 
-CREATE INDEX actor_usr_first_given_name_idx ON actor.usr (lower(first_given_name));
-CREATE INDEX actor_usr_second_given_name_idx ON actor.usr (lower(second_given_name));
-CREATE INDEX actor_usr_family_name_idx ON actor.usr (lower(family_name));
+CREATE INDEX actor_usr_first_given_name_idx ON actor.usr (evergreen.lowercase(first_given_name));
+CREATE INDEX actor_usr_second_given_name_idx ON actor.usr (evergreen.lowercase(second_given_name));
+CREATE INDEX actor_usr_family_name_idx ON actor.usr (evergreen.lowercase(family_name));
 
-CREATE INDEX actor_usr_email_idx ON actor.usr (lower(email));
+CREATE INDEX actor_usr_email_idx ON actor.usr (evergreen.lowercase(email));
 
-CREATE INDEX actor_usr_day_phone_idx ON actor.usr (lower(day_phone));
-CREATE INDEX actor_usr_evening_phone_idx ON actor.usr (lower(evening_phone));
-CREATE INDEX actor_usr_other_phone_idx ON actor.usr (lower(other_phone));
+CREATE INDEX actor_usr_day_phone_idx ON actor.usr (evergreen.lowercase(day_phone));
+CREATE INDEX actor_usr_evening_phone_idx ON actor.usr (evergreen.lowercase(evening_phone));
+CREATE INDEX actor_usr_other_phone_idx ON actor.usr (evergreen.lowercase(other_phone));
 
-CREATE INDEX actor_usr_ident_value_idx ON actor.usr (lower(ident_value));
-CREATE INDEX actor_usr_ident_value2_idx ON actor.usr (lower(ident_value2));
+CREATE INDEX actor_usr_ident_value_idx ON actor.usr (evergreen.lowercase(ident_value));
+CREATE INDEX actor_usr_ident_value2_idx ON actor.usr (evergreen.lowercase(ident_value2));
 
 CREATE FUNCTION actor.crypt_pw_insert () RETURNS TRIGGER AS $$
        BEGIN
@@ -316,7 +316,7 @@ COMMENT ON TABLE actor.card IS $$
 $$;
 
 CREATE INDEX actor_card_usr_idx ON actor.card (usr);
-CREATE INDEX actor_card_barcode_lower_idx ON actor.card (lower(barcode));
+CREATE INDEX actor_card_barcode_evergreen_lowercase_idx ON actor.card (evergreen.lowercase(barcode));
 
 CREATE TABLE actor.org_unit_type (
        id              SERIAL  PRIMARY KEY,
@@ -515,12 +515,12 @@ CREATE TABLE actor.usr_address (
 
 CREATE INDEX actor_usr_addr_usr_idx ON actor.usr_address (usr);
 
-CREATE INDEX actor_usr_addr_street1_idx ON actor.usr_address (lower(street1));
-CREATE INDEX actor_usr_addr_street2_idx ON actor.usr_address (lower(street2));
+CREATE INDEX actor_usr_addr_street1_idx ON actor.usr_address (evergreen.lowercase(street1));
+CREATE INDEX actor_usr_addr_street2_idx ON actor.usr_address (evergreen.lowercase(street2));
 
-CREATE INDEX actor_usr_addr_city_idx ON actor.usr_address (lower(city));
-CREATE INDEX actor_usr_addr_state_idx ON actor.usr_address (lower(state));
-CREATE INDEX actor_usr_addr_post_code_idx ON actor.usr_address (lower(post_code));
+CREATE INDEX actor_usr_addr_city_idx ON actor.usr_address (evergreen.lowercase(city));
+CREATE INDEX actor_usr_addr_state_idx ON actor.usr_address (evergreen.lowercase(state));
+CREATE INDEX actor_usr_addr_post_code_idx ON actor.usr_address (evergreen.lowercase(post_code));
 
 CREATE TABLE actor.usr_password_reset (
   id SERIAL PRIMARY KEY,
index 0add48d..476ee07 100644 (file)
@@ -1126,7 +1126,7 @@ BEGIN
     
                -- Looks like an ISBN? check for an isbn match
                IF (attr.attr_value ~* $r$^[0-9x]+$$r$ AND character_length(attr.attr_value) IN (10,13)) THEN
-               FOR eg_rec IN EXECUTE $$SELECT * FROM metabib.full_rec fr WHERE fr.value LIKE LOWER('$$ || attr.attr_value || $$%') AND fr.tag = '020' AND fr.subfield = 'a'$$ LOOP
+               FOR eg_rec IN EXECUTE $$SELECT * FROM metabib.full_rec fr WHERE fr.value LIKE evergreen.lowercase('$$ || attr.attr_value || $$%') AND fr.tag = '020' AND fr.subfield = 'a'$$ LOOP
                                PERFORM id FROM biblio.record_entry WHERE id = eg_rec.record AND deleted IS FALSE;
                                IF FOUND THEN
                                INSERT INTO vandelay.bib_match (field_type, matched_attr, queued_record, eg_record) VALUES ('isbn', attr.id, NEW.id, eg_rec.record);
index a189c57..e7abed5 100644 (file)
@@ -1,4 +1,4 @@
-DROP SCHEMA unapi CASCADE;
+DROP SCHEMA IF EXISTS unapi CASCADE;
 
 BEGIN;
 CREATE SCHEMA unapi;
index e1ba82c..0e8f6f8 100755 (executable)
@@ -83,6 +83,7 @@ ordered_file_list="
 
   001.schema.offline.sql
 
+  002.functions.general.sql
   002.schema.config.sql
   002.functions.aggregate.sql
   002.functions.config.sql
diff --git a/Open-ILS/src/sql/Pg/upgrade/0498.lowercase_via_perl.sql b/Open-ILS/src/sql/Pg/upgrade/0498.lowercase_via_perl.sql
new file mode 100644 (file)
index 0000000..2302bf7
--- /dev/null
@@ -0,0 +1,134 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0498'); -- dbs
+
+-- Rather than polluting the public schema with general Evergreen
+-- functions, carve out a dedicated schema
+CREATE SCHEMA evergreen;
+
+-- Replace all uses of PostgreSQL's built-in LOWER() function with
+-- a more locale-savvy PLPERLU evergreen.lowercase() function
+CREATE OR REPLACE FUNCTION evergreen.lowercase( TEXT ) RETURNS TEXT AS $$
+    return lc(shift);
+$$ LANGUAGE PLPERLU STRICT IMMUTABLE;
+
+-- update actor.usr_address indexes
+DROP INDEX IF EXISTS actor.actor_usr_addr_street1_idx;
+DROP INDEX IF EXISTS actor.actor_usr_addr_street2_idx;
+DROP INDEX IF EXISTS actor.actor_usr_addr_city_idx;
+DROP INDEX IF EXISTS actor.actor_usr_addr_state_idx; 
+DROP INDEX IF EXISTS actor.actor_usr_addr_post_code_idx;
+
+CREATE INDEX actor_usr_addr_street1_idx ON actor.usr_address (evergreen.lowercase(street1));
+CREATE INDEX actor_usr_addr_street2_idx ON actor.usr_address (evergreen.lowercase(street2));
+CREATE INDEX actor_usr_addr_city_idx ON actor.usr_address (evergreen.lowercase(city));
+CREATE INDEX actor_usr_addr_state_idx ON actor.usr_address (evergreen.lowercase(state));
+CREATE INDEX actor_usr_addr_post_code_idx ON actor.usr_address (evergreen.lowercase(post_code));
+
+-- update actor.usr indexes
+DROP INDEX IF EXISTS actor.actor_usr_first_given_name_idx;
+DROP INDEX IF EXISTS actor.actor_usr_second_given_name_idx;
+DROP INDEX IF EXISTS actor.actor_usr_family_name_idx;
+DROP INDEX IF EXISTS actor.actor_usr_email_idx;
+DROP INDEX IF EXISTS actor.actor_usr_day_phone_idx;
+DROP INDEX IF EXISTS actor.actor_usr_evening_phone_idx;
+DROP INDEX IF EXISTS actor.actor_usr_other_phone_idx;
+DROP INDEX IF EXISTS actor.actor_usr_ident_value_idx;
+DROP INDEX IF EXISTS actor.actor_usr_ident_value2_idx;
+
+CREATE INDEX actor_usr_first_given_name_idx ON actor.usr (evergreen.lowercase(first_given_name));
+CREATE INDEX actor_usr_second_given_name_idx ON actor.usr (evergreen.lowercase(second_given_name));
+CREATE INDEX actor_usr_family_name_idx ON actor.usr (evergreen.lowercase(family_name));
+CREATE INDEX actor_usr_email_idx ON actor.usr (evergreen.lowercase(email));
+CREATE INDEX actor_usr_day_phone_idx ON actor.usr (evergreen.lowercase(day_phone));
+CREATE INDEX actor_usr_evening_phone_idx ON actor.usr (evergreen.lowercase(evening_phone));
+CREATE INDEX actor_usr_other_phone_idx ON actor.usr (evergreen.lowercase(other_phone));
+CREATE INDEX actor_usr_ident_value_idx ON actor.usr (evergreen.lowercase(ident_value));
+CREATE INDEX actor_usr_ident_value2_idx ON actor.usr (evergreen.lowercase(ident_value2));
+
+-- update actor.card indexes
+DROP INDEX IF EXISTS actor.actor_card_barcode_evergreen_lowercase_idx;
+CREATE INDEX actor_card_barcode_evergreen_lowercase_idx ON actor.card (evergreen.lowercase(barcode));
+
+CREATE OR REPLACE FUNCTION vandelay.match_bib_record ( ) RETURNS TRIGGER AS $func$
+DECLARE
+    attr        RECORD;
+    attr_def    RECORD;
+    eg_rec      RECORD;
+    id_value    TEXT;
+    exact_id    BIGINT;
+BEGIN
+
+    DELETE FROM vandelay.bib_match WHERE queued_record = NEW.id;
+
+    SELECT * INTO attr_def FROM vandelay.bib_attr_definition WHERE xpath = '//*[@tag="901"]/*[@code="c"]' ORDER BY id LIMIT 1;
+
+    IF attr_def IS NOT NULL AND attr_def.id IS NOT NULL THEN
+        id_value := extract_marc_field('vandelay.queued_bib_record', NEW.id, attr_def.xpath, attr_def.remove);
+    
+        IF id_value IS NOT NULL AND id_value <> '' AND id_value ~ $r$^\d+$$r$ THEN
+            SELECT id INTO exact_id FROM biblio.record_entry WHERE id = id_value::BIGINT AND NOT deleted;
+            SELECT * INTO attr FROM vandelay.queued_bib_record_attr WHERE record = NEW.id and field = attr_def.id LIMIT 1;
+            IF exact_id IS NOT NULL THEN
+                INSERT INTO vandelay.bib_match (field_type, matched_attr, queued_record, eg_record) VALUES ('id', attr.id, NEW.id, exact_id);
+            END IF;
+        END IF;
+    END IF;
+
+    IF exact_id IS NULL THEN
+        FOR attr IN SELECT a.* FROM vandelay.queued_bib_record_attr a JOIN vandelay.bib_attr_definition d ON (d.id = a.field) WHERE record = NEW.id AND d.ident IS TRUE LOOP
+    
+               -- All numbers? check for an id match
+               IF (attr.attr_value ~ $r$^\d+$$r$) THEN
+               FOR eg_rec IN SELECT * FROM biblio.record_entry WHERE id = attr.attr_value::BIGINT AND deleted IS FALSE LOOP
+                       INSERT INTO vandelay.bib_match (field_type, matched_attr, queued_record, eg_record) VALUES ('id', attr.id, NEW.id, eg_rec.id);
+                       END LOOP;
+               END IF;
+    
+               -- Looks like an ISBN? check for an isbn match
+               IF (attr.attr_value ~* $r$^[0-9x]+$$r$ AND character_length(attr.attr_value) IN (10,13)) THEN
+               FOR eg_rec IN EXECUTE $$SELECT * FROM metabib.full_rec fr WHERE fr.value LIKE evergreen.lowercase('$$ || attr.attr_value || $$%') AND fr.tag = '020' AND fr.subfield = 'a'$$ LOOP
+                               PERFORM id FROM biblio.record_entry WHERE id = eg_rec.record AND deleted IS FALSE;
+                               IF FOUND THEN
+                               INSERT INTO vandelay.bib_match (field_type, matched_attr, queued_record, eg_record) VALUES ('isbn', attr.id, NEW.id, eg_rec.record);
+                               END IF;
+                       END LOOP;
+    
+                       -- subcheck for isbn-as-tcn
+                   FOR eg_rec IN SELECT * FROM biblio.record_entry WHERE tcn_value = 'i' || attr.attr_value AND deleted IS FALSE LOOP
+                           INSERT INTO vandelay.bib_match (field_type, matched_attr, queued_record, eg_record) VALUES ('tcn_value', attr.id, NEW.id, eg_rec.id);
+               END LOOP;
+               END IF;
+    
+               -- check for an OCLC tcn_value match
+               IF (attr.attr_value ~ $r$^o\d+$$r$) THEN
+                   FOR eg_rec IN SELECT * FROM biblio.record_entry WHERE tcn_value = regexp_replace(attr.attr_value,'^o','ocm') AND deleted IS FALSE LOOP
+                           INSERT INTO vandelay.bib_match (field_type, matched_attr, queued_record, eg_record) VALUES ('tcn_value', attr.id, NEW.id, eg_rec.id);
+               END LOOP;
+               END IF;
+    
+               -- check for a direct tcn_value match
+            FOR eg_rec IN SELECT * FROM biblio.record_entry WHERE tcn_value = attr.attr_value AND deleted IS FALSE LOOP
+                INSERT INTO vandelay.bib_match (field_type, matched_attr, queued_record, eg_record) VALUES ('tcn_value', attr.id, NEW.id, eg_rec.id);
+            END LOOP;
+    
+               -- check for a direct item barcode match
+            FOR eg_rec IN
+                    SELECT  DISTINCT b.*
+                      FROM  biblio.record_entry b
+                            JOIN asset.call_number cn ON (cn.record = b.id)
+                            JOIN asset.copy cp ON (cp.call_number = cn.id)
+                      WHERE cp.barcode = attr.attr_value AND cp.deleted IS FALSE
+            LOOP
+                INSERT INTO vandelay.bib_match (field_type, matched_attr, queued_record, eg_record) VALUES ('id', attr.id, NEW.id, eg_rec.id);
+            END LOOP;
+    
+        END LOOP;
+    END IF;
+
+    RETURN NULL;
+END;
+$func$ LANGUAGE PLPGSQL;
+
+
+COMMIT;
index c537b42..bb369c6 100644 (file)
 */
 
 if(!dojo._hasResource["fieldmapper.Fieldmapper"]){
-       dojo._hasResource["fieldmapper.Fieldmapper"] = true;
+    dojo._hasResource["fieldmapper.Fieldmapper"] = true;
 
-       dojo.provide("fieldmapper.Fieldmapper");
-       dojo.require("DojoSRF");
+    dojo.provide("fieldmapper.Fieldmapper");
+    dojo.require("DojoSRF");
 
 
 /* generate fieldmapper javascript classes.  This expects a global variable
-       called 'fmclasses' to be fleshed with the classes we need to build */
-
-       function FMEX(message) { this.message = message; }
-       FMEX.toString = function() { return "FieldmapperException: " + this.message + "\n"; }
-
-       dojo.declare( "fieldmapper.Fieldmapper", null, {
-
-               constructor : function (initArray) {
-                       if (initArray) {
-                               if (dojo.isArray(initArray)) {
-                                       this.a = initArray;
-                               } else {
-                                       this.a = [];
-                               }
-                       }
-               },
-
-               _isfieldmapper : true,
-
-               clone : function() {
-                       var obj = new this.constructor();
-
-                       for( var i in this.a ) {
-                               var thing = this.a[i];
-                               if(thing == null) continue;
-
-                               if( thing._isfieldmapper ) {
-                                       obj.a[i] = thing.clone();
-                               } else {
-
-                                       if(dojo.isArray(thing)) {
-                                               obj.a[i] = new Array();
-
-                                               for( var j in thing ) {
-
-                                                       if( thing[j]._isfieldmapper )
-                                                               obj.a[i][j] = thing[j].clone();
-                                                       else
-                                                               obj.a[i][j] = thing[j];
-                                               }
-                                       } else {
-                                               obj.a[i] = thing;
-                                       }
-                               }
-                       }
-                       return obj;
-               },
+    called 'fmclasses' to be fleshed with the classes we need to build */
+
+    function FMEX(message) { this.message = message; }
+    FMEX.toString = function() { return "FieldmapperException: " + this.message + "\n"; };
+
+    dojo.declare( "fieldmapper.Fieldmapper", null, {
+
+        constructor : function (initArray) {
+            if (initArray) {
+                if (dojo.isArray(initArray)) {
+                    this.a = initArray;
+                } else {
+                    this.a = [];
+                }
+            }
+        },
+
+        _isfieldmapper : true,
+
+        clone : function() {
+            var obj = new this.constructor();
+
+            for( var i in this.a ) {
+                var thing = this.a[i];
+                if(thing === null) continue;
+
+                if( thing._isfieldmapper ) {
+                    obj.a[i] = thing.clone();
+                } else {
+
+                    if(dojo.isArray(thing)) {
+                        obj.a[i] = [];
+
+                        for( var j in thing ) {
+
+                            if( thing[j]._isfieldmapper )
+                                obj.a[i][j] = thing[j].clone();
+                            else
+                                obj.a[i][j] = thing[j];
+                        }
+                    } else {
+                        obj.a[i] = thing;
+                    }
+                }
+            }
+            return obj;
+        },
 
         RequiredField : function (f) {
             if (!f) return;
@@ -89,40 +89,41 @@ if(!dojo._hasResource["fieldmapper.Fieldmapper"]){
             return;
         }
 
-       });
+    });
 
 
     fieldmapper.vivicateClass = function (cl) {
-               dojo.provide( cl );
-               dojo.declare( cl , fieldmapper.Fieldmapper, {
-                       constructor : function () {
-                               if (!this.a) this.a = [];
-                               this.classname = this.declaredClass;
+        dojo.provide( cl );
+        dojo.declare( cl , fieldmapper.Fieldmapper, {
+            constructor : function () {
+                if (!this.a) this.a = [];
+                this.classname = this.declaredClass;
                 this._fields = [];
 
+                var p, f;
                 if (fieldmapper.IDL && fieldmapper.IDL.loaded) {
-                    this.Structure = fieldmapper.IDL.fmclasses[this.classname]
+                    this.Structure = fieldmapper.IDL.fmclasses[this.classname];
 
-                    for (var f in fieldmapper.IDL.fmclasses[this.classname].fields) {
+                    for (f in fieldmapper.IDL.fmclasses[this.classname].fields) {
                         var field = fieldmapper.IDL.fmclasses[this.classname].fields[f];
-                        var p = field.array_position;
-                               this._fields.push( field.name );
-                                       this[field.name]=new Function('n', 'if(arguments.length==1)this.a['+p+']=n;return this.a['+p+'];');
+                        p = field.array_position;
+                        this._fields.push( field.name );
+                        this[field.name]=new Function('n', 'if(arguments.length==1)this.a['+p+']=n;return this.a['+p+'];');
                     }
                 } else {
-                                   this._fields = fmclasses[this.classname];
+                    this._fields = fmclasses[this.classname];
 
-                               for( var pos = 0; pos <  this._fields.length; pos++ ) {
-                                       var p = parseInt(pos);
-                                       var f = this._fields[pos];
-                                       this[f]=new Function('n', 'if(arguments.length==1)this.a['+p+']=n;return this.a['+p+'];');
-                               }
+                    for( var pos = 0; pos <  this._fields.length; pos++ ) {
+                        p = parseInt(pos, 10);
+                        f = this._fields[pos];
+                        this[f]=new Function('n', 'if(arguments.length==1)this.a['+p+']=n;return this.a['+p+'];');
+                    }
                 }
 
-                       }
-               });
+            }
+        });
 
-               fieldmapper[cl] = window[cl]; // alias into place
+        fieldmapper[cl] = window[cl]; // alias into place
 
         if (fieldmapper.IDL && fieldmapper.IDL.loaded) 
             fieldmapper[cl].Identifier = fieldmapper.IDL.fmclasses[cl].pkey;
@@ -130,7 +131,7 @@ if(!dojo._hasResource["fieldmapper.Fieldmapper"]){
         fieldmapper[cl].prototype.fromStoreItem = _fromStoreItem;
         fieldmapper[cl].toStoreData = _toStoreData;
         fieldmapper[cl].toStoreItem = _toStoreItem;
-        fieldmapper[cl].prototype.toStoreItem = function ( args ) { return _toStoreItem(this, args) };
+        fieldmapper[cl].prototype.toStoreItem = function ( args ) { return _toStoreItem(this, args); };
         fieldmapper[cl].initStoreData = _initStoreData;
         fieldmapper[cl].prototype.toHash = _toHash;
         fieldmapper[cl].toHash = _toHash;
@@ -138,180 +139,183 @@ if(!dojo._hasResource["fieldmapper.Fieldmapper"]){
         fieldmapper[cl].fromHash = _fromHash;
     };
 
-       fieldmapper._request = function ( meth, staff, params ) {
-               var ses = OpenSRF.CachedClientSession( meth[0] );
-               if (!ses) return null;
+    fieldmapper._request = function ( meth, staff, params ) {
+        var ses = OpenSRF.CachedClientSession( meth[0] );
+        if (!ses) return null;
 
-               var result = null;
-               var args = {};
+        var result = null;
+        var args = {};
 
-               if (dojo.isArray(params)) {
-                       args.params = params;
-               } else {
+        if (dojo.isArray(params)) {
+            args.params = params;
+        } else {
 
-                       if (dojo.isObject(params)) {
-                               args = params;
-                       } else {
+            if (dojo.isObject(params)) {
+                args = params;
+            } else {
                 args.params = [].splice.call(arguments, 2, arguments.length - 2);
-                       }
+            }
 
-               }
+        }
 
         if (!args.async && !args.timeout) args.timeout = 10;
 
         if(!args.onmethoderror) {
             args.onmethoderror = function(r, stat, stat_text) {
                 throw new Error('Method error: ' + r.stat + ' : ' + stat_text);
+            };
             }
-        }
 
         if(!args.ontransporterror) {
             args.ontransporterror = function(xreq) {
                 throw new Error('Transport error method='+args.method+', status=' + xreq.status);
+            };
             }
-        }
 
-               if (!args.onerror) {
-                       args.onerror = function (r) {
-                               throw new Error('Request error encountered! ' + r);
-                       }
-               }
+        if (!args.onerror) {
+            args.onerror = function (r) {
+                throw new Error('Request error encountered! ' + r);
+            };
+            }
 
-               if (!args.oncomplete) {
-                       args.oncomplete = function (r) {
-                               var x = r.recv();
-                               if (x) result = x.content();
-                       }
-               }
+        if (!args.oncomplete) {
+            args.oncomplete = function (r) {
+                var x = r.recv();
+                if (x) result = x.content();
+            };
+            }
 
-               args.method = meth[1];
-               if (staff && meth[2]) args.method += '.staff';
+        args.method = meth[1];
+        if (staff && meth[2]) args.method += '.staff';
 
-               ses.request(args).send();
+        ses.request(args).send();
 
-               return result;
-       };
+        return result;
+    };
 
-       fieldmapper.standardRequest = function (meth, params) { return fieldmapper._request(meth, false, params) };
-       fieldmapper.Fieldmapper.prototype.standardRequest = fieldmapper.standardRequest;
+    fieldmapper.standardRequest = function (meth, params) { return fieldmapper._request(meth, false, params); };
+    fieldmapper.Fieldmapper.prototype.standardRequest = fieldmapper.standardRequest;
 
-       fieldmapper.staffRequest = function (meth, params) { return fieldmapper._request(meth, true, params) };
-       fieldmapper.Fieldmapper.prototype.staffRequest = fieldmapper.staffRequest;
+    fieldmapper.staffRequest = function (meth, params) { return fieldmapper._request(meth, true, params); };
+    fieldmapper.Fieldmapper.prototype.staffRequest = fieldmapper.staffRequest;
 
-       fieldmapper.OpenSRF = {};
+    fieldmapper.OpenSRF = {};
 
-       /*      Methods are defined as [ service, method, have_staff ]
-               An optional 3rd component is when a method is followed by true, such methods
-               have a staff counterpart and should have ".staff" appended to the method 
-               before the method is called when in XUL mode */
-       fieldmapper.OpenSRF.methods = {
-               FETCH_ORG_BY_SHORTNAME : ['open-ils.actor','open-ils.actor.org_unit.retrieve_by_shortname'],
-               FETCH_ORG_SETTING : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default'],
-               FETCH_ORG_SETTING_BATCH : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default.batch']
-       };
+    /*    Methods are defined as [ service, method, have_staff ]
+        An optional 3rd component is when a method is followed by true, such methods
+        have a staff counterpart and should have ".staff" appended to the method 
+        before the method is called when in XUL mode */
+    fieldmapper.OpenSRF.methods = {
+        FETCH_ORG_BY_SHORTNAME : ['open-ils.actor','open-ils.actor.org_unit.retrieve_by_shortname'],
+        FETCH_ORG_SETTING : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default'],
+        FETCH_ORG_SETTING_BATCH : ['open-ils.actor','open-ils.actor.ou_setting.ancestor_default.batch']
+    };
    
     
     //** FROM HASH **/
-       function _fromHash (_hash) {
-               for ( var i=0; i < this._fields.length; i++) {
-                       if (_hash[this._fields[i]] != null)
-                               this[this._fields[i]]( _hash[this._fields[i]] );
-               }
-               return this;
-       }
-
-       function _toHash (includeNulls, virtFields) {
-               var _hash = {};
-               for ( var i=0; i < this._fields.length; i++) {
-                       if (includeNulls || this[this._fields[i]]() != null) {
-                               if (this[this._fields[i]]() == null)
+    function _fromHash (_hash) {
+        for ( var i=0; i < this._fields.length; i++) {
+            if (_hash[this._fields[i]] !== null)
+                this[this._fields[i]]( _hash[this._fields[i]] );
+        }
+        return this;
+    }
+
+    function _toHash (includeNulls, virtFields) {
+        var _hash = {};
+        var i;
+        for (i=0; i < this._fields.length; i++) {
+            if (includeNulls || this[this._fields[i]]() !== null) {
+                if (this[this._fields[i]]() === null)
                     _hash[this._fields[i]] = null;
                 else
-                                   _hash[this._fields[i]] = '' + this[this._fields[i]]();
+                    _hash[this._fields[i]] = '' + this[this._fields[i]]();
             }
-               }
+        }
 
-               if (virtFields && virtFields.length > 0) {
-                       for (var i = 0; i < virtFields.length; i++) {
-                               if (!_hash[virtFields[i]])
-                                       _hash[virtFields[i]] = null;
-                       }
-               }
+        if (virtFields && virtFields.length > 0) {
+            for (i = 0; i < virtFields.length; i++) {
+                if (!_hash[virtFields[i]])
+                    _hash[virtFields[i]] = null;
+            }
+        }
 
-               return _hash;
-       }
+        return _hash;
+    }
     //** FROM HASH **/
 
 
     /** FROM dojoData **/
-       function _fromStoreItem (data) {
-               this.fromHash(data);
+    function _fromStoreItem (data) {
+        this.fromHash(data);
 
-               for (var i = 0; this._ignore_fields && i < this._ignore_fields.length; i++)
-                       this[this._ignore_fields[i]](null);
+        var i;
+        for (i = 0; this._ignore_fields && i < this._ignore_fields.length; i++)
+            this[this._ignore_fields[i]](null);
 
-               for (var i = 0; this._fields && i < this._fields.length; i++) {
-                       if (dojo.isArray( this[this._fields[i]]() ))
-                               this[this._fields[i]]( this[this._fields[i]]()[0] );
-               }
-               return this;
-       }
+        for (i = 0; this._fields && i < this._fields.length; i++) {
+            if (dojo.isArray( this[this._fields[i]]() ))
+                this[this._fields[i]]( this[this._fields[i]]()[0] );
+        }
+        return this;
+    }
 
     function _initStoreData(label, params) {
-               if (!params) params = {};
-               if (!params.identifier) params.identifier = this.Identifier;
-               if (!label) label = params.label;
-               if (!label) label = params.identifier;
-               return { label : label, identifier : params.identifier, items : [] };
+        if (!params) params = {};
+        if (!params.identifier) params.identifier = this.Identifier;
+        if (!label) label = params.label;
+        if (!label) label = params.identifier;
+        return { label : label, identifier : params.identifier, items : [] };
     }
 
     function _toStoreItem(fmObj, params) {
-               if (!params) params = {};
+        if (!params) params = {};
         return fmObj.toHash(true, params.virtualFields);
     }
 
-       function _toStoreData (list, label, params) {
-               if (!params) params = {};
+    function _toStoreData (list, label, params) {
+        if (!params) params = {};
         var data = this.initStoreData(label, params);
 
-               for (var i = 0; list && i < list.length; i++) data.items.push( list[i].toHash(true, params.virtualFields) );
-
-               if (params.children && params.parent) {
-                       var _hash_list = data.items;
+        var i, j;
+        for (i = 0; list && i < list.length; i++) data.items.push( list[i].toHash(true, params.virtualFields) );
 
-                       var _find_root = {};
-                       for (var i = 0; _hash_list && i < _hash_list.length; i++) {
-                               _find_root[_hash_list[i][params.identifier]] = _hash_list[i]; 
-                       }
+        if (params.children && params.parent) {
+            var _hash_list = data.items;
 
-                       var item_data = [];
-                       for (var i = 0; _hash_list && i < _hash_list.length; i++) {
-                               var obj = _hash_list[i]
-                               obj[params.children] = [];
+            var _find_root = {};
+            for (i = 0; _hash_list && i < _hash_list.length; i++) {
+                _find_root[_hash_list[i][params.identifier]] = _hash_list[i]; 
+            }
 
-                               for (var j = 0; _hash_list && j < _hash_list.length; j++) {
-                                       var kid = _hash_list[j];
-                                       if (kid[params.parent] == obj[params.identifier]) {
-                                               obj[params.children].push( { _reference : kid[params.identifier] } );
-                                               kid._iskid = true;
-                                               if (_find_root[kid[params.identifier]]) delete _find_root[kid[params.identifier]];
-                                       }
-                               }
+            var item_data = [];
+            for (i = 0; _hash_list && i < _hash_list.length; i++) {
+                var obj = _hash_list[i];
+                obj[params.children] = [];
+
+                for (j = 0; _hash_list && j < _hash_list.length; j++) {
+                    var kid = _hash_list[j];
+                    if (kid[params.parent] == obj[params.identifier]) {
+                        obj[params.children].push( { _reference : kid[params.identifier] } );
+                        kid._iskid = true;
+                        if (_find_root[kid[params.identifier]]) delete _find_root[kid[params.identifier]];
+                    }
+                }
 
-                               item_data.push( obj );
-                       }
+                item_data.push( obj );
+            }
 
-                       for (var j in _find_root) {
-                               _find_root[j]['_top'] = 'true';
-                               if (!_find_root[j][params.parent])
-                                       _find_root[j]['_trueRoot'] = 'true';
-                       }
+            for (j in _find_root) {
+                _find_root[j]['_top'] = 'true';
+                if (!_find_root[j][params.parent])
+                    _find_root[j]['_trueRoot'] = 'true';
+            }
 
-                       data.items = item_data;
-               }
+            data.items = item_data;
+        }
 
-               return data;
-       }
+        return data;
+    }
     /** FROM dojoData **/
 
 
@@ -357,24 +361,24 @@ if(!dojo._hasResource["fieldmapper.Fieldmapper"]){
 
     /** FROM dojoData **/
     /* set up some known class attributes */
-       if (fieldmapper.aou) fieldmapper.aou.prototype._ignore_fields = ['children'];
-       if (fieldmapper.aout) fieldmapper.aout.prototype._ignore_fields = ['children'];
-       if (fieldmapper.pgt) fieldmapper.pgt.prototype._ignore_fields = ['children'];
-
-       fieldmapper.aou.toStoreData = function (list, label) {
-               if (!label) label = 'shortname';
-               return _toStoreData.call(this, list, label, { 'parent' : 'parent_ou', 'children' : 'children' });
-       }
-
-       fieldmapper.aout.toStoreData = function (list, label) {
-               if (!label) label = 'name';
-               return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
-       }
-
-       fieldmapper.pgt.toStoreData = function (list, label) {
-               if (!label) label = 'name';
-               return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
-       }
+    if (fieldmapper.aou) fieldmapper.aou.prototype._ignore_fields = ['children'];
+    if (fieldmapper.aout) fieldmapper.aout.prototype._ignore_fields = ['children'];
+    if (fieldmapper.pgt) fieldmapper.pgt.prototype._ignore_fields = ['children'];
+
+    fieldmapper.aou.toStoreData = function (list, label) {
+        if (!label) label = 'shortname';
+        return _toStoreData.call(this, list, label, { 'parent' : 'parent_ou', 'children' : 'children' });
+    };
+
+    fieldmapper.aout.toStoreData = function (list, label) {
+        if (!label) label = 'name';
+        return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
+    };
+
+    fieldmapper.pgt.toStoreData = function (list, label) {
+        if (!label) label = 'name';
+        return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
+    };
     /** FROM dojoData **/
     
 
index 3fa3162..9cc7a3c 100644 (file)
@@ -22,7 +22,7 @@ if(!dojo._hasResource["fieldmapper.IDL"]) {
                     fieldmapper.IDL.fmclasses[c] = window._preload_fieldmapper_IDL[c];
 
                     window.fmclasses[c] = [];
-                    dojo.forEach(fieldmapper.IDL.fmclasses[c].fields, function(obj){ window.fmclasses[c].push(obj.name) });
+                    dojo.forEach(fieldmapper.IDL.fmclasses[c].fields, function(obj){ window.fmclasses[c].push(obj.name); });
 
                     if (classlist && classlist.length)
                         classlist = dojo.filter(classlist, function(x){return x != c;});
@@ -161,13 +161,13 @@ if(!dojo._hasResource["fieldmapper.IDL"]) {
 
                 var obj = {
                     field : field,
-                    name       : name,
+                    name : name,
                     label : fieldmapper._getAttributeNS(field,this.NS_REPORTS,'label'),
                     datatype : fieldmapper._getAttributeNS(field,this.NS_REPORTS,'datatype'),
                     primitive : fieldmapper._getAttributeNS(field,this.NS_PERSIST,'primitive'),
                     selector : fieldmapper._getAttributeNS(field,this.NS_REPORTS,'selector'),
                     array_position : position++,
-                    type       : 'field',
+                    type : 'field',
                     virtual : (fieldmapper._getAttributeNS(fields[i],this.NS_PERSIST, 'virtual') == 'true'),
                     required : (fieldmapper._getAttributeNS(fields[i],this.NS_OBJ, 'required') == 'true'),
                     i18n : (fieldmapper._getAttributeNS(fields[i],this.NS_PERSIST, 'i18n') == 'true')
@@ -221,14 +221,17 @@ if(!dojo._hasResource["fieldmapper.IDL"]) {
     };
 
     window.fmclasses = {};
-    fieldmapper.IDL.load = function (list) { if (!list) list = []; return new fieldmapper.IDL(list); };
+    fieldmapper.IDL.load = function (list) {
+        if (!list) list = [];
+        return new fieldmapper.IDL(list);
+    };
     fieldmapper.IDL.loaded = false;
 
     JSON2js.fallbackObjectifier = function (arg, key_name, val_name) {
         console.log("Firing IDL loader for " + arg[key_name]);
         fieldmapper.IDL.load([arg[key_name]]);
         return decodeJS(arg);
-    }
+    };
  
 }
 
index c548e6a..8a1000c 100644 (file)
 
 if(!dojo._hasResource["fieldmapper.OrgUtils"]){
 
-       dojo._hasResource["fieldmapper.OrgUtils"] = true;
-       dojo.provide("fieldmapper.OrgUtils");
-       dojo.require("fieldmapper.Fieldmapper");
-       dojo.require("fieldmapper.OrgTree", true);
-       dojo.require("fieldmapper.OrgLasso", true);
-
-       fieldmapper.aou.slim_ok = true;
-       fieldmapper.aou.globalOrgTree = {};
-       fieldmapper.aou.OrgCache = {};
-       fieldmapper.aou.OrgCacheSN = {};
-       fieldmapper.aout.OrgTypeCache = {};
-
-       fieldmapper.aout.LoadOrgTypes = function () {
-               for (var i in fieldmapper.aout.OrgTypeCache) {
-                       return;
-               }
-
-               var types = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_types.retrieve']);
-
-               for (var i = 0; i < types.length; i++) {
-                       fieldmapper.aout.OrgTypeCache[types[i].id()] = {
-                               loaded : true,
-                               type : types[i]
-                       };
-               }
-       }
-
-       fieldmapper.aou.LoadOrg = function (id, slim_ok) {
-               if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok;
-               var slim_o = fieldmapper.aou.OrgCache[id];
-
-               if (slim_o && (slim_ok || slim_o.loaded))
-                       return fieldmapper.aou.OrgCache[id].org;
-
-               var o = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_unit.retrieve'],[null,id]);
+    dojo._hasResource["fieldmapper.OrgUtils"] = true;
+    dojo.provide("fieldmapper.OrgUtils");
+    dojo.require("fieldmapper.Fieldmapper");
+    dojo.require("fieldmapper.OrgTree", true);
+    dojo.require("fieldmapper.OrgLasso", true);
+
+    fieldmapper.aou.slim_ok = true;
+    fieldmapper.aou.globalOrgTree = {};
+    fieldmapper.aou.OrgCache = {};
+    fieldmapper.aou.OrgCacheSN = {};
+    fieldmapper.aout.OrgTypeCache = {};
+
+    fieldmapper.aout.LoadOrgTypes = function () {
+        var i;
+        for (i in fieldmapper.aout.OrgTypeCache) {
+            return;
+        }
+
+        var types = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_types.retrieve']);
+
+        for (i = 0; i < types.length; i++) {
+            fieldmapper.aout.OrgTypeCache[types[i].id()] = {
+                loaded : true,
+                type : types[i]
+            };
+        }
+    };
+
+    fieldmapper.aou.LoadOrg = function (id, slim_ok) {
+        if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok;
+        var slim_o = fieldmapper.aou.OrgCache[id];
+
+        if (slim_o && (slim_ok || slim_o.loaded))
+            return fieldmapper.aou.OrgCache[id].org;
+
+        var o = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_unit.retrieve'],[null,id]);
         if(!(o && o.id)) {
             throw new Error("fieldmapper.aou.LoadOrg(): No org unit found with ID " + id);
         }
-               o.children = fieldmapper.aou.OrgCache[o.id()].children;
-               fieldmapper.aou.OrgCache[o.id()] = { loaded : true, org : o };
-               return o;
-       }
-       fieldmapper.aou.findOrgUnit = fieldmapper.aou.LoadOrg;
-
-       if (window._l) {
-               for (var i = 0; i < _l.length; i++) {
-                       fieldmapper.aou.OrgCache[_l[i][0]] = {
-                               loaded: false,
-                               org : new fieldmapper.aou().fromHash({
-                                       id : _l[i][0],
-                                       ou_type : _l[i][1],
-                                       parent_ou : _l[i][2],
-                                       name : _l[i][3],
-                                       opac_visible : _l[i][4],
-                                       shortname : _l[i][5]
-                               })
-                       };
-
-               }
-
-               for (var i in fieldmapper.aou.OrgCache) {
-                       var x = fieldmapper.aou.OrgCache[i].org;
-                       if (x.parent_ou() == null || x.parent_ou() == '') {
-                               fieldmapper.aou.globalOrgTree = x;
-                               continue;
-                       }
-
-                       var par = fieldmapper.aou.findOrgUnit(x.parent_ou(),true);
-                       if (!par.children()) par.children([]);
-                       par.children().push(x);
-                       fieldmapper.aou.OrgCache[x.id()].treePtr = x;
-               }
-
-               for (var i = 0; i < globalOrgTypes.length; i++) {
-                       fieldmapper.aout.OrgTypeCache[globalOrgTypes[i].id()] = {
-                               loaded : true,
-                               type : globalOrgTypes[i]
-                       };
-               }
-       }
+        o.children = fieldmapper.aou.OrgCache[o.id()].children;
+        fieldmapper.aou.OrgCache[o.id()] = { loaded : true, org : o };
+        return o;
+    };
+    fieldmapper.aou.findOrgUnit = fieldmapper.aou.LoadOrg;
+
+    if (window._l) {
+        for (var i = 0; i < _l.length; i++) {
+            fieldmapper.aou.OrgCache[_l[i][0]] = {
+                loaded: false,
+                org : new fieldmapper.aou().fromHash({
+                    id : _l[i][0],
+                    ou_type : _l[i][1],
+                    parent_ou : _l[i][2],
+                    name : _l[i][3],
+                    opac_visible : _l[i][4],
+                    shortname : _l[i][5]
+                })
+            };
+
+        }
+
+        for (var i in fieldmapper.aou.OrgCache) {
+            var x = fieldmapper.aou.OrgCache[i].org;
+            if (x.parent_ou() == null || x.parent_ou() == '') {
+                fieldmapper.aou.globalOrgTree = x;
+                continue;
+            }
+
+            var par = fieldmapper.aou.findOrgUnit(x.parent_ou(),true);
+            if (!par.children()) par.children([]);
+            par.children().push(x);
+            fieldmapper.aou.OrgCache[x.id()].treePtr = x;
+        }
+
+        for (var i = 0; i < globalOrgTypes.length; i++) {
+            fieldmapper.aout.OrgTypeCache[globalOrgTypes[i].id()] = {
+                loaded : true,
+                type : globalOrgTypes[i]
+            };
+        }
+    }
 
 
    /* ---------------------------------------------------------------------- */
 
-       fieldmapper.aou.prototype.fetchOrgSettingDefault = function (name) {
-               return this.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING, [this.id(), name] ); 
-       }
-
-       fieldmapper.aou.prototype.fetchOrgSettingBatch = function (nameList) {
-               return this.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING_BATCH, [this.id(), nameList] ); 
-       }
-
-       fieldmapper.aou.fetchOrgSettingDefault = function (orgId, name) {
-               return fieldmapper.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING, [orgId, name] ); 
-       }
-
-       fieldmapper.aou.fetchOrgSettingBatch = function (orgId, nameList) {
-               return fieldmapper.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING_BATCH, [orgId, nameList] ); 
-       }
-
-       fieldmapper.aout.findOrgType = function (id) {
-               fieldmapper.aout.LoadOrgTypes();
-               return fieldmapper.aout.OrgTypeCache[id].type;
-       }
-
-       fieldmapper.aou.prototype.findOrgDepth = function (id) {
-               if (!id) id = this.id;
-               if (!id) return null;
-
-               var org = fieldmapper.aou.findOrgUnit(id);
-               return fieldmapper.aout.findOrgType(
-                       fieldmapper.aou.findOrgUnit(id).ou_type()
-               ).depth();
-       }
-       fieldmapper.aou.findOrgDepth = fieldmapper.aou.prototype.findOrgDepth;
-
-       fieldmapper.aout.findOrgTypeFromDepth = function (depth) {
-               if( depth == null ) return null;
-               fieldmapper.aout.LoadOrgTypes();
-               for( var i in fieldmapper.aout.OrgTypeCache ) {
-                       var t = fieldmapper.aout.OrgTypeCache[i].type;
-                       if( t.depth() == depth ) return t;
-               }
-               return null;
-       }
-
-       fieldmapper.aou.findOrgUnitSN = function (sn, slim_ok) {
-               if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok;
-               var org = fieldmapper.aou.OrgCacheSN[sn];
-               if (!org) {
-                       for (var i in fieldmapper.aou.OrgCache) {
-                               var o = fieldmapper.aou.OrgCache[i];
-                               if (o.org.shortname() == sn) {
-                                       fieldmapper.aou.OrgCacheSN[o.org.shortname()] = o;
-                                       org = o;
-                               }
-                       }
-
-                       if (!slim_ok && !fieldmapper.aou.OrgCache[org.id()].loaded) {
-                               org = fieldmapper.standardRequest(fieldmapper.OpenSRF.methods.FETCH_ORG_BY_SHORTNAME, sn);
-
-                               org.children = fieldmapper.aou.OrgCache[org.id()].children;
-                               fieldmapper.aou.OrgCache[org.id()] = { loaded : true, org : org };
-                               fieldmapper.aou.OrgCacheSN[org.shortname()] = { loaded : true, org : org };
-                       }
-
-               }
-
-               return org;
-       }
-
-       fieldmapper.aou.prototype.orgNodeTrail = function(node, asId) {
-               if (!node) node = this;
-               if (!node) return [];
-
-               var na = [];
-
-               while( node ) {
-                       na.push(node);
-                       if (node.parent_ou())
-                               node = fieldmapper.aou.findOrgUnit(node.parent_ou());
-                       else
-                               node = null;
-               }
-
-               na.reverse();
-               if (asId) return na.map(function(o) { return o.id(); });
-               else return na;
-       }
-       fieldmapper.aou.orgNodeTrail = fieldmapper.aou.prototype.orgNodeTrail;
-
-       fieldmapper.aou.prototype.orgIsMine = function (me, org) {
-               if (this._isfieldmapper) {
-                       org = me;
-                       me = this;
-               }
-
-               if(!me || !org) return false;
-
-               if(me.id() == org.id()) return true;
-
-               for( var i in me.children() ) {
-                       if(me.children()[i].orgIsMine(org)) return true;
-               }
-               return false;
-       }
+    fieldmapper.aou.prototype.fetchOrgSettingDefault = function (name) {
+        return this.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING, [this.id(), name] ); 
+    };
+
+    fieldmapper.aou.prototype.fetchOrgSettingBatch = function (nameList) {
+        return this.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING_BATCH, [this.id(), nameList] ); 
+    };
+
+    fieldmapper.aou.fetchOrgSettingDefault = function (orgId, name) {
+        return fieldmapper.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING, [orgId, name] ); 
+    };
+
+    fieldmapper.aou.fetchOrgSettingBatch = function (orgId, nameList) {
+        return fieldmapper.standardRequest( fieldmapper.OpenSRF.methods.FETCH_ORG_SETTING_BATCH, [orgId, nameList] ); 
+    };
+
+    fieldmapper.aout.findOrgType = function (id) {
+        fieldmapper.aout.LoadOrgTypes();
+        return fieldmapper.aout.OrgTypeCache[id].type;
+    };
+
+    fieldmapper.aou.prototype.findOrgDepth = function (id) {
+        if (!id) id = this.id;
+        if (!id) return null;
+
+        var org = fieldmapper.aou.findOrgUnit(id);
+        return fieldmapper.aout.findOrgType(
+            fieldmapper.aou.findOrgUnit(id).ou_type()
+        ).depth();
+    };
+    fieldmapper.aou.findOrgDepth = fieldmapper.aou.prototype.findOrgDepth;
+
+    fieldmapper.aout.findOrgTypeFromDepth = function (depth) {
+        if( depth == null ) return null;
+        fieldmapper.aout.LoadOrgTypes();
+        for( var i in fieldmapper.aout.OrgTypeCache ) {
+            var t = fieldmapper.aout.OrgTypeCache[i].type;
+            if( t.depth() == depth ) return t;
+        }
+        return null;
+    };
+
+    fieldmapper.aou.findOrgUnitSN = function (sn, slim_ok) {
+        if (slim_ok == null) slim_ok = fieldmapper.aou.slim_ok;
+        var org = fieldmapper.aou.OrgCacheSN[sn];
+        if (!org) {
+            for (var i in fieldmapper.aou.OrgCache) {
+                var o = fieldmapper.aou.OrgCache[i];
+                if (o.org.shortname() == sn) {
+                    fieldmapper.aou.OrgCacheSN[o.org.shortname()] = o;
+                    org = o;
+                }
+            }
+
+            if (!slim_ok && !fieldmapper.aou.OrgCache[org.id()].loaded) {
+                org = fieldmapper.standardRequest(fieldmapper.OpenSRF.methods.FETCH_ORG_BY_SHORTNAME, sn);
+
+                org.children = fieldmapper.aou.OrgCache[org.id()].children;
+                fieldmapper.aou.OrgCache[org.id()] = { loaded : true, org : org };
+                fieldmapper.aou.OrgCacheSN[org.shortname()] = { loaded : true, org : org };
+            }
+
+        }
+
+        return org;
+    };
+
+    fieldmapper.aou.prototype.orgNodeTrail = function(node, asId) {
+        if (!node) node = this;
+        if (!node) return [];
+
+        var na = [];
+
+        while( node ) {
+            na.push(node);
+            if (node.parent_ou())
+                node = fieldmapper.aou.findOrgUnit(node.parent_ou());
+            else
+                node = null;
+        }
+
+        na.reverse();
+        if (asId) return na.map(function(o) { return o.id(); });
+        else return na;
+    };
+    fieldmapper.aou.orgNodeTrail = fieldmapper.aou.prototype.orgNodeTrail;
+
+    fieldmapper.aou.prototype.orgIsMine = function (me, org) {
+        if (this._isfieldmapper) {
+            org = me;
+            me = this;
+        }
+
+        if(!me || !org) return false;
+
+        if(me.id() == org.id()) return true;
+
+        for( var i in me.children() ) {
+            if(me.children()[i].orgIsMine(org)) return true;
+        }
+        return false;
+    };
 
     /** Given an org id, returns an array of org units including
      * the org for the ID provided and all descendant orgs */
@@ -223,32 +224,32 @@ if(!dojo._hasResource["fieldmapper.OrgUtils"]){
         }
         addNode(fieldmapper.aou.findOrgUnit(orgId));
         return list;
-    }
+    };
 
     fieldmapper.aou.fullPath = function(orgId, asId) {
 
         var orgList = fieldmapper.aou.orgNodeTrail(fieldmapper.aou.findOrgUnit(orgId));
         orgList.pop(); // prevent dupes
-        orgList = orgList.concat(fieldmapper.aou.descendantNodeList(orgId))
+        orgList = orgList.concat(fieldmapper.aou.descendantNodeList(orgId));
 
         if(!asId) return orgList;
         return orgList.map( function(node) { return node.id(); } );
-    }
+    };
 
-       dojo.addOnUnload( function () {
-               for (var i in fieldmapper.aou.OrgCache) {
-                       x=fieldmapper.aou.OrgCache[i].treePtr;
-                       if (!x) continue;
-
-                       x.children(null);
-                       x.parent_ou(null);
-                       fieldmapper.aou.OrgCache[i]=null;
-               }
-               fieldmapper.aou.globalOrgTree = null;
-               fieldmapper.aou.OrgCache = null;
-               fieldmapper.aou.OrgCacheSN = null;
-               fieldmapper.aout.OrgTypeCache = null;
-       });
+    dojo.addOnUnload( function () {
+        for (var i in fieldmapper.aou.OrgCache) {
+            x=fieldmapper.aou.OrgCache[i].treePtr;
+            if (!x) continue;
+
+            x.children(null);
+            x.parent_ou(null);
+            fieldmapper.aou.OrgCache[i]=null;
+        }
+        fieldmapper.aou.globalOrgTree = null;
+        fieldmapper.aou.OrgCache = null;
+        fieldmapper.aou.OrgCacheSN = null;
+        fieldmapper.aout.OrgTypeCache = null;
+    });
 }
 
 
index 428359a..3ebcafc 100644 (file)
@@ -31,10 +31,11 @@ if(!dojo._hasResource['fieldmapper.dojoData']){
         function _fromStoreItem (data) {
             this.fromHash(data);
 
-            for (var i = 0; this._ignore_fields && i < this._ignore_fields.length; i++)
+            var i;
+            for (i = 0; this._ignore_fields && i < this._ignore_fields.length; i++)
                 this[this._ignore_fields[i]](null);
 
-            for (var i = 0; this._fields && i < this._fields.length; i++) {
+            for (i = 0; this._fields && i < this._fields.length; i++) {
                 if (dojo.isArray( this[this._fields[i]]() ))
                     this[this._fields[i]]( this[this._fields[i]]()[0] );
             }
@@ -58,22 +59,23 @@ if(!dojo._hasResource['fieldmapper.dojoData']){
             if (!params) params = {};
             var data = this.initStoreData(label, params);
 
-            for (var i = 0; list && i < list.length; i++) data.items.push( list[i].toHash(true, params.virtualFields) );
+            var i, j;
+            for (i = 0; list && i < list.length; i++) data.items.push( list[i].toHash(true, params.virtualFields) );
 
             if (params.children && params.parent) {
                 var _hash_list = data.items;
 
                 var _find_root = {};
-                for (var i = 0; _hash_list && i < _hash_list.length; i++) {
+                for (i = 0; _hash_list && i < _hash_list.length; i++) {
                     _find_root[_hash_list[i][params.identifier]] = _hash_list[i]; 
                 }
 
                 var item_data = [];
-                for (var i = 0; _hash_list && i < _hash_list.length; i++) {
-                    var obj = _hash_list[i]
+                for (i = 0; _hash_list && i < _hash_list.length; i++) {
+                    var obj = _hash_list[i];
                     obj[params.children] = [];
 
-                    for (var j = 0; _hash_list && j < _hash_list.length; j++) {
+                    for (j = 0; _hash_list && j < _hash_list.length; j++) {
                         var kid = _hash_list[j];
                         if (kid[params.parent] == obj[params.identifier]) {
                             obj[params.children].push( { _reference : kid[params.identifier] } );
@@ -85,7 +87,7 @@ if(!dojo._hasResource['fieldmapper.dojoData']){
                     item_data.push( obj );
                 }
 
-                for (var j in _find_root) {
+                for (j in _find_root) {
                     _find_root[j]['_top'] = 'true';
                     if (!_find_root[j][params.parent])
                         _find_root[j]['_trueRoot'] = 'true';
@@ -101,7 +103,7 @@ if(!dojo._hasResource['fieldmapper.dojoData']){
             fieldmapper[i].prototype.fromStoreItem = _fromStoreItem;
             fieldmapper[i].toStoreData = _toStoreData;
             fieldmapper[i].toStoreItem = _toStoreItem;
-            fieldmapper[i].prototype.toStoreItem = function ( args ) { return _toStoreItem(this, args) };
+            fieldmapper[i].prototype.toStoreItem = function ( args ) { return _toStoreItem(this, args); };
             fieldmapper[i].initStoreData = _initStoreData;
         }
 
@@ -112,17 +114,17 @@ if(!dojo._hasResource['fieldmapper.dojoData']){
         fieldmapper.aou.toStoreData = function (list, label) {
             if (!label) label = 'shortname';
             return _toStoreData.call(this, list, label, { 'parent' : 'parent_ou', 'children' : 'children' });
-        }
+        };
 
         fieldmapper.aout.toStoreData = function (list, label) {
             if (!label) label = 'name';
             return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
-        }
+        };
 
         fieldmapper.pgt.toStoreData = function (list, label) {
             if (!label) label = 'name';
             return _toStoreData.call(this, list, label, { 'parent' : 'parent', 'children' : 'children' });
-        }
+        };
 
         /*
         ppl.toStoreData = function (list, label) {
index 0cfea4b..21bb370 100644 (file)
@@ -25,9 +25,10 @@ if(!dojo._hasResource['fieldmapper.hash']){
         /* XXX Content loaded in Fieldmapper */
         /* XXX deprecate this file **/
 
+        var i;
         function _fromHash (_hash) {
-            for ( var i=0; i < this._fields.length; i++) {
-                if (_hash[this._fields[i]] != null)
+            for (i = 0; i < this._fields.length; i++) {
+                if (_hash[this._fields[i]] !== null)
                     this[this._fields[i]]( _hash[this._fields[i]] );
             }
             return this;
@@ -35,9 +36,9 @@ if(!dojo._hasResource['fieldmapper.hash']){
 
         function _toHash (includeNulls, virtFields) {
             var _hash = {};
-            for ( var i=0; i < this._fields.length; i++) {
-                if (includeNulls || this[this._fields[i]]() != null) {
-                    if (this[this._fields[i]]() == null)
+            for (i = 0; i < this._fields.length; i++) {
+                if (includeNulls || this[this._fields[i]]() !== null) {
+                    if (this[this._fields[i]]() === null)
                         _hash[this._fields[i]] = null;
                     else
                         _hash[this._fields[i]] = '' + this[this._fields[i]]();
@@ -45,7 +46,7 @@ if(!dojo._hasResource['fieldmapper.hash']){
             }
 
             if (virtFields && virtFields.length > 0) {
-                for (var i = 0; i < virtFields.length; i++) {
+                for (i = 0; i < virtFields.length; i++) {
                     if (!_hash[virtFields[i]])
                         _hash[virtFields[i]] = null;
                 }
index 3fa7735..e171f30 100644 (file)
@@ -583,7 +583,8 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
                 // invalid data.  This change tells dojo to pretend this focusing has 
                 // already happened so we can style required widgets during page render.
                 this.widget._hasBeenBlurred = true;
-                this.widget.validate();
+                if(this.widget.validate)
+                    this.widget.validate();
             }
         },
 
index 07e5404..f9fcd6e 100644 (file)
 <!ENTITY staff.main.menu.admin.server_admin.conify.grp_tree.label "Permission Groups">
 <!ENTITY staff.main.menu.admin.server_admin.conify.perm_list.label "Permissions">
 <!ENTITY staff.main.menu.admin.server_admin.conify.copy_status.label "Copy Statuses">
-<!ENTITY staff.main.menu.admin.server_admin.conify.marc_code_maps.label "Coded Value Maps">
+<!ENTITY staff.main.menu.admin.server_admin.conify.marc_record_attrs.label "MARC Record Attributes">
+<!ENTITY staff.main.menu.admin.server_admin.conify.coded_value_maps.label "MARC Coded Value Maps">
 <!ENTITY staff.main.menu.admin.server_admin.conify.billing_type.label "Billing Types">
 <!ENTITY staff.main.menu.admin.server_admin.conify.z3950_source.label "Z39.50 Servers">
 <!ENTITY staff.main.menu.admin.server_admin.conify.circulation_modifier.label "Circulation Modifiers">
 <!ENTITY staff.patron_search_form.phone.label 'Phone:'>
 <!ENTITY staff.patron_search_form.post_code.accesskey ''>
 <!ENTITY staff.patron_search_form.post_code.label 'ZIP:'>
+<!ENTITY staff.patron_search_form.profile.accesskey ''>
+<!ENTITY staff.patron_search_form.profile.label 'Filter by Permission Profile:'>
 <!ENTITY staff.patron_search_form.search.accesskey 'S'>
 <!ENTITY staff.patron_search_form.search.label 'Search'>
 <!ENTITY staff.patron_search_form.second_given_name.accesskey ''>
index 3b20241..627b713 100644 (file)
@@ -1,4 +1,5 @@
 [% WRAPPER default/base.tt2 %]
+[% ctx.page_title = 'MARC Record Attribute Definitions' %]
 <h1>Record Attribute Definitions</h1> <br/>
 
 <div dojoType="dijit.layout.ContentPane" layoutAlign="client" class='oils-header-panel'>
index f63ad8e..28c83af 100644 (file)
@@ -732,6 +732,10 @@ main.menu.prototype = {
                 ['oncommand'],
                 function() { open_eg_web_page('conify/global/config/record_attr_definition'); }
             ],
+            'cmd_server_admin_coded_value_map' : [
+                ['oncommand'],
+                function() { open_eg_web_page('conify/global/config/coded_value_map'); }
+            ],
             'cmd_server_admin_billing_type' : [
                 ['oncommand'],
                 function() { open_eg_web_page('conify/global/config/billing_type'); }
index a017100..0e71b6e 100644 (file)
     <command id="cmd_server_admin_perm_list"/>
     <command id="cmd_server_admin_copy_status"/>
     <command id="cmd_server_admin_marc_code"/>
+    <command id="cmd_server_admin_coded_value_map"/>
     <command id="cmd_server_admin_billing_type"/>
     <command id="cmd_server_admin_acq_invoice_item_type"/>
     <command id="cmd_server_admin_acq_invoice_payment_method"/>
                 <menuitem label="&staff.main.menu.admin.server_admin.conify.grp_tree.label;" command="cmd_server_admin_grp_tree"/>
                 <menuitem label="&staff.main.menu.admin.server_admin.conify.perm_list.label;" command="cmd_server_admin_perm_list"/>
                 <menuitem label="&staff.main.menu.admin.server_admin.conify.copy_status.label;" command="cmd_server_admin_copy_status"/>
-                <menuitem label="&staff.main.menu.admin.server_admin.conify.marc_code_maps.label;" command="cmd_server_admin_marc_code"/>
+                <menuitem label="&staff.main.menu.admin.server_admin.conify.marc_record_attrs.label;" command="cmd_server_admin_marc_code"/>
+                <menuitem label="&staff.main.menu.admin.server_admin.conify.coded_value_maps.label;" command="cmd_server_admin_coded_value_map"/>
                 <menuitem label="&staff.main.menu.admin.server_admin.conify.billing_type.label;" command="cmd_server_admin_billing_type"/>
                 <menuitem label="&staff.main.menu.admin.server_admin.conify.z3950_source.label;" command="cmd_server_admin_z39_source"/>
                 <menuitem label="&staff.main.menu.admin.server_admin.conify.circulation_modifier.label;" command="cmd_server_admin_circ_mod"/>
index 2426200..9c3acec 100644 (file)
@@ -232,6 +232,10 @@ patron.search_form.prototype = {
                             };
                         }
                     ],
+                    'profile' : [ ['render'], function(e) {
+                            return function() {};
+                        } 
+                    ],
                     'inactive' : [ ['render'], function(e) { 
                             return function() {}; 
                         } 
@@ -239,7 +243,7 @@ patron.search_form.prototype = {
                     'search_depth' : [ ['render'],function(e) {
                             return function() {};
                         }
-                    ],
+                    ]
                 }
             }
         );
@@ -282,7 +286,7 @@ patron.search_form.prototype = {
         util.widgets.load_attributes(file);
         ml.value = ml.getAttribute('value');
         if (! ml.value) {
-            ml.value = 0
+            ml.value = 0;
             ml.setAttribute('value',ml.value);
         }
 
@@ -295,6 +299,34 @@ patron.search_form.prototype = {
         );
         cb.checked = cb.getAttribute('value') == "true" ? true : false;
 
+        /* Populate the Patron Profile filter */
+        util.widgets.remove_children(obj.controller.view.profile);
+        var profile_ml = util.widgets.make_menulist(
+            util.functional.map_list( obj.OpenILS.data.list.pgt,
+                function(el,idx) {
+                    return [ el.name(), el.id() ]
+                }
+            ).sort(
+                function(a,b) {
+                    if (a[0] < b[0]) return -1;
+                    if (a[0] > b[0]) return 1;
+                    return 0;
+                }
+            )
+        );
+        profile_ml.addEventListener('command', function() {
+                profile_ml.parentNode.setAttribute('value', profile_ml.value);
+            }, false
+        );
+        profile_ml.setAttribute('id','profile_ml');
+
+        /* Add an empty menu item as the default profile */
+        var empty = document.createElement('menuitem'); 
+        profile_ml.firstChild.insertBefore(empty, profile_ml.firstChild.firstChild);
+        empty.setAttribute('label', '');
+        empty.setAttribute('value', ''); 
+        obj.controller.view.profile.appendChild(profile_ml);
+        profile_ml.value = profile_ml.getAttribute('value');
     },
 
     'on_submit' : function(q) {
@@ -313,6 +345,9 @@ patron.search_form.prototype = {
                 if (id == 'inactive') {
                     query[id] = node.getAttribute('value');
                     obj.error.sdump('D_DEBUG','id = ' + id + '  value = ' + node.getAttribute('value') + '\n');
+                } else if (id == 'profile') {
+                    query[id] = node.firstChild.getAttribute('value');
+                    obj.error.sdump('D_DEBUG','id = ' + id + '  value = ' + node.getAttribute('value') + '\n');
                 } else {
                     if (id == 'search_depth') {
                         query[id] = node.firstChild.getAttribute('value'); 
@@ -331,7 +366,7 @@ patron.search_form.prototype = {
                             obj.error.sdump('D_DEBUG','id = ' + id + '  value = ' + value + '\n');
                         }
                     }
-                }
+                } 
             }
         }
         if (typeof obj.on_submit == 'function') {
index 58f54d0..660b75a 100644 (file)
                 accesskey="&staff.patron_search_form.post_code.accesskey;"/>
             <textbox id="post_code" group="1" context="clipboard"/>
         </row>
+        <row>
+            <label value="&staff.patron_search_form.profile.label;"/>
+            <hbox id="profile" />
+        </row>
         <row id="psr12">
             <spacer id="pss12"/>
             <button id="search" label="&staff.patron_search_form.search.label;" 
index d313cbb..fadbb68 100644 (file)
@@ -187,7 +187,7 @@ patron.search_result.prototype = {
                     obj.search_term_count++;
                 break;
 
-                case 'family_name': case 'first_given_name': case 'second_given_name': case 'email': case 'alias': case 'usrname':
+                case 'family_name': case 'first_given_name': case 'second_given_name': case 'email': case 'alias': case 'usrname': case 'profile':
 
                     search_hash[ i ] = {};
                     search_hash[ i ].value = query[i];