-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9896 from touhidurabir/i4789_main_update
#4789 Due date fields added for declined review request resending
- Loading branch information
Showing
5 changed files
with
125 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
controllers/grid/users/reviewer/form/traits/HasReviewDueDate.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
/** | ||
* @file controllers/grid/users/reviewer/form/traits/HasReviewDueDate.php | ||
* | ||
* Copyright (c) 2024 Simon Fraser University | ||
* Copyright (c) 2024 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
* | ||
* @class HasReviewDueDate | ||
* | ||
* @brief Helper trait to get the review submit and/or response due dates | ||
*/ | ||
|
||
namespace PKP\controllers\grid\users\reviewer\form\traits; | ||
|
||
use Carbon\Carbon; | ||
use PKP\context\Context; | ||
|
||
trait HasReviewDueDate | ||
{ | ||
public const REVIEW_SUBMIT_DEFAULT_DUE_WEEKS = 4; | ||
public const REVIEW_RESPONSE_DEFAULT_DUE_WEEKS = 3; | ||
|
||
/** | ||
* Get the review submit due dates | ||
*/ | ||
public function getReviewSubmitDueDate(Context $context): Carbon | ||
{ | ||
$numWeeks = (int) $context->getData('numWeeksPerReview'); | ||
|
||
if ($numWeeks <= 0) { | ||
$numWeeks = static::REVIEW_SUBMIT_DEFAULT_DUE_WEEKS; | ||
} | ||
|
||
return Carbon::today()->endOfDay()->addWeeks($numWeeks); | ||
} | ||
|
||
/** | ||
* Get the review response due dates | ||
*/ | ||
public function getReviewResponseDueDate(Context $context): Carbon | ||
{ | ||
$numWeeks = (int) $context->getData('numWeeksPerResponse'); | ||
|
||
if ($numWeeks <= 0) { | ||
$numWeeks = static::REVIEW_RESPONSE_DEFAULT_DUE_WEEKS; | ||
} | ||
|
||
return Carbon::today()->endOfDay()->addWeeks($numWeeks); | ||
} | ||
|
||
/** | ||
* Get the review submit and response due dates | ||
*/ | ||
public function getDueDates(Context $context): array | ||
{ | ||
return [ | ||
$this->getReviewSubmitDueDate($context)->getTimestamp(), | ||
$this->getReviewResponseDueDate($context)->getTimestamp(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters