START TRANSACTION;

-- Keep the order module wording English-only across all locales.
-- This file follows the standard PHPJabbers updater pattern:
-- insert field, resolve @field_id, insert missing locale rows, then update content.


INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'lblReadMore', 'backend', 'Read more', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'lblReadMore');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Read more', `source` = 'script'
WHERE `key` = 'lblReadMore';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'lblReadMore' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Read more', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Read more', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_back_to_orders', 'frontend', 'Frontend / Back to orders', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_back_to_orders');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Back to orders', `source` = 'script'
WHERE `key` = 'front_back_to_orders';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_back_to_orders' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Back to orders', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Back to orders', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_button_reorder', 'frontend', 'Frontend / Reorder', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_button_reorder');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Reorder', `source` = 'script'
WHERE `key` = 'front_button_reorder';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_button_reorder' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Reorder', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Reorder', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_reorder_confirm_title', 'frontend', 'Frontend / Reorder confirmation title', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_reorder_confirm_title');

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_reorder_confirm_title' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Reorder', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_reorder_confirm_text', 'frontend', 'Frontend / Reorder confirmation text', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_reorder_confirm_text');

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_reorder_confirm_text' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Add the same products from this order to your cart?', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_reorder_success', 'frontend', 'Frontend / Reorder success', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_reorder_success');
SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_reorder_success' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Products were added to your cart.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (SELECT 1 FROM `plugin_base_multi_lang` AS ml WHERE ml.`foreign_id` = @field_id AND ml.`model` = 'pjBaseField' AND ml.`locale` = l.`id` AND ml.`field` = 'title');

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_reorder_failed', 'frontend', 'Frontend / Reorder failed', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_reorder_failed');
SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_reorder_failed' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'These products cannot be reordered.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (SELECT 1 FROM `plugin_base_multi_lang` AS ml WHERE ml.`foreign_id` = @field_id AND ml.`model` = 'pjBaseField' AND ml.`locale` = l.`id` AND ml.`field` = 'title');

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_reorder_out_of_stock', 'frontend', 'Frontend / Reorder out of stock', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_reorder_out_of_stock');
SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_reorder_out_of_stock' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Stock is not available or one of the ordered products is out of stock.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (SELECT 1 FROM `plugin_base_multi_lang` AS ml WHERE ml.`foreign_id` = @field_id AND ml.`model` = 'pjBaseField' AND ml.`locale` = l.`id` AND ml.`field` = 'title');

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_reorder_order_not_found', 'frontend', 'Frontend / Reorder order not found', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_reorder_order_not_found');
SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_reorder_order_not_found' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Order not found.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (SELECT 1 FROM `plugin_base_multi_lang` AS ml WHERE ml.`foreign_id` = @field_id AND ml.`model` = 'pjBaseField' AND ml.`locale` = l.`id` AND ml.`field` = 'title');

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_reorder_empty_order', 'frontend', 'Frontend / Reorder empty order', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_reorder_empty_order');
SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_reorder_empty_order' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'No products were found for this order.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (SELECT 1 FROM `plugin_base_multi_lang` AS ml WHERE ml.`foreign_id` = @field_id AND ml.`model` = 'pjBaseField' AND ml.`locale` = l.`id` AND ml.`field` = 'title');

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_custom_fields', 'frontend', 'Frontend / Additional information', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_custom_fields');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Additional information', `source` = 'script'
WHERE `key` = 'front_custom_fields';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_custom_fields' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Additional information', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Additional information', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_digital_copied', 'frontend', 'Frontend / Copied', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_digital_copied');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Copied', `source` = 'script'
WHERE `key` = 'front_digital_copied';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_digital_copied' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Copied!', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Copied!', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_digital_downloads_intro', 'frontend', 'Frontend / Digital downloads intro', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_digital_downloads_intro');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Digital downloads intro', `source` = 'script'
WHERE `key` = 'front_digital_downloads_intro';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_digital_downloads_intro' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Download your purchased digital products below.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Download your purchased digital products below.', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_digital_downloads_title', 'frontend', 'Frontend / Digital downloads', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_digital_downloads_title');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Digital downloads', `source` = 'script'
WHERE `key` = 'front_digital_downloads_title';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_digital_downloads_title' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Digital downloads', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Digital downloads', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_digital_label_count', 'frontend', 'Frontend / Download count', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_digital_label_count');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Download count', `source` = 'script'
WHERE `key` = 'front_digital_label_count';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_digital_label_count' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Downloads', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Downloads', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_digital_label_last', 'frontend', 'Frontend / Last downloaded', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_digital_label_last');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Last downloaded', `source` = 'script'
WHERE `key` = 'front_digital_label_last';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_digital_label_last' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Last downloaded', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Last downloaded', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_digital_label_until', 'frontend', 'Frontend / Valid until', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_digital_label_until');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Valid until', `source` = 'script'
WHERE `key` = 'front_digital_label_until';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_digital_label_until' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Valid until', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Valid until', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_digital_status_expired', 'frontend', 'Frontend / Expired', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_digital_status_expired');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Expired', `source` = 'script'
WHERE `key` = 'front_digital_status_expired';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_digital_status_expired' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Expired', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Expired', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_digital_status_max', 'frontend', 'Frontend / Max downloads', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_digital_status_max');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Max downloads', `source` = 'script'
WHERE `key` = 'front_digital_status_max';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_digital_status_max' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Max downloads reached', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Max downloads reached', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_discount_voucher', 'frontend', 'Frontend / Discount code', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_discount_voucher');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Discount code', `source` = 'script'
WHERE `key` = 'front_discount_voucher';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_discount_voucher' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Discount code', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Discount code', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_login', 'frontend', 'Frontend / Login', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_login');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Login', `source` = 'script'
WHERE `key` = 'front_login';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_login' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Log in', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Log in', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_no', 'frontend', 'Frontend / No', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_no');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / No', `source` = 'script'
WHERE `key` = 'front_no';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_no' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'No', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'No', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_created', 'frontend', 'Frontend / Order date', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_created');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Order date', `source` = 'script'
WHERE `key` = 'front_order_created';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_created' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Order date', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Order date', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_insurance', 'frontend', 'Frontend / Insurance', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_insurance');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Insurance', `source` = 'script'
WHERE `key` = 'front_order_insurance';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_insurance' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Insurance', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Insurance', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_login_required', 'frontend', 'Frontend / Login required', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_login_required');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Login required', `source` = 'script'
WHERE `key` = 'front_order_login_required';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_login_required' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Please log in to view your order.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Please log in to view your order.', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_not_found', 'frontend', 'Frontend / Order not found', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_not_found');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Order not found', `source` = 'script'
WHERE `key` = 'front_order_not_found';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_not_found' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Order not found.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Order not found.', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_notes', 'frontend', 'Frontend / Notes', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_notes');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Notes', `source` = 'script'
WHERE `key` = 'front_order_notes';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_notes' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Notes', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Notes', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_number', 'frontend', 'Frontend / Order number', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_number');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Order number', `source` = 'script'
WHERE `key` = 'front_order_number';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_number' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Order number', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Order number', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_pay_order', 'frontend', 'Frontend / Pay order', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_pay_order');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Pay order', `source` = 'script'
WHERE `key` = 'front_order_pay_order';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_pay_order' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Pay order', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Pay order', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_actions', 'frontend', 'Frontend / Order actions', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_actions');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Order actions', `source` = 'script'
WHERE `key` = 'front_order_actions';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_actions' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Actions', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Actions', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_status', 'frontend', 'Frontend / Order status', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_status');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Order status', `source` = 'script'
WHERE `key` = 'front_order_status';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_status' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Order status', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Order status', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_tab_billing_details', 'frontend', 'Frontend / Billing address', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_tab_billing_details');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Billing address', `source` = 'script'
WHERE `key` = 'front_order_tab_billing_details';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_tab_billing_details' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Billing address', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Billing address', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_tab_shipping_details', 'frontend', 'Frontend / Shipping address', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_tab_shipping_details');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Shipping address', `source` = 'script'
WHERE `key` = 'front_order_tab_shipping_details';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_tab_shipping_details' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Shipping address', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Shipping address', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_total', 'frontend', 'Frontend / Order total', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_total');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Order total', `source` = 'script'
WHERE `key` = 'front_order_total';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_total' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Total', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Total', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_order_voucher', 'frontend', 'Frontend / Discount code', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_order_voucher');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Discount code', `source` = 'script'
WHERE `key` = 'front_order_voucher';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_order_voucher' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Discount code', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Discount code', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';


INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_orders_not_found', 'frontend', 'Frontend / Orders not found', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_orders_not_found');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Orders not found', `source` = 'script'
WHERE `key` = 'front_orders_not_found';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_orders_not_found' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'No orders found.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'No orders found.', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_price', 'frontend', 'Frontend / Price', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_price');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Price', `source` = 'script'
WHERE `key` = 'front_price';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_price' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Price', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Price', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';


INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_product', 'frontend', 'Frontend / Product', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_product');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Product', `source` = 'script'
WHERE `key` = 'front_product';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_product' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Product', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Product', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_quantity', 'frontend', 'Frontend / Quantity', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_quantity');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Quantity', `source` = 'script'
WHERE `key` = 'front_quantity';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_quantity' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Qty', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Qty', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_shipping', 'frontend', 'Frontend / Shipping', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_shipping');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Shipping', `source` = 'script'
WHERE `key` = 'front_shipping';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_shipping' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Shipping', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Shipping', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_sub_total', 'frontend', 'Frontend / Subtotal', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_sub_total');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Subtotal', `source` = 'script'
WHERE `key` = 'front_sub_total';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_sub_total' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Subtotal', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Subtotal', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_tax', 'frontend', 'Frontend / Tax', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_tax');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Tax', `source` = 'script'
WHERE `key` = 'front_tax';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_tax' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Tax', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Tax', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_total', 'frontend', 'Frontend / Total', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_total');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Total', `source` = 'script'
WHERE `key` = 'front_total';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_total' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Total', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Total', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';


INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'front_yes', 'frontend', 'Frontend / Yes', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'front_yes');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Yes', `source` = 'script'
WHERE `key` = 'front_yes';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'front_yes' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Yes', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Yes', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'digital_download_btn', 'frontend', 'Frontend / Download button', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'digital_download_btn');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Frontend / Download button', `source` = 'script'
WHERE `key` = 'digital_download_btn';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'digital_download_btn' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Download', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Download', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'digital_download_password_label', 'frontend', 'Password', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'digital_download_password_label');

UPDATE `plugin_base_fields`
SET `type` = 'frontend', `label` = 'Password', `source` = 'script'
WHERE `key` = 'digital_download_password_label';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'digital_download_password_label' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Password', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Password', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'infoOrdersTitle', 'backend', 'Orders / Page title', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'infoOrdersTitle');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Page title', `source` = 'script'
WHERE `key` = 'infoOrdersTitle';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'infoOrdersTitle' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Orders', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Orders', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'infoOrdersDesc', 'backend', 'Orders / Page description', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'infoOrdersDesc');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Page description', `source` = 'script'
WHERE `key` = 'infoOrdersDesc';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'infoOrdersDesc' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Manage customer orders, payments, shipping, invoices, and order details.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Manage customer orders, payments, shipping, invoices, and order details.', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'infoUpdateOrderTitle', 'backend', 'Orders / Update title', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'infoUpdateOrderTitle');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Update title', `source` = 'script'
WHERE `key` = 'infoUpdateOrderTitle';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'infoUpdateOrderTitle' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Update order', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Update order', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'infoUpdateOrderDesc', 'backend', 'Orders / Update description', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'infoUpdateOrderDesc');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Update description', `source` = 'script'
WHERE `key` = 'infoUpdateOrderDesc';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'infoUpdateOrderDesc' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Review and update order details, customer information, shipping, products, and totals.', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Review and update order details, customer information, shipping, products, and totals.', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_tab_order', 'backend', 'Orders / Order tab', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_tab_order');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Order tab', `source` = 'script'
WHERE `key` = 'order_tab_order';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_tab_order' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Order', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Order', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_tab_client', 'backend', 'Orders / Client tab', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_tab_client');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Client tab', `source` = 'script'
WHERE `key` = 'order_tab_client';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_tab_client' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Client', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Client', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_tab_shipping', 'backend', 'Orders / Shipping tab', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_tab_shipping');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Shipping tab', `source` = 'script'
WHERE `key` = 'order_tab_shipping';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_tab_shipping' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Shipping', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Shipping', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_uuid', 'backend', 'Orders / UUID', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_uuid');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / UUID', `source` = 'script'
WHERE `key` = 'order_uuid';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_uuid' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Order number', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Order number', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_created', 'backend', 'Orders / Created', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_created');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Created', `source` = 'script'
WHERE `key` = 'order_created';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_created' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Created', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Created', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_send_confirm', 'backend', 'Orders / Send confirmation', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_send_confirm');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Send confirmation', `source` = 'script'
WHERE `key` = 'order_send_confirm';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_send_confirm' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Send confirmation', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Send confirmation', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_send_payment', 'backend', 'Orders / Send payment', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_send_payment');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Send payment', `source` = 'script'
WHERE `key` = 'order_send_payment';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_send_payment' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Send payment', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Send payment', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_status', 'backend', 'Orders / Status', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_status');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Status', `source` = 'script'
WHERE `key` = 'order_status';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_status' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Status', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Status', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_payment', 'backend', 'Orders / Payment', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_payment');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Payment', `source` = 'script'
WHERE `key` = 'order_payment';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_payment' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Payment', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Payment', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_voucher', 'backend', 'Orders / Voucher', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_voucher');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Voucher', `source` = 'script'
WHERE `key` = 'order_voucher';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_voucher' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Discount code', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Discount code', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_shipping_location', 'backend', 'Orders / Shipping location', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_shipping_location');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Shipping location', `source` = 'script'
WHERE `key` = 'order_shipping_location';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_shipping_location' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Shipping location', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Shipping location', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_price', 'backend', 'Orders / Price', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_price');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Price', `source` = 'script'
WHERE `key` = 'order_price';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_price' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Subtotal', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Subtotal', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_discount', 'backend', 'Orders / Discount', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_discount');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Discount', `source` = 'script'
WHERE `key` = 'order_discount';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_discount' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Discount', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Discount', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_insurance', 'backend', 'Orders / Insurance', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_insurance');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Insurance', `source` = 'script'
WHERE `key` = 'order_insurance';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_insurance' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Insurance', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Insurance', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_shipping', 'backend', 'Orders / Shipping', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_shipping');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Shipping', `source` = 'script'
WHERE `key` = 'order_shipping';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_shipping' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Shipping', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Shipping', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_tax', 'backend', 'Orders / Tax', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_tax');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Tax', `source` = 'script'
WHERE `key` = 'order_tax';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_tax' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Tax', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Tax', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_total', 'backend', 'Orders / Total', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_total');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Total', `source` = 'script'
WHERE `key` = 'order_total';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_total' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Total', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Total', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_notes', 'backend', 'Orders / Notes', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_notes');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Notes', `source` = 'script'
WHERE `key` = 'order_notes';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_notes' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Notes', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Notes', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_customer', 'backend', 'Orders / Customer', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_customer');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Customer', `source` = 'script'
WHERE `key` = 'order_customer';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_customer' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Customer', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Customer', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_client', 'backend', 'Orders / Client', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_client');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Client', `source` = 'script'
WHERE `key` = 'order_client';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_client' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Client', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Client', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_email', 'backend', 'Orders / Email', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_email');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Email', `source` = 'script'
WHERE `key` = 'order_email';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_email' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Email', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Email', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_address', 'backend', 'Orders / Address', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_address');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Address', `source` = 'script'
WHERE `key` = 'order_address';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_address' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Address', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Address', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_address_1', 'backend', 'Orders / Address 1', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_address_1');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Address 1', `source` = 'script'
WHERE `key` = 'order_address_1';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_address_1' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Address 1', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Address 1', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_address_2', 'backend', 'Orders / Address 2', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_address_2');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Address 2', `source` = 'script'
WHERE `key` = 'order_address_2';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_address_2' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Address 2', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Address 2', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_city', 'backend', 'Orders / City', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_city');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / City', `source` = 'script'
WHERE `key` = 'order_city';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_city' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'City', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'City', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_state', 'backend', 'Orders / State', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_state');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / State', `source` = 'script'
WHERE `key` = 'order_state';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_state' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'State', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'State', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_zip', 'backend', 'Orders / ZIP', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_zip');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / ZIP', `source` = 'script'
WHERE `key` = 'order_zip';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_zip' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'ZIP', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'ZIP', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_country', 'backend', 'Orders / Country', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_country');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Country', `source` = 'script'
WHERE `key` = 'order_country';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_country' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Country', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Country', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_phone', 'backend', 'Orders / Phone', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_phone');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Phone', `source` = 'script'
WHERE `key` = 'order_phone';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_phone' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Phone', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Phone', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_name', 'backend', 'Orders / Name', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_name');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Name', `source` = 'script'
WHERE `key` = 'order_name';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_name' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Name', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Name', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_products', 'backend', 'Orders / Products', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_products');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Products', `source` = 'script'
WHERE `key` = 'order_products';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_products' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Products', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Products', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_choose', 'backend', 'Orders / Choose', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_choose');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Choose', `source` = 'script'
WHERE `key` = 'order_choose';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_choose' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Choose', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Choose', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_select_product', 'backend', 'Orders / Select product', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_select_product');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Select product', `source` = 'script'
WHERE `key` = 'order_select_product';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_select_product' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Select product', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Select product', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_stock_add_title', 'backend', 'Orders / Add product', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_stock_add_title');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Add product', `source` = 'script'
WHERE `key` = 'order_stock_add_title';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_stock_add_title' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Add product', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Add product', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_stock_edit_title', 'backend', 'Orders / Edit product', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_stock_edit_title');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Edit product', `source` = 'script'
WHERE `key` = 'order_stock_edit_title';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_stock_edit_title' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Edit product', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Edit product', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_p_name', 'backend', 'Orders / Product name', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_p_name');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Product name', `source` = 'script'
WHERE `key` = 'order_p_name';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_p_name' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Product', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Product', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_p_sku', 'backend', 'Orders / SKU', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_p_sku');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / SKU', `source` = 'script'
WHERE `key` = 'order_p_sku';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_p_sku' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'SKU', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'SKU', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_p_price', 'backend', 'Orders / Product price', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_p_price');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Product price', `source` = 'script'
WHERE `key` = 'order_p_price';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_p_price' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Price', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Price', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_p_qty', 'backend', 'Orders / Product quantity', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_p_qty');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Product quantity', `source` = 'script'
WHERE `key` = 'order_p_qty';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_p_qty' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Qty', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Qty', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_p_subtotal', 'backend', 'Orders / Product subtotal', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_p_subtotal');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Product subtotal', `source` = 'script'
WHERE `key` = 'order_p_subtotal';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_p_subtotal' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Subtotal', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Subtotal', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_unit_price', 'backend', 'Orders / Unit price', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_unit_price');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Unit price', `source` = 'script'
WHERE `key` = 'order_unit_price';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_unit_price' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Unit price', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Unit price', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_billing_details', 'backend', 'Orders / Billing details', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_billing_details');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Billing details', `source` = 'script'
WHERE `key` = 'order_billing_details';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_billing_details' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Billing details', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Billing details', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_shipping_details', 'backend', 'Orders / Shipping details', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_shipping_details');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Shipping details', `source` = 'script'
WHERE `key` = 'order_shipping_details';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_shipping_details' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Shipping details', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Shipping details', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_copy_b', 'backend', 'Orders / Copy billing', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_copy_b');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Copy billing', `source` = 'script'
WHERE `key` = 'order_copy_b';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_copy_b' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Copy billing address', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Copy billing address', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_copy_s', 'backend', 'Orders / Copy shipping', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_copy_s');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Copy shipping', `source` = 'script'
WHERE `key` = 'order_copy_s';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_copy_s' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Copy shipping address', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Copy shipping address', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_same', 'backend', 'Orders / Same address', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_same');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Same address', `source` = 'script'
WHERE `key` = 'order_same';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_same' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Same as billing address', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Same as billing address', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_all_list', 'backend', 'Orders / All list', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_all_list');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / All list', `source` = 'script'
WHERE `key` = 'order_all_list';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_all_list' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'All orders', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'All orders', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_current_stock', 'backend', 'Orders / Current stock', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_current_stock');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Current stock', `source` = 'script'
WHERE `key` = 'order_current_stock';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_current_stock' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Current stock', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Current stock', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_confirmation_email_title', 'backend', 'Orders / Confirmation email', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_confirmation_email_title');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Confirmation email', `source` = 'script'
WHERE `key` = 'order_confirmation_email_title';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_confirmation_email_title' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Confirmation email', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Confirmation email', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_payment_email_title', 'backend', 'Orders / Payment email', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_payment_email_title');

UPDATE `plugin_base_fields`
SET `type` = 'backend', `label` = 'Orders / Payment email', `source` = 'script'
WHERE `key` = 'order_payment_email_title';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_payment_email_title' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Payment email', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Payment email', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';


INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_statuses_ARRAY_new', 'arrays', 'Order statuses / New', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_statuses_ARRAY_new');

UPDATE `plugin_base_fields`
SET `type` = 'arrays', `label` = 'Order statuses / New', `source` = 'script'
WHERE `key` = 'order_statuses_ARRAY_new';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_statuses_ARRAY_new' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'New', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'New', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_statuses_ARRAY_pending', 'arrays', 'Order statuses / Pending', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_statuses_ARRAY_pending');

UPDATE `plugin_base_fields`
SET `type` = 'arrays', `label` = 'Order statuses / Pending', `source` = 'script'
WHERE `key` = 'order_statuses_ARRAY_pending';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_statuses_ARRAY_pending' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Pending', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Pending', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_statuses_ARRAY_completed', 'arrays', 'Order statuses / Completed', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_statuses_ARRAY_completed');

UPDATE `plugin_base_fields`
SET `type` = 'arrays', `label` = 'Order statuses / Completed', `source` = 'script'
WHERE `key` = 'order_statuses_ARRAY_completed';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_statuses_ARRAY_completed' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Completed', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Completed', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'order_statuses_ARRAY_cancelled', 'arrays', 'Order statuses / Cancelled', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'order_statuses_ARRAY_cancelled');

UPDATE `plugin_base_fields`
SET `type` = 'arrays', `label` = 'Order statuses / Cancelled', `source` = 'script'
WHERE `key` = 'order_statuses_ARRAY_cancelled';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'order_statuses_ARRAY_cancelled' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Cancelled', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Cancelled', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'payment_methods_ARRAY_cash', 'arrays', 'Payment methods / Cash', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'payment_methods_ARRAY_cash');

UPDATE `plugin_base_fields`
SET `type` = 'arrays', `label` = 'Payment methods / Cash', `source` = 'script'
WHERE `key` = 'payment_methods_ARRAY_cash';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'payment_methods_ARRAY_cash' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Cash', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Cash', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

INSERT INTO `plugin_base_fields` (`id`, `key`, `type`, `label`, `source`, `modified`)
SELECT NULL, 'payment_methods_ARRAY_bank', 'arrays', 'Payment methods / Bank', 'script', '2026-05-23 00:00:00' FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM `plugin_base_fields` WHERE `key` = 'payment_methods_ARRAY_bank');

UPDATE `plugin_base_fields`
SET `type` = 'arrays', `label` = 'Payment methods / Bank', `source` = 'script'
WHERE `key` = 'payment_methods_ARRAY_bank';

SET @field_id := (SELECT `id` FROM `plugin_base_fields` WHERE `key` = 'payment_methods_ARRAY_bank' LIMIT 1);
INSERT INTO `plugin_base_multi_lang` (`id`, `foreign_id`, `model`, `locale`, `field`, `content`, `source`)
SELECT NULL, @field_id, 'pjBaseField', l.`id`, 'title', 'Bank transfer', 'script'
FROM `plugin_base_locale` AS l
WHERE @field_id IS NOT NULL
  AND NOT EXISTS (
    SELECT 1 FROM `plugin_base_multi_lang` AS ml
    WHERE ml.`foreign_id` = @field_id
      AND ml.`model` = 'pjBaseField'
      AND ml.`locale` = l.`id`
      AND ml.`field` = 'title'
  );

UPDATE `plugin_base_multi_lang`
SET `content` = 'Bank transfer', `source` = 'script'
WHERE `foreign_id` = @field_id
  AND `model` = 'pjBaseField'
  AND `field` = 'title';

COMMIT;
