Skip to content

pkp/pkp-lib#11260 fix return type in getRepresentationDao(), remove flushCache(), fix context abbrev in publication URN #1948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions classes/core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

use APP\payment\omp\OMPPaymentManager;
use APP\press\PressDAO;
use APP\publicationFormat\PublicationFormatDAO;
use APP\search\MonographSearchDAO;
use APP\search\MonographSearchIndex;
use PKP\context\Context;
use PKP\core\PKPApplication;
use PKP\db\DAO;
use PKP\db\DAORegistry;
use PKP\facades\Locale;
use PKP\submission\RepresentationDAOInterface;
Expand Down Expand Up @@ -166,10 +166,8 @@ public static function getContextDAO(): PressDAO

/**
* Get the representation DAO.
*
* @return PublicationFormatDAO|RepresentationDAOInterface
*/
public static function getRepresentationDAO(): RepresentationDAOInterface
public static function getRepresentationDAO(): DAO|RepresentationDAOInterface
{
return DAORegistry::getDAO('PublicationFormatDAO');
}
Expand Down
1 change: 0 additions & 1 deletion classes/monograph/ChapterDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ public function changePubId($pubObjectId, $pubIdType, $pubId)
*/
public function deletePubId(int $pubObjectId, string $pubIdType): int
{
$this->flushCache();
return DB::table('submission_chapter_settings')
->where('setting_name', '=', "pub-id::{$pubIdType}")
->where('chapter_id', '=', $pubObjectId)
Expand Down
2 changes: 0 additions & 2 deletions classes/publicationFormat/PublicationFormatDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ public function changePubId($pubObjectId, $pubIdType, $pubId)
*/
public function deletePubId(int $pubObjectId, string $pubIdType): int
{
$this->flushCache();
return DB::table('publication_format_settings')
->where('setting_name', '=', "pub-id::{$pubIdType}")
->where('publication_format_id', '=', $pubObjectId)
Expand All @@ -529,7 +528,6 @@ public function deletePubId(int $pubObjectId, string $pubIdType): int
public function deleteAllPubIds(int $contextId, string $pubIdType): int
{
$formats = $this->getByContextId($contextId);
$this->flushCache();
$affectedRows = 0;
while ($format = $formats->next()) {
$affectedRows += $this->deletePubId($format->getId(), $pubIdType);
Expand Down
3 changes: 2 additions & 1 deletion plugins/pubIds/urn/URNPubIdPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use APP\plugins\pubIds\urn\classes\form\URNSettingsForm;
use APP\publicationFormat\PublicationFormat;
use APP\template\TemplateManager;
use Illuminate\Support\Str;
use PKP\components\forms\FormComponent;
use PKP\components\forms\publication\PKPPublicationIdentifiersForm;
use PKP\linkAction\LinkAction;
Expand Down Expand Up @@ -326,7 +327,7 @@ public function addPublicationFormFields(string $hookName, FormComponent $form):
'value' => $form->publication->getData('pub-id::other::urn'),
'prefix' => $prefix,
'pattern' => $pattern,
'contextInitials' => $form->submissionContext->getData('acronym', $form->submissionContext->getData('primaryLocale')) ?? '',
'contextInitials' => preg_replace('/[^-._;()\/A-Za-z0-9]/', '', Str::lower($form->submissionContext->getData('acronym', $form->submissionContext->getData('primaryLocale')) ?? '')),
'isPForPress' => true,
'submissionId' => $form->publication->getData('submissionId'),
'assignIdLabel' => __('plugins.pubIds.urn.editor.urn.assignUrn'),
Expand Down