Skip to content

Commit

Permalink
Merge pull request #2 from pkp/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
Vitaliy-1 authored Apr 30, 2018
2 parents 7970375 + bf780e2 commit 99edb70
Show file tree
Hide file tree
Showing 152 changed files with 1,292 additions and 1,304 deletions.
4 changes: 2 additions & 2 deletions api/v1/issues/IssueHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public function getIssueList($slimRequest, $response, $args) {
case 'year':

// Support deprecated `year`, `number` and `volume` params
if (substr($param, -1) === 's') {
$param = substr($param, 0, -1);
if (substr($param, -1) !== 's') {
$param .= 's';
}

if (is_string($val) && strpos($val, ',') > -1) {
Expand Down
20 changes: 4 additions & 16 deletions classes/install/Upgrade.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,6 @@ function rebuildSearchIndex() {
return true;
}

/**
* Clear the data cache files (needed because of direct tinkering
* with settings tables)
* @return boolean
*/
function clearDataCache() {
$cacheManager = CacheManager::getManager();
$cacheManager->flush(null, CACHE_TYPE_FILE);
$cacheManager->flush(null, CACHE_TYPE_OBJECT);
return true;
}

/**
* Clear the CSS cache files (needed when changing LESS files)
* @return boolean
Expand Down Expand Up @@ -2687,7 +2675,7 @@ function migrateSRLocale() {

// Consider issue cover images
// Note that the locale column values are already changed above
$settingValueResult = $journalSettingsDao->retrieve('SELECT a.*, b.journal_id FROM issue_settings a, issues b WHERE a.setting_name = \'coverImage\' AND a.locale = ? AND a.setting_value LIKE ? AND a.setting_type = \'string\' AND b.issue_id = a.issue_id', array($newLocale, '%' .$oldLocale .'%'));
$settingValueResult = $journalSettingsDao->retrieve('SELECT a.*, b.journal_id FROM issue_settings a, issues b WHERE a.setting_name = \'fileName\' AND a.locale = ? AND a.setting_value LIKE ? AND a.setting_type = \'string\' AND b.issue_id = a.issue_id', array($newLocale, '%' .$oldLocale .'%'));
while (!$settingValueResult->EOF) {
$row = $settingValueResult->getRowAssoc(false);
$oldCoverImage = $row['setting_value'];
Expand All @@ -2696,14 +2684,14 @@ function migrateSRLocale() {
$publicFileManager->copyJournalFile($row['journal_id'], $publicFileManager->getContextFilesPath(ASSOC_TYPE_JOURNAL, $row['journal_id']) . '/' . $oldCoverImage, $newCoverImage);
$publicFileManager->removeJournalFile($row['journal_id'], $oldCoverImage);
}
$journalSettingsDao->update('UPDATE issue_settings SET setting_value = ? WHERE issue_id = ? AND setting_name = \'coverImage\' AND locale = ?', array($newCoverImage, (int) $row['issue_id'], $newLocale));
$journalSettingsDao->update('UPDATE issue_settings SET setting_value = ? WHERE issue_id = ? AND setting_name = \'fileName\' AND locale = ?', array($newCoverImage, (int) $row['issue_id'], $newLocale));
$settingValueResult->MoveNext();
}
$settingValueResult->Close();

// Consider article cover images
// Note that the locale column values are already changed above
$settingValueResult = $journalSettingsDao->retrieve('SELECT a.*, b.context_id FROM submission_settings a, submissions b WHERE a.setting_name = \'coverImage\' AND a.locale = ? AND a.setting_value LIKE ? AND a.setting_type = \'string\' AND b.submission_id = a.submission_id', array($newLocale, '%' .$oldLocale .'%'));
$settingValueResult = $journalSettingsDao->retrieve('SELECT a.*, b.context_id FROM submission_settings a, submissions b WHERE a.setting_name = \'fileName\' AND a.locale = ? AND a.setting_value LIKE ? AND a.setting_type = \'string\' AND b.submission_id = a.submission_id', array($newLocale, '%' .$oldLocale .'%'));
while (!$settingValueResult->EOF) {
$row = $settingValueResult->getRowAssoc(false);
$oldCoverImage = $row['setting_value'];
Expand All @@ -2712,7 +2700,7 @@ function migrateSRLocale() {
$publicFileManager->copyJournalFile($row['context_id'], $publicFileManager->getContextFilesPath(ASSOC_TYPE_JOURNAL, $row['context_id']) . '/' . $oldCoverImage, $newCoverImage);
$publicFileManager->removeJournalFile($row['context_id'], $oldCoverImage);
}
$journalSettingsDao->update('UPDATE submission_settings SET setting_value = ? WHERE submission_id = ? AND setting_name = \'coverImage\' AND locale = ?', array($newCoverImage, (int) $row['submission_id'], $newLocale));
$journalSettingsDao->update('UPDATE submission_settings SET setting_value = ? WHERE submission_id = ? AND setting_name = \'fileName\' AND locale = ?', array($newCoverImage, (int) $row['submission_id'], $newLocale));
$settingValueResult->MoveNext();
}
$settingValueResult->Close();
Expand Down
14 changes: 2 additions & 12 deletions classes/subscription/SubscriptionAction.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ function sendOnlinePaymentNotificationEmail($request, $subscription, $mailTempla
$subscriptionTypeDao = DAORegistry::getDAO('SubscriptionTypeDAO');
$subscriptionType = $subscriptionTypeDao->getById($subscription->getTypeId(), $journal->getId());

$roleDao = DAORegistry::getDAO('RoleDAO');
$role = $roleDao->newDataObject();
if ($roleDao->getJournalUsersRoleCount($journal->getId(), ROLE_ID_SUBSCRIPTION_MANAGER) > 0) {
$role->setId(ROLE_ID_SUBSCRIPTION_MANAGER);
$rolePath = $role->getPath();
} else {
$role->setId(ROLE_ID_MANAGER);
$rolePath = $role->getPath();
}

$paramArray = array(
'subscriptionType' => $subscriptionType->getSummaryString(),
'userDetails' => $user->getContactSignature(),
Expand All @@ -67,11 +57,11 @@ function sendOnlinePaymentNotificationEmail($request, $subscription, $mailTempla
switch($mailTemplateKey) {
case 'SUBSCRIPTION_PURCHASE_INDL':
case 'SUBSCRIPTION_RENEW_INDL':
$paramArray['subscriptionUrl'] = $request->url($journal->getPath(), $rolePath, 'editSubscription', 'individual', array($subscription->getId()));
$paramArray['subscriptionUrl'] = $request->url($journal->getPath(), 'payments', null, null, null, 'individual');
break;
case 'SUBSCRIPTION_PURCHASE_INSTL':
case 'SUBSCRIPTION_RENEW_INSTL':
$paramArray['subscriptionUrl'] = $request->url($journal->getPath(), $rolePath, 'editSubscription', 'institutional', array($subscription->getId()));
$paramArray['subscriptionUrl'] = $request->url($journal->getPath(), 'payments', null, null, null, 'institutional');
$paramArray['institutionName'] = $subscription->getInstitutionName();
$paramArray['institutionMailingAddress'] = $subscription->getInstitutionMailingAddress();
$paramArray['domain'] = $subscription->getDomain();
Expand Down
2 changes: 1 addition & 1 deletion classes/subscription/form/SubscriptionPolicyForm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

define('SUBSCRIPTION_OPEN_ACCESS_DELAY_MIN', '1');
define('SUBSCRIPTION_OPEN_ACCESS_DELAY_MAX', '24');
define('SUBSCRIPTION_OPEN_ACCESS_DELAY_MAX', '60');
define('SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_MONTHS_MIN', '1');
define('SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_MONTHS_MAX', '12');
define('SUBSCRIPTION_EXPIRY_REMINDER_BEFORE_WEEKS_MIN', '1');
Expand Down
4 changes: 2 additions & 2 deletions classes/workflow/EditorDecisionActionsManager.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static function _submissionStageDecisions($makeDecision = true) {
)
);
if ($makeDecision) {
$decisions = array_merge($decisions, array(
$decisions = $decisions + array(
SUBMISSION_EDITOR_DECISION_ACCEPT => array(
'name' => 'accept',
'operation' => 'promote',
Expand All @@ -153,7 +153,7 @@ static function _submissionStageDecisions($makeDecision = true) {
'operation' => 'sendReviews',
'title' => 'editor.submission.decision.decline',
),
));
);
}
return $decisions;
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/grid/issues/form/IssueGalleyForm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function __construct($request, $issue, $issueGalley = null) {
$this->addCheck(new FormValidatorCustom(
$this, 'galleyLocale', 'required', 'editor.issues.galleyLocaleRequired',
function($galleyLocale) use ($journal) {
return in_array($galleyLocale, $journal->getSupportedLocaleNames());
return in_array($galleyLocale, $journal->getSupportedLocales());
}
));

Expand Down
29 changes: 0 additions & 29 deletions controllers/grid/users/reviewer/ReviewerGridHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,6 @@ function reviewRead($args, $request) {
}
return parent::reviewRead($args, $request);
}

//
// Overridden methods from PKPHandler
//
/**
* @copydoc PKPHandler::authorize()
*/
function authorize($request, &$args, $roleAssignments) {
$stageId = $request->getUserVar('stageId'); // This is being validated in WorkflowStageAccessPolicy

// Not all actions need a stageId. Some work off the reviewAssignment which has the type and round.
$this->_stageId = (int)$stageId;

// Get the stage access policy
import('lib.pkp.classes.security.authorization.WorkflowStageAccessPolicy');
$ompWorkflowStageAccessPolicy = new WorkflowStageAccessPolicy($request, $args, $roleAssignments, 'submissionId', $stageId);

// Add policy to ensure there is a review round id.
import('lib.pkp.classes.security.authorization.internal.ReviewRoundRequiredPolicy');
$ompWorkflowStageAccessPolicy->addPolicy(new ReviewRoundRequiredPolicy($request, $args, 'reviewRoundId', $this->_getReviewRoundOps()));

// Add policy to ensure there is a review assignment for certain operations.
import('lib.pkp.classes.security.authorization.internal.ReviewAssignmentRequiredPolicy');
$ompWorkflowStageAccessPolicy->addPolicy(new ReviewAssignmentRequiredPolicy($request, $args, 'reviewAssignmentId', $this->_getReviewAssignmentOps()));
$this->addPolicy($ompWorkflowStageAccessPolicy);

return parent::authorize($request, $args, $roleAssignments);
}

}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,33 @@ class OJSPermissionSettingsForm extends PermissionSettingsForm {
function __construct($wizardMode = false) {
parent::__construct(
array(
'enableAuthorSelfArchive' => 'bool',
'authorSelfArchivePolicy' => 'string',
'copyrightYearBasis' => 'string',
),
$wizardMode
);
}

//
// Implement template methods from Form.
//
/**
* @copydoc Form::getLocaleFieldNames
*/
function getLocaleFieldNames() {
return array_merge(parent::getLocaleFieldNames(), array('authorSelfArchivePolicy'));
}

/**
* @copydoc ContextSettingsForm::fetch
*/
function fetch($request, $params = null) {
$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign('scheduledTasksEnabled', (boolean) Config::getVar('general', 'scheduled_tasks'));
return parent::fetch($request, $params);
}

}

?>
4 changes: 2 additions & 2 deletions dbscripts/xml/install.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE install SYSTEM "../../lib/pkp/dtd/install.dtd">
<!--
* install.xml
* dbscripts/xml/install.xml
*
* Copyright (c) 2014-2018 Simon Fraser University
* Copyright (c) 2003-2018 John Willinsky
Expand All @@ -10,7 +10,7 @@
* Installation descriptor file.
-->

<install version="3.1.0.0">
<install version="3.1.1.0">
<code function="checkPhpVersion" />

<code function="createDirectories"/>
Expand Down
11 changes: 8 additions & 3 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE install SYSTEM "../../lib/pkp/dtd/install.dtd">
<!--
* upgrade.xml
* dbscripts/xml/upgrade.xml
*
* Copyright (c) 2014-2018 Simon Fraser University
* Copyright (c) 2003-2018 John Willinsky
Expand All @@ -11,7 +11,7 @@
*
-->

<install version="3.1.0.0">
<install version="3.1.1.0">
<code function="checkPhpVersion" />

<upgrade minversion="2.0.0.0" maxversion="2.3.9.9">
Expand Down Expand Up @@ -83,6 +83,10 @@
<code function="installDefaultNavigationMenus" />
<code function="migrateStaticPagesToNavigationMenuItems" />

<upgrade minversion="2.4.0.0" maxversion="3.1.1.9">
<code function="migrateSRLocale" />
</upgrade>

<upgrade minversion="2.4.0.0" maxversion="2.4.9.9">
<code function="concatenateIntoAbout" />
<code function="concatenateIntoMasthead" />
Expand Down Expand Up @@ -190,12 +194,13 @@
<upgrade minversion="2.4.0.0" maxversion="3.1.0.9">
<data file="dbscripts/xml/upgrade/3.1.1_update.xml" />
<code function="installEmailTemplate" key="REVISED_VERSION_NOTIFY" locales="ar_IQ,da_DK,en_US,es_ES,fa_IR,fi_FI,fr_CA,fr_FR,id_ID,pt_PT,ru_RU,sv_SE" />
<code function="migrateSRLocale" />
<code function="clearDataCache" />
</upgrade>

<upgrade minversion="3.0.0.0" maxversion="3.1.0.9">
<code function="repairSuppFilesFilestage" />
<code function="fixAuthorGroup" /><!-- Run again after previous invalid fix (#3289) -->
<note file="docs/release-notes/README-3.1.1" />
</upgrade>

<!-- update plugin configuration - should be done as the final upgrade task -->
Expand Down
7 changes: 0 additions & 7 deletions dbscripts/xml/upgrade/3.0.0_postupgrade_metrics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
<query>UPDATE metrics SET assoc_type = 531 WHERE assoc_type = 262</query>
</sql>

<!-- update the supp file ids to the new file ids, ASSOC_TYPE_SUBMISSION_FILE_COUNTER_OTHER = 531 -->
<sql>
<query driver="mysql">UPDATE metrics m, submission_file_settings sfs SET m.assoc_id = sfs.file_id WHERE m.assoc_type = 531 AND sfs.setting_name = 'old-supp-id' AND sfs.setting_value = m.assoc_id</query>
<query driver="mysqli">UPDATE metrics m, submission_file_settings sfs SET m.assoc_id = sfs.file_id WHERE m.assoc_type = 531 AND sfs.setting_name = 'old-supp-id' AND sfs.setting_value = m.assoc_id</query>
<query driver="postgres7">UPDATE metrics SET assoc_id = sfs.file_id FROM submission_file_settings sfs WHERE metrics.assoc_type = 531 AND sfs.setting_name = 'old-supp-id' AND CAST(nullif(sfs.setting_value, '') AS integer) = metrics.assoc_id</query>
</sql>

<!-- fill the new metrics columns (assoc_object_type, assoc_object_id, pkp_section_id and representation_id) appropriately: -->
<!-- insert section id for articles, article galleys and files - they all have submission_id in the table -->
<sql>
Expand Down
4 changes: 2 additions & 2 deletions dbscripts/xml/upgrade/3.1.0_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<query>UPDATE review_assignments SET date_response_due = date_due WHERE date_response_due IS NULL</query>
</sql>
<sql><!-- pkp/pkp-lib#2310: Move plugins to unified sidebar upon upgrade -->
<query>UPDATE plugin_settings SET setting_value=1 WHERE setting_name='context' AND plugin_name LIKE '%BlockPlugin'</query><!-- 1 is BLOCK_CONTEXT_SIDEBAR -->
<query>UPDATE plugin_settings SET setting_value=1 WHERE setting_name='context' AND LOWER(plugin_name) LIKE '%blockplugin'</query><!-- 1 is BLOCK_CONTEXT_SIDEBAR -->
</sql>
<sql><!-- pkp/pkp-lib#2151: set viewable = 1 for submission files (migrated from 2.4.x) -->
<query>UPDATE submission_files SET viewable = 1 WHERE file_stage = 2 AND viewable = 0</query><!-- 2 is SUBMISSION_FILE_SUBMISSION -->
Expand Down Expand Up @@ -101,4 +101,4 @@
<sql><!-- pkp/pkp-lib#2873 -->
<query>UPDATE filter_groups SET output_type = 'xml::schema(http://schema.datacite.org/meta/kernel-4/metadata.xsd)' WHERE output_type = 'xml::schema(http://schema.datacite.org/meta/kernel-3/metadata.xsd)'</query>
</sql>
</data>
</data>
6 changes: 3 additions & 3 deletions dbscripts/xml/upgrade/3.1.1_update.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
</sql>
<!-- pkp/pkp-lib#2894 Set 0 review ratings to NULL -->
<sql>
<query>UPDATE review_assignments ra SET ra.quality = NULL WHERE ra.quality = 0</query>
<query>UPDATE review_assignments SET quality = NULL WHERE quality = 0</query>
</sql>
<!-- pkp/pkp-lib#2894 Update old localised user gossip entries -->
<sql>
<query driver="mysql">UPDATE users u, (SELECT user_id, GROUP_CONCAT(DISTINCT setting_value SEPARATOR ' ') AS groupedGossips FROM user_settings WHERE setting_name = 'gossip' AND setting_value &lt;&gt; '' GROUP BY user_id) us SET u.gossip = us.groupedGossips WHERE us.user_id = u.user_id</query>
<query driver="mysqli">UPDATE users u, (SELECT user_id, GROUP_CONCAT(DISTINCT setting_value SEPARATOR ' ') AS groupedGossips FROM user_settings WHERE setting_name = 'gossip' AND setting_value &lt;&gt; '' GROUP BY user_id) us SET u.gossip = us.groupedGossips WHERE us.user_id = u.user_id</query>
<query driver="postgres7">UPDATE users SET citations = us. groupedGossips FROM (SELECT user_id, string_agg(DISTINCT setting_value, ' ') AS groupedGossips FROM user_settings WHERE setting_name = 'gossip' AND setting_value &lt;&gt; '' GROUP BY user_id) AS us WHERE us.user_id = users.user_id</query>
<query>DELETE FROM user_settings WHERE setting_name="gossip"</query>
<query driver="postgres7">UPDATE users SET gossip = us.groupedGossips FROM (SELECT user_id, string_agg(DISTINCT setting_value, ' ') AS groupedGossips FROM user_settings WHERE setting_name = 'gossip' AND setting_value &lt;&gt; '' GROUP BY user_id) AS us WHERE us.user_id = users.user_id</query>
<query>DELETE FROM user_settings WHERE setting_name='gossip'</query>
</sql>
<sql><!-- pkp/pkp-lib#3412 Clean up notifications left over from deleted announcements -->
<query driver="mysql">DELETE n FROM notifications n LEFT JOIN announcements a ON (n.assoc_id = a.announcement_id) WHERE a.announcement_id IS NULL AND n.assoc_type = 522</query><!-- ASSOC_TYPE_ANNOUNCEMENT -->
Expand Down
8 changes: 4 additions & 4 deletions dbscripts/xml/version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<version>
<application>ojs2</application>
<type>core</type>
<release>3.1.0.0</release>
<tag>ojs-3_1_0-0</tag>
<date>2017-10-23</date>
<release>3.1.1.0</release>
<tag>ojs-3_1_1-0</tag>
<date>2018-04-04</date>
<info>http://pkp.sfu.ca/ojs/</info>
<package>http://pkp.sfu.ca/ojs/download/ojs-3.1.0.tar.gz</package>
<package>http://pkp.sfu.ca/ojs/download/ojs-3.1.1.tar.gz</package>
</version>
6 changes: 3 additions & 3 deletions docs/README
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
===================================
=== Open Journal Systems
=== The Public Knowledge Project
=== Version: 3.1.0
=== GIT tag: ojs-3_1_0-0
=== Release date: October 23, 2017
=== Version: 3.1.1
=== GIT tag: ojs-3_1_1-0
=== Release date: April 4, 2018
===================================


Expand Down
Loading

0 comments on commit 99edb70

Please sign in to comment.