-- Estimate staff and client signature setting

INSERT INTO tbloptions_static (name, value, autoload) VALUES('estimate_client_signature', '1', 1);

INSERT INTO tbloptions (tenant_id, name, value, autoload)
SELECT t.id,s.name,s.value,s.autoload
FROM tbltenants t
JOIN tbloptions_static s ON 1 = 1 AND s.name in('estimate_client_signature');



INSERT INTO tbloptions_static (name, value, autoload) VALUES('estimate_staff_signature', '0', 1);

INSERT INTO tbloptions (tenant_id, name, value, autoload)
SELECT t.id,s.name,s.value,s.autoload
FROM tbltenants t
JOIN tbloptions_static s ON 1 = 1 AND s.name in('estimate_staff_signature');


-- Invoice staff and client signature setting
INSERT INTO tbloptions_static (name, value, autoload) VALUES('invoice_client_signature', '1', 1);

INSERT INTO tbloptions (tenant_id, name, value, autoload)
SELECT t.id,s.name,s.value,s.autoload
FROM tbltenants t
JOIN tbloptions_static s ON 1 = 1 AND s.name in('invoice_client_signature');



INSERT INTO tbloptions_static (name, value, autoload) VALUES('invoice_staff_signature', '0', 1);

INSERT INTO tbloptions (tenant_id, name, value, autoload)
SELECT t.id,s.name,s.value,s.autoload
FROM tbltenants t
JOIN tbloptions_static s ON 1 = 1 AND s.name in('invoice_staff_signature');


INSERT INTO `tblplan_features` (`name`, `codename`, `description`, `type`, `added_on`) VALUES ('Allowed Client Signature', 'allowed_client_signature', 'Client Signature', 'restrict', NOW());
SET @allowed_client_signature  = LAST_INSERT_ID();
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('9', @allowed_client_signature , '0', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('10', @allowed_client_signature , '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('11', @allowed_client_signature , '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('12', @allowed_client_signature , '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('13', @allowed_client_signature , '0', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('14', @allowed_client_signature , '1', UTC_TIMESTAMP());
INSERT INTO `tblplan_features_value` (`plans_id`, `plans_features_id`, `value`, `added_on`) VALUES ('15', @allowed_client_signature , '1', UTC_TIMESTAMP());

UPDATE tblstaff SET refresh_permissions = 1;


