LP#1277194: Optionally hide organizational units from staff client user/csharp/lp1277194_staff_visible_org_unit_flag
authorChris Sharp <csharp@georgialibraries.org>
Mon, 2 Nov 2020 18:04:01 +0000 (13:04 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 2 Nov 2020 18:04:01 +0000 (13:04 -0500)
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/eg2/src/app/core/org.service.ts
Open-ILS/src/eg2/src/app/staff/admin/server/org-unit.component.html
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/actor.pm
Open-ILS/src/sql/Pg/005.schema.actors.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1277194_add_staff_visible_aou_column.sql [new file with mode: 0644]

index a312c10..b7d75d1 100644 (file)
@@ -7018,6 +7018,7 @@ SELECT  usr,
                        <field reporter:label="Email Address" name="email" reporter:datatype="text"/>
                        <field reporter:label="Phone Number" name="phone" reporter:datatype="text"/>
                        <field reporter:label="OPAC Visible" name="opac_visible" reporter:datatype="bool"/>
+                       <field reporter:label="Staff Visible" name="staff_visible" reporter:datatype="bool"/>
                        <field reporter:label="Fiscal Calendar" name="fiscal_calendar" reporter:datatype="link" oils_obj:required="true"/>
                        <field reporter:label="Users" name="users" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Closed Dates" name="closed_dates" oils_persist:virtual="true" reporter:datatype="link"/>
index 456f93f..60bbf39 100644 (file)
@@ -13,6 +13,7 @@ interface OrgFilter {
     canHaveUsers?: boolean;
     canHaveVolumes?: boolean;
     opacVisible?: boolean;
+    staffVisible?: boolean;
     inList?: number[];
     notInList?: number[];
 }
@@ -79,6 +80,10 @@ export class OrgService {
             if (ov && !this.opacVisible(org)) { return; }
             if (ov === false && this.opacVisible(org)) { return; }
 
+            const sv = filter.staffVisible;
+            if (sv && !this.staffVisible(org)) { return; }
+            if (sv === false && this.staffVisible(org)) { return; }
+
             if (filter.inList && !filter.inList.includes(org.id())) {
                 return;
             }
@@ -134,6 +139,10 @@ export class OrgService {
         return this.get(nodeOrId).opac_visible() === 't';
     }
 
+    staffVisible(nodeOrId): boolean {
+        return this.get(nodeOrId).staff_visible() === 't';
+    }
+
     // list of org_unit objects  or IDs for me + descendants
     descendants(nodeOrId: OrgNodeOrId, asId?: boolean): any[] {
         const node = this.get(nodeOrId);
index 294d62c..d0249ee 100644 (file)
@@ -48,7 +48,7 @@
               [record]="currentOrg().isnew() ? currentOrg() : null"
               [recordId]="currentOrg().isnew() ? null : currentOrg().id()"
               [showDelete]="!orgHasChildren()"
-              fieldOrder="parent_ou,ou_type,name,shortname,phone,email,opac_visible,fiscal_calendar"
+              fieldOrder="parent_ou,ou_type,name,shortname,phone,email,opac_visible,staff_visible,fiscal_calendar"
               hiddenFields="id,billing_address,mailing_address,holds_address,ill_address">
               <eg-fm-record-editor-action label="Add Child" i18n-label 
                 [disabled]="orgChildTypes().length === 0 || currentOrg().isnew()"
index a4047f7..9ad17a3 100644 (file)
@@ -82,7 +82,8 @@ 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 opac_visible fiscal_calendar/);
+                ill_address holds_address shortname name email phone opac_visible staff_visible 
+                fiscal_calendar/);
 
 #-------------------------------------------------------------------------------
 package actor::org_unit::hours_of_operation;
index 33ae628..4145bab 100644 (file)
@@ -348,6 +348,7 @@ CREATE TABLE actor.org_unit (
        email           TEXT,
        phone           TEXT,
        opac_visible    BOOL    NOT NULL DEFAULT TRUE,
+       staff_visible   BOOL    NOT NULL DEFAULT TRUE,
        fiscal_calendar INT     NOT NULL DEFAULT 1   -- foreign key constraint to be added later
 );
 CREATE INDEX actor_org_unit_parent_ou_idx ON actor.org_unit (parent_ou);
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1277194_add_staff_visible_aou_column.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.lp1277194_add_staff_visible_aou_column.sql
new file mode 100644 (file)
index 0000000..dacaa1b
--- /dev/null
@@ -0,0 +1,8 @@
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE actor.org_unit ADD COLUMN staff_visible BOOLEAN NOT NULL DEFAULT TRUE;
+
+COMMIT;