Skip to content

Commit

Permalink
pkp/pkp-lib#10195 allow submissions when a press has no active series
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitlinnewson authored and asmecher committed Aug 8, 2024
1 parent e131ad6 commit 10878cc
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 44 deletions.
31 changes: 6 additions & 25 deletions controllers/grid/settings/series/SeriesGridHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ function deleteSeries($args, $request) {
$activeSeriesCount++;
}
}
if ($activeSeriesCount < 1) {
return new JSONMessage(false, __('manager.series.confirmDeactivateSeries.error'));
return false;
}

$seriesDao->deleteObject($series);
return DAO::getDataChangedEvent($series->getId());
Expand All @@ -284,33 +280,18 @@ function deactivateSeries($args, $request) {

// Get series object
$seriesDao = DAORegistry::getDAO('SeriesDAO'); /* @var $seriesDao SeriesDAO */
// Validate if it can be inactive
$seriesIterator = $seriesDao->getByContextId($context->getId(),null,false);
$activeSeriesCount = 0;
while ($series = $seriesIterator->next()) {
if (!$series->getIsInactive()) {
$activeSeriesCount++;
}
}
if ($activeSeriesCount > 1) {
$series = $seriesDao->getById($seriesId, $context->getId());

if ($request->checkCSRF() && isset($series) && !$series->getIsInactive()) {
$series->setIsInactive(1);
$seriesDao->updateObject($series);
$series = $seriesDao->getById($seriesId, $context->getId());

// Create the notification.
$notificationMgr = new NotificationManager();
$user = $request->getUser();
$notificationMgr->createTrivialNotification($user->getId());
if ($request->checkCSRF() && isset($series) && !$series->getIsInactive()) {
$series->setIsInactive(1);
$seriesDao->updateObject($series);

return DAO::getDataChangedEvent($seriesId);
}
} else {
// Create the notification.
$notificationMgr = new NotificationManager();
$user = $request->getUser();
$notificationMgr->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_ERROR, array('contents' => __('manager.series.confirmDeactivateSeries.error')));
$notificationMgr->createTrivialNotification($user->getId());

return DAO::getDataChangedEvent($seriesId);
}

Expand Down
19 changes: 0 additions & 19 deletions controllers/grid/settings/series/form/SeriesForm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,6 @@ function validate($callHooks = true) {
}
}

// Validate if it can be inactive
if ($this->getData('isInactive')) {
$request = Application::get()->getRequest();
$context = $request->getContext();
$seriesId = $this->getSeriesId();

$seriesDao = DAORegistry::getDAO('SeriesDAO'); /* @var $seriesDao SeriesDAO */
$seriesIterator = $seriesDao->getByContextId($context->getId());
$activeSeriesCount = 0;
while ($series = $seriesIterator->next()) {
if (!$series->getIsInactive() && ($seriesId != $series->getId())) {
$activeSeriesCount++;
}
}
if ($activeSeriesCount < 1 && $this->getData('isInactive')) {
$this->addError('isInactive', __('manager.series.confirmDeactivateSeries.error'));
}
}

return parent::validate($callHooks);
}

Expand Down
102 changes: 102 additions & 0 deletions templates/frontend/pages/submissions.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{**
* templates/frontend/pages/submissions.tpl
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @brief Display the page to view the editorial team.
*
* @uses $currentContext Journal|Press The current press
* @uses $submissionChecklist array List of requirements for submissions
*}
{include file="frontend/components/header.tpl" pageTitle="about.submissions"}

<div class="page page_submissions">
{include file="frontend/components/breadcrumbs.tpl" currentTitleKey="about.submissions"}
<h1>
{translate key="about.submissions"}
</h1>

<div class="cmp_notification">
{if $currentContext->getData('disableSubmissions')}
{translate key="author.submit.notAccepting"}
{else}
{if $isUserLoggedIn}
{capture assign="newSubmission"}<a href="{url page="submission" op="wizard"}">{translate key="about.onlineSubmissions.newSubmission"}</a>{/capture}
{capture assign="viewSubmissions"}<a href="{url page="submissions"}">{translate key="about.onlineSubmissions.viewSubmissions"}</a>{/capture}
{translate key="about.onlineSubmissions.submissionActions" newSubmission=$newSubmission viewSubmissions=$viewSubmissions}
{else}
{capture assign="login"}<a href="{url page="login"}">{translate key="about.onlineSubmissions.login"}</a>{/capture}
{capture assign="register"}<a href="{url page="user" op="register"}">{translate key="about.onlineSubmissions.register"}</a>{/capture}
{translate key="about.onlineSubmissions.registrationRequired" login=$login register=$register}
{/if}
{/if}
</div>

{if $submissionChecklist}
<div class="submission_checklist">
<h2>
{translate key="about.submissionPreparationChecklist"}
{include file="frontend/components/editLink.tpl" page="management" op="settings" path="workflow" anchor="submission/submissionChecklist" sectionTitleKey="about.submissionPreparationChecklist"}
</h2>
{translate key="about.submissionPreparationChecklist.description"}
<ul>
{foreach from=$submissionChecklist item=checklistItem}
<li>
<span class="fa fa-check" aria-hidden="true"></span>
{$checklistItem.content|nl2br}
</li>
{/foreach}
</ul>
</div>
{/if}

{if $currentContext->getLocalizedData('authorGuidelines')}
<div class="author_guidelines" id="authorGuidelines">
<h2>
{translate key="about.authorGuidelines"}
{include file="frontend/components/editLink.tpl" page="management" op="settings" path="workflow" anchor="submission/authorGuidelines" sectionTitleKey="about.authorGuidelines"}
</h2>
{$currentContext->getLocalizedData('authorGuidelines')}
</div>
{/if}

{foreach from=$sections item="section"}
{if $section->getLocalizedPolicy()}
<div class="section_policy">
<h2>{$section->getLocalizedTitle()|escape}</h2>
{$section->getLocalizedPolicy()}
{if $isUserLoggedIn}
{capture assign="sectionSubmissionUrl"}{url page="submission" op="wizard" sectionId=$section->getId()}{/capture}
<p>
{translate key="about.onlineSubmissions.submitToSection" name=$section->getLocalizedTitle()|escape url=$sectionSubmissionUrl}
</p>
{/if}
</div>
{/if}
{/foreach}

{if $currentContext->getLocalizedData('copyrightNotice')}
<div class="copyright_notice">
<h2>
{translate key="about.copyrightNotice"}
{include file="frontend/components/editLink.tpl" page="management" op="settings" path="workflow" anchor="submission/authorGuidelines" sectionTitleKey="about.copyrightNotice"}
</h2>
{$currentContext->getLocalizedData('copyrightNotice')}
</div>
{/if}

{if $currentContext->getLocalizedData('privacyStatement')}
<div class="privacy_statement" id="privacyStatement">
<h2>
{translate key="about.privacyStatement"}
{include file="frontend/components/editLink.tpl" page="management" op="settings" path="website" anchor="setup/privacy" sectionTitleKey="about.privacyStatement"}
</h2>
{$currentContext->getLocalizedData('privacyStatement')}
</div>
{/if}

</div><!-- .page -->

{include file="frontend/components/footer.tpl"}

0 comments on commit 10878cc

Please sign in to comment.