INSERT INTO `tbloptions`
  SELECT id, NULL, 'estimate_show_lineitem_description', 1, 1 FROM `tbltenants`;

INSERT INTO `tbloptions`
  SELECT id, NULL, 'invoice_show_lineitem_description', 1, 1 FROM `tbltenants`;

INSERT INTO `tbloptions`
  SELECT id, NULL, 'work_order_show_lineitem_description', 1, 1 FROM `tbltenants`;
  
INSERT INTO `tbloptions_static`
  VALUES (NULL, 'invoice_show_lineitem_description', 1, 1),
  (NULL, 'estimate_show_lineitem_description', 1, 1),
  (NULL, 'work_order_show_lineitem_description', 1, 1);

/* Insert the new features into the database */

/* Feature 1 - Invoice Line Item Description */
INSERT INTO `tblplan_features`
  VALUES (NULL, 'Invoice Line Item Description', 'invoice_show_lineitem_description', 'Allow to Show Invoice Line Item Description', 'restrict', 0, 999, CURRENT_TIMESTAMP);

SET @plan_features_id = LAST_INSERT_ID();  

INSERT INTO `tblplan_features_value`
  VALUES (NULL, 9, @plan_features_id, 0, NULL, CURRENT_TIMESTAMP),
  (NULL, 10, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 11, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 12, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 13, @plan_features_id, 0, NULL, CURRENT_TIMESTAMP),
  (NULL, 14, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 15, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP);
/* Feature 1 - Invoice Line Item Description */

/* Feature 2 - Estimate Line Item Description */
INSERT INTO `tblplan_features`
  VALUES (NULL, 'Estimate Line Item Description', 'estimate_show_lineitem_description', 'Allow to Show Estimate Line Item Description', 'restrict', 0, 999, CURRENT_TIMESTAMP);

SET @plan_features_id = LAST_INSERT_ID();
  
INSERT INTO `tblplan_features_value`
  VALUES (NULL, 9, @plan_features_id, 0, NULL, CURRENT_TIMESTAMP),
  (NULL, 10, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 11, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 12, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 13, @plan_features_id, 0, NULL, CURRENT_TIMESTAMP),
  (NULL, 14, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 15, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP);

/* Feature 2 - Estimate Line Item Description */

/* Feature 3 - Work Order Line Item Description */    
INSERT INTO `tblplan_features`  
  VALUES (NULL, 'Work Order Line Item Description', 'work_order_show_lineitem_description', 'Allow to Show Work Order Line Item Description', 'restrict', 0, 999, CURRENT_TIMESTAMP);

SET @plan_features_id = LAST_INSERT_ID();
  
INSERT INTO `tblplan_features_value`
  VALUES (NULL, 9, @plan_features_id, 0, NULL, CURRENT_TIMESTAMP),
  (NULL, 10, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 11, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 12, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 13, @plan_features_id, 0, NULL, CURRENT_TIMESTAMP),
  (NULL, 14, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP),
  (NULL, 15, @plan_features_id, 1, NULL, CURRENT_TIMESTAMP);
  
/* Feature 3 - Work Order Line Item Description */

/* For refreshing permissions - to load above new permissions */  
UPDATE `tblstaff`
 SET refresh_permissions = 1;  
/* For refreshing permissions - to load above new permissions */  