SET @template := 'libraryNewFileToUser';
SET @categoryId := 2;
SET @sorter := IFNULL((SELECT MAX(sorter) FROM ma_Settings WHERE idCategory = @categoryId), -1) + 1;

INSERT INTO `ma_Settings` (`name`, `idCategory`, `fieldType`, `label`, `value`, `options`, `description`, `required`, `system`, `sorter`, `added`, `changed`) VALUES
(CONCAT(@template, 'Header'), @categoryId, 'header', '', 'Library Updates (Vendor Users Notification)', '', '', 'n', 'n', @sorter, NOW(), NOW()),
(CONCAT(@template, 'Subject'), @categoryId, 'text', 'Subject', 'There are new files in the Library', '', '', 'y', 'n', @sorter + 1, NOW(), NOW()),
(CONCAT(@template, 'From'), @categoryId, 'text', 'From Email Address &nbsp; <span class="label_description">If you leave this field empty - the From Email Address will be the same as the one in General Settings.</span>', '', '', '', 'n', 'n', @sorter + 2, NOW(), NOW()),
(CONCAT(@template, 'Body'), @categoryId, 'HtmlEditor', 'Message Body', '<p>There are new files in the <a href="{libraryUrl}">Library</a>: {files}</p>', '', 'Constants: {libraryUrl}, {files}', 'y', 'n', @sorter + 3, NOW(), NOW());

INSERT INTO `ma_SettingsOptions` (`name`, `variable`, `value`, `type`, `sorter`) VALUES (CONCAT(@template, 'Body'), 'mode', 'view', 'string', NULL);
