INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '2', 'Project Status Change', 'Status Changed #{PROJECT_ID} {PROJECT_NAME}', '<p>Hi there,</p><p>The Project <strong>{PROJECT_NAME}</strong> &nbsp;has been marked as <b>{STATUS}</b> by <b>{MARKED_BY}</b>.</p><p>You can view the project by logging into your portal Account:</p><p><div style="text-align: center;"><b><a href="{PROJECT_URL}">View Project</a></b></div></p><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br>Best Regards,<br />{COMPANY_NAME} Team', 'project_status_change', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '3', 'Task Status Change', 'Status Changed #{TASK_ID} {TASK_NAME}', '<p>Hi there,</p><p>The task <b>{TASK_NAME}</b> has been marked as <b>{STATUS}</b> by <b>{MARKED_BY}</b>.</p><p>You can view this task by logging in to the portal using the below button:</p><p><div style="text-align: center;"><b><a href="{TASK_URL}">View Task</a></b></div></p><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'task_status_change', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '4', 'Defect Status Changed', 'Status Changed #{DEFECT_ID} {DEFECT_NAME}', '<p>Hi there,</p><p>Defect <b>{DEFECT_NAME}</b> has been marked as <b>{STATUS}</b> by <b>{MARKED_BY}</b>.</p><p>You can view this defect by logging in to the portal using the link below.</p><p><div style="text-align: center;"><b><a href="{DEFECT_URL}">View Defect</a></b></div></p><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><p><br>Best Regards,<br>The {COMPANY_NAME} Team</p>', 'defect_status_changed', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '5', 'Incident Status Changed', 'Status Changed #{INCIDENT_ID} {INCIDENT_NAME}', '<p>Hi there,</p><p>Incident <b>{INCIDENT_NAME}</b> has been marked as <b>{STATUS}</b> by <b>{MARKED_BY}</b>.</p><p>You can view this incident by logging in to the portal using the link below.</p><p><div style="text-align: center;"><b><a href="{INCIDENT_URL}">View Incident</a></b></div></p><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><p><br>Best Regards,<br>The {COMPANY_NAME} Team</p>', 'incident_status_changed', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '2', 'Project Reminder', 'Reminder #{PROJECT_ID} {PROJECT_NAME}', '<p>Hello {NAME},</p><p>The Project <b>{PROJECT_NAME}</b> assigned to you will be start on <b>{START_DATE}</b>.</p><p>You can view this project by logging in to the portal using the link below:</p><br><div style="text-align: center;"><b><a href="{PROJECT_URL}">View Project</a></b></div><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'project_reminder', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '3', 'Task Reminder', 'Reminder #{TASK_ID} {TASK_NAME}', '<p>Hello {NAME},</p><p>The Task <b>{TASK_NAME}</b> assigned to you will be start on <b>{START_DATE}</b>.</p><p>You can view this task by logging in to the portal using the below button:</p><br><div style="text-align: center;"><b><a href="{TASK_URL}">View Task</a></b></div><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><p></p><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'task_reminder', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '4', 'Defect Reminder', 'Reminder #{DEFECT_ID} {DEFECT_NAME}', '<p>Hello {NAME},</p><p>The Defect <b>{DEFECT_NAME}</b> assigned to you will be start on <b>{START_DATE}</b>.</p><p>You can view this defect by logging in to the portal using the below button:</p><br><div style="text-align: center;"><b><a href="{DEFECT_URL}">View Defect</a></b></div><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'defect_reminder', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '5', 'Incident Reminder', 'Reminder #{INCIDENT_ID} {INCIDENT_NAME}', '<p>Hello {NAME},</p><p>The Incident <b>{INCIDENT_NAME}</b> assigned to you will be start on <b>{START_DATE}</b>.</p><p>You can view this incident by logging in to the portal using the below button:</p><br><div style="text-align: center;"><b><a href="{INCIDENT_URL}">View Incident</a></b></div><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'incident_reminder', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '6', 'Appointment Reminder', 'Reminder #{APPOINTMENT_ID} {APPOINTMENT_TITLE}', '<p>Hello <b>{NAME}</b>,</p><p>This is <b>{COMPANY_NAME}</b> reminding you for your appointment on <b>{DATE}</b> at <b>{TIME}</b>. Call/text us if you need to reschedule. See you then!</b></p><br><div>End Time: <b>{END_TIME}</b></div><div>Description: {DESCRIPTION}</div><br><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'appointment_reminder', NULL, NULL, NULL);

ALTER TABLE `vipspm_user_settings` ADD `reminder_alert_before_hours` VARCHAR(255) NULL DEFAULT '6,12,24' AFTER `last_cronjob_run`;
ALTER TABLE `vipspm_user_settings` ADD `reminder_alert_before_days` VARCHAR(255) NULL DEFAULT '1,2,3' AFTER `reminder_alert_before_hours`;
ALTER TABLE `vipspm_user_settings` ADD `php_date_format` VARCHAR(50) NOT NULL DEFAULT 'Y-m-d' AFTER `date_time_format`, ADD `php_time_format` VARCHAR(50) NOT NULL DEFAULT 'H:i' AFTER `php_date_format`, ADD `php_date_time_format` VARCHAR(50) NOT NULL DEFAULT 'Y-m-d H:i' AFTER `php_time_format`;

ALTER TABLE `vipspm_users` ADD `can_view_all_users` BOOLEAN NOT NULL DEFAULT FALSE AFTER `permission`;

UPDATE `vipspm_email_template` SET `template_subject` = 'Assigned Project #{PROJECT_ID} {PROJECT_NAME}', `template_body` = '<p>Hi There,</p><p>A<strong> {PROJECT_NAME}</strong> has been assigned by <strong>{ASSIGNED_BY} </strong>to you.You can view this project by logging in to the portal using the link below:<br><br><div style="text-align: center;"><big><a href="{PROJECT_URL}"><strong>View Project</strong></a></big></div><br><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br>Best Regards,<br>The {SITE_NAME} Team</p><p>&nbsp;</p>', `deleted_at` = NULL, `created_at` = NULL WHERE `vipspm_email_template`.`type` = 'assigned_project';

UPDATE `vipspm_email_template` SET `template_subject` = 'New Project Created #{PROJECT_ID} {PROJECT_NAME}', `template_body` = '<p>Hello <strong>{CLIENT_NAME}</strong>,<br><br>We have created a new project with your account.<br>You can view this project by logging in to the portal using the link below:<br><div style="text-align: center;"><big><a href="{PROJECT_URL}"><strong>View Project</strong></a></big></div></p><p>Project Name: <b>{PROJECT_NAME}</b></p><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><p><br>Best Regards,<br>The {SITE_NAME} Team</p><p>&nbsp;</p>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'notification_client';

UPDATE `vipspm_email_template` SET `template_subject` = 'Project Completed #{PROJECT_ID} {PROJECT_NAME}', `template_body` = '<p>Hi <strong>{CLIENT_NAME}</strong>,</p><p>Project <strong>{PROJECT_NAME}</strong> &nbsp;has been completed.<br>You can view this project by logging in to the portal using the link below:<br><div style="text-align: center;"><big><a href="{PROJECT_URL}"><strong>View Project</strong></a></big></div><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br><br>Best Regards,<br>The {SITE_NAME} Team</p>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'complete_projects';

UPDATE `vipspm_email_template` SET `template_subject` = 'Task Assigned #{TASK_ID} {TASK_NAME}', `template_body` = '<p>Hi there,</p><p>A new task <strong>{TASK_NAME}</strong> &nbsp;has been assigned to <strong>{ASSIGNED_TO}</strong> by <strong>{ASSIGNED_BY}</strong>.</p><p>You can view this task by logging in to the portal using the link below.</p><p><div style="text-align: center;"><big><strong><a href="{TASK_URL}">View Task</a></strong></big></div><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br>Best Regards,<br>The {COMPANY_NAME} Team</p>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'task_assigned';

UPDATE `vipspm_email_template` SET `template_subject` = 'Task Updated #{TASK_ID} {TASK_NAME}', `template_body` = '<p>Hi there,</p><p><strong>{TASK_NAME}</strong> has been updated by <strong>{UPDATED_BY}</strong>.</p><p>You can view this Task by logging in to the portal using the link below.</p><p><br><div style="text-align: center;"><big><strong><a href="{TASK_URL}">View Task</a></strong></big></div><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br>Best Regards,<br>The {COMPANY_NAME} Team</p>', `deleted_at` = NULL, `created_at` = NULL WHERE `vipspm_email_template`.`type` = 'task_updated';

UPDATE `vipspm_email_template` SET `template_subject` = 'Defect Assigned #{DEFECT_ID} {DEFECT_NAME}', `template_body` = '<p>Hi there,</p><p>A new defect {DEFECT_NAME} has been assigned to <strong>{ASSIGNED_TO}</strong> by <strong>{ASSIGNED_BY}</strong>.</p><p>You can view this defect by logging in to the portal using the link below.</p><p><br><div style="text-align: center;"><b><a href="{DEFECT_URL}">View Defect</a></b></div><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br><br>Best Regards,<br>The {COMPANY_NAME} Team</p>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'defect_assigned';

UPDATE `vipspm_email_template` SET `template_subject` = 'Defect Updated #{DEFECT_ID} {DEFECT_NAME}', `template_body` = '<p>Hi there,</p><p><strong>{DEFECT_NAME}</strong> has been updated by <strong>{UPDATED_BY}</strong>.</p><p>You can view this Defect by logging in to the portal using the link below.</p><p><br><div style="text-align: center;"><big><strong><a href="{DEFECT_URL}">View Defect</a></strong></big></div><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br>Best Regards,<br>The {COMPANY_NAME} Team</p>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'defect_updated';

UPDATE `vipspm_email_template` SET `template_subject` = 'Incident Assigned #{INCIDENT_ID} {INCIDENT_NAME}', `template_body` = '<p>Hi there,</p><p>A new incident <strong>{INCIDENT_NAME}</strong> has been assigned to <strong>{ASSIGNED_TO}</strong> by <strong>{ASSIGNED_BY}</strong>.</p><p>You can view this incident by logging in to the portal using the link below.</p><div style="text-align: center;"><strong><a href="{INCIDENT_URL}">View Incident</a></strong></div><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><p><br>Best Regards,<br>The {COMPANY_NAME} Team</p>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'incident_assigned';

UPDATE `vipspm_email_template` SET `template_subject` = 'Incident Updated #{INCIDENT_ID} {INCIDENT_NAME}', `template_body` = '<p>Hi there,</p><p><strong>{INCIDENT_NAME}</strong> has been updated by <strong>{UPDATED_BY}</strong>.</p><p>You can view this Incident by logging in to the portal using the link below.</p><p><br><div style="text-align: center;"><big><strong><a href="{INCIDENT_URL}">View Incident</a></strong></big></div><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br>Best Regards,<br>The {COMPANY_NAME} Team</p>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'incident_updated';

INSERT INTO `vipspm_email_template_groups` (`id`, `email_group_name`, `created_at`, `updated_at`, `deleted_at`) VALUES ('11', 'Meeting Emails', NULL, NULL, NULL);

UPDATE `vipspm_email_template` SET `email_group_id` = '11', `template_subject` = 'Meeting #{MEETING_ID} {MEETING_TITLE}', `template_body` = 'Hi <strong>{NAME}</strong>,<div><br></div><div>A meeting has been scheduled on <strong>{MEETING_DATE}</strong>, in the <strong>{LOCATION}</strong> at <strong>{MEETING_TIME}</strong>.</div><div><br></div><div>End Time: <b>{END_TIME}</b></div><div>Description: {DESCRIPTION}</div><div><br></div><div>Have fun!<br>The <strong>{COMPANY_NAME}</strong> Team.<br></div><div><br></div>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'meeting';

UPDATE `vipspm_email_template` SET `email_group_id` = '11', `template_subject` = 'Meeting Canceled #{MEETING_ID} {MEETING_TITLE}', `template_body` = 'Hi <strong>{NAME}</strong>,<div><br></div><div>The meeting scheduled on <strong>{MEETING_DATE}</strong>, in the <strong>{LOCATION}</strong> at <strong>{MEETING_TIME}</strong> has been canceled.</div><br><div>End Time: <b>{END_TIME}</b></div><div>Description: {DESCRIPTION}</div><br><div>Have fun!<br>The <strong>{COMPANY_NAME}</strong> Team.<br></div>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'cancel_meeting';

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '11', 'Meeting Reminder', 'Reminder #{MEETING_ID} {MEETING_TITLE}', '<p>Hi <b>{NAME}</b>,</p><p>Friendly reminder that we have a meeting booked for <b>{DATE}</b> at <b>{TIME}</b></b>.</p><p>You can view this meeting by logging in to the portal using the below button:</p><p></p><div style="text-align: center;"><b><a href="{MEETING_URL}">View Meeting</a></b></div><div>End Time: <b>{END_TIME}</b><div>Description: {DESCRIPTION}</div><p></p><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'meeting_reminder', NULL, NULL, NULL);

UPDATE `vipspm_email_template` SET `template_subject` = 'Appointment #{APPOINTMENT_ID} {APPOINTMENT_TITLE}', `template_body` = 'Hi <strong>{NAME}</strong>,<br><div>A appointment has been <b>{STATUS}</b> on <strong>{APPOINTEMENT_DATE}</strong>, in the <strong>{LOCATION}</strong> at <strong>{APPOINTEMENT_TIME}</strong>.</div><br><div>End Time: <b>{END_TIME}</b></div><div>Description: {DESCRIPTION}</div><br><div>Have fun!<br>The <strong>{COMPANY_NAME}</strong> Team.<br></div>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'appointment_mail';

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '1', 'New User Added', 'New User Added #{USER_ID} {USER_NAME}', '<p>Hello <b>{NAME}</b>,</p><p>New user <b>{USER_NAME}</b> has registered as a <b>{ROLE}</b> role.</p><p>You can view his/her profile by logging in to the portal using the below link:</p><p style="text-align: center;"><a href="{PROFILE_URL}"><big><b>View Profile</b></big></a></p><p>Best Regards,<br>The {COMPANY_NAME} Team</p>', 'new_user_added', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '1', 'New Client Added', 'New Client Added #{CLIENT_ID} {CLIENT_NAME}', '<p>Hello <b>{NAME}</b>,</p><p>New client <b>{CLIENT_NAME}</b> has registered.</p><p>You can view his/her profile by logging in to the portal using the below link:</p><p style="text-align: center;"><a href="{PROFILE_URL}"><big><b>View Profile</b></big></a></p><p>Best Regards,<br>The {COMPANY_NAME} Team</p>', 'new_client_added', NULL, NULL, NULL);

ALTER TABLE `vipspm_appointment` ADD `recurrence` TINYINT(1) NOT NULL DEFAULT '0' AFTER `note`;
ALTER TABLE `vipspm_appointment` ADD `recurrence_occurrences` INT(10) NULL AFTER `recurrence`;
ALTER TABLE `vipspm_appointment` ADD `recurrence_pattern` VARCHAR(50) NULL AFTER `recurrence_occurrences`;

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '2', 'Project Overdue Reminder', 'Project Overdue Reminder #{PROJECT_ID} {PROJECT_NAME}', '<p><b>Hello {NAME},</b></p><p>Hope You Are Well!<br></p><p>This is just to remind you that the project <b>{PROJECT_NAME}</b> is delayed by <b>{END_DATE}</b>. Its taking longer than expected,<br>Please review activities by login into portal using the link below:<br><big><p style="text-align: center;"><a href="{PROJECT_URL}"><strong>View Project</strong></a></p></big><br><p>Start Date: <b>{START_DATE}</b><br>Description: {DESCRIPTION}</p><br><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'project_overdue', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '3', 'Task Overdue Reminder', 'Task Overdue Reminder #{TASK_ID} {TASK_NAME}', '<p><b>Hello {NAME},</b></p><p>Hope You Are Well!<br></p><p>This is just to remind you that the task <b>{TASK_NAME}</b> is delayed by <b>{END_DATE}</b>. Its taking longer than expected,<br>Please review activities by login into portal using the link below:<br><big><p style="text-align: center;"><a href="{TASK_URL}"><strong>View Task</strong></a></p></big><br><p>Start Date: <b>{START_DATE}</b><br>Description: {DESCRIPTION}</p><br><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'task_overdue', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '4', 'Defect Overdue Reminder', 'Defect Overdue Reminder #{DEFECT_ID} {DEFECT_NAME}', '<p><b>Hello {NAME},</b></p><p>Hope You Are Well!<br></p><p>This is just to remind you that the defect <b>{DEFECT_NAME}</b> is delayed by <b>{END_DATE}</b>. Its taking longer than expected,<br>Please review activities by login into portal using the link below:<br><big><p style="text-align: center;"><a href="{DEFECT_URL}"><strong>View Defect</strong></a></p></big><br><p>Start Date: <b>{START_DATE}</b><br>Description: {DESCRIPTION}</p><br><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'defect_overdue', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '5', 'Incident Overdue Reminder', 'Incident Overdue Reminder #{INCIDENT_ID} {INCIDENT_NAME}', '<p><b>Hello {NAME},</b></p><p>Hope You Are Well!<br></p><p>This is just to remind you that the incident <b>{INCIDENT_NAME}</b> is delayed by <b>{END_DATE}</b>. Its taking longer than expected,<br>Please review activities by login into portal using the link below:<br><big><p style="text-align: center;"><a href="{INCIDENT_URL}"><strong>View Incident</strong></a></p></big><br><p>Start Date: <b>{START_DATE}</b><br />Description: {DESCRIPTION}</p><br><p>Best Regards,<br>{COMPANY_NAME} Team</p>', 'incident_overdue', NULL, NULL, NULL);

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '2', 'Project Update', 'Project Updated #{PROJECT_ID} {PROJECT_NAME}', '<p>Hi There,</p><p>The Project <b> {PROJECT_NAME}</b> has been updated by <b>{UPDATED_BY} </b>.You can view this project by logging in to the portal using the below button:</p><div style="text-align: center;"><big><a href="{PROJECT_URL}"><b>View Project</b></a></big></div><br><p>Start Date: <b>{START_DATE}</b></p><p>End Date: <b>{END_DATE}</b></p><p>Description: {DESCRIPTION}</p><br>Best Regards,<br>The {SITE_NAME} Team</p><p>&nbsp;</p>', 'project_update', NULL, NULL, NULL);

ALTER TABLE `vipspm_estimate_items` CHANGE `quantity` `quantity` INT(11) NOT NULL;
ALTER TABLE `vipspm_invoice_items` CHANGE `quantity` `quantity` INT(11) NOT NULL;

ALTER TABLE `vipspm_invoice_items` CHANGE `unit_price` `unit_price` DOUBLE(13,2) NOT NULL;
ALTER TABLE `vipspm_invoice_items` CHANGE `total_item_amount` `total_item_amount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_invoice_item_taxes` CHANGE `item_tax` `item_tax` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_invoices` CHANGE `sub_total` `sub_total` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_invoices` CHANGE `total_amount` `total_amount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_invoices` CHANGE `total_due_amount` `total_due_amount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_invoices` CHANGE `total_tax` `total_tax` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_invoices` CHANGE `discount` `discount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_invoices` CHANGE `adjustment` `adjustment` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_invoices` CHANGE `total_discount` `total_discount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_payments` CHANGE `amount` `amount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';

ALTER TABLE `vipspm_estimate_items` CHANGE `unit_price` `unit_price` DOUBLE(13,2) NOT NULL;
ALTER TABLE `vipspm_estimate_items` CHANGE `total_item_amount` `total_item_amount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_estimate_item_taxes` CHANGE `item_tax` `item_tax` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_estimates` CHANGE `sub_total` `sub_total` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_estimates` CHANGE `total_amount` `total_amount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_estimates` CHANGE `total_tax` `total_tax` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_estimates` CHANGE `adjustment` `adjustment` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_estimates` CHANGE `total_discount` `total_discount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';
ALTER TABLE `vipspm_estimates` CHANGE `discount` `discount` DOUBLE(13,2) NOT NULL DEFAULT '0.00';

ALTER TABLE `vipspm_items` CHANGE `price` `price` DOUBLE(13,2) NOT NULL;

ALTER TABLE `vipspm_projects` CHANGE `description` `description` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;
ALTER TABLE `vipspm_tasks` CHANGE `description` `description` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;
ALTER TABLE `vipspm_defects` CHANGE `description` `description` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;
ALTER TABLE `vipspm_incidents` CHANGE `description` `description` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;

ALTER TABLE `vipspm_invoices` ADD `recurrence` BOOLEAN NOT NULL DEFAULT FALSE AFTER `note`;
ALTER TABLE `vipspm_invoices` ADD `recurrence_occurrences` INT(11) NULL AFTER `recurrence`;
ALTER TABLE `vipspm_invoices` ADD `recurrence_pattern` VARCHAR(50) NULL AFTER `recurrence_occurrences`;
ALTER TABLE `vipspm_invoices` ADD `is_recurrence_generated` BOOLEAN NOT NULL DEFAULT FALSE AFTER `recurrence_pattern`;
ALTER TABLE `vipspm_invoices` ADD `parent_id` INT(11) NULL DEFAULT NULL AFTER `id`;

ALTER TABLE `vipspm_defects_history` CHANGE `description` `description` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
ALTER TABLE `vipspm_incident_history` CHANGE `description` `description` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;

ALTER TABLE `vipspm_announcements` CHANGE `description` `description` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;
ALTER TABLE `vipspm_holidays` CHANGE `description` `description` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;
ALTER TABLE `vipspm_meetings` CHANGE `description` `description` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;
ALTER TABLE `vipspm_project_sprints` CHANGE `description` `description` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;
ALTER TABLE `vipspm_email_inbox` CHANGE `message_body` `message_body` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;
ALTER TABLE `vipspm_appointment` CHANGE `note` `note` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL;

ALTER TABLE `vipspm_meetings` ADD `project_id` INT NULL AFTER `organizer_id`;

ALTER TABLE `vipspm_user_settings` ADD `mail_from_name` VARCHAR(255) NULL DEFAULT 'VipsPM' AFTER `smtp_encryption`;

INSERT INTO `vipspm_email_template` (`id`, `email_group_id`, `template_name`, `template_subject`, `template_body`, `type`, `deleted_at`, `created_at`, `updated_at`) VALUES (NULL, '7', 'Cancel Leave', 'Request for Cancelling Leave', 'Dear Sir/Mam,<br><br>I am writing to request for the cancellation of my submitted leave for <b>{DATE}</b>. So there will be no effect on my attendance and salary. <br>Sorry for the inconvenience. <br>Thanking you in anticipation.<br><br>Best Regards,<br>{NAME}', 'cancel_leave', NULL, NULL, NULL);

UPDATE `vipspm_email_template` SET `template_body` = '<p>Hello <strong>{NAME}</strong>,</p><p>Welcome to <strong>{COMPANY_NAME}</strong> .Thanks for joining <strong>{COMPANY_NAME}</strong>.</p><p>We just wanted to say welcome.</p><p>Please contact us if you need any help.</p><p>To verify your email address, please click on below link:<br><div style="text-align: center;"><big><strong><a href="{ACTIVATE_URL}">Finish Your Registration...</a></strong></big></div></p><p><br>Have fun!<br>The <strong>{COMPANY_NAME}</strong> Team.</p>', `deleted_at` = NULL, `created_at` = NULL, `updated_at` = NULL WHERE `vipspm_email_template`.`type` = 'welcome_email';

ALTER TABLE `vipspm_folders` DROP `folder_desc`;
