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)
<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"/>
# 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' ) {
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>';
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]";
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;
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;
__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;
"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;
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);
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 = '';
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';
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);
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
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
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
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
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,
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);