LP#1737019 Add an active flag to funding sources
authorTiffany Little <tlittle@georgialibraries.org>
Wed, 18 Aug 2021 12:18:31 +0000 (08:18 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Tue, 21 Sep 2021 14:05:08 +0000 (10:05 -0400)
This adds an active flag to funding sources. It also adds limits the
available funding sources in the Create Allocation dropdown to only
active funding sources.

Signed-off-by: Tiffany Little <tlittle@georgialibraries.org>
Signed-off-by: Lindsay Stratton <lstratton@wlsmail.org>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/eg2/src/app/staff/admin/acq/funds/fund-details-dialog.component.html
Open-ILS/src/eg2/src/app/staff/admin/acq/funds/funding-sources.component.html
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-active-flag.sql [new file with mode: 0644]

index 4cfdd3f..c068c2c 100644 (file)
@@ -9541,6 +9541,7 @@ SELECT  usr,
                        <field reporter:label="Owner" name="owner" reporter:datatype="org_unit" oils_obj:required="true" />
                        <field reporter:label="Currency" name="currency_type" oils_persist:primitive="string" reporter:datatype="link" oils_obj:required="true" />
                        <field reporter:label="Code" name="code" reporter:datatype="text" oils_obj:required="true" />
+                       <field reporter:label="Active" name="active" reporter:datatype="bool" oils_obj:required="true" />
                        <field reporter:label="Summary" name="summary" oils_persist:virtual="true"/>
                        <field reporter:label="Allocations" name="allocations" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Credits" name="credits" oils_persist:virtual="true" reporter:datatype="link"/>
index 6081785..19084cc 100644 (file)
 </eg-fm-record-editor>
 
 <eg-fm-record-editor #allocateToFundDialog idlClass="acqfa"
-    [preloadLinkedValues]="true">
+[fieldOptions]="{funding_source:{linkedSearchConditions:{'active':'t'},preloadLinkedValues:true}}">
 </eg-fm-record-editor>
 
 <eg-fund-transfer-dialog #transferDialog></eg-fund-transfer-dialog>
index 55599ea..4af5546 100644 (file)
@@ -80,6 +80,7 @@
   <eg-grid-column path="owner"></eg-grid-column>
   <eg-grid-column path="code"></eg-grid-column>
   <eg-grid-column path="currency_type"></eg-grid-column>
+  <eg-grid-column path="active"></eg-grid-column>
   <eg-grid-column path="balance" datatype="money" [filterable]="false" [sortable]="false"
     i18n-label label="Balance"></eg-grid-column>
   <eg-grid-column path="total_credits" datatype="money" [filterable]="false" [sortable]="false"
index 2d8678a..e0ca2bd 100644 (file)
@@ -156,6 +156,7 @@ CREATE TABLE acq.funding_source (
        owner           INT     NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
        currency_type   TEXT    NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED,
        code            TEXT    NOT NULL,
+       active          BOOL    NOT NULL DEFAULT TRUE,
        CONSTRAINT funding_source_code_once_per_owner UNIQUE (code,owner),
        CONSTRAINT funding_source_name_once_per_owner UNIQUE (name,owner)
 );
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-active-flag.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-active-flag.sql
new file mode 100644 (file)
index 0000000..4a5aeee
--- /dev/null
@@ -0,0 +1,13 @@
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version);
+
+-- Add an active flag column
+
+ALTER TABLE acq.funding_source ADD COLUMN active BOOL;
+
+UPDATE acq.funding_source SET active = 't';
+
+ALTER TABLE acq.funding_source ALTER COLUMN active SET NOT NULL DEFAULT TRUE;
+
+COMMIT;
\ No newline at end of file