adding library-hiding support
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Feb 2007 20:19:07 +0000 (20:19 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Feb 2007 20:19:07 +0000 (20:19 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6974 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/admin/ils_admin/setup/models.py
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/cgi-bin/lib-setup.cgi
Open-ILS/src/extras/org_tree_html_options.pl
Open-ILS/src/extras/org_tree_js.pl
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
Open-ILS/src/sql/Pg/005.schema.actors.sql

index e3363c1..01d4928 100644 (file)
@@ -154,6 +154,7 @@ class OrgUnit(models.Model):
    name = models.CharField(maxlength=200)
    email = models.EmailField(null=True, blank=True)
    phone = models.CharField(maxlength=200, null=True, blank=True)
+   opac_visible = models.BooleanField(blank=True)
    ill_address_id = models.ForeignKey(OrgAddress, db_column='ill_address', null=True, blank=True)
    holds_address_id = models.ForeignKey(OrgAddress, db_column='holds_address', null=True, blank=True)
    mailing_address_id = models.ForeignKey(OrgAddress, db_column='mailing_address', null=True, blank=True)
index a85c8cf..a1f76f5 100644 (file)
                        <field reporter:label="Short (Policy) Name" name="shortname" oils_obj:array_position="12" oils_persist:virtual="false" />
                        <field reporter:label="EMail Address" name="email" oils_obj:array_position="13" oils_persist:virtual="false" />
                        <field reporter:label="Phone Number" name="phone" oils_obj:array_position="14" oils_persist:virtual="false" />
+                       <field reporter:label="OPAC Visible" name="opac_visible" oils_obj:array_position="15" oils_persist:virtual="false" reporter:datatype="bool"/>
                </fields>
                <links>
                        <link field="billing_address" reltype="has_a" key="id" map="" class="aoa"/>
index 1c67ba3..a4186e6 100755 (executable)
@@ -23,9 +23,9 @@ my $cgi = new CGI;
 # setup part
 #-------------------------------------------------------------------------------
 
-my %org_cols = ( qw/id SysID name Name parent_ou Parent ou_type OrgUnitType shortname ShortName email Email phone Phone/ );
+my %org_cols = ( qw/id SysID name Name parent_ou Parent ou_type OrgUnitType shortname ShortName email Email phone Phone opac_visible OPACVisible/ );
 
-my @col_display_order = ( qw/id name shortname ou_type email phone parent_ou/ );
+my @col_display_order = ( qw/id name shortname ou_type email phone opac_visible parent_ou/ );
 
 if (my $action = $cgi->param('action')) {
        if ( $action eq 'Update' ) {
@@ -248,12 +248,27 @@ if (my $action = $cgi->param('action')) {
                                th($org_cols{email}),
                                td("<input type='text' name='email_$node' value=\"". $node->email() ."\">"),
                        );
+
                        print Tr(
                                th($org_cols{phone}),
                                td("<input type='text' name='phone_$node' value='". $node->phone() ."'>"),
                        );
 
                        print Tr(
+                               th($org_cols{opac_visible}),
+                               td("<select name='opac_visible_$node'>".
+                                       do {
+                                               my $out = "<option value='t' ";
+                                               $out .= ($node->opac_visible =~ /^[y1t]+/) ?  "selected='yes'" : "";
+                                               $out .= ">True</option><option value='f' ";
+                                               $out .= ($node->opac_visible =~ /^[n0f]+/) ?  "selected='yes'" : "";
+                                               $out .= ">False</option>";
+                                               $out;
+                                       }."</select>"
+                               ),
+                       );
+
+                       print Tr(
                                th($org_cols{parent_ou}),
                                td("<select name='parent_ou_$node'>".do{
                                                my $out = '<option>-- Select One --</option>';
index fce9b14..abde8ba 100644 (file)
@@ -6,7 +6,7 @@ use OpenSRF::System;
 use OpenILS::Utils::Fieldmapper;
 use OpenSRF::Utils::SettingsClient;
 
-die "usage: perl org_tree_js.pl <bootstrap_config> <output_file>" unless $ARGV[1];
+die "usage: perl org_tree_html_options.pl <bootstrap_config> <output_file>" unless $ARGV[1];
 OpenSRF::System->bootstrap_client(config_file => $ARGV[0]);
 
 open FILE, ">$ARGV[1]";
@@ -25,6 +25,7 @@ close FILE;
 
 sub print_option {
        my $node = shift;
+       return unless ($node->opac_visible =~ /^[y1t]+/i);
        my $depth = $node->ou_type - 1;
        my $sname = $node->shortname;
        my $name = $node->name;
index c094809..f7f74aa 100644 (file)
@@ -23,8 +23,8 @@ my $pile = "var _l = [";
 
 my @array;
 for my $o (@$tree) {
-       my ($i,$t,$p,$n) = ($o->id,$o->ou_type,$o->parent_ou,$o->name);
-       push @array, "[$i,$t,$p,\"$n\"]";
+       my ($i,$t,$p,$n,$v) = ($o->id,$o->ou_type,$o->parent_ou,$o->name,$o->opac_visible);
+       push @array, "[$i,$t,$p,\"$n\",\"$v\"]";
 }
 $pile .= join ',', @array;
 $pile .= <<JS;
index ee4fb5a..c2e631b 100644 (file)
@@ -74,7 +74,7 @@ use base qw/actor/;
 __PACKAGE__->table( 'actor_org_unit' );
 __PACKAGE__->columns( Primary => qw/id/);
 __PACKAGE__->columns( Essential => qw/parent_ou ou_type mailing_address billing_address
-                               ill_address holds_address shortname name email phone/);
+                               ill_address holds_address shortname name email phone opac_visible/);
 
 #-------------------------------------------------------------------------------
 package actor::org_unit::hours_of_operation;
index c4c944e..0c675cb 100644 (file)
@@ -36,7 +36,7 @@ sub ordered_records_from_metarecord {
                        "actor.org_unit_descendants($org)" ;
 
 
-       my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
+       my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
        $copies_visible = '' if ($self->api_name =~ /staff/o);
 
        my $sm_table = metabib::metarecord_source_map->table;
@@ -267,7 +267,7 @@ sub metarecord_copy_count {
        my $descendants = "actor.org_unit_descendants(u.id)";
        my $ancestors = "actor.org_unit_ancestors(?)";
 
-       my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
+       my $copies_visible = 'AND a.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
        $copies_visible = '' if ($self->api_name =~ /staff/o);
 
        my (@types,@forms);
@@ -453,7 +453,7 @@ sub biblio_multi_search_full_rec {
 
        my $has_vols = 'AND cn.owning_lib = d.id';
        my $has_copies = 'AND cp.call_number = cn.id';
-       my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
+       my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
 
        if ($self->api_name =~ /staff/o) {
                $copies_visible = '';
@@ -773,7 +773,7 @@ sub search_class_fts {
 
        my $has_vols = 'AND cn.owning_lib = d.id';
        my $has_copies = 'AND cp.call_number = cn.id';
-       my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
+       my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
 
        my $visible_count = ', count(DISTINCT cp.id)';
        my $visible_count_test = 'HAVING count(DISTINCT cp.id) > 0';
@@ -947,7 +947,7 @@ sub search_class_fts_count {
 
        my $has_vols = 'AND cn.owning_lib = d.id';
        my $has_copies = 'AND cp.call_number = cn.id';
-       my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
+       my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.holdable IS TRUE AND cl.opac_visible IS TRUE';
        if ($self->api_name =~ /staff/o) {
                $copies_visible = '';
                $has_vols = '' if ($ou_type == 0);
@@ -1246,6 +1246,7 @@ sub postfilter_search_class_fts {
                                AND cp.opac_visible IS TRUE
                                AND cs.holdable IS TRUE
                                AND cl.opac_visible IS TRUE
+                               AND d.opac_visible IS TRUE
                                AND br.active IS TRUE
                                AND br.deleted IS FALSE
                                AND ord.record = mrs.source
@@ -1282,6 +1283,7 @@ sub postfilter_search_class_fts {
                                        AND cp.opac_visible IS TRUE
                                        AND cs.holdable IS TRUE
                                        AND cl.opac_visible IS TRUE
+                                       AND d.opac_visible IS TRUE
                                        AND br.active IS TRUE
                                        AND br.deleted IS FALSE
                                        AND ord.record = mrs.source
@@ -1726,6 +1728,7 @@ sub postfilter_search_multi_class_fts {
                                        AND cp.opac_visible IS TRUE
                                        AND cs.holdable IS TRUE
                                        AND cl.opac_visible IS TRUE
+                                       AND d.opac_visible IS TRUE
                                        AND br.active IS TRUE
                                        AND br.deleted IS FALSE
                                        AND cp.deleted IS FALSE
@@ -2193,6 +2196,7 @@ sub biblio_search_multi_class_fts {
                                        AND cp.opac_visible IS TRUE
                                        AND cs.holdable IS TRUE
                                        AND cl.opac_visible IS TRUE
+                                       AND d.opac_visible IS TRUE
                                        AND cp.deleted IS FALSE
                                        AND cn.deleted IS FALSE
                                  LIMIT 1
index b180840..294bb04 100644 (file)
@@ -133,8 +133,8 @@ CREATE TRIGGER actor_crypt_pw_insert_trigger
 CREATE RULE protect_user_delete AS ON DELETE TO actor.usr DO INSTEAD UPDATE actor.usr SET deleted = TRUE WHERE OLD.id = actor.usr.id;
 
 -- Just so that there is a user...
-INSERT INTO actor.usr ( profile, card, usrname, passwd, first_given_name, family_name, dob, master_account, super_user, ident_type, ident_value, home_ou )
-       VALUES ( 1, 1,'admin', 'open-ils', 'Administrator', 'System Account', '1979-01-22', TRUE, TRUE, 1, 'identification', 1 );
+INSERT INTO actor.usr ( profile, card, usrname, passwd,     first_given_name, family_name,      dob,          master_account, super_user, ident_type, ident_value,      home_ou )
+               VALUES ( 1,       1,    'admin', 'open-ils', 'Administrator',  'System Account', '1979-01-22', TRUE,           TRUE,       1,          'identification', 1 );
 
 CREATE TABLE actor.usr_note (
        id              BIGSERIAL                       PRIMARY KEY,
@@ -375,7 +375,8 @@ CREATE TABLE actor.org_unit (
        shortname       TEXT    NOT NULL,
        name            TEXT    NOT NULL,
        email           TEXT,
-       phone           TEXT
+       phone           TEXT,
+       opac_visible    BOOL    NOT NULL DEFAULT TRUE
 );
 CREATE INDEX actor_org_unit_parent_ou_idx ON actor.org_unit (parent_ou);
 CREATE INDEX actor_org_unit_ou_type_idx ON actor.org_unit (ou_type);