Adds a new "sibling_order" column to actor.org_unit which specifies the
order in which an org unit should be sorted as compared to its sibling
org units in org unit trees.
This commit adds the IDL/DB components. It also updates the tpac and
the generic get_org_tree API. (Note, a follow-up commit will be pushed
to remove some deprecated / reduntant org tree retrievals).
Note that the sibling_order values do not have to be unique within each
set of siblings. The org unit name is still used as a tie-breaker sort,
so if the sort order is left unset (i.e. all values are 0), org units
will fall back to name-only sorting.
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
<field reporter:label="Resource Attributes" name="rsrc_attrs" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Attribute Values" name="attr_vals" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Hours of Operation" name="hours_of_operation" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Sibling Sort Order" name="sibling_order" reporter:datatype="int"/>
</fields>
<links>
<link field="billing_address" reltype="has_a" key="id" map="" class="aoa"/>
{ parent_ou => undef},
{ flesh => -1,
flesh_fields => {aou => ['children']},
- order_by => {aou => 'name'}
+ order_by => {aou => 'sibling_order, name'}
}
])->[0];
email TEXT,
phone TEXT,
opac_visible BOOL NOT NULL DEFAULT TRUE,
- fiscal_calendar INT NOT NULL DEFAULT 1 -- foreign key constraint to be added later
+ fiscal_calendar INT NOT NULL DEFAULT 1, -- foreign key constraint to be added later
+ sibling_order INT NOT NULL DEFAULT 0
);
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);
)
);
+ALTER TABLE actor.org_unit ADD COLUMN
+ sibling_order INTEGER NOT NULL DEFAULT 0;
+
+ALTER TABLE auditor.actor_org_unit_history ADD COLUMN
+ sibling_order INTEGER NOT NULL DEFAULT 0;
+
COMMIT;
/* UNDO
BEGIN;
DELETE FROM config.global_flag WHERE name = 'opac.org_unit.non_inheritied_visibility';
+ALTER TABLE actor.org_unit DROP COLUMN sibling_order;
+ALTER TABLE auditor.actor_org_unit_history DROP COLUMN sibling_order;
COMMIT;
*/