# ===== v 4.3.9 =====
INSERT INTO Events VALUES (DEFAULT, 'LINK.VALIDATION.RESULTS', NULL, 1, 0, 'In-Link', 'la_event_link.validation.results', 1);

INSERT INTO ImportScripts VALUES (DEFAULT, 'Links from CSV file [In-Link]', '', 'l', 'In-Link', '', 'CSV', '1');

UPDATE CustomField
SET ValueList = '=+||<SQL>SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM <PREFIX>StdDestinations WHERE DestType = 2 AND (DestParentId = 225 OR DestParentId = 38) ORDER BY DestParentId DESC, DestAbbr ASC</SQL>'
WHERE FieldName = 'LinkState';

UPDATE CustomField
SET ValueList = '=+||<SQL>SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM <PREFIX>StdDestinations WHERE DestType = 1 ORDER BY DestAbbr ASC</SQL>'
WHERE FieldName = 'LinkCountry';

# ===== v 5.0.0 =====
INSERT INTO Counters VALUES (DEFAULT, 'linkhits_count', 'SELECT ROUND(SUM(Hits)) FROM <%PREFIX%>Link', NULL, NULL, '300', '0', '|Link|');
UPDATE Category SET Template = '/in-link/designs/section' WHERE Template = 'inlink/index';
UPDATE Category SET CachedTemplate = '/in-link/designs/section' WHERE CachedTemplate = 'inlink/index';

UPDATE ConfigurationValues SET VariableValue = '/in-link/designs/section' WHERE VariableName = 'l_CategoryTemplate';
UPDATE ConfigurationValues SET VariableValue = 'in-link/designs/detail' WHERE VariableName = 'l_ItemTemplate';

INSERT INTO Permissions VALUES (DEFAULT, 'in-link:links.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-link:setting_folder.view', 11, 1, 1, 0);
DELETE FROM Permissions WHERE Permission LIKE 'in-link:inlink_general.%';

UPDATE Events SET Description = 'la_event_link.owner.modify' WHERE  Description = 'la_event_link.modify.modify';
UPDATE Events SET Description = 'la_event_link.owner.modify.pending' WHERE  Description = 'la_event_link.modify.modify.pending';

UPDATE Phrase SET Module = 'In-Link' WHERE ((Phrase LIKE '%Links%' OR Phrase LIKE '%Listing%') AND (Module = 'Core') AND Phrase NOT IN ('la_section_QuickLinks'));

UPDATE Phrase SET Module = 'In-Link', PhraseType = 1 WHERE ( (Phrase LIKE '%Validation%' OR Phrase LIKE 'la_title_In-Link') AND (Module = 'Core') AND Phrase NOT IN ('la_ValidationEmail', 'la_prompt_validation'));
