Feat: 1. User-level access added to Dogs, Command Categories, Locations, Button Shapes, Images, Distraction Types, Distraction Intensity Levels, Bribes, Response Quality Metrics, Obedience Levels. \n 2. New user (Founding Partner) creation setup in database and front-end but front-end not tested.
This commit is contained in:
@@ -450,26 +450,66 @@ BEGIN
|
||||
, LOCATIONS.id_change_set = v_id_change_set
|
||||
;
|
||||
|
||||
INSERT INTO fetchmetrics.DOG_Location (
|
||||
id_location_parent
|
||||
, code
|
||||
, name
|
||||
, active
|
||||
, id_user_created_by
|
||||
, created_on
|
||||
)
|
||||
SELECT
|
||||
t_LOCATIONS.id_location_parent AS id_location_parent
|
||||
, t_LOCATIONS.code AS code
|
||||
, t_LOCATIONS.name AS name
|
||||
, t_LOCATIONS.active AS active
|
||||
, a_id_user AS created_by
|
||||
, v_time_start AS created_on
|
||||
FROM tmp_Location t_LOCATIONS
|
||||
WHERE
|
||||
t_LOCATIONS.is_new = 1
|
||||
AND t_LOCATIONS.active = 1
|
||||
;
|
||||
IF EXISTS (
|
||||
SELECT *
|
||||
FROM tmp_Location t_LOCATIONS
|
||||
WHERE
|
||||
t_LOCATIONS.is_new = 1
|
||||
AND t_LOCATIONS.active = 1
|
||||
LIMIT 1
|
||||
) THEN
|
||||
INSERT INTO fetchmetrics.DOG_Location (
|
||||
id_temp
|
||||
, id_location_parent
|
||||
, code
|
||||
, name
|
||||
, active
|
||||
, id_user_created_by
|
||||
, created_on
|
||||
)
|
||||
SELECT
|
||||
t_LOCATIONS.id_temp
|
||||
, t_LOCATIONS.id_location_parent AS id_location_parent
|
||||
, t_LOCATIONS.code AS code
|
||||
, t_LOCATIONS.name AS name
|
||||
, t_LOCATIONS.active AS active
|
||||
, a_id_user AS created_by
|
||||
, v_time_start AS created_on
|
||||
FROM tmp_Location t_LOCATIONS
|
||||
WHERE
|
||||
t_LOCATIONS.is_new = 1
|
||||
AND t_LOCATIONS.active = 1
|
||||
;
|
||||
|
||||
UPDATE tmp_Location t_LOCATIONS
|
||||
INNER JOIN fetchmetrics.DOG_Location LOCATIONS ON t_LOCATIONS.id_temp = LOCATIONS.id_temp
|
||||
SET t_LOCATIONS.id_location = LOCATIONS.id_location
|
||||
WHERE
|
||||
t_LOCATIONS.is_new = 1
|
||||
AND t_LOCATIONS.active = 1
|
||||
;
|
||||
|
||||
INSERT INTO fetchmetrics.DOG_Location_User_Link (
|
||||
id_location
|
||||
, id_user
|
||||
, id_access_level
|
||||
, active
|
||||
, id_user_created_by
|
||||
, created_on
|
||||
)
|
||||
SELECT
|
||||
t_LOCATIONS.id_location
|
||||
, a_id_user
|
||||
, v_id_access_level_view
|
||||
, 1 -- active
|
||||
, a_id_user AS created_by
|
||||
, v_time_start AS created_on
|
||||
FROM tmp_Location t_LOCATIONS
|
||||
WHERE
|
||||
t_LOCATIONS.is_new = 1
|
||||
AND t_LOCATIONS.active = 1
|
||||
;
|
||||
END IF;
|
||||
|
||||
COMMIT;
|
||||
END IF;
|
||||
|
||||
Reference in New Issue
Block a user