schema: adjust fund transfer notes
authorGalen Charlton <gmc@equinoxOLI.org>
Wed, 2 Jun 2021 20:21:24 +0000 (16:21 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Wed, 2 Jun 2021 20:21:24 +0000 (16:21 -0400)
- Change allocation notes to

Now Transfer {to,from} FUND_CODE (YEAR) (FUND_ORG_UNIT_SHORTNAME)

- Fix issue where the fund org units were not being retrieved
  correctly, leading to incorrect or missing fund allocation notes

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.update_fund_xfr_notes.sql

index 040f20f..0cfb608 100644 (file)
@@ -1446,9 +1446,9 @@ BEGIN
     -- Fetch old and new fund's information
     -- in order to construct the allocation notes
     SELECT INTO old_fund_row * FROM acq.fund WHERE id = old_fund;
-    SELECT INTO old_org_row * FROM actor.org_unit WHERE id = old_fund_row.id;
+    SELECT INTO old_org_row * FROM actor.org_unit WHERE id = old_fund_row.org;
     SELECT INTO new_fund_row * FROM acq.fund WHERE id = new_fund;
-    SELECT INTO new_org_row * FROM actor.org_unit WHERE id = new_fund_row.id;
+    SELECT INTO new_org_row * FROM actor.org_unit WHERE id = new_fund_row.org;
 
        --
        -- Identify the funding source(s) from which we want to transfer the money.
@@ -1557,9 +1557,9 @@ BEGIN
                                old_fund,
                                source_deduction,
                                user_id,
-                               'Transfer to fund ' || new_org_row.shortname || ' '
-                                    || new_fund_row.code || ' ('
-                                    || new_fund_row.year || ')'
+                               'Transfer to fund ' || new_fund_row.code || ' ('
+                                    || new_fund_row.year || ') ('
+                                    || new_org_row.shortname || ')'
                        );
                END IF;
                --
@@ -1622,9 +1622,9 @@ BEGIN
                                        new_fund,
                                        source_addition,
                                        user_id,
-                                   'Transfer from fund ' || old_org_row.shortname || ' '
-                                          || old_fund_row.code || ' ('
-                                          || old_fund_row.year || ')'
+                                   'Transfer from fund ' || old_fund_row.code || ' ('
+                                          || old_fund_row.year || ') ('
+                                          || old_org_row.shortname || ')'
                                );
                        END IF;
                END IF;
index a222780..2f80e0d 100644 (file)
@@ -160,9 +160,9 @@ BEGIN
     -- Fetch old and new fund's information
     -- in order to construct the allocation notes
     SELECT INTO old_fund_row * FROM acq.fund WHERE id = old_fund;
-    SELECT INTO old_org_row * FROM actor.org_unit WHERE id = old_fund_row.id;
+    SELECT INTO old_org_row * FROM actor.org_unit WHERE id = old_fund_row.org;
     SELECT INTO new_fund_row * FROM acq.fund WHERE id = new_fund;
-    SELECT INTO new_org_row * FROM actor.org_unit WHERE id = new_fund_row.id;
+    SELECT INTO new_org_row * FROM actor.org_unit WHERE id = new_fund_row.org;
 
        --
        -- Identify the funding source(s) from which we want to transfer the money.
@@ -271,9 +271,9 @@ BEGIN
                                old_fund,
                                source_deduction,
                                user_id,
-                               'Transfer to fund ' || new_org_row.shortname || ' '
-                                    || new_fund_row.code || ' ('
-                                    || new_fund_row.year || ')'
+                               'Transfer to fund ' || new_fund_row.code || ' ('
+                                    || new_fund_row.year || ') ('
+                                    || new_org_row.shortname || ')'
                        );
                END IF;
                --
@@ -336,9 +336,9 @@ BEGIN
                                        new_fund,
                                        source_addition,
                                        user_id,
-                                   'Transfer from fund ' || old_org_row.shortname || ' '
-                                          || old_fund_row.code || ' ('
-                                          || old_fund_row.year || ')'
+                                   'Transfer from fund ' || old_fund_row.code || ' ('
+                                          || old_fund_row.year || ') ('
+                                          || old_org_row.shortname || ')'
                                );
                        END IF;
                END IF;