Add procedure for updating org unit structure using SQL
[working/Evergreen.git] / 1.6 / admin / serveradministration.xml
index 609d896..e54d738 100644 (file)
@@ -171,6 +171,69 @@ xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:id="serveradministrati
                        </note>\r
                </procedure>\r
                <procedure>\r
+                       <title>Changing the Default Organizational Units and Types Using SQL</title>\r
+                       <para>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 \r
+                       types. The quickest way to do this is with SQL.</para> \r
+                       <note><para>The following procedure should only be done before you have migrated users and items into your system.</para></note>\r
+                       <step>\r
+                               <para>Delete all but the core organizational unit:</para>\r
+<programlisting language="sql">\r
+BEGIN;\r
+DELETE FROM actor.org_unit WHERE id > 1;\r
+DELETE FROM actor.org_address WHERE id > 1;\r
+DELETE FROM actor.workstation WHERE owning_lib > 1;\r
+COMMIT;\r
+</programlisting>\r
+                       </step>\r
+                       <step>\r
+                               <para>Clean up our org unit types, in preparation for creating the organizational units hierarchy:</para>\r
+<programlisting language="sql">\r
+BEGIN;\r
+DELETE FROM actor.org_unit_type WHERE id > 2;\r
+UPDATE actor.org_unit_type SET name = 'System', can_have_users = TRUE\r
+WHERE id = 1;\r
+UPDATE actor.org_unit_type SET name = 'Branch', can_have_users = TRUE,\r
+can_have_vols = TRUE WHERE id = 2;\r
+COMMIT;\r
+</programlisting>\r
+</step>\r
+                       <step>\r
+                               <para>Create a branch that hangs off the only remaining parent branch setting the addresses to the system address temporarily:</para>\r
+<programlisting language="sql">\r
+INSERT INTO actor.org_unit (parent_ou, ou_type, ill_address,\r
+holds_address, mailing_address, billing_address, shortname, name)\r
+  VALUES (1, 2, 1, 1, 1, 1, 'MYBRANCH', 'My Branch');\r
+</programlisting>\r
+                       </step>\r
+                                       <step>\r
+                               <para>Find out what ID was assigned to the new branch:</para>\r
+<programlisting language="sql">\r
+SELECT id FROM actor.org_unit WHERE shortname = 'MYBRANCH';\r
+</programlisting>\r
+                       </step>\r
+                       <step>\r
+                               <para>Create our required org address and update <database class="table">actor.org_unit</database> to point ot correct <database class="table">actor.org_address</database> <database class="field">id</database> (assuming output of last step was <quote>101</quote>, adjust accordingly.):</para>\r
+<programlisting language="sql">\r
+BEGIN;\r
+INSERT INTO actor.org_address (id, org_unit, street1, city, state,\r
+country, post_code)\r
+  VALUES (2, 101, 'Fake Street', 'Fake', 'Fake', 'Fake', 'FOO BAR');\r
+UPDATE actor.org_unit SET ill_address= 2, holds_address = 2, mailing_address = 2, billing_address = 2 WHERE id = 101;\r
+COMMIT; \r
+</programlisting>\r
+                       </step>\r
+<step>\r
+                               <para>Run autogen.sh for your changes to be updated.</para>\r
+<screen>\r
+<userinput>./autogen.sh -c /openils/conf/opensrf_core.xml -u</userinput>\r
+</screen>\r
+\r
+                       </step>\r
+\r
+\r
+\r
+               </procedure>\r
+               <procedure>\r
                        <title>Editing Organizational Units<indexterm><primary>organization units</primary><secondary>editing</secondary></indexterm></title>\r
                        <step><para>Select the organizational unit you wish to edit from the \r
                        organizational unit tree in the left pane.</para></step>\r