From 0e8eab4fd4685c25768ed0769b7ce85a954d5a6b Mon Sep 17 00:00:00 2001 From: Robert Soulliere Date: Fri, 4 Feb 2011 15:43:29 -0500 Subject: [PATCH 1/1] Add procedure for updating org unit structure using SQL -- from list post by Dan Scott. --- 1.6/admin/serveradministration.xml | 63 ++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/1.6/admin/serveradministration.xml b/1.6/admin/serveradministration.xml index 609d896ab4..e54d7381ea 100644 --- a/1.6/admin/serveradministration.xml +++ b/1.6/admin/serveradministration.xml @@ -169,6 +169,69 @@ xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:id="serveradministrati organizational unit, you must move its users, workstations, copies and other associated resources to other organizational units. + + + Changing the Default Organizational Units and Types Using SQL + Evergreen comes with several default organizational units set up out-of-the-box. Most libraries will want to customize the Org units with their own Organizational Units and + types. The quickest way to do this is with SQL. + The following procedure should only be done before you have migrated users and items into your system. + + Delete all but the core organizational unit: + +BEGIN; +DELETE FROM actor.org_unit WHERE id > 1; +DELETE FROM actor.org_address WHERE id > 1; +DELETE FROM actor.workstation WHERE owning_lib > 1; +COMMIT; + + + + Clean up our org unit types, in preparation for creating the organizational units hierarchy: + +BEGIN; +DELETE FROM actor.org_unit_type WHERE id > 2; +UPDATE actor.org_unit_type SET name = 'System', can_have_users = TRUE +WHERE id = 1; +UPDATE actor.org_unit_type SET name = 'Branch', can_have_users = TRUE, +can_have_vols = TRUE WHERE id = 2; +COMMIT; + + + + Create a branch that hangs off the only remaining parent branch setting the addresses to the system address temporarily: + +INSERT INTO actor.org_unit (parent_ou, ou_type, ill_address, +holds_address, mailing_address, billing_address, shortname, name) + VALUES (1, 2, 1, 1, 1, 1, 'MYBRANCH', 'My Branch'); + + + + Find out what ID was assigned to the new branch: + +SELECT id FROM actor.org_unit WHERE shortname = 'MYBRANCH'; + + + + Create our required org address and update actor.org_unit to point ot correct actor.org_address id (assuming output of last step was 101, adjust accordingly.): + +BEGIN; +INSERT INTO actor.org_address (id, org_unit, street1, city, state, +country, post_code) + VALUES (2, 101, 'Fake Street', 'Fake', 'Fake', 'Fake', 'FOO BAR'); +UPDATE actor.org_unit SET ill_address= 2, holds_address = 2, mailing_address = 2, billing_address = 2 WHERE id = 101; +COMMIT; + + + + Run autogen.sh for your changes to be updated. + +./autogen.sh -c /openils/conf/opensrf_core.xml -u + + + + + + Editing Organizational Units<indexterm><primary>organization units</primary><secondary>editing</secondary></indexterm> -- 2.43.2