<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data SYSTEM "../../../lib/pkp/dtd/xmlData.dtd">

<!--
  * 2.3.0_update.xml
  *
  * Copyright (c) 2013-2016 Simon Fraser University Library
  * Copyright (c) 2003-2016 John Willinsky
  * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
  *
  * 2.3.0 database updates XML file.
  *
  -->
<data>
	<!-- Bug #3861: Add email templates. -->
	<sql>
		<query>INSERT INTO email_templates_default (email_key, can_edit, can_disable, from_role_id, to_role_id) VALUES ('EDITOR_DECISION_ACCEPT', 1, 0, 512, 65536)</query>
		<query>INSERT INTO email_templates_default (email_key, can_edit, can_disable, from_role_id, to_role_id) VALUES ('EDITOR_DECISION_REVISIONS', 1, 0, 512, 65536)</query>
		<query>INSERT INTO email_templates_default (email_key, can_edit, can_disable, from_role_id, to_role_id) VALUES ('EDITOR_DECISION_RESUBMIT', 1, 0, 512, 65536)</query>
		<query>INSERT INTO email_templates_default (email_key, can_edit, can_disable, from_role_id, to_role_id) VALUES ('EDITOR_DECISION_DECLINE', 1, 0, 512, 65536)</query>
		<query>INSERT INTO email_templates_default_data (locale, email_key, subject, body, description) VALUES ('en_US', 'EDITOR_DECISION_ACCEPT', 'Editor Decision', '{$authorName}:\n\nWe have reached a decision regarding your submission to {$journalTitle}, \"{$articleTitle}\".\n\nOur decision is to:\n\n{$editorialContactSignature}\n', 'This email from the Editor or Section Editor to an Author notifies them of a final decision regarding their submission.')</query>
		<query>INSERT INTO email_templates_default_data (locale, email_key, subject, body, description) VALUES ('en_US', 'EDITOR_DECISION_REVISIONS', 'Editor Decision', '{$authorName}:\n\nWe have reached a decision regarding your submission to {$journalTitle}, \"{$articleTitle}\".\n\nOur decision is to:\n\n{$editorialContactSignature}\n', 'This email from the Editor or Section Editor to an Author notifies them of a final decision regarding their submission.')</query>
		<query>INSERT INTO email_templates_default_data (locale, email_key, subject, body, description) VALUES ('en_US', 'EDITOR_DECISION_RESUBMIT', 'Editor Decision', '{$authorName}:\n\nWe have reached a decision regarding your submission to {$journalTitle}, \"{$articleTitle}\".\n\nOur decision is to:\n\n{$editorialContactSignature}\n', 'This email from the Editor or Section Editor to an Author notifies them of a final decision regarding their submission.')</query>
		<query>INSERT INTO email_templates_default_data (locale, email_key, subject, body, description) VALUES ('en_US', 'EDITOR_DECISION_DECLINE', 'Editor Decision', '{$authorName}:\n\nWe have reached a decision regarding your submission to {$journalTitle}, \"{$articleTitle}\".\n\nOur decision is to:\n\n{$editorialContactSignature}\n', 'This email from the Editor or Section Editor to an Author notifies them of a final decision regarding their submission.')</query>
	</sql>

	<!-- Bug #4664: abstract announcements -->
	<sql>
		<query>UPDATE announcements SET assoc_type = 256</query><!-- ASSOC_TYPE_JOURNAL -->
		<query>UPDATE announcement_types SET assoc_type = 256</query><!-- ASSOC_TYPE_CONFERENCE -->
	</sql>

	<!-- Bug #3941: abstract groups -->
	<sql>
		<query>UPDATE groups SET assoc_type = 256</query><!-- ASSOC_TYPE_JOURNAL -->
	</sql>

	<!-- Bug #4153: abstract email templates -->
	<sql>
		<query>UPDATE email_templates SET assoc_type = 256</query><!-- ASSOC_TYPE_JOURNAL -->
		<query>UPDATE email_templates_data SET assoc_type = 256</query><!-- ASSOC_TYPE_JOURNAL -->
	</sql>

	<!-- Bug #3694: abstract user settings -->
	<sql>
		<query>UPDATE user_settings SET assoc_type = 256</query><!-- ASSOC_TYPE_JOURNAL -->
	</sql>

	<!-- Bug #3922# No need for the notification_status table (it is encapsulated by the notification table) -->
	<sql>
		<query>INSERT INTO notification_subscription_settings (setting_name, setting_value, user_id, context, setting_type)
		SELECT 'emailed_notification', 268435477, ns.user_id, ns.journal_id, 'int' FROM notification_status ns</query><!-- NOTIFICATION_TYPE_PUBLISHED_ISSUE -->
		<drop table="notification_status" />
	</sql>

	<!-- Bug #3916: Separate out individual and institutional subscriptions.
	     Drop temp tables now that data has been migrated to new tables. -->
	<sql>
		<drop table="subscriptions_old" />
	</sql>

	<!-- Bug #1709: Upgrade enableSubscriptions setting to publishingMode -->
	<sql>
		<query>UPDATE journal_settings SET setting_name = 'publishingMode', setting_type = 'int' WHERE setting_name = 'enableSubscriptions'</query>
	</sql>
	
	<!-- Bug #4812: Add product name/type to pre-2.3.0 OJS versions so they appear in history -->
	<sql>
		<query>UPDATE versions SET product_type = 'core', product = 'ojs2' WHERE product_type IS NULL AND product IS NULL</query>
	</sql>
</data>
