Jordan Savant // Software Engineer

INSERT INTO `acme_widgetlist` (widgetlist) VALUES ('Reunion - Advocacy - Recipients - List');

DROP PROCEDURE IF EXISTS `procedure_foo`;

DELIMITER $$

CREATE PROCEDURE `procedure_foo`()
BEGIN
    DECLARE last_id INTEGER;

    SELECT id INTO last_id FROM `acme_widgetlist` WHERE `widgetlist` = 'Reunion - Advocacy - Recipients - List';

    INSERT INTO `acme_widgetlist_item` (`item`, `display_name`, `widgetlist_id`, `is_active`, `the_order`, `access_level`, `type_id`, `is_searchable`, `field`) VALUES
        ('alert_name', 'Name', last_id, 1, 1, 0, 1, 1, 'advocacy_capwiz_alert.alert_title');

    INSERT INTO `acme_widgetlist_item` (`item`, `display_name`, `widgetlist_id`, `is_active`, `the_order`, `access_level`, `type_id`, `is_searchable`, `field`) VALUES
        ('recipient_full_description', 'Recipient', last_id, 1, 2, 0, 1, 1, 'cms_form_completed_advocacy_letter_recipients.recipient_full_description');

    INSERT INTO `acme_widgetlist_item` (`item`, `display_name`, `widgetlist_id`, `is_active`, `the_order`, `access_level`, `type_id`, `is_searchable`, `field`) VALUES
        ('created_at', 'Created At', last_id, 1, 3, 0, 3, 1, 'cms_form_completed_advocacy_letter.created_at');

    INSERT INTO `acme_widgetlist_item` (`item`, `display_name`, `widgetlist_id`, `is_active`, `the_order`, `access_level`, `type_id`, `is_searchable`, `field`) VALUES
        ('delivery_method', 'Delivery Method', last_id, 1, 4, 0, 1, 0, '');

    INSERT INTO `acme_widgetlist_item` (`item`, `display_name`, `widgetlist_id`, `is_active`, `the_order`, `access_level`, `type_id`, `is_searchable`, `field`) VALUES
        ('form_title', 'Form Name', last_id, 1, 5, 0, 1, 1, 'cms_forms.title');

    INSERT INTO `acme_widgetlist_item` (`item`, `display_name`, `widgetlist_id`, `is_active`, `the_order`, `access_level`, `type_id`, `is_searchable`, `field`) VALUES
        ('package_name', 'Package Name', last_id, 1, 6, 0, 1, 1, 'bb_package.name');

    INSERT INTO `acme_widgetlist_item` (`item`, `display_name`, `widgetlist_id`, `is_active`, `the_order`, `access_level`, `type_id`, `is_searchable`, `field`) VALUES
        ('package_subject', 'Package Subject', last_id, 1, 7, 0, 1, 1, 'bb_package.description');

    INSERT INTO `acme_widgetlist_item` (`item`, `display_name`, `widgetlist_id`, `is_active`, `the_order`, `access_level`, `type_id`, `is_searchable`, `field`) VALUES
        ('export', '', last_id, 1, 8, 0, 1, 0, '');

END

$$

delimiter ;


CALL procedure_foo();

DROP PROCEDURE procedure_foo;