x
1
-- File: trig_i_u_syst_hierarchies.eex.sql
2
-- Location: musebms/database/components/system/mscmp_syst_hierarchy/ms_syst/api_views/syst_hierarchies/trig_i_u_syst_hierarchies.eex.sql
3
-- Project: Muse Systems Business Management System
4
--
5
-- Copyright © Lima Buttgereit Holdings LLC d/b/a Muse Systems
6
-- This file may include content copyrighted and licensed from third parties.
7
--
8
-- See the LICENSE file in the project root for license terms and conditions.
9
-- See the NOTICE file in the project root for copyright ownership information.
10
--
11
-- muse.information@musesystems.com :: https://muse.systems
12
13
BEGIN
14
15
IF
16
( old.syst_defined AND
17
( new.internal_name != old.internal_name OR
18
new.display_name != old.display_name OR
19
new.hierarchy_state_id != old.hierarchy_state_id OR
20
new.structured != old.structured ) )
21
OR
22
new.hierarchy_type_id != old.hierarchy_type_id
23
THEN
24
25
RAISE EXCEPTION
26
USING
27
MESSAGE = 'The requested data update included changes to fields disallowed ' ||
28
'by the business rules of the API View.',
29
DETAIL = ms_syst_priv.get_exception_details(
30
p_proc_schema => 'ms_appl'
31
,p_proc_name => 'trig_i_u_syst_hierarchies'
32
,p_exception_name => 'invalid_api_view_call'
33
,p_errcode => 'PM008'
34
,p_param_data => jsonb_build_object('new', new, 'old', old)
35
,p_context_data =>
36
jsonb_build_object(
37
'tg_op', tg_op
38
,'tg_when', tg_when
39
,'tg_schema', tg_table_schema
40
,'tg_table_name', tg_table_name)),
41
ERRCODE = 'PM008',
42
SCHEMA = tg_table_schema,
43
TABLE = tg_table_name;
44
45
END IF;
46
47
UPDATE ms_syst_data.syst_hierarchies
48
SET
49
internal_name = new.internal_name
50
, display_name = new.display_name
51
, hierarchy_state_id = new.hierarchy_state_id
52
, structured = new.structured
53
, user_description = new.user_description
54
WHERE id = new.id
55
RETURNING * INTO new;
56
END;