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 12, 2024
1 parent d054715 commit 05672bb
Show file tree
Hide file tree
Showing 59 changed files with 95 additions and 322 deletions.
44 changes: 9 additions & 35 deletions controllers/grid/settings/series/SeriesGridHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @file controllers/grid/settings/series/SeriesGridHandler.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2024 Simon Fraser University
* Copyright (c) 2003-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class SeriesGridHandler
Expand Down Expand Up @@ -292,19 +292,6 @@ public function deleteSeries($args, $request)
return new JSONMessage(false, __('manager.sections.alertDelete'));
}

$activeSectionsCount = Repo::section()->getCollector()
->filterByContextIds([$press->getId()])
->excludeInactive()
->getCount();

$activeSectionsCount = (!$series->getIsInactive())
? $activeSectionsCount - 1
: $activeSectionsCount;

if ($activeSectionsCount < 1) {
return new JSONMessage(false, __('manager.series.confirmDeactivateSeries.error'));
}

Repo::section()->delete($series);

return DAO::getDataChangedEvent($series->getId());
Expand All @@ -327,29 +314,16 @@ public function deactivateSeries($args, $request)
$context = $request->getContext();

// Validate if it can be inactive
$activeSeriesCount = Repo::section()
->getCollector()
->filterByContextIds([$context->getId()])
->excludeInactive()
->getCount();
if ($activeSeriesCount > 1) {
$series = Repo::section()->get($seriesId, $context->getId());
if ($request->checkCSRF() && isset($series) && !$series->getIsInactive()) {
$series->setIsInactive(1);
Repo::section()->edit($series, []);

// Create the notification.
$notificationMgr = new NotificationManager();
$user = $request->getUser();
$notificationMgr->createTrivialNotification($user->getId());

return DAO::getDataChangedEvent($seriesId);
}
} else {
$series = Repo::section()->get($seriesId, $context->getId());
if ($request->checkCSRF() && isset($series) && !$series->getIsInactive()) {
$series->setIsInactive(1);
Repo::section()->edit($series, []);

// Create the notification.
$notificationMgr = new NotificationManager();
$user = $request->getUser();
$notificationMgr->createTrivialNotification($user->getId(), Notification::NOTIFICATION_TYPE_ERROR, ['contents' => __('manager.series.confirmDeactivateSeries.error')]);
$notificationMgr->createTrivialNotification($user->getId());

return DAO::getDataChangedEvent($seriesId);
}

Expand Down
23 changes: 2 additions & 21 deletions controllers/grid/settings/series/form/SeriesForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @file controllers/grid/settings/series/form/SeriesForm.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2024 Simon Fraser University
* Copyright (c) 2003-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class SeriesForm
Expand Down Expand Up @@ -140,25 +140,6 @@ public function validate($callHooks = true)
}
}

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

$activeSeries = Repo::section()
->getCollector()
->filterByContextIds([$context->getId()])
->excludeInactive()
->getMany();
$otherActiveSeries = $activeSeries->filter(function ($activeSection) use ($seriesId) {
return $activeSection->getId() != $seriesId;
});
if ($otherActiveSeries->count() < 1) {
$this->addError('isInactive', __('manager.series.confirmDeactivateSeries.error'));
}
}

return parent::validate($callHooks);
}

Expand Down
5 changes: 0 additions & 5 deletions locale/ca/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ msgid "manager.series.restricted"
msgstr ""
"No permetre que els autors/ores facin trameses directament a aquesta sèrie."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""
"Com a mínim ha d'estar activa una sèrie. Visiteu la configuració del flux de "
"treball per desactivar totes les trameses a aquesta editorial."

msgid "manager.payment.generalOptions"
msgstr "Opcions generals"

Expand Down
3 changes: 0 additions & 3 deletions locale/ca/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,6 @@ msgstr ""
msgid "submission.wizard.notAllowed.description"
msgstr ""

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""

msgid "submission.wizard.sectionClosed.message"
msgstr ""

Expand Down
3 changes: 0 additions & 3 deletions locale/ckb/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ msgstr "ناونیشانی زنجیرە"
msgid "manager.series.restricted"
msgstr "ڕێگا بە نوسەران مەدە کە بە ڕاستەوخۆیی بۆ ئەم زنجیرەیە پێشکەش بکەن."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""

msgid "manager.payment.generalOptions"
msgstr "بژاردە گشتییەکان"

Expand Down
3 changes: 0 additions & 3 deletions locale/ckb/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,6 @@ msgstr ""
msgid "submission.wizard.notAllowed.description"
msgstr ""

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""

msgid "submission.wizard.sectionClosed.message"
msgstr ""

Expand Down
5 changes: 0 additions & 5 deletions locale/cs/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ msgstr "Název série"
msgid "manager.series.restricted"
msgstr "Neumožnit autorům zasílat příspěvky přímo do této série."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""
"Alespoň jedna série musí být aktivní. Navštivte nastavení pracovního postupu "
"a zakažte všechna odesílání do tohoto tisku."

msgid "manager.payment.generalOptions"
msgstr "Obecné možnosti"

Expand Down
7 changes: 0 additions & 7 deletions locale/cs/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -581,13 +581,6 @@ msgstr ""
"redakcí zaregistrováni. Pokud se domníváte, že se jedná o chybu, kontaktujte "
"prosím <a href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""
"Do tohoto tisku nemůžete přispívat, protože zasílání příspěvků do všech "
"sekcí tohoto vydavatelství bylo deaktivováno nebo omezeno. Pokud se "
"domníváte, že se jedná o chybu, kontaktujte prosím <a href='mailto:"
"{$email}'>{$name}</a>."

msgid "submission.wizard.sectionClosed.message"
msgstr ""
"{$contextName} nepřijímá příspěvky do seriálu {$section}. Pokud potřebujete "
Expand Down
5 changes: 0 additions & 5 deletions locale/da/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ msgstr "Serietitel"
msgid "manager.series.restricted"
msgstr "Tillad ikke forfattere at sende direkte til denne serie."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""
"Mindst én serie skal være aktiv. Gå til workflow-indstillingerne for at "
"deaktivere alle indsendelser til denne udgiver."

msgid "manager.payment.generalOptions"
msgstr "Generelle indstillinger"

Expand Down
7 changes: 0 additions & 7 deletions locale/da/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -602,13 +602,6 @@ msgstr ""
"forfattere skal registreres først af redaktionen. Hvis du mener, dette er en "
"fejl, så kontakt venligst <a href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""
"Du har ikke lov til at indsende et manuskript til denne udgiver, idet "
"indsendelser til alle sektioner hos denne udgiver er blevet deaktiveret "
"eller begrænset. Hvis du mener, dette er en fejl, så kontakt venligst <a "
"href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.sectionClosed.message"
msgstr ""
"{$contextName} accepterer ikke indsendelser til {$section}-serien. Hvis du "
Expand Down
5 changes: 0 additions & 5 deletions locale/de/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ msgstr "Reihentitel"
msgid "manager.series.restricted"
msgstr "Verbieten Sie Autor/innen, direkt bei dieser Reihe einzureichen."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""
"Mindestens eine Reihe muss aktiv sein. Gehen Sie zu den Workflow-"
"Einstellungen um alle Einreichungen zu diesem Verlag zu deaktivieren."

msgid "manager.payment.generalOptions"
msgstr "Allgemeine Optionen"

Expand Down
7 changes: 0 additions & 7 deletions locale/de/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -616,13 +616,6 @@ msgstr ""
"der Redaktion registriert werden müssen. Wenn Sie glauben, dass dies ein "
"Fehler ist, wenden Sie sich bitte an <a href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""
"Sie können keine Beiträge in dieser Zeitschrift einreichen, da Einreichungen "
"für alle Reihen dieses Verlags deaktiviert oder restriktiert sind. Wenn Sie "
"glauben, dass dies ein Fehler ist, wenden Sie sich bitte an <a "
"href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.sectionClosed.message"
msgstr ""
"{$contextName} akzeptiert keine Einreichungen für die Sektion {$section}. "
Expand Down
3 changes: 0 additions & 3 deletions locale/el/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ msgstr "Τίλτος Σειράς"
msgid "manager.series.restricted"
msgstr ""

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""

msgid "manager.payment.generalOptions"
msgstr ""

Expand Down
3 changes: 0 additions & 3 deletions locale/el/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,6 @@ msgstr ""
msgid "submission.wizard.notAllowed.description"
msgstr ""

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""

msgid "submission.wizard.sectionClosed.message"
msgstr ""

Expand Down
3 changes: 0 additions & 3 deletions locale/en/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ msgstr "Don't allow authors to submit directly to this series."
msgid "manager.sections.alertDelete"
msgstr "Before this series can be deleted, you must move associated submissions with this series to other series."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr "At least one series must be active. Visit the workflow settings to disable all submissions to this press."

msgid "manager.payment.generalOptions"
msgstr "General Options"

Expand Down
6 changes: 0 additions & 6 deletions locale/en/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,6 @@ msgstr ""
"registered by the editorial staff. If you believe this is an error, please "
"contact <a href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""
"You are not allowed to submit to this press because submissions to all "
"sections of this press have been deactivated or restricted. If you believe "
"this is an error, please contact <a href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.sectionClosed.message"
msgstr ""
"{$contextName} is not accepting submissions to the {$section} series. If you "
Expand Down
5 changes: 0 additions & 5 deletions locale/es/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ msgstr "Título de la colección"
msgid "manager.series.restricted"
msgstr "No permitir que los autores/as envíen directamente a esta serie."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""
"Debe estar activa como mínimo una serie. Visite los ajustes del flujo de "
"trabajo para deshabilitar todos los envíos a la editorial."

msgid "manager.payment.generalOptions"
msgstr "Opciones generales"

Expand Down
7 changes: 0 additions & 7 deletions locale/es/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,6 @@ msgstr ""
"sido registrados por el equipo editorial. Si cree que se trata de un error, "
"póngase en contacto con <a href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""
"No puede enviar artículos a esta editorial porque los envíos a todas las "
"secciones de esta editorial han sido desactivados o restringidos. Si cree "
"que se trata de un error, póngase en contacto con <a "
"href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.sectionClosed.message"
msgstr ""
"{$contextName} no acepta envíos a la colección {$section}. Si necesita ayuda "
Expand Down
5 changes: 0 additions & 5 deletions locale/fi/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ msgid "manager.series.restricted"
msgstr ""
"Älä salli kirjoittajien lähettää käsikirjoituksia suoraan tähän sarjaan."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""
"Vähintään yhden sarjan tulee olla käytössä. Käy työnkulun asetuksissa "
"estämässä käsikirjoitusten lähettäminen tälle julkaisijalle."

msgid "manager.payment.generalOptions"
msgstr "Yleiset valinnat"

Expand Down
6 changes: 0 additions & 6 deletions locale/fi/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -580,12 +580,6 @@ msgstr ""
"toimituskunta voi rekisteröidä uusia kirjoittajia. Jos arvioit tämän olevan "
"virhe, otathan yhteyttä <a href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""
"Et voi lähettää käsikirjoitusta tälle julkaisijalle, koska kaikki julkaisun "
"sarjat ovat pois käytöstä tai rajoitettuja. Jos arvelet, että ilmoitus on "
"virheellinen, otathan yhteyttä <a href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.sectionClosed.message"
msgstr ""
"{$contextName} ei vastaanota käsikirjoituksia sarjaan {$section}. Jos "
Expand Down
3 changes: 0 additions & 3 deletions locale/fr_CA/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ msgstr "Titre de la série"
msgid "manager.series.restricted"
msgstr "Restreint"

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""

msgid "manager.payment.generalOptions"
msgstr ""

Expand Down
3 changes: 0 additions & 3 deletions locale/fr_CA/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,6 @@ msgstr ""
msgid "submission.wizard.notAllowed.description"
msgstr ""

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""

msgid "submission.wizard.sectionClosed.message"
msgstr ""

Expand Down
5 changes: 0 additions & 5 deletions locale/fr_FR/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -825,11 +825,6 @@ msgstr ""
"Ne pas autoriser les auteur·e·s à soumettre directement leurs textes à cette "
"collection."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""
"Au moins une collection doit être active. Visitez les paramètres du flux de "
"travaux pour désactiver toutes les soumissions à cette maison d’édition."

msgid "manager.payment.generalOptions"
msgstr "Options générales"

Expand Down
6 changes: 0 additions & 6 deletions locale/fr_FR/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,6 @@ msgstr ""
"agit selon vous d’une erreur, veuillez contacter <a "
"href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""
"Vous n’êtes pas autorisé(e) à soumettre à cette maison d’édition parce que "
"les soumissions ont été désactivées ou restreintes. S’il s’agit selon vous d’"
"une erreur, veuillez contacter <a href='mailto:{$email}'>{$name}</a>."

msgid "submission.wizard.sectionClosed.message"
msgstr ""
"{$contextName} n’accepte pas de soumissions à la collection {$section}. Si "
Expand Down
3 changes: 0 additions & 3 deletions locale/gd/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,6 @@ msgstr ""
msgid "submission.wizard.notAllowed.description"
msgstr ""

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""

msgid "submission.wizard.sectionClosed.message"
msgstr ""

Expand Down
5 changes: 0 additions & 5 deletions locale/gl/manager.po
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ msgstr "Título da colección"
msgid "manager.series.restricted"
msgstr "Non permitir aos autores enviar directamente a esta colección."

msgid "manager.series.confirmDeactivateSeries.error"
msgstr ""
"Polo menos unha serie debe estar activa. Visita a configuración do fluxo de "
"traballo para desactivar todos os envíos a esta editorial."

msgid "manager.payment.generalOptions"
msgstr "Opcións xerais"

Expand Down
3 changes: 0 additions & 3 deletions locale/gl/submission.po
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,6 @@ msgstr ""
msgid "submission.wizard.notAllowed.description"
msgstr ""

msgid "submission.wizard.noSectionAllowed.description"
msgstr ""

msgid "submission.wizard.sectionClosed.message"
msgstr ""

Expand Down
Loading

0 comments on commit 05672bb

Please sign in to comment.