Skip to content

Commit ecb8437

Browse files
authored
Merge pull request #1948 from bozana/11260-3_5_0
pkp/pkp-lib#11260 fix return type in getRepresentationDao(), remove flushCache(), fix context abbrev in publication URN
2 parents 9a38b9b + 68215ee commit ecb8437

File tree

5 files changed

+5
-9
lines changed

5 files changed

+5
-9
lines changed

classes/core/Application.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121

2222
use APP\payment\omp\OMPPaymentManager;
2323
use APP\press\PressDAO;
24-
use APP\publicationFormat\PublicationFormatDAO;
2524
use APP\search\MonographSearchDAO;
2625
use APP\search\MonographSearchIndex;
2726
use PKP\context\Context;
2827
use PKP\core\PKPApplication;
28+
use PKP\db\DAO;
2929
use PKP\db\DAORegistry;
3030
use PKP\facades\Locale;
3131
use PKP\submission\RepresentationDAOInterface;
@@ -166,10 +166,8 @@ public static function getContextDAO(): PressDAO
166166

167167
/**
168168
* Get the representation DAO.
169-
*
170-
* @return PublicationFormatDAO|RepresentationDAOInterface
171169
*/
172-
public static function getRepresentationDAO(): RepresentationDAOInterface
170+
public static function getRepresentationDAO(): DAO|RepresentationDAOInterface
173171
{
174172
return DAORegistry::getDAO('PublicationFormatDAO');
175173
}

classes/monograph/ChapterDAO.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ public function changePubId($pubObjectId, $pubIdType, $pubId)
342342
*/
343343
public function deletePubId(int $pubObjectId, string $pubIdType): int
344344
{
345-
$this->flushCache();
346345
return DB::table('submission_chapter_settings')
347346
->where('setting_name', '=', "pub-id::{$pubIdType}")
348347
->where('chapter_id', '=', $pubObjectId)

classes/publicationFormat/PublicationFormatDAO.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ public function changePubId($pubObjectId, $pubIdType, $pubId)
516516
*/
517517
public function deletePubId(int $pubObjectId, string $pubIdType): int
518518
{
519-
$this->flushCache();
520519
return DB::table('publication_format_settings')
521520
->where('setting_name', '=', "pub-id::{$pubIdType}")
522521
->where('publication_format_id', '=', $pubObjectId)
@@ -529,7 +528,6 @@ public function deletePubId(int $pubObjectId, string $pubIdType): int
529528
public function deleteAllPubIds(int $contextId, string $pubIdType): int
530529
{
531530
$formats = $this->getByContextId($contextId);
532-
$this->flushCache();
533531
$affectedRows = 0;
534532
while ($format = $formats->next()) {
535533
$affectedRows += $this->deletePubId($format->getId(), $pubIdType);

plugins/pubIds/urn/URNPubIdPlugin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use APP\plugins\pubIds\urn\classes\form\URNSettingsForm;
2525
use APP\publicationFormat\PublicationFormat;
2626
use APP\template\TemplateManager;
27+
use Illuminate\Support\Str;
2728
use PKP\components\forms\FormComponent;
2829
use PKP\components\forms\publication\PKPPublicationIdentifiersForm;
2930
use PKP\linkAction\LinkAction;
@@ -326,7 +327,7 @@ public function addPublicationFormFields(string $hookName, FormComponent $form):
326327
'value' => $form->publication->getData('pub-id::other::urn'),
327328
'prefix' => $prefix,
328329
'pattern' => $pattern,
329-
'contextInitials' => $form->submissionContext->getData('acronym', $form->submissionContext->getData('primaryLocale')) ?? '',
330+
'contextInitials' => preg_replace('/[^-._;()\/A-Za-z0-9]/', '', Str::lower($form->submissionContext->getData('acronym', $form->submissionContext->getData('primaryLocale')) ?? '')),
330331
'isPForPress' => true,
331332
'submissionId' => $form->publication->getData('submissionId'),
332333
'assignIdLabel' => __('plugins.pubIds.urn.editor.urn.assignUrn'),

0 commit comments

Comments
 (0)