
START TRANSACTION;

DROP TABLE IF EXISTS `additional_services`;
CREATE TABLE IF NOT EXISTS `additional_services` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `calendar_id` int(10) DEFAULT NULL,
  `length` smallint(5) unsigned DEFAULT NULL,
  `price` decimal(16,2) DEFAULT NULL,
  `status` enum('T','F') DEFAULT 'T',
  PRIMARY KEY (`id`),
  KEY `status` (`status`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

ALTER TABLE `bookings` ADD COLUMN `additional_service_id` int(10) DEFAULT NULL AFTER `calendar_id`;
ALTER TABLE `bookings` ADD COLUMN `additional_service_price` decimal(16,2) DEFAULT NULL AFTER `additional_service_id`;
ALTER TABLE `bookings_services` ADD COLUMN `allow_double_booking` enum('T','F') DEFAULT 'F';
ALTER TABLE `bookings_services` ADD COLUMN `order` smallint(5) DEFAULT NULL;

DROP TABLE IF EXISTS `bookings_employees`;
CREATE TABLE IF NOT EXISTS `bookings_employees` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,                             
  `booking_id` int(10) unsigned NOT NULL,                                    
  `employee_id` int(10) unsigned NOT NULL,                                   
  `booking_service_id` int(10) unsigned DEFAULT NULL,                        
  PRIMARY KEY (`id`),                                                        
  UNIQUE KEY `booking_id` (`booking_id`,`employee_id`,`booking_service_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `extra_hours`;
CREATE TABLE IF NOT EXISTS `extra_hours` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `hours` varchar(255) DEFAULT NULL,
  `until_time` varchar(255) DEFAULT NULL,
  `price` decimal(16,2) DEFAULT NULL,
  `status` enum('T','F') DEFAULT 'T',
  PRIMARY KEY (`id`),
  KEY `status` (`status`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

INSERT INTO `plugin_base_fields` VALUES (NULL, 'menuAdditionalServices', 'backend', 'Menu / Additional Services', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Additional Services', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'additional_service_name', 'backend', 'Label / Name', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Name', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'additional_service_duration', 'backend', 'Label / Duration', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Duration', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'additional_service_price', 'backend', 'Label / Price', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Price', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'additional_service_statuses_ARRAY_T', 'arrays', 'additional_service_statuses_ARRAY_T', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Active', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'additional_service_statuses_ARRAY_F', 'arrays', 'additional_service_statuses_ARRAY_F', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Inactive', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'additional_service_create_title', 'backend', 'Label / Add additional service', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Add additional service', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'additional_service_update_title', 'backend', 'Label / Update additional service', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Update additional service', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'additional_service_index_title', 'backend', 'Label / Additional services title', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Additional services', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'additional_service_index_body', 'backend', 'Label / Additional services desc', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Below you can see the available additional services that you can order them to each bookings. Under Add additional service tab you can add a new additional service. Or use the edit icon for each additional service to modify it.', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'booking_add_custom_service', 'backend', 'Label / Add custom service', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Add custom service', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblBookingAdditionallService', 'backend', 'Label / Additional service', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Additional service', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'booking_additional_service_price', 'backend', 'Label / Additional service price', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Additional service price', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'booking_allow_double_booking', 'backend', 'Label / Allow double booking', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Allow double booking', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'booking_service_order', 'backend', 'Label / Order', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Order', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'booking_service_choose_apprentices', 'backend', 'Label / Choose apprentices', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Choose apprentices', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'booking_service_add_apprentices_title', 'backend', 'Label / Select apprentices', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Select apprentices', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'booking_service_apprentice', 'backend', 'Label / Apprentice', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Apprentice', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'booking_datetime', 'backend', 'Label / Date time', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Date time', 'script');



SET @id := (SELECT `id` FROM `fields` WHERE `key` = "opt_o_email_body_text");
UPDATE `multi_lang` SET `content` = '<div class="col-xs-6">
<div><small>{Name}</small></div>
<div><small>{Phone}</small></div>
<div><small>{Email}</small></div>
<div><small>{Notes}</small></div>
<div><small>{Address1}</small></div>
<div><small>{Address2}</small></div>
<div><small>{City}</small></div>
<div><small>{State}</small></div>
<div><small>{Zip}</small></div>
<div><small>{Country}</small></div>

</div>
<div class="col-xs-6">
<div><small>{BookingID}</small></div>
<div><small>{Services}</small></div>
<div><small>{DateTime}</small></div>
<div><small>{Subservices}</small></div>
<div><small>{AdditionalService}</small></div>
<div><small>{PaymentMethod}</small></div>
<div><small>{AdditionalServicePrice}</small></div>
<div><small>{Price}</small></div>
<div><small>{Deposit}</small></div>
<div><small>{Tax}</small></div>
<div><small>{Total}</small></div>
<div><small>{CancelURL}</small></div>
 </div>
' WHERE `foreign_id` = @id AND `model` = "pjField" AND `field` = "title";

SET @id := (SELECT `id` FROM `fields` WHERE `key` = "opt_o_reminder_body_text");
UPDATE `multi_lang` SET `content` = '<div class="col-xs-6">
<p>{Name}</p>
<p>{Phone}</p>
<p>{Email}</p>
<p>{BookingID}</p>
<p>{Services}</p>
<p>{DateTime}</p>
<p>{Subservices}</p>
<p>{AdditionalService}</p>
</div>
<div class="col-xs-6">
<p>{AdditionalServicePrice}</p>
<p>{Price}</p>
<p>{Deposit}</p>
<p>{Tax}</p>
<p>{Total}</p>
<p>{CancelURL}</p>
</div>
' WHERE `foreign_id` = @id AND `model` = "pjField" AND `field` = "title";




INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminAdditionalServices', 'backend', 'pjAdminAdditionalServices', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Additional Services Menu', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminAdditionalServices_pjActionIndex', 'backend', 'pjAdminAdditionalServices_pjActionIndex', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Additional Services List', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminAdditionalServices_pjActionCreate', 'backend', 'pjAdminAdditionalServices_pjActionCreate', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Add additional service', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminAdditionalServices_pjActionUpdate', 'backend', 'pjAdminAdditionalServices_pjActionUpdate', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Update additional service', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminAdditionalServices_pjActionDelete', 'backend', 'pjAdminAdditionalServices_pjActionDelete', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Delete single additional service', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminAdditionalServices_pjActionDeleteBulk', 'backend', 'pjAdminAdditionalServices_pjActionDeleteBulk', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Delete multiple additional services', 'script');

INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, NULL, 'pjAdminAdditionalServices');
SET @level_1_id := (SELECT LAST_INSERT_ID());

  INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_1_id, 'pjAdminAdditionalServices_pjActionIndex');
  SET @level_2_id := (SELECT LAST_INSERT_ID());

    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminAdditionalServices_pjActionCreate');
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminAdditionalServices_pjActionUpdate');
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminAdditionalServices_pjActionDelete');
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminAdditionalServices_pjActionDeleteBulk');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminExtraHours', 'backend', 'pjAdminExtraHours', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Extra hours Menu', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminExtraHours_pjActionIndex', 'backend', 'pjAdminExtraHours_pjActionIndex', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Extra hours List', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminExtraHours_pjActionCreate', 'backend', 'pjAdminExtraHours_pjActionCreate', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Add Extra hour', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminExtraHours_pjActionUpdate', 'backend', 'pjAdminExtraHours_pjActionUpdate', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Update Extra hour', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminExtraHours_pjActionDelete', 'backend', 'pjAdminExtraHours_pjActionDelete', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Delete single Extra hour', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'pjAdminExtraHours_pjActionDeleteBulk', 'backend', 'pjAdminExtraHours_pjActionDeleteBulk', 'script', '2015-03-20 11:37:44');
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjField', '::LOCALE::', 'title', 'Delete multiple Extra hours', 'script');

INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, NULL, 'pjAdminExtraHours');
SET @level_1_id := (SELECT LAST_INSERT_ID());

INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_1_id, 'pjAdminExtraHours_pjActionIndex');
SET @level_2_id := (SELECT LAST_INSERT_ID());

    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminExtraHours_pjActionCreate');
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminExtraHours_pjActionUpdate');
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminExtraHours_pjActionDelete');
    INSERT INTO `plugin_auth_permissions` (`id`, `parent_id`, `key`) VALUES (NULL, @level_2_id, 'pjAdminExtraHours_pjActionDeleteBulk');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'menuExtraHours', 'backend', 'Menu / Extra Hour', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Extra Hour', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'extrahours_name', 'backend', 'Label / Name', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Hour', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'extrahours_statuses_ARRAY_T', 'arrays', 'extrahours_statuses_ARRAY_T', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Active', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'extrahours_statuses_ARRAY_F', 'arrays', 'extrahours_statuses_ARRAY_F', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Inactive', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'extrahours_create_title', 'backend', 'Label / Add Extra Hour', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Add Extra Hour', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'extrahours_update_title', 'backend', 'Label / Update Extra Hour', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Update Extra Hour', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblextrahours', 'backend', 'Label / Extra Hour', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Extra Hour', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'extrahours_index_title', 'backend', 'Label / Extra Hours title', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Extra Hours', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'extrahours_index_body', 'backend', 'Label / Extra Hours desc', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Below you can see the available sub-services that you can assign them to each services. Under Add sub-service tab you can add a new extra hour. Or use the edit icon for each extra hour to modify it.', 'script');


INSERT INTO `plugin_base_fields` VALUES (NULL, 'extrahours_price', 'backend', 'Label / Name', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Price', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'extrahours_until_time', 'arrays', 'Until', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '::LOCALE::', 'title', 'Until', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoVoucherListDesc', 'backend', 'Infobox / List of coupons', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'List of coupons', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoVoucherListTitle', 'backend', 'Infobox / List of coupons', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'List of coupons', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblVoucherCode', 'backend', 'Label / Coupon code', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Coupon code', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblVoucherCodeExist', 'backend', 'Coupon code is already used.', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Coupon code is already used', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'voucher_types_ARRAY_amount', 'arrays', 'voucher_types_ARRAY_amount', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Amount', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'voucher_types_ARRAY_percent', 'arrays', 'voucher_types_ARRAY_percent', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Percent', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblVoucherAppliedOn', 'backend', 'Label / Applied on', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Applied on', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblVoucherUsage', 'backend', 'Label / Usage', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Usage', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'dash_manage_coupons', 'backend', 'Dash / Manage Coupons', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Manage Coupons', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoVoucherListsDesc', 'backend', 'Infobox / List of coupons', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'List of coupons', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'menuCouponsDiscounts', 'backend', 'Menu / Coupons & Discounts', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Vouchers/Coupons', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'tabCoupons', 'backend', 'Tab / Coupons', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Coupons', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblDiscount', 'backend', 'Label / Discount', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Discount', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblDiscountName', 'backend', 'Label / Discount name', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Discount name', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblDiscountOptions', 'backend', 'Label / Options', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Options', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblValidityFrom', 'backend', 'Coupon Start date', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Coupon Start date', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblValidityTo', 'backend', 'Coupon Expiry date', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Coupon Expiry date', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblExportSelected', 'backend', 'Export selected', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Export selected', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'btnAddCoupon', 'backend', 'Button / Add coupon', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Add coupon', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblDateFrom', 'backend', 'Label / Coupon Start date', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Label / Coupon Start date', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblDateTo', 'backend', 'Label / Coupon Expiry date', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Label / Coupon Expiry date', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'lblDiscountType', 'backend', 'Label / Discount Type', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Label / Discount Type', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'btnClose', 'backend', 'Label / Close', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Close', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoAddVoucherTitle', 'backend', 'Add coupon', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Add coupon', 'script');

INSERT INTO `plugin_base_fields` VALUES (NULL, 'infoUpdateVoucherTitle', 'backend', 'Infobox / Update coupon code', 'script', NULL);
SET @id := (SELECT LAST_INSERT_ID());
INSERT INTO `plugin_base_multi_lang` VALUES (NULL, @id, 'pjBaseField', '1', 'title', 'Update coupon code', 'script');



COMMIT;