Skip to content

Commit

Permalink
pkp/pkp-lib#7165 Issue datePublished can be set when adding an issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnyga committed Aug 17, 2022
1 parent a180b09 commit 5b7c374
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
6 changes: 5 additions & 1 deletion classes/controllers/grid/issues/IssueGridHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,11 @@ public function publishIssue($args, $request)
}

$issue->setPublished(1);
$issue->setDatePublished(Core::getCurrentDate());

// If no datePublished was given, use current date
if (!$issue->getData('datePublished')) {
$issue->setDatePublished(Core::getCurrentDate());
}

// If subscriptions with delayed open access are enabled then
// update open access date according to open access delay policy
Expand Down
8 changes: 4 additions & 4 deletions controllers/grid/issues/IssueGridRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ public function initialize($request, $template = null)
$dispatcher = $request->getDispatcher();
$this->addAction(
new LinkAction(
$issue->getDatePublished() ? 'viewIssue' : 'previewIssue',
$issue->getPublished() ? 'viewIssue' : 'previewIssue',
new OpenWindowAction(
$dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'issue', 'view', [$issueId])
),
__($issue->getDatePublished() ? 'grid.action.viewIssue' : 'grid.action.previewIssue'),
__($issue->getPublished() ? 'grid.action.viewIssue' : 'grid.action.previewIssue'),
'information'
)
);

if ($issue->getDatePublished()) {
if ($issue->getPublished()) {
$this->addAction(
new LinkAction(
'unpublish',
Expand Down Expand Up @@ -109,7 +109,7 @@ public function initialize($request, $template = null)

$currentIssue = Repo::issue()->getCurrent($issue->getJournalId());
$isCurrentIssue = $currentIssue != null && $issue->getId() == $currentIssue->getId();
if ($issue->getDatePublished() && !$isCurrentIssue) {
if ($issue->getPublished() && !$isCurrentIssue) {
$this->addAction(
new LinkAction(
'setCurrentIssue',
Expand Down
2 changes: 1 addition & 1 deletion controllers/grid/issues/form/IssueForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function execute(...$functionArgs)
$issue->setVolume(empty($volume) ? null : $volume);
$issue->setNumber(empty($number) ? null : $number);
$issue->setYear(empty($year) ? null : $year);
if (!$isNewIssue) {
if ($this->getData('datePublished')) {
$issue->setDatePublished($this->getData('datePublished'));
}
$issue->setDescription($this->getData('description'), null); // Localized
Expand Down
3 changes: 3 additions & 0 deletions locale/en_US/editor.po
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ msgstr "Unpublished"
msgid "editor.issues.datePublished"
msgstr "Date Published"

msgid "editor.issues.datePublished.notPublished.description"
msgstr "If no date is given, the date of publishing will be used"

msgid "editor.issues.volumeRequired"
msgstr "Volume is required and must be a positive, numeric value."

Expand Down
5 changes: 2 additions & 3 deletions templates/controllers/grid/issues/form/issueForm.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,15 @@
{assign var=issuePublished value=false}
{/if}

{if $issuePublished}
{fbvFormArea id="datePublishedArea" title="editor.issues.datePublished"}
{fbvFormSection}
{if $issuePublished}
{fbvElement type="text" id="datePublished" value=$datePublished size=$fbvStyles.size.SMALL class="datepicker"}
{else}
{fbvElement type="text" id="datePublished" value=$datePublished size=$fbvStyles.size.SMALL class="datepicker" label="editor.issues.datePublished.notPublished.description"}
{/if}
{/fbvFormSection}
{/fbvFormArea}
{/if}


{fbvFormArea id="identificationArea" title="editor.issues.identification"}
{fbvFormSection}
Expand Down

0 comments on commit 5b7c374

Please sign in to comment.