CREATE TABLE IF NOT EXISTS ohrm_leave_request_employee_nominee (
  id INT(10) NOT NULL AUTO_INCREMENT,
  emp_number INT(7) NOT NULL,
  state VARCHAR(255) NOT NULL,
  note TEXT,
  leave_request_id INT(10) UNSIGNED NOT NULL,
  PRIMARY KEY(id),
  CONSTRAINT fk_leave_request_employee_nominee_emp_number FOREIGN KEY (emp_number) REFERENCES hs_hr_employee(emp_number) ON DELETE CASCADE,
  CONSTRAINT fk_leave_request_employee_nominee_leave_request FOREIGN KEY (leave_request_id) REFERENCES ohrm_leave_request(id) ON DELETE CASCADE

) ENGINE = INNODB DEFAULT CHARSET = utf8;

CREATE TABLE IF NOT EXISTS ohrm_leave_request_employee_nominee_state (
  state VARCHAR(255)NOT NULL,
  leave_request_id INT(10) UNSIGNED NOT NULL,
  PRIMARY KEY(leave_request_id),
  CONSTRAINT fk_ohrm_leave_request_employee_nominee_state_leave_request FOREIGN KEY (leave_request_id) REFERENCES ohrm_leave_request(id) ON DELETE CASCADE
) ENGINE = INNODB DEFAULT CHARSET = utf8;


INSERT INTO `ohrm_workflow` (`id`, `name`, `label`, `available_to`, `default_available_to`, `group_name`, `group_label`, `order_no`)
VALUES ('NOMINEE', 'nominee', 'Nominee', '1,3', '2', 'leave', 'Leave', '2');

INSERT INTO `ohrm_event_listener` (`event`, `listener_class`, `enabled`, `position`) VALUES ('leave.leave_request_change_leave_request_employee_nominees', 'LeaveRequestChangeEmployeeNomineesListener', '1', '22');

SET @section_id = (SELECT id FROM `ohrm_audittrail_section` WHERE `name` = 'LeaveRequest' AND `description` = 'Leave Request');
INSERT INTO `ohrm_audittrail_section_actions` (`section_id`, `action`, `description`) VALUES (@section_id, 'CHANGE LEAVE REQUEST NOMINEES', 'Change Leave Request Nominees ');

SET @nominee_workflow_id = (SELECT `id` FROM `ohrm_workflow` WHERE `name` = 'nominee');

INSERT INTO `ohrm_workflow_state_machine` (`workflow`, `state`, `role`, `action`, `resulting_state`, `roles_to_notify`, `screens_to_show`, `priority`) VALUES
(@nominee_workflow_id, 'INITIAL', 'ADMIN', 'Add', 'ADDED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'INITIAL', 'SUPERVISOR', 'Add', 'ADDED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'INITIAL', 'ESS User', 'Add', 'NOMINATED', NULL, 'INVISIBLE', 0),

(@nominee_workflow_id, 'NOMINATED', 'ADMIN', 'Edit', 'NOMINATED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'NOMINATED', 'SUPERVISOR', 'Edit', 'NOMINATED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'NOMINATED', 'ESS User', 'Edit', 'NOMINATED', NULL, 'INVISIBLE', 0),

(@nominee_workflow_id, 'NOMINATED', 'SYSTEM', 'Add', 'ADDED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'INITIAL', 'SYSTEM', 'Add', 'ADDED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'INITIAL', 'SYSTEM', 'Add', 'NOMINATED', NULL, 'INVISIBLE', 0),

(@nominee_workflow_id, 'ADDED', 'ADMIN', 'Edit', 'ADDED', NULL, 'INVISIBLE', 0),

(@nominee_workflow_id, 'ADDED', 'SYSTEM', 'Freez', 'FROZEN', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'NOMINATED', 'SYSTEM', 'Freez', 'FROZEN', NULL, 'INVISIBLE', 0),

(@nominee_workflow_id, 'NOMINATED', 'SYSTEM', 'Remove', 'REMOVED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'NOMINATED', 'ADMIN', 'Remove', 'REMOVED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'NOMINATED', 'SUPERVISOR', 'Remove', 'REMOVED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'NOMINATED', 'ESS User', 'Remove', 'REMOVED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'ADDED', 'SYSTEM', 'Remove', 'REMOVED', NULL, 'INVISIBLE', 0),
(@nominee_workflow_id, 'ADDED', 'ADMIN', 'Remove', 'REMOVED', NULL, 'INVISIBLE', 0);


SET @leave_workflow_id := (SELECT id FROM `ohrm_workflow` WHERE `name` = 'leave');

# nominee workflow for custom user role

INSERT INTO `ohrm_workflow_state_machine` (`workflow`, `state`, `role`, `action`, `resulting_state`, `roles_to_notify`, `screens_to_show`, `priority`) SELECT `ouwsm`.`workflow`, `ouwsm`.`state`, `cur`.`name`, `ouwsm`.`action`, `ouwsm`.`resulting_state`, `ouwsm`.`roles_to_notify`, `ouwsm`.`screens_to_show`, `ouwsm`.`priority`
                                                                                                                                                       FROM
                                                                                                                                                         ( SELECT `ur`.`name` FROM `ohrm_user_role` `ur`
                                                                                                                                                           RIGHT JOIN `ohrm_user_role_type` `urt` ON `urt`.`id` = `ur`.`type_id`
                                                                                                                                                           WHERE `ur`.`name` IN (
                                                                                                                                                             SELECT DISTINCT `wsm`.`role` FROM `ohrm_workflow_state_machine` `wsm` WHERE `wsm`.`workflow` = @leave_workflow_id
                                                                                                                                                           )
                                                                                                                                                           AND `urt`.`name` = 'Admin' AND `ur`.`name` <> 'Admin'
                                                                                                                                                         ) `cur`,
                                                                                                                                                         ( SELECT `workflow`, `state`, `role`, `action`, `resulting_state`, `roles_to_notify`, `screens_to_show`, `priority`
                                                                                                                                                           FROM `ohrm_workflow_state_machine`
                                                                                                                                                           WHERE `workflow` = @nominee_workflow_id AND `role` = 'ADMIN'
                                                                                                                                                         ) `ouwsm`;

INSERT INTO `ohrm_workflow_state_machine` (`workflow`, `state`, `role`, `action`, `resulting_state`, `roles_to_notify`, `screens_to_show`, `priority`) SELECT `ouwsm`.`workflow`, `ouwsm`.`state`, `cur`.`name`, `ouwsm`.`action`, `ouwsm`.`resulting_state`, `ouwsm`.`roles_to_notify`, `ouwsm`.`screens_to_show`, `ouwsm`.`priority`
                                                                                                                                                       FROM
                                                                                                                                                         ( SELECT `ur`.`name` FROM `ohrm_user_role` `ur`
                                                                                                                                                           RIGHT JOIN `ohrm_user_role_type` `urt` ON `urt`.`id` = `ur`.`type_id`
                                                                                                                                                           WHERE `ur`.`name` IN (
                                                                                                                                                             SELECT DISTINCT `wsm`.`role` FROM `ohrm_workflow_state_machine` `wsm` WHERE `wsm`.`workflow` = @leave_workflow_id
                                                                                                                                                           )
                                                                                                                                                           AND `urt`.`name` = 'ESS' AND `ur`.`name` <> 'ESS'
                                                                                                                                                         ) `cur`,
                                                                                                                                                         ( SELECT `workflow`, `state`, `role`, `action`, `resulting_state`, `roles_to_notify`, `screens_to_show`, `priority`
                                                                                                                                                           FROM `ohrm_workflow_state_machine`
                                                                                                                                                           WHERE `workflow` = @nominee_workflow_id AND `role` = 'ESS User'
                                                                                                                                                         ) `ouwsm`;

INSERT INTO `ohrm_workflow_state_machine` (`workflow`, `state`, `role`, `action`, `resulting_state`, `roles_to_notify`, `screens_to_show`, `priority`) SELECT `ouwsm`.`workflow`, `ouwsm`.`state`, `cur`.`name`, `ouwsm`.`action`, `ouwsm`.`resulting_state`, `ouwsm`.`roles_to_notify`, `ouwsm`.`screens_to_show`, `ouwsm`.`priority`
                                                                                                                                                       FROM
                                                                                                                                                         ( SELECT `ur`.`name` FROM `ohrm_user_role` `ur`
                                                                                                                                                           RIGHT JOIN `ohrm_user_role_type` `urt` ON `urt`.`id` = `ur`.`type_id`
                                                                                                                                                           WHERE `ur`.`name` IN (
                                                                                                                                                             SELECT DISTINCT `wsm`.`role` FROM `ohrm_workflow_state_machine` `wsm` WHERE `wsm`.`workflow` = @leave_workflow_id
                                                                                                                                                           )
                                                                                                                                                           AND `urt`.`name` = 'Supervisor' AND `ur`.`name` <> 'Supervisor'
                                                                                                                                                         ) `cur`,
                                                                                                                                                         ( SELECT `workflow`, `state`, `role`, `action`, `resulting_state`, `roles_to_notify`, `screens_to_show`, `priority`
                                                                                                                                                           FROM `ohrm_workflow_state_machine`
                                                                                                                                                           WHERE `workflow` = @nominee_workflow_id AND `role` = 'SUPERVISOR'
                                                                                                                                                         ) `ouwsm`;
# nominee workflow for custom user role end

SET @NOMINATED_to_ADDED_by_SYSTEM_workflow_id := (SELECT id FROM `ohrm_workflow_state_machine` WHERE `state` = 'NOMINATED' AND `role` = 'SYSTEM' AND `resulting_state` = 'ADDED');
SET @INITIAL_to_ADDED_by_SYSTEM_workflow_id := (SELECT id FROM `ohrm_workflow_state_machine` WHERE `state` = 'INITIAL' AND `role` = 'SYSTEM' AND `resulting_state` = 'ADDED');
SET @ADDED_to_FROZEN_by_SYSTEM_workflow_id := (SELECT id FROM `ohrm_workflow_state_machine` WHERE `state` = 'ADDED' AND `role` = 'SYSTEM' AND `resulting_state` = 'FROZEN');
SET @NOMINATED_to_FROZEN_by_SYSTEM_workflow_id := (SELECT id FROM `ohrm_workflow_state_machine` WHERE `state` = 'NOMINATED' AND `role` = 'SYSTEM' AND `resulting_state` = 'FROZEN');
SET @INITIAL_to_NOMINATED_by_SYSTEM_workflow_id := (SELECT id FROM `ohrm_workflow_state_machine` WHERE `state` = 'INITIAL' AND `role` = 'SYSTEM' AND `resulting_state` = 'NOMINATED');

INSERT INTO `ohrm_workflow_state_machine_dependancy` (master_state_change_id, slave_state_change_id, trigger_verification) SELECT
                                                                                                                            wsm.id,
                                                                                                                            @NOMINATED_to_ADDED_by_SYSTEM_workflow_id,
                                                                                                                            'VerifyEmployeeNomineeStateChange'
                                                                                                                            FROM `ohrm_workflow_state_machine` wsm WHERE
                                                                                                                            wsm.workflow IN (SELECT `id` FROM `ohrm_workflow` WHERE `group_name` = 'leave' AND `name` <> 'nominee') AND
                                                                                                                            wsm.state <> 'INITIAL' AND
                                                                                                                            wsm.resulting_state IN('SCHEDULED');

INSERT INTO `ohrm_workflow_state_machine_dependancy` (master_state_change_id, slave_state_change_id, trigger_verification) SELECT
                                                                                                                            wsm.id,
                                                                                                                            @INITIAL_to_NOMINATED_by_SYSTEM_workflow_id,
                                                                                                                            'VerifyEmployeeNomineeStateChange'
                                                                                                                            FROM `ohrm_workflow_state_machine` wsm WHERE
                                                                                                                            wsm.workflow IN (SELECT `id` FROM `ohrm_workflow` WHERE `group_name` = 'leave' AND `name` <> 'nominee') AND
                                                                                                                            wsm.state = 'INITIAL' AND
                                                                                                                            wsm.action = 'APPLY' AND
                                                                                                                            wsm.resulting_state LIKE '%PENDING%';

INSERT INTO `ohrm_workflow_state_machine_dependancy` (master_state_change_id, slave_state_change_id, trigger_verification) SELECT
                                                                                                                            wsm.id,
                                                                                                                            @INITIAL_to_ADDED_by_SYSTEM_workflow_id,
                                                                                                                            'VerifyEmployeeNomineeStateChange'
                                                                                                                            FROM `ohrm_workflow_state_machine` wsm WHERE
                                                                                                                            wsm.workflow IN (SELECT `id` FROM `ohrm_workflow` WHERE `group_name` = 'leave' AND `name` <> 'nominee') AND
                                                                                                                            wsm.state = 'INITIAL' AND
                                                                                                                            wsm.resulting_state IN('SCHEDULED');

INSERT INTO `ohrm_workflow_state_machine_dependancy` (master_state_change_id, slave_state_change_id, trigger_verification) SELECT
                                                                                                                            wsm.id,
                                                                                                                            @NOMINATED_to_FROZEN_by_SYSTEM_workflow_id,
                                                                                                                            'VerifyEmployeeNomineeStateChange'
                                                                                                                            FROM `ohrm_workflow_state_machine` wsm WHERE
                                                                                                                            wsm.workflow IN (SELECT `id` FROM `ohrm_workflow` WHERE `group_name` = 'leave' AND `name` <> 'nominee') AND
                                                                                                                            wsm.resulting_state IN ('CANCELLED','REJECTED') AND
                                                                                                                            (wsm.state NOT LIKE '%SCHEDULED%' AND wsm.state NOT LIKE '%TAKEN%') AND
                                                                                                                            (wsm.role <> 'ADMIN'
                                                                                                                             AND
                                                                                                                             wsm.role NOT IN (SELECT `ur`.`name` FROM `ohrm_user_role` `ur`
                                                                                                                                               RIGHT JOIN `ohrm_user_role_type` `urt` ON `urt`.`id` = `ur`.`type_id`
                                                                                                                                               WHERE `ur`.`name` IN (
                                                                                                                                                 SELECT DISTINCT `wsm`.`role` FROM `ohrm_workflow_state_machine` `wsm` WHERE `wsm`.`workflow` = @leave_workflow_id
                                                                                                                                               ) AND `urt`.`name` = 'Admin' AND `ur`.`name` <> 'Admin'
                                                                                                                                             )
                                                                                                                            );

INSERT INTO `ohrm_workflow_state_machine_dependancy` (master_state_change_id, slave_state_change_id, trigger_verification) SELECT
                                                                                                                            wsm.id,
                                                                                                                            @ADDED_to_FROZEN_by_SYSTEM_workflow_id,
                                                                                                                            'VerifyEmployeeNomineeStateChange'
                                                                                                                            FROM `ohrm_workflow_state_machine` wsm WHERE
                                                                                                                            wsm.workflow IN (SELECT `id` FROM `ohrm_workflow` WHERE `group_name` = 'leave' AND `name` <> 'nominee') AND
                                                                                                                            wsm.resulting_state IN ('CANCELLED','REJECTED') AND
                                                                                                                            (wsm.state LIKE '%SCHEDULED%' OR wsm.state LIKE '%TAKEN%') AND
                                                                                                                            (wsm.role <> 'ADMIN'
                                                                                                                             AND
                                                                                                                             wsm.role NOT IN (SELECT `ur`.`name` FROM `ohrm_user_role` `ur`
                                                                                                                                               RIGHT JOIN `ohrm_user_role_type` `urt` ON `urt`.`id` = `ur`.`type_id`
                                                                                                                                               WHERE `ur`.`name` IN (
                                                                                                                                                SELECT DISTINCT `wsm`.`role` FROM `ohrm_workflow_state_machine` `wsm` WHERE `wsm`.`workflow` = @leave_workflow_id
                                                                                                                                               ) AND `urt`.`name` = 'Admin' AND `ur`.`name` <> 'Admin'
                                                                                                                                             )
                                                                                                                            );

INSERT INTO `ohrm_workflow_state_machine_dependancy` (master_state_change_id, slave_state_change_id, trigger_verification) SELECT
                                                                                                                            wsm.id,
                                                                                                                            @NOMINATED_to_FROZEN_by_SYSTEM_workflow_id,
                                                                                                                            'VerifyEmployeeNomineeStateChange'
                                                                                                                            FROM `ohrm_workflow_state_machine` wsm WHERE
                                                                                                                            wsm.workflow IN (SELECT `id` FROM `ohrm_workflow` WHERE `group_name` = 'leave' AND `name` <> 'nominee') AND
                                                                                                                            wsm.resulting_state IN ('CANCELLED','REJECTED') AND
                                                                                                                            (wsm.state NOT LIKE '%SCHEDULED%' AND wsm.state NOT LIKE '%TAKEN%') AND
                                                                                                                            (wsm.role = 'ADMIN'
                                                                                                                             OR
                                                                                                                             wsm.role IN (SELECT `ur`.`name` FROM `ohrm_user_role` `ur`
                                                                                                                                           RIGHT JOIN `ohrm_user_role_type` `urt` ON `urt`.`id` = `ur`.`type_id`
                                                                                                                                           WHERE `ur`.`name` IN (
                                                                                                                                             SELECT DISTINCT `wsm`.`role` FROM `ohrm_workflow_state_machine` `wsm` WHERE `wsm`.`workflow` = @leave_workflow_id
                                                                                                                                           ) AND `urt`.`name` = 'Admin' AND `ur`.`name` <> 'Admin'
                                                                                                                                         )
                                                                                                                            );

INSERT INTO `ohrm_workflow_state_machine_dependancy` (master_state_change_id, slave_state_change_id, trigger_verification) SELECT
                                                                                                                            wsm.id,
                                                                                                                            @ADDED_to_FROZEN_by_SYSTEM_workflow_id,
                                                                                                                            'VerifyEmployeeNomineeStateChange'
                                                                                                                            FROM `ohrm_workflow_state_machine` wsm WHERE
                                                                                                                            wsm.workflow IN (SELECT `id` FROM `ohrm_workflow` WHERE `group_name` = 'leave' AND `name` <> 'nominee') AND
                                                                                                                            wsm.resulting_state IN ('CANCELLED','REJECTED') AND
                                                                                                                            (wsm.state LIKE '%SCHEDULED%' OR wsm.state LIKE '%TAKEN%') AND
                                                                                                                            (wsm.role = 'ADMIN'
                                                                                                                             OR
                                                                                                                             wsm.role IN (SELECT `ur`.`name` FROM `ohrm_user_role` `ur`
                                                                                                                                           RIGHT JOIN `ohrm_user_role_type` `urt` ON `urt`.`id` = `ur`.`type_id`
                                                                                                                                           WHERE `ur`.`name` IN (
                                                                                                                                             SELECT DISTINCT `wsm`.`role` FROM `ohrm_workflow_state_machine` `wsm` WHERE `wsm`.`workflow` = @leave_workflow_id
                                                                                                                                           ) AND `urt`.`name` = 'Admin' AND `ur`.`name` <> 'Admin'
                                                                                                                                         )
                                                                                                                            );


SET @notification_type_id := (SELECT `id` FROM `ohrm_notification_type` WHERE `name` = 'Action Based');
SET @leave_module_id := (SELECT `id` FROM `ohrm_module` WHERE `name` = 'leave');
SET @email_media := (SELECT `id` FROM `ohrm_notification_media` WHERE `name` = 'Email');

INSERT INTO `ohrm_notification` (`name`, `is_enable`, `type_id`, `generator_class`, `parameters`, `workflow_id`, `workflow_action`, `module_id`, `hidden`) VALUES
('Nominee Added', '1', @notification_type_id, 'EmployeeNomineeNotificationProcessor', NULL, @leave_workflow_id, NULL, @leave_module_id, '0');
SET @nominee_added_notification := LAST_INSERT_ID();

INSERT INTO `ohrm_notification` (`name`, `is_enable`, `type_id`, `generator_class`, `parameters`, `workflow_id`, `workflow_action`, `module_id`, `hidden`) VALUES
('Nominee Removed', '1', @notification_type_id, 'EmployeeNomineeNotificationProcessor', NULL, @leave_workflow_id, NULL, @leave_module_id, '0');
SET @nominee_removed_notification := LAST_INSERT_ID();

INSERT INTO `ohrm_notification_subscriber`(`media_id`, `parameters`, `type`, `name`) VALUES (@email_media, '{"prevent_delete":true}', 'Custom', 'Affected Employee');
SET @nominee_notification_subscriber := LAST_INSERT_ID();



INSERT INTO `ohrm_notification_subscription` (`notification_id`, `workflow_item_id`,`notify_affected_employee`) SELECT
                                                                        @nominee_added_notification,
                                                                        wsm.id,
                                                                        0
                                                                        FROM `ohrm_workflow_state_machine` wsm WHERE
                                                                        wsm.workflow = @nominee_workflow_id AND
                                                                        wsm.state = 'INITIAL' AND
                                                                        wsm.action = 'Add';
SET @last_subscription_id:= LAST_INSERT_ID();

INSERT INTO `ohrm_notification_subscriber_subscription`(subscription_id, subscriber_id) SELECT
    ns.id, @nominee_notification_subscriber FROM `ohrm_notification_subscription` ns WHERE ns.id >= @last_subscription_id;


INSERT INTO `ohrm_notification_subscription` (`notification_id`, `workflow_item_id`,`notify_affected_employee`) SELECT
                                                                        @nominee_removed_notification,
                                                                        wsm.id,
                                                                        0
                                                                        FROM `ohrm_workflow_state_machine` wsm WHERE
                                                                        wsm.workflow = @nominee_workflow_id AND
                                                                        wsm.action = 'Remove';

SET @last_subscription_id:= LAST_INSERT_ID();

INSERT INTO `ohrm_notification_subscriber_subscription`(subscription_id, subscriber_id) SELECT
    ns.id, @nominee_notification_subscriber FROM `ohrm_notification_subscription` ns WHERE ns.id >= @last_subscription_id;

INSERT INTO `ohrm_notification_supported_media` (`notification_id`, `media_id`) VALUES
(@nominee_added_notification, @email_media),
(@nominee_removed_notification, @email_media);

INSERT INTO `ohrm_notification_template` (`notification_id`, `media_id`, `locale`, `performer_role`, `recipient_role`, `subject`, `body`) VALUES
  (@nominee_added_notification, @email_media, 'en_US', NULL, NULL, '%affectedEmployeeName% is added as a nominee for %leaveRequestOwner%''s leave request',
   'Hi %subscriberName%,

%affectedEmployeeName% has been added as a nominee by %performerName% for the following leave request made by %leaveRequestOwner%.

%body%

You received this email because you are a subscriber.

Thank you.

This is an automated notification.' );


INSERT INTO `ohrm_notification_template` (`notification_id`, `media_id`, `locale`, `performer_role`, `recipient_role`, `subject`, `body`) VALUES
  (@nominee_removed_notification, @email_media, 'en_US', NULL, NULL, '%affectedEmployeeName% has been removed from being a nominee for %leaveRequestOwner%''s leave',
   'Hi %subscriberName%,

%affectedEmployeeName% has been removed from being a nominee by %performerName% for the following leave request made by %leaveRequestOwner%.

%body%

You received this email because you are a subscriber.

Thank you.

This is an automated notification.' );

INSERT INTO `ohrm_notification_template` (`notification_id`, `media_id`, `locale`, `performer_role`, `recipient_role`, `subject`, `body`) VALUES
(@nominee_added_notification, @email_media, 'en_US', NULL, 'Affected Employee', 'You are added as a nominee for %leaveRequestOwner%''s leave request',
'Hi %subscriberName%,

You are added as a nominee by %performerName% for the following leave request made by %leaveRequestOwner%.

%body%

Thank you.

This is an automated notification.' );

INSERT INTO `ohrm_notification_template` (`notification_id`, `media_id`, `locale`, `performer_role`, `recipient_role`, `subject`, `body`) VALUES
(@nominee_removed_notification, @email_media, 'en_US', NULL, 'Affected Employee', 'You have been removed from being a nominee for %leaveRequestOwner%''s leave request',
'Hi %subscriberName%,

You have been removed from being a nominee by %performerName% for the following leave request made by %leaveRequestOwner%.

%body%

Thank you.

This is an automated notification.' );
