Skip to content

Commit

Permalink
pkp#5885 Review remainder update
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Jan 11, 2024
1 parent fc42763 commit 6d005d7
Show file tree
Hide file tree
Showing 14 changed files with 520 additions and 107 deletions.
46 changes: 38 additions & 8 deletions classes/components/forms/context/PKPReviewSetupForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,46 @@ public function __construct($action, $locales, $context)
]));

if (Config::getVar('general', 'scheduled_tasks')) {
$this->addField(new FieldText('numDaysBeforeInviteReminder', [
'label' => __('manager.setup.reviewOptions.reminders.response'),
'description' => __('manager.setup.reviewOptions.reminders.response.description'),
'value' => $context->getData('numDaysBeforeInviteReminder'),
'size' => 'small',
]))
->addField(new FieldText('numDaysBeforeSubmitReminder', [
// $this->addField(new FieldText('numDaysBeforeInviteReminder', [
// 'label' => __('manager.setup.reviewOptions.reminders.response'),
// 'description' => __('manager.setup.reviewOptions.reminders.response.description'),
// 'value' => $context->getData('numDaysBeforeInviteReminder'),
// 'size' => 'small',
// ]))
// ->addField(new FieldText('numDaysBeforeSubmitReminder', [
// 'label' => __('manager.setup.reviewOptions.reminders.submit'),
// 'description' => __('manager.setup.reviewOptions.reminders.submit.description'),
// 'value' => $context->getData('numDaysBeforeSubmitReminder'),
// 'size' => 'small',
// ]));

$this
->addField(new FieldHTML('reviewRequestResponseRemainder', [
'label' => __('manager.setup.reviewOptions.reminders.response'),
'description' => __('manager.setup.reviewOptions.reminders.response.description'),
]))
->addField(new FieldText('numDaysBeforeReviewResponseReminderDue', [
'description' => __('manager.setup.reviewOptions.reminders.response.description.before'),
'value' => $context->getData('numDaysBeforeReviewResponseReminderDue'),
'size' => 'small',
]))
->addField(new FieldText('numDaysAfterReviewResponseReminderDue', [
'description' => __('manager.setup.reviewOptions.reminders.response.description.after'),
'value' => $context->getData('numDaysAfterReviewResponseReminderDue'),
'size' => 'small',
]))
->addField(new FieldHTML('submissionReviewResponseRemainder', [
'label' => __('manager.setup.reviewOptions.reminders.submit'),
'description' => __('manager.setup.reviewOptions.reminders.submit.description'),
'value' => $context->getData('numDaysBeforeSubmitReminder'),
]))
->addField(new FieldText('numDaysBeforeReviewSubmitReminderDue', [
'description' => __('manager.setup.reviewOptions.reminders.submit.description.before'),
'value' => $context->getData('numDaysBeforeReviewSubmitReminderDue'),
'size' => 'small',
]))
->addField(new FieldText('numDaysAfterReviewSubmitReminderDue', [
'description' => __('manager.setup.reviewOptions.reminders.submit.description.after'),
'value' => $context->getData('numDaysAfterReviewSubmitReminderDue'),
'size' => 'small',
]));
} else {
Expand Down
46 changes: 46 additions & 0 deletions classes/form/validation/FormValidatorDateCompare.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* @file classes/form/validation/FormValidatorDateCompare.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class FormValidatorDateCompare
*
* @ingroup form_validation
*
* @see FormValidator
*
* @brief Form validation to validation comparison rule for a date field
*/

namespace PKP\form\validation;

use PKP\validation\ValidatorDateConparison;
use Carbon\Carbon;
use DateTimeInterface;

class FormValidatorDateCompare extends FormValidator
{
/**
* Constructor.
*
* @param \PKP\form\Form $form the associated form
* @param string $field the name of the associated field
* @param DateTimeInterface|Carbon $comparingDate the comparing date
* @param string $comparingRule the comparing rule e.g. equal/greater/lesser/...
* @param string $type the type of check, either "required" or "optional"
* @param string $message the error message for validation failures (i18n key)
*/
public function __construct(&$form, $field, $comparingDate, $comparingRule, $type = 'optional', $message = 'email.invalid')
{
$validator = new ValidatorDateConparison($comparingDate, $comparingRule);
parent::__construct($form, $field, $type, $message, $validator);
}
}

if (!PKP_STRICT_MODE) {
class_alias('\PKP\form\validation\FormValidatorDateCompare', '\FormValidatorDateCompare');
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@
namespace PKP\jats\exceptions;

use Exception;
use Throwable;

class UnableToCreateJATSContentException extends Exception
{

public function __construct(public ?Exception $innerException = null)
public function __construct(public ?Throwable $innerException = null)
{
parent::__construct(__('publication.jats.defaultContentCreationError'), null, $innerException);
parent::__construct(
__('publication.jats.defaultContentCreationError'),
$innerException?->getCode() ?? 0,
$innerException
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

/**
* @file classes/migration/upgrade/v3_5_0/I5885_RenameReviewRemainderSettingsName.php
*
* Copyright (c) 2014-2024 Simon Fraser University
* Copyright (c) 2000-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class I5885_RenameReviewRemainderColumns
*
* @brief Rename the review remainder settings name
*/

namespace PKP\migration\upgrade\v3_5_0;

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use PKP\migration\Migration;

abstract class I5885_RenameReviewRemainderSettingsName extends Migration
{
abstract protected function getContextSettingsTable(): string;

/**
* Run the migration.
*/
public function up(): void
{
DB::table($this->getContextSettingsTable())
->select(['setting_name'])
->where('setting_name', 'numDaysBeforeInviteReminder')
->update([
'setting_name' => 'numDaysAfterReviewResponseReminderDue'
]);

DB::table($this->getContextSettingsTable())
->select(['setting_name'])
->where('setting_name', 'numDaysBeforeSubmitReminder')
->update([
'setting_name' => 'numDaysAfterReviewSubmitReminderDue'
]);
}

/**
* Reverse the migration
*/
public function down(): void
{
DB::table($this->getContextSettingsTable())
->select(['setting_name'])
->where('setting_name', 'numDaysAfterReviewResponseReminderDue')
->update([
'setting_name' => 'numDaysBeforeInviteReminder'
]);

DB::table($this->getContextSettingsTable())
->select(['setting_name'])
->where('setting_name', 'numDaysAfterReviewSubmitReminderDue')
->update([
'setting_name' => 'numDaysBeforeSubmitReminder'
]);
}
}
Loading

0 comments on commit 6d005d7

Please sign in to comment.