diff --git a/src/main/resources/db/migration/V20240905_242__cleanup_for_results.sql b/src/main/resources/db/migration/V20240905_242__cleanup_for_results.sql new file mode 100644 index 00000000..bf9c9e8e --- /dev/null +++ b/src/main/resources/db/migration/V20240905_242__cleanup_for_results.sql @@ -0,0 +1,35 @@ +/** +* OPAL Program +* +* MODULE : cleanup_results.sql +* +* DESCRIPTION : Drop the RESULTS table to enable a cleanup in order to be able to load reference data from Capita. +* +* VERSION HISTORY: +* +* Date Author Version Nature of Change +* ---------- ------- -------- ------------------------------------------------------------------------------------------------------------------------------------ +* 05/09/2024 A Dennis 1.0 PO-701 Drop the RESULTS table to enable a cleanup in order to be able to load reference data from Capita. +* +**/ + +ALTER TABLE defendant_accounts +DROP constraint IF EXISTS res_enf_override_result_id_fk; + +ALTER TABLE enforcements +DROP constraint IF EXISTS enf_result_id_fk; + +ALTER TABLE committal_warrant_progress +DROP constraint IF EXISTS enf_enforcement_id_fk; + +DELETE FROM committal_warrant_progress; + +DELETE FROM enforcements; + +ALTER TABLE impositions +DROP constraint IF EXISTS imp_result_id_fk; + +ALTER TABLE result_documents +DROP constraint IF EXISTS rd_result_id_fk; + +DROP TABLE results; diff --git a/src/main/resources/db/migration/V20240905_243__recreate_results_table.sql b/src/main/resources/db/migration/V20240905_243__recreate_results_table.sql new file mode 100644 index 00000000..42703a79 --- /dev/null +++ b/src/main/resources/db/migration/V20240905_243__recreate_results_table.sql @@ -0,0 +1,73 @@ +/** +* CGI OPAL Program +* +* MODULE : results.sql +* +* DESCRIPTION : Creates the RESULTS table for the Fines model as per script from Capita +* +* VERSION HISTORY: +* +* Date Author Version Nature of Change +* ---------- ------- -------- ------------------------------------------------------------------------------- +* 05/09/2024 A Dennis 1.0 PO-701 Creates the RESULTS table for the Fines model as per script from Capita +* +**/ +CREATE TABLE results( + result_id varchar(6) NOT NULL, + result_title varchar(60) NOT NULL, + result_title_cy varchar(60), + result_type varchar(10) NOT NULL, + active boolean NOT NULL, + imposition boolean NOT NULL, + imposition_category varchar(40), + imposition_allocation_priority smallint, + imposition_accruing boolean NOT NULL, + imposition_creditor varchar(10), + enforcement boolean NOT NULL, + enforcement_override boolean NOT NULL, + further_enforcement_warn boolean NOT NULL, + further_enforcement_disallow boolean NOT NULL, + enforcement_hold boolean NOT NULL, + requires_enforcer boolean NOT NULL, + generates_hearing boolean NOT NULL, + generates_warrant boolean NOT NULL, + collection_order boolean NOT NULL, + extend_ttp_disallow boolean NOT NULL, + extend_ttp_preserve_last_enf boolean NOT NULL, + prevent_payment_card boolean NOT NULL, + lists_monies boolean NOT NULL, + result_parameters json); + +ALTER TABLE results + ADD CONSTRAINT results_id_pk + PRIMARY KEY (result_id), + ADD CONSTRAINT results_result_type_cc + CHECK (result_type IN ('Result','Action')), + ADD CONSTRAINT results_imposition_category_cc + CHECK (imposition_category IN ('Fines','Court Charge','Victim Surcharge','Witness Expenses '||CHR(38)||' Central Fund','Crown Prosecution Costs','Costs','Compensation','Legal Aid')), + ADD CONSTRAINT results_imposition_creditor_cc + CHECK (imposition_creditor IN ('CF','CPS','!CPS','Any')); + +COMMENT ON COLUMN results.result_id IS 'Unique ID of this result'; +COMMENT ON COLUMN results.result_title IS 'Result title'; +COMMENT ON COLUMN results.result_title_cy IS 'Result title'; +COMMENT ON COLUMN results.result_type IS 'Indicates if this is an acutal result or just an action. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.active IS 'Indicates if this result can be applied to new accounts. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.imposition IS 'Indicates if this result creates an imposition. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.imposition_category IS 'Financial category that monies for this imposition are reported under. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.imposition_allocation_priority IS 'Determines the order in which monies received are allocated to this impsition with respect to other impositions on the same account. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.imposition_accruing IS 'Indicates if this result is an imposition that accrues with time. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.imposition_creditor IS 'Indicates the creditor to be used for the imposition. Can be either Central (Central Fund Account), DPP (Crown Prosection Service), !DPP (a creditor other than DPP) or Any (any creditor). New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.enforcement IS 'Indicates if this result is an enforcement result. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.enforcement_override IS 'Indicates if this result can be used as an enforcement override. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.further_enforcement_warn IS 'Indicates if a warning should be issued when applying an enforcement action while this is the last enforcement on the account. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.further_enforcement_disallow IS 'Indicates if the system should prevent applying an enforcement action while this is the last enforcement on the account. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.enforcement_hold IS 'Indicates if this action places a hold on enforcement which requires it to be explicity removed to continue further enforcement on the account. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.requires_enforcer IS 'Indicates if this result requires the user to also specify an enforcer. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.generates_hearing IS 'Indicates if applying this action should attempt to schedule an enforcement hearing for the account debtor. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.collection_order IS 'Indicates if this result is a collection order result. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.extend_ttp_disallow IS 'Indicates if this result should prevent extension of payment terms. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.extend_ttp_preserve_last_enf IS 'Indicates if this should be preserved as the last enforcement on an account after extending payment instead of clearing it. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.prevent_payment_card IS 'Indicates if this result should prevent requesting a payment card if it is the last enforcement on an account. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.lists_monies IS 'this result cause the account to be reported on List Monies Under Warrant if a payment is received while this is the last enforcement action on the account. New field. Hard-coded in legacy GoB'; +COMMENT ON COLUMN results.result_parameters IS 'The parameters required to be input by the user when applyig this result. New field. Hard-coded in legacy GoB'; diff --git a/src/main/resources/db/migration/V20240905_244__load_results_table.sql b/src/main/resources/db/migration/V20240905_244__load_results_table.sql new file mode 100644 index 00000000..b276659e --- /dev/null +++ b/src/main/resources/db/migration/V20240905_244__load_results_table.sql @@ -0,0 +1,133 @@ +/** +* CGI OPAL Program +* +* MODULE : load_results_table.sql +* +* DESCRIPTION : Load the RESULTS table with reference data for the Fines model as per script from Capita +* +* VERSION HISTORY: +* +* Date Author Version Nature of Change +* ---------- ------- -------- ------------------------------------------------------------------------------------------------ +* 05/09/2024 A Dennis 1.0 PO-701 Load the RESULTS table with reference data for the Fines model as per script from Capita +* +**/ +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('ABDC','Application made for benefit deductions','Cais am dynnu arian o fudd-daliadau','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('AEO','Attachment of Earnings Order (Civil Debt)',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,'[{ "name":"normaldeductionrate", "prompt":"Normal deduction rate", "type":"D2", "min":1, "max":99999, "language_dependent":false },{ "name":"protectedearningsrate", "prompt":"Protected earnings rate", "type":"D2", "min":0, "max":99999, "language_dependent":false },{ "name":"payperiod", "prompt":"Pay period", "type":"XX", "min":0, "max":0, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('AEOC','Attachment of earnings order - fine account','Gorchymyn atafaelu enillion - cyfrif dirwy','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('BWTD','Bail Warrant - Dated','Gwarant Mechniaeth - Gyda dyddiad','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,FALSE,TRUE,FALSE,TRUE,TRUE,TRUE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"hearingdate", "prompt":"Adjourned to", "type":"DT", "min":0, "max":0, "language_dependent":false },{ "name":"courtcode", "prompt":"Court Code", "type":"N1", "min":1, "max":999, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('BWTU','Bail Warrant - Undated','Gwarant Mechniaeth - Heb Ddyddiad','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"baildirection", "prompt":"Date & time (Bail direction)", "type":"XX", "min":0, "max":0, "language_dependent":false },{ "name":"courtdetails", "prompt":"Court details", "type":"XX", "min":0, "max":0, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('CERTBR','CERTBR',NULL,'Action',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('CLAMPO','Clamping Order',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE,'[{ "name":"effectivedate", "prompt":"Effective from date", "type":"DT", "min":0, "max":0, "language_dependent":true }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('COLLO','Collection order made','Gwnaethpwyd gorchymyn casglu','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,'[{ "name":"collectiontype", "prompt":"Multiple Menu", "type":"MM", "min":1, "max":2, "language_dependent":false },{ "name":"collectiontype", "prompt":"Multiple Menu", "type":"MM", "min":1, "max":2, "language_dependent":false },{ "name":"reserveterms", "prompt":"Reserve terms (if applicable)", "type":"XX", "min":0, "max":0, "language_dependent":true }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('CONF','Confiscation Order',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('CONSOL','CONSOL',NULL,'Action',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('CREDRM','UNPRELET',NULL,'Action',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('CTPAYF','CTPAYSF',NULL,'Action',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('CW','Imprisonment in Default of Payment',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"prison", "prompt":"Prison", "type":"XX", "min":0, "max":0, "language_dependent":false },{ "name":"commitaldays", "prompt":"Number of days of committal", "type":"N1", "min":0, "max":99999, "language_dependent":false },{ "name":"consecconcurrent", "prompt":"consecutive", "type":"MN", "min":1, "max":2, "language_dependent":false },{ "name":"consecconcurrent", "prompt":"concurrent", "type":"MN", "min":1, "max":2, "language_dependent":false },{ "name":"detailsconsecutive", "prompt":"Details if consecutive", "type":"XX", "min":0, "max":0, "language_dependent":false },{ "name":"processserver", "prompt":"Custodian or process server", "type":"XX", "min":0, "max":0, "language_dependent":false },{ "name":"basisofcommital", "prompt":"Basis of committal", "type":"XX", "min":0, "max":0, "language_dependent":false },{ "name":"reasonnoaltused", "prompt":"Reason no alternative used", "type":"XX", "min":0, "max":0, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('CWN','Committal Warrant Notice','Rhybudd o Warant Traddodi','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"hearingdate", "prompt":"Adjourned to", "type":"DT", "min":0, "max":0, "language_dependent":false },{ "name":"courtcode", "prompt":"Court Code", "type":"N1", "min":1, "max":999, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('DW','Distress Warrant','Gwarant Atafaelu','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,TRUE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FCC','Criminal Courts Charge','Ffi''r Llysoedd Troseddol','Result',TRUE,TRUE,'Court Charge',6,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FCMP','SCOTTISH/NI COMPENSATION',NULL,'Result',TRUE,TRUE,'Compensation',1,FALSE,'Any',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FCOMP','Compensation','Iawndal','Result',TRUE,TRUE,'Compensation',1,FALSE,'Any',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FCOST','Costs','Costau','Result',TRUE,TRUE,'Costs',3,FALSE,'!CPS',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FCPC','Costs to Crown Prosecution Service','Costau i Wasanaeth Erlyn y Goron','Result',TRUE,TRUE,'Crown Prosecution Costs',3,FALSE,'CPS',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FCST','SCOTTISH/NI COSTS',NULL,'Result',TRUE,TRUE,'Compensation',1,FALSE,'Any',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FCUEX','CUSTOMS & EXCISE FINE',NULL,'Result',TRUE,TRUE,'Costs',4,FALSE,'Any',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FDCON','CONTRIBUTION TO FORM D COSTS',NULL,'Result',TRUE,TRUE,'Witness Expenses & Central Fund',9,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FEES','FEES',NULL,'Result',TRUE,TRUE,'Fines',2,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FFR','FORFEITED RECOGNISANCE',NULL,'Result',TRUE,TRUE,'Fines',10,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FINE','SCOTTISH/NI FINE',NULL,'Result',TRUE,TRUE,'Compensation',1,FALSE,'Any',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FLAID','LEGAL AID CONTRIBUTION',NULL,'Result',FALSE,TRUE,'Legal Aid',7,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FNIA','NO INSURANCE ARREARS',NULL,'Result',TRUE,TRUE,'Costs',4,FALSE,'Any',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FO','Fine','Dirwy','Result',TRUE,TRUE,'Fines',NULL,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FOPR1','CROWN COURT FINE',NULL,'Result',TRUE,TRUE,'Fines',NULL,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FSN','Further steps notice','Rhybudd o gamau pellach','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FVEA','VEHICLE EXCISE ARREARS',NULL,'Result',TRUE,TRUE,'Fines',8,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FVEBD','Vehicle Excise Back Duty','Ôl-dreth ar y Dreth Cerbyd','Result',TRUE,TRUE,'Fines',8,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FVS','Victim Surcharge','Gordal Dioddefwr','Result',TRUE,TRUE,'Victim Surcharge',2,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('FWEC','WITNESS EXPENSES - CENTRAL FUNDS',NULL,'Result',TRUE,TRUE,'Witness Expenses & Central Fund',9,FALSE,'CF',FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('HTT','HARD TO TRACE',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('INTL','INTELLIGENCE',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('MPSO','Money payment supervision order',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,'[{ "name":"supervisor", "prompt":"Supervisor", "type":"XX", "min":0, "max":0, "language_dependent":false },{ "name":"prisondetention", "prompt":"prison", "type":"MN", "min":1, "max":2, "language_dependent":false },{ "name":"prisondetention", "prompt":"detention", "type":"MN", "min":1, "max":2, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('NAP','NOTICE OF APPEAL',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('NAWT','NON-APPEARANCE WARRANT',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"entrynumber1", "prompt":"Date of hearing", "type":"DT", "min":0, "max":0, "language_dependent":false },{ "name":"entrynumber2", "prompt":"Court code", "type":"N1", "min":1, "max":999, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('NBWT','No bail warrant','Gwarant dim mechniaeth','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"courtdetails", "prompt":"Court details", "type":"XX", "min":0, "max":0, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('NOENF','Suspended Enforcement Order',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('PRIS','PRISON',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,'[{ "name":"earliestreleasedate", "prompt":"Earliest release date", "type":"DT", "min":0, "max":0, "language_dependent":"false" }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('REGF','Notice of Registration','Rhybudd Cofrestru','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE,TRUE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('REM','Final reminder of unpaid fine','Nodyn atgoffa terfynol am ddirwy heb ei thalu','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('REW','RETURNED EXECUTED WARRANT',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"entrynumber1", "prompt":"Date of hearing", "type":"DT", "min":0, "max":0, "language_dependent":false },{ "name":"entrynumber2", "prompt":"Court code", "type":"N1", "min":1, "max":999, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('S136','Overnight detention in police cells',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,TRUE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"timeofrelease", "prompt":"Time to be released", "type":"XX", "min":0, "max":0, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('S18','ISSUE OF SUSPENDED COMMITTAL',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,FALSE,TRUE,'[{ "name":"datesuspcom", "prompt":"Date of Suspended Committal", "type":"DT", "min":0, "max":0, "language_dependent":false },{ "name":"previouspaymentterms", "prompt":"Previous payment terms", "type":"XX", "min":0, "max":0, "language_dependent":false },{ "name":"replydate", "prompt":"Date reply to be received by", "type":"DT", "min":0, "max":0, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('SC','Suspended imprisonment to enforce money owed','Carchar Gohiriedig i orfodi arian sy''n ddyledus','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"daysindefault", "prompt":"Days in default", "type":"N1", "min":0, "max":99999, "language_dependent":false },{ "name":"totalamount", "prompt":"Total amount to pay", "type":"D2", "min":0, "max":99999, "language_dependent":false },{ "name":"paymentterms", "prompt":"Payment terms", "type":"XX", "min":0, "max":0, "language_dependent":true }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('SUMA','Enforcement Summons (Automatic enforcement only)','Gwŷs Gorfodi','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,TRUE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('SUMM','Enforcement Summons','Gwŷs Gorfodi','Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"hearingdate", "prompt":"Date of hearing", "type":"DT", "min":0, "max":0, "language_dependent":false },{ "name":"courtcode", "prompt":"Court code", "type":"N1", "min":1, "max":999, "language_dependent":false },{ "name":"prisondetention", "prompt":"prison", "type":"MN", "min":1, "max":2, "language_dependent":false },{ "name":"prisondetention", "prompt":"detention", "type":"MN", "min":1, "max":2, "language_dependent":false }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('TFOFP','FINOR',NULL,'Action',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('TFOLET','FINOTA',NULL,'Action',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('TFOOUT','Transfer of Fine Order to a Court in England or Wales','Trosglwyddo Gorchymyn Dirwy i Lys yng Nghymru neu Lloegr','Action',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('TFORD','FINOT',NULL,'Action',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('TFOREM','TFOAR',NULL,'Action',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('TTPAY','TIME TO PAY',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('UPWO','UNPAID WORK ORDER',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,TRUE,'[{ "name":"noofhours", "prompt":"No. of hours", "type":"N1", "min":1, "max":999, "language_dependent":false },{ "name":"consecconcurrent", "prompt":"Multiple Menu", "type":"MM", "min":1, "max":2, "language_dependent":true },{ "name":"consecconcurrent", "prompt":"Multiple Menu", "type":"MM", "min":1, "max":2, "language_dependent":true },{ "name":"completiondate", "prompt":"Completion date", "type":"DT", "min":0, "max":0, "language_dependent":false },{ "name":"supervisor", "prompt":"Multiple Menu", "type":"MM", "min":1, "max":3, "language_dependent":true },{ "name":"supervisor", "prompt":"Multiple Menu", "type":"MM", "min":1, "max":3, "language_dependent":true },{ "name":"supervisor", "prompt":"Multiple Menu", "type":"MM", "min":1, "max":3, "language_dependent":true },{ "name":"supervisingcourt", "prompt":"Name of supervising court", "type":"XX", "min":0, "max":0, "language_dependent":true }]'); +INSERT INTO results (result_id,result_title,result_title_cy,result_type,active,imposition,imposition_category,imposition_allocation_priority,imposition_accruing,imposition_creditor,enforcement,enforcement_override,further_enforcement_warn,further_enforcement_disallow,enforcement_hold,requires_enforcer,generates_hearing,generates_warrant,collection_order,extend_ttp_disallow,extend_ttp_preserve_last_enf,prevent_payment_card,lists_monies,result_parameters) +VALUES ('WDN','Warrant withdrawn',NULL,'Result',TRUE,FALSE,NULL,NULL,FALSE,NULL,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,NULL); + diff --git a/src/main/resources/db/migration/V20240905_245__restore_after_results.sql b/src/main/resources/db/migration/V20240905_245__restore_after_results.sql new file mode 100644 index 00000000..9d8ffc62 --- /dev/null +++ b/src/main/resources/db/migration/V20240905_245__restore_after_results.sql @@ -0,0 +1,111 @@ +/** +* OPAL Program +* +* MODULE : restore_after_results.sql +* +* DESCRIPTION : Update the enf_override_result_id foreign key ids in DEFENDANT_ACCOUNTS table to match the new result_ids in the RESULTS table after reference data load. Enable foreign keys that were disabled to allow Results reference data load. +* +* VERSION HISTORY: +* +* Date Author Version Nature of Change +* ---------- ------- -------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +* 05/09/2024 A Dennis 1.0 PO-701 Update the enf_override_result_id foreign key ids in DEFENDANT_ACCOUNTS table to match the new result_ids in the RESULTS table after reference data load. Enable foreign keys that were disabled to allow Results reference data load. +* +**/ + +UPDATE defendant_accounts +SET enf_override_result_id = 'AEO' +WHERE enf_override_result_id = '2723'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'BWTD' +WHERE enf_override_result_id = '2607'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'BWTU' +WHERE enf_override_result_id = '2631'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'CLAMPO' +WHERE enf_override_result_id = '2679'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'FCOST' +WHERE enf_override_result_id = '2223'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'FCOMP' +WHERE enf_override_result_id = '2396'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'FEES' +WHERE enf_override_result_id = '2406'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'FO' +WHERE enf_override_result_id = '2646'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'SUMM' +WHERE enf_override_result_id = '2409'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'UPWO' +WHERE enf_override_result_id = '1838'; + +UPDATE defendant_accounts +SET enf_override_result_id = 'FINE' +WHERE enf_override_result_id = '1838'; + + +ALTER TABLE defendant_accounts +ADD CONSTRAINT da_enf_override_result_id_fk FOREIGN KEY +( + enf_override_result_id +) +REFERENCES results +( + result_id +); + +ALTER TABLE defendant_accounts RENAME CONSTRAINT res_enf_override_enforcer_id_fk TO da_enf_override_enforcer_id_fk; + +ALTER TABLE enforcements +ADD CONSTRAINT enf_result_id_fk FOREIGN KEY +( + result_id +) +REFERENCES results +( + result_id +); + +ALTER TABLE committal_warrant_progress +ADD CONSTRAINT cwp_enforcement_id_fk FOREIGN KEY +( + enforcement_id +) +REFERENCES enforcements +( + enforcement_id +); + +ALTER TABLE impositions +ADD CONSTRAINT imp_result_id_fk FOREIGN KEY +( + result_id +) +REFERENCES results +( + result_id +); + +ALTER TABLE result_documents +ADD CONSTRAINT rd_result_id_fk FOREIGN KEY +( + result_id +) +REFERENCES results +( + result_id +);