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'));
# ===== v 5.0.1 =====
UPDATE ConfigurationValues SET VariableValue = 'in-link/links/link_detail' WHERE VariableName = 'l_ItemTemplate';
UPDATE ConfigurationAdmin SET ValueList = 'ReviewText=la_opt_CommentText,CreatedOn=la_opt_CreatedOn'
WHERE VariableName IN ('Link_ReviewsSort', 'Link_ReviewsSort2');
UPDATE ConfigurationAdmin SET ValueList = 'ASC=la_common_Ascending,DESC=la_common_Descending'
WHERE VariableName IN ('Link_ReviewsOrder', 'Link_ReviewsOrder2');
UPDATE ConfigurationAdmin SET ValueList = 'Name=la_Link_Name,Description=la_Link_Description,Url=la_Link_URL,CreatedOn=la_opt_CreatedOn,Hits=la_Link_Hits,CachedRating=la_opt_Rating,<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomField WHERE (Type = 4) AND (IsSystem = 0)</SQL>'
WHERE VariableName IN ('Link_SortField', 'Link_SortField2');
UPDATE ConfigurationAdmin
SET ValueList = '1=la_opt_Sec,60=la_opt_Min,3600=la_opt_Hour,86400=la_opt_Day,604800=la_opt_Week,2419200=la_opt_Month,29030400=la_opt_Year'
WHERE VariableName IN ('link_ReviewDelay_Interval', 'link_RatingDelay_Interval');
UPDATE CustomField SET FieldLabel = 'la_fld_cust_l_ItemTemplate', Prompt = 'la_fld_cust_l_ItemTemplate' WHERE FieldName = 'l_ItemTemplate';
UPDATE Modules SET Path = 'modules/in-link/' WHERE `Name` = 'In-Link';
DELETE FROM ConfigurationValues WHERE VariableName IN ('StartValidationTime', 'LastExpirationTime', 'Link_Root');
UPDATE CustomField
SET ValueList = '=+||<SQL+>SELECT IsoCode AS OptionValue, l%3$s_Name AS OptionName FROM <PREFIX>CountryStates WHERE Type = 2 ORDER BY StateCountryId DESC, IsoCode ASC</SQL>'
WHERE 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>';
UPDATE CustomField
SET ValueList = '=+||<SQL+>SELECT IsoCode AS OptionValue, l%3$s_Name AS OptionName FROM <PREFIX>CountryStates WHERE Type = 1 ORDER BY IsoCode ASC</SQL>'
WHERE ValueList = '=+||<SQL>SELECT DestAbbr AS OptionValue, DestName AS OptionName FROM <PREFIX>StdDestinations WHERE DestType = 1 ORDER BY DestAbbr ASC</SQL>';
DELETE FROM Permissions WHERE Permission LIKE 'in-link:configuration_email%';
WHERE ForeignField = 'PortalUser.Username' AND ModuleName = 'In-Link';
# ===== v 5.2.0-B2 =====
UPDATE Link main_table
SET main_table.CachedReviewsQty = (SELECT COUNT(*) FROM <%TABLE_PREFIX%>CatalogReviews review_table WHERE review_table.ItemId = main_table.ResourceId);
# ===== v 5.2.0-B3 =====
# ===== v 5.2.0-RC1 =====
# ===== v 5.2.0 =====
INSERT INTO Permissions VALUES(DEFAULT, 'in-link:configuration_output.add', 11, 1, 1, 0);
# ===== v 5.2.1-B1 =====
# ===== v 5.2.1-B2 =====
UPDATE Modules
SET ClassNamespace = 'Intechnic\\InPortal\\Modules\\InLink'