diff --git a/api/v1/_email/PKPEmailHandler.inc.php b/api/v1/_email/PKPEmailHandler.inc.php index 494593ad067..32f4d5df5cc 100644 --- a/api/v1/_email/PKPEmailHandler.inc.php +++ b/api/v1/_email/PKPEmailHandler.inc.php @@ -27,7 +27,7 @@ class PKPEmailHandler extends APIHandler { - /** Number of emails to send in each job */ + /** @var int Number of emails to send in each job */ public const EMAILS_PER_JOB = 100; /** diff --git a/api/v1/_library/PKPLibraryHandler.inc.php b/api/v1/_library/PKPLibraryHandler.inc.php new file mode 100644 index 00000000000..475237b8a69 --- /dev/null +++ b/api/v1/_library/PKPLibraryHandler.inc.php @@ -0,0 +1,145 @@ +_handlerPath = '_library'; + $this->_endpoints = [ + 'GET' => [ + [ + 'pattern' => $this->getEndpointPattern(), + 'handler' => [$this, 'getLibrary'], + 'roles' => [Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR], + ], + ], + ]; + parent::__construct(); + + } + + /** + * @copydoc PKPHandler::authorize + */ + public function authorize($request, &$args, $roleAssignments) + { + $rolePolicy = new PolicySet(PolicySet::COMBINING_PERMIT_OVERRIDES); + + foreach ($roleAssignments as $role => $operations) { + $rolePolicy->addPolicy(new RoleBasedHandlerOperationPolicy($request, $role, $operations)); + } + $this->addPolicy($rolePolicy); + + if ($request->getUserVar('includeSubmissionId')) { + $this->addPolicy(new SubmissionAccessPolicy($request, $args, $roleAssignments, 'includeSubmissionId')); + } + + return parent::authorize($request, $args, $roleAssignments); + } + + /** + * Get a list of all files in the library + * + * @param array $args arguments + * + * @return APIResponse + */ + public function getLibrary(ServerRequestInterface $slimRequest, APIResponse $response, array $args) + { + /** @var LibraryFileDAO $libraryFileDao */ + $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + $context = $this->getRequest()->getContext(); + $contextId = $context->getId(); + $libraryFileManager = new LibraryFileManager($contextId); + + $files = []; + + $params = $slimRequest->getQueryParams(); + if (isset($params['includeSubmissionId'])) { + /** @var DAOResultFactory $result */ + $result = $libraryFileDao->getBySubmissionId($submission->getId()); + /** @var LibraryFile $file */ + while ($file = $result->next()) { + $files[] = $this->fileToResponse($file, $libraryFileManager); + } + } + + /** @var DAOResultFactory $result */ + $result = $libraryFileDao->getByContextId($contextId); + /** @var LibraryFile $file */ + while ($file = $result->next()) { + $files[] = $this->fileToResponse($file, $libraryFileManager); + } + + return $response->withJson([ + 'items' => $files, + 'itemsMax' => count($files), + ], 200); + } + + /** + * Convert a file object to the JSON response object + */ + protected function fileToResponse(LibraryFile $file, LibraryFileManager $libraryFileManager): array + { + $request = Application::get()->getRequest(); + + $urlArgs = [ + 'libraryFileId' => $file->getId(), + ]; + if ($file->getSubmissionId()) { + $urlArgs['submissionId'] = $file->getSubmissionId(); + } + + return [ + 'id' => $file->getId(), + 'filename' => $file->getServerFileName(), + 'name' => $file->getName(null), + 'mimetype' => $file->getFileType(), + 'documentType' => Services::get('file')->getDocumentType($file->getFileType()), + 'submissionId' => $file->getSubmissionId() ?? 0, + 'type' => $file->getType(), + 'typeName' => __($libraryFileManager->getTitleKeyFromType($file->getType())), + 'url' => $request->getDispatcher()->url( + $request, + Application::ROUTE_COMPONENT, + null, + 'api.file.FileApiHandler', + 'downloadLibraryFile', + null, + $urlArgs + ), + ]; + } +} diff --git a/api/v1/_payments/PKPBackendPaymentsSettingsHandler.inc.php b/api/v1/_payments/PKPBackendPaymentsSettingsHandler.inc.php index 1580c442ff4..5fe6ab48385 100644 --- a/api/v1/_payments/PKPBackendPaymentsSettingsHandler.inc.php +++ b/api/v1/_payments/PKPBackendPaymentsSettingsHandler.inc.php @@ -63,8 +63,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Receive requests to edit the payments form * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * * @return Response */ diff --git a/api/v1/_submissions/PKPBackendSubmissionsHandler.inc.php b/api/v1/_submissions/PKPBackendSubmissionsHandler.inc.php index 5dfd74f10a5..1da352a59a9 100644 --- a/api/v1/_submissions/PKPBackendSubmissionsHandler.inc.php +++ b/api/v1/_submissions/PKPBackendSubmissionsHandler.inc.php @@ -22,8 +22,9 @@ use PKP\plugins\HookRegistry; use PKP\security\authorization\ContextAccessPolicy; - +use PKP\security\authorization\SubmissionAccessPolicy; use PKP\security\Role; +use Slim\Http\Response; abstract class PKPBackendSubmissionsHandler extends APIHandler { @@ -72,14 +73,20 @@ public function __construct() public function authorize($request, &$args, $roleAssignments) { $this->addPolicy(new ContextAccessPolicy($request, $roleAssignments)); + + $routeName = $this->getSlimRequest()->getAttribute('route')->getName(); + if (in_array($routeName, ['delete'])) { + $this->addPolicy(new SubmissionAccessPolicy($request, $args, $roleAssignments)); + } + return parent::authorize($request, $args, $roleAssignments); } /** * Get a collection of submissions * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -114,9 +121,13 @@ public function getMany($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($context->getId())->toArray(); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($context->getId())->toArray(); + return $response->withJson([ 'itemsMax' => Repo::submission()->getCount($collector->limit(null)->offset(null)), - 'items' => Repo::submission()->getSchemaMap()->mapManyToSubmissionsList($submissions, $userGroups), + 'items' => Repo::submission()->getSchemaMap()->mapManyToSubmissionsList($submissions, $userGroups, $genres), ], 200); } @@ -165,7 +176,7 @@ protected function getSubmissionCollector(array $queryParams): Collector case 'assignedTo': $val = array_map('intval', $this->paramToArray($val)); - if ($val == [-1]) { + if ($val == [\PKP\submission\Collector::UNASSIGNED]) { $val = array_shift($val); } $collector->assignedTo($val); @@ -203,8 +214,8 @@ protected function getSubmissionCollector(array $queryParams): Collector /** * Delete a submission * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response diff --git a/api/v1/_uploadPublicFile/PKPUploadPublicFileHandler.inc.php b/api/v1/_uploadPublicFile/PKPUploadPublicFileHandler.inc.php index 47d8214b759..858ee4d13e4 100644 --- a/api/v1/_uploadPublicFile/PKPUploadPublicFileHandler.inc.php +++ b/api/v1/_uploadPublicFile/PKPUploadPublicFileHandler.inc.php @@ -66,7 +66,7 @@ public function authorize($request, &$args, $roleAssignments) * A helper method which adds the necessary response headers to allow * file uploads * - * @param $response Response object + * @param Response $response object * * @return Response */ @@ -78,9 +78,9 @@ private function getResponse($response) /** * Upload a requested file * - * @param $slimRequest Request Slim request object - * @param $response Response object - * @param $args array arguments + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments * * @return Response */ @@ -198,9 +198,9 @@ public function uploadFile($slimRequest, $response, $args) * Respond affirmatively to a HTTP OPTIONS request with headers which allow * file uploads * - * @param $slimRequest Request Slim request object - * @param $response Response object - * @param $args array arguments + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments * * @return Response */ diff --git a/api/v1/announcements/PKPAnnouncementHandler.inc.php b/api/v1/announcements/PKPAnnouncementHandler.inc.php index 847de941f14..095f53d09cb 100644 --- a/api/v1/announcements/PKPAnnouncementHandler.inc.php +++ b/api/v1/announcements/PKPAnnouncementHandler.inc.php @@ -16,7 +16,10 @@ use APP\core\Application; use APP\facades\Repo; +use APP\notification\Notification; +use PKP\db\DAORegistry; use PKP\handler\APIHandler; +use PKP\notification\managerDelegate\AnnouncementNotificationManager; use PKP\plugins\HookRegistry; use PKP\security\authorization\PolicySet; use PKP\security\authorization\RoleBasedHandlerOperationPolicy; @@ -94,8 +97,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Get a single submission * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -119,8 +122,8 @@ public function get($slimRequest, $response, $args) /** * Get a collection of announcements * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -165,8 +168,8 @@ public function getMany($slimRequest, $response, $args) /** * Add an announcement * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -195,14 +198,31 @@ public function add($slimRequest, $response, $args) $id = Repo::announcement()->add($announcement); $announcement = Repo::announcement()->get($id); + if(filter_var($params['sendEmail'], FILTER_VALIDATE_BOOLEAN)){ + import('lib.pkp.classes.notification.managerDelegate.AnnouncementNotificationManager'); + $announcementNotificationManager = new AnnouncementNotificationManager(Notification::NOTIFICATION_TYPE_NEW_ANNOUNCEMENT); + $announcementNotificationManager->initialize($announcement); + + $notificationSubscriptionSettingsDao = DAORegistry::getDAO('NotificationSubscriptionSettingsDAO'); /** @var NotificationSubscriptionSettingsDAO $notificationSubscriptionSettingsDao */ + $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ + $allUsers = $userGroupDao->getUsersByContextId($request->getContext()->getId()); + while ($user = $allUsers->next()) { + if ($user->getDisabled()) continue; + $blockedEmails = $notificationSubscriptionSettingsDao->getNotificationSubscriptionSettings('blocked_emailed_notification', $user->getId(), $request->getContext()->getId()); + if (!in_array(Notification::NOTIFICATION_TYPE_NEW_ANNOUNCEMENT, $blockedEmails)) { + $announcementNotificationManager->notify($user); + } + } + } + return $response->withJson(Repo::announcement()->getSchemaMap()->map($announcement), 200); } /** * Edit an announcement * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -249,8 +269,8 @@ public function edit($slimRequest, $response, $args) /** * Delete an announcement * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response diff --git a/api/v1/contexts/PKPContextHandler.inc.php b/api/v1/contexts/PKPContextHandler.inc.php index 31013f5cd73..738c4863e67 100644 --- a/api/v1/contexts/PKPContextHandler.inc.php +++ b/api/v1/contexts/PKPContextHandler.inc.php @@ -99,9 +99,9 @@ public function authorize($request, &$args, $roleAssignments) /** * Get a collection of contexts * - * @param $slimRequest Request Slim request object - * @param $response Response object - * @param $args array arguments + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments * * @return Response */ @@ -172,8 +172,8 @@ public function getMany($slimRequest, $response, $args) /** * Get a single context * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -218,8 +218,8 @@ public function get($slimRequest, $response, $args) /** * Get the theme and any theme options for a context * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -279,8 +279,8 @@ public function getTheme($slimRequest, $response, $args) /** * Add a context * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -331,8 +331,8 @@ public function add($slimRequest, $response, $args) /** * Edit a context * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -392,8 +392,8 @@ public function edit($slimRequest, $response, $args) /** * Edit a context's theme and theme options * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -492,8 +492,8 @@ public function editTheme($slimRequest, $response, $args) /** * Delete a context * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response diff --git a/api/v1/emailTemplates/PKPEmailTemplateHandler.inc.php b/api/v1/emailTemplates/PKPEmailTemplateHandler.inc.php index 71543f92bcf..25a1081a93d 100644 --- a/api/v1/emailTemplates/PKPEmailTemplateHandler.inc.php +++ b/api/v1/emailTemplates/PKPEmailTemplateHandler.inc.php @@ -1,6 +1,6 @@ $this->getEndpointPattern(), 'handler' => [$this, 'getMany'], - 'roles' => $roles, + 'roles' => array_merge($roles, [Role::ROLE_ID_SUB_EDITOR, ROLE::ROLE_ID_ASSISTANT]), ], [ 'pattern' => $this->getEndpointPattern() . '/{key}', 'handler' => [$this, 'get'], - 'roles' => $roles, + 'roles' => array_merge($roles, [Role::ROLE_ID_SUB_EDITOR, ROLE::ROLE_ID_ASSISTANT]), ], ], 'POST' => [ @@ -151,8 +151,8 @@ public function getMany(SlimRequest $slimRequest, Response $response, array $arg /** * Get a single email template * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -173,8 +173,8 @@ public function get($slimRequest, $response, $args) /** * Add an email template * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -208,8 +208,8 @@ public function add($slimRequest, $response, $args) /** * Edit an email template * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -264,8 +264,8 @@ public function edit($slimRequest, $response, $args) /** * Delete an email template * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -291,8 +291,8 @@ public function delete($slimRequest, $response, $args) /** * Restore defaults in the email template settings * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response diff --git a/api/v1/site/PKPSiteHandler.inc.php b/api/v1/site/PKPSiteHandler.inc.php index a3ece976bf2..76306ce195f 100644 --- a/api/v1/site/PKPSiteHandler.inc.php +++ b/api/v1/site/PKPSiteHandler.inc.php @@ -79,8 +79,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Get the site * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -100,8 +100,8 @@ public function get($slimRequest, $response, $args) /** * Get the active theme on the site * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -136,8 +136,8 @@ public function getTheme($slimRequest, $response, $args) /** * Edit the site * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -168,8 +168,8 @@ public function edit($slimRequest, $response, $args) /** * Edit the active theme and theme options on the site * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response diff --git a/api/v1/stats/editorial/PKPStatsEditorialHandler.inc.php b/api/v1/stats/editorial/PKPStatsEditorialHandler.inc.php index cea07eae0e7..9f905cec9dd 100644 --- a/api/v1/stats/editorial/PKPStatsEditorialHandler.inc.php +++ b/api/v1/stats/editorial/PKPStatsEditorialHandler.inc.php @@ -69,9 +69,9 @@ public function authorize($request, &$args, $roleAssignments) * Returns information on submissions received, accepted, declined, * average response times and more. * - * @param $slimRequest Request Slim request object - * @param $response object Response - * @param $args array + * @param Request $slimRequest Slim request object + * @param object $response Response + * @param array $args * * @return object Response */ @@ -126,9 +126,9 @@ function ($item) { * Returns information on average submissions received, accepted * and declined per year. * - * @param $slimRequest Request Slim request object - * @param $response object Response - * @param $args array + * @param Request $slimRequest Slim request object + * @param object $response Response + * @param array $args * * @return object Response */ diff --git a/api/v1/stats/publications/PKPStatsPublicationHandler.inc.php b/api/v1/stats/publications/PKPStatsPublicationHandler.inc.php index 522bea87b2f..45d73656561 100644 --- a/api/v1/stats/publications/PKPStatsPublicationHandler.inc.php +++ b/api/v1/stats/publications/PKPStatsPublicationHandler.inc.php @@ -105,9 +105,9 @@ public function authorize($request, &$args, $roleAssignments) * Returns total views by abstract, all galleys, pdf galleys, * html galleys, and other galleys. * - * @param $slimRequest Request Slim request object - * @param $response object Response - * @param $args array + * @param Request $slimRequest Slim request object + * @param object $response Response + * @param array $args * * @return object Response */ @@ -238,9 +238,9 @@ public function getMany($slimRequest, $response, $args) * Get the total abstract views for a set of publications * in a timeline broken down month or day * - * @param $slimRequest Request Slim request object - * @param $response object Response - * @param $args array + * @param Request $slimRequest Slim request object + * @param object $response Response + * @param array $args * * @return object Response */ @@ -303,9 +303,9 @@ public function getManyAbstract($slimRequest, $response, $args) * Get the total galley views for a set of publications * in a timeline broken down month or day * - * @param $slimRequest Request Slim request object - * @param $response object Response - * @param $args array + * @param Request $slimRequest Slim request object + * @param object $response Response + * @param array $args * * @return object Response */ @@ -367,9 +367,9 @@ public function getManyGalley($slimRequest, $response, $args) /** * Get a single publication's usage statistics * - * @param $slimRequest object Request Slim request - * @param $response object Response - * @param $args array + * @param object $slimRequest Request Slim request + * @param object $response Response + * @param array $args * * @return object Response */ @@ -430,9 +430,9 @@ public function get($slimRequest, $response, $args) * Get the total abstract views for a set of publications broken down by * month or day * - * @param $slimRequest Request Slim request object - * @param $response object Response - * @param $args array + * @param Request $slimRequest Slim request object + * @param object $response Response + * @param array $args * * @return object Response */ @@ -483,9 +483,9 @@ public function getAbstract($slimRequest, $response, $args) * Get the total galley views for a publication broken down by * month or day * - * @param $slimRequest Request Slim request object - * @param $response object Response - * @param $args array + * @param Request $slimRequest Slim request object + * @param object $response Response + * @param array $args * * @return object Response */ diff --git a/api/v1/stats/users/PKPStatsUserHandler.inc.php b/api/v1/stats/users/PKPStatsUserHandler.inc.php index c03cbcca535..063a78ca4e3 100644 --- a/api/v1/stats/users/PKPStatsUserHandler.inc.php +++ b/api/v1/stats/users/PKPStatsUserHandler.inc.php @@ -63,9 +63,9 @@ public function authorize($request, &$args, $roleAssignments) * * Returns the count of users broken down by roles * - * @param $slimRequest Request Slim request object - * @param $response object Response - * @param $args array + * @param Request $slimRequest Slim request object + * @param object $response Response + * @param array $args * * @return object Response */ diff --git a/api/v1/submissions/PKPSubmissionFileHandler.inc.php b/api/v1/submissions/PKPSubmissionFileHandler.inc.php index 35a2317579f..25eb078a584 100644 --- a/api/v1/submissions/PKPSubmissionFileHandler.inc.php +++ b/api/v1/submissions/PKPSubmissionFileHandler.inc.php @@ -14,7 +14,10 @@ * */ +use APP\core\Application; +use APP\core\Services; use APP\facades\Repo; +use PKP\db\DAORegistry; use PKP\file\FileManager; use PKP\handler\APIHandler; use PKP\security\authorization\ContextAccessPolicy; @@ -23,6 +26,8 @@ use PKP\security\authorization\SubmissionFileAccessPolicy; use PKP\security\Role; use PKP\services\PKPSchemaService; +use PKP\submission\GenreDAO; +use PKP\submission\reviewRound\ReviewRoundDAO; use PKP\submissionFile\SubmissionFile; class PKPSubmissionFileHandler extends APIHandler @@ -59,6 +64,11 @@ public function __construct() 'handler' => [$this, 'edit'], 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_AUTHOR], ], + [ + 'pattern' => $this->getEndpointPattern() . '/{submissionFileId:\d+}/copy', + 'handler' => [$this, 'copy'], + 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR], + ], ], 'DELETE' => [ [ @@ -155,7 +165,7 @@ public function getMany($slimRequest, $response, $args) // Set the allowed file stages based on stage assignment // @see PKP\submissionFile\Repository::getAssignedFileStages() for excluded file stages if ($stageAssignments) { - $allowedFileStages = Repo::submissionFiles() + $allowedFileStages = Repo::submissionFile() ->getAssignedFileStages( $stageAssignments, SubmissionFileAccessPolicy::SUBMISSION_FILE_ACCESS_READ @@ -198,7 +208,7 @@ public function getMany($slimRequest, $response, $args) } } - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds( [$submission->getId()] @@ -206,15 +216,15 @@ public function getMany($slimRequest, $response, $args) ->filterByReviewRoundIds($allowedReviewRoundIds) ->filterByFileStages($allowedFileStages); - $files = Repo::submissionFiles()->getMany($collector); + $files = Repo::submissionFile()->getMany($collector); - $items = Repo::submissionFiles() + $items = Repo::submissionFile() ->getSchemaMap() - ->summarizeMany($files); + ->summarizeMany($files, $this->getFileGenres()); $data = [ 'itemsMax' => $files->count(), - 'items' => $items, + 'items' => $items->values(), ]; return $response->withJson($data, 200); @@ -233,9 +243,9 @@ public function get($slimRequest, $response, $args) { $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); - $data = Repo::submissionFiles() + $data = Repo::submissionFile() ->getSchemaMap() - ->map($submissionFile); + ->map($submissionFile, $this->getFileGenres()); return $response->withJson($data, 200); } @@ -265,7 +275,7 @@ public function add($slimRequest, $response, $args) $fileManager = new FileManager(); $extension = $fileManager->parseFileExtension($_FILES['file']['name']); - $submissionDir = Repo::submissionFiles() + $submissionDir = Repo::submissionFile() ->getSubmissionDir( $request->getContext()->getId(), $submission->getId() @@ -297,7 +307,7 @@ public function add($slimRequest, $response, $args) } } - $errors = Repo::submissionFiles() + $errors = Repo::submissionFile() ->validate( null, $params, @@ -342,18 +352,18 @@ public function add($slimRequest, $response, $args) } } - $submissionFile = Repo::submissionFiles() + $submissionFile = Repo::submissionFile() ->newDataObject($params); - $submissionFileId = Repo::submissionFiles() + $submissionFileId = Repo::submissionFile() ->add($submissionFile); - $submissionFile = Repo::submissionFiles() + $submissionFile = Repo::submissionFile() ->get($submissionFileId); - $data = Repo::submissionFiles() + $data = Repo::submissionFile() ->getSchemaMap() - ->map($submissionFile); + ->map($submissionFile, $this->getFileGenres()); return $response->withJson($data, 200); } @@ -385,7 +395,7 @@ public function edit($slimRequest, $response, $args) $primaryLocale = $request->getContext()->getPrimaryLocale(); $allowedLocales = $request->getContext()->getData('supportedSubmissionLocales'); - $errors = Repo::submissionFiles() + $errors = Repo::submissionFile() ->validate( $submissionFile, $params, @@ -405,7 +415,7 @@ public function edit($slimRequest, $response, $args) $fileManager = new FileManager(); $extension = $fileManager->parseFileExtension($_FILES['file']['name']); - $submissionDir = Repo::submissionFiles() + $submissionDir = Repo::submissionFile() ->getSubmissionDir( $request->getContext()->getId(), $submission->getId() @@ -422,18 +432,87 @@ public function edit($slimRequest, $response, $args) } } - Repo::submissionFiles() + Repo::submissionFile() ->edit( $submissionFile, $params ); - $submissionFile = Repo::submissionFiles() + $submissionFile = Repo::submissionFile() ->get($submissionFile->getId()); - $data = Repo::submissionFiles() + $data = Repo::submissionFile() ->getSchemaMap() - ->map($submissionFile); + ->map($submissionFile, $this->getFileGenres()); + + return $response->withJson($data, 200); + } + + /** + * Copy a submission file to another file stage + * + * @param \Slim\Http\Request $slimRequest + * @param APIResponse $response + * @param array $args arguments + * + * @return Response + */ + public function copy($slimRequest, $response, $args) + { + $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); + $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); + + $params = $slimRequest->getParsedBody(); + if (empty($params['toFileStage'])) { + return $response->withStatus(400)->withJsonError('api.submissionFiles.400.noFileStageId'); + } + + $toFileStage = (int) $params['toFileStage']; + + if (!in_array($toFileStage, Repo::submissionFile()->getFileStages())) { + return $response->withStatus(400)->withJsonError('api.submissionFiles.400.invalidFileStage'); + } + + // Expect a review round id when copying to a review stage, or use the latest + // round in that stage by default + $reviewRoundId = null; + if (in_array($toFileStage, Repo::submissionFile()->reviewFileStages)) { + if (!empty($params['reviewRoundId'])) { + $reviewRoundId = (int) $params['reviewRoundId']; + /** @var ReviewRoundDAO $reviewRoundDao */ + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); + $reviewRound = $reviewRoundDao->getById($reviewRoundId); + if (!$reviewRound || $reviewRound->getSubmissionId() != $submission->getId()) { + return $response->withStatus(400)->withJsonError('api.submissionFiles.400.reviewRoundSubmissionNotMatch'); + } + } else { + // Use the latest review round of the appropriate stage + $stageId = in_array($toFileStage, SubmissionFile::INTERNAL_REVIEW_STAGES) + ? WORKFLOW_STAGE_ID_INTERNAL_REVIEW + : WORKFLOW_STAGE_ID_EXTERNAL_REVIEW; + /** @var ReviewRoundDAO $reviewRoundDao */ + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); + $reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId); + if ($reviewRound) { + $reviewRoundId = $reviewRound->getId(); + } + } + if ($reviewRoundId === null) { + return $response->withStatus(400)->withJsonError('api.submissionFiles.400.reviewRoundIdRequired'); + } + } + + $newSubmissionFileId = Repo::submissionFile()->copy( + $submissionFile, + $toFileStage, + $reviewRoundId + ); + + $newSubmissionFile = Repo::submissionFile()->get($newSubmissionFileId); + + $data = Repo::submissionFile() + ->getSchemaMap() + ->map($newSubmissionFile, $this->getFileGenres()); return $response->withJson($data, 200); } @@ -451,15 +530,27 @@ public function delete($slimRequest, $response, $args) { $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); - $data = Repo::submissionFiles() + $data = Repo::submissionFile() ->getSchemaMap() - ->map($submissionFile); + ->map($submissionFile, $this->getFileGenres()); - Repo::submissionFiles()->delete($submissionFile); + Repo::submissionFile()->delete($submissionFile); return $response->withJson($data, 200); } + /** + * Helper method to get the file genres for the current context + * + * @return Genre[] + */ + protected function getFileGenres(): array + { + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + return $genreDao->getByContextId($this->getRequest()->getContext()->getId())->toArray(); + } + /** * Helper method to get the appropriate response when an error * has occurred during a file upload diff --git a/api/v1/submissions/PKPSubmissionHandler.inc.php b/api/v1/submissions/PKPSubmissionHandler.inc.php index b888c0165f2..05505be8d13 100644 --- a/api/v1/submissions/PKPSubmissionHandler.inc.php +++ b/api/v1/submissions/PKPSubmissionHandler.inc.php @@ -15,19 +15,22 @@ */ use APP\core\Application; +use APP\core\Request; use APP\core\Services; use APP\facades\Repo; use APP\i18n\AppLocale; use APP\notification\Notification; use APP\notification\NotificationManager; use APP\submission\Collector; +use APP\submission\Submission; +use PKP\core\Core; use PKP\db\DAORegistry; - +use PKP\decision\Type; use PKP\handler\APIHandler; -use PKP\mail\mailables\MailDiscussionMessage; use PKP\notification\PKPNotification; use PKP\plugins\HookRegistry; use PKP\security\authorization\ContextAccessPolicy; +use PKP\security\authorization\DecisionWritePolicy; use PKP\security\authorization\PublicationWritePolicy; use PKP\security\authorization\StageRolePolicy; use PKP\security\authorization\SubmissionAccessPolicy; @@ -60,11 +63,22 @@ class PKPSubmissionHandler extends APIHandler 'publishPublication', 'unpublishPublication', 'deletePublication', + 'getContributors', + 'getContributor', + 'addContributor', + 'deleteContributor', + 'editContributor', + 'saveContributorsOrder', + 'addDecision', ]; /** @var array Handlers that must be authorized to write to a publication */ public $requiresPublicationWriteAccess = [ 'editPublication', + 'addContributor', + 'deleteContributor', + 'editContributor', + 'saveContributorsOrder', ]; /** @var array Handlers that must be authorized to access a submission's production stage */ @@ -121,6 +135,16 @@ public function __construct() 'handler' => [$this, 'getPublication'], 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_REVIEWER, Role::ROLE_ID_AUTHOR], ], + [ + 'pattern' => $this->getEndpointPattern() . '/{submissionId:\d+}/publications/{publicationId:\d+}/contributors', + 'handler' => [$this, 'getContributors'], + 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_REVIEWER, Role::ROLE_ID_AUTHOR], + ], + [ + 'pattern' => $this->getEndpointPattern() . '/{submissionId:\d+}/publications/{publicationId:\d+}/contributors/{contributorId:\d+}', + 'handler' => [$this, 'getContributor'], + 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_REVIEWER, Role::ROLE_ID_AUTHOR], + ], ], 'POST' => [ [ @@ -138,6 +162,16 @@ public function __construct() 'handler' => [$this, 'versionPublication'], 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], ], + [ + 'pattern' => $this->getEndpointPattern() . '/{submissionId:\d+}/publications/{publicationId:\d+}/contributors', + 'handler' => [$this, 'addContributor'], + 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_AUTHOR], + ], + [ + 'pattern' => $this->getEndpointPattern() . '/{submissionId:\d+}/decisions', + 'handler' => [$this, 'addDecision'], + 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR], + ], ], 'PUT' => [ [ @@ -160,6 +194,16 @@ public function __construct() 'handler' => [$this, 'unpublishPublication'], 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], ], + [ + 'pattern' => $this->getEndpointPattern() . '/{submissionId:\d+}/publications/{publicationId:\d+}/contributors/{contributorId:\d+}', + 'handler' => [$this, 'editContributor'], + 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_AUTHOR], + ], + [ + 'pattern' => $this->getEndpointPattern() . '/{submissionId:\d+}/publications/{publicationId:\d+}/contributors/saveOrder', + 'handler' => [$this, 'saveContributorsOrder'], + 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_AUTHOR], + ], ], 'DELETE' => [ [ @@ -172,6 +216,11 @@ public function __construct() 'handler' => [$this, 'deletePublication'], 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], ], + [ + 'pattern' => $this->getEndpointPattern() . '/{submissionId:\d+}/publications/{publicationId:\d+}/contributors/{contributorId:\d+}', + 'handler' => [$this, 'deleteContributor'], + 'roles' => [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_AUTHOR], + ], ], ]; parent::__construct(); @@ -198,14 +247,18 @@ public function authorize($request, &$args, $roleAssignments) $this->addPolicy(new StageRolePolicy($this->productionStageAccessRoles, WORKFLOW_STAGE_ID_PRODUCTION, false)); } + if ($routeName === 'addDecision') { + $this->addPolicy(new DecisionWritePolicy($request, $args, (int) $request->getUserVar('decision'), $request->getUser())); + } + return parent::authorize($request, $args, $roleAssignments); } /** * Get a collection of submissions * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -216,10 +269,6 @@ public function getMany($slimRequest, $response, $args) $currentUser = $request->getUser(); $context = $request->getContext(); - if (!$context) { - return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); - } - $collector = $this->getSubmissionCollector($slimRequest->getQueryParams()); HookRegistry::call('API::submissions::params', [$collector, $slimRequest]); @@ -241,9 +290,13 @@ public function getMany($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($context->getId())->toArray(); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($context->getId())->toArray(); + return $response->withJson([ 'itemsMax' => Repo::submission()->getCount($collector->limit(null)->offset(null)), - 'items' => Repo::submission()->getSchemaMap()->summarizeMany($submissions, $userGroups), + 'items' => Repo::submission()->getSchemaMap()->summarizeMany($submissions, $userGroups, $genres), ], 200); } @@ -292,7 +345,7 @@ protected function getSubmissionCollector(array $queryParams): Collector case 'assignedTo': $val = array_map('intval', $this->paramToArray($val)); - if ($val == [-1]) { + if ($val == [\PKP\submission\Collector::UNASSIGNED]) { $val = array_shift($val); } $collector->assignedTo($val); @@ -330,8 +383,8 @@ protected function getSubmissionCollector(array $queryParams): Collector /** * Get a single submission * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -348,14 +401,18 @@ public function get($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); - return $response->withJson(Repo::submission()->getSchemaMap()->map($submission, $userGroups), 200); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + + return $response->withJson(Repo::submission()->getSchemaMap()->map($submission, $userGroups, $genres), 200); } /** * Add a new submission * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -366,11 +423,6 @@ public function add($slimRequest, $response, $args) $request = $this->getRequest(); - // Don't allow submissions to be added via the site-wide API - if (!$request->getContext()) { - return $response->withStatus(400)->withJsonError('api.submissions.403.contextRequired'); - } - if ($request->getContext()->getData('disableSubmissions')) { return $response->withStatus(403)->withJsonError('author.submit.notAccepting'); } @@ -399,14 +451,18 @@ public function add($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); - return $response->withJson(Repo::submission()->getSchemaMap()->map($submission, $userGroups), 200); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + + return $response->withJson(Repo::submission()->getSchemaMap()->map($submission, $userGroups, $genres), 200); } /** * Edit a submission * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -420,11 +476,6 @@ public function edit($slimRequest, $response, $args) return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); } - // Don't allow submissions to be added via the site-wide API - if (!$request->getContext()) { - return $response->withStatus(403)->withJsonError('api.submissions.403.contextRequired'); - } - $params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_SUBMISSION, $slimRequest->getParsedBody()); $params['id'] = $submission->getId(); $params['contextId'] = $request->getContext()->getId(); @@ -450,14 +501,18 @@ public function edit($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); - return $response->withJson(Repo::submission()->getSchemaMap()->map($submission, $userGroups), 200); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + + return $response->withJson(Repo::submission()->getSchemaMap()->map($submission, $userGroups, $genres), 200); } /** * Delete a submission * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -473,7 +528,11 @@ public function delete($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); - $submissionProps = Repo::submission()->getSchemaMap()->map($submission, $userGroups); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + + $submissionProps = Repo::submission()->getSchemaMap()->map($submission, $userGroups, $genres); Repo::submission()->delete($submission); @@ -485,8 +544,8 @@ public function delete($slimRequest, $response, $args) * * This does not return reviewers. * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -498,7 +557,7 @@ public function getParticipants($slimRequest, $response, $args) $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); $stageId = $args['stageId'] ?? null; - if (!$submission) { + if (!$submission || $submission->getData('contextId') !== $context->getId()) { return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); } @@ -521,9 +580,9 @@ public function getParticipants($slimRequest, $response, $args) /** * Get all of this submissions's publications * - * @param $slimRequest Request Slim request object - * @param $response Response object - * @param $args array arguments + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments * * @return Response */ @@ -560,8 +619,8 @@ public function getPublications($slimRequest, $response, $args) /** * Get one of this submission's publications * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -583,8 +642,12 @@ public function getPublication($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + return $response->withJson( - Repo::publication()->getSchemaMap($submission, $userGroups)->map($publication), + Repo::publication()->getSchemaMap($submission, $userGroups, $genres)->map($publication), 200 ); } @@ -595,8 +658,8 @@ public function getPublication($slimRequest, $response, $args) * This will create a new publication from scratch. If you want to create a new * version of a publication, see self::versionPublication(). * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -634,8 +697,12 @@ public function addPublication($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + return $response->withJson( - Repo::publication()->getSchemaMap($submission, $userGroups)->map($publication), + Repo::publication()->getSchemaMap($submission, $userGroups, $genres)->map($publication), 200 ); } @@ -643,8 +710,8 @@ public function addPublication($slimRequest, $response, $args) /** * Create a new version of a publication * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -689,8 +756,12 @@ public function versionPublication($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + return $response->withJson( - Repo::publication()->getSchemaMap($submission, $userGroups)->map($publication), + Repo::publication()->getSchemaMap($submission, $userGroups, $genres)->map($publication), 200 ); } @@ -698,8 +769,8 @@ public function versionPublication($slimRequest, $response, $args) /** * Edit one of this submission's publications * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -759,8 +830,12 @@ public function editPublication($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + return $response->withJson( - Repo::publication()->getSchemaMap($submission, $userGroups)->map($publication), + Repo::publication()->getSchemaMap($submission, $userGroups, $genres)->map($publication), 200 ); } @@ -772,8 +847,8 @@ public function editPublication($slimRequest, $response, $args) * checks and return errors but it will not perform the final * publication step. * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -818,8 +893,12 @@ public function publishPublication($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + return $response->withJson( - Repo::publication()->getSchemaMap($submission, $userGroups)->map($publication), + Repo::publication()->getSchemaMap($submission, $userGroups, $genres)->map($publication), 200 ); } @@ -827,8 +906,8 @@ public function publishPublication($slimRequest, $response, $args) /** * Unpublish one of this submission's publications * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -857,8 +936,12 @@ public function unpublishPublication($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + return $response->withJson( - Repo::publication()->getSchemaMap($submission, $userGroups)->map($publication), + Repo::publication()->getSchemaMap($submission, $userGroups, $genres)->map($publication), 200 ); } @@ -869,8 +952,8 @@ public function unpublishPublication($slimRequest, $response, $args) * Published publications can not be deleted. First you must unpublish them. * See self::unpublishPublication(). * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -896,10 +979,351 @@ public function deletePublication($slimRequest, $response, $args) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($submission->getData('contextId'))->toArray(); - $output = Repo::publication()->getSchemaMap($submission, $userGroups)->map($publication); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + + $output = Repo::publication()->getSchemaMap($submission, $userGroups, $genres)->map($publication); Repo::publication()->delete($publication); return $response->withJson($output, 200); } + + /** + * Get one of a publication's contributors + * + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments + * + * @return Response + */ + public function getContributor($slimRequest, $response, $args) + { + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + + $publication = Repo::publication()->get((int) $args['publicationId']); + $author = Repo::author()->get((int) $args['contributorId']); + + if (!$publication) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + if (!$author) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + if ($submission->getId() !== $publication->getData('submissionId')) { + return $response->withStatus(403)->withJsonError('api.publications.403.submissionsDidNotMatch'); + } + + if ($publication->getId() !== $author->getData('publicationId')) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + return $response->withJson( + Repo::author()->getSchemaMap()->map($author), + 200 + ); + } + + /** + * Get all publication's contributors + * + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments + * + * @return Response + */ + public function getContributors($slimRequest, $response, $args) + { + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + $publication = Repo::publication()->get((int) $args['publicationId']); + + if (!$publication) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + if ($submission->getId() !== $publication->getData('submissionId')) { + return $response->withStatus(403)->withJsonError('api.publications.403.submissionsDidNotMatch'); + } + + $collector = Repo::author()->getCollector(); + $collector->filterByPublicationIds([$publication->getId()]); + $authors = Repo::author()->getMany($collector); + + return $response->withJson([ + 'itemsMax' => Repo::author()->getCount($collector->limit(null)->offset(null)), + 'items' => Repo::author()->getSchemaMap()->summarizeMany($authors), + ], 200); + } + + /** + * Add a new contributor to publication + * + * This will create a new contributor from scratch. + * + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments + * + * @return Response + */ + public function addContributor($slimRequest, $response, $args) + { + $request = $this->getRequest(); + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + $currentUser = $request->getUser(); + + $publication = Repo::publication()->get((int) $args['publicationId']); + + if (!$publication) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + if ($submission->getId() !== $publication->getData('submissionId')) { + return $response->withStatus(403)->withJsonError('api.publications.403.submissionsDidNotMatch'); + } + + // Publications can not be edited when they are published + if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { + return $response->withStatus(403)->withJsonError('api.publication.403.cantEditPublished'); + } + + $params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_AUTHOR, $slimRequest->getParsedBody()); + $params['publicationId'] = $publication->getId(); + + $submissionContext = $request->getContext(); + if (!$submissionContext || $submissionContext->getId() !== $submission->getData('contextId')) { + $submissionContext = Services::get('context')->get($submission->getData('contextId')); + } + $primaryLocale = $submissionContext->getPrimaryLocale(); + $allowedLocales = $submissionContext->getData('supportedSubmissionLocales'); + + // A publication may have a different primary locale + if (!empty($params['locale']) && in_array($params['locale'], $allowedLocales)) { + $primaryLocale = $params['locale']; + } + + $errors = Repo::author()->validate(null, $params, $allowedLocales, $primaryLocale); + + if (!empty($errors)) { + return $response->withStatus(400)->withJson($errors); + } + + $author = Repo::author()->newDataObject($params); + $newId = Repo::author()->add($author); + $author = Repo::author()->get($newId); + + return $response->withJson( + Repo::author()->getSchemaMap()->map($author), + 200 + ); + } + + /** + * Delete one of this publication's contributors + * + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments + * + * @return Response + */ + public function deleteContributor($slimRequest, $response, $args) + { + $request = $this->getRequest(); + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + $currentUser = $request->getUser(); + + $publication = Repo::publication()->get((int) $args['publicationId']); + $author = Repo::author()->get((int) $args['contributorId']); + + if (!$publication) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + // Publications can not be edited when they are published + if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { + return $response->withStatus(403)->withJsonError('api.publication.403.cantEditPublished'); + } + + if ($submission->getId() !== $publication->getData('submissionId')) { + return $response->withStatus(403)->withJsonError('api.publications.403.submissionsDidNotMatch'); + } + + if (!$author) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + if ($publication->getId() !== $author->getData('publicationId')) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + $output = Repo::author()->getSchemaMap()->map($author); + + Repo::author()->delete($author); + + return $response->withJson($output, 200); + } + + /** + * Edit one of this publication's contributors + * + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments + * + * @return Response + */ + public function editContributor($slimRequest, $response, $args) + { + $request = $this->getRequest(); + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + $currentUser = $request->getUser(); + + $publication = Repo::publication()->get((int) $args['publicationId']); + $author = Repo::author()->get((int) $args['contributorId']); + + if (!$publication) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + if (!$author) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + if ($submission->getId() !== $publication->getData('submissionId')) { + return $response->withStatus(403)->withJsonError('api.publications.403.submissionsDidNotMatch'); + } + + // Publications can not be edited when they are published + if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { + return $response->withStatus(403)->withJsonError('api.publication.403.cantEditPublished'); + } + + $params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_AUTHOR, $slimRequest->getParsedBody()); + $params['id'] = $author->getId(); + + $submissionContext = $request->getContext(); + if (!$submissionContext || $submissionContext->getId() !== $submission->getData('contextId')) { + $submissionContext = Services::get('context')->get($submission->getData('contextId')); + } + + $primaryLocale = $publication->getData('locale'); + $allowedLocales = $submissionContext->getData('supportedSubmissionLocales'); + + if ($publication->getId() !== $author->getData('publicationId')) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + // Prevent users from editing publications if they do not have permission. Except for admins. + $userRoles = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES); + if (!in_array(Role::ROLE_ID_SITE_ADMIN, $userRoles) && !Repo::submission()->canEditPublication($submission->getId(), $currentUser->getId())) { + return $response->withStatus(403)->withJsonError('api.submissions.403.userCantEdit'); + } + + $errors = Repo::author()->validate($author, $params, $allowedLocales, $primaryLocale); + + if (!empty($errors)) { + return $response->withStatus(400)->withJson($errors); + } + + Repo::author()->edit($author, $params); + $author = Repo::author()->get($author->getId()); + + return $response->withJson( + Repo::author()->getSchemaMap()->map($author), + 200 + ); + } + + /** + * Save new order of contributors array + * + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments + * + * @return Response + */ + public function saveContributorsOrder($slimRequest, $response, $args) + { + $params = $slimRequest->getParsedBody(); + + $request = $this->getRequest(); + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + $currentUser = $request->getUser(); + + $publication = Repo::publication()->get((int) $args['publicationId']); + + if (!$publication) { + return $response->withStatus(404)->withJsonError('api.404.resourceNotFound'); + } + + if ($submission->getId() !== $publication->getData('submissionId')) { + return $response->withStatus(403)->withJsonError('api.publications.403.submissionsDidNotMatch'); + } + + // Publications can not be edited when they are published + if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { + return $response->withStatus(403)->withJsonError('api.publication.403.cantEditPublished'); + } + + if (!empty($params['sortedAuthors'])) { + $authors = []; + foreach ($params['sortedAuthors'] as $author) { + $newAuthor = Repo::author()->get((int) $author['id']); + + array_push($authors, $newAuthor); + } + + Repo::author()->setAuthorsOrder($publication->getId(), $authors); + } + + return $response->withJson($publication->getId()); + } + + /** + * Record an editorial decision for a submission, such as + * a decision to accept or reject the submission, request + * revisions, or send it to another stage. + * + * @param $slimRequest Request Slim request object + * @param $response Response object + * @param array $args arguments + * + * @return Response + */ + public function addDecision($slimRequest, $response, $args) + { + AppLocale::requireComponents([LOCALE_COMPONENT_APP_EDITOR, LOCALE_COMPONENT_PKP_EDITOR]); + $request = $this->getRequest(); /** @var Request $request */ + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); /** @var Submission $submission */ + $type = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_DECISION_TYPE); /** @var Type $type */ + + if ($submission->getData('status') === Submission::STATUS_PUBLISHED) { + return $response->withStatus(403)->withJsonError('api.decisions.403.alreadyPublished'); + } + + $params = $this->convertStringsToSchema(PKPSchemaService::SCHEMA_DECISION, $slimRequest->getParsedBody()); + $params['submissionId'] = $submission->getId(); + $params['dateDecided'] = Core::getCurrentDate(); + $params['editorId'] = $request->getUser()->getId(); + $params['stageId'] = $type->getStageId(); + + $errors = Repo::decision()->validate($params, $type, $submission, $request->getContext()); + + if (!empty($errors)) { + return $response->withStatus(400)->withJson($errors); + } + + $decision = Repo::decision()->newDataObject($params); + $decisionId = Repo::decision()->add($decision); + $decision = Repo::decision()->get($decisionId); + + return $response->withJson(Repo::decision()->getSchemaMap()->map($decision), 200); + } } diff --git a/api/v1/temporaryFiles/PKPTemporaryFilesHandler.inc.php b/api/v1/temporaryFiles/PKPTemporaryFilesHandler.inc.php index 5a797734fa8..cccddcefe47 100644 --- a/api/v1/temporaryFiles/PKPTemporaryFilesHandler.inc.php +++ b/api/v1/temporaryFiles/PKPTemporaryFilesHandler.inc.php @@ -12,6 +12,7 @@ * @brief Handle API requests to upload a file and receive a temporary file ID. */ +use APP\core\Services; use PKP\file\TemporaryFileManager; use PKP\handler\APIHandler; use PKP\security\authorization\PolicySet; @@ -66,7 +67,7 @@ public function authorize($request, &$args, $roleAssignments) * A helper method which adds the necessary response headers to allow * file uploads * - * @param $response Response object + * @param Response $response object * * @return Response */ @@ -78,9 +79,9 @@ private function getResponse($response) /** * Upload a requested file * - * @param $slimRequest Request Slim request object - * @param $response Response object - * @param $args array arguments + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments * * @return Response */ @@ -115,16 +116,21 @@ public function uploadFile($slimRequest, $response, $args) return $response->withStatus(400)->withJsonError('api.files.400.uploadFailed'); } - return $this->getResponse($response->withJson(['id' => $uploadedFile->getId()])); + return $this->getResponse($response->withJson([ + 'id' => $uploadedFile->getId(), + 'name' => $uploadedFile->getData('originalFileName'), + 'mimetype' => $uploadedFile->getData('filetype'), + 'documentType' => Services::get('file')->getDocumentType($uploadedFile->getData('filetype')), + ])); } /** * Respond affirmatively to a HTTP OPTIONS request with headers which allow * file uploads * - * @param $slimRequest Request Slim request object - * @param $response Response object - * @param $args array arguments + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments * * @return Response */ diff --git a/api/v1/users/PKPUserHandler.inc.php b/api/v1/users/PKPUserHandler.inc.php index b0c37992bde..19897f95f0c 100644 --- a/api/v1/users/PKPUserHandler.inc.php +++ b/api/v1/users/PKPUserHandler.inc.php @@ -69,9 +69,9 @@ public function authorize($request, &$args, $roleAssignments) /** * Get a collection of users * - * @param $slimRequest Request Slim request object - * @param $response Response object - * @param $args array arguments + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments * * @return Response */ @@ -145,9 +145,9 @@ public function getMany($slimRequest, $response, $args) /** * Get a single user * - * @param $slimRequest Request Slim request object - * @param $response Response object - * @param $args array arguments + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments * * @return Response */ @@ -171,9 +171,9 @@ public function get($slimRequest, $response, $args) /** * Get a collection of reviewers * - * @param $slimRequest Request Slim request object - * @param $response Response object - * @param $args array arguments + * @param Request $slimRequest Slim request object + * @param Response $response object + * @param array $args arguments * * @return Response */ diff --git a/api/v1/vocabs/PKPVocabHandler.inc.php b/api/v1/vocabs/PKPVocabHandler.inc.php index 0d0bc54382a..8b47a9c9199 100644 --- a/api/v1/vocabs/PKPVocabHandler.inc.php +++ b/api/v1/vocabs/PKPVocabHandler.inc.php @@ -17,6 +17,7 @@ use PKP\handler\APIHandler; use PKP\security\authorization\ContextAccessPolicy; use PKP\security\Role; +use Sokil\IsoCodes\IsoCodesFactory; class PKPVocabHandler extends APIHandler { @@ -51,8 +52,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Get the controlled vocab entries available in this context * - * @param $slimRequest Request Slim request object - * @param $response Response object + * @param Request $slimRequest Slim request object + * @param Response $response object * @param array $args arguments * * @return Response @@ -89,9 +90,9 @@ public function getMany($slimRequest, $response, $args) $entries = $submissionDisciplineEntryDao->getByContextId($vocab, $context->getId(), $locale)->toArray(); break; case \PKP\submission\SubmissionLanguageDAO::CONTROLLED_VOCAB_SUBMISSION_LANGUAGE: - $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory(\Sokil\IsoCodes\IsoCodesFactory::OPTIMISATION_IO); + $isoCodes = app(IsoCodesFactory::class); $languageNames = []; - foreach ($isoCodes->getLanguages() as $language) { + foreach ($isoCodes->getLanguages(IsoCodesFactory::OPTIMISATION_IO) as $language) { if (!$language->getAlpha2() || $language->getType() != 'L' || $language->getScope() != 'I') { continue; } diff --git a/classes/announcement/Announcement.inc.php b/classes/announcement/Announcement.inc.php index 8813f565fe6..2ab063a4d17 100644 --- a/classes/announcement/Announcement.inc.php +++ b/classes/announcement/Announcement.inc.php @@ -42,7 +42,7 @@ public function getAssocId() /** * Set assoc ID for this annoucement. * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -62,7 +62,7 @@ public function getAssocType() /** * Set assoc type for this annoucement. * - * @param $assocType int + * @param int $assocType */ public function setAssocType($assocType) { @@ -82,7 +82,7 @@ public function getTypeId() /** * Set the announcement type of the announcement. * - * @param $typeId int + * @param int $typeId */ public function setTypeId($typeId) { @@ -129,7 +129,7 @@ public function getLocalizedTitleFull() /** * Get announcement title. * - * @param $locale + * @param string $locale * * @return string */ @@ -141,8 +141,8 @@ public function getTitle($locale) /** * Set announcement title. * - * @param $title string - * @param $locale string + * @param string $title + * @param string $locale */ public function setTitle($title, $locale) { @@ -162,7 +162,7 @@ public function getLocalizedDescriptionShort() /** * Get announcement brief description. * - * @param $locale string + * @param string $locale * * @return string */ @@ -174,8 +174,8 @@ public function getDescriptionShort($locale) /** * Set announcement brief description. * - * @param $descriptionShort string - * @param $locale string + * @param string $descriptionShort + * @param string $locale */ public function setDescriptionShort($descriptionShort, $locale) { @@ -195,7 +195,7 @@ public function getLocalizedDescription() /** * Get announcement description. * - * @param $locale string + * @param string $locale * * @return string */ @@ -207,8 +207,8 @@ public function getDescription($locale) /** * Set announcement description. * - * @param $description string - * @param $locale string + * @param string $description + * @param string $locale */ public function setDescription($description, $locale) { @@ -228,7 +228,7 @@ public function getDateExpire() /** * Set announcement expiration date. * - * @param $dateExpire date (YYYY-MM-DD) + * @param date $dateExpire (YYYY-MM-DD) */ public function setDateExpire($dateExpire) { @@ -258,7 +258,7 @@ public function getDatetimePosted() /** * Set announcement posted date. * - * @param $datePosted date (YYYY-MM-DD) + * @param date $datePosted (YYYY-MM-DD) */ public function setDatePosted($datePosted) { @@ -268,7 +268,7 @@ public function setDatePosted($datePosted) /** * Set announcement posted datetime. * - * @param $datetimePosted date (YYYY-MM-DD HH:MM:SS) + * @param date $datetimePosted (YYYY-MM-DD HH:MM:SS) */ public function setDatetimePosted($datetimePosted) { diff --git a/classes/announcement/AnnouncementType.inc.php b/classes/announcement/AnnouncementType.inc.php index 9d53bc500b8..23e2229cd96 100644 --- a/classes/announcement/AnnouncementType.inc.php +++ b/classes/announcement/AnnouncementType.inc.php @@ -35,7 +35,7 @@ public function getContextId() /** * Set context ID for this announcement. * - * @param $contextId int + * @param int $contextId */ public function setContextId($contextId) { @@ -55,7 +55,7 @@ public function getLocalizedTypeName() /** * Get the type of the announcement type. * - * @param $locale string + * @param string $locale * * @return string */ @@ -67,8 +67,8 @@ public function getName($locale) /** * Set the type of the announcement type. * - * @param $name string - * @param $locale string + * @param string $name + * @param string $locale */ public function setName($name, $locale) { diff --git a/classes/announcement/AnnouncementTypeDAO.inc.php b/classes/announcement/AnnouncementTypeDAO.inc.php index 83e640cfa98..63ab44b53d1 100644 --- a/classes/announcement/AnnouncementTypeDAO.inc.php +++ b/classes/announcement/AnnouncementTypeDAO.inc.php @@ -34,8 +34,8 @@ public function newDataObject() /** * Retrieve an announcement type by announcement type ID. * - * @param $typeId int Announcement type ID - * @param $contextId int Optional context ID + * @param int $typeId Announcement type ID + * @param int $contextId Optional context ID * * @return AnnouncementType */ @@ -67,7 +67,7 @@ public function getLocaleFieldNames() /** * Internal function to return an AnnouncementType object from a row. * - * @param $row array + * @param array $row * * @return AnnouncementType */ @@ -84,7 +84,7 @@ public function _fromRow($row) /** * Update the localized settings for this object * - * @param $announcementType object + * @param object $announcementType */ public function updateLocaleFields($announcementType) { @@ -98,7 +98,7 @@ public function updateLocaleFields($announcementType) /** * Insert a new AnnouncementType. * - * @param $announcementType AnnouncementType + * @param AnnouncementType $announcementType * * @return int */ @@ -119,9 +119,9 @@ public function insertObject($announcementType) /** * Update an existing announcement type. * - * @param $announcementType AnnouncementType + * @param AnnouncementType $announcementType * - * @return boolean + * @return bool */ public function updateObject($announcementType) { @@ -143,9 +143,9 @@ public function updateObject($announcementType) * Delete an announcement type. Note that all announcements with this type are also * deleted. * - * @param $announcementType AnnouncementType + * @param AnnouncementType $announcementType * - * @return boolean + * @return bool */ public function deleteObject($announcementType) { @@ -156,7 +156,7 @@ public function deleteObject($announcementType) * Delete an announcement type by announcement type ID. Note that all announcements with * this type ID are also deleted. * - * @param $typeId int + * @param int $typeId */ public function deleteById($typeId) { @@ -170,7 +170,7 @@ public function deleteById($typeId) /** * Delete announcement types by context ID. * - * @param $contextId int + * @param int $contextId */ public function deleteByContextId($contextId) { @@ -182,7 +182,7 @@ public function deleteByContextId($contextId) /** * Retrieve an array of announcement types matching a particular context ID. * - * @param $contextId int + * @param int $contextId * * @return Generator Matching AnnouncementTypes */ diff --git a/classes/announcement/DAO.inc.php b/classes/announcement/DAO.inc.php index f74b9d88100..1e1ef9f94ef 100644 --- a/classes/announcement/DAO.inc.php +++ b/classes/announcement/DAO.inc.php @@ -14,10 +14,8 @@ namespace PKP\announcement; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\App; use Illuminate\Support\LazyCollection; use PKP\core\EntityDAO; -use stdClass; class DAO extends EntityDAO { @@ -48,7 +46,7 @@ class DAO extends EntityDAO */ public function newDataObject(): Announcement { - return App::make(Announcement::class); + return app(Announcement::class); } /** @@ -99,7 +97,7 @@ public function getMany(Collector $query): LazyCollection /** * @copydoc EntityDAO::fromRow() */ - public function fromRow(stdClass $row): Announcement + public function fromRow(object $row): Announcement { return parent::fromRow($row); } diff --git a/classes/announcement/Repository.inc.php b/classes/announcement/Repository.inc.php index b5d29478640..246842a9ef2 100644 --- a/classes/announcement/Repository.inc.php +++ b/classes/announcement/Repository.inc.php @@ -16,7 +16,6 @@ use APP\core\Request; use APP\i18n\AppLocale; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\App; use Illuminate\Support\LazyCollection; use PKP\core\Core; use PKP\plugins\HookRegistry; @@ -82,7 +81,7 @@ public function getMany(Collector $query): LazyCollection /** @copydoc DAO::getCollector() */ public function getCollector(): Collector { - return App::make(Collector::class); + return app(Collector::class); } /** @@ -136,7 +135,7 @@ public function validate(?Announcement $object, array $props, array $allowedLoca $errors = []; if ($validator->fails()) { - $errors = $this->schemaService->formatValidationErrors($validator->errors(), $this->schemaService->get($this->dao->schema), $allowedLocales); + $errors = $this->schemaService->formatValidationErrors($validator->errors()); } HookRegistry::call('Announcement::validate', [&$errors, $object, $props, $allowedLocales, $primaryLocale]); diff --git a/classes/author/Author.inc.php b/classes/author/Author.inc.php index 1e7077571c6..705c9b83284 100644 --- a/classes/author/Author.inc.php +++ b/classes/author/Author.inc.php @@ -28,8 +28,8 @@ class Author extends Identity * Get a piece of data for this object, localized to the current * locale if possible. * - * @param $key string - * @param $preferredLocale string + * @param string $key + * @param string $preferredLocale */ public function &getLocalizedData($key, $preferredLocale = null) { @@ -129,7 +129,7 @@ public function getSubmissionId() /** * Set ID of submission. * - * @param $submissionId int + * @param int $submissionId */ public function setSubmissionId($submissionId) { @@ -149,7 +149,7 @@ public function getSubmissionLocale() /** * Set submission locale. * - * @param $submissionLocale string + * @param string $submissionLocale */ public function setSubmissionLocale($submissionLocale) { @@ -159,7 +159,7 @@ public function setSubmissionLocale($submissionLocale) /** * Set the user group id * - * @param $userGroupId int + * @param int $userGroupId */ public function setUserGroupId($userGroupId) { @@ -179,7 +179,7 @@ public function getUserGroupId() /** * Set whether or not to include in browse lists. * - * @param $include boolean + * @param bool $include */ public function setIncludeInBrowse($include) { @@ -189,7 +189,7 @@ public function setIncludeInBrowse($include) /** * Get whether or not to include in browse lists. * - * @return boolean + * @return bool */ public function getIncludeInBrowse() { @@ -201,7 +201,7 @@ public function getIncludeInBrowse() * should be included in the list of submission contributor names). * This is fetched from the user group for performance reasons. * - * @return boolean + * @return bool */ public function getShowTitle() { @@ -220,7 +220,7 @@ public function _setShowTitle($showTitle) /** * Get primary contact. * - * @return boolean + * @return bool */ public function getPrimaryContact() { @@ -230,7 +230,7 @@ public function getPrimaryContact() /** * Set primary contact. * - * @param $primaryContact boolean + * @param bool $primaryContact */ public function setPrimaryContact($primaryContact) { @@ -250,7 +250,7 @@ public function getSequence() /** * Set sequence of author in submissions' author list. * - * @param $sequence float + * @param float $sequence */ public function setSequence($sequence) { diff --git a/classes/author/Collector.inc.php b/classes/author/Collector.inc.php index a75f717f5ad..17b5e1c0f14 100644 --- a/classes/author/Collector.inc.php +++ b/classes/author/Collector.inc.php @@ -109,7 +109,7 @@ public function filterByName(?string $givenName, ?string $familyName): self /** * Filter by the specified country code * - * @param $country string Country code (2-letter) + * @param string $country Country code (2-letter) * * */ public function filterByCountry(?string $country): self @@ -165,7 +165,7 @@ public function getQueryBuilder(): Builder $q->select('author_id') ->from($this->dao->settingsTable) ->where('setting_name', '=', 'familyName') - ->whereIn('setting_value', $this->familyName); + ->where('setting_value', $this->familyName); }); }); @@ -174,7 +174,7 @@ public function getQueryBuilder(): Builder $q->select('author_id') ->from($this->dao->settingsTable) ->where('setting_name', '=', 'givenName') - ->whereIn('setting_value', $this->givenName); + ->where('setting_value', $this->givenName); }); }); @@ -187,7 +187,7 @@ public function getQueryBuilder(): Builder $q->select('author_id') ->from($this->dao->settingsTable) ->where('setting_name', '=', 'country') - ->whereIn('setting_value', $this->country); + ->where('setting_value', $this->country); }); }); @@ -196,7 +196,7 @@ public function getQueryBuilder(): Builder $q->select('author_id') ->from($this->dao->settingsTable) ->where('setting_name', '=', 'affiliation') - ->whereIn('setting_value', $this->affiliation); + ->where('setting_value', $this->affiliation); }); }); diff --git a/classes/author/DAO.inc.php b/classes/author/DAO.inc.php index 4aa591605b5..3cd364f28be 100644 --- a/classes/author/DAO.inc.php +++ b/classes/author/DAO.inc.php @@ -20,12 +20,11 @@ use APP\author\Author; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Illuminate\Support\LazyCollection; use PKP\core\EntityDAO; use PKP\services\PKPSchemaService; -use stdClass; +use PKP\facades\Repo; class DAO extends EntityDAO { @@ -65,7 +64,7 @@ public function __construct( */ public function newDataObject(): Author { - return App::make(Author::class); + return app(Author::class); } /** @@ -79,7 +78,7 @@ public function get(int $id): ?Author ->join('publications as p', 'a.publication_id', '=', 'p.publication_id') ->join('submissions as s', 'p.submission_id', '=', 's.submission_id') ->where('a.author_id', '=', $id) - ->select(['*', 's.locale AS submission_locale']) + ->select(['a.*', 's.locale AS submission_locale']) ->first(); return $row ? $this->fromRow($row) : null; @@ -113,7 +112,7 @@ public function getMany(Collector $query): LazyCollection { $rows = $query ->getQueryBuilder() - ->select(['*', 's.locale AS submission_locale']) + ->select(['a.*', 's.locale AS submission_locale']) ->get(); return LazyCollection::make(function () use ($rows) { @@ -126,7 +125,7 @@ public function getMany(Collector $query): LazyCollection /** * @copydoc EntityDAO::fromRow() */ - public function fromRow(stdClass $row): Author + public function fromRow(object $row): Author { $author = parent::fromRow($row); @@ -167,4 +166,42 @@ public function deleteById(int $authorId) { parent::deleteById($authorId); } + + /** + * Get the next sequence that should be used when adding a contributor to a publication + */ + public function getNextSeq(int $publicationId): int + { + $nextSeq = 0; + $seq = DB::table('authors as a') + ->join('publications as p', 'a.publication_id', '=', 'p.publication_id') + ->where('p.publication_id', '=', $publicationId) + ->max('a.seq'); + + if ($seq) { + $nextSeq = $seq + 1; + } + + return $nextSeq; + } + + /** + * Reset the order of contributors in a publication + * + * This method resets the seq property for each contributor in a publication + * so that they are numbered sequentially without any gaps. + * + * eg - 1, 3, 4, 6 will become 1, 2, 3, 4 + */ + public function resetContributorsOrder(int $publicationId) + { + $authorIds = $this->getIds(Repo::author() + ->getCollector() + ->filterByPublicationIds([$publicationId]) + ->orderBy(Repo::author()->getCollector()::ORDERBY_SEQUENCE) + ); + foreach ($authorIds as $seq => $authorId) { + DB::table('authors')->where('author_id', '=', $authorId)->update(['seq' => $seq]); + } + } } diff --git a/classes/author/Repository.inc.php b/classes/author/Repository.inc.php index 3eba3bf1176..c595dcd28e2 100644 --- a/classes/author/Repository.inc.php +++ b/classes/author/Repository.inc.php @@ -18,10 +18,8 @@ use APP\core\Request; use APP\core\Services; use APP\facades\Repo; -use APP\publication\Publication; use APP\submission\Submission; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\App; use Illuminate\Support\LazyCollection; use PKP\plugins\HookRegistry; use PKP\services\PKPSchemaService; @@ -86,7 +84,7 @@ public function getMany(Collector $query): LazyCollection /** @copydoc DAO::getCollector() */ public function getCollector(): Collector { - return App::make(Collector::class); + return app(Collector::class); } /** @@ -144,8 +142,9 @@ public function validate($author, $props, $allowedLocales, $primaryLocale) } }); + $errors = []; if ($validator->fails()) { - $errors = $schemaService->formatValidationErrors($validator->errors(), $schemaService->get(PKPSchemaService::SCHEMA_AUTHOR), $allowedLocales); + $errors = $schemaService->formatValidationErrors($validator->errors()); } HookRegistry::call('Author::validate', [$errors, $author, $props, $allowedLocales, $primaryLocale]); @@ -158,6 +157,13 @@ public function validate($author, $props, $allowedLocales, $primaryLocale) */ public function add(Author $author): int { + $existingSeq = $author->getData('seq'); + + if (!isset($existingSeq)) { + $nextSeq = $this->dao->getNextSeq($author->getData('publicationId')); + $author->setData('seq', $nextSeq); + } + $authorId = $this->dao->insert($author); $author = Repo::author()->get($authorId); @@ -187,15 +193,18 @@ public function delete(Author $author) { HookRegistry::call('Author::delete::before', [$author]); $this->dao->delete($author); + + $this->dao->resetContributorsOrder($author->getData('publicationId')); + HookRegistry::call('Author::delete', [$author]); } /** * Update author names when publication locale changes. * - * @param $publicationId int - * @param $oldLocale string - * @param $newLocale string + * @param int $publicationId + * @param string $oldLocale + * @param string $newLocale */ public function changePublicationLocale($publicationId, $oldLocale, $newLocale) { @@ -239,4 +248,19 @@ public function getSubmissionAuthors(Submission $submission, bool $onlyIncludeIn ->orderBy(Repo::author()->getCollector()::ORDERBY_ID) ); } + + /** + * Reorders the authors of a publication according to the given order of the authors in the provided author array + */ + public function setAuthorsOrder(int $publicationId, array $authors) { + $seq = 0; + foreach ($authors as $author) { + + $author->setData('seq', $seq); + + $this->dao->update($author); + + $seq++; + } + } } diff --git a/classes/author/maps/Schema.inc.php b/classes/author/maps/Schema.inc.php index b499f6d3471..1050b07484f 100644 --- a/classes/author/maps/Schema.inc.php +++ b/classes/author/maps/Schema.inc.php @@ -15,7 +15,11 @@ use APP\author\Author; use Illuminate\Support\Enumerable; +use PKP\security\Role; use PKP\services\PKPSchemaService; +use PKP\core\PKPRequest; +use PKP\db\DAORegistry; +use PKP\security\UserGroupDAO; class Schema extends \PKP\core\maps\Schema { @@ -23,6 +27,16 @@ class Schema extends \PKP\core\maps\Schema public string $schema = PKPSchemaService::SCHEMA_AUTHOR; + protected array $authorUserGroups = []; + + public function __construct(PKPRequest $request, \PKP\context\Context $context, PKPSchemaService $schemaService) + { + parent::__construct($request, $context, $schemaService); + + $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ + $this->authorUserGroups = $userGroupDao->getByRoleId($this->context->getId(), Role::ROLE_ID_AUTHOR)->toAssociativeArray(); + } + /** * Map an author * @@ -76,7 +90,22 @@ protected function mapByProperties(array $props, Author $item): array { $output = []; foreach ($props as $prop) { - $output[$prop] = $item->getData($prop); + switch ($prop) { + case 'userGroupName': + $userGroupId = $item->getData('userGroupId'); + + $output[$prop] = isset($this->authorUserGroups[$userGroupId]) + ? $this->authorUserGroups[$userGroupId]->getName(null) + : ''; + + break; + case 'fullName': + $output[$prop] = $item->getFullName(); + break; + default: + $output[$prop] = $item->getData($prop); + break; + } } $output = $this->schemaService->addMissingMultilingualValues($this->schema, $output, $this->context->getSupportedSubmissionLocales()); diff --git a/classes/cache/APCCache.inc.php b/classes/cache/APCCache.inc.php index 8f7a9f97335..7a228521dd1 100644 --- a/classes/cache/APCCache.inc.php +++ b/classes/cache/APCCache.inc.php @@ -26,9 +26,9 @@ class APCCache extends GenericCache /** * Instantiate a cache. * - * @param $context string - * @param $cacheId mixed - * @param $fallback array PKP-style callback + * @param string $context + * @param mixed $cacheId + * @param array $fallback PKP-style callback */ public function __construct($context, $cacheId, $fallback) { @@ -52,7 +52,7 @@ public function flush() /** * Get an object from the cache. * - * @param $id mixed + * @param mixed $id */ public function getCache($id) { @@ -71,8 +71,8 @@ public function getCache($id) * Set an object in the cache. This function should be overridden * by subclasses. * - * @param $id mixed - * @param $value mixed + * @param mixed $id + * @param mixed $value */ public function setCache($id, $value) { @@ -96,7 +96,7 @@ public function getCacheTime() * Set the entire contents of the cache. * WARNING: THIS DOES NOT FLUSH THE CACHE FIRST! * - * @param $contents array Complete cache contents. + * @param array $contents Complete cache contents. */ public function setEntireCache($contents) { diff --git a/classes/cache/CacheManager.inc.php b/classes/cache/CacheManager.inc.php index 03d3dc1337a..11aecb44ee9 100644 --- a/classes/cache/CacheManager.inc.php +++ b/classes/cache/CacheManager.inc.php @@ -43,9 +43,9 @@ public static function getManager() /** * Get a file cache. * - * @param $context string - * @param $cacheId string - * @param $fallback callback + * @param string $context + * @param string $cacheId + * @param callable $fallback * * @return object FileCache */ @@ -76,10 +76,10 @@ public function getCacheImplementation($type) /** * Get a cache. * - * @param $context string - * @param $cacheId string - * @param $fallback callback - * @param $type string Type of cache: CACHE_TYPE_... + * @param string $context + * @param string $cacheId + * @param callable $fallback + * @param string $type Type of cache: CACHE_TYPE_... * * @return object Cache */ @@ -121,7 +121,7 @@ public function getCache($context, $cacheId, $fallback, $type = CACHE_TYPE_FILE) ); break; default: - die("Unknown cache type \"${type}\"!\n"); + exit("Unknown cache type \"${type}\"!\n"); break; } return $cache; @@ -141,8 +141,8 @@ public static function getFileCachePath() * Flush an entire context, if specified, or * the whole cache. * - * @param $context string The context to flush, if only one is to be flushed - * @param $type string The type of cache to flush + * @param string $context The context to flush, if only one is to be flushed + * @param string $type The type of cache to flush */ public function flush($context = null, $type = CACHE_TYPE_FILE) { @@ -166,7 +166,7 @@ public function flush($context = null, $type = CACHE_TYPE_FILE) // Nothing necessary. break; default: - die("Unknown cache type \"${cacheType}\"!\n"); + exit("Unknown cache type \"${cacheType}\"!\n"); } } } diff --git a/classes/cache/FileCache.inc.php b/classes/cache/FileCache.inc.php index cb3af235baa..4771263929f 100644 --- a/classes/cache/FileCache.inc.php +++ b/classes/cache/FileCache.inc.php @@ -70,7 +70,7 @@ public function flush() /** * Get an object from the cache. * - * @param $id + * @param string $id */ public function getCache($id) { @@ -84,8 +84,8 @@ public function getCache($id) * Set an object in the cache. This function should be overridden * by subclasses. * - * @param $id - * @param $value + * @param string $id + * @param mixed $value */ public function setCache($id, $value) { diff --git a/classes/cache/GenericCache.inc.php b/classes/cache/GenericCache.inc.php index 10e10cee1ad..a3c9acbd652 100644 --- a/classes/cache/GenericCache.inc.php +++ b/classes/cache/GenericCache.inc.php @@ -102,7 +102,7 @@ public function setEntireCache($contents) * Get an object from the cache. This function should be overridden * by subclasses. * - * @param $id + * @param string $id */ public function getCache($id) { @@ -113,8 +113,8 @@ public function getCache($id) * Set an object in the cache. This function should be overridden * by subclasses. * - * @param $id - * @param $value + * @param string $id + * @param mixed $value */ public function setCache($id, $value) { diff --git a/classes/cache/MemcacheCache.inc.php b/classes/cache/MemcacheCache.inc.php index 8aaa0ba2ed4..9141fd7da93 100644 --- a/classes/cache/MemcacheCache.inc.php +++ b/classes/cache/MemcacheCache.inc.php @@ -90,7 +90,7 @@ public function flush() /** * Get an object from the cache. * - * @param $id + * @param string $id */ public function getCache($id) { @@ -111,8 +111,8 @@ public function getCache($id) * Set an object in the cache. This function should be overridden * by subclasses. * - * @param $id - * @param $value + * @param string $id + * @param mixed $value */ public function setCache($id, $value) { diff --git a/classes/cache/XCacheCache.inc.php b/classes/cache/XCacheCache.inc.php index 49e0d5b937e..bcf220b294c 100644 --- a/classes/cache/XCacheCache.inc.php +++ b/classes/cache/XCacheCache.inc.php @@ -52,7 +52,7 @@ public function flush() /** * Get an object from the cache. * - * @param $id + * @param string $id */ public function getCache($id) { @@ -68,8 +68,8 @@ public function getCache($id) * Set an object in the cache. This function should be overridden * by subclasses. * - * @param $id - * @param $value + * @param string $id + * @param mixed $value */ public function setCache($id, $value) { diff --git a/classes/category/DAO.inc.php b/classes/category/DAO.inc.php index e9406d0b49a..0cb0eea02b3 100644 --- a/classes/category/DAO.inc.php +++ b/classes/category/DAO.inc.php @@ -14,11 +14,9 @@ namespace PKP\category; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Illuminate\Support\LazyCollection; use PKP\core\EntityDAO; -use stdClass; class DAO extends EntityDAO { @@ -48,7 +46,7 @@ class DAO extends EntityDAO */ public function newDataObject(): Category { - return App::make(Category::class); + return app(Category::class); } /** @@ -96,7 +94,7 @@ public function getMany(Collector $query): LazyCollection /** * @copydoc EntityDAO::fromRow() */ - public function fromRow(stdClass $row): Category + public function fromRow(object $row): Category { return parent::fromRow($row); } @@ -128,7 +126,7 @@ public function delete(Category $category) /** * Sequentially renumber categories in their sequence order by context ID and optionally parent category ID. * - * @param $parentCategoryId int Optional parent category ID + * @param int $parentCategoryId Optional parent category ID */ public function resequenceCategories(int $contextId, ?int $parentCategoryId = null) { diff --git a/classes/category/Repository.inc.php b/classes/category/Repository.inc.php index 4e0aa8cea32..13ed8591473 100644 --- a/classes/category/Repository.inc.php +++ b/classes/category/Repository.inc.php @@ -16,7 +16,6 @@ use APP\core\Request; use APP\i18n\AppLocale; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\App; use Illuminate\Support\LazyCollection; use PKP\plugins\HookRegistry; use PKP\services\PKPSchemaService; @@ -81,7 +80,7 @@ public function getMany(Collector $query): LazyCollection /** @copydoc DAO::getCollector() */ public function getCollector(): Collector { - return App::make(Collector::class); + return app(Collector::class); } /** diff --git a/classes/citation/Citation.inc.php b/classes/citation/Citation.inc.php index e802b36e416..c456ee8621d 100644 --- a/classes/citation/Citation.inc.php +++ b/classes/citation/Citation.inc.php @@ -26,7 +26,7 @@ class Citation extends \PKP\core\DataObject /** * Constructor. * - * @param $rawCitation string an unparsed citation string + * @param string $rawCitation an unparsed citation string */ public function __construct($rawCitation = null) { @@ -73,7 +73,7 @@ public function getRawCitation() /** * Set the rawCitation * - * @param $rawCitation string + * @param string $rawCitation */ public function setRawCitation($rawCitation) { @@ -84,7 +84,7 @@ public function setRawCitation($rawCitation) /** * Get the sequence number * - * @return integer + * @return int */ public function getSequence() { @@ -94,7 +94,7 @@ public function getSequence() /** * Set the sequence number * - * @param $seq integer + * @param int $seq */ public function setSequence($seq) { @@ -107,7 +107,7 @@ public function setSequence($seq) /** * Take a citation string and clean/normalize it * - * @param $citationString string + * @param string $citationString * * @return string */ diff --git a/classes/citation/CitationDAO.inc.php b/classes/citation/CitationDAO.inc.php index 147bfa1dd8e..601cae0111e 100644 --- a/classes/citation/CitationDAO.inc.php +++ b/classes/citation/CitationDAO.inc.php @@ -25,9 +25,9 @@ class CitationDAO extends \PKP\db\DAO /** * Insert a new citation. * - * @param $citation Citation + * @param Citation $citation * - * @return integer the new citation id + * @return int the new citation id */ public function insertObject($citation) { @@ -61,7 +61,7 @@ public function insertObject($citation) /** * Retrieve a citation by id. * - * @param $citationId integer + * @param int $citationId * * @return Citation */ @@ -78,8 +78,8 @@ public function getById($citationId) /** * Import citations from a raw citation list of the particular publication. * - * @param $publicationId int - * @param $rawCitationList string + * @param int $publicationId + * @param string $rawCitationList */ public function importCitations($publicationId, $rawCitationList) { @@ -119,7 +119,7 @@ public function importCitations($publicationId, $rawCitationList) /** * Retrieve an array of citations matching a particular publication id. * - * @param $publicationId int + * @param int $publicationId * @param null|mixed $rangeInfo * * @return DAOResultFactory containing matching Citations @@ -140,7 +140,7 @@ public function getByPublicationId($publicationId, $rangeInfo = null) /** * Update an existing citation. * - * @param $citation Citation + * @param Citation $citation */ public function updateObject($citation) { @@ -163,9 +163,9 @@ public function updateObject($citation) /** * Delete a citation. * - * @param $citation Citation + * @param Citation $citation * - * @return boolean + * @return bool */ public function deleteObject($citation) { @@ -175,9 +175,9 @@ public function deleteObject($citation) /** * Delete a citation by id. * - * @param $citationId int + * @param int $citationId * - * @return boolean + * @return bool */ public function deleteById($citationId) { @@ -188,9 +188,9 @@ public function deleteById($citationId) /** * Delete all citations matching a particular publication id. * - * @param $publicationId int + * @param int $publicationId * - * @return boolean + * @return bool */ public function deleteByPublicationId($publicationId) { @@ -232,7 +232,7 @@ public function _newDataObject() * Internal function to return a citation object from a * row. * - * @param $row array + * @param array $row * * @return Citation */ @@ -252,7 +252,7 @@ public function _fromRow($row) /** * Update the citation meta-data * - * @param $citation Citation + * @param Citation $citation */ public function _updateObjectMetadata($citation) { diff --git a/classes/citation/CitationListTokenizerFilter.inc.php b/classes/citation/CitationListTokenizerFilter.inc.php index d4a4110247c..7e3d62aa68d 100644 --- a/classes/citation/CitationListTokenizerFilter.inc.php +++ b/classes/citation/CitationListTokenizerFilter.inc.php @@ -37,7 +37,7 @@ public function __construct() /** * @see Filter::process() * - * @param $input string + * @param string $input * * @return mixed array */ diff --git a/classes/cliTool/CommandLineTool.inc.php b/classes/cliTool/CommandLineTool.inc.php index c89b042d673..64bc0f97ad2 100644 --- a/classes/cliTool/CommandLineTool.inc.php +++ b/classes/cliTool/CommandLineTool.inc.php @@ -43,16 +43,6 @@ use PKP\plugins\PluginRegistry; use PKP\security\Role; -if (!isset($argc)) { - // In PHP < 4.3.0 $argc/$argv are not automatically registered - if (isset($_SERVER['argc'])) { - $argc = $_SERVER['argc']; - $argv = $_SERVER['argv']; - } else { - $argc = $argv = null; - } -} - class CommandLineTool { /** @var string the script being executed */ @@ -85,7 +75,7 @@ public function __construct($argv = []) $this->argv = isset($argv) && is_array($argv) ? $argv : []; if (isset($_SERVER['SERVER_NAME'])) { - die('This script can only be executed from the command-line'); + exit('This script can only be executed from the command-line'); } $this->scriptName = isset($this->argv[0]) ? array_shift($this->argv) : ''; @@ -144,7 +134,7 @@ private function checkArgsForUsername() /** * Sets the user for the CLI Tool * - * @param $user User The user to set as the execution user of this CLI command + * @param User $user The user to set as the execution user of this CLI command */ public function setUser($user) { diff --git a/classes/cliTool/InstallTool.inc.php b/classes/cliTool/InstallTool.inc.php index 78c7ae364e2..139c2a0a4e2 100644 --- a/classes/cliTool/InstallTool.inc.php +++ b/classes/cliTool/InstallTool.inc.php @@ -126,7 +126,7 @@ public function readParams() /** * Print input section title. * - * @param $title string + * @param string $title */ public function printTitle($title) { @@ -151,9 +151,9 @@ public function readInput() /** * Read a string parameter. * - * @param $name string - * @param $prompt string - * @param $defaultValue string + * @param string $name + * @param string $prompt + * @param string $defaultValue */ public function readParam($name, $prompt, $defaultValue = null) { @@ -176,9 +176,9 @@ public function readParam($name, $prompt, $defaultValue = null) /** * Prompt user for yes/no input. * - * @param $name string - * @param $prompt string - * @param $default string default value, 'Y' or 'N' + * @param string $name + * @param string $prompt + * @param string $default default value, 'Y' or 'N' */ public function readParamBoolean($name, $prompt, $default = 'N') { @@ -196,9 +196,9 @@ public function readParamBoolean($name, $prompt, $default = 'N') /** * Read a parameter from a set of options. * - * @param $name string - * @param $prompt string - * @param $options array + * @param string $name + * @param string $prompt + * @param array $options * @param null|mixed $defaultValue */ public function readParamOptions($name, $prompt, $options, $defaultValue = null, $allowMultiple = false) @@ -249,7 +249,7 @@ public function readParamOptions($name, $prompt, $options, $defaultValue = null, /** * Log install message to stdout. * - * @param $message string + * @param string $message */ public function log($message) { diff --git a/classes/cliTool/MergeUsersTool.inc.php b/classes/cliTool/MergeUsersTool.inc.php index 1dca5b3f784..90f8d99793c 100644 --- a/classes/cliTool/MergeUsersTool.inc.php +++ b/classes/cliTool/MergeUsersTool.inc.php @@ -28,7 +28,7 @@ class MergeUsersTool extends \PKP\cliTool\CommandLineTool /** * Constructor. * - * @param $argv array command-line arguments + * @param array $argv command-line arguments */ public function __construct($argv = []) { @@ -108,7 +108,7 @@ public function execute() /** * Get a username by specifier, i.e. username or id=xyz. * - * @param $specifier string The specifier + * @param string $specifier The specifier * * @return User|null */ diff --git a/classes/cliTool/ScheduledTaskTool.inc.php b/classes/cliTool/ScheduledTaskTool.inc.php index e0df9039247..d1da3d66411 100644 --- a/classes/cliTool/ScheduledTaskTool.inc.php +++ b/classes/cliTool/ScheduledTaskTool.inc.php @@ -34,7 +34,7 @@ class ScheduledTaskTool extends \PKP\cliTool\CommandLineTool /** * Constructor. * - * @param $argv array command-line arguments + * @param array $argv command-line arguments * If specified, the first parameter should be the path to * a tasks XML descriptor file (other than the default) */ @@ -76,7 +76,7 @@ public function execute() /** * Parse and execute the scheduled tasks in the specified file. * - * @param $file string + * @param string $file */ public function parseTasks($file) { @@ -108,8 +108,8 @@ public function parseTasks($file) /** * Execute the specified task. * - * @param $className string the class name to execute - * @param $args array the array of arguments to pass to the class constructors + * @param string $className the class name to execute + * @param array $args the array of arguments to pass to the class constructors */ public function executeTask($className, $args) { diff --git a/classes/cliTool/UpgradeTool.inc.php b/classes/cliTool/UpgradeTool.inc.php index d2593e700c4..4ff2c23965a 100644 --- a/classes/cliTool/UpgradeTool.inc.php +++ b/classes/cliTool/UpgradeTool.inc.php @@ -33,7 +33,7 @@ class UpgradeTool extends \PKP\cliTool\CommandLineTool /** * Constructor. * - * @param $argv array command-line arguments + * @param array $argv command-line arguments */ public function __construct($argv = []) { @@ -163,8 +163,8 @@ public function download() /** * Perform version check. * - * @param $versionInfo array latest version info - * @param $displayInfo boolean just display info, don't perform check + * @param array $versionInfo latest version info + * @param bool $displayInfo just display info, don't perform check */ public function checkVersion($versionInfo, $displayInfo = false) { @@ -217,7 +217,7 @@ public function checkVersion($versionInfo, $displayInfo = false) /** * Prompt user for yes/no input (default no). * - * @param $prompt string + * @param string $prompt */ public function promptContinue($prompt = 'Continue?') { @@ -229,7 +229,7 @@ public function promptContinue($prompt = 'Continue?') /** * Log install message to stdout. * - * @param $message string + * @param string $message */ public function log($message) { diff --git a/classes/components/PKPStatsComponent.inc.php b/classes/components/PKPStatsComponent.inc.php index eaab34148e9..9ddd79263da 100644 --- a/classes/components/PKPStatsComponent.inc.php +++ b/classes/components/PKPStatsComponent.inc.php @@ -37,8 +37,8 @@ class PKPStatsComponent /** * Constructor * - * @param $apiUrl string The URL to fetch stats from - * @param $args array Optional arguments + * @param string $apiUrl The URL to fetch stats from + * @param array $args Optional arguments */ public function __construct($apiUrl, $args = []) { @@ -52,7 +52,7 @@ public function __construct($apiUrl, $args = []) /** * Initialize the handler with config parameters * - * @param $args array Configuration params + * @param array $args Configuration params */ public function init($args = []) { diff --git a/classes/components/PKPStatsPublicationPage.inc.php b/classes/components/PKPStatsPublicationPage.inc.php index 50812bbdb11..ec3f4f888d0 100644 --- a/classes/components/PKPStatsPublicationPage.inc.php +++ b/classes/components/PKPStatsPublicationPage.inc.php @@ -31,10 +31,10 @@ class PKPStatsPublicationPage extends PKPStatsComponent /** @var array List of items to display stats for */ public $items = []; - /** @var integer The maximum number of items that stats can be shown for */ + /** @var int The maximum number of items that stats can be shown for */ public $itemsMax = 0; - /** @var integer How many items to show per page */ + /** @var int How many items to show per page */ public $count = 30; /** @var string Order items by this property */ diff --git a/classes/components/fileAttachers/BaseAttacher.inc.php b/classes/components/fileAttachers/BaseAttacher.inc.php new file mode 100644 index 00000000000..9c76941375d --- /dev/null +++ b/classes/components/fileAttachers/BaseAttacher.inc.php @@ -0,0 +1,50 @@ +label = $label; + $this->description = $description; + $this->button = $button; + } + + /** + * Compile the initial state for this file attacher + */ + public function getState(): array + { + return [ + 'component' => $this->component, + 'label' => $this->label, + 'description' => $this->description, + 'button' => $this->button, + ]; + } +} diff --git a/classes/components/fileAttachers/FileStage.inc.php b/classes/components/fileAttachers/FileStage.inc.php new file mode 100644 index 00000000000..dcfa7bb5bfe --- /dev/null +++ b/classes/components/fileAttachers/FileStage.inc.php @@ -0,0 +1,78 @@ +context = $context; + $this->submission = $submission; + } + + /** + * Add a submission file stage that can be used for attachments + */ + public function withFileStage(int $fileStage, string $label, ?ReviewRound $reviewRound = null): self + { + $queryParams = ['fileStages' => [$fileStage]]; + if ($reviewRound) { + $queryParams['reviewRoundIds'] = [$reviewRound->getId()]; + } + $this->fileStages[] = [ + 'label' => $label, + 'queryParams' => $queryParams, + ]; + return $this; + } + + /** + * Compile the props for this file attacher + */ + public function getState(): array + { + $props = parent::getState(); + + $request = Application::get()->getRequest(); + $props['submissionFilesApiUrl'] = $request->getDispatcher()->url( + $request, + Application::ROUTE_API, + $this->context->getData('urlPath'), + 'submissions/' . $this->submission->getId() . '/files' + ); + + $props['fileStages'] = $this->fileStages; + + return $props; + } +} diff --git a/classes/components/fileAttachers/Library.inc.php b/classes/components/fileAttachers/Library.inc.php new file mode 100644 index 00000000000..1684c3eca5f --- /dev/null +++ b/classes/components/fileAttachers/Library.inc.php @@ -0,0 +1,63 @@ +context = $context; + $this->submission = $submission; + } + + /** + * Compile the props for this file attacher + */ + public function getState(): array + { + $props = parent::getState(); + + $request = Application::get()->getRequest(); + $props['downloadLabel'] = __('common.download'); + $props['libraryApiUrl'] = $request->getDispatcher()->url( + $request, + Application::ROUTE_API, + $this->context->getData('urlPath'), + '_library' + ); + if ($this->submission) { + $props['includeSubmissionId'] = $this->submission->getId(); + } + + return $props; + } +} diff --git a/classes/components/fileAttachers/ReviewFiles.inc.php b/classes/components/fileAttachers/ReviewFiles.inc.php new file mode 100644 index 00000000000..5c069d7dd46 --- /dev/null +++ b/classes/components/fileAttachers/ReviewFiles.inc.php @@ -0,0 +1,96 @@ + $files */ + public iterable $files; + + /** @var array $reviewAssignments */ + public array $reviewAssignments; + + /** + * Initialize this file attacher + * + * @param string $label The label to display for this file attacher + * @param string $description A description of this file attacher + * @param string $button The label for the button to activate this file attacher + */ + public function __construct(string $label, string $description, string $button, iterable $files, array $reviewAssignments, Context $context) + { + parent::__construct($label, $description, $button); + $this->files = $files; + $this->reviewAssignments = $reviewAssignments; + $this->context = $context; + } + + /** + * Compile the props for this file attacher + */ + public function getState(): array + { + $props = parent::getState(); + $props['downloadLabel'] = __('common.download'); + $props['files'] = $this->getFilesState(); + + return $props; + } + + protected function getFilesState(): array + { + $request = Application::get()->getRequest(); + + $files = []; + /** @var SubmissionFile $file */ + foreach ($this->files as $file) { + if (!isset($this->reviewAssignments[$file->getData('assocId')])) { + throw new Exception('Tried to add review file attachment from unknown review assignment.'); + } + $files[] = [ + 'id' => $file->getId(), + 'name' => $file->getData('name'), + 'documentType' => Services::get('file')->getDocumentType($file->getData('documentType')), + 'reviewerName' => $this->reviewAssignments[$file->getData('assocId')]->getReviewerFullName(), + 'url' => $request->getDispatcher()->url( + $request, + Application::ROUTE_COMPONENT, + $this->context->getData('urlPath'), + 'api.file.FileApiHandler', + 'downloadFile', + null, + [ + 'submissionFileId' => $file->getId(), + 'submissionId' => $file->getData('submissionId'), + 'stageId' => Repo::submissionFile()->getWorkflowStageId($file), + ] + ), + ]; + } + + return $files; + } +} diff --git a/classes/components/fileAttachers/Upload.inc.php b/classes/components/fileAttachers/Upload.inc.php new file mode 100644 index 00000000000..d3f16310724 --- /dev/null +++ b/classes/components/fileAttachers/Upload.inc.php @@ -0,0 +1,70 @@ +context = $context; + } + + /** + * Compile the props for this file attacher + */ + public function getState(): array + { + $props = parent::getState(); + + $request = Application::get()->getRequest(); + $props['temporaryFilesApiUrl'] = $request->getDispatcher()->url( + $request, + Application::ROUTE_API, + $this->context->getData('urlPath'), + 'temporaryFiles' + ); + $props['dropzoneOptions'] = [ + 'maxFilesize' => Application::getIntMaxFileMBs(), + 'timeout' => ini_get('max_execution_time') ? ini_get('max_execution_time') * 1000 : 0, + 'dropzoneDictDefaultMessage' => __('form.dropzone.dictDefaultMessage'), + 'dropzoneDictFallbackMessage' => __('form.dropzone.dictFallbackMessage'), + 'dropzoneDictFallbackText' => __('form.dropzone.dictFallbackText'), + 'dropzoneDictFileTooBig' => __('form.dropzone.dictFileTooBig'), + 'dropzoneDictInvalidFileType' => __('form.dropzone.dictInvalidFileType'), + 'dropzoneDictResponseError' => __('form.dropzone.dictResponseError'), + 'dropzoneDictCancelUpload' => __('form.dropzone.dictCancelUpload'), + 'dropzoneDictUploadCanceled' => __('form.dropzone.dictUploadCanceled'), + 'dropzoneDictCancelUploadConfirmation' => __('form.dropzone.dictCancelUploadConfirmation'), + 'dropzoneDictRemoveFile' => __('form.dropzone.dictRemoveFile'), + 'dropzoneDictMaxFilesExceeded' => __('form.dropzone.dictMaxFilesExceeded'), + ]; + + return $props; + } +} diff --git a/classes/components/forms/Field.inc.php b/classes/components/forms/Field.inc.php index 97d14adbdd9..673a6e3c4c6 100644 --- a/classes/components/forms/Field.inc.php +++ b/classes/components/forms/Field.inc.php @@ -40,10 +40,10 @@ abstract class Field /** @var string Which group should this field be placed in? */ public $groupId; - /** @var boolean Is this field required? */ + /** @var bool Is this field required? */ public $isRequired = false; - /** @var boolean Is this field multilingual? */ + /** @var bool Is this field multilingual? */ public $isMultilingual = false; /** @var mixed The value of this field. If multilingual, expects a key/value array: ['en_US', => 'English value', 'fr_CA' => 'French value'] */ @@ -68,8 +68,8 @@ abstract class Field /** * Initialize the form field * - * @param $name string - * @param $args array [ + * @param string $name + * @param array $args [ * @option label string|object * @option groupId string * @option isRequired boolean @@ -139,7 +139,7 @@ public function getConfig() * * Check that no required fields are missing * - * @return boolean + * @return bool */ public function validate() { diff --git a/classes/components/forms/FieldAutosuggestPreset.inc.php b/classes/components/forms/FieldAutosuggestPreset.inc.php index ce22545e612..a8565dbce00 100644 --- a/classes/components/forms/FieldAutosuggestPreset.inc.php +++ b/classes/components/forms/FieldAutosuggestPreset.inc.php @@ -19,7 +19,7 @@ class FieldAutosuggestPreset extends FieldBaseAutosuggest /** @copydoc Field::$component */ public $component = 'field-autosuggest-preset'; - /** @param array Key/value list of suggestions for this field */ + /** @var array Key/value list of suggestions for this field */ public $options = []; /** diff --git a/classes/components/forms/FieldControlledVocab.inc.php b/classes/components/forms/FieldControlledVocab.inc.php index 5263ffb0883..d5424d305e2 100644 --- a/classes/components/forms/FieldControlledVocab.inc.php +++ b/classes/components/forms/FieldControlledVocab.inc.php @@ -19,7 +19,7 @@ class FieldControlledVocab extends FieldBaseAutosuggest /** @copydoc Field::$component */ public $component = 'field-controlled-vocab'; - /** @param array Key/value list of languages this field should support. Key = locale code. Value = locale name */ + /** @var array Key/value list of languages this field should support. Key = locale code. Value = locale name */ public $locales = []; /** @@ -49,7 +49,7 @@ public function getConfig() * Map the selected values to the format expected by an * autosuggest field * - * @param string value + * @param string $value * * @return array */ diff --git a/classes/components/forms/FieldMetadataSetting.inc.php b/classes/components/forms/FieldMetadataSetting.inc.php index e773ec0d7dd..7f682fcc49a 100644 --- a/classes/components/forms/FieldMetadataSetting.inc.php +++ b/classes/components/forms/FieldMetadataSetting.inc.php @@ -20,11 +20,11 @@ class FieldMetadataSetting extends FieldOptions /** @copydoc Field::$component */ public $component = 'field-metadata-setting'; - /** @var integer What is the value that represents metadata that is disabled */ + /** @var int What is the value that represents metadata that is disabled */ public $disabledValue = METADATA_DISABLE; /** - * @var integer What is the value that represents metadata that is enabled, + * @var int What is the value that represents metadata that is enabled, * but which is not requested or required during submission? */ public $enabledOnlyValue = METADATA_ENABLE; diff --git a/classes/components/forms/FieldOptions.inc.php b/classes/components/forms/FieldOptions.inc.php index a266e21a668..1771025db71 100644 --- a/classes/components/forms/FieldOptions.inc.php +++ b/classes/components/forms/FieldOptions.inc.php @@ -22,7 +22,7 @@ class FieldOptions extends Field /** @var string Use a checkbox or radio button input type */ public $type = 'checkbox'; - /** @var boolean Should the user be able to re-order the options? */ + /** @var bool Should the user be able to re-order the options? */ public $isOrderable = false; /** @var array The options which can be selected */ diff --git a/classes/components/forms/FieldPubId.inc.php b/classes/components/forms/FieldPubId.inc.php index f72d6dc30cb..0c26f8e7dbf 100644 --- a/classes/components/forms/FieldPubId.inc.php +++ b/classes/components/forms/FieldPubId.inc.php @@ -28,7 +28,7 @@ class FieldPubId extends Field /** @var string The journal/press initials to use when generating a pub id */ public $contextInitials; - /** @var boolean If a %p in the pattern should stand for press (OMP). Otherwise it means pages (OJS). */ + /** @var bool If a %p in the pattern should stand for press (OMP). Otherwise it means pages (OJS). */ public $isPForPress = false; /** @var string The issue number to use when generating a pub id */ diff --git a/classes/components/forms/FieldRichTextarea.inc.php b/classes/components/forms/FieldRichTextarea.inc.php index 92876a30420..47e9e40e024 100644 --- a/classes/components/forms/FieldRichTextarea.inc.php +++ b/classes/components/forms/FieldRichTextarea.inc.php @@ -14,8 +14,6 @@ namespace PKP\components\forms; -use APP\core\Application; - class FieldRichTextarea extends Field { /** @copydoc Field::$component */ @@ -30,9 +28,6 @@ class FieldRichTextarea extends Field /** @var array Optional. A key/value list of content that can be inserted from a TinyMCE button. */ public $preparedContent; - /** @var boolean Whether the $preparedContent properties should be replaced in the field's initial value. */ - public $renderPreparedContent = false; - /** @var string Optional. A preset size option. */ public $size; @@ -42,7 +37,7 @@ class FieldRichTextarea extends Field /** @var string Optional. The API endpoint to upload images to. Only include if image uploads are supported here. */ public $uploadUrl; - /** @var integer Optional. When a word limit is specified a word counter will be shown */ + /** @var int Optional. When a word limit is specified a word counter will be shown */ public $wordLimit = 0; /** @@ -67,7 +62,6 @@ public function getConfig() $config['preparedContent'] = $this->preparedContent; } $config['insertPreparedContentLabel'] = __('common.insert'); - $config['renderPreparedContent'] = $this->renderPreparedContent; if (!empty($this->size)) { $config['size'] = $this->size; } @@ -80,9 +74,6 @@ public function getConfig() $config['wordCountLabel'] = __('publication.wordCount'); } - // Load TinyMCE skin - $config['skinUrl'] = Application::get()->getRequest()->getBaseUrl() . '/lib/ui-library/public/styles/tinymce'; - return $config; } } diff --git a/classes/components/forms/FieldText.inc.php b/classes/components/forms/FieldText.inc.php index f593560f2e4..a360e8ab90e 100644 --- a/classes/components/forms/FieldText.inc.php +++ b/classes/components/forms/FieldText.inc.php @@ -22,7 +22,7 @@ class FieldText extends Field /** @var string What should the be? */ public $inputType = 'text'; - /** @var boolean Whether the user should have to click a button to edit the field */ + /** @var bool Whether the user should have to click a button to edit the field */ public $optIntoEdit = false; /** @var string The label of the button added by self::$optIntoEdit */ diff --git a/classes/components/forms/FormComponent.inc.php b/classes/components/forms/FormComponent.inc.php index 143f056ded1..d90e1bc93bf 100644 --- a/classes/components/forms/FormComponent.inc.php +++ b/classes/components/forms/FormComponent.inc.php @@ -16,12 +16,20 @@ namespace PKP\components\forms; use Exception; +use PKP\plugins\HookRegistry; define('FIELD_POSITION_BEFORE', 'before'); define('FIELD_POSITION_AFTER', 'after'); class FormComponent { + /** + * @var string An $action value that will emit an event + * when the form is submitted, instead of sending a + * HTTP request + */ + public const ACTION_EMIT = 'emit'; + /** @var string A unique ID for this form */ public $id = ''; @@ -40,6 +48,9 @@ class FormComponent /** @var array List of groups in this form. */ public $groups = []; + /** @var array List of hiddden fields in this form. */ + public $hiddenFields = []; + /** @var array List of pages in this form. */ public $pages = []; @@ -49,10 +60,10 @@ class FormComponent /** * Initialize the form with config parameters * - * @param $id string - * @param $method string - * @param $action string - * @param $locales array + * @param string $id + * @param string $method + * @param string $action + * @param array $locales */ public function __construct($id, $method, $action, $locales) { @@ -65,8 +76,8 @@ public function __construct($id, $method, $action, $locales) /** * Add a form field * - * @param $field Field - * @param $position array [ + * @param Field $field + * @param array $position [ * @option string One of FIELD_POSITION_BEFORE or FIELD_POSITION_AFTER * @option string The field to position it before or after * ] @@ -86,7 +97,7 @@ public function addField($field, $position = []) /** * Remove a form field * - * @param $fieldName string + * @param string $fieldName * * @return FormComponent */ @@ -101,7 +112,7 @@ public function removeField($fieldName) /** * Get a form field * - * @param $fieldName string + * @param string $fieldName * * @return Field */ @@ -118,13 +129,13 @@ public function getField($fieldName) /** * Add a form group * - * @param $args array [ + * @param array $args [ * @option id string Required A unique ID for this form group * @option label string A label to identify this group of fields. Will become the fieldset's * @option description string A description of this group of fields. * ] * - * @param $position array [ + * @param array $position [ * @option string One of FIELD_POSITION_BEFORE or FIELD_POSITION_AFTER * @option string The group to position it before or after * ] @@ -147,7 +158,7 @@ public function addGroup($args, $position = []) /** * Remove a form group * - * @param $groupId string + * @param string $groupId * * @return FormComponent */ @@ -165,14 +176,14 @@ public function removeGroup($groupId) /** * Add a form page * - * @param $args array [ + * @param array $args [ * @option id string Required A unique ID for this form page * @option label string The name of the page to identify it in the page list * @option submitButton array Required Assoc array defining submission/next button params. Supports any param of the Button component in the UI Library. * @option previousButton array Assoc array defining button params to go back to the previous page. Supports any param of the Button component in the UI Library. * ] * - * @param $position array [ + * @param array $position [ * @option string One of FIELD_POSITION_BEFORE or FIELD_POSITION_AFTER * @option string The page to position it before or after * ] @@ -195,7 +206,7 @@ public function addPage($args, $position = []) /** * Remove a form page * - * @param $pageId string + * @param string $pageId * * @return FormComponent */ @@ -215,10 +226,10 @@ public function removePage($pageId) /** * Add an field, group or page to a specific position in its array * - * @param $id string The id of the item to position before or after - * @param $list array The list of fields, groups or pages - * @param $item array The item to insert - * @param $position string FIELD_POSITION_BEFORE or FIELD_POSITION_AFTER + * @param string $id The id of the item to position before or after + * @param array $list The list of fields, groups or pages + * @param array $item The item to insert + * @param string $position FIELD_POSITION_BEFORE or FIELD_POSITION_AFTER * * @return array */ @@ -245,6 +256,14 @@ public function addToPosition($id, $list, $item, $position) ); } + /** + * Add a hidden field to this form + */ + public function addHiddenField(string $name, $value) + { + $this->hiddenFields[$name] = $value; + } + /** * Retrieve the configuration data to be used when initializing this * handler on the frontend @@ -253,11 +272,11 @@ public function addToPosition($id, $list, $item, $position) */ public function getConfig() { - if (empty($this->id) || empty($this->method) || empty($this->action)) { + if (empty($this->id) || empty($this->action) || ($this->action !== self::ACTION_EMIT && empty($this->method))) { throw new Exception('FormComponent::getConfig() was called but one or more required property is missing: id, method, action.'); } - \HookRegistry::call('Form::config::before', $this); + HookRegistry::call('Form::config::before', $this); // Add a default page/group if none exist if (!$this->groups) { @@ -289,6 +308,7 @@ public function getConfig() 'action' => $this->action, 'fields' => $fieldsConfig, 'groups' => $this->groups, + 'hiddenFields' => (object) $this->hiddenFields, 'pages' => $this->pages, 'primaryLocale' => \AppLocale::getPrimaryLocale(), 'visibleLocales' => $visibleLocales, @@ -304,7 +324,7 @@ public function getConfig() /** * Compile a configuration array for a single field * - * @param $field Field + * @param Field $field * * @return array */ diff --git a/classes/components/forms/announcement/PKPAnnouncementForm.inc.php b/classes/components/forms/announcement/PKPAnnouncementForm.inc.php index 91e0f0cb452..15892c399fe 100644 --- a/classes/components/forms/announcement/PKPAnnouncementForm.inc.php +++ b/classes/components/forms/announcement/PKPAnnouncementForm.inc.php @@ -32,9 +32,9 @@ class PKPAnnouncementForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $announcementContext Context The context to get supported announcement types + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $announcementContext The context to get supported announcement types */ public function __construct($action, $locales, $announcementContext) { diff --git a/classes/components/forms/context/PKPAnnouncementSettingsForm.inc.php b/classes/components/forms/context/PKPAnnouncementSettingsForm.inc.php index ccb687d850e..99d36d8cc5c 100644 --- a/classes/components/forms/context/PKPAnnouncementSettingsForm.inc.php +++ b/classes/components/forms/context/PKPAnnouncementSettingsForm.inc.php @@ -32,9 +32,9 @@ class PKPAnnouncementSettingsForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { diff --git a/classes/components/forms/context/PKPAppearanceAdvancedForm.inc.php b/classes/components/forms/context/PKPAppearanceAdvancedForm.inc.php index 1c873c89f43..d537622f12f 100644 --- a/classes/components/forms/context/PKPAppearanceAdvancedForm.inc.php +++ b/classes/components/forms/context/PKPAppearanceAdvancedForm.inc.php @@ -32,12 +32,12 @@ class PKPAppearanceAdvancedForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for - * @param $baseUrl string Site's base URL. Used for image previews. - * @param $temporaryFileApiUrl string URL to upload files to - * @param $imageUploadUrl string The API endpoint for images uploaded through the rich text field + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for + * @param string $baseUrl Site's base URL. Used for image previews. + * @param string $temporaryFileApiUrl URL to upload files to + * @param string $imageUploadUrl The API endpoint for images uploaded through the rich text field */ public function __construct($action, $locales, $context, $baseUrl, $temporaryFileApiUrl, $imageUploadUrl) { diff --git a/classes/components/forms/context/PKPAppearanceSetupForm.inc.php b/classes/components/forms/context/PKPAppearanceSetupForm.inc.php index b7325f3a4da..f182fb6439e 100644 --- a/classes/components/forms/context/PKPAppearanceSetupForm.inc.php +++ b/classes/components/forms/context/PKPAppearanceSetupForm.inc.php @@ -33,12 +33,12 @@ class PKPAppearanceSetupForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for - * @param $baseUrl string Site's base URL. Used for image previews. - * @param $temporaryFileApiUrl string URL to upload files to - * @param $imageUploadUrl string The API endpoint for images uploaded through the rich text field + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for + * @param string $baseUrl Site's base URL. Used for image previews. + * @param string $temporaryFileApiUrl URL to upload files to + * @param string $imageUploadUrl The API endpoint for images uploaded through the rich text field */ public function __construct($action, $locales, $context, $baseUrl, $temporaryFileApiUrl, $imageUploadUrl) { diff --git a/classes/components/forms/context/PKPAuthorGuidelinesForm.inc.php b/classes/components/forms/context/PKPAuthorGuidelinesForm.inc.php index 3fbe511a9a9..f55013c9cf5 100644 --- a/classes/components/forms/context/PKPAuthorGuidelinesForm.inc.php +++ b/classes/components/forms/context/PKPAuthorGuidelinesForm.inc.php @@ -30,9 +30,9 @@ class PKPAuthorGuidelinesForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { diff --git a/classes/components/forms/context/PKPContactForm.inc.php b/classes/components/forms/context/PKPContactForm.inc.php index e23f828deb2..c60a7eca179 100644 --- a/classes/components/forms/context/PKPContactForm.inc.php +++ b/classes/components/forms/context/PKPContactForm.inc.php @@ -31,9 +31,9 @@ class PKPContactForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { diff --git a/classes/components/forms/context/PKPContextForm.inc.php b/classes/components/forms/context/PKPContextForm.inc.php index da4cbede6bb..a1ca422efdd 100644 --- a/classes/components/forms/context/PKPContextForm.inc.php +++ b/classes/components/forms/context/PKPContextForm.inc.php @@ -34,10 +34,10 @@ class PKPContextForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $baseUrl string Base URL for the site - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param string $baseUrl Base URL for the site + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $baseUrl, $context) { diff --git a/classes/components/forms/context/PKPDateTimeForm.inc.php b/classes/components/forms/context/PKPDateTimeForm.inc.php index edf948c5b43..4e3d2f9f3ee 100644 --- a/classes/components/forms/context/PKPDateTimeForm.inc.php +++ b/classes/components/forms/context/PKPDateTimeForm.inc.php @@ -30,9 +30,9 @@ class PKPDateTimeForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context \Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param \Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { @@ -132,7 +132,7 @@ public function __construct($action, $locales, $context) /** * Set localized options for date/time fields * - * @param $optionValues array options to pass to the field + * @param array $optionValues options to pass to the field * * @return array */ diff --git a/classes/components/forms/context/PKPDisableSubmissionsForm.inc.php b/classes/components/forms/context/PKPDisableSubmissionsForm.inc.php index f0340a4f578..5c7f68beef5 100644 --- a/classes/components/forms/context/PKPDisableSubmissionsForm.inc.php +++ b/classes/components/forms/context/PKPDisableSubmissionsForm.inc.php @@ -30,9 +30,9 @@ class PKPDisableSubmissionsForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { diff --git a/classes/components/forms/context/PKPEmailSetupForm.inc.php b/classes/components/forms/context/PKPEmailSetupForm.inc.php index 52f856baed5..d63e4561a13 100644 --- a/classes/components/forms/context/PKPEmailSetupForm.inc.php +++ b/classes/components/forms/context/PKPEmailSetupForm.inc.php @@ -15,6 +15,7 @@ namespace PKP\components\forms\context; use PKP\components\forms\FieldHTML; +use PKP\components\forms\FieldOptions; use PKP\components\forms\FieldRichTextarea; use PKP\components\forms\FieldText; use PKP\components\forms\FormComponent; @@ -32,39 +33,50 @@ class PKPEmailSetupForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { $this->action = $action; $this->locales = $locales; + $this->addField(new FieldOptions('notifyAllAuthors', [ + 'label' => __('manager.setup.notifyAllAuthors'), + 'description' => __('manager.setup.notifyAllAuthors.description'), + 'type' => 'radio', + 'options' => [ + ['value' => true, 'label' => __('manager.setup.notifyAllAuthors.allAuthors')], + ['value' => false, 'label' => __('manager.setup.notifyAllAuthors.assignedAuthors')], + ], + 'value' => $context->getData('notifyAllAuthors'), + ])); + $this->addField(new FieldRichTextarea('emailSignature', [ 'label' => __('manager.setup.emailSignature'), 'tooltip' => __('manager.setup.emailSignature.description'), 'value' => $context->getData('emailSignature'), 'preparedContent' => [ - 'contextName' => $context->getLocalizedName(), - 'senderName' => __('email.senderName'), - 'senderEmail' => __('email.senderEmail'), - 'mailingAddress' => htmlspecialchars(nl2br($context->getData('mailingAddress'))), - 'contactEmail' => htmlspecialchars($context->getData('contactEmail')), - 'contactName' => htmlspecialchars($context->getData('contactName')), + 'contextName' => '{$contextName}', + 'senderName' => '{$senderName}', + 'senderEmail' => '{$senderEmail}', + 'mailingAddress' => '{$mailingAddress}', + 'contactEmail' => '{$contactEmail}', + 'contactName' => '{$contactName}', ] ])); - $this->buildEnveloperSenderField($context); + $this->addEnveloperSenderField($context); } /** * Build the enveloper sender field * - * @param $context Context Journal or Press to change settings for + * @param Context $context Journal or Press to change settings for * */ - protected function buildEnveloperSenderField($context) + protected function addEnveloperSenderField($context) { $canEnvelopeSender = \Config::getVar('email', 'allow_envelope_sender'); diff --git a/classes/components/forms/context/PKPInformationForm.inc.php b/classes/components/forms/context/PKPInformationForm.inc.php index 1ea62397a10..718f333d615 100644 --- a/classes/components/forms/context/PKPInformationForm.inc.php +++ b/classes/components/forms/context/PKPInformationForm.inc.php @@ -31,10 +31,10 @@ class PKPInformationForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for - * @param $imageUploadUrl string The API endpoint for images uploaded through the rich text field + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for + * @param string $imageUploadUrl The API endpoint for images uploaded through the rich text field */ public function __construct($action, $locales, $context, $imageUploadUrl) { diff --git a/classes/components/forms/context/PKPLicenseForm.inc.php b/classes/components/forms/context/PKPLicenseForm.inc.php index 94e2735255e..43815fc553d 100644 --- a/classes/components/forms/context/PKPLicenseForm.inc.php +++ b/classes/components/forms/context/PKPLicenseForm.inc.php @@ -32,9 +32,9 @@ class PKPLicenseForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { diff --git a/classes/components/forms/context/PKPListsForm.inc.php b/classes/components/forms/context/PKPListsForm.inc.php index b7515c1f40e..0dbeae95a7d 100644 --- a/classes/components/forms/context/PKPListsForm.inc.php +++ b/classes/components/forms/context/PKPListsForm.inc.php @@ -31,9 +31,9 @@ class PKPListsForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { diff --git a/classes/components/forms/context/PKPMastheadForm.inc.php b/classes/components/forms/context/PKPMastheadForm.inc.php index c5baf44b697..52c48e976ff 100644 --- a/classes/components/forms/context/PKPMastheadForm.inc.php +++ b/classes/components/forms/context/PKPMastheadForm.inc.php @@ -33,10 +33,10 @@ class PKPMastheadForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for - * @param $imageUploadUrl string The API endpoint for images uploaded through the rich text field + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for + * @param string $imageUploadUrl The API endpoint for images uploaded through the rich text field */ public function __construct($action, $locales, $context, $imageUploadUrl) { diff --git a/classes/components/forms/context/PKPMetadataSettingsForm.inc.php b/classes/components/forms/context/PKPMetadataSettingsForm.inc.php index 62d7e83cd67..2b2962cd227 100644 --- a/classes/components/forms/context/PKPMetadataSettingsForm.inc.php +++ b/classes/components/forms/context/PKPMetadataSettingsForm.inc.php @@ -31,8 +31,8 @@ class PKPMetadataSettingsForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $context) { diff --git a/classes/components/forms/context/PKPPaymentSettingsForm.inc.php b/classes/components/forms/context/PKPPaymentSettingsForm.inc.php index f146f371e45..1b169bf9f8d 100644 --- a/classes/components/forms/context/PKPPaymentSettingsForm.inc.php +++ b/classes/components/forms/context/PKPPaymentSettingsForm.inc.php @@ -33,9 +33,9 @@ class PKPPaymentSettingsForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { diff --git a/classes/components/forms/context/PKPPrivacyForm.inc.php b/classes/components/forms/context/PKPPrivacyForm.inc.php index 89cbf64e9dc..3a5e1af584c 100644 --- a/classes/components/forms/context/PKPPrivacyForm.inc.php +++ b/classes/components/forms/context/PKPPrivacyForm.inc.php @@ -30,10 +30,10 @@ class PKPPrivacyForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for - * @param $imageUploadUrl string The API endpoint for images uploaded through the rich text field + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for + * @param string $imageUploadUrl The API endpoint for images uploaded through the rich text field */ public function __construct($action, $locales, $context, $imageUploadUrl) { diff --git a/classes/components/forms/context/PKPReviewGuidanceForm.inc.php b/classes/components/forms/context/PKPReviewGuidanceForm.inc.php index c109126d6ab..48b5fd201f3 100644 --- a/classes/components/forms/context/PKPReviewGuidanceForm.inc.php +++ b/classes/components/forms/context/PKPReviewGuidanceForm.inc.php @@ -31,9 +31,9 @@ class PKPReviewGuidanceForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { diff --git a/classes/components/forms/context/PKPReviewSetupForm.inc.php b/classes/components/forms/context/PKPReviewSetupForm.inc.php index 20dfdc9e2be..a962d3ccc74 100644 --- a/classes/components/forms/context/PKPReviewSetupForm.inc.php +++ b/classes/components/forms/context/PKPReviewSetupForm.inc.php @@ -34,9 +34,9 @@ class PKPReviewSetupForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { diff --git a/classes/components/forms/context/PKPSearchIndexingForm.inc.php b/classes/components/forms/context/PKPSearchIndexingForm.inc.php index 3afc17d6c83..bf5eafe43c6 100644 --- a/classes/components/forms/context/PKPSearchIndexingForm.inc.php +++ b/classes/components/forms/context/PKPSearchIndexingForm.inc.php @@ -31,10 +31,10 @@ class PKPSearchIndexingForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for - * @param $sitemapUrl string A URL to the context's sitemap for use in the + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for + * @param string $sitemapUrl A URL to the context's sitemap for use in the * search engine indexing group description */ public function __construct($action, $locales, $context, $sitemapUrl) diff --git a/classes/components/forms/context/PKPSubmissionsNotificationsForm.inc.php b/classes/components/forms/context/PKPSubmissionsNotificationsForm.inc.php index 3135958bcf3..ec32073e96a 100644 --- a/classes/components/forms/context/PKPSubmissionsNotificationsForm.inc.php +++ b/classes/components/forms/context/PKPSubmissionsNotificationsForm.inc.php @@ -32,9 +32,9 @@ class PKPSubmissionsNotificationsForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $locales, $context) { @@ -54,7 +54,7 @@ public function __construct($action, $locales, $context) /** * Build the copy submission ack primary contact field * - * @param $context Context Journal or Press to change settings for + * @param Context $context Journal or Press to change settings for * */ protected function buildCopySubmissionAckPrimaryContactField($context) diff --git a/classes/components/forms/context/PKPThemeForm.inc.php b/classes/components/forms/context/PKPThemeForm.inc.php index c1cbdb3c43b..95d6dad8ffe 100644 --- a/classes/components/forms/context/PKPThemeForm.inc.php +++ b/classes/components/forms/context/PKPThemeForm.inc.php @@ -41,9 +41,9 @@ class PKPThemeForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $context Context|null Journal/Press to change settings for, or null + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Context|null $context Journal/Press to change settings for, or null * to change settings for the Site */ public function __construct($action, $locales, $context = null) @@ -100,9 +100,9 @@ public function __construct($action, $locales, $context = null) * Add a form field that should only appear when a particular theme is * selected * - * @param $theme string The theme's base plugin path - * @param $field Field - * @param $position array [ + * @param string $theme The theme's base plugin path + * @param Field $field + * @param array $position [ * @option string One of `before` or `after` * @option string The field to position it before or after * ] diff --git a/classes/components/forms/context/PKPUserAccessForm.inc.php b/classes/components/forms/context/PKPUserAccessForm.inc.php index 2b1a8916aac..baa6d3d7523 100644 --- a/classes/components/forms/context/PKPUserAccessForm.inc.php +++ b/classes/components/forms/context/PKPUserAccessForm.inc.php @@ -31,8 +31,8 @@ class PKPUserAccessForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $context Context Journal or Press to change settings for + * @param string $action URL to submit the form to + * @param Context $context Journal or Press to change settings for */ public function __construct($action, $context) { diff --git a/classes/components/forms/decision/RequestPaymentDecisionForm.inc.php b/classes/components/forms/decision/RequestPaymentDecisionForm.inc.php new file mode 100644 index 00000000000..498a8c69005 --- /dev/null +++ b/classes/components/forms/decision/RequestPaymentDecisionForm.inc.php @@ -0,0 +1,56 @@ +addField(new FieldOptions('requestPayment', [ + 'label' => __('common.payment'), + 'type' => 'radio', + 'options' => [ + [ + 'value' => true, + 'label' => __( + 'payment.requestPublicationFee', + ['feeAmount' => $context->getData('publicationFee') . ' ' . $context->getData('currency')] + ), + ], + [ + 'value' => false, + 'label' => __('payment.waive'), + ], + ], + 'value' => true, + 'groupId' => 'default', + ])); + } +} diff --git a/classes/components/forms/decision/SelectRevisionDecisionForm.inc.php b/classes/components/forms/decision/SelectRevisionDecisionForm.inc.php new file mode 100644 index 00000000000..4e671d7cc94 --- /dev/null +++ b/classes/components/forms/decision/SelectRevisionDecisionForm.inc.php @@ -0,0 +1,61 @@ +addField(new FieldOptions('decision', [ + 'label' => __('editor.review.newReviewRound'), + 'type' => 'radio', + 'options' => [ + [ + 'value' => Decision::PENDING_REVISIONS, + 'label' => __('editor.review.NotifyAuthorRevisions'), + ], + [ + 'value' => Decision::RESUBMIT, + 'label' => __('editor.review.NotifyAuthorResubmit'), + ], + ], + 'value' => Decision::PENDING_REVISIONS, + 'groupId' => 'default', + ])) + ->addGroup([ + 'id' => 'default', + 'pageId' => 'default', + ]) + ->addPage([ + 'id' => 'default', + 'submitButton' => ['label' => __('help.next')] + ]); + } +} diff --git a/classes/components/forms/decision/SelectRevisionRecommendationForm.inc.php b/classes/components/forms/decision/SelectRevisionRecommendationForm.inc.php new file mode 100644 index 00000000000..6fc60867eb6 --- /dev/null +++ b/classes/components/forms/decision/SelectRevisionRecommendationForm.inc.php @@ -0,0 +1,61 @@ +addField(new FieldOptions('decision', [ + 'label' => __('editor.review.newReviewRound'), + 'type' => 'radio', + 'options' => [ + [ + 'value' => Decision::RECOMMEND_PENDING_REVISIONS, + 'label' => __('editor.review.NotifyAuthorRevisions.recommendation'), + ], + [ + 'value' => Decision::RECOMMEND_RESUBMIT, + 'label' => __('editor.review.NotifyAuthorResubmit.recommendation'), + ], + ], + 'value' => Decision::RECOMMEND_PENDING_REVISIONS, + 'groupId' => 'default', + ])) + ->addGroup([ + 'id' => 'default', + 'pageId' => 'default', + ]) + ->addPage([ + 'id' => 'default', + 'submitButton' => ['label' => __('help.next')] + ]); + } +} diff --git a/classes/components/forms/emailTemplate/PKPEmailTemplateForm.inc.php b/classes/components/forms/emailTemplate/PKPEmailTemplateForm.inc.php index 1835c2b484b..bbb3c9133fe 100644 --- a/classes/components/forms/emailTemplate/PKPEmailTemplateForm.inc.php +++ b/classes/components/forms/emailTemplate/PKPEmailTemplateForm.inc.php @@ -29,9 +29,9 @@ class PKPEmailTemplateForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $emailTemplate EmailTemplate + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param EmailTemplate $emailTemplate */ public function __construct($action, $locales, $emailTemplate = null) { diff --git a/classes/components/forms/publication/PKPCitationsForm.inc.php b/classes/components/forms/publication/PKPCitationsForm.inc.php index 0cb0aeb1b6b..e0c03be5900 100644 --- a/classes/components/forms/publication/PKPCitationsForm.inc.php +++ b/classes/components/forms/publication/PKPCitationsForm.inc.php @@ -30,8 +30,8 @@ class PKPCitationsForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $publication Publication The publication to change settings for + * @param string $action URL to submit the form to + * @param Publication $publication The publication to change settings for */ public function __construct($action, $publication) { diff --git a/classes/components/forms/publication/PKPContributorForm.inc.php b/classes/components/forms/publication/PKPContributorForm.inc.php new file mode 100644 index 00000000000..65b822fb439 --- /dev/null +++ b/classes/components/forms/publication/PKPContributorForm.inc.php @@ -0,0 +1,127 @@ +action = $action; + $this->locales = $locales; + + $userGroupDao = \DAORegistry::getDAO('UserGroupDAO'); /** @var \UserGroupDAO $userGroupDao */ + $authorUserGroups = $userGroupDao->getByRoleId($context->getId(), Role::ROLE_ID_AUTHOR)->toArray(); + + $authorUserGroupsOptions = []; + $firstAuthorUserGroupId = null; + foreach ($authorUserGroups as $authorUserGroup) { + if (!isset($firstAuthorUserGroupId)) { + $firstAuthorUserGroupId = (int) $authorUserGroup->getId(); + } + + $authorUserGroupsOptions[] = [ + 'value' => (int) $authorUserGroup->getId(), + 'label' => $authorUserGroup->getLocalizedName(), + ]; + } + + $isoCodes = app(IsoCodesFactory::class); + $countries = []; + foreach ($isoCodes->getCountries() as $country) { + $countries[] = [ + 'value' => $country->getAlpha2(), + 'label' => $country->getLocalName() + ]; + } + usort($countries, function ($a, $b) { + return strcmp($a['label'], $b['label']); + }); + + $this->addField(new FieldText('givenName', [ + 'label' => __('user.givenName'), + 'isMultilingual' => true, + 'isRequired' => true + ])) + ->addField(new FieldText('familyName', [ + 'label' => __('user.familyName'), + 'isMultilingual' => true, + ])) + ->addField(new FieldText('preferredPublicName', [ + 'label' => __('user.preferredPublicName'), + 'description' => __('user.preferredPublicName.description'), + 'isMultilingual' => true, + ])) + ->addField(new FieldText('email', [ + 'label' => __('user.email'), + 'isRequired' => true, + ])) + ->addField(new FieldSelect('country', [ + 'label' => __('common.country'), + 'options' => $countries, + 'isRequired' => true, + ])) + ->addField(new FieldText('url', [ + 'label' => __('user.url'), + ])) + ->addField(new FieldText('orcid', [ + 'label' => __('user.orcid'), + ])) + ->addField(new FieldRichTextarea('biography', [ + 'label' => __('user.biography'), + 'isMultilingual' => true, + ])) + ->addField(new FieldText('affiliation', [ + 'label' => __('user.affiliation'), + 'isMultilingual' => true, + ])) + ->addField(new FieldOptions('userGroupId', [ + 'label' => __('submission.submit.contributorRole'), + 'type' => 'radio', + 'value' => $firstAuthorUserGroupId, + 'options' => $authorUserGroupsOptions, + ])) + ->addField(new FieldOptions('includeInBrowse', [ + 'label' => __('submission.submit.includeInBrowse.title'), + 'type' => 'checkbox', + 'value' => true, + 'options' => [ + ['value' => true, 'label' => __('submission.submit.includeInBrowse')], + ] + ])); + } +} diff --git a/classes/components/forms/publication/PKPMetadataForm.inc.php b/classes/components/forms/publication/PKPMetadataForm.inc.php index 8289b0e7885..6aed659437b 100644 --- a/classes/components/forms/publication/PKPMetadataForm.inc.php +++ b/classes/components/forms/publication/PKPMetadataForm.inc.php @@ -31,11 +31,11 @@ class PKPMetadataForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $publication Publication The publication to change settings for - * @param $submissionContext Context The journal or press of the submission. - * @param $suggestionUrlBase string The base URL to get suggestions for controlled vocab. + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Publication $publication The publication to change settings for + * @param Context $submissionContext The journal or press of the submission. + * @param string $suggestionUrlBase The base URL to get suggestions for controlled vocab. */ public function __construct($action, $locales, $publication, $submissionContext, $suggestionUrlBase) { diff --git a/classes/components/forms/publication/PKPPublicationIdentifiersForm.inc.php b/classes/components/forms/publication/PKPPublicationIdentifiersForm.inc.php index 24da9c24290..a0f213ff959 100644 --- a/classes/components/forms/publication/PKPPublicationIdentifiersForm.inc.php +++ b/classes/components/forms/publication/PKPPublicationIdentifiersForm.inc.php @@ -35,10 +35,10 @@ class PKPPublicationIdentifiersForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $publication Publication The publication to change settings for - * @param $submissionContext Context The journal/press this publication exists in + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Publication $publication The publication to change settings for + * @param Context $submissionContext The journal/press this publication exists in */ public function __construct($action, $locales, $publication, $submissionContext) { diff --git a/classes/components/forms/publication/PKPPublicationLicenseForm.inc.php b/classes/components/forms/publication/PKPPublicationLicenseForm.inc.php index a04de550c8c..01c0b0b2bbc 100644 --- a/classes/components/forms/publication/PKPPublicationLicenseForm.inc.php +++ b/classes/components/forms/publication/PKPPublicationLicenseForm.inc.php @@ -30,11 +30,11 @@ class PKPPublicationLicenseForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $publication Publication The publication to change settings for - * @param $context Context The publication's context - * @param $userGroups array User groups in this context + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Publication $publication The publication to change settings for + * @param Context $context The publication's context + * @param array $userGroups User groups in this context */ public function __construct($action, $locales, $publication, $context, $userGroups) { diff --git a/classes/components/forms/publication/PKPTitleAbstractForm.inc.php b/classes/components/forms/publication/PKPTitleAbstractForm.inc.php index df3969cdbfa..ebd1c32725c 100644 --- a/classes/components/forms/publication/PKPTitleAbstractForm.inc.php +++ b/classes/components/forms/publication/PKPTitleAbstractForm.inc.php @@ -31,9 +31,9 @@ class PKPTitleAbstractForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $publication Publication The publication to change settings for + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Publication $publication The publication to change settings for */ public function __construct($action, $locales, $publication) { diff --git a/classes/components/forms/site/PKPSiteAppearanceForm.inc.php b/classes/components/forms/site/PKPSiteAppearanceForm.inc.php index 7ab879b1cd9..975a0916fee 100644 --- a/classes/components/forms/site/PKPSiteAppearanceForm.inc.php +++ b/classes/components/forms/site/PKPSiteAppearanceForm.inc.php @@ -33,11 +33,11 @@ class PKPSiteAppearanceForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $site Site - * @param $baseUrl string Site's base URL. Used for image previews. - * @param $temporaryFileApiUrl string URL to upload files to + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Site $site + * @param string $baseUrl Site's base URL. Used for image previews. + * @param string $temporaryFileApiUrl URL to upload files to */ public function __construct($action, $locales, $site, $baseUrl, $temporaryFileApiUrl) { diff --git a/classes/components/forms/site/PKPSiteBulkEmailsForm.inc.php b/classes/components/forms/site/PKPSiteBulkEmailsForm.inc.php index 046bfc160ba..fdb8a26d587 100644 --- a/classes/components/forms/site/PKPSiteBulkEmailsForm.inc.php +++ b/classes/components/forms/site/PKPSiteBulkEmailsForm.inc.php @@ -32,7 +32,7 @@ class PKPSiteBulkEmailsForm extends FormComponent * * @param string $action URL to submit the form to * @param Site $site - * @param Array $contexts List of context summary objects. See PKPContextQueryBuilder::getManySummary() + * @param array $contexts List of context summary objects. See PKPContextQueryBuilder::getManySummary() */ public function __construct($action, $site, $contexts) { diff --git a/classes/components/forms/site/PKPSiteConfigForm.inc.php b/classes/components/forms/site/PKPSiteConfigForm.inc.php index c17190173a4..2acb5221db6 100644 --- a/classes/components/forms/site/PKPSiteConfigForm.inc.php +++ b/classes/components/forms/site/PKPSiteConfigForm.inc.php @@ -31,9 +31,9 @@ class PKPSiteConfigForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $site Site + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Site $site */ public function __construct($action, $locales, $site) { diff --git a/classes/components/forms/site/PKPSiteInformationForm.inc.php b/classes/components/forms/site/PKPSiteInformationForm.inc.php index 1dce6da021e..ec7e6acbd91 100644 --- a/classes/components/forms/site/PKPSiteInformationForm.inc.php +++ b/classes/components/forms/site/PKPSiteInformationForm.inc.php @@ -31,9 +31,9 @@ class PKPSiteInformationForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $locales array Supported locales - * @param $site Site + * @param string $action URL to submit the form to + * @param array $locales Supported locales + * @param Site $site */ public function __construct($action, $locales, $site) { diff --git a/classes/components/forms/submission/PKPSubmissionFileForm.inc.php b/classes/components/forms/submission/PKPSubmissionFileForm.inc.php index aa784d62372..e19ecc601d9 100644 --- a/classes/components/forms/submission/PKPSubmissionFileForm.inc.php +++ b/classes/components/forms/submission/PKPSubmissionFileForm.inc.php @@ -30,8 +30,8 @@ class PKPSubmissionFileForm extends FormComponent /** * Constructor * - * @param $action string URL to submit the form to - * @param $genres array List of genres to use as options + * @param string $action URL to submit the form to + * @param array $genres List of genres to use as options */ public function __construct($action, $genres) { diff --git a/classes/components/listPanels/ListPanel.inc.php b/classes/components/listPanels/ListPanel.inc.php index 166508331cd..b4daaed38f3 100644 --- a/classes/components/listPanels/ListPanel.inc.php +++ b/classes/components/listPanels/ListPanel.inc.php @@ -28,7 +28,7 @@ class ListPanel /** @var string The appropriate heading level for this component */ public $headingLevel = 'h2'; - /** @var boolean Should the sidebar be visible on initial load? */ + /** @var bool Should the sidebar be visible on initial load? */ public $isSidebarVisible = false; /** @var string An ID for this component */ @@ -43,9 +43,9 @@ class ListPanel /** * Initialize the form with config parameters * - * @param $id string - * @param $title string - * @param $args array Configuration params + * @param string $id + * @param string $title + * @param array $args Configuration params */ public function __construct($id, $title, $args = []) { @@ -57,7 +57,7 @@ public function __construct($id, $title, $args = []) /** * Set configuration data for the component * - * @param $args array Configuration params + * @param array $args Configuration params * * @return */ diff --git a/classes/components/listPanels/PKPAnnouncementsListPanel.inc.php b/classes/components/listPanels/PKPAnnouncementsListPanel.inc.php index eaa453a24a4..05283957b76 100644 --- a/classes/components/listPanels/PKPAnnouncementsListPanel.inc.php +++ b/classes/components/listPanels/PKPAnnouncementsListPanel.inc.php @@ -34,9 +34,9 @@ class PKPAnnouncementsListPanel extends ListPanel /** * Initialize the form with config parameters * - * @param $id string - * @param $title string - * @param $args array Configuration params + * @param string $id + * @param string $title + * @param array $args Configuration params */ public function __construct($id, $title, $args = []) { diff --git a/classes/components/listPanels/PKPContributorsListPanel.inc.php b/classes/components/listPanels/PKPContributorsListPanel.inc.php new file mode 100644 index 00000000000..2d880c36753 --- /dev/null +++ b/classes/components/listPanels/PKPContributorsListPanel.inc.php @@ -0,0 +1,71 @@ + __('grid.action.addContributor'), + 'confirmDeleteMessage' => __('grid.action.deleteContributor.confirmationMessage'), + 'deleteContributorLabel' => __('grid.action.delete'), + 'editContributorLabel' => __('grid.action.edit'), + 'form' => $this->form->getConfig(), + 'canEditPublication' => $this->canEditPublication, + ] + ); + + return $config; + } +} diff --git a/classes/components/listPanels/PKPEmailTemplatesListPanel.inc.php b/classes/components/listPanels/PKPEmailTemplatesListPanel.inc.php index 2f743f0b482..7023343ebc5 100644 --- a/classes/components/listPanels/PKPEmailTemplatesListPanel.inc.php +++ b/classes/components/listPanels/PKPEmailTemplatesListPanel.inc.php @@ -23,13 +23,13 @@ class PKPEmailTemplatesListPanel extends ListPanel /** @var string URL to the API endpoint where items can be retrieved */ public $apiUrl = ''; - /** @param array Form for adding or editing an email template */ + /** @var array Form for adding or editing an email template */ public $form = []; /** @var array Query parameters to pass if this list executes GET requests */ public $getParams = []; - /** @var boolean Whether or not this component should be lazy-loaded */ + /** @var bool Whether or not this component should be lazy-loaded */ public $lazyLoad = []; /** @var int Max number of items available to display in this list panel */ @@ -38,10 +38,10 @@ class PKPEmailTemplatesListPanel extends ListPanel /** * Initialize the form with config parameters * - * @param $id string - * @param $title string - * @param $supportedLocales array - * @param $args array Configuration params + * @param string $id + * @param string $title + * @param array $supportedLocales + * @param array $args Configuration params */ public function __construct($id, $title, $supportedLocales, $args = []) { diff --git a/classes/components/listPanels/PKPSelectReviewerListPanel.inc.php b/classes/components/listPanels/PKPSelectReviewerListPanel.inc.php index 941967fac30..2e7d4c194f9 100644 --- a/classes/components/listPanels/PKPSelectReviewerListPanel.inc.php +++ b/classes/components/listPanels/PKPSelectReviewerListPanel.inc.php @@ -21,7 +21,7 @@ class PKPSelectReviewerListPanel extends ListPanel /** @var string URL to the API endpoint where items can be retrieved */ public $apiUrl = ''; - /** @var integer Number of items to show at one time */ + /** @var int Number of items to show at one time */ public $count = 30; /** @var array List of user IDs already assigned as a reviewer to this submission */ @@ -30,7 +30,7 @@ class PKPSelectReviewerListPanel extends ListPanel /** @var array Query parameters to pass if this list executes GET requests */ public $getParams = []; - /** @var integer Count of total items available for list */ + /** @var int Count of total items available for list */ public $itemsMax = 0; /** @var string Name of the input field*/ diff --git a/classes/components/listPanels/PKPSubmissionsListPanel.inc.php b/classes/components/listPanels/PKPSubmissionsListPanel.inc.php index d7a652ce1bf..b291fb0aa28 100644 --- a/classes/components/listPanels/PKPSubmissionsListPanel.inc.php +++ b/classes/components/listPanels/PKPSubmissionsListPanel.inc.php @@ -31,22 +31,22 @@ abstract class PKPSubmissionsListPanel extends ListPanel /** @var string URL to the API endpoint where items can be retrieved */ public $apiUrl = ''; - /** @var integer Number of items to show at one time */ + /** @var int Number of items to show at one time */ public $count = 30; /** @var array Query parameters to pass if this list executes GET requests */ public $getParams = []; - /** @var boolean Should items be loaded after the component is mounted? */ + /** @var bool Should items be loaded after the component is mounted? */ public $lazyLoad = false; - /** @var integer Count of total items available for list */ + /** @var int Count of total items available for list */ public $itemsMax = 0; - /** @var boolean Whether to show assigned to editors filter */ + /** @var bool Whether to show assigned to editors filter */ public $includeAssignedEditorsFilter = false; - /** @var boolean Whether to show categories filter */ + /** @var bool Whether to show categories filter */ public $includeCategoriesFilter = false; /** @var array List of all available categories */ @@ -238,7 +238,7 @@ public function getConfig() /** * Compile the categories for passing as filters * - * @param $categories array + * @param array $categories * * @return array */ diff --git a/classes/config/Config.inc.php b/classes/config/Config.inc.php index 9e9d010a4eb..6d16618a381 100644 --- a/classes/config/Config.inc.php +++ b/classes/config/Config.inc.php @@ -30,9 +30,9 @@ class Config /** * Retrieve a specified configuration variable. * - * @param $section string - * @param $key string - * @param $default mixed Optional default if the var doesn't exist + * @param string $section + * @param string $key + * @param mixed $default Optional default if the var doesn't exist * * @return mixed May return boolean (in case of "off"/"on"/etc), numeric, string, or null. */ @@ -78,7 +78,7 @@ public static function &reloadData() /** * Set the path to the configuration file. * - * @param $configFile string + * @param string $configFile */ public static function setConfigFileName($configFile) { diff --git a/classes/config/ConfigParser.inc.php b/classes/config/ConfigParser.inc.php index 92a8ced9761..c3a5e626226 100644 --- a/classes/config/ConfigParser.inc.php +++ b/classes/config/ConfigParser.inc.php @@ -17,7 +17,7 @@ class ConfigParser { - /** Contents of the config file currently being parsed */ + /** @var string Contents of the config file currently being parsed */ public $content; /** @@ -31,7 +31,7 @@ public function __construct() * Read a configuration file into a multidimensional array. * This is a replacement for the PHP parse_ini_file function, which does not type setting values. * - * @param $file string full path to the config file + * @param string $file full path to the config file * * @return array the configuration data (same format as http://php.net/parse_ini_file) */ @@ -123,10 +123,10 @@ public static function &readConfig($file) * This method stores the updated configuration but does not write it out. * Use writeConfig() or getFileContents() afterwards to do something with the new config. * - * @param $file string full path to the config file - * @param $params array an associative array of configuration parameters to update. If the value is an associative array (of variable name/value pairs) instead of a scalar, the key is treated as a section instead of a variable. Parameters not in $params remain unchanged + * @param string $file full path to the config file + * @param array $params an associative array of configuration parameters to update. If the value is an associative array (of variable name/value pairs) instead of a scalar, the key is treated as a section instead of a variable. Parameters not in $params remain unchanged * - * @return boolean true if file could be read, false otherwise + * @return bool true if file could be read, false otherwise */ public function updateConfig($file, $params) { @@ -183,9 +183,9 @@ public function updateConfig($file, $params) /** * Write contents of current config file * - * @param $file string full path to output file + * @param string $file full path to output file * - * @return boolean file write is successful + * @return bool file write is successful */ public function writeConfig($file) { diff --git a/classes/context/Context.inc.php b/classes/context/Context.inc.php index fbdcef64ea4..7fc8130c429 100644 --- a/classes/context/Context.inc.php +++ b/classes/context/Context.inc.php @@ -33,7 +33,7 @@ abstract class Context extends \PKP\core\DataObject /** * Get the localized name of the context * - * @param $preferredLocale string + * @param string $preferredLocale * * @return string */ @@ -45,7 +45,7 @@ public function getLocalizedName($preferredLocale = null) /** * Set the name of the context * - * @param $name string + * @param string $name * @param null|mixed $locale */ public function setName($name, $locale = null) @@ -76,7 +76,7 @@ public function getContactName() /** * Set the contact name for this context * - * @param $contactName string + * @param string $contactName */ public function setContactName($contactName) { @@ -96,7 +96,7 @@ public function getContactEmail() /** * Set the contact email for this context * - * @param $contactEmail string + * @param string $contactEmail */ public function setContactEmail($contactEmail) { @@ -118,8 +118,8 @@ public function getDescription($locale = null) /** * Set context description. * - * @param $description string - * @param $locale string optional + * @param string $description + * @param string $locale optional */ public function setDescription($description, $locale = null) { @@ -139,7 +139,7 @@ public function getPath() /** * Set path to context (in URL). * - * @param $path string + * @param string $path */ public function setPath($path) { @@ -159,7 +159,7 @@ public function getEnabled() /** * Set enabled flag of context * - * @param $enabled int + * @param int $enabled */ public function setEnabled($enabled) { @@ -196,7 +196,7 @@ public function getSequence() /** * Set sequence of context in site table of contents. * - * @param $sequence float + * @param float $sequence */ public function setSequence($sequence) { @@ -226,7 +226,7 @@ public function getLocalizedAcronym() /** * Get the acronym of the context. * - * @param $locale string + * @param string $locale * * @return string */ @@ -256,7 +256,7 @@ public function getLocalizedFavicon() * * @return array */ - public function getSupportedFormLocales() + public function getSupportedFormLocales(): ?array { return $this->getData('supportedFormLocales'); } @@ -366,7 +366,7 @@ public function getSupportedLocaleNames() /** * Return date or/and time formats available for forms, fallback to the default if not set * - * @param $format string datetime property, e.g., dateFormatShort + * @param string $format datetime property, e.g., dateFormatShort * * @return array */ @@ -515,10 +515,9 @@ public function getLocalizedSetting($name, $locale = null) /** * Update a context setting value. * - * @param $name string - * @param $value mixed - * @param $type string optional - * @param $isLocalized boolean optional + * @param string $name + * @param string $type optional + * @param bool $isLocalized optional * * @deprecated 3.3.0.0 */ @@ -609,10 +608,10 @@ public function getDefaultMetricType() * @see * for a full specification of the input and output format of this method. * - * @param $metricType null|integer|array metrics selection - * @param $columns integer|array column (aggregation level) selection - * @param $orderBy array order criteria - * @param $range null|DBResultRange paging specification + * @param null|integer|array $metricType metrics selection + * @param int|array $columns column (aggregation level) selection + * @param array $orderBy order criteria + * @param null|DBResultRange $range paging specification * * @return null|array The selected data as a simple tabular * result set or null if metrics are not supported by this context. diff --git a/classes/context/ContextDAO.inc.php b/classes/context/ContextDAO.inc.php index 19a5c9db386..f336b1a3143 100644 --- a/classes/context/ContextDAO.inc.php +++ b/classes/context/ContextDAO.inc.php @@ -26,7 +26,7 @@ abstract class ContextDAO extends SchemaDAO /** * Retrieve the IDs and names of all contexts in an associative array. * - * @param $enabledOnly true iff only enabled contexts are to be included + * @param bool $enabledOnly true iff only enabled contexts are to be included * * @return array */ @@ -53,9 +53,9 @@ public function getLocaleFieldNames() /** * Check if a context exists with a specified path. * - * @param $path string the path for the context + * @param string $path the path for the context * - * @return boolean + * @return bool */ public function existsByPath($path) { @@ -70,7 +70,7 @@ public function existsByPath($path) /** * Retrieve a context by path. * - * @param $path string + * @param string $path * * @return Context? */ @@ -87,8 +87,8 @@ public function getByPath($path) /** * Retrieve all contexts. * - * @param $enabledOnly true iff only enabled contexts should be included - * @param $rangeInfo Object optional + * @param bool $enabledOnly true iff only enabled contexts should be included + * @param object $rangeInfo optional * * @return DAOResultFactory containing matching Contexts */ @@ -111,8 +111,8 @@ public function getAll($enabledOnly = false, $rangeInfo = null) * or all contexts for site admin * If not user-based, retrieve all enabled contexts. * - * @param $userId int Optional user ID to find available contexts for - * @param $rangeInfo Object optional + * @param int $userId Optional user ID to find available contexts for + * @param object $rangeInfo optional * * @return DAOResultFactory containing matching Contexts */ @@ -144,9 +144,8 @@ public function getAvailable($userId = null, $rangeInfo = null) /** * Get journals by setting. * - * @param $settingName string - * @param $settingValue mixed - * @param $contextId int + * @param string $settingName + * @param int $contextId * * @return DAOResultFactory */ diff --git a/classes/context/LibraryFile.inc.php b/classes/context/LibraryFile.inc.php index 1009e31758d..33fa7b9cf2b 100644 --- a/classes/context/LibraryFile.inc.php +++ b/classes/context/LibraryFile.inc.php @@ -56,7 +56,7 @@ public function getContextId() /** * Set ID of context. * - * @param $contextId int + * @param int $contextId */ public function setContextId($contextId) { @@ -84,7 +84,7 @@ public function setSubmissionId($submissionId) /** * Get server-side file name of the file. * - * @param return string + * @return string */ public function getServerFileName() { @@ -94,7 +94,7 @@ public function getServerFileName() /** * Set server-side file name of the file. * - * @param $fileName string + * @param string $fileName */ public function setServerFileName($fileName) { @@ -104,7 +104,7 @@ public function setServerFileName($fileName) /** * Get original file name of the file. * - * @param return string + * @return string */ public function getOriginalFileName() { @@ -114,7 +114,7 @@ public function getOriginalFileName() /** * Set original file name of the file. * - * @param $originalFileName string + * @param string $originalFileName */ public function setOriginalFileName($originalFileName) { @@ -124,8 +124,8 @@ public function setOriginalFileName($originalFileName) /** * Set the name of the file * - * @param $name string - * @param $locale string + * @param string $name + * @param string $locale */ public function setName($name, $locale) { @@ -135,7 +135,7 @@ public function setName($name, $locale) /** * Get the name of the file * - * @param $locale string + * @param string $locale * * @return string */ @@ -157,7 +157,7 @@ public function getLocalizedName() /** * Get file type of the file. * - * @ return string + * @return string */ public function getFileType() { @@ -167,7 +167,7 @@ public function getFileType() /** * Set file type of the file. * - * @param $fileType string + * @param string $fileType */ public function setFileType($fileType) { @@ -177,7 +177,7 @@ public function setFileType($fileType) /** * Get type of the file. * - * @ return string + * @return string */ public function getType() { @@ -187,7 +187,7 @@ public function getType() /** * Set type of the file. * - * @param $type string + * @param string $type */ public function setType($type) { @@ -207,7 +207,7 @@ public function getDateUploaded() /** * Set uploaded date of file. * - * @param $dateUploaded date + * @param date $dateUploaded */ public function setDateUploaded($dateUploaded) { @@ -227,7 +227,7 @@ public function getDateModified() /** * Set modified date of file. * - * @param $dateModified date + * @param date $dateModified */ public function setDateModified($dateModified) { @@ -248,7 +248,7 @@ public function getFileSize() /** * Set file size of file. * - * @param $fileSize int + * @param int $fileSize */ public function setFileSize($fileSize) { @@ -280,7 +280,7 @@ public function getDocumentType() /** * Get public access indication * - * @return boolean + * @return bool */ public function getPublicAccess() { @@ -290,7 +290,7 @@ public function getPublicAccess() /** * Set public access indication * - * @param $publicAccess boolean + * @param bool $publicAccess */ public function setPublicAccess($publicAccess) { diff --git a/classes/context/LibraryFileDAO.inc.php b/classes/context/LibraryFileDAO.inc.php index 5d328aadef7..17895e14031 100644 --- a/classes/context/LibraryFileDAO.inc.php +++ b/classes/context/LibraryFileDAO.inc.php @@ -25,8 +25,8 @@ class LibraryFileDAO extends \PKP\db\DAO /** * Retrieve a library file by ID. * - * @param $fileId int - * @param $contextId int optional + * @param int $fileId + * @param int $contextId optional * * @return LibraryFile */ @@ -49,8 +49,8 @@ public function getById($fileId, $contextId = null) /** * Retrieve all library files for a context. * - * @param $contextId int - * @param $type (optional) + * @param int $contextId + * @param string $type (optional) * * @return array LibraryFiles */ @@ -73,9 +73,9 @@ public function getByContextId($contextId, $type = null) /** * Retrieve all library files for a submission. * - * @param $submissionId int - * @param $type (optional) - * @param $contextId (optional) int + * @param int $submissionId + * @param string $type (optional) + * @param int $contextId (optional) * * @return array LibraryFiles */ @@ -122,7 +122,7 @@ public function getLocaleFieldNames() /** * Update the localized fields for this file. * - * @param $libraryFile + * @param LibraryFile $libraryFile */ public function updateLocaleFields(&$libraryFile) { @@ -136,7 +136,7 @@ public function updateLocaleFields(&$libraryFile) /** * Internal function to return a LibraryFile object from a row. * - * @param $row array + * @param array $row * * @return LibraryFile */ @@ -165,7 +165,7 @@ public function _fromRow($row) /** * Insert a new LibraryFile. * - * @param $libraryFile LibraryFile + * @param LibraryFile $libraryFile * * @return int */ @@ -209,7 +209,7 @@ public function insertObject($libraryFile) /** * Update a LibraryFile * - * @param $libraryFile LibraryFile + * @param LibraryFile $libraryFile * * @return int */ @@ -250,7 +250,7 @@ public function updateObject($libraryFile) /** * Delete a library file by ID. * - * @param $revision int + * @param int $revision */ public function deleteById($fileId, $revision = null) { @@ -261,7 +261,7 @@ public function deleteById($fileId, $revision = null) /** * Check if a file with this filename already exists * - * @param $contextId int the context to check in. + * @param int $contextId the context to check in. * * @return bool */ diff --git a/classes/context/PKPSection.inc.php b/classes/context/PKPSection.inc.php index fe746923ca7..13832d5dbf6 100644 --- a/classes/context/PKPSection.inc.php +++ b/classes/context/PKPSection.inc.php @@ -32,7 +32,7 @@ public function getContextId() /** * Set ID of context. * - * @param $contextId int + * @param int $contextId */ public function setContextId($contextId) { @@ -52,7 +52,7 @@ public function getSequence() /** * Set sequence of section. * - * @param $sequence float + * @param float $sequence */ public function setSequence($sequence) { @@ -72,7 +72,7 @@ public function getLocalizedTitle() /** * Get title of section. * - * @param $locale string + * @param string $locale * * @return string */ @@ -84,8 +84,8 @@ public function getTitle($locale) /** * Set title of section. * - * @param $title string - * @param $locale string + * @param string $title + * @param string $locale */ public function setTitle($title, $locale) { @@ -95,7 +95,7 @@ public function setTitle($title, $locale) /** * Return boolean indicating whether or not submissions are restricted to [sub]Editors. * - * @return boolean + * @return bool */ public function getEditorRestricted() { @@ -105,7 +105,7 @@ public function getEditorRestricted() /** * Set whether or not submissions are restricted to [sub]Editors. * - * @param $editorRestricted boolean + * @param bool $editorRestricted */ public function setEditorRestricted($editorRestricted) { @@ -125,7 +125,7 @@ public function getReviewFormId() /** * Set ID of primary review form. * - * @param $reviewFormId int + * @param int $reviewFormId */ public function setReviewFormId($reviewFormId) { @@ -156,7 +156,7 @@ public function getLocalizedPolicy() /** * Get policy. * - * @param $locale string + * @param string $locale * * @return string */ @@ -168,8 +168,8 @@ public function getPolicy($locale) /** * Set policy. * - * @param $policy string - * @param $locale string + * @param string $policy + * @param string $locale */ public function setPolicy($policy, $locale) { diff --git a/classes/context/PKPSectionDAO.inc.php b/classes/context/PKPSectionDAO.inc.php index ffb86cca9d7..680ebf3a902 100644 --- a/classes/context/PKPSectionDAO.inc.php +++ b/classes/context/PKPSectionDAO.inc.php @@ -29,7 +29,7 @@ abstract public function newDataObject(); /** * Retrieve a section by ID. * - * @param $sectionId int + * @param int $sectionId * @param null|mixed $contextId * * @return Section @@ -39,7 +39,7 @@ abstract public function getById($sectionId, $contextId = null); /** * Generate a new PKPSection object from row. * - * @param $row array + * @param array $row * * @return PKPSection */ @@ -67,7 +67,7 @@ public function getLocaleFieldNames() /** * Delete a section. * - * @param $section Section + * @param Section $section */ public function deleteObject($section) { @@ -77,7 +77,7 @@ public function deleteObject($section) /** * Delete a section by ID. * - * @param $sectionId int + * @param int $sectionId * @param null|mixed $contextId */ abstract public function deleteById($sectionId, $contextId = null); @@ -86,7 +86,7 @@ abstract public function deleteById($sectionId, $contextId = null); * Delete sections by context ID * NOTE: This does not necessarily delete dependent entries. * - * @param $contextId int + * @param int $contextId */ public function deleteByContextId($contextId) { @@ -99,9 +99,9 @@ public function deleteByContextId($contextId) /** * Retrieve all sections for a context. * - * @param $contextId int context ID - * @param $rangeInfo DBResultRange optional - * @param $submittableOnly boolean optional. Whether to return only sections + * @param int $contextId context ID + * @param DBResultRange $rangeInfo optional + * @param bool $submittableOnly optional. Whether to return only sections * that can be submitted to by anyone. * * @return DAOResultFactory containing Sections ordered by sequence @@ -111,8 +111,8 @@ abstract public function getByContextId($contextId, $rangeInfo = null, $submitta /** * Retrieve the IDs and titles of the sections for a context in an associative array. * - * @param $contextId int context ID - * @param $submittableOnly boolean optional. Whether to return only sections + * @param int $contextId context ID + * @param bool $submittableOnly optional. Whether to return only sections * that can be submitted to by anyone. * * @return array diff --git a/classes/context/SubEditorsDAO.inc.php b/classes/context/SubEditorsDAO.inc.php index 9a632d6a1ec..a0292043a68 100644 --- a/classes/context/SubEditorsDAO.inc.php +++ b/classes/context/SubEditorsDAO.inc.php @@ -22,9 +22,9 @@ class SubEditorsDAO extends \PKP\db\DAO /** * Insert a new sub editor. * - * @param $contextId int - * @param $assocId int - * @param $userId int + * @param int $contextId + * @param int $assocId + * @param int $userId */ public function insertEditor($contextId, $assocId, $userId, $assocType) { @@ -45,10 +45,10 @@ public function insertEditor($contextId, $assocId, $userId, $assocType) /** * Delete a sub editor. * - * @param $contextId int - * @param $assocId int - * @param $userId int - * @param $assocType int ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY + * @param int $contextId + * @param int $assocId + * @param int $userId + * @param int $assocType ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY */ public function deleteEditor($contextId, $assocId, $userId, $assocType) { @@ -66,9 +66,9 @@ public function deleteEditor($contextId, $assocId, $userId, $assocType) /** * Retrieve a list of all sub editors assigned to the specified submission group. * - * @param $assocId int - * @param $assocType int ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY - * @param $contextId int + * @param int $assocId + * @param int $assocType ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY + * @param int $contextId * * @return array matching Users */ @@ -94,9 +94,9 @@ public function getBySubmissionGroupId($assocId, $assocType, $contextId) /** * Delete all sub editors for a specified submission group in a context. * - * @param $assocId int - * @param $assocType int ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY - * @param $contextId int + * @param int $assocId + * @param int $assocType ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY + * @param int $contextId */ public function deleteBySubmissionGroupId($assocId, $assocType, $contextId = null) { @@ -114,10 +114,10 @@ public function deleteBySubmissionGroupId($assocId, $assocType, $contextId = nul /** * Delete all submission group assignments for the specified user. * - * @param $userId int - * @param $contextId int optional, include assignments only in this context - * @param $assocId int optional, include only this submission group - * @param $assocType int optional ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY + * @param int $userId + * @param int $contextId optional, include assignments only in this context + * @param int $assocId optional, include only this submission group + * @param int $assocType optional ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY */ public function deleteByUserId($userId, $contextId = null, $assocId = null, $assocType = null) { @@ -144,12 +144,12 @@ public function deleteByUserId($userId, $contextId = null, $assocId = null, $ass /** * Check if a user is assigned to a specified submission group. * - * @param $contextId int - * @param $assocId int - * @param $userId int - * @param $assocType int optional ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY + * @param int $contextId + * @param int $assocId + * @param int $userId + * @param int $assocType optional ASSOC_TYPE_SECTION or ASSOC_TYPE_CATEGORY * - * @return boolean + * @return bool */ public function editorExists($contextId, $assocId, $userId, $assocType) { diff --git a/classes/controlledVocab/ControlledVocab.inc.php b/classes/controlledVocab/ControlledVocab.inc.php index aef5f52b2ce..48dd9a9b720 100644 --- a/classes/controlledVocab/ControlledVocab.inc.php +++ b/classes/controlledVocab/ControlledVocab.inc.php @@ -41,7 +41,7 @@ public function getAssocId() /** * set assoc id * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -61,7 +61,7 @@ public function getAssocType() /** * Set associated type. * - * @param $assocType int + * @param int $assocType */ public function setAssocType($assocType) { @@ -81,7 +81,7 @@ public function getSymbolic() /** * Set symbolic name. * - * @param $symbolic string + * @param string $symbolic */ public function setSymbolic($symbolic) { @@ -91,7 +91,7 @@ public function setSymbolic($symbolic) /** * Get a list of controlled vocabulary options. * - * @param $settingName string optional + * @param string $settingName optional * * @return array $controlledVocabEntryId => name */ diff --git a/classes/controlledVocab/ControlledVocabDAO.inc.php b/classes/controlledVocab/ControlledVocabDAO.inc.php index a05fbb2b1bb..fefc94bf1be 100644 --- a/classes/controlledVocab/ControlledVocabDAO.inc.php +++ b/classes/controlledVocab/ControlledVocabDAO.inc.php @@ -34,7 +34,7 @@ public function getEntryDAO() /** * Retrieve a controlled vocab by controlled vocab ID. * - * @param $controlledVocabId int + * @param int $controlledVocabId * * @return ControlledVocab */ @@ -48,9 +48,9 @@ public function getById($controlledVocabId) /** * Fetch a controlled vocab by symbolic info, building it if needed. * - * @param $symbolic string - * @param $assocType int - * @param $assocId int + * @param string $symbolic + * @param int $assocType + * @param int $assocId * * @return $controlledVocab */ @@ -91,7 +91,7 @@ public function newDataObject() /** * Internal function to return an ControlledVocab object from a row. * - * @param $row array + * @param array $row * * @return ControlledVocab */ @@ -109,7 +109,7 @@ public function _fromRow($row) /** * Insert a new ControlledVocab. * - * @param $controlledVocab ControlledVocab + * @param ControlledVocab $controlledVocab * * @return int? New insert ID on insert, or null on error */ @@ -139,9 +139,9 @@ public function insertObject($controlledVocab, $dieOnError = true) /** * Update an existing controlled vocab. * - * @param $controlledVocab ControlledVocab + * @param ControlledVocab $controlledVocab * - * @return boolean + * @return bool */ public function updateObject($controlledVocab) { @@ -164,9 +164,9 @@ public function updateObject($controlledVocab) /** * Delete a controlled vocab. * - * @param $controlledVocab ControlledVocab + * @param ControlledVocab $controlledVocab * - * @return boolean + * @return bool */ public function deleteObject($controlledVocab) { @@ -176,9 +176,9 @@ public function deleteObject($controlledVocab) /** * Delete a controlled vocab by controlled vocab ID. * - * @param $controlledVocabId int + * @param int $controlledVocabId * - * @return boolean + * @return bool */ public function deleteObjectById($controlledVocabId) { @@ -194,9 +194,9 @@ public function deleteObjectById($controlledVocabId) * Retrieve an array of controlled vocabs matching the specified * symbolic name and assoc info. * - * @param $symbolic string - * @param $assocType int - * @param $assocId int + * @param string $symbolic + * @param int $assocType + * @param int $assocId * * @return ControlledVocab? */ @@ -213,10 +213,10 @@ public function getBySymbolic($symbolic, $assocType = 0, $assocId = 0) /** * Get a list of controlled vocabulary options. * - * @param $symbolic string - * @param $assocType int - * @param $assocId int - * @param $settingName string optional + * @param string $symbolic + * @param int $assocType + * @param int $assocId + * @param string $settingName optional * * @return array $controlledVocabEntryId => $settingValue */ @@ -232,8 +232,8 @@ public function enumerateBySymbolic($symbolic, $assocType, $assocId, $settingNam /** * Get a list of controlled vocabulary options. * - * @param $controlledVocabId int - * @param $settingName string optional + * @param int $controlledVocabId + * @param string $settingName optional * * @return array $controlledVocabEntryId => name */ diff --git a/classes/controlledVocab/ControlledVocabEntry.inc.php b/classes/controlledVocab/ControlledVocabEntry.inc.php index 6b471c2b6f0..d54e2c67d56 100644 --- a/classes/controlledVocab/ControlledVocabEntry.inc.php +++ b/classes/controlledVocab/ControlledVocabEntry.inc.php @@ -36,7 +36,7 @@ public function getControlledVocabId() /** * Set the ID of the controlled vocab. * - * @param $controlledVocabId int + * @param int $controlledVocabId */ public function setControlledVocabId($controlledVocabId) { @@ -56,7 +56,7 @@ public function getSequence() /** * Set sequence number. * - * @param $sequence float + * @param float $sequence */ public function setSequence($sequence) { @@ -76,7 +76,7 @@ public function getLocalizedName() /** * Get the name of the controlled vocabulary entry. * - * @param $locale string + * @param string $locale * * @return string */ @@ -88,8 +88,8 @@ public function getName($locale) /** * Set the name of the controlled vocabulary entry. * - * @param $name string - * @param $locale string + * @param string $name + * @param string $locale */ public function setName($name, $locale) { diff --git a/classes/controlledVocab/ControlledVocabEntryDAO.inc.php b/classes/controlledVocab/ControlledVocabEntryDAO.inc.php index de92e5714e1..45ecc861465 100644 --- a/classes/controlledVocab/ControlledVocabEntryDAO.inc.php +++ b/classes/controlledVocab/ControlledVocabEntryDAO.inc.php @@ -24,7 +24,7 @@ class ControlledVocabEntryDAO extends \PKP\db\DAO /** * Retrieve a controlled vocab entry by controlled vocab entry ID. * - * @param $controlledVocabEntryId int + * @param int $controlledVocabEntryId * @param null|mixed $controlledVocabId * * @return ControlledVocabEntry @@ -49,12 +49,12 @@ public function getById($controlledVocabEntryId, $controlledVocabId = null) * Retrieve a controlled vocab entry by resolving one of its settings * to the corresponding entry id. * - * @param $settingValue string the setting value to be searched for - * @param $symbolic string the vocabulary to be searched, identified by its symbolic name - * @param $assocType integer - * @param $assocId integer - * @param $settingName string the setting to be searched - * @param $locale string + * @param string $settingValue the setting value to be searched for + * @param string $symbolic the vocabulary to be searched, identified by its symbolic name + * @param int $assocType + * @param int $assocId + * @param string $settingName the setting to be searched + * @param string $locale * * @return ControlledVocabEntry */ @@ -91,7 +91,7 @@ public function newDataObject() * Internal function to return a ControlledVocabEntry object from a * row. * - * @param $row array + * @param array $row * * @return ControlledVocabEntry */ @@ -120,7 +120,7 @@ public function getLocaleFieldNames() /** * Update the localized fields for this table * - * @param $controlledVocabEntry object + * @param object $controlledVocabEntry */ public function updateLocaleFields($controlledVocabEntry) { @@ -132,7 +132,7 @@ public function updateLocaleFields($controlledVocabEntry) /** * Insert a new ControlledVocabEntry. * - * @param $controlledVocabEntry ControlledVocabEntry + * @param ControlledVocabEntry $controlledVocabEntry * * @return int Inserted controlled vocabulary entry ID */ @@ -154,7 +154,7 @@ public function insertObject($controlledVocabEntry) /** * Delete a controlled vocab entry. * - * @param $controlledVocabEntry ControlledVocabEntry + * @param ControlledVocabEntry $controlledVocabEntry */ public function deleteObject($controlledVocabEntry) { @@ -164,7 +164,7 @@ public function deleteObject($controlledVocabEntry) /** * Delete a controlled vocab entry by controlled vocab entry ID. * - * @param $controlledVocabEntryId int + * @param int $controlledVocabEntryId */ public function deleteObjectById($controlledVocabEntryId) { @@ -176,7 +176,7 @@ public function deleteObjectById($controlledVocabEntryId) * Retrieve an iterator of controlled vocabulary entries matching a * particular controlled vocabulary ID. * - * @param $controlledVocabId int + * @param int $controlledVocabId * @param null|mixed $rangeInfo * @param null|mixed $filter * @@ -208,9 +208,9 @@ public function getByControlledVocabId($controlledVocabId, $rangeInfo = null, $f * (assigned to at least one submission in that context) and which match the * requested symbolic (eg - keywords/subjects) * - * @param $symbolic string One of the CONTROLLED_VOCAB_* constants - * @param $contextId int - * @param $locale string + * @param string $symbolic One of the CONTROLLED_VOCAB_* constants + * @param int $contextId + * @param string $locale * * @return array */ @@ -242,7 +242,7 @@ public function getByContextId($symbolic, $contextId, $locale) /** * Update an existing review form element. * - * @param $controlledVocabEntry ControlledVocabEntry + * @param ControlledVocabEntry $controlledVocabEntry */ public function updateObject($controlledVocabEntry) { @@ -263,7 +263,7 @@ public function updateObject($controlledVocabEntry) /** * Sequentially renumber entries in their sequence order. * - * @param $controlledVocabId int Controlled vocabulary ID + * @param int $controlledVocabId Controlled vocabulary ID */ public function resequence($controlledVocabId) { diff --git a/classes/controllers/grid/ArrayGridCellProvider.inc.php b/classes/controllers/grid/ArrayGridCellProvider.inc.php index 1756fae8ce8..de88f246557 100644 --- a/classes/controllers/grid/ArrayGridCellProvider.inc.php +++ b/classes/controllers/grid/ArrayGridCellProvider.inc.php @@ -26,8 +26,8 @@ class ArrayGridCellProvider extends GridCellProvider * * @see GridCellProvider::getTemplateVarsFromRowColumn() * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/classes/controllers/grid/CategoryGridDataProvider.inc.php b/classes/controllers/grid/CategoryGridDataProvider.inc.php index b154c83d037..a18a5f7c458 100644 --- a/classes/controllers/grid/CategoryGridDataProvider.inc.php +++ b/classes/controllers/grid/CategoryGridDataProvider.inc.php @@ -41,7 +41,7 @@ public function getDataProvider() /** * Set a grid data provider object. * - * @param $dataProvider GridDataProvider + * @param GridDataProvider $dataProvider */ public function setDataProvider($dataProvider) { @@ -79,9 +79,8 @@ public function setAuthorizedContext(&$authorizedContext) /** * Retrieve the category data to load into the grid. * - * @param $request PKPRequest - * @param $categoryDataElement mixed - * @param $filter mixed array or null + * @param PKPRequest $request + * @param array|null $filter * * @return array */ diff --git a/classes/controllers/grid/CategoryGridHandler.inc.php b/classes/controllers/grid/CategoryGridHandler.inc.php index 0ae3a952f7c..c3a548b0b87 100644 --- a/classes/controllers/grid/CategoryGridHandler.inc.php +++ b/classes/controllers/grid/CategoryGridHandler.inc.php @@ -78,7 +78,7 @@ public function setEmptyCategoryRowText($translationKey) /** * Get the category id that this grid is currently rendering. * - * @param int + * @return int */ public function getCurrentCategoryId() { @@ -89,8 +89,8 @@ public function getCurrentCategoryId() * Override to return the data element sequence value * inside the passed category, if needed. * - * @param $categoryId int The data element category id. - * @param $gridDataElement mixed The element to return the + * @param int $categoryId The data element category id. + * @param mixed $gridDataElement The element to return the * sequence. * * @return int @@ -104,10 +104,10 @@ public function getDataElementInCategorySequence($categoryId, &$gridDataElement) * Override to set the data element new sequence inside * the passed category, if needed. * - * @param $categoryId int The data element category id. - * @param $gridDataElement mixed The element to set the + * @param int $categoryId The data element category id. + * @param mixed $gridDataElement The element to set the * new sequence. - * @param $newSequence int The new sequence value. + * @param int $newSequence The new sequence value. */ public function setDataElementInCategorySequence($categoryId, &$gridDataElement, $newSequence) { @@ -118,8 +118,7 @@ public function setDataElementInCategorySequence($categoryId, &$gridDataElement, * Override to define whether the data element inside the passed * category is selected or not. * - * @param $categoryId int - * @param $gridDataElement mixed + * @param int $categoryId */ public function isDataElementInCategorySelected($categoryId, &$gridDataElement) { @@ -129,8 +128,8 @@ public function isDataElementInCategorySelected($categoryId, &$gridDataElement) /** * Get the grid category data. * - * @param $request PKPRequest - * @param $categoryElement mixed The category element. + * @param PKPRequest $request + * @param mixed $categoryElement The category element. * * @return array */ @@ -161,11 +160,11 @@ public function &getGridCategoryDataElements($request, $categoryElement) /** * Check whether the passed category has grid rows. * - * @param $categoryElement mixed The category data element + * @param mixed $categoryElement The category data element * that will be checked. - * @param $request PKPRequest + * @param PKPRequest $request * - * @return boolean + * @return bool */ public function hasGridDataElementsInCategory($categoryElement, $request) { @@ -177,8 +176,7 @@ public function hasGridDataElementsInCategory($categoryElement, $request) /** * Get the number of elements inside the passed category element. * - * @param $categoryElement mixed - * @param $request PKPRequest + * @param PKPRequest $request * * @return int */ @@ -192,8 +190,8 @@ public function getCategoryItemsCount($categoryElement, $request) /** * Set the grid category data. * - * @param $categoryElementId string The category element id. - * @param $data mixed an array or ItemIterator with category elements data. + * @param string $categoryElementId The category element id. + * @param mixed $data an array or ItemIterator with category elements data. */ public function setGridCategoryDataElements($request, $categoryElementId, $data) { @@ -224,8 +222,8 @@ public function setGridCategoryDataElements($request, $categoryElementId, $data) /** * Render a category with all the rows inside of it. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return string the serialized row JSON message or a flag * that indicates that the row has not been found. @@ -385,8 +383,8 @@ protected function renderRowInternally($request, $row) * Raises a fatal error if such an element cannot be * found. * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args * * @return GridRow the requested grid row, already * configured with id and data or null if the row @@ -446,9 +444,7 @@ protected function getCategoryRowIdParameterName() /** * Implement this method to load category data into the grid. * - * @param $request PKPRequest - * @param $categoryDataElement mixed - * @param $filter mixed + * @param PKPRequest $request * * @return array */ @@ -471,9 +467,8 @@ protected function loadCategoryData($request, &$categoryDataElement, $filter = n /** * Instantiate a new row. * - * @param $request Request - * @param $elementId string - * @param $element mixed + * @param Request $request + * @param string $elementId * * @return GridRow */ @@ -501,7 +496,7 @@ private function _getInitializedCategoryRowInstance($request, $elementId, $eleme /** * Render all the categories internally * - * @param $request PKPRequest + * @param PKPRequest $request */ private function _renderCategoriesInternally($request) { @@ -525,10 +520,10 @@ private function _renderCategoriesInternally($request) /** * Render a category row and its data. * - * @param $request PKPRequest - * @param $categoryRow GridCategoryRow + * @param PKPRequest $request + * @param GridCategoryRow $categoryRow * - * @return String HTML for all the rows (including category) + * @return string HTML for all the rows (including category) */ private function _renderCategoryInternally($request, $categoryRow) { diff --git a/classes/controllers/grid/DataObjectGridCellProvider.inc.php b/classes/controllers/grid/DataObjectGridCellProvider.inc.php index 95b02fa60ed..f8443bf40cd 100644 --- a/classes/controllers/grid/DataObjectGridCellProvider.inc.php +++ b/classes/controllers/grid/DataObjectGridCellProvider.inc.php @@ -33,7 +33,7 @@ class DataObjectGridCellProvider extends GridCellProvider /** * Set the locale * - * @param $locale string + * @param string $locale */ public function setLocale($locale) { @@ -64,8 +64,8 @@ public function getLocale() * * @see GridCellProvider::getTemplateVarsFromRowColumn() * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/classes/controllers/grid/DateGridCellProvider.inc.php b/classes/controllers/grid/DateGridCellProvider.inc.php index 8b5df0eb48a..e0616099190 100644 --- a/classes/controllers/grid/DateGridCellProvider.inc.php +++ b/classes/controllers/grid/DateGridCellProvider.inc.php @@ -17,17 +17,17 @@ class DateGridCellProvider extends GridCellProvider { - /** @var The actual data provider to wrap */ + /** @var DataProvider The actual data provider to wrap */ public $_dataProvider; - /** @var The format to use; see strftime */ + /** @var string The format to use; see strftime */ public $_format; /** * Constructor * - * @param $dataProvider DataProvider The object to wrap - * @param $format string See strftime + * @param DataProvider $dataProvider The object to wrap + * @param string $format See strftime */ public function __construct($dataProvider, $format) { @@ -43,8 +43,8 @@ public function __construct($dataProvider, $format) * Fetch a value from the provided DataProvider (in constructor) * and format it as a date. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/classes/controllers/grid/GridBodyElement.inc.php b/classes/controllers/grid/GridBodyElement.inc.php index ebde968a44b..895a2d9375d 100644 --- a/classes/controllers/grid/GridBodyElement.inc.php +++ b/classes/controllers/grid/GridBodyElement.inc.php @@ -60,7 +60,7 @@ public function getId() /** * Set the element id * - * @param $id string + * @param string $id */ public function setId($id) { @@ -80,7 +80,7 @@ public function getFlags() /** * Get a single layout flag * - * @param $flag string + * @param string $flag */ public function getFlag($flag) { @@ -91,9 +91,9 @@ public function getFlag($flag) /** * Check whether a layout flag is set to true. * - * @param $flag string + * @param string $flag * - * @return boolean + * @return bool */ public function hasFlag($flag) { @@ -106,8 +106,8 @@ public function hasFlag($flag) /** * Add a layout flag * - * @param $flag string - * @param $value mixed optional + * @param string $flag + * @param mixed $value optional */ public function addFlag($flag, $value = true) { @@ -127,7 +127,7 @@ public function getCellProvider() /** * Set the cell provider * - * @param $cellProvider GridCellProvider + * @param GridCellProvider $cellProvider */ public function setCellProvider($cellProvider) { diff --git a/classes/controllers/grid/GridCellProvider.inc.php b/classes/controllers/grid/GridCellProvider.inc.php index f53378414cc..ab1b8157acf 100644 --- a/classes/controllers/grid/GridCellProvider.inc.php +++ b/classes/controllers/grid/GridCellProvider.inc.php @@ -38,8 +38,8 @@ public function __construct() * To be used by a GridRow to generate a rendered representation of * the element for the given column. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return string the rendered representation of the element for the given column */ @@ -78,8 +78,8 @@ public function render($request, $row, $column) * for a given column from a data element so that they may be assigned * to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ @@ -97,10 +97,10 @@ public function getTemplateVarsFromRowColumn($row, $column) * be row-specific actions in which case action instantiation * should be delegated to the row. * - * @param $request Request - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn - * @param $position int GRID_ACTION_POSITION_... + * @param Request $request + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column + * @param int $position GRID_ACTION_POSITION_... * * @return array an array of LinkAction instances */ diff --git a/classes/controllers/grid/GridColumn.inc.php b/classes/controllers/grid/GridColumn.inc.php index d6193df8d47..4e229ad4e01 100644 --- a/classes/controllers/grid/GridColumn.inc.php +++ b/classes/controllers/grid/GridColumn.inc.php @@ -38,12 +38,12 @@ class GridColumn extends GridBodyElement /** * Constructor * - * @param $id string Grid column identifier - * @param $title string Locale key for grid column title - * @param $titleTranslated string Optional translated grid title - * @param $template string Optional template filename for grid column, including path - * @param $cellProvider GridCellProvider Optional grid cell provider for this column - * @param $flags array Optional set of flags for this grid column + * @param string $id Grid column identifier + * @param string $title Locale key for grid column title + * @param string $titleTranslated Optional translated grid title + * @param string $template Optional template filename for grid column, including path + * @param GridCellProvider $cellProvider Optional grid cell provider for this column + * @param array $flags Optional set of flags for this grid column */ public function __construct( $id = '', @@ -82,7 +82,7 @@ public function getTitle() /** * Set the column title (already translated) * - * @param $title string + * @param string $title */ public function setTitle($title) { @@ -123,7 +123,7 @@ public function getTemplate() /** * set the column's cell template * - * @param $template string + * @param string $template */ public function setTemplate($template) { @@ -151,7 +151,7 @@ public function getCellProvider() * actually provide cell-specific actions. The default * implementation returns an empty array. * - * @param $row \PKP\controllers\grid\GridRow The row for which actions are + * @param \PKP\controllers\grid\GridRow $row The row for which actions are * being requested. * * @return array An array of LinkActions for the cell. diff --git a/classes/controllers/grid/GridDataProvider.inc.php b/classes/controllers/grid/GridDataProvider.inc.php index 0b45b3ff536..7a32b865a9f 100644 --- a/classes/controllers/grid/GridDataProvider.inc.php +++ b/classes/controllers/grid/GridDataProvider.inc.php @@ -39,7 +39,7 @@ public function __construct() * Set the authorized context once it * is established. * - * @param $authorizedContext array + * @param array $authorizedContext */ public function setAuthorizedContext(&$authorizedContext) { @@ -49,7 +49,7 @@ public function setAuthorizedContext(&$authorizedContext) /** * Retrieve an object from the authorized context * - * @param $assocType integer + * @param int $assocType * * @return mixed will return null if the context * for the given assoc type does not exist. @@ -68,9 +68,9 @@ public function &getAuthorizedContextObject($assocType) * Check whether an object already exists in the * authorized context. * - * @param $assocType integer + * @param int $assocType * - * @return boolean + * @return bool */ public function hasAuthorizedContextObject($assocType) { @@ -84,9 +84,9 @@ public function hasAuthorizedContextObject($assocType) /** * Get the authorization policy. * - * @param $request PKPRequest - * @param $args array - * @param $roleAssignments array + * @param PKPRequest $request + * @param array $args + * @param array $roleAssignments * * @return PolicySet */ @@ -110,7 +110,7 @@ public function getRequestArgs() /** * Retrieve the data to load into the grid. * - * @param $filter array An optional associative array with filter data + * @param array $filter An optional associative array with filter data * as returned by GridHandler::getFilterSelectionData(). If no filter * has been selected by the user then the array will be empty. * diff --git a/classes/controllers/grid/GridHandler.inc.php b/classes/controllers/grid/GridHandler.inc.php index 17c2cca9782..eb3876ced75 100644 --- a/classes/controllers/grid/GridHandler.inc.php +++ b/classes/controllers/grid/GridHandler.inc.php @@ -78,7 +78,7 @@ class GridHandler extends PKPHandler /** @var array The GridColumns of this grid. */ public $_columns = []; - /** @var Array The grid's data source. */ + /** @var array The grid's data source. */ public $_data; /** @var ItemIterator The item iterator to be used for paging. */ @@ -100,7 +100,7 @@ class GridHandler extends PKPHandler /** * Constructor. * - * @param $dataProvider GridDataProvider An optional data provider + * @param GridDataProvider $dataProvider An optional data provider * for the grid. If no data provider is given then the grid * assumes that child classes will override default method * implementations. @@ -160,7 +160,7 @@ public function getRequestArgs() * * @see getRequestArgs() * - * @param $key string The name of the parameter to retrieve. + * @param string $key The name of the parameter to retrieve. */ public function getRequestArg($key) { @@ -182,7 +182,7 @@ public function getTitle() /** * Set the grid title. * - * @param $title string locale key + * @param string $title locale key */ public function setTitle($title) { @@ -202,7 +202,7 @@ public function getEmptyRowText() /** * Set the no items locale key * - * @param $emptyRowText string locale key + * @param string $emptyRowText locale key */ public function setEmptyRowText($emptyRowText) { @@ -222,7 +222,7 @@ public function getFootNote() /** * Set the grid foot note. * - * @param $footNote string locale key + * @param string $footNote locale key */ public function setFootNote($footNote) { @@ -232,7 +232,7 @@ public function setFootNote($footNote) /** * Get all actions for a given position within the grid. * - * @param $position string The position of the actions. + * @param string $position The position of the actions. * * @return array The LinkActions for the given position. */ @@ -247,8 +247,8 @@ public function getActions($position = self::GRID_ACTION_POSITION_ABOVE) /** * Add an action. * - * @param $action Mixed a single action. - * @param $position string The position of the action. + * @param mixed $action a single action. + * @param string $position The position of the action. */ public function addAction($action, $position = self::GRID_ACTION_POSITION_ABOVE) { @@ -271,7 +271,7 @@ public function &getColumns() /** * Retrieve a single column by id. * - * @param $columnId + * @param int $columnId * * @return GridColumn */ @@ -284,7 +284,7 @@ public function getColumn($columnId) /** * Get columns by flag. * - * @param $flag string + * @param string $flag * * @return array */ @@ -304,7 +304,7 @@ public function &getColumnsByFlag($flag) * Get columns number. If a flag is passed, the columns * using it will not be counted. * - * @param $flag optional string + * @param string $flag optional * * @return int */ @@ -323,9 +323,9 @@ public function getColumnsCount($flag = null) /** * Checks whether a column exists. * - * @param $columnId + * @param int $columnId * - * @return boolean + * @return bool */ public function hasColumn($columnId) { @@ -335,7 +335,7 @@ public function hasColumn($columnId) /** * Add a column. * - * @param $column mixed A single GridColumn instance. + * @param mixed $column A single GridColumn instance. */ public function addColumn($column) { @@ -346,7 +346,7 @@ public function addColumn($column) /** * Get the grid data. * - * @param $request PKPRequest + * @param PKPRequest $request * * @return array */ @@ -374,7 +374,7 @@ public function &getGridDataElements($request) /** * Check whether the grid has rows. * - * @return boolean + * @return bool */ public function hasGridDataElements($request) { @@ -386,7 +386,7 @@ public function hasGridDataElements($request) /** * Set the grid data. * - * @param $data mixed an array or ItemIterator with element data + * @param mixed $data an array or ItemIterator with element data */ public function setGridDataElements($data) { @@ -422,7 +422,7 @@ public function getTemplate() /** * Set the grid template. * - * @param $template string + * @param string $template */ public function setTemplate($template) { @@ -444,8 +444,8 @@ public function getUrls() * Define the urls that will be used * in JS handler. * - * @param $request PKPRequest - * @param $extraUrls array Optional extra urls. + * @param PKPRequest $request + * @param array $extraUrls Optional extra urls. */ public function setUrls($request, $extraUrls = []) { @@ -463,7 +463,7 @@ public function setUrls($request, $extraUrls = []) * to use the grid within another component (e.g. to * remove the title or change the layout accordingly). * - * @return boolean + * @return bool */ public function getIsSubcomponent() { @@ -514,7 +514,6 @@ public function getPublishChangeEvents() /** * Override to return the data element sequence value. * - * @param $gridDataElement mixed * * @return int */ @@ -526,10 +525,9 @@ public function getDataElementSequence($gridDataElement) /** * Override to set the data element new sequence. * - * @param $request PKPRequest - * @param $rowId int - * @param $gridDataElement mixed - * @param $newSequence int + * @param PKPRequest $request + * @param int $rowId + * @param int $newSequence */ public function setDataElementSequence($request, $rowId, $gridDataElement, $newSequence) { @@ -543,9 +541,8 @@ public function setDataElementSequence($request, $rowId, $gridDataElement, $newS * Returns the current selection state * of the grid data element. * - * @param $gridDataElement mixed * - * @return boolean + * @return bool */ public function isDataElementSelected($gridDataElement) { @@ -569,8 +566,8 @@ public function getSelectName() * Raises a fatal error if such an element cannot be * found. * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args * * @return \PKP\controllers\grid\GridRow the requested grid row, already * configured with id and data or null if the row @@ -612,8 +609,8 @@ public function getRequestedRow($request, $args) /** * Render the passed row and return its markup. * - * @param $request PKPRequest - * @param $row \PKP\controllers\grid\GridRow + * @param PKPRequest $request + * @param \PKP\controllers\grid\GridRow $row * * @return string */ @@ -626,9 +623,8 @@ public function renderRow($request, $row) /** * Get grid range info. * - * @param $request PKPRequest - * @param $rangeName string The grid id. - * @param $contextData mixed + * @param PKPRequest $request + * @param string $rangeName The grid id. * * @return DBResultRange */ @@ -668,8 +664,8 @@ public function authorize($request, &$args, $roleAssignments) /** * @see PKPHandler::initialize() * - * @param $request PKPRequest - * @param $args array optional + * @param PKPRequest $request + * @param array $args optional */ public function initialize($request, $args = null) { @@ -704,8 +700,8 @@ public function initialize($request, $args = null) * Render the entire grid controller and send * it to the client. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -750,8 +746,8 @@ public function fetchGrid($args, $request) /** * Fetch all grid rows from loaded data. * - * @param $args Array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object. */ @@ -783,8 +779,8 @@ public function fetchRows($args, $request) * Render a row and send it to the client. If the row no * longer exists then inform the client. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object. */ @@ -817,8 +813,8 @@ public function fetchRow($args, $request) /** * Render a cell and send it to the client * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -850,8 +846,8 @@ public function fetchCell(&$args, $request) * hook is attached to this grid, this operation will only return * the data changed event json message. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -885,7 +881,7 @@ public function getJSHandler() * that they are loaded. To handle grid items ordering, see * OrderItemsFeature class. * - * @param $request PKPRequest + * @param PKPRequest $request * * @return array */ @@ -913,8 +909,8 @@ protected function getRowInstance() * new rows prior to their insertion or existing rows that have * been edited but not saved. * - * @param $request PKPRequest - * @param $elementId int Reference to be filled with element + * @param PKPRequest $request + * @param int $elementId Reference to be filled with element * ID (if one is to be used) * * @return object @@ -929,8 +925,8 @@ protected function &getDataElementFromRequest($request, &$elementId) * source corresponding to the given row id. If none is * found then return null. * - * @param $request PKPRequest - * @param $rowId string The row ID; reference permits modification. + * @param PKPRequest $request + * @param string $rowId The row ID; reference permits modification. */ protected function getRowDataElement($request, &$rowId) { @@ -947,8 +943,8 @@ protected function getRowDataElement($request, &$rowId) /** * Implement this method to load data into the grid. * - * @param $request PKPRequest - * @param $filter array An associative array with filter data as returned by + * @param PKPRequest $request + * @param array $filter An associative array with filter data as returned by * getFilterSelectionData(). If no filter has been selected by the user * then the array will be empty. * @@ -982,7 +978,7 @@ protected function getFilterForm() /** * Determine whether a filter form should be collapsible. * - * @return boolean + * @return bool */ protected function isFilterFormCollapsible() { @@ -994,7 +990,7 @@ protected function isFilterFormCollapsible() * by instantiating the filter's Form object or by reading the request directly * (if using a simple filter template only). * - * @param $request PKPRequest + * @param PKPRequest $request * * @return array */ @@ -1006,8 +1002,8 @@ protected function getFilterSelectionData($request) /** * Render the filter (a template). * - * @param $request PKPRequest - * @param $filterData Array Data to be used by the filter template. + * @param PKPRequest $request + * @param array $filterData Data to be used by the filter template. * * @return string */ @@ -1052,9 +1048,9 @@ protected function noAutocompleteResults() * different actions than the ones implemented here. * This method is called by GridHandler::fetchGrid() * - * @param $args array - * @param $request PKPRequest - * @param $templateMgr PKPTemplateManager + * @param array $args + * @param PKPRequest $request + * @param PKPTemplateManager $templateMgr */ protected function doSpecificFetchGridActions($args, $request, $templateMgr) { @@ -1083,8 +1079,8 @@ protected function setFirstDataColumn() * method that use the returned array with the initialized * features to add them to grid. * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args * * @return array Array with initialized grid features objects. */ @@ -1099,8 +1095,8 @@ protected function initFeatures($request, $args) /** * Call the passed hook in all attached features. * - * @param $hookName string - * @param $args array Arguments provided by this handler. + * @param string $hookName + * @param array $args Arguments provided by this handler. */ protected function callFeaturesHook($hookName, $args) { @@ -1119,8 +1115,8 @@ protected function callFeaturesHook($hookName, $args) /** * Cycle through the data and get generate the row HTML. * - * @param $request PKPRequest - * @param $elements array The grid data elements to be rendered. + * @param PKPRequest $request + * @param array $elements The grid data elements to be rendered. * * @return array of HTML Strings for Grid Rows. */ @@ -1146,8 +1142,8 @@ protected function renderRowsInternally($request, $elements) * NB: You must have initialized the row * before you call this method. * - * @param $request PKPRequest - * @param $row \PKP\controllers\grid\GridRow + * @param PKPRequest $request + * @param \PKP\controllers\grid\GridRow $row * * @return string the row HTML */ @@ -1176,7 +1172,7 @@ protected function renderRowInternally($request, $row) /** * Method that renders tbodys to go in the grid main body. * - * @param $request PKPRequest + * @param PKPRequest $request * * @return array */ @@ -1204,10 +1200,9 @@ protected function renderGridBodyPartsInternally($request) /** * Instantiate a new row. * - * @param $request PKPRequest - * @param $elementId string - * @param $element mixed - * @param $isModified boolean optional + * @param PKPRequest $request + * @param string $elementId + * @param bool $isModified optional * * @return \PKP\controllers\grid\GridRow */ @@ -1233,9 +1228,9 @@ private function _getInitializedRowInstance($request, $elementId, &$element, $is * NB: You must have initialized the row * before you call this method. * - * @param $request PKPRequest - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param PKPRequest $request + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return string the cell HTML */ @@ -1330,7 +1325,7 @@ private function _fixColumnWidths() /** * Add grid features. * - * @param $features array + * @param array $features */ private function _addFeatures($features) { diff --git a/classes/controllers/grid/GridRow.inc.php b/classes/controllers/grid/GridRow.inc.php index 29a0e1e1765..a3e848439e5 100644 --- a/classes/controllers/grid/GridRow.inc.php +++ b/classes/controllers/grid/GridRow.inc.php @@ -31,13 +31,13 @@ class GridRow extends GridBodyElement /** @var array */ public $_requestArgs; - /** @var the grid this row belongs to */ + /** @var string the grid this row belongs to */ public $_gridId; /** @var mixed the row's data source */ public $_data; - /** @var boolean true if the row has been modified */ + /** @var bool true if the row has been modified */ public $_isModified; /** @@ -68,7 +68,7 @@ public function __construct() /** * Set the grid id * - * @param $gridId string + * @param string $gridId */ public function setGridId($gridId) { @@ -90,7 +90,7 @@ public function getGridId() * * @see GridHandler::getRequestArgs() * - * @param $requestArgs array + * @param array $requestArgs */ public function setRequestArgs($requestArgs) { @@ -112,7 +112,6 @@ public function getRequestArgs() /** * Set the data element(s) for this controller * - * @param $data mixed */ public function setData(&$data) { @@ -130,7 +129,7 @@ public function &getData() /** * Set the modified flag for the row * - * @param $isModified boolean + * @param bool $isModified */ public function setIsModified($isModified) { @@ -140,7 +139,7 @@ public function setIsModified($isModified) /** * Get the modified flag for the row * - * @return boolean + * @return bool */ public function getIsModified() { @@ -150,7 +149,7 @@ public function getIsModified() /** * Get whether this row has any actions or not. * - * @return boolean + * @return bool */ public function hasActions() { @@ -165,7 +164,7 @@ public function hasActions() /** * Get all actions for a given position within the controller * - * @param $position string the position of the actions + * @param string $position the position of the actions * * @return array the LinkActions for the given position */ @@ -180,8 +179,8 @@ public function getActions($position = GridHandler::GRID_ACTION_POSITION_DEFAULT /** * Add an action * - * @param $action mixed a single action - * @param $position string the position of the action + * @param mixed $action a single action + * @param string $position the position of the action */ public function addAction($action, $position = GridHandler::GRID_ACTION_POSITION_DEFAULT) { @@ -205,7 +204,7 @@ public function getTemplate() /** * Set the controller template * - * @param $template string + * @param string $template */ public function setTemplate($template) { @@ -220,8 +219,8 @@ public function setTemplate($template) * * Subclasses can override this method. * - * @param $request PKPRequest - * @param $template string + * @param PKPRequest $request + * @param string $template */ public function initialize($request, $template = null) { diff --git a/classes/controllers/grid/LiteralGridCellProvider.inc.php b/classes/controllers/grid/LiteralGridCellProvider.inc.php index 49fa637eb8e..9fd9422890f 100644 --- a/classes/controllers/grid/LiteralGridCellProvider.inc.php +++ b/classes/controllers/grid/LiteralGridCellProvider.inc.php @@ -26,8 +26,8 @@ class LiteralGridCellProvider extends GridCellProvider * * @see GridCellProvider::getTemplateVarsFromRowColumn() * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/classes/controllers/grid/feature/GeneralPagingFeature.inc.php b/classes/controllers/grid/feature/GeneralPagingFeature.inc.php index c757fbd9130..e3050501b7f 100644 --- a/classes/controllers/grid/feature/GeneralPagingFeature.inc.php +++ b/classes/controllers/grid/feature/GeneralPagingFeature.inc.php @@ -28,14 +28,14 @@ class GeneralPagingFeature extends GridFeature /** @var ItemIterator */ private $_itemIterator; - /** @var itemsPerPage */ + /** @var int itemsPerPage */ private $_itemsPerPage; /** * @see GridFeature::GridFeature() * - * @param $id string Feature identifier. - * @param $itemsPerPage null|int Optional Number of items to show at + * @param string $id Feature identifier. + * @param null|int $itemsPerPage Optional Number of items to show at * the first time. * Constructor. */ @@ -101,7 +101,7 @@ public function setOptions($request, $grid) // // Hooks implementation. // - /* + /** * @copydoc GridFeature::gridInitialize() * The feature will know about the current filter * value so it can request grid refreshes keeping @@ -179,7 +179,7 @@ public function getGridRangeInfo($args) /** * Get the range info items per page parameter name. * - * @param $rangeName string + * @param string $rangeName * * @return string */ diff --git a/classes/controllers/grid/feature/GridFeature.inc.php b/classes/controllers/grid/feature/GridFeature.inc.php index 8af579e33b2..16e7327a78c 100644 --- a/classes/controllers/grid/feature/GridFeature.inc.php +++ b/classes/controllers/grid/feature/GridFeature.inc.php @@ -30,7 +30,7 @@ class GridFeature /** * Constructor. * - * @param $id string Feature id. + * @param string $id Feature id. */ public function __construct($id) { @@ -54,7 +54,7 @@ public function getId() /** * Set feature id. * - * @param $id string + * @param string $id */ public function setId($id) { @@ -74,7 +74,7 @@ public function getOptions() /** * Add feature js class options. * - * @param $options array $optionId => $optionValue + * @param array $options $optionId => $optionValue */ public function addOptions($options) { @@ -90,8 +90,8 @@ public function addOptions($options) * Set feature js class options. Extend this method to * define more feature js class options. * - * @param $request PKPRequest - * @param $grid GridHandler + * @param PKPRequest $request + * @param GridHandler $grid */ public function setOptions($request, $grid) { @@ -109,8 +109,8 @@ public function setOptions($request, $grid) * into the grid. Use this only for ui elements * that grid will not fetch itself. * - * @param $request PKPRequest - * @param $grid GridHandler The grid that this + * @param PKPRequest $request + * @param GridHandler $grid The grid that this * feature is attached to. * * @return array It is expected that the array @@ -142,7 +142,7 @@ public function getJSClass() * extends the getRequestArgs method, this hook will only * be called if the extending method call its parent. * - * @param $args array + * @param array $args * 'grid' => GridHandler * 'requestArgs' => array */ @@ -155,7 +155,7 @@ public function getRequestArgs($args) * Hook called every time the grid range info is * retrieved. * - * @param $args array + * @param array $args * 'request' => PKPRequest * 'grid' => GridHandler * 'rangeInfo' => DBResultRange @@ -168,7 +168,7 @@ public function getGridRangeInfo($args) /** * Hook called when grid data is retrieved. * - * @param $args array + * @param array $args * 'request' => PKPRequest * 'grid' => GridHandler * 'gridData' => mixed (array or ItemIterator) @@ -182,7 +182,7 @@ public function getGridDataElements($args) /** * Hook called before grid data is setted. * - * @param $args array + * @param array $args * 'grid' => GridHandler * 'data' => mixed (array or ItemIterator) */ @@ -194,7 +194,7 @@ public function setGridDataElements($args) /** * Hook called every time grid initialize a row object. * - * @param $args array + * @param array $args * 'grid' => GridHandler, * 'row' => GridRow */ @@ -206,7 +206,7 @@ public function getInitializedRowInstance($args) /** * Hook called on grid category row initialization. * - * @param $args array 'request' => PKPRequest + * @param array $args 'request' => PKPRequest * 'grid' => CategoryGridHandler * 'categoryId' => int * 'row' => GridCategoryRow @@ -219,7 +219,7 @@ public function getInitializedCategoryRowInstance($args) /** * Hook called on grid's initialization. * - * @param $args array Contains the grid handler referenced object + * @param array $args Contains the grid handler referenced object * in 'grid' array index. */ public function gridInitialize($args) @@ -230,7 +230,7 @@ public function gridInitialize($args) /** * Hook called on grid's data loading. * - * @param $args array + * @param array $args * 'request' => PKPRequest, * 'grid' => GridHandler, * 'gridData' => array @@ -243,7 +243,7 @@ public function loadData($args) /** * Hook called on grid fetching. * - * @param $args array 'grid' => GridHandler + * @param array $args 'grid' => GridHandler */ public function fetchGrid($args) { @@ -256,7 +256,7 @@ public function fetchGrid($args) /** * Hook called after a group of rows is fetched. * - * @param $args array + * @param array $args * 'request' => PKPRequest * 'grid' => GridHandler * 'jsonMessage' => JSONMessage @@ -269,7 +269,7 @@ public function fetchRows($args) /** * Hook called after a row is fetched. * - * @param $args array + * @param array $args * 'request' => PKPRequest * 'grid' => GridHandler * 'row' => mixed GridRow or null @@ -284,7 +284,7 @@ public function fetchRow($args) * Hook called when save grid items sequence * is requested. * - * @param $args array 'request' => PKPRequest, + * @param array $args 'request' => PKPRequest, * 'grid' => GridHandler */ public function saveSequence($args) diff --git a/classes/controllers/grid/feature/OrderCategoryGridItemsFeature.inc.php b/classes/controllers/grid/feature/OrderCategoryGridItemsFeature.inc.php index 39c1427c87a..2e4a4fc63e4 100644 --- a/classes/controllers/grid/feature/OrderCategoryGridItemsFeature.inc.php +++ b/classes/controllers/grid/feature/OrderCategoryGridItemsFeature.inc.php @@ -25,13 +25,13 @@ class OrderCategoryGridItemsFeature extends OrderItemsFeature /** * Constructor. * - * @param $typeOption int Defines which grid elements will + * @param int $typeOption Defines which grid elements will * be orderable (categories and/or rows). - * @param $overrideRowTemplate boolean This feature uses row + * @param bool $overrideRowTemplate This feature uses row * actions and it will force the usage of the gridRow.tpl. * If you want to use a different grid row template file, set this flag to * false and make sure to use a template file that adds row actions. - * @param $grid GridHandler The grid this feature is to be part of + * @param GridHandler $grid The grid this feature is to be part of */ public function __construct($typeOption = self::ORDER_CATEGORY_GRID_CATEGORIES_AND_ROWS, $overrideRowTemplate = true, $grid = null) { @@ -138,10 +138,9 @@ public function saveSequence($args) /** * Save row elements sequence inside categories. * - * @param $request PKPRequest - * @param $grid GridHandler - * @param $gridCategoryElements array - * @param $data + * @param PKPRequest $request + * @param GridHandler $grid + * @param array $gridCategoryElements */ public function _saveRowsInCategoriesSequence($request, &$grid, $gridCategoryElements, $data) { diff --git a/classes/controllers/grid/feature/OrderGridItemsFeature.inc.php b/classes/controllers/grid/feature/OrderGridItemsFeature.inc.php index 37a288cb983..cf659bf8b42 100644 --- a/classes/controllers/grid/feature/OrderGridItemsFeature.inc.php +++ b/classes/controllers/grid/feature/OrderGridItemsFeature.inc.php @@ -49,7 +49,7 @@ public function getJSClass() /** * @see GridFeature::saveSequence() * - * @param $args array + * @param array $args */ public function saveSequence($args) { diff --git a/classes/controllers/grid/feature/OrderItemsFeature.inc.php b/classes/controllers/grid/feature/OrderItemsFeature.inc.php index fb244219aa2..7ec83396fb7 100644 --- a/classes/controllers/grid/feature/OrderItemsFeature.inc.php +++ b/classes/controllers/grid/feature/OrderItemsFeature.inc.php @@ -24,7 +24,7 @@ class OrderItemsFeature extends GridFeature { - /** @var boolean */ + /** @var bool */ public $_overrideRowTemplate; /** @var string */ @@ -33,11 +33,11 @@ class OrderItemsFeature extends GridFeature /** * Constructor. * - * @param $overrideRowTemplate boolean This feature uses row + * @param bool $overrideRowTemplate This feature uses row * actions and it will force the usage of the gridRow.tpl. * If you want to use a different grid row template file, set this flag to * false and make sure to use a template file that adds row actions. - * @param $nonOrderableItemMessage string optional A translated message to be used + * @param string $nonOrderableItemMessage optional A translated message to be used * when user tries to move a non orderable grid item. */ public function __construct($overrideRowTemplate, $nonOrderableItemMessage = null) @@ -63,9 +63,9 @@ public function setOverrideRowTemplate($overrideRowTemplate) /** * Get override row template flag. * - * @param $gridRow GridRow + * @param GridRow $gridRow * - * @return boolean + * @return bool */ public function getOverrideRowTemplate(&$gridRow) { @@ -81,7 +81,7 @@ public function getOverrideRowTemplate(&$gridRow) /** * Set non orderable item message. * - * @param $nonOrderableItemMessage string Message already translated. + * @param string $nonOrderableItemMessage Message already translated. */ public function setNonOrderableItemMessage($nonOrderableItemMessage) { @@ -177,7 +177,7 @@ public function gridInitialize($args) /** * Add grid row order action. * - * @param $row GridRow + * @param GridRow $row */ public function addRowOrderAction($row) { @@ -204,7 +204,7 @@ public function addRowOrderAction($row) * a grid level order action. Default is * true, override it if needed. * - * @return boolean + * @return bool */ public function isOrderActionNecessary() { diff --git a/classes/controllers/grid/feature/PagingFeature.inc.php b/classes/controllers/grid/feature/PagingFeature.inc.php index 83d09153846..79204a9b2b4 100644 --- a/classes/controllers/grid/feature/PagingFeature.inc.php +++ b/classes/controllers/grid/feature/PagingFeature.inc.php @@ -24,7 +24,7 @@ class PagingFeature extends GeneralPagingFeature * @see GridFeature::GridFeature() * Constructor. * - * @param $id string Feature identifier. + * @param string $id Feature identifier. */ public function __construct($id = 'paging') { diff --git a/classes/controllers/grid/feature/selectableItems/ItemSelectionGridColumn.inc.php b/classes/controllers/grid/feature/selectableItems/ItemSelectionGridColumn.inc.php index 3306d180e6c..fa8a782cb4b 100644 --- a/classes/controllers/grid/feature/selectableItems/ItemSelectionGridColumn.inc.php +++ b/classes/controllers/grid/feature/selectableItems/ItemSelectionGridColumn.inc.php @@ -26,7 +26,7 @@ class ItemSelectionGridColumn extends GridColumn /** * Constructor * - * @param $selectName string The name of the form parameter + * @param string $selectName The name of the form parameter * to which the selected files will be posted. */ public function __construct($selectName) diff --git a/classes/controllers/grid/files/FilesGridCapabilities.inc.php b/classes/controllers/grid/files/FilesGridCapabilities.inc.php index fbe4be0c2ab..d4c86148f7a 100644 --- a/classes/controllers/grid/files/FilesGridCapabilities.inc.php +++ b/classes/controllers/grid/files/FilesGridCapabilities.inc.php @@ -32,28 +32,28 @@ class FilesGridCapabilities public const FILE_GRID_MANAGE = 0x00000010; public const FILE_GRID_EDIT = 0x00000020; - /** @var boolean */ + /** @var bool */ public $_canAdd; - /** @var boolean */ + /** @var bool */ public $_canViewNotes; - /** @var boolean */ + /** @var bool */ public $_canDownloadAll; - /** @var boolean */ + /** @var bool */ public $_canDelete; - /** @var boolean */ + /** @var bool */ public $_canManage; - /** @var boolean */ + /** @var bool */ public $_canEdit; /** * Constructor * - * @param $capabilities integer A bit map with zero or more + * @param int $capabilities A bit map with zero or more * FILE_GRID_* capabilities set. */ public function __construct($capabilities = 0) @@ -73,7 +73,7 @@ public function __construct($capabilities = 0) /** * Does this grid allow the addition of files or revisions? * - * @return boolean + * @return bool */ public function canAdd() { @@ -83,7 +83,7 @@ public function canAdd() /** * Set whether or not the grid allows the addition of files or revisions. * - * @param $canAdd boolean + * @param bool $canAdd */ public function setCanAdd($canAdd) { @@ -93,7 +93,7 @@ public function setCanAdd($canAdd) /** * Does this grid allow viewing of notes? * - * @return boolean + * @return bool */ public function canViewNotes() { @@ -103,7 +103,7 @@ public function canViewNotes() /** * Set whether this grid allows viewing of notes or not. * - * @return boolean + * @return bool */ public function setCanViewNotes($canViewNotes) { @@ -113,7 +113,7 @@ public function setCanViewNotes($canViewNotes) /** * Can the user download all files as an archive? * - * @return boolean + * @return bool */ public function canDownloadAll() { @@ -123,7 +123,7 @@ public function canDownloadAll() /** * Set whether user can download all files as an archive or not. * - * @return boolean + * @return bool */ public function setCanDownloadAll($canDownloadAll) { @@ -133,7 +133,7 @@ public function setCanDownloadAll($canDownloadAll) /** * Can the user delete files from this grid? * - * @return boolean + * @return bool */ public function canDelete() { @@ -143,7 +143,7 @@ public function canDelete() /** * Set whether or not the user can delete files from this grid. * - * @param $canDelete boolean + * @param bool $canDelete */ public function setCanDelete($canDelete) { @@ -153,7 +153,7 @@ public function setCanDelete($canDelete) /** * Whether the grid allows file management (select existing files to add to grid) * - * @return boolean + * @return bool */ public function canManage() { @@ -163,7 +163,7 @@ public function canManage() /** * Set whether the grid allows file management (select existing files to add to grid) * - * @return boolean + * @return bool */ public function setCanManage($canManage) { @@ -173,7 +173,7 @@ public function setCanManage($canManage) /** * Whether the grid allows file metadata editing * - * @return boolean + * @return bool */ public function canEdit() { @@ -183,7 +183,7 @@ public function canEdit() /** * Set whether the grid allows file metadata editing * - * @return boolean + * @return bool */ public function setCanEdit($canEdit) { @@ -193,9 +193,9 @@ public function setCanEdit($canEdit) /** * Get the download all link action. * - * @param $request PKPRequest - * @param $files array The files to be downloaded. - * @param $linkParams array The link action request + * @param PKPRequest $request + * @param array $files The files to be downloaded. + * @param array $linkParams The link action request * parameters. * * @return LinkAction diff --git a/classes/controllers/grid/plugins/PluginGridHandler.inc.php b/classes/controllers/grid/plugins/PluginGridHandler.inc.php index 45176fd299e..ca4120e1e5b 100644 --- a/classes/controllers/grid/plugins/PluginGridHandler.inc.php +++ b/classes/controllers/grid/plugins/PluginGridHandler.inc.php @@ -49,7 +49,7 @@ abstract class PluginGridHandler extends CategoryGridHandler /** * Constructor * - * @param $roles array + * @param array $roles */ public function __construct($roles) { @@ -265,7 +265,7 @@ public function getCategoryRowIdParameterName() protected function loadData($request, $filter) { $categories = PluginRegistry::getCategories(); - if (is_array($filter) && isset($filter['category']) && array_search($filter['category'], $categories) !== false) { + if (is_array($filter) && isset($filter['category']) && in_array($filter['category'], $categories)) { return [$filter['category'] => $filter['category']]; } else { return array_combine($categories, $categories); @@ -279,8 +279,8 @@ protected function loadData($request, $filter) /** * Manage a plugin. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -293,8 +293,8 @@ public function manage($args, $request) /** * Enable a plugin. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -316,8 +316,8 @@ public function enable($args, $request) /** * Disable a plugin. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -339,8 +339,8 @@ public function disable($args, $request) /** * Show upload plugin form to upload a new plugin. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return string */ @@ -352,8 +352,8 @@ public function uploadPlugin($args, $request) /** * Show upload plugin form to update an existing plugin. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return string */ @@ -365,8 +365,8 @@ public function upgradePlugin($args, $request) /** * Upload a plugin file. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -390,8 +390,8 @@ public function uploadPluginFile($args, $request) /** * Save upload plugin file form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -416,8 +416,8 @@ public function saveUploadPlugin($args, $request) /** * Delete plugin. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -466,8 +466,8 @@ public function deletePlugin($args, $request) /** * Fetch upload plugin form. * - * @param $function string - * @param $request PKPRequest Request object + * @param string $function + * @param PKPRequest $request Request object * * @return JSONMessage JSON object */ diff --git a/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.inc.php b/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.inc.php index 1635daeaffe..e0f8018e9fb 100644 --- a/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.inc.php +++ b/classes/controllers/grid/users/reviewer/PKPReviewerGridHandler.inc.php @@ -67,10 +67,10 @@ class PKPReviewerGridHandler extends GridHandler /** @var Submission */ public $_submission; - /** @var integer */ + /** @var int */ public $_stageId; - /** @var boolean Is the current user assigned as an author to this submission */ + /** @var bool Is the current user assigned as an author to this submission */ public $_isCurrentUserAssignedAuthor; @@ -175,7 +175,7 @@ public function getSubmission() /** * Get the review stage id. * - * @return integer + * @return int */ public function getStageId() { @@ -337,8 +337,8 @@ protected function loadData($request, $filter) /** * Add a reviewer. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -350,8 +350,8 @@ public function showReviewerForm($args, $request) /** * Load the contents of the reviewer form * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -365,8 +365,8 @@ public function reloadReviewerForm($args, $request) /** * Create a new user as reviewer. * - * @param $args Array - * @param $request Request + * @param array $args + * @param Request $request * * @return string Serialized JSON object */ @@ -378,8 +378,8 @@ public function createReviewer($args, $request) /** * Enroll an existing user as reviewer. * - * @param $args Array - * @param $request Request + * @param array $args + * @param Request $request * * @return string Serialized JSON object */ @@ -391,8 +391,8 @@ public function enrollReviewer($args, $request) /** * Edit a reviewer * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -417,8 +417,8 @@ public function updateReviewer($args, $request) /** * Manage reviewer access to files * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -434,8 +434,8 @@ public function editReview($args, $request) /** * Save a change to reviewer access to files * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -456,8 +456,8 @@ public function updateReview($args, $request) /** * Get a list of all non-reviewer users in the system to populate the reviewer role assignment autocomplete. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -485,8 +485,8 @@ public function getUsersNotAssignedAsReviewers($args, $request) /** * Unassign a reviewer * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -506,8 +506,8 @@ public function unassignReviewer($args, $request) /** * Reinstate a reviewer * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -527,7 +527,7 @@ public function reinstateReviewer($args, $request) /** * Save the reviewer reinstatement * - * @param $request PKPRequest + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -562,7 +562,7 @@ public function updateReinstateReviewer($args, $request) /** * Save the reviewer unassignment * - * @param $request PKPRequest + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -597,8 +597,8 @@ public function updateUnassignReviewer($args, $request) /** * An action triggered by a confirmation modal to allow an editor to unconsider a review. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -636,8 +636,8 @@ public function unconsiderReview($args, $request) /** * Mark the review as read and trigger a rewrite of the row. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -708,8 +708,8 @@ public function reviewRead($args, $request) /** * Displays a modal to allow the editor to enter a message to send to the reviewer as a thank you. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -731,8 +731,8 @@ public function editThankReviewer($args, $request) * Open a modal to read the reviewer's review and * download any files they may have uploaded * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -788,8 +788,8 @@ public function readReview($args, $request) /** * Send the acknowledgement email, if desired, and trigger a row refresh action. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -820,8 +820,8 @@ public function thankReviewer($args, $request) /** * Displays a modal to allow the editor to enter a message to send to the reviewer as a reminder * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return string Serialized JSON object */ @@ -842,8 +842,8 @@ public function editReminder($args, $request) /** * Send the reviewer reminder and close the modal * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -870,8 +870,8 @@ public function sendReminder($args, $request) /** * Displays a modal to send an email message to the user. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -904,8 +904,8 @@ public function sendEmail($args, $request) /** * Displays a modal containing history for the review assignment. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -932,8 +932,8 @@ public function reviewHistory($args, $request) /** * Displays a modal containing the gossip values for a reviewer * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -972,8 +972,8 @@ public function gossip($args, $request) /** * Fetches an email template's message body and returns it via AJAX. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -1008,10 +1008,10 @@ public function fetchTemplateBody($args, $request) /** * Return a fetched reviewer form data in string. * - * @param $args Array - * @param $request Request + * @param array $args + * @param Request $request * - * @return String + * @return string */ public function _fetchReviewerForm($args, $request) { @@ -1032,9 +1032,9 @@ public function _fetchReviewerForm($args, $request) /** * Get the name of ReviewerForm class for the current selection type. * - * @param $selectionType String (const) + * @param string $selectionType (const) * - * @return FormClassName String + * @return string Form class name */ public function _getReviewerFormClassName($selectionType) { diff --git a/classes/controllers/listbuilder/ListbuilderGridColumn.inc.php b/classes/controllers/listbuilder/ListbuilderGridColumn.inc.php index cdd8e0e7ab9..47c60d175e8 100644 --- a/classes/controllers/listbuilder/ListbuilderGridColumn.inc.php +++ b/classes/controllers/listbuilder/ListbuilderGridColumn.inc.php @@ -22,13 +22,13 @@ class ListbuilderGridColumn extends GridColumn /** * Constructor * - * @param $listbuilder ListbuilderHandler The listbuilder handler this column belongs to. - * @param $id string The optional symbolic ID for this column. - * @param $title string The optional title for this column. - * @param $titleTranslated string The optional translated title for this column. - * @param $template string The optional overridden template for this column. - * @param $cellProvider ListbuilderGridCellProvider The optional overridden grid cell provider. - * @param $flags array Optional set of flags for this column's display. + * @param ListbuilderHandler $listbuilder The listbuilder handler this column belongs to. + * @param string $id The optional symbolic ID for this column. + * @param string $title The optional title for this column. + * @param string $titleTranslated The optional translated title for this column. + * @param string $template The optional overridden template for this column. + * @param ListbuilderGridCellProvider $cellProvider The optional overridden grid cell provider. + * @param array $flags Optional set of flags for this column's display. */ public function __construct( $listbuilder, diff --git a/classes/controllers/listbuilder/ListbuilderGridRow.inc.php b/classes/controllers/listbuilder/ListbuilderGridRow.inc.php index 91eff75f96d..6f2c66963d9 100644 --- a/classes/controllers/listbuilder/ListbuilderGridRow.inc.php +++ b/classes/controllers/listbuilder/ListbuilderGridRow.inc.php @@ -15,20 +15,19 @@ namespace PKP\controllers\listbuilder; -use PKP\controllers\grid\GridRow; use PKP\controllers\grid\GridRow; use PKP\linkAction\LinkAction; use PKP\linkAction\request\NullAction; class ListbuilderGridRow extends GridRow { - /** @var boolean */ + /** @var bool */ public $_hasDeleteItemLink; /** * Constructor * - * @param $hasDeleteItemLink boolean + * @param bool $hasDeleteItemLink */ public function __construct($hasDeleteItemLink = true) { @@ -40,7 +39,7 @@ public function __construct($hasDeleteItemLink = true) /** * Add a delete item link action or not. * - * @param $hasDeleteItemLink boolean + * @param bool $hasDeleteItemLink */ public function setHasDeleteItemLink($hasDeleteItemLink) { diff --git a/classes/controllers/listbuilder/ListbuilderHandler.inc.php b/classes/controllers/listbuilder/ListbuilderHandler.inc.php index 0904fc6780b..5c441576dba 100644 --- a/classes/controllers/listbuilder/ListbuilderHandler.inc.php +++ b/classes/controllers/listbuilder/ListbuilderHandler.inc.php @@ -24,15 +24,15 @@ class ListbuilderHandler extends GridHandler { - /* Listbuilder source types: text-based, pulldown, ... */ + /** @var int Listbuilder source types: text-based, pulldown, ... */ public const LISTBUILDER_SOURCE_TYPE_TEXT = 0; public const LISTBUILDER_SOURCE_TYPE_SELECT = 1; - /* Listbuilder save types */ + /** @var int Listbuilder save types */ public const LISTBUILDER_SAVE_TYPE_EXTERNAL = 0; public const LISTBUILDER_SAVE_TYPE_INTERNAL = 1; - /* String to identify optgroup in the returning options data. If you want to use + /** @var string String to identify optgroup in the returning options data. If you want to use * optgroup in listbuilder select, return the options data in a multidimensional array * array[columnIndex][optgroupId][selectItemId] and also with * array[columnIndex][LISTBUILDER_OPTGROUP_LABEL][optgroupId] */ @@ -82,7 +82,7 @@ public function getTemplate() /** * Set the type of source (Free text input, select from list, autocomplete) * - * @param $sourceType int LISTBUILDER_SOURCE_TYPE_... + * @param int $sourceType LISTBUILDER_SOURCE_TYPE_... */ public function setSourceType($sourceType) { @@ -120,7 +120,7 @@ public function getSaveType() /** * Set the save field name for LISTBUILDER_SAVE_TYPE_EXTERNAL * - * @param $fieldName string + * @param string $fieldName */ public function setSaveFieldName($fieldName) { @@ -142,7 +142,7 @@ public function getSaveFieldName() /** * Get the "add item" link action. * - * @param $actionRequest ActionRequest + * @param ActionRequest $actionRequest * * @return LinkAction */ @@ -161,7 +161,7 @@ public function getAddItemLinkAction($actionRequest) * this is an array representing the row. For single-column * listbuilders, this is a single piece of data (i.e. a string or int) * - * @param $request PKPRequest + * @param PKPRequest $request */ public function getNewRowId($request) { @@ -171,10 +171,10 @@ public function getNewRowId($request) /** * Delete an entry. * - * @param $request Request object - * @param $rowId mixed ID of row to modify + * @param Request $request object + * @param mixed $rowId ID of row to modify * - * @return boolean + * @return bool */ public function deleteEntry($request, $rowId) { @@ -184,11 +184,11 @@ public function deleteEntry($request, $rowId) /** * Persist an update to an entry. * - * @param $request Request object - * @param $rowId mixed ID of row to modify - * @param $newRowId mixed ID of the new entry + * @param Request $request object + * @param mixed $rowId ID of row to modify + * @param mixed $newRowId ID of the new entry * - * @return boolean + * @return bool */ public function updateEntry($request, $rowId, $newRowId) { @@ -204,10 +204,10 @@ public function updateEntry($request, $rowId, $newRowId) /** * Persist a new entry insert. * - * @param $request Request object - * @param $newRowId mixed ID of row to modify + * @param Request $request object + * @param mixed $newRowId ID of row to modify * - * @return boolean + * @return bool */ public function insertEntry($request, $newRowId) { @@ -222,7 +222,7 @@ public function insertEntry($request, $newRowId) * array('column 1 option 2', 'column 2 option 2' * ); * - * @param request Request + * @param Request $request * * @return array */ @@ -237,8 +237,8 @@ public function getOptions($request) /** * Fetch the listbuilder. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function fetch($args, $request) { @@ -268,10 +268,10 @@ public function fetch($args, $request) /** * Unpack data to save using an external handler. * - * @param $data String (the json encoded data from the listbuilder itself) - * @param $deletionCallback array callback to be used for each deleted element - * @param $insertionCallback array callback to be used for each updated element - * @param $updateCallback array callback to be used for each updated element + * @param string $data (the json encoded data from the listbuilder itself) + * @param array $deletionCallback callback to be used for each deleted element + * @param array $insertionCallback callback to be used for each updated element + * @param array $updateCallback callback to be used for each updated element */ public static function unpack($request, $data, $deletionCallback, $insertionCallback, $updateCallback) { @@ -340,8 +340,8 @@ public static function unpack($request, $data, $deletionCallback, $insertionCall /** * Save the listbuilder using the internal handler. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function save($args, $request) { @@ -363,8 +363,8 @@ public function save($args, $request) /** * Load the set of options for a select list type listbuilder. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -378,7 +378,7 @@ public function fetchOptions($args, $request) /** * Can items be added to this list builder? * - * @return boolean + * @return bool */ public function canAddItems() { diff --git a/classes/controllers/modals/editorDecision/PKPEditorDecisionHandler.inc.php b/classes/controllers/modals/editorDecision/PKPEditorDecisionHandler.inc.php deleted file mode 100644 index 1ec58d60eb6..00000000000 --- a/classes/controllers/modals/editorDecision/PKPEditorDecisionHandler.inc.php +++ /dev/null @@ -1,641 +0,0 @@ -_getReviewRoundOps(); - $this->addPolicy(new ReviewRoundRequiredPolicy($request, $args, 'reviewRoundId', $reviewRoundOps)); - - if (!parent::authorize($request, $args, $roleAssignments)) { - return false; - } - - // Prevent editors who are also assigned as authors from accessing the - // review stage operations - $operation = $request->getRouter()->getRequestedOp($request); - if (in_array($operation, $reviewRoundOps)) { - $userAccessibleStages = $this->getAuthorizedContextObject(ASSOC_TYPE_ACCESSIBLE_WORKFLOW_STAGES); - foreach ($userAccessibleStages as $stageId => $roles) { - if (in_array(Role::ROLE_ID_AUTHOR, $roles)) { - return false; - } - } - } - - return true; - } - - /** - * @copydoc PKPHandler::initialize() - */ - public function initialize($request) - { - AppLocale::requireComponents( - LOCALE_COMPONENT_APP_COMMON, - LOCALE_COMPONENT_APP_EDITOR, - LOCALE_COMPONENT_APP_SUBMISSION, - LOCALE_COMPONENT_PKP_EDITOR, - LOCALE_COMPONENT_PKP_SUBMISSION - ); - } - - - // - // Public handler actions - // - /** - * Start a new review round - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function newReviewRound($args, $request) - { - return $this->_initiateEditorDecision($args, $request, 'NewReviewRoundForm'); - } - - /** - * Jump from submission to external review - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function externalReview($args, $request) - { - return $this->_initiateEditorDecision($args, $request, 'InitiateExternalReviewForm'); - } - - /** - * Start a new review round in external review, bypassing internal - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function saveExternalReview($args, $request) - { - assert($this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE) == WORKFLOW_STAGE_ID_SUBMISSION); - $workflowStageDao = DAORegistry::getDAO('WorkflowStageDAO'); /** @var WorkflowStageDAO $workflowStageDao */ - return $this->_saveEditorDecision( - $args, - $request, - 'InitiateExternalReviewForm', - $workflowStageDao::WORKFLOW_STAGE_PATH_EXTERNAL_REVIEW, - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW - ); - } - - /** - * Show a save review form (responsible for decline submission modals when not in review stage) - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function sendReviews($args, $request) - { - return $this->_initiateEditorDecision($args, $request, 'SendReviewsForm'); - } - - /** - * Show a save review form (responsible for request revisions, - * resubmit for review, and decline submission modals in review stages). - * We need this because the authorization in review stages is different - * when not in review stages (need to authorize review round id). - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function sendReviewsInReview($args, $request) - { - return $this->_initiateEditorDecision($args, $request, 'SendReviewsForm'); - } - - /** - * Save the send review form when user is not in review stage. - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function saveSendReviews($args, $request) - { - return $this->_saveEditorDecision($args, $request, 'SendReviewsForm'); - } - - /** - * Save the send review form when user is in review stages. - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function saveSendReviewsInReview($args, $request) - { - return $this->_saveEditorDecision($args, $request, 'SendReviewsForm'); - } - - /** - * Show a promote form (responsible for accept submission modals outside review stage) - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function promote($args, $request) - { - return $this->_initiateEditorDecision($args, $request, 'PromoteForm'); - } - - /** - * Show a promote form (responsible for external review and accept submission modals - * in review stages). We need this because the authorization for promoting in review - * stages is different when not in review stages (need to authorize review round id). - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function promoteInReview($args, $request) - { - return $this->_initiateEditorDecision($args, $request, 'PromoteForm'); - } - - /** - * Save the send review form - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function savePromote($args, $request) - { - return $this->_saveGeneralPromote($args, $request); - } - - /** - * Save the send review form (same case of the - * promoteInReview() method, see description there). - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function savePromoteInReview($args, $request) - { - return $this->_saveGeneralPromote($args, $request); - } - - /** - * Show a revert decline form. - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function revertDecline($args, $request) - { - return $this->_initiateEditorDecision($args, $request, 'RevertDeclineForm'); - } - - /** - * Save the revert decline form. - * - * @param $args array - * @param $request PKPRequest - * - * @return string Serialized JSON object - */ - public function saveRevertDecline($args, $request) - { - return $this->_saveEditorDecision($args, $request, 'RevertDeclineForm'); - } - - /** - * Import all free-text/review form reviews to paste into message - * - * @param $args array - * @param $request PKPRequest - * - * @return JSONMessage JSON object - */ - public function importPeerReviews($args, $request) - { - // Retrieve the authorized submission. - $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); - - // Retrieve the current review round. - $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND); - - // Retrieve peer reviews. - $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /** @var ReviewAssignmentDAO $reviewAssignmentDao */ - $submissionCommentDao = DAORegistry::getDAO('SubmissionCommentDAO'); /** @var SubmissionCommentDAO $submissionCommentDao */ - $reviewFormResponseDao = DAORegistry::getDAO('ReviewFormResponseDAO'); /** @var ReviewFormResponseDAO $reviewFormResponseDao */ - $reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO'); /** @var ReviewFormElementDAO $reviewFormElementDao */ - - $reviewAssignments = $reviewAssignmentDao->getBySubmissionId($submission->getId(), $reviewRound->getId()); - $reviewIndexes = $reviewAssignmentDao->getReviewIndexesForRound($submission->getId(), $reviewRound->getId()); - AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION); - - $body = ''; - $textSeparator = '------------------------------------------------------'; - foreach ($reviewAssignments as $reviewAssignment) { - // If the reviewer has completed the assignment, then import the review. - if ($reviewAssignment->getDateCompleted() != null) { - // Get the comments associated with this review assignment - $submissionComments = $submissionCommentDao->getSubmissionComments($submission->getId(), SubmissionComment::COMMENT_TYPE_PEER_REVIEW, $reviewAssignment->getId()); - - $body .= "

${textSeparator}
"; - // If it is an open review, show reviewer's name. - if ($reviewAssignment->getReviewMethod() == SUBMISSION_REVIEW_METHOD_OPEN) { - $body .= $reviewAssignment->getReviewerFullName() . "
\n"; - } else { - $body .= __('submission.comments.importPeerReviews.reviewerLetter', ['reviewerLetter' => PKPString::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()])]) . "
\n"; - } - - while ($comment = $submissionComments->next()) { - // If the comment is viewable by the author, then add the comment. - if ($comment->getViewable()) { - $body .= PKPString::stripUnsafeHtml($comment->getComments()); - } - } - - // Add reviewer recommendation - $recommendation = $reviewAssignment->getLocalizedRecommendation(); - $body .= __('submission.recommendation', ['recommendation' => $recommendation]) . "
\n"; - - $body .= "
${textSeparator}

"; - - if ($reviewFormId = $reviewAssignment->getReviewFormId()) { - $reviewId = $reviewAssignment->getId(); - - - $reviewFormElements = $reviewFormElementDao->getByReviewFormId($reviewFormId); - if (!$submissionComments) { - $body .= "${textSeparator}
"; - - $body .= __('submission.comments.importPeerReviews.reviewerLetter', ['reviewerLetter' => PKPString::enumerateAlphabetically($reviewIndexes[$reviewAssignment->getId()])]) . '

'; - } - while ($reviewFormElement = $reviewFormElements->next()) { - if (!$reviewFormElement->getIncluded()) { - continue; - } - - $body .= PKPString::stripUnsafeHtml($reviewFormElement->getLocalizedQuestion()); - $reviewFormResponse = $reviewFormResponseDao->getReviewFormResponse($reviewId, $reviewFormElement->getId()); - - if ($reviewFormResponse) { - $possibleResponses = $reviewFormElement->getLocalizedPossibleResponses(); - // See issue #2437. - if (in_array($reviewFormElement->getElementType(), [$reviewFormElement::REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES, $reviewFormElement::REVIEW_FORM_ELEMENT_TYPE_RADIO_BUTTONS])) { - ksort($possibleResponses); - $possibleResponses = array_values($possibleResponses); - } - if (in_array($reviewFormElement->getElementType(), $reviewFormElement->getMultipleResponsesElementTypes())) { - if ($reviewFormElement->getElementType() == $reviewFormElement::REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES) { - $body .= '
    '; - foreach ($reviewFormResponse->getValue() as $value) { - $body .= '
  • ' . PKPString::stripUnsafeHtml($possibleResponses[$value]) . '
  • '; - } - $body .= '
'; - } else { - $body .= '
' . PKPString::stripUnsafeHtml($possibleResponses[$reviewFormResponse->getValue()]) . '
'; - } - $body .= '
'; - } else { - $body .= '
' . nl2br(htmlspecialchars($reviewFormResponse->getValue())) . '
'; - } - } - } - $body .= "${textSeparator}

"; - } - } - } - - // Notify the user. - $notificationMgr = new NotificationManager(); - $user = $request->getUser(); - $notificationMgr->createTrivialNotification($user->getId(), PKPNotification::NOTIFICATION_TYPE_SUCCESS, ['contents' => __('editor.review.reviewsAdded')]); - - return new JSONMessage(true, empty($body) ? __('editor.review.noReviews') : $body); - } - - /** - * Show the editor recommendation form - * - * @param $args array - * @param $request PKPRequest - * - * @return JSONMessage - */ - public function sendRecommendation($args, $request) - { - // Retrieve the authorized submission, stage id and review round. - $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); - $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); - assert(in_array($stageId, $this->_getReviewStages())); - $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND); - assert($reviewRound instanceof \PKP\submission\reviewRound\ReviewRound); - - // Form handling - $editorRecommendationForm = new RecommendationForm($submission, $stageId, $reviewRound); - $editorRecommendationForm->initData(); - return new JSONMessage(true, $editorRecommendationForm->fetch($request)); - } - - /** - * Show the editor recommendation form - * - * @param $args array - * @param $request PKPRequest - * - * @return JSONMessage - */ - public function saveRecommendation($args, $request) - { - // Retrieve the authorized submission, stage id and review round. - $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); - $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); - assert(in_array($stageId, $this->_getReviewStages())); - $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND); - assert($reviewRound instanceof \PKP\submission\reviewRound\ReviewRound); - - // Form handling - $editorRecommendationForm = new RecommendationForm($submission, $stageId, $reviewRound); - $editorRecommendationForm->readInputData(); - if ($editorRecommendationForm->validate()) { - $editorRecommendationForm->execute(); - $json = new JSONMessage(true); - $json->setGlobalEvent('decisionActionUpdated'); - return $json; - } - return new JSONMessage(false); - } - - - // - // Protected helper methods - // - /** - * Get operations that need a review round id policy. - * - * @return array - */ - protected function _getReviewRoundOps() - { - return ['promoteInReview', 'savePromoteInReview', 'newReviewRound', 'saveNewReviewRound', 'sendReviewsInReview', 'saveSendReviewsInReview', 'importPeerReviews', 'sendRecommendation', 'saveRecommendation']; - } - - /** - * Get the fully-qualified import name for the given form name. - * - * @param $formName Class name for the desired form. - * - * @return string - */ - protected function _resolveEditorDecisionForm($formName) - { - switch ($formName) { - case 'EditorDecisionWithEmailForm': - case 'NewReviewRoundForm': - case 'PromoteForm': - case 'SendReviewsForm': - case 'RevertDeclineForm': - return "lib.pkp.controllers.modals.editorDecision.form.${formName}"; - default: - assert(false); - } - } - - /** - * Get an instance of an editor decision form. - * - * @param $formName string - * @param $decision int - * - * @return EditorDecisionForm - */ - protected function _getEditorDecisionForm($formName, $decision) - { - // Retrieve the authorized submission. - $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); - // Retrieve the stage id - $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); - - import($this->_resolveEditorDecisionForm($formName)); - if (in_array($stageId, $this->_getReviewStages())) { - $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND); - $editorDecisionForm = new $formName($submission, $decision, $stageId, $reviewRound); - // We need a different save operation in review stages to authorize - // the review round object. - if ($editorDecisionForm instanceof PromoteForm) { - $editorDecisionForm->setSaveFormOperation('savePromoteInReview'); - } elseif ($editorDecisionForm instanceof SendReviewsForm) { - $editorDecisionForm->setSaveFormOperation('saveSendReviewsInReview'); - } - } else { - $editorDecisionForm = new $formName($submission, $decision, $stageId); - } - - if ($editorDecisionForm instanceof $formName) { - return $editorDecisionForm; - } else { - assert(false); - return null; - } - } - - /** - * Initiate an editor decision. - * - * @param $args array - * @param $request PKPRequest - * @param $formName string Name of form to call - * - * @return JSONMessage JSON object - */ - protected function _initiateEditorDecision($args, $request, $formName) - { - // Retrieve the decision - $decision = (int)$request->getUserVar('decision'); - - // Form handling - $editorDecisionForm = $this->_getEditorDecisionForm($formName, $decision); - $editorDecisionForm->initData(); - - return new JSONMessage(true, $editorDecisionForm->fetch($request)); - } - - /** - * Save an editor decision. - * - * @param $args array - * @param $request PKPRequest - * @param $formName string Name of form to call - * @param $redirectOp string A workflow stage operation to - * redirect to if successful (if any). - * @param null|mixed $decision - * - * @return JSONMessage JSON object - */ - protected function _saveEditorDecision($args, $request, $formName, $redirectOp = null, $decision = null) - { - // Retrieve the authorized submission. - $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); - // Retrieve the decision - if (is_null($decision)) { - $decision = (int)$request->getUserVar('decision'); - } - - $editorDecisionForm = $this->_getEditorDecisionForm($formName, $decision); - $editorDecisionForm->readInputData(); - if ($editorDecisionForm->validate()) { - $editorDecisionForm->execute(); - - // Get a list of author user IDs - $authorUserIds = []; - $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ - $submitterAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), Role::ROLE_ID_AUTHOR); - while ($assignment = $submitterAssignments->next()) { - $authorUserIds[] = $assignment->getUserId(); - } - // De-duplicate assignments - $authorUserIds = array_unique($authorUserIds); - - // Update editor decision and pending revisions notifications. - $notificationMgr = new NotificationManager(); - $editorDecisionNotificationType = $this->_getNotificationTypeByEditorDecision($decision); - $notificationTypes = array_merge([$editorDecisionNotificationType], $this->_getReviewNotificationTypes()); - $notificationMgr->updateNotification( - $request, - $notificationTypes, - $authorUserIds, - ASSOC_TYPE_SUBMISSION, - $submission->getId() - ); - - // Update submission notifications - $submissionNotificationsToUpdate = [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT => [ - PKPNotification::NOTIFICATION_TYPE_ASSIGN_COPYEDITOR, - PKPNotification::NOTIFICATION_TYPE_AWAITING_COPYEDITS - ], - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION => [ - PKPNotification::NOTIFICATION_TYPE_ASSIGN_COPYEDITOR, - PKPNotification::NOTIFICATION_TYPE_AWAITING_COPYEDITS, - PKPNotification::NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER, - PKPNotification::NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS, - ], - ]; - $notificationMgr = new NotificationManager(); - if (array_key_exists($decision, $submissionNotificationsToUpdate)) { - $notificationMgr->updateNotification( - $request, - $submissionNotificationsToUpdate[$decision], - null, - ASSOC_TYPE_SUBMISSION, - $submission->getId() - ); - } - - if ($redirectOp) { - $dispatcher = $this->getDispatcher(); - $redirectUrl = $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'workflow', $redirectOp, [$submission->getId()]); - return $request->redirectUrlJson($redirectUrl); - } else { - if (in_array($decision, [EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE, EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE, EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_REVERT_DECLINE])) { - $dispatcher = $this->getDispatcher(); - $redirectUrl = $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'workflow', 'access', [$submission->getId()]); - return $request->redirectUrlJson($redirectUrl); - } else { - // Needed to update review round status notifications. - return \PKP\db\DAO::getDataChangedEvent(); - } - } - } else { - return new JSONMessage(false); - } - } - - /** - * Get review-related stage IDs. - * - * @return array - */ - protected function _getReviewStages() - { - assert(false); - } - - /** - * Get review-related decision notifications. - * - * @return array - */ - protected function _getReviewNotificationTypes() - { - assert(false); // Subclasses to override - } -} - -if (!PKP_STRICT_MODE) { - class_alias('\PKP\controllers\modals\editorDecision\PKPEditorDecisionHandler', '\PKPEditorDecisionHandler'); -} diff --git a/classes/controllers/modals/editorDecision/form/EditorDecisionForm.inc.php b/classes/controllers/modals/editorDecision/form/EditorDecisionForm.inc.php deleted file mode 100644 index 9d40f3159c2..00000000000 --- a/classes/controllers/modals/editorDecision/form/EditorDecisionForm.inc.php +++ /dev/null @@ -1,240 +0,0 @@ -_submission = $submission; - $this->_stageId = $stageId; - $this->_reviewRound = $reviewRound; - $this->_decision = $decision; - - // Validation checks for this form - $this->addCheck(new \PKP\form\validation\FormValidatorPost($this)); - $this->addCheck(new \PKP\form\validation\FormValidatorCSRF($this)); - } - - // - // Getters and Setters - // - /** - * Get the decision - * - * @return integer - */ - public function getDecision() - { - return $this->_decision; - } - - /** - * Get the submission - * - * @return Submission - */ - public function getSubmission() - { - return $this->_submission; - } - - /** - * Get the stage Id - * - * @return int - */ - public function getStageId() - { - return $this->_stageId; - } - - /** - * Get the review round object. - * - * @return ReviewRound - */ - public function getReviewRound() - { - return $this->_reviewRound; - } - - // - // Overridden template methods from Form - // - /** - * @see Form::readInputData() - */ - public function readInputData() - { - $this->readUserVars(['selectedFiles']); - parent::initData(); - } - - - /** - * @copydoc Form::fetch() - * - * @param null|mixed $template - */ - public function fetch($request, $template = null, $display = false) - { - $submission = $this->getSubmission(); - - $reviewRound = $this->getReviewRound(); - if ($reviewRound instanceof \PKP\submission\reviewRound\ReviewRound) { - $this->setData('reviewRoundId', $reviewRound->getId()); - } - - $this->setData('stageId', $this->getStageId()); - - $templateMgr = TemplateManager::getManager($request); - $stageDecisions = (new EditorDecisionActionsManager())->getStageDecisions($request->getContext(), $submission, $this->getStageId()); - $templateMgr->assign([ - 'decisionData' => $stageDecisions[$this->getDecision()], - 'submissionId' => $submission->getId(), - 'submission' => $submission, - ]); - - return parent::fetch($request, $template, $display); - } - - - // - // Private helper methods - // - /** - * Initiate a new review round and add selected files - * to it. Also saves the new round to the submission. - * - * @param $submission Submission - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. - * @param $request Request - * @param $status integer One of the REVIEW_ROUND_STATUS_* constants. - * - * @return $newRound integer The round number of the new review round. - */ - public function _initiateReviewRound($submission, $stageId, $request, $status = null) - { - - // If we already have review round for this stage, - // we create a new round after the last one. - $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ - $lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId); - if ($lastReviewRound) { - $newRound = $lastReviewRound->getRound() + 1; - } else { - // If we don't have any review round, we create the first one. - $newRound = 1; - } - - // Create a new review round. - $reviewRound = $reviewRoundDao->build($submission->getId(), $stageId, $newRound, $status); - - // Check for a notification already in place for the current review round. - $notificationDao = DAORegistry::getDAO('NotificationDAO'); /** @var NotificationDAO $notificationDao */ - $notificationFactory = $notificationDao->getByAssoc( - ASSOC_TYPE_REVIEW_ROUND, - $reviewRound->getId(), - null, - PKPNotification::NOTIFICATION_TYPE_REVIEW_ROUND_STATUS, - $submission->getContextId() - ); - - // Create round status notification if there is no notification already. - if (!$notificationFactory->next()) { - $notificationMgr = new NotificationManager(); - $notificationMgr->createNotification( - $request, - null, - PKPNotification::NOTIFICATION_TYPE_REVIEW_ROUND_STATUS, - $submission->getContextId(), - ASSOC_TYPE_REVIEW_ROUND, - $reviewRound->getId(), - Notification::NOTIFICATION_LEVEL_NORMAL - ); - } - - // Add the selected files to the new round. - $fileStage = $stageId == WORKFLOW_STAGE_ID_INTERNAL_REVIEW - ? SubmissionFile::SUBMISSION_FILE_INTERNAL_REVIEW_FILE - : SubmissionFile::SUBMISSION_FILE_REVIEW_FILE; - - foreach (['selectedFiles', 'selectedAttachments'] as $userVar) { - $selectedFiles = $this->getData($userVar); - if (is_array($selectedFiles)) { - foreach ($selectedFiles as $fileId) { - $oldSubmissionFile = Repo::submissionFiles() - ->get($fileId); - $oldSubmissionFile->setData('fileStage', $fileStage); - $oldSubmissionFile->setData('sourceSubmissionFileId', $fileId); - $oldSubmissionFile->setData('assocType', null); - $oldSubmissionFile->setData('assocId', null); - - $submissionFileId = Repo::submissionFiles() - ->add($oldSubmissionFile); - - Repo::submissionFiles() - ->dao - ->assignRevisionToReviewRound( - $submissionFileId, - $reviewRound - ); - } - } - } - - return $newRound; - } -} - -if (!PKP_STRICT_MODE) { - class_alias('\PKP\controllers\modals\editorDecision\form\EditorDecisionForm', '\EditorDecisionForm'); -} diff --git a/classes/controllers/tab/workflow/PKPReviewRoundTabHandler.inc.php b/classes/controllers/tab/workflow/PKPReviewRoundTabHandler.inc.php index 0c5653af07b..d4fdcb7f6b9 100644 --- a/classes/controllers/tab/workflow/PKPReviewRoundTabHandler.inc.php +++ b/classes/controllers/tab/workflow/PKPReviewRoundTabHandler.inc.php @@ -45,8 +45,8 @@ public function authorize($request, &$args, $roleAssignments) /** * JSON fetch the external review round info (tab). * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -72,8 +72,8 @@ public function setupTemplate($request) /** * Internal function to handle both internal and external reviews round info (tab content). * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args * * @return JSONMessage JSON object */ diff --git a/classes/core/APIRouter.inc.php b/classes/core/APIRouter.inc.php index 80f067167af..40f425ecf6d 100644 --- a/classes/core/APIRouter.inc.php +++ b/classes/core/APIRouter.inc.php @@ -57,9 +57,9 @@ protected function getPathInfoParts() /** * Determines whether this router can route the given request. * - * @param $request PKPRequest + * @param PKPRequest $request * - * @return boolean true, if the router supports this request, otherwise false + * @return bool true, if the router supports this request, otherwise false */ public function supports($request) { @@ -132,7 +132,7 @@ public function route($request) /** * Get the requested operation * - * @param $request PKPRequest + * @param PKPRequest $request * * @return string */ diff --git a/classes/core/ArrayItemIterator.inc.php b/classes/core/ArrayItemIterator.inc.php index 1f7586315b1..bb3b2327a2e 100644 --- a/classes/core/ArrayItemIterator.inc.php +++ b/classes/core/ArrayItemIterator.inc.php @@ -29,21 +29,21 @@ class ArrayItemIterator extends ItemIterator /** @var int The total number of items. */ public $count; - /** Whether or not the iterator was empty from the start */ + /** @var bool Whether or not the iterator was empty from the start */ public $wasEmpty; /** * Constructor. * - * @param $theArray array The array of items to iterate through - * @param $page int the current page number - * @param $itemsPerPage int Number of items to display per page + * @param array $theArray The array of items to iterate through + * @param int $page the current page number + * @param int $itemsPerPage Number of items to display per page */ public function __construct(&$theArray, $page = -1, $itemsPerPage = -1) { parent::__construct(); if ($page >= 1 && $itemsPerPage >= 1) { - $this->theArray = $this->array_slice_key($theArray, ($page - 1) * $itemsPerPage, $itemsPerPage); + $this->theArray = array_slice($theArray, ($page - 1) * $itemsPerPage, $itemsPerPage, true); $this->page = $page; } else { $this->theArray = & $theArray; @@ -59,8 +59,8 @@ public function __construct(&$theArray, $page = -1, $itemsPerPage = -1) /** * Static method: Generate an iterator from an array and rangeInfo object. * - * @param $theArray array - * @param $theRange object + * @param array $theArray + * @param object $theRange */ public function &fromRangeInfo(&$theArray, &$theRange) { @@ -105,7 +105,7 @@ public function nextWithKey() /** * Determine whether or not this iterator represents the first page * - * @return boolean + * @return bool */ public function atFirstPage() { @@ -115,7 +115,7 @@ public function atFirstPage() /** * Determine whether or not this iterator represents the last page * - * @return boolean + * @return bool */ public function atLastPage() { @@ -155,7 +155,7 @@ public function getPageCount() /** * Return a boolean indicating whether or not we've reached the end of results * - * @return boolean + * @return bool */ public function eof() { @@ -165,7 +165,7 @@ public function eof() /** * Return a boolean indicating whether or not this iterator was empty from the beginning * - * @return boolean + * @return bool */ public function wasEmpty() { @@ -189,31 +189,6 @@ public function toAssociativeArray() { return $this->theArray; } - - /** - * A version of array_slice that takes keys into account. - * Thanks to pies at sputnik dot pl. - * This is made redundant by PHP 5.0.2's updated - * array_slice, but we can't assume everyone has that. - * FIXME: Reconcile this against the dupe in VirtualArrayIterator. - * - * @see http://ca3.php.net/manual/en/function.array-slice.php - */ - public function array_slice_key($array, $offset, $len = -1) - { - if (!is_array($array)) { - return false; - } - - $return = []; - $length = $len >= 0 ? $len : count($array); - $keys = array_slice(array_keys($array), $offset, $length); - foreach ($keys as $key) { - $return[$key] = $array[$key]; - } - - return $return; - } } if (!PKP_STRICT_MODE) { diff --git a/classes/core/Core.inc.php b/classes/core/Core.inc.php index 319f43bfb70..51567c5fde0 100644 --- a/classes/core/Core.inc.php +++ b/classes/core/Core.inc.php @@ -56,7 +56,7 @@ public static function getBaseDir() * Sanitize a value to be used in a file path. * Removes any characters except alphanumeric characters, underscores, and dashes. * - * @param $var string + * @param string $var * * @return string */ @@ -68,7 +68,7 @@ public static function cleanFileVar($var) /** * Return the current date in ISO (YYYY-MM-DD HH:MM:SS) format. * - * @param $ts int optional, use specified timestamp instead of current time + * @param int $ts optional, use specified timestamp instead of current time * * @return string */ @@ -91,7 +91,7 @@ public static function microtime() /** * Check if the server platform is Windows. * - * @return boolean + * @return bool */ public static function isWindows() { @@ -101,9 +101,9 @@ public static function isWindows() /** * Checks to see if a PHP module is enabled. * - * @param $moduleName string + * @param string $moduleName * - * @return boolean + * @return bool */ public static function checkGeneralPHPModule($moduleName) { @@ -116,11 +116,11 @@ public static function checkGeneralPHPModule($moduleName) /** * Check the passed user agent for a bot. * - * @param $userAgent string - * @param $botRegexpsFile string An alternative file with regular + * @param string $userAgent + * @param string $botRegexpsFile An alternative file with regular * expressions to find bots inside user agent strings. * - * @return boolean + * @return bool */ public static function isUserAgentBot($userAgent, $botRegexpsFile = COUNTER_USER_AGENTS_FILE) { @@ -149,12 +149,12 @@ public static function isUserAgentBot($userAgent, $botRegexpsFile = COUNTER_USER * Get context paths present into the passed * url information. * - * @param $urlInfo string Full url or just path info. - * @param $isPathInfo boolean Whether the + * @param string $urlInfo Full url or just path info. + * @param bool $isPathInfo Whether the * passed url info string is a path info or not. - * @param $contextList array (optional) - * @param $contextDepth int (optional) - * @param $userVars array (optional) Pass GET variables + * @param array $contextList (optional) + * @param int $contextDepth (optional) + * @param array $userVars (optional) Pass GET variables * if needed (for testing only). * * @return array @@ -207,10 +207,10 @@ public static function getContextPaths($urlInfo, $isPathInfo, $contextList = nul * the passed url information. It expects that urls * were built using the system. * - * @param $urlInfo string Full url or just path info. - * @param $isPathInfo boolean Tell if the + * @param string $urlInfo Full url or just path info. + * @param bool $isPathInfo Tell if the * passed url info string is a path info or not. - * @param $userVars array (optional) Pass GET variables + * @param array $userVars (optional) Pass GET variables * if needed (for testing only). * * @return string @@ -226,10 +226,10 @@ public static function getPage($urlInfo, $isPathInfo, $userVars = []) * the passed url information. It expects that urls * were built using the system. * - * @param $urlInfo string Full url or just path info. - * @param $isPathInfo boolean Tell if the + * @param string $urlInfo Full url or just path info. + * @param bool $isPathInfo Tell if the * passed url info string is a path info or not. - * @param $userVars array (optional) Pass GET variables + * @param array $userVars (optional) Pass GET variables * if needed (for testing only). * * @return string @@ -246,10 +246,10 @@ public static function getOp($urlInfo, $isPathInfo, $userVars = []) * only arguments appended to the URL separated by "/"). * It expects that urls were built using the system. * - * @param $urlInfo string Full url or just path info. - * @param $isPathInfo boolean Tell if the + * @param string $urlInfo Full url or just path info. + * @param bool $isPathInfo Tell if the * passed url info string is a path info or not. - * @param $userVars array (optional) Pass GET variables + * @param array $userVars (optional) Pass GET variables * if needed (for testing only). * * @return array @@ -264,12 +264,12 @@ public static function getArgs($urlInfo, $isPathInfo, $userVars = []) * Also, if true, checks for the context path in * url and if it's missing, tries to add it. * - * @param $url string + * @param string $url * * @return string|bool The url without base url, * false if it was not possible to remove it. */ - public function removeBaseUrl($url) + public static function removeBaseUrl($url) { [$baseUrl, $contextPath] = Core::_getBaseUrlAndPath($url); @@ -323,11 +323,11 @@ public function removeBaseUrl($url) * is set to use base url override, context * path for the passed url. * - * @param $url string + * @param string $url * * @return array With two elements, base url and context path. */ - protected function _getBaseUrlAndPath($url) + protected static function _getBaseUrlAndPath($url) { $baseUrl = false; $contextPath = false; @@ -398,14 +398,14 @@ protected function _getBaseUrlAndPath($url) * full url (host plus path) or just the path, * but they have to be consistent. * - * @param $baseUrl string Full base url + * @param string $baseUrl Full base url * or just it's path info. - * @param $url string Full url or just it's + * @param string $url Full url or just it's * path info. * - * @return boolean + * @return bool */ - protected function _checkBaseUrl($baseUrl, $url) + protected static function _checkBaseUrl($baseUrl, $url) { // Check if both base url and url have host // component or not. @@ -450,7 +450,7 @@ protected function _checkBaseUrl($baseUrl, $url) * Bot list file cache miss fallback. * (WARNING: This function appears to be used externally, hence public despite _ prefix.) * - * @param $cache FileCache + * @param FileCache $cache * * @return array */ @@ -483,9 +483,9 @@ function ($regexp) { /** * Get passed variable value inside the passed url. * - * @param $url string - * @param $varName string - * @param $userVars array + * @param string $url + * @param string $varName + * @param array $userVars * * @return string|null */ @@ -511,11 +511,11 @@ private static function _getUserVar($url, $varName, $userVars = []) * Get url components (page, operation and args) * based on the passed offset. * - * @param $urlInfo string - * @param $isPathInfo string - * @param $offset int - * @param $varName string - * @param $userVars array (optional) GET variables + * @param string $urlInfo + * @param string $isPathInfo + * @param int $offset + * @param string $varName + * @param array $userVars (optional) GET variables * (only for testing). * * @return mixed array|string|null @@ -558,7 +558,7 @@ private static function _getUrlComponents($urlInfo, $isPathInfo, $offset, $varNa /** * Extract the class name from the given file path. * - * @param SplFileInfo $file info about a file extract class name from + * @param SplFileInfo $file info about a file extract class name from * @return string fully qualified class name * @see Finder */ diff --git a/classes/core/DataObject.inc.php b/classes/core/DataObject.inc.php index f79d385905e..aa081a3d987 100644 --- a/classes/core/DataObject.inc.php +++ b/classes/core/DataObject.inc.php @@ -24,19 +24,19 @@ class DataObject /** @var array Array of object data */ public $_data = []; - /** @var boolean whether this objects loads meta-data adapters from the database */ + /** @var bool whether this objects loads meta-data adapters from the database */ public $_hasLoadableAdapters = false; /** @var array an array of meta-data extraction adapters (one per supported schema) */ public $_metadataExtractionAdapters = []; - /** @var boolean whether extraction adapters have already been loaded from the database */ + /** @var bool whether extraction adapters have already been loaded from the database */ public $_extractionAdaptersLoaded = false; /** @var array an array of meta-data injection adapters (one per supported schema) */ public $_metadataInjectionAdapters = []; - /** @var boolean whether injection adapters have already been loaded from the database */ + /** @var bool whether injection adapters have already been loaded from the database */ public $_injectionAdaptersLoaded = false; /** @@ -54,8 +54,8 @@ public function __construct() * Get a piece of data for this object, localized to the current * locale if possible. * - * @param $key string - * @param $preferredLocale string + * @param string $key + * @param string $preferredLocale */ public function getLocalizedData($key, $preferredLocale = null) { @@ -71,7 +71,6 @@ public function getLocalizedData($key, $preferredLocale = null) // Fallback: Get the first available piece of data. $data = & $this->getData($key, null); if (!empty($data)) { - // WARNING: Collapsing the following into a single line causes PHP 5.0.5 to die. $locales = array_keys($data); $firstLocale = array_shift($locales); return $data[$firstLocale]; @@ -86,8 +85,8 @@ public function getLocalizedData($key, $preferredLocale = null) /** * Get the value of a data variable. * - * @param $key string - * @param $locale string (optional) + * @param string $key + * @param string $locale (optional) */ public function &getData($key, $locale = null) { @@ -95,11 +94,8 @@ public function &getData($key, $locale = null) if (array_key_exists($key, $this->_data)) { return $this->_data[$key]; } - } else { - // see http://bugs.php.net/bug.php?id=29848 - if (array_key_exists($key, $this->_data) && is_array($this->_data[$key]) && array_key_exists($locale, $this->_data[$key])) { - return $this->_data[$key][$locale]; - } + } else if (array_key_exists($locale, (array) ($this->_data[$key] ?? []))) { + return $this->_data[$key][$locale]; } $nullVar = null; return $nullVar; @@ -108,15 +104,15 @@ public function &getData($key, $locale = null) /** * Set the value of a new or existing data variable. * - * @param $key string - * @param $value mixed can be either a single value or + * @param string $key + * @param mixed $value can be either a single value or * an array of of localized values in the form: * array( * 'fr_FR' => 'en français', * 'en_US' => 'in English', * ... * ) - * @param $locale string (optional) non-null for a single + * @param string $locale (optional) non-null for a single * localized value. Null for a non-localized value or * when setting all locales at once (see comment for * $value parameter) @@ -124,24 +120,23 @@ public function &getData($key, $locale = null) public function setData($key, $value, $locale = null) { if (is_null($locale)) { - // This is either a non-localized value or we're - // passing in all locales at once. + // This is either a non-localized value or we're passing in all locales at once. $this->_data[$key] = $value; - } else { - // Set a single localized value. - if (is_null($value)) { - // see http://bugs.php.net/bug.php?id=29848 - if (array_key_exists($key, $this->_data)) { - if (is_array($this->_data[$key]) && array_key_exists($locale, $this->_data[$key])) { - unset($this->_data[$key][$locale]); - } - // Was this the last entry for the data variable? - if (empty($this->_data[$key])) { - unset($this->_data[$key]); - } - } - } else { - $this->_data[$key][$locale] = $value; + return; + } + // Set a single localized value. + if (!is_null($value)) { + $this->_data[$key][$locale] = $value; + return; + } + // If the value is null, remove the entry. + if (array_key_exists($key, $this->_data)) { + if (array_key_exists($locale, (array) $this->_data[$key])) { + unset($this->_data[$key][$locale]); + } + // Was this the last entry for the data variable? + if (empty($this->_data[$key])) { + unset($this->_data[$key]); } } } @@ -149,8 +144,8 @@ public function setData($key, $value, $locale = null) /** * Unset an element of the data object. * - * @param $key string - * @param $locale string (optional) non-null for a single + * @param string $key + * @param string $locale (optional) non-null for a single * localized value. Null for a non-localized value or * when unsetting all locales at once. */ @@ -166,19 +161,14 @@ public function unsetData($key, $locale = null) /** * Check whether a value exists for a given data variable. * - * @param $key string - * @param $locale string (optional) + * @param string $key + * @param string $locale (optional) * - * @return boolean + * @return bool */ public function hasData($key, $locale = null) { - if (is_null($locale)) { - return array_key_exists($key, $this->_data); - } else { - // see http://bugs.php.net/bug.php?id=29848 - return array_key_exists($key, $this->_data) && is_array($this->_data[$key]) && array_key_exists($locale, $this->_data[$key]); - } + return is_null($locale) ? array_key_exists($key, $this->_data) : array_key_exists($locale, (array) ($this->_data[$key] ?? [])); } /** @@ -194,7 +184,7 @@ public function &getAllData() /** * Set all data variables at once. * - * @param $data array + * @param array $data */ public function setAllData($data) { @@ -214,7 +204,7 @@ public function getId() /** * Set ID of object. * - * @param $id int + * @param int $id */ public function setId($id) { @@ -238,7 +228,7 @@ public function setId($id) * Note: Data in the target object will be overwritten. We do not * clone the target object before we upcast. * - * @param $targetObject \PKP\core\DataObject The object to cast to. + * @param \PKP\core\DataObject $targetObject The object to cast to. * * @return \PKP\core\DataObject The upcast target object. */ @@ -258,7 +248,7 @@ public function upcastTo($targetObject) /** * Set whether the object has loadable meta-data adapters * - * @param $hasLoadableAdapters boolean + * @param bool $hasLoadableAdapters */ public function setHasLoadableAdapters($hasLoadableAdapters) { @@ -268,7 +258,7 @@ public function setHasLoadableAdapters($hasLoadableAdapters) /** * Get whether the object has loadable meta-data adapters * - * @return boolean + * @return bool */ public function getHasLoadableAdapters() { @@ -280,7 +270,7 @@ public function getHasLoadableAdapters() * by this application entity. Only one adapter per schema * can be added. * - * @param $metadataAdapter MetadataDataObjectAdapter + * @param MetadataDataObjectAdapter $metadataAdapter */ public function addSupportedMetadataAdapter($metadataAdapter) { @@ -313,9 +303,9 @@ public function addSupportedMetadataAdapter($metadataAdapter) * Remove all adapters for the given meta-data schema * (if it exists). * - * @param $metadataSchemaName string fully qualified class name + * @param string $metadataSchemaName fully qualified class name * - * @return boolean true if an adapter was removed, otherwise false. + * @return bool true if an adapter was removed, otherwise false. */ public function removeSupportedMetadataAdapter($metadataSchemaName) { @@ -395,7 +385,7 @@ public function getSupportedMetadataSchemas() * Retrieve the names of meta-data * properties of this data object. * - * @param $translated boolean if true, return localized field + * @param bool $translated if true, return localized field * names, otherwise return additional field names. */ public function getMetadataFieldNames($translated = true) @@ -418,7 +408,7 @@ public function getMetadataFieldNames($translated = true) * properties that need to be persisted * (i.e. that have data). * - * @param $translated boolean if true, return localized field + * @param bool $translated if true, return localized field * names, otherwise return additional field names. * * @return array an array of field names @@ -464,9 +454,9 @@ public function getAdditionalMetadataFieldNames() * Inject a meta-data description into this * data object. * - * @param $metadataDescription MetadataDescription + * @param MetadataDescription $metadataDescription * - * @return boolean true on success, otherwise false + * @return bool true on success, otherwise false */ public function injectMetadata($metadataDescription) { @@ -494,7 +484,7 @@ public function injectMetadata($metadataDescription) * Extract a meta-data description from this * data object. * - * @param $metadataSchema MetadataSchema + * @param MetadataSchema $metadataSchema * * @return $metadataDescription MetadataDescription */ diff --git a/classes/core/Dispatcher.inc.php b/classes/core/Dispatcher.inc.php index 8ab90b1e037..433887ac1ef 100644 --- a/classes/core/Dispatcher.inc.php +++ b/classes/core/Dispatcher.inc.php @@ -53,7 +53,7 @@ public function &getApplication() /** * Set the application * - * @param $application PKPApplication + * @param PKPApplication $application */ public function setApplication($application) { @@ -82,12 +82,12 @@ public function &getRouterNames() * NB: Routers must be part of the core package * to be accepted by this dispatcher implementation. * - * @param $routerName string a class name of a router + * @param string $routerName a class name of a router * to be given the chance to route the request. * NB: These are class names and not instantiated objects. We'll * use lazy instantiation to reduce the performance/memory impact * to a minimum. - * @param $shortcut string a shortcut name for the router + * @param string $shortcut a shortcut name for the router * to be used for quick router instance retrieval. */ public function addRouterName($routerName, $shortcut) @@ -101,7 +101,7 @@ public function addRouterName($routerName, $shortcut) * let the router dispatch the request to the appropriate * handler method. * - * @param $request PKPRequest + * @param PKPRequest $request */ public function dispatch($request) { @@ -141,7 +141,7 @@ public function dispatch($request) $this->_requestCallbackHack = & $request; if (Config::getVar('cache', 'web_cache')) { if ($this->_displayCached($router, $request)) { - exit(); + exit; } // Success ob_start([$this, '_cacheContent']); } @@ -169,15 +169,15 @@ public function dispatch($request) /** * Build a handler request URL into PKPApplication. * - * @param $request PKPRequest the request to be routed - * @param $shortcut string the short name of the router that should be used to construct the URL - * @param $newContext mixed Optional contextual paths - * @param $handler string Optional name of the handler to invoke - * @param $op string Optional name of operation to invoke - * @param $path mixed Optional string or array of args to pass to handler - * @param $params array Optional set of name => value pairs to pass as user parameters - * @param $anchor string Optional name of anchor to add to URL - * @param $escape boolean Whether or not to escape ampersands for this URL; default false. + * @param PKPRequest $request the request to be routed + * @param string $shortcut the short name of the router that should be used to construct the URL + * @param mixed $newContext Optional contextual paths + * @param string $handler Optional name of the handler to invoke + * @param string $op Optional name of operation to invoke + * @param mixed $path Optional string or array of args to pass to handler + * @param array $params Optional set of name => value pairs to pass as user parameters + * @param string $anchor Optional name of anchor to add to URL + * @param bool $escape Whether or not to escape ampersands for this URL; default false. * * @return string the URL */ @@ -207,8 +207,8 @@ public function url( /** * Instantiate a router * - * @param $routerName string - * @param $shortcut string + * @param string $routerName + * @param string $shortcut */ public function &_instantiateRouter($routerName, $shortcut) { @@ -231,7 +231,7 @@ public function &_instantiateRouter($routerName, $shortcut) /** * Display the request contents from cache. * - * @param $router PKPRouter + * @param PKPRouter $router */ public function _displayCached($router, $request) { @@ -244,7 +244,7 @@ public function _displayCached($router, $request) $ifModifiedSince = $request->getIfModifiedSince(); if ($ifModifiedSince !== null && $ifModifiedSince >= filemtime($filename)) { header('HTTP/1.1 304 Not Modified'); - exit(); + exit; } $fp = fopen($filename, 'r'); @@ -268,7 +268,7 @@ public function _displayCached($router, $request) /** * Cache content as a local file. * - * @param $contents string + * @param string $contents * * @return string */ diff --git a/classes/core/EntityDAO.inc.php b/classes/core/EntityDAO.inc.php index 2629bc0beca..136bbbee1ac 100644 --- a/classes/core/EntityDAO.inc.php +++ b/classes/core/EntityDAO.inc.php @@ -16,7 +16,6 @@ use Illuminate\Support\Facades\DB; use PKP\db\DAO; use PKP\services\PKPSchemaService; -use stdClass; abstract class EntityDAO { @@ -98,7 +97,7 @@ public function get(int $id): ?DataObject /** * Convert a row from the database query into a DataObject */ - public function fromRow(stdClass $row): DataObject + public function fromRow(object $row): DataObject { $schema = $this->schemaService->get($this->schema); @@ -113,22 +112,24 @@ public function fromRow(stdClass $row): DataObject } } - $rows = DB::table($this->settingsTable) - ->where($this->primaryKeyColumn, '=', $row->{$this->primaryKeyColumn}) - ->get(); - - $rows->each(function ($row) use ($object, $schema) { - if (!empty($schema->properties->{$row->setting_name})) { - $object->setData( - $row->setting_name, - $this->convertFromDB( - $row->setting_value, - $schema->properties->{$row->setting_name}->type - ), - empty($row->locale) ? null : $row->locale - ); - } - }); + if ($this->settingsTable) { + $rows = DB::table($this->settingsTable) + ->where($this->primaryKeyColumn, '=', $row->{$this->primaryKeyColumn}) + ->get(); + + $rows->each(function ($row) use ($object, $schema) { + if (!empty($schema->properties->{$row->setting_name})) { + $object->setData( + $row->setting_name, + $this->convertFromDB( + $row->setting_value, + $schema->properties->{$row->setting_name}->type + ), + empty($row->locale) ? null : $row->locale + ); + } + }); + } return $object; } @@ -152,7 +153,7 @@ protected function _insert(DataObject $object): int $object->setId((int) DB::getPdo()->lastInsertId()); // Add additional properties to settings table if they exist - if (count($sanitizedProps) !== count($primaryDbProps)) { + if ($this->settingsTable && count($sanitizedProps) !== count($primaryDbProps)) { foreach ($schema->properties as $propName => $propSchema) { if (!isset($sanitizedProps[$propName]) || array_key_exists($propName, $this->primaryTableColumns)) { continue; @@ -194,57 +195,59 @@ protected function _update(DataObject $object) ->where($this->primaryKeyColumn, '=', $object->getId()) ->update($primaryDbProps); - $deleteSettings = []; - foreach ($schema->properties as $propName => $propSchema) { - if (array_key_exists($propName, $this->primaryTableColumns)) { - continue; - } elseif (!isset($sanitizedProps[$propName])) { - $deleteSettings[] = $propName; - continue; - } - if (!empty($propSchema->multilingual)) { - foreach ($sanitizedProps[$propName] as $localeKey => $localeValue) { - // Delete rows with a null value - if (is_null($localeValue)) { - DB::table($this->settingsTable) - ->where($this->primaryKeyColumn, '=', $object->getId()) - ->where('setting_name', '=', $propName) - ->where('locale', '=', $localeKey) - ->delete(); - } else { - DB::table($this->settingsTable) - ->updateOrInsert( - [ - $this->primaryKeyColumn => $object->getId(), - 'locale' => $localeKey, - 'setting_name' => $propName, - ], - [ - 'setting_value' => $this->convertToDB($localeValue, $schema->properties->{$propName}->type), - ] - ); + if ($this->settingsTable) { + $deleteSettings = []; + foreach ($schema->properties as $propName => $propSchema) { + if (array_key_exists($propName, $this->primaryTableColumns)) { + continue; + } elseif (!isset($sanitizedProps[$propName])) { + $deleteSettings[] = $propName; + continue; + } + if (!empty($propSchema->multilingual)) { + foreach ($sanitizedProps[$propName] as $localeKey => $localeValue) { + // Delete rows with a null value + if (is_null($localeValue)) { + DB::table($this->settingsTable) + ->where($this->primaryKeyColumn, '=', $object->getId()) + ->where('setting_name', '=', $propName) + ->where('locale', '=', $localeKey) + ->delete(); + } else { + DB::table($this->settingsTable) + ->updateOrInsert( + [ + $this->primaryKeyColumn => $object->getId(), + 'locale' => $localeKey, + 'setting_name' => $propName, + ], + [ + 'setting_value' => $this->convertToDB($localeValue, $schema->properties->{$propName}->type), + ] + ); + } } + } else { + DB::table($this->settingsTable) + ->updateOrInsert( + [ + $this->primaryKeyColumn => $object->getId(), + 'locale' => '', + 'setting_name' => $propName, + ], + [ + 'setting_value' => $this->convertToDB($sanitizedProps[$propName], $schema->properties->{$propName}->type), + ] + ); } - } else { - DB::table($this->settingsTable) - ->updateOrInsert( - [ - $this->primaryKeyColumn => $object->getId(), - 'locale' => '', - 'setting_name' => $propName, - ], - [ - 'setting_value' => $this->convertToDB($sanitizedProps[$propName], $schema->properties->{$propName}->type), - ] - ); } - } - if (count($deleteSettings)) { - DB::table($this->settingsTable) - ->where($this->primaryKeyColumn, '=', $object->getId()) - ->whereIn('setting_name', $deleteSettings) - ->delete(); + if (count($deleteSettings)) { + DB::table($this->settingsTable) + ->where($this->primaryKeyColumn, '=', $object->getId()) + ->whereIn('setting_name', $deleteSettings) + ->delete(); + } } } @@ -261,9 +264,11 @@ protected function _delete(DataObject $object) */ public function deleteById(int $id) { - DB::table($this->settingsTable) - ->where($this->primaryKeyColumn, '=', $id) - ->delete(); + if ($this->settingsTable) { + DB::table($this->settingsTable) + ->where($this->primaryKeyColumn, '=', $id) + ->delete(); + } DB::table($this->table) ->where($this->primaryKeyColumn, '=', $id) ->delete(); diff --git a/classes/core/ItemIterator.inc.php b/classes/core/ItemIterator.inc.php index 8ae514766db..80ae0e8c009 100644 --- a/classes/core/ItemIterator.inc.php +++ b/classes/core/ItemIterator.inc.php @@ -48,7 +48,7 @@ public function nextWithKey() /** * Determine whether this iterator represents the first page of a set. * - * @return boolean + * @return bool */ public function atFirstPage() { @@ -58,7 +58,7 @@ public function atFirstPage() /** * Determine whether this iterator represents the last page of a set. * - * @return boolean + * @return bool */ public function atLastPage() { @@ -98,7 +98,7 @@ public function getPageCount() /** * Return a boolean indicating whether or not we've reached the end of results * - * @return boolean + * @return bool */ public function eof() { @@ -108,7 +108,7 @@ public function eof() /** * Return a boolean indicating whether or not this iterator was empty from the beginning * - * @return boolean + * @return bool */ public function wasEmpty() { diff --git a/classes/core/JSONMessage.inc.php b/classes/core/JSONMessage.inc.php index e01cb7314b8..5c22b8f958f 100644 --- a/classes/core/JSONMessage.inc.php +++ b/classes/core/JSONMessage.inc.php @@ -36,10 +36,10 @@ class JSONMessage /** * Constructor. * - * @param $status boolean The status of an event (e.g. false if form validation fails). - * @param $content Mixed The message to be delivered back to the calling script. - * @param $elementId string The DOM element to be replaced. - * @param $additionalAttributes array Additional data to be returned. + * @param bool $status The status of an event (e.g. false if form validation fails). + * @param Mixed $content The message to be delivered back to the calling script. + * @param string $elementId The DOM element to be replaced. + * @param array $additionalAttributes Additional data to be returned. */ public function __construct($status = true, $content = '', $elementId = '0', $additionalAttributes = null) { @@ -65,7 +65,7 @@ public function getStatus() /** * Set the status string * - * @param $status string + * @param string $status */ public function setStatus($status) { @@ -84,7 +84,6 @@ public function getContent() /** * Set the content data * - * @param $content mixed */ public function setContent($content) { @@ -104,7 +103,7 @@ public function getElementId() /** * Set the elementId string * - * @param $elementId string + * @param string $elementId */ public function setElementId($elementId) { @@ -115,8 +114,7 @@ public function setElementId($elementId) /** * Set the event to trigger with this JSON message * - * @param $eventName string - * @param $eventData mixed + * @param string $eventName */ public function setEvent($eventName, $eventData = null) { @@ -140,8 +138,8 @@ public function setEvent($eventName, $eventData = null) * triggered directly on the handler. They are intended for broadcasting * updates from one handler to other handlers. * - * @param $eventName string - * @param $eventData array Global event data must be an assoc array + * @param string $eventName + * @param array $eventData Global event data must be an assoc array */ public function setGlobalEvent($eventName, $eventData = []) { @@ -173,7 +171,7 @@ public function getAdditionalAttributes() /** * Set the additionalAttributes array * - * @param $additionalAttributes array + * @param array $additionalAttributes */ public function setAdditionalAttributes($additionalAttributes) { diff --git a/classes/core/MailServiceProvider.inc.php b/classes/core/MailServiceProvider.inc.php index 8e709e21a0b..1837de7d051 100644 --- a/classes/core/MailServiceProvider.inc.php +++ b/classes/core/MailServiceProvider.inc.php @@ -25,7 +25,6 @@ class MailServiceProvider extends IlluminateMailService { /** * Register mailer excluding markdown renderer - * @return void */ public function register() : void { @@ -42,7 +41,9 @@ public function registerIlluminateMailer() : void { /** * @see MailManager::resolve() - * @param string $name + * + * @param string $name + * * @throws InvalidArgumentException */ protected function resolve($name) : Mailer diff --git a/classes/core/MapContainer.inc.php b/classes/core/MapContainer.inc.php index 919c1d90515..6f8422e30ae 100644 --- a/classes/core/MapContainer.inc.php +++ b/classes/core/MapContainer.inc.php @@ -16,7 +16,6 @@ namespace PKP\core; -use Illuminate\Support\Facades\App; use PKP\core\maps\Base; class MapContainer @@ -34,9 +33,7 @@ public function extend(string $map, callable $callback) public function getMap(string $class, array $dependencies = []): Base { - return empty($dependencies) - ? App::make($class) - : App::makeWith($class, $dependencies); + return app($class, $dependencies); } public function withExtensions(string $class, array $dependencies = []): Base diff --git a/classes/core/PKPApplication.inc.php b/classes/core/PKPApplication.inc.php index 009d6603a0b..e5f84bcef9e 100644 --- a/classes/core/PKPApplication.inc.php +++ b/classes/core/PKPApplication.inc.php @@ -122,6 +122,7 @@ abstract class PKPApplication implements iPKPApplicationInfoProvider public const ASSOC_TYPE_PUBLICATION = 0x010000c; public const ASSOC_TYPE_ACCESSIBLE_FILE_STAGES = 0x010000d; public const ASSOC_TYPE_NONE = 0x010000e; + public const ASSOC_TYPE_DECISION_TYPE = 0x010000f; // Constant used in UsageStats for submission files that are not full texts public const ASSOC_TYPE_SUBMISSION_FILE_COUNTER_OTHER = 0x0000213; @@ -368,7 +369,7 @@ abstract public function getContextDepth(); * i.e. the various parameters that are needed to represent the * (e.g. array('journal') or array('conference', 'schedConf')) * - * @return Array + * @return array */ abstract public function getContextList(); @@ -385,8 +386,8 @@ abstract public function getVersionDescriptorUrl(); * from the database and caches the result for further * access. * - * @param $category string - * @param $mainContextId integer Optional ID of the top-level context + * @param string $category + * @param int $mainContextId Optional ID of the top-level context * (e.g. Journal, Conference, Press) to query for enabled products * * @return array @@ -466,7 +467,6 @@ public function getDAOMap() 'ControlledVocabEntryDAO' => 'PKP\controlledVocab\ControlledVocabEntryDAO', 'DataObjectTombstoneDAO' => 'PKP\tombstone\DataObjectTombstoneDAO', 'DataObjectTombstoneSettingsDAO' => 'PKP\tombstone\DataObjectTombstoneSettingsDAO', - 'EditDecisionDAO' => 'PKP\submission\EditDecisionDAO', 'FilterDAO' => 'PKP\filter\FilterDAO', 'FilterGroupDAO' => 'PKP\filter\FilterGroupDAO', 'GenreDAO' => 'PKP\submission\GenreDAO', @@ -527,7 +527,7 @@ public function getDAOMap() * Return the fully-qualified (e.g. page.name.ClassNameDAO) name of the * given DAO. * - * @param $name string + * @param string $name * * @return string */ @@ -614,13 +614,13 @@ public function getDefaultMetricType() * @see * for a full specification of the input and output format of this method. * - * @param $metricType null|string|array metrics selection + * @param null|string|array $metricType metrics selection * NB: If you want to use the default metric on journal level then you must * set $metricType = null and add an explicit filter on a single journal ID. * Otherwise the default site-level metric will be used. - * @param $columns string|array column (aggregation level) selection - * @param $orderBy array order criteria - * @param $range null|DBResultRange paging specification + * @param string|array $columns column (aggregation level) selection + * @param array $orderBy order criteria + * @param null|DBResultRange $range paging specification * * @return null|array The selected data as a simple tabular result set or * null if the given parameter combination is not supported. @@ -710,8 +710,8 @@ public function getMetrics($metricType = null, $columns = [], $filter = [], $ord * Return metric in the primary metric type * for the passed associated object. * - * @param $assocType int - * @param $assocId int + * @param int $assocType + * @param int $assocId * * @return int */ @@ -760,8 +760,8 @@ public static function getCCLicenseOptions() * Get the Creative Commons license badge associated with a given * license URL. * - * @param $ccLicenseURL URL to creative commons license - * @param $locale string Optional locale to return badge in + * @param string $ccLicenseURL URL to creative commons license + * @param string $locale Optional locale to return badge in * * @return string HTML code for CC license */ @@ -797,7 +797,7 @@ public function getCCLicenseBadge($ccLicenseURL, $locale = null) /** * Get a mapping of role keys and i18n key names. * - * @param boolean $contextOnly If false, also returns site-level roles (Site admin) + * @param bool $contextOnly If false, also returns site-level roles (Site admin) * @param array|null $roleIds Only return role names of these IDs * * @return array diff --git a/classes/core/PKPComponentRouter.inc.php b/classes/core/PKPComponentRouter.inc.php index b32fcc33fc1..0fea3a255dc 100644 --- a/classes/core/PKPComponentRouter.inc.php +++ b/classes/core/PKPComponentRouter.inc.php @@ -61,8 +61,6 @@ define('COMPONENT_ROUTER_PARTS_MAXLENGTH', 50); define('COMPONENT_ROUTER_PARTS_MINLENGTH', 2); -use APP\core\Request; - use APP\i18n\AppLocale; use Exception; @@ -89,9 +87,9 @@ class PKPComponentRouter extends PKPRouter /** * Determines whether this router can route the given request. * - * @param $request PKPRequest + * @param PKPRequest $request * - * @return boolean true, if the router supports this request, otherwise false + * @return bool true, if the router supports this request, otherwise false */ public function supports($request) { @@ -109,7 +107,7 @@ public function supports($request) * NB: This can be a component that not actually exists * in the code base. * - * @param $request PKPRequest + * @param PKPRequest $request * * @return string the requested component or an empty string * if none can be found. @@ -129,12 +127,12 @@ public function getRequestedComponent($request) array_pop($rpcServiceEndpointParts); // Construct the fully qualified component class name from the rest of it. - $handlerClassName = PKPString::camelize(array_pop($rpcServiceEndpointParts), CAMEL_CASE_HEAD_UP) . 'Handler'; + $handlerClassName = PKPString::camelize(array_pop($rpcServiceEndpointParts), PKPString::CAMEL_CASE_HEAD_UP) . 'Handler'; // camelize remaining endpoint parts $camelizedRpcServiceEndpointParts = []; foreach ($rpcServiceEndpointParts as $part) { - $camelizedRpcServiceEndpointParts[] = PKPString::camelize($part, CAMEL_CASE_HEAD_DOWN); + $camelizedRpcServiceEndpointParts[] = PKPString::camelize($part, PKPString::CAMEL_CASE_HEAD_DOWN); } $handlerPackage = implode('.', $camelizedRpcServiceEndpointParts); @@ -150,7 +148,7 @@ public function getRequestedComponent($request) * NB: This can be an operation that not actually * exists in the requested component. * - * @param $request PKPRequest + * @param PKPRequest $request * * @return string the requested operation or an empty string * if none can be found. @@ -167,7 +165,7 @@ public function getRequestedOp($request) } // Pop off the operation part - $this->_op = PKPString::camelize(array_pop($rpcServiceEndpointParts), CAMEL_CASE_HEAD_DOWN); + $this->_op = PKPString::camelize(array_pop($rpcServiceEndpointParts), PKPString::CAMEL_CASE_HEAD_DOWN); } return $this->_op; @@ -178,7 +176,7 @@ public function getRequestedOp($request) * If no such RPC service endpoint can be constructed then the method * returns null. * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed * * @return callable an array with the handler instance * and the handler operation to be called by call_user_func(). @@ -430,7 +428,7 @@ public function handleAuthorizationFailure( * If no such RPC service endpoint parts can be retrieved * then the method returns null. * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed * * @return array a string array with the RPC service endpoint * parts as values. @@ -466,7 +464,7 @@ public function _getValidatedServiceEndpointParts($request) * endpoint parts from the request. See the classdoc for the * URL patterns supported here. * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed * * @return array an array of (non-validated) service endpoint * parts or null if the request is not an RPC request. @@ -522,7 +520,7 @@ public function _retrieveServiceEndpointParts($request) * we try to convert them to a file/method name. This also * converts all parts to lower case. * - * @param $rpcServiceEndpointParts array + * @param array $rpcServiceEndpointParts * * @return array the validated service endpoint parts or null if validation * does not succeed. diff --git a/classes/core/PKPPageRouter.inc.php b/classes/core/PKPPageRouter.inc.php index 898c4bdfe9b..229cd19dc5b 100644 --- a/classes/core/PKPPageRouter.inc.php +++ b/classes/core/PKPPageRouter.inc.php @@ -71,11 +71,11 @@ public function getCacheablePages() /** * Determine whether or not the request is cacheable. * - * @param $request PKPRequest - * @param $testOnly boolean required for unit test to + * @param PKPRequest $request + * @param bool $testOnly required for unit test to * bypass session check. * - * @return boolean + * @return bool */ public function isCacheable($request, $testOnly = false) { @@ -111,9 +111,9 @@ public function isCacheable($request, $testOnly = false) /** * Get the page requested in the URL. * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed * - * @return String the page path (under the "pages" directory) + * @return string the page path (under the "pages" directory) */ public function getRequestedPage($request) { @@ -126,7 +126,7 @@ public function getRequestedPage($request) /** * Get the operation requested in the URL (assumed to exist in the requested page handler). * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed * * @return string */ @@ -141,7 +141,7 @@ public function getRequestedOp($request) /** * Get the arguments requested in the URL. * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed * * @return array */ @@ -480,7 +480,7 @@ public function handleAuthorizationFailure( /** * Redirect to user home page (or the user group home page if the user has one user group). * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed */ public function redirectHome($request) { @@ -490,7 +490,7 @@ public function redirectHome($request) /** * Get the user's "home" page URL (e.g. where they are sent after login). * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed */ public function getHomeUrl($request) { @@ -538,9 +538,9 @@ public function getHomeUrl($request) * Retrieve part of the current requested * url using the passed callback method. * - * @param $callback array Core method to retrieve + * @param array $callback Core method to retrieve * page, operation or arguments from url. - * @param $request PKPRequest + * @param PKPRequest $request * * @return array|string|null */ diff --git a/classes/core/PKPRequest.inc.php b/classes/core/PKPRequest.inc.php index 0f017de324f..e3e4d2d2829 100644 --- a/classes/core/PKPRequest.inc.php +++ b/classes/core/PKPRequest.inc.php @@ -17,9 +17,12 @@ use APP\facades\Repo; use PKP\config\Config; +use PKP\context\Context; use PKP\db\DAORegistry; use PKP\plugins\HookRegistry; use PKP\session\SessionManager; +use PKP\site\Site; +use PKP\user\User; class PKPRequest { @@ -41,10 +44,10 @@ class PKPRequest /** @var string request path */ public $_requestPath; - /** @var boolean true if restful URLs are enabled in the config */ + /** @var bool true if restful URLs are enabled in the config */ public $_isRestfulUrlsEnabled; - /** @var boolean true if path info is enabled for this server */ + /** @var bool true if path info is enabled for this server */ public $_isPathInfoEnabled; /** @var string server host */ @@ -53,7 +56,7 @@ class PKPRequest /** @var string request protocol */ public $_protocol; - /** @var boolean bot flag */ + /** @var bool bot flag */ public $_isBot; /** @var string user agent */ @@ -73,7 +76,7 @@ public function &getRouter() /** * set the router instance * - * @param $router instance PKPRouter + * @param PKPRouter $router */ public function setRouter($router) { @@ -83,7 +86,7 @@ public function setRouter($router) /** * Set the dispatcher * - * @param $dispatcher Dispatcher + * @param Dispatcher $dispatcher */ public function setDispatcher($dispatcher) { @@ -104,7 +107,7 @@ public function &getDispatcher() /** * Perform an HTTP redirect to an absolute or relative (to base system URL) URL. * - * @param $url string (exclude protocol for local redirects) + * @param string $url (exclude protocol for local redirects) */ public function redirectUrl($url) { @@ -113,13 +116,13 @@ public function redirectUrl($url) } header("Location: ${url}"); - exit(); + exit; } /** * Request an HTTP redirect via JSON to be used from components. * - * @param $url string + * @param string $url * * @return JSONMessage */ @@ -176,7 +179,7 @@ public function getIfModifiedSince() /** * Get the base URL of the request (excluding script). * - * @param $allowProtocolRelative boolean True iff protocol-relative URLs are allowed + * @param bool $allowProtocolRelative True iff protocol-relative URLs are allowed * * @return string */ @@ -374,8 +377,8 @@ public function getRequestPath() /** * Get the server hostname in the request. * - * @param $default string Default hostname (defaults to localhost) - * @param $includePort boolean Whether to include non-standard port number; default true + * @param string $default Default hostname (defaults to localhost) + * @param bool $includePort Whether to include non-standard port number; default true * * @return string */ @@ -428,7 +431,7 @@ public function getRequestMethod() /** * Determine whether the request is a POST request * - * @return boolean + * @return bool */ public function isPost() { @@ -438,7 +441,7 @@ public function isPost() /** * Determine whether the request is a GET request * - * @return boolean + * @return bool */ public function isGet() { @@ -448,7 +451,7 @@ public function isGet() /** * Determine whether a CSRF token is present and correct. * - * @return boolean + * @return bool */ public function checkCSRF() { @@ -525,7 +528,7 @@ public function getUserAgent() /** * Determine whether the user agent is a bot or not. * - * @return boolean + * @return bool */ public function isBot() { @@ -561,9 +564,8 @@ public function isRestfulUrlsEnabled() /** * Get site data. * - * @return Site */ - public function &getSite() + public function &getSite(): Site { $site = & Registry::get('site', true, null); if ($site === null) { @@ -667,13 +669,13 @@ public function &getUserVars() * Get the value of a GET/POST variable generated using the Smarty * html_select_date and/or html_select_time function. * - * @param $prefix string - * @param $defaultDay int - * @param $defaultMonth int - * @param $defaultYear int - * @param $defaultHour int - * @param $defaultMinute int - * @param $defaultSecond int + * @param string $prefix + * @param int $defaultDay + * @param int $defaultMonth + * @param int $defaultYear + * @param int $defaultHour + * @param int $defaultMinute + * @param int $defaultSecond * * @return Date */ @@ -738,9 +740,8 @@ public function getCookieVar($key) /** * Set a cookie variable. * - * @param $key string - * @param $value mixed - * @param $expire int (optional) + * @param string $key + * @param int $expire (optional) */ public function setCookieVar($key, $value, $expire = 0) { @@ -757,12 +758,12 @@ public function setCookieVar($key, $value, $expire = 0) * Redirect to the specified page within a PKP Application. * Shorthand for a common call to $request->redirect($dispatcher->url($request, PKPApplication::ROUTE_PAGE, ...)). * - * @param $context Array The optional contextual paths - * @param $page string The name of the op to redirect to. - * @param $op string optional The name of the op to redirect to. - * @param $path mixed string or array containing path info for redirect. - * @param $params array Map of name => value pairs for additional parameters - * @param $anchor string Name of desired anchor on the target page + * @param array $context The optional contextual paths + * @param string $page The name of the op to redirect to. + * @param string $op optional The name of the op to redirect to. + * @param mixed $path string or array containing path info for redirect. + * @param array $params Map of name => value pairs for additional parameters + * @param string $anchor Name of desired anchor on the target page */ public function redirect($context = null, $page = null, $op = null, $path = null, $params = null, $anchor = null) { @@ -773,11 +774,9 @@ public function redirect($context = null, $page = null, $op = null, $path = null /** * Get the current "context" (press/journal/etc) object. * - * @return Context - * * @see PKPPageRouter::getContext() */ - public function &getContext() + public function &getContext(): ?Context { return $this->_delegateToRouter('getContext'); } diff --git a/classes/core/PKPRouter.inc.php b/classes/core/PKPRouter.inc.php index 4c29e24f72d..49b3343bed5 100644 --- a/classes/core/PKPRouter.inc.php +++ b/classes/core/PKPRouter.inc.php @@ -71,15 +71,15 @@ class PKPRouter public $_application; /** @var Dispatcher */ public $_dispatcher; - /** @var integer context depth */ + /** @var int context depth */ public $_contextDepth; - /** @var integer context list */ + /** @var int context list */ public $_contextList; - /** @var integer context list with keys and values flipped */ + /** @var int context list with keys and values flipped */ public $_flippedContextList; - /** @var integer context paths */ + /** @var int context paths */ public $_contextPaths = []; - /** @var integer contexts */ + /** @var int contexts */ public $_contexts = []; /** @var PKPHandler Handler class */ public $_handler; @@ -105,7 +105,7 @@ public function &getApplication() /** * set the application * - * @param $application PKPApplication + * @param PKPApplication $application */ public function setApplication($application) { @@ -131,7 +131,7 @@ public function &getDispatcher() /** * set the dispatcher * - * @param $dispatcher PKPDispatcher + * @param PKPDispatcher $dispatcher */ public function setDispatcher($dispatcher) { @@ -141,7 +141,7 @@ public function setDispatcher($dispatcher) /** * Set the handler object for later retrieval. * - * @param $handler PKPHandler + * @param PKPHandler $handler */ public function setHandler($handler) { @@ -161,9 +161,9 @@ public function getHandler() /** * Determines whether this router can route the given request. * - * @param $request PKPRequest + * @param PKPRequest $request * - * @return boolean true, if the router supports this request, otherwise false + * @return bool true, if the router supports this request, otherwise false */ public function supports($request) { @@ -174,9 +174,9 @@ public function supports($request) /** * Determine whether or not this request is cacheable * - * @param $request PKPRequest + * @param PKPRequest $request * - * @return boolean + * @return bool */ public function isCacheable($request) { @@ -187,7 +187,7 @@ public function isCacheable($request) /** * A generic method to return an array of context paths (e.g. a Press or a Conference/SchedConf paths) * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed * * @return array of string (each element the path to one context element) */ @@ -234,8 +234,8 @@ public function getRequestedContextPaths($request) /** * A generic method to return a single context path (e.g. a Press or a SchedConf path) * - * @param $request PKPRequest the request to be routed - * @param $requestedContextLevel int (optional) the context level to return + * @param PKPRequest $request the request to be routed + * @param int $requestedContextLevel (optional) the context level to return * * @return string */ @@ -259,9 +259,9 @@ public function getRequestedContextPath($request, $requestedContextLevel = 1) /** * A Generic call to a context defining object (e.g. a Press, a Conference, or a SchedConf) * - * @param $request PKPRequest the request to be routed - * @param $requestedContextLevel int (optional) the desired context level - * @param $forceReload boolean (optional) Reset a context even if it's already been loaded + * @param PKPRequest $request the request to be routed + * @param int $requestedContextLevel (optional) the desired context level + * @param bool $forceReload (optional) Reset a context even if it's already been loaded * * @return object */ @@ -302,8 +302,8 @@ public function &getContext($request, $requestedContextLevel = 1, $forceReload = /** * Get the object that represents the desired context (e.g. Conference or Press) * - * @param $request PKPRequest the request to be routed - * @param $requestedContextName string page context + * @param PKPRequest $request the request to be routed + * @param string $requestedContextName page context * * @return object */ @@ -326,7 +326,7 @@ public function &getContextByName($request, $requestedContextName) /** * Get the URL to the index script. * - * @param $request PKPRequest the request to be routed + * @param PKPRequest $request the request to be routed * * @return string */ @@ -351,7 +351,7 @@ public function getIndexUrl($request) /** * Determine the filename to use for a local cache file. * - * @param $request PKPRequest + * @param PKPRequest $request * * @return string */ @@ -364,7 +364,7 @@ public function getCacheFilename($request) /** * Routes a given request to a handler operation * - * @param $request PKPRequest + * @param PKPRequest $request */ public function route($request) { @@ -375,14 +375,14 @@ public function route($request) /** * Build a handler request URL into PKPApplication. * - * @param $request PKPRequest the request to be routed - * @param $newContext mixed Optional contextual paths - * @param $handler string Optional name of the handler to invoke - * @param $op string Optional name of operation to invoke - * @param $path mixed Optional string or array of args to pass to handler - * @param $params array Optional set of name => value pairs to pass as user parameters - * @param $anchor string Optional name of anchor to add to URL - * @param $escape boolean Whether or not to escape ampersands, square brackets, etc. for this URL; default false. + * @param PKPRequest $request the request to be routed + * @param mixed $newContext Optional contextual paths + * @param string $handler Optional name of the handler to invoke + * @param string $op Optional name of operation to invoke + * @param mixed $path Optional string or array of args to pass to handler + * @param array $params Optional set of name => value pairs to pass as user parameters + * @param string $anchor Optional name of anchor to add to URL + * @param bool $escape Whether or not to escape ampersands, square brackets, etc. for this URL; default false. * * @return string the URL */ @@ -403,8 +403,8 @@ public function url( /** * Handle an authorization failure. * - * @param $request Request - * @param $authorizationMessage string a translation key with the authorization + * @param Request $request + * @param string $authorizationMessage a translation key with the authorization * failure message. */ public function handleAuthorizationFailure( @@ -429,10 +429,10 @@ public function handleAuthorizationFailure( * 4) execution * 5) client response * - * @param $serviceEndpoint callable the handler operation - * @param $request PKPRequest - * @param $args array - * @param $validate boolean whether or not to execute the + * @param callable $serviceEndpoint the handler operation + * @param PKPRequest $request + * @param array $args + * @param bool $validate whether or not to execute the * validation step. */ public function _authorizeInitializeAndCallRequest(&$serviceEndpoint, $request, &$args, $validate = true) @@ -499,7 +499,7 @@ public function _authorizeInitializeAndCallRequest(&$serviceEndpoint, $request, * When all entries are of the form 'contextName' => null or if * $newContext == null then we'll return an empty array. * - * @param $newContext the raw context array + * @param array $newContext the raw context array * * @return array the canonicalized context array */ @@ -541,8 +541,8 @@ public function _urlCanonicalizeNewContext($newContext) * in the config file using the 'base_url[context]' syntax in the * config file's 'general' section. * - * @param $request PKPRequest the request to be routed - * @param $newContext mixed (optional) context that differs from + * @param PKPRequest $request the request to be routed + * @param mixed $newContext (optional) context that differs from * the current request's context * * @return array An array consisting of the base url as the first @@ -614,10 +614,10 @@ public function _urlGetBaseAndContext($request, $newContext = []) /** * Build the additional parameters part of the URL. * - * @param $request PKPRequest the request to be routed - * @param $params array (optional) the parameter list to be + * @param PKPRequest $request the request to be routed + * @param array $params (optional) the parameter list to be * transformed to a url part. - * @param $escape boolean (optional) Whether or not to escape structural elements + * @param bool $escape (optional) Whether or not to escape structural elements * * @return array the encoded parameters or an empty array * if no parameters were given. @@ -644,32 +644,22 @@ public function _urlGetAdditionalParameters($request, $params = null, $escape = /** * Creates a valid URL from parts. * - * @param $baseUrl string the protocol, domain and initial path/parameters, no anchors allowed here - * @param $pathInfoArray array strings to be concatenated as path info - * @param $queryParametersArray array strings to be concatenated as query string - * @param $anchor string an additional anchor - * @param $escape boolean whether to escape ampersands + * @param string $baseUrl the protocol, domain and initial path/parameters, no anchors allowed here + * @param array $pathInfoArray strings to be concatenated as path info + * @param array $queryParametersArray strings to be concatenated as query string + * @param string $anchor an additional anchor + * @param bool $escape whether to escape ampersands * * @return string the URL */ public function _urlFromParts($baseUrl, $pathInfoArray = [], $queryParametersArray = [], $anchor = '', $escape = false) { - // parse_url does not support protocol relative URLs; - // work around it here (https://bugs.php.net/bug.php?id=66274) - if (strpos($baseUrl, '//') === 0) { - $baseUrl = 'http:' . $baseUrl; - $protocolRelativeWorkaround = true; - } else { - $protocolRelativeWorkaround = false; - } - // Parse the base url $baseUrlParts = parse_url($baseUrl); - assert(isset($baseUrlParts['scheme']) && isset($baseUrlParts['host']) && !isset($baseUrlParts['fragment'])); + assert(isset($baseUrlParts['host']) && !isset($baseUrlParts['fragment'])); // Reconstruct the base url without path and query - // (supporting the work-around for protocol relative URLs) - $baseUrl = $protocolRelativeWorkaround ? '//' : ($baseUrlParts['scheme'] . '://'); + $baseUrl = (isset($baseUrlParts['scheme']) ? $baseUrlParts['scheme'] . ':' : '') . '//'; if (isset($baseUrlParts['user'])) { $baseUrl .= $baseUrlParts['user']; if (isset($baseUrlParts['pass'])) { @@ -683,14 +673,12 @@ public function _urlFromParts($baseUrl, $pathInfoArray = [], $queryParametersArr } $baseUrl .= '/'; - // Add path info from the base URL - // to the path info array (if any). + // Add path info from the base URL to the path info array (if any). if (isset($baseUrlParts['path'])) { $pathInfoArray = array_merge(explode('/', trim($baseUrlParts['path'], '/')), $pathInfoArray); } - // Add query parameters from the base URL - // to the query parameter array (if any). + // Add query parameters from the base URL to the query parameter array (if any). if (isset($baseUrlParts['query'])) { $queryParametersArray = array_merge(explode('&', $baseUrlParts['query']), $queryParametersArray); } @@ -699,9 +687,9 @@ public function _urlFromParts($baseUrl, $pathInfoArray = [], $queryParametersArr $pathInfo = implode('/', $pathInfoArray); // Expand query parameters - $amp = ($escape ? '&' : '&'); + $amp = $escape ? '&' : '&'; $queryParameters = implode($amp, $queryParametersArray); - $queryParameters = (empty($queryParameters) ? '' : '?' . $queryParameters); + $queryParameters = empty($queryParameters) ? '' : '?' . $queryParameters; // Assemble and return the final URL return $baseUrl . $pathInfo . $queryParameters . $anchor; @@ -710,7 +698,7 @@ public function _urlFromParts($baseUrl, $pathInfoArray = [], $queryParametersArr /** * Convert a context level to its corresponding context name. * - * @param $contextLevel integer + * @param int $contextLevel * * @return string context name */ @@ -723,9 +711,9 @@ public function _contextLevelToContextName($contextLevel) /** * Convert a context name to its corresponding context level. * - * @param $contextName string + * @param string $contextName * - * @return integer context level + * @return int context level */ public function _contextNameToContextLevel($contextName) { diff --git a/classes/core/PKPString.inc.php b/classes/core/PKPString.inc.php index 3adbdffa0ee..74740ba8e30 100644 --- a/classes/core/PKPString.inc.php +++ b/classes/core/PKPString.inc.php @@ -16,40 +16,18 @@ namespace PKP\core; -/* - * Perl-compatibile regular expression (PCRE) constants: - * These are defined application-wide for consistency - */ - -/* - * RFC-2396 URIs - * - * Thanks to the PEAR Validation package (Tomas V.V.Cox , - * Pierre-Alain Joye , Amir Mohammad Saied ) - * - * Originally published under the "New BSD License" - * http://www.opensource.org/licenses/bsd-license.php - */ -define('PCRE_URI', '(?:([a-z][-+.a-z0-9]*):)?' . // Scheme - '(?://' . - '(?:((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();:\&=+$,])*)@)?' . // User - '(?:((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z](?:[a-z0-9]+)?\.?)' . // Hostname - '|([0-9]{1,3}(?:\.[0-9]{1,3}){3}))' . // IP Address - '(?::([0-9]*))?)' . // Port - '((?:/(?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'():@\&=+$,;])*)*/?)?' . // Path - '(?:\?([^#]*))?' . // Query String - '(?:\#((?:%[0-9a-f]{2}|[-a-z0-9_.!~*\'();/?:@\&=+$,])*))?'); // Fragment - -// Two different types of camel case: one for class names and one for method names -define('CAMEL_CASE_HEAD_UP', 0x01); -define('CAMEL_CASE_HEAD_DOWN', 0x02); - use PKP\config\Config; use Stringy\Stringy; class PKPString { + /** @var int Camel case for class names */ + public const CAMEL_CASE_HEAD_UP = 1; + + /** @var int Camel case for method names */ + public const CAMEL_CASE_HEAD_DOWN = 2; + /** * Perform initialization required for the string wrapper library. */ @@ -71,7 +49,7 @@ public static function init() /** * Check if server has the mbstring library. * - * @return boolean Returns true iff the server supports mbstring functions. + * @return bool Returns true iff the server supports mbstring functions. */ public static function hasMBString() { @@ -83,6 +61,7 @@ public static function hasMBString() // If string overloading is active, it will break many of the // native implementations. mbstring.func_overload must be set // to 0, 1 or 4 in php.ini (string overloading disabled). + // Note: Overloading has been deprecated on PHP 7.2 if (ini_get('mbstring.func_overload') && defined('MB_OVERLOAD_STRING')) { $hasMBString = false; } else { @@ -106,9 +85,9 @@ function_exists('mb_send_mail') // /** - * @see http://ca.php.net/manual/en/function.strlen.php + * @see https://www.php.net/strlen * - * @param $string string Input string + * @param string $string Input string * * @return int String length */ @@ -118,11 +97,11 @@ public static function strlen($string) } /** - * @see http://ca.php.net/manual/en/function.strpos.php + * @see https://www.php.net/strpos * - * @param $haystack string Input haystack to search - * @param $needle string Input needle to search for - * @param $offset int Offset at which to begin searching + * @param string $haystack Input haystack to search + * @param string $needle Input needle to search for + * @param int $offset Offset at which to begin searching * * @return int Position of needle within haystack */ @@ -132,10 +111,10 @@ public static function strpos($haystack, $needle, $offset = 0) } /** - * @see http://ca.php.net/manual/en/function.strrpos.php + * @see https://www.php.net/strrpos * - * @param $haystack string Haystack to search - * @param $needle string Needle to search haystack for + * @param string $haystack Haystack to search + * @param string $needle Needle to search haystack for * * @return int Last index of Needle in Haystack */ @@ -145,11 +124,11 @@ public static function strrpos($haystack, $needle) } /** - * @see http://ca.php.net/manual/en/function.substr.php + * @see https://www.php.net/substr * - * @param $string string Subject to extract substring from - * @param $start int Position to start from - * @param $length int Length to extract, or false for entire string from start position + * @param string $string Subject to extract substring from + * @param int $start Position to start from + * @param int $length Length to extract, or false for entire string from start position * * @return string Substring of $string */ @@ -159,9 +138,9 @@ public static function substr($string, $start, $length = null) } /** - * @see http://ca.php.net/manual/en/function.strtolower.php + * @see https://www.php.net/strtolower * - * @param $string string Input string + * @param string $string Input string * * @return string Lower case version of input string */ @@ -171,9 +150,9 @@ public static function strtolower($string) } /** - * @see http://ca.php.net/manual/en/function.strtoupper.php + * @see https://www.php.net/strtoupper * - * @param $string string Input string + * @param string $string Input string * * @return string Upper case version of input string */ @@ -183,9 +162,9 @@ public static function strtoupper($string) } /** - * @see http://ca.php.net/manual/en/function.ucfirst.php + * @see https://www.php.net/ucfirst * - * @param $string string Input string + * @param string $string Input string * * @return string ucfirst version of input string */ @@ -195,10 +174,10 @@ public static function ucfirst($string) } /** - * @see http://ca.php.net/manual/en/function.substr_count.php + * @see https://www.php.net/substr_count * - * @param $haystack string Input string to search - * @param $needle string String to search within $haystack for + * @param string $haystack Input string to search + * @param string $needle String to search within $haystack for * * @return int Count of number of times $needle appeared in $haystack */ @@ -208,9 +187,9 @@ public static function substr_count($haystack, $needle) } /** - * @see http://ca.php.net/manual/en/function.encode_mime_header.php + * @see https://www.php.net/encode_mime_header * - * @param $string string Input MIME header to encode. + * @param string $string Input MIME header to encode. * * @return string Encoded MIME header. */ @@ -229,10 +208,10 @@ public static function encode_mime_header($string) // /** - * @see http://ca.php.net/manual/en/function.regexp_quote.php + * @see https://www.php.net/preg_quote * - * @param $string string String to quote - * @param $delimiter string Delimiter for regular expression + * @param string $string String to quote + * @param string $delimiter Delimiter for regular expression * * @return string Quoted equivalent of $string */ @@ -242,10 +221,10 @@ public static function regexp_quote($string, $delimiter = '/') } /** - * @see http://ca.php.net/manual/en/function.regexp_grep.php + * @see https://www.php.net/preg_grep * - * @param $pattern string Regular expression - * @param $input string Input string + * @param string $pattern Regular expression + * @param string $input Input string * * @return array */ @@ -255,10 +234,10 @@ public static function regexp_grep($pattern, $input) } /** - * @see http://ca.php.net/manual/en/function.regexp_match.php + * @see https://www.php.net/preg_match * - * @param $pattern string Regular expression - * @param $subject string String to apply regular expression to + * @param string $pattern Regular expression + * @param string $subject String to apply regular expression to * * @return int */ @@ -268,11 +247,11 @@ public static function regexp_match($pattern, $subject) } /** - * @see http://ca.php.net/manual/en/function.regexp_match_get.php + * @see https://www.php.net/preg_match_get * - * @param $pattern string Regular expression - * @param $subject string String to apply regular expression to - * @param $matches array Reference to receive matches + * @param string $pattern Regular expression + * @param string $subject String to apply regular expression to + * @param array $matches Reference to receive matches * * @return int|boolean Returns 1 if the pattern matches given subject, 0 if it does not, or FALSE if an error occurred. */ @@ -282,11 +261,11 @@ public static function regexp_match_get($pattern, $subject, &$matches) } /** - * @see http://ca.php.net/manual/en/function.regexp_match_all.php + * @see https://www.php.net/preg_match_all * - * @param $pattern string Regular expression - * @param $subject string String to apply regular expression to - * @param $matches array Reference to receive matches + * @param string $pattern Regular expression + * @param string $subject String to apply regular expression to + * @param array $matches Reference to receive matches * * @return int|boolean Returns number of full matches of given subject, or FALSE if an error occurred. */ @@ -296,12 +275,12 @@ public static function regexp_match_all($pattern, $subject, &$matches) } /** - * @see http://ca.php.net/manual/en/function.regexp_replace.php + * @see https://www.php.net/preg_replace * - * @param $pattern string Regular expression - * @param $replacement string String to replace matches in $subject with - * @param $subject string String to apply regular expression to - * @param $limit int Number of replacements to perform, maximum, or -1 for no limit. + * @param string $pattern Regular expression + * @param string $replacement String to replace matches in $subject with + * @param string $subject String to apply regular expression to + * @param int $limit Number of replacements to perform, maximum, or -1 for no limit. */ public static function regexp_replace($pattern, $replacement, $subject, $limit = -1) { @@ -309,12 +288,12 @@ public static function regexp_replace($pattern, $replacement, $subject, $limit = } /** - * @see http://ca.php.net/manual/en/function.regexp_replace_callback.php + * @see https://www.php.net/preg_replace_callback * - * @param $pattern string Regular expression - * @param $callback callback PHP callback to generate content to replace matches with - * @param $subject string String to apply regular expression to - * @param $limit int Number of replacements to perform, maximum, or -1 for no limit. + * @param string $pattern Regular expression + * @param callable $callback PHP callback to generate content to replace matches with + * @param string $subject String to apply regular expression to + * @param int $limit Number of replacements to perform, maximum, or -1 for no limit. */ public static function regexp_replace_callback($pattern, $callback, $subject, $limit = -1) { @@ -322,11 +301,11 @@ public static function regexp_replace_callback($pattern, $callback, $subject, $l } /** - * @see http://ca.php.net/manual/en/function.regexp_split.php + * @see https://www.php.net/preg_split * - * @param $pattern string Regular expression - * @param $subject string String to apply regular expression to - * @param $limit int Number of times to match; -1 for unlimited + * @param string $pattern Regular expression + * @param string $subject String to apply regular expression to + * @param int $limit Number of times to match; -1 for unlimited * * @return array Resulting string segments */ @@ -336,10 +315,10 @@ public static function regexp_split($pattern, $subject, $limit = -1) } /** - * @see http://ca.php.net/manual/en/function.mime_content_type.php + * @see https://www.php.net/mime_content_type * - * @param $filename string Filename to test. - * @param $suggestedExtension string Suggested file extension (used for common misconfigurations) + * @param string $filename Filename to test. + * @param string $suggestedExtension Suggested file extension (used for common misconfigurations) * * @return string Detected MIME type */ @@ -417,7 +396,7 @@ public static function getAmbiguousExtensionsMap() * Strip unsafe HTML from the input text. Covers XSS attacks like scripts, * onclick(...) attributes, javascript: urls, and special characters. * - * @param $input string input string + * @param string $input input string * * @return string */ @@ -438,7 +417,7 @@ public static function stripUnsafeHtml($input) /** * Convert limited HTML into a string. * - * @param $html string + * @param string $html * * @return string */ @@ -456,7 +435,7 @@ public static function html2text($html) * Joins two title string fragments (in $fields) either with a * space or a colon. * - * @param $fields array + * @param array $fields * * @return string the joined string */ @@ -483,20 +462,20 @@ public static function concatTitleFields($fields) * Transform "handler-class" to "HandlerClass" * and "my-op" to "myOp". * - * @param $string input string - * @param $type which kind of camel case? + * @param string $string input string + * @param int $type which kind of camel case? * * @return string the string in camel case */ - public static function camelize($string, $type = CAMEL_CASE_HEAD_UP) + public static function camelize($string, $type = self::CAMEL_CASE_HEAD_UP) { - assert($type == CAMEL_CASE_HEAD_UP || $type == CAMEL_CASE_HEAD_DOWN); + assert($type == static::CAMEL_CASE_HEAD_UP || $type == static::CAMEL_CASE_HEAD_DOWN); // Transform "handler-class" to "HandlerClass" and "my-op" to "MyOp" $string = implode(array_map('ucfirst_codesafe', explode('-', $string))); // Transform "MyOp" to "myOp" - if ($type == CAMEL_CASE_HEAD_DOWN) { + if ($type == static::CAMEL_CASE_HEAD_DOWN) { $string = strtolower_codesafe(substr($string, 0, 1)) . substr($string, 1); } @@ -507,7 +486,7 @@ public static function camelize($string, $type = CAMEL_CASE_HEAD_UP) * Transform "HandlerClass" to "handler-class" * and "myOp" to "my-op". * - * @param $string + * @param string $string * * @return string */ @@ -525,18 +504,6 @@ public static function uncamelize($string) return strtolower_codesafe(implode('-', $words[0])); } - /** - * Get a letter $steps places after 'A' - * - * @param $steps int - * - * @return string Letter - */ - public static function enumerateAlphabetically($steps) - { - return chr(ord('A') + $steps); - } - /** * Create a new UUID (version 4) * @@ -559,7 +526,7 @@ public static function generateUUID() * Matches each symbol of PHP strftime format string * to jQuery Datepicker widget date format. * - * @param $phpFormat string + * @param string $phpFormat * * @return string */ @@ -567,55 +534,55 @@ public static function dateformatPHP2JQueryDatepicker($phpFormat) { $symbols = [ // Day - 'a' => 'D', // date() format 'D' - 'A' => 'DD', // date() format 'DD' - 'd' => 'dd', // date() format 'd' - 'e' => 'd', // date() format 'j' - 'j' => 'oo', // date() format none - 'u' => '', // date() format 'N' - 'w' => '', // date() format 'w' + 'a' => 'D', // date() format 'D' + 'A' => 'DD', // date() format 'DD' + 'd' => 'dd', // date() format 'd' + 'e' => 'd', // date() format 'j' + 'j' => 'oo', // date() format none + 'u' => '', // date() format 'N' + 'w' => '', // date() format 'w' // Week - 'U' => '', // date() format none - 'V' => '', // date() format none - 'W' => '', // date() format 'W' + 'U' => '', // date() format none + 'V' => '', // date() format none + 'W' => '', // date() format 'W' // Month - 'b' => 'M', // date() format 'M' - 'h' => 'M', // date() format 'M' - 'B' => 'MM', // date() format 'F' - 'm' => 'mm', // date() format 'm' + 'b' => 'M', // date() format 'M' + 'h' => 'M', // date() format 'M' + 'B' => 'MM', // date() format 'F' + 'm' => 'mm', // date() format 'm' // Year - 'C' => '', // date() format none - 'g' => 'y', // date() format none - 'G' => 'yy', // date() format 'o' - 'y' => 'y', // date() format 'y' - 'Y' => 'yy', // date() format 'Y' + 'C' => '', // date() format none + 'g' => 'y', // date() format none + 'G' => 'yy', // date() format 'o' + 'y' => 'y', // date() format 'y' + 'Y' => 'yy', // date() format 'Y' // Time - 'H' => '', // date() format 'H' - 'k' => '', // date() format none - 'I' => '', // date() format 'h' - 'l' => '', // date() format 'g' - 'P' => '', // date() format 'a' - 'p' => '', // date() format 'A' - 'M' => '', // date() format 'i' - 'S' => '', // date() format 's' - 's' => '', // date() format 'u' + 'H' => '', // date() format 'H' + 'k' => '', // date() format none + 'I' => '', // date() format 'h' + 'l' => '', // date() format 'g' + 'P' => '', // date() format 'a' + 'p' => '', // date() format 'A' + 'M' => '', // date() format 'i' + 'S' => '', // date() format 's' + 's' => '', // date() format 'u' // Timezone - 'z' => '', // date() format 'O' - 'Z' => '', // date() format 'T' + 'z' => '', // date() format 'O' + 'Z' => '', // date() format 'T' // Full Date/Time - 'r' => '', // date() format none - 'R' => '', // date() format none - 'X' => '', // date() format none - 'D' => '', // date() format none - 'F' => '', // date() format none - 'x' => '', // date() format none - 'c' => '', // date() format none + 'r' => '', // date() format none + 'R' => '', // date() format none + 'X' => '', // date() format none + 'D' => '', // date() format none + 'F' => '', // date() format none + 'x' => '', // date() format none + 'c' => '', // date() format none // Other '%' => '' diff --git a/classes/core/Registry.inc.php b/classes/core/Registry.inc.php index a9e33e92fe7..c1155d6ceae 100644 --- a/classes/core/Registry.inc.php +++ b/classes/core/Registry.inc.php @@ -32,9 +32,9 @@ public static function &_getRegistry() /** * Get the value of an item in the registry. * - * @param $key string - * @param $createIfEmpty boolean Whether or not to create the entry if none exists - * @param $createWithDefault mixed If $createIfEmpty, this value will be used as a default + * @param string $key + * @param bool $createIfEmpty Whether or not to create the entry if none exists + * @param mixed $createWithDefault If $createIfEmpty, this value will be used as a default */ public static function &get($key, $createIfEmpty = false, $createWithDefault = null) { @@ -54,8 +54,7 @@ public static function &get($key, $createIfEmpty = false, $createWithDefault = n * Set the value of an item in the registry. * The item will be added if it does not already exist. * - * @param $key string - * @param $value mixed + * @param string $key */ public static function set($key, &$value) { @@ -66,7 +65,7 @@ public static function set($key, &$value) /** * Remove an item from the registry. * - * @param $key string + * @param string $key */ public static function delete($key) { diff --git a/classes/core/RuntimeEnvironment.inc.php b/classes/core/RuntimeEnvironment.inc.php index 713aa77c37e..f547749d195 100644 --- a/classes/core/RuntimeEnvironment.inc.php +++ b/classes/core/RuntimeEnvironment.inc.php @@ -87,15 +87,15 @@ public function getExternalPrograms() * Checks whether the current runtime environment is * compatible with the specified parameters. * - * @return boolean + * @return bool */ public function isCompatible() { // Check PHP version - if (!is_null($this->_phpVersionMin) && !checkPhpVersion($this->_phpVersionMin)) { + if (!is_null($this->_phpVersionMin) && version_compare(PHP_VERSION, $this->_phpVersionMin) < 0) { return false; } - if (!is_null($this->_phpVersionMax) && version_compare(PHP_VERSION, $this->_phpVersionMax) === 1) { + if (!is_null($this->_phpVersionMax) && version_compare(PHP_VERSION, $this->_phpVersionMax) > 0) { return false; } diff --git a/classes/core/VirtualArrayIterator.inc.php b/classes/core/VirtualArrayIterator.inc.php index 6eb712f908a..da10721452f 100644 --- a/classes/core/VirtualArrayIterator.inc.php +++ b/classes/core/VirtualArrayIterator.inc.php @@ -30,16 +30,16 @@ class VirtualArrayIterator extends ItemIterator /** @var int The total number of items. */ public $count; - /** @var boolean Whether or not the iterator was empty from the start */ + /** @var bool Whether or not the iterator was empty from the start */ public $wasEmpty; /** * Constructor. * - * @param $theArray array The array of items to iterate through - * @param $totalItems int The total number of items in the virtual "larger" array - * @param $page int the current page number - * @param $itemsPerPage int Number of items to display per page + * @param array $theArray The array of items to iterate through + * @param int $totalItems The total number of items in the virtual "larger" array + * @param int $page the current page number + * @param int $itemsPerPage Number of items to display per page */ public function __construct($theArray, $totalItems, $page = -1, $itemsPerPage = -1) { @@ -62,8 +62,8 @@ public function __construct($theArray, $totalItems, $page = -1, $itemsPerPage = * Extracts the appropriate page items from the whole array and * calls the constructor. * - * @param $wholeArray array The whole array of items - * @param $rangeInfo int The number of items per page + * @param array $wholeArray The whole array of items + * @param int $rangeInfo The number of items per page * * @return object VirtualArrayIterator */ @@ -108,7 +108,7 @@ public function nextWithKey() /** * Check whether or not this iterator is for the first page of a sequence * - * @return boolean + * @return bool */ public function atFirstPage() { @@ -118,7 +118,7 @@ public function atFirstPage() /** * Check whether or not this iterator is for the last page of a sequence * - * @return boolean + * @return bool */ public function atLastPage() { @@ -160,7 +160,7 @@ public function getPageCount() * Note: This implementation requires that next() be called before every eof() will * function properly (except the first call). * - * @return boolean + * @return bool */ public function eof() { @@ -170,7 +170,7 @@ public function eof() /** * Return a boolean indicating whether or not this iterator was empty from the beginning * - * @return boolean + * @return bool */ public function wasEmpty() { @@ -186,35 +186,6 @@ public function &toArray() { return $this->theArray; } - - /** - * A version of array_slice that takes keys into account. - * Thanks to pies at sputnik dot pl. - * This is made redundant by PHP 5.0.2's updated - * array_slice, but we can't assume everyone has that. - * FIXME: Reconcile this against the dupe in ArrayItemIterator. - * - * @see http://ca3.php.net/manual/en/function.array-slice.php - * - * @param $array Array - * @param $offset int - * @param $len int - */ - public function array_slice_key($array, $offset, $len = -1) - { - if (!is_array($array)) { - return false; - } - - $return = []; - $length = $len >= 0 ? $len : count($array); - $keys = array_slice(array_keys($array), $offset, $length); - foreach ($keys as $key) { - $return[$key] = $array[$key]; - } - - return $return; - } } if (!PKP_STRICT_MODE) { diff --git a/classes/db/DAO.inc.php b/classes/db/DAO.inc.php index 9092ed8e7c5..fae025bb58a 100644 --- a/classes/db/DAO.inc.php +++ b/classes/db/DAO.inc.php @@ -52,8 +52,8 @@ public function __construct($callHooks = true) /** * Execute a SELECT SQL statement. * - * @param $sql string the SQL statement - * @param $params array parameters for the SQL statement + * @param string $sql the SQL statement + * @param array $params parameters for the SQL statement * * @deprecated 3.4 * @@ -79,9 +79,9 @@ public function retrieve($sql, $params = [], $callHooks = true) /** * Execute a SELECT SQL statment, returning rows in the range supplied. * - * @param $sql string the SQL statement - * @param $params array parameters for the SQL statement - * @param $dbResultRange DBResultRange object describing the desired range + * @param string $sql the SQL statement + * @param array $params parameters for the SQL statement + * @param DBResultRange $dbResultRange object describing the desired range * * @deprecated 3.4 * @@ -113,8 +113,8 @@ public function retrieveRange($sql, $params = [], $dbResultRange = null, $callHo /** * Count the number of records in the supplied SQL statement (with optional bind parameters parameters) * - * @param $sql string SQL query to be counted - * @param $params array Optional SQL query bind parameters + * @param string $sql SQL query to be counted + * @param array $params Optional SQL query bind parameters * * @deprecated 3.4 * @@ -129,7 +129,7 @@ public function countRecords($sql, $params = []) /** * Concatenate SQL expressions into a single string. * - * @param ...$args SQL expressions (e.g. column names) to concatenate. + * @param array ...$args SQL expressions (e.g. column names) to concatenate. * * @deprecated 3.4 * @@ -143,10 +143,10 @@ public function concat(...$args) /** * Execute an INSERT, UPDATE, or DELETE SQL statement. * - * @param $sql string the SQL statement the execute - * @param $params array an array of parameters for the SQL statement - * @param $callHooks boolean Whether or not to call hooks - * @param $dieOnError boolean Whether or not to die if an error occurs + * @param string $sql the SQL statement the execute + * @param array $params an array of parameters for the SQL statement + * @param bool $callHooks Whether or not to call hooks + * @param bool $dieOnError Whether or not to die if an error occurs * * @deprecated 3.4 * @@ -172,9 +172,9 @@ public function update($sql, $params = [], $callHooks = true, $dieOnError = true /** * Insert a row in a table, replacing an existing row if necessary. * - * @param $table string - * @param $arrFields array Associative array of colName => value - * @param $keyCols array Array of column names that are keys + * @param string $table + * @param array $arrFields Associative array of colName => value + * @param array $keyCols Array of column names that are keys * * @deprecated 3.4 * @@ -230,7 +230,7 @@ public function flushCache() /** * Return datetime formatted for DB insertion. * - * @param $dt int/string *nix timestamp or ISO datetime string + * @param int|string $dt *nix timestamp or ISO datetime string * * @deprecated 3.4 * @@ -250,7 +250,7 @@ public function datetimeToDB($dt) /** * Return date formatted for DB insertion. * - * @param $d int/string *nix timestamp or ISO date string + * @param int|string $d *nix timestamp or ISO date string * * @deprecated 3.4 * @@ -270,7 +270,7 @@ public function dateToDB($d) /** * Return datetime from DB as ISO datetime string. * - * @param $dt string datetime from DB + * @param string $dt datetime from DB * * @deprecated 3.4 * @@ -286,7 +286,7 @@ public function datetimeFromDB($dt) /** * Return date from DB as ISO date string. * - * @param $d string date from DB + * @param string $d date from DB * * @deprecated 3.4 * @@ -345,7 +345,7 @@ public function convertFromDB($value, $type, $nullable = false) /** * Get the type of a value to be stored in the database * - * @param $value string + * @param string $value * * @deprecated 3.4 * @@ -375,9 +375,8 @@ public function getType($value) /** * Convert a PHP variable into a string to be stored in the DB * - * @param $value mixed - * @param $type string - * @param $nullable bool True iff the value is allowed to be null. + * @param string $type + * @param bool $nullable True iff the value is allowed to be null. * * @return string */ @@ -429,7 +428,6 @@ public function convertToDB($value, &$type, $nullable = false) /** * Cast the given parameter to an int, or leave it null. * - * @param $value mixed * * @deprecated 3.4 * @@ -487,9 +485,9 @@ public function getLocaleFieldNames() /** * Update the settings table of a data object. * - * @param $tableName string - * @param $dataObject DataObject - * @param $idArray array + * @param string $tableName + * @param DataObject $dataObject + * @param array $idArray * * @deprecated 3.4 */ @@ -587,9 +585,9 @@ public function updateDataObjectSettings($tableName, $dataObject, $idArray) * Get contents of the _settings table, storing entries in the specified * data object. * - * @param $tableName string Settings table name - * @param $idFieldName string Name of ID column - * @param $dataObject \PKP\core\DataObject Object in which to store retrieved values + * @param string $tableName Settings table name + * @param string $idFieldName Name of ID column + * @param \PKP\core\DataObject $dataObject Object in which to store retrieved values * * @deprecated 3.4 */ @@ -618,7 +616,7 @@ public function getDataObjectSettings($tableName, $idFieldName, $idFieldValue, $ /** * Get the driver for this connection. * - * @param $direction int + * @param int $direction * * @deprecated 3.4 * @@ -641,13 +639,13 @@ public function getDirectionMapping($direction) * to the client to refresh itself according to changes * in the DB. * - * @param $elementId string (Optional) To refresh a single element + * @param string $elementId (Optional) To refresh a single element * give the element ID here. Otherwise all elements will * be refreshed. - * @param $parentElementId string (Optional) To refresh a single + * @param string $parentElementId (Optional) To refresh a single * element that is associated with another one give the parent * element ID here. - * @param $content mixed (Optional) Additional content to pass back + * @param mixed $content (Optional) Additional content to pass back * to the handler of the JSON message. * * @deprecated 3.4 @@ -676,16 +674,16 @@ public static function getDataChangedEvent($elementId = null, $parentElementId = * Format a passed date (in English textual datetime) * to Y-m-d H:i:s format, used in database. * - * @param $date string Any English textual datetime. - * @param $defaultNumWeeks int If passed and date is null, + * @param string $date Any English textual datetime. + * @param int $defaultNumWeeks If passed and date is null, * used to calculate a data in future from today. - * @param $acceptPastDate boolean Will not accept past dates, + * @param bool $acceptPastDate Will not accept past dates, * returning today if false and the passed date * is in the past. * * @deprecated 3.4 * - * @return string or null + * @return string|null */ protected function formatDateToDB($date, $defaultNumWeeks = null, $acceptPastDate = true) { diff --git a/classes/db/DAORegistry.inc.php b/classes/db/DAORegistry.inc.php index 497628cf42b..4f1d3303587 100644 --- a/classes/db/DAORegistry.inc.php +++ b/classes/db/DAORegistry.inc.php @@ -37,8 +37,8 @@ public static function &getDAOs() /** * Register a new DAO with the system. * - * @param $name string The name of the DAO to register - * @param $dao object A reference to the DAO to be registered + * @param string $name The name of the DAO to register + * @param object $dao A reference to the DAO to be registered * * @return object A reference to previously-registered DAO of the same * name, if one was already registered; null otherwise @@ -58,7 +58,7 @@ public static function registerDAO($name, $dao) /** * Retrieve a reference to the specified DAO. * - * @param $name string the class name of the requested DAO + * @param string $name the class name of the requested DAO * * @return DAO */ diff --git a/classes/db/DAOResultFactory.inc.php b/classes/db/DAOResultFactory.inc.php index 9c692e8bbc9..6749d86e063 100644 --- a/classes/db/DAOResultFactory.inc.php +++ b/classes/db/DAOResultFactory.inc.php @@ -62,13 +62,13 @@ class DAOResultFactory extends ItemIterator * Constructor. * Initialize the DAOResultFactory * - * @param $records object ADO record set, Generator, or Enumerable - * @param $dao object DAO class for factory - * @param $functionName The function to call on $dao to create an object - * @param $idFields array an array of primary key field names that uniquely identify a result row in the record set. Should be data object _data array key, not database column name - * @param $sql string Optional SQL query used to generate paged result set. Necessary when total row counts will be needed (e.g. when paging). WARNING: New code should not use this. - * @param $params array Optional parameters for SQL query used to generate paged result set. Necessary when total row counts will be needed (e.g. when paging). WARNING: New code should not use this. - * @param $rangeInfo DBResultRange Optional pagination information. WARNING: New code should not use this. + * @param object $records ADO record set, Generator, or Enumerable + * @param object $dao DAO class for factory + * @param string $functionName The function to call on $dao to create an object + * @param array $idFields an array of primary key field names that uniquely identify a result row in the record set. Should be data object _data array key, not database column name + * @param string $sql Optional SQL query used to generate paged result set. Necessary when total row counts will be needed (e.g. when paging). WARNING: New code should not use this. + * @param array $params Optional parameters for SQL query used to generate paged result set. Necessary when total row counts will be needed (e.g. when paging). WARNING: New code should not use this. + * @param DBResultRange $rangeInfo Optional pagination information. WARNING: New code should not use this. */ public function __construct($records, $dao, $functionName, $idFields = [], $sql = null, $params = [], $rangeInfo = null) { @@ -81,13 +81,12 @@ public function __construct($records, $dao, $functionName, $idFields = [], $sql $this->params = $params; $this->rangeInfo = $rangeInfo; - // Determine if the fromRow method expects to receive - // an array or a stdClass. EntityDAOs expect stdClass. - // DAOs that extend PKP\db\DAO expect an array. + // Determine if the "fromRow" method expects to receive an array or a stdClass. + // EntityDAOs expect an object. DAOs that extend PKP\db\DAO expect an array. $reflector = new ReflectionClass(get_class($this->dao)); - if (method_exists($this->dao, $this->functionName)) { + if ($reflector->hasMethod($this->functionName)) { $params = $reflector->getMethod($this->functionName)->getParameters(); - if (!empty($params) && $params[0]->hasType() && $params[0]->getType()->getName() === 'stdClass') { + if (!empty($params) && $params[0]->hasType() && $params[0]->getType()->getName() === 'object') { $this->expectsArray = false; } } @@ -146,7 +145,7 @@ public function getCount() * * @param null|mixed $idField * - * @return array? ($key, $value) + * @return array|null ($key, $value) */ public function nextWithKey($idField = null) { @@ -193,7 +192,7 @@ public function getPageCount() /** * Return a boolean indicating whether or not we've reached the end of results * - * @return boolean + * @return bool */ public function eof() { @@ -206,7 +205,7 @@ public function eof() /** * Return true iff the result list was empty. * - * @return boolean + * @return bool */ public function wasEmpty() { diff --git a/classes/db/DAOResultIterator.inc.php b/classes/db/DAOResultIterator.inc.php index f6076c8757b..e7f4fbed145 100644 --- a/classes/db/DAOResultIterator.inc.php +++ b/classes/db/DAOResultIterator.inc.php @@ -56,7 +56,6 @@ public function key() return null; } return $this->_i; - return $this->_current->getId(); } /** @@ -69,7 +68,7 @@ public function next() } /** - * Rewind the DAOResultFactory to the begining. WARNING that this + * Rewind the DAOResultFactory to the beginning. WARNING that this * operation is not arbitrarily supported -- it can only be called * before the first call to `next()`. */ diff --git a/classes/db/DBDataXMLParser.inc.php b/classes/db/DBDataXMLParser.inc.php index 6a7564701d1..0f9d7b31c1c 100644 --- a/classes/db/DBDataXMLParser.inc.php +++ b/classes/db/DBDataXMLParser.inc.php @@ -40,7 +40,7 @@ public function __construct() /** * Parse an XML data file into SQL statements. * - * @param $file string path to the XML file to parse + * @param string $file path to the XML file to parse * * @return array the array of SQL statements parsed */ @@ -161,9 +161,9 @@ public function parseData($file) /** * Execute the parsed SQL statements. * - * @param $continueOnError boolean continue to execute remaining statements if a failure occurs + * @param bool $continueOnError continue to execute remaining statements if a failure occurs * - * @return boolean success + * @return bool success */ public function executeData($continueOnError = false) { @@ -193,7 +193,7 @@ public function getSQL() /** * Quote a string to be appear as a value in an SQL INSERT statement. * - * @param $str string + * @param string $str * * @return string */ @@ -209,7 +209,7 @@ public function quoteString($str) /** * retrieve a field name and value from a field node * - * @param $fieldNode XMLNode + * @param XMLNode $fieldNode * * @return array an array with two entries: the field * name and the field value diff --git a/classes/db/DBResultRange.inc.php b/classes/db/DBResultRange.inc.php index 8d4d70a8e88..4fb1c5491c2 100644 --- a/classes/db/DBResultRange.inc.php +++ b/classes/db/DBResultRange.inc.php @@ -17,13 +17,13 @@ class DBResultRange { - /** The number of items to display */ + /** @var int The number of items to display */ public $count; - /** The number of pages to skip */ + /** @var int The number of pages to skip */ public $page; - /** Optional offset if pagination is not used. */ + /** @var int Optional offset if pagination is not used. */ public $offset; /** @@ -42,7 +42,7 @@ public function __construct($count, $page = 1, $offset = null) /** * Checks to see if the DBResultRange is valid. * - * @return boolean + * @return bool */ public function isValid() { @@ -63,7 +63,7 @@ public function getPage() /** * Set the count of pages to skip. * - * @param $page int + * @param int $page */ public function setPage($page) { @@ -83,7 +83,7 @@ public function getCount() /** * Set the count of items in this range to display. * - * @param $count int + * @param int $count */ public function setCount($count) { @@ -103,7 +103,7 @@ public function getOffset() /** * Set the offset of items in this range to display. * - * @param $offset int + * @param int $offset */ public function setOffset($offset) { diff --git a/classes/db/SchemaDAO.inc.php b/classes/db/SchemaDAO.inc.php index a999e4d8551..3fc5d631df1 100644 --- a/classes/db/SchemaDAO.inc.php +++ b/classes/db/SchemaDAO.inc.php @@ -48,7 +48,7 @@ abstract public function newDataObject(); /** * Retrieve an object by ID * - * @param $objectId int + * @param int $objectId * * @return \PKP\core\DataObject? */ @@ -130,7 +130,7 @@ public function insertObject($object) * * To delete a value for a locale key, a null value must be passed. * - * @param $object \PKP\core\DataObject The object to insert into the database + * @param \PKP\core\DataObject $object The object to insert into the database */ public function updateObject($object) { @@ -201,7 +201,7 @@ public function updateObject($object) * * A wrapper function for SchemaDAO::deleteObjectById(). * - * @param $object \PKP\core\DataObject The object to insert into the database + * @param \PKP\core\DataObject $object The object to insert into the database */ public function deleteObject($object) { @@ -211,7 +211,7 @@ public function deleteObject($object) /** * Delete an object by its ID * - * @param $objectId int + * @param int $objectId */ public function deleteById($objectId) { @@ -228,7 +228,7 @@ public function deleteById($objectId) /** * Return a \PKP\core\DataObject from a result row * - * @param $primaryRow array The result row from the primary table lookup + * @param array $primaryRow The result row from the primary table lookup * * @return DataObject */ @@ -283,7 +283,7 @@ public function getInsertId() /** * A helper function to compile the key/value set for the primary table * - * @param DataObject + * @param DataObject $object * * @return array */ diff --git a/classes/db/XMLDAO.inc.php b/classes/db/XMLDAO.inc.php index a7edfb4e4fd..5382f1c14d3 100644 --- a/classes/db/XMLDAO.inc.php +++ b/classes/db/XMLDAO.inc.php @@ -24,7 +24,7 @@ class XMLDAO * * @see PKPXMLParser::parse() * - * @param $file string + * @param string $file */ public function parse($file) { @@ -37,8 +37,8 @@ public function parse($file) * * @see PKPXMLParser::parse() * - * @param $file string - * @param $handler reference to the handler to use with the parser. + * @param string $file + * @param callable $handler reference to the handler to use with the parser. */ public function parseWithHandler($file, $handler) { @@ -52,10 +52,10 @@ public function parseWithHandler($file, $handler) * * @see PKPXMLParser::parseStruct() * - * @param $file string - * @param $tagsToMatch array + * @param string $file + * @param array $tagsToMatch * - * @return array? + * @return array|null */ public function parseStruct($file, $tagsToMatch = []) { diff --git a/classes/decision/Collector.inc.php b/classes/decision/Collector.inc.php new file mode 100644 index 00000000000..8e284ba1690 --- /dev/null +++ b/classes/decision/Collector.inc.php @@ -0,0 +1,134 @@ +dao = $dao; + } + + /** + * Filter decisions by these decision types + * + * @param int[] $decisionTypes One of the Decision::* constants + */ + public function filterByDecisionTypes(array $decisionTypes): self + { + $this->decisionTypes = $decisionTypes; + return $this; + } + + /** + * Filter decisions taken by one or more editors] + * + * @param int[] $editorIds + */ + public function filterByEditorIds(array $editorIds): self + { + $this->editorIds = $editorIds; + return $this; + } + + /** + * Filter decisions taken in one or more reviewRoundIds + * + * @param int[] $reviewRoundIds The review round number, such as first or + * second round of reviews. NOT the unique review round id. + */ + public function filterByReviewRoundIds(array $reviewRoundIds): self + { + $this->reviewRoundIds = $reviewRoundIds; + return $this; + } + + /** + * Filter decisions taken in one or more rounds + * + * @param int[] $rounds The review round number, such as first or + * second round of reviews. NOT the unique review round id. + */ + public function filterByRounds(array $rounds): self + { + $this->rounds = $rounds; + return $this; + } + + /** + * Filter decisions taken in one or more workflow stages + * + * @param int[] $stageIds One or more WORKFLOW_STAGE_ID_ constants + */ + public function filterByStageIds(array $stageIds): self + { + $this->stageIds = $stageIds; + return $this; + } + + /** + * Filter decisions taken for one or more submission ids + * + * @param int[] $submissionIds + */ + public function filterBySubmissionIds(array $submissionIds): self + { + $this->submissionIds = $submissionIds; + return $this; + } + + /** + * @copydoc CollectorInterface::getQueryBuilder() + */ + public function getQueryBuilder(): Builder + { + $qb = DB::table($this->dao->table . ' as ed') + ->when(!is_null($this->decisionTypes), function ($q) { + $q->whereIn('decision', $this->decisionTypes); + }) + ->when(!is_null($this->editorIds), function ($q) { + $q->whereIn('editor_id', $this->editorIds); + }) + ->when(!is_null($this->reviewRoundIds), function ($q) { + $q->whereIn('review_round_id', $this->reviewRoundIds); + }) + ->when(!is_null($this->rounds), function ($q) { + $q->whereIn('round', $this->rounds); + }) + ->when(!is_null($this->stageIds), function ($q) { + $q->whereIn('stage_id', $this->stageIds); + }) + ->when(!is_null($this->submissionIds), function ($q) { + $q->whereIn('submission_id', $this->submissionIds); + }) + ->orderBy('date_decided', 'asc'); + + HookRegistry::call('Decision::Collector', [&$qb, $this]); + + return $qb; + } +} diff --git a/classes/decision/DAO.inc.php b/classes/decision/DAO.inc.php new file mode 100644 index 00000000000..6abb2953041 --- /dev/null +++ b/classes/decision/DAO.inc.php @@ -0,0 +1,144 @@ + 'edit_decision_id', + 'dateDecided' => 'date_decided', + 'decision' => 'decision', + 'editorId' => 'editor_id', + 'reviewRoundId' => 'review_round_id', + 'round' => 'round', + 'stageId' => 'stage_id', + 'submissionId' => 'submission_id', + ]; + + /** + * Instantiate a new DataObject + */ + public function newDataObject(): Decision + { + return App::make(Decision::class); + } + + /** + * @copydoc EntityDAO::get() + */ + public function get(int $id): ?Decision + { + return parent::get($id); + } + + /** + * Get the number of decisions matching the configured query + */ + public function getCount(Collector $query): int + { + return $query + ->getQueryBuilder() + ->count(); + } + + /** + * Get a list of ids matching the configured query + */ + public function getIds(Collector $query): Collection + { + return $query + ->getQueryBuilder() + ->select('ed.' . $this->primaryKeyColumn) + ->pluck('ed.' . $this->primaryKeyColumn); + } + + /** + * Get a collection of decisions matching the configured query + */ + public function getMany(Collector $query): LazyCollection + { + $rows = $query + ->getQueryBuilder() + ->select(['ed.*']) + ->get(); + + return LazyCollection::make(function () use ($rows) { + foreach ($rows as $row) { + yield $this->fromRow($row); + } + }); + } + + /** + * @copydoc EntityDAO::fromRow() + */ + public function fromRow(object $row): Decision + { + return parent::fromRow($row); + } + + /** + * @copydoc EntityDAO::insert() + */ + public function insert(Decision $decision): int + { + return parent::_insert($decision); + } + + /** + * @copydoc EntityDAO::update() + */ + public function update(Decision $decision) + { + parent::_update($decision); + } + + /** + * @copydoc EntityDAO::delete() + */ + public function delete(Decision $decision) + { + parent::_delete($decision); + } + + /** + * Reassign all decisions from one editor to another + */ + public function reassignDecisions(int $fromEditorId, int $toEditorId) + { + DB::table($this->table) + ->where('editor_id', '=', $fromEditorId) + ->update(['editor_id' => $toEditorId]); + } +} diff --git a/classes/decision/Decision.inc.php b/classes/decision/Decision.inc.php new file mode 100644 index 00000000000..44d1ed3fea6 --- /dev/null +++ b/classes/decision/Decision.inc.php @@ -0,0 +1,70 @@ +getTypes() as $type) { + if ($type->getDecision() === $this->getData('decision')) { + return $type; + } + } + throw new Exception('Decision exists with an unknown type. Decision: ' . $this->getData('decisions')); + } +} + +if (!PKP_STRICT_MODE) { + define('SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE', Decision::INITIAL_DECLINE); + define('SUBMISSION_EDITOR_DECISION_SKIP_REVIEW', Decision::SKIP_REVIEW); + define('SUBMISSION_EDITOR_RECOMMEND_ACCEPT', Decision::RECOMMEND_ACCEPT); + define('SUBMISSION_EDITOR_RECOMMEND_PENDING_REVISIONS', Decision::RECOMMEND_PENDING_REVISIONS); + define('SUBMISSION_EDITOR_RECOMMEND_RESUBMIT', Decision::RECOMMEND_RESUBMIT); + define('SUBMISSION_EDITOR_RECOMMEND_DECLINE', Decision::RECOMMEND_DECLINE); + define('SUBMISSION_EDITOR_DECISION_REVERT_DECLINE', Decision::REVERT_DECLINE); + define('SUBMISSION_EDITOR_DECISION_REVERT_INITIAL_DECLINE', Decision::REVERT_INITIAL_DECLINE); + define('SUBMISSION_EDITOR_DECISION_BACK_TO_COPYEDITING', Decision::BACK_TO_COPYEDITING); + define('SUBMISSION_EDITOR_DECISION_BACK_TO_REVIEW', Decision::BACK_TO_REVIEW); + define('SUBMISSION_EDITOR_DECISION_BACK_TO_SUBMISSION_FROM_COPYEDITING', Decision::BACK_TO_SUBMISSION_FROM_COPYEDITING); + define('SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION', Decision::SEND_TO_PRODUCTION); +} diff --git a/classes/decision/Repository.inc.php b/classes/decision/Repository.inc.php new file mode 100644 index 00000000000..e3cf34abfba --- /dev/null +++ b/classes/decision/Repository.inc.php @@ -0,0 +1,487 @@ +dao = $dao; + $this->request = $request; + $this->schemaService = $schemaService; + } + + /** @copydoc DAO::newDataObject() */ + public function newDataObject(array $params = []): Decision + { + $object = $this->dao->newDataObject(); + if (!empty($params)) { + $object->setAllData($params); + } + return $object; + } + + /** @copydoc DAO::get() */ + public function get(int $id): ?Decision + { + return $this->dao->get($id); + } + + /** @copydoc DAO::getCount() */ + public function getCount(Collector $query): int + { + return $this->dao->getCount($query); + } + + /** @copydoc DAO::getIds() */ + public function getIds(Collector $query): Collection + { + return $this->dao->getIds($query); + } + + /** @copydoc DAO::getMany() */ + public function getMany(Collector $query): LazyCollection + { + return $this->dao->getMany($query); + } + + /** @copydoc DAO::getCollector() */ + public function getCollector(): Collector + { + return App::make(Collector::class); + } + + /** + * Get an instance of the map class for mapping + * decisions to their schema + */ + public function getSchemaMap(): maps\Schema + { + return app('maps')->withExtensions($this->schemaMap); + } + + /** + * Validate properties for a decision + * + * Perform validation checks on data used to add a decision. It is not + * possible to edit a decision. + * + * @param array $props A key/value array with the new data to validate + * @param Submission $submission The submission for this decision + * + * @return array A key/value array with validation errors. Empty if no errors + */ + public function validate(array $props, Type $type, Submission $submission, Context $context): array + { + AppLocale::requireComponents( + LOCALE_COMPONENT_PKP_EDITOR, + LOCALE_COMPONENT_APP_EDITOR + ); + + // Return early if no valid decision type exists + if (!isset($props['decision']) || $props['decision'] !== $type->getDecision()) { + return ['decision' => [__('editor.submission.workflowDecision.typeInvalid')]]; + } + + // Return early if an invalid submission ID is passed + if (!isset($props['submissionId']) || $props['submissionId'] !== $submission->getId()) { + return ['submissionId' => [__('editor.submission.workflowDecision.submissionInvalid')]]; + } + + $validator = ValidatorFactory::make( + $props, + $this->schemaService->getValidationRules($this->dao->schema, []), + ); + + // Check required + ValidatorFactory::required( + $validator, + null, + $this->schemaService->getRequiredProps($this->dao->schema), + $this->schemaService->getMultilingualProps($this->dao->schema), + [], + [] + ); + + $validator->after(function ($validator) use ($props, $type, $submission, $context) { + + // The decision stage id must match the decision type's stage id + // and the submission's current workflow stage + if ($props['stageId'] !== $type->getStageId() + || $props['stageId'] !== $submission->getData('stageId')) { + $validator->errors()->add('decision', __('editor.submission.workflowDecision.invalidStage')); + } + + // The editorId must match an existing editor + if (isset($props['editorId'])) { + $user = Repo::user()->get((int) $props['editorId']); + if (!$user) { + $validator->errors()->add('editorId', __('editor.submission.workflowDecision.invalidEditor')); + } + } + + // A recommendation can not be made if the submission does not + // have at least one assigned editor who can make a decision + if ($this->isRecommendation($type->getDecision())) { + /** @var StageAssignmentDAO $stageAssignmentDao */ + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); + $assignedEditorIds = $stageAssignmentDao->getDecidingEditorIds($submission->getId(), $type->getStageId()); + if (!$assignedEditorIds) { + $validator->errors()->add('decision', __('editor.submission.workflowDecision.requiredDecidingEditor')); + } + } + + // Validate the review round + if (isset($props['reviewRoundId'])) { + + // The decision must be taken during a review stage + if (!$type->isInReview() && !$validator->errors()->get('reviewRoundId')) { + $validator->errors()->add('reviewRoundId', __('editor.submission.workflowDecision.invalidReviewRoundStage')); + } + + // The review round must exist and be related to the correct submission. + if (!$validator->errors()->get('reviewRoundId')) { + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ + $reviewRound = $reviewRoundDao->getById($props['reviewRoundId']); + if (!$reviewRound) { + $validator->errors()->add('reviewRoundId', __('editor.submission.workflowDecision.invalidReviewRound')); + } elseif ($reviewRound->getSubmissionId() !== $submission->getId()) { + $validator->errors()->add('reviewRoundId', __('editor.submission.workflowDecision.invalidReviewRoundSubmission')); + } + } + } elseif ($type->isInReview()) { + $validator->errors()->add('reviewRoundId', __('editor.submission.workflowDecision.requiredReviewRound')); + } + + // Allow the decision type to add validation checks + $type->validate($props, $submission, $context, $validator, isset($reviewRound) ? $reviewRound->getId() : null); + }); + + $errors = []; + + if ($validator->fails()) { + $errors = $this->schemaService->formatValidationErrors($validator->errors()); + } + + HookRegistry::call('Decision::validate', [&$errors, $props]); + + return $errors; + } + + /** + * Record an editorial decision + */ + public function add(Decision $decision): int + { + // Actions are handled separately from the decision object + $actions = $decision->getData('actions') ?? []; + $decision->unsetData('actions'); + + // Set the review round automatically from the review round id + if ($decision->getData('reviewRoundId')) { + $decision->setData('round', $this->getRoundByReviewRoundId($decision->getData('reviewRoundId'))); + } + $decision->setData('dateDecided', Core::getCurrentDate()); + $id = $this->dao->insert($decision); + HookRegistry::call('Decision::add', [$decision]); + + $decision = $this->get($id); + + $type = $decision->getType(); + $submission = Repo::submission()->get($decision->getData('submissionId')); + $editor = Repo::user()->get($decision->getData('editorId')); + $decision = $this->get($decision->getId()); + $context = Application::get()->getRequest()->getContext(); + if (!$context || $context->getId() !== $submission->getData('contextId')) { + $context = Services::get('context')->get($submission->getData('contextId')); + } + + // Log the decision + AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_SUBMISSION); + SubmissionLog::logEvent( + $this->request, + $submission, + $this->isRecommendation($type->getDecision()) + ? PKPSubmissionEventLogEntry::SUBMISSION_LOG_EDITOR_RECOMMENDATION + : PKPSubmissionEventLogEntry::SUBMISSION_LOG_EDITOR_DECISION, + $type->getLog(), + [ + 'editorId' => $editor->getId(), + 'editorName' => $editor->getFullName(), + 'submissionId' => $decision->getData('submissionId'), + 'decision' => $type->getDecision(), + ] + ); + + // Allow the decision type to perform additional actions + $type->callback($decision, $submission, $editor, $context, $actions); + + try { + event(new DecisionAdded( + $decision, + $type, + $submission, + $editor, + $context, + $actions + )); + } catch (Exception $e) { + error_log($e->getMessage()); + error_log($e->getTraceAsString()); + } + + $this->updateNotifications($decision, $type, $submission); + + return $id; + } + + /** + * Delete all decisions by the submission ID + */ + public function deleteBySubmissionId(int $submissionId) + { + $decisionIds = $this->getIds( + $this->getCollector() + ->filterBySubmissionIds([$submissionId]) + ); + foreach ($decisionIds as $decisionId) { + $this->dao->deleteById($decisionId); + } + } + + /** + * Get a decision type by the DECISION::* constant + */ + public function getType(int $decision): ?Type + { + return $this->getTypes()->first(function (Type $type) use ($decision) { + return $type->getDecision() === $decision; + }); + } + + /** + * Find the most recent revisions decision that is still active. An active + * decision is one that is not overriden by any other decision. + */ + public function getActivePendingRevisionsDecision(int $submissionId, int $stageId, int $decision = Decision::PENDING_REVISIONS): ?Decision + { + $postReviewDecisions = [Decision::SEND_TO_PRODUCTION]; + $revisionDecisions = [Decision::PENDING_REVISIONS, Decision::RESUBMIT]; + if (!in_array($decision, $revisionDecisions)) { + return null; + } + + $revisionsDecisions = $this->getMany( + $this->getCollector() + ->filterBySubmissionIds([$submissionId]) + ); + // Most recent decision first + $revisionsDecisions = $revisionsDecisions->reverse(); + + $pendingRevisionDecision = null; + foreach ($revisionsDecisions as $revisionDecision) { + if (in_array($revisionDecision->getData('decision'), $postReviewDecisions)) { + // Decisions at later stages do not override the pending revisions one. + continue; + } elseif ($revisionDecision->getData('decision') == $decision) { + if ($revisionDecision->getData('stageId') == $stageId) { + $pendingRevisionDecision = $revisionDecision; + // Only the last pending revisions decision is relevant. + break; + } else { + // Both internal and external pending revisions decisions are + // valid at the same time. Continue to search. + continue; + } + } else { + break; + } + } + + + return $pendingRevisionDecision; + } + + /** + * Have any submission files been uploaded to the revision file stage since + * this decision was taken? + */ + public function revisionsUploadedSinceDecision(Decision $decision, int $submissionId): bool + { + $stageId = $decision->getData('stageId'); + $round = $decision->getData('round'); + $sentRevisions = false; + + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ + $reviewRound = $reviewRoundDao->getReviewRound($submissionId, $stageId, $round); + + $submissionFileCollector = Repo::submissionFile() + ->getCollector() + ->filterByReviewRoundIds([$reviewRound->getId()]) + ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_REVIEW_REVISION]); + + $submissionFiles = Repo::submissionFile()->getMany($submissionFileCollector); + + foreach ($submissionFiles as $submissionFile) { + if ($submissionFile->getData('updatedAt') > $decision->getData('dateDecided')) { + $sentRevisions = true; + break; + } + } + + return $sentRevisions; + + return true; + } + + /** + * Get a list of all the decision types available + * + * @return Collection + */ + abstract public function getTypes(): Collection; + + /** + * Is the given decision a recommendation? + */ + public function isRecommendation(int $decision): bool + { + return in_array($decision, [ + Decision::RECOMMEND_ACCEPT, + Decision::RECOMMEND_DECLINE, + Decision::RECOMMEND_PENDING_REVISIONS, + Decision::RECOMMEND_RESUBMIT, + ]); + } + + protected function getRoundByReviewRoundId(int $reviewRoundId): int + { + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ + $reviewRound = $reviewRoundDao->getById($reviewRoundId); + return $reviewRound->getData('round'); + } + + /** + * Update notifications controlled by the NotificationManager + */ + protected function updateNotifications(Decision $decision, Type $type, Submission $submission) + { + $notificationMgr = new NotificationManager(); + + // Update editor decision and pending revisions notifications. + $notificationTypes = $this->getReviewNotificationTypes(); + if ($editorDecisionNotificationType = $notificationMgr->getNotificationTypeByEditorDecision($decision)) { + array_unshift($notificationTypes, $editorDecisionNotificationType); + } + + $authorIds = []; + /** @var StageAssignmentDAO $stageAssignmentDao */ + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); + $result = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), Role::ROLE_ID_AUTHOR, $type->getStageId()); + /** @var StageAssignment $stageAssignment */ + while ($stageAssignment = $result->next()) { + $authorIds[] = (int) $stageAssignment->getUserId(); + } + + $notificationMgr->updateNotification( + Application::get()->getRequest(), + $notificationTypes, + $authorIds, + Application::ASSOC_TYPE_SUBMISSION, + $submission->getId() + ); + + // Update submission notifications + $submissionNotificationTypes = $this->getSubmissionNotificationTypes($decision); + if (count($submissionNotificationTypes)) { + $notificationMgr->updateNotification( + Application::get()->getRequest(), + $submissionNotificationTypes, + null, + Application::ASSOC_TYPE_SUBMISSION, + $submission->getId() + ); + } + } + + /** + * Get the notification types related to a review stage + * + * @return int[] One or more of the Notification::NOTIFICATION_TYPE_ constants + */ + abstract protected function getReviewNotificationTypes(): array; + + /** + * Get additional notifications to be updated on a submission + * + * @return int[] One or more of the Notification::NOTIFICATION_TYPE_ constants + */ + protected function getSubmissionNotificationTypes(Decision $decision): array + { + switch ($decision->getData('decision')) { + case Decision::ACCEPT: + return [ + Notification::NOTIFICATION_TYPE_ASSIGN_COPYEDITOR, + Notification::NOTIFICATION_TYPE_AWAITING_COPYEDITS + ]; + case Decision::SEND_TO_PRODUCTION: + return [ + Notification::NOTIFICATION_TYPE_ASSIGN_COPYEDITOR, + Notification::NOTIFICATION_TYPE_AWAITING_COPYEDITS, + Notification::NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER, + Notification::NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS, + ]; + } + return []; + } +} diff --git a/classes/decision/Step.inc.php b/classes/decision/Step.inc.php new file mode 100644 index 00000000000..e66af782d12 --- /dev/null +++ b/classes/decision/Step.inc.php @@ -0,0 +1,51 @@ +id = $id; + $this->name = $name; + $this->description = $description; + } + + /** + * Compile initial state data to pass to the frontend + */ + public function getState(): stdClass + { + $config = new stdClass(); + $config->id = $this->id; + $config->type = $this->type; + $config->name = $this->name; + $config->description = $this->description; + $config->errors = new stdClass(); + + return $config; + } +} diff --git a/classes/decision/Type.inc.php b/classes/decision/Type.inc.php new file mode 100644 index 00000000000..2494e0f1558 --- /dev/null +++ b/classes/decision/Type.inc.php @@ -0,0 +1,523 @@ + $this->getDecision(), + ]; + if ($this->isInReview()) { + if (!$reviewRoundId) { + throw new Exception('Can not get URL to the ' . get_class($this) . ' decision without a review round id.'); + } + $args['reviewRoundId'] = $reviewRoundId; + } + return $request->getDispatcher()->url( + $request, + Application::ROUTE_PAGE, + $context, + 'decision', + 'record', + $submission->getId(), + $args + ); + } + + /** + * Is this decision in a review workflow stage? + */ + public function isInReview(): bool + { + return in_array( + $this->getStageId(), + [ + WORKFLOW_STAGE_ID_INTERNAL_REVIEW, + WORKFLOW_STAGE_ID_EXTERNAL_REVIEW + ] + ); + } + + /** + * Validate this decision + * + * The default decision properties will already be validated. Use + * this method to validate data for this decision's actions, or + * to apply any additional restrictions for this decision. + */ + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + // No validation checks are performed by default + } + + /** + * A callback method that is fired when a decision + * of this type is recorded + * + * @see Repository::add() + * + * @param array $actions Actions handled by the decision type + */ + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + if ($this->getNewStatus()) { + Repo::submission()->updateStatus($submission, $this->getNewStatus()); + } + + if ($this->getNewStageId()) { + $submission->setData('stageId', $this->getNewStageId()); + Repo::submission()->dao->update($submission); + + // Create a new review round if there is not an existing round + // when promoting to a review stage, or reset the review round + // status if one already exists + if (in_array($this->getNewStageId(), [WORKFLOW_STAGE_ID_INTERNAL_REVIEW, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW])) { + /** @var ReviewRoundDAO $reviewRoundDao */ + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); + $reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $this->getNewStageId()); + if (!is_a($reviewRound, ReviewRound::class)) { + $this->createReviewRound($submission, $this->getNewStageId(), 1); + } else { + $reviewRoundDao->updateStatus($reviewRound, null); + } + } + } + + // Change review round status when a decision is taken in a review stage + if ($reviewRoundId = $decision->getData('reviewRoundId')) { + /** @var ReviewRoundDAO $reviewRoundDao */ + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); + $reviewRound = $reviewRoundDao->getById($reviewRoundId); + if (is_a($reviewRound, ReviewRound::class)) { + // If the decision type doesn't specify a review round status, recalculate + // it from scratch. In order to do this, we unset the ReviewRound's status + // so the DAO will determine the new status + if (is_null($this->getNewReviewRoundStatus())) { + $reviewRound->setData('status', null); + } + $reviewRoundDao->updateStatus($reviewRound, $this->getNewReviewRoundStatus()); + } + } + } + + /** + * Get the workflow for this decision type + * + * Returns null if this decision type does not use a workflow. + * In such cases the decision can be recorded but does not make + * use of the built-in UI for making the decision + */ + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): ?Workflow + { + return null; + } + + /** + * Get the assigned authors + */ + protected function getAssignedAuthorIds(Submission $submission): array + { + $userIds = []; + /** @var StageAssignmentDAO $stageAssignmentDao */ + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); + $result = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), Role::ROLE_ID_AUTHOR, $this->getStageId()); + /** @var StageAssignment $stageAssignment */ + while ($stageAssignment = $result->next()) { + $userIds[] = (int) $stageAssignment->getUserId(); + } + return $userIds; + } + + /** + * Validate the properties of an email action + * + * @return array Empty if no errors + */ + protected function validateEmailAction(array $emailAction, Submission $submission, array $allowedAttachmentFileStages = []): array + { + $schema = (object) [ + 'attachments' => (object) [ + 'type' => 'array', + 'items' => (object) [ + 'type' => 'object', + ], + ], + 'bcc' => (object) [ + 'type' => 'array', + 'items' => (object) [ + 'type' => 'string', + 'validation' => [ + 'email_or_localhost', + ], + ], + ], + 'body' => (object) [ + 'type' => 'string', + 'validation' => [ + 'required', + ], + ], + 'cc' => (object) [ + 'type' => 'array', + 'items' => (object) [ + 'type' => 'string', + 'validation' => [ + 'email_or_localhost', + ], + ], + ], + 'id' => (object) [ + 'type' => 'string', + 'validation' => [ + 'alpha', + 'required', + ], + ], + 'subject' => (object) [ + 'type' => 'string', + 'validation' => [ + 'required', + ], + ], + 'to' => (object) [ + 'type' => 'array', + 'items' => (object) [ + 'type' => 'integer', + ], + ], + ]; + + $schemaService = App::make(PKPSchemaService::class); + $rules = []; + foreach ($schema as $propName => $propSchema) { + $rules = $schemaService->addPropValidationRules($rules, $propName, $propSchema); + } + + $validator = ValidatorFactory::make( + $emailAction, + $rules, + ); + + if (isset($emailAction['attachments'])) { + $validator->after(function ($validator) use ($emailAction, $submission, $allowedAttachmentFileStages) { + if ($validator->errors()->get('attachments')) { + return; + } + foreach ($emailAction['attachments'] as $attachment) { + $errorMessage = __('email.attachmentNotFound', ['fileName' => $attachment['name'] ?? '']); + if (isset($attachment['temporaryFileId'])) { + $uploaderId = Application::get()->getRequest()->getUser()->getId(); + if (!$this->validateTemporaryFileAttachment($attachment['temporaryFileId'], $uploaderId)) { + $validator->errors()->add('attachments', $errorMessage); + } + } elseif (isset($attachment['submissionFileId'])) { + if (!$this->validateSubmissionFileAttachment((int) $attachment['submissionFileId'], $submission, $allowedAttachmentFileStages)) { + $validator->errors()->add('attachments', $errorMessage); + } + } elseif (isset($attachment['libraryFileId'])) { + if (!$this->validateLibraryAttachment($attachment['libraryFileId'], $submission)) { + $validator->errors()->add('attachments', $errorMessage); + } + } else { + $validator->errors()->add('attachments', $errorMessage); + } + } + }); + } + + $errors = []; + + if ($validator->fails()) { + $errors = $schemaService->formatValidationErrors($validator->errors()); + } + + return $errors; + } + + /** + * Validate a file attachment that has been uploaded by the user + */ + protected function validateTemporaryFileAttachment(string $temporaryFileId, int $uploaderId): bool + { + $temporaryFileManager = new TemporaryFileManager(); + return (bool) $temporaryFileManager->getFile($temporaryFileId, $uploaderId); + } + + /** + * Validate a file attachment from a submission file + * + * @param array $allowedFileStages SubmissionFile::SUBMISSION_FILE_* + */ + protected function validateSubmissionFileAttachment(int $submissionFileId, Submission $submission, array $allowedFileStages): bool + { + $submissionFile = Repo::submissionFile()->get($submissionFileId); + return $submissionFile + && $submissionFile->getData('submissionId') === $submission->getId() + && in_array($submissionFile->getData('fileStage'), $allowedFileStages); + } + + /** + * Validate a file attachment from a library file + */ + protected function validateLibraryAttachment(int $libraryFileId, Submission $submission): bool + { + /** @var LibraryFileDAO $libraryFileDao */ + $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); + $file = $libraryFileDao->getById($libraryFileId, $submission->getData('contextId')); + + if (!$file) { + return false; + } + + return !$file->getSubmissionId() || $file->getSubmissionId() === $submission->getId(); + } + + /** + * Set an error message for invalid recipients + * + * @param array $invalidRecipientIds + */ + protected function setRecipientError(string $actionErrorKey, array $invalidRecipientIds, Validator $validator) + { + $names = array_map(function ($userId) { + $user = Repo::user()->get((int) $userId); + return $user ? $user->getFullName() : $userId; + }, $invalidRecipientIds); + $validator->errors()->add( + $actionErrorKey . '.to', + __( + 'editor.submission.workflowDecision.invalidRecipients', + ['names' => join(__('common.commaListSeparator'), $names)] + ) + ); + } + + /** + * Create a fake decision object as if a decision of this + * type was recorded + * + * This decision object can be passed to a Mailable in order to + * prepare data for email templates. The decision is not saved + * to the database and has no `id` property. + */ + protected function getFakeDecision(Submission $submission, User $editor, ?ReviewRound $reviewRound = null): Decision + { + return Repo::decision()->newDataObject([ + 'dateDecided' => Core::getCurrentDate(), + 'decision' => $this->getDecision(), + 'editorId' => $editor->getId(), + 'reviewRoundId' => $reviewRound ? $reviewRound->getId() : null, + 'round' => $reviewRound ? $reviewRound->getRound() : null, + 'stageId' => $this->getStageId(), + 'submissionId' => $submission->getId(), + ]); + } + + /** + * Convert a decision action to EmailData + */ + protected function getEmailDataFromAction(array $action): EmailData + { + return new EmailData($action); + } + + /** + * Get a Mailable from a decision's action data + * + * Sets the sender, subject, body and attachments. + * + * Does NOT set the recipients. + */ + protected function addEmailDataToMailable(Mailable $mailable, User $sender, EmailData $email): Mailable + { + $mailable + ->sender($sender) + ->bcc($email->bcc) + ->cc($email->cc) + ->subject($email->subject) + ->body($email->body); + + if (!empty($email->attachments)) { + foreach ($email->attachments as $attachment) { + if (isset($attachment[Mailable::ATTACHMENT_TEMPORARY_FILE])) { + $mailable->attachTemporaryFile( + $attachment[Mailable::ATTACHMENT_TEMPORARY_FILE], + $attachment['name'], + $sender->getId() + ); + } elseif (isset($attachment[Mailable::ATTACHMENT_SUBMISSION_FILE])) { + $mailable->attachSubmissionFile( + $attachment[Mailable::ATTACHMENT_SUBMISSION_FILE], + $attachment['name'] + ); + } elseif (isset($attachment[Mailable::ATTACHMENT_LIBRARY_FILE])) { + $mailable->attachLibraryFile( + $attachment[Mailable::ATTACHMENT_LIBRARY_FILE], + $attachment['name'] + ); + } + } + } + + return $mailable; + } + + /** + * Create a review round in a review stage + */ + protected function createReviewRound(Submission $submission, int $stageId, ?int $round = 1) + { + /** @var ReviewRoundDAO $reviewRoundDao */ + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); + + $reviewRound = $reviewRoundDao->build( + $submission->getId(), + $stageId, + $round, + ReviewRound::REVIEW_ROUND_STATUS_PENDING_REVIEWERS + ); + + // Create review round status notification + /** @var NotificationDAO $notificationDao */ + $notificationDao = DAORegistry::getDAO('NotificationDAO'); + $notificationFactory = $notificationDao->getByAssoc( + Application::ASSOC_TYPE_REVIEW_ROUND, + $reviewRound->getId(), + null, + Notification::NOTIFICATION_TYPE_REVIEW_ROUND_STATUS, + $submission->getData('contextId') + ); + if (!$notificationFactory->next()) { + $notificationMgr = new NotificationManager(); + $notificationMgr->createNotification( + Application::get()->getRequest(), + null, + Notification::NOTIFICATION_TYPE_REVIEW_ROUND_STATUS, + $submission->getData('contextId'), + Application::ASSOC_TYPE_REVIEW_ROUND, + $reviewRound->getId(), + Notification::NOTIFICATION_LEVEL_NORMAL + ); + } + } + + /** + * Helper method to get the file genres for a context + */ + protected function getFileGenres(int $contextId): array + { + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + return $genreDao->getByContextId($contextId)->toArray(); + } +} diff --git a/classes/decision/Workflow.inc.php b/classes/decision/Workflow.inc.php new file mode 100644 index 00000000000..e42a98180dc --- /dev/null +++ b/classes/decision/Workflow.inc.php @@ -0,0 +1,125 @@ +decisionType = $decisionType; + $this->submission = $submission; + $this->context = $context; + if ($reviewRound) { + $this->reviewRound = $reviewRound; + } + } + + /** + * Add a step to the workflow + */ + public function addStep(Step $step) + { + $this->steps[$step->id] = $step; + } + + /** + * Compile initial state data to pass to the frontend + * + * @see DecisionPage.vue + */ + public function getState(): array + { + $state = []; + foreach ($this->steps as $step) { + $state[] = $step->getState(); + } + return $state; + } + + /** + * Get all users assigned to a role in this decision's stage + * + * @param integer $roleId + * + * @return array + */ + public function getStageParticipants(int $roleId): array + { + /** @var StageAssignmentDAO $stageAssignmentDao */ + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); + $userIds = []; + $result = $stageAssignmentDao->getBySubmissionAndRoleId( + $this->submission->getId(), + $roleId, + $this->decisionType->getStageId() + ); + /** @var StageAssignment $stageAssignment */ + while ($stageAssignment = $result->next()) { + $userIds[] = (int) $stageAssignment->getUserId(); + } + $users = []; + foreach (array_unique($userIds) as $authorUserId) { + $users[] = Repo::user()->get($authorUserId); + } + + return $users; + } + + /** + * Get all reviewers who completed a review in this decision's stage + * + * @param array $reviewAssignments + * + * @return array + */ + public function getReviewersFromAssignments(array $reviewAssignments): array + { + $reviewers = []; + foreach ($reviewAssignments as $reviewAssignment) { + $reviewers[] = Repo::user()->get((int) $reviewAssignment->getReviewerId()); + } + return $reviewers; + } + + /** + * Get all assigned editors who can make a decision in this stage + */ + public function getDecidingEditors(): array + { + /** @var StageAssignmentDAO $stageAssignmentDao */ + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); + $userIds = $stageAssignmentDao->getDecidingEditorIds($this->submission->getId(), $this->decisionType->getStageId()); + $users = []; + foreach (array_unique($userIds) as $authorUserId) { + $users[] = Repo::user()->get($authorUserId); + } + + return $users; + } +} diff --git a/classes/decision/maps/Schema.inc.php b/classes/decision/maps/Schema.inc.php new file mode 100644 index 00000000000..3a8344c3e18 --- /dev/null +++ b/classes/decision/maps/Schema.inc.php @@ -0,0 +1,70 @@ +mapByProperties($this->getProps(), $item); + } + + /** + * Map a collection of Decisions + * + * @see self::map + */ + public function mapMany(Enumerable $collection): Enumerable + { + $this->collection = $collection; + return $collection->map(function ($item) { + return $this->map($item); + }); + } + + /** + * Map schema properties of a Decision to an assoc array + */ + protected function mapByProperties(array $props, Decision $item): array + { + $output = []; + foreach ($props as $prop) { + switch ($prop) { + case '_href': + $output[$prop] = $this->getApiUrl('submissions/' . $item->getData('submissionId') . '/decisions/' . $item->getId()); + break; + default: + $output[$prop] = $item->getData($prop); + break; + } + } + + ksort($output); + + return $this->withExtensions($output, $item); + } +} diff --git a/classes/decision/steps/Email.inc.php b/classes/decision/steps/Email.inc.php new file mode 100644 index 00000000000..31618a2f5ef --- /dev/null +++ b/classes/decision/steps/Email.inc.php @@ -0,0 +1,129 @@ + */ + public array $attachers; + public bool $canChangeTo = false; + public bool $canSkip = true; + public array $locales; + public Mailable $mailable; + /** @var array */ + public array $recipients; + public string $type = 'email'; + + /** + * @param array $recipients One or more User objects who are the recipients of this email + * @param Mailable $mailable The mailable that will be used to send this email + * @param array + */ + public function __construct(string $id, string $name, string $description, array $recipients, Mailable $mailable, array $locales, ?array $attachers = []) + { + parent::__construct($id, $name, $description); + $this->attachers = $attachers; + $this->locales = $locales; + $this->mailable = $mailable; + $this->recipients = $recipients; + } + + /** + * Can the editor change the recipients of this email + */ + public function canChangeTo(bool $value): self + { + $this->canChangeTo = $value; + return $this; + } + + /** + * Can the editor skip this email + */ + public function canSkip(bool $value): self + { + $this->canSkip = $value; + return $this; + } + + public function getState(): stdClass + { + $config = parent::getState(); + $config->attachers = $this->getAttachers(); + $config->canChangeTo = $this->canChangeTo; + $config->canSkip = $this->canSkip; + $config->emailTemplates = $this->getEmailTemplates(); + $config->initialTemplateKey = $this->mailable::getEmailTemplateKey(); + $config->toOptions = $this->getToOptions(); + + $config->variables = []; + $config->locales = []; + $allLocales = AppLocale::getAllLocales(); + foreach ($this->locales as $locale) { + $config->variables[$locale] = $this->mailable->getData($locale); + $config->locales[] = [ + 'locale' => $locale, + 'name' => $allLocales[$locale], + ]; + } + + return $config; + } + + protected function getToOptions(): array + { + $toOptions = []; + foreach ($this->recipients as $user) { + $toOptions[] = [ + 'value' => $user->getId(), + 'label' => $user->getFullName(), + ]; + } + return $toOptions; + } + + protected function getEmailTemplates(): array + { + $request = Application::get()->getRequest(); + $context = $request->getContext(); + + $emailTemplates = collect(); + if ($this->mailable::getEmailTemplateKey()) { + $emailTemplate = Repo::emailTemplate()->getByKey($context->getId(), $this->mailable::getEmailTemplateKey()); + if ($emailTemplate) { + $emailTemplates->add($emailTemplate); + } + } + + return Repo::emailTemplate()->getSchemaMap()->mapMany($emailTemplates)->toArray(); + } + + protected function getAttachers(): array + { + $attachers = []; + foreach ($this->attachers as $attacher) { + $attachers[] = $attacher->getState(); + } + return $attachers; + } +} diff --git a/classes/decision/steps/Form.inc.php b/classes/decision/steps/Form.inc.php new file mode 100644 index 00000000000..a00332c7234 --- /dev/null +++ b/classes/decision/steps/Form.inc.php @@ -0,0 +1,46 @@ +form = $form; + } + + public function getState(): stdClass + { + $config = parent::getState(); + $config->form = $this->form->getConfig(); + + // Decision forms shouldn't have submit buttons + // because the step-by-step decision wizard includes + // next/previous buttons + unset($config->form['pages'][0]['submitButton']); + + return $config; + } +} diff --git a/classes/decision/steps/PromoteFiles.inc.php b/classes/decision/steps/PromoteFiles.inc.php new file mode 100644 index 00000000000..d4a19f56ad4 --- /dev/null +++ b/classes/decision/steps/PromoteFiles.inc.php @@ -0,0 +1,73 @@ +submission = $submission; + $this->to = $to; + + $this->genres = $genres; + } + + /** + * Add a list of files that can be copied to the next stage + */ + public function addFileList(string $name, Collector $collector): self + { + $files = Repo::submissionFile() + ->getSchemaMap() + ->summarizeMany(Repo::submissionFile()->getMany($collector), $this->genres); + + $this->lists[] = [ + 'name' => $name, + 'files' => $files->values(), + ]; + + return $this; + } + + public function getState(): stdClass + { + $config = parent::getState(); + $config->to = $this->to; + $config->selected = []; + $config->lists = $this->lists; + + return $config; + } +} diff --git a/classes/decision/types/Accept.inc.php b/classes/decision/types/Accept.inc.php new file mode 100644 index 00000000000..5f87046c7a3 --- /dev/null +++ b/classes/decision/types/Accept.inc.php @@ -0,0 +1,209 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + // If there is no review round id, a validation error will already have been set + if (!$reviewRoundId) { + return; + } + + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_PAYMENT: + $this->validatePaymentAction($action, $actionErrorKey, $validator, $context); + break; + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + case $this->ACTION_NOTIFY_REVIEWERS: + $this->validateNotifyReviewersAction($action, $actionErrorKey, $validator, $submission, $reviewRoundId); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case self::ACTION_PAYMENT: + $this->requestPayment($submission, $editor, $context); + break; + case $this->ACTION_NOTIFY_AUTHORS: + $reviewAssignments = $this->getCompletedReviewAssignments($submission->getId(), $decision->getData('reviewRoundId')); + $emailData = $this->getEmailDataFromAction($action); + $this->sendAuthorEmail( + new DecisionAcceptNotifyAuthor($context, $submission, $decision, $reviewAssignments), + $emailData, + $editor, + $submission, + $context + ); + $this->shareReviewAttachmentFiles($emailData->attachments, $submission, $decision->getData('reviewRoundId')); + break; + case $this->ACTION_NOTIFY_REVIEWERS: + $this->sendReviewersEmail( + new DecisionNotifyReviewer($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context, $reviewRound); + + $fakeDecision = $this->getFakeDecision($submission, $editor, $reviewRound); + $fileAttachers = $this->getFileAttachers($submission, $context, $reviewRound); + $reviewAssignments = $this->getCompletedReviewAssignments($submission->getId(), $reviewRound->getId()); + + // Request payment if configured + $paymentManager = Application::getPaymentManager($context); + if ($paymentManager->publicationEnabled()) { + $workflow->addStep($this->getPaymentForm($context)); + } + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionAcceptNotifyAuthor($context, $submission, $fakeDecision, $reviewAssignments); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.accept.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + if (count($reviewAssignments)) { + $reviewers = $workflow->getReviewersFromAssignments($reviewAssignments); + $mailable = new DecisionNotifyReviewer($context, $submission, $fakeDecision); + $workflow->addStep((new Email( + $this->ACTION_NOTIFY_REVIEWERS, + __('editor.submission.decision.notifyReviewers'), + __('editor.submission.decision.notifyReviewers.description'), + $reviewers, + $mailable->sender($editor), + $context->getSupportedFormLocales(), + $fileAttachers + ))->canChangeTo(true)); + } + + $workflow->addStep((new PromoteFiles( + 'promoteFilesToCopyediting', + __('editor.submission.selectFiles'), + __('editor.submission.decision.promoteFiles.copyediting'), + SubmissionFile::SUBMISSION_FILE_FINAL, + $submission, + $this->getFileGenres($context->getId()) + ))->addFileList( + __('editor.submission.revisions'), + Repo::submissionFile() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_REVIEW_REVISION]) + ->filterByReviewRoundIds([$reviewRound->getId()]) + )); + + return $workflow; + } +} diff --git a/classes/decision/types/BackToCopyediting.inc.php b/classes/decision/types/BackToCopyediting.inc.php new file mode 100644 index 00000000000..6a523a1ae39 --- /dev/null +++ b/classes/decision/types/BackToCopyediting.inc.php @@ -0,0 +1,192 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionBackToCopyeditingNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context); + + $fakeDecision = $this->getFakeDecision($submission, $editor); + $fileAttachers = $this->getFileAttachers($submission, $context); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionBackToCopyeditingNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.backToCopyediting.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + return $workflow; + } + + /** + * Get the submission file stages that are permitted to be attached to emails + * sent in this decision + * + * @return array + */ + protected function getAllowedAttachmentFileStages(): array + { + return [ + SubmissionFile::SUBMISSION_FILE_PRODUCTION_READY, + ]; + } + + /** + * Get the file attacher components supported for emails in this decision + */ + protected function getFileAttachers(Submission $submission, Context $context): array + { + $attachers = [ + new Upload( + $context, + __('common.upload.addFile'), + __('common.upload.addFile.description'), + __('common.upload.addFile') + ), + ]; + + $attachers[] = (new FileStage( + $context, + $submission, + __('submission.submit.submissionFiles'), + __('email.addAttachment.submissionFiles.submissionDescription'), + __('email.addAttachment.submissionFiles.attach') + )) + ->withFileStage( + SubmissionFile::SUBMISSION_FILE_PRODUCTION_READY, + __('editor.submission.production.productionReadyFiles') + ); + + $attachers[] = new Library( + $context, + $submission + ); + + return $attachers; + } +} diff --git a/classes/decision/types/BackToReview.inc.php b/classes/decision/types/BackToReview.inc.php new file mode 100644 index 00000000000..9bc9dca8e6f --- /dev/null +++ b/classes/decision/types/BackToReview.inc.php @@ -0,0 +1,192 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionBackToReviewNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context); + + $fakeDecision = $this->getFakeDecision($submission, $editor); + $fileAttachers = $this->getFileAttachers($submission, $context); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionBackToReviewNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.backToReview.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + return $workflow; + } + + /** + * Get the submission file stages that are permitted to be attached to emails + * sent in this decision + * + * @return array + */ + protected function getAllowedAttachmentFileStages(): array + { + return [ + SubmissionFile::SUBMISSION_FILE_FINAL, + ]; + } + + /** + * Get the file attacher components supported for emails in this decision + */ + protected function getFileAttachers(Submission $submission, Context $context): array + { + $attachers = [ + new Upload( + $context, + __('common.upload.addFile'), + __('common.upload.addFile.description'), + __('common.upload.addFile') + ), + ]; + + $attachers[] = (new FileStage( + $context, + $submission, + __('submission.submit.submissionFiles'), + __('email.addAttachment.submissionFiles.submissionDescription'), + __('email.addAttachment.submissionFiles.attach') + )) + ->withFileStage( + SubmissionFile::SUBMISSION_FILE_FINAL, + __('submission.finalDraft') + ); + + $attachers[] = new Library( + $context, + $submission + ); + + return $attachers; + } +} diff --git a/classes/decision/types/BackToSubmissionFromCopyediting.inc.php b/classes/decision/types/BackToSubmissionFromCopyediting.inc.php new file mode 100644 index 00000000000..b623a6d182b --- /dev/null +++ b/classes/decision/types/BackToSubmissionFromCopyediting.inc.php @@ -0,0 +1,192 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionBackToSubmissionNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context); + + $fakeDecision = $this->getFakeDecision($submission, $editor); + $fileAttachers = $this->getFileAttachers($submission, $context); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionBackToSubmissionNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.backToSubmission.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + return $workflow; + } + + /** + * Get the submission file stages that are permitted to be attached to emails + * sent in this decision + * + * @return array + */ + protected function getAllowedAttachmentFileStages(): array + { + return [ + SubmissionFile::SUBMISSION_FILE_FINAL + ]; + } + + /** + * Get the file attacher components supported for emails in this decision + */ + protected function getFileAttachers(Submission $submission, Context $context): array + { + $attachers = [ + new Upload( + $context, + __('common.upload.addFile'), + __('common.upload.addFile.description'), + __('common.upload.addFile') + ), + ]; + + $attachers[] = (new FileStage( + $context, + $submission, + __('submission.submit.submissionFiles'), + __('email.addAttachment.submissionFiles.submissionDescription'), + __('email.addAttachment.submissionFiles.attach') + )) + ->withFileStage( + SubmissionFile::SUBMISSION_FILE_FINAL, + __('submission.finalDraft') + ); + + $attachers[] = new Library( + $context, + $submission + ); + + return $attachers; + } +} diff --git a/classes/decision/types/Decline.inc.php b/classes/decision/types/Decline.inc.php new file mode 100644 index 00000000000..c6edb003577 --- /dev/null +++ b/classes/decision/types/Decline.inc.php @@ -0,0 +1,175 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + // If there is no review round id, a validation error will already have been set + if (!$reviewRoundId) { + return; + } + + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + case $this->ACTION_NOTIFY_REVIEWERS: + $this->validateNotifyReviewersAction($action, $actionErrorKey, $validator, $submission, $reviewRoundId); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $reviewAssignments = $this->getCompletedReviewAssignments($submission->getId(), $decision->getData('reviewRoundId')); + $emailData = $this->getEmailDataFromAction($action); + $this->sendAuthorEmail( + new DecisionDeclineNotifyAuthor($context, $submission, $decision, $reviewAssignments), + $emailData, + $editor, + $submission, + $context + ); + $this->shareReviewAttachmentFiles($emailData->attachments, $submission, $decision->getData('reviewRoundId')); + break; + case $this->ACTION_NOTIFY_REVIEWERS: + $this->sendReviewersEmail( + new DecisionNotifyReviewer($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context, $reviewRound); + + $fakeDecision = $this->getFakeDecision($submission, $editor, $reviewRound); + $fileAttachers = $this->getFileAttachers($submission, $context, $reviewRound); + $reviewAssignments = $this->getCompletedReviewAssignments($submission->getId(), $reviewRound->getId()); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionDeclineNotifyAuthor($context, $submission, $fakeDecision, $reviewAssignments); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.decline.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + if (count($reviewAssignments)) { + $reviewers = $workflow->getReviewersFromAssignments($reviewAssignments); + $mailable = new DecisionNotifyReviewer($context, $submission, $fakeDecision); + $workflow->addStep((new Email( + $this->ACTION_NOTIFY_REVIEWERS, + __('editor.submission.decision.notifyReviewers'), + __('editor.submission.decision.notifyReviewers.description'), + $reviewers, + $mailable->sender($editor), + $context->getSupportedFormLocales(), + $fileAttachers + ))->canChangeTo(true)); + } + + return $workflow; + } +} diff --git a/classes/decision/types/InitialDecline.inc.php b/classes/decision/types/InitialDecline.inc.php new file mode 100644 index 00000000000..36aa76e05b9 --- /dev/null +++ b/classes/decision/types/InitialDecline.inc.php @@ -0,0 +1,138 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionInitialDeclineNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context); + + $fakeDecision = $this->getFakeDecision($submission, $editor); + $fileAttachers = $this->getFileAttachers($submission, $context); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionInitialDeclineNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.decline.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + return $workflow; + } +} diff --git a/classes/decision/types/NewExternalReviewRound.inc.php b/classes/decision/types/NewExternalReviewRound.inc.php new file mode 100644 index 00000000000..a1b3bed69c3 --- /dev/null +++ b/classes/decision/types/NewExternalReviewRound.inc.php @@ -0,0 +1,170 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + // If there is no review round id, a validation error will already have been set + if (!$reviewRoundId) { + return; + } + + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + /** @var ReviewRoundDAO $reviewRoundDao */ + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); + /** @var ReviewRound $reviewRound */ + $reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $this->getNewStageId()); + $this->createReviewRound($submission, $this->getStageId(), $reviewRound->getRound() + 1); + + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionNewReviewRoundNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context, $reviewRound); + + $fakeDecision = $this->getFakeDecision($submission, $editor, $reviewRound); + $fileAttachers = $this->getFileAttachers($submission, $context, $reviewRound); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionNewReviewRoundNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.newReviewRound.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + $workflow->addStep((new PromoteFiles( + 'promoteFilesToReviewRound', + __('editor.submission.selectFiles'), + __('editor.submission.decision.promoteFiles.review'), + SubmissionFile::SUBMISSION_FILE_REVIEW_FILE, + $submission, + $this->getFileGenres($context->getId()) + ))->addFileList( + __('editor.submission.revisions'), + Repo::submissionFile() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_REVIEW_REVISION]) + ->filterByReviewRoundIds([$reviewRound->getId()]) + )); + + return $workflow; + } +} diff --git a/classes/decision/types/RecommendAccept.inc.php b/classes/decision/types/RecommendAccept.inc.php new file mode 100644 index 00000000000..9e4cab98369 --- /dev/null +++ b/classes/decision/types/RecommendAccept.inc.php @@ -0,0 +1,71 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + // If there is no review round id, a validation error will already have been set + if (!$reviewRoundId) { + return; + } + + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + case $this->ACTION_NOTIFY_REVIEWERS: + $this->validateNotifyReviewersAction($action, $actionErrorKey, $validator, $submission, $reviewRoundId); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $reviewAssignments = $this->getCompletedReviewAssignments($submission->getId(), $decision->getData('reviewRoundId')); + $emailData = $this->getEmailDataFromAction($action); + $this->sendAuthorEmail( + new DecisionRequestRevisionsNotifyAuthor($context, $submission, $decision, $reviewAssignments), + $emailData, + $editor, + $submission, + $context + ); + $this->shareReviewAttachmentFiles($emailData->attachments, $submission, $decision->getData('reviewRoundId')); + break; + case $this->ACTION_NOTIFY_REVIEWERS: + $this->sendReviewersEmail( + new DecisionNotifyReviewer($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context, $reviewRound); + + $fakeDecision = $this->getFakeDecision($submission, $editor, $reviewRound); + $fileAttachers = $this->getFileAttachers($submission, $context, $reviewRound); + $reviewAssignments = $this->getCompletedReviewAssignments($submission->getId(), $reviewRound->getId()); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionRequestRevisionsNotifyAuthor($context, $submission, $fakeDecision, $reviewAssignments); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.requestRevisions.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + if (count($reviewAssignments)) { + $reviewers = $workflow->getReviewersFromAssignments($reviewAssignments); + $mailable = new DecisionNotifyReviewer($context, $submission, $fakeDecision); + $workflow->addStep((new Email( + $this->ACTION_NOTIFY_REVIEWERS, + __('editor.submission.decision.notifyReviewers'), + __('editor.submission.decision.notifyReviewers.description'), + $reviewers, + $mailable->sender($editor), + $context->getSupportedFormLocales(), + $fileAttachers + ))->canChangeTo(true)); + } + + return $workflow; + } +} diff --git a/classes/decision/types/Resubmit.inc.php b/classes/decision/types/Resubmit.inc.php new file mode 100644 index 00000000000..f4016c72471 --- /dev/null +++ b/classes/decision/types/Resubmit.inc.php @@ -0,0 +1,175 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + // If there is no review round id, a validation error will already have been set + if (!$reviewRoundId) { + return; + } + + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + case $this->ACTION_NOTIFY_REVIEWERS: + $this->validateNotifyReviewersAction($action, $actionErrorKey, $validator, $submission, $reviewRoundId); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $reviewAssignments = $this->getCompletedReviewAssignments($submission->getId(), $decision->getData('reviewRoundId')); + $emailData = $this->getEmailDataFromAction($action); + $this->sendAuthorEmail( + new DecisionResubmitNotifyAuthor($context, $submission, $decision, $reviewAssignments), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + $this->shareReviewAttachmentFiles($emailData->attachments, $submission, $decision->getData('reviewRoundId')); + break; + case $this->ACTION_NOTIFY_REVIEWERS: + $this->sendReviewersEmail( + new DecisionNotifyReviewer($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context, $reviewRound); + + $fakeDecision = $this->getFakeDecision($submission, $editor, $reviewRound); + $fileAttachers = $this->getFileAttachers($submission, $context, $reviewRound); + $reviewAssignments = $this->getCompletedReviewAssignments($submission->getId(), $reviewRound->getId()); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionResubmitNotifyAuthor($context, $submission, $fakeDecision, $reviewAssignments); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.requestRevisions.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + if (count($reviewAssignments)) { + $reviewers = $workflow->getReviewersFromAssignments($reviewAssignments); + $mailable = new DecisionNotifyReviewer($context, $submission, $fakeDecision); + $workflow->addStep((new Email( + $this->ACTION_NOTIFY_REVIEWERS, + __('editor.submission.decision.notifyReviewers'), + __('editor.submission.decision.notifyReviewers.description'), + $reviewers, + $mailable->sender($editor), + $context->getSupportedFormLocales(), + $fileAttachers + ))->canChangeTo(true)); + } + + return $workflow; + } +} diff --git a/classes/decision/types/RevertDecline.inc.php b/classes/decision/types/RevertDecline.inc.php new file mode 100644 index 00000000000..318f3b24367 --- /dev/null +++ b/classes/decision/types/RevertDecline.inc.php @@ -0,0 +1,141 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + // If there is no review round id, a validation error will already have been set + if (!$reviewRoundId) { + return; + } + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionRevertDeclineNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context, $reviewRound); + + $fakeDecision = $this->getFakeDecision($submission, $editor, $reviewRound); + $fileAttachers = $this->getFileAttachers($submission, $context, $reviewRound); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionRevertDeclineNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.revertDecline.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + return $workflow; + } +} diff --git a/classes/decision/types/RevertInitialDecline.inc.php b/classes/decision/types/RevertInitialDecline.inc.php new file mode 100644 index 00000000000..0a92b4486d1 --- /dev/null +++ b/classes/decision/types/RevertInitialDecline.inc.php @@ -0,0 +1,138 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionRevertInitialDeclineNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context); + + $fakeDecision = $this->getFakeDecision($submission, $editor); + $fileAttachers = $this->getFileAttachers($submission, $context); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionRevertInitialDeclineNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.revertDecline.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + return $workflow; + } +} diff --git a/classes/decision/types/SendExternalReview.inc.php b/classes/decision/types/SendExternalReview.inc.php new file mode 100644 index 00000000000..466fe23c687 --- /dev/null +++ b/classes/decision/types/SendExternalReview.inc.php @@ -0,0 +1,169 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionSendExternalReviewNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context); + + $fakeDecision = $this->getFakeDecision($submission, $editor); + $fileAttachers = $this->getFileAttachers($submission, $context); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionSendExternalReviewNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.sendExternalReview.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + $workflow->addStep((new PromoteFiles( + 'promoteFilesToReview', + __('editor.submission.selectFiles'), + __('editor.submission.decision.promoteFiles.externalReview'), + SubmissionFile::SUBMISSION_FILE_REVIEW_FILE, + $submission, + $this->getFileGenres($context->getId()) + ))->addFileList( + __('submission.submit.submissionFiles'), + Repo::submissionFile() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_SUBMISSION]) + )); + + return $workflow; + } + + /** + * Get the submission file stages that are permitted to be attached to emails + * sent in this decision + * + * @return array + */ + protected function getAllowedAttachmentFileStages(): array + { + return [ + SubmissionFile::SUBMISSION_FILE_SUBMISSION, + ]; + } +} diff --git a/classes/decision/types/SendToProduction.inc.php b/classes/decision/types/SendToProduction.inc.php new file mode 100644 index 00000000000..9123de65b49 --- /dev/null +++ b/classes/decision/types/SendToProduction.inc.php @@ -0,0 +1,197 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionSendToProductionNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context); + + $fakeDecision = $this->getFakeDecision($submission, $editor); + $fileAttachers = $this->getFileAttachers($submission, $context); + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionSendToProductionNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.sendToProduction.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + return $workflow; + } + + /** + * Get the submission file stages that are permitted to be attached to emails + * sent in this decision + * + * @return array + */ + protected function getAllowedAttachmentFileStages(): array + { + return [ + SubmissionFile::SUBMISSION_FILE_FINAL, + SubmissionFile::SUBMISSION_FILE_COPYEDIT, + ]; + } + + /** + * Get the file attacher components supported for emails in this decision + */ + protected function getFileAttachers(Submission $submission, Context $context): array + { + $attachers = [ + new Upload( + $context, + __('common.upload.addFile'), + __('common.upload.addFile.description'), + __('common.upload.addFile') + ), + ]; + + $attachers[] = (new FileStage( + $context, + $submission, + __('submission.submit.submissionFiles'), + __('email.addAttachment.submissionFiles.submissionDescription'), + __('email.addAttachment.submissionFiles.attach') + )) + ->withFileStage( + SubmissionFile::SUBMISSION_FILE_COPYEDIT, + __('submission.copyedited') + ) + ->withFileStage( + SubmissionFile::SUBMISSION_FILE_FINAL, + __('submission.finalDraft') + ); + + $attachers[] = new Library( + $context, + $submission + ); + + return $attachers; + } +} diff --git a/classes/decision/types/SkipReview.inc.php b/classes/decision/types/SkipReview.inc.php new file mode 100644 index 00000000000..8a605ea9056 --- /dev/null +++ b/classes/decision/types/SkipReview.inc.php @@ -0,0 +1,176 @@ + $submission->getLocalizedFullTitle()]); + } + + public function validate(array $props, Submission $submission, Context $context, Validator $validator, ?int $reviewRoundId = null) + { + parent::validate($props, $submission, $context, $validator, $reviewRoundId); + + foreach ($props['actions'] as $index => $action) { + $actionErrorKey = 'actions.' . $index; + switch ($action['id']) { + case self::ACTION_PAYMENT: + $this->validatePaymentAction($action, $actionErrorKey, $validator, $context); + break; + case $this->ACTION_NOTIFY_AUTHORS: + $this->validateNotifyAuthorsAction($action, $actionErrorKey, $validator, $submission); + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case self::ACTION_PAYMENT: + $this->requestPayment($submission, $editor, $context); + break; + case $this->ACTION_NOTIFY_AUTHORS: + $this->sendAuthorEmail( + new DecisionSkipReviewNotifyAuthor($context, $submission, $decision), + $this->getEmailDataFromAction($action), + $editor, + $submission, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context); + + $fakeDecision = $this->getFakeDecision($submission, $editor); + $fileAttachers = $this->getFileAttachers($submission, $context); + + // Request payment if configured + $paymentManager = Application::getPaymentManager($context); + if ($paymentManager->publicationEnabled()) { + $workflow->addStep($this->getPaymentForm($context)); + } + + $authors = $workflow->getStageParticipants(Role::ROLE_ID_AUTHOR); + if (count($authors)) { + $mailable = new DecisionSkipReviewNotifyAuthor($context, $submission, $fakeDecision); + $workflow->addStep(new Email( + $this->ACTION_NOTIFY_AUTHORS, + __('editor.submission.decision.notifyAuthors'), + __('editor.submission.decision.skipReview.notifyAuthorsDescription'), + $authors, + $mailable + ->sender($editor) + ->recipients($authors), + $context->getSupportedFormLocales(), + $fileAttachers + )); + } + + $workflow->addStep((new PromoteFiles( + 'promoteFilesToReview', + __('editor.submission.selectFiles'), + __('editor.submission.decision.promoteFiles.copyediting'), + SubmissionFile::SUBMISSION_FILE_FINAL, + $submission, + $this->getFileGenres($context->getId()) + ))->addFileList( + __('submission.submit.submissionFiles'), + Repo::submissionFile() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_SUBMISSION]) + )); + + return $workflow; + } +} diff --git a/classes/decision/types/traits/InExternalReviewRound.inc.php b/classes/decision/types/traits/InExternalReviewRound.inc.php new file mode 100644 index 00000000000..c46ff538cb0 --- /dev/null +++ b/classes/decision/types/traits/InExternalReviewRound.inc.php @@ -0,0 +1,160 @@ + + */ + protected function getCompletedReviewerIds(Submission $submission, int $reviewRoundId): array + { + $userIds = []; + /** @var ReviewAssignmentDAO $reviewAssignmentDao */ + $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); + $reviewAssignments = $reviewAssignmentDao->getBySubmissionId( + $submission->getId(), + $reviewRoundId, + $this->getStageId() + ); + foreach ($reviewAssignments as $reviewAssignment) { + if (!in_array($reviewAssignment->getStatus(), ReviewAssignment::REVIEW_COMPLETE_STATUSES)) { + continue; + } + $userIds[] = (int) $reviewAssignment->getReviewerId(); + } + return $userIds; + } + + /** + * Get the submission file stages that are permitted to be attached to emails + * sent in this decision + * + * @return array + */ + protected function getAllowedAttachmentFileStages(): array + { + return [ + SubmissionFile::SUBMISSION_FILE_REVIEW_ATTACHMENT, + SubmissionFile::SUBMISSION_FILE_REVIEW_FILE, + SubmissionFile::SUBMISSION_FILE_REVIEW_REVISION, + ]; + } + + /** + * Get the file attacher components supported for emails in this decision + */ + protected function getFileAttachers(Submission $submission, Context $context, ?ReviewRound $reviewRound = null): array + { + $attachers = [ + new Upload( + $context, + __('common.upload.addFile'), + __('common.upload.addFile.description'), + __('common.upload.addFile') + ), + ]; + + if ($reviewRound) { + /** @var ReviewAssignmentDAO $reviewAssignmentDAO */ + $reviewAssignmentDAO = DAORegistry::getDAO('ReviewAssignmentDAO'); + $reviewAssignments = $reviewAssignmentDAO->getByReviewRoundId($reviewRound->getId()); + $reviewerFiles = []; + if (!empty($reviewAssignments)) { + $reviewerFiles = Repo::submissionFile()->getMany( + Repo::submissionFile() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByAssoc(Application::ASSOC_TYPE_REVIEW_ASSIGNMENT, array_keys($reviewAssignments)) + ); + } + $attachers[] = new ReviewFiles( + __('reviewer.submission.reviewFiles'), + __('email.addAttachment.reviewFiles.description'), + __('email.addAttachment.reviewFiles.attach'), + $reviewerFiles, + $reviewAssignments, + $context + ); + } + + $attachers[] = (new FileStage( + $context, + $submission, + __('submission.submit.submissionFiles'), + __('email.addAttachment.submissionFiles.reviewDescription'), + __('email.addAttachment.submissionFiles.attach') + )) + ->withFileStage( + SubmissionFile::SUBMISSION_FILE_REVIEW_REVISION, + __('editor.submission.revisions'), + $reviewRound + )->withFileStage( + SubmissionFile::SUBMISSION_FILE_REVIEW_FILE, + __('reviewer.submission.reviewFiles'), + $reviewRound + ); + + $attachers[] = new Library( + $context, + $submission + ); + + return $attachers; + } + + /** + * Get the completed review assignments for this round + */ + protected function getCompletedReviewAssignments(int $submissionId, int $reviewRoundId): array + { + /** @var ReviewAssignmentDAO $reviewAssignmentDao */ + $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); + $reviewAssignments = $reviewAssignmentDao->getBySubmissionId( + $submissionId, + $reviewRoundId, + $this->getStageId() + ); + $completedReviewAssignments = []; + foreach ($reviewAssignments as $reviewAssignment) { + if (in_array($reviewAssignment->getStatus(), ReviewAssignment::REVIEW_COMPLETE_STATUSES)) { + $completedReviewAssignments[] = $reviewAssignment; + } + } + + return $completedReviewAssignments; + } +} diff --git a/classes/decision/types/traits/InSubmissionStage.inc.php b/classes/decision/types/traits/InSubmissionStage.inc.php new file mode 100644 index 00000000000..6bf229847c1 --- /dev/null +++ b/classes/decision/types/traits/InSubmissionStage.inc.php @@ -0,0 +1,76 @@ + + */ + protected function getAllowedAttachmentFileStages(): array + { + return [ + SubmissionFile::SUBMISSION_FILE_SUBMISSION, + ]; + } + + /** + * Get the file attacher components supported for emails in this decision + */ + protected function getFileAttachers(Submission $submission, Context $context): array + { + $attachers = [ + new Upload( + $context, + __('common.upload.addFile'), + __('common.upload.addFile.description'), + __('common.upload.addFile') + ), + ]; + + $attachers[] = (new FileStage( + $context, + $submission, + __('submission.submit.submissionFiles'), + __('email.addAttachment.submissionFiles.submissionDescription'), + __('email.addAttachment.submissionFiles.attach') + )) + ->withFileStage( + SubmissionFile::SUBMISSION_FILE_SUBMISSION, + __('submission.submit.submissionFiles') + ); + + $attachers[] = new Library( + $context, + $submission + ); + + return $attachers; + } +} diff --git a/classes/decision/types/traits/IsRecommendation.inc.php b/classes/decision/types/traits/IsRecommendation.inc.php new file mode 100644 index 00000000000..d1cd6013674 --- /dev/null +++ b/classes/decision/types/traits/IsRecommendation.inc.php @@ -0,0 +1,199 @@ + $action) { + switch ($action['id']) { + case $this->ACTION_DISCUSSION: + $errors = $this->validateEmailAction($action, $submission, $this->getAllowedAttachmentFileStages()); + if (count($errors)) { + foreach ($errors as $key => $error) { + $validator->errors()->add('actions.' . $index . '.' . $key, $error); + } + } + break; + } + } + } + + public function callback(Decision $decision, Submission $submission, User $editor, Context $context, array $actions) + { + parent::callback($decision, $submission, $editor, $context, $actions); + + foreach ($actions as $action) { + switch ($action['id']) { + case $this->ACTION_DISCUSSION: + $this->addRecommendationQuery( + $this->getEmailDataFromAction($action), + $submission, + $editor, + $context + ); + break; + } + } + } + + public function getWorkflow(Submission $submission, Context $context, User $editor, ?ReviewRound $reviewRound): Workflow + { + $workflow = new Workflow($this, $submission, $context, $reviewRound); + + $fakeDecision = $this->getFakeDecision($submission, $editor); + $fileAttachers = $this->getFileAttachers($submission, $context, $reviewRound); + $editors = $workflow->getDecidingEditors(); + $reviewAssignments = $this->getCompletedReviewAssignments($submission->getId(), $reviewRound->getId()); + $mailable = new RecommendationNotifyEditors($context, $submission, $fakeDecision, $reviewAssignments); + + $workflow->addStep((new Email( + $this->ACTION_DISCUSSION, + __('editor.submissionReview.recordRecommendation.notifyEditors'), + __('editor.submission.recommend.notifyEditors.description'), + $editors, + $mailable + ->sender($editor) + ->recipients($editors), + $context->getSupportedFormLocales(), + $fileAttachers + ))->canSkip(false)); + + return $workflow; + } + + /** + * Create a query (discussion) among deciding editors + * and add attachments to the head note + * + * @return array + */ + protected function addRecommendationQuery(EmailData $email, Submission $submission, User $editor, Context $context) + { + /** @var QueryDAO $queryDao */ + $queryDao = DAORegistry::getDAO('QueryDAO'); + $queryId = $queryDao->addRecommendationQuery( + $editor->getId(), + $submission->getId(), + $this->getStageId(), + $email->subject, + $email->body + ); + + $query = $queryDao->getById($queryId); + $note = $query->getHeadNote(); + foreach ($email->attachments as $attachment) { + if (isset($attachment[Mailable::ATTACHMENT_TEMPORARY_FILE])) { + $temporaryFileManager = new TemporaryFileManager(); + $temporaryFile = $temporaryFileManager->getFile($attachment[Mailable::ATTACHMENT_TEMPORARY_FILE], $editor->getId()); + if (!$temporaryFile) { + throw new Exception('Could not find temporary file ' . $attachment[Mailable::ATTACHMENT_TEMPORARY_FILE] . ' to attach to the query note.'); + } + $this->addSubmissionFileToNoteFromFilePath( + $temporaryFile->getFilePath(), + $attachment['name'], + $note, + $editor, + $submission, + $context + ); + } elseif (isset($attachment[Mailable::ATTACHMENT_SUBMISSION_FILE])) { + $submissionFile = Repo::submissionFile()->get($attachment[Mailable::ATTACHMENT_SUBMISSION_FILE]); + if (!$submissionFile || $submissionFile->getData('submissionId') !== $submission->getId()) { + throw new Exception('Could not find submission file ' . $attachment[Mailable::ATTACHMENT_SUBMISSION_FILE] . ' to attach to the query note.'); + } + $newSubmissionFile = clone $submissionFile; + $newSubmissionFile->setData('fileStage', SubmissionFile::SUBMISSION_FILE_QUERY); + $newSubmissionFile->setData('sourceSubmissionFileId', $submissionFile->getId()); + $newSubmissionFile->setData('assocType', Application::ASSOC_TYPE_NOTE); + $newSubmissionFile->setData('assocId', $note->getId()); + Repo::submissionFile()->add($newSubmissionFile); + } elseif (isset($attachment[Mailable::ATTACHMENT_LIBRARY_FILE])) { + /** @var LibraryFileDAO $libraryFileDao */ + $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); + /** @var LibraryFile $file */ + $libraryFile = $libraryFileDao->getById($attachment[Mailable::ATTACHMENT_LIBRARY_FILE]); + if (!$libraryFile) { + throw new Exception('Could not find library file ' . $attachment[Mailable::ATTACHMENT_LIBRARY_FILE] . ' to attach to the query note.'); + } + $this->addSubmissionFileToNoteFromFilePath( + $libraryFile->getFilePath(), + $attachment['name'], + $note, + $editor, + $submission, + $context + ); + } + } + } + + /** + * Helper function to save a file to the file system and then + * use that in a new submission file attached to the query note + */ + protected function addSubmissionFileToNoteFromFilePath(string $filepath, string $filename, Note $note, User $uploader, Submission $submission, Context $context) + { + $extension = pathinfo($filename, PATHINFO_EXTENSION); + $submissionDir = Repo::submissionFile()->getSubmissionDir($context->getId(), $submission->getId()); + $fileId = Services::get('file')->add( + $filepath, + $submissionDir . '/' . uniqid() . '.' . $extension + ); + /** @var SubmissionFileDAO $submissionFileDao */ + $submissionFileDao = DAORegistry::getDao('SubmissionFileDAO'); + $submissionFile = $submissionFileDao->newDataObject(); + $submissionFile->setAllData([ + 'fileId' => $fileId, + 'name' => [ + AppLocale::getLocale() => $filename + ], + 'fileStage' => SubmissionFile::SUBMISSION_FILE_QUERY, + 'submissionId' => $submission->getId(), + 'uploaderUserId' => $uploader->getId(), + 'assocType' => Application::ASSOC_TYPE_NOTE, + 'assocId' => $note->getId(), + ]); + Repo::submissionFile()->add($submissionFile); + } +} diff --git a/classes/decision/types/traits/NotifyAuthors.inc.php b/classes/decision/types/traits/NotifyAuthors.inc.php new file mode 100644 index 00000000000..97bd9de58e4 --- /dev/null +++ b/classes/decision/types/traits/NotifyAuthors.inc.php @@ -0,0 +1,146 @@ +validateEmailAction($action, $submission, $this->getAllowedAttachmentFileStages()); + foreach ($errors as $key => $propErrors) { + foreach ($propErrors as $propError) { + $validator->errors()->add($actionErrorKey . '.' . $key, $propError); + } + } + } + + /** + * Send the email to the author(s) + */ + protected function sendAuthorEmail(Mailable $mailable, EmailData $email, User $editor, Submission $submission, Context $context) + { + $recipients = array_map(function ($userId) { + return Repo::user()->get($userId); + }, $this->getAssignedAuthorIds($submission)); + + $mailable = $this->addEmailDataToMailable($mailable, $editor, $email); + + Mail::send($mailable->recipients($recipients)); + + /** @var SubmissionEmailLogDAO $submissionEmailLogDao */ + $submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO'); + $submissionEmailLogDao->logMailable( + SubmissionEmailLogEntry::SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR, + $mailable, + $submission, + $editor + ); + + if ($context->getData('notifyAllAuthors')) { + $authors = $submission->getCurrentPublication()->getData('authors'); + $assignedAuthorEmails = array_map(function (User $user) { + return $user->getEmail(); + }, $recipients); + $mailable = new DecisionNotifyOtherAuthors($context, $submission); + $emailTemplate = Repo::emailTemplate()->getByKey($context->getId(), $mailable::getEmailTemplateKey()); + $mailable + ->sender($editor) + ->subject($email->subject) + ->body($emailTemplate->getLocalizedData('body')) + ->addData([ + $mailable::MESSAGE_TO_SUBMITTING_AUTHOR => $email->body, + ]); + foreach ($authors as $author) { + if (!$author->getEmail() || in_array($author->getEmail(), $assignedAuthorEmails)) { + continue; + } + $mailable->to($author->getEmail(), $author->getFullName()); + Mail::send($mailable); + } + } + } + + /** + * Share reviewer file attachments with author + * + * This method looks in the email attachments for any files in the + * SubmissionFile::SUBMISSION_FILE_REVIEW_ATTACHMENT stage and sets + * their viewable flag to true. This flag makes the file visible to + * the author from the author submission dashboard. + */ + protected function shareReviewAttachmentFiles(array $attachments, Submission $submission, int $reviewRoundId) + { + if (!in_array($this->getStageId(), [WORKFLOW_STAGE_ID_INTERNAL_REVIEW, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW])) { + return; + } + + $submissionFileIds = []; + foreach ($attachments as $attachment) { + if (!isset($attachment['submissionFileId'])) { + continue; + } + $submissionFileIds[] = (int) $attachment['submissionFileId']; + } + + if (empty($submissionFileIds)) { + return; + } + + $reviewAttachmentIds = Repo::submissionFile()->getIds( + Repo::submissionFile() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByReviewRoundIds([$reviewRoundId]) + ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_REVIEW_ATTACHMENT]) + ); + + foreach ($reviewAttachmentIds->intersect($submissionFileIds) as $sharedFileId) { + $submissionFile = Repo::submissionFile()->get($sharedFileId); + Repo::submissionFile()->edit( + $submissionFile, + ['viewable' => true], + Application::get()->getRequest() + ); + } + } +} diff --git a/classes/decision/types/traits/NotifyReviewers.inc.php b/classes/decision/types/traits/NotifyReviewers.inc.php new file mode 100644 index 00000000000..643b8b63dbd --- /dev/null +++ b/classes/decision/types/traits/NotifyReviewers.inc.php @@ -0,0 +1,109 @@ +validateEmailAction($action, $submission, $this->getAllowedAttachmentFileStages()); + foreach ($errors as $key => $propErrors) { + foreach ($propErrors as $propError) { + $validator->errors()->add($actionErrorKey . '.' . $key, $propError); + } + } + if (empty($action['to'])) { + $validator->errors()->add($actionErrorKey . '.to', __('validator.required')); + return; + } + $reviewerIds = $this->getCompletedReviewerIds($submission, $reviewRoundId); + $invalidRecipients = array_diff($action['to'], $reviewerIds); + if (count($invalidRecipients)) { + $this->setRecipientError($actionErrorKey, $invalidRecipients, $validator); + } + } + + /** + * Send the email to the reviewers + */ + protected function sendReviewersEmail(DecisionNotifyReviewer $mailable, EmailData $email, User $editor, Submission $submission) + { + /** @var DecisionNotifyReviewer $mailable */ + $mailable = $this->addEmailDataToMailable($mailable, $editor, $email); + + /** @var User[] $recipients */ + $recipients = array_map(function ($userId) { + return Repo::user()->get($userId); + }, $email->to); + + foreach ($recipients as $recipient) { + Mail::send($mailable->recipients([$recipient])); + + // Update the ReviewAssignment to indicate the reviewer has been acknowledged + /** @var ReviewAssignmentDAO $reviewAssignmentDao */ + $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); + $reviewAssignment = $reviewAssignmentDao->getReviewAssignment($mailable->getDecision()->getData('reviewRoundId'), $recipient->getId()); + if ($reviewAssignment) { + $reviewAssignment->setDateAcknowledged(Core::getCurrentDate()); + $reviewAssignment->stampModified(); + $reviewAssignment->setUnconsidered(ReviewAssignment::REVIEW_ASSIGNMENT_NOT_UNCONSIDERED); + $reviewAssignmentDao->updateObject($reviewAssignment); + } + } + + SubmissionLog::logEvent( + Application::get()->getRequest(), + $submission, + SubmissionEventLogEntry::SUBMISSION_LOG_DECISION_EMAIL_SENT, + 'submission.event.decisionReviewerEmailSent', + [ + 'recipientCount' => count($recipients), + 'subject' => $email->subject, + ] + ); + } +} diff --git a/classes/decision/types/traits/RequestPayment.inc.php b/classes/decision/types/traits/RequestPayment.inc.php new file mode 100644 index 00000000000..a9e8e16e333 --- /dev/null +++ b/classes/decision/types/traits/RequestPayment.inc.php @@ -0,0 +1,88 @@ +ACTION_PAYMENT, + __('editor.article.payment.requestPayment'), + '', + new RequestPaymentDecisionForm($context) + ); + } + + /** + * Validate the decision action to request or waive payment + */ + protected function validatePaymentAction(array $action, string $actionErrorKey, Validator $validator, Context $context) + { + $paymentManager = Application::getPaymentManager($context); + if (!$paymentManager->publicationEnabled()) { + $validator->errors()->add($actionErrorKey . '.requestPayment', __('payment.requestPublicationFee.notEnabled')); + } elseif (!isset($action['requestPayment'])) { + $validator->errors()->add($actionErrorKey . '.requestPayment', __('validator.required')); + } + } + + /** + * Request payment from authors + */ + protected function requestPayment(Submission $submission, User $editor, Context $context) + { + $paymentManager = Application::getPaymentManager($context); + $queuedPayment = $paymentManager->createQueuedPayment( + Application::get()->getRequest(), + OJSPaymentManager::PAYMENT_TYPE_PUBLICATION, + $editor->getId(), + $submission->getId(), + $context->getData('publicationFee'), + $context->getData('currency') + ); + $paymentManager->queuePayment($queuedPayment); + + // Notify authors that this needs payment. + $notificationMgr = new NotificationManager(); + $authorIds = $this->getAssignedAuthorIds($submission); + foreach ($authorIds as $authorId) { + $notificationMgr->createNotification( + Application::get()->getRequest(), + $authorId, + Notification::NOTIFICATION_TYPE_PAYMENT_REQUIRED, + $context->getId(), + Application::ASSOC_TYPE_QUEUED_PAYMENT, + $queuedPayment->getId(), + Notification::NOTIFICATION_LEVEL_TASK + ); + } + } +} diff --git a/classes/emailTemplate/DAO.inc.php b/classes/emailTemplate/DAO.inc.php index 258d2bc12c7..a02d024d11d 100644 --- a/classes/emailTemplate/DAO.inc.php +++ b/classes/emailTemplate/DAO.inc.php @@ -14,13 +14,11 @@ namespace PKP\emailTemplate; use Exception; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Illuminate\Support\LazyCollection; use PKP\core\EntityDAO; use PKP\db\XMLDAO; use PKP\facades\Repo; -use stdClass; class DAO extends EntityDAO { @@ -54,11 +52,12 @@ class DAO extends EntityDAO */ public function newDataObject(): EmailTemplate { - return App::make(EmailTemplate::class); + return app(EmailTemplate::class); } /** * @copydoc EntityDAO::insert() + * * @throws Exception */ public function insert(EmailTemplate $object): int @@ -106,6 +105,7 @@ public function delete(EmailTemplate $emailTemplate) /** * @copydoc EntityDAO::get() + * * @throws Exception */ public function get(int $id): ?EmailTemplate @@ -115,6 +115,7 @@ public function get(int $id): ?EmailTemplate /** * Do not use this method. + * * @throws Exception */ public function getIds() @@ -164,11 +165,12 @@ public function getCount(Collector $query): int /** * Retrieve template together with data from the email_template_default_data + * * @copydoc EntityDAO::fromRow() */ - public function fromRow(stdClass $row): EmailTemplate + public function fromRow(object $row): EmailTemplate { - /** @var EmailTemplate $emailTemplate */ + /** @var EmailTemplate $emailTemplate */ $emailTemplate = parent::fromRow($row); $schema = $this->schemaService->get($this->schema); @@ -218,9 +220,8 @@ public function deleteDefaultEmailTemplatesByLocale(string $locale) * Check if a template exists with the given email key for a journal/ * conference/... * - * @param $key string * - * @return boolean + * @return bool */ public function defaultTemplateIsInstalled(string $key) { @@ -240,22 +241,20 @@ public function getMainEmailTemplatesFilename() /** * Install email templates from an XML file. * - * @param $templatesFile string Filename to install - * @param $locales array List of locales to install data for - * @param $emailKey string|null Optional name of single email key to install, + * @param string $templatesFile Filename to install + * @param array $locales List of locales to install data for + * @param string|null $emailKey Optional name of single email key to install, * skipping others - * @param $skipExisting boolean If true, do not install email templates + * @param bool $skipExisting If true, do not install email templates * that already exist in the database * - * @return boolean */ public function installEmailTemplates( string $templatesFile, array $locales = [], ?string $emailKey = null, bool $skipExisting = false - ): bool - { + ): bool { $xmlDao = new XMLDAO(); $data = $xmlDao->parseStruct($templatesFile, ['email']); if (!isset($data['email'])) { @@ -290,19 +289,17 @@ public function installEmailTemplates( /** * Install email template contents from an XML file. * - * @param $templatesFile string Filename to install - * @param $locales array List of locales to install data for - * @param $emailKey string|null Optional name of single email key to install, + * @param string $templatesFile Filename to install + * @param array $locales List of locales to install data for + * @param string|null $emailKey Optional name of single email key to install, * skipping others * - * @return boolean */ public function installEmailTemplateLocaleData( string $templatesFile, array $locales = [], ?string $emailKey = null - ): bool - { + ): bool { $xmlDao = new XMLDAO(); $data = $xmlDao->parseStruct($templatesFile, ['email']); if (!isset($data['email'])) { @@ -334,8 +331,8 @@ public function installEmailTemplateLocaleData( DB::table('email_templates_default_data')->insert([ 'email_key' => $attrs['key'], 'locale' => $locale, - 'subject' => $translatedSubject, - 'body' => $translatedBody, + 'subject' => $this->renameApplicationVariables($translatedSubject), + 'body' => $this->renameApplicationVariables($translatedBody), 'description' => __($description, [], $locale), ]); } @@ -350,9 +347,9 @@ public function installEmailTemplateLocaleData( * * @deprecated Since OJS/OMP 3.2, this data should be supplied via the non-localized email template list and PO files. (pkp/pkp-lib#5461) * - * @param $templateDataFile string Filename to install - * @param $locale string Locale of template(s) to install - * @param $emailKey string|null If specified, the key of the single template + * @param string $templateDataFile Filename to install + * @param string $locale Locale of template(s) to install + * @param string|null $emailKey If specified, the key of the single template * to install (otherwise all are installed) * * @return array|boolean @@ -361,8 +358,7 @@ public function installEmailTemplateData( string $templateDataFile, string $locale, ?string $emailKey = null - ): bool - { + ): bool { $xmlDao = new XMLDAO(); $data = $xmlDao->parse($templateDataFile); if (!$data) { @@ -376,7 +372,7 @@ public function installEmailTemplateData( // Translate variable contents foreach ([&$subject, &$body, &$description] as &$var) { - $var = preg_replace_callback('{{translate key="([^"]+)"}}', function ($matches) use($locale) { + $var = preg_replace_callback('{{translate key="([^"]+)"}}', function ($matches) use ($locale) { return __($matches[1], [], $locale); }, $var); } @@ -385,7 +381,7 @@ public function installEmailTemplateData( continue; } DB::table('email_templates_default_data') - ->where('email_key',$emailNode->getAttribute('key')) + ->where('email_key', $emailNode->getAttribute('key')) ->where('locale', $locale) ->delete(); @@ -399,4 +395,34 @@ public function installEmailTemplateData( } return true; } + + /** + * @param string $localizedData email template's localized subject or body + */ + protected function renameApplicationVariables(string $localizedData): string + { + $map = $this->variablesToRename(); + if (empty($map)) { + return $localizedData; + } + + $variables = []; + $replacements = []; + foreach ($map as $key => $value) { + $variables[] = '/\{\$' . $key . '\}/'; + $replacements[] = '{$' . $value . '}'; + } + + return preg_replace($variables, $replacements, $localizedData); + } + + /** + * Override this function on an application level to rename app-specific template variables + * + * Example: ['contextName' => 'journalName'] + */ + protected function variablesToRename(): array + { + return []; + } } diff --git a/classes/emailTemplate/EmailTemplate.inc.php b/classes/emailTemplate/EmailTemplate.inc.php index 0f307b8c6e3..04817a9c749 100644 --- a/classes/emailTemplate/EmailTemplate.inc.php +++ b/classes/emailTemplate/EmailTemplate.inc.php @@ -40,7 +40,7 @@ public function getAssocId() * * @deprecated 3.2 * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -72,7 +72,7 @@ public function getFromRoleId() /** * Set sender role ID. * - * @param $fromRoleId int + * @param int $fromRoleId * * @deprecated 3.2 */ @@ -96,7 +96,7 @@ public function getToRoleId() * * @deprecated 3.2 * - * @param $toRoleId int + * @param int $toRoleId */ public function setToRoleId($toRoleId) { @@ -120,7 +120,7 @@ public function getEmailId() * * @deprecated 3.2 * - * @param $emailId int + * @param int $emailId */ public function setEmailId($emailId) { @@ -144,7 +144,7 @@ public function getEmailKey() * * @deprecated 3.2 * - * @param $key string + * @param string $key */ public function setEmailKey($key) { @@ -156,7 +156,7 @@ public function setEmailKey($key) * * @deprecated 3.2 * - * @return boolean + * @return bool */ public function getEnabled() { @@ -168,7 +168,7 @@ public function getEnabled() * * @deprecated 3.2 * - * @param $enabled boolean + * @param bool $enabled */ public function setEnabled($enabled) { @@ -180,7 +180,7 @@ public function setEnabled($enabled) * * @deprecated 3.2 * - * @return boolean + * @return bool */ public function getCanDisable() { @@ -192,7 +192,7 @@ public function getCanDisable() * * @deprecated 3.2 * - * @param $canDisable boolean + * @param bool $canDisable */ public function setCanDisable($canDisable) { @@ -216,7 +216,7 @@ public function getSubject() * * @deprecated 3.2 * - * @param $subject string + * @param string $subject */ public function setSubject($subject) { @@ -240,7 +240,7 @@ public function getBody() * * @deprecated 3.2 * - * @param $body string + * @param string $body */ public function setBody($body) { diff --git a/classes/emailTemplate/Repository.inc.php b/classes/emailTemplate/Repository.inc.php index 7059627cc1f..6c28f3dcde8 100644 --- a/classes/emailTemplate/Repository.inc.php +++ b/classes/emailTemplate/Repository.inc.php @@ -13,14 +13,15 @@ namespace PKP\emailTemplate; +use APP\emailTemplate\DAO; use APP\i18n\AppLocale; +use Illuminate\Support\Facades\App; use Illuminate\Support\LazyCollection; use PKP\core\PKPRequest; +use PKP\facades\Repo; use PKP\plugins\HookRegistry; use PKP\services\PKPSchemaService; -use Illuminate\Support\Facades\App; use PKP\validation\ValidatorFactory; -use PKP\facades\Repo; class Repository { @@ -57,7 +58,7 @@ public function getByKey(int $contextId, string $key): ?EmailTemplate } /** @copydoc DAO::getMany() */ - public function getMany(Collector $query): LazyCollection + public function getMany(Collector $query): LazyCollection { return $this->dao->getMany($query); } @@ -71,7 +72,7 @@ public function getCount(Collector $query): int /** @copydoc DAO::getCollector() */ public function getCollector(): Collector { - return App::make(Collector::class); + return app(Collector::class); } /** @@ -143,7 +144,7 @@ public function validate(?EmailTemplate $object, array $props, array $allowedLoc ValidatorFactory::allowedLocales($validator, $this->schemaService->getMultilingualProps($this->dao->schema), $allowedLocales); if ($validator->fails()) { - $errors = $this->schemaService->formatValidationErrors($validator->errors(), $this->schemaService->get($this->dao->schema), $allowedLocales); + $errors = $this->schemaService->formatValidationErrors($validator->errors()); } HookRegistry::call('EmailTemplate::validate', [&$errors, $object, $props, $allowedLocales, $primaryLocale]); diff --git a/classes/facades/Repo.inc.php b/classes/facades/Repo.inc.php index 7c54668132e..15df39c5653 100644 --- a/classes/facades/Repo.inc.php +++ b/classes/facades/Repo.inc.php @@ -1,7 +1,7 @@ make(AnnouncementRepository::class); + return app(AnnouncementRepository::class); } public static function author(): AuthorRepository { - return app()->make(AuthorRepository::class); + return app(AuthorRepository::class); + } + + public static function decision(): DecisionRepository + { + return app()->make(DecisionRepository::class); } public static function emailTemplate(): EmailTemplateRepository { - return app()->make(EmailTemplateRepository::class); + return app(EmailTemplateRepository::class); } public static function category(): CategoryRepository { - return app()->make(CategoryRepository::class); + return app(CategoryRepository::class); } - public static function submissionFiles(): SubmissionFileRepository + public static function submissionFile(): SubmissionFileRepository { - return app()->make(SubmissionFileRepository::class); + return app(SubmissionFileRepository::class); } } diff --git a/classes/file/FileArchive.inc.php b/classes/file/FileArchive.inc.php index a282a02fb36..79968a4a068 100644 --- a/classes/file/FileArchive.inc.php +++ b/classes/file/FileArchive.inc.php @@ -67,7 +67,7 @@ public function create($files, $filesDir) /** * Return true if the zip extension is loaded. * - * @return boolean + * @return bool */ public static function zipFunctional() { diff --git a/classes/file/FileManager.inc.php b/classes/file/FileManager.inc.php index 815de9ce51e..e91dd323e34 100644 --- a/classes/file/FileManager.inc.php +++ b/classes/file/FileManager.inc.php @@ -55,9 +55,9 @@ public function __construct() /** * Return true if an uploaded file exists. * - * @param $fileName string the name of the file used in the POST form + * @param string $fileName the name of the file used in the POST form * - * @return boolean + * @return bool */ public function uploadedFileExists($fileName) { @@ -71,9 +71,9 @@ public function uploadedFileExists($fileName) /** * Return true iff an error occurred when trying to upload a file. * - * @param $fileName string the name of the file used in the POST form + * @param string $fileName the name of the file used in the POST form * - * @return boolean + * @return bool */ public function uploadError($fileName) { @@ -85,9 +85,9 @@ public function uploadError($fileName) * * @see http://php.net/manual/en/features.file-upload.errors.php * - * @param $fileName string the name of the file used in the POST form + * @param string $fileName the name of the file used in the POST form * - * @return integer + * @return int */ public function getUploadErrorCode($fileName) { @@ -108,7 +108,7 @@ public function getFirstUploadedPostName() /** * Return the (temporary) path to an uploaded file. * - * @param $fileName string the name of the file used in the POST form + * @param string $fileName the name of the file used in the POST form * * @return string (boolean false if no such file) */ @@ -123,7 +123,7 @@ public function getUploadedFilePath($fileName) /** * Return the user-specific (not temporary) filename of an uploaded file. * - * @param $fileName string the name of the file used in the POST form + * @param string $fileName the name of the file used in the POST form * * @return string (boolean false if no such file) */ @@ -138,14 +138,13 @@ public function getUploadedFileName($fileName) /** * Return the type of an uploaded file. * - * @param $fileName string the name of the file used in the POST form + * @param string $fileName the name of the file used in the POST form * * @return string */ public function getUploadedFileType($fileName) { if (isset($_FILES[$fileName])) { - // The result of "explode" can't be passed directly to "array_pop" in PHP 7. $exploded = explode('.', $_FILES[$fileName]['name']); $type = PKPString::mime_content_type( @@ -164,9 +163,9 @@ public function getUploadedFileType($fileName) /** * Upload a file. * - * @param $fileName string the name of the file used in the POST form + * @param string $fileName the name of the file used in the POST form * - * @return boolean returns true if successful + * @return bool returns true if successful */ public function uploadFile($fileName, $destFileName) { @@ -187,10 +186,10 @@ public function uploadFile($fileName, $destFileName) /** * Write a file. * - * @param $dest string the path where the file is to be saved - * @param $contents string the contents to write to the file + * @param string $dest the path where the file is to be saved + * @param string $contents the contents to write to the file * - * @return boolean returns true if successful + * @return bool returns true if successful */ public function writeFile($dest, &$contents) { @@ -217,10 +216,10 @@ public function writeFile($dest, &$contents) /** * Copy a file. * - * @param $source string the source URL for the file - * @param $dest string the path where the file is to be saved + * @param string $source the source URL for the file + * @param string $dest the path where the file is to be saved * - * @return boolean returns true if successful + * @return bool returns true if successful */ public function copyFile($source, $dest) { @@ -239,10 +238,10 @@ public function copyFile($source, $dest) * Copy a directory. * Adapted from code by gimmicklessgpt at gmail dot com, at http://php.net/manual/en/function.copy.php * - * @param $source string the path to the source directory - * @param $dest string the path where the directory is to be saved + * @param string $source the path to the source directory + * @param string $dest the path where the directory is to be saved * - * @return boolean returns true if successful + * @return bool returns true if successful */ public function copyDir($source, $dest) { @@ -279,8 +278,8 @@ public function copyDir($source, $dest) /** * Read a file's contents. * - * @param $filePath string the location of the file to be read - * @param $output boolean output the file's contents instead of returning a string + * @param string $filePath the location of the file to be read + * @param bool $output output the file's contents instead of returning a string * * @return string|boolean */ @@ -313,12 +312,12 @@ public function readFileFromPath($filePath, $output = false) * Download a file. * Outputs HTTP headers and file content for download * - * @param $filePath string the location of the file to be sent - * @param $mediaType string the MIME type of the file, optional - * @param $inline boolean print file as inline instead of attachment, optional - * @param $fileName string Optional filename to use on the client side + * @param string $filePath the location of the file to be sent + * @param string $mediaType the MIME type of the file, optional + * @param bool $inline print file as inline instead of attachment, optional + * @param string $fileName Optional filename to use on the client side * - * @return boolean + * @return bool */ public function downloadByPath($filePath, $mediaType = null, $inline = false, $fileName = null) { @@ -358,9 +357,9 @@ public function downloadByPath($filePath, $mediaType = null, $inline = false, $f /** * Delete a file. * - * @param $filePath string the location of the file to be deleted + * @param string $filePath the location of the file to be deleted * - * @return boolean returns true if successful + * @return bool returns true if successful */ public function deleteByPath($filePath) { @@ -377,10 +376,10 @@ public function deleteByPath($filePath) /** * Create a new directory. * - * @param $dirPath string the full path of the directory to be created - * @param $perms string the permissions level of the directory (optional) + * @param string $dirPath the full path of the directory to be created + * @param string $perms the permissions level of the directory (optional) * - * @return boolean returns true if successful + * @return bool returns true if successful */ public function mkdir($dirPath, $perms = null) { @@ -397,9 +396,9 @@ public function mkdir($dirPath, $perms = null) /** * Remove a directory. * - * @param $dirPath string the full path of the directory to be delete + * @param string $dirPath the full path of the directory to be delete * - * @return boolean returns true if successful + * @return bool returns true if successful */ public function rmdir($dirPath) { @@ -409,9 +408,9 @@ public function rmdir($dirPath) /** * Delete all contents including directory (equivalent to "rm -r") * - * @param $file string the full path of the directory to be removed + * @param string $file the full path of the directory to be removed * - * @return boolean true iff success, otherwise false + * @return bool true iff success, otherwise false */ public function rmtree($file) { @@ -441,10 +440,10 @@ public function rmtree($file) /** * Create a new directory, including all intermediate directories if required (equivalent to "mkdir -p") * - * @param $dirPath string the full path of the directory to be created - * @param $perms string the permissions level of the directory (optional) + * @param string $dirPath the full path of the directory to be created + * @param string $perms the permissions level of the directory (optional) * - * @return boolean returns true if successful + * @return bool returns true if successful */ public function mkdirtree($dirPath, $perms = null) { @@ -465,8 +464,8 @@ public function mkdirtree($dirPath, $perms = null) /** * Check if a file path is valid; * - * @param $filePath string the file/directory to check - * @param $type string (file|dir) the type of path + * @param string $filePath the file/directory to check + * @param string $type (file|dir) the type of path */ public function fileExists($filePath, $type = 'file') { @@ -483,7 +482,7 @@ public function fileExists($filePath, $type = 'file') /** * Returns a file type, based on generic categories defined above * - * @param $type String + * @param string $type * * @return string (Enuemrated DOCUMENT_TYPEs) */ @@ -525,7 +524,7 @@ public function getDocumentType($type) * Returns file extension associated with the given document type, * or false if the type does not belong to a recognized document type. * - * @param $type string + * @param string $type */ public function getDocumentExtension($type) { @@ -549,7 +548,7 @@ public function getDocumentExtension($type) * Returns file extension associated with the given image type, * or false if the type does not belong to a recognized image type. * - * @param $type string + * @param string $type */ public function getImageExtension($type) { @@ -600,7 +599,7 @@ public function getImageExtension($type) /** * Parse file extension from file name. * - * @param string a valid file name + * @param string $fileName a valid file name * * @return string extension */ @@ -630,7 +629,7 @@ public function truncateFileName($fileName, $length = 127) /** * Return pretty file size string (in B, KB, MB, or GB units). * - * @param $size int file size in bytes + * @param int $size file size in bytes * * @return string */ @@ -646,10 +645,10 @@ public function getNiceFileSize($size) /** * Set file/directory mode based on the 'umask' config setting. * - * @param $path string - * @param $mask int + * @param string $path + * @param int $mask * - * @return boolean + * @return bool */ public function setMode($path, $mask) { @@ -663,7 +662,7 @@ public function setMode($path, $mask) /** * Parse the file extension from a filename/path. * - * @param $fileName string + * @param string $fileName * * @return string */ @@ -690,7 +689,7 @@ public function parseFileExtension($fileName) /** * Decompress passed gziped file. * - * @param $filePath string + * @param string $filePath * * @return string The file path that was created. */ @@ -702,7 +701,7 @@ public function decompressFile($filePath) /** * Compress passed file. * - * @param $filePath string The file to be compressed. + * @param string $filePath The file to be compressed. * * @return string The file path that was created. */ @@ -718,8 +717,8 @@ public function compressFile($filePath) /** * Execute gzip to compress or extract files. * - * @param $filePath string file to be compressed or uncompressed. - * @param $decompress boolean optional Set true if the passed file + * @param string $filePath file to be compressed or uncompressed. + * @param bool $decompress optional Set true if the passed file * needs to be decompressed. * * @return string The file path that was created with the operation diff --git a/classes/file/PKPFile.inc.php b/classes/file/PKPFile.inc.php index 55cf228063c..37610da2211 100644 --- a/classes/file/PKPFile.inc.php +++ b/classes/file/PKPFile.inc.php @@ -25,7 +25,7 @@ class PKPFile extends \PKP\core\DataObject /** * Get server-side file name of the file. * - * @param return string + * @return string */ public function getServerFileName() { @@ -35,7 +35,7 @@ public function getServerFileName() /** * Set server-side file name of the file. * - * @param $fileName string + * @param string $fileName */ public function setServerFileName($fileName) { @@ -45,7 +45,7 @@ public function setServerFileName($fileName) /** * Get original uploaded file name of the file. * - * @param return string + * @return string */ public function getOriginalFileName() { @@ -55,7 +55,7 @@ public function getOriginalFileName() /** * Set original uploaded file name of the file. * - * @param $originalFileName string + * @param string $originalFileName */ public function setOriginalFileName($originalFileName) { @@ -93,7 +93,7 @@ public function getDateUploaded() /** * Set uploaded date of file. * - * @param $dateUploaded date + * @param date $dateUploaded */ public function setDateUploaded($dateUploaded) { @@ -113,7 +113,7 @@ public function getFileSize() /** * Set file size of file. * - * @param $fileSize int + * @param int $fileSize */ public function setFileSize($fileSize) { diff --git a/classes/file/PKPLibraryFileManager.inc.php b/classes/file/PKPLibraryFileManager.inc.php index 0257fed0f6e..0b4f8c71078 100644 --- a/classes/file/PKPLibraryFileManager.inc.php +++ b/classes/file/PKPLibraryFileManager.inc.php @@ -27,7 +27,7 @@ class PKPLibraryFileManager extends PrivateFileManager /** * Constructor * - * @param $contextId int + * @param int $contextId */ public function __construct($contextId) { @@ -48,7 +48,7 @@ public function getBasePath() /** * Delete a file by ID. * - * @param $fileId int + * @param int $fileId * * @return int number of files removed */ @@ -65,8 +65,8 @@ public function deleteById($fileId) /** * Generate a filename for a library file. * - * @param $type int LIBRARY_FILE_TYPE_... - * @param $originalFileName string + * @param int $type LIBRARY_FILE_TYPE_... + * @param string $originalFileName * * @return string */ @@ -102,8 +102,8 @@ public function generateFileName($type, $originalFileName) /** * Routine to copy a library file from a temporary file. * - * @param $temporaryFile object - * @param $libraryFileType int LIBRARY_FILE_TYPE_... + * @param object $temporaryFile + * @param int $libraryFileType LIBRARY_FILE_TYPE_... * * @return LibraryFile the generated file, prepared as much as possible for insert (false if upload failed) */ @@ -128,7 +128,7 @@ public function ©FromTemporaryFile(&$temporaryFile, $libraryFileType) /** * Get the file suffix for the given file type * - * @param $type int LIBRARY_FILE_TYPE_... + * @param int $type LIBRARY_FILE_TYPE_... */ public function getFileSuffixFromType($type) { @@ -155,7 +155,7 @@ public function &getTypeSuffixMap() /** * Get the symbolic name from the type * - * @param $type int LIBRARY_FILE_TYPE_... + * @param int $type LIBRARY_FILE_TYPE_... */ public function getNameFromType($type) { @@ -186,7 +186,7 @@ public function &getTypeTitleKeyMap() /** * Get the display name locale key from the type title * - * @param $type int LIBRARY_FILE_TYPE_... + * @param int $type LIBRARY_FILE_TYPE_... */ public function getTitleKeyFromType($type) { diff --git a/classes/file/PKPPublicFileManager.inc.php b/classes/file/PKPPublicFileManager.inc.php index 25fbf1f0857..3841e5de886 100644 --- a/classes/file/PKPPublicFileManager.inc.php +++ b/classes/file/PKPPublicFileManager.inc.php @@ -32,7 +32,7 @@ public function getSiteFilesPath() /** * Get the path to a context's public files directory. * - * @param $contextId int Context ID + * @param int $contextId Context ID * * @return string */ @@ -41,11 +41,11 @@ abstract public function getContextFilesPath($contextId); /** * Upload a file to a context's public directory. * - * @param $contextId int The context ID - * @param $fileName string the name of the file in the upload form - * @param $destFileName string the destination file name + * @param int $contextId The context ID + * @param string $fileName the name of the file in the upload form + * @param string $destFileName the destination file name * - * @return boolean + * @return bool */ public function uploadContextFile($contextId, $fileName, $destFileName) { @@ -55,11 +55,11 @@ public function uploadContextFile($contextId, $fileName, $destFileName) /** * Write a file to a context's public directory. * - * @param $contextId int Context ID - * @param $destFileName string the destination file name - * @param $contents string the contents to write to the file + * @param int $contextId Context ID + * @param string $destFileName the destination file name + * @param string $contents the contents to write to the file * - * @return boolean + * @return bool */ public function writeContextFile($contextId, $destFileName, $contents) { @@ -69,10 +69,10 @@ public function writeContextFile($contextId, $destFileName, $contents) /** * Upload a file to the site's public directory. * - * @param $fileName string the name of the file in the upload form - * @param $destFileName string the destination file name + * @param string $fileName the name of the file in the upload form + * @param string $destFileName the destination file name * - * @return boolean + * @return bool */ public function uploadSiteFile($fileName, $destFileName) { @@ -82,11 +82,11 @@ public function uploadSiteFile($fileName, $destFileName) /** * Copy a file to a context's public directory. * - * @param $contextId int Context ID - * @param $sourceFile string the source of the file to copy - * @param $destFileName string the destination file name + * @param int $contextId Context ID + * @param string $sourceFile the source of the file to copy + * @param string $destFileName the destination file name * - * @return boolean + * @return bool */ public function copyContextFile($contextId, $sourceFile, $destFileName) { @@ -96,10 +96,10 @@ public function copyContextFile($contextId, $sourceFile, $destFileName) /** * Delete a file from a context's public directory. * - * @param $contextId int Context ID - * @param $fileName string the target file name + * @param int $contextId Context ID + * @param string $fileName the target file name * - * @return boolean + * @return bool */ public function removeContextFile($contextId, $fileName) { @@ -109,9 +109,9 @@ public function removeContextFile($contextId, $fileName) /** * Delete a file from the site's public directory. * - * @param $fileName string the target file name + * @param string $fileName the target file name * - * @return boolean + * @return bool */ public function removeSiteFile($fileName) { diff --git a/classes/file/PrivateFileManager.inc.php b/classes/file/PrivateFileManager.inc.php index e19be2db2cd..e3c214e1538 100644 --- a/classes/file/PrivateFileManager.inc.php +++ b/classes/file/PrivateFileManager.inc.php @@ -19,7 +19,7 @@ class PrivateFileManager extends FileManager { - /** var $filesDir */ + /** @var string $filesDir */ public $filesDir; /** diff --git a/classes/file/TemporaryFile.inc.php b/classes/file/TemporaryFile.inc.php index b62ef9eff4f..5a549a5b84b 100644 --- a/classes/file/TemporaryFile.inc.php +++ b/classes/file/TemporaryFile.inc.php @@ -47,7 +47,7 @@ public function getUserId() /** * Set ID of associated user. * - * @param $userId int + * @param int $userId */ public function setUserId($userId) { diff --git a/classes/file/TemporaryFileDAO.inc.php b/classes/file/TemporaryFileDAO.inc.php index 89aeb457921..5a1a30ff9a1 100644 --- a/classes/file/TemporaryFileDAO.inc.php +++ b/classes/file/TemporaryFileDAO.inc.php @@ -24,8 +24,8 @@ class TemporaryFileDAO extends \PKP\db\DAO /** * Retrieve a temporary file by ID. * - * @param $fileId int - * @param $userId int + * @param int $fileId + * @param int $userId * * @return TemporaryFile? */ @@ -53,7 +53,7 @@ public function newDataObject() /** * Internal function to return a TemporaryFile object from a row. * - * @param $row array + * @param array $row * * @return TemporaryFile */ @@ -76,7 +76,7 @@ public function _returnTemporaryFileFromRow($row) /** * Insert a new TemporaryFile. * - * @param $temporaryFile TemporaryFile + * @param TemporaryFile $temporaryFile * * @return int */ @@ -137,8 +137,8 @@ public function updateObject($temporaryFile) /** * Delete a temporary file by ID. * - * @param $fileId int - * @param $userId int + * @param int $fileId + * @param int $userId */ public function deleteTemporaryFileById($fileId, $userId) { @@ -148,7 +148,7 @@ public function deleteTemporaryFileById($fileId, $userId) /** * Delete temporary files by user ID. * - * @param $userId int + * @param int $userId */ public function deleteByUserId($userId) { diff --git a/classes/file/TemporaryFileManager.inc.php b/classes/file/TemporaryFileManager.inc.php index 45a61519add..5321a14c017 100644 --- a/classes/file/TemporaryFileManager.inc.php +++ b/classes/file/TemporaryFileManager.inc.php @@ -57,7 +57,7 @@ public function getFile($fileId, $userId) /** * Delete a file by ID. * - * @param $fileId int + * @param int $fileId */ public function deleteById($fileId, $userId) { @@ -72,10 +72,10 @@ public function deleteById($fileId, $userId) /** * Download a file. * - * @param $fileId int the file id of the file to download - * @param $inline print file as inline instead of attachment, optional + * @param int $fileId the file id of the file to download + * @param bool $inline print file as inline instead of attachment, optional * - * @return boolean + * @return bool */ public function downloadById($fileId, $userId, $inline = false) { @@ -91,8 +91,8 @@ public function downloadById($fileId, $userId, $inline = false) /** * Upload the file and add it to the database. * - * @param $fileName string index into the $_FILES array - * @param $userId int + * @param string $fileName index into the $_FILES array + * @param int $userId * * @return object|boolean The new TemporaryFile or false on failure */ diff --git a/classes/filter/BooleanFilterSetting.inc.php b/classes/filter/BooleanFilterSetting.inc.php index 15a24faeaec..52e15fb6e53 100644 --- a/classes/filter/BooleanFilterSetting.inc.php +++ b/classes/filter/BooleanFilterSetting.inc.php @@ -23,9 +23,9 @@ class BooleanFilterSetting extends FilterSetting /** * Constructor * - * @param $name string - * @param $displayName string - * @param $validationMessage string + * @param string $name + * @param string $displayName + * @param string $validationMessage */ public function __construct($name, $displayName, $validationMessage) { diff --git a/classes/filter/ClassTypeDescription.inc.php b/classes/filter/ClassTypeDescription.inc.php index 95ce54d2f99..55be81f336b 100644 --- a/classes/filter/ClassTypeDescription.inc.php +++ b/classes/filter/ClassTypeDescription.inc.php @@ -27,7 +27,7 @@ class ClassTypeDescription extends TypeDescription /** * Constructor * - * @param $typeName string a fully qualified class name. + * @param string $typeName a fully qualified class name. */ public function __construct($typeName) { @@ -93,7 +93,7 @@ public function checkType(&$object) * Splits a fully qualified class name into * a package and a class name string. * - * @param $typeName the type name to be split up. + * @param string $typeName the type name to be split up. * * @return array an array with the package name * as its first entry and the class name as its diff --git a/classes/filter/CompositeFilter.inc.php b/classes/filter/CompositeFilter.inc.php index 58bf46e968a..2bb457ea70d 100644 --- a/classes/filter/CompositeFilter.inc.php +++ b/classes/filter/CompositeFilter.inc.php @@ -20,14 +20,14 @@ class CompositeFilter extends PersistableFilter /** @var array An ordered array of sub-filters */ public $_filters = []; - /** @var integer the max sequence number that has been attributed so far */ + /** @var int the max sequence number that has been attributed so far */ public $_maxSeq = 0; /** * Constructor * - * @param $filterGroup FilterGroup - * @param $displayName string + * @param FilterGroup $filterGroup + * @param string $displayName */ public function __construct(&$filterGroup, $displayName = null) { @@ -44,9 +44,9 @@ public function __construct(&$filterGroup, $displayName = null) * NB: A filter that is using the sequence number of * another filter will not be added. * - * @param $filter Filter + * @param Filter $filter * - * @return integer the filter's sequence number, null + * @return int the filter's sequence number, null * if the sequence number of the filter had already been * set before by a different filter and the filter has * not been added. @@ -81,7 +81,7 @@ public function addFilter(&$filter) * Identify a filter by sequence * number. * - * @param $seq integer + * @param int $seq * * @return Filter */ @@ -106,7 +106,7 @@ public function &getFilters() /** * Set the settings mappings * - * @param $settingsMapping array + * @param array $settingsMapping * A settings mapping is of the form: * array( * $settingName => array($targetSetting1, $targetSetting2, ...), @@ -364,7 +364,7 @@ public function hasData($key, $locale = null) * they are identical and return only the first * one. * - * @param $settingName string + * @param string $settingName * * @return $compositeSettingName string */ @@ -386,7 +386,7 @@ public function _getCompositeSettingName($settingName) * then we assume that those settings are identical * and will return only the first one. * - * @param $settingName string a mapped sub-filter setting + * @param string $settingName a mapped sub-filter setting * * @return FilterSetting */ @@ -402,7 +402,7 @@ public function &_getSubfilterSetting($settingName) * Split a composite setting name and identify the * corresponding sub-filter and setting name. * - * @param $compositeSettingName string + * @param string $compositeSettingName * * @return array the first entry will be the sub-filter * and the second entry the setting name. diff --git a/classes/filter/EmailFilterSetting.inc.php b/classes/filter/EmailFilterSetting.inc.php index eae0533b7d2..06e20e5340c 100644 --- a/classes/filter/EmailFilterSetting.inc.php +++ b/classes/filter/EmailFilterSetting.inc.php @@ -23,10 +23,10 @@ class EmailFilterSetting extends FilterSetting /** * Constructor * - * @param $name string - * @param $displayName string - * @param $validationMessage string - * @param $required boolean + * @param string $name + * @param string $displayName + * @param string $validationMessage + * @param bool $required */ public function __construct($name, $displayName, $validationMessage, $required = FormValidator::FORM_VALIDATOR_REQUIRED_VALUE) { diff --git a/classes/filter/Filter.inc.php b/classes/filter/Filter.inc.php index 30f063bb681..25654ee4fd8 100644 --- a/classes/filter/Filter.inc.php +++ b/classes/filter/Filter.inc.php @@ -89,10 +89,10 @@ class Filter extends \PKP\core\DataObject /** @var TypeDescription */ public $_outputType; - /** */ + /** @var mixed */ public $_input; - /** */ + /** @var mixed */ public $_output; /** @var array a list of errors occurred while filtering */ @@ -111,8 +111,8 @@ class Filter extends \PKP\core\DataObject * * @see TypeDescription * - * @param $inputType string a string representation of a TypeDescription - * @param $outputType string a string representation of a TypeDescription + * @param string $inputType a string representation of a TypeDescription + * @param string $outputType a string representation of a TypeDescription */ public function __construct($inputType, $outputType) { @@ -127,7 +127,7 @@ public function __construct($inputType, $outputType) /** * Set the display name * - * @param $displayName string + * @param string $displayName */ public function setDisplayName($displayName) { @@ -157,7 +157,7 @@ public function getDisplayName() /** * Set the sequence id * - * @param $seq integer + * @param int $seq */ public function setSequence($seq) { @@ -167,7 +167,7 @@ public function setSequence($seq) /** * Get the sequence id * - * @return integer + * @return int */ public function getSequence() { @@ -177,8 +177,8 @@ public function getSequence() /** * Set the input/output type of this filter group. * - * @param $inputType TypeDescription|string - * @param $outputType TypeDescription|string + * @param TypeDescription|string $inputType + * @param TypeDescription|string $outputType * * @see TypeDescriptionFactory::instantiateTypeDescription() for more details */ @@ -264,7 +264,7 @@ public function &getLastInput() /** * Add a filter error * - * @param $message string + * @param string $message */ public function addError($message) { @@ -284,7 +284,7 @@ public function getErrors() /** * Whether this filter has produced errors. * - * @return boolean + * @return bool */ public function hasErrors() { @@ -302,7 +302,7 @@ public function clearErrors() /** * Set the required runtime environment * - * @param $runtimeEnvironment RuntimeEnvironment + * @param RuntimeEnvironment $runtimeEnvironment */ public function setRuntimeEnvironment(&$runtimeEnvironment) { @@ -336,7 +336,7 @@ public function &getRuntimeEnvironment() * This method performs the actual data processing. * NB: sub-classes must implement this method. * - * @param $input mixed validated filter input data + * @param mixed $input validated filter input data * * @return mixed non-validated filter output or null * if processing was not successful. @@ -368,10 +368,8 @@ public function &process(&$input) * implement any required stateful inspection * of the provided objects. * - * @param $input mixed - * @param $output mixed * - * @return boolean + * @return bool */ public function supports(&$input, &$output) { @@ -398,9 +396,8 @@ public function supports(&$input, &$output) * NB: sub-classes will not normally override * this method. * - * @param $input mixed * - * @return boolean + * @return bool */ public function supportsAsInput(&$input) { @@ -412,7 +409,7 @@ public function supportsAsInput(&$input) * Check whether the filter is compatible with * the required runtime environment. * - * @return boolean + * @return bool */ public function isCompatibleWithRuntimeEnvironment() { @@ -460,9 +457,9 @@ public function isCompatibleWithRuntimeEnvironment() * NB: sub-classes will not normally override * this method. * - * @param $input mixed an input value that is supported + * @param mixed $input an input value that is supported * by this filter - * @param $returnErrors boolean whether the value + * @param bool $returnErrors whether the value * should be returned also if an error occurred * * @return mixed a valid return value or null diff --git a/classes/filter/FilterDAO.inc.php b/classes/filter/FilterDAO.inc.php index 62c6b9dfdb3..5844545cda5 100644 --- a/classes/filter/FilterDAO.inc.php +++ b/classes/filter/FilterDAO.inc.php @@ -60,14 +60,14 @@ class FilterDAO extends \PKP\db\DAO * Instantiates a new filter from configuration data and then * installs it. * - * @param $filterClassName string - * @param $filterGroupSymbolic string - * @param $settings array key-value pairs that can be directly written + * @param string $filterClassName + * @param string $filterGroupSymbolic + * @param array $settings key-value pairs that can be directly written * via \PKP\core\DataObject::setData(). - * @param $asTemplate boolean - * @param $contextId integer the context the filter should be installed into - * @param $subFilters array sub-filters (only allowed when the filter is a CompositeFilter) - * @param $persist boolean whether to actually persist the filter + * @param bool $asTemplate + * @param int $contextId the context the filter should be installed into + * @param array $subFilters sub-filters (only allowed when the filter is a CompositeFilter) + * @param bool $persist whether to actually persist the filter * * @return PersistableFilter|boolean the new filter if installation successful, otherwise 'false'. */ @@ -118,10 +118,10 @@ public function configureObject($filterClassName, $filterGroupSymbolic, $setting /** * Insert a new filter instance (transformation). * - * @param $filter PersistableFilter The configured filter instance to be persisted - * @param $contextId integer + * @param PersistableFilter $filter The configured filter instance to be persisted + * @param int $contextId * - * @return integer the new filter id + * @return int the new filter id */ public function insertObject($filter, $contextId = \PKP\core\PKPApplication::CONTEXT_ID_NONE) { @@ -158,7 +158,7 @@ public function insertObject($filter, $contextId = \PKP\core\PKPApplication::CON /** * Retrieve a configured filter instance (transformation) * - * @param $filter PersistableFilter + * @param PersistableFilter $filter * * @return PersistableFilter */ @@ -170,8 +170,8 @@ public function getObject($filter) /** * Retrieve a configured filter instance (transformation) by id. * - * @param $filterId integer - * @param $allowSubfilter boolean + * @param int $filterId + * @param bool $allowSubfilter * * @return PersistableFilter */ @@ -191,11 +191,11 @@ public function getObjectById($filterId, $allowSubfilter = false) * Retrieve a result set with all filter instances * (transformations) that are based on the given class. * - * @param $className string - * @param $contextId integer - * @param $getTemplates boolean set true if you want filter templates + * @param string $className + * @param int $contextId + * @param bool $getTemplates set true if you want filter templates * rather than actual transformations - * @param $allowSubfilters boolean + * @param bool $allowSubfilters * * @return DAOResultFactory */ @@ -218,12 +218,12 @@ class_name = ? AND * (transformations) within a given group that are * based on the given class. * - * @param $groupSymbolic string - * @param $className string - * @param $contextId integer - * @param $getTemplates boolean set true if you want filter templates + * @param string $groupSymbolic + * @param string $className + * @param int $contextId + * @param bool $getTemplates set true if you want filter templates * rather than actual transformations - * @param $allowSubfilters boolean + * @param bool $allowSubfilters * * @return DAOResultFactory */ @@ -244,12 +244,12 @@ public function getObjectsByGroupAndClass($groupSymbolic, $className, $contextId /** * Retrieve filters based on the supported input/output type. * - * @param $inputTypeDescription a type description that has to match the input type - * @param $outputTypeDescription a type description that has to match the output type + * @param string $inputTypeDescription a type description that has to match the input type + * @param string $outputTypeDescription a type description that has to match the output type * NB: input and output type description can contain wildcards. - * @param $data mixed the data to be matched by the filter. If no data is given then + * @param mixed $data the data to be matched by the filter. If no data is given then * all filters will be matched. - * @param $dataIsInput boolean true if the given data object is to be checked as + * @param bool $dataIsInput true if the given data object is to be checked as * input type, false to check against the output type. * * @return array a list of matched filters. @@ -315,12 +315,12 @@ public function getObjectsByTypeDescription($inputTypeDescription, $outputTypeDe * Only filters supported by the current run-time environment * will be returned when $checkRuntimeEnvironment is set to 'true'. * - * @param $groupSymbolic string - * @param $contextId integer returns filters from context 0 and + * @param string $groupSymbolic + * @param int $contextId returns filters from context 0 and * the given filters of all contexts if set to null - * @param $getTemplates boolean set true if you want filter templates + * @param bool $getTemplates set true if you want filter templates * rather than actual transformations - * @param $checkRuntimeEnvironment boolean whether to remove filters + * @param bool $checkRuntimeEnvironment whether to remove filters * from the result set that do not match the current run-time environment. * * @return array filter instances (transformations) in the given group @@ -355,7 +355,7 @@ public function getObjectsByGroup($groupSymbolic, $contextId = \PKP\core\PKPAppl /** * Update an existing filter instance (transformation). * - * @param $filter PersistableFilter + * @param PersistableFilter $filter */ public function updateObject($filter) { @@ -400,9 +400,9 @@ class_name = ?, /** * Delete a filter instance (transformation). * - * @param $filter PersistableFilter + * @param PersistableFilter $filter * - * @return boolean + * @return bool */ public function deleteObject($filter) { @@ -412,9 +412,9 @@ public function deleteObject($filter) /** * Delete a filter instance (transformation) by id. * - * @param $filterId int + * @param int $filterId * - * @return boolean + * @return bool */ public function deleteObjectById($filterId) { @@ -495,8 +495,8 @@ public function getInsertId() /** * Construct a new configured filter instance (transformation). * - * @param $filterClassName string a fully qualified class name - * @param $filterGroupId integer + * @param string $filterClassName a fully qualified class name + * @param int $filterGroupId * * @return PersistableFilter */ @@ -520,7 +520,7 @@ public function _newDataObject($filterClassName, $filterGroupId) * Internal function to return a filter instance (transformation) * object from a row. * - * @param $row array + * @param array $row * * @return PersistableFilter */ @@ -564,7 +564,7 @@ public function _fromRow($row) * Populate the sub-filters (if any) for the * given parent filter. * - * @param $parentFilter PersistableFilter + * @param PersistableFilter $parentFilter */ public function _populateSubFilters($parentFilter) { @@ -594,7 +594,7 @@ public function _populateSubFilters($parentFilter) * Recursively insert sub-filters of * the given parent filter. * - * @param $parentFilter Filter + * @param Filter $parentFilter */ public function _insertSubFilters($parentFilter) { @@ -616,7 +616,7 @@ public function _insertSubFilters($parentFilter) * Recursively delete all sub-filters for * the given parent filter. * - * @param $parentFilterId integer + * @param int $parentFilterId */ public function _deleteSubFiltersByParentFilterId($parentFilterId) { diff --git a/classes/filter/FilterGroup.inc.php b/classes/filter/FilterGroup.inc.php index 6cf2548646d..1064002e350 100644 --- a/classes/filter/FilterGroup.inc.php +++ b/classes/filter/FilterGroup.inc.php @@ -49,7 +49,7 @@ class FilterGroup extends \PKP\core\DataObject /** * Set the symbolic name * - * @param $symbolic string + * @param string $symbolic */ public function setSymbolic($symbolic) { @@ -69,7 +69,7 @@ public function getSymbolic() /** * Set the display name * - * @param $displayName string + * @param string $displayName */ public function setDisplayName($displayName) { @@ -89,7 +89,7 @@ public function getDisplayName() /** * Set the description * - * @param $description string + * @param string $description */ public function setDescription($description) { @@ -109,7 +109,7 @@ public function getDescription() /** * Set the input type * - * @param $inputType string a string representation of a TypeDescription + * @param string $inputType a string representation of a TypeDescription */ public function setInputType($inputType) { @@ -129,7 +129,7 @@ public function getInputType() /** * Set the output type * - * @param $outputType string a string representation of a TypeDescription + * @param string $outputType a string representation of a TypeDescription */ public function setOutputType($outputType) { diff --git a/classes/filter/FilterGroupDAO.inc.php b/classes/filter/FilterGroupDAO.inc.php index 173a756871a..858e2465e11 100644 --- a/classes/filter/FilterGroupDAO.inc.php +++ b/classes/filter/FilterGroupDAO.inc.php @@ -24,9 +24,9 @@ class FilterGroupDAO extends \PKP\db\DAO /** * Insert a new filter group. * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup * - * @return integer the new filter group id + * @return int the new filter group id */ public function insertObject(&$filterGroup) { @@ -49,7 +49,7 @@ public function insertObject(&$filterGroup) /** * Retrieve a filter group * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup * * @return FilterGroup */ @@ -61,7 +61,7 @@ public function getObject($filterGroup) /** * Retrieve a configured filter group by id. * - * @param $filterGroupId integer + * @param int $filterGroupId * * @return FilterGroup */ @@ -79,7 +79,7 @@ public function getObjectById($filterGroupId) /** * Retrieve a configured filter group by its symbolic representation. * - * @param $filterGroupSymbolic string + * @param string $filterGroupSymbolic * * @return FilterGroup */ @@ -98,7 +98,7 @@ public function getObjectBySymbolic($filterGroupSymbolic) /** * Update an existing filter group. * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function updateObject(&$filterGroup) { @@ -124,9 +124,9 @@ public function updateObject(&$filterGroup) /** * Delete a filter group (only works if there are not more filters in this group). * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup * - * @return boolean + * @return bool */ public function deleteObject($filterGroup) { @@ -153,9 +153,9 @@ public function deleteObject($filterGroup) /** * Delete a filter group by id. * - * @param $filterGroupId int + * @param int $filterGroupId * - * @return boolean + * @return bool */ public function deleteObjectById($filterGroupId) { @@ -170,9 +170,9 @@ public function deleteObjectById($filterGroupId) /** * Delete a filter group by symbolic name. * - * @param $filterGroupSymbolic string + * @param string $filterGroupSymbolic * - * @return boolean + * @return bool */ public function deleteObjectBySymbolic($filterGroupSymbolic) { @@ -215,7 +215,7 @@ public function newDataObject() * Internal function to return a filter group * object from a row. * - * @param $row array + * @param array $row * * @return FilterGroup */ diff --git a/classes/filter/FilterHelper.inc.php b/classes/filter/FilterHelper.inc.php index b5c1177a7c7..92267572a6e 100644 --- a/classes/filter/FilterHelper.inc.php +++ b/classes/filter/FilterHelper.inc.php @@ -26,7 +26,7 @@ class FilterHelper * element. * @endverbatim * - * @param $filterGroupsNode XMLNode + * @param XMLNode $filterGroupsNode */ public function installFilterGroups($filterGroupsNode) { @@ -66,8 +66,8 @@ public function installFilterGroups($filterGroupsNode) * which represents a element. * @endverbatim * - * @param $filterNode XMLNode - * @param $persist boolean whether to install the filter + * @param XMLNode $filterNode + * @param bool $persist whether to install the filter * * @return PersistableFilter the installed filter. */ @@ -144,11 +144,11 @@ public function &configureFilter($filterNode, $persist = true) * Recursively compares two filters (filter A and filter B) * based on their settings and sub-filters. * - * @param $filterA PersistableFilter - * @param $filterBSettings array an array of key/value pairs - * @param $filterBSubfilters array an array of filters + * @param PersistableFilter $filterA + * @param array $filterBSettings an array of key/value pairs + * @param array $filterBSubfilters an array of filters * - * @return boolean true if the two transformations are identical, false otherwise + * @return bool true if the two transformations are identical, false otherwise */ public function compareFilters(&$filterA, $filterBSettings, &$filterBSubfilters) { @@ -201,7 +201,7 @@ public function compareFilters(&$filterA, $filterBSettings, &$filterBSubfilters) * from the children of a element. * @endverbatim * - * @param $settingNode XMLNode + * @param XMLNode $settingNode * * @return $setting array a key-value pair. */ @@ -255,7 +255,7 @@ public function getFilterSetting($settingNode) /** * Recursively read an array from an XML element list. * - * @param $arrayNode XMLNode + * @param XMLNode $arrayNode * * @return array */ diff --git a/classes/filter/FilterSetting.inc.php b/classes/filter/FilterSetting.inc.php index 03fcb8dc1b0..3071bdc3b88 100644 --- a/classes/filter/FilterSetting.inc.php +++ b/classes/filter/FilterSetting.inc.php @@ -28,20 +28,20 @@ class FilterSetting /** @var string */ public $_validationMessage; - /** @var boolean */ + /** @var bool */ public $_required; - /** @var boolean */ + /** @var bool */ public $_isLocalized; /** * Constructor * - * @param $name string - * @param $displayName string - * @param $validationMessage string - * @param $required string - * @param $isLocalized boolean + * @param string $name + * @param string $displayName + * @param string $validationMessage + * @param string $required + * @param bool $isLocalized */ public function __construct($name, $displayName, $validationMessage, $required = FormValidator::FORM_VALIDATOR_REQUIRED_VALUE, $isLocalized = false) { @@ -58,7 +58,7 @@ public function __construct($name, $displayName, $validationMessage, $required = /** * Set the setting name * - * @param $name string + * @param string $name */ public function setName($name) { @@ -78,7 +78,7 @@ public function getName() /** * Set the display name * - * @param $displayName string + * @param string $displayName */ public function setDisplayName($displayName) { @@ -98,7 +98,7 @@ public function getDisplayName() /** * Set the validation message * - * @param $validationMessage string + * @param string $validationMessage */ public function setValidationMessage($validationMessage) { @@ -118,7 +118,7 @@ public function getValidationMessage() /** * Set the required flag * - * @param $required string + * @param string $required */ public function setRequired($required) { @@ -138,7 +138,7 @@ public function getRequired() /** * Set the localization flag * - * @param $isLocalized boolean + * @param bool $isLocalized */ public function setIsLocalized($isLocalized) { @@ -148,7 +148,7 @@ public function setIsLocalized($isLocalized) /** * Get the localization flag * - * @return boolean + * @return bool */ public function getIsLocalized() { diff --git a/classes/filter/GenericMultiplexerFilter.inc.php b/classes/filter/GenericMultiplexerFilter.inc.php index 03f8d9c9210..838331e6538 100644 --- a/classes/filter/GenericMultiplexerFilter.inc.php +++ b/classes/filter/GenericMultiplexerFilter.inc.php @@ -22,7 +22,7 @@ class GenericMultiplexerFilter extends CompositeFilter { /** - * @var boolean whether some sub-filters can fail as long as at least one + * @var bool whether some sub-filters can fail as long as at least one * filter returns a result. */ public $_tolerateFailures = false; @@ -30,8 +30,8 @@ class GenericMultiplexerFilter extends CompositeFilter /** * Constructor * - * @param $filterGroup FilterGroup - * @param $displayName string + * @param FilterGroup $filterGroup + * @param string $displayName */ public function __construct(&$filterGroup, $displayName = null) { @@ -46,7 +46,7 @@ public function __construct(&$filterGroup, $displayName = null) * Set to true if sub-filters can fail as long as * at least one filter returns a result. * - * @param $tolerateFailures boolean + * @param bool $tolerateFailures */ public function setTolerateFailures($tolerateFailures) { @@ -57,7 +57,7 @@ public function setTolerateFailures($tolerateFailures) * Returns true when sub-filters can fail as long * as at least one filter returns a result. * - * @return boolean + * @return bool */ public function getTolerateFailures() { @@ -83,8 +83,6 @@ public function getClassName() /** * @see Filter::process() * - * @param $input mixed - * * @return array */ public function &process(&$input) diff --git a/classes/filter/GenericSequencerFilter.inc.php b/classes/filter/GenericSequencerFilter.inc.php index 48839dcb4a6..948fa4bfc8f 100644 --- a/classes/filter/GenericSequencerFilter.inc.php +++ b/classes/filter/GenericSequencerFilter.inc.php @@ -48,7 +48,6 @@ public function getClassName() /** * @see Filter::process() * - * @param $input mixed */ public function &process(&$input) { diff --git a/classes/filter/PersistableFilter.inc.php b/classes/filter/PersistableFilter.inc.php index 3ab31eafc82..823d54a7bf1 100644 --- a/classes/filter/PersistableFilter.inc.php +++ b/classes/filter/PersistableFilter.inc.php @@ -63,7 +63,7 @@ class PersistableFilter extends Filter * configured via DataObject::setData(). Only parameters * that are available in the DataObject will be persisted. * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -104,7 +104,7 @@ public function getFilterGroup() * There must be exactly one transformation template * for each supported filter group. * - * @param $isTemplate boolean + * @param bool $isTemplate */ public function setIsTemplate($isTemplate) { @@ -115,7 +115,7 @@ public function setIsTemplate($isTemplate) * Is this a transformation template rather than * an actual transformation? * - * @return boolean + * @return bool */ public function getIsTemplate() { @@ -125,7 +125,7 @@ public function getIsTemplate() /** * Set the parent filter id * - * @param $parentFilterId integer + * @param int $parentFilterId */ public function setParentFilterId($parentFilterId) { @@ -135,7 +135,7 @@ public function setParentFilterId($parentFilterId) /** * Get the parent filter id * - * @return integer + * @return int */ public function getParentFilterId() { @@ -145,7 +145,7 @@ public function getParentFilterId() /** * Add a filter setting * - * @param $setting FilterSetting + * @param FilterSetting $setting */ public function addSetting($setting) { @@ -165,7 +165,7 @@ public function addSetting($setting) /** * Get a filter setting * - * @param $settingName string + * @param string $settingName * * @return FilterSetting */ @@ -197,7 +197,7 @@ public function hasSetting($settingName) /** * Can this filter be parameterized? * - * @return boolean + * @return bool */ public function hasSettings() { @@ -287,8 +287,8 @@ public function getLocalizedSettingNames() * filter group on the fly with only an input and an output type * which takes away at least some of the cruft. * - * @param $inputType string - * @param $outputType string + * @param string $inputType + * @param string $outputType */ public static function tempGroup($inputType, $outputType) { diff --git a/classes/filter/PrimitiveTypeDescription.inc.php b/classes/filter/PrimitiveTypeDescription.inc.php index 45855505726..5ad60d6272a 100644 --- a/classes/filter/PrimitiveTypeDescription.inc.php +++ b/classes/filter/PrimitiveTypeDescription.inc.php @@ -22,7 +22,7 @@ class PrimitiveTypeDescription extends TypeDescription /** * Constructor * - * @param $typeName string Allowed primitive types are + * @param string $typeName Allowed primitive types are * 'integer', 'string', 'float' and 'boolean'. */ public function __construct($typeName) @@ -85,7 +85,6 @@ public function checkType(&$object) /** * Return a string representation of a primitive type. * - * @param $variable mixed */ public function _getPrimitiveTypeName(&$variable) { diff --git a/classes/filter/SetFilterSetting.inc.php b/classes/filter/SetFilterSetting.inc.php index f66d03f2bb6..05ca4b26ff0 100644 --- a/classes/filter/SetFilterSetting.inc.php +++ b/classes/filter/SetFilterSetting.inc.php @@ -26,11 +26,11 @@ class SetFilterSetting extends FilterSetting /** * Constructor * - * @param $name string - * @param $displayName string - * @param $validationMessage string - * @param $acceptedValues array - * @param $required boolean + * @param string $name + * @param string $displayName + * @param string $validationMessage + * @param array $acceptedValues + * @param bool $required */ public function __construct($name, $displayName, $validationMessage, $acceptedValues, $required = FormValidator::FORM_VALIDATOR_REQUIRED_VALUE) { @@ -44,7 +44,7 @@ public function __construct($name, $displayName, $validationMessage, $acceptedVa /** * Set the accepted values * - * @param $acceptedValues array + * @param array $acceptedValues */ public function setAcceptedValues($acceptedValues) { diff --git a/classes/filter/TemplateBasedFilter.inc.php b/classes/filter/TemplateBasedFilter.inc.php index c1b8aeb13d5..d80d801fa23 100644 --- a/classes/filter/TemplateBasedFilter.inc.php +++ b/classes/filter/TemplateBasedFilter.inc.php @@ -18,8 +18,6 @@ use APP\template\TemplateManager; -use PKPK\filter\PersistableFilter; - class TemplateBasedFilter extends PersistableFilter { // @@ -52,10 +50,10 @@ public function getTemplateName() * Sub-classes must implement this method to add * template variables to the template. * - * @param $templateMgr TemplateManager - * @param $input mixed the filter input - * @param $request Request - * @param $locale AppLocale + * @param TemplateManager $templateMgr + * @param mixed $input the filter input + * @param Request $request + * @param string $locale */ public function addTemplateVars($templateMgr, &$input, $request, &$locale) { diff --git a/classes/filter/TypeDescription.inc.php b/classes/filter/TypeDescription.inc.php index 29c97c548e2..362dc2a07b3 100644 --- a/classes/filter/TypeDescription.inc.php +++ b/classes/filter/TypeDescription.inc.php @@ -52,13 +52,13 @@ class TypeDescription /** @var string the unparsed type name */ public $_typeName; - /** @var integer the cardinality of the type */ + /** @var int the cardinality of the type */ public $_cardinality; /** * Constructor * - * @param $typeName string A plain text type name to be parsed + * @param string $typeName A plain text type name to be parsed * by this type description class. * * Type names can be any string. This base class provides a basic @@ -124,9 +124,8 @@ public function getTypeDescription() * Checks whether the given object complies * with the type description. * - * @param $object mixed * - * @return boolean + * @return bool */ public function isCompatible($object) { @@ -184,9 +183,9 @@ public function isCompatible($object) /** * Parse a type name * - * @param $typeName string + * @param string $typeName * - * @return boolean true if success, otherwise false + * @return bool true if success, otherwise false */ public function parseTypeName($typeName) { @@ -197,9 +196,8 @@ public function parseTypeName($typeName) /** * Validates an object against the internal type description. * - * @param $object mixed * - * @return boolean + * @return bool */ public function checkType(&$object) { @@ -216,7 +214,7 @@ public function checkType(&$object) * then delegate to the subclass to do the type-specific * parsing. * - * @param $typeName string + * @param string $typeName */ public function _parseTypeNameInternally($typeName) { diff --git a/classes/filter/TypeDescriptionFactory.inc.php b/classes/filter/TypeDescriptionFactory.inc.php index e4223e24560..837ee879e1f 100644 --- a/classes/filter/TypeDescriptionFactory.inc.php +++ b/classes/filter/TypeDescriptionFactory.inc.php @@ -64,7 +64,7 @@ public static function getInstance() * Takes a plain text type descriptor, identifies the namespace * and instantiates the corresponding type description object. * - * @param $typeDescription string A plain text type description. + * @param string $typeDescription A plain text type description. * * Type descriptions consist of two parts: * * a type namespace @@ -77,7 +77,7 @@ public static function getInstance() * Each namespace will be mapped to one subclass of the TypeDescription * class which will then be responsible to parse the given type name. * - * @return TypeDescription or null if the type description is invalid. + * @return TypeDescription|null if the type description is invalid. */ public function &instantiateTypeDescription($typeDescription) { @@ -114,7 +114,7 @@ public function &instantiateTypeDescription($typeDescription) * * FIXME: Move this map to the Application object. * - * @param $namespace string + * @param string $namespace * * @return string */ diff --git a/classes/form/Form.inc.php b/classes/form/Form.inc.php index 92c5cfaf67f..d1ea1344452 100644 --- a/classes/form/Form.inc.php +++ b/classes/form/Form.inc.php @@ -32,28 +32,28 @@ class Form { - /** The template file containing the HTML form */ + /** @var string The template file containing the HTML form */ public $_template; - /** Associative array containing form data */ + /** @var array Associative array containing form data */ public $_data; - /** Validation checks for this form */ + /** @var array Validation checks for this form */ public $_checks; - /** Errors occurring in form validation */ + /** @var array Errors occurring in form validation */ public $_errors; - /** Array of field names where an error occurred and the associated error message */ + /** @var array Array of field names where an error occurred and the associated error message */ public $errorsArray; - /** Array of field names where an error occurred */ + /** @var array Array of field names where an error occurred */ public $errorFields; - /** Array of errors for the form section currently being processed */ + /** @var array Array of errors for the form section currently being processed */ public $formSectionErrors; - /** Client-side validation rules **/ + /** @var array Client-side validation rules */ public $cssValidation; /** @var string Symbolic name of required locale */ @@ -68,7 +68,7 @@ class Form /** * Constructor. * - * @param $template string the path to the form template file + * @param string $template the path to the form template file * @param null|mixed $requiredLocale * @param null|mixed $supportedLocales */ @@ -110,7 +110,7 @@ public function __construct($template = null, $callHooks = true, $requiredLocale /** * Set the template * - * @param $template string + * @param string $template */ public function setTemplate($template) { @@ -144,8 +144,8 @@ public function getRequiredLocale() /** * Display the form. * - * @param $request PKPRequest - * @param $template string the template to be rendered, mandatory + * @param PKPRequest $request + * @param string $template the template to be rendered, mandatory * if no template has been specified on class instantiation. */ public function display($request = null, $template = null) @@ -156,10 +156,10 @@ public function display($request = null, $template = null) /** * Returns a string of the rendered form * - * @param $request PKPRequest - * @param $template string the template to be rendered, mandatory + * @param PKPRequest $request + * @param string $template the template to be rendered, mandatory * if no template has been specified on class instantiation. - * @param $display boolean + * @param bool $display * * @return string the rendered form */ @@ -214,7 +214,7 @@ public function fetch($request, $template = null, $display = false) /** * Get the value of a form field. * - * @param $key string + * @param string $key */ public function getData($key) { @@ -224,8 +224,7 @@ public function getData($key) /** * Set the value of one or several form fields. * - * @param $key string|array If a string, then set a single field. If an associative array, then set many. - * @param $value mixed + * @param string|array $key If a string, then set a single field. If an associative array, then set many. */ public function setData($key, $value = null) { @@ -264,7 +263,7 @@ public function readInputData() /** * Validate form data. * - * @param $callHooks boolean True (default) iff hooks are to be called. + * @param bool $callHooks True (default) iff hooks are to be called. */ public function validate($callHooks = true) { @@ -372,7 +371,7 @@ public function getDefaultFormLocale() /** * Set the default form locale. * - * @param $defaultLocale string + * @param string $defaultLocale */ public function setDefaultFormLocale($defaultLocale) { @@ -382,7 +381,7 @@ public function setDefaultFormLocale($defaultLocale) /** * Add a supported locale. * - * @param $supportedLocale string + * @param string $supportedLocale */ public function addSupportedFormLocale($supportedLocale) { @@ -398,7 +397,7 @@ public function addSupportedFormLocale($supportedLocale) /** * Adds specified user variables to input data. * - * @param $vars array the names of the variables to read + * @param array $vars the names of the variables to read */ public function readUserVars($vars) { @@ -418,7 +417,7 @@ public function readUserVars($vars) /** * Add a validation check to the form. * - * @param $formValidator FormValidator + * @param FormValidator $formValidator */ public function addCheck($formValidator) { @@ -429,7 +428,7 @@ public function addCheck($formValidator) * Add an error to the form. * Errors are typically assigned as the form is validated. * - * @param $field string the name of the field where the error occurred + * @param string $field the name of the field where the error occurred */ public function addError($field, $message) { @@ -439,7 +438,7 @@ public function addError($field, $message) /** * Add an error field for highlighting on form * - * @param $field string the name of the field where the error occurred + * @param string $field the name of the field where the error occurred */ public function addErrorField($field) { @@ -449,7 +448,7 @@ public function addErrorField($field) /** * Check if form passes all validation checks. * - * @return boolean + * @return bool */ public function isValid() { @@ -480,9 +479,9 @@ public function getErrorsArray() * Convert PHP variable (literals or arrays) into HTML containing * hidden input fields. * - * @param $name string Name of variable - * @param $value mixed Value of variable - * @param $stack array Names of array keys (for recursive calling) + * @param string $name Name of variable + * @param mixed $value Value of variable + * @param array $stack Names of array keys (for recursive calling) * * @return string HTML hidden form elements describing the parameters. */ diff --git a/classes/form/FormBuilderVocabulary.inc.php b/classes/form/FormBuilderVocabulary.inc.php index aefd590c99b..d4788cf7827 100644 --- a/classes/form/FormBuilderVocabulary.inc.php +++ b/classes/form/FormBuilderVocabulary.inc.php @@ -60,16 +60,16 @@ class FormBuilderVocabulary { - /** Form associated with this object, if any. Will inform smarty which forms to label as required **/ + /** @var Form associated with this object, if any. Will inform smarty which forms to label as required */ public $_form; - /** Styles organized by parameter name */ + /** @var array Styles organized by parameter name */ public $_fbvStyles; /** * Constructor. * - * @param $form object Form associated with this object + * @param object $form Form associated with this object */ public function __construct($form = null) { @@ -86,7 +86,7 @@ public function __construct($form = null) /** * Set the form * - * @param $form object + * @param object $form */ public function setForm($form) { @@ -123,10 +123,10 @@ public function getStyles() /** * A form area that contains form sections. * - * @param $params array - * @param $content string - * @param $smarty object - * @param $repeat + * @param array $params + * @param string $content + * @param object $smarty + * @param bool $repeat */ public function smartyFBVFormArea($params, $content, $smarty, &$repeat) { @@ -147,10 +147,10 @@ public function smartyFBVFormArea($params, $content, $smarty, &$repeat) /** * A form section that contains controls in a variety of layout possibilities. * - * @param $params array - * @param $content string - * @param $smarty object - * @param $repeat + * @param array $params + * @param string $content + * @param object $smarty + * @param bool $repeat */ public function smartyFBVFormSection($params, $content, $smarty, &$repeat) { @@ -222,8 +222,8 @@ public function smartyFBVFormSection($params, $content, $smarty, &$repeat) /** * Submit and (optional) cancel button for a form. * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function smartyFBVFormButtons($params, $smarty) { @@ -245,8 +245,8 @@ public function smartyFBVFormButtons($params, $smarty) /** * Base form element. * - * @param $params array - * @param $smarty object- + * @param array $params + * @param object $smarty * @param null|mixed $content */ public function smartyFBVElement($params, $smarty, $content = null) @@ -340,8 +340,8 @@ public function smartyFBVElement($params, $smarty, $content = null) * Form button. * parameters: label (or value), disabled (optional), type (optional) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVButton($params, $smarty) { @@ -372,8 +372,8 @@ public function _smartyFBVButton($params, $smarty) * Form Autocomplete text input. (actually two inputs, label and value) * parameters: disabled (optional), name (optional - assigned value of 'id' by default) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVAutocompleteInput($params, $smarty) { @@ -407,8 +407,8 @@ public function _smartyFBVAutocompleteInput($params, $smarty) * Form text input. * parameters: disabled (optional), name (optional - assigned value of 'id' by default), multilingual (optional) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVTextInput($params, $smarty) { @@ -482,8 +482,8 @@ public function _smartyFBVTextInput($params, $smarty) * - multilingual: boolean (default false) * - rich: false (default), true, or 'extended' * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVTextArea($params, $smarty) { @@ -550,8 +550,8 @@ public function _smartyFBVTextArea($params, $smarty) * Hidden input element. * parameters: value, id, name (optional - assigned value of 'id' by default), disabled (optional), multilingual (optional) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVHiddenInput($params, $smarty) { @@ -582,8 +582,8 @@ public function _smartyFBVHiddenInput($params, $smarty) * parameters: from [array], selected [array index], defaultLabel (optional), defaultValue (optional), disabled (optional), * translate (optional), name (optional - value of 'id' by default) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVSelect($params, $smarty) { @@ -634,8 +634,8 @@ public function _smartyFBVSelect($params, $smarty) * parameters: from [array], selected [array index], defaultLabel (optional), defaultValue (optional), disabled (optional), * translate (optional), name (optional - value of 'id' by default) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVCheckboxGroup($params, $smarty) { @@ -673,8 +673,8 @@ public function _smartyFBVCheckboxGroup($params, $smarty) * Checkbox input control. * parameters: label, disabled (optional), translate (optional), name (optional - value of 'id' by default) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVCheckbox($params, $smarty) { @@ -706,8 +706,8 @@ public function _smartyFBVCheckbox($params, $smarty) * Radio input control. * parameters: label, disabled (optional), translate (optional), name (optional - value of 'id' by default) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVRadioButton($params, $smarty) { @@ -744,8 +744,8 @@ public function _smartyFBVRadioButton($params, $smarty) * File upload input. * parameters: submit (optional - name of submit button to include), disabled (optional), name (optional - value of 'id' by default) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVFileInput($params, $smarty) { @@ -773,8 +773,8 @@ public function _smartyFBVFileInput($params, $smarty) * Keyword input. * parameters: available - all available keywords (for autosuggest); current - user's current keywords * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVKeywordInput($params, $smarty) { @@ -812,8 +812,8 @@ public function _smartyFBVKeywordInput($params, $smarty) * Reviewing interests input. * parameters: interests - current users's keywords (array) * - * @param $params array - * @param $smarty object + * @param array $params + * @param object $smarty */ public function _smartyFBVInterestsInput($params, $smarty) { @@ -836,8 +836,8 @@ public function _smartyFBVInterestsInput($params, $smarty) /** * Custom Smarty function for labelling/highlighting of form fields. * - * @param $params array can contain 'name' (field name/ID), 'required' (required field), 'key' (localization key), 'label' (non-localized label string), 'suppressId' (boolean) - * @param $smarty Smarty + * @param array $params can contain 'name' (field name/ID), 'required' (required field), 'key' (localization key), 'label' (non-localized label string), 'suppressId' (boolean) + * @param Smarty $smarty */ public function _smartyFBVSubLabel($params, $smarty) { @@ -877,7 +877,7 @@ public function _smartyFBVSubLabel($params, $smarty) /** * Assign the appropriate class name to the element for client-side validation * - * @param $params array + * @param array $params * return array */ public function _addClientSideValidation($params) @@ -896,7 +896,7 @@ public function _addClientSideValidation($params) /** * Cycle through layout parameters to add the appropriate classes to the element's parent container * - * @param $params array + * @param array $params * * @return string */ @@ -929,8 +929,8 @@ public function _getLayoutInfo($params) /** * Custom Smarty function for labelling/highlighting of form fields. * - * @param $params array can contain 'name' (field name/ID), 'required' (required field), 'key' (localization key), 'label' (non-localized label string), 'suppressId' (boolean) - * @param $smarty Smarty + * @param array $params can contain 'name' (field name/ID), 'required' (required field), 'key' (localization key), 'label' (non-localized label string), 'suppressId' (boolean) + * @param Smarty $smarty */ public function smartyFieldLabel($params, $smarty) { diff --git a/classes/form/FormError.inc.php b/classes/form/FormError.inc.php index c6381707d1f..c0e25df2cd6 100644 --- a/classes/form/FormError.inc.php +++ b/classes/form/FormError.inc.php @@ -17,17 +17,17 @@ class FormError { - /** The name of the field */ + /** @var string The name of the field */ public $field; - /** The error message */ + /** @var string The error message */ public $message; /** * Constructor. * - * @param $field string the name of the field - * @param $message string the error message (i18n key) + * @param string $field the name of the field + * @param string $message the error message (i18n key) */ public function __construct($field, $message) { diff --git a/classes/form/validation/FormValidator.inc.php b/classes/form/validation/FormValidator.inc.php index 2bd3669f7d5..ae7384c04c8 100644 --- a/classes/form/validation/FormValidator.inc.php +++ b/classes/form/validation/FormValidator.inc.php @@ -42,11 +42,11 @@ class FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $validator Validator the validator used to validate this form field (optional) + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param Validator $validator the validator used to validate this form field (optional) */ public function __construct(&$form, $field, $type, $message, $validator = null) { @@ -124,7 +124,7 @@ public function getType() * Check if field value is valid. * Default check is that field is either optional or not empty. * - * @return boolean + * @return bool */ public function isValid() { @@ -166,7 +166,7 @@ public function getFieldValue() /** * Check if field value is empty and optional. * - * @return boolean + * @return bool */ public function isEmptyAndOptional() { diff --git a/classes/form/validation/FormValidatorArray.inc.php b/classes/form/validation/FormValidatorArray.inc.php index b48e2ed862b..9fe3b46adf4 100644 --- a/classes/form/validation/FormValidatorArray.inc.php +++ b/classes/form/validation/FormValidatorArray.inc.php @@ -26,11 +26,11 @@ class FormValidatorArray extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $fields array all subfields for each item in the array, i.e. name[][foo]. If empty it is assumed that name[] is a data field + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param array $fields all subfields for each item in the array, i.e. name[][foo]. If empty it is assumed that name[] is a data field */ public function __construct(&$form, $field, $type, $message, $fields = []) { @@ -61,7 +61,7 @@ public function getErrorFields() * @see FormValidator::isValid() * Value is valid if it is empty and optional or all field values are set. * - * @return boolean + * @return bool */ public function isValid() { diff --git a/classes/form/validation/FormValidatorArrayCustom.inc.php b/classes/form/validation/FormValidatorArrayCustom.inc.php index 3b57e5ab391..6e89461dc18 100644 --- a/classes/form/validation/FormValidatorArrayCustom.inc.php +++ b/classes/form/validation/FormValidatorArrayCustom.inc.php @@ -23,7 +23,7 @@ class FormValidatorArrayCustom extends FormValidator /** @var array Array of field names where an error occurred */ public $_errorFields; - /** @var boolean is the field a multilingual-capable field */ + /** @var bool is the field a multilingual-capable field */ public $_isLocaleField; /** @var callable Custom validation function */ @@ -32,21 +32,21 @@ class FormValidatorArrayCustom extends FormValidator /** @var array Additional arguments to pass to $userFunction */ public $_additionalArguments; - /** @var boolean If true, field is considered valid if user function returns false instead of true */ + /** @var bool If true, field is considered valid if user function returns false instead of true */ public $_complementReturn; /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $userFunction function the user function to use for validation - * @param $additionalArguments array optional, a list of additional arguments to pass to $userFunction - * @param $complementReturn boolean optional, complement the value returned by $userFunction - * @param $fields array all subfields for each item in the array, i.e. name[][foo]. If empty it is assumed that name[] is a data field - * @param $isLocaleField boolean + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param callable $userFunction the user function to use for validation + * @param array $additionalArguments optional, a list of additional arguments to pass to $userFunction + * @param bool $complementReturn optional, complement the value returned by $userFunction + * @param array $fields all subfields for each item in the array, i.e. name[][foo]. If empty it is assumed that name[] is a data field + * @param bool $isLocaleField */ public function __construct(&$form, $field, $type, $message, $userFunction, $additionalArguments = [], $complementReturn = false, $fields = [], $isLocaleField = false) { @@ -75,7 +75,7 @@ public function getErrorFields() /** * Is it a multilingual-capable field. * - * @return boolean + * @return bool */ public function isLocaleField() { @@ -89,7 +89,7 @@ public function isLocaleField() /** * @see FormValidator::isValid() * - * @return boolean + * @return bool */ public function isValid() { @@ -176,7 +176,7 @@ public function isValid() /** * Is the field an array. * - * @return boolean + * @return bool */ public function isArray() { diff --git a/classes/form/validation/FormValidatorBoolean.inc.php b/classes/form/validation/FormValidatorBoolean.inc.php index f16de42219a..722538d68d8 100644 --- a/classes/form/validation/FormValidatorBoolean.inc.php +++ b/classes/form/validation/FormValidatorBoolean.inc.php @@ -22,9 +22,9 @@ class FormValidatorBoolean extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $message string the error message for validation failures (i18n key) + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $message the error message for validation failures (i18n key) */ public function __construct(&$form, $field, $message) { @@ -42,7 +42,7 @@ public function __construct(&$form, $field, $message) * * @see FormValidator::isValid() * - * @return boolean + * @return bool */ public function isValid() { diff --git a/classes/form/validation/FormValidatorCSRF.inc.php b/classes/form/validation/FormValidatorCSRF.inc.php index 43929d567f7..07705df8168 100644 --- a/classes/form/validation/FormValidatorCSRF.inc.php +++ b/classes/form/validation/FormValidatorCSRF.inc.php @@ -22,8 +22,8 @@ class FormValidatorCSRF extends FormValidator /** * Constructor. * - * @param $form Form - * @param $message string the locale key to use (optional) + * @param Form $form + * @param string $message the locale key to use (optional) */ public function __construct(&$form, $message = 'form.csrfInvalid') { @@ -38,7 +38,7 @@ public function __construct(&$form, $message = 'form.csrfInvalid') * Check if the CSRF token is correct. * overrides FormValidator::isValid() * - * @return boolean + * @return bool */ public function isValid() { diff --git a/classes/form/validation/FormValidatorControlledVocab.inc.php b/classes/form/validation/FormValidatorControlledVocab.inc.php index c97ab0aaa0a..2104c46254d 100644 --- a/classes/form/validation/FormValidatorControlledVocab.inc.php +++ b/classes/form/validation/FormValidatorControlledVocab.inc.php @@ -22,13 +22,13 @@ class FormValidatorControlledVocab extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $symbolic string - * @param $assocType int - * @param $assocId int + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param string $symbolic + * @param int $assocType + * @param int $assocId */ public function __construct(&$form, $field, $type, $message, $symbolic, $assocType, $assocId) { diff --git a/classes/form/validation/FormValidatorCustom.inc.php b/classes/form/validation/FormValidatorCustom.inc.php index 06cb85b40f8..26a6729c446 100644 --- a/classes/form/validation/FormValidatorCustom.inc.php +++ b/classes/form/validation/FormValidatorCustom.inc.php @@ -23,20 +23,20 @@ class FormValidatorCustom extends FormValidator /** @var array Additional arguments to pass to $userFunction */ public $_additionalArguments; - /** @var boolean If true, field is considered valid if user function returns false instead of true */ + /** @var bool If true, field is considered valid if user function returns false instead of true */ public $_complementReturn; /** @var array If present, additional arguments to pass to the getMessage translation function * The user function is passed the form data as its first argument and $additionalArguments, if set, as the remaining arguments. This function must return a boolean value. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $userFunction callable function the user function to use for validation - * @param $additionalArguments array optional, a list of additional arguments to pass to $userFunction - * @param $complementReturn boolean optional, complement the value returned by $userFunction - * @param $messageArgs array optional, arguments to pass to getMessage() + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param callable $userFunction function the user function to use for validation + * @param array $additionalArguments optional, a list of additional arguments to pass to $userFunction + * @param bool $complementReturn optional, complement the value returned by $userFunction + * @param array $messageArgs optional, arguments to pass to getMessage() */ public function __construct(&$form, $field, $type, $message, $userFunction, $additionalArguments = [], $complementReturn = false, $messageArgs = []) { @@ -69,7 +69,7 @@ public function getMessage() * @see FormValidator::isValid() * Value is valid if it is empty and optional or validated by user-supplied function. * - * @return boolean + * @return bool */ public function isValid() { diff --git a/classes/form/validation/FormValidatorEmail.inc.php b/classes/form/validation/FormValidatorEmail.inc.php index faa2e3c37ea..e0e693549eb 100644 --- a/classes/form/validation/FormValidatorEmail.inc.php +++ b/classes/form/validation/FormValidatorEmail.inc.php @@ -24,10 +24,10 @@ class FormValidatorEmail extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) + * @param Form $form the associated form + * @param string $field the name of the associated field + * @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, $type = 'optional', $message = 'email.invalid') { diff --git a/classes/form/validation/FormValidatorISSN.inc.php b/classes/form/validation/FormValidatorISSN.inc.php index e43c0f9e822..d105cf5d7aa 100644 --- a/classes/form/validation/FormValidatorISSN.inc.php +++ b/classes/form/validation/FormValidatorISSN.inc.php @@ -22,10 +22,10 @@ class FormValidatorISSN extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) + * @param Form $form the associated form + * @param string $field the name of the associated field + * @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, $type, $message) { diff --git a/classes/form/validation/FormValidatorInSet.inc.php b/classes/form/validation/FormValidatorInSet.inc.php index e57d7116c3d..22e123025eb 100644 --- a/classes/form/validation/FormValidatorInSet.inc.php +++ b/classes/form/validation/FormValidatorInSet.inc.php @@ -23,11 +23,11 @@ class FormValidatorInSet extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $acceptedValues array all possible accepted values + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param array $acceptedValues all possible accepted values */ public function __construct(&$form, $field, $type, $message, $acceptedValues) { @@ -44,7 +44,7 @@ public function __construct(&$form, $field, $type, $message, $acceptedValues) * * @see FormValidator::isValid() * - * @return boolean + * @return bool */ public function isValid() { diff --git a/classes/form/validation/FormValidatorLength.inc.php b/classes/form/validation/FormValidatorLength.inc.php index 7b0d931b870..d06eb1d3678 100644 --- a/classes/form/validation/FormValidatorLength.inc.php +++ b/classes/form/validation/FormValidatorLength.inc.php @@ -28,12 +28,12 @@ class FormValidatorLength extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $comparator - * @param $length + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param string $comparator + * @param int $length */ public function __construct(&$form, $field, $type, $message, $comparator, $length) { @@ -64,7 +64,7 @@ public function getMessage() * @see FormValidator::isValid() * Value is valid if it is empty and optional or meets the specified length requirements. * - * @return boolean + * @return bool */ public function isValid() { diff --git a/classes/form/validation/FormValidatorLocale.inc.php b/classes/form/validation/FormValidatorLocale.inc.php index b24822a0a25..b8ade0adc10 100644 --- a/classes/form/validation/FormValidatorLocale.inc.php +++ b/classes/form/validation/FormValidatorLocale.inc.php @@ -25,12 +25,12 @@ class FormValidatorLocale extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $validator Validator the validator used to validate this form field (optional) - * @param $requiredLocale The name of the required locale, i.e. en_US + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param Validator $validator the validator used to validate this form field (optional) + * @param string $requiredLocale The name of the required locale, i.e. en_US */ public function __construct(&$form, $field, $type, $message, $requiredLocale = null, $validator = null) { diff --git a/classes/form/validation/FormValidatorLocaleEmail.inc.php b/classes/form/validation/FormValidatorLocaleEmail.inc.php index 03cc342f26b..394137bd8f9 100644 --- a/classes/form/validation/FormValidatorLocaleEmail.inc.php +++ b/classes/form/validation/FormValidatorLocaleEmail.inc.php @@ -24,11 +24,11 @@ class FormValidatorLocaleEmail extends FormValidatorLocale /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $requiredLocale string The symbolic name of the required locale + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param string $requiredLocale The symbolic name of the required locale */ public function __construct(&$form, $field, $type, $message, $requiredLocale = null) { diff --git a/classes/form/validation/FormValidatorLocaleUrl.inc.php b/classes/form/validation/FormValidatorLocaleUrl.inc.php index 9174a2f6660..aa0c16f5a35 100644 --- a/classes/form/validation/FormValidatorLocaleUrl.inc.php +++ b/classes/form/validation/FormValidatorLocaleUrl.inc.php @@ -25,11 +25,11 @@ class FormValidatorLocaleUrl extends FormValidatorLocale /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $requiredLocale string The symbolic name of the required locale + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param string $requiredLocale The symbolic name of the required locale */ public function __construct(&$form, $field, $type, $message, $requiredLocale = null) { diff --git a/classes/form/validation/FormValidatorORCID.inc.php b/classes/form/validation/FormValidatorORCID.inc.php index 9f27ce1d891..d74d27be1f6 100644 --- a/classes/form/validation/FormValidatorORCID.inc.php +++ b/classes/form/validation/FormValidatorORCID.inc.php @@ -23,10 +23,10 @@ class FormValidatorORCID extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) + * @param Form $form the associated form + * @param string $field the name of the associated field + * @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, $type, $message) { diff --git a/classes/form/validation/FormValidatorPost.inc.php b/classes/form/validation/FormValidatorPost.inc.php index 140e206befa..f405a6a2075 100644 --- a/classes/form/validation/FormValidatorPost.inc.php +++ b/classes/form/validation/FormValidatorPost.inc.php @@ -22,8 +22,8 @@ class FormValidatorPost extends FormValidator /** * Constructor. * - * @param $form Form - * @param $message string the locale key to use (optional) + * @param Form $form + * @param string $message the locale key to use (optional) */ public function __construct(&$form, $message = 'form.postRequired') { @@ -38,7 +38,7 @@ public function __construct(&$form, $message = 'form.postRequired') * Check if form was posted. * overrides FormValidator::isValid() * - * @return boolean + * @return bool */ public function isValid() { diff --git a/classes/form/validation/FormValidatorReCaptcha.inc.php b/classes/form/validation/FormValidatorReCaptcha.inc.php index 49cf02a2aa5..d33bf283a2f 100644 --- a/classes/form/validation/FormValidatorReCaptcha.inc.php +++ b/classes/form/validation/FormValidatorReCaptcha.inc.php @@ -31,10 +31,10 @@ class FormValidatorReCaptcha extends FormValidator /** * Constructor. * - * @param $form object - * @param $userIp string IP address of user request - * @param $message string Key of message to display on mismatch - * @param $hostname ?string Hostname to expect in validation response + * @param object $form + * @param string $userIp IP address of user request + * @param string $message Key of message to display on mismatch + * @param string|null $hostname Hostname to expect in validation response */ public function __construct(Form $form, string $userIp, string $message, ?string $hostname = null) { @@ -50,7 +50,7 @@ public function __construct(Form $form, string $userIp, string $message, ?string * @see FormValidator::isValid() * Determine whether or not the form meets this ReCaptcha constraint. * - * @return boolean + * @return bool */ public function isValid(): bool { @@ -67,9 +67,9 @@ public function isValid(): bool /** * Validates the reCaptcha response * - * @param ?string $response The reCaptcha response - * @param ?string $ip The user IP address (defaults to null) - * @param ?string $hostname The application hostname (defaults to null) + * @param string|null $response The reCaptcha response + * @param string|null $ip The user IP address (defaults to null) + * @param string|null $hostname The application hostname (defaults to null) * * @throws Exception Throws in case the validation fails */ diff --git a/classes/form/validation/FormValidatorRegExp.inc.php b/classes/form/validation/FormValidatorRegExp.inc.php index 4703e15d103..d7d3591e065 100644 --- a/classes/form/validation/FormValidatorRegExp.inc.php +++ b/classes/form/validation/FormValidatorRegExp.inc.php @@ -23,11 +23,11 @@ class FormValidatorRegExp extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) - * @param $regExp string the regular expression (PCRE form) + * @param Form $form the associated form + * @param string $field the name of the associated field + * @param string $type the type of check, either "required" or "optional" + * @param string $message the error message for validation failures (i18n key) + * @param string $regExp the regular expression (PCRE form) */ public function __construct(&$form, $field, $type, $message, $regExp) { diff --git a/classes/form/validation/FormValidatorUrl.inc.php b/classes/form/validation/FormValidatorUrl.inc.php index 2a1bc2b51f5..44820dba19e 100644 --- a/classes/form/validation/FormValidatorUrl.inc.php +++ b/classes/form/validation/FormValidatorUrl.inc.php @@ -25,10 +25,10 @@ class FormValidatorUrl extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) + * @param Form $form the associated form + * @param string $field the name of the associated field + * @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, $type, $message) { diff --git a/classes/form/validation/FormValidatorUsername.inc.php b/classes/form/validation/FormValidatorUsername.inc.php index e7972407072..2a725e8d21b 100644 --- a/classes/form/validation/FormValidatorUsername.inc.php +++ b/classes/form/validation/FormValidatorUsername.inc.php @@ -25,10 +25,10 @@ class FormValidatorUsername extends FormValidator /** * Constructor. * - * @param $form Form the associated form - * @param $field string the name of the associated field - * @param $type string the type of check, either "required" or "optional" - * @param $message string the error message for validation failures (i18n key) + * @param Form $form the associated form + * @param string $field the name of the associated field + * @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, $type, $message) { diff --git a/classes/handler/APIHandler.inc.php b/classes/handler/APIHandler.inc.php index bbf429c1efa..30e887c1fc5 100644 --- a/classes/handler/APIHandler.inc.php +++ b/classes/handler/APIHandler.inc.php @@ -305,8 +305,8 @@ protected function paramToArray($value): array * * Empty strings will be converted to null. * - * @param $schema string One of the SCHEMA_... constants - * @param $params array Key/value parameters to be validated + * @param string $schema One of the SCHEMA_... constants + * @param array $params Key/value parameters to be validated * * @return array Converted parameters */ @@ -346,8 +346,7 @@ public function convertStringsToSchema($schema, $params) * * @see self::convertStringsToTypes * - * @param $value - * @param $type One of boolean, integer or number + * @param string $type One of boolean, integer or number */ private function _convertStringsToSchema($value, $type, $schema) { @@ -398,6 +397,12 @@ private function _convertStringsToSchema($value, $type, $schema) break; case 'object': if (is_array($value)) { + // In some cases a property may be defined as an object but it may not + // contain specific details about that object's properties. In these cases, + // leave the properties alone. + if (!property_exists($schema, 'properties')) { + return $value; + } $newObject = []; foreach ($schema->properties as $propName => $propSchema) { if (!isset($value[$propName])) { @@ -425,7 +430,7 @@ private function _convertStringsToSchema($value, $type, $schema) * @param string $dateStartParam Where the find the start date in the array of params * @param string $dateEndParam Where to find the end date in the array of params * - * @return boolean|string True if they validate, or a string which + * @return bool|string True if they validate, or a string which * contains the locale key of an error message. */ protected function _validateStatDates($params, $dateStartParam = 'dateStart', $dateEndParam = 'dateEnd') diff --git a/classes/handler/PKPHandler.inc.php b/classes/handler/PKPHandler.inc.php index fdcd1d94896..444f842bf5a 100644 --- a/classes/handler/PKPHandler.inc.php +++ b/classes/handler/PKPHandler.inc.php @@ -44,7 +44,7 @@ class PKPHandler */ public $_id; - /** @var Dispatcher, mainly needed for cross-router url construction */ + /** @var Dispatcher mainly needed for cross-router url construction */ public $_dispatcher; /** @var array validation checks for this page - deprecated! */ @@ -63,13 +63,13 @@ class PKPHandler /** @var AuthorizationDecisionManager authorization decision manager for this handler */ public $_authorizationDecisionManager; - /** @var boolean Whether to enforce site access restrictions. */ + /** @var bool Whether to enforce site access restrictions. */ public $_enforceRestrictedSite = true; - /** @var boolean Whether role assignments have been checked. */ + /** @var bool Whether role assignments have been checked. */ public $_roleAssignmentsChecked = false; - /** @var boolean Whether this is a handler for a page in the backend editorial UI */ + /** @var bool Whether this is a handler for a page in the backend editorial UI */ public $_isBackendPage = false; /** @@ -90,7 +90,7 @@ public function setEnforceRestrictedSite($enforceRestrictedSite) /** * Set the controller id * - * @param $id string + * @param string $id */ public function setId($id) { @@ -125,7 +125,7 @@ public function &getDispatcher() /** * Set the dispatcher * - * @param $dispatcher PKPDispatcher + * @param PKPDispatcher $dispatcher */ public function setDispatcher($dispatcher) { @@ -135,8 +135,8 @@ public function setDispatcher($dispatcher) /** * Fallback method in case request handler does not implement index method. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function index($args, $request) { @@ -157,8 +157,8 @@ public function index($args, $request) * call so that PKPHandler::authorize() will be able to enforce * them. * - * @param $authorizationPolicy AuthorizationPolicy - * @param $addToTop boolean whether to insert the new policy + * @param AuthorizationPolicy $authorizationPolicy + * @param bool $addToTop whether to insert the new policy * to the top of the list. */ public function addPolicy($authorizationPolicy, $addToTop = false) @@ -180,7 +180,7 @@ public function addPolicy($authorizationPolicy, $addToTop = false) * and checked for permission in the policy class, it's then chucked into * the authorized context for later retrieval by code that needs it. * - * @param $assocType integer any of the ASSOC_TYPE_* constants + * @param int $assocType any of the ASSOC_TYPE_* constants */ public function &getAuthorizedContextObject($assocType) { @@ -222,9 +222,9 @@ public function getLastAuthorizationMessage() /** * Add role - operation assignments to the handler. * - * @param $roleIds integer|array one or more of the ROLE_ID_* + * @param int|array $roleIds one or more of the ROLE_ID_* * constants - * @param $operations string|array a single method name or + * @param string|array $operations a single method name or * an array of method names to be assigned. */ public function addRoleAssignment($roleIds, $operations) @@ -263,7 +263,7 @@ public function addRoleAssignment($roleIds, $operations) * This method returns an assignment of operation names for the * given role. * - * @param $roleId int + * @param int $roleId * * @return array assignment for the given role. */ @@ -306,12 +306,12 @@ public function markRoleAssignmentsChecked() * * NB: This method will be called once for every request only. * - * @param $request Request - * @param $args array request arguments - * @param $roleAssignments array the operation role assignment, + * @param Request $request + * @param array $args request arguments + * @param array $roleAssignments the operation role assignment, * see getRoleAssignment() for more details. * - * @return boolean + * @return bool */ public function authorize($request, &$args, $roleAssignments) { @@ -371,8 +371,8 @@ public function authorize($request, &$args, $roleAssignments) * to resources (e.g. via redirect) like handler operations * or data objects. * - * @param $requiredContexts array - * @param $request Request + * @param array $requiredContexts + * @param Request $request */ public function validate($requiredContexts = null, $request = null) { @@ -411,7 +411,7 @@ public function validate($requiredContexts = null, $request = null) * NB: This method will be called after validation and * authorization. * - * @param $request PKPRequest + * @param PKPRequest $request */ public function initialize($request) { @@ -438,9 +438,9 @@ public function initialize($request) /** * Return the DBResultRange structure and misc. variables describing the current page of a set of pages. * - * @param $request PKPRequest - * @param $rangeName string Symbolic name of range of pages; must match the Smarty {page_list ...} name. - * @param $contextData array If set, this should contain a set of data that are required to + * @param PKPRequest $request + * @param string $rangeName Symbolic name of range of pages; must match the Smarty {page_list ...} name. + * @param array $contextData If set, this should contain a set of data that are required to * define the context of this request (for maintaining page numbers across requests). * To disable persistent page contexts, set this variable to null. * @@ -493,7 +493,7 @@ public static function getRangeInfo($request, $rangeName, $contextData = null) /** * Get the range info page parameter name. * - * @param $rangeName string + * @param string $rangeName * * @return string */ @@ -505,7 +505,7 @@ public static function getPageParamName($rangeName) /** * Set up the basic template. * - * @param $request PKPRequest + * @param PKPRequest $request */ public function setupTemplate($request) { @@ -548,8 +548,8 @@ public function setupTemplate($request) * context that differentiates it from other similar pages (e.g. all * articles vs. all articles starting with "l"). * - * @param $request PKPRequest - * @param $contextData array A set of information identifying the page + * @param PKPRequest $request + * @param array $contextData A set of information identifying the page * * @return string hash */ @@ -566,7 +566,7 @@ public static function hashPageContext($request, $contextData = []) /** * Return the context that is configured in site redirect setting. * - * @param $request Request + * @param Request $request * * @return mixed Either Context or null */ @@ -583,8 +583,8 @@ public function getSiteRedirectContext($request) /** * Return the first context that user is enrolled with. * - * @param $user User - * @param $contexts Array + * @param User $user + * @param array $contexts * * @return mixed Either Context or null */ @@ -605,7 +605,7 @@ public function getFirstUserContext($user, $contexts) /** * Assume SSL is required for all handlers, unless overridden in subclasses. * - * @return boolean + * @return bool */ public function requireSSL() { @@ -636,8 +636,8 @@ public function setApiToken($apiToken) * a request needs to have one in its context but may be in a site-level * context as specified in the URL. * - * @param $request Request - * @param $hasNoContexts boolean Optional reference to receive true iff no contexts were found. + * @param Request $request + * @param bool $hasNoContexts Optional reference to receive true iff no contexts were found. * * @return mixed Either a Context or null if none could be determined. */ diff --git a/classes/i18n/LocaleFile.inc.php b/classes/i18n/LocaleFile.inc.php index b8b19ce6885..79da6e8e6c8 100644 --- a/classes/i18n/LocaleFile.inc.php +++ b/classes/i18n/LocaleFile.inc.php @@ -31,8 +31,8 @@ class LocaleFile /** * Constructor. * - * @param $locale string Key for this locale file - * @param $filename string Filename to this locale file + * @param string $locale Key for this locale file + * @param string $filename Filename to this locale file */ public function __construct($locale, $filename) { @@ -87,9 +87,9 @@ public function getFilename() * Substitution works by replacing tokens like "{$foo}" with the value of * the parameter named "foo" (if supplied). * - * @param $key string - * @param $params array named substitution parameters - * @param $locale string the locale to use + * @param string $key + * @param array $params named substitution parameters + * @param string $locale the locale to use * * @return string */ @@ -130,8 +130,8 @@ public function translate($key, $params = [], $locale = null) /** * Static method: Load a locale array from a file. Not cached! * - * @param $filename string Filename to locale .po file to load - * @param array + * @param string $filename Filename to locale .po file to load + * @return array */ public static function &load($filename) { @@ -146,7 +146,7 @@ public static function &load($filename) /** * Check if a locale is valid. * - * @return boolean + * @return bool */ public function isValid() { @@ -157,7 +157,7 @@ public function isValid() * Test a locale file against the given reference locale file and * return an array of errorType => array(errors). * - * @param $referenceLocaleFile object + * @param object $referenceLocaleFile * * @return array */ diff --git a/classes/i18n/PKPLocale.inc.php b/classes/i18n/PKPLocale.inc.php index b168739050c..c5ff1b409cf 100644 --- a/classes/i18n/PKPLocale.inc.php +++ b/classes/i18n/PKPLocale.inc.php @@ -257,7 +257,7 @@ public static function getPrimaryLocale() * Get a list of locale files currently registered, either in all * locales (in an array for each locale), or for a specific locale. * - * @param $locale string Locale identifier (optional) + * @param string $locale Locale identifier (optional) */ public static function &getLocaleFiles($locale = null) { @@ -274,7 +274,7 @@ public static function &getLocaleFiles($locale = null) /** * Add octothorpes to a key name for presentation of the key as missing. * - * @param @key string + * @param string $key * * @return string */ @@ -288,10 +288,10 @@ public static function addOctothorpes($key) * Substitution works by replacing tokens like "{$foo}" with the value * of the parameter named "foo" (if supplied). * - * @param $key string - * @param $params array named substitution parameters - * @param $locale string the locale to use - * @param $missingKeyHandler function Callback to be invoked when a key cannot be found. + * @param string $key + * @param array $params named substitution parameters + * @param string $locale the locale to use + * @param callable $missingKeyHandler Callback to be invoked when a key cannot be found. * * @return string */ @@ -328,7 +328,7 @@ public static function translate($key, $params = [], $locale = null, $missingKey /** * Initialize the locale system. * - * @param $request PKPRequest + * @param PKPRequest $request */ public static function initialize($request) { @@ -342,9 +342,6 @@ public static function initialize($request) AppLocale::registerLocaleFile($locale, "lib/pkp/locale/${locale}/common.po"); // Set site time zone - // Starting from PHP 5.3.0 PHP will throw an E_WARNING if the default - // time zone is not set and date/time functions are used - // http://pl.php.net/manual/en/function.date-default-timezone-set.php $timeZone = self::getTimeZone(); date_default_timezone_set($timeZone); @@ -380,7 +377,7 @@ public static function initialize($request) * Build an associative array of LOCALE_COMPOMENT_... => filename * (use getFilenameComponentMap instead) * - * @param $locale string + * @param string $locale * * @return array */ @@ -407,7 +404,7 @@ public static function makeComponentMap($locale) /** * Get an associative array of LOCALE_COMPOMENT_... => filename * - * @param $locale string + * @param string $locale * * @return array */ @@ -475,9 +472,9 @@ public static function requireComponents() /** * Register a locale file against the current list. * - * @param $locale string Locale key - * @param $filename string Filename to new locale XML file - * @param $addToTop boolean Whether to add to the top of the list (true) + * @param string $locale Locale key + * @param string $filename Filename to new locale XML file + * @param bool $addToTop Whether to add to the top of the list (true) * or the bottom (false). Allows overriding. */ public static function registerLocaleFile($locale, $filename, $addToTop = false) @@ -504,7 +501,7 @@ public static function registerLocaleFile($locale, $filename, $addToTop = false) /** * Get the stylesheet filename for a particular locale. * - * @param $locale string + * @param string $locale * * @return string or null if none configured. */ @@ -525,7 +522,7 @@ public static function getLocaleStyleSheet($locale) * other value that is expected is `rtl`. This value is used in HTML and * CSS markup to present a right-to-left layout. * - * @param $locale string + * @param string $locale * * @return string */ @@ -541,9 +538,9 @@ public static function getLocaleDirection($locale) /** * Determine whether or not a locale is marked incomplete. * - * @param $locale xx_XX symbolic name of locale to check + * @param string $locale xx_XX symbolic name of locale to check * - * @return boolean + * @return bool */ public static function isLocaleComplete($locale) { @@ -560,9 +557,9 @@ public static function isLocaleComplete($locale) /** * Determine whether or not a locale uses family name first. * - * @param $locale xx_XX symbolic name of locale to check + * @param string $locale xx_XX symbolic name of locale to check * - * @return boolean + * @return bool */ public static function isLocaleWithFamilyFirst($locale) { @@ -576,9 +573,9 @@ public static function isLocaleWithFamilyFirst($locale) /** * Check if the supplied locale is currently installable. * - * @param $locale string + * @param string $locale * - * @return boolean + * @return bool */ public static function isLocaleValid($locale) { @@ -598,7 +595,7 @@ public static function isLocaleValid($locale) /** * Load a locale list from a file. * - * @param $filename string + * @param string $filename * * @return array */ @@ -643,7 +640,7 @@ public static function &getAllLocales() /** * Install support for a new locale. * - * @param $locale string + * @param string $locale */ public static function installLocale($locale) { @@ -662,7 +659,7 @@ public static function installLocale($locale) /** * Uninstall support for an existing locale. * - * @param $locale string + * @param string $locale */ public static function uninstallLocale($locale) { @@ -674,7 +671,7 @@ public static function uninstallLocale($locale) /** * Reload locale-specific data. * - * @param $locale string + * @param string $locale */ public static function reloadLocale($locale) { @@ -685,7 +682,7 @@ public static function reloadLocale($locale) * Given a locale string, get the list of parameter references of the * form {$myParameterName}. * - * @param $source string + * @param string $source * * @return array */ @@ -704,7 +701,7 @@ public static function getParameterNames($source) * Translate the ISO 2-letter language string (ISO639-1) * into a ISO compatible 3-letter string (ISO639-2b). * - * @param $iso2Letter string + * @param string $iso2Letter * * @return string the translated string or null if we * don't know about the given language. @@ -726,7 +723,7 @@ public static function get3LetterFrom2LetterIsoLanguage($iso2Letter) * Translate the ISO 3-letter language string (ISO639-2b) * into a ISO compatible 2-letter string (ISO639-1). * - * @param $iso3Letter string + * @param string $iso3Letter * * @return string the translated string or null if we * don't know about the given language. @@ -748,7 +745,7 @@ public static function get2LetterFrom3LetterIsoLanguage($iso3Letter) * Translate the PKP locale identifier into an * ISO639-2b compatible 3-letter string. * - * @param $locale string + * @param string $locale * * @return string */ @@ -817,7 +814,7 @@ public static function getLocaleFrom3LetterIso($iso3Letter) /** * Translate the ISO 2-letter language string (ISO639-1) into ISO639-3. * - * @param $iso1 string + * @param string $iso1 * * @return string the translated string or null if we * don't know about the given language. @@ -838,7 +835,7 @@ public static function getIso3FromIso1($iso1) /** * Translate the ISO639-3 into ISO639-1. * - * @param $iso3 string + * @param string $iso3 * * @return string the translated string or null if we * don't know about the given language. @@ -860,7 +857,7 @@ public static function getIso1FromIso3($iso3) * Translate the PKP locale identifier into an * ISO639-3 compatible 3-letter string. * - * @param $locale string + * @param string $locale * * @return string */ @@ -875,7 +872,7 @@ public static function getIso3FromLocale($locale) * Translate the PKP locale identifier into an * ISO639-1 compatible 2-letter string. * - * @param $locale string + * @param string $locale * * @return string */ @@ -896,7 +893,7 @@ public static function getIso1FromLocale($locale) * If that still doesn't determine a unique locale then * we'll choose the first locale found. * - * @param $iso3 string + * @param string $iso3 * * @return string */ @@ -988,8 +985,8 @@ public static function &_getAllLocalesCache() /** * Create a cache file with locale data. * - * @param $cache CacheManager - * @param $id the cache id (not used here, required by the cache manager) + * @param CacheManager $cache + * @param string $id the cache id (not used here, required by the cache manager) */ public static function _allLocalesCacheMiss($cache, $id) { diff --git a/classes/identity/Identity.inc.php b/classes/identity/Identity.inc.php index 41e64f9d675..a189a6a624b 100644 --- a/classes/identity/Identity.inc.php +++ b/classes/identity/Identity.inc.php @@ -22,6 +22,7 @@ use APP\core\Application; use APP\i18n\AppLocale; +use Sokil\IsoCodes\IsoCodesFactory; class Identity extends \PKP\core\DataObject { @@ -32,8 +33,8 @@ class Identity extends \PKP\core\DataObject * Get a piece of data for this object, localized to the current * locale if possible. * - * @param $key string - * @param $preferredLocale string + * @param string $key + * @param string $preferredLocale */ public function &getLocalizedData($key, $preferredLocale = null) { @@ -81,10 +82,10 @@ public function &getLocalizedData($key, $preferredLocale = null) * Get the identity's localized complete name. * Includes given name and family name. * - * @param $preferred boolean If the preferred public name should be used, if exist - * @param $familyFirst boolean False / default: Givenname Familyname + * @param bool $preferred If the preferred public name should be used, if exist + * @param bool $familyFirst False / default: Givenname Familyname * If true: Familyname, Givenname - * @param $defaultLocale string + * @param string $defaultLocale * * @return string */ @@ -119,7 +120,7 @@ public function getFullName($preferred = true, $familyFirst = false, $defaultLoc /** * Get given name. * - * @param $locale string + * @param string $locale * * @return string|array */ @@ -131,8 +132,8 @@ public function getGivenName($locale) /** * Set given name. * - * @param $givenName string - * @param $locale string + * @param string $givenName + * @param string $locale */ public function setGivenName($givenName, $locale) { @@ -154,7 +155,7 @@ public function getLocalizedGivenName($defaultLocale = null) /** * Get family name. * - * @param $locale string + * @param string $locale * * @return string|array */ @@ -166,8 +167,8 @@ public function getFamilyName($locale) /** * Set family name. * - * @param $familyName string - * @param $locale string + * @param string $familyName + * @param string $locale */ public function setFamilyName($familyName, $locale) { @@ -178,7 +179,7 @@ public function setFamilyName($familyName, $locale) * Get the localized family name * Return family name for the locale first name exists in * - * @param $defaultLocale string + * @param string $defaultLocale * * @return string */ @@ -207,7 +208,7 @@ public function getLocalizedFamilyName($defaultLocale = null) /** * Get preferred public name. * - * @param $locale string + * @param string $locale * * @return string */ @@ -219,8 +220,8 @@ public function getPreferredPublicName($locale) /** * Set preferred public name. * - * @param $preferredPublicName string - * @param $locale string + * @param string $preferredPublicName + * @param string $locale */ public function setPreferredPublicName($preferredPublicName, $locale) { @@ -230,7 +231,7 @@ public function setPreferredPublicName($preferredPublicName, $locale) /** * Get affiliation (position, institution, etc.). * - * @param $locale string + * @param string $locale * * @return string */ @@ -242,8 +243,8 @@ public function getAffiliation($locale) /** * Set affiliation. * - * @param $affiliation string - * @param $locale string + * @param string $affiliation + * @param string $locale */ public function setAffiliation($affiliation, $locale) { @@ -271,7 +272,7 @@ public function getEmail() /** * Set email address. * - * @param $email string + * @param string $email */ public function setEmail($email) { @@ -291,7 +292,7 @@ public function getOrcid() /** * Set ORCID identifier. * - * @param $orcid string + * @param string $orcid */ public function setOrcid($orcid) { @@ -319,7 +320,7 @@ public function getCountryLocalized() if (!$countryCode) { return null; } - $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory(); + $isoCodes = app(IsoCodesFactory::class); $country = $isoCodes->getCountries()->getByAlpha2($countryCode); return $country ? $country->getLocalName() : null; } @@ -327,7 +328,7 @@ public function getCountryLocalized() /** * Set country code (ISO 3166-1 two-letter codes) * - * @param $country string + * @param string $country */ public function setCountry($country) { @@ -347,7 +348,7 @@ public function getUrl() /** * Set URL. * - * @param $url string + * @param string $url */ public function setUrl($url) { @@ -367,7 +368,7 @@ public function getLocalizedBiography() /** * Get biography. * - * @param $locale string + * @param string $locale * * @return string */ @@ -379,8 +380,8 @@ public function getBiography($locale) /** * Set biography. * - * @param $biography string - * @param $locale string + * @param string $biography + * @param string $locale */ public function setBiography($biography, $locale) { diff --git a/classes/install/Installer.inc.php b/classes/install/Installer.inc.php index ce971dc30f1..201e87f45e5 100644 --- a/classes/install/Installer.inc.php +++ b/classes/install/Installer.inc.php @@ -55,7 +55,7 @@ class Installer /** @var string descriptor path (relative to INSTALLER_DATA_DIR) */ public $descriptor; - /** @var boolean indicates if a plugin is being installed (thus modifying the descriptor path) */ + /** @var bool indicates if a plugin is being installed (thus modifying the descriptor path) */ public $isPlugin; /** @var array installation parameters */ @@ -88,7 +88,7 @@ class Installer /** @var string contents of the updated config file */ public $configContents; - /** @var boolean indicating if config file was written or not */ + /** @var bool indicating if config file was written or not */ public $wroteConfig; /** @var int error code (null | INSTALLER_ERROR_GENERAL | INSTALLER_ERROR_DB) */ @@ -106,9 +106,9 @@ class Installer /** * Constructor. * - * @param $descriptor string descriptor path - * @param $params array installer parameters - * @param $isPlugin boolean true iff a plugin is being installed + * @param string $descriptor descriptor path + * @param array $params installer parameters + * @param bool $isPlugin true iff a plugin is being installed */ public function __construct($descriptor, $params = [], $isPlugin = false) { @@ -134,7 +134,7 @@ public function __construct($descriptor, $params = [], $isPlugin = false) */ public function isUpgrade() { - die('ABSTRACT CLASS'); + exit('ABSTRACT CLASS'); } /** @@ -148,7 +148,7 @@ public function destroy() /** * Pre-installation. * - * @return boolean + * @return bool */ public function preInstall() { @@ -180,7 +180,7 @@ public function preInstall() /** * Installation. * - * @return boolean + * @return bool */ public function execute() { @@ -211,7 +211,7 @@ public function execute() /** * Post-installation. * - * @return boolean + * @return bool */ public function postInstall() { @@ -225,7 +225,7 @@ public function postInstall() /** * Record message to installation log. * - * @param $message string + * @param string $message */ public function log($message) { @@ -242,7 +242,7 @@ public function log($message) /** * Parse the installation descriptor XML file. * - * @return boolean + * @return bool */ public function parseInstaller() { @@ -276,7 +276,7 @@ public function parseInstaller() /** * Execute the installer actions. * - * @return boolean + * @return bool */ public function executeInstaller() { @@ -296,7 +296,7 @@ public function executeInstaller() /** * Update the version number. * - * @return boolean + * @return bool */ public function updateVersion() { @@ -321,7 +321,7 @@ public function updateVersion() /** * Parse children nodes in the install descriptor. * - * @param $installTree XMLNode + * @param XMLNode $installTree */ public function parseInstallNodes($installTree) { @@ -348,7 +348,7 @@ public function parseInstallNodes($installTree) /** * Add an installer action from the descriptor. * - * @param $node XMLNode + * @param XMLNode $node */ public function addInstallAction($node) { @@ -381,9 +381,9 @@ public function addInstallAction($node) /** * Execute a single installer action. * - * @param $action array + * @param array $action * - * @return boolean + * @return bool */ public function executeAction($action) { @@ -513,9 +513,8 @@ public function executeAction($action) /** * Execute an SQL statement. * - * @param $sql mixed * - * @return boolean + * @return bool */ public function executeSQL($sql) { @@ -540,9 +539,9 @@ public function executeSQL($sql) /** * Update the specified configuration parameters. * - * @param $configParams arrays + * @param arrays $configParams * - * @return boolean + * @return bool */ public function updateConfig($configParams) { @@ -570,7 +569,7 @@ public function updateConfig($configParams) /** * Get the value of an installation parameter. * - * @param $name + * @param string $name */ public function getParam($name) { @@ -630,7 +629,7 @@ public function getConfigContents() /** * Check if installer was able to write out new config file. * - * @return boolean + * @return bool */ public function wroteConfig() { @@ -681,8 +680,8 @@ public function getErrorString() /** * Set the error type and messgae. * - * @param $type int - * @param $msg string Text message (INSTALLER_ERROR_DB) or locale key (otherwise) + * @param int $type + * @param string $msg Text message (INSTALLER_ERROR_DB) or locale key (otherwise) */ public function setError($type, $msg) { @@ -693,7 +692,7 @@ public function setError($type, $msg) /** * Set the logger for this installer. * - * @param $logger Logger + * @param Logger $logger */ public function setLogger($logger) { @@ -704,7 +703,7 @@ public function setLogger($logger) * Clear the data cache files (needed because of direct tinkering * with settings tables) * - * @return boolean + * @return bool */ public function clearDataCache() { @@ -717,7 +716,7 @@ public function clearDataCache() /** * Set the current version for this installer. * - * @param $version Version + * @param Version $version */ public function setCurrentVersion($version) { @@ -727,8 +726,8 @@ public function setCurrentVersion($version) /** * For upgrade: install email templates and data * - * @param $installer object - * @param $attr array Attributes: array containing + * @param object $installer + * @param array $attr Attributes: array containing * 'key' => 'EMAIL_KEY_HERE', * 'locales' => 'en_US,fr_CA,...' */ @@ -751,9 +750,9 @@ public function installEmailTemplate($installer, $attr) /** * Install the given filter configuration file. * - * @param $filterConfigFile string + * @param string $filterConfigFile * - * @return boolean true when successful, otherwise false + * @return bool true when successful, otherwise false */ public function installFilterConfig($filterConfigFile) { @@ -794,10 +793,10 @@ public function installFilterConfig($filterConfigFile) * Check to see whether a column exists. * Used in installer XML in conditional checks on nodes. * - * @param $tableName string - * @param $columnName string + * @param string $tableName + * @param string $columnName * - * @return boolean + * @return bool */ public function columnExists($tableName, $columnName) { @@ -815,9 +814,9 @@ public function columnExists($tableName, $columnName) * Check to see whether a table exists. * Used in installer XML in conditional checks on nodes. * - * @param $tableName string + * @param string $tableName * - * @return boolean + * @return bool */ public function tableExists($tableName) { @@ -829,7 +828,7 @@ public function tableExists($tableName) * Insert or update plugin data in versions * and plugin_settings tables. * - * @return boolean + * @return bool */ public function addPluginVersions() { @@ -872,10 +871,10 @@ public function addPluginVersions() /** * Fail the upgrade. * - * @param $installer Installer - * @param $attr array Attributes + * @param Installer $installer + * @param array $attr Attributes * - * @return boolean + * @return bool */ public function abort($installer, $attr) { @@ -886,7 +885,7 @@ public function abort($installer, $attr) /** * For 3.1.0 upgrade. DefaultMenus Defaults * - * @return boolean Success/failure + * @return bool Success/failure */ public function installDefaultNavigationMenus() { @@ -906,7 +905,7 @@ public function installDefaultNavigationMenus() /** * Check that the environment meets minimum PHP requirements. * - * @return boolean Success/failure + * @return bool Success/failure */ public function checkPhpVersion() { @@ -918,7 +917,7 @@ public function checkPhpVersion() return false; } - /* + /** * Migrate site locale settings to a serialized array in the database */ public function migrateSiteLocales() @@ -944,7 +943,7 @@ public function migrateSiteLocales() /** * Migrate active sidebar blocks from plugin_settings to journal_settings * - * @return boolean + * @return bool */ public function migrateSidebarBlocks() { @@ -1138,7 +1137,7 @@ public function setStatsEmailSettings() * Fix library files, which were mistakenly named server-side using source filenames. * See https://github.com/pkp/pkp-lib/issues/5471 * - * @return boolean + * @return bool */ public function fixLibraryFiles() { diff --git a/classes/install/PKPInstall.inc.php b/classes/install/PKPInstall.inc.php index cb9ab47bb8e..64639995a32 100644 --- a/classes/install/PKPInstall.inc.php +++ b/classes/install/PKPInstall.inc.php @@ -47,14 +47,17 @@ class PKPInstall extends Installer { + /** @var int Minimum password length */ + public const MIN_PASSWORD_LENGTH = 6; + /** * Constructor. * * @see install.form.InstallForm for the expected parameters * - * @param $xmlDescriptor string descriptor path - * @param $params array installer parameters - * @param $isPlugin boolean true iff a plugin is being installed + * @param string $xmlDescriptor descriptor path + * @param array $params installer parameters + * @param bool $isPlugin true iff a plugin is being installed */ public function __construct($xmlDescriptor, $params, $isPlugin) { @@ -72,7 +75,7 @@ public function isUpgrade() /** * Pre-installation. * - * @return boolean + * @return bool */ public function preInstall() { @@ -142,7 +145,7 @@ public function getCreateDirectories() * Create required files directories * FIXME No longer needed since FileManager will auto-create? * - * @return boolean + * @return bool */ public function createDirectories() { @@ -193,7 +196,7 @@ public function createDirectories() /** * Write the configuration file. * - * @return boolean + * @return bool */ public function createConfig() { @@ -230,7 +233,7 @@ public function createConfig() /** * Create initial required data. * - * @return boolean + * @return bool */ public function createData() { @@ -269,7 +272,7 @@ public function createData() $siteDao = DAORegistry::getDAO('SiteDAO'); $site = $siteDao->newDataObject(); $site->setRedirect(0); - $site->setMinPasswordLength(INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH); + $site->setMinPasswordLength(static::MIN_PASSWORD_LENGTH); $site->setPrimaryLocale($siteLocale); $site->setInstalledLocales($this->installedLocales); $site->setSupportedLocales($this->installedLocales); diff --git a/classes/install/form/InstallForm.inc.php b/classes/install/form/InstallForm.inc.php index 143357e38f1..141627a5cf4 100644 --- a/classes/install/form/InstallForm.inc.php +++ b/classes/install/form/InstallForm.inc.php @@ -51,7 +51,7 @@ class InstallForm extends MaintenanceForm /** * Constructor. * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request) { @@ -203,7 +203,7 @@ public function readInputData() /** * Perform installation. * - * @param ...$functionArgs Function arguments + * @param mixed[] ...$functionArgs Function arguments */ public function execute(...$functionArgs) { diff --git a/classes/install/form/MaintenanceForm.inc.php b/classes/install/form/MaintenanceForm.inc.php index 2c9b3cece33..6eb1f633a44 100644 --- a/classes/install/form/MaintenanceForm.inc.php +++ b/classes/install/form/MaintenanceForm.inc.php @@ -51,8 +51,8 @@ public function display($request = null, $template = null) /** * Fail with a generic installation error. * - * @param $errorMsg string - * @param $translate boolean + * @param string $errorMsg + * @param bool $translate */ public function installError($errorMsg, $translate = true) { @@ -64,7 +64,7 @@ public function installError($errorMsg, $translate = true) /** * Fail with a database installation error. * - * @param $errorMsg string + * @param string $errorMsg */ public function dbInstallError($errorMsg) { diff --git a/classes/linkAction/LinkAction.inc.php b/classes/linkAction/LinkAction.inc.php index 13f71fb6b72..56555f6d7a6 100644 --- a/classes/linkAction/LinkAction.inc.php +++ b/classes/linkAction/LinkAction.inc.php @@ -43,12 +43,12 @@ class LinkAction /** * Constructor * - * @param $id string - * @param $actionRequest LinkActionRequest The action to be taken when the link action is activated. - * @param $title string (optional) The localized title of the action. - * @param $image string (optional) The name of an icon for the + * @param string $id + * @param LinkActionRequest $actionRequest The action to be taken when the link action is activated. + * @param string $title (optional) The localized title of the action. + * @param string $image (optional) The name of an icon for the * action. - * @param $toolTip string (optional) A localized tool tip to display when hovering over + * @param string $toolTip (optional) A localized tool tip to display when hovering over * the link action. */ public function __construct($id, $actionRequest, $title = null, $image = null, $toolTip = null) diff --git a/classes/linkAction/request/AddTabAction.inc.php b/classes/linkAction/request/AddTabAction.inc.php index 25ed590c23d..bc2471ec5d3 100644 --- a/classes/linkAction/request/AddTabAction.inc.php +++ b/classes/linkAction/request/AddTabAction.inc.php @@ -19,7 +19,7 @@ class AddTabAction extends EventAction /** * Constructor * - * @param $targetSelector string Selector for target to receive event. + * @param string $targetSelector Selector for target to receive event. */ public function __construct($targetSelector, $url, $title) { diff --git a/classes/linkAction/request/AjaxAction.inc.php b/classes/linkAction/request/AjaxAction.inc.php index 51fbfe44fcc..93186083e88 100644 --- a/classes/linkAction/request/AjaxAction.inc.php +++ b/classes/linkAction/request/AjaxAction.inc.php @@ -33,9 +33,9 @@ class AjaxAction extends LinkActionRequest /** * Constructor * - * @param $remoteAction string The target URL. - * @param $requestType string One of the AJAX_REQUEST_TYPE_* constants. - * @param $requestData array Any request data (e.g. POST params) to be sent. + * @param string $remoteAction The target URL. + * @param string $requestType One of the AJAX_REQUEST_TYPE_* constants. + * @param array $requestData Any request data (e.g. POST params) to be sent. */ public function __construct($remoteAction, $requestType = self::AJAX_REQUEST_TYPE_POST, $requestData = []) { diff --git a/classes/linkAction/request/AjaxModal.inc.php b/classes/linkAction/request/AjaxModal.inc.php index f901b48977c..0a544c35925 100644 --- a/classes/linkAction/request/AjaxModal.inc.php +++ b/classes/linkAction/request/AjaxModal.inc.php @@ -22,13 +22,13 @@ class AjaxModal extends Modal /** * Constructor * - * @param $url string The URL of the AJAX resource to load into the modal. - * @param $title string (optional) The localized modal title. - * @param $titleIcon string (optional) The icon to be used in the modal title bar. - * @param $canClose boolean (optional) Whether the modal will have a close button. - * @param $closeOnFormSuccessId string (optional) Close the modal when the + * @param string $url The URL of the AJAX resource to load into the modal. + * @param string $title (optional) The localized modal title. + * @param string $titleIcon (optional) The icon to be used in the modal title bar. + * @param bool $canClose (optional) Whether the modal will have a close button. + * @param string $closeOnFormSuccessId (optional) Close the modal when the * form with this id fires a formSuccess event. - * @param $closeCleanVueInstances array (optional) When the modal is closed + * @param array $closeCleanVueInstances (optional) When the modal is closed * destroy the registered vue instances with these ids */ public function __construct( diff --git a/classes/linkAction/request/ConfirmationModal.inc.php b/classes/linkAction/request/ConfirmationModal.inc.php index c16f82bedb8..e9d261ac02f 100644 --- a/classes/linkAction/request/ConfirmationModal.inc.php +++ b/classes/linkAction/request/ConfirmationModal.inc.php @@ -37,16 +37,16 @@ class ConfirmationModal extends Modal /** * Constructor * - * @param $dialogText string The localized text to appear + * @param string $dialogText The localized text to appear * in the dialog modal. - * @param $title string (optional) The localized modal title. - * @param $titleIcon string (optional) The icon to be used + * @param string $title (optional) The localized modal title. + * @param string $titleIcon (optional) The icon to be used * in the modal title bar. - * @param $okButton string (optional) The localized text to + * @param string $okButton (optional) The localized text to * appear on the confirmation button. - * @param $cancelButton string (optional) The localized text to + * @param string $cancelButton (optional) The localized text to * appear on the cancel button. - * @param $canClose boolean (optional) Whether the modal will + * @param bool $canClose (optional) Whether the modal will * have a close button. */ public function __construct($dialogText, $title = null, $titleIcon = 'modal_confirm', $okButton = null, $cancelButton = null, $canClose = true) diff --git a/classes/linkAction/request/EventAction.inc.php b/classes/linkAction/request/EventAction.inc.php index c87088c8b97..85a27d88471 100644 --- a/classes/linkAction/request/EventAction.inc.php +++ b/classes/linkAction/request/EventAction.inc.php @@ -28,8 +28,8 @@ class EventAction extends LinkActionRequest /** * Constructor * - * @param $targetSelector string Selector for target to receive event. - * @param $eventName string Name of Javascript event to trigger. + * @param string $targetSelector Selector for target to receive event. + * @param string $eventName Name of Javascript event to trigger. */ public function __construct($targetSelector, $eventName, $options = []) { diff --git a/classes/linkAction/request/JsEventConfirmationModal.inc.php b/classes/linkAction/request/JsEventConfirmationModal.inc.php index 06a19f2b08a..6e4b368ef1d 100644 --- a/classes/linkAction/request/JsEventConfirmationModal.inc.php +++ b/classes/linkAction/request/JsEventConfirmationModal.inc.php @@ -27,18 +27,18 @@ class JsEventConfirmationModal extends ConfirmationModal /** * Constructor * - * @param $dialogText string The localized text to appear + * @param string $dialogText The localized text to appear * in the dialog modal. - * @param $event string the name of the JS event. - * @param $extraArguments array (optional) extra information to be passed as JSON data with the event. - * @param $title string (optional) The localized modal title. - * @param $titleIcon string (optional) The icon to be used + * @param string $event the name of the JS event. + * @param array $extraArguments (optional) extra information to be passed as JSON data with the event. + * @param string $title (optional) The localized modal title. + * @param string $titleIcon (optional) The icon to be used * in the modal title bar. - * @param $okButton string (optional) The localized text to + * @param string $okButton (optional) The localized text to * appear on the confirmation button. - * @param $cancelButton string (optional) The localized text to + * @param string $cancelButton (optional) The localized text to * appear on the cancel button. - * @param $canClose boolean (optional) Whether the modal will + * @param bool $canClose (optional) Whether the modal will * have a close button. */ public function __construct($dialogText, $event = 'confirmationModalConfirmed', $extraArguments = null, $title = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true) diff --git a/classes/linkAction/request/Modal.inc.php b/classes/linkAction/request/Modal.inc.php index dc9bf1ad117..39d7a2a41e4 100644 --- a/classes/linkAction/request/Modal.inc.php +++ b/classes/linkAction/request/Modal.inc.php @@ -26,7 +26,7 @@ class Modal extends LinkActionRequest /** @var string The icon to be displayed in the title bar. */ public $_titleIcon; - /** @var boolean Whether the modal has a close icon in the title bar. */ + /** @var bool Whether the modal has a close icon in the title bar. */ public $_canClose; /** @var string The id of a form which should close the modal when completed */ @@ -38,12 +38,12 @@ class Modal extends LinkActionRequest /** * Constructor * - * @param $title string (optional) The localized modal title. - * @param $titleIcon string (optional) The icon to be used in the modal title bar. - * @param $canClose boolean (optional) Whether the modal will have a close button. - * @param $closeOnFormSuccessId string (optional) Close the modal when the + * @param string $title (optional) The localized modal title. + * @param string $titleIcon (optional) The icon to be used in the modal title bar. + * @param bool $canClose (optional) Whether the modal will have a close button. + * @param string $closeOnFormSuccessId (optional) Close the modal when the * form with this id fires a formSuccess event. - * @param $closeCleanVueInstances array (optional) When the modal is closed + * @param array $closeCleanVueInstances (optional) When the modal is closed * destroy the registered vue instances with these ids */ public function __construct( @@ -90,7 +90,7 @@ public function getTitleIcon() /** * Whether the modal has a close icon in the title bar. * - * @return boolean + * @return bool */ public function getCanClose() { diff --git a/classes/linkAction/request/OpenWindowAction.inc.php b/classes/linkAction/request/OpenWindowAction.inc.php index 9d156dce7f6..a073ec02855 100644 --- a/classes/linkAction/request/OpenWindowAction.inc.php +++ b/classes/linkAction/request/OpenWindowAction.inc.php @@ -22,7 +22,7 @@ class OpenWindowAction extends LinkActionRequest /** * Constructor * - * @param $url string Target URL + * @param string $url Target URL */ public function __construct($url) { diff --git a/classes/linkAction/request/PostAndRedirectAction.inc.php b/classes/linkAction/request/PostAndRedirectAction.inc.php index 9aa51a29834..6c1378b6ee1 100644 --- a/classes/linkAction/request/PostAndRedirectAction.inc.php +++ b/classes/linkAction/request/PostAndRedirectAction.inc.php @@ -23,8 +23,8 @@ class PostAndRedirectAction extends RedirectAction /** * Constructor * - * @param $postUrl string The target URL to post data. - * @param $redirectUrl string The target URL to redirect. + * @param string $postUrl The target URL to post data. + * @param string $redirectUrl The target URL to redirect. */ public function __construct($postUrl, $redirectUrl) { diff --git a/classes/linkAction/request/RedirectAction.inc.php b/classes/linkAction/request/RedirectAction.inc.php index 2935b3391c3..517214337ac 100644 --- a/classes/linkAction/request/RedirectAction.inc.php +++ b/classes/linkAction/request/RedirectAction.inc.php @@ -28,9 +28,9 @@ class RedirectAction extends LinkActionRequest /** * Constructor * - * @param $url string Target URL - * @param $name string Name of window to direct (defaults to current window) - * @param $specs string Optional set of window specs (see window.open JS reference) + * @param string $url Target URL + * @param string $name Name of window to direct (defaults to current window) + * @param string $specs Optional set of window specs (see window.open JS reference) */ public function __construct($url, $name = '_self', $specs = '') { diff --git a/classes/linkAction/request/RedirectConfirmationModal.inc.php b/classes/linkAction/request/RedirectConfirmationModal.inc.php index 3f22008f84e..d2bbcf49a48 100644 --- a/classes/linkAction/request/RedirectConfirmationModal.inc.php +++ b/classes/linkAction/request/RedirectConfirmationModal.inc.php @@ -22,18 +22,18 @@ class RedirectConfirmationModal extends ConfirmationModal /** * Constructor * - * @param $dialogText string The localized text to appear + * @param string $dialogText The localized text to appear * in the dialog modal. - * @param $title string (optional) The localized modal title. - * @param $remoteUrl string (optional) A URL to be + * @param string $title (optional) The localized modal title. + * @param string $remoteUrl (optional) A URL to be * redirected to when the confirmation button is clicked. - * @param $titleIcon string (optional) The icon to be used + * @param string $titleIcon (optional) The icon to be used * in the modal title bar. - * @param $okButton string (optional) The localized text to + * @param string $okButton (optional) The localized text to * appear on the confirmation button. - * @param $cancelButton string (optional) The localized text to + * @param string $cancelButton (optional) The localized text to * appear on the cancel button. - * @param $canClose boolean (optional) Whether the modal will + * @param bool $canClose (optional) Whether the modal will * have a close button. */ public function __construct($dialogText, $title = null, $remoteUrl = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true) diff --git a/classes/linkAction/request/RemoteActionConfirmationModal.inc.php b/classes/linkAction/request/RemoteActionConfirmationModal.inc.php index 7d38a962620..d85fcfe16ba 100644 --- a/classes/linkAction/request/RemoteActionConfirmationModal.inc.php +++ b/classes/linkAction/request/RemoteActionConfirmationModal.inc.php @@ -25,19 +25,19 @@ class RemoteActionConfirmationModal extends ConfirmationModal /** * Constructor * - * @param $session Session The user's session object. - * @param $dialogText string The localized text to appear + * @param Session $session The user's session object. + * @param string $dialogText The localized text to appear * in the dialog modal. - * @param $title string (optional) The localized modal title. - * @param $remoteAction string (optional) A URL to be + * @param string $title (optional) The localized modal title. + * @param string $remoteAction (optional) A URL to be * called when the confirmation button is clicked. - * @param $titleIcon string (optional) The icon to be used + * @param string $titleIcon (optional) The icon to be used * in the modal title bar. - * @param $okButton string (optional) The localized text to + * @param string $okButton (optional) The localized text to * appear on the confirmation button. - * @param $cancelButton string (optional) The localized text to + * @param string $cancelButton (optional) The localized text to * appear on the cancel button. - * @param $canClose boolean (optional) Whether the modal will + * @param bool $canClose (optional) Whether the modal will * have a close button. */ public function __construct($session, $dialogText, $title = null, $remoteAction = null, $titleIcon = null, $okButton = null, $cancelButton = null, $canClose = true) diff --git a/classes/linkAction/request/WizardModal.inc.php b/classes/linkAction/request/WizardModal.inc.php index 1fcd13e00a8..d1ab9529a08 100644 --- a/classes/linkAction/request/WizardModal.inc.php +++ b/classes/linkAction/request/WizardModal.inc.php @@ -19,10 +19,10 @@ class WizardModal extends AjaxModal /** * Constructor * - * @param $url string The URL of the AJAX resource to load into the wizard modal. - * @param $title string (optional) The localized modal title. - * @param $titleIcon string (optional) The icon to be used in the modal title bar. - * @param $canClose boolean (optional) Whether the modal will have a close button. + * @param string $url The URL of the AJAX resource to load into the wizard modal. + * @param string $title (optional) The localized modal title. + * @param string $titleIcon (optional) The icon to be used in the modal title bar. + * @param bool $canClose (optional) Whether the modal will have a close button. */ public function __construct($url, $title = null, $titleIcon = null, $canClose = true) { diff --git a/classes/log/EmailLogDAO.inc.php b/classes/log/EmailLogDAO.inc.php index 9595a51e050..2fc1141c07a 100644 --- a/classes/log/EmailLogDAO.inc.php +++ b/classes/log/EmailLogDAO.inc.php @@ -26,9 +26,9 @@ class EmailLogDAO extends \PKP\db\DAO /** * Retrieve a log entry by ID. * - * @param $logId int - * @param $assocType int optional - * @param $assocId int optional + * @param int $logId + * @param int $assocType optional + * @param int $assocId optional * * @return EmailLogEntry */ @@ -52,11 +52,11 @@ public function getById($logId, $assocType = null, $assocId = null) /** * Retrieve a log entry by event type. * - * @param $assocType int - * @param $assocId int - * @param $eventType int - * @param $userId int optional - * @param $rangeInfo object optional + * @param int $assocType + * @param int $assocId + * @param int $eventType + * @param int $userId optional + * @param object $rangeInfo optional * * @return EmailLogEntry */ @@ -89,9 +89,9 @@ public function _getByEventType($assocType, $assocId, $eventType, $userId = null /** * Retrieve all log entries for an object matching the specified association. * - * @param $assocType int - * @param $assocId int - * @param $rangeInfo object optional + * @param int $assocType + * @param int $assocId + * @param object $rangeInfo optional * * @return DAOResultFactory containing matching EventLogEntry ordered by sequence */ @@ -113,7 +113,7 @@ public function getByAssoc($assocType = null, $assocId = null, $rangeInfo = null /** * Internal function to return an EmailLogEntry object from a row. * - * @param $row array + * @param array $row * * @return EmailLogEntry */ @@ -141,7 +141,7 @@ public function build($row) /** * Insert a new log entry. * - * @param $entry EmailLogEntry + * @param EmailLogEntry $entry */ public function insertObject($entry) { @@ -176,9 +176,9 @@ public function insertObject($entry) /** * Delete a single log entry for an object. * - * @param $logId int - * @param $assocType int optional - * @param $assocId int optional + * @param int $logId + * @param int $assocType optional + * @param int $assocId optional */ public function deleteObject($logId, $assocType = null, $assocId = null) { @@ -197,7 +197,7 @@ public function deleteObject($logId, $assocType = null, $assocId = null) /** * Delete all log entries for an object. * - * @param $assocType int + * @param int $assocType * @praam $assocId int */ public function deleteByAssoc($assocType, $assocId) @@ -211,8 +211,8 @@ public function deleteByAssoc($assocType, $assocId) /** * Transfer all log entries to another user. * - * @param $oldUserId int - * @param $newUserId int + * @param int $oldUserId + * @param int $newUserId */ public function changeUser($oldUserId, $newUserId) { @@ -239,7 +239,7 @@ public function getInsertId() /** * Stores the correspondent user ids of the all recipient emails. * - * @param $entry EmailLogEntry + * @param EmailLogEntry $entry */ public function _insertLogUserIds($entry) { diff --git a/classes/log/EmailLogEntry.inc.php b/classes/log/EmailLogEntry.inc.php index 11204de39c1..fe121761b48 100644 --- a/classes/log/EmailLogEntry.inc.php +++ b/classes/log/EmailLogEntry.inc.php @@ -38,7 +38,7 @@ public function getSenderId() /** * Set user ID of sender. * - * @param $senderId int + * @param int $senderId */ public function setSenderId($senderId) { @@ -58,7 +58,7 @@ public function getDateSent() /** * Set date email was sent. * - * @param $dateSent datestamp + * @param datestamp $dateSent */ public function setDateSent($dateSent) { @@ -78,7 +78,7 @@ public function getEventType() /** * Set event type. * - * @param $eventType int + * @param int $eventType */ public function setEventType($eventType) { @@ -98,7 +98,7 @@ public function getAssocType() /** * Set associated type. * - * @param $assocType int + * @param int $assocType */ public function setAssocType($assocType) { @@ -118,7 +118,7 @@ public function getAssocId() /** * Set associated ID. * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { diff --git a/classes/log/EventLogDAO.inc.php b/classes/log/EventLogDAO.inc.php index dd3ab9bea75..c7c1d1a2442 100644 --- a/classes/log/EventLogDAO.inc.php +++ b/classes/log/EventLogDAO.inc.php @@ -25,9 +25,9 @@ class EventLogDAO extends \PKP\db\DAO /** * Retrieve a log entry by ID. * - * @param $logId int - * @param $assocId int optional - * @param $assocType int optional + * @param int $logId + * @param int $assocId optional + * @param int $assocType optional * * @return EventLogEntry */ @@ -51,9 +51,9 @@ public function getById($logId, $assocType = null, $assocId = null) /** * Retrieve all log entries matching the specified association. * - * @param $assocType int - * @param $assocId int - * @param $rangeInfo object optional + * @param int $assocType + * @param int $assocId + * @param object $rangeInfo optional * * @return DAOResultFactory containing matching EventLogEntry ordered by sequence */ @@ -81,7 +81,7 @@ public function newDataObject() /** * Internal function to return an EventLogEntry object from a row. * - * @param $row array + * @param array $row * * @return EventLogEntry */ @@ -115,7 +115,7 @@ public function build($row) /** * Insert a new log entry. * - * @param $entry EventLogEntry + * @param EventLogEntry $entry */ public function insertObject($entry) { @@ -157,7 +157,7 @@ public function insertObject($entry) /** * Delete a single log entry (and associated settings). * - * @param $logId int + * @param int $logId * @param null|mixed $assocType * @param null|mixed $assocId */ @@ -180,8 +180,8 @@ public function deleteById($logId, $assocType = null, $assocId = null) /** * Delete all log entries for an object. * - * @param $assocType int - * @param $assocId int + * @param int $assocType + * @param int $assocId */ public function deleteByAssoc($assocType, $assocId) { @@ -194,8 +194,8 @@ public function deleteByAssoc($assocType, $assocId) /** * Transfer all log entries to another user. * - * @param $oldUserId int - * @param $newUserId int + * @param int $oldUserId + * @param int $newUserId */ public function changeUser($oldUserId, $newUserId) { diff --git a/classes/log/EventLogEntry.inc.php b/classes/log/EventLogEntry.inc.php index dc3f1ca820e..8a842704fa6 100644 --- a/classes/log/EventLogEntry.inc.php +++ b/classes/log/EventLogEntry.inc.php @@ -45,7 +45,7 @@ public function getUserId() /** * Set user ID of user that initiated the event. * - * @param $userId int + * @param int $userId */ public function setUserId($userId) { @@ -65,7 +65,7 @@ public function getDateLogged() /** * Set date entry was logged. * - * @param $dateLogged datestamp + * @param datestamp $dateLogged */ public function setDateLogged($dateLogged) { @@ -85,7 +85,7 @@ public function getEventType() /** * Set event type. * - * @param $eventType int + * @param int $eventType */ public function setEventType($eventType) { @@ -105,7 +105,7 @@ public function getAssocType() /** * Set associated type. * - * @param $assocType int + * @param int $assocType */ public function setAssocType($assocType) { @@ -125,7 +125,7 @@ public function getAssocId() /** * Set associated ID. * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -145,7 +145,7 @@ public function getMessage() /** * Set custom log message (either locale key or literal string). * - * @param $message string + * @param string $message */ public function setMessage($message) { @@ -155,7 +155,7 @@ public function setMessage($message) /** * Get flag indicating whether or not message is translated. * - * @return boolean + * @return bool */ public function getIsTranslated() { @@ -165,7 +165,7 @@ public function getIsTranslated() /** * Set flag indicating whether or not message is translated. * - * @param $isTranslated int + * @param int $isTranslated */ public function setIsTranslated($isTranslated) { @@ -175,8 +175,8 @@ public function setIsTranslated($isTranslated) /** * Get translated message, translating it if necessary. * - * @param $locale string optional - * @param $hideReviewerName boolean optional Don't reveal reviewer names in + * @param string $locale optional + * @param bool $hideReviewerName optional Don't reveal reviewer names in * log descriptions. */ public function getTranslatedMessage($locale = null, $hideReviewerName = false) @@ -214,7 +214,7 @@ public function getTranslatedMessage($locale = null, $hideReviewerName = false) if (isset($params['fileStage']) && $params['fileStage'] === SubmissionFile::SUBMISSION_FILE_REVIEW_ATTACHMENT) { assert(isset($params['fileId']) && isset($params['submissionId'])); $anonymousAuthor = true; - $submissionFile = Repo::submissionFiles()->get($params['id']); + $submissionFile = Repo::submissionFile()->get($params['id']); if ($submissionFile && $submissionFile->getData('assocType') === ASSOC_TYPE_REVIEW_ASSIGNMENT) { $reviewAssignment = $reviewAssignmentDao->getById($submissionFile->getData('assocId')); if ($reviewAssignment && !in_array($reviewAssignment->getReviewMethod(), [SUBMISSION_REVIEW_METHOD_ANONYMOUS, SUBMISSION_REVIEW_METHOD_DOUBLEANONYMOUS])) { @@ -249,7 +249,7 @@ public function getParams() /** * Set custom log message parameters. * - * @param $params array + * @param array $params */ public function setParams($params) { @@ -268,7 +268,7 @@ public function getUserFullName() $userFullName = Repo::user()->get($this->getUserId(), true)->getFullName(); } - return ($userFullName ? $userFullName : ''); + return $userFullName ?: ''; } /** @@ -284,7 +284,7 @@ public function getUserEmail() $userEmail = Repo::user()->get($this->getUserId(), true)->getEmail(); } - return ($userEmail ? $userEmail : ''); + return $userEmail ?: ''; } } diff --git a/classes/log/PKPSubmissionEventLogEntry.inc.php b/classes/log/PKPSubmissionEventLogEntry.inc.php index dfab52c99da..4baa8488dd2 100644 --- a/classes/log/PKPSubmissionEventLogEntry.inc.php +++ b/classes/log/PKPSubmissionEventLogEntry.inc.php @@ -31,6 +31,7 @@ class PKPSubmissionEventLogEntry extends EventLogEntry public const SUBMISSION_LOG_EDITOR_DECISION = 0x30000003; public const SUBMISSION_LOG_EDITOR_RECOMMENDATION = 0x30000004; + public const SUBMISSION_LOG_DECISION_EMAIL_SENT = 0x40000020; public const SUBMISSION_LOG_REVIEW_ASSIGN = 0x40000001; public const SUBMISSION_LOG_REVIEW_REINSTATED = 0x40000005; @@ -42,6 +43,7 @@ class PKPSubmissionEventLogEntry extends EventLogEntry public const SUBMISSION_LOG_REVIEW_READY = 0x40000018; public const SUBMISSION_LOG_REVIEW_CONFIRMED = 0x40000019; + // // Getters/setters // diff --git a/classes/log/SubmissionEmailLogDAO.inc.php b/classes/log/SubmissionEmailLogDAO.inc.php index f3fa6d5de10..990bc780082 100644 --- a/classes/log/SubmissionEmailLogDAO.inc.php +++ b/classes/log/SubmissionEmailLogDAO.inc.php @@ -17,6 +17,11 @@ namespace PKP\log; +use APP\submission\Submission; +use PKP\core\Core; +use PKP\mail\Mailable; +use PKP\user\User; + class SubmissionEmailLogDAO extends EmailLogDAO { /** @@ -34,9 +39,8 @@ public function newDataObject() /** * Get submission email log entries by submission ID and event type * - * @param $submissionId int - * @param $eventType SubmissionEmailLogEntry::SUBMISSION_EMAIL_... - * @param $userId int optional Return only emails sent to this user. + * @param int $submissionId + * @param int $userId optional Return only emails sent to this user. * * @return DAOResultFactory */ @@ -48,7 +52,7 @@ public function getByEventType($submissionId, $eventType, $userId = null) /** * Get submission email log entries by submission ID * - * @param $submissionId int + * @param int $submissionId * * @return DAOResultFactory */ @@ -56,6 +60,46 @@ public function getBySubmissionId($submissionId) { return $this->getByAssoc(ASSOC_TYPE_SUBMISSION, $submissionId); } + + /** + * Create a log entry from data in a Mailable class + * + * @param integer $eventType One of the SubmissionEmailLogEntry::SUBMISSION_EMAIL_* constants + * + * @return integer The new log entry id + */ + public function logMailable(int $eventType, Mailable $mailable, Submission $submission, ?User $sender = null): int + { + $entry = $this->newDataObject(); + $entry->setEventType($eventType); + $entry->setAssocId($submission->getId()); + $entry->setDateSent(Core::getCurrentDate()); + $entry->setSenderId($sender ? $sender->getId() : 0); + $entry->setSubject($mailable->subject); + $entry->setBody($mailable->render()); + $entry->setFrom($this->getContactString($mailable->from)); + $entry->setRecipients($this->getContactString($mailable->to)); + $entry->setCcs($this->getContactString($mailable->cc)); + $entry->setBccs($this->getContactString($mailable->bcc)); + + return $this->insertObject($entry); + } + + /** + * Get the from or to data as a string + * + * @param array $addressees Expects Mailable::$to or Mailable::$from + */ + protected function getContactString(array $addressees): string + { + $contactStrings = []; + foreach ($addressees as $addressee) { + $contactStrings[] = isset($addressee['name']) + ? '"' . $addressee['name'] . '" <' . $addressee['address'] . '>' + : $addressee['address']; + } + return join(', ', $contactStrings); + } } if (!PKP_STRICT_MODE) { diff --git a/classes/log/SubmissionEmailLogEntry.inc.php b/classes/log/SubmissionEmailLogEntry.inc.php index a3038003838..48ab9281e74 100644 --- a/classes/log/SubmissionEmailLogEntry.inc.php +++ b/classes/log/SubmissionEmailLogEntry.inc.php @@ -67,7 +67,7 @@ class SubmissionEmailLogEntry extends EmailLogEntry /** * Set the submission ID for the log entry. * - * @param $submissionId int + * @param int $submissionId */ public function setSubmissionId($submissionId) { diff --git a/classes/log/SubmissionEventLogDAO.inc.php b/classes/log/SubmissionEventLogDAO.inc.php index 6e893b0d004..0e09a988f44 100644 --- a/classes/log/SubmissionEventLogDAO.inc.php +++ b/classes/log/SubmissionEventLogDAO.inc.php @@ -36,7 +36,7 @@ public function newDataObject() /** * Get submission event log entries by submission ID * - * @param $submissionId int + * @param int $submissionId * * @return DAOResultFactory */ diff --git a/classes/log/SubmissionFileEventLogDAO.inc.php b/classes/log/SubmissionFileEventLogDAO.inc.php index 39231f48e85..93437d90d2e 100644 --- a/classes/log/SubmissionFileEventLogDAO.inc.php +++ b/classes/log/SubmissionFileEventLogDAO.inc.php @@ -34,7 +34,7 @@ public function newDataObject() /** * Get event log entries by submission file ID. * - * @param $submissionFileId int + * @param int $submissionFileId * * @return DAOResultFactory */ diff --git a/classes/log/SubmissionFileLog.inc.php b/classes/log/SubmissionFileLog.inc.php index c51d282005c..16790ec789c 100644 --- a/classes/log/SubmissionFileLog.inc.php +++ b/classes/log/SubmissionFileLog.inc.php @@ -23,11 +23,11 @@ class SubmissionFileLog extends SubmissionLog /** * Add a new file event log entry with the specified parameters * - * @param $request object - * @param $submissionFile object - * @param $eventType int - * @param $messageKey string - * @param $params array optional + * @param object $request + * @param object $submissionFile + * @param int $eventType + * @param string $messageKey + * @param array $params optional * * @return object SubmissionLogEntry iff the event was logged */ diff --git a/classes/log/SubmissionLog.inc.php b/classes/log/SubmissionLog.inc.php index f705bcb9176..7dcd4d6e2c3 100644 --- a/classes/log/SubmissionLog.inc.php +++ b/classes/log/SubmissionLog.inc.php @@ -31,11 +31,11 @@ class SubmissionLog /** * Add a new event log entry with the specified parameters * - * @param $request object - * @param $submission object - * @param $eventType int - * @param $messageKey string - * @param $params array optional + * @param object $request + * @param object $submission + * @param int $eventType + * @param string $messageKey + * @param array $params optional * * @return object SubmissionLogEntry iff the event was logged */ diff --git a/classes/mail/EmailData.inc.php b/classes/mail/EmailData.inc.php new file mode 100644 index 00000000000..1a6b140b56c --- /dev/null +++ b/classes/mail/EmailData.inc.php @@ -0,0 +1,79 @@ + 1, 'name' => 'example.docx'] + * ['submissionFileId' => 2, 'name' => 'other.pdf'] + * ] + * + * @param array[] + */ + public array $attachments = []; + + /** + * Instantiate an object from an assoc array of request data + * + * @param array $args [ + */ + public function __construct(array $args = []) + { + foreach ($args as $key => $value) { + if (property_exists(EmailData::class, $key)) { + $this->{$key} = $value; + } + } + } +} diff --git a/classes/mail/FormEmailData.inc.php b/classes/mail/FormEmailData.inc.php deleted file mode 100644 index facf494d71c..00000000000 --- a/classes/mail/FormEmailData.inc.php +++ /dev/null @@ -1,99 +0,0 @@ -body = $body; - return $this; - } - - public function setSubject(?string $subject): FormEmailData - { - if ($subject) { - $this->subject = $subject; - } - return $this; - } - - public function skipEmail(bool $skip): FormEmailData - { - $this->skipEmail = $skip; - return $this; - } - - public function setRecipientIds(array $userIds): FormEmailData - { - $this->recipientIds = $userIds; - return $this; - } - - public function setSenderId(int $userId): FormEmailData - { - $this->senderId = $userId; - return $this; - } - - public function addVariables(array $variablesToAdd): FormEmailData - { - $this->variables = $variablesToAdd + $this->variables; - return $this; - } - - public function shouldBeSkipped() - { - return $this->skipEmail; - } - - public function getRecipients(int $contextId): LazyCollection - { - return Repo::user()->getMany( - Repo::user()->getCollector() - ->filterByUserIds($this->recipientIds) - ->filterByContextIds([$contextId]) - ); - } - - public function getSender(): ?User - { - return Repo::user()->get($this->senderId); - } - - public function getVariables(int $userId = null): array - { - return $userId ? $this->variables[$userId] : $this->variables; - } -} diff --git a/classes/mail/Mail.inc.php b/classes/mail/Mail.inc.php index 048196395f4..cda98523038 100644 --- a/classes/mail/Mail.inc.php +++ b/classes/mail/Mail.inc.php @@ -27,7 +27,6 @@ use PHPMailer\PHPMailer\OAuth; use PHPMailer\PHPMailer\PHPMailer; -use PHPMailer\PHPMailer\SMTP; use PKP\config\Config; use PKP\core\PKPString; @@ -77,8 +76,8 @@ public function setPrivateParams($privateParams) /** * Add a recipient. * - * @param $email string - * @param $name string optional + * @param string $email + * @param string $name optional */ public function addRecipient($email, $name = '') { @@ -94,7 +93,7 @@ public function addRecipient($email, $name = '') * Set the envelope sender (bounce address) for the message, * if supported. * - * @param $envelopeSender string Email address + * @param string $envelopeSender Email address */ public function setEnvelopeSender($envelopeSender) { @@ -130,7 +129,7 @@ public function getContentType() /** * Set the message content type (MIME) * - * @param $contentType string + * @param string $contentType */ public function setContentType($contentType) { @@ -150,7 +149,7 @@ public function getRecipients() /** * Set the recipients for the message. * - * @param $recipients array + * @param array $recipients */ public function setRecipients($recipients) { @@ -160,8 +159,8 @@ public function setRecipients($recipients) /** * Add a carbon-copy (CC) recipient to the message. * - * @param $email string - * @param $name string optional + * @param string $email + * @param string $name optional */ public function addCc($email, $name = '') { @@ -186,7 +185,7 @@ public function getCcs() /** * Set the carbon-copy (CC) recipients for the message. * - * @param $ccs array + * @param array $ccs */ public function setCcs($ccs) { @@ -196,8 +195,8 @@ public function setCcs($ccs) /** * Add a hidden carbon copy (BCC) recipient to the message. * - * @param $email string - * @param $name optional + * @param string $email + * @param string $name optional */ public function addBcc($email, $name = '') { @@ -222,7 +221,7 @@ public function getBccs() /** * Set the hidden carbon copy (BCC) recipients for the message. * - * @param $bccs array + * @param array $bccs */ public function setBccs($bccs) { @@ -233,7 +232,7 @@ public function setBccs($bccs) * If no recipients for this message, promote CC'd accounts to * recipients. If recipients exist, no effect. * - * @return boolean true iff CCs were promoted + * @return bool true iff CCs were promoted */ public function promoteCcsIfNoRecipients() { @@ -260,8 +259,8 @@ public function clearAllRecipients() /** * Add an SMTP header to the message. * - * @param $name string - * @param $content string + * @param string $name + * @param string $content */ public function addHeader($name, $content) { @@ -298,7 +297,7 @@ public function getHeaders() /** * Set the SMTP headers for the message. * - * @param $headers array + * @param array $headers */ public function setHeaders(&$headers) { @@ -308,10 +307,10 @@ public function setHeaders(&$headers) /** * Adds a file attachment to the email. * - * @param $filePath string complete path to the file to attach - * @param $fileName string attachment file name (optional) - * @param $contentType string attachment content type (optional) - * @param $contentDisposition string attachment content disposition, inline or attachment (optional, default attachment) + * @param string $filePath complete path to the file to attach + * @param string $fileName attachment file name (optional) + * @param string $contentType attachment content type (optional) + * @param string $contentDisposition attachment content disposition, inline or attachment (optional, default attachment) */ public function addAttachment($filePath, $fileName = '', $contentType = '', $contentDisposition = 'attachment') { @@ -355,7 +354,7 @@ public function &getAttachments() /** * Return true iff attachments are included in this message. * - * @return boolean + * @return bool */ public function hasAttachments() { @@ -366,8 +365,8 @@ public function hasAttachments() /** * Set the sender of the message. * - * @param $email string - * @param $name string optional + * @param string $email + * @param string $name optional */ public function setFrom($email, $name = '') { @@ -387,8 +386,8 @@ public function getFrom() /** * Set the reply-to of the message. * - * @param $email string or null to clear - * @param $name string optional + * @param string|null $email to clear + * @param string $name optional */ public function setReplyTo($email, $name = '') { @@ -401,8 +400,8 @@ public function setReplyTo($email, $name = '') /** * Add a reply-to for the message. * - * @param $email string - * @param $name string optional + * @param string $email + * @param string $name optional */ public function addReplyTo($email, $name = '') { @@ -438,7 +437,7 @@ public function getReplyToString($send = false) /** * Set the subject of the message. * - * @param $subject string + * @param string $subject */ public function setSubject($subject) { @@ -458,7 +457,7 @@ public function getSubject() /** * Set the body of the message. * - * @param $body string + * @param string $body */ public function setBody($body) { @@ -493,7 +492,7 @@ public function getFromString($send = false) /** * Return a string from an array of (name, email) pairs. * - * @param $includeNames boolean + * @param bool $includeNames * * @return string; */ @@ -554,7 +553,7 @@ public function getBccString() /** * Send the email. * - * @return boolean + * @return bool */ public function send() { @@ -706,8 +705,8 @@ public function send() /** * Encode a display name for proper inclusion with an email address. * - * @param $displayName string - * @param $send boolean True to encode the results for sending + * @param string $displayName + * @param bool $send True to encode the results for sending * * @return string */ diff --git a/classes/mail/MailTemplate.inc.php b/classes/mail/MailTemplate.inc.php index 6686fe37459..c15d4076d89 100644 --- a/classes/mail/MailTemplate.inc.php +++ b/classes/mail/MailTemplate.inc.php @@ -18,6 +18,7 @@ use APP\core\Application; use APP\i18n\AppLocale; +use APP\mail\variables\ContextEmailVariable; use PKP\core\PKPApplication; use PKP\facades\Repo; @@ -28,7 +29,7 @@ class MailTemplate extends Mail /** @var object The context this message relates to */ public $context; - /** @var boolean whether to include the context's signature */ + /** @var bool whether to include the context's signature */ public $includeSignature; /** @var string Key of the email template we are using */ @@ -37,16 +38,16 @@ class MailTemplate extends Mail /** @var string locale of this template */ public $locale; - /** @var boolean email template is enabled */ + /** @var bool email template is enabled */ public $enabled; /** @var array List of errors to display to the user */ public $errorMessages; - /** @var boolean whether or not to bcc the sender */ + /** @var bool whether or not to bcc the sender */ public $bccSender; - /** @var boolean Whether or not email fields are disabled */ + /** @var bool Whether or not email fields are disabled */ public $addressFieldsEnabled; /** @var array The list of parameters to be assigned to the template. */ @@ -55,9 +56,9 @@ class MailTemplate extends Mail /** * Constructor. * - * @param $emailKey string unique identifier for the template - * @param $locale string locale of the template - * @param $includeSignature boolean optional + * @param string $emailKey unique identifier for the template + * @param string $locale locale of the template + * @param bool $includeSignature optional * @param null|mixed $context */ public function __construct($emailKey = null, $locale = null, $context = null, $includeSignature = true) @@ -126,7 +127,7 @@ public function __construct($emailKey = null, $locale = null, $context = null, $ * fields, callers should manually clearAllRecipients and add/set * recipients just prior to sending. * - * @param $addressFieldsEnabled boolean + * @param bool $addressFieldsEnabled */ public function setAddressFieldsEnabled($addressFieldsEnabled) { @@ -136,7 +137,7 @@ public function setAddressFieldsEnabled($addressFieldsEnabled) /** * Get the enabled/disabled state of address fields on the email form. * - * @return boolean + * @return bool */ public function getAddressFieldsEnabled() { @@ -146,7 +147,7 @@ public function getAddressFieldsEnabled() /** * Check whether or not there were errors in the user input for this form. * - * @return boolean true iff one or more error messages are stored. + * @return bool true iff one or more error messages are stored. */ public function hasErrors() { @@ -156,7 +157,7 @@ public function hasErrors() /** * Assigns values to e-mail parameters. * - * @param $params array Associative array of variables to supply to the email template + * @param array $params Associative array of variables to supply to the email template */ public function assignParams($params = []) { @@ -168,9 +169,9 @@ public function assignParams($params = []) // Add context-specific variables $dispatcher = $application->getDispatcher(); $params = array_merge([ - 'principalContactSignature' => $this->context->getData('contactName'), - 'contextName' => $this->context->getLocalizedName(), - 'contextUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $this->context->getPath()), + 'signature' => $this->context->getData('contactName'), + ContextEmailVariable::CONTEXT_NAME => $this->context->getLocalizedName(), + ContextEmailVariable::CONTEXT_URL => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $this->context->getPath()), 'mailingAddress' => htmlspecialchars(nl2br($this->context->getData('mailingAddress'))), 'contactEmail' => htmlspecialchars($this->context->getData('contactEmail')), 'contactName' => htmlspecialchars($this->context->getData('contactName')), @@ -178,7 +179,7 @@ public function assignParams($params = []) } else { // No context available $params = array_merge([ - 'principalContactSignature' => $site->getLocalizedContactName(), + 'signature' => $site->getLocalizedContactName(), ], $params); } @@ -201,7 +202,7 @@ public function assignParams($params = []) /** * Returns true if the email template is enabled; false otherwise. * - * @return boolean + * @return bool */ public function isEnabled() { @@ -211,7 +212,7 @@ public function isEnabled() /** * Send the email. * - * @return boolean false if there was a problem sending the email + * @return bool false if there was a problem sending the email */ public function send() { @@ -269,9 +270,9 @@ public function replaceParams() * Assigns user-specific values to email parameters, sends * the email, then clears those values. * - * @param $params array Associative array of variables to supply to the email template + * @param array $params Associative array of variables to supply to the email template * - * @return boolean false if there was a problem sending the email + * @return bool false if there was a problem sending the email */ public function sendWithParams($params) { @@ -292,7 +293,7 @@ public function sendWithParams($params) /** * Clears the recipient, cc, and bcc lists. * - * @param $clearHeaders boolean if true, also clear headers + * @param bool $clearHeaders if true, also clear headers */ public function clearRecipients($clearHeaders = true) { @@ -307,9 +308,9 @@ public function clearRecipients($clearHeaders = true) /** * Finds and changes appropriately URL valued template parameter keys. * - * @param $targetString string The string that contains the original {$key}s template variables - * @param $key string The key we are looking for, and has an URL as its $value - * @param $value string The value of the $key + * @param string $targetString The string that contains the original {$key}s template variables + * @param string $key The key we are looking for, and has an URL as its $value + * @param string $value The value of the $key * * @return string the $targetString replaced appropriately */ diff --git a/classes/mail/Mailable.inc.php b/classes/mail/Mailable.inc.php index c8fc67c664b..199fda46ade 100644 --- a/classes/mail/Mailable.inc.php +++ b/classes/mail/Mailable.inc.php @@ -27,23 +27,33 @@ namespace PKP\mail; +use APP\core\Services; +use APP\decision\Decision; +use APP\facades\Repo; use APP\i18n\AppLocale; +use APP\mail\variables\ContextEmailVariable; use BadMethodCallException; use Exception; use Illuminate\Mail\Mailable as IlluminateMailable; use InvalidArgumentException; +use PKP\config\Config; use PKP\context\Context; -use APP\mail\variables\ContextEmailVariable; +use PKP\context\LibraryFile; +use PKP\context\LibraryFileDAO; +use PKP\db\DAORegistry; +use PKP\file\TemporaryFileManager; +use PKP\mail\traits\Recipient; +use PKP\mail\traits\Sender; +use PKP\mail\variables\DecisionEmailVariable; use PKP\mail\variables\QueuedPaymentEmailVariable; use PKP\mail\variables\RecipientEmailVariable; use PKP\mail\variables\ReviewAssignmentEmailVariable; use PKP\mail\variables\SenderEmailVariable; use PKP\mail\variables\SiteEmailVariable; -use PKP\mail\variables\StageAssignmentEmailVariable; use PKP\mail\variables\SubmissionEmailVariable; +use PKP\mail\variables\Variable; use PKP\payment\QueuedPayment; use PKP\site\Site; -use PKP\stageAssignment\StageAssignment; use PKP\submission\PKPSubmission; use PKP\submission\reviewAssignment\ReviewAssignment; use ReflectionClass; @@ -52,11 +62,7 @@ class Mailable extends IlluminateMailable { - - /** - * Name of the variable representing a message object assigned to email templates by Illuminate Mailer by default - * @var string - */ + /** Used internally by Illuminate Mailer. Do not touch. */ public const DATA_KEY_MESSAGE = 'message'; public const GROUP_OTHER = 'other'; @@ -65,30 +71,28 @@ class Mailable extends IlluminateMailable public const GROUP_COPYEDITING = 'copyediting'; public const GROUP_PRODUCTION = 'production'; - /** - * The email variables handled by this mailable - * - * @param array - */ - protected array $variables = []; - - /** - * One or more groups this mailable should be included in - * - * Mailables are assigned to one or more groups so that they - * can be organized when shown in the UI. - */ - protected static array $groupIds = [self::GROUP_OTHER]; + public const ATTACHMENT_TEMPORARY_FILE = 'temporaryFileId'; + public const ATTACHMENT_SUBMISSION_FILE = 'submissionFileId'; + public const ATTACHMENT_LIBRARY_FILE = 'libraryFileId'; - // Locale key, name of the Mailable displayed in the UI + /** @var string|null Locale key for the name of this Mailable */ protected static ?string $name = null; - // Locale key, description of the Mailable displayed in the UI + /** @var string|null Locale key for the description of this Mailable */ protected static ?string $description = null; - // Whether Mailable supports additional templates, besides the default + /** @var string|null Key of the default email template key to use with this Mailable */ + protected static ?string $emailTemplateKey = null; + + /** @var bool Whether users can assign extra email templates to this Mailable */ protected static bool $supportsTemplates = false; + /** @var int[] Mailables are organized into one or more self::GROUP_ */ + protected static array $groupIds = [self::GROUP_OTHER]; + + /** @var Variable[] The email variables supported by this mailable */ + protected array $variables = []; + public function __construct(array $variables = []) { if (!empty($variables)) { @@ -96,10 +100,52 @@ public function __construct(array $variables = []) } } + /** + * Get the name of this Mailable + */ + public static function getName(): string + { + return static::$name ? __(static::$name) : ''; + } + + /** + * Get the description of this Mailable + */ + public static function getDescription(): string + { + return static::$description ? __(static::$description) : ''; + } + + /** + * Get the description of this Mailable + */ + public static function getEmailTemplateKey(): string + { + return static::$emailTemplateKey ? static::$emailTemplateKey : ''; + } + + /** + * Get whether or not this Mailable supports extra email templates + */ + public function getSupportsTemplates(): bool + { + return $this->supportsTemplates; + } + + /** + * Get the groups this Mailable is in + * + * @return string[] + */ + public static function getGroupIds(): array + { + return static::$groupIds; + } + /** * Add data for this email */ - public function addData(array $data) : self + public function addData(array $data): self { $this->viewData = array_merge($this->viewData, $data); return $this; @@ -132,6 +178,7 @@ public function setData(?string $locale = null) /** * @param string $localeKey + * * @throws BadMethodCallException */ public function locale($localeKey) @@ -142,45 +189,42 @@ public function locale($localeKey) /** * Use instead of the \Illuminate\Mail\Mailable::view() to compile template message's body + * * @param string $view HTML string with template variables */ - public function body(string $view) : self + public function body(string $view): self { return parent::view($view, []); } /** * Doesn't support Illuminate markdown + * * @throws BadMethodCallException */ - public function markdown($view, array $data = []) : self + public function markdown($view, array $data = []): self { throw new BadMethodCallException('Markdown isn\'t supported'); } - /** - * @return array [self::GROUP_...] workflow stages associated with a mailable - */ - public static function getGroupIds() : array - { - return static::$groupIds; - } - /** * Method's implementation is required for Mailable to be sent according to Laravel docs + * * @see \Illuminate\Mail\Mailable::send(), https://laravel.com/docs/7.x/mail#writing-mailables */ - public function build() : self + public function build(): self { return $this; } /** * Allow data to be passed to the subject + * * @param \Illuminate\Mail\Message $message + * * @throws Exception */ - protected function buildSubject($message) : self + protected function buildSubject($message): self { if (!$this->subject) { throw new Exception('Subject isn\'t specified in ' . static::class); @@ -195,25 +239,26 @@ protected function buildSubject($message) : self /** * Returns variables map associated with a specific object, * variables names should be unique + * * @return string[] */ - protected static function templateVariablesMap() : array + protected static function templateVariablesMap(): array { return [ - Site::class => SiteEmailVariable::class, Context::class => ContextEmailVariable::class, + Decision::class => DecisionEmailVariable::class, PKPSubmission::class => SubmissionEmailVariable::class, ReviewAssignment::class => ReviewAssignmentEmailVariable::class, - StageAssignment::class => StageAssignmentEmailVariable::class, QueuedPayment::class => QueuedPaymentEmailVariable::class, + Site::class => SiteEmailVariable::class, ]; } /** * Scans arguments to retrieve variables which can be assigned to the template of the email */ - protected function setupVariables(array $variables) : void + protected function setupVariables(array $variables): void { $map = static::templateVariablesMap(); foreach ($variables as $variable) { @@ -234,7 +279,7 @@ protected function setupVariables(array $variables) : void * * @return array ['variableName' => description] */ - public static function getDataDescriptions() : array + public static function getDataDescriptions(): array { $args = static::getParamsClass(static::getConstructor()); $map = static::templateVariablesMap(); @@ -260,18 +305,18 @@ public static function getDataDescriptions() : array if (array_key_exists(Recipient::class, $traits)) { $descriptions = array_merge( $descriptions, - RecipientEmailVariable::getDescription(), + RecipientEmailVariable::descriptions(), ); } if (array_key_exists(Sender::class, $traits)) { $descriptions = array_merge( $descriptions, - SenderEmailVariable::getDescription(), + SenderEmailVariable::descriptions(), ); } } - foreach ($args as $arg) { /** @var ReflectionParameter $arg) */ + foreach ($args as $arg) { /** @var ReflectionParameter $arg) */ $class = $arg->getType()->getName(); if (!array_key_exists($class, $map)) { @@ -281,7 +326,7 @@ public static function getDataDescriptions() : array // No special treatment for others $descriptions = array_merge( $descriptions, - $map[$class]::getDescription() + $map[$class]::descriptions() ); } @@ -291,7 +336,7 @@ public static function getDataDescriptions() : array /** * @see self::getTemplateVarsDescription */ - protected static function getConstructor() : ReflectionMethod + protected static function getConstructor(): ReflectionMethod { $constructor = (new ReflectionClass(static::class))->getConstructor(); if (!$constructor) { @@ -303,9 +348,10 @@ protected static function getConstructor() : ReflectionMethod /** * Retrieves arguments of the specified methods + * * @see self::getTemplateVarsDescription */ - protected static function getParamsClass(ReflectionMethod $method) : array + protected static function getParamsClass(ReflectionMethod $method): array { $params = $method->getParameters(); if (empty($params)) { @@ -320,4 +366,54 @@ protected static function getParamsClass(ReflectionMethod $method) : array } return $params; } + + /** + * Attach a temporary file + */ + public function attachTemporaryFile(string $id, string $name, int $uploaderId): self + { + $temporaryFileManager = new TemporaryFileManager(); + $file = $temporaryFileManager->getFile($id, $uploaderId); + if (!$file) { + throw new Exception('Tried to attach temporary file ' . $id . ' that does not exist.'); + } + $this->attach($file->getFilePath(), ['as' => $name]); + return $this; + } + + /** + * Attach a submission file + */ + public function attachSubmissionFile(int $id, string $name): self + { + $submissionFile = Repo::submissionFile()->get($id); + if (!$submissionFile) { + throw new Exception('Tried to attach submission file ' . $id . ' that does not exist.'); + } + $file = Services::get('file')->get($submissionFile->getData('fileId')); + $this->attach( + Config::getVar('files', 'files_dir') . '/' . $file->path, + [ + 'as' => $name, + 'mime' => $file->mimetype, + ] + ); + return $this; + } + + /** + * Attach a library file + */ + public function attachLibraryFile(int $id, string $name): self + { + /** @var LibraryFileDAO $libraryFileDao */ + $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); + /** @var LibraryFile $file */ + $file = $libraryFileDao->getById($id); + if (!$file) { + throw new Exception('Tried to attach library file ' . $id . ' that does not exist.'); + } + $this->attach($file->getFilePath(), ['as' => $name]); + return $this; + } } diff --git a/classes/mail/Mailer.inc.php b/classes/mail/Mailer.inc.php index bb9ed6ad408..814934aaebb 100644 --- a/classes/mail/Mailer.inc.php +++ b/classes/mail/Mailer.inc.php @@ -33,18 +33,16 @@ class Mailer extends IlluminateMailer { - const OPEN_TAG = '{'; - const CLOSING_TAG = '}'; - const DOLLAR_SIGN_TAG = '$'; - /** * Don't bind Laravel View Service, as it's not implemented + * * @var null */ protected $views = null; /** * Creates new Mailer instance without binding with View + * * @copydoc \Illuminate\Mail\Mailer::__construct() */ public function __construct(string $name, Swift_Mailer $swift, Dispatcher $events = null) @@ -56,12 +54,15 @@ public function __construct(string $name, Swift_Mailer $swift, Dispatcher $event /** * Renders email content into HTML string + * * @param string $view * @param array $data variable => value, 'message' is reserved for the Laravel's Swift Message (Illuminate\Mail\Message) + * * @throws Exception + * * @see \Illuminate\Mail\Mailer::renderView() */ - protected function renderView($view, $data) : string + protected function renderView($view, $data): string { if ($view instanceof Htmlable) { // return HTML without data compiling @@ -77,11 +78,13 @@ protected function renderView($view, $data) : string /** * Compiles email templates by substituting variables with their real values + * * @param string $view text or HTML string * @param array $data variables with their values passes ['variable' => value] - * @throws Exception + * + * @return string compiled string with substitute variables */ - public function compileParams(string $view, array $data) : string + public function compileParams(string $view, array $data): string { // Remove pre-set message template variable assigned by Illuminate Mailer unset($data[Mailable::DATA_KEY_MESSAGE]); @@ -112,8 +115,10 @@ public function send($view, array $data = [], $callback = null) /** * Overrides Illuminate Mailer method to provide additional parameters to the event + * * @param Swift_Message $message * @param array $data + * * @return bool */ protected function shouldSendMessage($message, $data = []) diff --git a/classes/mail/SubmissionMailTemplate.inc.php b/classes/mail/SubmissionMailTemplate.inc.php index 447e3a1612d..5ba353be506 100644 --- a/classes/mail/SubmissionMailTemplate.inc.php +++ b/classes/mail/SubmissionMailTemplate.inc.php @@ -39,11 +39,11 @@ class SubmissionMailTemplate extends MailTemplate /** * Constructor. * - * @param $submission Submission - * @param $emailKey string optional - * @param $locale string optional - * @param $context object optional - * @param $includeSignature boolean optional + * @param Submission $submission + * @param string $emailKey optional + * @param string $locale optional + * @param object $context optional + * @param bool $includeSignature optional * * @see MailTemplate::MailTemplate() */ @@ -56,7 +56,7 @@ public function __construct($submission, $emailKey = null, $locale = null, $cont /** * Assign parameters to template * - * @param $paramArray array + * @param array $paramArray */ public function assignParams($paramArray = []) { @@ -67,7 +67,7 @@ public function assignParams($paramArray = []) 'submissionTitle' => strip_tags($submission->getLocalizedFullTitle()), 'submissionId' => $submission->getId(), 'submissionAbstract' => PKPString::stripUnsafeHtml($submission->getLocalizedAbstract()), - 'authorString' => strip_tags($submission->getAuthorString()), + 'authors' => strip_tags($submission->getAuthorString()), ], $paramArray )); @@ -76,7 +76,7 @@ public function assignParams($paramArray = []) /** * @see parent::send() * - * @param $request PKPRequest optional (used for logging purposes) + * @param PKPRequest $request optional (used for logging purposes) */ public function send($request = null) { @@ -109,7 +109,7 @@ public function sendWithParams($paramArray) /** * Add logging properties to this email. * - * @param $eventType int + * @param int $eventType */ public function setEventType($eventType) { @@ -119,7 +119,7 @@ public function setEventType($eventType) /** * Set the context this message is associated with. * - * @param $context object + * @param object $context */ public function setContext($context) { @@ -166,8 +166,8 @@ public function log($request = null) /** * Send this email to all assigned sub editors in the given stage * - * @param $submissionId int - * @param $stageId int + * @param int $submissionId + * @param int $stageId */ public function toAssignedSubEditors($submissionId, $stageId) { @@ -177,8 +177,8 @@ public function toAssignedSubEditors($submissionId, $stageId) /** * CC this email to all assigned sub editors in the given stage * - * @param $submissionId int - * @param $stageId int + * @param int $submissionId + * @param int $stageId * * @return array of Users */ @@ -190,8 +190,8 @@ public function ccAssignedSubEditors($submissionId, $stageId) /** * BCC this email to all assigned sub editors in the given stage * - * @param $submissionId int - * @param $stageId int + * @param int $submissionId + * @param int $stageId */ public function bccAssignedSubEditors($submissionId, $stageId) { @@ -201,10 +201,10 @@ public function bccAssignedSubEditors($submissionId, $stageId) /** * Fetch the requested users and add to the email * - * @param $submissionId int - * @param $roleId int - * @param $stageId int - * @param $method string one of addRecipient, addCC, or addBCC + * @param int $submissionId + * @param int $roleId + * @param int $stageId + * @param string $method one of addRecipient, addCC, or addBCC * * @return array of Users */ diff --git a/classes/mail/mailables/DecisionAcceptNotifyAuthor.inc.php b/classes/mail/mailables/DecisionAcceptNotifyAuthor.inc.php new file mode 100644 index 00000000000..1cf192360be --- /dev/null +++ b/classes/mail/mailables/DecisionAcceptNotifyAuthor.inc.php @@ -0,0 +1,52 @@ + $reviewAssignments + */ + public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments) + { + parent::__construct(array_slice(func_get_args(), 0, -1)); + $this->setupReviewerCommentsVariable($reviewAssignments, $submission); + } + + public static function getDataDescriptions(): array + { + $variables = parent::getDataDescriptions(); + return self::addReviewerCommentsDescription($variables); + } +} diff --git a/classes/mail/mailables/DecisionBackToCopyeditingNotifyAuthor.inc.php b/classes/mail/mailables/DecisionBackToCopyeditingNotifyAuthor.inc.php new file mode 100644 index 00000000000..cc9a3b2288b --- /dev/null +++ b/classes/mail/mailables/DecisionBackToCopyeditingNotifyAuthor.inc.php @@ -0,0 +1,40 @@ + $reviewAssignments + */ + public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments) + { + parent::__construct(array_slice(func_get_args(), 0, -1)); + $this->setupReviewerCommentsVariable($reviewAssignments, $submission); + } + + public static function getDataDescriptions(): array + { + $variables = parent::getDataDescriptions(); + return self::addReviewerCommentsDescription($variables); + } +} diff --git a/classes/mail/mailables/DecisionInitialDeclineNotifyAuthor.inc.php b/classes/mail/mailables/DecisionInitialDeclineNotifyAuthor.inc.php new file mode 100644 index 00000000000..dcda486011a --- /dev/null +++ b/classes/mail/mailables/DecisionInitialDeclineNotifyAuthor.inc.php @@ -0,0 +1,40 @@ +decision = $decision; + parent::__construct(func_get_args()); + } + + public function getDecision(): Decision + { + return $this->decision; + } + + public static function getDataDescriptions(): array + { + $variables = parent::getDataDescriptions(); + $variables[self::DECISION_DESCRIPTION] = __('mailable.decision.notifyReviewer.variable.decisionDescription'); + return $variables; + } + + public function setData(?string $locale = null) + { + parent::setData($locale); + $this->viewData[self::DECISION_DESCRIPTION] = $this->getDecisionDescription($locale); + } + + /** + * Get a description of the decision to use as an email variable + */ + protected function getDecisionDescription(?string $locale = null): string + { + switch ($this->decision->getData('decision')) { + case Decision::ACCEPT: return __('mailable.decision.notifyReviewer.variable.decisionDescription.accept', [], $locale); + case Decision::DECLINE: return __('mailable.decision.notifyReviewer.variable.decisionDescription.decline', [], $locale); + case Decision::PENDING_REVISIONS: return __('mailable.decision.notifyReviewer.variable.decisionDescription.pendingRevisions', [], $locale); + case Decision::RESUBMIT: return __('mailable.decision.notifyReviewer.variable.decisionDescription.resubmit', [], $locale); + default: return ''; + } + } +} diff --git a/classes/mail/mailables/DecisionRequestRevisionsNotifyAuthor.inc.php b/classes/mail/mailables/DecisionRequestRevisionsNotifyAuthor.inc.php new file mode 100644 index 00000000000..435ac5188e6 --- /dev/null +++ b/classes/mail/mailables/DecisionRequestRevisionsNotifyAuthor.inc.php @@ -0,0 +1,53 @@ + $reviewAssignments + */ + public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments) + { + parent::__construct(array_slice(func_get_args(), 0, -1)); + $this->setupReviewerCommentsVariable($reviewAssignments, $submission); + } + + public static function getDataDescriptions(): array + { + $variables = parent::getDataDescriptions(); + return self::addReviewerCommentsDescription($variables); + } +} diff --git a/classes/mail/mailables/DecisionResubmitNotifyAuthor.inc.php b/classes/mail/mailables/DecisionResubmitNotifyAuthor.inc.php new file mode 100644 index 00000000000..e7bb160f3b9 --- /dev/null +++ b/classes/mail/mailables/DecisionResubmitNotifyAuthor.inc.php @@ -0,0 +1,52 @@ + $reviewAssignments + */ + public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments) + { + parent::__construct(array_slice(func_get_args(), 0, -1)); + $this->setupReviewerCommentsVariable($reviewAssignments, $submission); + } + + public static function getDataDescriptions(): array + { + $variables = parent::getDataDescriptions(); + return self::addReviewerCommentsDescription($variables); + } +} diff --git a/classes/mail/mailables/DecisionRevertDeclineNotifyAuthor.inc.php b/classes/mail/mailables/DecisionRevertDeclineNotifyAuthor.inc.php new file mode 100644 index 00000000000..422db8e1d31 --- /dev/null +++ b/classes/mail/mailables/DecisionRevertDeclineNotifyAuthor.inc.php @@ -0,0 +1,40 @@ +getByKey($contextId, self::EMAIL_KEY); - } } diff --git a/classes/mail/mailables/MailReviewerAssigned.inc.php b/classes/mail/mailables/MailReviewerAssigned.inc.php index 78ea5963c22..42f815d7dc6 100644 --- a/classes/mail/mailables/MailReviewerAssigned.inc.php +++ b/classes/mail/mailables/MailReviewerAssigned.inc.php @@ -18,10 +18,10 @@ use PKP\context\Context; use PKP\mail\Configurable; use PKP\mail\Mailable; +use PKP\mail\traits\Recipient; +use PKP\mail\traits\Sender; use PKP\submission\PKPSubmission; use PKP\submission\reviewAssignment\ReviewAssignment; -use PKP\mail\Recipient; -use PKP\mail\Sender; class MailReviewerAssigned extends Mailable { @@ -30,11 +30,8 @@ class MailReviewerAssigned extends Mailable use Configurable; protected static ?string $name = 'mailable.mailReviewerAssigned.name'; - protected static ?string $description = 'mailable.mailReviewerAssigned.description'; - - public static bool $supportsTemplates = true; - + protected static bool $supportsTemplates = true; protected static array $groupIds = [self::GROUP_REVIEW]; public function __construct(Context $context, PKPSubmission $submission, ReviewAssignment $reviewAssignment) diff --git a/classes/mail/mailables/MailReviewerReinstated.inc.php b/classes/mail/mailables/MailReviewerReinstated.inc.php index 0972f78578a..19b3d0d7800 100644 --- a/classes/mail/mailables/MailReviewerReinstated.inc.php +++ b/classes/mail/mailables/MailReviewerReinstated.inc.php @@ -18,10 +18,10 @@ use PKP\context\Context; use PKP\mail\Configurable; use PKP\mail\Mailable; +use PKP\mail\traits\Recipient; +use PKP\mail\traits\Sender; use PKP\submission\PKPSubmission; use PKP\submission\reviewAssignment\ReviewAssignment; -use PKP\mail\Recipient; -use PKP\mail\Sender; class MailReviewerReinstated extends Mailable { @@ -30,11 +30,8 @@ class MailReviewerReinstated extends Mailable use Configurable; protected static ?string $name = 'mailable.mailReviewerReinstate.name'; - protected static ?string $description = 'mailable.mailReviewerReinstate.description'; - - public static bool $supportsTemplates = true; - + protected static bool $supportsTemplates = true; protected static array $groupIds = [self::GROUP_REVIEW]; public function __construct(Context $context, PKPSubmission $submission, ReviewAssignment $reviewAssignment) diff --git a/classes/mail/mailables/MailReviewerUnassigned.inc.php b/classes/mail/mailables/MailReviewerUnassigned.inc.php index dbc03e53861..206a23f0408 100644 --- a/classes/mail/mailables/MailReviewerUnassigned.inc.php +++ b/classes/mail/mailables/MailReviewerUnassigned.inc.php @@ -18,8 +18,8 @@ use PKP\context\Context; use PKP\mail\Configurable; use PKP\mail\Mailable; -use PKP\mail\Recipient; -use PKP\mail\Sender; +use PKP\mail\traits\Recipient; +use PKP\mail\traits\Sender; use PKP\submission\PKPSubmission; use PKP\submission\reviewAssignment\ReviewAssignment; @@ -30,11 +30,8 @@ class MailReviewerUnassigned extends Mailable use Configurable; protected static ?string $name = 'mailable.mailReviewerUnassigned.name'; - protected static ?string $description = 'mailable.mailReviewerUnassigned.description'; - - public static bool $supportsTemplates = true; - + protected static bool $supportsTemplates = true; protected static array $groupIds = [self::GROUP_REVIEW]; public function __construct(Context $context, PKPSubmission $submission, ReviewAssignment $reviewAssignment) diff --git a/classes/mail/mailables/RecommendationNotifyEditors.inc.php b/classes/mail/mailables/RecommendationNotifyEditors.inc.php new file mode 100644 index 00000000000..3b53d0474ad --- /dev/null +++ b/classes/mail/mailables/RecommendationNotifyEditors.inc.php @@ -0,0 +1,52 @@ + $reviewAssignments + */ + public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments) + { + parent::__construct(array_slice(func_get_args(), 0, -1)); + $this->setupReviewerCommentsVariable($reviewAssignments, $submission); + } + + public static function getDataDescriptions(): array + { + $variables = parent::getDataDescriptions(); + return self::addReviewerCommentsDescription($variables); + } +} diff --git a/classes/mail/mailables/ValidateEmailContext.inc.php b/classes/mail/mailables/ValidateEmailContext.inc.php index 0cd45264ee4..21f0eff4107 100644 --- a/classes/mail/mailables/ValidateEmailContext.inc.php +++ b/classes/mail/mailables/ValidateEmailContext.inc.php @@ -16,28 +16,19 @@ namespace PKP\mail\mailables; use PKP\context\Context; -use PKP\facades\Repo; use PKP\mail\Mailable; -use PKP\emailTemplate\EmailTemplate; -use PKP\mail\Recipient; +use PKP\mail\traits\Recipient; class ValidateEmailContext extends Mailable { use Recipient; - public const EMAIL_KEY = 'USER_VALIDATE'; - protected static ?string $name = 'mailable.validateEmailContext.name'; - protected static ?string $description = 'mailable.validateEmailContext.description'; + protected static ?string $emailTemplateKey = 'USER_VALIDATE_CONTEXT'; public function __construct(Context $context) { parent::__construct(func_get_args()); } - - public function getTemplate(int $contextId) : EmailTemplate - { - return Repo::emailTemplate()->getByKey($contextId, self::EMAIL_KEY); - } } diff --git a/classes/mail/mailables/ValidateEmailSite.inc.php b/classes/mail/mailables/ValidateEmailSite.inc.php index 727b537b4f0..f74364ae50c 100644 --- a/classes/mail/mailables/ValidateEmailSite.inc.php +++ b/classes/mail/mailables/ValidateEmailSite.inc.php @@ -15,29 +15,20 @@ namespace PKP\mail\mailables; -use PKP\facades\Repo; use PKP\mail\Mailable; -use PKP\emailTemplate\EmailTemplate; +use PKP\mail\traits\Recipient; use PKP\site\Site; -use PKP\mail\Recipient; class ValidateEmailSite extends Mailable { use Recipient; - public const EMAIL_KEY = 'USER_VALIDATE'; - protected static ?string $name = 'mailable.validateEmailSite.name'; - protected static ?string $description = 'mailable.validateEmailSite.description'; + protected static ?string $emailTemplateKey = 'USER_VALIDATE_SITE'; public function __construct(Site $site) { parent::__construct(func_get_args()); } - - public function getTemplate(int $contextId) : EmailTemplate - { - return Repo::emailTemplate()->getByKey($contextId, self::EMAIL_KEY); - } } diff --git a/classes/mail/Recipient.inc.php b/classes/mail/traits/Recipient.inc.php similarity index 71% rename from classes/mail/Recipient.inc.php rename to classes/mail/traits/Recipient.inc.php index 6a7eb5611e6..e50edf29391 100644 --- a/classes/mail/Recipient.inc.php +++ b/classes/mail/traits/Recipient.inc.php @@ -1,7 +1,7 @@ $recipients */ - public function recipients(array $recipients) : Mailable + public function recipients(array $recipients): Mailable { $to = []; foreach ($recipients as $recipient) { @@ -54,6 +57,13 @@ public function recipients(array $recipients) : Mailable 'name' => $recipient->getFullName(), ]; } + + // Override the existing recipient data + $this->to = []; + $this->variables = array_filter($this->variables, function ($variable) { + return !is_a($variable, RecipientEmailVariable::class); + }); + $this->setAddress($to); $this->variables[] = new RecipientEmailVariable($recipients); return $this; diff --git a/classes/mail/traits/ReviewerComments.inc.php b/classes/mail/traits/ReviewerComments.inc.php new file mode 100644 index 00000000000..b9d1124e620 --- /dev/null +++ b/classes/mail/traits/ReviewerComments.inc.php @@ -0,0 +1,141 @@ + $reviewAssignments + */ + protected function setupReviewerCommentsVariable(array $reviewAssignments, Submission $submission) + { + /** @var SubmissionCommentDAO $submissionCommentDao */ + $submissionCommentDao = DAORegistry::getDAO('SubmissionCommentDAO'); + + $reviewerNumber = 0; + $comments = []; + foreach ($reviewAssignments as $reviewAssignment) { + $reviewerNumber++; + + $submissionComments = $submissionCommentDao->getReviewerCommentsByReviewerId( + $submission->getId(), + $reviewAssignment->getReviewerId(), + $reviewAssignment->getId(), + true + ); + + $reviewerIdentity = $reviewAssignment->getReviewMethod() == ReviewAssignment::SUBMISSION_REVIEW_METHOD_OPEN + ? $reviewAssignment->getReviewerFullName() + : __('submission.comments.importPeerReviews.reviewerLetter', ['reviewerLetter' => $reviewerNumber]); + $recommendation = $reviewAssignment->getLocalizedRecommendation(); + + $commentsBody = ''; + /** @var SubmissionComment $comment */ + while ($comment = $submissionComments->next()) { + // If the comment is viewable by the author, then add the comment. + if ($comment->getViewable()) { + $commentsBody .= PKPString::stripUnsafeHtml($comment->getComments()); + } + } + + $comments[] = + '

' + . '' . $reviewerIdentity . '' + . '
' + . __('submission.recommendation', ['recommendation' => $recommendation]) + . '

' + . $commentsBody + . $this->getReviewFormComments($reviewAssignment); + } + + $this->addData([ + static::$allReviewerComments => join('', $comments), + ]); + } + + protected function getReviewFormComments(ReviewAssignment $reviewAssignment): string + { + if (!$reviewAssignment->getReviewFormId()) { + return ''; + } + + /** @var ReviewFormElementDAO $reviewFormElementDao */ + $reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO'); + $reviewFormElements = $reviewFormElementDao->getByReviewFormId($reviewAssignment->getReviewFormId()); + + if ($reviewFormElements->wasEmpty()) { + return ''; + } + + /** @var ReviewFormResponseDAO $reviewFormResponseDao */ + $reviewFormResponseDao = DAORegistry::getDAO('ReviewFormResponseDAO'); + + $comments = ''; + while ($reviewFormElement = $reviewFormElements->next()) { + if (!$reviewFormElement->getIncluded()) { + continue; + } + + /** @var ReviewFormResponse|null $reviewFormResponse */ + $reviewFormResponse = $reviewFormResponseDao->getReviewFormResponse($reviewAssignment->getId(), $reviewFormElement->getId()); + if (!$reviewFormResponse) { + continue; + } + $comments .= PKPString::stripUnsafeHtml($reviewFormElement->getLocalizedQuestion()); + $possibleResponses = $reviewFormElement->getLocalizedPossibleResponses(); + // See issue #2437. + if (in_array($reviewFormElement->getElementType(), [$reviewFormElement::REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES, $reviewFormElement::REVIEW_FORM_ELEMENT_TYPE_RADIO_BUTTONS])) { + ksort($possibleResponses); + $possibleResponses = array_values($possibleResponses); + } + if (in_array($reviewFormElement->getElementType(), $reviewFormElement->getMultipleResponsesElementTypes())) { + if ($reviewFormElement->getElementType() == $reviewFormElement::REVIEW_FORM_ELEMENT_TYPE_CHECKBOXES) { + $comments .= '
    '; + foreach ($reviewFormResponse->getValue() as $value) { + $comments .= '
  • ' . PKPString::stripUnsafeHtml($possibleResponses[$value]) . '
  • '; + } + $comments .= '
'; + } else { + $comments .= '

' . PKPString::stripUnsafeHtml($possibleResponses[$reviewFormResponse->getValue()]) . '

'; + } + } else { + $comments .= '

' . nl2br(htmlspecialchars($reviewFormResponse->getValue())) . '

'; + } + } + + return $comments; + } +} diff --git a/classes/mail/Sender.inc.php b/classes/mail/traits/Sender.inc.php similarity index 78% rename from classes/mail/Sender.inc.php rename to classes/mail/traits/Sender.inc.php index 5ee9a48d317..2508e029f8a 100644 --- a/classes/mail/Sender.inc.php +++ b/classes/mail/traits/Sender.inc.php @@ -1,7 +1,7 @@ setAddress($sender->getEmail(), $sender->getFullName($defaultLocale), 'from'); $this->variables[] = new SenderEmailVariable($sender); diff --git a/classes/mail/variables/ContextEmailVariable.inc.php b/classes/mail/variables/ContextEmailVariable.inc.php index 6ce4341385a..bf7935ca8a9 100644 --- a/classes/mail/variables/ContextEmailVariable.inc.php +++ b/classes/mail/variables/ContextEmailVariable.inc.php @@ -21,12 +21,13 @@ class ContextEmailVariable extends Variable { - const CONTEXT_NAME = 'contextName'; - const CONTEXT_URL = 'contextUrl'; - const CONTACT_NAME = 'contactName'; - const PRINCIPAL_CONTACT_SIGNATURE = 'principalContactSignature'; - const CONTACT_EMAIL = 'contactEmail'; - const PASSWORD_LOST_URL = 'passwordLostUrl'; + public const CONTEXT_NAME = 'contextName'; + public const CONTEXT_URL = 'contextUrl'; + public const CONTACT_NAME = 'contactName'; + public const PRINCIPAL_CONTACT_SIGNATURE = 'principalContactSignature'; + public const CONTACT_EMAIL = 'contactEmail'; + public const PASSWORD_LOST_URL = 'passwordLostUrl'; + public const SUBMISSIONS_URL = 'submissionsUrl'; protected Context $context; @@ -39,9 +40,9 @@ public function __construct(Context $context) } /** - * @copydoc Variable::description() + * @copydoc Variable::descriptions() */ - protected static function description() : array + public static function descriptions(): array { return [ @@ -49,6 +50,7 @@ protected static function description() : array self::PRINCIPAL_CONTACT_SIGNATURE => __('emailTemplate.variable.context.principalContactSignature'), self::CONTACT_EMAIL => __('emailTemplate.variable.context.contactEmail'), self::PASSWORD_LOST_URL => __('emailTemplate.variable.context.passwordLostUrl'), + self::SUBMISSIONS_URL => __('emailTemplate.variable.context.passwordLostUrl'), ]; } @@ -59,30 +61,45 @@ public function values(string $locale): array { return [ - self::CONTACT_NAME => $this->context->getData('contactName'), + self::CONTACT_NAME => (string) $this->context->getData('contactName'), self::PRINCIPAL_CONTACT_SIGNATURE => $this->getPrincipalContactSignature($locale), - self::CONTACT_EMAIL => $this->context->getData('contactEmail'), + self::CONTACT_EMAIL => (string) $this->context->getData('contactEmail'), self::PASSWORD_LOST_URL => $this->getPasswordLostUrl(), + self::SUBMISSIONS_URL => $this->getSubmissionsUrl(), ]; } - protected function getContextUrl() : string + protected function getContextUrl(): string { return $this->request->getDispatcher()->url($this->request, PKPApplication::ROUTE_PAGE, $this->context->getData('urlPath')); } - protected function getPrincipalContactSignature(string $locale) : string + protected function getPrincipalContactSignature(string $locale): string { return $this->context->getData('contactName') - . "\n" + . "
\n" . $this->context->getLocalizedData('name', $locale); } /** * URL to the lost password page */ - protected function getPasswordLostUrl() : string + protected function getPasswordLostUrl(): string { return $this->request->getDispatcher()->url($this->request, PKPApplication::ROUTE_PAGE, $this->context->getData('urlPath'), 'login', 'lostPassword'); } + + /** + * URL to the submissions lists + */ + protected function getSubmissionsUrl(): string + { + $request = PKPApplication::get()->getRequest(); + return $request->getDispatcher()->url( + $request, + PKPApplication::ROUTE_PAGE, + null, + 'submissions', + ); + } } diff --git a/classes/mail/variables/DecisionEmailVariable.inc.php b/classes/mail/variables/DecisionEmailVariable.inc.php new file mode 100644 index 00000000000..e17702b409b --- /dev/null +++ b/classes/mail/variables/DecisionEmailVariable.inc.php @@ -0,0 +1,75 @@ +decision = $decision; + $this->type = Repo::decision()->getType($decision->getData('decision')); + } + + /** + * @copydoc Variable::descriptions() + */ + public static function descriptions(): array + { + return + [ + self::DECISION => __('emailTemplate.variable.decision.name'), + self::DESCRIPTION => __('emailTemplate.variable.decision.description'), + self::STAGE => __('emailTemplate.variable.decision.stage'), + self::ROUND => __('emailTemplate.variable.decision.round'), + ]; + } + + /** + * @copydoc Variable::values() + */ + public function values(string $locale): array + { + return + [ + self::DECISION => $this->type->getLabel($locale), + self::DESCRIPTION => $this->type->getDescription($locale), + self::STAGE => $this->getStageName($locale), + self::ROUND => (string) $this->decision->getData('round'), + ]; + } + + protected function getStageName(string $locale): string + { + return __( + (string) WorkflowStageDAO::getTranslationKeyFromId($this->decision->getData('stageId')), + [], + $locale + ); + } +} diff --git a/classes/mail/variables/QueuedPaymentEmailVariable.inc.php b/classes/mail/variables/QueuedPaymentEmailVariable.inc.php index 90445977035..d36ed49ad7c 100644 --- a/classes/mail/variables/QueuedPaymentEmailVariable.inc.php +++ b/classes/mail/variables/QueuedPaymentEmailVariable.inc.php @@ -15,15 +15,15 @@ namespace PKP\mail\variables; -use Application; +use APP\core\Application; use PKP\core\PKPServices; use PKP\payment\QueuedPayment; class QueuedPaymentEmailVariable extends Variable { - const ITEM_NAME = 'itemName'; - const ITEM_COST = 'itemCost'; - const ITEM_CURRENCY_CODE = 'itemCurrencyCode'; + public const ITEM_NAME = 'itemName'; + public const ITEM_COST = 'itemCost'; + public const ITEM_CURRENCY_CODE = 'itemCurrencyCode'; protected QueuedPayment $queuedPayment; @@ -33,9 +33,9 @@ public function __construct(QueuedPayment $queuedPayment) } /** - * @copydoc Validation::description() + * @copydoc Validation::descriptions() */ - protected static function description() : array + public static function descriptions(): array { return [ @@ -53,12 +53,12 @@ public function values(string $locale): array return [ self::ITEM_NAME => $this->getItemName(), - self::ITEM_COST => $this->getItemCost(), - self::ITEM_CURRENCY_CODE => $this->getItemCurrencyCode(), + self::ITEM_COST => (string) $this->getItemCost(), + self::ITEM_CURRENCY_CODE => (string) $this->getItemCurrencyCode(), ]; } - protected function getItemName() : string + protected function getItemName(): string { $context = PKPServices::get('context')->get($this->queuedPayment->getContextId()); $paymentManager = Application::getPaymentManager($context); @@ -73,7 +73,7 @@ protected function getItemCost() return $this->queuedPayment->getAmount(); } - protected function getItemCurrencyCode() : ?string + protected function getItemCurrencyCode(): ?string { return $this->queuedPayment->getCurrencyCode(); } diff --git a/classes/mail/variables/RecipientEmailVariable.inc.php b/classes/mail/variables/RecipientEmailVariable.inc.php index eace188550d..a104e705308 100644 --- a/classes/mail/variables/RecipientEmailVariable.inc.php +++ b/classes/mail/variables/RecipientEmailVariable.inc.php @@ -20,26 +20,27 @@ class RecipientEmailVariable extends Variable { - const RECIPIENT_FULL_NAME = 'userFullName'; - const RECIPIENT_USERNAME = 'username'; + public const RECIPIENT_FULL_NAME = 'recipientName'; + public const RECIPIENT_USERNAME = 'recipientUsername'; - protected array $recipients; + /** @var iterable */ + protected iterable $recipients; - public function __construct(array $recipient) + public function __construct(iterable $recipients) { - foreach ($recipient as $user) - { - if (!is_a($user, User::class)) - throw new InvalidArgumentException('recipient array values should be an instances or ancestors of ' . User::class . ', ' . get_class($user) . ' is given'); + foreach ($recipients as $recipient) { + if (!is_a($recipient, User::class)) { + throw new InvalidArgumentException('recipient array values should be an instances or ancestors of ' . User::class . ', ' . get_class($recipient) . ' is given'); + } } - $this->recipients = $recipient; + $this->recipients = $recipients; } /** - * @copydoc Variable::description() + * @copydoc Variable::descriptions() */ - protected static function description(): array + public static function descriptions(): array { return [ @@ -62,14 +63,17 @@ public function values(string $locale): array /** * Array containing full names of recipients in all supported locales separated by a comma + * * @return array [localeKey => fullName] */ protected function getRecipientsFullName(string $locale): string { - $fullNames = array_map(function(User $user) use ($locale) { - return $user->getFullName(true, false, $locale); - }, $this->recipients); - return join(__('common.commaListSeparator'), $fullNames); + $names = []; + foreach ($this->recipients as $recipient) { + $names[] = $recipient->getFullName(true, false, $locale); + } + + return join(__('common.listSeparator'), $names); } /** @@ -77,9 +81,10 @@ protected function getRecipientsFullName(string $locale): string */ protected function getRecipientsUserName(): string { - $userNames = array_map(function (User $user) { - return $user->getData('username'); - }, $this->recipients); - return join(__('common.commaListSeparator'), $userNames); + $userNames = []; + foreach ($this->recipients as $recipient) { + $userNames[] = $recipient->getData('userName'); + } + return join(__('common.listSeparator'), $userNames); } } diff --git a/classes/mail/variables/ReviewAssignmentEmailVariable.inc.php b/classes/mail/variables/ReviewAssignmentEmailVariable.inc.php index 6e08a80e7c7..1ed1ba099de 100644 --- a/classes/mail/variables/ReviewAssignmentEmailVariable.inc.php +++ b/classes/mail/variables/ReviewAssignmentEmailVariable.inc.php @@ -20,9 +20,9 @@ class ReviewAssignmentEmailVariable extends Variable { - const REVIEW_DUE_DATE = 'reviewDueDate'; - const RESPONSE_DUE_DATE = 'responseDueDate'; - const SUBMISSION_REVIEW_URL = 'submissionReviewUrl'; + public const REVIEW_DUE_DATE = 'reviewDueDate'; + public const RESPONSE_DUE_DATE = 'responseDueDate'; + public const SUBMISSION_REVIEW_URL = 'submissionReviewUrl'; /** @var ReviewAssignment $reviewAssignment */ protected $reviewAssignment; @@ -33,9 +33,9 @@ public function __construct(ReviewAssignment $reviewAssignment) } /** - * @copydoc Variable::description() + * @copydoc Variable::descriptions() */ - protected static function description(): array + public static function descriptions(): array { return [ @@ -58,12 +58,12 @@ public function values(string $locale): array ]; } - protected function getReviewDueDate() : string + protected function getReviewDueDate(): string { return $this->reviewAssignment->getDateDue(); } - protected function getResponseDueDate() : string + protected function getResponseDueDate(): string { return $this->reviewAssignment->getDateResponseDue(); } @@ -71,7 +71,7 @@ protected function getResponseDueDate() : string /** * URL of the submission for the assigned reviewer */ - protected function getSubmissionUrl() : string + protected function getSubmissionUrl(): string { $request = PKPApplication::get()->getRequest(); $dispatcher = $request->getDispatcher(); diff --git a/classes/mail/variables/SenderEmailVariable.inc.php b/classes/mail/variables/SenderEmailVariable.inc.php index 9c9b762247f..03418d756bb 100644 --- a/classes/mail/variables/SenderEmailVariable.inc.php +++ b/classes/mail/variables/SenderEmailVariable.inc.php @@ -16,14 +16,13 @@ namespace PKP\mail\variables; use PKP\core\PKPString; -use PKP\i18n\PKPLocale; use PKP\user\User; class SenderEmailVariable extends Variable { - const SENDER_NAME = 'senderName'; - const SENDER_EMAIL = 'senderEmail'; - const SENDER_CONTACT_SIGNATURE = 'signature'; + public const SENDER_NAME = 'senderName'; + public const SENDER_EMAIL = 'senderEmail'; + public const SENDER_CONTACT_SIGNATURE = 'signature'; protected User $sender; @@ -33,9 +32,9 @@ public function __construct(User $sender) } /** - * @copydoc Variable::description() + * @copydoc Variable::descriptions() */ - protected static function description(): array + public static function descriptions(): array { return [ @@ -66,6 +65,6 @@ protected function getSignature(string $locale): string $signature = $this->sender->getSignature($locale); return $signature ? PKPString::stripUnsafeHtml($signature) - : ''; + : '

' . $this->sender->getFullName(true, false, $locale) . '

'; } } diff --git a/classes/mail/variables/SiteEmailVariable.inc.php b/classes/mail/variables/SiteEmailVariable.inc.php index 5563438133d..a0525e5374d 100644 --- a/classes/mail/variables/SiteEmailVariable.inc.php +++ b/classes/mail/variables/SiteEmailVariable.inc.php @@ -19,8 +19,9 @@ class SiteEmailVariable extends Variable { - const SITE_TITLE = 'siteTitle'; - const SITE_CONTACT = 'siteContactName'; + public const SITE_TITLE = 'siteTitle'; + public const SITE_CONTACT = 'siteContactName'; + public const SITE_EMAIL = 'siteContactEmail'; protected Site $site; @@ -30,14 +31,15 @@ public function __construct(Site $site) } /** - * @copydoc Variable::description() + * @copydoc Variable::descriptions() */ - protected static function description(): array + public static function descriptions(): array { return [ self::SITE_TITLE => __('emailTemplate.variable.site.siteTitle'), self::SITE_CONTACT => __('emailTemplate.variable.site.siteContactName'), + self::SITE_EMAIL => __('emailTemplate.variable.site.siteContactEmail'), ]; } @@ -46,10 +48,11 @@ protected static function description(): array */ public function values(string $locale): array { - return + return [ self::SITE_TITLE => $this->site->getLocalizedData('title', $locale), self::SITE_CONTACT => $this->site->getLocalizedData('contactName', $locale), + self::SITE_EMAIL => $this->site->getData('contactEmail'), ]; } } diff --git a/classes/mail/variables/StageAssignmentEmailVariable.inc.php b/classes/mail/variables/StageAssignmentEmailVariable.inc.php deleted file mode 100644 index d9215b48533..00000000000 --- a/classes/mail/variables/StageAssignmentEmailVariable.inc.php +++ /dev/null @@ -1,76 +0,0 @@ -stageAssignment = $stageAssignment; - } - - /** - * @copydoc Variable::description() - */ - protected static function description(): array - { - return - [ - self::DECISION_MAKING_EDITORS => __('emailTemplate.variable.stageAssignment.editors'), - ]; - } - - /** - * @copydoc Variable::values() - */ - public function values(string $locale): array - { - return - [ - self::DECISION_MAKING_EDITORS => $this->getEditors($locale), - ]; - } - - /** - * Full names of editors associated with an assignment - */ - protected function getEditors(string $locale): string - { - /** @var StageAssignmentDAO $stageAssignmentDao */ - $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); - $editorsStageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($this->stageAssignment->getSubmissionId(), $this->stageAssignment->getStageId()); - - $editorNames = []; - foreach ($editorsStageAssignments as $editorsStageAssignment) { - if (!$editorsStageAssignment->getRecommendOnly()) { - $user = Repo::user()->get($editorsStageAssignment->getUserId()); - $editorNames[] = $user->getFullName(true, false, $locale); - } - } - - return join(__('common.commaListSeparator'), $editorNames); - } -} diff --git a/classes/mail/variables/SubmissionEmailVariable.inc.php b/classes/mail/variables/SubmissionEmailVariable.inc.php index 5a419a78a19..f167f6f28c9 100644 --- a/classes/mail/variables/SubmissionEmailVariable.inc.php +++ b/classes/mail/variables/SubmissionEmailVariable.inc.php @@ -15,18 +15,23 @@ namespace PKP\mail\variables; +use APP\facades\Repo; use APP\publication\Publication; use APP\submission\Submission; use PKP\author\Author; use PKP\core\PKPApplication; +use PKP\db\DAORegistry; +use PKP\security\Role; class SubmissionEmailVariable extends Variable { - public const SUBMISSION_TITLE = 'submissionTitle'; - public const SUBMISSION_ID = 'submissionId'; - public const SUBMISSION_ABSTRACT = 'submissionAbstract'; + public const AUTHOR_SUBMISSION_URL = 'authorSubmissionUrl'; public const AUTHORS = 'authors'; - public const AUTHORS_FULL = 'authorsFull'; + public const AUTHORS_SHORT = 'authorsShort'; + public const SUBMISSION_ABSTRACT = 'submissionAbstract'; + public const SUBMITTING_AUTHOR_NAME = 'submittingAuthorName'; + public const SUBMISSION_ID = 'submissionId'; + public const SUBMISSION_TITLE = 'submissionTitle'; public const SUBMISSION_URL = 'submissionUrl'; protected Submission $submission; @@ -42,17 +47,19 @@ public function __construct(Submission $submission) } /** - * @copydoc Variable::description() + * @copydoc Variable::descriptions() */ - protected static function description(): array + public static function descriptions(): array { return [ - self::SUBMISSION_TITLE => __('emailTemplate.variable.submission.submissionTitle'), - self::SUBMISSION_ID => __('emailTemplate.variable.submission.submissionId'), - self::SUBMISSION_ABSTRACT => __('emailTemplate.variable.submission.submissionAbstract'), + self::AUTHOR_SUBMISSION_URL => __('emailTemplate.variable.submission.authors'), self::AUTHORS => __('emailTemplate.variable.submission.authors'), - self::AUTHORS_FULL => __('emailTemplate.variable.submission.authorsFull'), + self::AUTHORS_SHORT => __('emailTemplate.variable.submission.authorsShort'), + self::SUBMISSION_ABSTRACT => __('emailTemplate.variable.submission.submissionAbstract'), + self::SUBMITTING_AUTHOR_NAME => __('emailTemplate.variable.submission.submittingAuthorName'), + self::SUBMISSION_ID => __('emailTemplate.variable.submission.submissionId'), + self::SUBMISSION_TITLE => __('emailTemplate.variable.submission.submissionTitle'), self::SUBMISSION_URL => __('emailTemplate.variable.submission.submissionUrl'), ]; } @@ -64,11 +71,13 @@ public function values(string $locale): array { return [ - self::SUBMISSION_TITLE => $this->currentPublication->getLocalizedFullTitle($locale), - self::SUBMISSION_ID => $this->submission->getId(), + self::AUTHOR_SUBMISSION_URL => $this->getAuthorSubmissionUrl(), + self::AUTHORS => $this->getAuthorsFull($locale), + self::AUTHORS_SHORT => $this->currentPublication->getShortAuthorString($locale), self::SUBMISSION_ABSTRACT => $this->currentPublication->getLocalizedData('abstract', $locale), - self::AUTHORS => $this->currentPublication->getShortAuthorString($locale), - self::AUTHORS_FULL => $this->getAuthorsFull($locale), + self::SUBMITTING_AUTHOR_NAME => $this->getSubmittingAuthorName($locale), + self::SUBMISSION_ID => (string) $this->submission->getId(), + self::SUBMISSION_TITLE => $this->currentPublication->getLocalizedFullTitle($locale), self::SUBMISSION_URL => $this->getSubmissionUrl(), ]; } @@ -83,7 +92,25 @@ protected function getAuthorsFull(string $locale): string return $author->getFullName(true, false, $locale); }, iterator_to_array($authors)); - return join(__('common.commaListSeparator'), $fullNames); + return join(__('common.commaListSeparator'), $fullNames); + } + + /** + * URL to the author's submission workflow + */ + protected function getAuthorSubmissionUrl(): string + { + $request = PKPApplication::get()->getRequest(); + return $request->getDispatcher()->url( + $request, + PKPApplication::ROUTE_PAGE, + null, + 'authorDashboard', + 'submission', + [ + $this->submission->getId(), + ] + ); } /** @@ -98,8 +125,38 @@ protected function getSubmissionUrl(): string null, 'workflow', 'index', - [$this->submission->getId(), - $this->submission->getData('stageId')] + [ + $this->submission->getId(), + $this->submission->getData('stageId'), + ] ); } + + /** + * The name(s) of authors assigned as participants to the + * submission workflow. + * + * Usually this is the submitting author. + */ + protected function getSubmittingAuthorName(string $locale): string + { + $authorNames = []; + $alreadyCollected = []; // Prevent duplicate names for each stage assignment + /** @var StageAssignmentDAO $stageAssignmentDao */ + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); + $result = $stageAssignmentDao->getBySubmissionAndRoleId($this->submission->getId(), Role::ROLE_ID_AUTHOR); + /** @var StageAssignment $stageAssignment */ + while ($stageAssignment = $result->next()) { + $userId = (int) $stageAssignment->getUserId(); + if (in_array($userId, $alreadyCollected)) { + continue; + } + $alreadyCollected[] = $userId; + $user = Repo::user()->get($userId); + if ($user) { + $authorNames[] = $user->getFullName(true, false, $locale); + } + } + return join(__('common.commaListSeparator'), $authorNames); + } } diff --git a/classes/mail/variables/Variable.inc.php b/classes/mail/variables/Variable.inc.php index 84732595cde..d222e39bd0c 100644 --- a/classes/mail/variables/Variable.inc.php +++ b/classes/mail/variables/Variable.inc.php @@ -15,36 +15,19 @@ namespace PKP\mail\variables; -use InvalidArgumentException; - abstract class Variable { /** * Get descriptions of the variables provided by this class + * * @return string[] */ - abstract protected static function description() : array; + abstract public static function descriptions(): array; /** * Get the value of variables supported by this class + * * @return string[] */ - abstract public function values(string $locale) : array; - - /** - * Get description of all or specific variable - * @param string|null $variableConst - * @return string|string[] - */ - static function getDescription(string $variableConst = null) - { - $description = static::description(); - if (!is_null($variableConst)) { - if (!array_key_exists($variableConst, $description)) { - throw new InvalidArgumentException('Template variable \'' . $variableConst . '\' doesn\'t exist in ' . static::class); - } - return $description[$variableConst]; - } - return $description; - } + abstract public function values(string $locale): array; } diff --git a/classes/metadata/CrosswalkFilter.inc.php b/classes/metadata/CrosswalkFilter.inc.php index ff9cd75b79b..3555a7b8921 100644 --- a/classes/metadata/CrosswalkFilter.inc.php +++ b/classes/metadata/CrosswalkFilter.inc.php @@ -27,8 +27,8 @@ class CrosswalkFilter extends Filter /** * Constructor * - * @param $fromSchema string fully qualified class name of supported input meta-data schema - * @param $toSchema string fully qualified class name of supported output meta-data schema + * @param string $fromSchema fully qualified class name of supported input meta-data schema + * @param string $toSchema fully qualified class name of supported output meta-data schema */ public function __construct($fromSchema, $toSchema) { diff --git a/classes/metadata/MetadataDataObjectAdapter.inc.php b/classes/metadata/MetadataDataObjectAdapter.inc.php index d4e4dc4d37f..e03db1b813c 100644 --- a/classes/metadata/MetadataDataObjectAdapter.inc.php +++ b/classes/metadata/MetadataDataObjectAdapter.inc.php @@ -30,7 +30,7 @@ class MetadataDataObjectAdapter extends PersistableFilter public const METADATA_DOA_INJECTION_MODE = 1; public const METADATA_DOA_EXTRACTION_MODE = 2; - /** @var integer */ + /** @var int */ public $_mode; /** @var MetadataSchema */ @@ -45,7 +45,7 @@ class MetadataDataObjectAdapter extends PersistableFilter /** @var string */ public $_metadataSchemaName; - /** @var integer */ + /** @var int */ public $_assocType; /** @var string */ @@ -54,7 +54,7 @@ class MetadataDataObjectAdapter extends PersistableFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup * @param null|mixed $mode */ public function __construct($filterGroup, $mode = null) @@ -111,7 +111,7 @@ public function __construct($filterGroup, $mode = null) /** * One of the METADATA_DOA_*_MODE constants. * - * @return integer + * @return int */ public function getMode() { @@ -190,7 +190,7 @@ public function getDataObjectClass() * Get the association type corresponding to the data * object type. * - * @return integer + * @return int */ public function getAssocType() { @@ -200,7 +200,7 @@ public function getAssocType() /** * Set the target data object for meta-data injection. * - * @param $targetDataObject DataObject + * @param DataObject $targetDataObject */ public function setTargetDataObject(&$targetDataObject) { @@ -222,8 +222,8 @@ public function &getTargetDataObject() /** * Inject a MetadataDescription into the target DataObject * - * @param $metadataDescription MetadataDescription - * @param $targetDataObject DataObject + * @param MetadataDescription $metadataDescription + * @param DataObject $targetDataObject * * @return DataObject */ @@ -236,7 +236,7 @@ public function &injectMetadataIntoDataObject(&$metadataDescription, &$targetDat /** * Extract a MetadataDescription from a source DataObject. * - * @param $sourceDataObject DataObject + * @param DataObject $sourceDataObject * * @return MetadataDescription */ @@ -254,7 +254,7 @@ public function extractMetadataFromDataObject(&$sourceDataObject) * NB: The field names must be prefixed with the meta-data * schema namespace identifier. * - * @param $translated boolean if true, return localized field + * @param bool $translated if true, return localized field * names, otherwise return additional field names. * * @return array an array of field names to be persisted. @@ -275,7 +275,7 @@ public function getDataObjectMetadataFieldNames($translated = true) * * @see Filter::process() * - * @param $input mixed either a MetadataDescription or an application object + * @param mixed $input either a MetadataDescription or an application object * * @return mixed either a MetadataDescription or an application object */ @@ -346,7 +346,7 @@ public function &instantiateMetadataDescription() * Return all field names introduced by the * meta-data schema that might have to be persisted. * - * @param $translated boolean if true, return localized field + * @param bool $translated if true, return localized field * names, otherwise return additional field names. * * @return array an array of field names to be persisted. @@ -381,9 +381,9 @@ public function getMetadataFieldNames($translated = true) /** * Set several localized statements in a meta-data schema. * - * @param $metadataDescription MetadataDescription - * @param $propertyName string - * @param $localizedValues array (keys: locale, values: localized values) + * @param MetadataDescription $metadataDescription + * @param string $propertyName + * @param array $localizedValues (keys: locale, values: localized values) */ public function addLocalizedStatements(&$metadataDescription, $propertyName, $localizedValues) { @@ -406,8 +406,8 @@ public function addLocalizedStatements(&$metadataDescription, $propertyName, $lo * data object into the data object's data array for * automatic persistence by the meta-data framework. * - * @param $metadataDescription MetadataDescription - * @param $dataObject DataObject + * @param MetadataDescription $metadataDescription + * @param DataObject $dataObject */ public function injectUnmappedDataObjectMetadataFields(&$metadataDescription, &$dataObject) { @@ -436,8 +436,8 @@ public function injectUnmappedDataObjectMetadataFields(&$metadataDescription, &$ * Directly extract all fields that are not mapped to the * data object from the data object's data array. * - * @param $dataObject DataObject - * @param $metadataDescription MetadataDescription + * @param DataObject $dataObject + * @param MetadataDescription $metadataDescription */ public function extractUnmappedDataObjectMetadataFields(&$dataObject, &$metadataDescription) { diff --git a/classes/metadata/MetadataDescription.inc.php b/classes/metadata/MetadataDescription.inc.php index c040e68f76c..d2d578af727 100644 --- a/classes/metadata/MetadataDescription.inc.php +++ b/classes/metadata/MetadataDescription.inc.php @@ -130,7 +130,7 @@ class MetadataDescription extends \PKP\core\DataObject public $_displayName; /** - * @var integer sequence id used when saving several descriptions + * @var int sequence id used when saving several descriptions * of the same subject. */ public $_seq; @@ -197,7 +197,7 @@ public function getAssocId() /** * Set the association id (described resource identifier) * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -222,7 +222,7 @@ public function getAssoc() /** * Set the (optional) display name * - * @param $displayName string + * @param string $displayName */ public function setDisplayName($displayName) { @@ -242,7 +242,7 @@ public function getDisplayName() /** * Set the sequence id * - * @param $seq integer + * @param int $seq */ public function setSequence($seq) { @@ -252,7 +252,7 @@ public function setSequence($seq) /** * Get the sequence id * - * @return integer + * @return int */ public function getSequence() { @@ -265,12 +265,12 @@ public function getSequence() * method will also check the validity of the value for the * given property before adding the statement. * - * @param $propertyName string The name of the property - * @param $value mixed The value to be assigned to the property - * @param $locale string - * @param $replace boolean whether to replace an existing statement + * @param string $propertyName The name of the property + * @param mixed $value The value to be assigned to the property + * @param string $locale + * @param bool $replace whether to replace an existing statement * - * @return boolean true if a valid statement was added, otherwise false + * @return bool true if a valid statement was added, otherwise false */ public function addStatement($propertyName, $value, $locale = null, $replace = false) { @@ -336,10 +336,10 @@ public function addStatement($propertyName, $value, $locale = null, $replace = f * If the property is translated and the locale is null then * the statements for all locales will be removed. * - * @param $propertyName string - * @param $locale string + * @param string $propertyName + * @param string $locale * - * @return boolean true if the statement was found and removed, otherwise false + * @return bool true if the statement was found and removed, otherwise false */ public function removeStatement($propertyName, $locale = null) { @@ -372,8 +372,8 @@ public function &getStatements() /** * Get a specific statement * - * @param $propertyName string - * @param $locale string + * @param string $propertyName + * @param string $locale * * @return mixed a scalar property value or an array of property values * if the cardinality of the property is 'many'. @@ -401,7 +401,7 @@ public function &getStatement($propertyName, $locale = null) /** * Returns all translations of a translated property * - * @param $propertyName string + * @param string $propertyName * * @return array all translations of a given property; if the * property has cardinality "many" then this returns a two-dimensional @@ -425,10 +425,10 @@ public function &getStatementTranslations($propertyName) * * Translated properties with a cardinality of 'many' must be * passed in as sub-sub-arrays with the locale as the first key. * - * @param $statements array statements - * @param $replace integer one of the allowed replace levels. + * @param array $statements statements + * @param int $replace one of the allowed replace levels. * - * @return boolean true if all statements could be added, false otherwise + * @return bool true if all statements could be added, false otherwise */ public function setStatements(&$statements, $replace = self::METADATA_DESCRIPTION_REPLACE_PROPERTIES) { @@ -519,7 +519,7 @@ public function &getProperties() * Convenience method that returns a property from * the underlying meta-data schema. * - * @param $propertyName string + * @param string $propertyName * * @return MetadataProperty */ @@ -533,7 +533,7 @@ public function &getProperty($propertyName) * Convenience method that returns a property id * the underlying meta-data schema. * - * @param $propertyName string + * @param string $propertyName * * @return string */ @@ -559,7 +559,7 @@ public function getPropertyNames() * Convenience method that returns the names of properties with a * given data type of the underlying meta-data schema. * - * @param $propertyType string + * @param string $propertyType * * @return array an array of string values representing valid property names */ @@ -584,9 +584,9 @@ public function getSetPropertyNames() * Convenience method that checks the existence * of a property in the underlying meta-data schema. * - * @param $propertyName string + * @param string $propertyName * - * @return boolean + * @return bool */ public function hasProperty($propertyName) { @@ -597,9 +597,9 @@ public function hasProperty($propertyName) /** * Check the existence of a statement for the given property. * - * @param $propertyName string + * @param string $propertyName * - * @return boolean + * @return bool */ public function hasStatement($propertyName) { @@ -611,9 +611,9 @@ public function hasStatement($propertyName) * Convenience method that checks whether a given property * is translated. * - * @param $propertyName string + * @param string $propertyName * - * @return boolean + * @return bool */ public function isTranslatedProperty($propertyName) { diff --git a/classes/metadata/MetadataDescriptionDummyAdapter.inc.php b/classes/metadata/MetadataDescriptionDummyAdapter.inc.php index 0fd99b36807..d5820cc1996 100644 --- a/classes/metadata/MetadataDescriptionDummyAdapter.inc.php +++ b/classes/metadata/MetadataDescriptionDummyAdapter.inc.php @@ -23,7 +23,7 @@ class MetadataDescriptionDummyAdapter extends MetadataDataObjectAdapter /** * Constructor * - * @param $metadataDescription MetadataDescription + * @param MetadataDescription $metadataDescription * @param null|mixed $mode */ public function __construct(&$metadataDescription, $mode = null) @@ -55,8 +55,8 @@ public function getClassName() /** * @see MetadataDataObjectAdapter::injectMetadataIntoDataObject() * - * @param $sourceMetadataDescription MetadataDescription - * @param $targetMetadataDescription MetadataDescription + * @param MetadataDescription $sourceMetadataDescription + * @param MetadataDescription $targetMetadataDescription * * @return MetadataDescription */ @@ -71,7 +71,7 @@ public function &injectMetadataIntoDataObject(&$sourceMetadataDescription, &$tar /** * @see MetadataDataObjectAdapter::extractMetadataFromDataObject() * - * @param $sourceMetadataDescription MetadataDescription + * @param MetadataDescription $sourceMetadataDescription * * @return MetadataDescription */ @@ -88,7 +88,7 @@ public function extractMetadataFromDataObject(&$sourceMetadataDescription) * prefix. This is ok as meta-data descriptions always * only have meta-data from one namespace. * - * @param $translated boolean if true, return localized field + * @param bool $translated if true, return localized field * names, otherwise return additional field names. * * @return array an array of field names to be persisted. diff --git a/classes/metadata/MetadataProperty.inc.php b/classes/metadata/MetadataProperty.inc.php index 063773b70f0..e4a79cbb19c 100644 --- a/classes/metadata/MetadataProperty.inc.php +++ b/classes/metadata/MetadataProperty.inc.php @@ -72,30 +72,30 @@ class MetadataProperty /** @var array allowed property types */ public $_allowedTypes; - /** @var boolean flag that defines whether the property can be translated */ + /** @var bool flag that defines whether the property can be translated */ public $_translated; - /** @var integer property cardinality */ + /** @var int property cardinality */ public $_cardinality; /** @var string validation message */ public $_validationMessage; - /** @var boolean */ + /** @var bool */ public $_mandatory; /** * Constructor * - * @param $name string the unique name of the property within a meta-data schema (can be a property URI) - * @param $assocTypes array an array of integers that define the application entities that can + * @param string $name the unique name of the property within a meta-data schema (can be a property URI) + * @param array $assocTypes an array of integers that define the application entities that can * be described with this property. - * @param $allowedTypes mixed must be a scalar or an array with the supported types, default: METADATA_PROPERTY_TYPE_STRING - * @param $translated boolean whether the property may have various language versions, default: false - * @param $cardinality integer must be on of the supported cardinalities, default: METADATA_PROPERTY_CARDINALITY_ONE - * @param $displayName string - * @param $validationMessage string A string that can be displayed in case a user tries to set an invalid value for this property. - * @param $mandatory boolean Is this a mandatory property within the schema? + * @param mixed $allowedTypes must be a scalar or an array with the supported types, default: METADATA_PROPERTY_TYPE_STRING + * @param bool $translated whether the property may have various language versions, default: false + * @param int $cardinality must be on of the supported cardinalities, default: METADATA_PROPERTY_CARDINALITY_ONE + * @param string $displayName + * @param string $validationMessage A string that can be displayed in case a user tries to set an invalid value for this property. + * @param bool $mandatory Is this a mandatory property within the schema? */ public function __construct( $name, @@ -274,7 +274,7 @@ public function &getAssocTypes() /** * Get the allowed type * - * @return integer + * @return int */ public function getAllowedTypes() { @@ -284,7 +284,7 @@ public function getAllowedTypes() /** * Is this property translated? * - * @return boolean + * @return bool */ public function getTranslated() { @@ -294,7 +294,7 @@ public function getTranslated() /** * Get the cardinality * - * @return integer + * @return int */ public function getCardinality() { @@ -314,7 +314,7 @@ public function getValidationMessage() /** * Is this property mandatory? * - * @return boolean + * @return bool */ public function getMandatory() { @@ -333,8 +333,8 @@ public function getMandatory() * validation result. If the given value fits none of the allowed * types, then we'll return 'false'. * - * @param $value mixed the input to be validated - * @param $locale string the locale to be used for validation + * @param mixed $value the input to be validated + * @param string $locale the locale to be used for validation * * @return array|boolean an array with a single entry of the format * "type => additional type parameter" against which the value diff --git a/classes/metadata/MetadataRecord.inc.php b/classes/metadata/MetadataRecord.inc.php index 1021f0cb6eb..8449dda85bf 100644 --- a/classes/metadata/MetadataRecord.inc.php +++ b/classes/metadata/MetadataRecord.inc.php @@ -31,11 +31,11 @@ class MetadataRecord /** * Add a meta-data description. * - * @param $metadataDescription MetadataDescription - * @param $replace whether to replace a description if a description for + * @param MetadataDescription $metadataDescription + * @param bool $replace whether to replace a description if a description for * the same application entity instance already exists. * - * @return boolean true if a valid description was added, otherwise false + * @return bool true if a valid description was added, otherwise false */ public function addDescription($metadataDescription, $replace = true) { @@ -62,9 +62,9 @@ public function addDescription($metadataDescription, $replace = true) /** * Remove description. * - * @param $applicationEntityId string consisting of 'assocType:assocId' + * @param string $applicationEntityId consisting of 'assocType:assocId' * - * @return boolean true if the description was found and removed, otherwise false + * @return bool true if the description was found and removed, otherwise false * * @see MetadataRecord::getApplicationEntityIdFromMetadataDescription() */ @@ -92,9 +92,9 @@ public function &getDescriptions() /** * Get a specific description * - * @param $applicationEntityId string consisting of 'assocType:assocId' + * @param string $applicationEntityId consisting of 'assocType:assocId' * - * @return boolean true if the description was found and removed, otherwise false + * @return bool true if the description was found and removed, otherwise false * * @see MetadataRecord::getApplicationEntityIdFromMetadataDescription() */ @@ -116,9 +116,9 @@ public function &getDescription($applicationEntityId) * is invalid then the meta-data record will be empty after this * operation. * - * @param $descriptions array descriptions + * @param array $descriptions descriptions * - * @return boolean true if all descriptions could be added, false otherwise + * @return bool true if all descriptions could be added, false otherwise */ public function setDescriptions(&$descriptions) { diff --git a/classes/metadata/MetadataSchema.inc.php b/classes/metadata/MetadataSchema.inc.php index ec24696bdb9..d6faded27e3 100644 --- a/classes/metadata/MetadataSchema.inc.php +++ b/classes/metadata/MetadataSchema.inc.php @@ -88,13 +88,13 @@ class MetadataSchema /** * Constructor * - * @param $name string the meta-data schema name - * @param $namespace string a globally unique namespace for + * @param string $name the meta-data schema name + * @param string $namespace a globally unique namespace for * the schema. Property names must be unique within this * namespace. - * @param $classname the fully qualified class name of + * @param string $classname the fully qualified class name of * this schema - * @param $assocTypes array|integer the association types of + * @param array|integer $assocTypes the association types of * PKP application objects that can be described using * this schema. A single association type can be given as * a scalar. @@ -192,7 +192,7 @@ public function &getProperty($propertyName) * Returns the property id with prefixed name space * for use in an external context (e.g. Forms, Templates). * - * @param $propertyName string + * @param string $propertyName * * @return string */ @@ -206,7 +206,7 @@ public function getNamespacedPropertyId($propertyName) /** * (Re-)set all properties of this meta-data schema. * - * @param $properties array an array of MetadataProperties + * @param array $properties an array of MetadataProperties */ public function setProperties(&$properties) { @@ -222,13 +222,13 @@ public function setProperties(&$properties) /** * Add a property to this meta-data schema. * - * @param $name string the unique name of the property within a meta-data schema (can be a property URI) - * @param $allowedTypes mixed must be a scalar or an array with the supported types, default: METADATA_PROPERTY_TYPE_STRING - * @param $translated boolean whether the property may have various language versions, default: false - * @param $cardinality integer must be on of the supported cardinalities, default: METADATA_PROPERTY_CARDINALITY_ONE - * @param $displayName string - * @param $validationMessage string A string that can be displayed in case a user tries to set an invalid value for this property. - * @param $mandatory boolean Is this a mandatory property within the schema? + * @param string $name the unique name of the property within a meta-data schema (can be a property URI) + * @param mixed $allowedTypes must be a scalar or an array with the supported types, default: METADATA_PROPERTY_TYPE_STRING + * @param bool $translated whether the property may have various language versions, default: false + * @param int $cardinality must be on of the supported cardinalities, default: METADATA_PROPERTY_CARDINALITY_ONE + * @param string $displayName + * @param string $validationMessage A string that can be displayed in case a user tries to set an invalid value for this property. + * @param bool $mandatory Is this a mandatory property within the schema? */ public function addProperty( $name, @@ -262,7 +262,7 @@ public function getPropertyNames() /** * Get the names of properties with a given data type. * - * @param $propertyType mixed a valid property type description + * @param mixed $propertyType a valid property type description * * @return array an array of string values representing valid property names */ @@ -284,9 +284,9 @@ public function getPropertyNamesByType($propertyType) /** * Checks whether a property exists in the meta-data schema * - * @param $propertyName string + * @param string $propertyName * - * @return boolean + * @return bool */ public function hasProperty($propertyName) { diff --git a/classes/metadata/MetadataTypeDescription.inc.php b/classes/metadata/MetadataTypeDescription.inc.php index deb2b65a436..f02771ccceb 100644 --- a/classes/metadata/MetadataTypeDescription.inc.php +++ b/classes/metadata/MetadataTypeDescription.inc.php @@ -32,14 +32,14 @@ class MetadataTypeDescription extends ClassTypeDescription /** @var string the expected meta-data schema class */ public $_metadataSchemaClassName; - /** @var integer the expected assoc type of the meta-data description */ + /** @var int the expected assoc type of the meta-data description */ public $_assocType; /** * Constructor * - * @param $typeName string a fully qualified class name. + * @param string $typeName a fully qualified class name. */ public function __construct($typeName) { @@ -66,7 +66,7 @@ public function getMetadataSchemaClass() } /** - * @return integer + * @return int */ public function getAssocType() { diff --git a/classes/migration/install/SubmissionsMigration.inc.php b/classes/migration/install/SubmissionsMigration.inc.php index 088e437354e..3db203bc8ed 100644 --- a/classes/migration/install/SubmissionsMigration.inc.php +++ b/classes/migration/install/SubmissionsMigration.inc.php @@ -96,9 +96,9 @@ public function up(): void Schema::create('edit_decisions', function (Blueprint $table) { $table->bigInteger('edit_decision_id')->autoIncrement(); $table->bigInteger('submission_id'); - $table->bigInteger('review_round_id'); + $table->bigInteger('review_round_id')->nullable(); $table->bigInteger('stage_id')->nullable(); - $table->smallInteger('round'); + $table->smallInteger('round')->nullable(); $table->bigInteger('editor_id'); $table->smallInteger('decision'); $table->datetime('date_decided'); diff --git a/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php b/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php index ee3129687cf..297a2c509ea 100755 --- a/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php +++ b/classes/migration/upgrade/PKPv3_3_0UpgradeMigration.inc.php @@ -368,7 +368,7 @@ private function _migrateSubmissionFiles() ); $path = sprintf( '%s/%s/%s', - Repo::submissionFiles()->getSubmissionDir( + Repo::submissionFile()->getSubmissionDir( $row->context_id, $row->submission_id ), @@ -617,7 +617,7 @@ private function _fileStageToPath($fileStage) return $fileStagePathMap[$fileStage]; } - /* + /** * Update block names to be all lowercase * * In previous versions, a custom block name would be stored in the @@ -625,7 +625,6 @@ private function _fileStageToPath($fileStage) * table is all lowercase. This migration aligns the two places by changing * the block names to always use lowercase. * - * @return void */ private function _fixCapitalCustomBlockTitles() { @@ -653,7 +652,7 @@ private function _fixCapitalCustomBlockTitles() } } - /* + /** * Create titles for custom block plugins * * This method copies the block names, which are a unique id, diff --git a/classes/migration/upgrade/v3_4_0/I7264_UpdateEmailTemplates.inc.php b/classes/migration/upgrade/v3_4_0/I7264_UpdateEmailTemplates.inc.php new file mode 100644 index 00000000000..49176dbda56 --- /dev/null +++ b/classes/migration/upgrade/v3_4_0/I7264_UpdateEmailTemplates.inc.php @@ -0,0 +1,442 @@ +where('email_key', 'USER_VALIDATE') + ->update(['email_key' => 'USER_VALIDATE_CONTEXT']); + + $tableContainingKeys->where('email_key', 'PUBLISH_NOTIFY') + ->update(['email_key' => 'ISSUE_PUBLISH_NOTIFY']); + + $tableContainingKeys->where('email_key', 'REVIEW_REQUEST_REMIND_AUTO') + ->update(['email_key' => 'REVIEW_RESPONSE_OVERDUE_AUTO']); + + $tableContainingKeys->where('email_key', 'REVIEW_REQUEST_REMIND_AUTO_ONECLICK') + ->update(['email_key' => 'REVIEW_RESPONSE_OVERDUE_AUTO_ONECLICK']); + } + + // Add new template for email which is sent to a user registered from a site + DB::table('email_templates_default')->insert([ + 'email_key' => 'USER_VALIDATE_SITE', + 'can_disable' => 0, + ]); + + DB::table('email_templates_default_data')->insertUsing([ + 'email_key', + 'locale', + 'subject', + 'body', + 'description' + ], function (Builder $q) { + $q->selectRaw('? as email_key', ['USER_VALIDATE_SITE']) + ->addSelect('locale', 'subject', 'body', 'description') + ->from('email_templates_default_data') + ->where('email_key', '=', 'USER_VALIDATE_CONTEXT'); + }); + + // Replace all template variables + $oldNewVariablesMap = $this->oldNewVariablesMap(); + $this->renameTemplateVariables($oldNewVariablesMap); + } + + /** + * Reverse the downgrades + */ + public function down(): void + { + // Revert variables renaming + $newOldVariablesMap = []; + foreach ($this->oldNewVariablesMap() as $emailKey => $variablesMap) { + $newOldVariablesMap[$emailKey] = array_flip($variablesMap); + } + $this->renameTemplateVariables($newOldVariablesMap); + + // Revert renaming email template keys + foreach ([ + DB::table('email_templates'), + DB::table('email_templates_default'), + DB::table('email_templates_default_data') + ] as $tableContainingKeys) { + $tableContainingKeys->where('email_key', 'USER_VALIDATE_CONTEXT') + ->update(['email_key' => 'USER_VALIDATE']); + + $tableContainingKeys->where('email_key', 'ISSUE_PUBLISH_NOTIFY') + ->update(['email_key' => 'PUBLISH_NOTIFY']); + + $tableContainingKeys->where('email_key', 'REVIEW_RESPONSE_OVERDUE_AUTO') + ->update(['email_key' => 'REVIEW_REQUEST_REMIND_AUTO']); + + $tableContainingKeys->where('email_key', 'REVIEW_RESPONSE_OVERDUE_AUTO_ONECLICK') + ->update(['email_key' => 'REVIEW_REQUEST_REMIND_AUTO_ONECLICK']); + + $tableContainingKeys->where('email_key', 'USER_VALIDATE_SITE')->delete(); + } + } + + /** + * Replaces email template variables in templates' subject and body + */ + protected function renameTemplateVariables(array $oldNewVariablesMap): void + { + foreach ($oldNewVariablesMap as $emailKey => $variablesMap) { + $variables = []; + $replacements = []; + foreach ($variablesMap as $key => $value) { + $variables[] = '/\{\$' . $key . '\}/'; + $replacements[] = '{$' . $value . '}'; + } + + // Default templates + $data = DB::table('email_templates_default_data')->where('email_key', $emailKey)->get(); + $data->each(function (object $entry) use ($variables, $replacements) { + $subject = preg_replace($variables, $replacements, $entry->subject); + $body = preg_replace($variables, $replacements, $entry->body); + DB::table('email_templates_default_data') + ->where('email_key', $entry->{'email_key'}) + ->where('locale', $entry->{'locale'}) + ->update(['subject' => $subject, 'body' => $body]); + }); + + // Custom templates + $customData = DB::table('email_templates')->where('email_key', $emailKey)->get(); + $customData->each(function (object $customEntry) use ($variables, $replacements) { + $emailRows = DB::table('email_templates_settings')->where('email_id', $customEntry->{'email_id'})->get(); + foreach ($emailRows as $emailRow) { + $value = preg_replace($variables, $replacements, $emailRow->{'setting_value'}); + DB::table('email_templates_settings') + ->where('email_id', $emailRow->{'email_id'}) + ->where('locale', $emailRow->{'locale'}) + ->where('setting_name', $emailRow->{'setting_name'}) + ->update(['setting_value' => $value]); + } + }); + } + } + + /** + * @return array [email_key => [old_variable => new_variable]] + */ + protected function oldNewVariablesMap(): array + { + return [ + 'NOTIFICATION' => [ + 'url' => 'notificationUrl', + 'principalContactSignature' => 'signature', + ], + 'NOTIFICATION_CENTER_DEFAULT' => [ + 'contextName' => 'contextName', + ], + 'PASSWORD_RESET_CONFIRM' => [ + 'url' => 'passwordResetUrl', + 'principalContactSignature' => 'signature', + ], + 'PASSWORD_RESET' => [ + 'principalContactSignature' => 'signature', + 'username' => 'recipientUsername', + ], + 'USER_REGISTER' => [ + 'userFullName' => 'recipientName', + 'principalContactSignature' => 'signature', + 'contextName' => 'contextName', + 'username' => 'recipientUsername', + ], + // new template from USER_VALIDATE + 'USER_VALIDATE_CONTEXT' => [ + 'userFullName' => 'recipientName', + 'principalContactSignature' => 'signature', + 'contextName' => 'contextName', + ], + // new template from USER_VALIDATE + 'USER_VALIDATE_SITE' => [ + 'userFullName' => 'recipientName', + 'principalContactSignature' => 'signature', + 'contextName' => 'contextName', + ], + 'REVIEWER_REGISTER' => [ + 'contextName' => 'contextName', + 'principalContactSignature' => 'signature', + 'username' => 'recipientUsername' + ], + // renamed from PUBLISH_NOTIFY + 'ISSUE_PUBLISH_NOTIFY' => [ + 'contextName' => 'contextName', + 'contextUrl' => 'contextUrl', + 'editorialContactSignature' => 'signature', + ], + 'LOCKSS_EXISTING_ARCHIVE' => [ + 'contextName' => 'contextName', + 'contextUrl' => 'contextUrl', + 'principalContactSignature' => 'signature', + ], + 'LOCKSS_NEW_ARCHIVE' => [ + 'contextName' => 'contextName', + 'contextUrl' => 'contextUrl', + 'principalContactSignature' => 'signature', + ], + 'SUBMISSION_ACK' => [ + 'authorName' => 'recipientName', + 'contextName' => 'contextName', + 'authorUsername' => 'recipientUsername', + 'editorContactSignature' => 'signature', + 'submissionUrl' => 'authorSubmissionUrl', + ], + 'SUBMISSION_ACK_NOT_USER' => [ + 'contextName' => 'contextName', + 'editorialContactSignature' => 'signature', + ], + // submissionUrl and editorUsername/recipientUsername are used only in the old template + 'EDITOR_ASSIGN' => [ + 'editorialContactName' => 'recipientName', + 'contextName' => 'contextName', + 'editorUsername' => 'recipientUsername', + ], + 'REVIEW_CANCEL' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + ], + 'REVIEW_REINSTATE' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + ], + 'REVIEW_REQUEST' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'contextUrl' => 'contextUrl', + 'passwordResetUrl' => 'passwordLostUrl', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + 'editorialContactSignature' => 'signature', + ], + 'REVIEW_REQUEST_SUBSEQUENT' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'contextUrl' => 'contextUrl', + 'passwordResetUrl' => 'passwordLostUrl', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + 'editorialContactSignature' => 'signature', + ], + 'REVIEW_REQUEST_ONECLICK' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + 'editorialContactSignature' => 'signature', + ], + 'REVIEW_REQUEST_ONECLICK_SUBSEQUENT' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + 'editorialContactSignature' => 'signature', + ], + 'REVIEW_REQUEST_ATTACHED' => [ + 'reviewerName' => 'recipientName', + 'editorialContactSignature' => 'signature', + ], + 'REVIEW_REQUEST_ATTACHED_SUBSEQUENT' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'editorialContactSignature' => 'signature', + ], + // renamed from REVIEW_REQUEST_REMIND_AUTO + 'REVIEW_RESPONSE_OVERDUE_AUTO' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'contextUrl' => 'contextUrl', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + 'editorialContactSignature' => 'signature', + ], + // renamed from REVIEW_REQUEST_REMIND_AUTO_ONECLICK + 'REVIEW_RESPONSE_OVERDUE_AUTO_ONECLICK' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + 'editorialContactSignature' => 'signature', + ], + 'REVIEW_CONFIRM' => [ + 'contextName' => 'contextName', + 'reviewerName' => 'senderName', + ], + 'REVIEW_DECLINE' => [ + 'contextName' => 'contextName', + 'reviewerName' => 'senderName', + ], + 'REVIEW_ACK' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + ], + 'REVIEW_REMIND' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + 'editorialContactSignature' => 'signature', + ], + 'REVIEW_REMIND_AUTO' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + ], + 'REVIEW_REMIND_ONECLICK' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + 'editorialContactSignature' => 'signature', + ], + 'REVIEW_REMIND_AUTO_ONECLICK' => [ + 'reviewerName' => 'recipientName', + 'contextName' => 'contextName', + 'submissionReviewUrl' => 'reviewAssignmentUrl', + 'editorialContactSignature' => 'signature', + ], + 'EDITOR_DECISION_ACCEPT' => [ + 'authorName' => 'authors', + 'contextName' => 'contextName', + 'submissionUrl' => 'authorSubmissionUrl', + ], + 'EDITOR_DECISION_SEND_TO_EXTERNAL' => [ + 'authorName' => 'authors', + 'submissionUrl' => 'authorSubmissionUrl', + ], + 'EDITOR_DECISION_SEND_TO_PRODUCTION' => [ + 'authorName' => 'authors', + 'submissionUrl' => 'authorSubmissionUrl', + ], + 'EDITOR_DECISION_REVISIONS' => [ + 'authorName' => 'authors', + 'submissionUrl' => 'authorSubmissionUrl', + ], + 'EDITOR_DECISION_RESUBMIT' => [ + 'authorName' => 'authors', + 'contextName' => 'contextName', + 'submissionUrl' => 'authorSubmissionUrl', + ], + 'EDITOR_DECISION_DECLINE' => [ + 'authorName' => 'authors', + 'contextName' => 'contextName', + 'submissionUrl' => 'authorSubmissionUrl', + ], + 'EDITOR_DECISION_INITIAL_DECLINE' => [ + 'authorName' => 'authors', + 'submissionUrl' => 'authorSubmissionUrl', + ], + 'EDITOR_RECOMMENDATION' => [ + 'contextName' => 'contextName', + ], + 'COPYEDIT_REQUEST' => [ + 'participantName' => 'recipientName', + 'contextName' => 'contextName', + 'contextUrl' => 'contextUrl', + 'participantUsername' => 'recipientUsername', + ], + 'LAYOUT_REQUEST' => [ + 'participantName' => 'recipientName', + 'contextName' => 'contextName', + 'contextUrl' => 'contextUrl', + 'participantUsername' => 'recipientUsername', + ], + 'LAYOUT_COMPLETE' => [ + 'editorialContactName' => 'recipientName', + 'contextName' => 'contextName', + 'participantName' => 'senderName', + ], + 'EMAIL_LINK' => [ + 'authorName' => 'authors', + 'contextName' => 'contextName', + 'articleUrl' => 'submissionUrl', + 'monographUrl' => 'submissionUrl', + ], + 'SUBSCRIPTION_NOTIFY' => [ + 'subscriberName' => 'recipientName', + 'contextName' => 'contextName', + 'username' => 'recipientUsername', + 'subscriptionContactSignature' => 'signature', + ], + 'OPEN_ACCESS_NOTIFY' => [ + 'contextName' => 'contextName', + 'contextUrl' => 'contextUrl', + 'editorialContactSignature' => 'signature', + ], + 'SUBSCRIPTION_BEFORE_EXPIRY' => [ + 'subscriberName' => 'recipientName', + 'contextName' => 'contextName', + 'username' => 'recipientUsername', + 'subscriptionContactSignature' => 'signature', + ], + 'SUBSCRIPTION_AFTER_EXPIRY' => [ + 'subscriberName' => 'recipientName', + 'contextName' => 'contextName', + 'username' => 'recipientUsername', + 'subscriptionContactSignature' => 'signature', + ], + 'SUBSCRIPTION_AFTER_EXPIRY_LAST' => [ + 'subscriberName' => 'recipientName', + 'contextName' => 'contextName', + 'username' => 'recipientUsername', + 'subscriptionContactSignature' => 'signature', + ], + 'SUBSCRIPTION_PURCHASE_INDL' => [ + 'contextName' => 'contextName', + 'userDetails' => 'subscriberDetails', + ], + 'SUBSCRIPTION_PURCHASE_INSTL' => [ + 'contextName' => 'contextName', + 'userDetails' => 'subscriberDetails', + ], + 'SUBSCRIPTION_RENEW_INDL' => [ + 'contextName' => 'contextName', + 'userDetails' => 'subscriberDetails', + ], + 'SUBSCRIPTION_RENEW_INSTL' => [ + 'contextName' => 'contextName', + 'userDetails' => 'subscriberDetails', + ], + 'CITATION_EDITOR_AUTHOR_QUERY' => [ + 'authorFirstName' => 'recipientName', + 'userFirstName' => 'senderName', + 'contextName' => 'contextName', + ], + 'REVISED_VERSION_NOTIFY' => [ + 'editorialContactSignature' => 'signature', + 'authorName' => 'submitterName', + ], + 'STATISTICS_REPORT_NOTIFICATION' => [ + 'principalContactSignature' => 'signature', + ], + 'ANNOUNCEMENT' => [ + 'title' => 'announcementTitle', + 'summary' => 'announcementSummary', + 'url' => 'announcementUrl', + ], + // in OPS only + 'POSTED_ACK' => [ + 'authorName' => 'authorPrimary', + 'publicationUrl' => 'submissionUrl', + 'editorialContactSignature' => 'signature' + ] + ]; + } +} diff --git a/classes/migration/upgrade/v3_4_0/I7265_EditorialDecisions.inc.php b/classes/migration/upgrade/v3_4_0/I7265_EditorialDecisions.inc.php new file mode 100644 index 00000000000..c3160777fad --- /dev/null +++ b/classes/migration/upgrade/v3_4_0/I7265_EditorialDecisions.inc.php @@ -0,0 +1,75 @@ +upReviewRounds(); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + $this->downReviewRounds(); + } + + /** + * Use null instead of 0 for editorial decisions not in review rounds + */ + protected function upReviewRounds() + { + Schema::table('edit_decisions', function (Blueprint $table) { + $table->bigInteger('review_round_id')->nullable()->change(); + $table->bigInteger('round')->nullable()->change(); + }); + + DB::table('edit_decisions') + ->where('review_round_id', '=', 0) + ->orWhere('round', '=', 0) + ->update([ + 'review_round_id' => null, + 'round' => null + ]); + } + + /** + * Restore 0 values instead of null for editorial decisions not in review rounds + */ + protected function downReviewRounds() + { + DB::table('edit_decisions') + ->whereNull('review_round_id') + ->orWhereNull('round') + ->update([ + 'review_round_id' => 0, + 'round' => 0 + ]); + + Schema::table('edit_decisions', function (Blueprint $table) { + $table->bigInteger('review_round_id')->nullable(false)->change(); + $table->bigInteger('round')->nullable(false)->change(); + }); + } +} diff --git a/classes/navigationMenu/NavigationMenu.inc.php b/classes/navigationMenu/NavigationMenu.inc.php index 9e69689492b..19f16dfaf11 100644 --- a/classes/navigationMenu/NavigationMenu.inc.php +++ b/classes/navigationMenu/NavigationMenu.inc.php @@ -39,7 +39,7 @@ public function getContextId() /** * Set contextId of this NavigationMenu * - * @param $contextId int + * @param int $contextId */ public function setContextId($contextId) { @@ -59,7 +59,7 @@ public function getTitle() /** * Set title of this NavigationMenu. Not localized. * - * @param $title string + * @param string $title */ public function setTitle($title) { @@ -79,7 +79,7 @@ public function getAreaName() /** * Set navigationArea name of this NavigationMenu. Not localized. * - * @param $areaName string + * @param string $areaName */ public function setAreaName($areaName) { diff --git a/classes/navigationMenu/NavigationMenuDAO.inc.php b/classes/navigationMenu/NavigationMenuDAO.inc.php index 08a60e13a3e..6fed641aedf 100644 --- a/classes/navigationMenu/NavigationMenuDAO.inc.php +++ b/classes/navigationMenu/NavigationMenuDAO.inc.php @@ -39,8 +39,8 @@ public function newDataObject() /** * Retrieve a navigation menu by navigation menu ID. * - * @param $navigationMenuId int navigation menu ID - * @param $contextId int Context Id + * @param int $navigationMenuId navigation menu ID + * @param int $contextId Context Id * * @return NavigationMenu? */ @@ -63,7 +63,7 @@ public function getById($navigationMenuId, $contextId = null) /** * Retrieve a navigation menu by context Id. * - * @param $contextId int Context Id + * @param int $contextId Context Id * * @return NavigationMenu */ @@ -76,8 +76,8 @@ public function getByContextId($contextId) /** * Retrieve a navigation menu by navigation menu area. * - * @param $contextId int Context Id - * @param $areaName string Template Area name + * @param int $contextId Context Id + * @param string $areaName Template Area name * * @return NavigationMenu */ @@ -90,8 +90,8 @@ public function getByArea($contextId, $areaName) /** * Retrieve a navigation menu by title * - * @param $contextId int Context Id - * @param $title string + * @param int $contextId Context Id + * @param string $title * * @return NavigationMenu? */ @@ -105,10 +105,10 @@ public function getByTitle($contextId, $title) /** * Check if a navigationMenu exists with the given title. * - * @param $contextId int - * @param $title int + * @param int $contextId + * @param int $title * - * @return boolean True if a NM exists by that title + * @return bool True if a NM exists by that title */ public function navigationMenuExistsByTitle($contextId, $title) { @@ -130,7 +130,7 @@ public function getLocaleFieldNames() /** * Internal function to return an NavigationMenu object from a row. * - * @param $row array + * @param array $row * * @return NavigationMenu */ @@ -148,7 +148,7 @@ public function _fromRow($row) /** * Insert a new NavigationMenu. * - * @param $navigationMenu NavigationMenu + * @param NavigationMenu $navigationMenu * * @return int */ @@ -167,7 +167,7 @@ public function insertObject($navigationMenu) * * @param NavigationMenu $navigationMenu * - * @return boolean + * @return bool */ public function updateObject($navigationMenu) { @@ -191,9 +191,9 @@ public function updateObject($navigationMenu) /** * Delete a NavigationMenu. * - * @param $navigationMenu NavigationMenu + * @param NavigationMenu $navigationMenu * - * @return boolean + * @return bool */ public function deleteObject($navigationMenu) { @@ -203,7 +203,7 @@ public function deleteObject($navigationMenu) /** * Delete a NavigationMenu. * - * @param $navigationMenuId int + * @param int $navigationMenuId */ public function deleteById($navigationMenuId) { @@ -216,7 +216,7 @@ public function deleteById($navigationMenuId) /** * Delete NavigationMenus by contextId. * - * @param $contextId int + * @param int $contextId */ public function deleteByContextId($contextId) { @@ -239,10 +239,10 @@ public function getInsertId() /** * Load the XML file and move the settings to the DB * - * @param $contextId - * @param $filename + * @param int $contextId + * @param string $filename * - * @return boolean true === success + * @return bool true === success */ public function installSettings($contextId, $filename) { @@ -326,7 +326,7 @@ public function unCache($id) /** * Get the settings cache for a given ID * - * @param $id + * @param string $id * * @return array|null (Null indicates caching disabled) */ @@ -350,8 +350,8 @@ public function getCache($id) /** * Callback for a cache miss. * - * @param $cache Cache - * @param $id string + * @param Cache $cache + * @param string $id */ public function _cacheMiss($cache, $id) { diff --git a/classes/navigationMenu/NavigationMenuItem.inc.php b/classes/navigationMenu/NavigationMenuItem.inc.php index 554faf16fa2..e2bf295311f 100755 --- a/classes/navigationMenu/NavigationMenuItem.inc.php +++ b/classes/navigationMenu/NavigationMenuItem.inc.php @@ -19,7 +19,7 @@ class NavigationMenuItem extends \PKP\core\DataObject { - /** types for all default navigationMenuItems */ + // Types for all default navigationMenuItems public const NMI_TYPE_ABOUT = 'NMI_TYPE_ABOUT'; public const NMI_TYPE_SUBMISSIONS = 'NMI_TYPE_SUBMISSIONS'; public const NMI_TYPE_EDITORIAL_TEAM = 'NMI_TYPE_EDITORIAL_TEAM'; @@ -51,7 +51,7 @@ class NavigationMenuItem extends \PKP\core\DataObject /** * Set path for this navigation menu item. * - * @param $path string + * @param string $path */ public function setPath($path) { @@ -71,7 +71,7 @@ public function getPath() /** * Set url for this navigation menu item. * - * @param $url string + * @param string $url */ public function setUrl($url) { @@ -91,7 +91,7 @@ public function getUrl() /** * Set type for this navigation menu item. * - * @param $type string + * @param string $type */ public function setType($type) { @@ -121,7 +121,7 @@ public function getContextId() /** * Set context_id for this navigation menu item. * - * @param $contextId int + * @param int $contextId */ public function setContextId($contextId) { @@ -141,7 +141,7 @@ public function getLocalizedTitle() /** * Get the title of the navigation menu item. * - * @param $locale string + * @param string $locale * * @return string */ @@ -153,8 +153,8 @@ public function getTitle($locale) /** * Set the title of the navigation menu item. * - * @param $title string - * @param $locale string + * @param string $title + * @param string $locale */ public function setTitle($title, $locale) { @@ -174,7 +174,7 @@ public function getLocalizedContent() /** * Get the content of the navigation menu item. * - * @param $locale string + * @param string $locale * * @return string */ @@ -186,8 +186,8 @@ public function getContent($locale) /** * Set the content of the navigation menu item. * - * @param $content string - * @param $locale string + * @param string $content + * @param string $locale */ public function setContent($content, $locale) { @@ -207,7 +207,7 @@ public function getSequence() /** * Set seq for this navigation menu item. * - * @param $seq int + * @param int $seq */ public function setSequence($seq) { @@ -217,7 +217,7 @@ public function setSequence($seq) /** * Get $isDisplayed for this navigation menu item. * - * @return boolean + * @return bool */ public function getIsDisplayed() { @@ -227,7 +227,7 @@ public function getIsDisplayed() /** * Set $isDisplayed for this navigation menu item. * - * @param $isDisplayed boolean + * @param bool $isDisplayed */ public function setIsDisplayed($isDisplayed) { @@ -237,7 +237,7 @@ public function setIsDisplayed($isDisplayed) /** * Get $isChildVisible for this navigation menu item. * - * @return boolean true if at least one NMI child is visible. It is defined at the Service functionality level + * @return bool true if at least one NMI child is visible. It is defined at the Service functionality level */ public function getIsChildVisible() { @@ -247,7 +247,7 @@ public function getIsChildVisible() /** * Set $isChildVisible for this navigation menu item. * - * @param $isChildVisible boolean true if at least one NMI child is visible. It is defined at the Service functionality level + * @param bool $isChildVisible true if at least one NMI child is visible. It is defined at the Service functionality level */ public function setIsChildVisible($isChildVisible) { @@ -267,7 +267,7 @@ public function getTitleLocaleKey() /** * Set titleLocaleKey for this navigation menu item. * - * @param $titleLocaleKey string + * @param string $titleLocaleKey */ public function setTitleLocaleKey($titleLocaleKey) { @@ -287,7 +287,7 @@ public function getLocalizedRemoteUrl() /** * Get the remoteUrl of the navigation menu item. * - * @param $locale string + * @param string $locale */ public function getRemoteUrl($locale) { @@ -297,8 +297,8 @@ public function getRemoteUrl($locale) /** * Set the remoteUrl of the navigation menu item. * - * @param $url string - * @param $locale string + * @param string $url + * @param string $locale */ public function setRemoteUrl($url, $locale) { diff --git a/classes/navigationMenu/NavigationMenuItemAssignment.inc.php b/classes/navigationMenu/NavigationMenuItemAssignment.inc.php index d3f6122b65e..fad665ff4c4 100644 --- a/classes/navigationMenu/NavigationMenuItemAssignment.inc.php +++ b/classes/navigationMenu/NavigationMenuItemAssignment.inc.php @@ -43,7 +43,7 @@ public function getMenuId() /** * Set menuId for this navigation menu item assignment. * - * @param $menuId int + * @param int $menuId */ public function setMenuId($menuId) { @@ -63,7 +63,7 @@ public function getMenuItemId() /** * Set menuItemId for this navigation menu item assignment. * - * @param $menuItemId int + * @param int $menuItemId */ public function setMenuItemId($menuItemId) { @@ -83,7 +83,7 @@ public function getParentId() /** * Set parent menu item ID * - * @param $parentId int + * @param int $parentId */ public function setParentId($parentId) { @@ -103,7 +103,7 @@ public function getSequence() /** * Set seq for this navigation menu item. * - * @param $seq int + * @param int $seq */ public function setSequence($seq) { @@ -144,7 +144,7 @@ public function getLocalizedTitle() /** * Get the title of the object. * - * @param $locale string + * @param string $locale * * @return string */ @@ -156,8 +156,8 @@ public function getTitle($locale) /** * Set the title of the object. * - * @param $title string - * @param $locale string + * @param string $title + * @param string $locale */ public function setTitle($title, $locale) { diff --git a/classes/navigationMenu/NavigationMenuItemAssignmentDAO.inc.php b/classes/navigationMenu/NavigationMenuItemAssignmentDAO.inc.php index 8f8de5cf5a7..743e2071486 100644 --- a/classes/navigationMenu/NavigationMenuItemAssignmentDAO.inc.php +++ b/classes/navigationMenu/NavigationMenuItemAssignmentDAO.inc.php @@ -26,7 +26,7 @@ class NavigationMenuItemAssignmentDAO extends \PKP\db\DAO /** * Retrieve a navigation menu item assignment by ID. * - * @param $navigationMenuItemAssignmentId int + * @param int $navigationMenuItemAssignmentId * * @return NavigationMenuItemAssignment? */ @@ -53,7 +53,7 @@ public function newDataObject() /** * Retrieve items by menu id * - * @param $menuId int + * @param int $menuId * * @return DAOResultFactory */ @@ -73,7 +73,7 @@ public function getByMenuId($menuId) /** * Retrieve items by menu item id * - * @param $menuItemId int + * @param int $menuItemId * * @return DAOResultFactory */ @@ -93,9 +93,9 @@ public function getByMenuItemId($menuItemId) /** * Retrieve items by navigationMenuItemId menu item id and ParentId * - * @param $navigationMenuItemId int - * @param $menuId int - * @param $parentId int + * @param int $navigationMenuItemId + * @param int $menuId + * @param int $parentId * * @return NavigationMenuItemAssignment */ @@ -120,8 +120,8 @@ public function getByNMIIdAndMenuIdAndParentId($navigationMenuItemId, $menuId, $ /** * Retrieve items by navigationMenu id and ParentId * - * @param $menuId int - * @param $parentId int 0 if we want to return NMIAssignments with no parents + * @param int $menuId + * @param int $parentId 0 if we want to return NMIAssignments with no parents */ public function getByMenuIdAndParentId($menuId, $parentId) { @@ -139,7 +139,7 @@ public function getByMenuIdAndParentId($menuId, $parentId) * Internal function to return a NavigationMenuItemAssignment object from a * row. * - * @param $row array + * @param array $row * * @return NavigationMenuItemAssignment */ @@ -160,9 +160,9 @@ public function _fromRow($row) /** * Update an existing NavigationMenuItemAssignment. * - * @param $navigationMenuItemAssignment NavigationMenuItemAssignment + * @param NavigationMenuItemAssignment $navigationMenuItemAssignment * - * @return boolean + * @return bool */ public function updateObject($navigationMenuItemAssignment) { @@ -190,7 +190,7 @@ public function updateObject($navigationMenuItemAssignment) /** * Insert a new NavigationMenuItemAssignment. * - * @param $assignment NavigationMenuItemAssignment + * @param NavigationMenuItemAssignment $assignment * * @return int */ @@ -226,9 +226,9 @@ public function insertObject($assignment) /** * Delete all assignments by NavigationMenu ID * - * @param $menuId NavigationMenu id + * @param NavigationMenu $menuId id * - * @return boolean + * @return bool */ public function deleteByMenuId($menuId) { @@ -243,9 +243,9 @@ public function deleteByMenuId($menuId) /** * Delete all assignments by NavigationMenuItem ID * - * @param $menuItemId NavigationMenuItem id + * @param NavigationMenuItem $menuItemId id * - * @return boolean + * @return bool */ public function deleteByMenuItemId($menuItemId) { @@ -260,9 +260,9 @@ public function deleteByMenuItemId($menuItemId) /** * Delete a NavigationMenuItemAssignment. * - * @param $navigationMenuItemAssignment NavigationMenuItemAssignment + * @param NavigationMenuItemAssignment $navigationMenuItemAssignment * - * @return boolean + * @return bool */ public function deleteObject($navigationMenuItemAssignment) { @@ -272,9 +272,9 @@ public function deleteObject($navigationMenuItemAssignment) /** * Delete a NavigationMenuItemAssignment by NavigationMenuItemAssignment ID. * - * @param $navigationMenuItemAssignmentId int + * @param int $navigationMenuItemAssignmentId * - * @return boolean + * @return bool */ public function deleteById($navigationMenuItemAssignmentId) { @@ -307,7 +307,7 @@ public function getInsertId() /** * Update the settings for this object * - * @param $navigationMenuItemAssignment object + * @param object $navigationMenuItemAssignment */ public function updateLocaleFields($navigationMenuItemAssignment) { diff --git a/classes/navigationMenu/NavigationMenuItemDAO.inc.php b/classes/navigationMenu/NavigationMenuItemDAO.inc.php index 6b1cc3190e1..79012310316 100755 --- a/classes/navigationMenu/NavigationMenuItemDAO.inc.php +++ b/classes/navigationMenu/NavigationMenuItemDAO.inc.php @@ -19,13 +19,14 @@ use PKP\db\DAORegistry; use PKP\db\DAOResultFactory; +use PKP\xml\XMLNode; class NavigationMenuItemDAO extends \PKP\db\DAO { /** * Retrieve a navigation menu item by ID. * - * @param $navigationMenuItemId int + * @param int $navigationMenuItemId * * @return NavigationMenuItem? */ @@ -44,8 +45,8 @@ public function getById($navigationMenuItemId) /** * Retrieve a navigation menu item by path. * - * @param $contextId int Context Id - * @param $path string + * @param int $contextId Context Id + * @param string $path * * @return NavigationMenuItem? */ @@ -63,7 +64,7 @@ public function getByPath($contextId, $path) /** * Retrieve a navigation menu items by context Id. * - * @param $contextId int Context Id + * @param int $contextId Context Id * * @return NavigationMenu */ @@ -80,7 +81,7 @@ public function getByContextId($contextId) /** * Retrieve items by menu id * - * @param $menuId int + * @param int $menuId */ public function getByMenuId($menuId) { @@ -98,9 +99,9 @@ public function getByMenuId($menuId) /** * Retrieve items by menuItemType and setting_name = titleLocaleKey * - * @param $contextId int - * @param $menuItemType string - * @param $menuItemTitleLocaleKey string + * @param int $contextId + * @param string $menuItemType + * @param string $menuItemTitleLocaleKey * * @return NavigationMenuItem? */ @@ -122,8 +123,8 @@ public function getByTypeAndTitleLocaleKey($contextId, $menuItemType, $menuItemT /** * Retrieve the menu items with the specified type. * - * @param $type int NMI_TYPE_... - * @param $contextId int + * @param int $type NMI_TYPE_... + * @param int $contextId * * @return DAOResultFactory containing matching NavigationMenuItems */ @@ -172,7 +173,7 @@ public function newDataObject() /** * Internal function to return a NavigationMenuItem object from a row. * - * @param $row array + * @param array $row * * @return NavigationMenuItem */ @@ -192,7 +193,7 @@ public function _fromRow($row, $dataObject = false) /** * Update the settings for this object * - * @param $navigationMenuItem object + * @param object $navigationMenuItem */ public function updateLocaleFields($navigationMenuItem) { @@ -204,7 +205,7 @@ public function updateLocaleFields($navigationMenuItem) /** * Insert a new NavigationMenuItem. * - * @param $navigationMenuItem NavigationMenuItem + * @param NavigationMenuItem $navigationMenuItem * * @return int */ @@ -232,9 +233,9 @@ public function insertObject($navigationMenuItem) /** * Update an existing NavigationMenuItem. * - * @param $navigationMenuItem NavigationMenuItem + * @param NavigationMenuItem $navigationMenuItem * - * @return boolean + * @return bool */ public function updateObject($navigationMenuItem) { @@ -262,9 +263,9 @@ public function updateObject($navigationMenuItem) /** * Delete a NavigationMenuItem. * - * @param $navigationMenuItem NavigationMenuItem + * @param NavigationMenuItem $navigationMenuItem * - * @return boolean + * @return bool */ public function deleteObject($navigationMenuItem) { @@ -274,9 +275,9 @@ public function deleteObject($navigationMenuItem) /** * Delete a NavigationMenuItem by navigationMenuItem ID. * - * @param $navigationMenuItemId int + * @param int $navigationMenuItemId * - * @return boolean + * @return bool */ public function deleteById($navigationMenuItemId) { @@ -292,7 +293,7 @@ public function deleteById($navigationMenuItemId) /** * Delete NavigationMenuItems by contextId. * - * @param $contextId int + * @param int $contextId */ public function deleteByContextId($contextId) { @@ -316,10 +317,10 @@ public function getInsertId() /** * Load the XML file and move the settings to the DB * - * @param $contextId - * @param $filename + * @param int $contextId + * @param string $filename * - * @return boolean true === success + * @return bool true === success */ public function installSettings($contextId, $filename) { @@ -349,14 +350,14 @@ public function installSettings($contextId, $filename) /** * Load a XML node to DB * - * @param $contextId int - * @param $node - * @param $navigationMenuId int - * @param $navigationMenuItemParentId int - * @param $seq int - * @param $checkChildren bool Optional + * @param int $contextId + * @param XMLNode $node + * @param int $navigationMenuId + * @param int $navigationMenuItemParentId + * @param int $seq + * @param bool $checkChildren Optional * - * @return boolean true === success + * @return bool true === success */ public function installNodeSettings($contextId, $node, $navigationMenuId = null, $navigationMenuItemParentId = null, $seq = 0, $checkChildren = false) { @@ -421,11 +422,10 @@ public function installNodeSettings($contextId, $node, $navigationMenuId = null, /** * Method for update navigationMenuItem setting * - * @param $navigationMenuItemId int - * @param $name string - * @param $value mixed - * @param $type string data type of the setting. If omitted, type will be guessed - * @param $isLocalized boolean + * @param int $navigationMenuItemId + * @param string $name + * @param string $type data type of the setting. If omitted, type will be guessed + * @param bool $isLocalized */ public function updateSetting($navigationMenuItemId, $name, $value, $type = null, $isLocalized = false) { @@ -466,8 +466,8 @@ public function updateSetting($navigationMenuItemId, $name, $value, $type = null /** * Retrieve a context setting value. * - * @param $name string - * @param $locale string optional + * @param string $name + * @param string $locale optional */ public function getSetting($navigationMenuItemId, $name, $locale = null) { @@ -500,7 +500,7 @@ public function getSetting($navigationMenuItemId, $name, $locale = null) /** * Remove all settings associated with a locale * - * @param $locale + * @param string $locale */ public function deleteSettingsByLocale($locale) { diff --git a/classes/note/Note.inc.php b/classes/note/Note.inc.php index 95f8746b927..6113183607b 100644 --- a/classes/note/Note.inc.php +++ b/classes/note/Note.inc.php @@ -33,7 +33,7 @@ public function getUserId() /** * set user id of the note's author * - * @param $userId int + * @param int $userId */ public function setUserId($userId) { @@ -63,7 +63,7 @@ public function getDateCreated() /** * set date note was created * - * @param $dateCreated date (YYYY-MM-DD HH:MM:SS) + * @param date $dateCreated (YYYY-MM-DD HH:MM:SS) */ public function setDateCreated($dateCreated) { @@ -83,7 +83,7 @@ public function getDateModified() /** * set date note was modified * - * @param $dateModified date (YYYY-MM-DD HH:MM:SS) + * @param date $dateModified (YYYY-MM-DD HH:MM:SS) */ public function setDateModified($dateModified) { @@ -103,7 +103,7 @@ public function getContents() /** * set note contents * - * @param $contents string + * @param string $contents */ public function setContents($contents) { @@ -123,7 +123,7 @@ public function getTitle() /** * set note title * - * @param $title string + * @param string $title */ public function setTitle($title) { @@ -143,7 +143,7 @@ public function getAssocType() /** * set note type * - * @param $assocType int + * @param int $assocType */ public function setAssocType($assocType) { @@ -163,7 +163,7 @@ public function getAssocId() /** * set note assoc id * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { diff --git a/classes/note/NoteDAO.inc.php b/classes/note/NoteDAO.inc.php index b0e5a2cf0f0..258d4c36c0c 100644 --- a/classes/note/NoteDAO.inc.php +++ b/classes/note/NoteDAO.inc.php @@ -39,7 +39,7 @@ public function newDataObject() /** * Retrieve Note by note id * - * @param $noteId int Note ID + * @param int $noteId Note ID * * @return Note|null object */ @@ -56,8 +56,8 @@ public function getById($noteId) /** * Retrieve Notes by user id * - * @param $userId int User ID - * @param $rangeInfo DBResultRange Optional + * @param int $userId User ID + * @param DBResultRange $rangeInfo Optional * * @return object DAOResultFactory containing matching Note objects */ @@ -75,11 +75,11 @@ public function getByUserId($userId, $rangeInfo = null) /** * Retrieve Notes by assoc id/type * - * @param $assocId int ASSOC_TYPE_... - * @param $assocType int Assoc ID (per $assocType) - * @param $userId int Optional user ID - * @param $orderBy int Optional sorting field constant: self::NOTE_ORDER_... - * @param $sortDirection int Optional sorting order constant: SORT_DIRECTION_... + * @param int $assocId ASSOC_TYPE_... + * @param int $assocType Assoc ID (per $assocType) + * @param int $userId Optional user ID + * @param int $orderBy Optional sorting field constant: self::NOTE_ORDER_... + * @param int $sortDirection Optional sorting order constant: SORT_DIRECTION_... * * @return object DAOResultFactory containing matching Note objects */ @@ -125,9 +125,9 @@ public function getByAssoc($assocType, $assocId, $userId = null, $orderBy = self /** * Retrieve Notes by assoc id/type * - * @param $assocId int - * @param $assocType int - * @param $userId int + * @param int $assocId + * @param int $assocType + * @param int $userId * * @return object DAOResultFactory containing matching Note objects */ @@ -152,9 +152,9 @@ public function notesExistByAssoc($assocType, $assocId, $userId = null) /** * Determine whether or not unread notes exist for a given association * - * @param $assocType int ASSOC_TYPE_... - * @param $assocId int Foreign key, depending on ASSOC_TYPE - * @param $userId int User ID + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId Foreign key, depending on ASSOC_TYPE + * @param int $userId User ID */ public function unreadNotesExistByAssoc($assocType, $assocId, $userId) { @@ -181,7 +181,7 @@ public function unreadNotesExistByAssoc($assocType, $assocId, $userId) /** * Creates and returns an note object from a row * - * @param $row array + * @param array $row * * @return Note object */ @@ -205,7 +205,7 @@ public function _fromRow($row) /** * Inserts a new note into notes table * - * @param Note object + * @param Note $note object * * @return int Note Id */ @@ -239,7 +239,7 @@ public function insertObject($note) /** * Update a note in the notes table * - * @param Note object + * @param Note $note object * * @return int Note Id */ @@ -273,7 +273,7 @@ public function updateObject($note) /** * Delete a note by note object. * - * @param $note Note + * @param Note $note */ public function deleteObject($note) { @@ -283,8 +283,8 @@ public function deleteObject($note) /** * Delete Note by note id * - * @param $noteId int - * @param $userId int optional + * @param int $noteId + * @param int $userId optional */ public function deleteById($noteId, $userId = null) { @@ -303,8 +303,8 @@ public function deleteById($noteId, $userId = null) /** * Delete notes by association * - * @param $assocType int ASSOC_TYPE_... - * @param $assocId int Foreign key, depending on $assocType + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId Foreign key, depending on $assocType */ public function deleteByAssoc($assocType, $assocId) { diff --git a/classes/notification/INotificationInfoProvider.inc.php b/classes/notification/INotificationInfoProvider.inc.php index c4a1ed4bb63..03d23aacd2f 100644 --- a/classes/notification/INotificationInfoProvider.inc.php +++ b/classes/notification/INotificationInfoProvider.inc.php @@ -27,8 +27,8 @@ interface INotificationInfoProvider /** * Get a URL for the notification. * - * @param $request PKPRequest - * @param $notification Notification + * @param PKPRequest $request + * @param Notification $notification * * @return string */ @@ -38,8 +38,8 @@ public function getNotificationUrl($request, $notification); * Get the notification message. Only return translated locale * key strings. * - * @param $request PKPRequest - * @param $notification Notification + * @param PKPRequest $request + * @param Notification $notification * * @return string */ @@ -50,8 +50,8 @@ public function getNotificationMessage($request, $notification); * more than text, like presenting link actions inside fetched * template files. * - * @param $request PKPRequest - * @param $notification Notification + * @param PKPRequest $request + * @param Notification $notification * * @return string */ @@ -60,7 +60,7 @@ public function getNotificationContents($request, $notification); /** * Get the notification title. * - * @param $notification Notification + * @param Notification $notification * * @return string */ @@ -69,7 +69,7 @@ public function getNotificationTitle($notification); /** * Get the notification style class. * - * @param $notification Notification + * @param Notification $notification * * @return string */ @@ -78,7 +78,7 @@ public function getStyleClass($notification); /** * Get the notification icon class. * - * @param $notification Notification + * @param Notification $notification * * @return string */ @@ -88,11 +88,11 @@ public function getIconClass($notification); * Whether any notification with the passed notification type * is visible to all users or not. * - * @param $notificationType int - * @param $assocType int ASSOC_TYPE_... - * @param $assocId int + * @param int $notificationType + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId * - * @return boolean + * @return bool */ public function isVisibleToAllUsers($notificationType, $assocType, $assocId); } diff --git a/classes/notification/NotificationDAO.inc.php b/classes/notification/NotificationDAO.inc.php index d68a0ef7a89..575b5108f81 100644 --- a/classes/notification/NotificationDAO.inc.php +++ b/classes/notification/NotificationDAO.inc.php @@ -31,8 +31,8 @@ class NotificationDAO extends \PKP\db\DAO /** * Retrieve Notification by notification id * - * @param $notificationId int - * @param $userId int optional + * @param int $notificationId + * @param int $userId optional * * @return object Notification */ @@ -59,10 +59,10 @@ public function getById($notificationId, $userId = null) * Note that this method will not return fully-fledged notification objects. Use * NotificationManager::getNotificationsForUser() to get notifications with URL, and contents * - * @param $userId int - * @param $level int - * @param $type int - * @param $contextId int + * @param int $userId + * @param int $level + * @param int $type + * @param int $contextId * * @return object DAOResultFactory containing matching Notification objects */ @@ -80,11 +80,11 @@ public function getByUserId($userId, $level = Notification::NOTIFICATION_LEVEL_N * Note that this method will not return fully-fledged notification objects. Use * NotificationManager::getNotificationsForUser() to get notifications with URL, and contents * - * @param $assocType int ASSOC_TYPE_... - * @param $assocId int - * @param $userId int User ID (optional) - * @param $type int - * @param $contextId int Context (journal/press/etc.) ID (optional) + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId + * @param int $userId User ID (optional) + * @param int $type + * @param int $contextId Context (journal/press/etc.) ID (optional) * * @return object DAOResultFactory containing matching Notification objects */ @@ -116,10 +116,10 @@ public function getByAssoc($assocType, $assocId, $userId = null, $type = null, $ /** * Retrieve Notifications by notification id * - * @param $notificationId int - * @param $dateRead date + * @param int $notificationId + * @param date $dateRead * - * @return boolean + * @return bool */ public function setDateRead($notificationId, $dateRead) { @@ -149,7 +149,7 @@ public function newDataObject() /** * Inserts a new notification into notifications table * - * @param $notification object + * @param object $notification * * @return int Notification Id */ @@ -180,12 +180,12 @@ public function insertObject($notification) /** * Inserts or update a notification into notifications table. * - * @param $level int - * @param $type int - * @param $assocType int - * @param $assocId int - * @param $userId int (optional) - * @param $contextId int (optional) + * @param int $level + * @param int $type + * @param int $assocType + * @param int $assocId + * @param int $userId (optional) + * @param int $contextId (optional) * * @return mixed Notification or null */ @@ -230,10 +230,10 @@ public function build($contextId, $level, $type, $assocType, $assocId, $userId = /** * Delete Notification by notification id * - * @param $notificationId int - * @param $userId int + * @param int $notificationId + * @param int $userId * - * @return boolean + * @return bool */ public function deleteById($notificationId, $userId = null) { @@ -257,9 +257,9 @@ public function deleteById($notificationId, $userId = null) /** * Delete Notification * - * @param $notification Notification + * @param Notification $notification * - * @return boolean + * @return bool */ public function deleteObject($notification) { @@ -269,13 +269,13 @@ public function deleteObject($notification) /** * Delete notification(s) by association * - * @param $assocType int - * @param $assocId int - * @param $userId int optional - * @param $type int optional - * @param $contextId int optional + * @param int $assocType + * @param int $assocId + * @param int $userId optional + * @param int $type optional + * @param int $contextId optional * - * @return boolean + * @return bool */ public function deleteByAssoc($assocType, $assocId, $userId = null, $type = null, $contextId = null) { @@ -298,10 +298,10 @@ public function getInsertId() /** * Get the number of unread messages for a user * - * @param $read boolean Whether to check for read (true) or unread (false) notifications - * @param $contextId int - * @param $userId int - * @param $level int + * @param bool $read Whether to check for read (true) or unread (false) notifications + * @param int $contextId + * @param int $userId + * @param int $level * * @return int */ @@ -325,8 +325,8 @@ public function getNotificationCount($read = true, $userId = null, $contextId = /** * Transfer the notifications for a user. * - * @param $oldUserId int - * @param $newUserId int + * @param int $oldUserId + * @param int $newUserId */ public function transferNotifications($oldUserId, $newUserId) { @@ -339,7 +339,7 @@ public function transferNotifications($oldUserId, $newUserId) /** * Creates and returns an notification object from a row * - * @param $row array + * @param array $row * * @return Notification object */ diff --git a/classes/notification/NotificationManagerDelegate.inc.php b/classes/notification/NotificationManagerDelegate.inc.php index 68a3b5a917b..ef4aa5749c7 100644 --- a/classes/notification/NotificationManagerDelegate.inc.php +++ b/classes/notification/NotificationManagerDelegate.inc.php @@ -28,7 +28,7 @@ abstract class NotificationManagerDelegate extends PKPNotificationOperationManag /** * Constructor. * - * @param $notificationType int NOTIFICATION_TYPE_... + * @param int $notificationType NOTIFICATION_TYPE_... */ public function __construct($notificationType) { @@ -48,12 +48,12 @@ public function getNotificationType() /** * Define operations to update notifications. * - * @param $request PKPRequest Request object - * @param $userIds array List of user IDs to notify - * @param $assocType int ASSOC_TYPE_... - * @param $assocId int ID corresponding to $assocType + * @param PKPRequest $request Request object + * @param array $userIds List of user IDs to notify + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId ID corresponding to $assocType * - * @return boolean True iff success + * @return bool True iff success */ public function updateNotification($request, $userIds, $assocType, $assocId) { @@ -86,7 +86,7 @@ public function createNotification($request, $userId = null, $notificationType = * all information for all notification types you're handling (via * the getNotification... methods). * - * @return boolean + * @return bool */ protected function multipleTypesUpdate() { diff --git a/classes/notification/NotificationSettingsDAO.inc.php b/classes/notification/NotificationSettingsDAO.inc.php index ff925353a0a..725d86057e8 100644 --- a/classes/notification/NotificationSettingsDAO.inc.php +++ b/classes/notification/NotificationSettingsDAO.inc.php @@ -24,7 +24,7 @@ class NotificationSettingsDAO extends \PKP\db\DAO /** * Update a notification's metadata * - * @param $notificationId int + * @param int $notificationId * * @return $params array */ @@ -53,11 +53,11 @@ public function getNotificationSettings($notificationId) /** * Store a notification's metadata * - * @param $notificationId int - * @param $name string - * @param $value string - * @param $isLocalized boolean optional - * @param $type string optional + * @param int $notificationId + * @param string $name + * @param string $value + * @param bool $isLocalized optional + * @param string $type optional */ public function updateNotificationSetting($notificationId, $name, $value, $isLocalized = false, $type = null) { @@ -102,7 +102,7 @@ public function updateNotificationSetting($notificationId, $name, $value, $isLoc /** * Delete all settings for a notification * - * @param $notificationId + * @param int $notificationId */ public function deleteSettingsByNotificationId($notificationId) { diff --git a/classes/notification/NotificationSubscriptionSettingsDAO.inc.php b/classes/notification/NotificationSubscriptionSettingsDAO.inc.php index dfec4ac0263..1ea00cb1d5e 100644 --- a/classes/notification/NotificationSubscriptionSettingsDAO.inc.php +++ b/classes/notification/NotificationSubscriptionSettingsDAO.inc.php @@ -30,9 +30,9 @@ class NotificationSubscriptionSettingsDAO extends \PKP\db\DAO /** * Delete a notification setting by setting name * - * @param $notificationId int - * @param $userId int - * @param $settingName string optional + * @param int $notificationId + * @param int $userId + * @param string $settingName optional */ public function deleteNotificationSubscriptionSettings($notificationId, $userId, $settingName = null) { @@ -51,9 +51,9 @@ public function deleteNotificationSubscriptionSettings($notificationId, $userId, /** * Retrieve Notification subscription settings by user id * - * @param $settingName string - * @param $userId int - * @param $contextId int + * @param string $settingName + * @param int $userId + * @param int $contextId * * @return array */ @@ -74,10 +74,10 @@ public function &getNotificationSubscriptionSettings($settingName, $userId, $con /** * Update a user's notification subscription settings * - * @param $settingName string - * @param $settings array - * @param $userId int - * @param $contextId int + * @param string $settingName + * @param array $settings + * @param int $userId + * @param int $contextId */ public function updateNotificationSubscriptionSettings($settingName, $settings, $userId, $contextId) { @@ -107,8 +107,8 @@ public function updateNotificationSubscriptionSettings($settingName, $settings, /** * Gets a user id by an RSS token value * - * @param $token int - * @param $contextId + * @param int $token + * @param int $contextId * * @return int|null */ @@ -125,8 +125,8 @@ public function getUserIdByRSSToken($token, $contextId) /** * Gets an RSS token for a user id * - * @param $userId int - * @param $contextId int + * @param int $userId + * @param int $contextId * * @return int|null */ @@ -143,8 +143,8 @@ public function getRSSTokenByUserId($userId, $contextId) /** * Generates and inserts a new token for a user's RSS feed * - * @param $userId int - * @param $contextId int + * @param int $userId + * @param int $contextId * * @return int */ diff --git a/classes/notification/PKPNotification.inc.php b/classes/notification/PKPNotification.inc.php index 70ae1122410..4b76553e019 100644 --- a/classes/notification/PKPNotification.inc.php +++ b/classes/notification/PKPNotification.inc.php @@ -18,12 +18,12 @@ class PKPNotification extends \PKP\core\DataObject { - /** Notification levels. Determines notification behavior **/ + // Notification levels. Determines notification behavior public const NOTIFICATION_LEVEL_TRIVIAL = 1; public const NOTIFICATION_LEVEL_NORMAL = 2; public const NOTIFICATION_LEVEL_TASK = 3; - /** Notification types. Determines what text and URL to display for notification */ + // Notification types. Determines what text and URL to display for notification public const NOTIFICATION_TYPE_SUCCESS = 0x0000001; public const NOTIFICATION_TYPE_WARNING = 0x0000002; public const NOTIFICATION_TYPE_ERROR = 0x0000003; @@ -101,7 +101,7 @@ public function getUserId() /** * set user id associated with this notification * - * @param $userId int + * @param int $userId */ public function setUserId($userId) { @@ -121,7 +121,7 @@ public function getLevel() /** * Set the level (NOTIFICATION_LEVEL_...) for this notification * - * @param $level int + * @param int $level */ public function setLevel($level) { @@ -141,7 +141,7 @@ public function getDateCreated() /** * set date notification was created * - * @param $dateCreated date (YYYY-MM-DD HH:MM:SS) + * @param date $dateCreated (YYYY-MM-DD HH:MM:SS) */ public function setDateCreated($dateCreated) { @@ -161,7 +161,7 @@ public function getDateRead() /** * set date notification is read by user * - * @param $dateRead date (YYYY-MM-DD HH:MM:SS) + * @param date $dateRead (YYYY-MM-DD HH:MM:SS) */ public function setDateRead($dateRead) { @@ -181,7 +181,7 @@ public function getType() /** * set notification type * - * @param $type int + * @param int $type */ public function setType($type) { @@ -201,7 +201,7 @@ public function getAssocType() /** * set notification type * - * @param $assocType int + * @param int $assocType */ public function setAssocType($assocType) { @@ -221,7 +221,7 @@ public function getAssocId() /** * set notification assoc id * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { diff --git a/classes/notification/PKPNotificationManager.inc.php b/classes/notification/PKPNotificationManager.inc.php index de7c5f162c1..5e47e76ad2a 100644 --- a/classes/notification/PKPNotificationManager.inc.php +++ b/classes/notification/PKPNotificationManager.inc.php @@ -18,8 +18,10 @@ namespace PKP\notification; use APP\core\Application; +use APP\decision\Decision; use APP\facades\Repo; use APP\i18n\AppLocale; +use APP\notification\Notification; use APP\template\TemplateManager; use PKP\core\PKPApplication; use PKP\db\DAORegistry; @@ -364,12 +366,12 @@ public function isVisibleToAllUsers($notificationType, $assocType, $assocId) * this method to update notifications associated with a certain type, you need * to first create a manager delegate and define it in getMgrDelegate() method. * - * @param $request PKPRequest - * @param $notificationTypes array The type(s) of the notification(s) to + * @param PKPRequest $request + * @param array $notificationTypes The type(s) of the notification(s) to * be updated. - * @param $userIds array|null The notification user(s) id(s), or null for all. - * @param $assocType int ASSOC_TYPE_... The notification associated object type. - * @param $assocId int The notification associated object id. + * @param array|null $userIds The notification user(s) id(s), or null for all. + * @param int $assocType ASSOC_TYPE_... The notification associated object type. + * @param int $assocId The notification associated object id. * * @return mixed Return false if no operation is executed or the last operation * returned value. @@ -424,15 +426,59 @@ public function getNotificationSettingsMap() ]; } + /** + * Get the stage-level notification type constants for editorial decisions + * + * @return int[] + */ + public function getDecisionStageNotifications(): array + { + return [ + PKPNotification::NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_SUBMISSION, + PKPNotification::NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EXTERNAL_REVIEW, + PKPNotification::NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EDITING, + PKPNotification::NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_PRODUCTION + ]; + } + + /** + * Get the notification type for each editor decision + * + * @return int One of the Notification::NOTIFICATION_TYPE_ constants + */ + public function getNotificationTypeByEditorDecision(Decision $decision): ?int + { + switch ($decision->getData('decision')) { + case Decision::ACCEPT: + return Notification::NOTIFICATION_TYPE_EDITOR_DECISION_ACCEPT; + case Decision::EXTERNAL_REVIEW: + return Notification::NOTIFICATION_TYPE_EDITOR_DECISION_EXTERNAL_REVIEW; + case Decision::PENDING_REVISIONS: + return Notification::NOTIFICATION_TYPE_EDITOR_DECISION_PENDING_REVISIONS; + case Decision::RESUBMIT: + return Notification::NOTIFICATION_TYPE_EDITOR_DECISION_RESUBMIT; + case Decision::NEW_ROUND: + return Notification::NOTIFICATION_TYPE_EDITOR_DECISION_NEW_ROUND; + case Decision::DECLINE: + case Decision::INITIAL_DECLINE: + return Notification::NOTIFICATION_TYPE_EDITOR_DECISION_DECLINE; + case Decision::REVERT_DECLINE: + return Notification::NOTIFICATION_TYPE_EDITOR_DECISION_REVERT_DECLINE; + case Decision::SEND_TO_PRODUCTION: + return Notification::NOTIFICATION_TYPE_EDITOR_DECISION_SEND_TO_PRODUCTION; + } + return null; + } + // // Protected methods // /** * Get the notification manager delegate based on the passed notification type. * - * @param $notificationType int - * @param $assocType int - * @param $assocId int + * @param int $notificationType + * @param int $assocType + * @param int $assocId * * @return mixed Null or NotificationManagerDelegate */ @@ -484,7 +530,7 @@ protected function getMgrDelegate($notificationType, $assocType, $assocId) * Try to use a delegate to retrieve a notification data that's defined * by the implementation of the * - * @param $operationName string + * @param string $operationName */ protected function getByDelegate($notificationType, $assocType, $assocId, $operationName, $parameters) { @@ -503,9 +549,9 @@ protected function getByDelegate($notificationType, $assocType, $assocId, $opera /** * Return notification settings. * - * @param $notificationId int + * @param int $notificationId * - * @return Array + * @return array */ private function getNotificationSettings($notificationId) { @@ -521,10 +567,10 @@ private function getNotificationSettings($notificationId) /** * Helper function to get a translated string from a notification with parameters * - * @param $key string - * @param $notificationId int + * @param string $key + * @param int $notificationId * - * @return String + * @return string */ private function _getTranslatedKeyWithParameters($key, $notificationId) { diff --git a/classes/notification/PKPNotificationOperationManager.inc.php b/classes/notification/PKPNotificationOperationManager.inc.php index 861954661a9..96db417e2bf 100644 --- a/classes/notification/PKPNotificationOperationManager.inc.php +++ b/classes/notification/PKPNotificationOperationManager.inc.php @@ -106,7 +106,7 @@ public function isVisibleToAllUsers($notificationType, $assocType, $assocId) * a param for the journal's default locale, or the first value (in case the value * is not localized) * - * @param $params array + * @param array $params * * @return array */ @@ -143,16 +143,16 @@ public function getParamsForCurrentLocale($params) /** * Create a new notification with the specified arguments and insert into DB * - * @param $request PKPRequest - * @param $userId int (optional) - * @param $notificationType int - * @param $contextId int - * @param $assocType int - * @param $assocId int - * @param $level int - * @param $params array - * @param $suppressEmail boolean Whether or not to suppress the notification email. - * @param $mailConfigurator callable Enables the customization of the Notification email + * @param PKPRequest $request + * @param int $userId (optional) + * @param int $notificationType + * @param int $contextId + * @param int $assocType + * @param int $assocId + * @param int $level + * @param array $params + * @param bool $suppressEmail Whether or not to suppress the notification email. + * @param callable $mailConfigurator Enables the customization of the Notification email * * @return Notification object|null */ @@ -196,9 +196,9 @@ public function createNotification($request, $userId = null, $notificationType = * Create a new notification with the specified arguments and insert into DB * This is a static method * - * @param $userId int - * @param $notificationType int - * @param $params array + * @param int $userId + * @param int $notificationType + * @param array $params * * @return Notification object */ @@ -242,7 +242,7 @@ public function deleteTrivialNotifications($notifications) /** * General notification data formating. * - * @param $request PKPRequest + * @param PKPRequest $request * @param array $notifications * * @return array @@ -266,8 +266,8 @@ public function formatToGeneralNotification($request, $notifications) /** * In place notification data formating. * - * @param $request PKPRequest - * @param $notifications array + * @param PKPRequest $request + * @param array $notifications * * @return array */ @@ -288,8 +288,8 @@ public function formatToInPlaceNotification($request, $notifications) /** * Get set of notifications types user does not want to be notified of. * - * @param $userId int The notification user - * @param $contextId int + * @param int $userId The notification user + * @param int $contextId * * @return array */ @@ -313,7 +313,7 @@ protected function getUserBlockedEmailedNotifications($userId, $contextId) /** * Get a template mail instance. * - * @param $emailKey string + * @param string $emailKey * * @return MailTemplate * @@ -327,8 +327,8 @@ protected function getMailTemplate($emailKey = null) /** * Get a notification content with a link action. * - * @param $linkAction LinkAction - * @param $request Request + * @param LinkAction $linkAction + * @param Request $request * * @return string */ @@ -343,11 +343,13 @@ protected function fetchLinkActionNotificationContent($linkAction, $request) // // Private helper methods. // - /* + /** * Return a string of formatted notifications for display - * @param $request PKPRequest - * @param $notifications object DAOResultFactory - * @param $notificationTemplate string optional Template to use for constructing an individual notification for display + * + * @param PKPRequest $request + * @param object $notifications DAOResultFactory + * @param string $notificationTemplate optional Template to use for constructing an individual notification for display + * * @return string */ private function formatNotifications($request, $notifications, $notificationTemplate = 'notification/notification.tpl') @@ -365,8 +367,8 @@ private function formatNotifications($request, $notifications, $notificationTemp /** * Return a fully formatted notification for display * - * @param $request PKPRequest - * @param $notification object Notification + * @param PKPRequest $request + * @param object $notification Notification * * @return string */ @@ -403,10 +405,10 @@ private function formatNotification($request, $notification, $notificationTempla /** * Send an email to a user regarding the notification * - * @param $request PKPRequest - * @param $notification object Notification - * @param $contextId ?int Context ID - * @param $mailConfigurator callable If specified, must return a MailTemplate instance. A ready MailTemplate object will be provided as argument + * @param PKPRequest $request + * @param object $notification Notification + * @param int|null $contextId Context ID + * @param callable $mailConfigurator If specified, must return a MailTemplate instance. A ready MailTemplate object will be provided as argument */ protected function sendNotificationEmail($request, $notification, ?int $contextId, callable $mailConfigurator = null) { @@ -432,7 +434,7 @@ protected function sendNotificationEmail($request, $notification, ?int $contextI $emailParams = [ 'notificationContents' => $this->getNotificationContents($request, $notification), - 'url' => $this->getNotificationUrl($request, $notification), + 'notificationUrl' => $this->getNotificationUrl($request, $notification), 'siteTitle' => $context ? $context->getLocalizedName() : $site->getLocalizedTitle(), ]; @@ -468,7 +470,7 @@ protected function sendNotificationEmail($request, $notification, ?int $contextI /** * Creates and returns a unique string for the given notification, that will be encoded and validated against. * - * @param $notification Notification + * @param Notification $notification * * @return string */ @@ -482,7 +484,7 @@ public function createUnsubscribeUniqueKey($notification) /** * Creates and returns an encoded token that will be used to validate an unsubscribe url. * - * @param $notification Notification + * @param Notification $notification * * @return string */ @@ -502,8 +504,8 @@ public function createUnsubscribeToken($notification) /** * The given notification is validated against the requested token. * - * @param $token string - * @param $notification Notification + * @param string $token + * @param Notification $notification * * @return bool */ @@ -527,8 +529,8 @@ public function validateUnsubscribeToken($token, $notification) /** * Returns the unsubscribe url for the given notification. * - * @param $request PKPRequest - * @param $notification Notification + * @param PKPRequest $request + * @param Notification $notification * * @return string */ diff --git a/classes/notification/form/PKPNotificationsUnsubscribeForm.inc.php b/classes/notification/form/PKPNotificationsUnsubscribeForm.inc.php index 1d0d56700e9..0ad8471c8d6 100644 --- a/classes/notification/form/PKPNotificationsUnsubscribeForm.inc.php +++ b/classes/notification/form/PKPNotificationsUnsubscribeForm.inc.php @@ -35,8 +35,8 @@ class PKPNotificationsUnsubscribeForm extends Form /** * Constructor. * - * @param $notification Notification The notification that triggered the unsubscribe event - * @param $validationToken string $name The unsubscribe validation token + * @param Notification $notification The notification that triggered the unsubscribe event + * @param string $validationToken $name The unsubscribe validation token */ public function __construct($notification, $validationToken) { diff --git a/classes/notification/managerDelegate/AnnouncementNotificationManager.inc.php b/classes/notification/managerDelegate/AnnouncementNotificationManager.inc.php index a938ee0844f..6be59b10672 100644 --- a/classes/notification/managerDelegate/AnnouncementNotificationManager.inc.php +++ b/classes/notification/managerDelegate/AnnouncementNotificationManager.inc.php @@ -17,17 +17,20 @@ use APP\core\Application; use APP\core\Services; use APP\notification\Notification; +use PKP\announcement\Announcement; use PKP\core\PKPApplication; use PKP\emailTemplate\EmailTemplate; use PKP\facades\Repo; +use PKP\mail\Mail; use PKP\mail\MailTemplate; use PKP\notification\NotificationManagerDelegate; use PKP\notification\PKPNotification; +use PKP\user\User; class AnnouncementNotificationManager extends NotificationManagerDelegate { - /** @var array The announcement to send a notification about */ + /** @var Announcement The announcement to send a notification about */ public $_announcement; /** @@ -90,7 +93,7 @@ public function getStyleClass($notification): string /** * Sends a notification to the given user. * - * @param $user User The user who will be notified + * @param User $user The user who will be notified * * @return PKPNotification|null The notification instance or null if no notification created */ @@ -130,8 +133,8 @@ protected function getMailTemplate($emailKey = null): MailTemplate /** * Setups a customized message for the given user. * - * @param $mail Mail The message which will be customized - * @param $user User The user who will be notified + * @param Mail $mail The message which will be customized + * @param User $user The user who will be notified * * @return Mail The prepared message */ diff --git a/classes/notification/managerDelegate/EditorialReportNotificationManager.inc.php b/classes/notification/managerDelegate/EditorialReportNotificationManager.inc.php index 56aeb9165af..659d7419f59 100644 --- a/classes/notification/managerDelegate/EditorialReportNotificationManager.inc.php +++ b/classes/notification/managerDelegate/EditorialReportNotificationManager.inc.php @@ -61,9 +61,9 @@ public function __construct(int $notificationType) /** * Initializes the class. * - * @param $context Context The context from where the statistics shall be retrieved - * @param $context DateTimeInterface Start date filter for the ranged statistics - * @param $context DateTimeInterface End date filter for the ranged statistics + * @param Context $context The context from where the statistics shall be retrieved + * @param DateTimeInterface $context Start date filter for the ranged statistics + * @param DateTimeInterface $context End date filter for the ranged statistics */ public function initialize(Context $context, DateTimeInterface $dateStart, DateTimeInterface $dateEnd): void { @@ -224,7 +224,7 @@ public function getStyleClass($notification): string /** * Sends a notification to the given user. * - * @param $user User The user who will be notified + * @param User $user The user who will be notified * * @return PKPNotification The notification instance */ @@ -261,8 +261,8 @@ protected function getMailTemplate($emailKey = null): MailTemplate /** * Setups a customized message for the given user. * - * @param $mail Mail The message which will be customized - * @param $user User The user who will be notified + * @param Mail $mail The message which will be customized + * @param User $user The user who will be notified * * @return Mail The prepared message */ @@ -278,7 +278,7 @@ private function _setupMessage(Mail $mail, User $user): Mail /** * Retrieves the message parameters. * - * @param $user User The user who will be notified + * @param User $user The user who will be notified * * @return array An array with the parameters and their values */ diff --git a/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php b/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php index fdfbac7d9a0..01116cb6a01 100644 --- a/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php +++ b/classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.inc.php @@ -97,11 +97,11 @@ public function updateNotification($request, $userIds, $assocType, $assocId) $productionQuery = $productionQueries->next(); // Get the copyedited files - $submissionFileCollector = Repo::submissionFiles() + $submissionFileCollector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$submissionId]) ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_COPYEDIT]); - $countCopyeditedFiles = Repo::submissionFiles() + $countCopyeditedFiles = Repo::submissionFile() ->getCount($submissionFileCollector); // Get representations @@ -208,10 +208,10 @@ public function updateNotification($request, $userIds, $assocType, $assocId) /** * Remove a notification. * - * @param $submissionId int - * @param $userId int - * @param $notificationType int NOTIFICATION_TYPE_ - * @param $contextId int + * @param int $submissionId + * @param int $userId + * @param int $notificationType NOTIFICATION_TYPE_ + * @param int $contextId */ public function _removeNotification($submissionId, $userId, $notificationType, $contextId) { @@ -228,11 +228,11 @@ public function _removeNotification($submissionId, $userId, $notificationType, $ /** * Create a notification if none exists. * - * @param $request PKPRequest - * @param $submissionId int - * @param $userId int - * @param $notificationType int NOTIFICATION_TYPE_ - * @param $contextId int + * @param PKPRequest $request + * @param int $submissionId + * @param int $userId + * @param int $notificationType NOTIFICATION_TYPE_ + * @param int $contextId */ public function _createNotification($request, $submissionId, $userId, $notificationType, $contextId) { diff --git a/classes/notification/managerDelegate/PendingRevisionsNotificationManager.inc.php b/classes/notification/managerDelegate/PendingRevisionsNotificationManager.inc.php index d09ccd8f64b..6fc32545dd4 100644 --- a/classes/notification/managerDelegate/PendingRevisionsNotificationManager.inc.php +++ b/classes/notification/managerDelegate/PendingRevisionsNotificationManager.inc.php @@ -15,11 +15,11 @@ namespace PKP\notification\managerDelegate; +use APP\decision\Decision; use APP\facades\Repo; use APP\i18n\AppLocale; use APP\notification\Notification; -use APP\workflow\EditorDecisionActionsManager; use PKP\db\DAORegistry; use PKP\notification\NotificationManagerDelegate; use PKP\notification\PKPNotification; @@ -109,12 +109,11 @@ public function updateNotification($request, $userIds, $assocType, $assocId) } $expectedStageId = $stageData['id']; - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $pendingRevisionDecision = $editDecisionDao->findValidPendingRevisionsDecision($submissionId, $expectedStageId, EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS); + $pendingRevisionDecision = Repo::decision()->getActivePendingRevisionsDecision($submissionId, $expectedStageId, Decision::PENDING_REVISIONS); $removeNotifications = false; if ($pendingRevisionDecision) { - if ($editDecisionDao->responseExists($pendingRevisionDecision, $submissionId)) { + if (Repo::decision()->revisionsUploadedSinceDecision($pendingRevisionDecision, $submissionId)) { // Some user already uploaded a revision. Flag to delete any existing notification. $removeNotifications = true; } else { diff --git a/classes/notification/managerDelegate/QueryNotificationManager.inc.php b/classes/notification/managerDelegate/QueryNotificationManager.inc.php index 8d624fa4ca7..816fef02c72 100644 --- a/classes/notification/managerDelegate/QueryNotificationManager.inc.php +++ b/classes/notification/managerDelegate/QueryNotificationManager.inc.php @@ -78,7 +78,7 @@ public function getNotificationMessage($request, $notification) /** * Get the submission for a query. * - * @param $query Query + * @param Query $query * * @return Submission */ diff --git a/classes/oai/OAI.inc.php b/classes/oai/OAI.inc.php index 8d4f0d3fca7..71e766f4ad3 100644 --- a/classes/oai/OAI.inc.php +++ b/classes/oai/OAI.inc.php @@ -46,7 +46,7 @@ abstract class OAI * Constructor. * Initializes object and parses user input. * - * @param $config OAIConfig repository configuration + * @param OAIConfig $config repository configuration */ public function __construct($config) { @@ -117,9 +117,9 @@ abstract public function repositoryInfo(); /** * Check if identifier is in the valid format. * - * @param $identifier string + * @param string $identifier * - * @return boolean + * @return bool */ public function validIdentifier($identifier) { @@ -129,9 +129,9 @@ public function validIdentifier($identifier) /** * Check if identifier exists. * - * @param $identifier string + * @param string $identifier * - * @return boolean + * @return bool */ public function identifierExists($identifier) { @@ -141,7 +141,7 @@ public function identifierExists($identifier) /** * Return OAI record for specified identifier. * - * @param $identifier string + * @param string $identifier * * @return OAIRecord (or false, if identifier is invalid) */ @@ -150,13 +150,13 @@ abstract public function record($identifier); /** * Return set of OAI records. * - * @param $metadataPrefix string specified metadata prefix - * @param $from int minimum timestamp - * @param $until int maximum timestamp - * @param $set string specified set - * @param $offset int current record offset - * @param $limit int maximum number of records to return - * @param $total int output parameter, set to total number of records + * @param string $metadataPrefix specified metadata prefix + * @param int $from minimum timestamp + * @param int $until maximum timestamp + * @param string $set specified set + * @param int $offset current record offset + * @param int $limit maximum number of records to return + * @param int $total output parameter, set to total number of records * * @return array OAIRecord */ @@ -180,9 +180,9 @@ public function identifiers($metadataPrefix, $from, $until, $set, $offset, $limi /** * Return set of OAI sets. * - * @param $offset int current set offset - * @param $limit int Maximum number of sets to return - * @param $total int output parameter, set to total number of sets + * @param int $offset current set offset + * @param int $limit Maximum number of sets to return + * @param int $total output parameter, set to total number of sets */ public function sets($offset, $limit, &$total) { @@ -192,7 +192,7 @@ public function sets($offset, $limit, &$total) /** * Retrieve a resumption token. * - * @param $tokenId string + * @param string $tokenId * * @return OAIResumptionToken|false */ @@ -201,8 +201,8 @@ abstract public function resumptionToken($tokenId); /** * Save a resumption token. * - * @param $offset int current offset - * @param $params array request parameters + * @param int $offset current offset + * @param array $params request parameters * * @return OAIResumptionToken the saved token */ @@ -211,8 +211,8 @@ abstract public function saveResumptionToken($offset, $params); /** * Return array of supported metadata formats. * - * @param $namesOnly boolean return array of format prefix names only - * @param $identifier string return formats for specific identifier + * @param bool $namesOnly return array of format prefix names only + * @param string $identifier return formats for specific identifier * * @return array */ @@ -691,8 +691,8 @@ public function error($code, $message) /** * Output OAI response. * - * @param $response string text of response message. - * @param $printParams boolean display request parameters + * @param string $response text of response message. + * @param bool $printParams display request parameters */ public function response($response, $printParams = true) { @@ -723,7 +723,7 @@ public function response($response, $printParams = true) /** * Returns the value of the specified parameter. * - * @param $name string + * @param string $name * * @return string */ @@ -745,7 +745,7 @@ public function getParams() /** * Set the request parameters. * - * @param $params array + * @param array $params */ public function setParams($params) { @@ -755,9 +755,9 @@ public function setParams($params) /** * Returns true if the requested parameter is set, false if it is not set. * - * @param $name string + * @param string $name * - * @return boolean + * @return bool */ public function paramExists($name) { @@ -778,10 +778,10 @@ public function getNonPathInfoParams() * Check request parameters. * Outputs error response if an invalid parameter is found. * - * @param $required array required parameters for the current request - * @param $optional array optional parameters for the current request + * @param array $required required parameters for the current request + * @param array $optional optional parameters for the current request * - * @return boolean + * @return bool */ public function checkParams($required = [], $optional = []) { @@ -826,7 +826,7 @@ public function checkParams($required = [], $optional = []) /** * Returns formatted metadata response in specified format. * - * @param $format string + * @param string $format * * @return string */ @@ -841,11 +841,11 @@ public function formatMetadata($format, $record) * Checks if from and until parameters have been passed. * If passed, validate and convert to UNIX timestamps. * - * @param $params array request parameters - * @param $from int from timestamp (output parameter) - * @param $until int until timestamp (output parameter) + * @param array $params request parameters + * @param int $from from timestamp (output parameter) + * @param int $until until timestamp (output parameter) * - * @return boolean + * @return bool */ public function extractDateParams($params, &$from, &$until) { diff --git a/classes/oai/OAIMetadataFormat.inc.php b/classes/oai/OAIMetadataFormat.inc.php index 356e0cde5cc..3dc148dc9c5 100644 --- a/classes/oai/OAIMetadataFormat.inc.php +++ b/classes/oai/OAIMetadataFormat.inc.php @@ -55,8 +55,8 @@ public function getLocalizedData($data, $locale) /** * Retrieve XML-formatted metadata for the specified record. * - * @param $record OAIRecord - * @param $format string OAI metadata prefix + * @param OAIRecord $record + * @param string $format OAI metadata prefix * * @return string */ diff --git a/classes/oai/OAIUtils.inc.php b/classes/oai/OAIUtils.inc.php index 84fdc8e81e8..f6ea6fee582 100644 --- a/classes/oai/OAIUtils.inc.php +++ b/classes/oai/OAIUtils.inc.php @@ -32,8 +32,8 @@ public static function init() /** * Return a UTC-formatted datestamp from the specified UNIX timestamp. * - * @param $timestamp int *nix timestamp (if not used, the current time is used) - * @param $includeTime boolean include both the time and date + * @param int $timestamp *nix timestamp (if not used, the current time is used) + * @param bool $includeTime include both the time and date * * @return string UTC datestamp */ @@ -56,8 +56,8 @@ public static function UTCDate($timestamp = 0, $includeTime = true) * Returns the string "invalid" if datestamp is invalid, * or "invalid_granularity" if unsupported granularity. * - * @param $date string UTC datestamp - * @param $requiredGranularity string Datestamp granularity to require (default: not checked) + * @param string $date UTC datestamp + * @param string $requiredGranularity Datestamp granularity to require (default: not checked) * * @return int timestamp */ @@ -87,7 +87,7 @@ public static function UTCtoTimestamp($date, $requiredGranularity = null) /** * Clean input variables (by reference). * - * @param $data mixed request parameter(s) + * @param mixed $data request parameter(s) */ public static function prepInput(&$data) { // REFERENCE REQUIRED @@ -109,7 +109,7 @@ public static function prepInput(&$data) * Prepare variables for output (by reference). * Data is assumed to be UTF-8 encoded (FIXME?) * - * @param $data mixed output parameter(s) + * @param mixed $data output parameter(s) * * @return mixed cleaned output parameter(s) */ @@ -135,7 +135,7 @@ public static function prepOutput(&$data) * Acts like parse_str($string, $array) except duplicate * variable names in $string are converted to an array. * - * @param $array array of parsed parameters + * @param array $array of parsed parameters */ public static function parseStr($string, &$array) { @@ -167,8 +167,6 @@ public static function parseStr($string, &$array) * [1] https://www.openarchives.org/OAI/2.0/openarchivesprotocol.htm#Set * [2] http://www.ietf.org/rfc/rfc2396.txt * - * @param $string string - * @return string */ public static function toValidSetSpec(string $string): string { diff --git a/classes/oai/PKPOAIDAO.inc.php b/classes/oai/PKPOAIDAO.inc.php index 1691e15a343..686572a33d6 100755 --- a/classes/oai/PKPOAIDAO.inc.php +++ b/classes/oai/PKPOAIDAO.inc.php @@ -28,7 +28,7 @@ abstract class PKPOAIDAO extends \PKP\db\DAO /** * Set parent OAI object. * - * @param JournalOAI + * @param JournalOAI $oai */ public function setOAI($oai) { @@ -52,7 +52,7 @@ public function clearTokens() /** * Retrieve a resumption token. * - * @param $tokenId string OAI resumption token + * @param string $tokenId OAI resumption token * * @return OAIResumptionToken */ @@ -66,7 +66,7 @@ public function getToken($tokenId) /** * Insert an OAI resumption token, generating a new ID. * - * @param $token OAIResumptionToken + * @param OAIResumptionToken $token * * @return OAIResumptionToken */ @@ -97,12 +97,12 @@ public function insertToken($token) /** * Check if a data object ID specifies a data object. * - * @param $dataObjectId int - * @param $setIds array optional Objects ids that specify an OAI set, + * @param int $dataObjectId + * @param array $setIds optional Objects ids that specify an OAI set, * in hierarchical order. If passed, will check for the data object id * only inside the specified set. * - * @return boolean + * @return bool */ public function recordExists($dataObjectId, $setIds = []) { @@ -112,8 +112,8 @@ public function recordExists($dataObjectId, $setIds = []) /** * Return OAI record for specified data object. * - * @param $dataObjectId int - * @param $setIds array optional Objects ids that specify an OAI set, + * @param int $dataObjectId + * @param array $setIds optional Objects ids that specify an OAI set, * in hierarchical order. If passed, will check for the data object id * only inside the specified set. * @@ -129,15 +129,15 @@ public function getRecord($dataObjectId, $setIds = []) /** * Return set of OAI records matching specified parameters. * - * @param $setIds array Objects ids that specify an OAI set, + * @param array $setIds Objects ids that specify an OAI set, * in hierarchical order. The returned records will be part * of this set. - * @param $from int timestamp - * @param $until int timestamp - * @param $set string setSpec - * @param $offset int - * @param $limit int - * @param $total int + * @param int $from timestamp + * @param int $until timestamp + * @param string $set setSpec + * @param int $offset + * @param int $limit + * @param int $total * * @return array OAIRecord */ @@ -157,15 +157,15 @@ public function getRecords($setIds, $from, $until, $set, $offset, $limit, &$tota /** * Return set of OAI identifiers matching specified parameters. * - * @param $setIds array Objects ids that specify an OAI set, + * @param array $setIds Objects ids that specify an OAI set, * in hierarchical order. The returned records will be part * of this set. - * @param $from int timestamp - * @param $until int timestamp - * @param $set string setSpec - * @param $offset int - * @param $limit int - * @param $total int + * @param int $from timestamp + * @param int $until timestamp + * @param string $set setSpec + * @param int $offset + * @param int $limit + * @param int $total * * @return array OAIIdentifier */ @@ -185,7 +185,7 @@ public function getIdentifiers($setIds, $from, $until, $set, $offset, $limit, &$ /** * Return the *nix timestamp of the earliest published submission. * - * @param $setIds array optional Objects ids that specify an OAI set, + * @param array $setIds optional Objects ids that specify an OAI set, * in hierarchical order. If empty, all records from * all sets will be included. * @@ -208,7 +208,7 @@ public function getEarliestDatestamp($setIds = []) /** * Return OAIRecord object from database row. * - * @param $row array + * @param array $row * * @return OAIRecord */ @@ -225,7 +225,7 @@ public function _returnRecordFromRow($row) /** * Return OAIIdentifier object from database row. * - * @param $row array + * @param array $row * * @return OAIIdentifier */ @@ -242,10 +242,10 @@ public function _returnIdentifierFromRow($row) /** * Common operations for OAIRecord and OAIIdentifier object data set. * - * @param $record OAIRecord/OAIIdentifier - * @param $row array + * @param OAIRecord|OAIIdentifier $record + * @param array $row * - * @return OAIRecord/OAIIdentifier + * @return OAIRecord|OAIIdentifier */ public function _doCommonOAIFromRowOperations($record, $row) { @@ -266,13 +266,13 @@ public function _doCommonOAIFromRowOperations($record, $row) /** * Get a OAI records record set. * - * @param $setIds array Objects ids that specify an OAI set, + * @param array $setIds Objects ids that specify an OAI set, * in hierarchical order. - * @param $from int/string *nix timestamp or ISO datetime string - * @param $until int/string *nix timestamp or ISO datetime string - * @param $set string - * @param $submissionId int optional - * @param $orderBy string UNFILTERED + * @param int|string $from *nix timestamp or ISO datetime string + * @param int|string $until *nix timestamp or ISO datetime string + * @param string $set + * @param int $submissionId optional + * @param string $orderBy UNFILTERED * * @return \Illuminate\Database\Query\Builder */ diff --git a/classes/observers/events/DecisionAdded.inc.php b/classes/observers/events/DecisionAdded.inc.php new file mode 100644 index 00000000000..6670c96dcf5 --- /dev/null +++ b/classes/observers/events/DecisionAdded.inc.php @@ -0,0 +1,65 @@ +actions = $actions; + $this->context = $context; + $this->decision = $decision; + $this->decisionType = $decisionType; + $this->editor = $editor; + $this->submission = $submission; + } +} diff --git a/classes/observers/events/DiscussionMessageSent.inc.php b/classes/observers/events/DiscussionMessageSent.inc.php deleted file mode 100644 index c7d82618040..00000000000 --- a/classes/observers/events/DiscussionMessageSent.inc.php +++ /dev/null @@ -1,44 +0,0 @@ -query = $query; - $this->context = $context; - $this->submission = $submission; - $this->formEmailData = $formData; - } -} diff --git a/classes/observers/listeners/MailDiscussionMessage.inc.php b/classes/observers/listeners/MailDiscussionMessage.inc.php deleted file mode 100644 index cd6c0431b63..00000000000 --- a/classes/observers/listeners/MailDiscussionMessage.inc.php +++ /dev/null @@ -1,68 +0,0 @@ -formEmailData->getRecipients($event->context->getId()); - foreach ($users as $user) { - // Check if user is unsubscribed - $notificationSubscriptionSettings = $notificationSubscriptionSettingsDao->getNotificationSubscriptionSettings( - NotificationSubscriptionSettingsDAO::BLOCKED_EMAIL_NOTIFICATION_KEY, - $user->getId(), - (int) $event->context->getId() - ); - if (in_array(PKPNotification::NOTIFICATION_TYPE_NEW_QUERY, $notificationSubscriptionSettings)) { - return; - } - - $submission = $event->submission; - $sender = $event->formEmailData->getSender(); - - $mailable = new \PKP\mail\mailables\MailDiscussionMessage($event->context, $submission); - $emailTemplate = $mailable->getTemplate($event->context->getId()); - - $mailable->addData(array_merge( - [ - 'siteTitle' => $mailable->viewData['journalName'], - ], - $event->formEmailData->getVariables($user->getId()) - )); - - $mailable - ->body($emailTemplate->getLocalizedData('body')) - ->subject($emailTemplate->getLocalizedData('subject')) - ->sender($sender) - ->recipients([$user]) - ->replyTo($event->context->getContactEmail(), $event->context->getContactName()); - - Mail::send($mailable); - } - } -} diff --git a/classes/observers/listeners/ValidateRegisteredEmail.inc.php b/classes/observers/listeners/ValidateRegisteredEmail.inc.php index e18ef4a192e..65c4493c7ef 100644 --- a/classes/observers/listeners/ValidateRegisteredEmail.inc.php +++ b/classes/observers/listeners/ValidateRegisteredEmail.inc.php @@ -15,22 +15,23 @@ namespace PKP\observers\listeners; +use APP\facades\Repo; use Illuminate\Events\Dispatcher; use Illuminate\Support\Facades\Mail; use PKP\config\Config; use PKP\core\PKPApplication; -use PKP\security\AccessKeyManager; -use PKP\observers\events\UserRegisteredContext; -use PKP\observers\events\UserRegisteredSite; use PKP\mail\mailables\ValidateEmailContext as ContextMailable; use PKP\mail\mailables\ValidateEmailSite as SiteMailable; +use PKP\observers\events\UserRegisteredContext; +use PKP\observers\events\UserRegisteredSite; +use PKP\security\AccessKeyManager; class ValidateRegisteredEmail { /** * Maps methods with correspondent events to listen */ - public function subscribe(Dispatcher $events) : void + public function subscribe(Dispatcher $events): void { $events->listen( UserRegisteredContext::class, @@ -46,26 +47,28 @@ public function subscribe(Dispatcher $events) : void /** * @param \PKP\observers\events\UserRegisteredContext */ - public function handleContextRegistration(UserRegisteredContext $event) : void + public function handleContextRegistration(UserRegisteredContext $event): void { $this->manageEmail($event); } /** - * @param \PKP\observers\events\UserRegisteredSite $event */ - public function handleSiteRegistration(UserRegisteredSite $event) : void + public function handleSiteRegistration(UserRegisteredSite $event): void { $this->manageEmail($event); } /** * Sends mail depending on a source - context or site registration + * * @param UserRegisteredContext|UserRegisteredSite $event */ - protected function manageEmail($event) : void + protected function manageEmail($event): void { - if (!$this->emailValidationRequired()) return; + if (!$this->emailValidationRequired()) { + return; + } $accessKeyManager = new AccessKeyManager(); $accessKey = $accessKeyManager->createKey( @@ -82,16 +85,16 @@ protected function manageEmail($event) : void $mailable->addData([ 'activateUrl' => PKPApplication::get()->getRequest()->url($event->context->getData('urlPath'), 'user', 'activateUser', [$event->recipient->getData('username'), $accessKey]), ]); - $registerTemplate = $mailable->getTemplate($event->context->getId()); + $registerTemplate = Repo::emailTemplate()->getByKey($event->context->getId(), $mailable::getEmailTemplateKey()); } else { $mailable = new SiteMailable($event->site); $mailable->from($event->site->getLocalizedContactEmail(), $event->site->getLocalizedContactName()); $mailable->addData([ 'activateUrl' => PKPApplication::get()->getRequest()->url(null, 'user', 'activateUser', [$event->recipient->getData('username'), $accessKey]), - 'contextName' => $event->site->getLocalizedTitle(), - 'principalContactSignature' => $mailable->viewData['siteContactName'], + 'siteName' => $event->site->getLocalizedTitle(), + 'signature' => $mailable->viewData['siteContactName'], ]); - $registerTemplate = $mailable->getTemplate(PKPApplication::CONTEXT_SITE); + $registerTemplate = Repo::emailTemplate()->getByKey(PKPApplication::CONTEXT_SITE, $mailable::getEmailTemplateKey()); } // Send mail @@ -103,7 +106,7 @@ protected function manageEmail($event) : void Mail::send($mailable); } - protected function emailValidationRequired() : bool + protected function emailValidationRequired(): bool { return (bool) Config::getVar('email', 'require_validation'); } diff --git a/classes/payment/CompletedPayment.inc.php b/classes/payment/CompletedPayment.inc.php index 0adef10a965..336788f272d 100644 --- a/classes/payment/CompletedPayment.inc.php +++ b/classes/payment/CompletedPayment.inc.php @@ -38,7 +38,7 @@ public function getTimestamp() /** * Set the payment completion timestamp. * - * @param $timestamp string Timestamp + * @param string $timestamp Timestamp */ public function setTimestamp($timestamp) { @@ -58,7 +58,7 @@ public function getPayMethodPluginName() /** * Set the payment plugin name. * - * @param $paymentPluginName string + * @param string $paymentPluginName */ public function setPayMethodPluginName($paymentPluginName) { diff --git a/classes/payment/Payment.inc.php b/classes/payment/Payment.inc.php index feddbea3b41..32544724bd5 100644 --- a/classes/payment/Payment.inc.php +++ b/classes/payment/Payment.inc.php @@ -30,7 +30,7 @@ class Payment /** @var int Context ID */ public $contextId; - /** @var numeric amount of payment in $currencyCode units */ + /** @var float amount of payment in $currencyCode units */ public $amount; /** @var string ISO 4217 alpha currency code */ @@ -48,10 +48,10 @@ class Payment /** * Constructor * - * @param $amount number - * @param $currencyCode string - * @param $userId int - * @param $assocId int optional + * @param float $amount + * @param string $currencyCode + * @param int $userId + * @param int $assocId optional */ public function __construct($amount = null, $currencyCode = null, $userId = null, $assocId = null) { @@ -74,7 +74,7 @@ public function getId() /** * Set the id of payment * - * @param $paymentId int + * @param int $paymentId * * @return int new payment id */ @@ -86,9 +86,9 @@ public function setId($paymentId) /** * Set the payment amount * - * @param $amount numeric + * @param float $amount * - * @return numeric new amount + * @return float new amount */ public function setAmount($amount) { @@ -98,7 +98,7 @@ public function setAmount($amount) /** * Get the payment amount * - * @return numeric + * @return float */ public function getAmount() { @@ -108,7 +108,7 @@ public function getAmount() /** * Set the currency code for the transaction (ISO 4217) * - * @param $currencyCode string + * @param string $currencyCode * * @return string new currency code */ @@ -140,7 +140,7 @@ public function getContextId() /** * Set the context ID for the payment. * - * @param $contextId int + * @param int $contextId */ public function setContextId($contextId) { @@ -150,7 +150,7 @@ public function setContextId($contextId) /** * Set the type for this payment (PAYMENT_TYPE_...) * - * @param $type int PAYMENT_TYPE_... + * @param int $type PAYMENT_TYPE_... * * @return int New payment type */ @@ -172,7 +172,7 @@ public function getType() /** * Set the user ID of the customer. * - * @param $userId int + * @param int $userId * * @return int New user ID */ @@ -194,7 +194,7 @@ public function getUserId() /** * Set the association ID for the payment. * - * @param $assocId int + * @param int $assocId * * @return int New association ID */ diff --git a/classes/payment/PaymentManager.inc.php b/classes/payment/PaymentManager.inc.php index aa05147a4db..ac3c589a016 100644 --- a/classes/payment/PaymentManager.inc.php +++ b/classes/payment/PaymentManager.inc.php @@ -30,7 +30,7 @@ abstract class PaymentManager /** * Constructor * - * @param $context Context + * @param Context $context */ public function __construct($context) { @@ -40,8 +40,8 @@ public function __construct($context) /** * Queue a payment for receipt. * - * @param $queuedPayment object - * @param $expiryDate date optional + * @param object $queuedPayment + * @param date $expiryDate optional * * @return mixed Queued payment ID for new payment, or false if fails */ @@ -86,7 +86,7 @@ public function isConfigured() /** * Get the payment form for the configured payment plugin and specified payment. * - * @param $queuedPayment QueuedPayment + * @param QueuedPayment $queuedPayment * * @return Form */ @@ -102,7 +102,7 @@ public function getPaymentForm($queuedPayment) /** * Call the payment plugin's settings display method * - * @return boolean + * @return bool */ public function displayConfigurationForm() { @@ -116,7 +116,7 @@ public function displayConfigurationForm() /** * Fetch a queued payment * - * @param $queuedPaymentId int + * @param int $queuedPaymentId * * @return QueuedPayment */ @@ -130,10 +130,10 @@ public function getQueuedPayment($queuedPaymentId) /** * Fulfill a queued payment * - * @param $request PKPRequest - * @param $queuedPayment QueuedPayment + * @param PKPRequest $request + * @param QueuedPayment $queuedPayment * - * @return boolean success/failure + * @return bool success/failure */ abstract public function fulfillQueuedPayment($request, $queuedPayment); } diff --git a/classes/payment/QueuedPayment.inc.php b/classes/payment/QueuedPayment.inc.php index bb9525bbd9c..003255a175d 100644 --- a/classes/payment/QueuedPayment.inc.php +++ b/classes/payment/QueuedPayment.inc.php @@ -26,7 +26,7 @@ class QueuedPayment extends Payment /** * Set the request URL. * - * @param $url string + * @param string $url * * @return string New URL */ diff --git a/classes/payment/QueuedPaymentDAO.inc.php b/classes/payment/QueuedPaymentDAO.inc.php index 508d295ae55..3d1c7c81a46 100644 --- a/classes/payment/QueuedPaymentDAO.inc.php +++ b/classes/payment/QueuedPaymentDAO.inc.php @@ -19,15 +19,16 @@ namespace PKP\payment; use PKP\core\Core; +use PKP\db\DAORegistry; class QueuedPaymentDAO extends \PKP\db\DAO { /** * Retrieve a queued payment by ID. * - * @param $queuedPaymentId int + * @param int $queuedPaymentId * - * @return QueuedPayment or null on failure + * @return QueuedPayment|null on failure */ public function getById($queuedPaymentId) { @@ -46,8 +47,8 @@ public function getById($queuedPaymentId) /** * Insert a new queued payment. * - * @param $queuedPayment QueuedPayment - * @param $expiryDate date optional + * @param QueuedPayment $queuedPayment + * @param date $expiryDate optional */ public function insertObject($queuedPayment, $expiryDate = null) { @@ -72,8 +73,8 @@ public function insertObject($queuedPayment, $expiryDate = null) /** * Update an existing queued payment. * - * @param $queuedPaymentId int - * @param $queuedPayment QueuedPayment + * @param int $queuedPaymentId + * @param QueuedPayment $queuedPayment */ public function updateObject($queuedPaymentId, $queuedPayment) { @@ -106,7 +107,7 @@ public function getInsertId() /** * Delete a queued payment. * - * @param $queuedPaymentId int + * @param int $queuedPaymentId */ public function deleteById($queuedPaymentId) { diff --git a/classes/plugins/AuthPlugin.inc.php b/classes/plugins/AuthPlugin.inc.php index 99d70f6e073..380d66b9e0a 100644 --- a/classes/plugins/AuthPlugin.inc.php +++ b/classes/plugins/AuthPlugin.inc.php @@ -29,8 +29,8 @@ abstract class AuthPlugin extends Plugin /** * Constructor. * - * @param $settings array - * @param $authId int ID for this instance + * @param array $settings + * @param int $authId ID for this instance */ public function __construct($settings = [], $authId = null) { @@ -61,9 +61,9 @@ public function getSettingsTemplate() /** * Update local user profile from the remote source, if enabled. * - * @param $user User + * @param User $user * - * @return boolean true if successful + * @return bool true if successful */ public function doGetUserInfo($user) { @@ -76,9 +76,9 @@ public function doGetUserInfo($user) /** * Update remote user profile, if enabled. * - * @param $user User + * @param User $user * - * @return boolean true if successful + * @return bool true if successful */ public function doSetUserInfo($user) { @@ -91,10 +91,10 @@ public function doSetUserInfo($user) /** * Update remote user password, if enabled. * - * @param $username string - * @param $password string + * @param string $username + * @param string $password * - * @return boolean true if successful + * @return bool true if successful */ public function doSetUserPassword($username, $password) { @@ -107,9 +107,9 @@ public function doSetUserPassword($username, $password) /** * Create remote user account, if enabled. * - * @param $user User to create + * @param User $user User to create * - * @return boolean true if successful + * @return bool true if successful */ public function doCreateUser($user) { @@ -127,8 +127,8 @@ public function doCreateUser($user) /** * Returns an instance of the authentication plugin * - * @param $settings array settings specific to this instance - * @param $authId int identifier for this instance + * @param array $settings settings specific to this instance + * @param int $authId identifier for this instance * * @return AuthPlugin */ @@ -137,10 +137,10 @@ abstract public function getInstance($settings, $authId); /** * Authenticate a username and password. * - * @param $username string - * @param $password string + * @param string $username + * @param string $password * - * @return boolean true if authentication is successful + * @return bool true if authentication is successful */ abstract public function authenticate($username, $password); @@ -152,9 +152,9 @@ abstract public function authenticate($username, $password); /** * Check if a username exists. * - * @param $username string + * @param string $username * - * @return boolean + * @return bool */ public function userExists($username) { @@ -165,9 +165,9 @@ public function userExists($username) * Retrieve user profile information from the remote source. * Any unsupported fields (e.g., OJS- or OMP-specific ones) should not be modified. * - * @param $user User to update + * @param User $user User to update * - * @return boolean true if successful + * @return bool true if successful */ public function getUserInfo($user) { @@ -177,9 +177,9 @@ public function getUserInfo($user) /** * Store user profile information on the remote source. * - * @param $user User to store + * @param User $user User to store * - * @return boolean true if successful + * @return bool true if successful */ public function setUserInfo($user) { @@ -189,10 +189,10 @@ public function setUserInfo($user) /** * Change a user's password on the remote source. * - * @param $username string user to update - * @param $password string the new password + * @param string $username user to update + * @param string $password the new password * - * @return boolean true if successful + * @return bool true if successful */ public function setUserPassword($username, $password) { @@ -202,9 +202,9 @@ public function setUserPassword($username, $password) /** * Create a user on the remote source. * - * @param $user User to create + * @param User $user User to create * - * @return boolean true if successful + * @return bool true if successful */ public function createUser($user) { @@ -216,9 +216,9 @@ public function createUser($user) * This function is currently not used within OJS or OMP, * but is reserved for future use. * - * @param $username string user to delete + * @param string $username user to delete * - * @return boolean true if successful + * @return bool true if successful */ public function deleteUser($username) { diff --git a/classes/plugins/BlockPlugin.inc.php b/classes/plugins/BlockPlugin.inc.php index 29e6a5024ed..b0c41059da9 100644 --- a/classes/plugins/BlockPlugin.inc.php +++ b/classes/plugins/BlockPlugin.inc.php @@ -23,9 +23,9 @@ abstract class BlockPlugin extends LazyLoadPlugin /** * Determine whether or not this plugin is currently enabled. * - * @param $contextId int Context ID (journal/press) + * @param int $contextId Context ID (journal/press) * - * @return boolean + * @return bool */ public function getEnabled($contextId = null) { @@ -35,8 +35,8 @@ public function getEnabled($contextId = null) /** * Set whether or not this plugin is currently enabled. * - * @param $enabled boolean - * @param $contextId int Context ID (journal/press) + * @param bool $enabled + * @param int $contextId Context ID (journal/press) */ public function setEnabled($enabled, $contextId = null) { @@ -59,8 +59,8 @@ public function getBlockTemplateFilename() /** * Get the HTML contents for this block. * - * @param $templateMgr object - * @param $request PKPRequest (Optional for legacy plugins) + * @param object $templateMgr + * @param PKPRequest $request (Optional for legacy plugins) * * @return string */ diff --git a/classes/plugins/GalleryPlugin.inc.php b/classes/plugins/GalleryPlugin.inc.php index d3a2715478e..aa2cc8659e0 100644 --- a/classes/plugins/GalleryPlugin.inc.php +++ b/classes/plugins/GalleryPlugin.inc.php @@ -29,7 +29,7 @@ class GalleryPlugin extends \PKP\core\DataObject /** * Get the localized name of the plugin * - * @param $preferredLocale string + * @param string $preferredLocale * * @return string */ @@ -41,8 +41,8 @@ public function getLocalizedName($preferredLocale = null) /** * Set the name of the plugin * - * @param $name string - * @param $locale string optional + * @param string $name + * @param string $locale optional */ public function setName($name, $locale = null) { @@ -52,7 +52,7 @@ public function setName($name, $locale = null) /** * Get the name of the plugin * - * @param $locale string optional + * @param string $locale optional * * @return string */ @@ -74,7 +74,7 @@ public function getHomepage() /** * Set the homepage for this plugin * - * @param $homepage string + * @param string $homepage */ public function setHomepage($homepage) { @@ -94,7 +94,7 @@ public function getProduct() /** * Set the product (symbolic name) for this plugin * - * @param $product string + * @param string $product */ public function setProduct($product) { @@ -114,7 +114,7 @@ public function getCategory() /** * Set the category for this plugin * - * @param $category string + * @param string $category */ public function setCategory($category) { @@ -124,7 +124,7 @@ public function setCategory($category) /** * Get the newest compatible version of this plugin * - * @param $pad boolean True iff returned version numbers should be + * @param bool $pad True iff returned version numbers should be * padded to 4 terms, e.g. 1.0.0.0 instead of just 1.0 * * @return string @@ -145,7 +145,7 @@ public function getVersion($pad = false) /** * Set the version for this plugin * - * @param $version string + * @param string $version */ public function setVersion($version) { @@ -165,7 +165,7 @@ public function getDate() /** * Set the release date for this plugin * - * @param $date int + * @param int $date */ public function setDate($date) { @@ -185,7 +185,7 @@ public function getContactName() /** * Set the contact name for this plugin * - * @param $contactName string + * @param string $contactName */ public function setContactName($contactName) { @@ -205,7 +205,7 @@ public function getContactInstitutionName() /** * Set the contact institution name for this plugin * - * @param $contactInstitutionName string + * @param string $contactInstitutionName */ public function setContactInstitutionName($contactInstitutionName) { @@ -225,7 +225,7 @@ public function getContactEmail() /** * Set the contact email for this plugin * - * @param $contactEmail string + * @param string $contactEmail */ public function setContactEmail($contactEmail) { @@ -235,7 +235,7 @@ public function setContactEmail($contactEmail) /** * Get plugin summary. * - * @param $locale string optional + * @param string $locale optional * * @return string */ @@ -247,8 +247,8 @@ public function getSummary($locale = null) /** * Set plugin summary. * - * @param $summary string - * @param $locale string optional + * @param string $summary + * @param string $locale optional */ public function setSummary($summary, $locale = null) { @@ -258,7 +258,7 @@ public function setSummary($summary, $locale = null) /** * Get plugin description. * - * @param $locale string optional + * @param string $locale optional * * @return string */ @@ -270,8 +270,8 @@ public function getDescription($locale = null) /** * Set plugin description. * - * @param $description string - * @param $locale string optional + * @param string $description + * @param string $locale optional */ public function setDescription($description, $locale = null) { @@ -281,7 +281,7 @@ public function setDescription($description, $locale = null) /** * Get plugin installation instructions. * - * @param $locale string optional + * @param string $locale optional * * @return string */ @@ -293,8 +293,8 @@ public function getInstallationInstructions($locale = null) /** * Set plugin installation instructions. * - * @param $installation string - * @param $locale string optional + * @param string $installation + * @param string $locale optional */ public function setInstallationInstructions($installation, $locale = null) { @@ -304,7 +304,7 @@ public function setInstallationInstructions($installation, $locale = null) /** * Get release description. * - * @param $locale string optional + * @param string $locale optional * * @return string */ @@ -316,8 +316,8 @@ public function getReleaseDescription($locale = null) /** * Set plugin release description. * - * @param $releaseDescription string - * @param $locale string optional + * @param string $releaseDescription + * @param string $locale optional */ public function setReleaseDescription($releaseDescription, $locale = null) { @@ -337,7 +337,7 @@ public function getReleaseMD5() /** * Set plugin release MD5. * - * @param $releaseMD5 string + * @param string $releaseMD5 */ public function setReleaseMD5($releaseMD5) { @@ -357,7 +357,7 @@ public function getReleaseCertifications() /** * Set the certifications for this plugin release * - * @param $certifications array + * @param array $certifications */ public function setReleaseCertifications($certifications) { diff --git a/classes/plugins/GatewayPlugin.inc.php b/classes/plugins/GatewayPlugin.inc.php index 2b2aed5f65f..401bdda912d 100644 --- a/classes/plugins/GatewayPlugin.inc.php +++ b/classes/plugins/GatewayPlugin.inc.php @@ -22,15 +22,15 @@ abstract class GatewayPlugin extends Plugin /** * Handle fetch requests for this plugin. * - * @param $args array - * @param $request object + * @param array $args + * @param object $request */ abstract public function fetch($args, $request); /** * Determine whether the plugin can be enabled. * - * @return boolean + * @return bool */ public function getCanEnable() { @@ -40,7 +40,7 @@ public function getCanEnable() /** * Determine whether the plugin can be disabled. * - * @return boolean + * @return bool */ public function getCanDisable() { @@ -50,7 +50,7 @@ public function getCanDisable() /** * Determine whether or not this plugin is currently enabled. * - * @return boolean + * @return bool */ public function getEnabled() { @@ -60,7 +60,7 @@ public function getEnabled() /** * Set whether or not this plugin is currently enabled. * - * @param $enabled boolean + * @param bool $enabled */ public function setEnabled($enabled) { @@ -80,7 +80,7 @@ public function getCurrentContextId() /** * Get policies to the authorization process * - * @param $request PKPRequest + * @param PKPRequest $request * * @return array Set of authorization policies */ diff --git a/classes/plugins/HookRegistry.inc.php b/classes/plugins/HookRegistry.inc.php index b97dc2964c6..343094436d0 100644 --- a/classes/plugins/HookRegistry.inc.php +++ b/classes/plugins/HookRegistry.inc.php @@ -27,7 +27,7 @@ class HookRegistry /** * Get the current set of hook registrations. * - * @param $hookName string Name of hook to optionally return + * @param string $hookName Name of hook to optionally return * * @return mixed Array of all hooks or just those attached to $hookName, or * null if nothing has been attached to $hookName @@ -52,8 +52,8 @@ public static function &getHooks($hookName = null) * Set the hooks table for the given hook name to the supplied array * of callbacks. * - * @param $hookName string Name of hook to set - * @param $callbacks array Array of callbacks for this hook + * @param string $hookName Name of hook to set + * @param array $callbacks Array of callbacks for this hook */ public static function setHooks($hookName, $callbacks) { @@ -64,7 +64,7 @@ public static function setHooks($hookName, $callbacks) /** * Clear hooks registered against the given name. * - * @param $hookName string Name of hook + * @param string $hookName Name of hook */ public static function clear($hookName) { @@ -76,9 +76,9 @@ public static function clear($hookName) /** * Register a hook against the given hook name. * - * @param $hookName string Name of hook to register against - * @param $callback object Callback pseudotype - * @param $hookSequence int Optional hook sequence specifier HOOK_SEQUENCE_... + * @param string $hookName Name of hook to register against + * @param object $callback Callback pseudotype + * @param int $hookSequence Optional hook sequence specifier HOOK_SEQUENCE_... */ public static function register($hookName, $callback, $hookSequence = HOOK_SEQUENCE_NORMAL) { @@ -94,8 +94,8 @@ public static function register($hookName, $callback, $hookSequence = HOOK_SEQUE * return value of this call will be the value returned by the last * callback. * - * @param $hookName string The name of the hook to register against - * @param $args string Hooks are called with this as the second param + * @param string $hookName The name of the hook to register against + * @param string $args Hooks are called with this as the second param */ public static function call($hookName, $args = null) { @@ -137,12 +137,12 @@ public static function call($hookName, $args = null) * Set/query the flag that triggers storing of * called hooks. * - * @param $askOnly boolean When set to true, the flag will not + * @param bool $askOnly When set to true, the flag will not * be changed but only returned. - * @param $updateTo boolean When $askOnly is set to 'true' then + * @param bool $updateTo When $askOnly is set to 'true' then * this parameter defines the value of the flag. * - * @return boolean The current value of the flag. + * @return bool The current value of the flag. */ public static function rememberCalledHooks($askOnly = false, $updateTo = true) { @@ -157,7 +157,7 @@ public static function rememberCalledHooks($askOnly = false, $updateTo = true) * Switch off the function to store hooks and delete all stored hooks. * Always call this after using otherwise we get a severe memory. * - * @param $leaveAlive boolean Set this to true if you only want to + * @param bool $leaveAlive Set this to true if you only want to * delete hooks stored so far but if you want to record future * hook calls, too. */ diff --git a/classes/plugins/ImportExportPlugin.inc.php b/classes/plugins/ImportExportPlugin.inc.php index e9210a4142b..0abf57ce587 100644 --- a/classes/plugins/ImportExportPlugin.inc.php +++ b/classes/plugins/ImportExportPlugin.inc.php @@ -40,15 +40,15 @@ abstract class ImportExportPlugin extends Plugin /** * Execute import/export tasks using the command-line interface. * - * @param $scriptName The name of the command-line script (displayed as usage info) - * @param $args Parameters to the plugin + * @param string $scriptName The name of the command-line script (displayed as usage info) + * @param array $args Parameters to the plugin */ abstract public function executeCLI($scriptName, &$args); /** * Display the command-line usage information * - * @param $scriptName string + * @param string $scriptName */ abstract public function usage($scriptName); @@ -81,8 +81,8 @@ public function getActions($request, $actionArgs) /** * Display the import/export plugin. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function display($args, $request) { @@ -110,8 +110,8 @@ public function display($args, $request) * * @see calling conventions at http://www.smarty.net/docsv2/en/api.register.function.tpl * - * @param $params array - * @param $smarty Smarty + * @param array $params + * @param Smarty $smarty * * @return string */ @@ -125,7 +125,7 @@ public function pluginUrl($params, $smarty) * Check if this is a relative path to the xml document * that describes public identifiers to be imported. * - * @param $url string path to the xml file + * @param string $url path to the xml file */ public function isRelativePath($url) { @@ -142,9 +142,9 @@ public function isRelativePath($url) /** * Determine whether the specified URL describes an allowed protocol. * - * @param $url string + * @param string $url * - * @return boolean + * @return bool */ public function isAllowedMethod($url) { @@ -185,10 +185,10 @@ public function getExportPath() /** * Return the whole export file name. * - * @param $basePath string Base path for temporary file storage - * @param $objectsFileNamePart string Part different for each object type. - * @param $context Context - * @param $extension string + * @param string $basePath Base path for temporary file storage + * @param string $objectsFileNamePart Part different for each object type. + * @param Context $context + * @param string $extension * * @return string */ @@ -200,8 +200,8 @@ public function getExportFileName($basePath, $objectsFileNamePart, $context, $ex /** * Display XML validation errors. * - * @param $errors array - * @param $xml string + * @param array $errors + * @param string $xml */ public function displayXMLValidationErrors($errors, $xml) { @@ -251,9 +251,9 @@ public function getDeployment() /** * Get the submissions and proceed to the export * - * @param $submissionIds array Array of submissions to export - * @param $deployment PKPNativeImportExportDeployment - * @param $opts array + * @param array $submissionIds Array of submissions to export + * @param PKPNativeImportExportDeployment $deployment + * @param array $opts */ public function getExportSubmissionsDeployment($submissionIds, $deployment, $opts = []) { @@ -274,7 +274,7 @@ public function getExportSubmissionsDeployment($submissionIds, $deployment, $opt /** * Save the export result as an XML * - * @param $deployment PKPNativeImportExportDeployment + * @param PKPNativeImportExportDeployment $deployment * * @return string */ @@ -294,9 +294,9 @@ public function exportResultXML($deployment) /** * Gets template result for the export process * - * @param $deployment PKPNativeImportExportDeployment - * @param $templateMgr PKPTemplateManager - * @param $exportFileName string + * @param PKPNativeImportExportDeployment $deployment + * @param PKPTemplateManager $templateMgr + * @param string $exportFileName * * @return string */ @@ -329,10 +329,10 @@ public function getExportTemplateResult($deployment, $templateMgr, $exportFileNa /** * Gets template result for the import process * - * @param $filter string - * @param $xmlString string - * @param $deployment PKPNativeImportExportDeployment - * @param $templateMgr PKPTemplateManager + * @param string $filter + * @param string $xmlString + * @param PKPNativeImportExportDeployment $deployment + * @param PKPTemplateManager $templateMgr * * @return string */ @@ -360,8 +360,8 @@ public function getImportTemplateResult($filter, $xmlString, $deployment, $templ /** * Gets the imported file path * - * @param $temporaryFileId int - * @param $user User + * @param int $temporaryFileId + * @param User $user * * @return string */ @@ -385,10 +385,10 @@ public function getImportedFilePath($temporaryFileId, $user) /** * Gets a tab to display after the import/export operation is over * - * @param $request PKPRequest - * @param $title string - * @param $bounceUrl string - * @param $bounceParameterArray array + * @param PKPRequest $request + * @param string $title + * @param string $bounceUrl + * @param array $bounceParameterArray * * @return string */ @@ -415,7 +415,7 @@ public function getBounceTab($request, $title, $bounceUrl, $bounceParameterArray /** * Download file given it's name * - * @param $exportFileName string + * @param string $exportFileName */ public function downloadExportedFile($exportFileName) { @@ -427,9 +427,9 @@ public function downloadExportedFile($exportFileName) /** * Create file given it's name and content * - * @param $filename string - * @param $fileContent string - * @param $context Context + * @param string $filename + * @param string $fileContent + * @param Context $context * * @return string */ diff --git a/classes/plugins/LazyLoadPlugin.inc.php b/classes/plugins/LazyLoadPlugin.inc.php index 8dc6f3ba6d5..48938c2ce45 100644 --- a/classes/plugins/LazyLoadPlugin.inc.php +++ b/classes/plugins/LazyLoadPlugin.inc.php @@ -61,13 +61,13 @@ public function getName() /** * Determine whether or not this plugin is currently enabled. * - * @param $contextId integer To identify if the plugin is enabled + * @param int $contextId To identify if the plugin is enabled * we need a context. This context is usually taken from the * request but sometimes there is no context in the request * (e.g. when executing CLI commands). Then the main context * can be given as an explicit ID. * - * @return boolean + * @return bool */ public function getEnabled($contextId = null) { @@ -83,7 +83,7 @@ public function getEnabled($contextId = null) /** * Set whether or not this plugin is currently enabled. * - * @param $enabled boolean + * @param bool $enabled */ public function setEnabled($enabled) { diff --git a/classes/plugins/MetadataPlugin.inc.php b/classes/plugins/MetadataPlugin.inc.php index ea503ad5039..e36233521d3 100644 --- a/classes/plugins/MetadataPlugin.inc.php +++ b/classes/plugins/MetadataPlugin.inc.php @@ -37,7 +37,7 @@ public function register($category, $path, $mainContextId = null) /** * Get a unique id for this metadata format * - * @param $format string The format to check for support. + * @param string $format The format to check for support. * * @return string */ @@ -46,7 +46,7 @@ abstract public function supportsFormat($format); /** * Instantiate and return the schema object for this metadata format * - * @param $format string The format to return the schema object for in case + * @param string $format The format to return the schema object for in case * the plugin supports multiple formats. */ abstract public function getSchemaObject($format); diff --git a/classes/plugins/PKPPubIdPlugin.inc.php b/classes/plugins/PKPPubIdPlugin.inc.php index ca7fe41320c..30a5cb03846 100644 --- a/classes/plugins/PKPPubIdPlugin.inc.php +++ b/classes/plugins/PKPPubIdPlugin.inc.php @@ -125,7 +125,7 @@ public function manage($args, $request) /** * Get the public identifier. * - * @param $pubObject object + * @param object $pubObject * Submission, Representation, SubmissionFile + OJS Issue * * @return string @@ -135,9 +135,9 @@ abstract public function getPubId($pubObject); /** * Construct the public identifier from its prefix and suffix. * - * @param $pubIdPrefix string - * @param $pubIdSuffix string - * @param $contextId integer + * @param string $pubIdPrefix + * @param string $pubIdSuffix + * @param int $contextId * * @return string */ @@ -168,8 +168,8 @@ abstract public function getPubIdFullName(); /** * Get the whole resolving URL. * - * @param $contextId integer - * @param $pubId string + * @param int $contextId + * @param string $pubId * * @return string resolving URL */ @@ -187,8 +187,8 @@ abstract public function getPubIdMetadataFile(); /** * Add JavaScript files to be loaded in the metadata file. * - * @param $request PKPRequest - * @param $templateMgr PKPTemplateManager + * @param PKPRequest $request + * @param PKPTemplateManager $templateMgr */ public function addJavaScript($request, $templateMgr) { @@ -206,7 +206,7 @@ abstract public function getPubIdAssignFile(); /** * Get the settings form. * - * @param $contextId integer + * @param int $contextId * * @return object Settings form */ @@ -280,10 +280,10 @@ public function getPubObjectTypes() /** * Is this object type enabled in plugin settings * - * @param $pubObjectType object - * @param $contextId integer + * @param object $pubObjectType + * @param int $contextId * - * @return boolean + * @return bool */ abstract public function isObjectTypeEnabled($pubObjectType, $contextId); @@ -297,13 +297,13 @@ abstract public function getNotUniqueErrorMsg(); /** * Verify form data. * - * @param $fieldName string The form field to be checked. - * @param $fieldValue string The value of the form field. - * @param $pubObject object - * @param $contextId integer - * @param $errorMsg string Return validation error messages here. + * @param string $fieldName The form field to be checked. + * @param string $fieldValue The value of the form field. + * @param object $pubObject + * @param int $contextId + * @param string $errorMsg Return validation error messages here. * - * @return boolean + * @return bool */ public function verifyData($fieldName, $fieldValue, $pubObject, $contextId, &$errorMsg) { @@ -331,9 +331,9 @@ public function verifyData($fieldName, $fieldValue, $pubObject, $contextId, &$er /** * Check whether the given pubId is valid. * - * @param $pubId string + * @param string $pubId * - * @return boolean + * @return bool */ public function validatePubId($pubId) { @@ -352,17 +352,17 @@ public function getDAOs() Repo::publication()->dao, Repo::submission()->dao, Application::getRepresentationDAO(), - Repo::submissionFiles()->dao, + Repo::submissionFile()->dao, ]; } /** * Can a pub id be assigned to the object. * - * @param $pubObject object + * @param object $pubObject * Submission, Representation, SubmissionFile + OJS Issue * - * @return boolean + * @return bool * false, if the pub id contains an unresolved pattern i.e. '%' or * if the custom suffix is empty i.e. the pub id null. */ @@ -392,8 +392,8 @@ public function canBeAssigned($pubObject) * * @see PKPPubIdPlugin::getAdditionalFieldNames() * - * @param $hookName string `Schema::get::publication` - * @param $params array + * @param string $hookName `Schema::get::publication` + * @param array $params */ public function addToSchema($hookName, $params) { @@ -415,8 +415,8 @@ public function addToSchema($hookName, $params) * * @see PKPPubIdPlugin::addToSchema() * - * @param $hookName string - * @param $params array + * @param string $hookName + * @param array $params */ public function getAdditionalFieldNames($hookName, $params) { @@ -430,7 +430,7 @@ public function getAdditionalFieldNames($hookName, $params) /** * Return the object type. * - * @param $pubObject object + * @param object $pubObject * * @return string? */ @@ -455,8 +455,8 @@ public function getPubObjectType($pubObject) /** * Set and store a public identifier. * - * @param $pubObject object - * @param $pubId string + * @param object $pubObject + * @param string $pubId */ public function setStoredPubId(&$pubObject, $pubId) { @@ -475,12 +475,12 @@ public function setStoredPubId(&$pubObject, $pubId) * Checks to see if a pubId has already been assigned to any object * in the context. * - * @param $pubId string - * @param $pubObjectType string Class name of the pub object being checked - * @param $excludeId integer This object id will not be checked for duplicates - * @param $contextId integer + * @param string $pubId + * @param string $pubObjectType Class name of the pub object being checked + * @param int $excludeId This object id will not be checked for duplicates + * @param int $contextId * - * @return boolean + * @return bool */ public function checkDuplicate($pubId, $pubObjectType, $excludeId, $contextId) { @@ -490,7 +490,7 @@ public function checkDuplicate($pubId, $pubObjectType, $excludeId, $contextId) } elseif ($type === 'Representation') { $typeDao = Application::getRepresentationDAO(); } elseif ($type === 'SubmissionFile') { - $typeDao = Repo::submissionFiles()->dao; + $typeDao = Repo::submissionFile()->dao; } $excludeTypeId = $type === $pubObjectType ? $excludeId : null; if (isset($typeDao) && $typeDao->pubIdExists($this->getPubIdType(), $pubId, $excludeTypeId, $contextId)) { @@ -504,7 +504,7 @@ public function checkDuplicate($pubId, $pubObjectType, $excludeId, $contextId) /** * Get the context object. * - * @param $contextId integer + * @param int $contextId * * @return object Context */ diff --git a/classes/plugins/PKPPubIdPluginDAO.inc.php b/classes/plugins/PKPPubIdPluginDAO.inc.php index 354caaf2184..1b60cff527b 100644 --- a/classes/plugins/PKPPubIdPluginDAO.inc.php +++ b/classes/plugins/PKPPubIdPluginDAO.inc.php @@ -21,33 +21,33 @@ interface PKPPubIdPluginDAO * Checks if public identifier exists (other than for the specified * submission ID, which is treated as an exception). * - * @param $pubIdType string One of the NLM pub-id-type values or + * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). - * @param $pubId string - * @param $excludePubObjectId int ID of the pub object to be excluded from the search. - * @param $contextId int + * @param string $pubId + * @param int $excludePubObjectId ID of the pub object to be excluded from the search. + * @param int $contextId * - * @return boolean + * @return bool */ public function pubIdExists($pubIdType, $pubId, $excludePubObjectId, $contextId); /** * Change the public ID of a submission. * - * @param $pubObjectId int ID of the pub object - * @param $pubIdType string One of the NLM pub-id-type values or + * @param int $pubObjectId ID of the pub object + * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). - * @param $pubId string + * @param string $pubId */ public function changePubId($pubObjectId, $pubIdType, $pubId); /** * Delete the public ID of a submission. * - * @param $pubObjectId int ID of the pub object - * @param $pubIdType string One of the NLM pub-id-type values or + * @param int $pubObjectId ID of the pub object + * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). */ @@ -56,8 +56,8 @@ public function deletePubId($pubObjectId, $pubIdType); /** * Delete the public IDs of all submissions in this context. * - * @param $contextId int - * @param $pubIdType string One of the NLM pub-id-type values or + * @param int $contextId + * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). */ diff --git a/classes/plugins/PKPPubIdPluginHelper.inc.php b/classes/plugins/PKPPubIdPluginHelper.inc.php index e6cdd73caba..48d136cb4ed 100644 --- a/classes/plugins/PKPPubIdPluginHelper.inc.php +++ b/classes/plugins/PKPPubIdPluginHelper.inc.php @@ -22,9 +22,9 @@ class PKPPubIdPluginHelper /** * Validate the additional form fields from public identifier plugins. * - * @param $contextId integer - * @param $form object PKPPublicIdentifiersForm - * @param $pubObject object + * @param int $contextId + * @param object $form PKPPublicIdentifiersForm + * @param object $pubObject * Submission, Representation, SubmissionFile + OJS Issue */ public function validate($contextId, $form, $pubObject) @@ -47,9 +47,9 @@ public function validate($contextId, $form, $pubObject) /** * Set form link actions. * - * @param $contextId integer - * @param $form object PKPPublicIdentifiersForm - * @param $pubObject object + * @param int $contextId + * @param object $form PKPPublicIdentifiersForm + * @param object $pubObject * Submission, Representation, SubmissionFile + OJS Issue */ public function setLinkActions($contextId, $form, $pubObject) @@ -69,9 +69,9 @@ public function setLinkActions($contextId, $form, $pubObject) /** * Add pub id plugins JavaScripts. * - * @param $contextId integer - * @param $request PKPRequest - * @param $templateMgr PKPTemplateManager + * @param int $contextId + * @param PKPRequest $request + * @param PKPTemplateManager $templateMgr */ public function addJavaScripts($contextId, $request, $templateMgr) { @@ -86,9 +86,9 @@ public function addJavaScripts($contextId, $request, $templateMgr) /** * Init the additional form fields from public identifier plugins. * - * @param $contextId integer - * @param $form object PKPPublicIdentifiersForm|CatalogEntryFormatMetadataForm - * @param $pubObject object + * @param int $contextId + * @param object $form PKPPublicIdentifiersForm|CatalogEntryFormatMetadataForm + * @param object $pubObject * Submission, Representation, SubmissionFile + OJS Issue */ public function init($contextId, $form, $pubObject) @@ -109,8 +109,8 @@ public function init($contextId, $form, $pubObject) /** * Read the additional input data from public identifier plugins. * - * @param $contextId integer - * @param $form object PKPPublicIdentifiersForm + * @param int $contextId + * @param object $form PKPPublicIdentifiersForm */ public function readInputData($contextId, $form) { @@ -126,7 +126,7 @@ public function readInputData($contextId, $form) /** * Read the the public identifiers' assign form field data. * - * @param $form object Form containing the assign check box + * @param object $form Form containing the assign check box * PKPAssignPublicIdentifiersForm * OJS IssueEntryPublicationMetadataForm */ @@ -145,9 +145,9 @@ public function readAssignInputData($form) /** * Set the additional data from public identifier plugins. * - * @param $contextId integer - * @param $form object PKPPublicIdentifiersForm - * @param $pubObject object + * @param int $contextId + * @param object $form PKPPublicIdentifiersForm + * @param object $pubObject * Submission, Representation, SubmissionFile + OJS Issue */ public function execute($contextId, $form, $pubObject) @@ -176,10 +176,10 @@ public function execute($contextId, $form, $pubObject) /** * Assign public identifier. * - * @param $contextId integer - * @param $form object - * @param $pubObject object - * @param $save boolean Whether the pub id shall be saved here + * @param int $contextId + * @param object $form + * @param object $pubObject + * @param bool $save Whether the pub id shall be saved here * Submission, Representation, SubmissionFile + OJS Issue */ public function assignPubId($contextId, $form, $pubObject, $save = false) @@ -202,9 +202,9 @@ public function assignPubId($contextId, $form, $pubObject, $save = false) /** * Clear a pubId from a pubObject. * - * @param $contextId integer - * @param $pubIdPlugInClassName string - * @param $pubObject object + * @param int $contextId + * @param string $pubIdPlugInClassName + * @param object $pubObject * Submission, Representation, SubmissionFile + OJS Issue */ public function clearPubId($contextId, $pubIdPlugInClassName, $pubObject) diff --git a/classes/plugins/PaymethodPlugin.inc.php b/classes/plugins/PaymethodPlugin.inc.php index 007dc1a073f..b2a47e3a844 100644 --- a/classes/plugins/PaymethodPlugin.inc.php +++ b/classes/plugins/PaymethodPlugin.inc.php @@ -20,8 +20,8 @@ abstract class PaymethodPlugin extends LazyLoadPlugin /** * Get the payment form for this plugin. * - * @param $context Context - * @param $queuedPayment QueuedPayment + * @param Context $context + * @param QueuedPayment $queuedPayment * * @return Form */ @@ -30,9 +30,9 @@ abstract public function getPaymentForm($context, $queuedPayment); /** * Check whether this plugin is fully configured and ready for use. * - * @param $context Context + * @param Context $context * - * @return boolean + * @return bool */ public function isConfigured($context) { @@ -42,9 +42,9 @@ public function isConfigured($context) /** * Save settings for this payment method * - * @param $params array Params that have already been - * @param $slimRequest Request Slim request object - * @param $request Request + * @param array $params Params that have already been + * @param Request $slimRequest Slim request object + * @param Request $request * * @return array List of errors */ diff --git a/classes/plugins/Plugin.inc.php b/classes/plugins/Plugin.inc.php index 3dae71c1c43..f01601a6d19 100644 --- a/classes/plugins/Plugin.inc.php +++ b/classes/plugins/Plugin.inc.php @@ -94,15 +94,15 @@ public function __construct() * registerOn() matches the current request operation. An empty array * matches all request operations. * - * @param $category String Name of category plugin was registered to - * @param $path String The path the plugin was found in - * @param $mainContextId integer To identify if the plugin is enabled + * @param string $category Name of category plugin was registered to + * @param string $path The path the plugin was found in + * @param int $mainContextId To identify if the plugin is enabled * we need a context. This context is usually taken from the * request but sometimes there is no context in the request * (e.g. when executing CLI commands). Then the main context * can be given as an explicit ID. * - * @return boolean True iff plugin registered successfully; if false, + * @return bool True iff plugin registered successfully; if false, * the plugin will not be executed. */ public function register($category, $path, $mainContextId = null) @@ -172,7 +172,7 @@ abstract public function getDescription(); * should be registered compared to others of its category. * Higher = later. * - * @return integer + * @return int */ public function getSeq() { @@ -182,7 +182,7 @@ public function getSeq() /** * Site-wide plugins should override this function to return true. * - * @return boolean + * @return bool */ public function isSitePlugin() { @@ -192,8 +192,8 @@ public function isSitePlugin() /** * Perform a management function. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage A JSON-encoded response */ @@ -207,7 +207,7 @@ public function manage($args, $request) * management interface. Useful in the case of derivative plugins, * i.e. when a generic plugin registers a feed plugin. * - * @return boolean + * @return bool */ public function getHideManagement() { @@ -314,7 +314,7 @@ public function getInstallFilterConfigFiles() /** * Get the name of the category this plugin is registered to. * - * @return String category + * @return string category */ public function getCategory() { @@ -324,7 +324,7 @@ public function getCategory() /** * Get the path this plugin's files are located in. * - * @return String pathname + * @return string pathname */ public function getPluginPath() { @@ -334,7 +334,7 @@ public function getPluginPath() /** * Get the directory name of the plugin * - * @return String directory name + * @return string directory name */ public function getDirName() { @@ -345,8 +345,8 @@ public function getDirName() * Return the Resource Name for templates in this plugin, or if specified, the full resource locator * for a specific template. * - * @param $template Template path/filename, if desired - * @param $inCore boolean True if a "core" template should be used. + * @param Template $template path/filename, if desired + * @param bool $inCore True if a "core" template should be used. * * @return string */ @@ -375,7 +375,7 @@ public function getTemplateResource($template = null, $inCore = false) /** * Return the canonical template path of this plug-in * - * @param $inCore Return the core template path if true. + * @param bool $inCore Return the core template path if true. * * @return string|null */ @@ -391,7 +391,7 @@ public function getTemplatePath($inCore = false) /** * Register this plugin's templates as a template resource * - * @param $inCore boolean True iff this is a core resource. + * @param bool $inCore True iff this is a core resource. */ protected function _registerTemplateResource($inCore = false) { @@ -408,14 +408,14 @@ protected function _registerTemplateResource($inCore = false) * override template files by adding their own templates to: * /templates/plugins///templates/.tpl * - * @param $hookName string TemplateResource::getFilename - * @param $args array [ + * @param string $hookName TemplateResource::getFilename + * @param array $args [ * @option string File path to preferred template. Leave as-is to not * override template. * @option string Template file requested * ] * - * @return boolean + * @return bool */ public function _overridePluginTemplates($hookName, $args) { @@ -445,7 +445,7 @@ public function _overridePluginTemplates($hookName, $args) /** * Recursive check for existing templates * - * @param $path string + * @param string $path * * @return string|null */ @@ -478,9 +478,9 @@ private function _findOverriddenTemplate($path) /** * Load locale data for this plugin. * - * @param $locale string|null + * @param string|null $locale * - * @return boolean + * @return bool */ public function addLocaleData($locale = null) { @@ -497,8 +497,8 @@ public function addLocaleData($locale = null) /** * Retrieve a plugin setting within the given context * - * @param $contextId int Context ID - * @param $name string Setting name + * @param int $contextId Context ID + * @param string $name Setting name */ public function getSetting($contextId, $name) { @@ -520,10 +520,10 @@ public function getSetting($contextId, $name) /** * Update a plugin setting within the given context. * - * @param $contextId int Context ID - * @param $name string The name of the setting - * @param $value mixed Setting value - * @param $type string optional + * @param int $contextId Context ID + * @param string $name The name of the setting + * @param mixed $value Setting value + * @param string $type optional */ public function updateSetting($contextId, $name, $value, $type = null) { @@ -544,7 +544,7 @@ public function updateSetting($contextId, $name, $value, $type = null) /** * Load a PHP file from this plugin's installation directory. * - * @param $class string + * @param string $class */ public function import($class) { @@ -561,7 +561,7 @@ public function import($class) * Get the filename for the locale data for this plugin. * (Warning: This function is used by the custom locale plugin) * - * @param $locale string + * @param string $locale * * @return array The locale file names. */ @@ -582,10 +582,10 @@ public function getLocaleFilename($locale) /** * Callback used to install settings on system install. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * - * @return boolean + * @return bool */ public function installSiteSettings($hookName, $args) { @@ -609,10 +609,10 @@ public function installSiteSettings($hookName, $args) * Callback used to install settings on new context * (e.g. journal, conference or press) creation. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * - * @return boolean + * @return bool */ public function installContextSpecificSettings($hookName, $args) { @@ -625,10 +625,10 @@ public function installContextSpecificSettings($hookName, $args) /** * Callback used to install email templates. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * - * @return boolean + * @return bool */ public function installEmailTemplates($hookName, $args) { @@ -660,10 +660,10 @@ public function installEmailTemplates($hookName, $args) * * @deprecated Email template data should be installed via installEmailTemplates (pkp/pkp-lib#5461) * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * - * @return boolean + * @return bool */ public function installEmailTemplateData($hookName, $args) { @@ -689,10 +689,10 @@ public function installEmailTemplateData($hookName, $args) /** * Callback used to install email template data on locale install. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * - * @return boolean + * @return bool */ public function installLocale($hookName, $args) { @@ -716,13 +716,13 @@ public function installLocale($hookName, $args) /** * Callback used to install filters. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args */ public function installFilters($hookName, $args) { $installer = & $args[0]; /** @var Installer $installer */ - $result = & $args[1]; /** @var boolean $result */ + $result = & $args[1]; /** @var bool $result */ // Get the filter configuration file name(s). $filterConfigFiles = $this->getInstallFilterConfigFiles(); @@ -754,10 +754,10 @@ public function installFilters($hookName, $args) * Called during the install process to install the plugin schema, * if applicable. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * - * @return boolean + * @return bool */ public function updateSchema($hookName, $args) { @@ -778,8 +778,8 @@ public function updateSchema($hookName, $args) /** * Extend the {url ...} smarty to support plugins. * - * @param $params array - * @param $smarty Smarty + * @param array $params + * @param Smarty $smarty * * @return string */ @@ -835,8 +835,8 @@ public function &getRequest() /** * Get a list of link actions for plugin management. * - * @param request PKPRequest - * @param $actionArgs array The list of action args to be included in request URLs. + * @param PKPRequest $request + * @param array $actionArgs The list of action args to be included in request URLs. * * @return array List of LinkActions */ @@ -848,7 +848,7 @@ public function getActions($request, $actionArgs) /** * Determine whether the plugin can be enabled. * - * @return boolean + * @return bool */ public function getCanEnable() { @@ -858,7 +858,7 @@ public function getCanEnable() /** * Determine whether the plugin can be disabled. * - * @return boolean + * @return bool */ public function getCanDisable() { @@ -868,7 +868,7 @@ public function getCanDisable() /** * Determine whether the plugin is enabled. * - * @return boolean + * @return bool */ public function getEnabled() { diff --git a/classes/plugins/PluginGalleryDAO.inc.php b/classes/plugins/PluginGalleryDAO.inc.php index 7fb7c6f3adf..0f476c8d20e 100644 --- a/classes/plugins/PluginGalleryDAO.inc.php +++ b/classes/plugins/PluginGalleryDAO.inc.php @@ -49,9 +49,9 @@ class PluginGalleryDAO extends \PKP\db\DAO * Get a set of GalleryPlugin objects describing the available * compatible plugins in their newest versions. * - * @param $application PKPApplication - * @param $category string Optional category name to use as filter - * @param $search string Optional text to use as filter + * @param PKPApplication $application + * @param string $category Optional category name to use as filter + * @param string $search Optional text to use as filter * * @return array GalleryPlugin objects */ @@ -167,10 +167,10 @@ public function newDataObject() * Build a GalleryPlugin from a DOM element, using the newest compatible * release with the supplied Application. * - * @param $element DOMElement - * @param $application Application + * @param DOMElement $element + * @param Application $application * - * @return GalleryPlugin or null, if no compatible plugin was available + * @return GalleryPlugin|null, if no compatible plugin was available */ protected function _compatibleFromElement($element, $application) { @@ -224,7 +224,7 @@ protected function _compatibleFromElement($element, $application) /** * Handle a maintainer element * - * @param $plugin GalleryPlugin + * @param GalleryPlugin $plugin */ public function _handleMaintainer($element, $plugin) { @@ -252,8 +252,8 @@ public function _handleMaintainer($element, $plugin) /** * Handle a release element * - * @param $plugin GalleryPlugin - * @param $application PKPApplication + * @param GalleryPlugin $plugin + * @param PKPApplication $application */ public function _handleRelease($element, $plugin, $application) { @@ -309,10 +309,10 @@ public function _handleRelease($element, $plugin, $application) * Handle a compatibility element, fishing out the most recent statement * of compatibility. * - * @param $plugin GalleryPlugin - * @param $application PKPApplication + * @param GalleryPlugin $plugin + * @param PKPApplication $application * - * @return boolean True iff a compatibility statement matched this app + * @return bool True iff a compatibility statement matched this app */ public function _handleCompatibility($element, $plugin, $application) { diff --git a/classes/plugins/PluginHelper.inc.php b/classes/plugins/PluginHelper.inc.php index 79d07a44a9e..f949abcdbd4 100644 --- a/classes/plugins/PluginHelper.inc.php +++ b/classes/plugins/PluginHelper.inc.php @@ -40,8 +40,8 @@ class PluginHelper /** * Extract and validate a plugin (prior to installation) * - * @param $filePath string Full path to plugin archive - * @param $originalFileName string Original filename of plugin archive + * @param string $filePath Full path to plugin archive + * @param string $originalFileName Original filename of plugin archive * * @return string Extracted plugin path */ @@ -93,7 +93,7 @@ public function extractPlugin($filePath, $originalFileName) /** * Installs an extracted plugin * - * @param $path string path to plugin Directory + * @param string $path path to plugin Directory * * @return Version Version of installed plugin on success */ @@ -152,11 +152,11 @@ public function installPlugin($path) /** * Checks to see if local version of plugin is newer than installed version * - * @param $productType string Product type of plugin - * @param $productName string Product name of plugin - * @param $newVersion Version Version object of plugin to check against database + * @param string $productType Product type of plugin + * @param string $productName Product name of plugin + * @param Version $newVersion Version object of plugin to check against database * - * @return boolean + * @return bool */ protected function _checkIfNewer($productType, $productName, $newVersion) { @@ -189,9 +189,9 @@ protected function _getConnectionParams() /** * Upgrade a plugin to a newer version from the user's filesystem * - * @param $category string - * @param $plugin string - * @param $path string path to plugin Directory + * @param string $category + * @param string $plugin + * @param string $path path to plugin Directory * * @return Version */ diff --git a/classes/plugins/PluginRegistry.inc.php b/classes/plugins/PluginRegistry.inc.php index 67dc6b907c2..7795a8d142b 100644 --- a/classes/plugins/PluginRegistry.inc.php +++ b/classes/plugins/PluginRegistry.inc.php @@ -35,7 +35,7 @@ class PluginRegistry * category is not specified, all plugins in an associative array of * arrays by category. * - * @param $category String the name of the category to retrieve + * @param string $category the name of the category to retrieve * * @return array */ @@ -73,16 +73,16 @@ public static function getAllPlugins() /** * Register a plugin with the registry in the given category. * - * @param $category String the name of the category to extend - * @param $plugin The instantiated plugin to add - * @param $path The path the plugin was found in - * @param $mainContextId integer To identify enabled plug-ins + * @param string $category the name of the category to extend + * @param Plugin $plugin The instantiated plugin to add + * @param string $path The path the plugin was found in + * @param int $mainContextId To identify enabled plug-ins * we need a context. This context is usually taken from the * request but sometimes there is no context in the request * (e.g. when executing CLI commands). Then the main context * can be given as an explicit ID. * - * @return boolean True IFF the plugin was registered successfully + * @return bool True IFF the plugin was registered successfully */ public static function register($category, $plugin, $path, $mainContextId = null) { @@ -101,8 +101,8 @@ public static function register($category, $plugin, $path, $mainContextId = null /** * Get a plugin by name. * - * @param $category String category name - * @param $name String plugin name + * @param string $category category name + * @param string $name plugin name * * @return Plugin? */ @@ -115,11 +115,11 @@ public static function getPlugin($category, $name) /** * Load all plugins for a given category. * - * @param $category string The name of the category to load - * @param $enabledOnly boolean if true load only enabled + * @param string $category The name of the category to load + * @param bool $enabledOnly if true load only enabled * plug-ins (db-installation required), otherwise look on * disk and load all available plug-ins (no db required). - * @param $mainContextId integer To identify enabled plug-ins + * @param int $mainContextId To identify enabled plug-ins * we need a context. This context is usually taken from the * request but sometimes there is no context in the request * (e.g. when executing CLI commands). Then the main context @@ -196,9 +196,9 @@ public static function loadCategory($category, $enabledOnly = false, $mainContex * Similar to loadCategory, except that it only loads a single plugin * within a category rather than loading all. * - * @param $category string - * @param $pathName string - * @param $mainContextId integer To identify enabled plug-ins + * @param string $category + * @param string $pathName + * @param int $mainContextId To identify enabled plug-ins * we need a context. This context is usually taken from the * request but sometimes there is no context in the request * (e.g. when executing CLI commands). Then the main context @@ -243,7 +243,7 @@ public static function getCategories() /** * Load all plugins in the system and return them in a single array. * - * @param $enabledOnly boolean load only enabled plug-ins + * @param bool $enabledOnly load only enabled plug-ins * * @return array Set of all plugins */ @@ -268,10 +268,10 @@ public static function loadAllPlugins($enabledOnly = false) * * This method can be called statically. * - * @param $category string - * @param $categoryDir string - * @param $file string - * @param $classToCheck string set null to maintain pre-2.3.x backwards compatibility + * @param string $category + * @param string $categoryDir + * @param string $file + * @param string $classToCheck set null to maintain pre-2.3.x backwards compatibility * * @return Plugin? */ diff --git a/classes/plugins/PluginSettingsDAO.inc.php b/classes/plugins/PluginSettingsDAO.inc.php index deb593ca69b..f16ddbe7342 100644 --- a/classes/plugins/PluginSettingsDAO.inc.php +++ b/classes/plugins/PluginSettingsDAO.inc.php @@ -25,8 +25,8 @@ class PluginSettingsDAO extends \PKP\db\DAO /** * Get the cache for plugin settings. * - * @param $contextId int Context ID - * @param $pluginName string Plugin symbolic name + * @param int $contextId Context ID + * @param string $pluginName Plugin symbolic name * * @return Cache */ @@ -54,9 +54,9 @@ public function _getCache($contextId, $pluginName) /** * Retrieve a plugin setting value. * - * @param $contextId int Context ID - * @param $pluginName string Plugin symbolic name - * @param $name Setting name + * @param int $contextId Context ID + * @param string $pluginName Plugin symbolic name + * @param string $name Setting name */ public function getSetting($contextId, $pluginName, $name) { @@ -71,11 +71,11 @@ public function getSetting($contextId, $pluginName, $name) /** * Does the plugin setting exist. * - * @param $contextId int Context ID - * @param $pluginName string Plugin symbolic name - * @param $name Setting name + * @param int $contextId Context ID + * @param string $pluginName Plugin symbolic name + * @param string $name Setting name * - * @return boolean + * @return bool */ public function settingExists($contextId, $pluginName, $name) { @@ -91,8 +91,8 @@ public function settingExists($contextId, $pluginName, $name) /** * Callback for a cache miss. * - * @param $cache Cache object - * @param $id string Identifier to look up in cache + * @param object $cache Cache object + * @param string $id Identifier to look up in cache */ public function _cacheMiss($cache, $id) { @@ -110,8 +110,8 @@ public function _cacheMiss($cache, $id) /** * Retrieve and cache all settings for a plugin. * - * @param $contextId int Context ID - * @param $pluginName string Plugin symbolic name + * @param int $contextId Context ID + * @param string $pluginName Plugin symbolic name * * @return array */ @@ -139,11 +139,11 @@ public function getPluginSettings($contextId, $pluginName) /** * Add/update a plugin setting. * - * @param $contextId int Context ID - * @param $pluginName string Symbolic plugin name - * @param $name string Setting name - * @param $value mixed Setting value - * @param $type string data type of the setting. If omitted, type will be guessed + * @param int $contextId Context ID + * @param string $pluginName Symbolic plugin name + * @param string $name Setting name + * @param mixed $value Setting value + * @param string $type data type of the setting. If omitted, type will be guessed * * @return int Return value from ADODB's replace() function. */ @@ -173,9 +173,9 @@ public function updateSetting($contextId, $pluginName, $name, $value, $type = nu /** * Delete a plugin setting. * - * @param $contextId int - * @param $pluginName int - * @param $name string + * @param int $contextId + * @param int $pluginName + * @param string $name */ public function deleteSetting($contextId, $pluginName, $name) { @@ -194,8 +194,8 @@ public function deleteSetting($contextId, $pluginName, $name) /** * Delete all settings for a plugin. * - * @param $contextId int - * @param $pluginName string + * @param int $contextId + * @param string $pluginName */ public function deleteSettingsByPlugin($contextId, $pluginName) { @@ -214,7 +214,7 @@ public function deleteSettingsByPlugin($contextId, $pluginName) /** * Delete all settings for a context. * - * @param $contextId int + * @param int $contextId */ public function deleteByContextId($contextId) { @@ -227,8 +227,8 @@ public function deleteByContextId($contextId) /** * Used internally by installSettings to perform variable and translation replacements. * - * @param $rawInput string contains text including variable and/or translate replacements. - * @param $paramArray array contains variables for replacement + * @param string $rawInput contains text including variable and/or translate replacements. + * @param array $paramArray contains variables for replacement * * @return string */ @@ -247,8 +247,8 @@ public function _performReplacement($rawInput, $paramArray = []) * Used internally by installSettings to recursively build nested arrays. * Deals with translation and variable replacement calls. * - * @param $node object XMLNode tag - * @param $paramArray array Parameters to be replaced in key/value contents + * @param object $node XMLNode tag + * @param array $paramArray Parameters to be replaced in key/value contents */ public function _buildObject($node, $paramArray = []) { @@ -274,9 +274,9 @@ public function _buildObject($node, $paramArray = []) /** * Install plugin settings from an XML file. * - * @param $pluginName name of plugin for settings to apply to - * @param $filename string Name of XML file to parse and install - * @param $paramArray array Optional parameters for variable replacement in settings + * @param string $pluginName name of plugin for settings to apply to + * @param string $filename Name of XML file to parse and install + * @param array $paramArray Optional parameters for variable replacement in settings */ public function installSettings($contextId, $pluginName, $filename, $paramArray = []) { @@ -321,7 +321,7 @@ public function installSettings($contextId, $pluginName, $filename, $paramArray * Used internally by plugin setting installation code to perform translation * function. * - * @param $matches array + * @param array $matches * * @return string */ diff --git a/classes/plugins/ReportPlugin.inc.php b/classes/plugins/ReportPlugin.inc.php index b929586ff4e..6566d23d2fd 100644 --- a/classes/plugins/ReportPlugin.inc.php +++ b/classes/plugins/ReportPlugin.inc.php @@ -31,11 +31,11 @@ abstract class ReportPlugin extends Plugin * @see * for a full specification of the input and output format of this method. * - * @param $metricType null|string|array metrics selection - * @param $columns string|array column (aggregation level) selection - * @param $filters array report-level filter selection - * @param $orderBy array order criteria - * @param $range null|DBResultRange paging specification + * @param null|string|array $metricType metrics selection + * @param string|array $columns column (aggregation level) selection + * @param array $filters report-level filter selection + * @param array $orderBy order criteria + * @param null|DBResultRange $range paging specification * * @return null|array The selected data as a simple tabular result set or * null if metrics are not supported by this plug-in, the specified report @@ -60,7 +60,7 @@ public function getMetricTypes() /** * Public metric type that will be displayed to end users. * - * @param $metricType string One of the values returned from getMetricTypes() + * @param string $metricType One of the values returned from getMetricTypes() * * @return null|string The metric type or null if the plug-in does not support * standard metric retrieval or the metric type was not found. @@ -73,7 +73,7 @@ public function getMetricDisplayType($metricType) /** * Full name of the metric type. * - * @param $metricType string One of the values returned from getMetricTypes() + * @param string $metricType One of the values returned from getMetricTypes() * * @return null|string The full name of the metric type or null if the * plug-in does not support standard metric retrieval or the metric type @@ -88,7 +88,7 @@ public function getMetricFullName($metricType) * Get the columns used in reports by the passed * metric type. * - * @param $metricType string One of the values returned from getMetricTypes() + * @param string $metricType One of the values returned from getMetricTypes() * * @return null|array Return an array with STATISTICS_DIMENSION_... * constants. @@ -102,7 +102,7 @@ public function getColumns($metricType) * Get optional columns that are not required for this report * to implement the passed metric type. * - * @param $metricType string One of the values returned from getMetricTypes() + * @param string $metricType One of the values returned from getMetricTypes() * * @return array Return an array with STATISTICS_DIMENSION_... * constants. @@ -116,7 +116,7 @@ public function getOptionalColumns($metricType) * Get the object types that the passed metric type * counts statistics for. * - * @param $metricType string One of the values returned from getMetricTypes() + * @param string $metricType One of the values returned from getMetricTypes() * * @return null|array Return an array with ASSOC_TYPE_... * constants. @@ -132,7 +132,7 @@ public function getObjectTypes($metricType) * Subclasses can override this method to add/remove * default formats. * - * @param $metricTypes string|array|null Define one or more metric types + * @param string|array|null $metricTypes Define one or more metric types * if you don't want to use all the implemented report metric types. * * @return array diff --git a/classes/plugins/ThemePlugin.inc.php b/classes/plugins/ThemePlugin.inc.php index 0556894662b..a1db01082da 100644 --- a/classes/plugins/ThemePlugin.inc.php +++ b/classes/plugins/ThemePlugin.inc.php @@ -110,7 +110,7 @@ public function register($category, $path, $mainContextId = null) /** * Fire the init() method when a theme is registered * - * @param $themes array List of all loaded themes + * @param array $themes List of all loaded themes */ public function themeRegistered($themes) { @@ -152,7 +152,7 @@ public function initAfter() * in a given context. Use self::getEnabled() if you want to know if the * theme is available for use on the site. * - * @return boolean + * @return bool */ public function isActive() { @@ -177,11 +177,11 @@ public function isActive() * Style paths with a .less extension will be compiled and redirected to * the compiled file. * - * @param $name string A name for this stylesheet - * @param $style string The stylesheet. Should be a path relative to the + * @param string $name A name for this stylesheet + * @param string $style The stylesheet. Should be a path relative to the * theme directory or, if the `inline` argument is included, style data to * be output. - * @param $args array Optional arguments hash. Supported args: + * @param array $args Optional arguments hash. Supported args: * 'context': Whether to load this on the `frontend` or `backend`. * default: `frontend` * 'priority': Controls order in which styles are printed @@ -225,8 +225,8 @@ public function addStyle($name, $style, $args = []) /** * Modify the params of an existing stylesheet * - * @param $name string The name of the stylesheet to modify - * @param $args array Parameters to modify. + * @param string $name The name of the stylesheet to modify + * @param array $args Parameters to modify. * * @see self::addStyle() */ @@ -254,7 +254,7 @@ public function modifyStyle($name, $args = []) /** * Remove a registered stylesheet * - * @param $name string The name of the stylesheet to remove + * @param string $name The name of the stylesheet to remove * * @return bool Whether or not the stylesheet was found and removed. */ @@ -271,7 +271,7 @@ public function removeStyle($name) /** * Get a style from this theme or any parent theme * - * @param $name string The name of the style to retrieve + * @param string $name The name of the style to retrieve * * @return array|null Reference to the style or null if not found */ @@ -296,11 +296,11 @@ public function &getStyle($name) /** * Add a script to load with this theme * - * @param $name string A name for this script - * @param $script string The script to be included. Should be path relative + * @param string $name A name for this script + * @param string $script The script to be included. Should be path relative * to the theme or, if the `inline` argument is included, script data to * be output. - * @param $args array Optional arguments hash. Supported args: + * @param array $args Optional arguments hash. Supported args: * `context` string Whether to load this on the `frontend` or `backend`. * default: frontend * `priority` int Controls order in which scripts are printed @@ -324,8 +324,8 @@ public function addScript($name, $script, $args = []) /** * Modify the params of an existing script * - * @param $name string The name of the script to modify - * @param $args array Parameters to modify. + * @param string $name The name of the script to modify + * @param array $args Parameters to modify. * * @see self::addScript() */ @@ -347,7 +347,7 @@ public function modifyScript($name, $args = []) /** * Remove a registered script * - * @param $name string The name of the script to remove + * @param string $name The name of the script to remove * * @return bool Whether or not the stylesheet was found and removed. */ @@ -364,7 +364,7 @@ public function removeScript($name) /** * Get a script from this theme or any parent theme * - * @param $name string The name of the script to retrieve + * @param string $name The name of the script to retrieve * * @return array|null Reference to the script or null if not found */ @@ -392,9 +392,9 @@ public function &getScript($name) * Appearance form when this theme is activated. Common options are * colour and typography selectors. * - * @param $name string Unique name for this setting - * @param $type string One of the Field* class names - * @param $args array Optional parameters defining this setting. Some setting + * @param string $name Unique name for this setting + * @param string $type One of the Field* class names + * @param array $args Optional parameters defining this setting. Some setting * types may accept or require additional arguments. * `label` string Locale key for a label for this field. * `description` string Locale key for a description for this field. @@ -456,7 +456,7 @@ public function addOption($name, $type, $args = []) /** * Get the value of an option or default if the option is not set * - * @param $name string The name of the option value to retrieve + * @param string $name The name of the option value to retrieve * * @return mixed The value of the option. Will return a default if set in * the option config. False if no option exists. Null if no value or default @@ -496,7 +496,7 @@ public function getOption($name) * This retrives option settings for any option attached to this theme or * any parent theme. * - * @param $name The name of the option config to retrieve + * @param string $name The name of the option config to retrieve * * @return false|array The config array for this option. Or false if no * config is found. @@ -537,8 +537,8 @@ public function getOptionsConfig() * so changes can be made directly (via reference) and args don't need to be * manually merged * - * @param $name The name of the option config to retrieve - * @param $args The new configuration settings for this option + * @param string $name The name of the option config to retrieve + * @param array $args The new configuration settings for this option * * @return bool Whether the option was found and the config was updated. */ @@ -555,7 +555,7 @@ public function modifyOptionsConfig($name, $args = []) /** * Remove an option * - * @param $name The name of the option to remove + * @param string $name The name of the option to remove * * @return bool Whether the option was found and removed */ @@ -575,7 +575,7 @@ public function removeOption($name) * This retrieves a single array containing option values for this theme * and any parent themes. * - * @param $contextId int + * @param int $contextId * * @return array */ @@ -621,11 +621,11 @@ public function getOptionValues($contextId) * If this is a child theme, you must call $this->parent->validateOptions() to * perform any validation defined on the parent theme. * - * @param $options array Key/value list of options to validate - * @param $themePluginPath string The theme these options are for - * @param $contextId int The context these theme options are for, or + * @param array $options Key/value list of options to validate + * @param string $themePluginPath The theme these options are for + * @param int $contextId The context these theme options are for, or * CONTEXT_ID_NONE for the site-wide settings. - * @param $request Request + * @param Request $request * * @return array List of errors with option name as the key and the value as * an array of error messages. Example: @@ -643,9 +643,9 @@ public function validateOptions($options, $themePluginPath, $contextId, $request /** * Sanitize and save a theme option * - * @param $name string A unique id for the option to save - * @param $value mixed The new value to save - * @param $contextId int Optional context id. Defaults to the current + * @param string $name A unique id for the option to save + * @param mixed $value The new value to save + * @param int $contextId Optional context id. Defaults to the current * context */ public function saveOption($name, $value, $contextId = null) @@ -676,7 +676,7 @@ public function saveOption($name, $value, $contextId = null) /** * Register a navigation menu area for this theme * - * @param $menuAreas string|array One or more menu area names + * @param string|array $menuAreas One or more menu area names */ public function addMenuArea($menuAreas) { @@ -690,7 +690,7 @@ public function addMenuArea($menuAreas) /** * Remove a registered navigation menu area * - * @param $menuArea string The menu area to remove + * @param string $menuArea The menu area to remove * * @return bool Whether or not the menuArea was found and removed. */ @@ -708,7 +708,7 @@ public function removeMenuArea($menuArea) /** * Get all menu areas registered by this theme and any parents * - * @param $existingAreas array Any existing menu areas from child themes + * @param array $existingAreas Any existing menu areas from child themes * * @return array All menua reas */ @@ -722,7 +722,7 @@ public function getMenuAreas($existingAreas = []) /** * Set a parent theme for this theme * - * @param $parent string Key in the plugin registry for the parent theme + * @param string $parent Key in the plugin registry for the parent theme */ public function setParent($parent) { @@ -827,7 +827,7 @@ public function _registerScripts() * also be set to the @baseUrl variable before LESS files are compiloed so * that images and fonts can be located. * - * @param $path string An optional path to append to the base + * @param string $path An optional path to append to the base * * @return string */ @@ -841,7 +841,7 @@ public function _getBaseUrl($path = '') /** * Get the base path to be used for file references * - * @param $path string An optional path to append to the base + * @param string $path An optional path to append to the base * * @return string */ diff --git a/classes/plugins/importexport/PKPImportExportDeployment.inc.php b/classes/plugins/importexport/PKPImportExportDeployment.inc.php index 3978404fc11..682f3bbf565 100644 --- a/classes/plugins/importexport/PKPImportExportDeployment.inc.php +++ b/classes/plugins/importexport/PKPImportExportDeployment.inc.php @@ -77,8 +77,8 @@ class PKPImportExportDeployment /** * Constructor * - * @param $context Context - * @param $user User optional + * @param Context $context + * @param User $user optional */ public function __construct($context, $user = null) { @@ -150,7 +150,7 @@ public function getSchemaFilename() /** * Set the import/export context. * - * @param $context Context + * @param Context $context */ public function setContext($context) { @@ -170,7 +170,7 @@ public function getContext() /** * Set the import/export submission. * - * @param $submission Submission + * @param Submission $submission */ public function setSubmission($submission) { @@ -193,7 +193,7 @@ public function getSubmission() /** * Set the import/export publication. * - * @param $publication PKPPublication + * @param PKPPublication $publication */ public function setPublication($publication) { @@ -216,8 +216,8 @@ public function getPublication() /** * Add the processed object ID. * - * @param $assocType integer ASSOC_TYPE_... - * @param $assocId integer + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId */ public function addProcessedObjectId($assocType, $assocId) { @@ -227,9 +227,9 @@ public function addProcessedObjectId($assocType, $assocId) /** * Add the error message to the processed object ID. * - * @param $assocType integer ASSOC_TYPE_... - * @param $assocId integer - * @param $errorMsg string + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId + * @param string $errorMsg */ public function addError($assocType, $assocId, $errorMsg) { @@ -239,9 +239,9 @@ public function addError($assocType, $assocId, $errorMsg) /** * Add the warning message to the processed object ID. * - * @param $assocType integer ASSOC_TYPE_... - * @param $assocId integer - * @param $warningMsg string + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId + * @param string $warningMsg */ public function addWarning($assocType, $assocId, $warningMsg) { @@ -251,7 +251,7 @@ public function addWarning($assocType, $assocId, $warningMsg) /** * Get the processed objects IDs. * - * @param $assocType integer ASSOC_TYPE_... + * @param int $assocType ASSOC_TYPE_... * * @return array */ @@ -266,7 +266,7 @@ public function getProcessedObjectsIds($assocType) /** * Get the processed objects errors. * - * @param $assocType integer ASSOC_TYPE_... + * @param int $assocType ASSOC_TYPE_... * * @return array */ @@ -280,7 +280,7 @@ public function getProcessedObjectsErrors($assocType) /** * Get the processed objects errors. * - * @param $assocType integer ASSOC_TYPE_... + * @param int $assocType ASSOC_TYPE_... * * @return array */ @@ -296,7 +296,7 @@ public function getProcessedObjectsWarnings($assocType) /** * Remove the processed objects. * - * @param $assocType integer ASSOC_TYPE_... + * @param int $assocType ASSOC_TYPE_... */ public function removeImportedObjects($assocType) { @@ -317,7 +317,7 @@ public function removeImportedObjects($assocType) /** * Set the import/export user. * - * @param $user User + * @param User $user */ public function setUser($user) { @@ -347,7 +347,7 @@ public function getFileDBIds() /** * Set the array of the inserted file DB Ids. * - * @param $fileDBIds array + * @param array $fileDBIds */ public function setFileDBIds($fileDBIds) { @@ -357,9 +357,9 @@ public function setFileDBIds($fileDBIds) /** * Get the file DB Id. * - * @param $fileId integer The old file id + * @param int $fileId The old file id * - * @return integer The new file id + * @return int The new file id */ public function getFileDBId($fileId) { @@ -372,8 +372,8 @@ public function getFileDBId($fileId) /** * Set the file DB Id. * - * @param $fileId integer The old file id - * @param $DBId integer The new file id + * @param int $fileId The old file id + * @param int $DBId The new file id */ public function setFileDBId($fileId, $DBId) { @@ -393,7 +393,7 @@ public function getSubmissionFileDBIds() /** * Set the array of the inserted submission file DB Ids. * - * @param $submissionFileDBIds array + * @param array $submissionFileDBIds */ public function setSubmissionFileDBIds($submissionFileDBIds) { @@ -403,7 +403,7 @@ public function setSubmissionFileDBIds($submissionFileDBIds) /** * Get the submission file DB Id. * - * @return integer The new submission file id + * @return int The new submission file id */ public function getSubmissionFileDBId($submissionFileDBId) { @@ -416,8 +416,8 @@ public function getSubmissionFileDBId($submissionFileDBId) /** * Set the submission file DB Id. * - * @param $submissionFileDBId integer The old submission file id - * @param $DBId integer The new submission file id + * @param int $submissionFileDBId The old submission file id + * @param int $DBId The new submission file id */ public function setSubmissionFileDBId($submissionFileDBId, $DBId) { @@ -427,7 +427,7 @@ public function setSubmissionFileDBId($submissionFileDBId, $DBId) /** * Set the array of the inserted author DB Ids. * - * @param $authorDBIds array + * @param array $authorDBIds */ public function setAuthorDBIds($authorDBIds) { @@ -447,9 +447,9 @@ public function getAuthorDBIds() /** * Get the author DB Id. * - * @param $authorId integer + * @param int $authorId * - * @return integer? + * @return int? */ public function getAuthorDBId($authorId) { @@ -463,8 +463,8 @@ public function getAuthorDBId($authorId) /** * Set the author DB Id. * - * @param $authorId integer - * @param $DBId integer + * @param int $authorId + * @param int $DBId */ public function setAuthorDBId($authorId, $DBId) { @@ -474,7 +474,7 @@ public function setAuthorDBId($authorId, $DBId) /** * Set the directory location for the import source * - * @param $path string + * @param string $path */ public function setImportPath($path) { @@ -494,7 +494,7 @@ public function getImportPath() /** * Add the imported root entities. * - * @param $assocType integer ASSOC_TYPE_... + * @param int $assocType ASSOC_TYPE_... */ public function addImportedRootEntity($assocType, $entity) { @@ -504,7 +504,7 @@ public function addImportedRootEntity($assocType, $entity) /** * Get the imported root entities. * - * @param $assocType integer ASSOC_TYPE_... + * @param int $assocType ASSOC_TYPE_... */ public function getImportedRootEntities($assocType) { @@ -518,7 +518,7 @@ public function getImportedRootEntities($assocType) /** * Set export root entities * - * @param $exportRootEntities array + * @param array $exportRootEntities */ public function setExportRootEntities($exportRootEntities) { @@ -538,8 +538,8 @@ public function getExportRootEntities() /** * Wraps the import process * - * @param $rootFilter string - * @param $importXml string + * @param string $rootFilter + * @param string $importXml */ public function import($rootFilter, $importXml) { @@ -573,9 +573,9 @@ public function import($rootFilter, $importXml) /** * Wraps the export process * - * @param $rootFilter string - * @param $exportObjects array - * @param $opts array + * @param string $rootFilter + * @param array $exportObjects + * @param array $opts */ public function export($rootFilter, $exportObjects, $opts = []) { @@ -638,7 +638,7 @@ protected function getObjectTypes() /** * Get object type string. * - * @param $assocType mixed int or null (optional) + * @param mixed $assocType int or null (optional) * * @return mixed string or array */ diff --git a/classes/plugins/importexport/PKPImportExportFilter.inc.php b/classes/plugins/importexport/PKPImportExportFilter.inc.php index b8092d0694c..2cadb01eab2 100644 --- a/classes/plugins/importexport/PKPImportExportFilter.inc.php +++ b/classes/plugins/importexport/PKPImportExportFilter.inc.php @@ -32,7 +32,7 @@ class PKPImportExportFilter extends PersistableFilter /** * Set the import/export deployment * - * @param $deployment NativeImportExportDeployment + * @param NativeImportExportDeployment $deployment */ public function setDeployment($deployment) { @@ -52,9 +52,9 @@ public function getDeployment() /** * Static method that gets the filter object given its name * - * @param $filter string - * @param $deployment PKPImportExportDeployment - * @param $opts array + * @param string $filter + * @param PKPImportExportDeployment $deployment + * @param array $opts * * @return Filter */ diff --git a/classes/publication/DAO.inc.php b/classes/publication/DAO.inc.php index d5c004cbe70..bb3f04d5899 100644 --- a/classes/publication/DAO.inc.php +++ b/classes/publication/DAO.inc.php @@ -17,7 +17,6 @@ use APP\publication\Publication; use Illuminate\Support\Collection; use Illuminate\Support\Enumerable; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Illuminate\Support\LazyCollection; use PKP\citation\CitationDAO; @@ -28,7 +27,6 @@ use PKP\submission\SubmissionKeywordDAO; use PKP\submission\SubmissionLanguageDAO; use PKP\submission\SubmissionSubjectDAO; -use stdClass; class DAO extends EntityDAO { @@ -89,7 +87,7 @@ public function __construct( */ public function newDataObject(): Publication { - return App::make(Publication::class); + return app(Publication::class); } /** @@ -141,9 +139,9 @@ public function getMany(Collector $query): LazyCollection * Get the publication dates of the first and last publications * matching the passed query * - * @return stdClass self::$min_date_published, self::$max_date_published + * @return object self::$min_date_published, self::$max_date_published */ - public function getDateBoundaries(Collector $query): stdClass + public function getDateBoundaries(Collector $query): object { return $query ->getQueryBuilder() @@ -179,7 +177,7 @@ public function isDuplicateUrlPath(string $urlPath, int $submissionId, int $cont /** * @copydoc EntityDAO::fromRow() */ - public function fromRow(stdClass $row): Publication + public function fromRow(object $row): Publication { $publication = parent::fromRow($row); @@ -386,7 +384,7 @@ protected function setAuthors(Publication $publication) Repo::author() ->getCollector() ->filterByPublicationIds([$publication->getId()]) - ->orderBy(Repo::author()->getCollector()::ORDERBY_ID) + ->orderBy(Repo::author()->getCollector()::ORDERBY_SEQUENCE) ) ); } diff --git a/classes/publication/PKPPublication.inc.php b/classes/publication/PKPPublication.inc.php index c3f468915f6..3e24da6fa51 100644 --- a/classes/publication/PKPPublication.inc.php +++ b/classes/publication/PKPPublication.inc.php @@ -33,9 +33,9 @@ class PKPPublication extends \PKP\core\DataObject * - the publication's primary locale * - the first locale we find data for * - * @param $key string - * @param $preferredLocale string - * @param $selectedLocale Optional reference to receive locale used for return value. + * @param string $key + * @param string $preferredLocale + * @param string $selectedLocale Optional reference to receive locale used for return value. */ public function getLocalizedData($key, $preferredLocale = null, &$selectedLocale = null) { @@ -145,10 +145,11 @@ public function getTitles() * Eg - Daniel Barnes, Carlo Corino (Author); Alan Mwandenga (Translator) * * @param array $userGroups List of UserGroup objects + * @param bool $includeInBrowseOnly true if only the includeInBrowse Authors will be contained * * @return string */ - public function getAuthorString($userGroups) + public function getAuthorString($userGroups, $includeInBrowseOnly = false) { $authors = $this->getData('authors'); @@ -156,6 +157,12 @@ public function getAuthorString($userGroups) return ''; } + if ($includeInBrowseOnly) { + $authors = $authors->filter(function ($author, $key) { + return $author->getData('includeInBrowse'); + }); + } + $str = ''; $lastUserGroupId = null; foreach ($authors as $author) { @@ -212,9 +219,9 @@ public function getShortAuthorString($defaultLocale = null) $firstAuthor = $authors->first(); - $str = $firstAuthor->getLocalizedFamilyName(); + $str = $firstAuthor->getLocalizedData('familyName', $defaultLocale); if (!$str) { - $str = $firstAuthor->getLocalizedGivenName(); + $str = $firstAuthor->getLocalizedData('givenName', $defaultLocale); } if ($authors->count() > 1) { @@ -329,7 +336,7 @@ public function getPageArray() /** * Is the license for copyright on this publication a Creative Commons license? * - * @return boolean + * @return bool */ public function isCCLicense() { diff --git a/classes/publication/Repository.inc.php b/classes/publication/Repository.inc.php index ae70d0ec0f0..ab61d3ec021 100644 --- a/classes/publication/Repository.inc.php +++ b/classes/publication/Repository.inc.php @@ -24,7 +24,6 @@ use APP\submission\Submission; use Illuminate\Support\Collection; use Illuminate\Support\Enumerable; -use Illuminate\Support\Facades\App; use Illuminate\Support\LazyCollection; use PKP\core\Core; use PKP\db\DAORegistry; @@ -33,9 +32,9 @@ use PKP\log\SubmissionLog; use PKP\plugins\HookRegistry; use PKP\services\PKPSchemaService; +use PKP\submission\Genre; use PKP\submission\PKPSubmission; use PKP\validation\ValidatorFactory; -use stdClass; abstract class Repository { @@ -101,20 +100,24 @@ public function getMany(Collector $query): LazyCollection /** @copydoc DAO::getCollector() */ public function getCollector(): Collector { - return App::make(Collector::class); + return app(Collector::class); } /** * Get an instance of the map class for mapping * publications to their schema + * + * @param UserGroup[] $userGroups + * @param Genre[] $genres */ - public function getSchemaMap(Submission $submission, array $userGroups): maps\Schema + public function getSchemaMap(Submission $submission, array $userGroups, array $genres): maps\Schema { return app('maps')->withExtensions( $this->schemaMap, [ 'submission' => $submission, 'userGroups' => $userGroups, + 'genres' => $genres, ] ); } @@ -126,7 +129,7 @@ public function getIdsBySetting(string $settingName, $settingValue, int $context } /** @copydoc DAO:: getDateBoundaries()*/ - public function getDateBoundaries(Collector $query): stdClass + public function getDateBoundaries(Collector $query): object { return $this->dao->getDateBoundaries($query); } @@ -225,7 +228,7 @@ public function validate(?Publication $publication, array $props, array $allowed ); if ($validator->fails()) { - $errors = $this->schemaService->formatValidationErrors($validator->errors(), $this->schemaService->get($this->dao->schema), $allowedLocales); + $errors = $this->schemaService->formatValidationErrors($validator->errors()); } HookRegistry::call('Publication::validate', [&$errors, $publication, $props, $allowedLocales, $primaryLocale]); @@ -539,9 +542,9 @@ public function delete(Publication $publication) * file ID if a new file has been uploaded. * @param string $settingName The name of the setting to save, typically used * in the filename. - * @param integer $userId ID of the user who owns the temporary file + * @param int $userId ID of the user who owns the temporary file * @param string $localeKey Optional. Pass if the setting is multilingual - * @param boolean $isImage Optional. For image files which include alt text in value + * @param bool $isImage Optional. For image files which include alt text in value * * @return string|array|bool New param value or false on failure */ diff --git a/classes/publication/maps/Schema.inc.php b/classes/publication/maps/Schema.inc.php index 510fde6484f..5ee37b3c311 100644 --- a/classes/publication/maps/Schema.inc.php +++ b/classes/publication/maps/Schema.inc.php @@ -22,14 +22,16 @@ use Illuminate\Support\Enumerable; use PKP\context\Context; use PKP\db\DAORegistry; +use PKP\security\UserGroup; use PKP\services\PKPSchemaService; +use PKP\submission\Genre; class Schema extends \PKP\core\maps\Schema { - /** @var Enumerable */ + /** */ public Enumerable $collection; - /** @var string */ + /** */ public string $schema = PKPSchemaService::SCHEMA_PUBLICATION; /** @var Submission */ @@ -38,14 +40,18 @@ class Schema extends \PKP\core\maps\Schema /** @var bool */ public $anonymize; - /** @var array The user groups for this context. */ + /** @var UserGroup[] The user groups for this context. */ public $userGroups; - public function __construct(Submission $submission, array $userGroups, Request $request, Context $context, PKPSchemaService $schemaService) + /** @var Genre[] The file genres for this context. */ + public array $genres; + + public function __construct(Submission $submission, array $userGroups, array $genres, Request $request, Context $context, PKPSchemaService $schemaService) { parent::__construct($request, $context, $schemaService); $this->submission = $submission; $this->userGroups = $userGroups; + $this->genres = $genres; } /** @@ -121,6 +127,9 @@ protected function mapByProperties(array $props, Publication $publication, bool case 'authorsString': $output[$prop] = $this->anonymize ? '' : $publication->getAuthorString($this->userGroups); break; + case 'authorsStringIncludeInBrowse': + $output[$prop] = $this->anonymize ? '' : $publication->getAuthorString($this->userGroups, true); + break; case 'authorsStringShort': $output[$prop] = $this->anonymize ? '' : $publication->getShortAuthorString(); break; diff --git a/classes/query/Query.inc.php b/classes/query/Query.inc.php index 6eaa8be8d7e..8dd900abaeb 100644 --- a/classes/query/Query.inc.php +++ b/classes/query/Query.inc.php @@ -18,6 +18,7 @@ namespace PKP\query; use PKP\db\DAORegistry; +use PKP\note\Note; use PKP\note\NoteDAO; class Query extends \PKP\core\DataObject @@ -35,7 +36,7 @@ public function getAssocType() /** * Set query assoc type * - * @param $assocType int ASSOC_TYPE_... + * @param int $assocType ASSOC_TYPE_... */ public function setAssocType($assocType) { @@ -55,7 +56,7 @@ public function getAssocId() /** * Set query assoc ID * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -75,7 +76,7 @@ public function getStageId() /** * Set stage ID * - * @param $stageId int + * @param int $stageId */ public function setStageId($stageId) { @@ -95,7 +96,7 @@ public function getSequence() /** * Set sequence of query. * - * @param $sequence float + * @param float $sequence */ public function setSequence($sequence) { @@ -105,7 +106,7 @@ public function setSequence($sequence) /** * Get closed flag * - * @return boolean + * @return bool */ public function getIsClosed() { @@ -115,7 +116,7 @@ public function getIsClosed() /** * Set closed flag * - * @param $isClosed boolean + * @param bool $isClosed */ public function setIsClosed($isClosed) { @@ -136,10 +137,10 @@ public function getHeadNote() /** * Get all notes on a query. * - * @param $userId int Optional user ID - * @param $sortBy int Optional NoteDAO::NOTE_ORDER_... - * @param $sortOrder int Optional SORT_DIRECTION_... - * @param $isAdmin bool Optional user sees all + * @param int $userId Optional user ID + * @param int $sortBy Optional NoteDAO::NOTE_ORDER_... + * @param int $sortOrder Optional SORT_DIRECTION_... + * @param bool $isAdmin Optional user sees all * * @return DAOResultFactory */ diff --git a/classes/query/QueryDAO.inc.php b/classes/query/QueryDAO.inc.php index e1105839b87..f205acded4c 100644 --- a/classes/query/QueryDAO.inc.php +++ b/classes/query/QueryDAO.inc.php @@ -17,6 +17,10 @@ namespace PKP\query; +use APP\core\Application; +use APP\notification\Notification; +use APP\notification\NotificationManager; +use PKP\core\Core; use PKP\db\DAORegistry; use PKP\db\DAOResultFactory; use PKP\plugins\HookRegistry; @@ -26,9 +30,9 @@ class QueryDAO extends \PKP\db\DAO /** * Retrieve a submission query by ID. * - * @param $queryId int Query ID - * @param $assocType int Optional ASSOC_TYPE_... - * @param $assocId int Optional assoc ID per assocType + * @param int $queryId Query ID + * @param int $assocType Optional ASSOC_TYPE_... + * @param int $assocId Optional assoc ID per assocType * * @return Query */ @@ -53,10 +57,10 @@ public function getById($queryId, $assocType = null, $assocId = null) /** * Retrieve all queries by association * - * @param $assocType int ASSOC_TYPE_... - * @param $assocId int Assoc ID - * @param $stageId int Optional stage ID - * @param $userId int Optional user ID; when set, show only assigned queries + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId Assoc ID + * @param int $stageId Optional stage ID + * @param int $userId Optional user ID; when set, show only assigned queries * * @return array Query */ @@ -98,7 +102,7 @@ public function getByAssoc($assocType, $assocId, $stageId = null, $userId = null /** * Internal function to return a submission query object from a row. * - * @param $row array + * @param array $row * * @return Query */ @@ -129,7 +133,7 @@ public function newDataObject() /** * Insert a new Query. * - * @param $query Query + * @param Query $query * * @return int New query ID */ @@ -153,8 +157,8 @@ public function insertObject($query) /** * Adds a participant to a query. * - * @param $queryId int Query ID - * @param $userId int User ID + * @param int $queryId Query ID + * @param int $userId User ID */ public function insertParticipant($queryId, $userId) { @@ -170,8 +174,8 @@ public function insertParticipant($queryId, $userId) /** * Removes a participant from a query. * - * @param $queryId int Query ID - * @param $userId int User ID + * @param int $queryId Query ID + * @param int $userId User ID */ public function removeParticipant($queryId, $userId) { @@ -184,7 +188,7 @@ public function removeParticipant($queryId, $userId) /** * Removes all participants from a query. * - * @param $queryId int Query ID + * @param int $queryId Query ID */ public function removeAllParticipants($queryId) { @@ -197,8 +201,8 @@ public function removeAllParticipants($queryId) /** * Retrieve all participant user IDs for a query. * - * @param $queryId int Query ID - * @param $userId int User ID to restrict results to + * @param int $queryId Query ID + * @param int $userId User ID to restrict results to * * @return array */ @@ -225,7 +229,7 @@ public function getParticipantIds($queryId, $userId = null) /** * Update an existing Query. * - * @param $query Query + * @param Query $query */ public function updateObject($query) { @@ -251,7 +255,7 @@ public function updateObject($query) /** * Delete a submission query. * - * @param $query Query + * @param Query $query */ public function deleteObject($query) { @@ -261,9 +265,9 @@ public function deleteObject($query) /** * Delete a submission query by ID. * - * @param $queryId int Query ID - * @param $assocType int Optional ASSOC_TYPE_... - * @param $assocId int Optional assoc ID per assocType + * @param int $queryId Query ID + * @param int $assocType Optional ASSOC_TYPE_... + * @param int $assocId Optional assoc ID per assocType */ public function deleteById($queryId, $assocType = null, $assocId = null) { @@ -295,8 +299,8 @@ public function deleteById($queryId, $assocType = null, $assocId = null) /** * Sequentially renumber queries in their sequence order. * - * @param $assocType int ASSOC_TYPE_... - * @param $assocId int Assoc ID per assocType + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId Assoc ID per assocType */ public function resequence($assocType, $assocId) { @@ -324,8 +328,8 @@ public function getInsertId() /** * Delete queries by assoc info. * - * @param $assocType int ASSOC_TYPE_... - * @param $assocId int Assoc ID per assocType + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId Assoc ID per assocType */ public function deleteByAssoc($assocType, $assocId) { @@ -334,6 +338,61 @@ public function deleteByAssoc($assocType, $assocId) $this->deleteObject($query); } } + + /** + * Add a query when a recommendation (editor decision type) is made + */ + public function addRecommendationQuery(int $recommenderUserId, int $submissionId, int $stageId, string $title, string $content): int + { + $query = $this->newDataObject(); + $query->setAssocType(Application::ASSOC_TYPE_SUBMISSION); + $query->setAssocId($submissionId); + $query->setStageId($stageId); + $query->setSequence(REALLY_BIG_NUMBER); + $this->insertObject($query); + $this->resequence(Application::ASSOC_TYPE_SUBMISSION, $submissionId); + + // Add the decision making editors as discussion participants + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ + $discussionParticipantsIds = []; + $editorsStageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($submissionId, $stageId); + foreach ($editorsStageAssignments as $editorsStageAssignment) { + if (!$editorsStageAssignment->getRecommendOnly()) { + if (!in_array($editorsStageAssignment->getUserId(), $discussionParticipantsIds)) { + $discussionParticipantsIds[] = $editorsStageAssignment->getUserId(); + $this->insertParticipant($query->getId(), $editorsStageAssignment->getUserId()); + } + } + } + + // Add the message + $noteDao = DAORegistry::getDAO('NoteDAO'); /** @var NoteDAO $noteDao */ + $note = $noteDao->newDataObject(); + $note->setAssocType(Application::ASSOC_TYPE_QUERY); + $note->setAssocId($query->getId()); + $note->setContents($content); + $note->setTitle($title); + $note->setDateCreated(Core::getCurrentDate()); + $note->setDateModified(Core::getCurrentDate()); + $note->setUserId($recommenderUserId); + $noteDao->insertObject($note); + + // Add task for assigned participants + $notificationMgr = new NotificationManager(); + foreach ($discussionParticipantsIds as $discussionParticipantsId) { + $notificationMgr->createNotification( + Application::get()->getRequest(), + $discussionParticipantsId, + Notification::NOTIFICATION_TYPE_NEW_QUERY, + Application::get()->getRequest()->getContext()->getId(), + Application::ASSOC_TYPE_QUERY, + $query->getId(), + Notification::NOTIFICATION_LEVEL_TASK + ); + } + + return $query->getId(); + } } if (!PKP_STRICT_MODE) { diff --git a/classes/reviewForm/ReviewForm.inc.php b/classes/reviewForm/ReviewForm.inc.php index 9da76107b19..2b6d5fd0cba 100644 --- a/classes/reviewForm/ReviewForm.inc.php +++ b/classes/reviewForm/ReviewForm.inc.php @@ -63,7 +63,7 @@ public function getCompleteCount() /** * Set the number of complete reviews for this review form. * - * @param $completeCount int + * @param int $completeCount */ public function setCompleteCount($completeCount) { @@ -83,7 +83,7 @@ public function getIncompleteCount() /** * Set the number of incomplete reviews for this review form. * - * @param $incompleteCount int + * @param int $incompleteCount */ public function setIncompleteCount($incompleteCount) { @@ -103,7 +103,7 @@ public function getAssocType() /** * Set the associated type. * - * @param $assocType int + * @param int $assocType */ public function setAssocType($assocType) { @@ -123,7 +123,7 @@ public function getAssocId() /** * Set the Id of the associated type. * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -143,7 +143,7 @@ public function getSequence() /** * Set sequence of review form. * - * @param $sequence float + * @param float $sequence */ public function setSequence($sequence) { @@ -163,7 +163,7 @@ public function getActive() /** * Set active flag * - * @param $active int + * @param int $active */ public function setActive($active) { @@ -173,7 +173,7 @@ public function setActive($active) /** * Get title. * - * @param $locale string + * @param string $locale * * @return string */ @@ -185,8 +185,8 @@ public function getTitle($locale) /** * Set title. * - * @param $title string - * @param $locale string + * @param string $title + * @param string $locale */ public function setTitle($title, $locale) { @@ -196,7 +196,7 @@ public function setTitle($title, $locale) /** * Get description. * - * @param $locale string + * @param string $locale * * @return string */ @@ -208,8 +208,8 @@ public function getDescription($locale) /** * Set description. * - * @param $description string - * @param $locale string + * @param string $description + * @param string $locale */ public function setDescription($description, $locale) { diff --git a/classes/reviewForm/ReviewFormDAO.inc.php b/classes/reviewForm/ReviewFormDAO.inc.php index 97f34422157..caf661004e6 100644 --- a/classes/reviewForm/ReviewFormDAO.inc.php +++ b/classes/reviewForm/ReviewFormDAO.inc.php @@ -27,9 +27,9 @@ class ReviewFormDAO extends \PKP\db\DAO /** * Retrieve a review form by ID. * - * @param $reviewFormId int - * @param $assocType int optional - * @param $assocId int optional + * @param int $reviewFormId + * @param int $assocType optional + * @param int $assocId optional * * @return ReviewForm */ @@ -66,7 +66,7 @@ public function newDataObject() /** * Internal function to return a ReviewForm object from a row. * - * @param $row array + * @param array $row * * @return ReviewForm */ @@ -91,11 +91,11 @@ public function _fromRow($row) /** * Check if a review form exists with the specified ID. * - * @param $reviewFormId int - * @param $assocType int - * @param $assocId int + * @param int $reviewFormId + * @param int $assocType + * @param int $assocId * - * @return boolean + * @return bool */ public function reviewFormExists($reviewFormId, $assocType, $assocId) { @@ -120,7 +120,7 @@ public function getLocaleFieldNames() /** * Update the localized fields for this table * - * @param $reviewForm object + * @param object $reviewForm */ public function updateLocaleFields(&$reviewForm) { @@ -132,7 +132,7 @@ public function updateLocaleFields(&$reviewForm) /** * Insert a new review form. * - * @param $reviewForm ReviewForm + * @param ReviewForm $reviewForm */ public function insertObject($reviewForm) { @@ -158,7 +158,7 @@ public function insertObject($reviewForm) /** * Update an existing review form. * - * @param $reviewForm ReviewForm + * @param ReviewForm $reviewForm */ public function updateObject($reviewForm) { @@ -187,7 +187,7 @@ public function updateObject($reviewForm) /** * Delete a review form. * - * @param $reviewForm ReviewForm + * @param ReviewForm $reviewForm */ public function deleteObject($reviewForm) { @@ -197,7 +197,7 @@ public function deleteObject($reviewForm) /** * Delete a review form by Id. * - * @param $reviewFormId int + * @param int $reviewFormId */ public function deleteById($reviewFormId) { @@ -211,8 +211,8 @@ public function deleteById($reviewFormId) /** * Delete all review forms by assoc Id. * - * @param $assocType int - * @param $assocId int + * @param int $assocType + * @param int $assocId */ public function deleteByAssoc($assocType, $assocId) { @@ -226,9 +226,9 @@ public function deleteByAssoc($assocType, $assocId) /** * Get all review forms by assoc id. * - * @param $assocType int - * @param $assocId int - * @param $rangeInfo RangeInfo (optional) + * @param int $assocType + * @param int $assocId + * @param RangeInfo $rangeInfo (optional) * * @return DAOResultFactory containing matching ReviewForms */ @@ -251,9 +251,9 @@ public function getByAssocId($assocType, $assocId, $rangeInfo = null) /** * Get active review forms for an associated object. * - * @param $assocType int - * @param $assocId int - * @param $rangeInfo object RangeInfo object (optional) + * @param int $assocType + * @param int $assocId + * @param RangeInfo $rangeInfo (optional) * * @return DAOResultFactory containing matching ReviewForms */ @@ -276,11 +276,11 @@ public function getActiveByAssocId($assocType, $assocId, $rangeInfo = null) /** * Check if a review form exists with the specified ID. * - * @param $reviewFormId int - * @param $assocType int optional - * @param $assocId int optional + * @param int $reviewFormId + * @param int $assocType optional + * @param int $assocId optional * - * @return boolean + * @return bool */ public function unusedReviewFormExists($reviewFormId, $assocType = null, $assocId = null) { @@ -297,8 +297,8 @@ public function unusedReviewFormExists($reviewFormId, $assocType = null, $assocI /** * Sequentially renumber review form in their sequence order. * - * @param $assocType int - * @param $assocId int + * @param int $assocType + * @param int $assocId */ public function resequenceReviewForms($assocType, $assocId) { diff --git a/classes/reviewForm/ReviewFormElement.inc.php b/classes/reviewForm/ReviewFormElement.inc.php index 5b93cb4ef6d..67f53104335 100644 --- a/classes/reviewForm/ReviewFormElement.inc.php +++ b/classes/reviewForm/ReviewFormElement.inc.php @@ -74,7 +74,7 @@ public function getReviewFormId() /** * Set the review form ID of the review form element. * - * @param $reviewFormId int + * @param int $reviewFormId */ public function setReviewFormId($reviewFormId) { @@ -94,7 +94,7 @@ public function getSequence() /** * Set sequence of review form element. * - * @param $sequence float + * @param float $sequence */ public function setSequence($sequence) { @@ -114,7 +114,7 @@ public function getElementType() /** * Set the type of the review form element. * - * @param $reviewFormElementType string + * @param string $reviewFormElementType */ public function setElementType($reviewFormElementType) { @@ -124,7 +124,7 @@ public function setElementType($reviewFormElementType) /** * Get required flag * - * @return boolean + * @return bool */ public function getRequired() { @@ -142,7 +142,7 @@ public function setRequired($required) /** * get included * - * @return boolean + * @return bool */ public function getIncluded() { @@ -152,7 +152,7 @@ public function getIncluded() /** * set included * - * @param $included boolean + * @param bool $included */ public function setIncluded($included) { @@ -162,7 +162,7 @@ public function setIncluded($included) /** * Get question. * - * @param $locale string + * @param string $locale * * @return string */ @@ -174,8 +174,8 @@ public function getQuestion($locale) /** * Set question. * - * @param $question string - * @param $locale string + * @param string $question + * @param string $locale */ public function setQuestion($question, $locale) { @@ -185,7 +185,7 @@ public function setQuestion($question, $locale) /** * Get description. * - * @param $locale string + * @param string $locale * * @return string */ @@ -197,8 +197,8 @@ public function getDescription($locale) /** * Set description. * - * @param $description string - * @param $locale string + * @param string $description + * @param string $locale */ public function setDescription($description, $locale) { @@ -208,7 +208,7 @@ public function setDescription($description, $locale) /** * Get possible response. * - * @param $locale string + * @param string $locale * * @return string */ @@ -220,7 +220,7 @@ public function getPossibleResponses($locale) /** * Set possibleResponse. * - * @param $locale string + * @param string $locale */ public function setPossibleResponses($possibleResponses, $locale) { diff --git a/classes/reviewForm/ReviewFormElementDAO.inc.php b/classes/reviewForm/ReviewFormElementDAO.inc.php index f4e37f676e1..9343d0a7325 100644 --- a/classes/reviewForm/ReviewFormElementDAO.inc.php +++ b/classes/reviewForm/ReviewFormElementDAO.inc.php @@ -27,8 +27,8 @@ class ReviewFormElementDAO extends \PKP\db\DAO /** * Retrieve a review form element by ID. * - * @param $reviewFormElementId int Review form element ID - * @param $reviewFormId int optional + * @param int $reviewFormElementId Review form element ID + * @param int $reviewFormId optional * * @return ReviewFormElement */ @@ -62,7 +62,7 @@ public function newDataObject() /** * Internal function to return a ReviewFormElement object from a row. * - * @param $row array + * @param array $row * * @return ReviewFormElement */ @@ -96,7 +96,7 @@ public function getLocaleFieldNames() /** * Update the localized fields for this table * - * @param $reviewFormElement object + * @param object $reviewFormElement */ public function updateLocaleFields($reviewFormElement) { @@ -108,7 +108,7 @@ public function updateLocaleFields($reviewFormElement) /** * Insert a new review form element. * - * @param $reviewFormElement ReviewFormElement + * @param ReviewFormElement $reviewFormElement * * @return int Review form element ID */ @@ -136,7 +136,7 @@ public function insertObject($reviewFormElement) /** * Update an existing review form element. * - * @param $reviewFormElement ReviewFormElement + * @param ReviewFormElement $reviewFormElement */ public function updateObject($reviewFormElement) { @@ -164,7 +164,7 @@ public function updateObject($reviewFormElement) /** * Delete a review form element. * - * @param $reviewFormElement reviewFormElement + * @param reviewFormElement $reviewFormElement */ public function deleteObject($reviewFormElement) { @@ -174,7 +174,7 @@ public function deleteObject($reviewFormElement) /** * Delete a review form element by ID. * - * @param $reviewFormElementId int + * @param int $reviewFormElementId */ public function deleteById($reviewFormElementId) { @@ -189,7 +189,7 @@ public function deleteById($reviewFormElementId) * Delete review form elements by review form ID * to be called only when deleting a review form. * - * @param $reviewFormId int + * @param int $reviewFormId */ public function deleteByReviewFormId($reviewFormId) { @@ -202,8 +202,8 @@ public function deleteByReviewFormId($reviewFormId) /** * Delete a review form element setting * - * @param $reviewFormElementId int - * @param $locale string + * @param int $reviewFormElementId + * @param string $locale */ public function deleteSetting($reviewFormElementId, $name, $locale = null) { @@ -223,9 +223,9 @@ public function deleteSetting($reviewFormElementId, $name, $locale = null) /** * Retrieve all elements for a review form. * - * @param $reviewFormId int - * @param $rangeInfo object RangeInfo object (optional) - * @param $included boolean True for only included comments; false for non-included; null for both + * @param int $reviewFormId + * @param RangeInfo $rangeInfo (optional) + * @param bool $included True for only included comments; false for non-included; null for both * * @return DAOResultFactory containing ReviewFormElements ordered by sequence */ @@ -248,7 +248,7 @@ public function getByReviewFormId($reviewFormId, $rangeInfo = null, $included = /** * Retrieve ids of all required elements for a review form. * - * @param $reviewFormId int + * @param int $reviewFormId * return array */ public function getRequiredReviewFormElementIds($reviewFormId) @@ -268,10 +268,10 @@ public function getRequiredReviewFormElementIds($reviewFormId) /** * Check if a review form element exists with the specified ID. * - * @param $reviewFormElementId int - * @param $reviewFormId int optional + * @param int $reviewFormElementId + * @param int $reviewFormId optional * - * @return boolean + * @return bool */ public function reviewFormElementExists($reviewFormElementId, $reviewFormId = null) { @@ -294,7 +294,7 @@ public function reviewFormElementExists($reviewFormElementId, $reviewFormId = nu /** * Sequentially renumber a review form elements in their sequence order. * - * @param $reviewFormId int + * @param int $reviewFormId */ public function resequenceReviewFormElements($reviewFormId) { diff --git a/classes/reviewForm/ReviewFormResponse.inc.php b/classes/reviewForm/ReviewFormResponse.inc.php index 001f6995a81..f3b2df0e3f5 100644 --- a/classes/reviewForm/ReviewFormResponse.inc.php +++ b/classes/reviewForm/ReviewFormResponse.inc.php @@ -37,7 +37,7 @@ public function getReviewId() /** * Set the review ID. * - * @param $reviewId int + * @param int $reviewId */ public function setReviewId($reviewId) { @@ -57,7 +57,7 @@ public function getReviewFormElementId() /** * Set ID of review form element. * - * @param $reviewFormElementId int + * @param int $reviewFormElementId */ public function setReviewFormElementId($reviewFormElementId) { @@ -77,7 +77,7 @@ public function getValue() /** * Set response value. * - * @param $value int + * @param int $value */ public function setValue($value) { @@ -97,7 +97,7 @@ public function getResponseType() /** * Set response type. * - * @param $type string + * @param string $type */ public function setResponseType($type) { diff --git a/classes/reviewForm/ReviewFormResponseDAO.inc.php b/classes/reviewForm/ReviewFormResponseDAO.inc.php index 25be29a73d8..6547a495795 100644 --- a/classes/reviewForm/ReviewFormResponseDAO.inc.php +++ b/classes/reviewForm/ReviewFormResponseDAO.inc.php @@ -25,8 +25,8 @@ class ReviewFormResponseDAO extends \PKP\db\DAO /** * Retrieve a review form response. * - * @param $reviewId int - * @param $reviewFormElementId int + * @param int $reviewId + * @param int $reviewFormElementId * * @return ReviewFormResponse */ @@ -53,7 +53,7 @@ public function newDataObject() /** * Internal function to return a ReviewFormResponse object from a row. * - * @param $row array + * @param array $row * * @return ReviewFormResponse */ @@ -75,7 +75,7 @@ public function &_returnReviewFormResponseFromRow($row) /** * Insert a new review form response. * - * @param $reviewFormResponse ReviewFormResponse + * @param ReviewFormResponse $reviewFormResponse */ public function insertObject($reviewFormResponse) { @@ -96,7 +96,7 @@ public function insertObject($reviewFormResponse) /** * Update an existing review form response. * - * @param $reviewFormResponse ReviewFormResponse + * @param ReviewFormResponse $reviewFormResponse */ public function updateObject($reviewFormResponse) { @@ -119,7 +119,7 @@ public function updateObject($reviewFormResponse) /** * Delete a review form response. * - * @param $reviewFormResponse ReviewFormResponse + * @param ReviewFormResponse $reviewFormResponse */ public function deleteObject($reviewFormResponse) { @@ -129,8 +129,8 @@ public function deleteObject($reviewFormResponse) /** * Delete a review form response by ID. * - * @param $reviewId int - * @param $reviewFormElementId int + * @param int $reviewId + * @param int $reviewFormElementId */ public function deleteById($reviewId, $reviewFormElementId) { @@ -143,7 +143,7 @@ public function deleteById($reviewId, $reviewFormElementId) /** * Delete review form responses by review ID * - * @param $reviewId int + * @param int $reviewId */ public function deleteByReviewId($reviewId) { @@ -153,7 +153,7 @@ public function deleteByReviewId($reviewId) /** * Delete group membership by user ID * - * @param $reviewFormElementId int + * @param int $reviewFormElementId */ public function deleteByReviewFormElementId($reviewFormElementId) { @@ -163,7 +163,7 @@ public function deleteByReviewFormElementId($reviewFormElementId) /** * Retrieve all review form responses for a review in an associative array. * - * @param $reviewId int + * @param int $reviewId * * @return array review_form_element_id => array(review form response for this element) */ @@ -181,10 +181,10 @@ public function getReviewReviewFormResponseValues($reviewId) /** * Check if a review form response for the review. * - * @param $reviewId int - * @param $reviewFormElementId int optional + * @param int $reviewId + * @param int $reviewFormElementId optional * - * @return boolean + * @return bool */ public function reviewFormResponseExists($reviewId, $reviewFormElementId = null) { diff --git a/classes/scheduledTask/ScheduledTask.inc.php b/classes/scheduledTask/ScheduledTask.inc.php index 705b7ac44aa..1be67d4b316 100644 --- a/classes/scheduledTask/ScheduledTask.inc.php +++ b/classes/scheduledTask/ScheduledTask.inc.php @@ -42,7 +42,7 @@ abstract class ScheduledTask /** * Constructor. * - * @param $args array + * @param array $args */ public function __construct($args = []) { @@ -109,8 +109,8 @@ public function getName() /** * Add an entry into the execution log. * - * @param $message string A translated message. - * @param $type string (optional) One of the ScheduledTaskHelper + * @param string $message A translated message. + * @param string $type (optional) One of the ScheduledTaskHelper * SCHEDULED_TASK_MESSAGE_TYPE... constants. */ public function addExecutionLogEntry($message, $type = null) @@ -145,7 +145,7 @@ public function addExecutionLogEntry($message, $type = null) /** * Implement this method to execute the task actions. * - * @return boolean true iff success + * @return bool true iff success */ abstract protected function executeActions(); @@ -158,7 +158,7 @@ abstract protected function executeActions(); * This is not the method one should extend to implement the * task actions, for this see ScheduledTask::executeActions(). * - * @return boolean Whether or not the task was succesfully + * @return bool Whether or not the task was succesfully * executed. */ public function execute() diff --git a/classes/scheduledTask/ScheduledTaskDAO.inc.php b/classes/scheduledTask/ScheduledTaskDAO.inc.php index f69182b302f..71e5eee50db 100644 --- a/classes/scheduledTask/ScheduledTaskDAO.inc.php +++ b/classes/scheduledTask/ScheduledTaskDAO.inc.php @@ -28,7 +28,7 @@ class ScheduledTaskDAO extends \PKP\db\DAO /** * Get the last time a scheduled task was executed. * - * @param $className string + * @param string $className * * @return int */ @@ -45,8 +45,8 @@ public function getLastRunTime($className) /** * Update a scheduled task's last run time. * - * @param $className string - * @param $timestamp int optional, if omitted the current time is used. + * @param string $className + * @param int $timestamp optional, if omitted the current time is used. * * @return int */ diff --git a/classes/scheduledTask/ScheduledTaskHelper.inc.php b/classes/scheduledTask/ScheduledTaskHelper.inc.php index 26be4df4cb6..0fbc6cb6279 100644 --- a/classes/scheduledTask/ScheduledTaskHelper.inc.php +++ b/classes/scheduledTask/ScheduledTaskHelper.inc.php @@ -40,8 +40,8 @@ class ScheduledTaskHelper * Constructor. * Ovewrites both parameters if one is not passed. * - * @param $email string (optional) - * @param $contactName string (optional) + * @param string $email (optional) + * @param string $contactName (optional) */ public function __construct($email = '', $contactName = '') { @@ -70,7 +70,7 @@ public function getMail() /** * Get the arguments for a task from the parsed XML. * - * @param XMLNode + * @param XMLNode $task * * @return array */ @@ -91,8 +91,8 @@ public static function getTaskArgs($task) * Check if the specified task should be executed according to the specified * frequency and its last run time. * - * @param $className string - * @param $frequency XMLNode + * @param string $className + * @param XMLNode $frequency * * @return string */ @@ -147,11 +147,11 @@ public static function checkFrequency($className, $frequency) * Notifies site administrator about the * task execution result. * - * @param $id int Task id. - * @param $name string Task name. - * @param $result boolean Whether or not the task + * @param int $id Task id. + * @param string $name Task name. + * @param bool $result Whether or not the task * execution was successful. - * @param $executionLogFile string Task execution log file path. + * @param string $executionLogFile Task execution log file path. */ public function notifyExecutionResult($id, $name, $result, $executionLogFile = '') { @@ -178,7 +178,7 @@ public function notifyExecutionResult($id, $name, $result, $executionLogFile = ' /** * Get execution log email message. * - * @param $executionLogFile string + * @param string $executionLogFile * * @return string */ @@ -213,7 +213,7 @@ public static function clearExecutionLogs() /** * Download execution log file. * - * @param $file string + * @param string $file */ public static function downloadExecutionLog($file) { @@ -229,10 +229,10 @@ public static function downloadExecutionLog($file) /** * Send email to the site administrator. * - * @param $message string - * @param $subject string + * @param string $message + * @param string $subject * - * @return boolean + * @return bool */ private function _sendEmail($message, $subject) { @@ -247,14 +247,14 @@ private function _sendEmail($message, $subject) /** * Check if a value is within the specified range. * - * @param $rangeStr string the range (e.g., 0, 1-5, *, etc.) - * @param $currentValue int value to check if its in the range - * @param $lastTimestamp int the last time the task was executed - * @param $timeCompareStr string value to use in strtotime("-X $timeCompareStr") - * @param $passTimestamp int If the last run is older than this timestamp, consider executing. - * @param $blockTimestamp int If the last run is newer than this timestamp, do not execute. + * @param string $rangeStr the range (e.g., 0, 1-5, *, etc.) + * @param int $currentValue value to check if its in the range + * @param int $lastTimestamp the last time the task was executed + * @param string $timeCompareStr value to use in strtotime("-X $timeCompareStr") + * @param int $passTimestamp If the last run is older than this timestamp, consider executing. + * @param int $blockTimestamp If the last run is newer than this timestamp, do not execute. * - * @return boolean + * @return bool */ private static function _isInRange($rangeStr, $currentValue, $lastTimestamp, $timeCompareStr, $passTimestamp, $blockTimestamp) { @@ -306,11 +306,11 @@ private static function _isInRange($rangeStr, $currentValue, $lastTimestamp, $ti /** * Check if a numeric value is within the specified range. * - * @param $value int - * @param $min int - * @param $max int + * @param int $value + * @param int $min + * @param int $max * - * @return boolean + * @return bool */ private static function _isInNumericRange($value, $min, $max) { diff --git a/classes/search/SearchFileParser.inc.php b/classes/search/SearchFileParser.inc.php index bbfc0ef13a3..ed6d9e1b4e3 100644 --- a/classes/search/SearchFileParser.inc.php +++ b/classes/search/SearchFileParser.inc.php @@ -34,7 +34,7 @@ class SearchFileParser /** * Constructor. * - * @param $filePath string + * @param string $filePath */ public function __construct($filePath) { @@ -54,7 +54,7 @@ public function getFilePath() /** * Change the file path. * - * @param $filePath string + * @param string $filePath */ public function setFilePath($filePath) { @@ -64,7 +64,7 @@ public function setFilePath($filePath) /** * Open the file. * - * @return boolean + * @return bool */ public function open() { @@ -124,8 +124,8 @@ public static function fromFile($submissionFile) /** * Create a text parser for a file. * - * @param $type string - * @param $path string + * @param string $type + * @param string $path * * @return SearchFileParser */ diff --git a/classes/search/SearchHTMLParser.inc.php b/classes/search/SearchHTMLParser.inc.php index f02d1d26cad..cfdef859155 100644 --- a/classes/search/SearchHTMLParser.inc.php +++ b/classes/search/SearchHTMLParser.inc.php @@ -25,9 +25,6 @@ public function doRead() // convert HTML entities to valid UTF-8 characters $line = html_entity_decode($line, ENT_COMPAT, 'UTF-8'); - // slightly (~10%) faster than above, but not quite as accurate, and requires html_entity_decode() - // $line = html_entity_decode($line, ENT_COMPAT, strtoupper(Config::getVar('i18n', 'client_charset'))); - return $line; } } diff --git a/classes/search/SubmissionSearch.inc.php b/classes/search/SubmissionSearch.inc.php index 326a28a2fc6..fabd995359f 100644 --- a/classes/search/SubmissionSearch.inc.php +++ b/classes/search/SubmissionSearch.inc.php @@ -54,7 +54,7 @@ public function __construct() * Parses a search query string. * Supports +/-, AND/OR, parens * - * @param $query + * @param string $query * * @return array of the form ('+' => , '' => , '-' => excluded) */ @@ -234,16 +234,16 @@ protected function _getMergedPhraseResults($context, &$phrase, $type, $published * $keywords[SUBMISSION_SEARCH_...] = array(...); * $keywords[null] = array('Matches', 'All', 'Fields'); * - * @param $request Request - * @param $context object The context to search - * @param $keywords array List of keywords - * @param $error string a reference to a variable that will + * @param Request $request + * @param object $context The context to search + * @param array $keywords List of keywords + * @param string $error a reference to a variable that will * contain an error message if the search service produces * an error. - * @param $publishedFrom object Search-from date - * @param $publishedTo object Search-to date - * @param $rangeInfo Information on the range of results to return - * @param $exclude array An array of article IDs to exclude from the result. + * @param object $publishedFrom Search-from date + * @param object $publishedTo Search-to date + * @param object $rangeInfo Information on the range of results to return + * @param array $exclude An array of article IDs to exclude from the result. * * @return VirtualArrayIterator An iterator with one entry per retrieved * article containing the article, published submission, issue, context, etc. @@ -333,7 +333,7 @@ public function getResultSetOrderingDirectionOptions() * Return the currently selected result * set ordering option (default: descending relevance). * - * @param $request Request + * @param Request $request * * @return array An array with the order field as the * first entry and the order direction as the second @@ -368,8 +368,8 @@ public function getResultSetOrdering($request) * Note that this function is also called externally to fetch * results for the title index, and possibly elsewhere. * - * @param $results array - * @param $user User optional (if availability information is desired) + * @param array $results + * @param User $user optional (if availability information is desired) * * @return array */ @@ -378,7 +378,7 @@ abstract public function formatResults($results, $user = null); /** * Return the available options for result set ordering. * - * @param $request Request + * @param Request $request * * @return array */ @@ -393,7 +393,7 @@ abstract protected function getSparseArray($unorderedResults, $orderBy, $orderDi /** * Return the default order direction. * - * @param $orderBy string + * @param string $orderBy * * @return string */ diff --git a/classes/search/SubmissionSearchDAO.inc.php b/classes/search/SubmissionSearchDAO.inc.php index 12ee91308e0..4dd129ae9ef 100644 --- a/classes/search/SubmissionSearchDAO.inc.php +++ b/classes/search/SubmissionSearchDAO.inc.php @@ -24,7 +24,7 @@ class SubmissionSearchDAO extends \PKP\db\DAO /** * Add a word to the keyword list (if it doesn't already exist). * - * @param $keyword string + * @param string $keyword * * @return int the keyword ID */ @@ -61,9 +61,9 @@ public function insertKeyword($keyword) /** * Delete all keywords for a submission. * - * @param $submissionId int - * @param $type int optional - * @param $assocId int optional + * @param int $submissionId + * @param int $type optional + * @param int $assocId optional */ public function deleteSubmissionKeywords($submissionId, $type = null, $assocId = null) { @@ -90,9 +90,9 @@ public function deleteSubmissionKeywords($submissionId, $type = null, $assocId = /** * Add a submission object to the index (if already exists, indexed keywords are cleared). * - * @param $submissionId int - * @param $type int - * @param $assocId int + * @param int $submissionId + * @param int $type + * @param int $assocId * * @return int the object ID */ diff --git a/classes/search/SubmissionSearchIndex.inc.php b/classes/search/SubmissionSearchIndex.inc.php index bd09057b7d4..7328455b741 100644 --- a/classes/search/SubmissionSearchIndex.inc.php +++ b/classes/search/SubmissionSearchIndex.inc.php @@ -28,8 +28,8 @@ abstract class SubmissionSearchIndex /** * Split a string into a clean array of keywords * - * @param $text string - * @param $allowWildcards boolean + * @param string $text + * @param bool $allowWildcards * * @return array of keywords */ @@ -105,14 +105,14 @@ abstract public function submissionChangesFinished(); * mark articles as "changed" and let the indexing back-end decide * the best point in time to actually index the changed data. * - * @param $submission Submission + * @param Submission $submission */ abstract public function submissionMetadataChanged($submission); /** * Remove indexed file contents for a submission * - * @param $submission Submission + * @param Submission $submission */ abstract public function clearSubmissionFiles($submission); } diff --git a/classes/security/AccessKey.inc.php b/classes/security/AccessKey.inc.php index dae28fce2b2..7e122f1abb5 100644 --- a/classes/security/AccessKey.inc.php +++ b/classes/security/AccessKey.inc.php @@ -40,7 +40,7 @@ public function getContext() /** * Set context. * - * @param $context string + * @param string $context */ public function setContext($context) { @@ -60,7 +60,7 @@ public function getKeyHash() /** * Set key hash. * - * @param $keyHash string + * @param string $keyHash */ public function setKeyHash($keyHash) { @@ -80,7 +80,7 @@ public function getUserId() /** * Set user ID. * - * @param $userId int + * @param int $userId */ public function setUserId($userId) { @@ -100,7 +100,7 @@ public function getAssocId() /** * Set associated ID. * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -120,7 +120,7 @@ public function getExpiryDate() /** * Set expiry date. * - * @param $expiryDate string + * @param string $expiryDate */ public function setExpiryDate($expiryDate) { diff --git a/classes/security/AccessKeyDAO.inc.php b/classes/security/AccessKeyDAO.inc.php index 631639928e0..0028ac9df06 100644 --- a/classes/security/AccessKeyDAO.inc.php +++ b/classes/security/AccessKeyDAO.inc.php @@ -25,7 +25,7 @@ class AccessKeyDAO extends \PKP\db\DAO /** * Retrieve an accessKey by ID. * - * @param $accessKeyId int + * @param int $accessKeyId * * @return AccessKey */ @@ -45,8 +45,8 @@ public function getAccessKey($accessKeyId) /** * Retrieve a accessKey object user ID. * - * @param $context string - * @param $userId int + * @param string $context + * @param int $userId * * @return AccessKey */ @@ -66,10 +66,10 @@ public function getAccessKeyByUserId($context, $userId) /** * Retrieve a accessKey object by key. * - * @param $context string - * @param $userId int - * @param $keyHash string - * @param $assocId int + * @param string $context + * @param int $userId + * @param string $keyHash + * @param int $assocId * * @return AccessKey */ @@ -103,7 +103,7 @@ public function newDataObject() /** * Internal function to return an AccessKey object from a row. * - * @param $row array + * @param array $row * * @return AccessKey */ @@ -125,7 +125,7 @@ public function _returnAccessKeyFromRow($row) /** * Insert a new accessKey. * - * @param $accessKey AccessKey + * @param AccessKey $accessKey */ public function insertObject($accessKey) { @@ -152,7 +152,7 @@ public function insertObject($accessKey) /** * Update an existing accessKey. * - * @param $accessKey AccessKey + * @param AccessKey $accessKey */ public function updateObject($accessKey) { @@ -181,7 +181,7 @@ public function updateObject($accessKey) /** * Delete an accessKey. * - * @param $accessKey AccessKey + * @param AccessKey $accessKey */ public function deleteObject($accessKey) { @@ -191,7 +191,7 @@ public function deleteObject($accessKey) /** * Delete an accessKey by ID. * - * @param $accessKeyId int + * @param int $accessKeyId */ public function deleteAccessKeyById($accessKeyId) { @@ -201,8 +201,8 @@ public function deleteAccessKeyById($accessKeyId) /** * Transfer access keys to another user ID. * - * @param $oldUserId int - * @param $newUserId int + * @param int $oldUserId + * @param int $newUserId */ public function transferAccessKeys($oldUserId, $newUserId) { diff --git a/classes/security/AccessKeyManager.inc.php b/classes/security/AccessKeyManager.inc.php index 1682a8a5279..7da63964c90 100644 --- a/classes/security/AccessKeyManager.inc.php +++ b/classes/security/AccessKeyManager.inc.php @@ -37,7 +37,7 @@ public function __construct() /** * Generate a key hash from a key. * - * @param $key string + * @param string $key * * @return string */ @@ -51,10 +51,10 @@ public function generateKeyHash($key) * If $assocId is specified, it must match the associated ID of the * key exactly. * - * @param $context string The context of the access key - * @param $userId int - * @param $keyHash string The access key "passcode" - * @param $assocId string optional assoc ID to check against the keys in the database + * @param string $context The context of the access key + * @param int $userId + * @param string $keyHash The access key "passcode" + * @param string $assocId optional assoc ID to check against the keys in the database * * @return AccessKey */ @@ -66,10 +66,10 @@ public function validateKey($context, $userId, $keyHash, $assocId = null) /** * Create an access key with the given information. * - * @param $context string The context of the access key - * @param $userId int The ID of the effective user for this access key - * @param $assocId int The associated ID of the key - * @param $expiryDays int The number of days before this key expires + * @param string $context The context of the access key + * @param int $userId The ID of the effective user for this access key + * @param int $assocId The associated ID of the key + * @param int $expiryDays The number of days before this key expires * * @return accessKey string The generated passkey */ diff --git a/classes/security/AuthSource.inc.php b/classes/security/AuthSource.inc.php index 3974ccc21a9..85cc4d5feed 100644 --- a/classes/security/AuthSource.inc.php +++ b/classes/security/AuthSource.inc.php @@ -38,7 +38,7 @@ public function getAuthId() /** * Set ID of this source. * - * @param $authId int + * @param int $authId */ public function setAuthId($authId) { @@ -58,7 +58,7 @@ public function getTitle() /** * Set user-specified title of this source. * - * @param $title string + * @param string $title */ public function setTitle($title) { @@ -78,7 +78,7 @@ public function getPlugin() /** * Set the authentication plugin associated with this source. * - * @param $plugin string + * @param string $plugin */ public function setPlugin($plugin) { @@ -88,7 +88,7 @@ public function setPlugin($plugin) /** * Get flag indicating this is the default authentication source. * - * @return boolean + * @return bool */ public function getDefault() { @@ -98,7 +98,7 @@ public function getDefault() /** * Set flag indicating this is the default authentication source. * - * @param $authDefault boolean + * @param bool $authDefault */ public function setDefault($authDefault) { @@ -118,7 +118,7 @@ public function getSettings() /** * Set array of plugin-specific settings for this source. * - * @param $settings array + * @param array $settings */ public function setSettings($settings) { @@ -139,7 +139,7 @@ public function &getPluginClass() /** * Set authentication plugin object associated with this source. * - * @param $authPlugin AuthPlugin + * @param AuthPlugin $authPlugin */ public function setPluginClass($authPlugin) { diff --git a/classes/security/AuthSourceDAO.inc.php b/classes/security/AuthSourceDAO.inc.php index 31a4a99c783..7124583f260 100644 --- a/classes/security/AuthSourceDAO.inc.php +++ b/classes/security/AuthSourceDAO.inc.php @@ -36,7 +36,7 @@ public function __construct() /** * Get plugin instance corresponding to the ID. * - * @param $authId int + * @param int $authId * * @return AuthPlugin */ @@ -74,7 +74,7 @@ public function getDefaultPlugin() /** * Retrieve a source. * - * @param $authId int + * @param int $authId * * @return AuthSource */ @@ -115,7 +115,7 @@ public function newDataObject() /** * Internal function to return an AuthSource object from a row. * - * @param $row array + * @param array $row * * @return AuthSource */ @@ -140,7 +140,7 @@ class_alias('\PKP\security\AuthSourceDAO', '\AuthSourceDAO'); /** * Insert a new source. * - * @param $auth AuthSource + * @param AuthSource $auth */ public function insertObject($auth) { @@ -169,7 +169,7 @@ public function insertObject($auth) /** * Update a source. * - * @param $auth AuthSource + * @param AuthSource $auth */ public function updateObject($auth) { @@ -189,7 +189,7 @@ public function updateObject($auth) /** * Delete a source. * - * @param $authId int + * @param int $authId */ public function deleteObject($authId) { @@ -202,7 +202,7 @@ public function deleteObject($authId) /** * Set the default authentication source. * - * @param $authId int + * @param int $authId */ public function setDefault($authId) { diff --git a/classes/security/Role.inc.php b/classes/security/Role.inc.php index 1bda72be94f..521016ec060 100644 --- a/classes/security/Role.inc.php +++ b/classes/security/Role.inc.php @@ -19,7 +19,7 @@ class Role extends \PKP\core\DataObject { - /** ID codes and paths for all default roles */ + // ID codes and paths for all default roles public const ROLE_ID_MANAGER = 0x00000010; public const ROLE_ID_SITE_ADMIN = 0x00000001; public const ROLE_ID_SUB_EDITOR = 0x00000011; @@ -32,7 +32,7 @@ class Role extends \PKP\core\DataObject /** * Constructor. * - * @param $roleId for this role. Default to null for backwards + * @param int $roleId for this role. Default to null for backwards * compatibility */ public function __construct($roleId = null) @@ -58,7 +58,7 @@ public function getRoleId() /** * Set role ID of this role. * - * @param $roleId int + * @param int $roleId */ public function setRoleId($roleId) { diff --git a/classes/security/RoleDAO.inc.php b/classes/security/RoleDAO.inc.php index c29650fcb87..198168c8da0 100644 --- a/classes/security/RoleDAO.inc.php +++ b/classes/security/RoleDAO.inc.php @@ -33,9 +33,9 @@ public function newDataObject() /** * Validation check to see if a user belongs to any group that has a given role * - * @param $contextId int - * @param $userId int - * @param $roleId int|array ROLE_ID_... + * @param int $contextId + * @param int $userId + * @param int|array $roleId ROLE_ID_... * * @return bool True iff at least one such role exists */ @@ -54,8 +54,8 @@ public function userHasRole($contextId, $userId, $roleId) /** * Return an array of row objects corresponding to the roles a given use has * - * @param $userId - * @param $contextId + * @param int $userId + * @param int $contextId * * @return array of Roles */ @@ -86,7 +86,7 @@ public function getByUserId($userId, $contextId = null) * Return an array of objects corresponding to the roles a given user has, * grouped by context id. * - * @param $userId int + * @param int $userId * * @return array */ @@ -109,7 +109,7 @@ public function getByUserIdGroupedByContext($userId) /** * Get role forbidden stages. * - * @param $roleId int Specific role ID to fetch stages for, if any + * @param int $roleId Specific role ID to fetch stages for, if any * * @return array With $roleId, array(WORKFLOW_STAGE_ID_...); without, * array(ROLE_ID_... => array(WORKFLOW_STAGE_ID_...)) diff --git a/classes/security/UserGroup.inc.php b/classes/security/UserGroup.inc.php index d7134edd66f..4d1de1f0ea3 100644 --- a/classes/security/UserGroup.inc.php +++ b/classes/security/UserGroup.inc.php @@ -32,7 +32,7 @@ public function getRoleId() /** * Set the role ID * - * @param $roleId int ROLE_ID_... + * @param int $roleId ROLE_ID_... */ public function setRoleId($roleId) { @@ -71,7 +71,7 @@ public function getContextId() /** * Set the context ID * - * @param $contextId int + * @param int $contextId */ public function setContextId($contextId) { @@ -81,7 +81,7 @@ public function setContextId($contextId) /** * Get the default flag * - * @return boolean + * @return bool */ public function getDefault() { @@ -91,7 +91,7 @@ public function getDefault() /** * Set the default flag * - * @param $isDefault boolean + * @param bool $isDefault */ public function setDefault($isDefault) { @@ -102,7 +102,7 @@ public function setDefault($isDefault) * Get the "show title" flag (whether or not the title of the role * should be included in the list of submission contributor names) * - * @return boolean + * @return bool */ public function getShowTitle() { @@ -112,7 +112,7 @@ public function getShowTitle() /** * Set the "show title" flag * - * @param $showTitle boolean + * @param bool $showTitle */ public function setShowTitle($showTitle) { @@ -125,7 +125,7 @@ public function setShowTitle($showTitle) * reviewers, or whether it should be prohibited, in the case of * internal reviewers). * - * @return boolean True IFF user self-registration is permitted + * @return bool True IFF user self-registration is permitted */ public function getPermitSelfRegistration() { @@ -135,7 +135,7 @@ public function getPermitSelfRegistration() /** * Set the "permit self-registration" flag * - * @param $permitSelfRegistration boolean + * @param bool $permitSelfRegistration */ public function setPermitSelfRegistration($permitSelfRegistration) { @@ -146,7 +146,7 @@ public function setPermitSelfRegistration($permitSelfRegistration) * Get the recommendOnly option (whether or not the manager or the sub-editor role * can only recommend or also make decisions in the submission review) * - * @return boolean + * @return bool */ public function getRecommendOnly() { @@ -157,7 +157,7 @@ public function getRecommendOnly() * Set the recommendOnly option (whether or not the manager or the sub-editor role * can only recommend or also make decisions in the submission review) * - * @param $recommendOnly boolean + * @param bool $recommendOnly */ public function setRecommendOnly($recommendOnly) { @@ -177,7 +177,7 @@ public function getLocalizedName() /** * Get localized user group name, or array of localized names if $locale is null * - * @param $locale string|null + * @param string|null $locale * * @return string|array|null localized name or array of localized names or null */ @@ -189,8 +189,8 @@ public function getName($locale) /** * Set user group name * - * @param $name string - * @param $locale string + * @param string $name + * @param string $locale */ public function setName($name, $locale) { @@ -210,7 +210,7 @@ public function getLocalizedAbbrev() /** * Get localized user group abbreviation, or array of localized abbreviations if $locale is null * - * @param $locale string|null + * @param string|null $locale * * @return string|array|null localized abbreviation or array of localized abbreviations or null */ @@ -222,8 +222,8 @@ public function getAbbrev($locale) /** * Set user group abbreviation * - * @param $abbrev string - * @param $locale string + * @param string $abbrev + * @param string $locale */ public function setAbbrev($abbrev, $locale) { @@ -233,7 +233,7 @@ public function setAbbrev($abbrev, $locale) /** * Getter for permitMetadataEdit attribute. * - * @return boolean + * @return bool */ public function getPermitMetadataEdit() { @@ -243,7 +243,7 @@ public function getPermitMetadataEdit() /** * Setter for permitMetadataEdit attribute. * - * @param $permitMetadataEdit boolean + * @param bool $permitMetadataEdit */ public function setPermitMetadataEdit($permitMetadataEdit) { diff --git a/classes/security/UserGroupAssignment.inc.php b/classes/security/UserGroupAssignment.inc.php index 0a7354726f0..f882a3f618f 100644 --- a/classes/security/UserGroupAssignment.inc.php +++ b/classes/security/UserGroupAssignment.inc.php @@ -21,7 +21,7 @@ class UserGroupAssignment extends \PKP\core\DataObject { - /** @var the UserGroup object associated with this assignment **/ + /** @var UserGroup the UserGroup object associated with this assignment */ public $userGroup; // @@ -63,7 +63,7 @@ public function getUserId() /** * Set user ID associated with role. * - * @param $userId int + * @param int $userId */ public function setUserId($userId) { diff --git a/classes/security/UserGroupAssignmentDAO.inc.php b/classes/security/UserGroupAssignmentDAO.inc.php index b46fd576915..c4ec0be918e 100644 --- a/classes/security/UserGroupAssignmentDAO.inc.php +++ b/classes/security/UserGroupAssignmentDAO.inc.php @@ -36,7 +36,7 @@ public function newDataObject() /** * Internal function to return a UserGroupAssignment object from a row. * - * @param $row array + * @param array $row * * @return Role */ @@ -53,7 +53,7 @@ public function _fromRow($row) * Delete all user group assignments for a given userId * * @param int $userId - * @param $userGroupId int optional + * @param int $userGroupId optional */ public function deleteByUserId($userId, $userGroupId = null) { @@ -111,9 +111,9 @@ public function deleteAssignmentsByContextId($contextId, $userId = null) /** * Retrieve user group assignments for a user * - * @param $userId int - * @param $contextId int - * @param $roleId int + * @param int $userId + * @param int $contextId + * @param int $roleId * * @return Iterator UserGroup */ @@ -158,7 +158,7 @@ public function insertObject($userGroupAssignment) /** * Remove an assignment * - * @param $userGroupAssignment + * @param UserGroupAssignment $userGroupAssignment */ public function deleteAssignment($userGroupAssignment) { diff --git a/classes/security/UserGroupDAO.inc.php b/classes/security/UserGroupDAO.inc.php index 228c0de4352..20d7d58df8b 100644 --- a/classes/security/UserGroupDAO.inc.php +++ b/classes/security/UserGroupDAO.inc.php @@ -37,7 +37,7 @@ class UserGroupDAO extends DAO { - /** @var a shortcut to get the UserGroupAssignmentDAO **/ + /** @var UserGroupAssignmentDAO */ public $userGroupAssignmentDao; /** @@ -61,7 +61,7 @@ public function newDataObject() /** * Internal function to return a UserGroup object from a row. * - * @param $row array + * @param array $row * * @return UserGroup */ @@ -86,7 +86,7 @@ public function _returnFromRow($row) /** * Insert a user group. * - * @param $userGroup UserGroup + * @param UserGroup $userGroup * * @return int Inserted user group ID */ @@ -115,7 +115,7 @@ public function insertObject($userGroup) /** * Update a user group. * - * @param $userGroup UserGroup + * @param UserGroup $userGroup */ public function updateObject($userGroup) { @@ -146,8 +146,8 @@ public function updateObject($userGroup) * Delete a user group by its id * will also delete related settings and all the assignments to this group * - * @param $contextId int - * @param $userGroupId int + * @param int $contextId + * @param int $userGroupId */ public function deleteById($contextId, $userGroupId) { @@ -161,7 +161,7 @@ public function deleteById($contextId, $userGroupId) * Delete a user group. * will also delete related settings and all the assignments to this group * - * @param $userGroup UserGroup + * @param UserGroup $userGroup */ public function deleteObject($userGroup) { @@ -172,7 +172,7 @@ public function deleteObject($userGroup) /** * Delete a user group by its context id * - * @param $contextId int + * @param int $contextId */ public function deleteByContextId($contextId) { @@ -227,8 +227,8 @@ public function updateLocaleFields($userGroup) /** * Get an individual user group * - * @param $userGroupId int User group ID - * @param $contextId int Optional context ID to use for validation + * @param int $userGroupId User group ID + * @param int $contextId Optional context ID to use for validation */ public function getById($userGroupId, $contextId = null) { @@ -249,8 +249,8 @@ public function getById($userGroupId, $contextId = null) /** * Get a single default user group with a particular roleId * - * @param $contextId int Context ID - * @param $roleId int ROLE_ID_... + * @param int $contextId Context ID + * @param int $roleId ROLE_ID_... * * @return UserGroup|false */ @@ -263,9 +263,9 @@ public function getDefaultByRoleId($contextId, $roleId) /** * Check whether the passed user group id is default or not. * - * @param $userGroupId Integer + * @param int $userGroupId * - * @return boolean + * @return bool */ public function isDefault($userGroupId) { @@ -281,9 +281,9 @@ public function isDefault($userGroupId) /** * Get all user groups belonging to a role * - * @param Integer $contextId - * @param Integer $roleId - * @param boolean $default (optional) + * @param int $contextId + * @param int $roleId + * @param bool $default (optional) * @param DBResultRange $dbResultRange (optional) * * @return DAOResultFactory @@ -311,8 +311,8 @@ public function getByRoleId($contextId, $roleId, $default = false, $dbResultRang /** * Get an array of user group ids belonging to a given role * - * @param $roleId int ROLE_ID_... - * @param $contextId int Context ID + * @param int $roleId ROLE_ID_... + * @param int $contextId Context ID */ public function getUserGroupIdsByRoleId($roleId, $contextId = null) { @@ -339,10 +339,10 @@ public function getUserGroupIdsByRoleId($roleId, $contextId = null) /** * Check if a user is in a particular user group * - * @param $userId int - * @param $userGroupId int + * @param int $userId + * @param int $userGroupId * - * @return boolean + * @return bool */ public function userInGroup($userId, $userGroupId) { @@ -362,10 +362,10 @@ public function userInGroup($userId, $userGroupId) /** * Check if a user is in any user group * - * @param $userId int - * @param $contextId int optional + * @param int $userId + * @param int $contextId optional * - * @return boolean + * @return bool */ public function userInAnyGroup($userId, $contextId = null) { @@ -389,8 +389,8 @@ public function userInAnyGroup($userId, $contextId = null) /** * Retrieve user groups to which a user is assigned. * - * @param $userId int - * @param $contextId int + * @param int $userId + * @param int $contextId * * @return DAOResultFactory */ @@ -416,8 +416,8 @@ public function getByUserId($userId, $contextId = null) /** * Validation check to see if user group exists for a given context * - * @param $contextId - * @param $userGroupId + * @param int $contextId + * @param int $userGroupId * * @return bool */ @@ -437,7 +437,7 @@ public function contextHasGroup($contextId, $userGroupId) /** * Retrieve user groups for a given context (all contexts if null) * - * @param Integer $contextId (optional) + * @param int $contextId (optional) * @param DBResultRange $dbResultRange (optional) * * @return DAOResultFactory @@ -481,7 +481,7 @@ public function getUserCountByContextId(int $contextId = null): Collection /** * Retrieve the number of users associated with the specified context. * - * @param $contextId int + * @param int $contextId * @param null|mixed $userGroupId * @param null|mixed $roleId * @@ -528,10 +528,10 @@ public function getUsersByContextId($contextId, $searchType = null, $search = nu /** * Find users that don't have a given role * - * @param $roleId ROLE_ID_... int (const) - * @param $contextId int Optional context ID - * @param $search string Optional search string - * @param $rangeInfo RangeInfo Optional range info + * @param int $roleId ROLE_ID_... int (const) + * @param int $contextId Optional context ID + * @param string $search Optional search string + * @param RangeInfo $rangeInfo Optional range info * * @return DAOResultFactory */ @@ -651,7 +651,7 @@ public function deleteAssignmentsByUserId($userId, $userGroupId = null) /** * Delete all assignments to a given user group * - * @param unknown_type $userGroupId + * @param int $userGroupId */ public function deleteAssignmentsByUserGroupId($userGroupId) { @@ -686,9 +686,9 @@ public function assignUserToGroup($userId, $groupId) /** * remove a given user from a given user group * - * @param $userId int - * @param $groupId int - * @param $contextId int + * @param int $userId + * @param int $groupId + * @param int $contextId */ public function removeUserFromGroup($userId, $groupId, $contextId) { @@ -703,8 +703,8 @@ public function removeUserFromGroup($userId, $groupId, $contextId) /** * Delete all stage assignments in a user group. * - * @param $contextId int - * @param $userGroupId int + * @param int $contextId + * @param int $userGroupId */ public function removeAllStagesFromGroup($contextId, $userGroupId) { @@ -717,9 +717,9 @@ public function removeAllStagesFromGroup($contextId, $userGroupId) /** * Assign a user group to a stage * - * @param $contextId int - * @param $userGroupId int - * @param $stageId int + * @param int $contextId + * @param int $userGroupId + * @param int $stageId */ public function assignGroupToStage($contextId, $userGroupId, $stageId) { @@ -732,9 +732,9 @@ public function assignGroupToStage($contextId, $userGroupId, $stageId) /** * Remove a user group from a stage * - * @param $contextId int - * @param $userGroupId int - * @param $stageId int + * @param int $contextId + * @param int $userGroupId + * @param int $stageId */ public function removeGroupFromStage($contextId, $userGroupId, $stageId) { @@ -750,11 +750,10 @@ public function removeGroupFromStage($contextId, $userGroupId, $stageId) /** * Method for updatea userGroup setting * - * @param $userGroupId int - * @param $name string - * @param $value mixed - * @param $type string data type of the setting. If omitted, type will be guessed - * @param $isLocalized boolean + * @param int $userGroupId + * @param string $name + * @param string $type data type of the setting. If omitted, type will be guessed + * @param bool $isLocalized */ public function updateSetting($userGroupId, $name, $value, $type = null, $isLocalized = false) { @@ -796,9 +795,9 @@ public function updateSetting($userGroupId, $name, $value, $type = null, $isLoca /** * Retrieve a context setting value. * - * @param $userGroupId int - * @param $name string - * @param $locale string optional + * @param int $userGroupId + * @param string $name + * @param string $locale optional */ public function getSetting($userGroupId, $name, $locale = null) { @@ -833,10 +832,10 @@ public function getSetting($userGroupId, $name, $locale = null) /** * Load the XML file and move the settings to the DB * - * @param $contextId - * @param $filename + * @param int $contextId + * @param string $filename * - * @return boolean true === success + * @return bool true === success */ public function installSettings($contextId, $filename) { @@ -902,8 +901,8 @@ public function installSettings($contextId, $filename) /** * use the locale keys stored in the settings table to install the locale settings * - * @param $locale - * @param $contextId + * @param string $locale + * @param int $contextId */ public function installLocale($locale, $contextId = null) { @@ -934,7 +933,7 @@ public function installLocale($locale, $contextId = null) /** * Remove all settings associated with a locale * - * @param $locale + * @param string $locale */ public function deleteSettingsByLocale($locale) { @@ -1095,8 +1094,8 @@ public function getUserGroupsByStage($contextId, $stageId, $roleId = null, $dbRe /** * Get all stages assigned to one user group in one context. * - * @param $contextId int The context ID. - * @param $userGroupId int The user group ID + * @param int $contextId The context ID. + * @param int $userGroupId The user group ID * * @return array */ @@ -1141,10 +1140,10 @@ public function userGroupAssignedToStage($userGroupId, $stageId) /** * Check to see whether a user is assigned to a stage ID via a user group. * - * @param $contextId int - * @param $userId int + * @param int $contextId + * @param int $userId * - * @return boolean + * @return bool */ public function userAssignmentExists($contextId, $userId, $stageId) { @@ -1165,8 +1164,8 @@ public function userAssignmentExists($contextId, $userId, $stageId) /** * Get all user group IDs with recommendOnly option enabled. * - * @param $contextId integer - * @param $roleId integer (optional) + * @param int $contextId + * @param int $roleId (optional) * * @return array */ @@ -1196,8 +1195,8 @@ public function getRecommendOnlyGroupIds($contextId, $roleId = null) /** * Get all user group IDs with permit_metadata_edit option enabled. * - * @param $contextId integer - * @param $roleId integer (optional) + * @param int $contextId + * @param int $roleId (optional) * * @return array */ diff --git a/classes/security/Validation.inc.php b/classes/security/Validation.inc.php index 77e35f2d072..ffa06b68831 100644 --- a/classes/security/Validation.inc.php +++ b/classes/security/Validation.inc.php @@ -29,10 +29,10 @@ class Validation /** * Authenticate user credentials and mark the user as logged in in the current session. * - * @param $username string - * @param $password string unencrypted password - * @param $reason string reference to string to receive the reason an account was disabled; null otherwise - * @param $remember boolean remember a user's session past the current browser session + * @param string $username + * @param string $password unencrypted password + * @param string $reason reference to string to receive the reason an account was disabled; null otherwise + * @param bool $remember remember a user's session past the current browser session * * @return User the User associated with the login credentials, or false if the credentials are invalid */ @@ -92,7 +92,7 @@ public static function login($username, $password, &$reason, $remember = false) * @param string $hash the password hash from the database * @param string &$rehash if password needs rehash, this variable is used * - * @return boolean + * @return bool */ public static function verifyPassword($username, $password, $hash, &$rehash) { @@ -114,9 +114,9 @@ public static function verifyPassword($username, $password, $hash, &$rehash) /** * Mark the user as logged in in the current session. * - * @param $user User user to register in the session - * @param $reason string reference to string to receive the reason an account was disabled; null otherwise - * @param $remember boolean remember a user's session past the current browser session + * @param User $user user to register in the session + * @param string $reason reference to string to receive the reason an account was disabled; null otherwise + * @param bool $remember remember a user's session past the current browser session * * @return mixed User or boolean the User associated with the login credentials, or false if the credentials are invalid */ @@ -162,7 +162,7 @@ public static function registerUserSession($user, &$reason, $remember = false) /** * Mark the user as logged out in the current session. * - * @return boolean + * @return bool */ public static function logout() { @@ -186,7 +186,7 @@ public static function logout() /** * Redirect to the login page, appending the current URL as the source. * - * @param $message string Optional name of locale key to add to login page + * @param string $message Optional name of locale key to add to login page */ public static function redirectLogin($message = null) { @@ -206,10 +206,10 @@ public static function redirectLogin($message = null) /** * Check if a user's credentials are valid. * - * @param $username string username - * @param $password string unencrypted password + * @param string $username username + * @param string $password unencrypted password * - * @return boolean + * @return bool */ public static function checkCredentials($username, $password) { @@ -245,10 +245,10 @@ public static function checkCredentials($username, $password) /** * Check if a user is authorized to access the specified role in the specified context. * - * @param $roleId int - * @param $contextId optional (e.g., for global site admin role), the ID of the context + * @param int $roleId + * @param int $contextId optional (e.g., for global site admin role), the ID of the context * - * @return boolean + * @return bool */ public static function isAuthorized($roleId, $contextId = 0) { @@ -276,10 +276,10 @@ public static function isAuthorized($roleId, $contextId = 0) * The username is used as a unique salt to make dictionary * attacks against a compromised database more difficult. * - * @param $username string username (kept for backwards compatibility) - * @param $password string unencrypted password - * @param $encryption string optional encryption algorithm to use, defaulting to the value from the site configuration - * @param $legacy boolean if true, use legacy hashing technique for backwards compatibility + * @param string $username username (kept for backwards compatibility) + * @param string $password unencrypted password + * @param string $encryption optional encryption algorithm to use, defaulting to the value from the site configuration + * @param bool $legacy if true, use legacy hashing technique for backwards compatibility * * @return string encrypted password */ @@ -311,7 +311,7 @@ public static function encryptCredentials($username, $password, $encryption = fa * Generate a random password. * Assumes the random number generator has already been seeded. * - * @param $length int the length of the password to generate (default is site minimum) + * @param int $length the length of the password to generate (default is site minimum) * * @return string */ @@ -335,8 +335,8 @@ public static function generatePassword($length = null) /** * Generate a hash value to use for confirmation to reset a password. * - * @param $userId int - * @param $expiry int timestamp when hash expires, defaults to CURRENT_TIME + RESET_SECONDS + * @param int $userId + * @param int $expiry timestamp when hash expires, defaults to CURRENT_TIME + RESET_SECONDS * * @return string (boolean false if user is invalid) */ @@ -373,10 +373,10 @@ public static function generatePasswordResetHash($userId, $expiry = null) /** * Check if provided password reset hash is valid. * - * @param $userId int - * @param $hash string + * @param int $userId + * @param string $hash * - * @return boolean + * @return bool */ public static function verifyPasswordResetHash($userId, $hash) { @@ -394,8 +394,8 @@ public static function verifyPasswordResetHash($userId, $hash) /** * Suggest a username given the first and last names. * - * @param $givenName string - * @param $familyName string + * @param string $givenName + * @param string $familyName * * @return string */ @@ -415,7 +415,7 @@ public static function suggestUsername($givenName, $familyName = null) /** * Check if the user must change their password in order to log in. * - * @return boolean + * @return bool */ public static function isLoggedIn() { @@ -429,7 +429,7 @@ public static function isLoggedIn() /** * Check if the user is logged in as a different user. * - * @return boolean + * @return bool */ public static function isLoggedInAs() { @@ -443,7 +443,7 @@ public static function isLoggedInAs() /** * Shortcut for checking authorization as site admin. * - * @return boolean + * @return bool */ public static function isSiteAdmin() { @@ -453,10 +453,10 @@ public static function isSiteAdmin() /** * Check whether a user is allowed to administer another user. * - * @param $administeredUserId int User ID of user to potentially administer - * @param $administratorUserId int User ID of user who wants to do the administrating + * @param int $administeredUserId User ID of user to potentially administer + * @param int $administratorUserId User ID of user who wants to do the administrating * - * @return boolean True IFF the administration operation is permitted + * @return bool True IFF the administration operation is permitted */ public static function canAdminister($administeredUserId, $administratorUserId) { diff --git a/classes/security/authorization/AssignedStageRoleHandlerOperationPolicy.inc.php b/classes/security/authorization/AssignedStageRoleHandlerOperationPolicy.inc.php index 040139a8011..8720ba4d5c9 100644 --- a/classes/security/authorization/AssignedStageRoleHandlerOperationPolicy.inc.php +++ b/classes/security/authorization/AssignedStageRoleHandlerOperationPolicy.inc.php @@ -23,13 +23,13 @@ class AssignedStageRoleHandlerOperationPolicy extends RoleBasedHandlerOperationP /** * Constructor * - * @param $request PKPRequest - * @param $roles array|integer either a single role ID or an array of role ids - * @param $operations array|string either a single operation or a list of operations that + * @param PKPRequest $request + * @param array|integer $roles either a single role ID or an array of role ids + * @param array|string $operations either a single operation or a list of operations that * this policy is targeting. - * @param $stageId int The stage ID to check for assigned roles - * @param $message string a message to be displayed if the authorization fails - * @param $allRoles boolean whether all roles must match ("all of") or whether it is + * @param int $stageId The stage ID to check for assigned roles + * @param string $message a message to be displayed if the authorization fails + * @param bool $allRoles whether all roles must match ("all of") or whether it is * enough for only one role to match ("any of"). Default: false ("any of") */ public function __construct( diff --git a/classes/security/authorization/AuthorDashboardAccessPolicy.inc.php b/classes/security/authorization/AuthorDashboardAccessPolicy.inc.php index cb2997f0420..8815a891e2b 100644 --- a/classes/security/authorization/AuthorDashboardAccessPolicy.inc.php +++ b/classes/security/authorization/AuthorDashboardAccessPolicy.inc.php @@ -23,9 +23,9 @@ class AuthorDashboardAccessPolicy extends ContextPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request arguments - * @param $roleAssignments array + * @param PKPRequest $request + * @param array $args request arguments + * @param array $roleAssignments */ public function __construct($request, &$args, $roleAssignments) { diff --git a/classes/security/authorization/AuthorizationDecisionManager.inc.php b/classes/security/authorization/AuthorizationDecisionManager.inc.php index fd788685145..61829dd360c 100644 --- a/classes/security/authorization/AuthorizationDecisionManager.inc.php +++ b/classes/security/authorization/AuthorizationDecisionManager.inc.php @@ -55,7 +55,7 @@ public function __construct() * Set the default decision if none of the * policies in the root policy set applies. * - * @param $decisionIfNoPolicyApplies integer + * @param int $decisionIfNoPolicyApplies */ public function setDecisionIfNoPolicyApplies($decisionIfNoPolicyApplies) { @@ -65,8 +65,8 @@ public function setDecisionIfNoPolicyApplies($decisionIfNoPolicyApplies) /** * Add an authorization policy or a policy set. * - * @param $policyOrPolicySet AuthorizationPolicy|PolicySet - * @param $addToTop boolean whether to insert the new policy + * @param AuthorizationPolicy|PolicySet $policyOrPolicySet + * @param bool $addToTop whether to insert the new policy * to the top of the list. */ public function addPolicy($policyOrPolicySet, $addToTop = false) @@ -77,7 +77,7 @@ public function addPolicy($policyOrPolicySet, $addToTop = false) /** * Add an authorization message * - * @param $message string + * @param string $message */ public function addAuthorizationMessage($message) { @@ -97,7 +97,7 @@ public function getAuthorizationMessages() /** * Retrieve an object from the authorized context * - * @param $assocType integer + * @param int $assocType * * @return mixed will return null if the context * for the given assoc type does not exist. @@ -129,7 +129,7 @@ public function &getAuthorizedContext() /** * Take an authorization decision. * - * @return integer one of AUTHORIZATION_PERMIT or + * @return int one of AUTHORIZATION_PERMIT or * AUTHORIZATION_DENY. */ public function decide() @@ -159,11 +159,11 @@ public function decide() /** * Recursively decide the given policy set. * - * @param $policySet PolicySet - * @param $callOnDeny A "call-on-deny" advice will be passed + * @param PolicySet $policySet + * @param int $callOnDeny A "call-on-deny" advice will be passed * back by reference if found. * - * @return integer one of the AUTHORIZATION_* values. + * @return int one of the AUTHORIZATION_* values. */ public function _decidePolicySet(&$policySet, &$callOnDeny) { diff --git a/classes/security/authorization/AuthorizationPolicy.inc.php b/classes/security/authorization/AuthorizationPolicy.inc.php index af9080588aa..de8fcca7b60 100644 --- a/classes/security/authorization/AuthorizationPolicy.inc.php +++ b/classes/security/authorization/AuthorizationPolicy.inc.php @@ -45,7 +45,7 @@ class AuthorizationPolicy /** * Constructor * - * @param $message string + * @param string $message */ public function __construct($message = null) { @@ -60,8 +60,7 @@ public function __construct($message = null) /** * Set an advice * - * @param $adviceType integer - * @param $adviceContent mixed + * @param int $adviceType */ public function setAdvice($adviceType, $adviceContent) { @@ -72,9 +71,9 @@ public function setAdvice($adviceType, $adviceContent) * Whether this policy implements * the given advice type. * - * @param $adviceType integer + * @param int $adviceType * - * @return boolean + * @return bool */ public function hasAdvice($adviceType) { @@ -84,7 +83,7 @@ public function hasAdvice($adviceType) /** * Get advice for the given advice type. * - * @param $adviceType integer + * @param int $adviceType */ public function &getAdvice($adviceType) { @@ -99,8 +98,7 @@ public function &getAdvice($adviceType) /** * Add an object to the authorized context * - * @param $assocType integer - * @param $authorizedObject mixed + * @param int $assocType */ public function addAuthorizedContextObject($assocType, &$authorizedObject) { @@ -111,9 +109,9 @@ public function addAuthorizedContextObject($assocType, &$authorizedObject) * Check whether an object already exists in the * authorized context. * - * @param $assocType integer + * @param int $assocType * - * @return boolean + * @return bool */ public function hasAuthorizedContextObject($assocType) { @@ -123,7 +121,7 @@ public function hasAuthorizedContextObject($assocType) /** * Retrieve an object from the authorized context * - * @param $assocType integer + * @param int $assocType * * @return mixed will return null if the context * for the given assoc type does not exist. @@ -164,7 +162,7 @@ public function &getAuthorizedContext() /** * Whether this policy applies. * - * @return boolean + * @return bool */ public function applies() { diff --git a/classes/security/authorization/ContextAccessPolicy.inc.php b/classes/security/authorization/ContextAccessPolicy.inc.php index e4f7f0c2612..0bd49ec5a3a 100644 --- a/classes/security/authorization/ContextAccessPolicy.inc.php +++ b/classes/security/authorization/ContextAccessPolicy.inc.php @@ -21,8 +21,8 @@ class ContextAccessPolicy extends ContextPolicy /** * Constructor * - * @param $request PKPRequest - * @param $roleAssignments array + * @param PKPRequest $request + * @param array $roleAssignments */ public function __construct($request, $roleAssignments) { diff --git a/classes/security/authorization/ContextRequiredPolicy.inc.php b/classes/security/authorization/ContextRequiredPolicy.inc.php index 71ae2f28610..7b6d3ae4871 100644 --- a/classes/security/authorization/ContextRequiredPolicy.inc.php +++ b/classes/security/authorization/ContextRequiredPolicy.inc.php @@ -22,7 +22,7 @@ class ContextRequiredPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request, $message = 'user.authorization.contextRequired') { diff --git a/classes/security/authorization/DataObjectRequiredPolicy.inc.php b/classes/security/authorization/DataObjectRequiredPolicy.inc.php index 7d068232040..37875770246 100644 --- a/classes/security/authorization/DataObjectRequiredPolicy.inc.php +++ b/classes/security/authorization/DataObjectRequiredPolicy.inc.php @@ -54,11 +54,11 @@ public function &getArgs() /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $parameterName string the request parameter we expect - * @param $message string - * @param $operations array Optional list of operations for which this check takes effect. If specified, operations outside this set will not be checked against this policy. + * @param PKPRequest $request + * @param array $args request parameters + * @param string $parameterName the request parameter we expect + * @param string $message + * @param array $operations Optional list of operations for which this check takes effect. If specified, operations outside this set will not be checked against this policy. */ public function __construct($request, &$args, $parameterName, $message = null, $operations = null) { @@ -103,10 +103,10 @@ public function dataObjectEffect() /** * Identifies a data object id in the request. * - * @param $lookOnlyByParameterName boolean True iff page router + * @param bool $lookOnlyByParameterName True iff page router * requests should only look for named parameters. * - * @return integer|false returns false if no valid submission id could be found. + * @return int|false returns false if no valid submission id could be found. */ public function getDataObjectId($lookOnlyByParameterName = false) { diff --git a/classes/security/authorization/DecisionWritePolicy.inc.php b/classes/security/authorization/DecisionWritePolicy.inc.php new file mode 100644 index 00000000000..676252b9f4b --- /dev/null +++ b/classes/security/authorization/DecisionWritePolicy.inc.php @@ -0,0 +1,36 @@ +addPolicy(new DecisionTypeRequiredPolicy($request, $args, $decision)); + $this->addPolicy(new DecisionStageValidPolicy()); + $this->addPolicy(new DecisionAllowedPolicy($editor)); + } +} + +if (!PKP_STRICT_MODE) { + class_alias('\PKP\security\authorization\DecisionWritePolicy', '\DecisionWritePolicy'); +} diff --git a/classes/security/authorization/EditorDecisionAccessPolicy.inc.php b/classes/security/authorization/EditorDecisionAccessPolicy.inc.php deleted file mode 100644 index 6792e92e957..00000000000 --- a/classes/security/authorization/EditorDecisionAccessPolicy.inc.php +++ /dev/null @@ -1,46 +0,0 @@ -addPolicy(new WorkflowStageAccessPolicy($request, $args, $roleAssignments, $submissionParameterName, $stageId, PKPApplication::WORKFLOW_TYPE_EDITORIAL)); - - // An editor decision can only be made if there is an editor assigned to the stage - $this->addPolicy(new ManagerRequiredPolicy($request)); - } -} - -if (!PKP_STRICT_MODE) { - class_alias('\PKP\security\authorization\EditorDecisionAccessPolicy', '\EditorDecisionAccessPolicy'); -} diff --git a/classes/security/authorization/HandlerOperationPolicy.inc.php b/classes/security/authorization/HandlerOperationPolicy.inc.php index b98cf4855fe..6726eb8f843 100644 --- a/classes/security/authorization/HandlerOperationPolicy.inc.php +++ b/classes/security/authorization/HandlerOperationPolicy.inc.php @@ -26,10 +26,10 @@ class HandlerOperationPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest - * @param $operations array|string either a single operation or a list of operations that + * @param PKPRequest $request + * @param array|string $operations either a single operation or a list of operations that * this policy is targeting. - * @param $message string a message to be displayed if the authorization fails + * @param string $message a message to be displayed if the authorization fails */ public function __construct($request, $operations, $message = null) { @@ -77,7 +77,7 @@ public function getOperations() * Check whether the requested operation is on * the list of permitted operations. * - * @return boolean + * @return bool */ public function _checkOperationWhitelist() { diff --git a/classes/security/authorization/HttpsPolicy.inc.php b/classes/security/authorization/HttpsPolicy.inc.php index a45c769cb8c..fbecd4e6d61 100644 --- a/classes/security/authorization/HttpsPolicy.inc.php +++ b/classes/security/authorization/HttpsPolicy.inc.php @@ -24,7 +24,7 @@ class HttpsPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request) { diff --git a/classes/security/authorization/NoteAccessPolicy.inc.php b/classes/security/authorization/NoteAccessPolicy.inc.php index 9aed706a18c..96b4133269a 100644 --- a/classes/security/authorization/NoteAccessPolicy.inc.php +++ b/classes/security/authorization/NoteAccessPolicy.inc.php @@ -36,9 +36,9 @@ class NoteAccessPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest - * @param $noteId int - * @param $accessMode int NOTE_ACCESS_... + * @param PKPRequest $request + * @param int $noteId + * @param int $accessMode NOTE_ACCESS_... */ public function __construct($request, $noteId, $accessMode) { diff --git a/classes/security/authorization/PKPPublicAccessPolicy.inc.php b/classes/security/authorization/PKPPublicAccessPolicy.inc.php index e52ae20f80a..33b06ca5f84 100644 --- a/classes/security/authorization/PKPPublicAccessPolicy.inc.php +++ b/classes/security/authorization/PKPPublicAccessPolicy.inc.php @@ -20,10 +20,10 @@ class PKPPublicAccessPolicy extends HandlerOperationPolicy /** * Constructor * - * @param $request PKPRequest - * @param $operations array|string either a single operation or a list of operations that + * @param PKPRequest $request + * @param array|string $operations either a single operation or a list of operations that * this policy is targeting. - * @param $message string a message to be displayed if the authorization fails + * @param string $message a message to be displayed if the authorization fails */ public function __construct($request, $operations, $message = 'user.authorization.privateOperation') { diff --git a/classes/security/authorization/PKPSiteAccessPolicy.inc.php b/classes/security/authorization/PKPSiteAccessPolicy.inc.php index 51c10d4a20f..29ebd4999e1 100644 --- a/classes/security/authorization/PKPSiteAccessPolicy.inc.php +++ b/classes/security/authorization/PKPSiteAccessPolicy.inc.php @@ -23,11 +23,11 @@ class PKPSiteAccessPolicy extends PolicySet /** * Constructor * - * @param $request PKPRequest - * @param $operations array|string either a single operation or a list of operations that + * @param PKPRequest $request + * @param array|string $operations either a single operation or a list of operations that * this policy is targeting. - * @param $roleAssignments array|int Either an array of role -> operation assignments or the constant SITE_ACCESS_ALL_ROLES - * @param $message string a message to be displayed if the authorization fails + * @param array|int $roleAssignments Either an array of role -> operation assignments or the constant SITE_ACCESS_ALL_ROLES + * @param string $message a message to be displayed if the authorization fails */ public function __construct($request, $operations, $roleAssignments, $message = 'user.authorization.loginRequired') { diff --git a/classes/security/authorization/PluginAccessPolicy.inc.php b/classes/security/authorization/PluginAccessPolicy.inc.php index 79c7a8c6242..817b518dbdb 100644 --- a/classes/security/authorization/PluginAccessPolicy.inc.php +++ b/classes/security/authorization/PluginAccessPolicy.inc.php @@ -26,10 +26,10 @@ class PluginAccessPolicy extends PolicySet /** * Constructor * - * @param $request PKPRequest - * @param $args array request arguments - * @param $roleAssignments array - * @param $accessMode int + * @param PKPRequest $request + * @param array $args request arguments + * @param array $roleAssignments + * @param int $accessMode */ public function __construct($request, &$args, $roleAssignments, $accessMode = self::ACCESS_MODE_ADMIN) { diff --git a/classes/security/authorization/PolicySet.inc.php b/classes/security/authorization/PolicySet.inc.php index cc40f520671..4b5373b23e9 100644 --- a/classes/security/authorization/PolicySet.inc.php +++ b/classes/security/authorization/PolicySet.inc.php @@ -26,17 +26,17 @@ class PolicySet /** @var array */ public $_policies = []; - /** @var integer */ + /** @var int */ public $_combiningAlgorithm; - /** @var integer the default effect if none of the policies in the set applies */ + /** @var int the default effect if none of the policies in the set applies */ public $_effectIfNoPolicyApplies = AuthorizationPolicy::AUTHORIZATION_DENY; /** * Constructor * - * @param $combiningAlgorithm int COMBINING_... + * @param int $combiningAlgorithm COMBINING_... */ public function __construct($combiningAlgorithm = self::COMBINING_DENY_OVERRIDES) { @@ -49,8 +49,8 @@ public function __construct($combiningAlgorithm = self::COMBINING_DENY_OVERRIDES /** * Add a policy or a nested policy set. * - * @param $policyOrPolicySet AuthorizationPolicy|PolicySet - * @param $addToTop boolean whether to insert the new policy + * @param AuthorizationPolicy|PolicySet $policyOrPolicySet + * @param bool $addToTop whether to insert the new policy * to the top of the list. */ public function addPolicy($policyOrPolicySet, $addToTop = false) @@ -76,7 +76,7 @@ public function &getPolicies() /** * Return the combining algorithm * - * @return integer + * @return int */ public function getCombiningAlgorithm() { @@ -86,7 +86,7 @@ public function getCombiningAlgorithm() /** * Set the default effect if none of the policies in the set applies * - * @param $effectIfNoPolicyApplies integer + * @param int $effectIfNoPolicyApplies */ public function setEffectIfNoPolicyApplies($effectIfNoPolicyApplies) { @@ -99,7 +99,7 @@ public function setEffectIfNoPolicyApplies($effectIfNoPolicyApplies) /** * Get the default effect if none of the policies in the set applies * - * @return integer + * @return int */ public function getEffectIfNoPolicyApplies() { diff --git a/classes/security/authorization/PublicationAccessPolicy.inc.php b/classes/security/authorization/PublicationAccessPolicy.inc.php index abfd8a2500e..b76994250c8 100644 --- a/classes/security/authorization/PublicationAccessPolicy.inc.php +++ b/classes/security/authorization/PublicationAccessPolicy.inc.php @@ -17,16 +17,17 @@ use PKP\security\authorization\internal\ContextPolicy; use PKP\security\authorization\internal\PublicationIsSubmissionPolicy; use PKP\security\authorization\internal\PublicationRequiredPolicy; +use PKP\security\authorization\internal\PublicationCanBeEditedPolicy; class PublicationAccessPolicy extends ContextPolicy { /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $roleAssignments array - * @param $publicationParameterName string the request parameter we + * @param PKPRequest $request + * @param array $args request parameters + * @param array $roleAssignments + * @param string $publicationParameterName the request parameter we * expect the submission id in. */ public function __construct($request, $args, $roleAssignments, $publicationParameterName = 'publicationId') diff --git a/classes/security/authorization/PublicationWritePolicy.inc.php b/classes/security/authorization/PublicationWritePolicy.inc.php index a1c1f3f41e8..dc5a42c13d3 100644 --- a/classes/security/authorization/PublicationWritePolicy.inc.php +++ b/classes/security/authorization/PublicationWritePolicy.inc.php @@ -23,9 +23,9 @@ class PublicationWritePolicy extends ContextPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request arguments - * @param $roleAssignments array + * @param PKPRequest $request + * @param array $args request arguments + * @param array $roleAssignments */ public function __construct($request, &$args, $roleAssignments) { @@ -39,7 +39,7 @@ public function __construct($request, &$args, $roleAssignments) $this->addPolicy(new StageRolePolicy([Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT, Role::ROLE_ID_AUTHOR])); // Can the user edit the publication? - $this->addPolicy(new PublicationCanBeEditedPolicy($request, 'api.submissions.403.userCantEdit')); + $this->addPolicy(new PublicationCanBeEditedPolicy($request, 'api.submissions.403.userCantEdit')); } } diff --git a/classes/security/authorization/QueryAccessPolicy.inc.php b/classes/security/authorization/QueryAccessPolicy.inc.php index 656e5d35fd6..98f93f30951 100644 --- a/classes/security/authorization/QueryAccessPolicy.inc.php +++ b/classes/security/authorization/QueryAccessPolicy.inc.php @@ -25,10 +25,10 @@ class QueryAccessPolicy extends ContextPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $roleAssignments array - * @param $stageId int + * @param PKPRequest $request + * @param array $args request parameters + * @param array $roleAssignments + * @param int $stageId */ public function __construct($request, $args, $roleAssignments, $stageId) { diff --git a/classes/security/authorization/QueryWorkflowStageAccessPolicy.inc.php b/classes/security/authorization/QueryWorkflowStageAccessPolicy.inc.php index a5734c77aee..da7dc37772b 100644 --- a/classes/security/authorization/QueryWorkflowStageAccessPolicy.inc.php +++ b/classes/security/authorization/QueryWorkflowStageAccessPolicy.inc.php @@ -24,11 +24,11 @@ class QueryWorkflowStageAccessPolicy extends ContextPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request arguments - * @param $roleAssignments array - * @param $submissionParameterName string - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. + * @param PKPRequest $request + * @param array $args request arguments + * @param array $roleAssignments + * @param string $submissionParameterName + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. */ public function __construct($request, &$args, $roleAssignments, $submissionParameterName, $stageId) { diff --git a/classes/security/authorization/RestrictedSiteAccessPolicy.inc.php b/classes/security/authorization/RestrictedSiteAccessPolicy.inc.php index 0335b64b047..7f9a675730d 100644 --- a/classes/security/authorization/RestrictedSiteAccessPolicy.inc.php +++ b/classes/security/authorization/RestrictedSiteAccessPolicy.inc.php @@ -26,7 +26,7 @@ class RestrictedSiteAccessPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request) { diff --git a/classes/security/authorization/ReviewAssignmentFileWritePolicy.inc.php b/classes/security/authorization/ReviewAssignmentFileWritePolicy.inc.php index f467564bc38..4fe39f7b71a 100644 --- a/classes/security/authorization/ReviewAssignmentFileWritePolicy.inc.php +++ b/classes/security/authorization/ReviewAssignmentFileWritePolicy.inc.php @@ -30,8 +30,8 @@ class ReviewAssignmentFileWritePolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest - * @param $reviewAssignmentId int + * @param PKPRequest $request + * @param int $reviewAssignmentId */ public function __construct($request, $reviewAssignmentId) { diff --git a/classes/security/authorization/ReviewStageAccessPolicy.inc.php b/classes/security/authorization/ReviewStageAccessPolicy.inc.php index c2c7c6a651b..906e159e86b 100644 --- a/classes/security/authorization/ReviewStageAccessPolicy.inc.php +++ b/classes/security/authorization/ReviewStageAccessPolicy.inc.php @@ -22,12 +22,12 @@ class ReviewStageAccessPolicy extends ContextPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request arguments - * @param $roleAssignments array - * @param $submissionParameterName string - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. - * @param $permitDeclined bool Whether to permit reviewers to fetch declined review assignments. + * @param PKPRequest $request + * @param array $args request arguments + * @param array $roleAssignments + * @param string $submissionParameterName + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. + * @param bool $permitDeclined Whether to permit reviewers to fetch declined review assignments. */ public function __construct($request, &$args, $roleAssignments, $submissionParameterName, $stageId, $permitDeclined = false) { diff --git a/classes/security/authorization/RoleBasedHandlerOperationPolicy.inc.php b/classes/security/authorization/RoleBasedHandlerOperationPolicy.inc.php index e07652d0970..e45898d4d31 100644 --- a/classes/security/authorization/RoleBasedHandlerOperationPolicy.inc.php +++ b/classes/security/authorization/RoleBasedHandlerOperationPolicy.inc.php @@ -20,18 +20,18 @@ class RoleBasedHandlerOperationPolicy extends HandlerOperationPolicy /** @var array the target roles */ public $_roles = []; - /** @var boolean */ + /** @var bool */ public $_allRoles; /** * Constructor * - * @param $request PKPRequest - * @param $roles array|integer either a single role ID or an array of role ids - * @param $operations array|string either a single operation or a list of operations that + * @param PKPRequest $request + * @param array|integer $roles either a single role ID or an array of role ids + * @param array|string $operations either a single operation or a list of operations that * this policy is targeting. - * @param $message string a message to be displayed if the authorization fails - * @param $allRoles boolean whether all roles must match ("all of") or whether it is + * @param string $message a message to be displayed if the authorization fails + * @param bool $allRoles whether all roles must match ("all of") or whether it is * enough for only one role to match ("any of"). Default: false ("any of") */ public function __construct( @@ -92,9 +92,9 @@ public function effect() * to any of the allowed roles. If so then grant * access. * - * @param $userRoles array + * @param array $userRoles * - * @return boolean + * @return bool */ public function _checkUserRoleAssignment($userRoles) { diff --git a/classes/security/authorization/StageRolePolicy.inc.php b/classes/security/authorization/StageRolePolicy.inc.php index b9caa2848f2..91fdaf4c0a2 100644 --- a/classes/security/authorization/StageRolePolicy.inc.php +++ b/classes/security/authorization/StageRolePolicy.inc.php @@ -30,7 +30,7 @@ class StageRolePolicy extends AuthorizationPolicy /** @var int|null */ private $_stageId; - /** @var boolean */ + /** @var bool */ private $_allowRecommendOnly; /** @@ -39,7 +39,7 @@ class StageRolePolicy extends AuthorizationPolicy * @param array $roleIds The roles required to be authorized * @param int $stageId The stage the role assignment is required on to be authorized. * Leave this null to check against the submission's currently active stage. - * @param boolean $allowRecommendOnly Authorize the user even if the stage assignment + * @param bool $allowRecommendOnly Authorize the user even if the stage assignment * is a "recommend only" assignment. Default allows "recommend only" assignments to * pass authorization. */ diff --git a/classes/security/authorization/SubmissionAccessPolicy.inc.php b/classes/security/authorization/SubmissionAccessPolicy.inc.php index dd48ab46649..9fb87d0083d 100644 --- a/classes/security/authorization/SubmissionAccessPolicy.inc.php +++ b/classes/security/authorization/SubmissionAccessPolicy.inc.php @@ -27,12 +27,12 @@ class SubmissionAccessPolicy extends ContextPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $roleAssignments array - * @param $submissionParameterName string the request parameter we + * @param PKPRequest $request + * @param array $args request parameters + * @param array $roleAssignments + * @param string $submissionParameterName the request parameter we * expect the submission id in. - * @param $permitDeclined boolean True iff declined reviews are permitted for viewing by reviewers + * @param bool $permitDeclined True iff declined reviews are permitted for viewing by reviewers */ public function __construct($request, $args, $roleAssignments, $submissionParameterName = 'submissionId', $permitDeclined = false) { diff --git a/classes/security/authorization/SubmissionFileAccessPolicy.inc.php b/classes/security/authorization/SubmissionFileAccessPolicy.inc.php index 9dde421fc7e..f0d6c796bc4 100644 --- a/classes/security/authorization/SubmissionFileAccessPolicy.inc.php +++ b/classes/security/authorization/SubmissionFileAccessPolicy.inc.php @@ -36,18 +36,18 @@ class SubmissionFileAccessPolicy extends ContextPolicy public const SUBMISSION_FILE_ACCESS_READ = 1; public const SUBMISSION_FILE_ACCESS_MODIFY = 2; - /** var $_baseFileAccessPolicy the base file file policy before _SUB_EDITOR is considered */ + /** @var PoliceSet $_baseFileAccessPolicy the base file file policy before _SUB_EDITOR is considered */ public $_baseFileAccessPolicy; /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $roleAssignments array - * @param $mode int bitfield SUBMISSION_FILE_ACCESS_... - * @param $submissionFileId int - * @param $submissionParameterName string the request parameter we expect + * @param PKPRequest $request + * @param array $args request parameters + * @param array $roleAssignments + * @param int $mode bitfield SUBMISSION_FILE_ACCESS_... + * @param int $submissionFileId + * @param string $submissionParameterName the request parameter we expect * the submission id in. */ public function __construct($request, $args, $roleAssignments, $mode, $submissionFileId = null, $submissionParameterName = 'submissionId') @@ -65,7 +65,7 @@ public function __construct($request, $args, $roleAssignments, $mode, $submissio * @param PKPRequest $request * @param array $args * @param array $roleAssignments - * @param int bitfield $mode + * @param int $mode bitfield * @param int $submissionFileId * @param string $submissionParameterName */ diff --git a/classes/security/authorization/UserRequiredPolicy.inc.php b/classes/security/authorization/UserRequiredPolicy.inc.php index 4a0e37cf1bd..02dec2974ad 100644 --- a/classes/security/authorization/UserRequiredPolicy.inc.php +++ b/classes/security/authorization/UserRequiredPolicy.inc.php @@ -22,7 +22,7 @@ class UserRequiredPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request, $message = 'user.authorization.userRequired') { diff --git a/classes/security/authorization/UserRolesRequiredPolicy.inc.php b/classes/security/authorization/UserRolesRequiredPolicy.inc.php index 7d7dde71e78..1c436db06ca 100644 --- a/classes/security/authorization/UserRolesRequiredPolicy.inc.php +++ b/classes/security/authorization/UserRolesRequiredPolicy.inc.php @@ -28,7 +28,7 @@ class UserRolesRequiredPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request) { @@ -128,8 +128,8 @@ public function _getContextRoles($roleContext, $contextDepth, $userRoles) * Prepare an array with the passed user roles. Can optionally * add those roles to an already created array. * - * @param $userRoles array - * @param $contextRoles array + * @param array $userRoles + * @param array $contextRoles * * @return array */ diff --git a/classes/security/authorization/WorkflowStageAccessPolicy.inc.php b/classes/security/authorization/WorkflowStageAccessPolicy.inc.php index b44d0b4eda1..268b8ad5189 100644 --- a/classes/security/authorization/WorkflowStageAccessPolicy.inc.php +++ b/classes/security/authorization/WorkflowStageAccessPolicy.inc.php @@ -25,12 +25,12 @@ class WorkflowStageAccessPolicy extends ContextPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request arguments - * @param $roleAssignments array - * @param $submissionParameterName string - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. - * @param $workflowType string|null Which workflow the stage access must be granted + * @param PKPRequest $request + * @param array $args request arguments + * @param array $roleAssignments + * @param string $submissionParameterName + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. + * @param string|null $workflowType Which workflow the stage access must be granted * for. One of PKPApplication::WORKFLOW_TYPE_*. */ public function __construct($request, &$args, $roleAssignments, $submissionParameterName, $stageId, $workflowType = null) diff --git a/classes/security/authorization/internal/ApiAuthorizationMiddleware.inc.php b/classes/security/authorization/internal/ApiAuthorizationMiddleware.inc.php index cfdca275610..0387c346e2e 100644 --- a/classes/security/authorization/internal/ApiAuthorizationMiddleware.inc.php +++ b/classes/security/authorization/internal/ApiAuthorizationMiddleware.inc.php @@ -39,7 +39,7 @@ public function __construct(APIHandler $handler) * * @param SlimRequest $slimRequest * - * @return boolean|string + * @return bool|string */ protected function _authorize($slimRequest) { @@ -78,7 +78,7 @@ protected function _authorize($slimRequest) * @param SlimResponse $response response * @param callable $next Next middleware * - * @return boolean|string|unknown + * @return bool|string|unknown */ public function __invoke($request, $response, $next) { diff --git a/classes/security/authorization/internal/ApiCsrfMiddleware.inc.php b/classes/security/authorization/internal/ApiCsrfMiddleware.inc.php index ec9238890c6..06b9d650d69 100644 --- a/classes/security/authorization/internal/ApiCsrfMiddleware.inc.php +++ b/classes/security/authorization/internal/ApiCsrfMiddleware.inc.php @@ -60,7 +60,7 @@ public function __invoke($slimRequest, $response, $next) * * @param SlimRequest $slimRequest * - * @return boolean + * @return bool */ protected function _isCSRFRequired($slimRequest) { @@ -76,7 +76,7 @@ protected function _isCSRFRequired($slimRequest) * * @param SlimRequest $slimRequest * - * @return boolean + * @return bool */ protected function _isCSRFValid($slimRequest) { diff --git a/classes/security/authorization/internal/ApiTokenDecodingMiddleware.inc.php b/classes/security/authorization/internal/ApiTokenDecodingMiddleware.inc.php index a518192130f..4c8ef10ee66 100644 --- a/classes/security/authorization/internal/ApiTokenDecodingMiddleware.inc.php +++ b/classes/security/authorization/internal/ApiTokenDecodingMiddleware.inc.php @@ -40,7 +40,7 @@ public function __construct(APIHandler $handler) * * @param SlimRequest $slimRequest * - * @return boolean|string + * @return bool|string */ protected function _decode($slimRequest) { @@ -119,7 +119,7 @@ protected function _decode($slimRequest) * @param SlimResponse $response response * @param callable $next Next middleware * - * @return boolean|string|unknown + * @return bool|string|unknown */ public function __invoke($request, $response, $next) { diff --git a/classes/security/authorization/internal/ContextPolicy.inc.php b/classes/security/authorization/internal/ContextPolicy.inc.php index 62a845b6b44..5d7d72e488a 100644 --- a/classes/security/authorization/internal/ContextPolicy.inc.php +++ b/classes/security/authorization/internal/ContextPolicy.inc.php @@ -24,7 +24,7 @@ class ContextPolicy extends PolicySet /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request) { diff --git a/classes/security/authorization/internal/DecisionAllowedPolicy.inc.php b/classes/security/authorization/internal/DecisionAllowedPolicy.inc.php new file mode 100644 index 00000000000..9c2e83c13a9 --- /dev/null +++ b/classes/security/authorization/internal/DecisionAllowedPolicy.inc.php @@ -0,0 +1,90 @@ +user = $user; + } + + /** + * @see AuthorizationPolicy::effect() + */ + public function effect() + { + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + $decisionType = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_DECISION_TYPE); + + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ + $result = $stageAssignmentDao->getBySubmissionAndUserIdAndStageId($submission->getId(), $this->user->getId(), $submission->getData('stageId')); + $stageAssignments = $result->toArray(); + if (empty($stageAssignments)) { + $userRoles = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES); + $canAccessUnassignedSubmission = !empty(array_intersect([Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER], $userRoles)); + if ($canAccessUnassignedSubmission) { + return AuthorizationPolicy::AUTHORIZATION_PERMIT; + } else { + $this->setAdvice(self::AUTHORIZATION_ADVICE_DENY_MESSAGE, 'editor.submission.workflowDecision.noUnassignedDecisions'); + return AuthorizationPolicy::AUTHORIZATION_DENY; + } + } else { + $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ + $isAllowed = false; + foreach ($stageAssignments as $stageAssignment) { + $userGroup = $userGroupDao->getById($stageAssignment->getUserGroupId()); + if (!in_array($userGroup->getRoleId(), [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR])) { + continue; + } + if (Repo::decision()->isRecommendation($decisionType->getDecision()) && $stageAssignment->getRecommendOnly()) { + $isAllowed = true; + } elseif (!$stageAssignment->getRecommendOnly()) { + $isAllowed = true; + } + } + if ($isAllowed) { + return AuthorizationPolicy::AUTHORIZATION_PERMIT; + } + } + + return AuthorizationPolicy::AUTHORIZATION_DENY; + } +} + +if (!PKP_STRICT_MODE) { + class_alias('\PKP\security\authorization\internal\DecisionAllowedPolicy', '\DecisionAllowedPolicy'); +} diff --git a/classes/security/authorization/internal/DecisionStageValidPolicy.inc.php b/classes/security/authorization/internal/DecisionStageValidPolicy.inc.php new file mode 100644 index 00000000000..ec703c6de25 --- /dev/null +++ b/classes/security/authorization/internal/DecisionStageValidPolicy.inc.php @@ -0,0 +1,56 @@ +getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + $decisionType = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_DECISION_TYPE); + + if ($submission->getData('stageId') === $decisionType->getStageId()) { + return AuthorizationPolicy::AUTHORIZATION_PERMIT; + } + + return AuthorizationPolicy::AUTHORIZATION_DENY; + } +} + +if (!PKP_STRICT_MODE) { + class_alias('\PKP\security\authorization\internal\DecisionStageValidPolicy', '\DecisionStageValidPolicy'); +} diff --git a/classes/security/authorization/internal/DecisionTypeRequiredPolicy.inc.php b/classes/security/authorization/internal/DecisionTypeRequiredPolicy.inc.php new file mode 100644 index 00000000000..1636c830613 --- /dev/null +++ b/classes/security/authorization/internal/DecisionTypeRequiredPolicy.inc.php @@ -0,0 +1,71 @@ +decision = $decision; + } + + // + // Implement template methods from AuthorizationPolicy + // + /** + * @see DataObjectRequiredPolicy::dataObjectEffect() + */ + public function dataObjectEffect() + { + /** @var Type|null $type */ + $type = Repo::decision()->getTypes()->first(function ($type) { + return $type->getDecision() === $this->decision; + }); + + if (!$type) { + return AuthorizationPolicy::AUTHORIZATION_DENY; + } + + $this->addAuthorizedContextObject(Application::ASSOC_TYPE_DECISION_TYPE, $type); + + return AuthorizationPolicy::AUTHORIZATION_PERMIT; + } +} + +if (!PKP_STRICT_MODE) { + class_alias('\PKP\security\authorization\internal\DecisionTypeRequiredPolicy', '\DecisionTypeRequiredPolicy'); +} diff --git a/classes/security/authorization/internal/ManagerRequiredPolicy.inc.php b/classes/security/authorization/internal/ManagerRequiredPolicy.inc.php deleted file mode 100644 index 0f39a08286d..00000000000 --- a/classes/security/authorization/internal/ManagerRequiredPolicy.inc.php +++ /dev/null @@ -1,72 +0,0 @@ -_request = $request; - } - - // - // Implement template methods from AuthorizationPolicy - // - /** - * @see AuthorizationPolicy::effect() - */ - public function effect() - { - // Get the submission - $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); - if (!$submission instanceof Submission) { - return AuthorizationPolicy::AUTHORIZATION_DENY; - } - - // Get the stage - $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); - if (!is_numeric($stageId)) { - return AuthorizationPolicy::AUTHORIZATION_DENY; - } - - $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ - if ($stageAssignmentDao->editorAssignedToStage($submission->getId(), $stageId)) { - return AuthorizationPolicy::AUTHORIZATION_PERMIT; - } else { - return AuthorizationPolicy::AUTHORIZATION_DENY; - } - } -} - -if (!PKP_STRICT_MODE) { - class_alias('\PKP\security\authorization\internal\ManagerRequiredPolicy', '\ManagerRequiredPolicy'); -} diff --git a/classes/security/authorization/internal/PluginLevelRequiredPolicy.inc.php b/classes/security/authorization/internal/PluginLevelRequiredPolicy.inc.php index 7c12419e976..9749a4af87e 100644 --- a/classes/security/authorization/internal/PluginLevelRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/PluginLevelRequiredPolicy.inc.php @@ -19,14 +19,14 @@ class PluginLevelRequiredPolicy extends AuthorizationPolicy { - /** @var boolean */ + /** @var bool */ public $_contextPresent; /** * Constructor * - * @param $request PKPRequest - * @param $contextPresent boolean + * @param PKPRequest $request + * @param bool $contextPresent */ public function __construct($request, $contextPresent) { diff --git a/classes/security/authorization/internal/PluginRequiredPolicy.inc.php b/classes/security/authorization/internal/PluginRequiredPolicy.inc.php index 6b71bb42981..a63348ecdaa 100644 --- a/classes/security/authorization/internal/PluginRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/PluginRequiredPolicy.inc.php @@ -26,7 +26,7 @@ class PluginRequiredPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request) { diff --git a/classes/security/authorization/internal/PublicationCanBeEditedPolicy.inc.php b/classes/security/authorization/internal/PublicationCanBeEditedPolicy.inc.php index ffdcf8749f7..25c0dce0556 100644 --- a/classes/security/authorization/internal/PublicationCanBeEditedPolicy.inc.php +++ b/classes/security/authorization/internal/PublicationCanBeEditedPolicy.inc.php @@ -39,7 +39,7 @@ public function __construct(Request $request, string $message) */ public function effect() { - $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); /* @var $submission Submission */ + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); /** @var Submission $submission */ // Prevent users from editing publications if they do not have permission. Except for admins. $userRoles = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES); @@ -49,4 +49,4 @@ public function effect() return AuthorizationPolicy::AUTHORIZATION_DENY; } -} \ No newline at end of file +} diff --git a/classes/security/authorization/internal/PublicationRequiredPolicy.inc.php b/classes/security/authorization/internal/PublicationRequiredPolicy.inc.php index 040eb19c39f..9a3f81072aa 100644 --- a/classes/security/authorization/internal/PublicationRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/PublicationRequiredPolicy.inc.php @@ -26,9 +26,9 @@ class PublicationRequiredPolicy extends DataObjectRequiredPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $publicationParameterName string the request parameter we expect + * @param PKPRequest $request + * @param array $args request parameters + * @param string $publicationParameterName the request parameter we expect * the submission id in. * @param null|mixed $operations */ diff --git a/classes/security/authorization/internal/QueryAssignedToUserAccessPolicy.inc.php b/classes/security/authorization/internal/QueryAssignedToUserAccessPolicy.inc.php index 5a283858ed8..145fd0f287c 100644 --- a/classes/security/authorization/internal/QueryAssignedToUserAccessPolicy.inc.php +++ b/classes/security/authorization/internal/QueryAssignedToUserAccessPolicy.inc.php @@ -27,7 +27,7 @@ class QueryAssignedToUserAccessPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request) { diff --git a/classes/security/authorization/internal/QueryRequiredPolicy.inc.php b/classes/security/authorization/internal/QueryRequiredPolicy.inc.php index ffe080a4db1..4b812a64ef0 100644 --- a/classes/security/authorization/internal/QueryRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/QueryRequiredPolicy.inc.php @@ -26,8 +26,8 @@ class QueryRequiredPolicy extends DataObjectRequiredPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters + * @param PKPRequest $request + * @param array $args request parameters * @param null|mixed $operations */ public function __construct($request, &$args, $parameterName = 'queryId', $operations = null) diff --git a/classes/security/authorization/internal/RepresentationRequiredPolicy.inc.php b/classes/security/authorization/internal/RepresentationRequiredPolicy.inc.php index ac352455d02..4e676c3ad2f 100644 --- a/classes/security/authorization/internal/RepresentationRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/RepresentationRequiredPolicy.inc.php @@ -27,8 +27,8 @@ class RepresentationRequiredPolicy extends DataObjectRequiredPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters + * @param PKPRequest $request + * @param array $args request parameters * @param null|mixed $operations */ public function __construct($request, &$args, $parameterName = 'representationId', $operations = null) diff --git a/classes/security/authorization/internal/RepresentationUploadAccessPolicy.inc.php b/classes/security/authorization/internal/RepresentationUploadAccessPolicy.inc.php index 116346e6bd6..850a76231e5 100644 --- a/classes/security/authorization/internal/RepresentationUploadAccessPolicy.inc.php +++ b/classes/security/authorization/internal/RepresentationUploadAccessPolicy.inc.php @@ -35,9 +35,9 @@ class RepresentationUploadAccessPolicy extends DataObjectRequiredPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $representationId int + * @param PKPRequest $request + * @param array $args request parameters + * @param int $representationId */ public function __construct($request, &$args, $representationId) { diff --git a/classes/security/authorization/internal/ReviewAssignmentAccessPolicy.inc.php b/classes/security/authorization/internal/ReviewAssignmentAccessPolicy.inc.php index e57d7740c27..aba94fb56c1 100644 --- a/classes/security/authorization/internal/ReviewAssignmentAccessPolicy.inc.php +++ b/classes/security/authorization/internal/ReviewAssignmentAccessPolicy.inc.php @@ -33,8 +33,8 @@ class ReviewAssignmentAccessPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest - * @param $permitDeclined bool True if declined or cancelled reviews are acceptable. + * @param PKPRequest $request + * @param bool $permitDeclined True if declined or cancelled reviews are acceptable. */ public function __construct($request, $permitDeclined = false) { diff --git a/classes/security/authorization/internal/ReviewAssignmentRequiredPolicy.inc.php b/classes/security/authorization/internal/ReviewAssignmentRequiredPolicy.inc.php index dc631ff0f49..e24e4a738ed 100644 --- a/classes/security/authorization/internal/ReviewAssignmentRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/ReviewAssignmentRequiredPolicy.inc.php @@ -22,19 +22,19 @@ class ReviewAssignmentRequiredPolicy extends DataObjectRequiredPolicy { - /** @var Allowed review methods */ + /** @var array Allowed review methods */ public $_reviewMethods = []; /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $parameterName string the request parameter we + * @param PKPRequest $request + * @param array $args request parameters + * @param string $parameterName the request parameter we * expect the submission id in. - * @param $operations array|string either a single operation or a list of operations that + * @param array|string $operations either a single operation or a list of operations that * this policy is targeting. - * @param $reviewMethods array limit the policy to specific review methods + * @param array $reviewMethods limit the policy to specific review methods */ public function __construct($request, &$args, $parameterName = 'reviewAssignmentId', $operations = null, $reviewMethods = null) { diff --git a/classes/security/authorization/internal/ReviewRoundRequiredPolicy.inc.php b/classes/security/authorization/internal/ReviewRoundRequiredPolicy.inc.php index bc651655793..2ed04ff7ec7 100644 --- a/classes/security/authorization/internal/ReviewRoundRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/ReviewRoundRequiredPolicy.inc.php @@ -27,12 +27,12 @@ class ReviewRoundRequiredPolicy extends DataObjectRequiredPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $parameterName string the request parameter we expect + * @param PKPRequest $request + * @param array $args request parameters + * @param string $parameterName the request parameter we expect * the submission id in. - * @param $operations array Optional list of operations for which this check takes effect. If specified, operations outside this set will not be checked against this policy. - * @param $reviewRoundId int Optionally pass the review round id directly. If passed, the $parameterName will be ignored. + * @param array $operations Optional list of operations for which this check takes effect. If specified, operations outside this set will not be checked against this policy. + * @param int $reviewRoundId Optionally pass the review round id directly. If passed, the $parameterName will be ignored. */ public function __construct($request, &$args, $parameterName = 'reviewRoundId', $operations = null, $reviewRoundId = null) { diff --git a/classes/security/authorization/internal/SubmissionAuthorPolicy.inc.php b/classes/security/authorization/internal/SubmissionAuthorPolicy.inc.php index 9c20cb051c1..082e22a1f74 100644 --- a/classes/security/authorization/internal/SubmissionAuthorPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionAuthorPolicy.inc.php @@ -33,7 +33,7 @@ class SubmissionAuthorPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request */ public function __construct($request) { diff --git a/classes/security/authorization/internal/SubmissionFileAssignedQueryAccessPolicy.inc.php b/classes/security/authorization/internal/SubmissionFileAssignedQueryAccessPolicy.inc.php index 2d6e82cfbf2..7f67f691353 100644 --- a/classes/security/authorization/internal/SubmissionFileAssignedQueryAccessPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionFileAssignedQueryAccessPolicy.inc.php @@ -24,7 +24,7 @@ class SubmissionFileAssignedQueryAccessPolicy extends SubmissionFileBaseAccessPo /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request * @param null|mixed $submissionFileId */ public function __construct($request, $submissionFileId = null) diff --git a/classes/security/authorization/internal/SubmissionFileAssignedReviewerAccessPolicy.inc.php b/classes/security/authorization/internal/SubmissionFileAssignedReviewerAccessPolicy.inc.php index c51d04ce044..056e13c8ed1 100644 --- a/classes/security/authorization/internal/SubmissionFileAssignedReviewerAccessPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionFileAssignedReviewerAccessPolicy.inc.php @@ -25,7 +25,7 @@ class SubmissionFileAssignedReviewerAccessPolicy extends SubmissionFileBaseAcces /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request * @param null|mixed $submissionFileId */ public function __construct($request, $submissionFileId = null) diff --git a/classes/security/authorization/internal/SubmissionFileBaseAccessPolicy.inc.php b/classes/security/authorization/internal/SubmissionFileBaseAccessPolicy.inc.php index 77c92f50609..709398a992f 100644 --- a/classes/security/authorization/internal/SubmissionFileBaseAccessPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionFileBaseAccessPolicy.inc.php @@ -29,8 +29,8 @@ class SubmissionFileBaseAccessPolicy extends AuthorizationPolicy /** * Constructor * - * @param $request PKPRequest - * @param $submissionFileId int If passed, this policy will try to + * @param PKPRequest $request + * @param int $submissionFileId If passed, this policy will try to * get the submission file from this data. */ public function __construct($request, $submissionFileId = null) @@ -66,7 +66,7 @@ public function &_getCache() /** * Get the requested submission file. * - * @param $request PKPRequest + * @param PKPRequest $request * * @return SubmissionFile */ @@ -81,7 +81,7 @@ public function getSubmissionFile($request) // Fetch the object, caching if possible $cache = & $this->_getCache(); if (!isset($cache[$this->_submissionFileId])) { - $cache[$this->_submissionFileId] = Repo::submissionFiles()->get($this->_submissionFileId); + $cache[$this->_submissionFileId] = Repo::submissionFile()->get($this->_submissionFileId); } return $cache[$this->_submissionFileId]; diff --git a/classes/security/authorization/internal/SubmissionFileMatchesWorkflowStageIdPolicy.inc.php b/classes/security/authorization/internal/SubmissionFileMatchesWorkflowStageIdPolicy.inc.php index 70c48a31748..d19fec4cb3e 100644 --- a/classes/security/authorization/internal/SubmissionFileMatchesWorkflowStageIdPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionFileMatchesWorkflowStageIdPolicy.inc.php @@ -26,8 +26,8 @@ class SubmissionFileMatchesWorkflowStageIdPolicy extends SubmissionFileBaseAcces /** * Constructor * - * @param $request PKPRequest - * @param $stageId int Workflow stage ID (WORKFLOW_STAGE_ID_...) + * @param PKPRequest $request + * @param int $stageId Workflow stage ID (WORKFLOW_STAGE_ID_...) * @param null|mixed $submissionFileId */ public function __construct($request, $submissionFileId = null, $stageId = null) @@ -52,7 +52,7 @@ public function effect() return AuthorizationPolicy::AUTHORIZATION_DENY; } - $workflowStageId = Repo::submissionFiles()->getWorkflowStageId($submissionFile); + $workflowStageId = Repo::submissionFile()->getWorkflowStageId($submissionFile); // Check if the submission file belongs to the specified workflow stage. if ($workflowStageId != $this->_stageId) { diff --git a/classes/security/authorization/internal/SubmissionFileRequestedRevisionRequiredPolicy.inc.php b/classes/security/authorization/internal/SubmissionFileRequestedRevisionRequiredPolicy.inc.php index 0136f165ed6..21ac06bd0bb 100644 --- a/classes/security/authorization/internal/SubmissionFileRequestedRevisionRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionFileRequestedRevisionRequiredPolicy.inc.php @@ -16,10 +16,12 @@ namespace PKP\security\authorization\internal; -use APP\workflow\EditorDecisionActionsManager; +use APP\decision\Decision; +use APP\facades\Repo; use PKP\db\DAORegistry; use PKP\security\authorization\AuthorizationPolicy; +use PKP\submission\reviewRound\ReviewRound; use PKP\submissionFile\SubmissionFile; class SubmissionFileRequestedRevisionRequiredPolicy extends SubmissionFileBaseAccessPolicy @@ -27,7 +29,7 @@ class SubmissionFileRequestedRevisionRequiredPolicy extends SubmissionFileBaseAc /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request * @param null|mixed $submissionFileId */ public function __construct($request, $submissionFileId = null) @@ -61,7 +63,14 @@ public function effect() if (!$reviewRound instanceof ReviewRound) { return AuthorizationPolicy::AUTHORIZATION_DENY; } - if (!(new EditorDecisionActionsManager())->getEditorTakenActionInReviewRound($request->getContext(), $reviewRound, [EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS])) { + $countRevisionDecisions = Repo::decision()->getCount( + Repo::decision() + ->getCollector() + ->filterBySubmissionIds([$submissionFile->getData('submissionId)')]) + ->filterByReviewRoundIds([$reviewRound->getId()]) + ->filterByDecisionTypes([Decision::PENDING_REVISIONS]) + ); + if (!$countRevisionDecisions) { return AuthorizationPolicy::AUTHORIZATION_DENY; } @@ -79,14 +88,19 @@ public function effect() $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ // Make sure that the last review round editor decision is request revisions. - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $reviewRoundDecisions = $editDecisionDao->getEditorDecisions($submissionFile->getData('submissionId'), $reviewRound->getStageId(), $reviewRound->getRound()); - if (empty($reviewRoundDecisions)) { + $reviewRoundDecisions = Repo::decision()->getMany( + Repo::decision() + ->getCollector() + ->filterBySubmissionIds([$submissionFile->getData('submissionId')]) + ->filterByStageIds([$reviewRound->getStageId()]) + ->filterByReviewRoundIds([$reviewRound->getId()]) + ); + if ($reviewRoundDecisions->isEmpty()) { return AuthorizationPolicy::AUTHORIZATION_DENY; } - $lastEditorDecision = array_pop($reviewRoundDecisions); - if ($lastEditorDecision['decision'] != EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS) { + $lastEditorDecision = $reviewRoundDecisions->last(); + if ($lastEditorDecision->getData('decision') != Decision::PENDING_REVISIONS) { return AuthorizationPolicy::AUTHORIZATION_DENY; } diff --git a/classes/security/authorization/internal/SubmissionFileStageAccessPolicy.inc.php b/classes/security/authorization/internal/SubmissionFileStageAccessPolicy.inc.php index cfbf0c6d665..3213aa3e85e 100644 --- a/classes/security/authorization/internal/SubmissionFileStageAccessPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionFileStageAccessPolicy.inc.php @@ -16,8 +16,8 @@ namespace PKP\security\authorization\internal; +use APP\decision\Decision; use APP\facades\Repo; -use APP\workflow\EditorDecisionActionsManager; use PKP\db\DAORegistry; use PKP\security\authorization\AuthorizationPolicy; use PKP\security\authorization\SubmissionFileAccessPolicy; @@ -36,9 +36,9 @@ class SubmissionFileStageAccessPolicy extends AuthorizationPolicy /** * Constructor * - * @param $fileStage int SUBMISSION_FILE_... - * @param $action int SUBMISSION_FILE_ACCESS_READ or SUBMISSION_FILE_ACCESS_MODIFY - * @param $message string The message to display when authorization is denied + * @param int $fileStage SUBMISSION_FILE_... + * @param int $action SUBMISSION_FILE_ACCESS_READ or SUBMISSION_FILE_ACCESS_MODIFY + * @param string $message The message to display when authorization is denied */ public function __construct($fileStage, $action, $message) { @@ -75,7 +75,7 @@ public function effect() } // Determine the allowed file stages - $assignedFileStages = Repo::submissionFiles() + $assignedFileStages = Repo::submissionFile() ->getAssignedFileStages( $stageAssignments, $this->_action @@ -103,18 +103,21 @@ public function effect() $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ $reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $reviewStage); if ($reviewRound) { - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $decisions = $editDecisionDao->getEditorDecisions($submission->getId(), $reviewRound->getStageId(), $reviewRound->getRound()); - if (!empty($decisions)) { - foreach ($decisions as $decision) { - if ($decision['decision'] == EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT - || $decision['decision'] == EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS - || $decision['decision'] == EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_NEW_ROUND - || $decision['decision'] == EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_RESUBMIT) { - $assignedFileStages[] = $this->_fileStage; - break; - } - } + $countDecisions = Repo::decision()->getCount( + Repo::decision() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByStageIds([$reviewRound->getStageId()]) + ->filterByReviewRoundIds([$reviewRound->getId()]) + ->filterByDecisionTypes([ + Decision::ACCEPT, + Decision::PENDING_REVISIONS, + Decision::NEW_ROUND, + Decision::RESUBMIT + ]) + ); + if ($countDecisions) { + $assignedFileStages[] = $this->_fileStage; } } } diff --git a/classes/security/authorization/internal/SubmissionFileStageRequiredPolicy.inc.php b/classes/security/authorization/internal/SubmissionFileStageRequiredPolicy.inc.php index b43949691f3..9202ec5a0a5 100644 --- a/classes/security/authorization/internal/SubmissionFileStageRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionFileStageRequiredPolicy.inc.php @@ -23,17 +23,17 @@ class SubmissionFileStageRequiredPolicy extends SubmissionFileBaseAccessPolicy /** @var int SubmissionFile::SUBMISSION_FILE_... */ public $_fileStage; - /** @var boolean Whether the file has to be viewable */ + /** @var bool Whether the file has to be viewable */ public $_viewable; /** * Constructor * - * @param $request PKPRequest - * @param $submissionFileId int This policy will try to + * @param PKPRequest $request + * @param int $submissionFileId This policy will try to * get the submission file from this data. - * @param $fileStage int SubmissionFile::SUBMISSION_FILE_... - * @param $viewable boolean Whether the file has to be viewable + * @param int $fileStage SubmissionFile::SUBMISSION_FILE_... + * @param bool $viewable Whether the file has to be viewable */ public function __construct($request, $submissionFileId, $fileStage, $viewable = false) { diff --git a/classes/security/authorization/internal/SubmissionFileUploaderAccessPolicy.inc.php b/classes/security/authorization/internal/SubmissionFileUploaderAccessPolicy.inc.php index ca51db552a3..253ebb31f54 100644 --- a/classes/security/authorization/internal/SubmissionFileUploaderAccessPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionFileUploaderAccessPolicy.inc.php @@ -23,7 +23,7 @@ class SubmissionFileUploaderAccessPolicy extends SubmissionFileBaseAccessPolicy /** * Constructor * - * @param $request PKPRequest + * @param PKPRequest $request * @param null|mixed $submissionFileId */ public function __construct($request, $submissionFileId = null) diff --git a/classes/security/authorization/internal/SubmissionRequiredPolicy.inc.php b/classes/security/authorization/internal/SubmissionRequiredPolicy.inc.php index f25718fb337..13c907251de 100644 --- a/classes/security/authorization/internal/SubmissionRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/SubmissionRequiredPolicy.inc.php @@ -26,9 +26,9 @@ class SubmissionRequiredPolicy extends DataObjectRequiredPolicy /** * Constructor * - * @param $request PKPRequest - * @param $args array request parameters - * @param $submissionParameterName string the request parameter we expect + * @param PKPRequest $request + * @param array $args request parameters + * @param string $submissionParameterName the request parameter we expect * the submission id in. * @param null|mixed $operations */ diff --git a/classes/security/authorization/internal/UserAccessibleWorkflowStagePolicy.inc.php b/classes/security/authorization/internal/UserAccessibleWorkflowStagePolicy.inc.php index 5d9e7519ee3..44bae980006 100644 --- a/classes/security/authorization/internal/UserAccessibleWorkflowStagePolicy.inc.php +++ b/classes/security/authorization/internal/UserAccessibleWorkflowStagePolicy.inc.php @@ -25,15 +25,15 @@ class UserAccessibleWorkflowStagePolicy extends AuthorizationPolicy /** @var int */ public $_stageId; - /** @var string Workflow type. One of PKPApplication::WORKFLOW_TYPE_... **/ + /** @var string Workflow type. One of PKPApplication::WORKFLOW_TYPE_... */ public $_workflowType; /** * Constructor * - * @param $stageId The one that will be checked against accessible + * @param int $stageId The one that will be checked against accessible * user workflow stages. - * @param $workflowType string Which workflow the stage access must be granted + * @param string $workflowType Which workflow the stage access must be granted * for. One of PKPApplication::WORKFLOW_TYPE_*. */ public function __construct($stageId, $workflowType = null) diff --git a/classes/security/authorization/internal/UserAccessibleWorkflowStageRequiredPolicy.inc.php b/classes/security/authorization/internal/UserAccessibleWorkflowStageRequiredPolicy.inc.php index f10b63ebf9c..d49e2afecf4 100644 --- a/classes/security/authorization/internal/UserAccessibleWorkflowStageRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/UserAccessibleWorkflowStageRequiredPolicy.inc.php @@ -25,14 +25,14 @@ class UserAccessibleWorkflowStageRequiredPolicy extends AuthorizationPolicy /** @var PKPRequest */ public $_request; - /** @var string Workflow type. One of PKPApplication::WORKFLOW_TYPE_... **/ + /** @var string Workflow type. One of PKPApplication::WORKFLOW_TYPE_... */ public $_workflowType; /** * Constructor * - * @param $request PKPRequest - * @param $workflowType string Which workflow the stage access must be granted + * @param PKPRequest $request + * @param string $workflowType Which workflow the stage access must be granted * for. One of PKPApplication::WORKFLOW_TYPE_*. */ public function __construct($request, $workflowType = null) diff --git a/classes/security/authorization/internal/WorkflowStageRequiredPolicy.inc.php b/classes/security/authorization/internal/WorkflowStageRequiredPolicy.inc.php index 78beccff755..c192182818c 100644 --- a/classes/security/authorization/internal/WorkflowStageRequiredPolicy.inc.php +++ b/classes/security/authorization/internal/WorkflowStageRequiredPolicy.inc.php @@ -20,13 +20,13 @@ class WorkflowStageRequiredPolicy extends AuthorizationPolicy { - /** @var integer */ + /** @var int */ public $_stageId; /** * Constructor * - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. */ public function __construct($stageId) { diff --git a/classes/services/PKPContextService.inc.php b/classes/services/PKPContextService.inc.php index 01a2e5bb371..25140d8a313 100644 --- a/classes/services/PKPContextService.inc.php +++ b/classes/services/PKPContextService.inc.php @@ -416,7 +416,7 @@ public function validate($action, $props, $allowedLocales, $primaryLocale) } if ($validator->fails()) { - $errors = $schemaService->formatValidationErrors($validator->errors(), $schemaService->get(PKPSchemaService::SCHEMA_CONTEXT), $allowedLocales); + $errors = $schemaService->formatValidationErrors($validator->errors()); } HookRegistry::call('Context::validate', [&$errors, $action, $props, $allowedLocales, $primaryLocale]); @@ -615,9 +615,9 @@ public function delete($context) * after a context has been created, or when translations change and a journal * wants to take advantage of the new values. * - * @param $context Context The context to restore default values for - * @param $request Request - * @param $locale string Locale key to restore defaults for. Example: `en_US` + * @param Context $context The context to restore default values for + * @param Request $request + * @param string $locale Locale key to restore defaults for. Example: `en_US` */ public function restoreLocaleDefaults($context, $request, $locale) { @@ -658,12 +658,12 @@ public function restoreLocaleDefaults($context, $request, $locale) /** * Move a temporary file to the context's public directory * - * @param $context Context - * @param $temporaryFile TemporaryFile - * @param $fileNameBase string Unique identifier to use for the filename. The + * @param Context $context + * @param TemporaryFile $temporaryFile + * @param string $fileNameBase Unique identifier to use for the filename. The * Extension and locale will be appended. - * @param $userId int ID of the user who uploaded the temporary file - * @param $localeKey string Example: en_US. Leave empty for a file that is + * @param int $userId ID of the user who uploaded the temporary file + * @param string $localeKey Example: en_US. Leave empty for a file that is * not localized. * * @return string|boolean The new filename or false on failure @@ -710,15 +710,15 @@ public function moveTemporaryFile($context, $temporaryFile, $fileNameBase, $user * go through the add and edit methods in order to ensure that * the appropriate hooks are fired. * - * @param $context Context The context being edited - * @param $value mixed The param value to be saved. Contains the temporary + * @param Context $context The context being edited + * @param mixed $value The param value to be saved. Contains the temporary * file ID if a new file has been uploaded. - * @param $settingName string The name of the setting to save, typically used + * @param string $settingName The name of the setting to save, typically used * in the filename. - * @param $userId integer ID of the user who owns the temporary file - * @param $localeKey string Optional. Used in the filename for multilingual + * @param int $userId ID of the user who owns the temporary file + * @param string $localeKey Optional. Used in the filename for multilingual * properties. - * @param $isImage boolean Optional. For image files which return alt text, + * @param bool $isImage Optional. For image files which return alt text, * width, height, etc in the param value. * * @return string|array|null New param value or null on failure diff --git a/classes/services/PKPFileService.inc.php b/classes/services/PKPFileService.inc.php index 1b44bdc3e7a..f06377b05f6 100644 --- a/classes/services/PKPFileService.inc.php +++ b/classes/services/PKPFileService.inc.php @@ -138,7 +138,7 @@ public function delete($id) * * @param int $fileId File ID * @param string $filename Filename to give to the downloaded file - * @param boolean $inline Whether to stream the file to the browser + * @param bool $inline Whether to stream the file to the browser */ public function download($fileId, $filename, $inline = false) { @@ -169,7 +169,7 @@ public function download($fileId, $filename, $inline = false) header('Pragma: public'); fpassthru($this->fs->readStream($path)); - exit(); + exit; } /** @@ -262,7 +262,7 @@ public function getDocumentType($mimetype) * * Examples: 82B, 12KB, 2MB, 2GB * - * @param integer $size File size in bytes + * @param int $size File size in bytes * * @return string */ diff --git a/classes/services/PKPNavigationMenuService.inc.php b/classes/services/PKPNavigationMenuService.inc.php index 2c8acec9b31..f5b5f42b3f4 100755 --- a/classes/services/PKPNavigationMenuService.inc.php +++ b/classes/services/PKPNavigationMenuService.inc.php @@ -433,7 +433,7 @@ public function loadMenuTree(&$navigationMenu) /** * Get a tree of NavigationMenuItems assigned to this menu * - * @param $navigationMenu NavigationMenu + * @param NavigationMenu $navigationMenu * */ public function getMenuTree(&$navigationMenu) @@ -516,7 +516,7 @@ public function arrayToObject($class, $array) /** * Transform an item title if the title includes a {$variable} * - * @param $templateMgr TemplateManager + * @param TemplateManager $templateMgr */ public function transformNavMenuItemTitle($templateMgr, &$navigationMenuItem) { @@ -542,7 +542,7 @@ public function transformNavMenuItemTitle($templateMgr, &$navigationMenuItem) /** * Populate the navigationMenuItem and the children properties of the NMIAssignment object * - * @param $nmiAssignment NavigationMenuItemAssignment The NMIAssignment object passed by reference + * @param NavigationMenuItemAssignment $nmiAssignment The NMIAssignment object passed by reference */ public function populateNMIAssignmentContainedObjects(&$nmiAssignment) { @@ -564,12 +564,12 @@ public function populateNMIAssignmentContainedObjects(&$nmiAssignment) /** * Returns whether a NM's NMI has a child of a certain NMIType * - * @param $navigationMenu NavigationMenu The NM to be searched - * @param $navigationMenuItem NavigationMenuItem The NMI to check its children for NMIType - * @param $nmiType string The NMIType - * @param $isDisplayed boolean optional. If true the function checks if the found NMI of type $nmiType is displayed. + * @param NavigationMenu $navigationMenu The NM to be searched + * @param NavigationMenuItem $navigationMenuItem The NMI to check its children for NMIType + * @param string $nmiType The NMIType + * @param bool $isDisplayed optional. If true the function checks if the found NMI of type $nmiType is displayed. * - * @return boolean Returns true if a NMI of type $nmiType has been found as child of the given $navigationMenuItem. + * @return bool Returns true if a NMI of type $nmiType has been found as child of the given $navigationMenuItem. */ private function _hasNMTreeNMIAssignmentWithChildOfNMIType($navigationMenu, $navigationMenuItem, $nmiType, $isDisplayed = true) { @@ -595,7 +595,7 @@ private function _hasNMTreeNMIAssignmentWithChildOfNMIType($navigationMenu, $nav /** * Sets the title of a navigation menu item, depending on its title or locale-key * - * @param $nmi NavigationMenuItem The NMI to set its title + * @param NavigationMenuItem $nmi The NMI to set its title */ public function setNMITitleLocalized($nmi) { @@ -614,7 +614,7 @@ public function setNMITitleLocalized($nmi) /** * Sets the title of a navigation menu item, depending on its title or locale-key * - * @param $nmi NavigationMenuItem The NMI to set its title + * @param NavigationMenuItem $nmi The NMI to set its title */ public function setAllNMILocalisedTitles($nmi) { @@ -643,7 +643,7 @@ public function setAllNMILocalisedTitles($nmi) * Callback to be registered from PKPTemplateManager for the LoadHandler hook. * Used by the Custom NMI to point their URL target to [context]/[path] * - * @return boolean true if the callback has handled the request. + * @return bool true if the callback has handled the request. */ public function _callbackHandleCustomNavigationMenuItems($hookName, $args) { diff --git a/classes/services/PKPSchemaService.inc.php b/classes/services/PKPSchemaService.inc.php index b8152954c14..91c95f47b98 100644 --- a/classes/services/PKPSchemaService.inc.php +++ b/classes/services/PKPSchemaService.inc.php @@ -16,6 +16,8 @@ namespace PKP\services; use Exception; +use Illuminate\Support\Arr; +use Illuminate\Support\MessageBag; use PKP\plugins\HookRegistry; class PKPSchemaService @@ -24,6 +26,7 @@ class PKPSchemaService public const SCHEMA_AUTHOR = 'author'; public const SCHEMA_CATEGORY = 'category'; public const SCHEMA_CONTEXT = 'context'; + public const SCHEMA_DECISION = 'decision'; public const SCHEMA_EMAIL_TEMPLATE = 'emailTemplate'; public const SCHEMA_GALLEY = 'galley'; public const SCHEMA_ISSUE = 'issue'; @@ -47,8 +50,8 @@ class PKPSchemaService * - Passes schema through hook * - Returns pre-loaded schemas on request * - * @param $schemaName string One of the SCHEMA_... constants - * @param $forceReload boolean Optional. Compile the schema again from the + * @param string $schemaName One of the SCHEMA_... constants + * @param bool $forceReload Optional. Compile the schema again from the * source files, bypassing any cached version. * * @return object @@ -96,8 +99,8 @@ public function get($schemaName, $forceReload = false) * If both schemas contain definitions for the same property, the property * definition in the additional schema will override the base schema. * - * @param $baseSchema object The base schema - * @param $additionalSchema object The additional schema properties to apply + * @param object $baseSchema The base schema + * @param object $additionalSchema The additional schema properties to apply * to $baseSchema. * * @return object @@ -135,7 +138,7 @@ public function merge($baseSchema, $additionalSchema) * Gets the properties of a schema which are considered part of the summary * view presented in an API. * - * @param $schemaName string One of the SCHEMA_... constants + * @param string $schemaName One of the SCHEMA_... constants * * @return array List of property names */ @@ -158,7 +161,7 @@ public function getSummaryProps($schemaName) * Gets the complete list of properties of a schema which are considered part * of the full view presented in an API. * - * @param $schemaName string One of the SCHEMA_... constants + * @param string $schemaName One of the SCHEMA_... constants * * @return array List of property names */ @@ -179,7 +182,7 @@ public function getFullProps($schemaName) /** * Get required properties of a schema * - * @param $schemaName string One of the SCHEMA_... constants + * @param string $schemaName One of the SCHEMA_... constants * * @return array List of property names */ @@ -196,7 +199,7 @@ public function getRequiredProps($schemaName) /** * Get multilingual properties of a schema * - * @param $schemaName string One of the SCHEMA_... constants + * @param string $schemaName One of the SCHEMA_... constants * * @return array List of property names */ @@ -220,8 +223,8 @@ public function getMultilingualProps($schemaName) * This method coerces properties to their appropriate type, and strips out * properties that are not specified in the schema. * - * @param $schemaName string One of the SCHEMA_... constants - * @param $props array Properties to be sanitized + * @param string $schemaName One of the SCHEMA_... constants + * @param array $props Properties to be sanitized * * @return array The sanitized props */ @@ -258,9 +261,8 @@ public function sanitize($schemaName, $props) * * It will leave null values alone. * - * @param $value mixed - * @param $type string boolean, integer, number, string, array, object - * @param $schema object A schema defining this property + * @param string $type boolean, integer, number, string, array, object + * @param object $schema A schema defining this property * * @return mixed The value coerced to type */ @@ -305,7 +307,7 @@ public function coerce($value, $type, $schema) } return $newObject; } - fatalError('Requested variable coercion for a type that was not recognized: ' . $type); + throw new Exception('Requested variable coercion for a type that was not recognized: ' . $type); } /** @@ -314,8 +316,8 @@ public function coerce($value, $type, $schema) * These validation rules are returned in a format that is ready to be passed * into ValidatorFactory::make(). * - * @param $schemaName string One of the SCHEMA_... constants - * @param $allowedLocales array List of allowed locale keys. + * @param string $schemaName One of the SCHEMA_... constants + * @param array $allowedLocales List of allowed locale keys. * * @return array List of validation rules for each property */ @@ -340,7 +342,7 @@ public function getValidationRules($schemaName, $allowedLocales) /** * Compile the validation rules for a single property's schema * - * @param $propSchema object The property schema + * @param object $propSchema The property schema * * @return array List of Laravel-formatted validation rules */ @@ -405,34 +407,13 @@ public function addPropValidationRules($rules, $ruleKey, $propSchema) * ], * bar: ['Error message'], * ] - * - * @param $errorBag \Illuminate\Support\MessageBag - * @param $schema object The entity schema - * - * @return array */ - public function formatValidationErrors($errorBag, $schema, $locales) + public function formatValidationErrors(MessageBag $errorBag): array { - $errors = $errorBag->getMessages(); $formatted = []; - - foreach ($errors as $ruleKey => $messages) { - $ruleKeyParts = explode('.', $ruleKey); - $propName = $ruleKeyParts[0]; - if (!isset($formatted[$propName])) { - $formatted[$propName] = []; - } - if (!empty($schema->properties->{$propName}) && !empty($schema->properties->{$propName}->multilingual)) { - $localeKey = $ruleKeyParts[1]; - if (!isset($formatted[$propName][$localeKey])) { - $formatted[$propName][$localeKey] = []; - } - $formatted[$propName][$localeKey] = array_merge($formatted[$propName][$localeKey], $messages); - } else { - $formatted[$propName] = array_merge($formatted[$propName], $messages); - } + foreach ($errorBag->getMessages() as $ruleKey => $messages) { + Arr::set($formatted, $ruleKey, $messages); } - return $formatted; } @@ -451,12 +432,12 @@ public function formatValidationErrors($errorBag, $schema, $locales) * * ['contextName' => 'Journal of Public Knowledge'] * - * @param $schemaName string One of the SCHEMA_... constants - * @param $object \PKP\core\DataObject The object to be modified - * @param $supportedLocales array List of locale keys that shoud receive + * @param string $schemaName One of the SCHEMA_... constants + * @param \PKP\core\DataObject $object The object to be modified + * @param array $supportedLocales List of locale keys that shoud receive * default content. Example: ['en_US', 'fr_CA'] - * @param $primaryLocale string Example: `en_US` - * @param $localeParams array Key/value params for the translation strings + * @param string $primaryLocale Example: `en_US` + * @param array $localeParams Key/value params for the translation strings * * @return DataObject */ @@ -500,9 +481,9 @@ public function setDefaults($schemaName, $object, $supportedLocales, $primaryLoc /** * Get the default values for a specific locale * - * @param $schemaName string One of the SCHEMA_... constants - * @param $locale string The locale key to get values for. Example: `en_US` - * @param $localeParams array Key/value params for the translation strings + * @param string $schemaName One of the SCHEMA_... constants + * @param string $locale The locale key to get values for. Example: `en_US` + * @param array $localeParams Key/value params for the translation strings * * @return array Key/value of property defaults for the specified locale */ @@ -525,9 +506,9 @@ public function getLocaleDefaults($schemaName, $locale, $localeParams) /** * Get a default value for a property based on the schema * - * @param $propSchema object The schema definition for this property - * @param $localeParams array\null Optional. Key/value params for the translation strings - * @param $localeKey string|null Optional. The locale to translate into + * @param object $propSchema The schema definition for this property + * @param array|null $localeParams Optional. Key/value params for the translation strings + * @param string|null $localeKey Optional. The locale to translate into * * @return mixed Will return null if no default value is available */ @@ -598,8 +579,8 @@ public function getDefault($propSchema, $localeParams = null, $localeKey = null) * This is primarily used to ensure API responses present a consistent data * structure regardless of which properties have values. * - * @param $schemaName string One of the SCHEMA_... constants - * @param $values array Key/value list of entity properties + * @param string $schemaName One of the SCHEMA_... constants + * @param array $values Key/value list of entity properties * * @return array */ diff --git a/classes/services/PKPSiteService.inc.php b/classes/services/PKPSiteService.inc.php index f33f72ab4d4..18787bd64dd 100644 --- a/classes/services/PKPSiteService.inc.php +++ b/classes/services/PKPSiteService.inc.php @@ -79,9 +79,9 @@ public function getFullProperties($site, $args = null) * * This does NOT authenticate the current user to perform the action. * - * @param $props array The data to validate - * @param $allowedLocales array Which locales are allowed for this context - * @param $primaryLocale string + * @param array $props The data to validate + * @param array $allowedLocales Which locales are allowed for this context + * @param string $primaryLocale * * @return array List of error messages. The array keys are property names */ @@ -164,7 +164,7 @@ public function validate($props, $allowedLocales, $primaryLocale) }); if ($validator->fails()) { - $errors = $schemaService->formatValidationErrors($validator->errors(), $schemaService->get(PKPSchemaService::SCHEMA_SITE), $allowedLocales); + $errors = $schemaService->formatValidationErrors($validator->errors()); } \HookRegistry::call('Site::validate', [&$errors, $props, $allowedLocales, $primaryLocale]); @@ -178,9 +178,9 @@ public function validate($props, $allowedLocales, $primaryLocale) * This does not check if the user is authorized to edit the site, or validate or sanitize * the new content. * - * @param $site Context The context to edit - * @param $params Array Key/value array of new data - * @param $request Request + * @param Context $site The context to edit + * @param array $params Key/value array of new data + * @param Request $request * * @return Site */ @@ -217,12 +217,12 @@ public function edit($site, $params, $request) /** * Move a temporary file to the site's public directory * - * @param $context Context - * @param $temporaryFile TemporaryFile - * @param $fileNameBase string Unique identifier to use for the filename. The + * @param Context $context + * @param TemporaryFile $temporaryFile + * @param string $fileNameBase Unique identifier to use for the filename. The * Extension and locale will be appended. - * @param $userId int ID of the user who uploaded the temporary file - * @param $localeKey string Example: en_US. Leave empty for a file that is + * @param int $userId ID of the user who uploaded the temporary file + * @param string $localeKey Example: en_US. Leave empty for a file that is * not localized. * * @return string|boolean The new filename or false on failure @@ -261,15 +261,15 @@ public function moveTemporaryFile($context, $temporaryFile, $fileNameBase, $user * This method is protected because all operations which edit the site should * go through the editSite method in order to ensure that the appropriate hooks are fired. * - * @param $site Site The site being edited - * @param $value mixed The param value to be saved. Contains the temporary + * @param Site $site The site being edited + * @param mixed $value The param value to be saved. Contains the temporary * file ID if a new file has been uploaded. - * @param $settingName string The name of the setting to save, typically used + * @param string $settingName The name of the setting to save, typically used * in the filename. - * @param $userId integer ID of the user who owns the temporary file - * @param $localeKey string Optional. Used in the filename for multilingual + * @param int $userId ID of the user who owns the temporary file + * @param string $localeKey Optional. Used in the filename for multilingual * properties. - * @param $isImage boolean Optional. For image files which return alt text, + * @param bool $isImage Optional. For image files which return alt text, * width, height, etc in the param value. * * @return string|array|null New param value or null on failure diff --git a/classes/services/PKPStatsEditorialService.inc.php b/classes/services/PKPStatsEditorialService.inc.php index d206495e6bd..c6605e36b5d 100644 --- a/classes/services/PKPStatsEditorialService.inc.php +++ b/classes/services/PKPStatsEditorialService.inc.php @@ -16,7 +16,7 @@ namespace PKP\services; -use APP\workflow\EditorDecisionActionsManager; +use APP\decision\Decision; class PKPStatsEditorialService { @@ -32,9 +32,9 @@ public function getOverview($args = []) \AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_APP_MANAGER); $received = $this->countSubmissionsReceived($args); - $accepted = $this->countByDecisions(EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT, $args); - $declinedDesk = $this->countByDecisions(EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE, $args); - $declinedReview = $this->countByDecisions(EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE, $args); + $accepted = $this->countByDecisions(Decision::ACCEPT, $args); + $declinedDesk = $this->countByDecisions(Decision::INITIAL_DECLINE, $args); + $declinedReview = $this->countByDecisions(Decision::DECLINE, $args); $declined = $declinedDesk + $declinedReview; // Calculate the acceptance/decline rates @@ -58,9 +58,9 @@ public function getOverview($args = []) // within the date range that were accepted or declined. This // excludes submissions that were made within the date range but // have not yet been accepted or declined. - $acceptedForSubmissionDate = $this->countByDecisionsForSubmittedDate(EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT, $args); - $declinedDeskForSubmissionDate = $this->countByDecisionsForSubmittedDate(EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE, $args); - $declinedReviewForSubmissionDate = $this->countByDecisionsForSubmittedDate(EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE, $args); + $acceptedForSubmissionDate = $this->countByDecisionsForSubmittedDate(Decision::ACCEPT, $args); + $declinedDeskForSubmissionDate = $this->countByDecisionsForSubmittedDate(Decision::INITIAL_DECLINE, $args); + $declinedReviewForSubmissionDate = $this->countByDecisionsForSubmittedDate(Decision::DECLINE, $args); $totalDecidedForSubmissionDate = $acceptedForSubmissionDate + $declinedDeskForSubmissionDate + $declinedReviewForSubmissionDate; // Never divide by 0 @@ -80,8 +80,8 @@ public function getOverview($args = []) // Calculate the number of days it took for most submissions to // receive decisions $firstDecisionDays = $this->getDaysToDecisions([], $args); - $acceptDecisionDays = $this->getDaysToDecisions([EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION, EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT], $args); - $declineDecisionDays = $this->getDaysToDecisions([EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE, EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE], $args); + $acceptDecisionDays = $this->getDaysToDecisions($this->getAcceptedDecisions(), $args); + $declineDecisionDays = $this->getDaysToDecisions($this->getDeclinedDecisions(), $args); $firstDecisionDaysRate = empty($firstDecisionDays) ? 0 : $this->calculateDaysToDecisionRate($firstDecisionDays, 0.8); $acceptDecisionDaysRate = empty($acceptDecisionDays) ? 0 : $this->calculateDaysToDecisionRate($acceptDecisionDays, 0.8); $declineDecisionDaysRate = empty($declineDecisionDays) ? 0 : $this->calculateDaysToDecisionRate($declineDecisionDays, 0.8); @@ -209,10 +209,10 @@ public function getAverages($args = []) // Editorial decisions (accepted and declined) $decisionsList = [ - 'submissionsAccepted' => [EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT], - 'submissionsDeclined' => [EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE, EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE], - 'submissionsDeclinedDeskReject' => [EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE], - 'submissionsDeclinedPostReview' => [EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE], + 'submissionsAccepted' => [Decision::ACCEPT], + 'submissionsDeclined' => [Decision::INITIAL_DECLINE, Decision::DECLINE], + 'submissionsDeclinedDeskReject' => [Decision::INITIAL_DECLINE], + 'submissionsDeclinedPostReview' => [Decision::DECLINE], ]; $yearlyDecisions = []; foreach ($decisionsList as $key => $decisions) { @@ -461,4 +461,42 @@ protected function getQueryBuilder($args = []) return $qb; } + + /** + * Get the decisions that indicate a submission has been accepted + * + * Decision::SEND_TO_PRODUCTION is included + * in order to catch submissions that do not have an accept decision recorded, but have + * still made it to the production stage. Once a SEND_TO_PRODUCTION decision has been + * recorded, we assume the submission has been accepted for the purposes of statistics. + * + * This list only applies to editorial statistics. This method should not be used to + * identify acceptance decisions for any other purpose. + * + * @return int[] SUBMISSION_EDITOR_DECISION_ constants + */ + protected function getAcceptedDecisions(): array + { + return [ + Decision::ACCEPT, + Decision::SKIP_REVIEW, + Decision::SEND_TO_PRODUCTION, + ]; + } + + /** + * Get the decisions that indicate a submission has been declined + * + * This distinction only applies to editorial statistics. This method should not be used to + * identify declined decisions for any other purpose. + * + * @return int[] SUBMISSION_EDITOR_DECISION_ constants + */ + protected function getDeclinedDecisions(): array + { + return [ + Decision::DECLINE, + Decision::INITIAL_DECLINE, + ]; + } } diff --git a/classes/services/PKPStatsService.inc.php b/classes/services/PKPStatsService.inc.php index ba9d0b14e62..2f7328ce7dd 100644 --- a/classes/services/PKPStatsService.inc.php +++ b/classes/services/PKPStatsService.inc.php @@ -215,7 +215,7 @@ public function getOrderedObjects($groupBy, $orderDirection, $args = []) * * @param array $record * - * @return integer + * @return int */ public function sumMetric($total, $record) { @@ -279,9 +279,9 @@ public function filterRecordOther($record) * Get all time segments (months or days) between the start and end date * with empty values. * - * @param $startDate string - * @param $endDate string - * @param $timelineInterval string STATISTICS_DIMENSION_MONTH or STATISTICS_DIMENSION_DAY + * @param string $startDate + * @param string $endDate + * @param string $timelineInterval STATISTICS_DIMENSION_MONTH or STATISTICS_DIMENSION_DAY * * @return array of time segments in ASC order */ diff --git a/classes/services/interfaces/EntityPropertyInterface.inc.php b/classes/services/interfaces/EntityPropertyInterface.inc.php index 37bed3ee129..fdf54800c6f 100644 --- a/classes/services/interfaces/EntityPropertyInterface.inc.php +++ b/classes/services/interfaces/EntityPropertyInterface.inc.php @@ -21,9 +21,9 @@ interface EntityPropertyInterface /** * Returns the values for the requested list of properties * - * @param $entity object The object to convert - * @param $props array The properties to include in the result - * @param $args array Additional variable which may be required + * @param object $entity The object to convert + * @param array $props The properties to include in the result + * @param array $args Additional variable which may be required * $args['request'] PKPRequest Required * $args['slimRequest'] SlimRequest * @@ -34,8 +34,8 @@ public function getProperties($entity, $props, $args = null); /** * Returns summary properties for an entity * - * @param $entity object The object to convert - * @param $args array Additional variables which may be required + * @param object $entity The object to convert + * @param array $args Additional variables which may be required * $args['request'] PKPRequest Required * $args['slimRequest'] SlimRequest * @@ -46,8 +46,8 @@ public function getSummaryProperties($entity, $args = null); /** * Returns full properties for an entity * - * @param $entity object The object to convert - * @param $args array Additional variable which may be required + * @param object $entity The object to convert + * @param array $args Additional variable which may be required * $args['request'] PKPRequest Required * $args['slimRequest'] SlimRequest * diff --git a/classes/services/interfaces/EntityWriteInterface.inc.php b/classes/services/interfaces/EntityWriteInterface.inc.php index dac7e685660..8844f179ac8 100644 --- a/classes/services/interfaces/EntityWriteInterface.inc.php +++ b/classes/services/interfaces/EntityWriteInterface.inc.php @@ -30,11 +30,11 @@ interface EntityWriteInterface * * This does NOT authenticate the current user to perform the action. * - * @param $action string The type of action required (add/edit). One of the + * @param string $action The type of action required (add/edit). One of the * VALIDATE_ACTION_... constants. - * @param $props array The data to validate - * @param $allowedLocales array Which locales are allowed for this entity - * @param $primaryLocale string + * @param array $props The data to validate + * @param array $allowedLocales Which locales are allowed for this entity + * @param string $primaryLocale * * @return array List of error messages. The array keys are property names */ @@ -46,8 +46,8 @@ public function validate($action, $props, $allowedLocales, $primaryLocale); * This does not check if the user is authorized to add the object, or * validate or sanitize this object. * - * @param $object object - * @param $request Request + * @param object $object + * @param Request $request * * @return object */ @@ -59,9 +59,9 @@ public function add($object, $request); * This does not check if the user is authorized to edit the object, or * validate or sanitize the new object values. * - * @param $object object - * @param $params Array Key/value array of new data - * @param $request Request + * @param object $object + * @param array $params Key/value array of new data + * @param Request $request * * @return object */ @@ -73,9 +73,9 @@ public function edit($object, $params, $request); * This does not check if the user is authorized to delete the object or if * the object exists. * - * @param $object object + * @param object $object * - * @return boolean + * @return bool */ public function delete($object); } diff --git a/classes/services/queryBuilders/PKPContextQueryBuilder.inc.php b/classes/services/queryBuilders/PKPContextQueryBuilder.inc.php index 81719c1b7fc..5f8c43595b8 100644 --- a/classes/services/queryBuilders/PKPContextQueryBuilder.inc.php +++ b/classes/services/queryBuilders/PKPContextQueryBuilder.inc.php @@ -30,10 +30,10 @@ abstract class PKPContextQueryBuilder implements EntityQueryBuilderInterface /** @var string The column name for a context ID: `journal_id` or `press_id` */ protected $dbIdColumn; - /** @var boolean enabled or disabled contexts */ + /** @var bool enabled or disabled contexts */ protected $isEnabled = null; - /** @var integer Filter contexts by whether or not this user can access it when logged in */ + /** @var int Filter contexts by whether or not this user can access it when logged in */ protected $userId; /** @var string search phrase */ @@ -42,7 +42,7 @@ abstract class PKPContextQueryBuilder implements EntityQueryBuilderInterface /** * Set isEnabled filter * - * @param $isEnabled boolean + * @param bool $isEnabled * * @return \PKP\services\queryBuilders\PKPContextQueryBuilder */ @@ -59,7 +59,7 @@ public function filterByIsEnabled($isEnabled) * a user group. If the context is disabled, they must be * assigned to ROLE_ID_MANAGER user group. * - * @param $userId boolean + * @param bool $userId * * @return \PKP\services\queryBuilders\PKPContextQueryBuilder */ @@ -72,7 +72,7 @@ public function filterByUserId($userId) /** * Set query search phrase * - * @param $phrase string + * @param string $phrase * * @return \PKP\services\queryBuilders\PKPContextQueryBuilder */ diff --git a/classes/services/queryBuilders/PKPStatsEditorialQueryBuilder.inc.php b/classes/services/queryBuilders/PKPStatsEditorialQueryBuilder.inc.php index c53452466d0..375fe8f8bff 100644 --- a/classes/services/queryBuilders/PKPStatsEditorialQueryBuilder.inc.php +++ b/classes/services/queryBuilders/PKPStatsEditorialQueryBuilder.inc.php @@ -16,7 +16,7 @@ namespace PKP\services\queryBuilders; -use APP\workflow\EditorDecisionActionsManager; +use APP\decision\Decision; use Illuminate\Support\Facades\DB; @@ -115,7 +115,7 @@ public function countSubmissionsReceived() * editor decisions * * @param array $decisions One or more SUBMISSION_EDITOR_DECISION_* - * @param boolean $forSubmittedDate How date restrictions should be applied. + * @param bool $forSubmittedDate How date restrictions should be applied. * A false value will count the number of submissions with an editorial * decision within the date range. A true value will count the number of * submissions received within the date range which eventually received @@ -157,8 +157,8 @@ public function countByDecisions($decisions, $forSubmittedDate = false) // exclude submissions where the status doesn't match the // decisions we are looking for. $declineDecisions = [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE, - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE + Decision::DECLINE, + Decision::INITIAL_DECLINE ]; if (count(array_intersect($declineDecisions, $decisions))) { $q->where('s.status', '=', PKPSubmission::STATUS_DECLINED); @@ -330,8 +330,8 @@ public function getDecisionsDates($decisions) // exclude submissions where the status doesn't match the // decisions we are looking for. $declineDecisions = [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE, - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE + Decision::DECLINE, + Decision::INITIAL_DECLINE ]; if (count(array_intersect($declineDecisions, $decisions))) { $q->where('s.status', '=', PKPSubmission::STATUS_DECLINED); diff --git a/classes/session/Session.inc.php b/classes/session/Session.inc.php index 00597724a95..aaf5b73e8ce 100644 --- a/classes/session/Session.inc.php +++ b/classes/session/Session.inc.php @@ -27,14 +27,14 @@ class Session extends \PKP\core\DataObject { - /** The User object associated with this session */ + /** @var User User object associated with this session */ public $user; /** * Get a session variable's value. * - * @param $key string + * @param string $key */ public function getSessionVar($key) { @@ -44,8 +44,7 @@ public function getSessionVar($key) /** * Get a session variable's value. * - * @param $key string - * @param $value mixed + * @param string $key */ public function setSessionVar($key, $value) { @@ -56,7 +55,7 @@ public function setSessionVar($key, $value) /** * Unset (delete) a session variable. * - * @param $key string + * @param string $key */ public function unsetSessionVar($key) { @@ -82,7 +81,7 @@ public function getUserId() /** * Set user ID. * - * @param $userId int + * @param int $userId */ public function setUserId($userId) { @@ -111,7 +110,7 @@ public function getIpAddress() /** * Set IP address. * - * @param $ipAddress string + * @param string $ipAddress */ public function setIpAddress($ipAddress) { @@ -131,7 +130,7 @@ public function getUserAgent() /** * Set user agent. * - * @param $userAgent string + * @param string $userAgent */ public function setUserAgent($userAgent) { @@ -151,7 +150,7 @@ public function getSecondsCreated() /** * Set time (in seconds) since session was created. * - * @param $created int + * @param int $created */ public function setSecondsCreated($created) { @@ -171,7 +170,7 @@ public function getSecondsLastUsed() /** * Set time (in seconds) since session was last used. * - * @param $lastUsed int + * @param int $lastUsed */ public function setSecondsLastUsed($lastUsed) { @@ -181,7 +180,7 @@ public function setSecondsLastUsed($lastUsed) /** * Check if session is to be saved across browser sessions. * - * @return boolean + * @return bool */ public function getRemember() { @@ -191,7 +190,7 @@ public function getRemember() /** * Set whether session is to be saved across browser sessions. * - * @param $remember boolean + * @param bool $remember */ public function setRemember($remember) { @@ -211,7 +210,7 @@ public function getSessionData() /** * Set session parameters. * - * @param $data array + * @param array $data */ public function setSessionData($data) { @@ -231,7 +230,7 @@ public function getDomain() /** * Set the domain with which the session is registered * - * @param $data array + * @param string $data */ public function setDomain($data) { diff --git a/classes/session/SessionDAO.inc.php b/classes/session/SessionDAO.inc.php index 084c0ff47cf..2f3eec1a94a 100644 --- a/classes/session/SessionDAO.inc.php +++ b/classes/session/SessionDAO.inc.php @@ -32,7 +32,7 @@ public function newDataObject() /** * Retrieve a session by ID. * - * @param $sessionId string + * @param string $sessionId * * @return Session */ @@ -60,7 +60,7 @@ public function getSession($sessionId) /** * Insert a new session. * - * @param $session Session + * @param Session $session */ public function insertObject($session) { @@ -85,7 +85,7 @@ public function insertObject($session) /** * Update an existing session. * - * @param $session Session + * @param Session $session * * @return int Number of affected rows */ @@ -120,7 +120,7 @@ public function updateObject($session) /** * Delete a session. * - * @param $session Session + * @param Session $session */ public function deleteObject($session) { @@ -130,7 +130,7 @@ public function deleteObject($session) /** * Delete a session by ID. * - * @param $sessionId string + * @param string $sessionId */ public function deleteById($sessionId) { @@ -140,7 +140,7 @@ public function deleteById($sessionId) /** * Delete sessions by user ID. * - * @param $userId string + * @param string $userId */ public function deleteByUserId($userId) { @@ -153,8 +153,8 @@ public function deleteByUserId($userId) /** * Delete all sessions older than the specified time. * - * @param $lastUsed int cut-off time in seconds for not-remembered sessions - * @param $lastUsedRemember int optional, cut-off time in seconds for remembered sessions + * @param int $lastUsed cut-off time in seconds for not-remembered sessions + * @param int $lastUsedRemember optional, cut-off time in seconds for remembered sessions */ public function deleteByLastUsed($lastUsed, $lastUsedRemember = 0) { @@ -182,9 +182,9 @@ public function deleteAllSessions() /** * Check if a session exists with the specified ID. * - * @param $sessionId string + * @param string $sessionId * - * @return boolean + * @return bool */ public function sessionExistsById($sessionId) { diff --git a/classes/session/SessionManager.inc.php b/classes/session/SessionManager.inc.php index 141e74e5265..9aacfd62c48 100644 --- a/classes/session/SessionManager.inc.php +++ b/classes/session/SessionManager.inc.php @@ -21,10 +21,10 @@ class SessionManager { - /** @var object The DAO for accessing Session objects */ + /** @var SessionDao The DAO for accessing Session objects */ public $sessionDao; - /** @var object The Session associated with the current request */ + /** @var Session The Session associated with the current request */ public $userSession; /** @@ -32,8 +32,8 @@ class SessionManager * Initialize session configuration and set PHP session handlers. * Attempts to rejoin a user's session if it exists, or create a new session otherwise. * - * @param $sessionDao SessionDAO - * @param $request PKPRequest + * @param SessionDAO $sessionDao + * @param PKPRequest $request */ public function __construct($sessionDao, $request) { @@ -109,12 +109,7 @@ public function __construct($sessionDao, $request) // Update existing session's timestamp; will be saved when write is called $this->userSession->setSecondsLastUsed($now); } - - // Adding session_write_close as a shutdown function. This is a PHP - // space workaround for the "Class '...' not found" bug in installations - // having the APC opcode cache installed - // Bugzilla: https://pkp.sfu.ca/bugzilla/show_bug.cgi?id=8151 - // PHP Bug tracker: https://bugs.php.net/bug.php?id=58739 + // https://www.php.net/manual/en/function.session-set-save-handler.php#refsect1-function.session-set-save-handler-notes register_shutdown_function('session_write_close'); } @@ -155,7 +150,7 @@ public function getUserSession() * Open a session. * Does nothing; only here to satisfy PHP session handler requirements. * - * @return boolean + * @return bool */ public function open() { @@ -166,7 +161,7 @@ public function open() * Close a session. * Does nothing; only here to satisfy PHP session handler requirements. * - * @return boolean + * @return bool */ public function close() { @@ -176,9 +171,9 @@ public function close() /** * Read session data from database. * - * @param $sessionId string + * @param string $sessionId * - * @return boolean + * @return bool */ public function read($sessionId) { @@ -194,10 +189,10 @@ public function read($sessionId) /** * Save session data to database. * - * @param $sessionId string - * @param $data array + * @param string $sessionId + * @param array $data * - * @return boolean + * @return bool */ public function write($sessionId, $data) { @@ -211,9 +206,9 @@ public function write($sessionId, $data) /** * Destroy (delete) a session. * - * @param $sessionId string + * @param string $sessionId * - * @return boolean + * @return bool */ public function destroy($sessionId) { @@ -225,9 +220,9 @@ public function destroy($sessionId) * Garbage collect unused session data. * TODO: Use $maxlifetime instead of assuming 24 hours? * - * @param $maxlifetime int the number of seconds after which data will be seen as "garbage" and cleaned up + * @param int $maxlifetime the number of seconds after which data will be seen as "garbage" and cleaned up * - * @return boolean + * @return bool */ public function gc($maxlifetime) { @@ -237,10 +232,10 @@ public function gc($maxlifetime) /** * Resubmit the session cookie. * - * @param $sessionId string new session ID (or false to keep current ID) - * @param $expireTime int new expiration time in seconds (0 = current session) + * @param string $sessionId new session ID (or false to keep current ID) + * @param int $expireTime new expiration time in seconds (0 = current session) * - * @return boolean + * @return bool */ public function updateSessionCookie($sessionId = false, $expireTime = 0) { @@ -272,7 +267,7 @@ public function updateSessionCookie($sessionId = false, $expireTime = 0) * by changing the user's session ID after they have logged in (in case the * original session ID had been pre-populated). * - * @return boolean + * @return bool */ public function regenerateSessionId() { @@ -294,9 +289,9 @@ public function regenerateSessionId() /** * Change the lifetime of the current session cookie. * - * @param $expireTime int new expiration time in seconds (0 = current session) + * @param int $expireTime new expiration time in seconds (0 = current session) * - * @return boolean + * @return bool */ public function updateSessionLifetime($expireTime = 0) { diff --git a/classes/site/Site.inc.php b/classes/site/Site.inc.php index b547b4e346c..80c55bb8b15 100644 --- a/classes/site/Site.inc.php +++ b/classes/site/Site.inc.php @@ -60,7 +60,7 @@ public function &getSupportedLocaleNames() /** * Get site title. * - * @param $locale string Locale code to return, if desired. + * @param string $locale Locale code to return, if desired. */ public function getTitle($locale = null) { @@ -112,7 +112,7 @@ public function getRedirect() /** * Set redirect * - * @param $redirect int + * @param int $redirect */ public function setRedirect($redirect) { @@ -156,7 +156,7 @@ public function getMinPasswordLength() /** * Set minimum password length. * - * @param $minPasswordLength int + * @param int $minPasswordLength */ public function setMinPasswordLength($minPasswordLength) { @@ -176,7 +176,7 @@ public function getPrimaryLocale() /** * Set primary locale. * - * @param $primaryLocale string + * @param string $primaryLocale */ public function setPrimaryLocale($primaryLocale) { @@ -197,7 +197,7 @@ public function getInstalledLocales() /** * Set installed locales. * - * @param $installedLocales array + * @param array $installedLocales */ public function setInstalledLocales($installedLocales) { @@ -218,7 +218,7 @@ public function getSupportedLocales() /** * Set array of all supported locales (for static text). * - * @param $supportedLocales array + * @param array $supportedLocales */ public function setSupportedLocales($supportedLocales) { diff --git a/classes/site/SiteDAO.inc.php b/classes/site/SiteDAO.inc.php index f633a2cb359..43a9a78cc6b 100644 --- a/classes/site/SiteDAO.inc.php +++ b/classes/site/SiteDAO.inc.php @@ -116,7 +116,7 @@ public function _fromRow($primaryRow, $callHook = true) /** * Insert site information. * - * @param $site Site + * @param Site $site */ public function insertSite($site) { diff --git a/classes/site/Version.inc.php b/classes/site/Version.inc.php index f06104a555b..e1d56524340 100644 --- a/classes/site/Version.inc.php +++ b/classes/site/Version.inc.php @@ -62,7 +62,7 @@ public function __construct( * 0 if they are equal * > 0 if this version is higher * - * @param $version string/Version the version to compare against + * @param string|Version $version the version to compare against * * @return int */ @@ -77,12 +77,12 @@ public function compare($version) /** * Static method to return a new version from a version string of the form "W.X.Y.Z". * - * @param $versionString string - * @param $productType string - * @param $product string - * @param $productClass string - * @param $lazyLoad integer - * @param $sitewide integer + * @param string $versionString + * @param string $productType + * @param string $product + * @param string $productClass + * @param int $lazyLoad + * @param int $sitewide * * @return Version */ @@ -130,7 +130,7 @@ public function getMajor() /** * Set major version. * - * @param $major int + * @param int $major */ public function setMajor($major) { @@ -150,7 +150,7 @@ public function getMinor() /** * Set minor version. * - * @param $minor int + * @param int $minor */ public function setMinor($minor) { @@ -170,7 +170,7 @@ public function getRevision() /** * Set revision version. * - * @param $revision int + * @param int $revision */ public function setRevision($revision) { @@ -190,7 +190,7 @@ public function getBuild() /** * Set build version. * - * @param $build int + * @param int $build */ public function setBuild($build) { @@ -210,7 +210,7 @@ public function getDateInstalled() /** * Set date installed. * - * @param $dateInstalled date + * @param date $dateInstalled */ public function setDateInstalled($dateInstalled) { @@ -230,7 +230,7 @@ public function getCurrent() /** * Set if current version. * - * @param $current int + * @param int $current */ public function setCurrent($current) { @@ -250,7 +250,7 @@ public function getProductType() /** * Set product type. * - * @param $productType string + * @param string $productType */ public function setProductType($productType) { @@ -270,7 +270,7 @@ public function getProduct() /** * Set product name. * - * @param $product string + * @param string $product */ public function setProduct($product) { @@ -290,7 +290,7 @@ public function getProductClassName() /** * Set the product's class name * - * @param $productClassName string + * @param string $productClassName */ public function setProductClassName($productClassName) { @@ -300,7 +300,7 @@ public function setProductClassName($productClassName) /** * Get the lazy load flag for this product * - * @return boolean + * @return bool */ public function getLazyLoad() { @@ -310,7 +310,7 @@ public function getLazyLoad() /** * Set the lazy load flag for this product * - * @param $lazyLoad boolean + * @param bool $lazyLoad */ public function setLazyLoad($lazyLoad) { @@ -320,7 +320,7 @@ public function setLazyLoad($lazyLoad) /** * Get the sitewide flag for this product * - * @return boolean + * @return bool */ public function getSitewide() { @@ -330,7 +330,7 @@ public function getSitewide() /** * Set the sitewide flag for this product * - * @param $sitewide boolean + * @param bool $sitewide */ public function setSitewide($sitewide) { @@ -340,7 +340,7 @@ public function setSitewide($sitewide) /** * Return complete version string. * - * @numeric boolean True (default) iff a numeric (comparable) version is to be returned. + * @param bool True (default) iff a numeric (comparable) version is to be returned. * * @return string */ diff --git a/classes/site/VersionCheck.inc.php b/classes/site/VersionCheck.inc.php index 46e40f59af4..690de5cc29b 100644 --- a/classes/site/VersionCheck.inc.php +++ b/classes/site/VersionCheck.inc.php @@ -87,7 +87,7 @@ public static function getCurrentCodeVersion() /** * Parse information from a version XML file. * - * @param $url string + * @param string $url * * @return array */ @@ -153,8 +153,8 @@ public static function parseVersionXML($url) /** * Find the applicable patch for the current code version (if available). * - * @param $versionInfo array as returned by parseVersionXML() - * @param $codeVersion as returned by getCurrentCodeVersion() + * @param array $versionInfo as returned by parseVersionXML() + * @param Version $codeVersion as returned by getCurrentCodeVersion() * * @return string */ @@ -174,7 +174,7 @@ public static function getPatch($versionInfo, $codeVersion = null) * contains valid data. Returns a Version object if everything * is ok, otherwise throws an Exception. * - * @param $versionFile string + * @param string $versionFile * * @return Version */ diff --git a/classes/site/VersionDAO.inc.php b/classes/site/VersionDAO.inc.php index f98654289b6..f7cf04644ba 100644 --- a/classes/site/VersionDAO.inc.php +++ b/classes/site/VersionDAO.inc.php @@ -26,9 +26,9 @@ class VersionDAO extends \PKP\db\DAO /** * Retrieve the current version. * - * @param $productType string - * @param $product string - * @param $isPlugin boolean + * @param string $productType + * @param string $product + * @param bool $isPlugin * * @return Version? */ @@ -51,8 +51,8 @@ public function getCurrentVersion($productType = null, $product = null, $isPlugi /** * Retrieve the complete version history, ordered by date (most recent first). * - * @param $productType string - * @param $product string + * @param string $productType + * @param string $product * * @return array Versions */ @@ -80,7 +80,7 @@ public function getVersionHistory($productType = null, $product = null) /** * Internal function to return a Version object from a row. * - * @param $row array + * @param array $row * * @return Version */ @@ -108,8 +108,8 @@ public function _returnVersionFromRow($row) /** * Insert a new version. * - * @param $version Version - * @param $isPlugin boolean + * @param Version $version + * @param bool $isPlugin */ public function insertVersion($version, $isPlugin = false) { @@ -193,7 +193,7 @@ public function insertVersion($version, $isPlugin = false) * first key representing the product type, the second * key the product name and the value the product version. * - * @param $context array the application context, only + * @param array $context the application context, only * products enabled in that context will be returned. * * @return array @@ -227,8 +227,8 @@ public function getCurrentProducts($context) /** * Disable a product by setting its 'current' column to 0 * - * @param $productType string - * @param $product string + * @param string $productType + * @param string $product */ public function disableVersion($productType, $product) { diff --git a/classes/stageAssignment/StageAssignment.inc.php b/classes/stageAssignment/StageAssignment.inc.php index 603b2d962cb..d164c20e282 100644 --- a/classes/stageAssignment/StageAssignment.inc.php +++ b/classes/stageAssignment/StageAssignment.inc.php @@ -31,7 +31,7 @@ class StageAssignment extends \PKP\core\DataObject /** * Set the submission ID * - * @param $submissionId int + * @param int $submissionId */ public function setSubmissionId($submissionId) { @@ -51,7 +51,7 @@ public function getSubmissionId() /** * Set the stage ID * - * @param $stageId int + * @param int $stageId */ public function setStageId($stageId) { @@ -71,7 +71,7 @@ public function getStageId() /** * Set the User Group ID * - * @param $userGroupId int + * @param int $userGroupId */ public function setUserGroupId($userGroupId) { @@ -101,7 +101,7 @@ public function getUserId() /** * Set user ID for this stageAssignment. * - * @param $userId int + * @param int $userId */ public function setUserId($userId) { @@ -111,7 +111,7 @@ public function setUserId($userId) /** * Set the date assigned * - * @param $dateAssigned datestamp (YYYY-MM-DD HH:MM:SS) + * @param datestamp $dateAssigned (YYYY-MM-DD HH:MM:SS) */ public function setDateAssigned($dateAssigned) { @@ -131,7 +131,7 @@ public function getDateAssigned() /** * Get recommendOnly option. * - * @return boolean + * @return bool */ public function getRecommendOnly() { @@ -141,7 +141,7 @@ public function getRecommendOnly() /** * Set recommendOnly option. * - * @param $recommendOnly boolean + * @param bool $recommendOnly */ public function setRecommendOnly($recommendOnly) { @@ -151,7 +151,7 @@ public function setRecommendOnly($recommendOnly) /** * Get permit metadata edit option. * - * @return boolean + * @return bool */ public function getCanChangeMetadata() { diff --git a/classes/stageAssignment/StageAssignmentDAO.inc.php b/classes/stageAssignment/StageAssignmentDAO.inc.php index 7865ef7c6c0..178f0d061b6 100644 --- a/classes/stageAssignment/StageAssignmentDAO.inc.php +++ b/classes/stageAssignment/StageAssignmentDAO.inc.php @@ -27,7 +27,7 @@ class StageAssignmentDAO extends \PKP\db\DAO /** * Retrieve an assignment by its ID * - * @param $stageAssignmentId int + * @param int $stageAssignmentId * * @return StageAssignment */ @@ -45,10 +45,10 @@ public function getById($stageAssignmentId) /** * Retrieve StageAssignments by submission and stage IDs. * - * @param $submissionId int - * @param $stageId int (optional) - * @param $userGroupId int (optional) - * @param $userId int (optional) + * @param int $submissionId + * @param int $stageId (optional) + * @param int $userGroupId (optional) + * @param int $userId (optional) * * @return DAOResultFactory StageAssignment */ @@ -60,10 +60,10 @@ public function getBySubmissionAndStageId($submissionId, $stageId = null, $userG /** * Retrieve StageAssignments by submission and role IDs. * - * @param $submissionId int Submission ID - * @param $roleId int ROLE_ID_... - * @param $stageId int (optional) - * @param $userId int (optional) + * @param int $submissionId Submission ID + * @param int $roleId ROLE_ID_... + * @param int $stageId (optional) + * @param int $userId (optional) * * @return DAOResultFactory StageAssignment */ @@ -75,7 +75,7 @@ public function getBySubmissionAndRoleId($submissionId, $roleId, $stageId = null /** * Get by user ID * - * @param $userId int + * @param int $userId * * @return StageAssignment */ @@ -88,9 +88,9 @@ public function getByUserId($userId) /** * Retrieve StageAssignments by submission and user IDs * - * @param $submissionId int Submission ID - * @param $userId int User ID - * @param $stageId int optional WORKFLOW_STAGE_ID_... + * @param int $submissionId Submission ID + * @param int $userId User ID + * @param int $stageId optional WORKFLOW_STAGE_ID_... * * @return DAOResultFactory StageAssignment */ @@ -102,8 +102,8 @@ public function getBySubmissionAndUserIdAndStageId($submissionId, $userId, $stag /** * Get editor stage assignments. * - * @param $submissionId int - * @param $stageId int + * @param int $submissionId + * @param int $stageId * * @return array StageAssignment */ @@ -119,8 +119,8 @@ public function getEditorsAssignedToStage($submissionId, $stageId) * This test is used to determine what grid to place a submission into, * and to know if the review stage can be started. * - * @param $submissionId (int) The id of the submission being tested. - * @param $stageId (int) The id of the stage being tested. + * @param int $submissionId The id of the submission being tested. + * @param int $stageId The id of the stage being tested. * * @return bool */ @@ -144,11 +144,45 @@ public function editorAssignedToStage($submissionId, $stageId = null) return $row && $row->row_count; } + /** + * Get all assigned editors who can make a decision in a given stage + * + * @return array + */ + public function getDecidingEditorIds(int $submissionId, int $stageId): array + { + $decidingEditorIds = []; + $result = $this->getBySubmissionAndRoleId( + $submissionId, + Role::ROLE_ID_MANAGER, + $stageId + ); + /** @var StageAssignment $stageAssignment */ + while ($stageAssignment = $result->next()) { + if (!$stageAssignment->getRecommendOnly()) { + $decidingEditorIds[] = (int) $stageAssignment->getUserId(); + } + } + $result = $this->getBySubmissionAndRoleId( + $submissionId, + Role::ROLE_ID_SUB_EDITOR, + $stageId + ); + /** @var StageAssignment $stageAssignment */ + while ($stageAssignment = $result->next()) { + if (!$stageAssignment->getRecommendOnly()) { + $decidingEditorIds[] = (int) $stageAssignment->getUserId(); + } + } + + return $decidingEditorIds; + } + /** * Retrieve all assignments by UserGroupId and ContextId * - * @param $userGroupId int - * @param $contextId int + * @param int $userGroupId + * @param int $contextId * * @return DAOResultFactory */ @@ -167,11 +201,11 @@ public function getByUserGroupId($userGroupId, $contextId) /** * Fetch a stageAssignment by symbolic info, building it if needed. * - * @param $submissionId int - * @param $userGroupId int - * @param $userId int - * @param $recommendOnly boolean - * @param $canChangeMetadata boolean + * @param int $submissionId + * @param int $userGroupId + * @param int $userId + * @param bool $recommendOnly + * @param bool $canChangeMetadata * * @return StageAssignment */ @@ -218,7 +252,7 @@ public function newDataObject() /** * Internal function to return an StageAssignment object from a row. * - * @param $row array + * @param array $row * * @return StageAssignment */ @@ -241,7 +275,7 @@ public function _fromRow($row) /** * Insert a new StageAssignment. * - * @param $stageAssignment StageAssignment + * @param StageAssignment $stageAssignment */ public function insertObject($stageAssignment) { @@ -266,7 +300,7 @@ public function insertObject($stageAssignment) /** * Update a new StageAssignment. * - * @param $stageAssignment StageAssignment + * @param StageAssignment $stageAssignment */ public function updateObject($stageAssignment) { @@ -296,7 +330,7 @@ public function updateObject($stageAssignment) /** * Delete a StageAssignment. * - * @param $stageAssignment StageAssignment + * @param StageAssignment $stageAssignment */ public function deleteObject($stageAssignment) { @@ -310,9 +344,9 @@ public function deleteObject($stageAssignment) /** * Delete a stageAssignment by matching on all fields. * - * @param $submissionId int Submission ID - * @param $userGroupId int User group ID - * @param $userId int User ID + * @param int $submissionId Submission ID + * @param int $userGroupId User group ID + * @param int $userId User ID */ public function deleteByAll($submissionId, $userGroupId, $userId) { @@ -341,12 +375,12 @@ public function getInsertId() * serves two purposes: returns a single assignment or returns a factory, * depending on the calling context. * - * @param $submissionId int - * @param $stageId int optional - * @param $userGroupId int optional - * @param $userId int optional - * @param $roleId int optional ROLE_ID_... - * @param $single bool specify if only one stage assignment (default is a ResultFactory) + * @param int $submissionId + * @param int $stageId optional + * @param int $userGroupId optional + * @param int $userId optional + * @param int $roleId optional ROLE_ID_... + * @param bool $single specify if only one stage assignment (default is a ResultFactory) * * @return StageAssignment|ResultFactory Mixed, depending on $single */ diff --git a/classes/statistics/PKPMetricsDAO.inc.php b/classes/statistics/PKPMetricsDAO.inc.php index 386134cbe59..ae00ec0a402 100644 --- a/classes/statistics/PKPMetricsDAO.inc.php +++ b/classes/statistics/PKPMetricsDAO.inc.php @@ -36,12 +36,12 @@ class PKPMetricsDAO extends \PKP\db\DAO * @see * for a full specification of the input and output format of this method. * - * @param $metricType string|array metrics selection - * @param $columns string|array column (aggregation level) selection - * @param $filters array report-level filter selection - * @param $orderBy array order criteria - * @param $range null|DBResultRange paging specification - * @param $nonAdditive boolean (optional) Whether the metric type dimension + * @param string|array $metricType metrics selection + * @param string|array $columns column (aggregation level) selection + * @param array $filters report-level filter selection + * @param array $orderBy order criteria + * @param null|DBResultRange $range paging specification + * @param bool $nonAdditive (optional) Whether the metric type dimension * will be additive or not. This must be used with care, different metric types * should not be additive because they may diverge in ways of counting usage events. * @@ -246,9 +246,9 @@ public function &getMetrics($metricType, $columns = [], $filters = [], $orderBy * with records filtered by the passed * arguments. * - * @param $assocType int - * @param $assocId int - * @param $metricType string + * @param int $assocType + * @param int $assocId + * @param string $metricType * * @return array */ @@ -267,9 +267,9 @@ public function getLoadId($assocType, $assocId, $metricType) * Check for the presence of any record * that has the passed metric type. * - * @param $metricType string + * @param string $metricType * - * @return boolean + * @return bool */ public function hasRecord($metricType) { @@ -280,7 +280,7 @@ public function hasRecord($metricType) /** * Purge a load batch. * - * @param $loadId string + * @param string $loadId */ public function purgeLoadBatch($loadId) { @@ -291,8 +291,8 @@ public function purgeLoadBatch($loadId) * Purge all records associated with the passed metric type * until the passed date. * - * @param $metricType string - * @param $toDate string + * @param string $metricType + * @param string $toDate */ public function purgeRecords($metricType, $toDate) { @@ -302,7 +302,7 @@ public function purgeRecords($metricType, $toDate) /** * Insert an entry into metrics table. * - * @param $record array + * @param array $record */ public function insertRecord($record) { @@ -388,9 +388,9 @@ public function insertRecord($record) /** * Foreign key lookup for the published object dimension. * - * @param $assocType int - * @param $assocId int - * @param $representationId int, optional + * @param int $assocType + * @param int $assocId + * @param int $representationId optional * * @return array Values must be foreign keys relative to the * context, pkp section, associated object (type and id), submission @@ -406,7 +406,7 @@ protected function foreignKeyLookup($assocType, $assocId, $representationId = nu switch ($assocType) { case PKPApplication::ASSOC_TYPE_SUBMISSION_FILE: case PKPApplication::ASSOC_TYPE_SUBMISSION_FILE_COUNTER_OTHER: - $submissionFile = Repo::submissionFiles()->get($assocId); + $submissionFile = Repo::submissionFile()->get($assocId); if ($submissionFile === null) { throw new Exception('Cannot load record: invalid submission file id.'); } @@ -488,8 +488,8 @@ protected function foreignKeyLookup($assocType, $assocId, $representationId = nu * Default implementation returns null, subclasses * have to implement it. * - * @param $submissionId Submission id. - * @param $contextId The submission context id. + * @param int $submissionId Submission id. + * @param int $contextId The submission context id. * * @return array Assoc type and id of the object. */ diff --git a/classes/statistics/PKPStatisticsHelper.inc.php b/classes/statistics/PKPStatisticsHelper.inc.php index 359e040ba68..20238bda736 100644 --- a/classes/statistics/PKPStatisticsHelper.inc.php +++ b/classes/statistics/PKPStatisticsHelper.inc.php @@ -81,7 +81,7 @@ public function __construct() * would require us to retrieve all context objects for the filtered * objects, etc. * - * @param $filter array + * @param array $filter * * @return null|Context */ @@ -103,11 +103,11 @@ public function &getContext($filter) /** * Identify and canonicalize the filtered metric type. * - * @param $metricType string|array A wildcard can be used to + * @param string|array $metricType A wildcard can be used to * identify all metric types. - * @param $context null|Context - * @param $defaultSiteMetricType string - * @param $siteMetricTypes array + * @param null|Context $context + * @param string $defaultSiteMetricType + * @param array $siteMetricTypes * * @return null|array The canonicalized metric type array. Null if an error * occurred. @@ -155,7 +155,7 @@ public function canonicalizeMetricTypes($metricType, $context, $defaultSiteMetri * Get the report plugin that implements * the passed metric type. * - * @param $metricType string + * @param string $metricType * * @return mixed ReportPlugin or null */ @@ -213,7 +213,7 @@ public function getAllMetricTypeStrings() /** * Get report column name. * - * @param $column string (optional) + * @param string $column (optional) * * @return array|string|null */ @@ -235,7 +235,7 @@ public function getColumnNames($column = null) /** * Get object type string. * - * @param $assocType mixed int or null (optional) + * @param mixed $assocType int or null (optional) * * @return mixed string or array */ @@ -257,7 +257,7 @@ public function getObjectTypeString($assocType = null) /** * Get file type string. * - * @param $fileType mixed int or null (optional) + * @param mixed $fileType int or null (optional) * * @return mixed string or array */ @@ -280,11 +280,11 @@ public function getFileTypeString($fileType = null) * Get an url that requests a statiscs report, * using the passed parameters as request arguments. * - * @param $request PKPRequest - * @param $metricType string Report metric type. - * @param $columns array Report columns - * @param $filter array Report filters. - * @param $orderBy array (optional) Report order by values. + * @param PKPRequest $request + * @param string $metricType Report metric type. + * @param array $columns Report columns + * @param array $filter Report filters. + * @param array $orderBy (optional) Report order by values. * * @return string */ @@ -381,7 +381,7 @@ public function getFileTypesArray() /** * Get an application specific column name. * - * @param $column string One of the statistics column constant. + * @param string $column One of the statistics column constant. * * @return string A localized text. */ diff --git a/classes/submission/Collector.inc.php b/classes/submission/Collector.inc.php index 7ad3979fa68..35abb38365a 100644 --- a/classes/submission/Collector.inc.php +++ b/classes/submission/Collector.inc.php @@ -38,6 +38,8 @@ abstract class Collector implements CollectorInterface public const ORDER_DIR_ASC = 'ASC'; public const ORDER_DIR_DESC = 'DESC'; + public const UNASSIGNED = -1; + public DAO $dao; public ?array $categoryIds = null; public ?array $contextIds = null; @@ -132,7 +134,7 @@ public function filterByDaysInactive(?int $daysInactive): AppCollector * Limit results to submissions assigned to these users * * @param int|array $assignedTo An array of user IDs - * or -1 to get unassigned submissions + * or self::UNASSIGNED to get unassigned submissions */ public function assignedTo($assignedTo): AppCollector { @@ -271,10 +273,12 @@ public function getQueryBuilder(): Builder $table->on('raod.review_round_id', '=', 'rr.review_round_id'); }); // Only get overdue assignments on active review rounds - $q->where('rr.status', '!=', ReviewRound::REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW); - $q->where('rr.status', '!=', ReviewRound::REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL); - $q->where('rr.status', '!=', ReviewRound::REVIEW_ROUND_STATUS_ACCEPTED); - $q->where('rr.status', '!=', ReviewRound::REVIEW_ROUND_STATUS_DECLINED); + $q->whereNotIn('rr.status', [ + ReviewRound::REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW, + ReviewRound::REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL, + ReviewRound::REVIEW_ROUND_STATUS_ACCEPTED, + ReviewRound::REVIEW_ROUND_STATUS_DECLINED, + ]); $q->where(function ($q) { $q->where('raod.declined', '<>', 1); $q->where('raod.cancelled', '<>', 1); @@ -289,25 +293,25 @@ public function getQueryBuilder(): Builder }); } - $isAssignedOnly = is_array($this->assignedTo); - if ($isAssignedOnly) { - $q->leftJoin('stage_assignments as sa', function ($table) { - $table->on('s.submission_id', '=', 'sa.submission_id'); - $table->whereIn('sa.user_id', $this->assignedTo); - }); - - $q->leftJoin('review_assignments as ra', function ($table) { - $table->on('s.submission_id', '=', 'ra.submission_id'); - $table->on('ra.declined', '=', DB::raw((int) 0)); - $table->on('ra.cancelled', '=', DB::raw((int) 0)); - $table->whereIn('ra.reviewer_id', $this->assignedTo); - }); - - $q->where(function ($q) { - $q->whereNotNull('sa.stage_assignment_id'); - $q->orWhereNotNull('ra.review_id'); + if (is_array($this->assignedTo)) { + $q->whereIn('s.submission_id', function ($q) { + $q->select('s.submission_id') + ->from('submissions AS s') + ->leftJoin('stage_assignments as sa', function ($q) { + $q->on('s.submission_id', '=', 'sa.submission_id') + ->whereIn('sa.user_id', $this->assignedTo); + }); + + $q->leftJoin('review_assignments as ra', function ($table) { + $table->on('s.submission_id', '=', 'ra.submission_id'); + $table->where('ra.declined', '=', (int) 0); + $table->where('ra.cancelled', '=', (int) 0); + $table->whereIn('ra.reviewer_id', $this->assignedTo); + }); + $q->whereNotNull('sa.stage_assignment_id') + ->orWhereNotNull('ra.review_id'); }); - } elseif ($this->assignedTo === -1) { + } elseif ($this->assignedTo === self::UNASSIGNED) { $sub = DB::table('stage_assignments') ->select(DB::raw('count(stage_assignments.stage_assignment_id)')) ->leftJoin('user_groups', 'stage_assignments.user_group_id', '=', 'user_groups.user_group_id') @@ -340,6 +344,12 @@ public function getQueryBuilder(): Builder Identity::IDENTITY_SETTING_FAMILYNAME, 'orcid' ]) + // Don't permit reviewers to search on author names + ->when(is_array($this->assignedTo), function ($q) { + $q->leftJoin('review_assignments AS ra', 'ra.submission_id', '=', 'p.submission_id') + ->whereIn('ra.reviewer_id', $this->assignedTo) + ->whereNull('ra.reviewer_id'); + }) ->where(DB::raw('lower(aus.setting_value)'), 'LIKE', $likePattern)->addBinding($word); }); if (ctype_digit((string) $word)) { @@ -347,9 +357,6 @@ public function getQueryBuilder(): Builder } }); } - if ($isAssignedOnly) { - $q->whereNull('ra.reviewer_id'); - } } if (isset($this->categoryIds)) { diff --git a/classes/submission/DAO.inc.php b/classes/submission/DAO.inc.php index 7015a4412db..68252b443a2 100644 --- a/classes/submission/DAO.inc.php +++ b/classes/submission/DAO.inc.php @@ -20,14 +20,12 @@ use Illuminate\Support\Collection; use Illuminate\Support\Enumerable; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Illuminate\Support\LazyCollection; use PKP\core\EntityDAO; use PKP\db\DAORegistry; use PKP\services\PKPSchemaService; -use stdClass; class DAO extends EntityDAO { @@ -62,7 +60,7 @@ class DAO extends EntityDAO */ public function newDataObject(): Submission { - return App::make(Submission::class); + return app(Submission::class); } /** @@ -180,7 +178,7 @@ public function getByPubId(string $pubIdType, string $pubId, $contextId = null): /** * @copydoc EntityDAO::fromRow() */ - public function fromRow(stdClass $row): Submission + public function fromRow(object $row): Submission { $submission = parent::fromRow($row); @@ -235,22 +233,21 @@ public function deleteById(int $id) } // Delete submission files. - $submissionFilesCollector = Repo::submissionFiles() + $submissionFilesCollector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$submission->getId()]); - $submissionFilesIterator = Repo::submissionFiles() + $submissionFilesIterator = Repo::submissionFile() ->getMany($submissionFilesCollector); foreach ($submissionFilesIterator as $submissionFile) { - Repo::submissionFiles()->delete($submissionFile); + Repo::submissionFile()->delete($submissionFile); } $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ $reviewRoundDao->deleteBySubmissionId($id); - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $editDecisionDao->deleteDecisionsBySubmissionId($id); + Repo::decision()->deleteBySubmissionId($id); $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /** @var ReviewAssignmentDAO $reviewAssignmentDao */ $reviewAssignmentDao->deleteBySubmissionId($id); diff --git a/classes/submission/EditDecisionDAO.inc.php b/classes/submission/EditDecisionDAO.inc.php deleted file mode 100644 index 2669d894b97..00000000000 --- a/classes/submission/EditDecisionDAO.inc.php +++ /dev/null @@ -1,219 +0,0 @@ -update( - sprintf( - 'INSERT INTO edit_decisions - (submission_id, review_round_id, stage_id, round, editor_id, decision, date_decided) - VALUES (?, ?, ?, ?, ?, ?, %s)', - $this->datetimeToDB($editorDecision['dateDecided']) - ), - [ - (int) $submissionId, - $reviewRound instanceof ReviewRound ? (int) $reviewRound->getId() : 0, - $reviewRound instanceof ReviewRound ? $reviewRound->getStageId() : (int) $stageId, - $reviewRound instanceof ReviewRound ? (int) $reviewRound->getRound() : REVIEW_ROUND_NONE, - (int) $editorDecision['editorId'], - $editorDecision['decision'] - ] - ); - } - } - - /** - * Delete editing decisions by submission ID. - * - * @param $submissionId int - */ - public function deleteDecisionsBySubmissionId($submissionId) - { - return $this->update( - 'DELETE FROM edit_decisions WHERE submission_id = ?', - [(int) $submissionId] - ); - } - - /** - * Get the editor decisions for a review round of a submission. - * - * @param $submissionId int Submission ID - * @param $stageId int Optional STAGE_ID_... - * @param $round int Optional review round number - * @param $editorId int Optional editor ID - * - * @return array List of information on the editor decisions: - * editDecisionId, reviewRoundId, stageId, round, editorId, decision, dateDecided - */ - public function getEditorDecisions($submissionId, $stageId = null, $round = null, $editorId = null) - { - $params = [(int) $submissionId]; - if ($stageId) { - $params[] = (int) $stageId; - } - if ($round) { - $params[] = (int) $round; - } - if ($editorId) { - $params[] = (int) $editorId; - } - - $result = $this->retrieve( - 'SELECT edit_decision_id, editor_id, decision, - date_decided, review_round_id, stage_id, round - FROM edit_decisions - WHERE submission_id = ? - ' . ($stageId ? ' AND stage_id = ?' : '') . ' - ' . ($round ? ' AND round = ?' : '') . ' - ' . ($editorId ? ' AND editor_id = ?' : '') . ' - ORDER BY date_decided ASC', - $params - ); - - $decisions = []; - foreach ($result as $row) { - $decisions[] = [ - 'editDecisionId' => $row->edit_decision_id, - 'reviewRoundId' => $row->review_round_id, - 'stageId' => $row->stage_id, - 'round' => $row->round, - 'editorId' => $row->editor_id, - 'decision' => $row->decision, - 'dateDecided' => $this->datetimeFromDB($row->date_decided) - ]; - } - return $decisions; - } - - /** - * Transfer the decisions for an editor. - * - * @param $oldUserId int - * @param $newUserId int - */ - public function transferEditorDecisions($oldUserId, $newUserId) - { - $this->update( - 'UPDATE edit_decisions SET editor_id = ? WHERE editor_id = ?', - [(int) $newUserId, (int) $oldUserId] - ); - } - - /** - * Find any still valid pending revisions decision for the passed - * submission id. A valid decision is one that is not overriden by any - * other decision. - * - * @param $submissionId int - * @param $expectedStageId int - * @param $revisionDecision int SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS or SUBMISSION_EDITOR_DECISION_RESUBMIT - * - * @return mixed array or null - */ - public function findValidPendingRevisionsDecision($submissionId, $expectedStageId, $revisionDecision = EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS) - { - $postReviewDecisions = [EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION]; - $revisionDecisions = [EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS, EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_RESUBMIT]; - if (!in_array($revisionDecision, $revisionDecisions)) { - return null; - } - - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $editorDecisions = $editDecisionDao->getEditorDecisions($submissionId); - $workingDecisions = array_reverse($editorDecisions); - $pendingRevisionDecision = null; - - foreach ($workingDecisions as $decision) { - if (in_array($decision['decision'], $postReviewDecisions)) { - // Decisions at later stages do not override the pending revisions one. - continue; - } elseif ($decision['decision'] == $revisionDecision) { - if ($decision['stageId'] == $expectedStageId) { - $pendingRevisionDecision = $decision; - // Only the last pending revisions decision is relevant. - break; - } else { - // Both internal and external pending revisions decisions are - // valid at the same time. Continue to search. - continue; - } - } else { - break; - } - } - - return $pendingRevisionDecision; - } - - /** - * Find any file upload that's a revision and can be considered as - * a pending revisions decision response. - * - * @param $decision array - * @param $submissionId int - * - * @return boolean - */ - public function responseExists($decision, $submissionId) - { - $stageId = $decision['stageId']; - $round = $decision['round']; - $sentRevisions = false; - - $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ - $reviewRound = $reviewRoundDao->getReviewRound($submissionId, $stageId, $round); - - $submissionFileCollector = Repo::submissionFiles() - ->getCollector() - ->filterByReviewRoundIds([$reviewRound->getId()]) - ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_REVIEW_REVISION]); - - $submissionFilesIterator = Repo::submissionFiles()->getMany($submissionFileCollector); - - foreach ($submissionFilesIterator as $submissionFile) { - if ($submissionFile->getData('updatedAt') > $decision['dateDecided']) { - $sentRevisions = true; - break; - } - } - - return $sentRevisions; - } -} - -if (!PKP_STRICT_MODE) { - class_alias('\PKP\submission\EditDecisionDAO', '\EditDecisionDAO'); -} diff --git a/classes/submission/Genre.inc.php b/classes/submission/Genre.inc.php index 8a8757f4bf7..b20532a5e20 100644 --- a/classes/submission/Genre.inc.php +++ b/classes/submission/Genre.inc.php @@ -38,7 +38,7 @@ public function getContextId() /** * Set ID of context. * - * @param $contextId int + * @param int $contextId */ public function setContextId($contextId) { @@ -58,7 +58,7 @@ public function getSequence() /** * Set sequence of genre. * - * @param $sequence float + * @param float $sequence */ public function setSequence($sequence) { @@ -78,7 +78,7 @@ public function getKey() /** * Set key of genre. * - * @param $key string + * @param string $key */ public function setKey($key) { @@ -88,7 +88,7 @@ public function setKey($key) /** * Get enabled status of genre. * - * @return boolean + * @return bool */ public function getEnabled() { @@ -98,7 +98,7 @@ public function getEnabled() /** * Set enabled status of genre. * - * @param $enabled boolean + * @param bool $enabled */ public function setEnabled($enabled) { @@ -108,8 +108,8 @@ public function setEnabled($enabled) /** * Set the name of the genre * - * @param $name string - * @param $locale string + * @param string $name + * @param string $locale */ public function setName($name, $locale) { @@ -119,7 +119,7 @@ public function setName($name, $locale) /** * Get the name of the genre * - * @param $locale string + * @param string $locale * * @return string */ @@ -151,7 +151,7 @@ public function getCategory() /** * Set context file category (e.g. artwork or document) * - * @param $category int GENRE_CATEGORY_... + * @param int $category GENRE_CATEGORY_... */ public function setCategory($category) { @@ -171,7 +171,7 @@ public function getDependent() /** * Set dependent flag * - * @param $dependent bool + * @param bool $dependent */ public function setDependent($dependent) { @@ -191,7 +191,7 @@ public function getSupplementary() /** * Set supplementary flag * - * @param $supplementary bool + * @param bool $supplementary */ public function setSupplementary($supplementary) { diff --git a/classes/submission/GenreDAO.inc.php b/classes/submission/GenreDAO.inc.php index 60cd565078a..41e88f67893 100644 --- a/classes/submission/GenreDAO.inc.php +++ b/classes/submission/GenreDAO.inc.php @@ -29,7 +29,7 @@ class GenreDAO extends DAO /** * Retrieve a genre by type id. * - * @param $genreId int + * @param int $genreId * @param null|mixed $contextId * * @return Genre @@ -54,8 +54,8 @@ public function getById($genreId, $contextId = null) /** * Retrieve all genres * - * @param $contextId int - * @param $rangeInfo object optional + * @param int $contextId + * @param object $rangeInfo optional * * @return DAOResultFactory containing matching genres */ @@ -75,9 +75,9 @@ public function getEnabledByContextId($contextId, $rangeInfo = null) /** * Retrieve genres based on whether they are dependent or not. * - * @param $dependentFilesOnly boolean - * @param $contextId int - * @param $rangeInfo object optional + * @param bool $dependentFilesOnly + * @param int $contextId + * @param object $rangeInfo optional * * @return DAOResultFactory containing matching genres */ @@ -97,9 +97,9 @@ public function getByDependenceAndContextId($dependentFilesOnly, $contextId, $ra /** * Retrieve genres based on whether they are supplementary or not. * - * @param $supplementaryFilesOnly boolean - * @param $contextId int - * @param $rangeInfo object optional + * @param bool $supplementaryFilesOnly + * @param int $contextId + * @param object $rangeInfo optional * * @return DAOResultFactory */ @@ -119,8 +119,8 @@ public function getBySupplementaryAndContextId($supplementaryFilesOnly, $context /** * Retrieve genres that are not supplementary or dependent. * - * @param $contextId int - * @param $rangeInfo object optional + * @param int $contextId + * @param object $rangeInfo optional * * @return DAOResultFactory */ @@ -140,8 +140,8 @@ public function getPrimaryByContextId($contextId, $rangeInfo = null) /** * Retrieve all genres * - * @param $contextId int - * @param $rangeInfo object optional + * @param int $contextId + * @param object $rangeInfo optional * * @return DAOResultFactory containing matching genres */ @@ -159,8 +159,8 @@ public function getByContextId($contextId, $rangeInfo = null) /** * Retrieves the genre associated with a key. * - * @param $key String the entry key - * @param $contextId int Optional context ID + * @param string $key the entry key + * @param int $contextId Optional context ID * * @return Genre */ @@ -194,7 +194,7 @@ public function getLocaleFieldNames() /** * Update the settings for this object * - * @param $genre object + * @param object $genre */ public function updateLocaleFields($genre) { @@ -218,7 +218,7 @@ public function newDataObject() /** * Internal function to return a Genre object from a row. * - * @param $row array + * @param array $row * * @return Genre */ @@ -244,7 +244,7 @@ public function _fromRow($row) /** * Insert a new genre. * - * @param $genre Genre + * @param Genre $genre * * @return int Inserted genre ID */ @@ -273,7 +273,7 @@ public function insertObject($genre) /** * Update an existing genre. * - * @param $genre Genre + * @param Genre $genre */ public function updateObject($genre) { @@ -302,7 +302,7 @@ public function updateObject($genre) /** * Delete a genre by id. * - * @param $genre Genre + * @param Genre $genre */ public function deleteObject($genre) { @@ -312,7 +312,7 @@ public function deleteObject($genre) /** * Soft delete a genre by id. * - * @param $genreId int Genre ID + * @param int $genreId Genre ID */ public function deleteById($genreId) { @@ -326,7 +326,7 @@ public function deleteById($genreId) * Delete the genre entries associated with a context. * Called when deleting a Context in ContextDAO. * - * @param $contextId int Context ID + * @param int $contextId Context ID */ public function deleteByContextId($contextId) { @@ -353,8 +353,8 @@ public function getInsertId() /** * Install default data for settings. * - * @param $contextId int Context ID - * @param $locales array List of locale codes + * @param int $contextId Context ID + * @param array $locales List of locale codes */ public function installDefaults($contextId, $locales) { @@ -419,11 +419,11 @@ public function getDefaultKeys() /** * If a key exists for a context. * - * @param $key string - * @param $contextId int - * @param $genreId int (optional) Current genre to be ignored + * @param string $key + * @param int $contextId + * @param int $genreId (optional) Current genre to be ignored * - * @return boolean + * @return bool */ public function keyExists($key, $contextId, $genreId = null) { @@ -442,7 +442,7 @@ public function keyExists($key, $contextId, $genreId = null) /** * Remove all settings associated with a locale * - * @param $locale string Locale code + * @param string $locale Locale code */ public function deleteSettingsByLocale($locale) { diff --git a/classes/submission/PKPSubmission.inc.php b/classes/submission/PKPSubmission.inc.php index 8be746804ec..aefc6771cf0 100644 --- a/classes/submission/PKPSubmission.inc.php +++ b/classes/submission/PKPSubmission.inc.php @@ -212,8 +212,8 @@ abstract public function getSectionId(); /** * Get the value of a license field from the containing context. * - * @param $locale string Locale code - * @param $field PERMISSIONS_FIELD_... + * @param string $locale Locale code + * @param int $field PERMISSIONS_FIELD_... * * @return string|null */ @@ -226,7 +226,7 @@ abstract public function _getContextLicenseFieldValue($locale, $field); /** * Get the localized copyright holder for the current publication * - * @param $preferredLocale string Preferred locale code + * @param string $preferredLocale Preferred locale code * * @return string Localized copyright holder. * @@ -256,7 +256,7 @@ public function getContextId() /** * Set the context ID for the current publication * - * @param $contextId int + * @param int $contextId * * @deprecated 3.2.0.0 */ @@ -305,7 +305,7 @@ public function getLocalizedData($key, $preferredLocale = null) /** * Get stored public ID of the submission. * - * @param @literal $pubIdType string One of the NLM pub-id-type values or + * @param string $pubIdType @literal One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). @endliteral * @@ -325,10 +325,10 @@ public function getStoredPubId($pubIdType) /** * Set the stored public ID of the submission. * - * @param $pubIdType string One of the NLM pub-id-type values or + * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). - * @param $pubId string + * @param string $pubId * * @deprecated 3.2.0.0 */ @@ -343,7 +343,7 @@ public function setStoredPubId($pubIdType, $pubId) /** * Get stored copyright holder for the submission. * - * @param $locale string locale + * @param string $locale locale * * @return string * @@ -361,8 +361,8 @@ public function getCopyrightHolder($locale) /** * Set the stored copyright holder for the submission. * - * @param $copyrightHolder string Copyright holder - * @param $locale string locale + * @param string $copyrightHolder Copyright holder + * @param string $locale locale * * @deprecated 3.2.0.0 */ @@ -393,7 +393,7 @@ public function getCopyrightYear() /** * Set the stored copyright year for the submission. * - * @param $copyrightYear string Copyright holder + * @param string $copyrightYear Copyright holder * * @deprecated 3.2.0.0 */ @@ -437,7 +437,7 @@ public function setLicenseURL($licenseURL) /** * Set option selection indicating if author should be hidden in issue ToC. * - * @param $hideAuthor int AUTHOR_TOC_... + * @param int $hideAuthor AUTHOR_TOC_... * * @deprecated 3.2.0.0 */ @@ -452,8 +452,8 @@ public function setHideAuthor($hideAuthor) /** * Return string of author names, separated by the specified token * - * @param $preferred boolean If the preferred public name should be used, if exist - * @param $familyOnly boolean return list of family names only (default false) + * @param bool $preferred If the preferred public name should be used, if exist + * @param bool $familyOnly return list of family names only (default false) * * @return string * @@ -542,7 +542,7 @@ public function getLocale() /** * Set the locale of the submission. * - * @param $locale string + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -554,8 +554,8 @@ public function setLocale($locale) /** * Get "localized" submission title (if applicable). * - * @param $preferredLocale string - * @param $includePrefix bool + * @param string $preferredLocale + * @param bool $includePrefix * * @return string * @@ -573,8 +573,8 @@ public function getLocalizedTitle($preferredLocale = null, $includePrefix = true /** * Get title. * - * @param $locale - * @param $includePrefix bool + * @param string $locale + * @param bool $includePrefix * * @return string|array * @@ -598,8 +598,8 @@ public function getTitle($locale, $includePrefix = true) /** * Set title. * - * @param $title string - * @param $locale + * @param string $title + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -627,7 +627,7 @@ public function getLocalizedSubtitle() /** * Get the subtitle for a given locale * - * @param $locale string + * @param string $locale * * @return string * @@ -645,8 +645,8 @@ public function getSubtitle($locale) /** * Set the subtitle for a locale * - * @param $subtitle string - * @param $locale string + * @param string $subtitle + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -679,7 +679,7 @@ public function getLocalizedFullTitle() * Get the submission full title (with prefix, title * and subtitle). * - * @param $locale string Locale to fetch data in. + * @param string $locale Locale to fetch data in. * * @return string * @@ -716,7 +716,7 @@ public function getLocalizedPrefix() /** * Get prefix. * - * @param $locale + * @param string $locale * * @return string * @@ -734,8 +734,8 @@ public function getPrefix($locale) /** * Set prefix. * - * @param $prefix string - * @param $locale + * @param string $prefix + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -766,7 +766,7 @@ public function getLocalizedAbstract() /** * Get abstract. * - * @param $locale + * @param string $locale * * @return string * @@ -784,8 +784,8 @@ public function getAbstract($locale) /** * Set abstract. * - * @param $abstract string - * @param $locale + * @param string $abstract + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -816,7 +816,7 @@ public function getLocalizedDiscipline() /** * Get discipline * - * @param $locale + * @param string $locale * * @return string * @@ -834,8 +834,8 @@ public function getDiscipline($locale) /** * Set discipline * - * @param $discipline string - * @param $locale + * @param string $discipline + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -866,7 +866,7 @@ public function getLocalizedSubject() /** * Get subject. * - * @param $locale + * @param string $locale * * @return string * @@ -884,8 +884,8 @@ public function getSubject($locale) /** * Set subject. * - * @param $subject string - * @param $locale + * @param string $subject + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -916,7 +916,7 @@ public function getLocalizedCoverage() /** * Get coverage. * - * @param $locale + * @param string $locale * * @return string * @@ -934,8 +934,8 @@ public function getCoverage($locale) /** * Set coverage. * - * @param $coverage string - * @param $locale + * @param string $coverage + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -966,7 +966,7 @@ public function getLocalizedType() /** * Get type (method/approach). * - * @param $locale + * @param string $locale * * @return string * @@ -984,8 +984,8 @@ public function getType($locale) /** * Set type (method/approach). * - * @param $type string - * @param $locale + * @param string $type + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -1000,7 +1000,7 @@ public function setType($type, $locale) /** * Get rights. * - * @param $locale + * @param string $locale * * @return string * @@ -1018,8 +1018,8 @@ public function getRights($locale) /** * Set rights. * - * @param $rights string - * @param $locale + * @param string $rights + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -1034,7 +1034,7 @@ public function setRights($rights, $locale) /** * Get source. * - * @param $locale + * @param string $locale * * @return string * @@ -1052,8 +1052,8 @@ public function getSource($locale) /** * Set source. * - * @param $source string - * @param $locale + * @param string $source + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -1084,7 +1084,7 @@ public function getLanguage() /** * Set language. * - * @param $language string + * @param string $language * * @deprecated 3.2.0.0 */ @@ -1115,7 +1115,7 @@ public function getLocalizedSponsor() /** * Get sponsor. * - * @param $locale + * @param string $locale * * @return string * @@ -1133,8 +1133,8 @@ public function getSponsor($locale) /** * Set sponsor. * - * @param $sponsor string - * @param $locale + * @param string $sponsor + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -1149,7 +1149,7 @@ public function setSponsor($sponsor, $locale) /** * Get the copyright notice for a given locale * - * @param $locale string + * @param string $locale * * @return string * @@ -1167,8 +1167,8 @@ public function getCopyrightNotice($locale) /** * Set the copyright notice for a locale * - * @param $copyrightNotice string - * @param $locale string + * @param string $copyrightNotice + * @param string $locale * * @deprecated 3.2.0.0 */ @@ -1199,7 +1199,7 @@ public function getCitations() /** * Set citations. * - * @param $citations string + * @param string $citations * * @deprecated 3.2.0.0 */ @@ -1226,7 +1226,7 @@ public function getDateSubmitted() /** * Set submission date. * - * @param $dateSubmitted date + * @param date $dateSubmitted * * @deprecated 3.2.0.0 */ @@ -1250,7 +1250,7 @@ public function getDateStatusModified() /** * Set the date of the last status modification. * - * @param $dateModified date + * @param date $dateModified * * @deprecated 3.2.0.0 */ @@ -1274,7 +1274,7 @@ public function getLastModified() /** * Set the date of the last modification. * - * @param $dateModified date + * @param date $dateModified * * @deprecated 3.2.0.0 */ @@ -1298,7 +1298,7 @@ public function getStatus() /** * Set submission status. * - * @param $status int + * @param int $status * * @deprecated 3.2.0.0 */ @@ -1322,7 +1322,7 @@ public function getSubmissionProgress() /** * Set submission progress. * - * @param $submissionProgress int + * @param int $submissionProgress * * @deprecated 3.2.0.0 */ @@ -1390,7 +1390,7 @@ public function getPageArray() /** * set pages * - * @param $pages string + * @param string $pages * * @deprecated 3.2.0.0 */ @@ -1417,7 +1417,7 @@ public function getStageId() /** * Set the submission's current publication stage ID * - * @param $stageId int + * @param int $stageId * * @deprecated 3.2.0.0 */ @@ -1445,7 +1445,7 @@ public function getDatePublished() /** * Set date published. * - * @param $datePublished date + * @param date $datePublished * * @deprecated 3.2.0.0 */ @@ -1461,7 +1461,7 @@ public function setDatePublished($datePublished) * Determines whether or not the license for copyright on this submission is * a Creative Commons license or not. * - * @return boolean + * @return bool * * @deprecated 3.2.0.0 */ diff --git a/classes/submission/PKPSubmissionMetadataFormImplementation.inc.php b/classes/submission/PKPSubmissionMetadataFormImplementation.inc.php index 87c4bf48e72..5c06a892cd3 100644 --- a/classes/submission/PKPSubmissionMetadataFormImplementation.inc.php +++ b/classes/submission/PKPSubmissionMetadataFormImplementation.inc.php @@ -31,7 +31,7 @@ class PKPSubmissionMetadataFormImplementation /** * Constructor. * - * @param $parentForm Form A form that can use this form. + * @param Form $parentForm A form that can use this form. */ public function __construct($parentForm = null) { @@ -42,9 +42,9 @@ public function __construct($parentForm = null) /** * Determine whether or not abstracts are required. * - * @param $submission Submission + * @param Submission $submission * - * @return boolean + * @return bool */ public function _getAbstractsRequired($submission) { @@ -54,7 +54,7 @@ public function _getAbstractsRequired($submission) /** * Add checks to form. * - * @param $submission Submission + * @param Submission $submission */ public function addChecks($submission) { @@ -107,7 +107,7 @@ function () use ($submission) { /** * Initialize form data from current submission. * - * @param $submission Submission + * @param Submission $submission */ public function initData($submission) { @@ -182,8 +182,8 @@ public function getTagitFieldNames() /** * Save changes to submission. * - * @param $submission Submission - * @param $request PKPRequest + * @param Submission $submission + * @param PKPRequest $request * * @return Submission */ diff --git a/classes/submission/Repository.inc.php b/classes/submission/Repository.inc.php index 79aaa1fb004..3ec1fe56b2c 100644 --- a/classes/submission/Repository.inc.php +++ b/classes/submission/Repository.inc.php @@ -23,7 +23,6 @@ use APP\submission\Submission; use Illuminate\Support\Collection; use Illuminate\Support\Enumerable; -use Illuminate\Support\Facades\App; use Illuminate\Support\LazyCollection; use PKP\core\Core; use PKP\db\DAORegistry; @@ -97,7 +96,7 @@ public function getMany(Collector $query): LazyCollection /** @copydoc DAO::getCollector() */ public function getCollector(): Collector { - return App::make(Collector::class); + return app(Collector::class); } /** @@ -211,7 +210,7 @@ public function getWorkflowUrlByUserRoles(Submission $submission, ?int $userId = // Send reviewers to review wizard $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /** @var ReviewAssignmentDAO $reviewAssignmentDao */ $reviewAssignment = $reviewAssignmentDao->getLastReviewRoundReviewAssignmentByReviewer($submission->getId(), $user->getId()); - if ($reviewAssignment) { + if ($reviewAssignment && !$reviewAssignment->getCancelled() && !$reviewAssignment->getDeclined()) { return $dispatcher->url( $request, Application::ROUTE_PAGE, @@ -279,7 +278,7 @@ public function validate(?Submission $submission, array $props, array $allowedLo }); if ($validator->fails()) { - $errors = $this->schemaService->formatValidationErrors($validator->errors(), $this->schemaService->get(PKPSchemaService::SCHEMA_SUBMISSION), $allowedLocales); + $errors = $this->schemaService->formatValidationErrors($validator->errors()); } HookRegistry::call('Submission::validate', [&$errors, $submission, $props, $allowedLocales, $primaryLocale]); @@ -366,7 +365,7 @@ public function add(Submission $submission, Publication $publication): int $this->edit($submission, ['currentPublicationId' => $publicationId]); - HookRegistry::call('Submission::add', [&$submission]); + HookRegistry::call('Submission::add', [$submission]); return $submission->getId(); } @@ -378,7 +377,7 @@ public function edit(Submission $submission, array $params) $newSubmission->stampLastActivity(); $newSubmission->stampModified(); - HookRegistry::call('Submission::edit', [&$newSubmission, $submission, $params]); + HookRegistry::call('Submission::edit', [$newSubmission, $submission, $params]); $this->dao->update($newSubmission); } @@ -390,7 +389,7 @@ public function delete(Submission $submission) $this->dao->delete($submission); - HookRegistry::call('Submission::delete', [&$submission]); + HookRegistry::call('Submission::delete', [$submission]); } /** @@ -406,71 +405,42 @@ public function deleteByContextId(int $contextId) } /** - * Update a submission's status and current publication id + * Update a submission's status * - * Sets the appropriate status on the submission and updates the - * current publication id, based on all of the submission's + * Changes a submission's status. Or, if no new status is provided, + * sets the appropriate status based on all of the submission's * publications. * - * Used to update the submission status when publications are - * published or deleted, or any other actions which may effect - * the status of the submission. + * This method performs any actions necessary when a submission's + * status changes, such as changing the current publication ID + * and creating or deleting tombstones. */ - public function updateStatus(Submission $submission) + public function updateStatus(Submission $submission, ?int $newStatus = null) { - $status = $newStatus = $submission->getData('status'); - $currentPublicationId = $newCurrentPublicationId = $submission->getData('currentPublicationId'); - $publications = $submission->getData('publications'); /** @var LazyCollection $publications */ - - // If there are no publications, we are probably in the process of deleting a submission. - // To be safe, reset the status and currentPublicationId anyway. - if (!$publications->count()) { - $newStatus = $status == Submission::STATUS_DECLINED - ? Submission::STATUS_DECLINED - : Submission::STATUS_QUEUED; - $newCurrentPublicationId = null; - } else { - - // Get the new current publication after status changes or deletions - // Use the latest published publication or, failing that, the latest publication - $newCurrentPublicationId = $publications->reduce(function ($a, $b) { - return $b->getData('status') === PKPSubmission::STATUS_PUBLISHED && $b->getId() > $a ? $b->getId() : $a; - }, 0); - if (!$newCurrentPublicationId) { - $newCurrentPublicationId = $publications->reduce(function ($a, $b) { - return $a > $b->getId() ? $a : $b->getId(); - }, 0); - } + $status = $submission->getData('status'); + if ($newStatus === null) { + $newStatus = $status; + } - // Declined submissions should remain declined even if their - // publications change - if ($status !== PKPSubmission::STATUS_DECLINED) { - $newStatus = PKPSubmission::STATUS_QUEUED; - foreach ($publications as $publication) { - if ($publication->getData('status') === PKPSubmission::STATUS_PUBLISHED) { - $newStatus = PKPSubmission::STATUS_PUBLISHED; - break; - } - if ($publication->getData('status') === PKPSubmission::STATUS_SCHEDULED) { - $newStatus = PKPSubmission::STATUS_SCHEDULED; - continue; - } - } - } + if ($newStatus === null) { + $newStatus = $this->getStatusByPublications($submission); } HookRegistry::call('Submission::updateStatus', [&$newStatus, $status, $submission]); - $updateParams = []; if ($status !== $newStatus) { - $updateParams['status'] = $newStatus; + $submission->setData('status', $newStatus); } + + $currentPublicationId = $newCurrentPublicationId = $submission->getData('currentPublicationId'); + $newCurrentPublicationId = $this->getCurrentPublicationIdByPublications($submission); if ($currentPublicationId !== $newCurrentPublicationId) { - $updateParams['currentPublicationId'] = $newCurrentPublicationId; - } - if (!empty($updateParams)) { - $this->edit($submission, $updateParams); + $submission->setData('currentPublicationId', $newCurrentPublicationId); } + + // Use the DAO instead of the Repository to prevent + // calling this method over and over again. + $this->dao->update($submission); } /** @@ -549,4 +519,67 @@ protected function _canUserAccessUnassignedSubmissions(int $contextId, int $user } return false; } + + /** + * Get the appropriate status of a submission based on the + * statuses of its publications + */ + protected function getStatusByPublications(Submission $submission): int + { + $publications = $submission->getData('publications'); /** @var LazyCollection $publications */ + + // Declined submissions should remain declined regardless of their publications' statuses + if ($submission->getData('status') === Submission::STATUS_DECLINED) { + return Submission::STATUS_DECLINED; + } + + // If there are no publications, we are probably in the process of deleting a submission. + // To be safe, reset the status anyway. + if (!$publications->count()) { + return Submission::STATUS_DECLINED + ? Submission::STATUS_DECLINED + : Submission::STATUS_QUEUED; + } + + $newStatus = Submission::STATUS_QUEUED; + foreach ($publications as $publication) { + if ($publication->getData('status') === Submission::STATUS_PUBLISHED) { + $newStatus = Submission::STATUS_PUBLISHED; + break; + } + if ($publication->getData('status') === Submission::STATUS_SCHEDULED) { + $newStatus = Submission::STATUS_SCHEDULED; + continue; + } + } + + return $newStatus; + } + + /** + * Get the appropriate currentPublicationId for a submission based on the + * statues of its publications + */ + protected function getCurrentPublicationIdByPublications(Submission $submission): ?int + { + $publications = $submission->getData('publications'); /** @var LazyCollection $publications */ + + if (!$publications->count()) { + return null; + } + + // Use the latest published publication + $newCurrentPublicationId = $publications->reduce(function ($a, $b) { + return $b->getData('status') === Submission::STATUS_PUBLISHED && $b->getId() > $a ? $b->getId() : $a; + }, 0); + + // If there is no published publication, use the latest publication + if (!$newCurrentPublicationId) { + $newCurrentPublicationId = $publications->reduce(function ($a, $b) { + return $a > $b->getId() ? $a : $b->getId(); + }, 0); + } + + return $newCurrentPublicationId ?? $submission->getData('currentPublicationId'); + } } diff --git a/classes/submission/Representation.inc.php b/classes/submission/Representation.inc.php index eb1d378a357..ce133e36f71 100644 --- a/classes/submission/Representation.inc.php +++ b/classes/submission/Representation.inc.php @@ -45,7 +45,7 @@ public function getSequence() /** * Set sequence of format in format listings for the submission. * - * @param $seq float + * @param float $seq */ public function setSequence($seq) { @@ -65,7 +65,7 @@ public function getLocalizedName() /** * Get the format name (if applicable). * - * @param $locale string + * @param string $locale * * @return string */ @@ -77,8 +77,8 @@ public function getName($locale) /** * Set name. * - * @param $name string - * @param $locale + * @param string $name + * @param string $locale */ public function setName($name, $locale = null) { @@ -88,7 +88,7 @@ public function setName($name, $locale = null) /** * Determines if a representation is approved or not. * - * @return boolean + * @return bool */ public function getIsApproved() { @@ -98,7 +98,7 @@ public function getIsApproved() /** * Sets whether a representation is approved or not. * - * @param boolean $isApproved + * @param bool $isApproved */ public function setIsApproved($isApproved) { @@ -108,7 +108,7 @@ public function setIsApproved($isApproved) /** * Get stored public ID of the submission. * - * @param $pubIdType string One of the NLM pub-id-type values or + * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). * @@ -122,10 +122,10 @@ public function getStoredPubId($pubIdType) /** * Set the stored public ID of the submission. * - * @param $pubIdType string One of the NLM pub-id-type values or + * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). - * @param $pubId string + * @param string $pubId */ public function setStoredPubId($pubIdType, $pubId) { @@ -147,7 +147,7 @@ public function getRemoteURL() /** * Set the remote URL for retrieving this representation. * - * @param $remoteURL string + * @param string $remoteURL * * @deprecated 3.2.0.0 */ diff --git a/classes/submission/RepresentationDAO.inc.php b/classes/submission/RepresentationDAO.inc.php index f6e3d076b1d..4d40854a561 100644 --- a/classes/submission/RepresentationDAO.inc.php +++ b/classes/submission/RepresentationDAO.inc.php @@ -21,9 +21,9 @@ abstract class RepresentationDAO extends \PKP\db\DAO /** * Retrieves a representation by ID. * - * @param $representationId int Representation ID. - * @param $publicationId int Optional publication ID. - * @param $contextId int Optional context ID. + * @param int $representationId Representation ID. + * @param int $publicationId Optional publication ID. + * @param int $contextId Optional context ID. * * @return DAOResultFactory */ @@ -32,8 +32,8 @@ abstract public function getById($representationId, $publicationId = null, $cont /** * Retrieves an iterator of representations for a publication * - * @param $publicationId int - * @param $contextId int + * @param int $publicationId + * @param int $contextId * * @return DAOResultFactory */ diff --git a/classes/submission/ReviewFilesDAO.inc.php b/classes/submission/ReviewFilesDAO.inc.php index 1fba011ab40..14e6cc162c3 100644 --- a/classes/submission/ReviewFilesDAO.inc.php +++ b/classes/submission/ReviewFilesDAO.inc.php @@ -23,8 +23,8 @@ class ReviewFilesDAO extends \PKP\db\DAO /** * Grant a review file to a review. * - * @param $reviewId int Review assignment ID - * @param $submissionFileId int Submission file ID + * @param int $reviewId Review assignment ID + * @param int $submissionFileId Submission file ID */ public function grant($reviewId, $submissionFileId) { @@ -40,8 +40,8 @@ public function grant($reviewId, $submissionFileId) /** * Revoke a review's association with a review file. * - * @param $reviewId int Review assignment ID. - * @param $fileId int Review file ID. + * @param int $reviewId Review assignment ID. + * @param int $fileId Review file ID. */ public function revoke($reviewId, $fileId) { @@ -54,7 +54,7 @@ public function revoke($reviewId, $fileId) /** * Revoke a review's association with all submission files. * - * @param $reviewId int Review assignment ID. + * @param int $reviewId Review assignment ID. */ public function revokeByReviewId($reviewId) { @@ -78,10 +78,10 @@ public function revokeBySubmissionFileId(int $submissionFileId) /** * Check review file availability * - * @param $reviewId integer - * @param $submissionFileId int + * @param int $reviewId + * @param int $submissionFileId * - * @return boolean + * @return bool */ public function check($reviewId, $submissionFileId) { diff --git a/classes/submission/SubmissionAgency.inc.php b/classes/submission/SubmissionAgency.inc.php index 03f772ea530..64b9f20b16f 100644 --- a/classes/submission/SubmissionAgency.inc.php +++ b/classes/submission/SubmissionAgency.inc.php @@ -36,8 +36,8 @@ public function getAgency() /** * Set the agency text * - * @param agency string - * @param locale string + * @param string $agency + * @param string $locale */ public function setAgency($agency, $locale) { diff --git a/classes/submission/SubmissionAgencyDAO.inc.php b/classes/submission/SubmissionAgencyDAO.inc.php index d4adb9f1174..1c57ce91726 100644 --- a/classes/submission/SubmissionAgencyDAO.inc.php +++ b/classes/submission/SubmissionAgencyDAO.inc.php @@ -27,8 +27,8 @@ class SubmissionAgencyDAO extends ControlledVocabDAO /** * Build/fetch and return a controlled vocabulary for agencies. * - * @param $publicationId int - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param int $publicationId + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return ControlledVocab */ @@ -50,9 +50,9 @@ public function getLocaleFieldNames() /** * Get agencies for a specified submission ID. * - * @param $publicationId int - * @param $locales array - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 + * @param int $publicationId + * @param array $locales + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 * * @return array */ @@ -97,10 +97,10 @@ public function getAllUniqueAgencies() /** * Add an array of agencies * - * @param $agencies array List of agencies. - * @param $publicationId int Submission ID. - * @param $deleteFirst boolean True iff existing agencies should be removed first. - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param array $agencies List of agencies. + * @param int $publicationId Submission ID. + * @param bool $deleteFirst True iff existing agencies should be removed first. + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return int */ diff --git a/classes/submission/SubmissionAgencyEntryDAO.inc.php b/classes/submission/SubmissionAgencyEntryDAO.inc.php index f9a4ba06f7b..1aae74fdb42 100644 --- a/classes/submission/SubmissionAgencyEntryDAO.inc.php +++ b/classes/submission/SubmissionAgencyEntryDAO.inc.php @@ -36,8 +36,8 @@ public function newDataObject() * Retrieve an iterator of controlled vocabulary entries matching a * particular controlled vocabulary ID. * - * @param $controlledVocabId int - * @param $filter null (Not yet supported) + * @param int $controlledVocabId + * @param null $filter (Not yet supported) * @param null|mixed $rangeInfo * * @return object DAOResultFactory containing matching CVE objects diff --git a/classes/submission/SubmissionComment.inc.php b/classes/submission/SubmissionComment.inc.php index 612531934e2..877e703b4f5 100644 --- a/classes/submission/SubmissionComment.inc.php +++ b/classes/submission/SubmissionComment.inc.php @@ -40,7 +40,7 @@ public function getCommentType() /** * set comment type * - * @param $commentType int COMMENT_TYPE_... + * @param int $commentType COMMENT_TYPE_... */ public function setCommentType($commentType) { @@ -60,7 +60,7 @@ public function getRoleId() /** * set role id * - * @param $roleId int + * @param int $roleId */ public function setRoleId($roleId) { @@ -80,7 +80,7 @@ public function getSubmissionId() /** * set submission id * - * @param $submissionId int + * @param int $submissionId */ public function setSubmissionId($submissionId) { @@ -100,7 +100,7 @@ public function getAssocId() /** * set assoc id * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -120,7 +120,7 @@ public function getAuthorId() /** * set author id * - * @param $authorId int + * @param int $authorId */ public function setAuthorId($authorId) { @@ -176,7 +176,7 @@ public function getCommentTitle() /** * set comment title * - * @param $commentTitle string + * @param string $commentTitle */ public function setCommentTitle($commentTitle) { @@ -196,7 +196,7 @@ public function getComments() /** * set comments * - * @param $comments string + * @param string $comments */ public function setComments($comments) { @@ -216,7 +216,7 @@ public function getDatePosted() /** * set date posted * - * @param $datePosted date + * @param date $datePosted */ public function setDatePosted($datePosted) { @@ -236,7 +236,7 @@ public function getDateModified() /** * set date modified * - * @param $dateModified date + * @param date $dateModified */ public function setDateModified($dateModified) { @@ -246,7 +246,7 @@ public function setDateModified($dateModified) /** * get viewable * - * @return boolean + * @return bool */ public function getViewable() { @@ -256,7 +256,7 @@ public function getViewable() /** * set viewable * - * @param $viewable boolean + * @param bool $viewable */ public function setViewable($viewable) { diff --git a/classes/submission/SubmissionCommentDAO.inc.php b/classes/submission/SubmissionCommentDAO.inc.php index 905e1fc3776..37e6d9eb883 100644 --- a/classes/submission/SubmissionCommentDAO.inc.php +++ b/classes/submission/SubmissionCommentDAO.inc.php @@ -25,9 +25,9 @@ class SubmissionCommentDAO extends \PKP\db\DAO /** * Retrieve SubmissionComments by submission id * - * @param $submissionId int Submission ID - * @param $commentType int Comment type - * @param $assocId int Assoc ID + * @param int $submissionId Submission ID + * @param int $commentType Comment type + * @param int $assocId Assoc ID * * @return DAOResultFactory */ @@ -58,7 +58,7 @@ public function getSubmissionComments($submissionId, $commentType = null, $assoc /** * Retrieve SubmissionComments by user id * - * @param $userId int User ID. + * @param int $userId User ID. * * @return DAOResultFactory */ @@ -77,10 +77,10 @@ public function getByUserId($userId) /** * Retrieve SubmissionComments made my reviewers on a submission * - * @param $submissionId int The submission Id that was reviewered/commented on. - * @param $reviewerId int The user id of the reviewer. - * @param $reviewId int (optional) The review assignment ID the comment pertains to. - * @param $viewable boolean True for only viewable comments; false for non-viewable; null for both + * @param int $submissionId The submission Id that was reviewered/commented on. + * @param int $reviewerId The user id of the reviewer. + * @param int $reviewId (optional) The review assignment ID the comment pertains to. + * @param bool $viewable True for only viewable comments; false for non-viewable; null for both * * @return DAOResultFactory */ @@ -116,7 +116,7 @@ public function getReviewerCommentsByReviewerId($submissionId, $reviewerId = nul /** * Retrieve submission comment by id * - * @param $commentId int Comment ID. + * @param int $commentId Comment ID. * * @return SubmissionComment object */ @@ -143,7 +143,7 @@ public function newDataObject() /** * Creates and returns a submission comment object from a row * - * @param $row array + * @param array $row * * @return SubmissionComment object */ @@ -170,7 +170,7 @@ public function _fromRow($row) /** * inserts a new submission comment into the submission_comments table * - * @param SubmissionNote object + * @param SubmissionNote $submissionComment object * * @return Submission note ID int */ @@ -214,7 +214,7 @@ public function getInsertId() /** * Removes a submission comment from the submission_comments table * - * @param SubmissionComment object + * @param SubmissionComment $submissionComment object */ public function deleteObject($submissionComment) { @@ -224,7 +224,7 @@ public function deleteObject($submissionComment) /** * Removes a submission note by id * - * @param noteId int + * @param int $commentId */ public function deleteById($commentId) { @@ -237,7 +237,7 @@ public function deleteById($commentId) /** * Delete all comments for a submission. * - * @param $submissionId int + * @param int $submissionId */ public function deleteBySubmissionId($submissionId) { @@ -250,7 +250,7 @@ public function deleteBySubmissionId($submissionId) /** * Updates a submission comment * - * @param SubmissionComment object + * @param SubmissionComment $submissionComment object */ public function updateObject($submissionComment) { diff --git a/classes/submission/SubmissionDiscipline.inc.php b/classes/submission/SubmissionDiscipline.inc.php index 387d7349dba..80726aa1405 100644 --- a/classes/submission/SubmissionDiscipline.inc.php +++ b/classes/submission/SubmissionDiscipline.inc.php @@ -36,8 +36,8 @@ public function getDiscipline() /** * Set the discipline text * - * @param discipline string - * @param locale string + * @param string $discipline + * @param string $locale */ public function setDiscipline($discipline, $locale) { diff --git a/classes/submission/SubmissionDisciplineDAO.inc.php b/classes/submission/SubmissionDisciplineDAO.inc.php index 5bc6f6a7897..5c741d7f266 100644 --- a/classes/submission/SubmissionDisciplineDAO.inc.php +++ b/classes/submission/SubmissionDisciplineDAO.inc.php @@ -28,8 +28,8 @@ class SubmissionDisciplineDAO extends ControlledVocabDAO /** * Build/fetch a publication's discipline controlled vocabulary. * - * @param $publicationId int - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param int $publicationId + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return ControlledVocabulary */ @@ -51,9 +51,9 @@ public function getLocaleFieldNames() /** * Get disciplines for a submission. * - * @param $publicationId int - * @param $locales array - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 + * @param int $publicationId + * @param array $locales + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 * * @return array */ @@ -98,10 +98,10 @@ public function getAllUniqueDisciplines() /** * Add an array of disciplines * - * @param $disciplines array - * @param $publicationId int - * @param $deleteFirst boolean - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param array $disciplines + * @param int $publicationId + * @param bool $deleteFirst + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return int */ diff --git a/classes/submission/SubmissionDisciplineEntryDAO.inc.php b/classes/submission/SubmissionDisciplineEntryDAO.inc.php index ac21273dff0..1588a2a4456 100644 --- a/classes/submission/SubmissionDisciplineEntryDAO.inc.php +++ b/classes/submission/SubmissionDisciplineEntryDAO.inc.php @@ -36,8 +36,8 @@ public function newDataObject() * Retrieve an iterator of controlled vocabulary entries matching a * particular controlled vocabulary ID. * - * @param $controlledVocabId int - * @param $filter null (Not yet supported) + * @param int $controlledVocabId + * @param null $filter (Not yet supported) * @param null|mixed $rangeInfo * * @return object DAOResultFactory containing matching CVE objects diff --git a/classes/submission/SubmissionKeyword.inc.php b/classes/submission/SubmissionKeyword.inc.php index bdc6a81a7f1..50b0f12d4e0 100644 --- a/classes/submission/SubmissionKeyword.inc.php +++ b/classes/submission/SubmissionKeyword.inc.php @@ -36,8 +36,8 @@ public function getKeyword() /** * Set the keyword text * - * @param keyword string - * @param locale string + * @param string $keyword + * @param string $locale */ public function setKeyword($keyword, $locale) { diff --git a/classes/submission/SubmissionKeywordDAO.inc.php b/classes/submission/SubmissionKeywordDAO.inc.php index 4b1896ea008..dc01ff2def0 100644 --- a/classes/submission/SubmissionKeywordDAO.inc.php +++ b/classes/submission/SubmissionKeywordDAO.inc.php @@ -27,8 +27,8 @@ class SubmissionKeywordDAO extends ControlledVocabDAO /** * Build/fetch and return a controlled vocabulary for keywords. * - * @param $publicationId int - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param int $publicationId + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return ControlledVocab */ @@ -51,9 +51,9 @@ public function getLocaleFieldNames() /** * Get keywords for a submission. * - * @param $publicationId int - * @param $locales array - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 + * @param int $publicationId + * @param array $locales + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 * * @return array */ @@ -98,10 +98,10 @@ public function getAllUniqueKeywords() /** * Add an array of keywords * - * @param $keywords array - * @param $publicationId int - * @param $deleteFirst boolean - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param array $keywords + * @param int $publicationId + * @param bool $deleteFirst + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return int */ diff --git a/classes/submission/SubmissionKeywordEntryDAO.inc.php b/classes/submission/SubmissionKeywordEntryDAO.inc.php index 6685d80879c..108dcb2cd22 100644 --- a/classes/submission/SubmissionKeywordEntryDAO.inc.php +++ b/classes/submission/SubmissionKeywordEntryDAO.inc.php @@ -36,8 +36,8 @@ public function newDataObject() * Retrieve an iterator of controlled vocabulary entries matching a * particular controlled vocabulary ID. * - * @param $controlledVocabId int - * @param $filter null (Not yet supported) + * @param int $controlledVocabId + * @param null $filter (Not yet supported) * @param null|mixed $rangeInfo * * @return object DAOResultFactory containing matching CVE objects diff --git a/classes/submission/SubmissionLanguage.inc.php b/classes/submission/SubmissionLanguage.inc.php index 89ca7ecbfe5..cf8435212bc 100644 --- a/classes/submission/SubmissionLanguage.inc.php +++ b/classes/submission/SubmissionLanguage.inc.php @@ -36,8 +36,8 @@ public function getLanguage() /** * Set the language text * - * @param language string - * @param locale string + * @param string $language + * @param string $locale */ public function setLanguage($language, $locale) { diff --git a/classes/submission/SubmissionLanguageDAO.inc.php b/classes/submission/SubmissionLanguageDAO.inc.php index f81c351f1e8..21bd4583e8c 100644 --- a/classes/submission/SubmissionLanguageDAO.inc.php +++ b/classes/submission/SubmissionLanguageDAO.inc.php @@ -27,8 +27,8 @@ class SubmissionLanguageDAO extends ControlledVocabDAO /** * Build/fetch and return a controlled vocabulary for languages. * - * @param $publicationId int - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param int $publicationId + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return ControlledVocab */ @@ -51,9 +51,9 @@ public function getLocaleFieldNames() /** * Get Languages for a submission. * - * @param $publicationId int - * @param $locales array - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 + * @param int $publicationId + * @param array $locales + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 * * @return array */ @@ -98,10 +98,10 @@ public function getAllUniqueLanguages() /** * Add an array of languages * - * @param $languages array - * @param $publicationId int - * @param $deleteFirst boolean - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param array $languages + * @param int $publicationId + * @param bool $deleteFirst + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return int */ diff --git a/classes/submission/SubmissionLanguageEntryDAO.inc.php b/classes/submission/SubmissionLanguageEntryDAO.inc.php index 095d0b7cb81..6845ca32a5f 100644 --- a/classes/submission/SubmissionLanguageEntryDAO.inc.php +++ b/classes/submission/SubmissionLanguageEntryDAO.inc.php @@ -36,8 +36,8 @@ public function newDataObject() * Retrieve an iterator of controlled vocabulary entries matching a * particular controlled vocabulary ID. * - * @param $controlledVocabId int - * @param $filter null (Not yet supported) + * @param int $controlledVocabId + * @param null $filter (Not yet supported) * @param null|mixed $rangeInfo * * @return object DAOResultFactory containing matching CVE objects diff --git a/classes/submission/SubmissionSubject.inc.php b/classes/submission/SubmissionSubject.inc.php index 138a9e801d3..42765368d66 100644 --- a/classes/submission/SubmissionSubject.inc.php +++ b/classes/submission/SubmissionSubject.inc.php @@ -36,8 +36,8 @@ public function getSubject() /** * Set the subject text * - * @param subject string - * @param locale string + * @param string $subject + * @param string $locale */ public function setSubject($subject, $locale) { diff --git a/classes/submission/SubmissionSubjectDAO.inc.php b/classes/submission/SubmissionSubjectDAO.inc.php index 933cb7a9cd0..146481827a5 100644 --- a/classes/submission/SubmissionSubjectDAO.inc.php +++ b/classes/submission/SubmissionSubjectDAO.inc.php @@ -27,8 +27,8 @@ class SubmissionSubjectDAO extends ControlledVocabDAO /** * Build/fetch and return a controlled vocabulary for subjects. * - * @param $publicationId int - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param int $publicationId + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return ControlledVocab */ @@ -51,9 +51,9 @@ public function getLocaleFieldNames() /** * Get Subjects for a submission. * - * @param $publicationId int - * @param $locales array - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 + * @param int $publicationId + * @param array $locales + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#6213 * * @return array */ @@ -98,10 +98,10 @@ public function getAllUniqueSubjects() /** * Add an array of subjects * - * @param $subjects array - * @param $publicationId int - * @param $deleteFirst boolean - * @param $assocType int DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 + * @param array $subjects + * @param int $publicationId + * @param bool $deleteFirst + * @param int $assocType DO NOT USE: For <3.1 to 3.x migration pkp/pkp-lib#3572 pkp/pkp-lib#6213 * * @return int */ diff --git a/classes/submission/SubmissionSubjectEntryDAO.inc.php b/classes/submission/SubmissionSubjectEntryDAO.inc.php index 34f4d320abc..914e9d60d75 100644 --- a/classes/submission/SubmissionSubjectEntryDAO.inc.php +++ b/classes/submission/SubmissionSubjectEntryDAO.inc.php @@ -36,8 +36,8 @@ public function newDataObject() * Retrieve an iterator of controlled vocabulary entries matching a * particular controlled vocabulary ID. * - * @param $controlledVocabId int - * @param $filter null (Not yet supported) + * @param int $controlledVocabId + * @param null $filter (Not yet supported) * @param null|mixed $rangeInfo * * @return object DAOResultFactory containing matching CVE objects diff --git a/classes/submission/action/EditorAction.inc.php b/classes/submission/action/EditorAction.inc.php index 0be96d83ad2..4cd8b8c5f24 100644 --- a/classes/submission/action/EditorAction.inc.php +++ b/classes/submission/action/EditorAction.inc.php @@ -16,11 +16,9 @@ namespace PKP\submission\action; use APP\facades\Repo; -use APP\i18n\AppLocale; use APP\notification\Notification; use APP\notification\NotificationManager; use APP\submission\Submission; -use APP\workflow\EditorDecisionActionsManager; use Illuminate\Mail\Mailable; use Illuminate\Support\Facades\Mail; @@ -55,84 +53,16 @@ public function __construct() // // Actions. // - /** - * Records an editor's submission decision. - * - * @param $request PKPRequest - * @param $submission Submission - * @param $decision integer - * @param $decisionLabels array(SUBMISSION_EDITOR_DECISION_... or SUBMISSION_EDITOR_RECOMMEND_... => editor.submission.decision....) - * @param $reviewRound ReviewRound optional Current review round that user is taking the decision, if any. - * @param $stageId integer optional - * @param $recommendation boolean optional - */ - public function recordDecision($request, $submission, $decision, $decisionLabels, $reviewRound = null, $stageId = null, $recommendation = false) - { - $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ - - // Define the stage and round data. - if (!is_null($reviewRound)) { - $stageId = $reviewRound->getStageId(); - } else { - if ($stageId == null) { - // We consider that the decision is being made for the current - // submission stage. - $stageId = $submission->getStageId(); - } - } - - $editorAssigned = $stageAssignmentDao->editorAssignedToStage( - $submission->getId(), - $stageId - ); - - // Sanity checks - if (!$editorAssigned || !isset($decisionLabels[$decision])) { - return false; - } - - $user = $request->getUser(); - $editorDecision = [ - 'editDecisionId' => null, - 'editorId' => $user->getId(), - 'decision' => $decision, - 'dateDecided' => date(Core::getCurrentDate()) - ]; - - $result = $editorDecision; - if (!HookRegistry::call('EditorAction::recordDecision', [&$submission, &$editorDecision, &$result, &$recommendation])) { - // Record the new decision - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $editDecisionDao->updateEditorDecision($submission->getId(), $editorDecision, $stageId, $reviewRound); - - // Set a new submission status if necessary - if ($decision == EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE || $decision == EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE) { - Repo::submission()->edit($submission, ['status' => Submission::STATUS_DECLINED]); - $submission = Repo::submission()->get($submission->getId()); - } elseif ($submission->getStatus() == PKPSubmission::STATUS_DECLINED) { - Repo::submission()->edit($submission, ['status' => Submission::STATUS_QUEUED]); - $submission = Repo::submission()->get($submission->getId()); - } - - // Add log entry - AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_APP_EDITOR); - $eventType = $recommendation ? PKPSubmissionEventLogEntry::SUBMISSION_LOG_EDITOR_RECOMMENDATION : PKPSubmissionEventLogEntry::SUBMISSION_LOG_EDITOR_DECISION; - $logKey = $recommendation ? 'log.editor.recommendation' : 'log.editor.decision'; - SubmissionLog::logEvent($request, $submission, $eventType, $logKey, ['editorName' => $user->getFullName(), 'submissionId' => $submission->getId(), 'decision' => __($decisionLabels[$decision])]); - } - return $result; - } - /** * Assigns a reviewer to a submission. * - * @param $request PKPRequest - * @param $submission object - * @param $reviewerId int - * @param $reviewRound ReviewRound - * @param $reviewDueDate datetime - * @param $responseDueDate datetime + * @param PKPRequest $request + * @param object $submission + * @param int $reviewerId + * @param ReviewRound $reviewRound + * @param datetime $reviewDueDate + * @param datetime $responseDueDate * @param null|mixed $reviewMethod */ public function addReviewer($request, $submission, $reviewerId, &$reviewRound, $reviewDueDate, $responseDueDate, $reviewMethod = null) @@ -198,7 +128,7 @@ public function addReviewer($request, $submission, $reviewerId, &$reviewRound, $ PKPNotification::NOTIFICATION_TYPE_ERROR, ['contents' => __('email.compose.error')] ); - trigger_error($e->getMessage(), E_USER_WARNING); + trigger_error('Failed to send email: ' . $e->getMessage(), E_USER_WARNING); } } } @@ -207,12 +137,12 @@ public function addReviewer($request, $submission, $reviewerId, &$reviewRound, $ /** * Sets the due date for a review assignment. * - * @param $request PKPRequest - * @param $submission Submission - * @param $reviewAssignment ReviewAssignment - * @param $reviewDueDate string - * @param $responseDueDate string - * @param $logEntry boolean + * @param PKPRequest $request + * @param Submission $submission + * @param ReviewAssignment $reviewAssignment + * @param string $reviewDueDate + * @param string $responseDueDate + * @param bool $logEntry */ public function setDueDates($request, $submission, $reviewAssignment, $reviewDueDate, $responseDueDate, $logEntry = false) { @@ -262,17 +192,6 @@ public function setDueDates($request, $submission, $reviewAssignment, $reviewDue } } - /** - * Increment a submission's workflow stage. - * - * @param $submission Submission - * @param $newStage integer One of the WORKFLOW_STAGE_* constants. - */ - public function incrementWorkflowStage($submission, $newStage) - { - Repo::submission()->edit($submission, ['stageId' => $newStage]); - } - protected function createMail( PKPSubmission $submission, ReviewAssignment $reviewAssignment, @@ -314,8 +233,8 @@ protected function createMail( // Additional template variable $mailable->addData([ - 'reviewerName' => $mailable->viewData['userFullName'], - 'reviewerUserName' => $mailable->viewData['username'], + 'reviewerName' => $mailable->viewData['userFullName'] ?? null, + 'reviewerUserName' => $mailable->viewData['username'] ?? null, ]); return $mailable; diff --git a/classes/submission/form/PKPSubmissionSubmitStep1Form.inc.php b/classes/submission/form/PKPSubmissionSubmitStep1Form.inc.php index 9b41da010cf..092e433795e 100644 --- a/classes/submission/form/PKPSubmissionSubmitStep1Form.inc.php +++ b/classes/submission/form/PKPSubmissionSubmitStep1Form.inc.php @@ -30,14 +30,14 @@ class PKPSubmissionSubmitStep1Form extends SubmissionSubmitForm { - /** @var boolean Is there a privacy statement to be confirmed? */ + /** @var bool Is there a privacy statement to be confirmed? */ public $hasPrivacyStatement = true; /** * Constructor. * - * @param $context Context - * @param $submission Submission (optional) + * @param Context $context + * @param Submission $submission (optional) */ public function __construct($context, $submission = null) { @@ -211,7 +211,7 @@ public function fetch($request, $template = null, $display = false) * * @see SubmissionSubmitForm::initData * - * @param $data array + * @param array $data */ public function initData($data = []) { @@ -281,10 +281,10 @@ public function setPublicationData($publication, $submission) /** * Add or update comments to editor * - * @param $submissionId int - * @param $commentsToEditor string - * @param $userId int - * @param $query Query optional + * @param int $submissionId + * @param string $commentsToEditor + * @param int $userId + * @param Query $query optional */ public function setCommentsToEditor($submissionId, $commentsToEditor, $userId, $query = null) { @@ -338,7 +338,7 @@ public function setCommentsToEditor($submissionId, $commentsToEditor, $userId, $ /** * Get comments to editor * - * @param $submissionId int + * @param int $submissionId * * @return null|Query */ @@ -415,36 +415,46 @@ public function execute(...$functionArgs) // if no user names exist for this submission locale, // copy the names in default site primary locale for this locale as well - $userGivenNames = $user->getGivenName(null); - $userFamilyNames = $user->getFamilyName(null); - if (is_null($userFamilyNames)) { - $userFamilyNames = []; - } - if (empty($userGivenNames[$this->submission->getData('locale')])) { - $site = Application::get()->getRequest()->getSite(); - $userGivenNames[$this->submission->getData('locale')] = $userGivenNames[$site->getPrimaryLocale()]; - // then there should also be no family name for the submission locale - $userFamilyNames[$this->submission->getData('locale')] = !empty($userFamilyNames[$site->getPrimaryLocale()]) ? $userFamilyNames[$site->getPrimaryLocale()] : ''; + $authorUserGroups = $userGroupDao->getByRoleId($this->context->getId(), Role::ROLE_ID_AUTHOR)->toArray(); + + $userInAuthorGroup = array_filter($authorUserGroups, function ($item) use ($userGroupId) { + return $item->getId() === $userGroupId; + }); + + if (!empty($userInAuthorGroup)) { + $userGivenNames = $user->getGivenName(null); + $userFamilyNames = $user->getFamilyName(null); + if (is_null($userFamilyNames)) { + $userFamilyNames = []; + } + if (empty($userGivenNames[$this->submission->getData('locale')])) { + $site = Application::get()->getRequest()->getSite(); + $userGivenNames[$this->submission->getData('locale')] = $userGivenNames[$site->getPrimaryLocale()]; + // then there should also be no family name for the submission locale + $userFamilyNames[$this->submission->getData('locale')] = !empty($userFamilyNames[$site->getPrimaryLocale()]) ? $userFamilyNames[$site->getPrimaryLocale()] : ''; + } + + // Set user to initial author + $author = Repo::author()->newDataObject(); + $author->setGivenName($userGivenNames, null); + $author->setFamilyName($userFamilyNames, null); + $author->setAffiliation($user->getAffiliation(null), null); + $author->setCountry($user->getCountry()); + $author->setEmail($user->getEmail()); + $author->setUrl($user->getUrl()); + $author->setBiography($user->getBiography(null), null); + $author->setIncludeInBrowse(1); + $author->setOrcid($user->getOrcid()); + $author->setData('publicationId', $publication->getId()); + + // Get the user group to display the submitter as + $author->setUserGroupId($userGroupId); + + $authorId = Repo::author()->add($author); + Repo::publication()->edit($publication, ['primaryContactId' => $authorId]); } - // Set user to initial author - $author = Repo::author()->newDataObject(); - $author->setGivenName($userGivenNames, null); - $author->setFamilyName($userFamilyNames, null); - $author->setAffiliation($user->getAffiliation(null), null); - $author->setCountry($user->getCountry()); - $author->setEmail($user->getEmail()); - $author->setUrl($user->getUrl()); - $author->setBiography($user->getBiography(null), null); - $author->setIncludeInBrowse(1); - $author->setOrcid($user->getOrcid()); - $author->setData('publicationId', $publication->getId()); - - // Get the user group to display the submitter as - $author->setUserGroupId($userGroupId); - - $authorId = Repo::author()->add($author); - Repo::publication()->edit($publication, ['primaryContactId' => $authorId]); + $publication = Repo::publication()->get($publication->getId()); // Assign the user author to the stage diff --git a/classes/submission/form/PKPSubmissionSubmitStep2Form.inc.php b/classes/submission/form/PKPSubmissionSubmitStep2Form.inc.php index 29899adbce6..39db172a9ce 100644 --- a/classes/submission/form/PKPSubmissionSubmitStep2Form.inc.php +++ b/classes/submission/form/PKPSubmissionSubmitStep2Form.inc.php @@ -17,6 +17,7 @@ use APP\core\Application; use APP\facades\Repo; +use APP\i18n\AppLocale; use APP\template\TemplateManager; use PKP\core\PKPApplication; @@ -29,8 +30,8 @@ class PKPSubmissionSubmitStep2Form extends SubmissionSubmitForm /** * Constructor. * - * @param $context Context - * @param $submission Submission + * @param Context $context + * @param Submission $submission */ public function __construct($context, $submission) { @@ -55,6 +56,7 @@ public function fetch($request, $template = null, $display = false) $fileUploadApiUrl = ''; $submissionFiles = []; + $submissionLocale = AppLocale::getLocale(); if ($this->submission) { $fileUploadApiUrl = $request->getDispatcher()->url( $request, @@ -64,17 +66,17 @@ public function fetch($request, $template = null, $display = false) ); $submissionFileForm = new \PKP\components\forms\submission\PKPSubmissionFileForm($fileUploadApiUrl, $genres); - $submissionFilesCollector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$this->submission->getId()]) ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_SUBMISSION]); - $submissionFilesIterator = Repo::submissionFiles() - ->getMany($submissionFilesCollector); + $submissionFiles = Repo::submissionFile() + ->getMany($collector); - $submissionFiles = Repo::submissionFiles() + $submissionFiles = Repo::submissionFile() ->getSchemaMap() - ->summarizeMany($submissionFilesIterator); + ->summarizeMany($submissionFiles, $genres); } $templateMgr = TemplateManager::getManager($request); @@ -110,7 +112,7 @@ public function fetch($request, $template = null, $display = false) ]; }, $genres), 'id' => 'submissionFiles', - 'items' => $submissionFiles, + 'items' => $submissionFiles->values(), 'options' => [ 'maxFilesize' => Application::getIntMaxFileMBs(), 'timeout' => ini_get('max_execution_time') ? ini_get('max_execution_time') * 1000 : 0, @@ -127,6 +129,7 @@ public function fetch($request, $template = null, $display = false) 'dropzoneDictMaxFilesExceeded' => __('form.dropzone.dictMaxFilesExceeded'), ], 'otherLabel' => __('about.other'), + 'primaryLocale' => $request->getContext()->getPrimaryLocale(), 'removeConfirmLabel' => __('submission.submit.removeConfirm'), 'stageId' => WORKFLOW_STAGE_ID_SUBMISSION, 'title' => __('submission.files'), @@ -152,11 +155,11 @@ public function fetch($request, $template = null, $display = false) public function validate($callHooks = true) { // Validate that all upload files have been assigned a genreId - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_SUBMISSION]) ->filterBySubmissionIds([$this->submission->getId()]); - $submissionFilesIterator = Repo::submissionFiles() + $submissionFilesIterator = Repo::submissionFile() ->getMany($collector); foreach ($submissionFilesIterator as $submissionFile) { if (!$submissionFile->getData('genreId')) { diff --git a/classes/submission/form/PKPSubmissionSubmitStep3Form.inc.php b/classes/submission/form/PKPSubmissionSubmitStep3Form.inc.php index 5be791cf102..3fcb0e3835b 100644 --- a/classes/submission/form/PKPSubmissionSubmitStep3Form.inc.php +++ b/classes/submission/form/PKPSubmissionSubmitStep3Form.inc.php @@ -28,9 +28,9 @@ class PKPSubmissionSubmitStep3Form extends SubmissionSubmitForm /** * Constructor. * - * @param $context Context - * @param $submission Submission - * @param $metadataFormImplementation MetadataFormImplementation + * @param Context $context + * @param Submission $submission + * @param MetadataFormImplementation $metadataFormImplementation */ public function __construct($context, $submission, $metadataFormImplementation) { diff --git a/classes/submission/form/PKPSubmissionSubmitStep4Form.inc.php b/classes/submission/form/PKPSubmissionSubmitStep4Form.inc.php index 2abe5d819b3..4f7b82e7c29 100644 --- a/classes/submission/form/PKPSubmissionSubmitStep4Form.inc.php +++ b/classes/submission/form/PKPSubmissionSubmitStep4Form.inc.php @@ -19,7 +19,6 @@ use APP\facades\Repo; use APP\notification\Notification; use APP\notification\NotificationManager; -use APP\workflow\EditorDecisionActionsManager; use PKP\core\Core; use PKP\db\DAORegistry; @@ -36,8 +35,8 @@ class PKPSubmissionSubmitStep4Form extends SubmissionSubmitForm /** * Constructor. * - * @param $context Context - * @param $submission Submission + * @param Context $context + * @param Submission $submission */ public function __construct($context, $submission) { @@ -148,7 +147,7 @@ public function execute(...$functionArgs) // Update assignment notifications $notificationManager->updateNotification( $request, - (new EditorDecisionActionsManager())->getStageNotifications(), + $notificationManager->getDecisionStageNotifications(), null, ASSOC_TYPE_SUBMISSION, $this->submission->getId() diff --git a/classes/submission/form/SubmissionSubmitForm.inc.php b/classes/submission/form/SubmissionSubmitForm.inc.php index 5942011e8bb..503e344a98f 100644 --- a/classes/submission/form/SubmissionSubmitForm.inc.php +++ b/classes/submission/form/SubmissionSubmitForm.inc.php @@ -40,12 +40,17 @@ class SubmissionSubmitForm extends Form /** * Constructor. * - * @param $submission object - * @param $step int + * @param object $submission + * @param int $step */ public function __construct($context, $submission, $step) { - parent::__construct(sprintf('submission/form/step%d.tpl', $step)); + parent::__construct( + sprintf('submission/form/step%d.tpl', $step), + true, + $submission ? $submission->getLocale() : null, + $context->getSupportedSubmissionLocaleNames() + ); $this->addCheck(new \PKP\form\validation\FormValidatorPost($this)); $this->addCheck(new \PKP\form\validation\FormValidatorCSRF($this)); $this->step = (int) $step; diff --git a/classes/submission/maps/Schema.inc.php b/classes/submission/maps/Schema.inc.php index 3a8c66309c8..d79a030450c 100644 --- a/classes/submission/maps/Schema.inc.php +++ b/classes/submission/maps/Schema.inc.php @@ -25,7 +25,9 @@ use PKP\db\DAORegistry; use PKP\plugins\HookRegistry; use PKP\plugins\PluginRegistry; +use PKP\security\UserGroup; use PKP\services\PKPSchemaService; +use PKP\submission\Genre; use PKP\submission\reviewAssignment\ReviewAssignment; use PKP\submissionFile\SubmissionFile; @@ -37,9 +39,12 @@ class Schema extends \PKP\core\maps\Schema /** @copydoc \PKP\core\maps\Schema::$schema */ public string $schema = PKPSchemaService::SCHEMA_SUBMISSION; - /** The user groups for this context. */ + /** @var UserGroup[] The user groups for this context. */ public array $userGroups; + /** @var Genre[] The genres for this context. */ + public array $genres; + public function __construct(Request $request, Context $context, PKPSchemaService $schemaService) { AppLocale::requireComponents( @@ -87,10 +92,14 @@ protected function getSubmissionsListProps(): array * Map a submission * * Includes all properties in the submission schema. + * + * @param UserGroup[] $userGroups The user groups in this context + * @param Genre[] $genres The file genres in this context */ - public function map(Submission $item, array $userGroups): array + public function map(Submission $item, array $userGroups, array $genres): array { $this->userGroups = $userGroups; + $this->genres = $genres; return $this->mapByProperties($this->getProps(), $item); } @@ -98,10 +107,14 @@ public function map(Submission $item, array $userGroups): array * Summarize a submission * * Includes properties with the apiSummary flag in the submission schema. + * + * @param UserGroup[] $userGroups The user groups in this context + * @param Genres[] $genres The file genres in this context */ - public function summarize(Submission $item, array $userGroups): array + public function summarize(Submission $item, array $userGroups, array $genres): array { $this->userGroups = $userGroups; + $this->genres = $genres; return $this->mapByProperties($this->getSummaryProps(), $item); } @@ -109,13 +122,17 @@ public function summarize(Submission $item, array $userGroups): array * Map a collection of Submissions * * @see self::map + * + * @param UserGroup[] $userGroups The user groups in this context + * @param Genres[] $genres The file genres in this context */ - public function mapMany(Enumerable $collection, array $userGroups): Enumerable + public function mapMany(Enumerable $collection, array $userGroups, array $genres): Enumerable { $this->collection = $collection; $this->userGroups = $userGroups; + $this->genres = $genres; return $collection->map(function ($item) { - return $this->map($item, $this->userGroups); + return $this->map($item, $this->userGroups, $this->genres); }); } @@ -123,22 +140,30 @@ public function mapMany(Enumerable $collection, array $userGroups): Enumerable * Summarize a collection of Submissions * * @see self::summarize + * + * @param UserGroup[] $userGroups The user groups in this context + * @param Genres[] $genres The file genres in this context */ - public function summarizeMany(Enumerable $collection, array $userGroups): Enumerable + public function summarizeMany(Enumerable $collection, array $userGroups, array $genres): Enumerable { $this->collection = $collection; $this->userGroups = $userGroups; + $this->genres = $genres; return $collection->map(function ($item) { - return $this->summarize($item, $this->userGroups); + return $this->summarize($item, $this->userGroups, $this->genres); }); } /** * Map a submission with extra properties for the submissions list + * + * @param UserGroup[] $userGroups The user groups in this context + * @param Genres[] $genres The file genres in this context */ - public function mapToSubmissionsList(Submission $item, array $userGroups): array + public function mapToSubmissionsList(Submission $item, array $userGroups, array $genres): array { $this->userGroups = $userGroups; + $this->genres = $genres; return $this->mapByProperties($this->getSubmissionsListProps(), $item); } @@ -146,13 +171,17 @@ public function mapToSubmissionsList(Submission $item, array $userGroups): array * Map a collection of submissions with extra properties for the submissions list * * @see self::map + * + * @param UserGroup[] $userGroups The user groups in this context + * @param Genres[] $genres The file genres in this context */ - public function mapManyToSubmissionsList(Enumerable $collection, array $userGroups): Enumerable + public function mapManyToSubmissionsList(Enumerable $collection, array $userGroups, array $genres): Enumerable { $this->collection = $collection; $this->userGroups = $userGroups; + $this->genres = $genres; return $collection->map(function ($item) { - return $this->mapToSubmissionsList($item, $this->userGroups); + return $this->mapToSubmissionsList($item, $this->userGroups, $this->genres); }); } @@ -213,7 +242,7 @@ protected function mapByProperties(array $props, Submission $submission): array ); break; case 'publications': - $output[$prop] = Repo::publication()->getSchemaMap($submission, $this->userGroups) + $output[$prop] = Repo::publication()->getSchemaMap($submission, $this->userGroups, $this->genres) ->summarizeMany($submission->getData('publications'), $anonymize); break; case 'reviewAssignments': @@ -420,14 +449,14 @@ public function getPropertyStages(Submission $submission): array $stage['statusId'] = $reviewRound->determineStatus(); $stage['status'] = __($reviewRound->getStatusKey()); - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$submission->getId()]) ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_REVIEW_REVISION]) ->filterByReviewRoundIds([$reviewRound->getId()]); // Revision files in this round. $stage['files'] = [ - 'count' => Repo::submissionFiles()->getCount($collector), + 'count' => Repo::submissionFile()->getCount($collector), ]; // See if the curent user can only recommend: @@ -456,13 +485,13 @@ public function getPropertyStages(Submission $submission): array case WORKFLOW_STAGE_ID_EDITING: case WORKFLOW_STAGE_ID_PRODUCTION: $fileStages = [WORKFLOW_STAGE_ID_EDITING ? SubmissionFile::SUBMISSION_FILE_COPYEDIT : SubmissionFile::SUBMISSION_FILE_PROOF]; - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$submission->getId()]) ->filterByFileStages($fileStages); // Revision files in this round. $stage['files'] = [ - 'count' => Repo::submissionFiles()->getCount($collector), + 'count' => Repo::submissionFile()->getCount($collector), ]; break; } diff --git a/classes/submission/reviewAssignment/ReviewAssignment.inc.php b/classes/submission/reviewAssignment/ReviewAssignment.inc.php index 60f210fa9ad..867b80d5618 100644 --- a/classes/submission/reviewAssignment/ReviewAssignment.inc.php +++ b/classes/submission/reviewAssignment/ReviewAssignment.inc.php @@ -55,6 +55,18 @@ class ReviewAssignment extends \PKP\core\DataObject public const REVIEW_ASSIGNMENT_STATUS_THANKED = 9; // reviewer has been thanked public const REVIEW_ASSIGNMENT_STATUS_CANCELLED = 10; // reviewer cancelled review request + /** + * All review assignment statuses that indicate a + * review was completed + * + * @var array + */ + public const REVIEW_COMPLETE_STATUSES = [ + self::REVIEW_ASSIGNMENT_STATUS_RECEIVED, + self::REVIEW_ASSIGNMENT_STATUS_COMPLETE, + self::REVIEW_ASSIGNMENT_STATUS_THANKED, + ]; + // // Get/set methods // @@ -72,7 +84,7 @@ public function getSubmissionId() /** * Set ID of review assignment's submission * - * @param $submissionId int + * @param int $submissionId */ public function setSubmissionId($submissionId) { @@ -92,7 +104,7 @@ public function getReviewerId() /** * Set ID of reviewer. * - * @param $reviewerId int + * @param int $reviewerId */ public function setReviewerId($reviewerId) { @@ -112,7 +124,7 @@ public function getReviewerFullName() /** * Set full name of reviewer. * - * @param $reviewerFullName string + * @param string $reviewerFullName */ public function setReviewerFullName($reviewerFullName) { @@ -132,7 +144,7 @@ public function getComments() /** * Set reviewer comments. * - * @param $comments string + * @param string $comments */ public function setComments($comments) { @@ -152,7 +164,7 @@ public function getCompetingInterests() /** * Set competing interests. * - * @param $competingInterests string + * @param string $competingInterests */ public function setCompetingInterests($competingInterests) { @@ -172,7 +184,7 @@ public function getStageId() /** * Set the workflow stage id. * - * @param $stageId int WORKFLOW_STAGE_ID_... + * @param int $stageId WORKFLOW_STAGE_ID_... */ public function setStageId($stageId) { @@ -192,7 +204,7 @@ public function getReviewMethod() /** * Set the type of review. * - * @param $method int + * @param int $method */ public function setReviewMethod($method) { @@ -212,7 +224,7 @@ public function getReviewRoundId() /** * Set review round id. * - * @param $reviewRoundId int + * @param int $reviewRoundId */ public function setReviewRoundId($reviewRoundId) { @@ -232,7 +244,7 @@ public function getRecommendation() /** * Set reviewer recommendation. * - * @param $recommendation string + * @param string $recommendation */ public function setRecommendation($recommendation) { @@ -252,7 +264,7 @@ public function getUnconsidered() /** * Set unconsidered state. * - * @param $unconsidered int + * @param int $unconsidered */ public function setUnconsidered($unconsidered) { @@ -272,7 +284,7 @@ public function getDateRated() /** * Set the date the reviewer was rated. * - * @param $dateRated string + * @param string $dateRated */ public function setDateRated($dateRated) { @@ -292,7 +304,7 @@ public function getLastModified() /** * Set the date of the last modification. * - * @param $dateModified date + * @param date $dateModified */ public function setLastModified($dateModified) { @@ -320,7 +332,7 @@ public function getDateAssigned() /** * Set the reviewer's assigned date. * - * @param $dateAssigned string + * @param string $dateAssigned */ public function setDateAssigned($dateAssigned) { @@ -340,7 +352,7 @@ public function getDateNotified() /** * Set the reviewer's notified date. * - * @param $dateNotified string + * @param string $dateNotified */ public function setDateNotified($dateNotified) { @@ -360,7 +372,7 @@ public function getDateConfirmed() /** * Set the reviewer's confirmed date. * - * @param $dateConfirmed string + * @param string $dateConfirmed */ public function setDateConfirmed($dateConfirmed) { @@ -380,7 +392,7 @@ public function getDateCompleted() /** * Set the reviewer's completed date. * - * @param $dateCompleted string + * @param string $dateCompleted */ public function setDateCompleted($dateCompleted) { @@ -400,7 +412,7 @@ public function getDateAcknowledged() /** * Set the reviewer's acknowledged date. * - * @param $dateAcknowledged string + * @param string $dateAcknowledged */ public function setDateAcknowledged($dateAcknowledged) { @@ -420,7 +432,7 @@ public function getDateReminded() /** * Set the reviewer's last reminder date. * - * @param $dateReminded string + * @param string $dateReminded */ public function setDateReminded($dateReminded) { @@ -440,7 +452,7 @@ public function getDateDue() /** * Set the reviewer's due date. * - * @param $dateDue string + * @param string $dateDue */ public function setDateDue($dateDue) { @@ -460,7 +472,7 @@ public function getDateResponseDue() /** * Set the reviewer's response due date. * - * @param $dateResponseDue string + * @param string $dateResponseDue */ public function setDateResponseDue($dateResponseDue) { @@ -470,7 +482,7 @@ public function setDateResponseDue($dateResponseDue) /** * Get the declined value. * - * @return boolean + * @return bool */ public function getDeclined() { @@ -480,7 +492,7 @@ public function getDeclined() /** * Set the reviewer's declined value. * - * @param $declined boolean + * @param bool $declined */ public function setDeclined($declined) { @@ -490,7 +502,7 @@ public function setDeclined($declined) /** * Get the cancelled value. * - * @return boolean + * @return bool */ public function getCancelled() { @@ -500,7 +512,7 @@ public function getCancelled() /** * Set the reviewer's cancelled value. * - * @param $cancelled boolean + * @param bool $cancelled */ public function setCancelled($cancelled) { @@ -510,7 +522,7 @@ public function setCancelled($cancelled) /** * Get a boolean indicating whether or not the last reminder was automatic. * - * @return boolean + * @return bool */ public function getReminderWasAutomatic() { @@ -520,7 +532,7 @@ public function getReminderWasAutomatic() /** * Set the boolean indicating whether or not the last reminder was automatic. * - * @param $wasAutomatic boolean + * @param bool $wasAutomatic */ public function setReminderWasAutomatic($wasAutomatic) { @@ -540,7 +552,7 @@ public function getQuality() /** * Set quality. * - * @param $quality int|null + * @param int|null $quality */ public function setQuality($quality) { @@ -560,7 +572,7 @@ public function getRound() /** * Set round. * - * @param $round int + * @param int $round */ public function setRound($round) { @@ -580,7 +592,7 @@ public function getReviewFormId() /** * Set review form id. * - * @param $reviewFormId int + * @param int $reviewFormId */ public function setReviewFormId($reviewFormId) { @@ -728,7 +740,7 @@ public function getStatusKey($status = null) /** * Get the translation key for the review method * - * @param $method int|null Optionally pass a method to retrieve a specific key. + * @param int|null $method Optionally pass a method to retrieve a specific key. * Default will return the key for the current review method * * @return string diff --git a/classes/submission/reviewAssignment/ReviewAssignmentDAO.inc.php b/classes/submission/reviewAssignment/ReviewAssignmentDAO.inc.php index ac9661d2ea1..462d2758f7f 100644 --- a/classes/submission/reviewAssignment/ReviewAssignmentDAO.inc.php +++ b/classes/submission/reviewAssignment/ReviewAssignmentDAO.inc.php @@ -26,7 +26,7 @@ class ReviewAssignmentDAO extends \PKP\db\DAO /** * Retrieve review assignments for the passed review round id. * - * @param $reviewRoundId int + * @param int $reviewRoundId * * @return array */ @@ -41,7 +41,7 @@ public function getByReviewRoundId($reviewRoundId) /** * Retrieve open review assignments for the passed review round id. * - * @param $reviewRoundId int + * @param int $reviewRoundId * * @return array */ @@ -57,8 +57,8 @@ public function getOpenReviewsByReviewRoundId($reviewRoundId) * Retrieve review assignments from table usign the passed * sql query and parameters. * - * @param $query string - * @param $queryParams array + * @param string $query + * @param array $queryParams * * @return array */ @@ -91,8 +91,8 @@ public function getReviewRoundJoin() /** * Retrieve a review assignment by review round and reviewer. * - * @param $reviewRoundId int - * @param $reviewerId int + * @param int $reviewRoundId + * @param int $reviewerId * * @return ReviewAssignment */ @@ -114,7 +114,7 @@ public function getReviewAssignment($reviewRoundId, $reviewerId) /** * Retrieve a review assignment by review assignment id. * - * @param $reviewId int + * @param int $reviewId * * @return ReviewAssignment */ @@ -170,9 +170,9 @@ public function getIncompleteReviewAssignmentsWhereString() /** * Get all review assignments for a submission. * - * @param $submissionId int Submission ID - * @param $reviewRoundId int Review round ID - * @param $stageId int Optional stage ID + * @param int $submissionId Submission ID + * @param int $reviewRoundId Review round ID + * @param int $stageId Optional stage ID * * @return array ReviewAssignments */ @@ -207,9 +207,9 @@ public function getBySubmissionId($submissionId, $reviewRoundId = null, $stageId /** * Retrieve all review assignments by submission and reviewer. * - * @param $submissionId int - * @param $reviewerId int - * @param $stageId int optional + * @param int $submissionId + * @param int $reviewerId + * @param int $stageId optional * * @return array */ @@ -228,7 +228,7 @@ public function getBySubmissionReviewer($submissionId, $reviewerId, $stageId = n /** * Get all review assignments for a reviewer. * - * @param $userId int + * @param int $userId * * @return array ReviewAssignments */ @@ -259,10 +259,10 @@ public function getByUserId($userId) /** * Check if a reviewer is assigned to a specified submission. * - * @param $reviewRoundId int - * @param $reviewerId int + * @param int $reviewRoundId + * @param int $reviewerId * - * @return boolean + * @return bool */ public function reviewerExists($reviewRoundId, $reviewerId) { @@ -280,7 +280,7 @@ public function reviewerExists($reviewRoundId, $reviewerId) /** * Get all review assignments for a review form. * - * @param $reviewFormId int + * @param int $reviewFormId * * @return array ReviewAssignments */ @@ -310,8 +310,8 @@ public function getByReviewFormId($reviewFormId) /** * Determine the order of active reviews for the given round of the given submission * - * @param $submissionId int Submission ID - * @param $reviewRoundId int Review round ID + * @param int $submissionId Submission ID + * @param int $reviewRoundId Review round ID * * @return array Associating review ID with number, i.e. if review ID 26 is first returned['26']=0. */ @@ -337,7 +337,7 @@ public function getReviewIndexesForRound($submissionId, $reviewRoundId) /** * Insert a new Review Assignment. * - * @param $reviewAssignment ReviewAssignment + * @param ReviewAssignment $reviewAssignment */ public function insertObject($reviewAssignment) { @@ -402,7 +402,7 @@ public function insertObject($reviewAssignment) /** * Update an existing review assignment. * - * @param $reviewAssignment object + * @param object $reviewAssignment */ public function updateObject($reviewAssignment) { @@ -472,7 +472,7 @@ public function updateObject($reviewAssignment) * Update the status of the review round an assignment is attached to. This * should be fired whenever a reviewer assignment is modified. * - * @param $reviewAssignment ReviewAssignment + * @param ReviewAssignment $reviewAssignment */ public function updateReviewRoundStatus($reviewAssignment) { @@ -494,7 +494,7 @@ public function updateReviewRoundStatus($reviewAssignment) /** * Internal function to return a review assignment object from a row. * - * @param $row array + * @param array $row * * @return ReviewAssignment */ @@ -546,7 +546,7 @@ public function newDataObject() /** * Delete review assignment. * - * @param $reviewId int + * @param int $reviewId */ public function deleteById($reviewId) { @@ -573,9 +573,9 @@ public function deleteById($reviewId) /** * Delete review assignments by submission ID. * - * @param $submissionId int + * @param int $submissionId * - * @return boolean + * @return bool */ public function deleteBySubmissionId($submissionId) { @@ -605,8 +605,8 @@ public function getInsertId() /** * Get the last review round review assignment for a given user. * - * @param $submissionId int - * @param $reviewerId int + * @param int $submissionId + * @param int $reviewerId * * @return ReviewAssignment? */ diff --git a/classes/submission/reviewRound/ReviewRound.inc.php b/classes/submission/reviewRound/ReviewRound.inc.php index b52e553acd7..1413c9e277c 100644 --- a/classes/submission/reviewRound/ReviewRound.inc.php +++ b/classes/submission/reviewRound/ReviewRound.inc.php @@ -20,13 +20,13 @@ namespace PKP\submission\reviewRound; -use APP\workflow\EditorDecisionActionsManager; - +use APP\decision\Decision; +use APP\facades\Repo; use PKP\db\DAORegistry; class ReviewRound extends \PKP\core\DataObject { - // The first four statuses are set explicitly by EditorDecisions, which override + // The first four statuses are set explicitly by Decisions, which override // the current status. public const REVIEW_ROUND_STATUS_REVISIONS_REQUESTED = 1; public const REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW = 2; @@ -72,7 +72,7 @@ public function getSubmissionId() /** * set submission id * - * @param $submissionId int + * @param int $submissionId */ public function setSubmissionId($submissionId) { @@ -92,7 +92,7 @@ public function getStageId() /** * Set review stage id * - * @param $stageId int + * @param int $stageId */ public function setStageId($stageId) { @@ -130,7 +130,7 @@ public function getStatus() /** * Set current round status * - * @param $status int + * @param int $status */ public function setStatus($status) { @@ -149,18 +149,14 @@ public function setStatus($status) */ public function determineStatus() { - // Check if revisions requested or received, if this is latest review round and then check files - $roundStatus = $this->getStatus(); - // If revisions have been requested, check to see if any have been // submitted if ($this->getStatus() == self::REVIEW_ROUND_STATUS_REVISIONS_REQUESTED || $this->getStatus() == self::REVIEW_ROUND_STATUS_REVISIONS_SUBMITTED) { // get editor decisions - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $pendingRevisionDecision = $editDecisionDao->findValidPendingRevisionsDecision($this->getSubmissionId(), $this->getStageId(), EditorDecisionActionsManager::SUBMISSION_EDITOR_RECOMMEND_PENDING_REVISIONS); + $pendingRevisionDecision = Repo::decision()->getActivePendingRevisionsDecision($this->getSubmissionId(), $this->getStageId(), Decision::PENDING_REVISIONS); if ($pendingRevisionDecision) { - if ($editDecisionDao->responseExists($pendingRevisionDecision, $this->getSubmissionId())) { + if (Repo::decision()->revisionsUploadedSinceDecision($pendingRevisionDecision, $this->getSubmissionId())) { return self::REVIEW_ROUND_STATUS_REVISIONS_SUBMITTED; } } @@ -171,11 +167,10 @@ public function determineStatus() // submitted if ($this->getStatus() == self::REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW || $this->getStatus() == self::REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW_SUBMITTED) { // get editor decisions - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $pendingRevisionDecision = $editDecisionDao->findValidPendingRevisionsDecision($this->getSubmissionId(), $this->getStageId(), EditorDecisionActionsManager::SUBMISSION_EDITOR_RECOMMEND_RESUBMIT); + $pendingRevisionDecision = Repo::decision()->getActivePendingRevisionsDecision($this->getSubmissionId(), $this->getStageId(), Decision::RESUBMIT); if ($pendingRevisionDecision) { - if ($editDecisionDao->responseExists($pendingRevisionDecision, $this->getSubmissionId())) { + if (Repo::decision()->revisionsUploadedSinceDecision($pendingRevisionDecision, $this->getSubmissionId())) { return self::REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW_SUBMITTED; } } @@ -196,7 +191,6 @@ public function determineStatus() // Determine the round status by looking at the recommendOnly editor assignment statuses $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ $pendingRecommendations = false; $recommendationsFinished = true; $recommendationsReady = false; @@ -205,9 +199,15 @@ public function determineStatus() if ($editorsStageAssignment->getRecommendOnly()) { $pendingRecommendations = true; // Get recommendation from the assigned recommendOnly editor - $editorId = $editorsStageAssignment->getUserId(); - $editorRecommendations = $editDecisionDao->getEditorDecisions($this->getSubmissionId(), $this->getStageId(), $this->getRound(), $editorId); - if (empty($editorRecommendations)) { + $decisions = Repo::decision()->getCount( + Repo::decision() + ->getCollector() + ->filterBySubmissionIds([$this->getSubmissionId()]) + ->filterByStageIds([$this->getStageId()]) + ->filterByReviewRoundIds([$this->getId()]) + ->filterByEditorIds([$editorsStageAssignment->getUserId()]) + ); + if (!$decisions) { $recommendationsFinished = false; } else { $recommendationsReady = true; @@ -274,7 +274,7 @@ public function determineStatus() /** * Get locale key associated with current status * - * @param $isAuthor boolean True iff the status is to be shown to the author (slightly tweaked phrasing) + * @param bool $isAuthor True iff the status is to be shown to the author (slightly tweaked phrasing) * * @return int */ diff --git a/classes/submission/reviewRound/ReviewRoundDAO.inc.php b/classes/submission/reviewRound/ReviewRoundDAO.inc.php index 0a823a4d00e..98f9040f047 100644 --- a/classes/submission/reviewRound/ReviewRoundDAO.inc.php +++ b/classes/submission/reviewRound/ReviewRoundDAO.inc.php @@ -27,10 +27,10 @@ class ReviewRoundDAO extends \PKP\db\DAO /** * Fetch a review round, creating it if needed. * - * @param $submissionId integer - * @param $stageId integer One of the WORKFLOW_*_REVIEW_STAGE_ID constants. - * @param $round integer - * @param $status integer One of the REVIEW_ROUND_STATUS_* constants. + * @param int $submissionId + * @param int $stageId One of the WORKFLOW_*_REVIEW_STAGE_ID constants. + * @param int $round + * @param int $status One of the REVIEW_ROUND_STATUS_* constants. * * @return ReviewRound */ @@ -76,7 +76,7 @@ public function newDataObject() /** * Insert a new review round. * - * @param $reviewRound ReviewRound + * @param ReviewRound $reviewRound * * @return int */ @@ -100,9 +100,9 @@ public function insertObject($reviewRound) /** * Update an existing review round. * - * @param $reviewRound ReviewRound + * @param ReviewRound $reviewRound * - * @return boolean + * @return bool */ public function updateObject($reviewRound) { @@ -125,9 +125,9 @@ public function updateObject($reviewRound) /** * Retrieve a review round * - * @param $submissionId integer - * @param $stageId int One of the Stage_id_* constants. - * @param $round int The review round to be retrieved. + * @param int $submissionId + * @param int $stageId One of the Stage_id_* constants. + * @param int $round The review round to be retrieved. * * @return ReviewRound? */ @@ -161,7 +161,7 @@ public function getById($reviewRoundId) /** * Retrieve a review round by a submission file id. * - * @param $submissionFileId int + * @param int $submissionFileId * * @return ReviewRound */ @@ -182,9 +182,9 @@ public function getBySubmissionFileId($submissionFileId) /** * Get an iterator of review round objects associated with this submission * - * @param $submissionId int - * @param $stageId int (optional) - * @param $round int (optional) + * @param int $submissionId + * @param int $stageId (optional) + * @param int $round (optional) */ public function getBySubmissionId($submissionId, $stageId = null, $round = null) { @@ -210,8 +210,8 @@ public function getBySubmissionId($submissionId, $stageId = null, $round = null) /** * Get the current review round for a given stage (or for the latest stage) * - * @param $submissionId int - * @param $stageId int + * @param int $submissionId + * @param int $stageId * * @return int */ @@ -235,8 +235,8 @@ public function getCurrentRoundBySubmissionId($submissionId, $stageId = null) /** * Get the last review round for a give stage (or for the latest stage) * - * @param $submissionId int - * @param $stageId int + * @param int $submissionId + * @param int $stageId * * @return ReviewRound? */ @@ -259,6 +259,25 @@ public function getLastReviewRoundBySubmissionId($submissionId, $stageId = null) return $row ? $this->_fromRow($row) : null; } + /** + * Check if submission has a review round (in the given stage id) + */ + public function submissionHasReviewRound(int $submissionId, ?int $stageId = null): bool + { + $params = [(int)$submissionId]; + if ($stageId) { + $params[] = (int) $stageId; + } + $result = $this->retrieve( + 'SELECT review_round_id + FROM review_rounds + WHERE submission_id = ? + ' . ($stageId ? ' AND stage_id = ?' : ''), + $params + ); + return (bool) $result->current(); + } + /** * Get the ID of the last inserted review round. * @@ -272,8 +291,8 @@ public function getInsertId() /** * Update the review round status. * - * @param $reviewRound ReviewRound - * @param $status int? Optionally pass a REVIEW_ROUND_STATUS_... to set a + * @param ReviewRound $reviewRound + * @param int? $status Optionally pass a REVIEW_ROUND_STATUS_... to set a * specific status. If not included, will determine the appropriate status * based on ReviewRound::determineStatus(). */ @@ -301,7 +320,7 @@ public function updateStatus($reviewRound, $status = null) /** * Delete review rounds by submission ID. * - * @param $submissionId int + * @param int $submissionId */ public function deleteBySubmissionId($submissionId) { @@ -314,7 +333,7 @@ public function deleteBySubmissionId($submissionId) /** * Delete a review round. * - * @param $reviewRound ReviewRound + * @param ReviewRound $reviewRound */ public function deleteObject($reviewRound) { @@ -324,9 +343,9 @@ public function deleteObject($reviewRound) /** * Delete a review round by ID. * - * @param $reviewRoundId int + * @param int $reviewRoundId * - * @return boolean + * @return bool */ public function deleteById($reviewRoundId) { @@ -340,7 +359,7 @@ public function deleteById($reviewRoundId) /** * Internal function to return a review round object from a row. * - * @param $row array + * @param array $row * * @return ReviewRound */ diff --git a/classes/submission/reviewer/ReviewerAction.inc.php b/classes/submission/reviewer/ReviewerAction.inc.php index 3b8d80ca4bc..5dc687283e0 100644 --- a/classes/submission/reviewer/ReviewerAction.inc.php +++ b/classes/submission/reviewer/ReviewerAction.inc.php @@ -43,11 +43,11 @@ public function __construct() /** * Records whether or not the reviewer accepts the review assignment. * - * @param $request PKPRequest - * @param $reviewAssignment ReviewAssignment - * @param $submission Submission - * @param $decline boolean - * @param $emailText string optional + * @param PKPRequest $request + * @param ReviewAssignment $reviewAssignment + * @param Submission $submission + * @param bool $decline + * @param string $emailText optional */ public function confirmReview($request, $reviewAssignment, $submission, $decline, $emailText = null) { diff --git a/classes/submission/reviewer/form/PKPReviewerReviewStep1Form.inc.php b/classes/submission/reviewer/form/PKPReviewerReviewStep1Form.inc.php index 21a7469289d..30c79358535 100644 --- a/classes/submission/reviewer/form/PKPReviewerReviewStep1Form.inc.php +++ b/classes/submission/reviewer/form/PKPReviewerReviewStep1Form.inc.php @@ -35,8 +35,8 @@ class PKPReviewerReviewStep1Form extends ReviewerReviewForm /** * Constructor. * - * @param $request PKPRequest - * @param $reviewerSubmission ReviewerSubmission + * @param PKPRequest $request + * @param ReviewerSubmission $reviewerSubmission */ public function __construct($request, $reviewerSubmission, $reviewAssignment) { diff --git a/classes/submission/reviewer/form/PKPReviewerReviewStep2Form.inc.php b/classes/submission/reviewer/form/PKPReviewerReviewStep2Form.inc.php index 5a832446681..6dd3401c16d 100644 --- a/classes/submission/reviewer/form/PKPReviewerReviewStep2Form.inc.php +++ b/classes/submission/reviewer/form/PKPReviewerReviewStep2Form.inc.php @@ -22,7 +22,7 @@ class PKPReviewerReviewStep2Form extends ReviewerReviewForm /** * Constructor. * - * @param $reviewerSubmission ReviewerSubmission + * @param ReviewerSubmission $reviewerSubmission */ public function __construct($request, $reviewerSubmission, $reviewAssignment) { diff --git a/classes/submission/reviewer/form/PKPReviewerReviewStep3Form.inc.php b/classes/submission/reviewer/form/PKPReviewerReviewStep3Form.inc.php index 51bb8648339..9a7b01ad3f7 100644 --- a/classes/submission/reviewer/form/PKPReviewerReviewStep3Form.inc.php +++ b/classes/submission/reviewer/form/PKPReviewerReviewStep3Form.inc.php @@ -38,8 +38,8 @@ class PKPReviewerReviewStep3Form extends ReviewerReviewForm /** * Constructor. * - * @param $reviewerSubmission ReviewerSubmission - * @param $reviewAssignment ReviewAssignment + * @param ReviewerSubmission $reviewerSubmission + * @param ReviewAssignment $reviewAssignment */ public function __construct($request, $reviewerSubmission, $reviewAssignment) { @@ -245,7 +245,7 @@ public function saveForLater() /** * Save the given answers to the review form * - * @param $reviewAssignment ReviewAssignment + * @param ReviewAssignment $reviewAssignment */ public function saveReviewForm($reviewAssignment) { diff --git a/classes/submission/reviewer/form/ReviewerReviewForm.inc.php b/classes/submission/reviewer/form/ReviewerReviewForm.inc.php index 5509e5886ab..3a0ed869ab9 100644 --- a/classes/submission/reviewer/form/ReviewerReviewForm.inc.php +++ b/classes/submission/reviewer/form/ReviewerReviewForm.inc.php @@ -36,9 +36,9 @@ class ReviewerReviewForm extends Form /** * Constructor. * - * @param $reviewerSubmission ReviewerSubmission - * @param $step integer - * @param $request PKPRequest + * @param ReviewerSubmission $reviewerSubmission + * @param int $step + * @param PKPRequest $request */ public function __construct($request, $reviewerSubmission, $reviewAssignment, $step) { @@ -78,7 +78,7 @@ public function getReviewAssignment() /** * Get the review step. * - * @return integer + * @return int */ public function getStep() { @@ -114,7 +114,7 @@ public function fetch($request, $template = null, $display = false) * value if it is not already set to a higher value. Then * update the given reviewer submission. * - * @param $reviewerSubmission ReviewerSubmission + * @param ReviewerSubmission $reviewerSubmission */ public function updateReviewStepAndSaveSubmission($reviewerSubmission) { diff --git a/classes/submissionFile/Collector.inc.php b/classes/submissionFile/Collector.inc.php index 0d39ad8b15d..4bafd91fb06 100644 --- a/classes/submissionFile/Collector.inc.php +++ b/classes/submissionFile/Collector.inc.php @@ -47,7 +47,7 @@ class Collector implements CollectorInterface /** @var null|array get submission files matching an ASSOC_ID with one of the assocTypes */ protected $assocIds = null; - /** @var boolean include submission files in the SUBMISSION_FILE_DEPENDENT stage */ + /** @var bool include submission files in the SUBMISSION_FILE_DEPENDENT stage */ protected $includeDependentFiles = false; /** @var null|array get submission files matching one or more uploader users id */ diff --git a/classes/submissionFile/DAO.inc.php b/classes/submissionFile/DAO.inc.php index 085cde781cc..7061c75f636 100644 --- a/classes/submissionFile/DAO.inc.php +++ b/classes/submissionFile/DAO.inc.php @@ -21,7 +21,6 @@ use APP\facades\Repo; use Exception; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Illuminate\Support\LazyCollection; @@ -31,8 +30,6 @@ use PKP\services\PKPSchemaService; use PKP\submission\reviewRound\ReviewRound; -use stdClass; - class DAO extends EntityDAO implements PKPPubIdPluginDAO { /** @copydoc EntityDAO::$schema */ @@ -68,7 +65,7 @@ class DAO extends EntityDAO implements PKPPubIdPluginDAO */ public function newDataObject(): SubmissionFile { - return App::make(SubmissionFile::class); + return app(SubmissionFile::class); } /** @@ -117,7 +114,7 @@ public function getMany(Collector $query): LazyCollection return LazyCollection::make(function () use ($rows) { foreach ($rows as $row) { - yield $row->submission_file_id = $this->fromRow($row); + yield $row->submission_file_id => $this->fromRow($row); } }); } @@ -125,7 +122,7 @@ public function getMany(Collector $query): LazyCollection /** * @copydoc EntityDAO::fromRow() */ - public function fromRow(stdClass $primaryRow): SubmissionFile + public function fromRow(object $primaryRow): SubmissionFile { $submissionFile = parent::fromRow($primaryRow); $submissionFile->setData('locale', $primaryRow->locale); @@ -285,8 +282,8 @@ public function getByBestId( /** * Assign file to a review round. * - * @param $submissionFileId int The file to be assigned. - * @param $reviewRound ReviewRound + * @param int $submissionFileId The file to be assigned. + * @param ReviewRound $reviewRound */ public function assignRevisionToReviewRound( int $submissionFileId, @@ -381,11 +378,11 @@ public function deleteAllPubIds($contextId, $pubIdType) ->filterByContextIds([$contextId]); $submissionsIds = Repo::submission()->getIds($collector)->toArray(); - $submissionFilesCollector = Repo::submissionFiles() + $submissionFilesCollector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds($submissionsIds); - Repo::submissionFiles() + Repo::submissionFile() ->deleteMany($submissionFilesCollector); } diff --git a/classes/submissionFile/Repository.inc.php b/classes/submissionFile/Repository.inc.php index a7288cfe96b..eec3e5c7024 100644 --- a/classes/submissionFile/Repository.inc.php +++ b/classes/submissionFile/Repository.inc.php @@ -21,7 +21,6 @@ use APP\notification\NotificationManager; use Exception; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Illuminate\Support\LazyCollection; use PKP\core\Core; @@ -42,17 +41,13 @@ class Repository { - /** @var DAO $dao */ - public $dao; + public DAO $dao; + public string $schemaMap = Schema::class; + protected Request $request; + protected PKPSchemaService $schemaService; - /** @var string $schemaMap The name of the class to map this entity to its schemaa */ - public $schemaMap = Schema::class; - - /** @var Request $request */ - protected $request; - - /** @var PKPSchemaService $schemaService */ - protected $schemaService; + /** @var array $reviewFileStages The file stages that are part of a review workflow stage */ + public array $reviewFileStages = []; public function __construct(DAO $dao, Request $request, PKPSchemaService $schemaService) { @@ -99,7 +94,7 @@ public function getMany(Collector $query): LazyCollection /** @copydoc DAO::getCollector() */ public function getCollector(): Collector { - return App::make(Collector::class); + return app(Collector::class); } /** @@ -497,6 +492,27 @@ public function edit( ); } + /** + * Copy a submission file to another stage + * + * @return int ID of the new submission file + */ + public function copy(SubmissionFile $submissionFile, int $toFileStage, ?int $reviewRoundId = null): int + { + $newSubmissionFile = clone $submissionFile; + $newSubmissionFile->setData('fileStage', $toFileStage); + $newSubmissionFile->setData('sourceSubmissionFileId', $submissionFile->getId()); + $newSubmissionFile->setData('assocType', null); + $newSubmissionFile->setData('assocId', null); + + if ($reviewRoundId) { + $newSubmissionFile->setData('assocType', Application::ASSOC_TYPE_REVIEW_ROUND); + $newSubmissionFile->setData('assocId', $reviewRoundId); + } + + return Repo::submissionFile()->add($newSubmissionFile); + } + /** @copydoc DAO::delete() */ public function delete(SubmissionFile $submissionFile): void { diff --git a/classes/submissionFile/SubmissionFile.inc.php b/classes/submissionFile/SubmissionFile.inc.php index a3e4633379b..2e4f293af14 100644 --- a/classes/submissionFile/SubmissionFile.inc.php +++ b/classes/submissionFile/SubmissionFile.inc.php @@ -16,7 +16,6 @@ namespace PKP\submissionFile; use APP\i18n\AppLocale; -use PKP\core\PKPApplication; // Define the file stage identifiers. @@ -37,12 +36,22 @@ class SubmissionFile extends \PKP\core\DataObject public const SUBMISSION_FILE_INTERNAL_REVIEW_FILE = 19; public const SUBMISSION_FILE_INTERNAL_REVIEW_REVISION = 20; + public const INTERNAL_REVIEW_STAGES = [ + SubmissionFile::SUBMISSION_FILE_INTERNAL_REVIEW_FILE, + SubmissionFile::SUBMISSION_FILE_INTERNAL_REVIEW_REVISION, + ]; + + public const EXTERNAL_REVIEW_STAGES = [ + SubmissionFile::SUBMISSION_FILE_REVIEW_FILE, + SubmissionFile::SUBMISSION_FILE_REVIEW_REVISION, + ]; + /** * Get a piece of data for this object, localized to the current * locale if possible. * - * @param $key string - * @param $preferredLocale string + * @param string $key + * @param string $preferredLocale */ public function &getLocalizedData($key, $preferredLocale = null) { @@ -98,7 +107,7 @@ public function getSubmissionLocale() * * @deprecated 3.3.0.0 * - * @param $submissionLocale string + * @param string $submissionLocale */ public function setSubmissionLocale($submissionLocale) { @@ -108,7 +117,7 @@ public function setSubmissionLocale($submissionLocale) /** * Get stored public ID of the file. * - * @param @literal $pubIdType string One of the NLM pub-id-type values or + * @param string $pubIdType @literal One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). @endliteral * @@ -122,10 +131,10 @@ public function getStoredPubId($pubIdType) /** * Set the stored public ID of the file. * - * @param $pubIdType string One of the NLM pub-id-type values or + * @param string $pubIdType One of the NLM pub-id-type values or * 'other::something' if not part of the official NLM list * (see ). - * @param $pubId string + * @param string $pubId */ public function setStoredPubId($pubIdType, $pubId) { @@ -136,7 +145,7 @@ public function setStoredPubId($pubIdType, $pubId) * Get price of submission file. * A null return indicates "not available"; 0 is free. * - * @return numeric|null + * @return float|null */ public function getDirectSalesPrice() { @@ -147,7 +156,7 @@ public function getDirectSalesPrice() * Set direct sales price. * A null return indicates "not available"; 0 is free. * - * @param $directSalesPrice numeric|null + * @param float|null $directSalesPrice */ public function setDirectSalesPrice($directSalesPrice) { @@ -167,7 +176,7 @@ public function getSalesType() /** * Set sales type. * - * @param $salesType string + * @param string $salesType */ public function setSalesType($salesType) { @@ -180,7 +189,7 @@ public function setSalesType($salesType) * * @deprecated 3.3.0.0 * - * @param $genreId int + * @param int $genreId */ public function setGenreId($genreId) { @@ -232,7 +241,7 @@ public function getFileStage() * * @deprecated 3.3.0.0 * - * @param $fileStage int SUBMISSION_FILE_... + * @param int $fileStage SUBMISSION_FILE_... */ public function setFileStage($fileStage) { @@ -257,7 +266,7 @@ public function getDateModified() * * @deprecated 3.3.0.0 * - * @param $updatedAt date + * @param date $updatedAt */ public function setDateModified($updatedAt) @@ -270,7 +279,7 @@ public function setDateModified($updatedAt) * * @deprecated 3.3.0.0 * - * @return boolean + * @return bool */ public function getViewable() { @@ -283,7 +292,7 @@ public function getViewable() * * @deprecated 3.3.0.0 * - * @param $viewable boolean + * @param bool $viewable */ public function setViewable($viewable) { @@ -295,7 +304,7 @@ public function setViewable($viewable) * * @deprecated 3.3.0.0 * - * @param $uploaderUserId integer + * @param int $uploaderUserId */ public function setUploaderUserId($uploaderUserId) { @@ -307,7 +316,7 @@ public function setUploaderUserId($uploaderUserId) * * @deprecated 3.3.0.0 * - * @return integer + * @return int */ public function getUploaderUserId() { @@ -331,7 +340,7 @@ public function getAssocType() * * @deprecated 3.3.0.0 * - * @param $assocType int + * @param int $assocType */ public function setAssocType($assocType) { @@ -355,7 +364,7 @@ public function getChapterId() * * @deprecated 3.3.0.0 * - * @param $chapterId int + * @param int $chapterId */ public function setChapterId($chapterId) { diff --git a/classes/submissionFile/maps/Schema.inc.php b/classes/submissionFile/maps/Schema.inc.php index a7f5673b390..b6d3a75e911 100644 --- a/classes/submissionFile/maps/Schema.inc.php +++ b/classes/submissionFile/maps/Schema.inc.php @@ -14,28 +14,42 @@ namespace PKP\submissionFile\maps; use APP\core\Application; +use APP\core\Request; use APP\core\Services; use APP\facades\Repo; use Illuminate\Support\Enumerable; +use PKP\context\Context; use PKP\core\maps\Schema as BaseSchema; use PKP\services\PKPSchemaService; +use PKP\submission\Genre; use PKP\submissionFile\SubmissionFile; class Schema extends BaseSchema { - /** @var Enumerable */ + /** */ public Enumerable $collection; - /** @var string */ + /** */ public string $schema = PKPSchemaService::SCHEMA_SUBMISSION_FILE; + /** @var Genre[] File genres in this context */ + public array $genres; + + public function __construct(Request $request, Context $context, PKPSchemaService $schemaService) + { + parent::__construct($request, $context, $schemaService); + } + /** * Map a submission file * * Includes all properties in the submission file schema. + * + * @param Genre[] $genres */ - public function map(SubmissionFile $item): array + public function map(SubmissionFile $item, array $genres): array { + $this->genres = $genres; return $this->mapByProperties($this->getProps(), $item); } @@ -43,9 +57,12 @@ public function map(SubmissionFile $item): array * Summarize a submission file * * Includes properties with the apiSummary flag in the submission file schema. + * + * @param Genre[] $genres */ - public function summarize(SubmissionFile $item): array + public function summarize(SubmissionFile $item, array $genres): array { + $this->genres = $genres; return $this->mapByProperties($this->getSummaryProps(), $item); } @@ -53,12 +70,14 @@ public function summarize(SubmissionFile $item): array * Map a collection of submission files * * @see self::map + * + * @param Genre[] $genres */ - public function mapMany(Enumerable $collection): Enumerable + public function mapMany(Enumerable $collection, array $genres): Enumerable { $this->collection = $collection; - return $collection->map(function ($item) { - return $this->map($item); + return $collection->map(function ($item) use ($genres) { + return $this->map($item, $genres); }); } @@ -66,12 +85,14 @@ public function mapMany(Enumerable $collection): Enumerable * Summarize a collection of submission files * * @see self::summarize + * + * @param Genre[] $genres */ - public function summarizeMany(Enumerable $collection): Enumerable + public function summarizeMany(Enumerable $collection, array $genres): Enumerable { $this->collection = $collection; - return $collection->map(function ($item) { - return $this->summarize($item); + return $collection->map(function ($item) use ($genres) { + return $this->summarize($item, $genres); }); } @@ -83,7 +104,7 @@ protected function mapByProperties(array $props, SubmissionFile $item): array $output = []; foreach ($props as $prop) { if ($prop === '_href') { - $values[$prop] = $this->getApiUrl( + $output[$prop] = $this->getApiUrl( 'submissions/' . $item->getData('submissionId') . '/files/' . $item->getId(), $this->context->getData('urlPath') ); @@ -92,30 +113,51 @@ protected function mapByProperties(array $props, SubmissionFile $item): array } if ($prop === 'dependentFiles') { - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterByAssoc(Application::ASSOC_TYPE_SUBMISSION_FILE, [$item->getId()]) ->filterBySubmissionIds([$item->getData('submissionId')]) ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_DEPENDENT]) ->includeDependentFiles(); - $dependentFiles = Repo::submissionFiles()->getMany($collector); + $dependentFiles = Repo::submissionFile()->getMany($collector); - $values[$prop] = $this->summarizeMany($dependentFiles); + $output[$prop] = $this->summarizeMany($dependentFiles, $this->genres)->values(); continue; } if ($prop === 'documentType') { - $values[$prop] = Services::get('file')->getDocumentType($item->getData('mimetype')); + $output[$prop] = Services::get('file')->getDocumentType($item->getData('mimetype')); + + continue; + } + if ($prop === 'genreIsPrimary') { + $output[$prop] = false; + foreach ($this->genres as $genre) { + if ($genre->getId() === $item->getData('genreId')) { + $output[$prop] = !$genre->getSupplementary() && !$genre->getDependent(); + break; + } + } + continue; + } + + if ($prop === 'genreName') { + foreach ($this->genres as $genre) { + if ($genre->getId() === $item->getData('genreId')) { + $output[$prop] = $genre->getData('name'); + break; + } + } continue; } if ($prop === 'revisions') { $files = []; - $revisions = Repo::submissionFiles()->getRevisions($item->getId()); + $revisions = Repo::submissionFile()->getRevisions($item->getId()); foreach ($revisions as $revision) { if ($revision->fileId === $item->getData('fileId')) { @@ -138,19 +180,19 @@ protected function mapByProperties(array $props, SubmissionFile $item): array 'fileId' => $revision->fileId, 'submissionFileId' => $item->getId(), 'submissionId' => $item->getData('submissionId'), - 'stageId' => Repo::submissionFiles()->getWorkflowStageId($item), + 'stageId' => Repo::submissionFile()->getWorkflowStageId($item), ] ), ]; } - $values[$prop] = $files; + $output[$prop] = $files; continue; } if ($prop === 'url') { - $values[$prop] = $this->request->getDispatcher()->url( + $output[$prop] = $this->request->getDispatcher()->url( $this->request, Application::ROUTE_COMPONENT, $this->context->getData('urlPath'), @@ -160,7 +202,7 @@ protected function mapByProperties(array $props, SubmissionFile $item): array [ 'submissionFileId' => $item->getId(), 'submissionId' => $item->getData('submissionId'), - 'stageId' => Repo::submissionFiles()->getWorkflowStageId($item), + 'stageId' => Repo::submissionFile()->getWorkflowStageId($item), ] ); diff --git a/classes/task/FileLoader.inc.php b/classes/task/FileLoader.inc.php index 9d14647e2d0..b480fa1f01c 100644 --- a/classes/task/FileLoader.inc.php +++ b/classes/task/FileLoader.inc.php @@ -62,13 +62,13 @@ abstract class FileLoader extends ScheduledTask /** @var array List of staged back files after processing. */ private $_stagedBackFiles = []; - /** @var boolean Whether to compress the archived files or not. */ + /** @var bool Whether to compress the archived files or not. */ private $_compressArchives = false; /** * Constructor. * - * @param $args array script arguments + * @param array $args script arguments */ public function __construct($args) { @@ -153,7 +153,7 @@ public function getArchivePath() /** * Return whether the archives must be compressed or not. * - * @return boolean + * @return bool */ public function getCompressArchives() { @@ -163,7 +163,7 @@ public function getCompressArchives() /** * Set whether the archives must be compressed or not. * - * @param $compressArchives boolean + * @param bool $compressArchives */ public function setCompressArchives($compressArchives) { @@ -223,10 +223,10 @@ protected function executeActions() * A public helper function that can be used to ensure * that the file structure has actually been installed. * - * @param $install boolean Set this parameter to true to + * @param bool $install Set this parameter to true to * install the folder structure if it is missing. * - * @return boolean True if the folder structure exists, + * @return bool True if the folder structure exists, * otherwise false. */ public function checkFolderStructure($install = false) @@ -282,7 +282,7 @@ public function checkFolderStructure($install = false) /** * Process the passed file. * - * @param $filePath string + * @param string $filePath * * @see FileLoader::execute to understand * the expected return values. @@ -292,9 +292,9 @@ abstract protected function processFile($filePath); /** * Move file between filesystem directories. * - * @param $sourceDir string - * @param $destDir string - * @param $filename string + * @param string $sourceDir + * @param string $destDir + * @param string $filename * * @return string The destination path of the moved file. */ @@ -392,27 +392,6 @@ private function _stageFile() { $this->moveFile($this->_processingPath, $this->_stagePath, $this->_claimedFilename); } - - /** - * Send the passed message to the administrator by email. - * - * @param $message string - */ - private function _notify($message, $messageType) - { - // Instantiate the email to the admin. - $mail = new Mail(); - - // Recipient - $mail->addRecipient($this->_adminEmail, $this->_adminName); - - // The message - $mail->setSubject(__('admin.fileLoader.emailSubject', ['processId' => $this->getProcessId()]) . - ' - ' . __($messageType)); - $mail->setBody($message); - - $mail->send(); - } } if (!PKP_STRICT_MODE) { diff --git a/classes/task/ReviewReminder.inc.php b/classes/task/ReviewReminder.inc.php index 6fa0864ae32..f4ad1541157 100644 --- a/classes/task/ReviewReminder.inc.php +++ b/classes/task/ReviewReminder.inc.php @@ -41,13 +41,13 @@ public function getName() /** * Send the automatic review reminder to the reviewer. * - * @param $reviewAssignment \PKP\submission\reviewAssignment\ReviewAssignment - * @param $submission Submission - * @param $context Context - * @param $reminderType string - * REVIEW_REMIND_AUTO, REVIEW_REQUEST_REMIND_AUTO + * @param \PKP\submission\reviewAssignment\ReviewAssignment $reviewAssignment + * @param Submission $submission + * @param Context $context + * @param string $reminderType + * REVIEW_REMIND_AUTO, REVIEW_RESPONSE_OVERDUE_AUTO */ - public function sendReminder($reviewAssignment, $submission, $context, $reminderType = 'REVIEW_REMIND_AUTO') + public function sendReminder($reviewAssignment, $submission, $context, $reminderType = 'REVIEW_RESPONSE_OVERDUE_AUTO') { $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /** @var ReviewAssignmentDAO $reviewAssignmentDao */ $reviewId = $reviewAssignment->getId(); @@ -63,8 +63,8 @@ public function sendReminder($reviewAssignment, $submission, $context, $reminder case $reviewerAccessKeysEnabled && ($reminderType == 'REVIEW_REMIND_AUTO'): $emailKey = 'REVIEW_REMIND_AUTO_ONECLICK'; break; - case $reviewerAccessKeysEnabled && ($reminderType == REVIEW_REQUEST_REMIND_AUTO): - $emailKey = 'REVIEW_REQUEST_REMIND_AUTO_ONECLICK'; + case $reviewerAccessKeysEnabled && ($reminderType == 'REVIEW_RESPONSE_OVERDUE_AUTO'): + $emailKey = 'REVIEW_RESPONSE_OVERDUE_AUTO_ONECLICK'; break; } $email = new SubmissionMailTemplate($submission, $emailKey, $context->getPrimaryLocale(), $context, false); @@ -111,13 +111,13 @@ public function sendReminder($reviewAssignment, $submission, $context, $reminder AppLocale::requireComponents(LOCALE_COMPONENT_PKP_REVIEWER); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_COMMON); $paramArray = [ - 'reviewerName' => $reviewer->getFullName(), - 'reviewerUserName' => $reviewer->getUsername(), + 'recipientName' => $reviewer->getFullName(), + 'recipientUsername' => $reviewer->getUsername(), 'reviewDueDate' => $reviewDueDate, 'responseDueDate' => $responseDueDate, - 'editorialContactSignature' => $context->getData('contactName') . "\n" . $context->getLocalizedName(), + 'signature' => $context->getData('contactName') . "\n" . $context->getLocalizedName(), 'passwordResetUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), ['confirm' => Validation::generatePasswordResetHash($reviewer->getId())]), - 'submissionReviewUrl' => $submissionReviewUrl, + 'reviewAssignmentUrl' => $submissionReviewUrl, 'messageToReviewer' => __('reviewer.step1.requestBoilerplate'), 'abstractTermIfEnabled' => ($submission->getLocalizedAbstract() == '' ? '' : __('common.abstract')), ]; @@ -182,7 +182,7 @@ public function executeActions() if ($inviteReminderDays >= 1 && $reviewAssignment->getDateConfirmed() == null) { $checkDate = strtotime($reviewAssignment->getDateResponseDue()); if (time() - $checkDate > 60 * 60 * 24 * $inviteReminderDays) { - $reminderType = REVIEW_REQUEST_REMIND_AUTO; + $reminderType = 'REVIEW_RESPONSE_OVERDUE_AUTO'; } } diff --git a/classes/template/PKPTemplateManager.inc.php b/classes/template/PKPTemplateManager.inc.php index 5a4d3c2a4a3..f60234ce781 100644 --- a/classes/template/PKPTemplateManager.inc.php +++ b/classes/template/PKPTemplateManager.inc.php @@ -40,6 +40,7 @@ use PKP\core\PKPApplication; use PKP\core\Registry; use PKP\db\DAORegistry; +use PKP\file\FileManager; use PKP\form\FormBuilderVocabulary; use PKP\linkAction\LinkAction; @@ -48,6 +49,8 @@ use PKP\plugins\PluginRegistry; use PKP\security\Role; use PKP\security\Validation; +use PKP\submission\Genre; +use PKP\submission\GenreDAO; use Smarty; /* This definition is required by Smarty */ @@ -129,7 +132,7 @@ public function __construct() /** * Initialize the template manager. * - * @param $request PKPRequest + * @param PKPRequest $request */ public function initialize($request) { @@ -392,7 +395,7 @@ public function initialize($request) /** * Flag the page as cacheable (or not). * - * @param $cacheability boolean optional + * @param bool $cacheability optional */ public function setCacheability($cacheability = self::CACHEABILITY_PUBLIC) { @@ -402,9 +405,9 @@ public function setCacheability($cacheability = self::CACHEABILITY_PUBLIC) /** * Compile a LESS stylesheet * - * @param $name string Unique name for this LESS stylesheet - * @param $lessFile string Path to the LESS file to compile - * @param $args array Optional arguments. Supports: + * @param string $name Unique name for this LESS stylesheet + * @param string $lessFile Path to the LESS file to compile + * @param array $args Optional arguments. Supports: * 'baseUrl': Base URL to use when rewriting URLs in the LESS file. * 'addLess': Array of additional LESS files to parse before compiling * @@ -449,8 +452,8 @@ public function compileLess($name, $lessFile, $args = []) /** * Save LESS styles to a cached file * - * @param $path string File path to save the compiled styles - * @param styles string CSS styles compiled from the LESS + * @param string $path File path to save the compiled styles + * @param string $styles CSS styles compiled from the LESS * * @return bool success/failure */ @@ -467,7 +470,7 @@ public function cacheLess($path, $styles) /** * Retrieve the file path for a cached LESS file * - * @param $name string Unique name for the LESS file + * @param string $name Unique name for the LESS file * * @return $path string Path to the less file or false if not found */ @@ -482,10 +485,10 @@ public function getCachedLessFilePath($name) /** * Register a stylesheet with the style handler * - * @param $name string Unique name for the stylesheet - * @param $style string The stylesheet to be included. Should be a URL + * @param string $name Unique name for the stylesheet + * @param string $style The stylesheet to be included. Should be a URL * or, if the `inline` argument is included, stylesheet data to be output. - * @param $args array Key/value array defining display details + * @param array $args Key/value array defining display details * `priority` int The order in which to print this stylesheet. * Default: STYLE_SEQUENCE_NORMAL * `contexts` string|array Where the stylesheet should be loaded. @@ -516,10 +519,10 @@ public function addStyleSheet($name, $style, $args = []) /** * Register a script with the script handler * - * @param $name string Unique name for the script - * @param $script string The script to be included. Should be a URL or, if + * @param string $name Unique name for the script + * @param string $script The script to be included. Should be a URL or, if * the `inline` argument is included, script data to be output. - * @param $args array Key/value array defining display details + * @param array $args Key/value array defining display details * `priority` int The order in which to print this script. * Default: STYLE_SEQUENCE_NORMAL * `contexts` string|array Where the script should be loaded. @@ -550,9 +553,9 @@ public function addJavaScript($name, $script, $args = []) /** * Add a page-specific item to the . * - * @param $name string Unique name for the header - * @param $header string The header to be included. - * @param $args array Key/value array defining display details + * @param string $name Unique name for the header + * @param string $header The header to be included. + * @param array $args Key/value array defining display details * `priority` int The order in which to print this header. * Default: STYLE_SEQUENCE_NORMAL * `contexts` string|array Where the header should be loaded. @@ -852,6 +855,29 @@ public function setupBackendPage() 'validator.required' ]); + // Set up the document type icons + $documentTypeIcons = [ + FileManager::DOCUMENT_TYPE_DEFAULT => 'file-o', + FileManager::DOCUMENT_TYPE_AUDIO => 'file-audio-o', + FileManager::DOCUMENT_TYPE_EPUB => 'file-text-o', + FileManager::DOCUMENT_TYPE_EXCEL => 'file-excel-o', + FileManager::DOCUMENT_TYPE_HTML => 'file-code-o', + FileManager::DOCUMENT_TYPE_IMAGE => 'file-image-o', + FileManager::DOCUMENT_TYPE_PDF => 'file-pdf-o', + FileManager::DOCUMENT_TYPE_WORD => 'file-word-o', + FileManager::DOCUMENT_TYPE_VIDEO => 'file-video-o', + FileManager::DOCUMENT_TYPE_ZIP => 'file-archive-o', + ]; + $this->addJavaScript( + 'documentTypeIcons', + 'pkp.documentTypeIcons = ' . json_encode($documentTypeIcons) . ';', + [ + 'priority' => self::STYLE_SEQUENCE_LAST, + 'contexts' => 'backend', + 'inline' => true, + ] + ); + // Register the jQuery script $min = Config::getVar('general', 'enable_minified') ? '.min' : ''; $this->addJavaScript( @@ -919,6 +945,9 @@ public function setupBackendPage() // Set up required state properties $this->setState([ 'menu' => [], + 'tinyMCE' => [ + 'skinUrl' => $request->getBaseUrl() . '/lib/ui-library/public/styles/tinymce', + ], ]); /** @@ -1130,9 +1159,9 @@ public function fetch($template = null, $cache_id = null, $compile_id = null, $p /** * Fetch content via AJAX and add it to the DOM, wrapped in a container element. * - * @param $id string ID to use for the generated container element. - * @param $url string URL to fetch the contents from. - * @param $element string Element to use for container. + * @param string $id ID to use for the generated container element. + * @param string $url URL to fetch the contents from. + * @param string $element Element to use for container. * * @return JSONMessage The JSON-encoded result. */ @@ -1151,7 +1180,7 @@ public function fetchAjax($id, $url, $element = 'div') /** * Calculate a compile ID for a resource. * - * @param $resourceName string Resource name. + * @param string $resourceName Resource name. * * @return string */ @@ -1170,8 +1199,8 @@ public function getCompileId($resourceName) /** * Returns the template results as a JSON message. * - * @param $template string Template filename (or Smarty resource name) - * @param $status boolean + * @param string $template Template filename (or Smarty resource name) + * @param bool $status * * @return JSONMessage JSON object */ @@ -1279,8 +1308,8 @@ public function clearCssCache() /** * Clear the cache when a context or site has changed it's active theme * - * @param $hookName string - * @param $args array [ + * @param string $hookName + * @param array $args [ * @option Context|Site The new values * @option Context|Site The old values * @option array Key/value of params that were modified @@ -1300,7 +1329,7 @@ public function clearThemeTemplateCache($hookName, $args) /** * Return an instance of the template manager. * - * @param $request PKPRequest + * @param PKPRequest $request * * @return TemplateManager the template manager object */ @@ -1344,8 +1373,8 @@ public function getFBV() /** * Display the sidebar * - * @param $hookName string - * @param $args array [ + * @param string $hookName + * @param array $args [ * @option array Params passed to the hook * @option Smarty * @option string The output @@ -1392,10 +1421,10 @@ public function displaySidebar($hookName, $args) * Custom Smarty function for translating localization keys. * Substitution works by replacing tokens like "{$foo}" with the value of the parameter named "foo" (if supplied). * - * @param $params array associative array, must contain "key" parameter for string to translate plus zero or more named parameters for substitution. + * @param array $params associative array, must contain "key" parameter for string to translate plus zero or more named parameters for substitution. * Translation variables can be specified also as an optional * associative array named "params". - * @param $smarty Smarty + * @param Smarty $smarty * * @return string the localized string, including any parameter substitutions */ @@ -1423,7 +1452,7 @@ public function smartyTranslate($params, $smarty) * Custom Smarty function for displaying a null link action; these will * typically be attached and handled in Javascript. * - * @param $smarty Smarty + * @param Smarty $smarty * * @return string the HTML for the generated link action */ @@ -1454,7 +1483,7 @@ public function smartyNullLinkAction($params, $smarty) * * Custom Smarty function for displaying a context-sensitive help link. * - * @param $smarty Smarty + * @param Smarty $smarty * * @return string the HTML for the generated link action */ @@ -1490,8 +1519,8 @@ public function smartyHelp($params, $smarty) * * Identical to Smarty's "html_options" function except option values are translated from i18n keys. * - * @param $params array - * @param $smarty Smarty + * @param array $params + * @param Smarty $smarty */ public function smartyHtmlOptionsTranslate($params, $smarty) { @@ -1630,7 +1659,7 @@ public function smartyCallHook($params, $smarty) /** * Generate a URL into a PKPApp. * - * @param $smarty object + * @param object $smarty * Available parameters: * - router: which router to use * - context @@ -1717,8 +1746,8 @@ public function smartyUrl($parameters, $smarty) * * Usage: {title value="Journal Settings"} * - * @param $parameters array - * @param $smarty object + * @param array $parameters + * @param object $smarty * Available parameters: * - router: which router to use * - context @@ -1851,10 +1880,10 @@ public function smartyConcat() /** * Compare the parameters. * - * @param $a mixed Parameter A - * @param $a mixed Parameter B - * @param $strict boolean True iff a strict (===) compare should be used - * @param $invert booelan True iff the output should be inverted + * @param mixed $a Parameter A + * @param mixed $a Parameter B + * @param bool $strict True iff a strict (===) compare should be used + * @param bool $invert True iff the output should be inverted */ public function smartyCompare($a, $b, $strict = false, $invert = false) { @@ -1912,8 +1941,8 @@ public function smartyEscape($string, $esc_type = 'html', $char_set = 'ISO-8859- * * Custom Smarty function for loading a URL via AJAX into any HTML element * - * @param $params array associative array - * @param $smarty Smarty + * @param array $params associative array + * @param Smarty $smarty * * @return string of HTML/Javascript */ @@ -1956,8 +1985,8 @@ public function smartyLoadUrlInEl($params, $smarty) * Custom Smarty function for loading a URL via AJAX into a DIV. Convenience * wrapper for smartyLoadUrlInEl. * - * @param $params array associative array - * @param $smarty Smarty + * @param array $params associative array + * @param Smarty $smarty * * @return string of HTML/Javascript */ @@ -1972,8 +2001,8 @@ public function smartyLoadUrlInDiv($params, $smarty) * * Custom Smarty function for inserting a CSRF token. * - * @param $params array associative array - * @param $smarty Smarty + * @param array $params associative array + * @param Smarty $smarty * * @return string of HTML */ @@ -1994,8 +2023,8 @@ public function smartyCSRF($params, $smarty) * * Custom Smarty function for printing stylesheets attached to a context. * - * @param $params array associative array - * @param $smarty Smarty + * @param array $params associative array + * @param Smarty $smarty * * @return string of HTML/Javascript */ @@ -2039,8 +2068,8 @@ public function smartyLoadStylesheet($params, $smarty) * Any styles assigned to the `htmlGalley` context will be injected into the * galley unless the galley already has an embedded CSS file. * - * @param $htmlContent string The HTML file content - * @param $embeddedFiles array Additional files embedded in this galley + * @param string $htmlContent The HTML file content + * @param array $embeddedFiles Additional files embedded in this galley */ public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) { @@ -2080,8 +2109,8 @@ public function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) * * Custom Smarty function for printing scripts attached to a context. * - * @param $params array associative array - * @param $smarty Smarty + * @param array $params associative array + * @param Smarty $smarty * * @return string of HTML/Javascript */ @@ -2124,8 +2153,8 @@ public function smartyLoadScript($params, $smarty) * * Custom Smarty function for printing scripts attached to a context. * - * @param $params array associative array - * @param $smarty Smarty + * @param array $params associative array + * @param Smarty $smarty * * @return string of HTML/Javascript */ @@ -2154,8 +2183,8 @@ public function smartyLoadHeader($params, $smarty) * * Custom Smarty function for printing navigation menu areas attached to a context. * - * @param $params array associative array - * @param $smarty Smarty + * @param array $params associative array + * @param Smarty $smarty * * @return string of HTML/Javascript */ @@ -2215,8 +2244,8 @@ public function smartyLoadNavigationMenuArea($params, $smarty) * A helper function which retrieves script, style and header assets * assigned to a particular context. * - * @param $resources array Requested resources - * @param $context string Requested context + * @param array $resources Requested resources + * @param string $context Requested context * * @return array Resources assigned to these contexts */ @@ -2259,8 +2288,8 @@ public function getResourcesByContext($resources, $context) * Custom Smarty function for plucking files from the array of $availableFiles * related to a submission. Intended to be used on the frontend * - * @param $params array associative array - * @param $smarty Smarty + * @param array $params associative array + * @param Smarty $smarty * * @return array of SubmissionFile objects */ diff --git a/classes/template/PKPTemplateResource.inc.php b/classes/template/PKPTemplateResource.inc.php index afcfd7bf42f..624e2f28672 100644 --- a/classes/template/PKPTemplateResource.inc.php +++ b/classes/template/PKPTemplateResource.inc.php @@ -25,7 +25,7 @@ class PKPTemplateResource extends \Smarty_Resource_Custom /** * Constructor * - * @param $templateDir string|array Template directory + * @param string|array $templateDir Template directory */ public function __construct($templateDir) { @@ -39,11 +39,11 @@ public function __construct($templateDir) /** * Resource function to get a template. * - * @param $name string Template name - * @param $source string Reference to variable receiving fetched Smarty source - * @param $mtime Modification time + * @param string $name Template name + * @param string $source Reference to variable receiving fetched Smarty source + * @param int|bool $mtime Modification time * - * @return boolean + * @return bool */ public function fetch($name, &$source, &$mtime) { @@ -60,7 +60,7 @@ public function fetch($name, &$source, &$mtime) /** * Get the timestamp for the specified template. * - * @param $name string Template name + * @param string $name Template name * * @return int|boolean */ diff --git a/classes/tombstone/DataObjectTombstone.inc.php b/classes/tombstone/DataObjectTombstone.inc.php index fd7186801b9..57c85eaab3c 100755 --- a/classes/tombstone/DataObjectTombstone.inc.php +++ b/classes/tombstone/DataObjectTombstone.inc.php @@ -32,7 +32,7 @@ public function getDataObjectId() /** * set data object id * - * @param $dataObjectId int + * @param int $dataObjectId */ public function setDataObjectId($dataObjectId) { @@ -52,7 +52,7 @@ public function getDateDeleted() /** * set date deleted * - * @param $dateDeleted date + * @param date $dateDeleted */ public function setDateDeleted($dateDeleted) { @@ -80,7 +80,7 @@ public function getSetSpec() /** * Set oai setSpec. * - * @param $setSpec string + * @param string $setSpec */ public function setSetSpec($setSpec) { @@ -100,7 +100,7 @@ public function getSetName() /** * Set oai setName. * - * @param $setName string + * @param string $setName */ public function setSetName($setName) { @@ -120,7 +120,7 @@ public function getOAIIdentifier() /** * Set oai identifier. * - * @param $oaiIdentifier string + * @param string $oaiIdentifier */ public function setOAIIdentifier($oaiIdentifier) { @@ -131,7 +131,7 @@ public function setOAIIdentifier($oaiIdentifier) * Get an specific object id that is part of * the OAI set of this tombstone. * - * @param $assocType int + * @param int $assocType * * @return int The object id. */ @@ -149,8 +149,8 @@ public function getOAISetObjectId($assocType) * Set an specific object id that is part of * the OAI set of this tombstone. * - * @param $assocType int - * @param $assocId int + * @param int $assocType + * @param int $assocId */ public function setOAISetObjectId($assocType, $assocId) { @@ -175,7 +175,7 @@ public function getOAISetObjectsIds() * Set all objects ids that are part of * the OAI set of this tombstone. * - * @param $OAISetObjectsIds array assocType => assocId + * @param array $OAISetObjectsIds assocType => assocId */ public function setOAISetObjectsIds($OAISetObjectsIds) { diff --git a/classes/tombstone/DataObjectTombstoneDAO.inc.php b/classes/tombstone/DataObjectTombstoneDAO.inc.php index 26324df5a48..fcca0fe0778 100755 --- a/classes/tombstone/DataObjectTombstoneDAO.inc.php +++ b/classes/tombstone/DataObjectTombstoneDAO.inc.php @@ -34,9 +34,9 @@ public function newDataObject() /** * Retrieve DataObjectTombstone by id. * - * @param $tombstoneId int - * @param $assocType int - * @param $assocId int + * @param int $tombstoneId + * @param int $assocType + * @param int $assocId * * @return DataObjectTombstone object */ @@ -58,7 +58,7 @@ public function getById($tombstoneId, $assocType = null, $assocId = null) /** * Retrieve DataObjectTombstone by data object id. * - * @param $dataObjectId int + * @param int $dataObjectId * * @return DataObjectTombstone object */ @@ -75,7 +75,7 @@ public function getByDataObjectId($dataObjectId) /** * Creates and returns a data object tombstone object from a row. * - * @param $row array + * @param array $row * * @return DataObjectTombstone object */ @@ -98,11 +98,11 @@ public function _fromRow($row) /** * Delete DataObjectTombstone by tombstone id. * - * @param $tombstoneId int - * @param $assocType int - * @param $assocId int + * @param int $tombstoneId + * @param int $assocType + * @param int $assocId * - * @return boolean + * @return bool */ public function deleteById($tombstoneId, $assocType = null, $assocId = null) { @@ -130,7 +130,7 @@ public function deleteById($tombstoneId, $assocType = null, $assocId = null) /** * Delete DataObjectTombstone by data object id. * - * @param $dataObjectId int + * @param int $dataObjectId */ public function deleteByDataObjectId($dataObjectId) { @@ -143,7 +143,7 @@ public function deleteByDataObjectId($dataObjectId) /** * Inserts a new data object tombstone into data_object_tombstone table. * - * @param $dataObjectTombstone DataObjectTombstone + * @param DataObjectTombstone $dataObjectTombstone * * @return int Data object tombstone id. */ @@ -174,7 +174,7 @@ public function insertObject(&$dataObjectTombstone) /** * Update a data object tombstone in the data_object_tombstones table. * - * @param $dataObjectTombstone DataObjectTombstone + * @param DataObjectTombstone $dataObjectTombstone * * @return int dataObjectTombstone id */ @@ -219,8 +219,8 @@ public function getInsertId() * Retrieve all sets for data object tombstones that are inside of * the passed set object id. * - * @param $assocType int The assoc type of the parent set object. - * @param $assocId int The id of the parent set object. + * @param int $assocType The assoc type of the parent set object. + * @param int $assocId The id of the parent set object. * * @return array('setSpec' => setName) */ @@ -244,7 +244,7 @@ public function &getSets($assocType, $assocId) * Get all objects ids that are part of the passed * tombstone OAI set. * - * @param $tombstoneId int + * @param int $tombstoneId * * @return array assocType => assocId */ @@ -265,7 +265,7 @@ public function getOAISetObjectsIds($tombstoneId) /** * Delete OAI set objects data from data_object_tombstone_oai_set_objects table. * - * @param $tombstoneId int The related tombstone id. + * @param int $tombstoneId The related tombstone id. */ public function deleteOAISetObjects($tombstoneId) { @@ -278,7 +278,7 @@ public function deleteOAISetObjects($tombstoneId) /** * Insert OAI set objects data into data_object_tombstone_oai_set_objects table. * - * @param $dataObjectTombstone DataObjectTombstone + * @param DataObjectTombstone $dataObjectTombstone */ public function insertOAISetObjects($dataObjectTombstone) { @@ -300,9 +300,9 @@ public function insertOAISetObjects($dataObjectTombstone) /** * Update OAI set objects data into data_object_tombstone_oai_set_objects table. * - * @param $dataObjectTombstone DataObjectTombstone + * @param DataObjectTombstone $dataObjectTombstone * - * @return boolean + * @return bool */ public function updateOAISetObjects($dataObjectTombstone) { diff --git a/classes/tombstone/DataObjectTombstoneSettingsDAO.inc.php b/classes/tombstone/DataObjectTombstoneSettingsDAO.inc.php index 6ca1cd232df..a0fbdd3a6ea 100755 --- a/classes/tombstone/DataObjectTombstoneSettingsDAO.inc.php +++ b/classes/tombstone/DataObjectTombstoneSettingsDAO.inc.php @@ -20,9 +20,9 @@ class DataObjectTombstoneSettingsDAO extends \PKP\db\DAO /** * Retrieve an submission tombstone setting value. * - * @param $tombstoneId int - * @param $name - * @param $locale string optional + * @param int $tombstoneId + * @param string $name + * @param string $locale optional */ public function getSetting($tombstoneId, $name, $locale = null) { @@ -51,11 +51,10 @@ public function getSetting($tombstoneId, $name, $locale = null) /** * Add/update an submission tombstone setting. * - * @param $tombstoneId int - * @param $name string - * @param $value mixed - * @param $type string data type of the setting. If omitted, type will be guessed - * @param $isLocalized boolean + * @param int $tombstoneId + * @param string $name + * @param string $type data type of the setting. If omitted, type will be guessed + * @param bool $isLocalized */ public function updateSetting($tombstoneId, $name, $value, $type = null, $isLocalized = false) { @@ -96,9 +95,9 @@ public function updateSetting($tombstoneId, $name, $value, $type = null, $isLoca /** * Delete an submission tombstone setting. * - * @param $tombstoneId int - * @param $name string - * @param $locale string optional + * @param int $tombstoneId + * @param string $name + * @param string $locale optional * * @return int Affected row count */ @@ -116,7 +115,7 @@ public function deleteSetting($tombstoneId, $name, $locale = null) /** * Delete all settings for an submission tombstone. * - * @param $tombstoneId int + * @param int $tombstoneId * * @return int Affected row count */ diff --git a/classes/user/Collector.inc.php b/classes/user/Collector.inc.php index c575d81638b..6e5419d55fb 100644 --- a/classes/user/Collector.inc.php +++ b/classes/user/Collector.inc.php @@ -280,6 +280,7 @@ public function assignedToCategoryIds(?array $categoryIds): self /** * Filter by exact match of user settings (the locale is ignored) + * * @param array|null $settings The key must be a valid setting_name while the value will match the setting_value */ public function filterBySettings(?array $settings): self @@ -349,16 +350,16 @@ public function getQueryBuilder(): Builder $query = DB::table('users', 'u') ->select('u.*') // Filters by registration date - ->when($this->registeredBefore !== null, fn(Builder $query) => $query->where('u.date_registered', '<', Carbon::rawParse($this->registeredBefore)->addDay()->toDateString())) - ->when($this->registeredAfter !== null, fn(Builder $query) => $query->where('u.date_registered', '>=', $this->registeredAfter)) + ->when($this->registeredBefore !== null, fn (Builder $query) => $query->where('u.date_registered', '<', Carbon::rawParse($this->registeredBefore)->addDay()->toDateString())) + ->when($this->registeredAfter !== null, fn (Builder $query) => $query->where('u.date_registered', '>=', $this->registeredAfter)) // Filters by user ID - ->when($this->userIds !== null, fn(Builder $query) => $query->whereIn('u.user_id', $this->userIds)) - ->when($this->excludeUserIds !== null, fn(Builder $query) => $query->whereNotIn('u.user_id', $this->excludeUserIds)) + ->when($this->userIds !== null, fn (Builder $query) => $query->whereIn('u.user_id', $this->userIds)) + ->when($this->excludeUserIds !== null, fn (Builder $query) => $query->whereNotIn('u.user_id', $this->excludeUserIds)) // User enabled/disabled state - ->when($this->status !== self::STATUS_ALL, fn(Builder $query) => $query->where('u.disabled', '=', $this->status === self::STATUS_DISABLED)) + ->when($this->status !== self::STATUS_ALL, fn (Builder $query) => $query->where('u.disabled', '=', $this->status === self::STATUS_DISABLED)) // Adds limit and offset for pagination - ->when($this->count !== null, fn(Builder $query) => $query->limit($this->count)) - ->when($this->offset !== null, fn(Builder $query) => $query->offset($this->offset)); + ->when($this->count !== null, fn (Builder $query) => $query->limit($this->count)) + ->when($this->offset !== null, fn (Builder $query) => $query->offset($this->offset)); $this ->buildReviewerStatistics($query) @@ -385,12 +386,12 @@ protected function buildSubmissionAssignmentsFilter(Builder $query): self return $this; } $query->whereExists( - fn(Builder $subQuery) => $subQuery->from('stage_assignments', 'sa') + fn (Builder $query) => $query->from('stage_assignments', 'sa') ->join('user_group_stage AS ugs', 'sa.user_group_id', '=', 'ugs.user_group_id') ->whereColumn('sa.user_id', '=', 'u.user_id') - ->when(isset($this->assignedTo['submissionId']), fn() => $subQuery->where('sa.submission_id', '=', $this->assignedTo['submissionId'])) - ->when(isset($this->assignedTo['stageId']), fn() => $subQuery->where('ugs.stage_id', '=', $this->assignedTo['stageId'])) - ->when(isset($this->assignedTo['userGroupId']), fn() => $subQuery->where('sa.user_group_id', '=', $this->assignedTo['userGroupId'])) + ->when(isset($this->assignedTo['submissionId']), fn ($query) => $query->where('sa.submission_id', '=', $this->assignedTo['submissionId'])) + ->when(isset($this->assignedTo['stageId']), fn ($query) => $query->where('ugs.stage_id', '=', $this->assignedTo['stageId'])) + ->when(isset($this->assignedTo['userGroupId']), fn ($query) => $query->where('sa.user_group_id', '=', $this->assignedTo['userGroupId'])) ); return $this; } @@ -404,17 +405,18 @@ protected function buildUserGroupFilter(Builder $query): self return $this; } $query->whereExists( - fn(Builder $subQuery) => $subQuery->from('user_user_groups', 'uug') + fn (Builder $query) => $query->from('user_user_groups', 'uug') ->join('user_groups AS ug', 'uug.user_group_id', '=', 'ug.user_group_id') ->whereColumn('uug.user_id', '=', 'u.user_id') - ->when($this->userGroupIds !== null, fn() => $subQuery->whereIn('uug.user_group_id', $this->userGroupIds)) + ->when($this->userGroupIds !== null, fn ($query) => $query->whereIn('uug.user_group_id', $this->userGroupIds)) ->when( - $this->workflowStageIds !== null, fn() => $subQuery + $this->workflowStageIds !== null, + fn ($query) => $query ->join('user_group_stage AS ugs', 'ug.user_group_id', '=', 'ugs.user_group_id') ->whereIn('ugs.stage_id', $this->workflowStageIds) ) - ->when($this->roleIds !== null, fn() => $subQuery->whereIn('ug.role_id', $this->roleIds)) - ->when($this->contextIds !== null, fn() => $subQuery->whereIn('ug.context_id', $this->contextIds)) + ->when($this->roleIds !== null, fn ($query) => $query->whereIn('ug.role_id', $this->roleIds)) + ->when($this->contextIds !== null, fn ($query) => $query->whereIn('ug.context_id', $this->contextIds)) ); return $this; } @@ -426,7 +428,7 @@ protected function buildSettingsFilter(Builder $query): self { foreach ($this->settings ?? [] as $name => $value) { $query->whereExists( - fn(Builder $subQuery) => $subQuery->from('user_settings', 'us') + fn (Builder $query) => $query->from('user_settings', 'us') ->whereColumn('us.user_id', '=', 'u.user_id') ->where('us.setting_name', '=', $name) ->where('us.setting_value', '=', $value) @@ -444,11 +446,11 @@ protected function buildExcludedSubmissionStagesFilter(Builder $query): self return $this; } $query->whereExists( - fn(Builder $subQuery) => $subQuery->from('user_user_groups', 'uug') + fn (Builder $query) => $query->from('user_user_groups', 'uug') ->join('user_group_stage AS ugs', 'ugs.user_group_id', '=', 'uug.user_group_id') ->leftJoin( 'stage_assignments AS sa', - fn(JoinClause $join) => $join->on('sa.user_id', '=', 'uug.user_id') + fn (JoinClause $join) => $join->on('sa.user_id', '=', 'uug.user_id') ->on('sa.user_group_id', '=', 'uug.user_group_id') ->where('sa.submission_id', '=', $this->excludeSubmissionStage['submission_id']) ) @@ -466,9 +468,9 @@ protected function buildExcludedSubmissionStagesFilter(Builder $query): self protected function buildSubEditorFilter(Builder $query): self { $subEditorFilters = [Application::ASSOC_TYPE_SECTION => $this->assignedSectionIds, Application::ASSOC_TYPE_CATEGORY => $this->assignedCategoryIds]; - foreach (array_filter($subEditorFilters, fn(?array $assocIds) => !empty($assocIds)) as $assocType => $assocIds) { + foreach (array_filter($subEditorFilters, fn (?array $assocIds) => !empty($assocIds)) as $assocType => $assocIds) { $query->whereExists( - fn(Builder $subQuery) => $subQuery->from('subeditor_submission_group', 'ssg') + fn (Builder $query) => $query->from('subeditor_submission_group', 'ssg') ->whereColumn('ssg.user_id', '=', 'u.user_id') ->where('ssg.assoc_type', '=', $assocType) ->whereIn('ssg.assoc_id', $assocIds) @@ -486,12 +488,12 @@ protected function buildReviewerStatistics(Builder $query): self return $this; } - $dateDiff = fn(string $dateA, string $dateB): string => DB::connection() instanceof MySqlConnection + $dateDiff = fn (string $dateA, string $dateB): string => DB::connection() instanceof MySqlConnection ? "DATEDIFF(${dateA}, ${dateB})" : "DATE_PART('day', ${dateA} - ${dateB})"; $query->leftJoinSub( - fn(Builder $subQuery) => $subQuery->from('review_assignments', 'ra') + fn (Builder $query) => $query->from('review_assignments', 'ra') ->groupBy('ra.reviewer_id') ->select('ra.reviewer_id') ->selectRaw('MAX(ra.date_assigned) AS last_assigned') @@ -501,30 +503,35 @@ protected function buildReviewerStatistics(Builder $query): self ->selectRaw('SUM(ra.cancelled) AS cancelled_count') ->selectRaw('AVG(' . $dateDiff('ra.date_completed', 'ra.date_notified') . ') AS average_time') ->selectRaw('AVG(ra.quality) AS reviewer_rating'), - 'ra_stats', 'u.user_id', '=', 'ra_stats.reviewer_id' + 'ra_stats', + 'u.user_id', + '=', + 'ra_stats.reviewer_id' ) // Select all statistics columns ->addSelect('ra_stats.*') // Reviewer rating - ->when($this->reviewerRating !== null, fn(Builder $query) => $query->where('ra_stats.reviewer_rating', '>=', $this->reviewerRating)) + ->when($this->reviewerRating !== null, fn (Builder $query) => $query->where('ra_stats.reviewer_rating', '>=', $this->reviewerRating)) // Completed reviews - ->when($this->reviewsCompleted !== null, fn(Builder $query) => $query->where('ra_stats.complete_count', '>=', $this->reviewsCompleted)) + ->when($this->reviewsCompleted !== null, fn (Builder $query) => $query->where('ra_stats.complete_count', '>=', $this->reviewsCompleted)) // Minimum active reviews - ->when(($minReviews = $this->reviewsActive[0] ?? null) !== null, fn(Builder $query) => $query->where('ra_stats.incomplete_count', '>=', $minReviews)) + ->when(($minReviews = $this->reviewsActive[0] ?? null) !== null, fn (Builder $query) => $query->where('ra_stats.incomplete_count', '>=', $minReviews)) // Maximum active reviews - ->when(($maxReviews = $this->reviewsActive[1] ?? null) !== null, fn(Builder $query) => $query->where('ra_stats.incomplete_count', '<=', $maxReviews)) + ->when(($maxReviews = $this->reviewsActive[1] ?? null) !== null, fn (Builder $query) => $query->where('ra_stats.incomplete_count', '<=', $maxReviews)) // Minimum days since last review assignment ->when( - ($minDays = $this->daysSinceLastAssignment[0] ?? null) !== null, fn(Builder $query) => $query + ($minDays = $this->daysSinceLastAssignment[0] ?? null) !== null, + fn (Builder $query) => $query ->where('ra_stats.last_assigned', '<=', Carbon::now()->subDays($minDays)->toDateString()) ) // Maximum days since last review assignment ->when( - ($maxDays = $this->daysSinceLastAssignment[1] ?? null) !== null, fn(Builder $query) => $query + ($maxDays = $this->daysSinceLastAssignment[1] ?? null) !== null, + fn (Builder $query) => $query ->where('ra_stats.last_assigned', '>=', Carbon::now()->subDays($maxDays + 1)->toDateString()) // Add one to include upper bound ) // Average days to complete review - ->when($this->averageCompletion !== null, fn(Builder $query) => $query->where('ra_stats.average_time', '<=', $this->averageCompletion)); + ->when($this->averageCompletion !== null, fn (Builder $query) => $query->where('ra_stats.average_time', '<=', $this->averageCompletion)); return $this; } @@ -540,19 +547,19 @@ protected function buildSearchFilter(Builder $query): self // Settings where the search will be performed $settings = [Identity::IDENTITY_SETTING_GIVENNAME, Identity::IDENTITY_SETTING_FAMILYNAME, 'preferredPublicName', 'affiliation', 'biography', 'orcid']; // Break words by whitespace, trims and escapes "%" and "_" - $words = array_map(fn(string $word) => '%' . addcslashes($word, '%_') . '%', PKPString::regexp_split('/\s+/', $searchPhrase)); + $words = array_map(fn (string $word) => '%' . addcslashes($word, '%_') . '%', PKPString::regexp_split('/\s+/', $searchPhrase)); foreach ($words as $word) { $query->where( - fn() => $query->whereRaw('LOWER(u.username) LIKE LOWER(?)', [$word]) + fn ($query) => $query->whereRaw('LOWER(u.username) LIKE LOWER(?)', [$word]) ->orWhereRaw('LOWER(u.email) LIKE LOWER(?)', [$word]) ->orWhereExists( - fn(Builder $subQuery) => $subQuery->from('user_settings', 'us') + fn (Builder $query) => $query->from('user_settings', 'us') ->whereColumn('us.user_id', '=', 'u.user_id') ->whereIn('us.setting_name', $settings) ->whereRaw('LOWER(us.setting_value) LIKE LOWER(?)', [$word]) ) ->orWhereExists( - fn(Builder $subQuery) => $subQuery->from('user_interests', 'ui') + fn (Builder $query) => $query->from('user_interests', 'ui') ->join('controlled_vocab_entry_settings AS cves', 'ui.controlled_vocab_entry_id', '=', 'cves.controlled_vocab_entry_id') ->whereColumn('ui.user_id', '=', 'u.user_id') ->whereRaw('LOWER(cves.setting_value) LIKE LOWER(?)', [$word]) @@ -584,7 +591,7 @@ protected function buildOrderBy(Builder $query): self $sortedSettings = array_values($this->orderBy === self::ORDERBY_GIVENNAME ? $nameSettings : array_reverse($nameSettings)); $query->orderBy( function (Builder $query) use ($sortedSettings, $locales): void { - $query->fromSub(fn(Builder $query) => $query->from(null)->selectRaw(0), 'placeholder'); + $query->fromSub(fn (Builder $query) => $query->from(null)->selectRaw(0), 'placeholder'); $aliasesBySetting = []; foreach ($sortedSettings as $i => $setting) { $aliases = []; @@ -592,7 +599,7 @@ function (Builder $query) use ($sortedSettings, $locales): void { $aliases[] = $alias = "us_${i}_${j}"; $query->leftJoin( "user_settings AS ${alias}", - fn(JoinClause $join) => $join + fn (JoinClause $join) => $join ->on("${alias}.user_id", '=', 'u.user_id') ->where("${alias}.setting_name", '=', $setting) ->where("${alias}.locale", '=', $locale) @@ -602,7 +609,7 @@ function (Builder $query) use ($sortedSettings, $locales): void { } // Build a possibly long CONCAT(COALESCE(given_localeA, given_localeB, [...]), COALESCE(family_localeA, family_localeB, [...]) $coalescedSettings = array_map( - fn(array $aliases) => 'COALESCE(' . implode(', ', array_map(fn(string $alias) => "${alias}.setting_value", $aliases)) . ", '')", + fn (array $aliases) => 'COALESCE(' . implode(', ', array_map(fn (string $alias) => "${alias}.setting_value", $aliases)) . ", '')", $aliasesBySetting ); $query->selectRaw('CONCAT(' . implode(', ', $coalescedSettings) . ')'); diff --git a/classes/user/DAO.inc.php b/classes/user/DAO.inc.php index 52b490cd8be..308c99b95ff 100644 --- a/classes/user/DAO.inc.php +++ b/classes/user/DAO.inc.php @@ -84,7 +84,7 @@ public function newDataObject() /** * @copydoc EntityDAO::get() * - * @param $allowDisabled boolean If true, allow fetching a disabled user. + * @param bool $allowDisabled If true, allow fetching a disabled user. */ public function get(int $id, $allowDisabled = false): ?User { @@ -135,8 +135,6 @@ public function getIds(Collector $query): Collection /** * Retrieve a user by username. * - * @param $username string - * @param $allowDisabled boolean * * @return User? */ @@ -155,7 +153,6 @@ public function getByUsername(string $username, bool $allowDisabled = false): ?U /** * Retrieve a user by email address. * - * @param $allowDisabled boolean * * @return User? */ @@ -174,8 +171,8 @@ public function getByEmail(string $email, bool $allowDisabled = false): ?User /** * Get the user by the TDL ID (implicit authentication). * - * @param $authstr string - * @param $allowDisabled boolean + * @param string $authstr + * @param bool $allowDisabled * * @return User? */ @@ -191,9 +188,9 @@ public function getUserByAuthStr($authstr, $allowDisabled = true): ?User /** * Retrieve a user by username and (encrypted) password. * - * @param $username string - * @param $password string encrypted password - * @param $allowDisabled boolean + * @param string $username + * @param string $password encrypted password + * @param bool $allowDisabled * * @return User? */ @@ -213,9 +210,8 @@ public function getUserByCredentials($username, $password, $allowDisabled = true /** * @copydoc EntityDAO::fromRow * - * @param $includeReviewerData boolean */ - public function fromRow(\stdClass $row, bool $includeReviewerData = false): DataObject + public function fromRow(object $row, bool $includeReviewerData = false): DataObject { $user = parent::fromRow($row); if ($includeReviewerData) { @@ -261,8 +257,8 @@ public function delete(User $user) /** * Update user names when the site primary locale changes. * - * @param $oldLocale string - * @param $newLocale string + * @param string $oldLocale + * @param string $newLocale */ public function changeSitePrimaryLocale($oldLocale, $newLocale) { diff --git a/classes/user/InterestDAO.inc.php b/classes/user/InterestDAO.inc.php index 08b7a866ffc..06ce97aabd0 100644 --- a/classes/user/InterestDAO.inc.php +++ b/classes/user/InterestDAO.inc.php @@ -37,7 +37,7 @@ public function build() /** * Get a list of controlled vocabulary entry IDs (corresponding to interest keywords) attributed to a user * - * @param $userId int + * @param int $userId * * @return array */ @@ -82,7 +82,7 @@ public function getUserIdsByInterest($interest) /** * Get all user's interests * - * @param $filter string (optional) + * @param string $filter (optional) * * @return object */ @@ -105,8 +105,8 @@ public function getAllInterests($filter = null) /** * Update a user's set of interests * - * @param $interests array - * @param $userId int + * @param array $interests + * @param int $userId */ public function setUserInterests($interests, $userId) { diff --git a/classes/user/InterestEntry.inc.php b/classes/user/InterestEntry.inc.php index 094e2f48da8..18d449ca5f2 100644 --- a/classes/user/InterestEntry.inc.php +++ b/classes/user/InterestEntry.inc.php @@ -36,7 +36,7 @@ public function getInterest() /** * Set the interest text * - * @param interest + * @param string $interest */ public function setInterest($interest) { diff --git a/classes/user/InterestEntryDAO.inc.php b/classes/user/InterestEntryDAO.inc.php index 0aae739d38c..469e1489b3a 100644 --- a/classes/user/InterestEntryDAO.inc.php +++ b/classes/user/InterestEntryDAO.inc.php @@ -46,9 +46,9 @@ public function getAdditionalFieldNames() * Retrieve an iterator of controlled vocabulary entries matching a * particular controlled vocabulary ID. * - * @param $controlledVocabId int - * @param $rangeInfo RangeInfo optional range information for result - * @param $filter string Optional filter to match to beginnings of results + * @param int $controlledVocabId + * @param RangeInfo $rangeInfo optional range information for result + * @param string $filter Optional filter to match to beginnings of results * * @return object DAOResultFactory containing matching CVE objects */ @@ -79,7 +79,7 @@ public function getByControlledVocabId($controlledVocabId, $rangeInfo = null, $f /** * Retrieve controlled vocab entries matching a list of vocab entry IDs * - * @param $entryIds array + * @param array $entryIds * * @return DAOResultFactory */ diff --git a/classes/user/InterestManager.inc.php b/classes/user/InterestManager.inc.php index 417d31fbcbc..ffa33bfc0ce 100644 --- a/classes/user/InterestManager.inc.php +++ b/classes/user/InterestManager.inc.php @@ -30,7 +30,7 @@ public function __construct() /** * Get all interests for all users in the system * - * @param $filter string + * @param string $filter * * @return array */ @@ -50,7 +50,7 @@ public function getAllInterests($filter = null) /** * Get user reviewing interests. (Cached in memory for batch fetches.) * - * @param $user User + * @param User $user * * @return array */ @@ -80,7 +80,7 @@ public function getInterestsForUser($user) /** * Returns a comma separated string of a user's interests * - * @param $user User + * @param User $user * * @return string */ @@ -94,8 +94,7 @@ public function getInterestsString($user) /** * Set a user's interests * - * @param $user User - * @param $interests mixed + * @param User $user */ public function setInterestsForUser($user, $interests) { diff --git a/classes/user/Repository.inc.php b/classes/user/Repository.inc.php index d45d2eb5b84..c7c6d97b762 100644 --- a/classes/user/Repository.inc.php +++ b/classes/user/Repository.inc.php @@ -17,7 +17,6 @@ use APP\facades\Repo; use APP\i18n\AppLocale; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\App; use Illuminate\Support\LazyCollection; use PKP\db\DAORegistry; use PKP\plugins\HookRegistry; @@ -90,7 +89,7 @@ public function getByEmail(string $email, bool $allowDisabled = false): ?User /** @copydoc DAO::getCollector() */ public function getCollector(): Collector { - return App::make(Collector::class); + return app(Collector::class); } /** @@ -140,9 +139,9 @@ public function delete(User $user) /** * Can the current user view and edit the gossip field for a user * - * @param $userId int The user who's gossip field should be accessed + * @param int $userId The user who's gossip field should be accessed * - * @return boolean + * @return bool */ public function canCurrentUserGossip($userId) { @@ -187,7 +186,7 @@ public function canCurrentUserGossip($userId) * @param array $userAccessibleStages User's assignments to the workflow stages. ASSOC_TYPE_ACCESSIBLE_WORKFLOW_STAGES * @param array $userRoles User's roles in the context * - * @return Boolean + * @return bool */ public function canUserAccessStage($stageId, $workflowType, $userAccessibleStages, $userRoles) { @@ -290,8 +289,8 @@ public function getRolesOverview(Collector $collector) /** * Merge user accounts and delete the old user account. * - * @param $oldUserId int The user ID to remove - * @param $newUserId int The user ID to receive all "assets" (i.e. submissions) from old user + * @param int $oldUserId The user ID to remove + * @param int $newUserId The user ID to receive all "assets" (i.e. submissions) from old user */ public function mergeUsers($oldUserId, $newUserId) { @@ -302,14 +301,14 @@ public function mergeUsers($oldUserId, $newUserId) HookRegistry::call('UserAction::mergeUsers', [&$oldUserId, &$newUserId]); - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterByUploaderUserIds([$oldUserId]) ->includeDependentFiles(); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); foreach ($submissionFilesIterator as $submissionFile) { - Repo::submissionFiles()->edit($submissionFile, ['uploaderUserId' => $newUserId]); + Repo::submissionFile()->edit($submissionFile, ['uploaderUserId' => $newUserId]); } $noteDao = DAORegistry::getDAO('NoteDAO'); /** @var NoteDAO $noteDao */ @@ -319,8 +318,7 @@ public function mergeUsers($oldUserId, $newUserId) $noteDao->updateObject($note); } - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $editDecisionDao->transferEditorDecisions($oldUserId, $newUserId); + Repo::decision()->dao->reassignDecisions($oldUserId, $newUserId); $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /** @var ReviewAssignmentDAO $reviewAssignmentDao */ foreach ($reviewAssignmentDao->getByUserId($oldUserId) as $reviewAssignment) { diff --git a/classes/user/User.inc.php b/classes/user/User.inc.php index a997cd397d1..7a9faa2edae 100644 --- a/classes/user/User.inc.php +++ b/classes/user/User.inc.php @@ -46,7 +46,7 @@ public function getUsername() /** * Set username. * - * @param $username string + * @param string $username */ public function setUsername($username) { @@ -56,7 +56,7 @@ public function setUsername($username) /** * Get implicit auth ID string. * - * @return String + * @return string */ public function getAuthStr() { @@ -66,7 +66,7 @@ public function getAuthStr() /** * Set Shib ID string for this user. * - * @param $authStr string + * @param string $authStr */ public function setAuthStr($authStr) { @@ -84,7 +84,7 @@ public function getLocalizedSignature() /** * Get email signature. * - * @param $locale string + * @param string $locale * * @return string */ @@ -96,8 +96,8 @@ public function getSignature($locale) /** * Set signature. * - * @param $signature string - * @param $locale string + * @param string $signature + * @param string $locale */ public function setSignature($signature, $locale) { @@ -117,7 +117,7 @@ public function getPassword() /** * Set password (assumed to be already encrypted). * - * @param $password string + * @param string $password */ public function setPassword($password) { @@ -137,7 +137,7 @@ public function getPhone() /** * Set phone number. * - * @param $phone string + * @param string $phone */ public function setPhone($phone) { @@ -157,7 +157,7 @@ public function getMailingAddress() /** * Set mailing address. * - * @param $mailingAddress string + * @param string $mailingAddress */ public function setMailingAddress($mailingAddress) { @@ -177,7 +177,7 @@ public function getBillingAddress() /** * Set billing address. * - * @param $billingAddress string + * @param string $billingAddress */ public function setBillingAddress($billingAddress) { @@ -208,7 +208,7 @@ public function getGossip() /** * Set user gossip. * - * @param $gossip string + * @param string $gossip */ public function setGossip($gossip) { @@ -229,7 +229,7 @@ public function getLocales() /** * Set user's working languages. * - * @param $locales array + * @param array $locales */ public function setLocales($locales) { @@ -249,7 +249,7 @@ public function getDateLastEmail() /** * Set date user last sent an email. * - * @param $dateLastEmail datestamp (YYYY-MM-DD HH:MM:SS) + * @param datestamp $dateLastEmail (YYYY-MM-DD HH:MM:SS) */ public function setDateLastEmail($dateLastEmail) { @@ -269,7 +269,7 @@ public function getDateRegistered() /** * Set date user registered with the site. * - * @param $dateRegistered datestamp (YYYY-MM-DD HH:MM:SS) + * @param datestamp $dateRegistered (YYYY-MM-DD HH:MM:SS) */ public function setDateRegistered($dateRegistered) { @@ -289,7 +289,7 @@ public function getDateValidated() /** * Set date user email was validated with the site. * - * @param $dateValidated datestamp (YYYY-MM-DD HH:MM:SS) + * @param datestamp $dateValidated (YYYY-MM-DD HH:MM:SS) */ public function setDateValidated($dateValidated) { @@ -309,7 +309,7 @@ public function getDateLastLogin() /** * Set date user last logged in to the site. * - * @param $dateLastLogin datestamp + * @param datestamp $dateLastLogin */ public function setDateLastLogin($dateLastLogin) { @@ -319,7 +319,7 @@ public function setDateLastLogin($dateLastLogin) /** * Check if user must change their password on their next login. * - * @return boolean + * @return bool */ public function getMustChangePassword() { @@ -329,7 +329,7 @@ public function getMustChangePassword() /** * Set whether or not user must change their password on their next login. * - * @param $mustChangePassword boolean + * @param bool $mustChangePassword */ public function setMustChangePassword($mustChangePassword) { @@ -339,7 +339,7 @@ public function setMustChangePassword($mustChangePassword) /** * Check if user is disabled. * - * @return boolean + * @return bool */ public function getDisabled() { @@ -349,7 +349,7 @@ public function getDisabled() /** * Set whether or not user is disabled. * - * @param $disabled boolean + * @param bool $disabled */ public function setDisabled($disabled) { @@ -369,7 +369,7 @@ public function getDisabledReason() /** * Set the reason the user is disabled. * - * @param $reasonDisabled string + * @param string $reasonDisabled */ public function setDisabledReason($reasonDisabled) { @@ -389,7 +389,7 @@ public function getAuthId() /** * Set ID of authentication source for this user. * - * @param $authId int + * @param int $authId */ public function setAuthId($authId) { @@ -409,18 +409,21 @@ public function getInlineHelp() /** * Set the inline help display status for this user. * - * @param $inlineHelp int + * @param int $inlineHelp */ public function setInlineHelp($inlineHelp) { $this->setData('inlineHelp', $inlineHelp); } - public function getContactSignature() + public function getContactSignature(?string $locale = null) { + if ($this->getSignature($locale)) { + return $this->getSignature($locale); + } $signature = htmlspecialchars($this->getFullName()); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_USER); - if ($a = $this->getLocalizedAffiliation()) { + if ($a = $this->$this->getLocalizedData('affiliation', $locale)) { $signature .= '
' . htmlspecialchars($a); } if ($p = $this->getPhone()) { diff --git a/classes/user/UserStageAssignmentDAO.inc.php b/classes/user/UserStageAssignmentDAO.inc.php index 9cf98674b61..8ec405d57cd 100644 --- a/classes/user/UserStageAssignmentDAO.inc.php +++ b/classes/user/UserStageAssignmentDAO.inc.php @@ -25,7 +25,7 @@ class UserStageAssignmentDAO extends DAO /** * Delete a stage assignment by Id. * - * @param $assignmentId + * @param int $assignmentId * * @return bool */ @@ -37,10 +37,10 @@ public function deleteAssignment($assignmentId) /** * Retrieve a set of users of a user group not assigned to a given submission stage and matching the specified settings. * - * @param $submissionId int - * @param $stageId int - * @param $userGroupId int - * @param $name string|null Partial string match with user name + * @param int $submissionId + * @param int $stageId + * @param int $userGroupId + * @param string|null $name Partial string match with user name * @param null|mixed $rangeInfo * * @return object DAOResultFactory diff --git a/classes/user/form/APIProfileForm.inc.php b/classes/user/form/APIProfileForm.inc.php index 96a3d7e3527..fafd9a7f5f4 100644 --- a/classes/user/form/APIProfileForm.inc.php +++ b/classes/user/form/APIProfileForm.inc.php @@ -29,7 +29,7 @@ class APIProfileForm extends BaseProfileForm /** * Constructor. * - * @param $user User + * @param User $user */ public function __construct($user) { diff --git a/classes/user/form/BaseProfileForm.inc.php b/classes/user/form/BaseProfileForm.inc.php index 67ffec549a2..3813c60661a 100644 --- a/classes/user/form/BaseProfileForm.inc.php +++ b/classes/user/form/BaseProfileForm.inc.php @@ -29,8 +29,8 @@ abstract class BaseProfileForm extends Form /** * Constructor. * - * @param $template string - * @param $user User + * @param string $template + * @param User $user */ public function __construct($template, $user) { diff --git a/classes/user/form/ContactForm.inc.php b/classes/user/form/ContactForm.inc.php index 0cf81b85c75..76d814003a2 100644 --- a/classes/user/form/ContactForm.inc.php +++ b/classes/user/form/ContactForm.inc.php @@ -28,7 +28,7 @@ class ContactForm extends BaseProfileForm /** * Constructor. * - * @param $user User + * @param User $user */ public function __construct($user) { diff --git a/classes/user/form/IdentityForm.inc.php b/classes/user/form/IdentityForm.inc.php index af8589224ee..c7131d24e60 100644 --- a/classes/user/form/IdentityForm.inc.php +++ b/classes/user/form/IdentityForm.inc.php @@ -24,7 +24,7 @@ class IdentityForm extends BaseProfileForm /** * Constructor. * - * @param $user User + * @param User $user */ public function __construct($user) { diff --git a/classes/user/form/LoginChangePasswordForm.inc.php b/classes/user/form/LoginChangePasswordForm.inc.php index 3c4b01689df..ee1bcc69782 100644 --- a/classes/user/form/LoginChangePasswordForm.inc.php +++ b/classes/user/form/LoginChangePasswordForm.inc.php @@ -70,7 +70,7 @@ public function readInputData() /** * @copydoc Form::execute() * - * @return boolean success + * @return bool success */ public function execute(...$functionArgs) { diff --git a/classes/user/form/PublicProfileForm.inc.php b/classes/user/form/PublicProfileForm.inc.php index 6a9bb04e5f5..364927f3a6a 100644 --- a/classes/user/form/PublicProfileForm.inc.php +++ b/classes/user/form/PublicProfileForm.inc.php @@ -29,7 +29,7 @@ class PublicProfileForm extends BaseProfileForm /** * Constructor. * - * @param $user User + * @param User $user */ public function __construct($user) { @@ -71,7 +71,7 @@ public function readInputData() /** * Upload a profile image. * - * @return boolean True iff success. + * @return bool True iff success. */ public function uploadProfileImage() { @@ -117,7 +117,7 @@ public function uploadProfileImage() /** * Delete a profile image. * - * @return boolean True iff success. + * @return bool True iff success. */ public function deleteProfileImage() { diff --git a/classes/user/form/RegistrationForm.inc.php b/classes/user/form/RegistrationForm.inc.php index b821f1cba76..301c71b35df 100644 --- a/classes/user/form/RegistrationForm.inc.php +++ b/classes/user/form/RegistrationForm.inc.php @@ -39,13 +39,13 @@ class RegistrationForm extends Form /** @var User The user object being created (available to hooks during registrationform::execute hook) */ public $user; - /** @var boolean user is already registered with another context */ + /** @var bool user is already registered with another context */ public $existingUser; /** @var AuthPlugin default authentication source, if specified */ public $defaultAuth; - /** @var boolean whether or not captcha is enabled for this form */ + /** @var bool whether or not captcha is enabled for this form */ public $captchaEnabled; /** diff --git a/classes/user/form/RolesForm.inc.php b/classes/user/form/RolesForm.inc.php index ee23c13af00..4ffd7ad7141 100644 --- a/classes/user/form/RolesForm.inc.php +++ b/classes/user/form/RolesForm.inc.php @@ -27,7 +27,7 @@ class RolesForm extends BaseProfileForm /** * Constructor. * - * @param $user User + * @param User $user */ public function __construct($user) { diff --git a/classes/user/form/UserFormHelper.inc.php b/classes/user/form/UserFormHelper.inc.php index 68ae8311c2c..f14af31a8d8 100644 --- a/classes/user/form/UserFormHelper.inc.php +++ b/classes/user/form/UserFormHelper.inc.php @@ -32,8 +32,8 @@ public function __construct() /** * Assign role selection content to the template manager. * - * @param $templateMgr PKPTemplateManager - * @param $request PKPRequest + * @param PKPTemplateManager $templateMgr + * @param PKPRequest $request */ public function assignRoleContent($templateMgr, $request) { @@ -73,8 +73,8 @@ public function assignRoleContent($templateMgr, $request) /** * Save role elements of an executed user form. * - * @param $form Form The form from which to fetch elements - * @param $user User The current user + * @param Form $form The form from which to fetch elements + * @param User $user The current user */ public function saveRoleContent($form, $user) { diff --git a/classes/validation/Validator.inc.php b/classes/validation/Validator.inc.php index 35e793b4941..69e478bb4f5 100644 --- a/classes/validation/Validator.inc.php +++ b/classes/validation/Validator.inc.php @@ -27,9 +27,9 @@ abstract class Validator /** * Check whether the given value is valid. * - * @param $value mixed the value to be checked + * @param mixed $value the value to be checked * - * @return boolean + * @return bool */ abstract public function isValid($value); } diff --git a/classes/validation/ValidatorControlledVocab.inc.php b/classes/validation/ValidatorControlledVocab.inc.php index f5f7c647d26..1ffac574918 100644 --- a/classes/validation/ValidatorControlledVocab.inc.php +++ b/classes/validation/ValidatorControlledVocab.inc.php @@ -26,9 +26,9 @@ class ValidatorControlledVocab extends Validator /** * Constructor. * - * @param $symbolic string - * @param $assocType int - * @param $assocId int + * @param string $symbolic + * @param int $assocType + * @param int $assocId */ public function __construct($symbolic, $assocType, $assocId) { @@ -49,9 +49,7 @@ public function __construct($symbolic, $assocType, $assocId) * @see Validator::isValid() * Value is valid if it is empty and optional or is in the set of accepted values. * - * @param $value mixed - * - * @return boolean + * @return bool */ public function isValid($value) { diff --git a/classes/validation/ValidatorFactory.inc.php b/classes/validation/ValidatorFactory.inc.php index c5134cb4d36..c51ac6533f4 100644 --- a/classes/validation/ValidatorFactory.inc.php +++ b/classes/validation/ValidatorFactory.inc.php @@ -21,6 +21,7 @@ use Illuminate\Translation\Translator; use Illuminate\Validation\Factory; +use Illuminate\Validation\Validator; use PKP\file\TemporaryFileManager; use Sokil\IsoCodes\IsoCodesFactory; @@ -34,13 +35,11 @@ class ValidatorFactory * necessary dependencies and instantiates Laravel's validation factory, then * calls the `make` method on that factory. * - * @param $props array The properties to validate - * @param $rules array The validation rules - * @param $messages array Error messages - * - * @return Illuminate\Validation\Validator + * @param array $props The properties to validate + * @param array $rules The validation rules + * @param array $messages Error messages */ - public static function make($props, $rules, $messages = []) + public static function make(array $props, array $rules, ?array $messages = []): Validator { // This configures a non-existent translation file, but it is necessary to @@ -145,7 +144,7 @@ public static function make($props, $rules, $messages = []) * Compile translated error messages for each of the validation rules * we support. * - * @param $messages array List of error messages to override the defaults. + * @param array $messages List of error messages to override the defaults. * * @return array */ @@ -203,6 +202,7 @@ public static function getMessages($messages = []) ], 'not_in' => __('validator.not_in'), 'numeric' => __('validator.numeric'), + 'orcid' => __('user.orcid.orcidInvalid'), 'present' => __('validator.present'), 'regex' => __('validator.regex'), 'required' => __('validator.required'), @@ -247,7 +247,7 @@ public static function getMessages($messages = []) * Convert variables in translated strings from {$variable} syntax to * Laravel's :variable syntax * - * @param $message string + * @param string $message * * @return string */ @@ -268,12 +268,12 @@ public static function convertMessageSyntax($message) * Required props that are also multilingual will only be required in the * primary locale. * - * @param $validator Illuminate\Validation\Validator - * @param $object DataObject The object being validated or null if adding an object - * @param $requiredProps array List of prop names - * @param $multilingualProps array List of prop names - * @param $allowedLocales array List of locale codes - * @param $primaryLocale string Primary locale code + * @param Illuminate\Validation\Validator $validator + * @param DataObject $object The object being validated or null if adding an object + * @param array $requiredProps List of prop names + * @param array $multilingualProps List of prop names + * @param array $allowedLocales List of locale codes + * @param string $primaryLocale Primary locale code */ public static function required($validator, $object, $requiredProps, $multilingualProps, $allowedLocales, $primaryLocale) { @@ -319,7 +319,7 @@ public static function required($validator, $object, $requiredProps, $multilingu /** * Checks whether the given value is an empty string * - * @param $value string + * @param string $value */ private static function isEmpty($value) { @@ -332,9 +332,9 @@ private static function isEmpty($value) * A wrapper method that calls $validator->after to check for data from * locales that are not allowed * - * @param $validator Illuminate\Validation\Validator - * @param $multilingualProps array List of prop names - * @param $allowedLocales array List of locale codes + * @param Illuminate\Validation\Validator $validator + * @param array $multilingualProps List of prop names + * @param array $allowedLocales List of locale codes */ public static function allowedLocales($validator, $multilingualProps, $allowedLocales) { @@ -362,14 +362,14 @@ public static function allowedLocales($validator, $multilingualProps, $allowedLo * A wrapper method that validates the temporaryFileId of new file uploads * when an object is edited * - * @param $validator Illuminate\Validation\Validator - * @param $uploadProps array List of prop names that may include a + * @param Illuminate\Validation\Validator $validator + * @param array $uploadProps List of prop names that may include a * a temporaryFileId - * @param $multilingualUploadProps array List of $uploadProps which are + * @param array $multilingualUploadProps List of $uploadProps which are * multiligual - * @param $props array Key/value list of props - * @param $allowedLocales array List of locale codes - * @param $userId int The user ID which owns the temporary files + * @param array $props Key/value list of props + * @param array $allowedLocales List of locale codes + * @param int $userId The user ID which owns the temporary files */ public static function temporaryFilesExist($validator, $uploadProps, $multilingualUploadProps, $props, $allowedLocales, $userId) { diff --git a/classes/validation/ValidatorRegExp.inc.php b/classes/validation/ValidatorRegExp.inc.php index c7e58a1f300..cb9f7a1b24d 100644 --- a/classes/validation/ValidatorRegExp.inc.php +++ b/classes/validation/ValidatorRegExp.inc.php @@ -17,13 +17,13 @@ class ValidatorRegExp extends Validator { - /** @var The regular expression to match against the field value */ + /** @var string The regular expression to match against the field value */ public $_regExp; /** * Constructor. * - * @param $regExp string the regular expression (PCRE form) + * @param string $regExp the regular expression (PCRE form) */ public function __construct($regExp) { diff --git a/classes/validation/ValidatorTypeDescription.inc.php b/classes/validation/ValidatorTypeDescription.inc.php index 1733a7104eb..19db46567af 100644 --- a/classes/validation/ValidatorTypeDescription.inc.php +++ b/classes/validation/ValidatorTypeDescription.inc.php @@ -30,7 +30,7 @@ class ValidatorTypeDescription extends PrimitiveTypeDescription /** * Constructor * - * @param $typeName string Allowed primitive types are + * @param string $typeName Allowed primitive types are * 'integer', 'string', 'float' and 'boolean'. */ public function __construct($typeName) diff --git a/classes/views/ViewsDAO.inc.php b/classes/views/ViewsDAO.inc.php index 59ee0e1c70d..632028f854e 100644 --- a/classes/views/ViewsDAO.inc.php +++ b/classes/views/ViewsDAO.inc.php @@ -20,9 +20,9 @@ class ViewsDAO extends \PKP\db\DAO /** * Mark an item as viewed. * - * @param $assocType integer The associated type for the item being marked. - * @param $assocId string The id of the object being marked. - * @param $userId integer The id of the user viewing the item. + * @param int $assocType The associated type for the item being marked. + * @param string $assocId The id of the object being marked. + * @param int $userId The id of the user viewing the item. * * @return int RECORD_VIEW_RESULT_... */ @@ -43,9 +43,9 @@ public function recordView($assocType, $assocId, $userId) /** * Get the timestamp of the last view. * - * @param $assocType integer - * @param $assocId string - * @param $userId integer + * @param int $assocType + * @param string $assocId + * @param int $userId * * @return string|boolean Datetime of last view. False if no view found. */ @@ -70,9 +70,9 @@ public function getLastViewDate($assocType, $assocId, $userId = null) /** * Move views from one assoc object to another. * - * @param $assocType integer One of the ASSOC_TYPE_* constants. - * @param $oldAssocId string - * @param $newAssocId string + * @param int $assocType One of the ASSOC_TYPE_* constants. + * @param string $oldAssocId + * @param string $newAssocId */ public function moveViews($assocType, $oldAssocId, $newAssocId) { @@ -85,8 +85,8 @@ public function moveViews($assocType, $oldAssocId, $newAssocId) /** * Delete views of an assoc object. * - * @param $assocType integer One of the ASSOC_TYPE_* constants. - * @param $assocId string + * @param int $assocType One of the ASSOC_TYPE_* constants. + * @param string $assocId */ public function deleteViews($assocType, $assocId) { diff --git a/classes/workflow/PKPEditorDecisionActionsManager.inc.php b/classes/workflow/PKPEditorDecisionActionsManager.inc.php deleted file mode 100644 index d7edb1053e1..00000000000 --- a/classes/workflow/PKPEditorDecisionActionsManager.inc.php +++ /dev/null @@ -1,191 +0,0 @@ -_submissionStageDecisions($submission, $stageId, $makeDecision); - break; - case WORKFLOW_STAGE_ID_EXTERNAL_REVIEW: - $result = $this->_externalReviewStageDecisions($context, $submission, $makeDecision); - break; - case WORKFLOW_STAGE_ID_EDITING: - $result = $this->_editorialStageDecisions($makeDecision); - break; - default: - assert(false); - } - HookRegistry::call( - 'EditorAction::modifyDecisionOptions', - [$context, $submission, $stageId, &$makeDecision, &$result] - ); - return $result; - } - - /** - * Get an associative array matching editor recommendation codes with locale strings. - * (Includes default '' => "Choose One" string.) - * - * @param $stageId integer - * - * @return array recommendation => localeString - */ - public function getRecommendationOptions($stageId) - { - return [ - '' => 'common.chooseOne', - self::SUBMISSION_EDITOR_RECOMMEND_PENDING_REVISIONS => 'editor.submission.decision.requestRevisions', - self::SUBMISSION_EDITOR_RECOMMEND_RESUBMIT => 'editor.submission.decision.resubmit', - self::SUBMISSION_EDITOR_RECOMMEND_ACCEPT => 'editor.submission.decision.accept', - self::SUBMISSION_EDITOR_RECOMMEND_DECLINE => 'editor.submission.decision.decline', - ]; - } - - /** - * Define and return editor decisions for the submission stage. - * If the user cannot make decisions i.e. if it is a recommendOnly user, - * the user can only send the submission to the review stage, and neither - * acept nor decline the submission. - * - * @param $submission Submission - * @param $stageId int WORKFLOW_STAGE_ID_... - * @param $makeDecision boolean If the user can make decisions - * - * @return array - */ - protected function _submissionStageDecisions($submission, $stageId, $makeDecision = true) - { - $decisions = [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW => [ - 'operation' => 'externalReview', - 'name' => 'externalReview', - 'title' => 'editor.submission.decision.sendExternalReview', - 'toStage' => 'editor.review', - ] - ]; - if ($makeDecision) { - if ($stageId == WORKFLOW_STAGE_ID_SUBMISSION) { - $decisions = $decisions + [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT => [ - 'name' => 'accept', - 'operation' => 'promote', - 'title' => 'editor.submission.decision.skipReview', - 'toStage' => 'submission.copyediting', - ], - ]; - } - - if ($submission->getStatus() == PKPSubmission::STATUS_QUEUED) { - $decisions = $decisions + [ - self::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE => [ - 'name' => 'decline', - 'operation' => 'sendReviews', - 'title' => 'editor.submission.decision.decline', - ], - ]; - } - if ($submission->getStatus() == PKPSubmission::STATUS_DECLINED) { - $decisions = $decisions + [ - self::SUBMISSION_EDITOR_DECISION_REVERT_DECLINE => [ - 'name' => 'revert', - 'operation' => 'revertDecline', - 'title' => 'editor.submission.decision.revertDecline', - ], - ]; - } - } - return $decisions; - } - - /** - * Define and return editor decisions for the editorial stage. - * Currently it does not matter if the user cannot make decisions - * i.e. if it is a recommendOnly user for this stage. - * - * @param $makeDecision boolean If the user cannot make decisions - * - * @return array - */ - protected function _editorialStageDecisions($makeDecision = true) - { - return [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION => [ - 'operation' => 'promote', - 'name' => 'sendToProduction', - 'title' => 'editor.submission.decision.sendToProduction', - 'toStage' => 'submission.production', - ], - ]; - } - - /** - * Get the stage-level notification type constants. - * - * @return array - */ - public function getStageNotifications() - { - return [ - PKPNotification::NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_SUBMISSION, - PKPNotification::NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EXTERNAL_REVIEW, - PKPNotification::NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_EDITING, - PKPNotification::NOTIFICATION_TYPE_EDITOR_ASSIGNMENT_PRODUCTION - ]; - } -} - -if (!PKP_STRICT_MODE) { - class_alias('\PKP\workflow\PKPEditorDecisionActionsManager', '\PKPEditorDecisionActionsManager'); - foreach ([ - 'SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE', - 'SUBMISSION_EDITOR_RECOMMEND_ACCEPT', - 'SUBMISSION_EDITOR_RECOMMEND_PENDING_REVISIONS', - 'SUBMISSION_EDITOR_RECOMMEND_RESUBMIT', - 'SUBMISSION_EDITOR_RECOMMEND_DECLINE', - 'SUBMISSION_EDITOR_DECISION_REVERT_DECLINE', - ] as $constantName) { - if (!defined($constantName)) { - define($constantName, constant('\PKPEditorDecisionActionsManager::' . $constantName)); - } - } -} diff --git a/classes/workflow/WorkflowStageDAO.inc.php b/classes/workflow/WorkflowStageDAO.inc.php index c559873a612..1d7e6680e1c 100644 --- a/classes/workflow/WorkflowStageDAO.inc.php +++ b/classes/workflow/WorkflowStageDAO.inc.php @@ -30,7 +30,7 @@ class WorkflowStageDAO extends \PKP\db\DAO /** * Convert a stage id into a stage path * - * @param $stageId integer + * @param int $stageId * * @return string|null */ @@ -52,9 +52,9 @@ public static function getPathFromId($stageId) /** * Convert a stage path into a stage id * - * @param $stagePath string + * @param string $stagePath * - * @return integer|null + * @return int|null */ public static function getIdFromPath($stagePath) { @@ -74,7 +74,7 @@ public static function getIdFromPath($stagePath) /** * Convert a stage id into a stage translation key * - * @param $stageId integer + * @param int $stageId * * @return string|null */ @@ -131,9 +131,9 @@ public static function getWorkflowStageKeysAndPaths() * Returns an array containing data for rendering the stage workflow tabs * for a submission. * - * @param $submission Submission - * @param $stagesWithDecisions array - * @param $stageNotifications array + * @param Submission $submission + * @param array $stagesWithDecisions + * @param array $stageNotifications * * @return array */ diff --git a/classes/xml/PKPXMLParser.inc.php b/classes/xml/PKPXMLParser.inc.php index 682a62bfcb1..7996d51ef06 100644 --- a/classes/xml/PKPXMLParser.inc.php +++ b/classes/xml/PKPXMLParser.inc.php @@ -71,7 +71,7 @@ function parseText($text) { /** * Parse an XML file using the specified handler. * If no handler has been specified, XMLParserDOMHandler is used by default, returning a tree structure representing the document. - * @param $file string full path to the XML file + * @param string $file full path to the XML file * @return object|false actual return type depends on the handler */ function parse($file) { @@ -106,7 +106,7 @@ function parse($file) { /** * Get a PSR7 stream given a filename or URL. - * @param $filenameOrUrl + * @param string $filenameOrUrl * @return \GuzzleHttp\Psr7\Stream|null */ protected function _getStream($filenameOrUrl) { @@ -124,7 +124,7 @@ protected function _getStream($filenameOrUrl) { /** * Add an error to the current error list - * @param $error string + * @param string $error */ function addError($error) { array_push($this->errors, $error); @@ -140,7 +140,7 @@ function getErrors() { /** * Determine whether or not the parser encountered an error (false) * or completed successfully (true) - * @return boolean + * @return bool */ function getStatus() { return empty($this->errors); @@ -148,7 +148,7 @@ function getStatus() { /** * Set the handler to use for parse(...). - * @param $handler XMLParserHandler + * @param XMLParserHandler $handler */ function setHandler($handler) { $this->handler = $handler; @@ -157,9 +157,9 @@ function setHandler($handler) { /** * Parse XML data using xml_parse_into_struct and return data in an array. * This is best suited for XML documents with fairly simple structure. - * @param $text string XML data - * @param $tagsToMatch array optional, if set tags not in the array will be skipped - * @return array? a struct of the form ($TAG => array('attributes' => array( ... ), 'value' => $VALUE), ... ) + * @param string $text XML data + * @param array $tagsToMatch optional, if set tags not in the array will be skipped + * @return array|null a struct of the form ($TAG => array('attributes' => array( ... ), 'value' => $VALUE), ... ) */ function parseTextStruct($text, $tagsToMatch = array()) { $parser = $this->createParser(); @@ -194,9 +194,9 @@ function parseTextStruct($text, $tagsToMatch = array()) { /** * Parse an XML file using xml_parse_into_struct and return data in an array. * This is best suited for XML documents with fairly simple structure. - * @param $file string full path to the XML file - * @param $tagsToMatch array optional, if set tags not in the array will be skipped - * @return array? a struct of the form ($TAG => array('attributes' => array( ... ), 'value' => $VALUE), ... ) + * @param string $file full path to the XML file + * @param array $tagsToMatch optional, if set tags not in the array will be skipped + * @return array|null a struct of the form ($TAG => array('attributes' => array( ... ), 'value' => $VALUE), ... ) */ function parseStruct($file, $tagsToMatch = array()) { $stream = $this->_getStream($file); @@ -220,7 +220,7 @@ function createParser() { /** * Destroy XML parser. - * @param $parser resource + * @param resource $parser */ function destroyParser($parser) { xml_parser_free($parser); diff --git a/classes/xml/XMLNode.inc.php b/classes/xml/XMLNode.inc.php index da5f177ff4b..e9b50484734 100644 --- a/classes/xml/XMLNode.inc.php +++ b/classes/xml/XMLNode.inc.php @@ -35,7 +35,7 @@ class XMLNode { /** * Constructor. - * @param $name element/tag name + * @param string $name element/tag name */ function __construct($name = null) { $this->name = $name; @@ -46,7 +46,7 @@ function __construct($name = null) { } /** - * @param $includeNamespace boolean + * @param bool $includeNamespace * @return string */ function getName($includeNamespace = true) { @@ -58,7 +58,7 @@ function getName($includeNamespace = true) { } /** - * @param $name string + * @param string $name */ function setName($name) { $this->name = $name; @@ -72,7 +72,7 @@ function &getParent() { } /** - * @param $parent XMLNode + * @param XMLNode $parent */ function setParent(&$parent) { $this->parent =& $parent; @@ -86,7 +86,7 @@ function getAttributes() { } /** - * @param $name string attribute name + * @param string $name attribute name * @return string attribute value */ function getAttribute($name) { @@ -94,15 +94,15 @@ function getAttribute($name) { } /** - * @param $name string attribute name - * @param value string attribute value + * @param string $name attribute name + * @param string $value attribute value */ function setAttribute($name, $value) { $this->attributes[$name] = $value; } /** - * @param $attributes array + * @param array $attributes */ function setAttributes($attributes) { $this->attributes = $attributes; @@ -116,7 +116,7 @@ function &getValue() { } /** - * @param $value string + * @param string $value */ function setValue($value) { $this->value =& $value; @@ -130,8 +130,8 @@ function &getChildren() { } /** - * @param $name - * @param $index + * @param string $name + * @param int $index * @return XMLNode the ($index+1)th child matching the specified name */ function &getChildByName($name, $index = 0) { @@ -153,8 +153,8 @@ function &getChildByName($name, $index = 0) { /** * Get the value of a child node. - * @param $name String name of node - * @param $index Optional integer index of child node to find + * @param string $name name of node + * @param int $index Optional index of child node to find */ function &getChildValue($name, $index = 0) { $node =& $this->getChildByName($name); @@ -167,14 +167,14 @@ function &getChildValue($name, $index = 0) { } /** - * @param $node XMLNode the child node to add + * @param XMLNode $node the child node to add */ function addChild(&$node) { $this->children[] =& $node; } /** - * @param $output file handle to write to, or true for stdout, or null if XML to be returned as string + * @param resource $output file handle to write to, or true for stdout, or null if XML to be returned as string * @return string */ function &toXml($output = null) { diff --git a/classes/xml/XMLParserDOMHandler.inc.php b/classes/xml/XMLParserDOMHandler.inc.php index 29c02c9cc32..a711cf6b3ca 100644 --- a/classes/xml/XMLParserDOMHandler.inc.php +++ b/classes/xml/XMLParserDOMHandler.inc.php @@ -28,7 +28,7 @@ class XMLParserDOMHandler extends XMLParserHandler { /** @var XMLNode reference to the node currently being parsed */ var $currentNode; - /** @var reference to the current data */ + /** @var string reference to the current data */ var $currentData; /** @@ -45,9 +45,9 @@ function destroy() { /** * Callback function to act as the start element handler. - * @param $parser PKPXMLParser - * @param $tag string - * @param $attributes array + * @param PKPXMLParser $parser + * @param string $tag + * @param array $attributes */ function startElement($parser, $tag, $attributes) { $this->currentData = null; @@ -67,8 +67,8 @@ function startElement($parser, $tag, $attributes) { /** * Callback function to act as the end element handler. - * @param $parser PKPXMLParser - * @param $tag string + * @param PKPXMLParser $parser + * @param string $tag */ function endElement($parser, $tag) { $this->currentNode->setValue($this->currentData); @@ -78,8 +78,8 @@ function endElement($parser, $tag) { /** * Callback function to act as the character data handler. - * @param $parser PKPXMLParser - * @param $data string + * @param PKPXMLParser $parser + * @param string $data */ function characterData($parser, $data) { $this->currentData .= $data; diff --git a/classes/xml/XMLParserHandler.inc.php b/classes/xml/XMLParserHandler.inc.php index 83fa1796698..39bbe4aa6aa 100644 --- a/classes/xml/XMLParserHandler.inc.php +++ b/classes/xml/XMLParserHandler.inc.php @@ -20,25 +20,25 @@ class XMLParserHandler { /** * Callback function to act as the start element handler. - * @param $parser PKPXMLParser - * @param $tag string - * @param $attributes array + * @param PKPXMLParser $parser + * @param string $tag + * @param array $attributes */ function startElement($parser, $tag, $attributes) { } /** * Callback function to act as the end element handler. - * @param $parser PKPXMLParser - * @param $tag string + * @param PKPXMLParser $parser + * @param string $tag */ function endElement($parser, $tag) { } /** * Callback function to act as the character data handler. - * @param $parser PKPXMLParser - * @param $data string + * @param PKPXMLParser $parser + * @param string $data */ function characterData($parser, $data) { } diff --git a/classes/xslt/XMLTypeDescription.inc.php b/classes/xslt/XMLTypeDescription.inc.php index b88c70dd163..5b384fe4547 100644 --- a/classes/xslt/XMLTypeDescription.inc.php +++ b/classes/xslt/XMLTypeDescription.inc.php @@ -19,8 +19,6 @@ * xml::schema(http://www.crossref.org/schema/queryResultSchema/crossref_query_output2.0.xsd) * * XML input/output can be either represented as a string or as a DOMDocument object. - * - * NB: XML validation currently requires PHP5 */ namespace PKP\xslt; @@ -57,7 +55,7 @@ public function getNamespace() /** * Set the validation strategy * - * @param $validationStrategy string XML_TYPE_DESCRIPTION_VALIDATE_... + * @param string $validationStrategy XML_TYPE_DESCRIPTION_VALIDATE_... */ public function setValidationStrategy($validationStrategy) { diff --git a/classes/xslt/XSLTransformationFilter.inc.php b/classes/xslt/XSLTransformationFilter.inc.php index 7f2da72491c..26433306bb7 100644 --- a/classes/xslt/XSLTransformationFilter.inc.php +++ b/classes/xslt/XSLTransformationFilter.inc.php @@ -24,8 +24,8 @@ class XSLTransformationFilter extends PersistableFilter /** * Constructor * - * @param $filterGroup FilterGroup - * @param $displayName string + * @param FilterGroup $filterGroup + * @param string $displayName * * NB: The input side of the transformation must always * be an XML format. See the XMLTypeDescription class for @@ -65,7 +65,7 @@ public function &getXSL() /** * Get the XSL Type * - * @return integer + * @return int */ public function getXSLType() { @@ -75,7 +75,7 @@ public function getXSLType() /** * Set the XSL * - * @param $xsl DOMDocument|string + * @param DOMDocument|string $xsl */ public function setXSL(&$xsl) { @@ -94,7 +94,7 @@ public function setXSL(&$xsl) /** * Set the XSL as a file name * - * @param $xslFile string + * @param string $xslFile */ public function setXSLFilename($xslFile) { @@ -105,7 +105,7 @@ public function setXSLFilename($xslFile) /** * Get the result type * - * @return integer + * @return int */ public function getResultType() { @@ -115,7 +115,7 @@ public function getResultType() /** * Set the result type * - * @param $resultType integer + * @param int $resultType */ public function setResultType($resultType) { @@ -143,7 +143,7 @@ public function getClassName() * * @see Filter::process() * - * @param $xml DOMDocument|string + * @param DOMDocument|string $xml * * @return DOMDocument|string */ diff --git a/classes/xslt/XSLTransformer.inc.php b/classes/xslt/XSLTransformer.inc.php index 94538eea5fe..0c42bcdafcf 100644 --- a/classes/xslt/XSLTransformer.inc.php +++ b/classes/xslt/XSLTransformer.inc.php @@ -10,7 +10,7 @@ * @class XSLTransformer * @ingroup xslt * - * @brief Wrapper class for running XSL transformations using PHP 4.x or 5.x + * @brief Wrapper class for running XSL transformations. */ namespace PKP\xslt; @@ -43,7 +43,7 @@ class XSLTransformer /** @var array of parameters to pass to XSL (built-in libraries only) */ public $parameters; - /** @var array of PHP functions to allow in XSL (PHP5 built-in only) */ + /** @var array of PHP functions to allow in XSL */ public $registerPHPFunctions; /** @var array List of error strings */ @@ -53,7 +53,7 @@ class XSLTransformer * Constructor. * Initialize transformer and set parser options. * - * @return boolean returns false if no XSLT processor could be created + * @return bool returns false if no XSLT processor could be created */ public function __construct() { @@ -66,7 +66,7 @@ public function __construct() /** * Fetch configuration and check whether XSLT is properly supported. * - * @return boolean True iff XSLT support is present. + * @return bool True iff XSLT support is present. */ public static function checkSupport() { @@ -109,7 +109,7 @@ public static function getProcessor() /** * Set the parameter list for internal processors. * - * @param $parameters array + * @param array $parameters */ public function setParameters($parameters) { @@ -119,7 +119,7 @@ public function setParameters($parameters) /** * Set the registerPHPFunctions setting on or off. * - * @param $flag boolean + * @param bool $flag */ public function setRegisterPHPFunctions($flag) { @@ -131,8 +131,8 @@ public function setRegisterPHPFunctions($flag) /** * Apply an XSLT transform to a given XML and XSL source files * - * @param $xmlFile string absolute pathname to the XML source file - * @param $xslFile string absolute pathname to the XSL stylesheet + * @param string $xmlFile absolute pathname to the XML source file + * @param string $xslFile absolute pathname to the XSL stylesheet * * @return string containing the transformed XML output, or false on error */ @@ -144,8 +144,8 @@ public function transformFiles($xmlFile, $xslFile) /** * Apply an XSLT transform to a given XML and XSL strings * - * @param $xml string containing source XML - * @param $xsl string containing source XSL + * @param string $xml containing source XML + * @param string $xsl containing source XSL * * @return string containing the transformed XML output, or false on error */ @@ -158,11 +158,9 @@ public function transformStrings($xml, $xsl) * Apply an XSLT transform to a given XML and XSL. Both parameters * can be either strings, files or DOM objects. * - * @param $xml mixed - * @param $xmlType integer - * @param $xsl mixed - * @param $xslType integer - * @param $resultType integer self::XSL_TRANSFORMER_DOCTYPE_... + * @param int $xmlType + * @param int $xslType + * @param int $resultType self::XSL_TRANSFORMER_DOCTYPE_... * * @return mixed return type depends on the $resultType parameter and can be * DOMDocument or string. The method returns a boolean value of false if the @@ -205,11 +203,9 @@ public function transform($xml, $xmlType, $xsl, $xslType, $resultType) /** * Use external programs to do the XSL transformation * - * @param $xml mixed - * @param $xmlType integer - * @param $xsl mixed - * @param $xslType integer - * @param $resultType integer self::XSL_TRANSFORMER_DOCTYPE_... + * @param int $xmlType + * @param int $xslType + * @param int $resultType self::XSL_TRANSFORMER_DOCTYPE_... * * @return mixed return type depends on the $resultType parameter and can be * DOMDocument or string. Returns boolean "false" on error. @@ -280,13 +276,11 @@ public function _transformExternal($xml, $xmlType, $xsl, $xslType, $resultType) } /** - * Use PHP5's DOMDocument and XSLTProcessor to do the transformation + * Use DOMDocument and XSLTProcessor to do the transformation * - * @param $xml mixed - * @param $xmlType integer - * @param $xsl mixed - * @param $xslType integer - * @param $resultType integer self::XSL_TRANSFORMER_DOCTYPE_... + * @param int $xmlType + * @param int $xslType + * @param int $resultType self::XSL_TRANSFORMER_DOCTYPE_... * * @return mixed return type depends on the $resultType parameter and can be * DOMDocument or string. Returns boolean "false" on error. @@ -387,7 +381,7 @@ public function _transformPHP($xml, $xmlType, $xsl, $xslType, $resultType) /** * Add an error to the current error list * - * @param $error string + * @param string $error */ public function addError($error) { diff --git a/composer.json b/composer.json index 356063cb6dc..10858866110 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "laravel/framework": "^7.0", "firebase/php-jwt": "5.*", "danielstjules/stringy": "3.*", - "adodb/adodb-php": "dev-v5.20.18-mods-magicport", + "adodb/adodb-php": "v5.20.18", "gettext/gettext": "5.x", "sokil/php-isocodes": "^3.0", "doctrine/dbal": "^2.10", @@ -40,17 +40,14 @@ "php": "7.3.0" } }, - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/asmecher/ADOdb" - } - ], "scripts": { "fix": "./lib/vendor/bin/php-cs-fixer fix --allow-risky=yes" }, "extra": { "patches": { + "adodb/adodb-php": { + "Apply PKP ADODB patches": "lib/adodb.diff" + }, "laravel/framework": { "Inhibit __ Laravel helper": "lib/laravel-helper-4017.diff" } diff --git a/composer.lock b/composer.lock index 4a6c8793e79..df1062f3e92 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "87761f2470935ed2d844209bf724fe48", + "content-hash": "2e89355feb3888cef49f1aa8499db0e0", "packages": [ { "name": "adodb/adodb-php", - "version": "dev-v5.20.18-mods", + "version": "v5.20.18", "source": { "type": "git", - "url": "https://github.com/asmecher/ADOdb.git", - "reference": "e0cae940e09e7661e09bf3f13e225432faf395ac" + "url": "https://github.com/ADOdb/ADOdb.git", + "reference": "0363eca78eed8bd02d1456072c729da302655241" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/asmecher/ADOdb/zipball/f24f521bd46222044c862aa85c4967111ee5810f", - "reference": "228c62019235f0c640b866c37a5aa3c19e6c714d", + "url": "https://api.github.com/repos/ADOdb/ADOdb/zipball/0363eca78eed8bd02d1456072c729da302655241", + "reference": "0363eca78eed8bd02d1456072c729da302655241", "shasum": "" }, "require": { @@ -29,6 +29,7 @@ "adodb.inc.php" ] }, + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause", "LGPL-2.1-or-later" @@ -61,20 +62,20 @@ "issues": "https://github.com/ADOdb/ADOdb/issues", "source": "https://github.com/ADOdb/ADOdb" }, - "time": "2020-08-13T23:24:52+00:00" + "time": "2020-06-28T17:52:20+00:00" }, { "name": "brick/math", - "version": "0.9.2", + "version": "0.9.3", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "dff976c2f3487d42c1db75a3b180e2b9f0e72ce0" + "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/dff976c2f3487d42c1db75a3b180e2b9f0e72ce0", - "reference": "dff976c2f3487d42c1db75a3b180e2b9f0e72ce0", + "url": "https://api.github.com/repos/brick/math/zipball/ca57d18f028f84f777b2168cd1911b0dee2343ae", + "reference": "ca57d18f028f84f777b2168cd1911b0dee2343ae", "shasum": "" }, "require": { @@ -84,7 +85,7 @@ "require-dev": { "php-coveralls/php-coveralls": "^2.2", "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0", - "vimeo/psalm": "4.3.2" + "vimeo/psalm": "4.9.2" }, "type": "library", "autoload": { @@ -109,15 +110,19 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.9.2" + "source": "https://github.com/brick/math/tree/0.9.3" }, "funding": [ + { + "url": "https://github.com/BenMorel", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/brick/math", "type": "tidelift" } ], - "time": "2021-01-20T22:51:39+00:00" + "time": "2021-08-15T20:50:18+00:00" }, { "name": "components/jquery", @@ -711,34 +716,30 @@ }, { "name": "doctrine/inflector", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210" + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/9cf661f4eb38f7c881cac67c75ea9b00bf97b210", - "reference": "9cf661f4eb38f7c881cac67c75ea9b00bf97b210", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^7.0", - "phpstan/phpstan": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "doctrine/coding-standard": "^8.2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" @@ -786,7 +787,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.x" + "source": "https://github.com/doctrine/inflector/tree/2.0.4" }, "funding": [ { @@ -802,36 +803,32 @@ "type": "tidelift" } ], - "time": "2020-05-29T15:13:26+00:00" + "time": "2021-10-22T20:16:43+00:00" }, { "name": "doctrine/lexer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" + "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", + "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" @@ -866,7 +863,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.1" + "source": "https://github.com/doctrine/lexer/tree/1.2.2" }, "funding": [ { @@ -882,7 +879,7 @@ "type": "tidelift" } ], - "time": "2020-05-25T17:44:05+00:00" + "time": "2022-01-12T08:27:12+00:00" }, { "name": "dragonmantank/cron-expression", @@ -1519,16 +1516,16 @@ }, { "name": "laravel/framework", - "version": "v7.30.4", + "version": "v7.30.6", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "9dd38140dc2924daa1a020a3d7a45f9ceff03df3" + "reference": "ecdafad1dda3c790af186a6d18479ea4757ef9ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/9dd38140dc2924daa1a020a3d7a45f9ceff03df3", - "reference": "9dd38140dc2924daa1a020a3d7a45f9ceff03df3", + "url": "https://api.github.com/repos/laravel/framework/zipball/ecdafad1dda3c790af186a6d18479ea4757ef9ee", + "reference": "ecdafad1dda3c790af186a6d18479ea4757ef9ee", "shasum": "" }, "require": { @@ -1677,7 +1674,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-01-21T14:10:48+00:00" + "time": "2021-12-07T14:56:47+00:00" }, { "name": "league/commonmark", @@ -1782,16 +1779,16 @@ }, { "name": "league/flysystem", - "version": "1.1.4", + "version": "1.1.9", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32" + "reference": "094defdb4a7001845300334e7c1ee2335925ef99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3ad69181b8afed2c9edf7be5a2918144ff4ea32", - "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/094defdb4a7001845300334e7c1ee2335925ef99", + "reference": "094defdb4a7001845300334e7c1ee2335925ef99", "shasum": "" }, "require": { @@ -1864,7 +1861,7 @@ ], "support": { "issues": "https://github.com/thephpleague/flysystem/issues", - "source": "https://github.com/thephpleague/flysystem/tree/1.1.4" + "source": "https://github.com/thephpleague/flysystem/tree/1.1.9" }, "funding": [ { @@ -1872,7 +1869,7 @@ "type": "other" } ], - "time": "2021-06-23T21:56:05+00:00" + "time": "2021-12-09T09:40:50+00:00" }, { "name": "league/flysystem-sftp", @@ -1922,16 +1919,16 @@ }, { "name": "league/mime-type-detection", - "version": "1.7.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3" + "reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", - "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/aa70e813a6ad3d1558fc927863d47309b4c23e69", + "reference": "aa70e813a6ad3d1558fc927863d47309b4c23e69", "shasum": "" }, "require": { @@ -1939,7 +1936,7 @@ "php": "^7.2 || ^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.18", + "friendsofphp/php-cs-fixer": "^3.2", "phpstan/phpstan": "^0.12.68", "phpunit/phpunit": "^8.5.8 || ^9.3" }, @@ -1962,7 +1959,7 @@ "description": "Mime-type detection for Flysystem", "support": { "issues": "https://github.com/thephpleague/mime-type-detection/issues", - "source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0" + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.9.0" }, "funding": [ { @@ -1974,7 +1971,7 @@ "type": "tidelift" } ], - "time": "2021-01-18T20:58:21+00:00" + "time": "2021-11-21T11:48:40+00:00" }, { "name": "michelf/php-markdown", @@ -2031,24 +2028,24 @@ }, { "name": "monolog/monolog", - "version": "2.3.1", + "version": "2.3.5", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "9738e495f288eec0b187e310b7cdbbb285777dbe" + "reference": "fd4380d6fc37626e2f799f29d91195040137eba9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/9738e495f288eec0b187e310b7cdbbb285777dbe", - "reference": "9738e495f288eec0b187e310b7cdbbb285777dbe", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9", + "reference": "fd4380d6fc37626e2f799f29d91195040137eba9", "shasum": "" }, "require": { "php": ">=7.2", - "psr/log": "^1.0.1" + "psr/log": "^1.0.1 || ^2.0 || ^3.0" }, "provide": { - "psr/log-implementation": "1.0.0" + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" }, "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", @@ -2056,14 +2053,14 @@ "elasticsearch/elasticsearch": "^7", "graylog2/gelf-php": "^1.4.2", "mongodb/mongodb": "^1.8", - "php-amqplib/php-amqplib": "~2.4", + "php-amqplib/php-amqplib": "~2.4 || ^3", "php-console/php-console": "^3.1.3", "phpspec/prophecy": "^1.6.1", "phpstan/phpstan": "^0.12.91", "phpunit/phpunit": "^8.5", "predis/predis": "^1.1", "rollbar/rollbar": "^1.3", - "ruflin/elastica": ">=0.90 <7.0.1", + "ruflin/elastica": ">=0.90@dev", "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { @@ -2071,8 +2068,11 @@ "doctrine/couchdb": "Allow sending log messages to a CouchDB server", "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", "ext-mbstring": "Allow to work properly with unicode symbols", "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", @@ -2111,7 +2111,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.3.1" + "source": "https://github.com/Seldaek/monolog/tree/2.3.5" }, "funding": [ { @@ -2123,7 +2123,7 @@ "type": "tidelift" } ], - "time": "2021-07-14T11:56:39+00:00" + "time": "2021-10-01T21:08:31+00:00" }, { "name": "moxiecode/plupload", @@ -2167,27 +2167,29 @@ }, { "name": "nesbot/carbon", - "version": "2.50.0", + "version": "2.55.2", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "f47f17d17602b2243414a44ad53d9f8b9ada5fdb" + "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/f47f17d17602b2243414a44ad53d9f8b9ada5fdb", - "reference": "f47f17d17602b2243414a44ad53d9f8b9ada5fdb", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8c2a18ce3e67c34efc1b29f64fe61304368259a2", + "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2", "shasum": "" }, "require": { "ext-json": "*", "php": "^7.1.8 || ^8.0", "symfony/polyfill-mbstring": "^1.0", - "symfony/translation": "^3.4 || ^4.0 || ^5.0" + "symfony/polyfill-php80": "^1.16", + "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { + "doctrine/dbal": "^2.0 || ^3.0", "doctrine/orm": "^2.7", - "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", + "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", @@ -2201,8 +2203,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev", - "dev-3.x": "3.x-dev" + "dev-3.x": "3.x-dev", + "dev-master": "2.x-dev" }, "laravel": { "providers": [ @@ -2243,6 +2245,7 @@ "time" ], "support": { + "docs": "https://carbon.nesbot.com/docs", "issues": "https://github.com/briannesbitt/Carbon/issues", "source": "https://github.com/briannesbitt/Carbon" }, @@ -2256,7 +2259,7 @@ "type": "tidelift" } ], - "time": "2021-06-28T22:38:45+00:00" + "time": "2021-12-03T14:59:52+00:00" }, { "name": "nikic/fast-route", @@ -2451,29 +2454,29 @@ }, { "name": "phpoption/phpoption", - "version": "1.7.5", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525" + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/994ecccd8f3283ecf5ac33254543eb0ac946d525", - "reference": "994ecccd8f3283ecf5ac33254543eb0ac946d525", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", + "reference": "eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15", "shasum": "" }, "require": { - "php": "^5.5.9 || ^7.0 || ^8.0" + "php": "^7.0 || ^8.0" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^4.8.35 || ^5.7.27 || ^6.5.6 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.19 || ^9.5.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.8-dev" } }, "autoload": { @@ -2488,11 +2491,13 @@ "authors": [ { "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com" + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" }, { "name": "Graham Campbell", - "email": "graham@alt-three.com" + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" } ], "description": "Option Type for PHP", @@ -2504,7 +2509,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.7.5" + "source": "https://github.com/schmittjoh/php-option/tree/1.8.1" }, "funding": [ { @@ -2516,7 +2521,7 @@ "type": "tidelift" } ], - "time": "2020-07-20T17:29:33+00:00" + "time": "2021-12-04T23:24:31+00:00" }, { "name": "phpseclib/phpseclib", @@ -2978,20 +2983,21 @@ }, { "name": "ramsey/collection", - "version": "1.1.3", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1" + "reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1", - "reference": "28a5c4ab2f5111db6a60b2b4ec84057e0f43b9c1", + "url": "https://api.github.com/repos/ramsey/collection/zipball/cccc74ee5e328031b15640b51056ee8d3bb66c0a", + "reference": "cccc74ee5e328031b15640b51056ee8d3bb66c0a", "shasum": "" }, "require": { - "php": "^7.2 || ^8" + "php": "^7.3 || ^8", + "symfony/polyfill-php81": "^1.23" }, "require-dev": { "captainhook/captainhook": "^5.3", @@ -3001,6 +3007,7 @@ "hamcrest/hamcrest-php": "^2", "jangregor/phpstan-prophecy": "^0.8", "mockery/mockery": "^1.3", + "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "^1", "phpstan/phpstan": "^0.12.32", "phpstan/phpstan-mockery": "^0.12.5", @@ -3028,7 +3035,7 @@ "homepage": "https://benramsey.com" } ], - "description": "A PHP 7.2+ library for representing and manipulating collections.", + "description": "A PHP library for representing and manipulating collections.", "keywords": [ "array", "collection", @@ -3039,7 +3046,7 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/1.1.3" + "source": "https://github.com/ramsey/collection/tree/1.2.2" }, "funding": [ { @@ -3051,53 +3058,54 @@ "type": "tidelift" } ], - "time": "2021-01-21T17:40:04+00:00" + "time": "2021-10-10T03:01:02+00:00" }, { "name": "ramsey/uuid", - "version": "4.1.1", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "cd4032040a750077205918c86049aa0f43d22947" + "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/cd4032040a750077205918c86049aa0f43d22947", - "reference": "cd4032040a750077205918c86049aa0f43d22947", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", + "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", "shasum": "" }, "require": { "brick/math": "^0.8 || ^0.9", "ext-json": "*", - "php": "^7.2 || ^8", + "php": "^7.2 || ^8.0", "ramsey/collection": "^1.0", - "symfony/polyfill-ctype": "^1.8" + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-php80": "^1.14" }, "replace": { "rhumsaa/uuid": "self.version" }, "require-dev": { - "codeception/aspect-mock": "^3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0", + "captainhook/captainhook": "^5.10", + "captainhook/plugin-composer": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "doctrine/annotations": "^1.8", - "goaop/framework": "^2", + "ergebnis/composer-normalize": "^2.15", "mockery/mockery": "^1.3", "moontoast/math": "^1.1", "paragonie/random-lib": "^2", + "php-mock/php-mock": "^2.2", "php-mock/php-mock-mockery": "^1.3", - "php-mock/php-mock-phpunit": "^2.5", "php-parallel-lint/php-parallel-lint": "^1.1", - "phpbench/phpbench": "^0.17.1", + "phpbench/phpbench": "^1.0", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12", "phpstan/phpstan-mockery": "^0.12", "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^8.5", - "psy/psysh": "^0.10.0", - "slevomat/coding-standard": "^6.0", + "phpunit/phpunit": "^8.5 || ^9", + "slevomat/coding-standard": "^7.0", "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "3.9.4" + "vimeo/psalm": "^4.9" }, "suggest": { "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", @@ -3110,7 +3118,10 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-main": "4.x-dev" + }, + "captainhook": { + "force-install": true } }, "autoload": { @@ -3126,7 +3137,6 @@ "MIT" ], "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", - "homepage": "https://github.com/ramsey/uuid", "keywords": [ "guid", "identifier", @@ -3134,16 +3144,19 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "rss": "https://github.com/ramsey/uuid/releases.atom", - "source": "https://github.com/ramsey/uuid" + "source": "https://github.com/ramsey/uuid/tree/4.2.3" }, "funding": [ { "url": "https://github.com/ramsey", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", + "type": "tidelift" } ], - "time": "2020-08-18T17:17:46+00:00" + "time": "2021-09-25T23:10:38+00:00" }, { "name": "slim/slim", @@ -3224,16 +3237,16 @@ }, { "name": "smarty/smarty", - "version": "v3.1.39", + "version": "v3.1.43", "source": { "type": "git", "url": "https://github.com/smarty-php/smarty.git", - "reference": "e27da524f7bcd7361e3ea5cdfa99c4378a7b5419" + "reference": "273f7e00fec034f6d61112552e9caf08d19565b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/smarty-php/smarty/zipball/e27da524f7bcd7361e3ea5cdfa99c4378a7b5419", - "reference": "e27da524f7bcd7361e3ea5cdfa99c4378a7b5419", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/273f7e00fec034f6d61112552e9caf08d19565b7", + "reference": "273f7e00fec034f6d61112552e9caf08d19565b7", "shasum": "" }, "require": { @@ -3281,9 +3294,9 @@ "forum": "http://www.smarty.net/forums/", "irc": "irc://irc.freenode.org/smarty", "issues": "https://github.com/smarty-php/smarty/issues", - "source": "https://github.com/smarty-php/smarty/tree/v3.1.39" + "source": "https://github.com/smarty-php/smarty/tree/v3.1.43" }, - "time": "2021-02-17T21:57:51+00:00" + "time": "2022-01-10T09:52:40+00:00" }, { "name": "sokil/php-isocodes", @@ -3397,16 +3410,16 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "15f7faf8508e04471f666633addacf54c0ab5933" + "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/15f7faf8508e04471f666633addacf54c0ab5933", - "reference": "15f7faf8508e04471f666633addacf54c0ab5933", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8a5d5072dca8f48460fce2f4131fcc495eec654c", + "reference": "8a5d5072dca8f48460fce2f4131fcc495eec654c", "shasum": "" }, "require": { @@ -3418,7 +3431,7 @@ }, "require-dev": { "mockery/mockery": "^1.0", - "symfony/phpunit-bridge": "^4.4|^5.0" + "symfony/phpunit-bridge": "^4.4|^5.4" }, "suggest": { "ext-intl": "Needed to support internationalized email addresses" @@ -3456,7 +3469,7 @@ ], "support": { "issues": "https://github.com/swiftmailer/swiftmailer/issues", - "source": "https://github.com/swiftmailer/swiftmailer/tree/v6.2.7" + "source": "https://github.com/swiftmailer/swiftmailer/tree/v6.3.0" }, "funding": [ { @@ -3468,32 +3481,34 @@ "type": "tidelift" } ], - "time": "2021-03-09T12:30:35+00:00" + "abandoned": "symfony/mailer", + "time": "2021-10-18T15:26:12+00:00" }, { "name": "symfony/console", - "version": "v5.3.2", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "649730483885ff2ca99ca0560ef0e5f6b03f2ac1" + "reference": "a2c6b7ced2eb7799a35375fb9022519282b5405e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/649730483885ff2ca99ca0560ef0e5f6b03f2ac1", - "reference": "649730483885ff2ca99ca0560ef0e5f6b03f2ac1", + "url": "https://api.github.com/repos/symfony/console/zipball/a2c6b7ced2eb7799a35375fb9022519282b5405e", + "reference": "a2c6b7ced2eb7799a35375fb9022519282b5405e", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", @@ -3501,16 +3516,16 @@ "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -3550,7 +3565,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.2" + "source": "https://github.com/symfony/console/tree/v5.4.2" }, "funding": [ { @@ -3566,24 +3581,25 @@ "type": "tidelift" } ], - "time": "2021-06-12T09:42:48+00:00" + "time": "2021-12-20T16:11:12+00:00" }, { "name": "symfony/css-selector", - "version": "v5.3.0", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "fcd0b29a7a0b1bb5bfbedc6231583d77fea04814" + "reference": "cfcbee910e159df402603502fe387e8b677c22fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/fcd0b29a7a0b1bb5bfbedc6231583d77fea04814", - "reference": "fcd0b29a7a0b1bb5bfbedc6231583d77fea04814", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/cfcbee910e159df402603502fe387e8b677c22fd", + "reference": "cfcbee910e159df402603502fe387e8b677c22fd", "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3615,7 +3631,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.3.0" + "source": "https://github.com/symfony/css-selector/tree/v5.4.2" }, "funding": [ { @@ -3631,20 +3647,20 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:40:38+00:00" + "time": "2021-12-16T21:58:21+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", "shasum": "" }, "require": { @@ -3653,7 +3669,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3682,7 +3698,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" }, "funding": [ { @@ -3698,33 +3714,35 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/error-handler", - "version": "v5.3.3", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "43323e79c80719e8a4674e33484bca98270d223f" + "reference": "e0c0dd0f9d4120a20158fc9aec2367d07d38bc56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/43323e79c80719e8a4674e33484bca98270d223f", - "reference": "43323e79c80719e8a4674e33484bca98270d223f", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/e0c0dd0f9d4120a20158fc9aec2367d07d38bc56", + "reference": "e0c0dd0f9d4120a20158fc9aec2367d07d38bc56", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/log": "^1.0", - "symfony/polyfill-php80": "^1.15", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "require-dev": { - "symfony/deprecation-contracts": "^2.1", - "symfony/http-kernel": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/http-kernel": "^4.4|^5.0|^6.0", + "symfony/serializer": "^4.4|^5.0|^6.0" }, + "bin": [ + "Resources/bin/patch-type-declarations" + ], "type": "library", "autoload": { "psr-4": { @@ -3751,7 +3769,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.3.3" + "source": "https://github.com/symfony/error-handler/tree/v5.4.2" }, "funding": [ { @@ -3767,27 +3785,27 @@ "type": "tidelift" } ], - "time": "2021-06-24T08:13:00+00:00" + "time": "2021-12-19T20:02:00+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.3.0", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "67a5f354afa8e2f231081b3fa11a5912f933c3ce" + "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/67a5f354afa8e2f231081b3fa11a5912f933c3ce", - "reference": "67a5f354afa8e2f231081b3fa11a5912f933c3ce", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/27d39ae126352b9fa3be5e196ccf4617897be3eb", + "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/event-dispatcher-contracts": "^2", - "symfony/polyfill-php80": "^1.15" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" }, "conflict": { "symfony/dependency-injection": "<4.4" @@ -3797,14 +3815,14 @@ "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/dependency-injection": "", @@ -3836,7 +3854,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.3.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.0" }, "funding": [ { @@ -3852,20 +3870,20 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2021-11-23T10:19:22+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11" + "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", + "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", "shasum": "" }, "require": { @@ -3878,7 +3896,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3915,7 +3933,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.0" }, "funding": [ { @@ -3931,24 +3949,26 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/finder", - "version": "v5.3.0", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "0ae3f047bed4edff6fd35b26a9a6bfdc92c953c6" + "reference": "e77046c252be48c48a40816187ed527703c8f76c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/0ae3f047bed4edff6fd35b26a9a6bfdc92c953c6", - "reference": "0ae3f047bed4edff6fd35b26a9a6bfdc92c953c6", + "url": "https://api.github.com/repos/symfony/finder/zipball/e77046c252be48c48a40816187ed527703c8f76c", + "reference": "e77046c252be48c48a40816187ed527703c8f76c", "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3976,7 +3996,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.3.0" + "source": "https://github.com/symfony/finder/tree/v5.4.2" }, "funding": [ { @@ -3992,111 +4012,33 @@ "type": "tidelift" } ], - "time": "2021-05-26T12:52:38+00:00" - }, - { - "name": "symfony/http-client-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/7e82f6084d7cae521a75ef2cb5c9457bbda785f4", - "reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4", - "shasum": "" - }, - "require": { - "php": ">=7.2.5" - }, - "suggest": { - "symfony/http-client-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\HttpClient\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to HTTP clients", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v2.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-04-11T23:07:08+00:00" + "time": "2021-12-15T11:06:13+00:00" }, { "name": "symfony/http-foundation", - "version": "v5.3.3", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "0e45ab1574caa0460d9190871a8ce47539e40ccf" + "reference": "ce952af52877eaf3eab5d0c08cc0ea865ed37313" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/0e45ab1574caa0460d9190871a8ce47539e40ccf", - "reference": "0e45ab1574caa0460d9190871a8ce47539e40ccf", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ce952af52877eaf3eab5d0c08cc0ea865ed37313", + "reference": "ce952af52877eaf3eab5d0c08cc0ea865ed37313", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "require-dev": { "predis/predis": "~1.0", - "symfony/cache": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/mime": "^4.4|^5.0" + "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/mime": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/mime": "To use the file extension guesser" @@ -4127,7 +4069,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.3.3" + "source": "https://github.com/symfony/http-foundation/tree/v5.4.2" }, "funding": [ { @@ -4143,36 +4085,35 @@ "type": "tidelift" } ], - "time": "2021-06-27T09:19:40+00:00" + "time": "2021-12-28T17:15:56+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.3.3", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "90ad9f4b21ddcb8ebe9faadfcca54929ad23f9f8" + "reference": "35b7e9868953e0d1df84320bb063543369e43ef5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/90ad9f4b21ddcb8ebe9faadfcca54929ad23f9f8", - "reference": "90ad9f4b21ddcb8ebe9faadfcca54929ad23f9f8", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/35b7e9868953e0d1df84320bb063543369e43ef5", + "reference": "35b7e9868953e0d1df84320bb063543369e43ef5", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/log": "~1.0", - "symfony/deprecation-contracts": "^2.1", - "symfony/error-handler": "^4.4|^5.0", - "symfony/event-dispatcher": "^5.0", - "symfony/http-client-contracts": "^1.1|^2", - "symfony/http-foundation": "^5.3", + "psr/log": "^1|^2", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^5.0|^6.0", + "symfony/http-foundation": "^5.3.7|^6.0", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "conflict": { - "symfony/browser-kit": "<4.4", + "symfony/browser-kit": "<5.4", "symfony/cache": "<5.0", "symfony/config": "<5.0", "symfony/console": "<4.4", @@ -4188,23 +4129,24 @@ "twig/twig": "<2.13" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", - "symfony/browser-kit": "^4.4|^5.0", - "symfony/config": "^5.0", - "symfony/console": "^4.4|^5.0", - "symfony/css-selector": "^4.4|^5.0", - "symfony/dependency-injection": "^5.3", - "symfony/dom-crawler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/routing": "^4.4|^5.0", - "symfony/stopwatch": "^4.4|^5.0", - "symfony/translation": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", + "symfony/browser-kit": "^5.4|^6.0", + "symfony/config": "^5.0|^6.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/css-selector": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^5.3|^6.0", + "symfony/dom-crawler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/http-client-contracts": "^1.1|^2|^3", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/stopwatch": "^4.4|^5.0|^6.0", + "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2|^3", "twig/twig": "^2.13|^3.0.4" }, "suggest": { @@ -4239,7 +4181,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.3.3" + "source": "https://github.com/symfony/http-kernel/tree/v5.4.2" }, "funding": [ { @@ -4255,28 +4197,28 @@ "type": "tidelift" } ], - "time": "2021-06-30T08:27:49+00:00" + "time": "2021-12-29T13:20:26+00:00" }, { "name": "symfony/mime", - "version": "v5.3.2", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "47dd7912152b82d0d4c8d9040dbc93d6232d472a" + "reference": "1bfd938cf9562822c05c4d00e8f92134d3c8e42d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/47dd7912152b82d0d4c8d9040dbc93d6232d472a", - "reference": "47dd7912152b82d0d4c8d9040dbc93d6232d472a", + "url": "https://api.github.com/repos/symfony/mime/zipball/1bfd938cf9562822c05c4d00e8f92134d3c8e42d", + "reference": "1bfd938cf9562822c05c4d00e8f92134d3c8e42d", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "conflict": { "egulias/email-validator": "~3.0.0", @@ -4287,10 +4229,10 @@ "require-dev": { "egulias/email-validator": "^2.1.10|^3.1", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/property-access": "^4.4|^5.1", - "symfony/property-info": "^4.4|^5.1", - "symfony/serializer": "^5.2" + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/property-access": "^4.4|^5.1|^6.0", + "symfony/property-info": "^4.4|^5.1|^6.0", + "symfony/serializer": "^5.2|^6.0" }, "type": "library", "autoload": { @@ -4322,7 +4264,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.3.2" + "source": "https://github.com/symfony/mime/tree/v5.4.2" }, "funding": [ { @@ -4338,25 +4280,28 @@ "type": "tidelift" } ], - "time": "2021-06-09T10:58:01+00:00" + "time": "2021-12-28T17:15:56+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -4401,7 +4346,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" }, "funding": [ { @@ -4417,25 +4362,28 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-iconv", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933" + "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/63b5bb7db83e5673936d6e3b8b3e022ff6474933", - "reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/f1aed619e28cb077fc83fac8c4c0383578356e40", + "reference": "f1aed619e28cb077fc83fac8c4c0383578356e40", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-iconv": "*" + }, "suggest": { "ext-iconv": "For best performance" }, @@ -4481,7 +4429,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.24.0" }, "funding": [ { @@ -4497,20 +4445,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:27:20+00:00" + "time": "2022-01-04T09:04:05+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "24b72c6baa32c746a4d0840147c9715e42bb68ab" + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/24b72c6baa32c746a4d0840147c9715e42bb68ab", - "reference": "24b72c6baa32c746a4d0840147c9715e42bb68ab", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { @@ -4562,7 +4510,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.24.0" }, "funding": [ { @@ -4578,20 +4526,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:17:38+00:00" + "time": "2021-11-23T21:10:46+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65" + "reference": "749045c69efb97c70d25d7463abba812e91f3a44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65", - "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44", + "reference": "749045c69efb97c70d25d7463abba812e91f3a44", "shasum": "" }, "require": { @@ -4649,7 +4597,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.24.0" }, "funding": [ { @@ -4665,11 +4613,11 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:27:20+00:00" + "time": "2021-09-14T14:02:44+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -4733,7 +4681,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0" }, "funding": [ { @@ -4753,21 +4701,24 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, @@ -4813,7 +4764,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" }, "funding": [ { @@ -4829,11 +4780,11 @@ "type": "tidelift" } ], - "time": "2021-05-27T09:27:20+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", @@ -4889,7 +4840,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.24.0" }, "funding": [ { @@ -4909,16 +4860,16 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { @@ -4968,7 +4919,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" }, "funding": [ { @@ -4984,20 +4935,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", "shasum": "" }, "require": { @@ -5051,7 +5002,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" }, "funding": [ { @@ -5067,25 +5018,104 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-09-13T13:58:33+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-13T13:58:11+00:00" }, { "name": "symfony/process", - "version": "v5.3.2", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "714b47f9196de61a196d86c4bad5f09201b307df" + "reference": "2b3ba8722c4aaf3e88011be5e7f48710088fb5e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/714b47f9196de61a196d86c4bad5f09201b307df", - "reference": "714b47f9196de61a196d86c4bad5f09201b307df", + "url": "https://api.github.com/repos/symfony/process/zipball/2b3ba8722c4aaf3e88011be5e7f48710088fb5e4", + "reference": "2b3ba8722c4aaf3e88011be5e7f48710088fb5e4", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -5113,7 +5143,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.3.2" + "source": "https://github.com/symfony/process/tree/v5.4.2" }, "funding": [ { @@ -5129,26 +5159,26 @@ "type": "tidelift" } ], - "time": "2021-06-12T10:15:01+00:00" + "time": "2021-12-27T21:01:00+00:00" }, { "name": "symfony/routing", - "version": "v5.3.0", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "368e81376a8e049c37cb80ae87dbfbf411279199" + "reference": "9eeae93c32ca86746e5d38f3679e9569981038b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/368e81376a8e049c37cb80ae87dbfbf411279199", - "reference": "368e81376a8e049c37cb80ae87dbfbf411279199", + "url": "https://api.github.com/repos/symfony/routing/zipball/9eeae93c32ca86746e5d38f3679e9569981038b1", + "reference": "9eeae93c32ca86746e5d38f3679e9569981038b1", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-php80": "^1.15" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "conflict": { "doctrine/annotations": "<1.12", @@ -5158,12 +5188,12 @@ }, "require-dev": { "doctrine/annotations": "^1.12", - "psr/log": "~1.0", - "symfony/config": "^5.3", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/yaml": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.3|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/yaml": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/config": "For using the all-in-one router or any loader", @@ -5203,7 +5233,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.3.0" + "source": "https://github.com/symfony/routing/tree/v5.4.0" }, "funding": [ { @@ -5219,25 +5249,29 @@ "type": "tidelift" } ], - "time": "2021-05-26T17:43:10+00:00" + "time": "2021-11-23T10:19:22+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.1" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -5245,7 +5279,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -5282,7 +5316,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.0" }, "funding": [ { @@ -5298,20 +5332,20 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2021-11-04T16:48:04+00:00" }, { "name": "symfony/string", - "version": "v5.3.3", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1" + "reference": "e6a5d5ecf6589c5247d18e0e74e30b11dfd51a3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", - "reference": "bd53358e3eccec6a670b5f33ab680d8dbe1d4ae1", + "url": "https://api.github.com/repos/symfony/string/zipball/e6a5d5ecf6589c5247d18e0e74e30b11dfd51a3d", + "reference": "e6a5d5ecf6589c5247d18e0e74e30b11dfd51a3d", "shasum": "" }, "require": { @@ -5322,11 +5356,14 @@ "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "~1.15" }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { @@ -5365,7 +5402,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.3" + "source": "https://github.com/symfony/string/tree/v5.4.2" }, "funding": [ { @@ -5381,31 +5418,32 @@ "type": "tidelift" } ], - "time": "2021-06-27T11:44:38+00:00" + "time": "2021-12-16T21:52:00+00:00" }, { "name": "symfony/translation", - "version": "v5.3.3", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "380b8c9e944d0e364b25f28e8e555241eb49c01c" + "reference": "ff8bb2107b6a549dc3c5dd9c498dcc82c9c098ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/380b8c9e944d0e364b25f28e8e555241eb49c01c", - "reference": "380b8c9e944d0e364b25f28e8e555241eb49c01c", + "url": "https://api.github.com/repos/symfony/translation/zipball/ff8bb2107b6a549dc3c5dd9c498dcc82c9c098ca", + "reference": "ff8bb2107b6a549dc3c5dd9c498dcc82c9c098ca", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.15", + "symfony/polyfill-php80": "^1.16", "symfony/translation-contracts": "^2.3" }, "conflict": { "symfony/config": "<4.4", + "symfony/console": "<5.3", "symfony/dependency-injection": "<5.0", "symfony/http-kernel": "<5.0", "symfony/twig-bundle": "<5.0", @@ -5415,16 +5453,17 @@ "symfony/translation-implementation": "2.3" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/console": "^4.4|^5.0", - "symfony/dependency-injection": "^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/http-kernel": "^5.0", - "symfony/intl": "^4.4|^5.0", + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/dependency-injection": "^5.0|^6.0", + "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/http-client-contracts": "^1.1|^2.0|^3.0", + "symfony/http-kernel": "^5.0|^6.0", + "symfony/intl": "^4.4|^5.0|^6.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^4.4|^5.0" + "symfony/service-contracts": "^1.1.2|^2|^3", + "symfony/yaml": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", @@ -5460,7 +5499,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.3.3" + "source": "https://github.com/symfony/translation/tree/v5.4.2" }, "funding": [ { @@ -5476,20 +5515,20 @@ "type": "tidelift" } ], - "time": "2021-06-27T12:22:47+00:00" + "time": "2021-12-25T19:45:36+00:00" }, { "name": "symfony/translation-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "95c812666f3e91db75385749fe219c5e494c7f95" + "reference": "d28150f0f44ce854e942b671fc2620a98aae1b1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/95c812666f3e91db75385749fe219c5e494c7f95", - "reference": "95c812666f3e91db75385749fe219c5e494c7f95", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/d28150f0f44ce854e942b671fc2620a98aae1b1e", + "reference": "d28150f0f44ce854e942b671fc2620a98aae1b1e", "shasum": "" }, "require": { @@ -5501,7 +5540,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -5538,7 +5577,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/translation-contracts/tree/v2.5.0" }, "funding": [ { @@ -5554,26 +5593,26 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-08-17T14:20:01+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.3.3", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "46aa709affb9ad3355bd7a810f9662d71025c384" + "reference": "1b56c32c3679002b3a42384a580e16e2600f41c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/46aa709affb9ad3355bd7a810f9662d71025c384", - "reference": "46aa709affb9ad3355bd7a810f9662d71025c384", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/1b56c32c3679002b3a42384a580e16e2600f41c1", + "reference": "1b56c32c3679002b3a42384a580e16e2600f41c1", "shasum": "" }, "require": { "php": ">=7.2.5", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "conflict": { "phpunit/phpunit": "<5.4.3", @@ -5581,8 +5620,9 @@ }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/uid": "^5.1|^6.0", "twig/twig": "^2.13|^3.0.4" }, "suggest": { @@ -5626,7 +5666,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.3.3" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.2" }, "funding": [ { @@ -5642,30 +5682,30 @@ "type": "tidelift" } ], - "time": "2021-06-24T08:13:00+00:00" + "time": "2021-12-29T10:10:35+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.3", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "b43b05cf43c1b6d849478965062b6ef73e223bb5" + "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/b43b05cf43c1b6d849478965062b6ef73e223bb5", - "reference": "b43b05cf43c1b6d849478965062b6ef73e223bb5", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/da444caae6aca7a19c0c140f68c6182e337d5b1c", + "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "php": "^5.5 || ^7.0 || ^8.0", - "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0" + "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" }, "type": "library", "extra": { @@ -5693,22 +5733,22 @@ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "support": { "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", - "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.3" + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.4" }, - "time": "2020-07-13T06:12:54+00:00" + "time": "2021-12-08T09:12:39+00:00" }, { "name": "tinymce/tinymce", - "version": "5.8.2", + "version": "5.10.0", "source": { "type": "git", "url": "https://github.com/tinymce/tinymce-dist.git", - "reference": "dbf8c9ab481e11b660a957257c73f55e2af83b20" + "reference": "dbd8fefb0bbe96ed15f9af4518b078ae2c20e020" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/dbf8c9ab481e11b660a957257c73f55e2af83b20", - "reference": "dbf8c9ab481e11b660a957257c73f55e2af83b20", + "url": "https://api.github.com/repos/tinymce/tinymce-dist/zipball/dbd8fefb0bbe96ed15f9af4518b078ae2c20e020", + "reference": "dbd8fefb0bbe96ed15f9af4518b078ae2c20e020", "shasum": "" }, "type": "component", @@ -5734,32 +5774,38 @@ "LGPL-2.1-only" ], "description": "Web based JavaScript HTML WYSIWYG editor control.", - "homepage": "http://www.tinymce.com", + "homepage": "https://www.tiny.cloud/", "keywords": [ - "editor", + "contenteditable", + "editing", "html", "javascript", + "rich editor", + "rich text", + "rich text editor", "richtext", + "rte", + "text", "tinymce", "wysiwyg" ], "support": { - "source": "https://github.com/tinymce/tinymce-dist/tree/5.8.2" + "source": "https://github.com/tinymce/tinymce-dist/tree/5.10.0" }, - "time": "2021-06-23T06:52:46+00:00" + "time": "2021-10-11T03:18:15+00:00" }, { "name": "vlucas/phpdotenv", - "version": "v4.2.0", + "version": "v4.2.2", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "da64796370fc4eb03cc277088f6fede9fde88482" + "reference": "77e974614d2ead521f18069dccc571696f52b8dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/da64796370fc4eb03cc277088f6fede9fde88482", - "reference": "da64796370fc4eb03cc277088f6fede9fde88482", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/77e974614d2ead521f18069dccc571696f52b8dc", + "reference": "77e974614d2ead521f18069dccc571696f52b8dc", "shasum": "" }, "require": { @@ -5771,7 +5817,7 @@ "bamarni/composer-bin-plugin": "^1.4.1", "ext-filter": "*", "ext-pcre": "*", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20" + "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.21" }, "suggest": { "ext-filter": "Required to use the boolean validator.", @@ -5780,7 +5826,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -5795,13 +5841,13 @@ "authors": [ { "name": "Graham Campbell", - "email": "graham@alt-three.com", - "homepage": "https://gjcampbell.co.uk/" + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" }, { "name": "Vance Lucas", "email": "vance@vancelucas.com", - "homepage": "https://vancelucas.com/" + "homepage": "https://github.com/vlucas" } ], "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", @@ -5812,7 +5858,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v4.2.0" + "source": "https://github.com/vlucas/phpdotenv/tree/v4.2.2" }, "funding": [ { @@ -5824,7 +5870,7 @@ "type": "tidelift" } ], - "time": "2021-01-20T15:11:48+00:00" + "time": "2021-12-12T23:07:53+00:00" }, { "name": "voku/portable-ascii", @@ -8949,7 +8995,6 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "adodb/adodb-php": 20, "psy/psysh": 0 }, "prefer-stable": false, @@ -8959,5 +9004,5 @@ "platform-overrides": { "php": "7.3.0" }, - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.2.0" } diff --git a/controllers/api/file/FileApiHandler.inc.php b/controllers/api/file/FileApiHandler.inc.php index 150e3c2cd09..0caf8d9132e 100644 --- a/controllers/api/file/FileApiHandler.inc.php +++ b/controllers/api/file/FileApiHandler.inc.php @@ -56,12 +56,12 @@ public function authorize($request, &$args, $roleAssignments) } elseif (is_numeric($libraryFileId)) { $this->addPolicy(new ContextAccessPolicy($request, $roleAssignments)); } elseif (!empty($fileStage) && empty($submissionFileId)) { - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$submissionId]) ->filterByFileStages([$fileStage]) ->includeDependentFiles($fileStage === SubmissionFile::SUBMISSION_FILE_DEPENDENT); - $submissionFileIds = Repo::submissionFiles()->getIds($collector); + $submissionFileIds = Repo::submissionFile()->getIds($collector); $allFilesAccessPolicy = new PolicySet(PolicySet::COMBINING_DENY_OVERRIDES); foreach ($submissionFileIds as $submissionFileId) { $allFilesAccessPolicy->addPolicy(new SubmissionFileAccessPolicy($request, $args, $roleAssignments, SubmissionFileAccessPolicy::SUBMISSION_FILE_ACCESS_READ, $submissionFileId)); @@ -78,14 +78,14 @@ public function authorize($request, &$args, $roleAssignments) /** * Download a file. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function downloadFile($args, $request) { $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); $fileId = $request->getUserVar('fileId') ?? $submissionFile->getData('fileId'); - $revisions = Repo::submissionFiles() + $revisions = Repo::submissionFile() ->getRevisions($submissionFile->getId()); $file = null; foreach ($revisions as $revision) { @@ -127,8 +127,8 @@ public function downloadFile($args, $request) /** * Download a library file. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function downloadLibraryFile($args, $request) { @@ -140,8 +140,8 @@ public function downloadLibraryFile($args, $request) /** * Download all passed files. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function downloadAllFiles($args, $request) { @@ -179,8 +179,8 @@ public function downloadAllFiles($args, $request) /** * Record file download and return js event to update grid rows. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return string */ @@ -194,8 +194,8 @@ public function recordDownload($args, $request) * recordDownload since library files do not have downloads recorded and are in a * different context. * - * @param $args aray - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ diff --git a/controllers/api/file/PKPManageFileApiHandler.inc.php b/controllers/api/file/PKPManageFileApiHandler.inc.php index e206b9541cb..ca7c14fb867 100644 --- a/controllers/api/file/PKPManageFileApiHandler.inc.php +++ b/controllers/api/file/PKPManageFileApiHandler.inc.php @@ -56,8 +56,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Delete a file or revision * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -68,7 +68,7 @@ public function deleteFile($args, $request) } $submissionFile = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE); - Repo::submissionFiles()->delete($submissionFile); + Repo::submissionFile()->delete($submissionFile); $this->setupTemplate($request); $user = $request->getUser(); @@ -87,8 +87,8 @@ public function deleteFile($args, $request) /** * Edit submission file metadata modal. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -108,8 +108,8 @@ public function editMetadata($args, $request) /** * Edit submission file metadata tab. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -128,8 +128,8 @@ public function editMetadataTab($args, $request) * Save the metadata of the latest revision of * the requested submission file. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ diff --git a/controllers/api/file/linkAction/AddFileLinkAction.inc.php b/controllers/api/file/linkAction/AddFileLinkAction.inc.php index fc1bf87e495..d463483671e 100644 --- a/controllers/api/file/linkAction/AddFileLinkAction.inc.php +++ b/controllers/api/file/linkAction/AddFileLinkAction.inc.php @@ -22,25 +22,25 @@ class AddFileLinkAction extends BaseAddFileLinkAction /** * Constructor * - * @param $request Request - * @param $submissionId integer The submission the file should be + * @param Request $request + * @param int $submissionId The submission the file should be * uploaded to. - * @param $stageId integer The workflow stage in which the file + * @param int $stageId The workflow stage in which the file * uploader is being instantiated (one of the WORKFLOW_STAGE_ID_* * constants). - * @param $uploaderRoles array The ids of all roles allowed to upload + * @param array $uploaderRoles The ids of all roles allowed to upload * in the context of this action. - * @param $fileStage integer The file stage the file should be + * @param int $fileStage The file stage the file should be * uploaded to (one of the SubmissionFile::SUBMISSION_FILE_* constants). - * @param $assocType integer The type of the element the file should + * @param int $assocType The type of the element the file should * be associated with (one fo the ASSOC_TYPE_* constants). - * @param $assocId integer The id of the element the file should be + * @param int $assocId The id of the element the file should be * associated with. - * @param $reviewRoundId int The current review round ID (if any) - * @param $revisedFileId int Revised file ID, if any - * @param $dependentFilesOnly bool whether to only include dependent + * @param int $reviewRoundId The current review round ID (if any) + * @param int $revisedFileId Revised file ID, if any + * @param bool $dependentFilesOnly whether to only include dependent * files in the Genres dropdown. - * @param $queryId int The query id. Use when the assoc details point + * @param int $queryId The query id. Use when the assoc details point * to a note */ public function __construct( @@ -98,7 +98,7 @@ public function __construct( * Static method to return text labels * for upload to different file stages. * - * @param $fileStage integer One of the + * @param int $fileStage One of the * SubmissionFile::SUBMISSION_FILE_* constants. * * @return array diff --git a/controllers/api/file/linkAction/AddRevisionLinkAction.inc.php b/controllers/api/file/linkAction/AddRevisionLinkAction.inc.php index 6175e0d1509..75729f85e46 100644 --- a/controllers/api/file/linkAction/AddRevisionLinkAction.inc.php +++ b/controllers/api/file/linkAction/AddRevisionLinkAction.inc.php @@ -22,9 +22,9 @@ class AddRevisionLinkAction extends BaseAddFileLinkAction /** * Constructor * - * @param $request Request - * @param $reviewRound ReviewRound The review round to upload to. - * @param $uploaderRoles array The ids of all roles allowed to upload + * @param Request $request + * @param ReviewRound $reviewRound The review round to upload to. + * @param array $uploaderRoles The ids of all roles allowed to upload * in the context of this action. */ public function __construct($request, $reviewRound, $uploaderRoles) diff --git a/controllers/api/file/linkAction/BaseAddFileLinkAction.inc.php b/controllers/api/file/linkAction/BaseAddFileLinkAction.inc.php index 7062d5e0cff..3a35e47a53e 100644 --- a/controllers/api/file/linkAction/BaseAddFileLinkAction.inc.php +++ b/controllers/api/file/linkAction/BaseAddFileLinkAction.inc.php @@ -24,19 +24,19 @@ class BaseAddFileLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $submissionId integer The submission the file should be + * @param Request $request + * @param int $submissionId The submission the file should be * uploaded to. - * @param $stageId integer The workflow stage in which the file + * @param int $stageId The workflow stage in which the file * uploader is being instantiated (one of the WORKFLOW_STAGE_ID_* * constants). - * @param $uploaderRoles array The ids of all roles allowed to upload + * @param array $uploaderRoles The ids of all roles allowed to upload * in the context of this action. - * @param $actionArgs array The arguments to be passed into the file + * @param array $actionArgs The arguments to be passed into the file * upload wizard. - * @param $wizardTitle string The title to be displayed in the file + * @param string $wizardTitle The title to be displayed in the file * upload wizard. - * @param $buttonLabel string The link action's button label. + * @param string $buttonLabel The link action's button label. */ public function __construct( $request, diff --git a/controllers/api/file/linkAction/DeleteFileLinkAction.inc.php b/controllers/api/file/linkAction/DeleteFileLinkAction.inc.php index a230b348aa6..1fd371b0253 100644 --- a/controllers/api/file/linkAction/DeleteFileLinkAction.inc.php +++ b/controllers/api/file/linkAction/DeleteFileLinkAction.inc.php @@ -21,10 +21,10 @@ class DeleteFileLinkAction extends FileLinkAction /** * Constructor * - * @param $request Request - * @param $submissionFile SubmissionFile the submission file to be deleted - * @param $stageId int (optional) - * @param $localeKey string (optional) Locale key to use for delete link + * @param Request $request + * @param SubmissionFile $submissionFile the submission file to be deleted + * @param int $stageId (optional) + * @param string $localeKey (optional) Locale key to use for delete link * be deleted. */ public function __construct($request, $submissionFile, $stageId, $localeKey = 'grid.action.delete') diff --git a/controllers/api/file/linkAction/DownloadFileLinkAction.inc.php b/controllers/api/file/linkAction/DownloadFileLinkAction.inc.php index cefe4cc7cb8..783bf46bb30 100644 --- a/controllers/api/file/linkAction/DownloadFileLinkAction.inc.php +++ b/controllers/api/file/linkAction/DownloadFileLinkAction.inc.php @@ -24,13 +24,13 @@ class DownloadFileLinkAction extends FileLinkAction /** * Constructor * - * @param $request Request - * @param $submissionFile SubmissionFile the submission file to + * @param Request $request + * @param SubmissionFile $submissionFile the submission file to * link to. - * @param $stageId int (optional) - * @param $label string (optional) Label to use instead of filename - * @param $fileId int (optional) Download a specific revision of a file - * @param $filename string (optional) The filename to use for the file + * @param int $stageId (optional) + * @param string $label (optional) Label to use instead of filename + * @param int $fileId (optional) Download a specific revision of a file + * @param string $filename (optional) The filename to use for the file */ public function __construct($request, $submissionFile, $stageId = null, $label = null, $fileId = null, $filename = null) { @@ -74,7 +74,7 @@ public function __construct($request, $submissionFile, $stageId = null, $label = /** * Get the label for the file download action. * - * @param $submissionFile SubmissionFile + * @param SubmissionFile $submissionFile * * @return string */ diff --git a/controllers/api/file/linkAction/DownloadLibraryFileLinkAction.inc.php b/controllers/api/file/linkAction/DownloadLibraryFileLinkAction.inc.php index 2fe0121d0ee..813b95d50bb 100644 --- a/controllers/api/file/linkAction/DownloadLibraryFileLinkAction.inc.php +++ b/controllers/api/file/linkAction/DownloadLibraryFileLinkAction.inc.php @@ -20,8 +20,8 @@ class DownloadLibraryFileLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $libraryFile LibraryFile the library file to + * @param Request $request + * @param LibraryFile $libraryFile the library file to * link to. */ public function __construct($request, $libraryFile) @@ -59,7 +59,7 @@ public function __construct($request, $libraryFile) /** * Return the action arguments to address a file. * - * @param $libraryFile LibraryFile + * @param LibraryFile $libraryFile * * @return array */ diff --git a/controllers/api/file/linkAction/EditFileLinkAction.inc.php b/controllers/api/file/linkAction/EditFileLinkAction.inc.php index a9511b2fe6d..53feab0b72f 100644 --- a/controllers/api/file/linkAction/EditFileLinkAction.inc.php +++ b/controllers/api/file/linkAction/EditFileLinkAction.inc.php @@ -21,9 +21,9 @@ class EditFileLinkAction extends FileLinkAction /** * Constructor * - * @param $request Request - * @param $submissionFile SubmissionFile the submission file to edit. - * @param $stageId int Stage ID + * @param Request $request + * @param SubmissionFile $submissionFile the submission file to edit. + * @param int $stageId Stage ID */ public function __construct($request, $submissionFile, $stageId) { diff --git a/controllers/api/file/linkAction/FileLinkAction.inc.php b/controllers/api/file/linkAction/FileLinkAction.inc.php index c9434b5ab79..23089e72631 100644 --- a/controllers/api/file/linkAction/FileLinkAction.inc.php +++ b/controllers/api/file/linkAction/FileLinkAction.inc.php @@ -19,11 +19,11 @@ class FileLinkAction extends LinkAction /** * Constructor * - * @param $id string Link action ID - * @param $actionRequest LinkActionRequest - * @param $title string optional - * @param $image string optional - * @param $tooltip string optional + * @param string $id Link action ID + * @param LinkActionRequest $actionRequest + * @param string $title optional + * @param string $image optional + * @param string $tooltip optional */ public function __construct($id, $actionRequest, $title = null, $image = null, $tooltip = null) { @@ -37,8 +37,8 @@ public function __construct($id, $actionRequest, $title = null, $image = null, $ /** * Return the action arguments to address a file. * - * @param $submissionFile SubmissionFile - * @param $stageId int (optional) + * @param SubmissionFile $submissionFile + * @param int $stageId (optional) * * @return array */ diff --git a/controllers/api/task/SendReminderLinkAction.inc.php b/controllers/api/task/SendReminderLinkAction.inc.php index ad72d14111e..1fdd90a6ab1 100644 --- a/controllers/api/task/SendReminderLinkAction.inc.php +++ b/controllers/api/task/SendReminderLinkAction.inc.php @@ -21,8 +21,8 @@ class SendReminderLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $actionArgs array The action arguments. + * @param Request $request + * @param array $actionArgs The action arguments. */ public function __construct($request, $modalTitle, $actionArgs) { diff --git a/controllers/api/task/SendThankYouLinkAction.inc.php b/controllers/api/task/SendThankYouLinkAction.inc.php index 08c1b320e78..c37a6b2ca4e 100644 --- a/controllers/api/task/SendThankYouLinkAction.inc.php +++ b/controllers/api/task/SendThankYouLinkAction.inc.php @@ -21,8 +21,8 @@ class SendThankYouLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $actionArgs array The action arguments. + * @param Request $request + * @param array $actionArgs The action arguments. */ public function __construct($request, $modalTitle, $actionArgs) { diff --git a/controllers/api/user/UserApiHandler.inc.php b/controllers/api/user/UserApiHandler.inc.php index c69502d987e..f7bf1ef6020 100644 --- a/controllers/api/user/UserApiHandler.inc.php +++ b/controllers/api/user/UserApiHandler.inc.php @@ -45,8 +45,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Get a suggested username, making sure it's not already used. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/confirmationModal/linkAction/ViewCompetingInterestGuidelinesLinkAction.inc.php b/controllers/confirmationModal/linkAction/ViewCompetingInterestGuidelinesLinkAction.inc.php index 5fa580e95a2..4d9d1014e9c 100644 --- a/controllers/confirmationModal/linkAction/ViewCompetingInterestGuidelinesLinkAction.inc.php +++ b/controllers/confirmationModal/linkAction/ViewCompetingInterestGuidelinesLinkAction.inc.php @@ -21,7 +21,7 @@ class ViewCompetingInterestGuidelinesLinkAction extends LinkAction /** * Constructor * - * @param $request Request + * @param Request $request */ public function __construct($request) { diff --git a/controllers/confirmationModal/linkAction/ViewReviewGuidelinesLinkAction.inc.php b/controllers/confirmationModal/linkAction/ViewReviewGuidelinesLinkAction.inc.php index 68546a8e9f1..0b8d5c70373 100644 --- a/controllers/confirmationModal/linkAction/ViewReviewGuidelinesLinkAction.inc.php +++ b/controllers/confirmationModal/linkAction/ViewReviewGuidelinesLinkAction.inc.php @@ -30,8 +30,8 @@ class ViewReviewGuidelinesLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $stageId int Stage ID of review assignment + * @param Request $request + * @param int $stageId Stage ID of review assignment */ public function __construct($request, $stageId) { diff --git a/controllers/grid/admin/context/ContextGridCellProvider.inc.php b/controllers/grid/admin/context/ContextGridCellProvider.inc.php index f018b46138e..8be1effa8d3 100644 --- a/controllers/grid/admin/context/ContextGridCellProvider.inc.php +++ b/controllers/grid/admin/context/ContextGridCellProvider.inc.php @@ -22,8 +22,8 @@ class ContextGridCellProvider extends GridCellProvider * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/admin/context/ContextGridHandler.inc.php b/controllers/grid/admin/context/ContextGridHandler.inc.php index e186d87bd4e..6ec4b1ae281 100644 --- a/controllers/grid/admin/context/ContextGridHandler.inc.php +++ b/controllers/grid/admin/context/ContextGridHandler.inc.php @@ -203,8 +203,8 @@ public function getPublishChangeEvents() /** * Add a new context. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function createContext($args, $request) { @@ -215,8 +215,8 @@ public function createContext($args, $request) /** * Edit an existing context. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -273,8 +273,8 @@ public function editContext($args, $request) /** * Delete a context. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -300,8 +300,8 @@ public function deleteContext($args, $request) /** * Display users management grid for the given context. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/admin/languages/AdminLanguageGridHandler.inc.php b/controllers/grid/admin/languages/AdminLanguageGridHandler.inc.php index ac9ad7eb64b..de002e6cda6 100644 --- a/controllers/grid/admin/languages/AdminLanguageGridHandler.inc.php +++ b/controllers/grid/admin/languages/AdminLanguageGridHandler.inc.php @@ -187,8 +187,8 @@ protected function loadData($request, $filter) /** * Open a form to select locales for installation. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -203,8 +203,8 @@ public function installLocale($args, $request) /** * Save the install language form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -231,8 +231,8 @@ public function saveInstallLocale($args, $request) /** * Uninstall a locale. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -278,8 +278,8 @@ public function uninstallLocale($args, $request) /** * Enable an existing locale. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -306,8 +306,8 @@ public function enableLocale($args, $request) /** * Disable an existing locale. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -344,8 +344,8 @@ public function disableLocale($args, $request) /** * Set primary locale. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -386,9 +386,9 @@ public function setPrimaryLocale($args, $request) /** * Update the locale support state (enabled or disabled). * - * @param $request Request - * @param $rowId string The locale row id. - * @param $enable boolean Enable locale flag. + * @param Request $request + * @param string $rowId The locale row id. + * @param bool $enable Enable locale flag. */ protected function _updateLocaleSupportState($request, $rowId, $enable) { @@ -425,7 +425,7 @@ protected function _updateLocaleSupportState($request, $rowId, $enable) * Helper function to update locale settings in all * installed contexts, based on site locale settings. * - * @param $request object + * @param object $request */ protected function _updateContextLocaleSettings($request) { @@ -460,9 +460,9 @@ protected function _updateContextLocaleSettings($request) * This grid can also present management functions * if the conditions above are true. * - * @param $request Request + * @param Request $request * - * @return boolean + * @return bool */ protected function _canManage($request) { diff --git a/controllers/grid/admin/plugins/AdminPluginGridHandler.inc.php b/controllers/grid/admin/plugins/AdminPluginGridHandler.inc.php index 85636a7326d..c59ffcf1d7d 100644 --- a/controllers/grid/admin/plugins/AdminPluginGridHandler.inc.php +++ b/controllers/grid/admin/plugins/AdminPluginGridHandler.inc.php @@ -48,9 +48,9 @@ public function getRowInstance() /** * @see GridHandler::authorize() * - * @param $request PKPRequest - * @param $args array - * @param $roleAssignments array + * @param PKPRequest $request + * @param array $args + * @param array $roleAssignments */ public function authorize($request, &$args, $roleAssignments) { diff --git a/controllers/grid/announcements/AnnouncementTypeGridCellProvider.inc.php b/controllers/grid/announcements/AnnouncementTypeGridCellProvider.inc.php index 1873390983c..c353fb3a37a 100644 --- a/controllers/grid/announcements/AnnouncementTypeGridCellProvider.inc.php +++ b/controllers/grid/announcements/AnnouncementTypeGridCellProvider.inc.php @@ -50,8 +50,8 @@ public function getCellActions($request, $row, $column, $position = GridHandler: * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/announcements/AnnouncementTypeGridHandler.inc.php b/controllers/grid/announcements/AnnouncementTypeGridHandler.inc.php index 275ad8a23e4..2a2e2b5eaa6 100644 --- a/controllers/grid/announcements/AnnouncementTypeGridHandler.inc.php +++ b/controllers/grid/announcements/AnnouncementTypeGridHandler.inc.php @@ -145,8 +145,8 @@ protected function getRowInstance() /** * Display form to add announcement type. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return string */ @@ -158,8 +158,8 @@ public function addAnnouncementType($args, $request) /** * Display form to edit an announcement type. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -178,8 +178,8 @@ public function editAnnouncementType($args, $request) /** * Save an edited/inserted announcement type. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -221,8 +221,8 @@ public function updateAnnouncementType($args, $request) /** * Delete an announcement type. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/announcements/form/AnnouncementTypeForm.inc.php b/controllers/grid/announcements/form/AnnouncementTypeForm.inc.php index cc4433f65a5..37266293ef8 100644 --- a/controllers/grid/announcements/form/AnnouncementTypeForm.inc.php +++ b/controllers/grid/announcements/form/AnnouncementTypeForm.inc.php @@ -25,14 +25,14 @@ class AnnouncementTypeForm extends Form /** @var int Context ID */ public $contextId; - /** @var typeId int the ID of the announcement type being edited */ + /** @var int The ID of the announcement type being edited */ public $typeId; /** * Constructor * - * @param $contextId int Context ID - * @param $typeId int leave as default for new announcement type + * @param int $contextId Context ID + * @param int $typeId leave as default for new announcement type */ public function __construct($contextId, $typeId = null) { diff --git a/controllers/grid/eventLog/EventLogGridCellProvider.inc.php b/controllers/grid/eventLog/EventLogGridCellProvider.inc.php index db306037b62..75338821c30 100644 --- a/controllers/grid/eventLog/EventLogGridCellProvider.inc.php +++ b/controllers/grid/eventLog/EventLogGridCellProvider.inc.php @@ -22,13 +22,13 @@ class EventLogGridCellProvider extends DataObjectGridCellProvider { - /** @var boolean Is the current user assigned as an author to this submission */ + /** @var bool Is the current user assigned as an author to this submission */ public $_isCurrentUserAssignedAuthor; /** * Constructor * - * @param boolean $isCurrentUserAssignedAuthor Is the current user assigned + * @param bool $isCurrentUserAssignedAuthor Is the current user assigned * as an author to this submission? */ public function __construct($isCurrentUserAssignedAuthor) @@ -44,8 +44,8 @@ public function __construct($isCurrentUserAssignedAuthor) * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ @@ -87,7 +87,7 @@ public function getTemplateVarsFromRowColumn($row, $column) // Maybe anonymize files submitted by reviewers if (isset($params['fileStage']) && $params['fileStage'] === SubmissionFile::SUBMISSION_FILE_REVIEW_ATTACHMENT) { assert(isset($params['fileId']) && isset($params['submissionId'])); - $submissionFile = Repo::submissionFiles()->get($params['id']); + $submissionFile = Repo::submissionFile()->get($params['id']); if ($submissionFile && $submissionFile->getData('assocType') === ASSOC_TYPE_REVIEW_ASSIGNMENT) { $reviewAssignment = $reviewAssignmentDao->getById($submissionFile->getData('assocId')); if (!$reviewAssignment || in_array($reviewAssignment->getReviewMethod(), [SUBMISSION_REVIEW_METHOD_ANONYMOUS, SUBMISSION_REVIEW_METHOD_DOUBLEANONYMOUS])) { diff --git a/controllers/grid/eventLog/EventLogGridRow.inc.php b/controllers/grid/eventLog/EventLogGridRow.inc.php index f6d12eb29b3..028e4908ce8 100644 --- a/controllers/grid/eventLog/EventLogGridRow.inc.php +++ b/controllers/grid/eventLog/EventLogGridRow.inc.php @@ -26,17 +26,17 @@ class EventLogGridRow extends GridRow { - /** @var Submission **/ + /** @var Submission */ public $_submission; - /** @var boolean Is the current user assigned as an author to this submission */ + /** @var bool Is the current user assigned as an author to this submission */ public $_isCurrentUserAssignedAuthor; /** * Constructor * - * @param $submission Submission - * @param $isCurrentUserAssignedAuthor boolean Is the current user assigned + * @param Submission $submission + * @param bool $isCurrentUserAssignedAuthor Is the current user assigned * as an author to this submission? */ public function __construct($submission, $isCurrentUserAssignedAuthor) @@ -69,7 +69,7 @@ public function initialize($request, $template = null) case SubmissionFileEventLogEntry::SUBMISSION_LOG_FILE_UPLOAD: $submissionFileId = $params['submissionFileId']; $fileId = $params['fileId']; - $submissionFile = Repo::submissionFiles()->get($submissionFileId); + $submissionFile = Repo::submissionFile()->get($submissionFileId); if (!$submissionFile) { break; } @@ -85,7 +85,7 @@ public function initialize($request, $template = null) } } if (!$anonymousAuthor) { - $workflowStageId = Repo::submissionFiles()->getWorkflowStageId($submissionFile); + $workflowStageId = Repo::submissionFile()->getWorkflowStageId($submissionFile); // If a submission file is attached to a query that has been deleted, we cannot // determine its stage. Don't present a download link in this case. if ($workflowStageId || $submissionFile->getData('fileStage') != SubmissionFile::SUBMISSION_FILE_QUERY) { diff --git a/controllers/grid/eventLog/SubmissionEventLogGridHandler.inc.php b/controllers/grid/eventLog/SubmissionEventLogGridHandler.inc.php index 236866c0a73..79994de097b 100644 --- a/controllers/grid/eventLog/SubmissionEventLogGridHandler.inc.php +++ b/controllers/grid/eventLog/SubmissionEventLogGridHandler.inc.php @@ -21,6 +21,7 @@ use PKP\controllers\grid\GridColumn; use PKP\controllers\grid\GridHandler; use PKP\core\JSONMessage; +use PKP\core\PKPString; use PKP\log\EmailLogEntry; use PKP\log\EventLogEntry; use PKP\security\authorization\internal\UserAccessibleWorkflowStageRequiredPolicy; @@ -35,7 +36,7 @@ class SubmissionEventLogGridHandler extends GridHandler /** @var int The current workflow stage */ public $_stageId; - /** @var boolean Is the current user assigned as an author to this submission */ + /** @var bool Is the current user assigned as an author to this submission */ public $_isCurrentUserAssignedAuthor; /** @@ -67,7 +68,7 @@ public function getSubmission() /** * Set the Submission * - * @param $submission Submission + * @param Submission $submission */ public function setSubmission($submission) { @@ -81,9 +82,9 @@ public function setSubmission($submission) /** * @see PKPHandler::authorize() * - * @param $request PKPRequest - * @param $args array - * @param $roleAssignments array + * @param PKPRequest $request + * @param array $args + * @param array $roleAssignments */ public function authorize($request, &$args, $roleAssignments) { @@ -230,8 +231,8 @@ protected function loadData($request, $filter = null) /** * Get the contents of the email * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -245,20 +246,27 @@ public function viewEmail($args, $request) /** * Format the contents of the email * - * @param $emailLogEntry EmailLogEntry + * @param EmailLogEntry $emailLogEntry * * @return string Formatted email */ - public function _formatEmail($emailLogEntry) + public function _formatEmail(EmailLogEntry $emailLogEntry) { - assert($emailLogEntry instanceof EmailLogEntry); - $text = []; $text[] = __('email.from') . ': ' . htmlspecialchars($emailLogEntry->getFrom()); $text[] = __('email.to') . ': ' . htmlspecialchars($emailLogEntry->getRecipients()); + if ($emailLogEntry->getCcs()) { + $text[] = __('email.cc') . ': ' . htmlspecialchars($emailLogEntry->getCcs()); + } + if ($emailLogEntry->getBccs()) { + $text[] = __('email.bcc') . ': ' . htmlspecialchars($emailLogEntry->getBccs()); + } $text[] = __('email.subject') . ': ' . htmlspecialchars($emailLogEntry->getSubject()); - $text[] = $emailLogEntry->getBody(); - return nl2br(PKPString::stripUnsafeHtml(implode(PHP_EOL . PHP_EOL, $text))); + return + '
' + . nl2br(join(PHP_EOL, $text)) . '

' + . PKPString::stripUnsafeHtml($emailLogEntry->getBody()) + . '
'; } } diff --git a/controllers/grid/eventLog/SubmissionFileEventLogGridHandler.inc.php b/controllers/grid/eventLog/SubmissionFileEventLogGridHandler.inc.php index 50e489efa10..8229273d978 100644 --- a/controllers/grid/eventLog/SubmissionFileEventLogGridHandler.inc.php +++ b/controllers/grid/eventLog/SubmissionFileEventLogGridHandler.inc.php @@ -37,7 +37,7 @@ public function getSubmissionFile() /** * Set the submission file * - * @param $submissionFile SubmissionFile + * @param SubmissionFile $submissionFile */ public function setSubmissionFile($submissionFile) { @@ -51,9 +51,9 @@ public function setSubmissionFile($submissionFile) /** * @see PKPHandler::authorize() * - * @param $request PKPRequest - * @param $args array - * @param $roleAssignments array + * @param PKPRequest $request + * @param array $args + * @param array $roleAssignments */ public function authorize($request, &$args, $roleAssignments) { diff --git a/controllers/grid/eventLog/linkAction/EmailLinkAction.inc.php b/controllers/grid/eventLog/linkAction/EmailLinkAction.inc.php index d2491a869d6..3b4cb9cc448 100644 --- a/controllers/grid/eventLog/linkAction/EmailLinkAction.inc.php +++ b/controllers/grid/eventLog/linkAction/EmailLinkAction.inc.php @@ -21,9 +21,9 @@ class EmailLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $modalTitle string Title of the modal - * @param $actionArgs array The action arguments. + * @param Request $request + * @param string $modalTitle Title of the modal + * @param array $actionArgs The action arguments. */ public function __construct($request, $modalTitle, $actionArgs) { diff --git a/controllers/grid/files/FileDateGridColumn.inc.php b/controllers/grid/files/FileDateGridColumn.inc.php index f761ecf8444..43a2c191f77 100644 --- a/controllers/grid/files/FileDateGridColumn.inc.php +++ b/controllers/grid/files/FileDateGridColumn.inc.php @@ -19,13 +19,13 @@ class FileDateGridColumn extends GridColumn { - /** @var boolean */ + /** @var bool */ public $_includeNotes; /** * Constructor * - * @param $includeNotes boolean + * @param bool $includeNotes * without the history tab. */ public function __construct($includeNotes = true) diff --git a/controllers/grid/files/FileNameGridColumn.inc.php b/controllers/grid/files/FileNameGridColumn.inc.php index 7ad04935e85..0c1232725ac 100644 --- a/controllers/grid/files/FileNameGridColumn.inc.php +++ b/controllers/grid/files/FileNameGridColumn.inc.php @@ -19,21 +19,21 @@ class FileNameGridColumn extends GridColumn { - /** @var boolean */ + /** @var bool */ public $_includeNotes; /** @var int */ public $_stageId; - /** @var boolean */ + /** @var bool */ public $_removeHistoryTab; /** * Constructor * - * @param $includeNotes boolean - * @param $stageId int (optional) - * @param $removeHistoryTab boolean (optional) Open the information center + * @param bool $includeNotes + * @param int $stageId (optional) + * @param bool $removeHistoryTab (optional) Open the information center * without the history tab. */ public function __construct($includeNotes = true, $stageId = null, $removeHistoryTab = false) diff --git a/controllers/grid/files/FilesGridDataProvider.inc.php b/controllers/grid/files/FilesGridDataProvider.inc.php index 9549bb5f49f..66ed35319d3 100644 --- a/controllers/grid/files/FilesGridDataProvider.inc.php +++ b/controllers/grid/files/FilesGridDataProvider.inc.php @@ -17,10 +17,10 @@ class FilesGridDataProvider extends GridDataProvider { - /** @var integer */ + /** @var int */ public $_uploaderRoles; - /** @var boolean */ + /** @var bool */ public $_viewableOnly = false; @@ -30,7 +30,7 @@ class FilesGridDataProvider extends GridDataProvider /** * Set the uploader roles. * - * @param $roleAssignments array The grid's + * @param array $roleAssignments The grid's * role assignment from which the uploader roles * will be extracted. */ @@ -53,7 +53,7 @@ public function getUploaderRoles() /** * Load only viewable files flag. * - * @param $viewableOnly boolean + * @param bool $viewableOnly */ public function setViewableOnly($viewableOnly) { @@ -69,7 +69,7 @@ public function setViewableOnly($viewableOnly) * * NB: Must be overridden by subclasses (if implemented). * - * @param $request Request + * @param Request $request * * @return AddFileLinkAction */ @@ -83,7 +83,7 @@ public function getAddFileAction($request) * * NB: Must be overridden by subclasses (if implemented). * - * @param $request Request + * @param Request $request * * @return SelectFilesLinkAction */ diff --git a/controllers/grid/files/LibraryFileGridCategoryRow.inc.php b/controllers/grid/files/LibraryFileGridCategoryRow.inc.php index 161bdc8cdfd..c224573f0c1 100644 --- a/controllers/grid/files/LibraryFileGridCategoryRow.inc.php +++ b/controllers/grid/files/LibraryFileGridCategoryRow.inc.php @@ -19,7 +19,7 @@ class LibraryFileGridCategoryRow extends GridCategoryRow { - /** the context for our Library file manager */ + /** @var Context the context for our Library file manager */ public $_context; /** diff --git a/controllers/grid/files/LibraryFileGridCellProvider.inc.php b/controllers/grid/files/LibraryFileGridCellProvider.inc.php index 63995d1de0f..d8bd18f447b 100644 --- a/controllers/grid/files/LibraryFileGridCellProvider.inc.php +++ b/controllers/grid/files/LibraryFileGridCellProvider.inc.php @@ -23,8 +23,8 @@ class LibraryFileGridCellProvider extends GridCellProvider * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ @@ -43,8 +43,8 @@ public function getTemplateVarsFromRowColumn($row, $column) /** * Get cell actions associated with this row/column combination * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array an array of LinkAction instances */ diff --git a/controllers/grid/files/LibraryFileGridHandler.inc.php b/controllers/grid/files/LibraryFileGridHandler.inc.php index 2ae7051f07a..0629513e489 100644 --- a/controllers/grid/files/LibraryFileGridHandler.inc.php +++ b/controllers/grid/files/LibraryFileGridHandler.inc.php @@ -28,10 +28,10 @@ class LibraryFileGridHandler extends CategoryGridHandler { - /** the context for this grid */ + /** @var Context The context for this grid */ public $_context; - /** whether or not the grid is editable **/ + /** @var bool Whether or not the grid is editable */ public $_canEdit; /** @@ -65,7 +65,7 @@ public function getContext() /** * Can the user edit/add files in this grid? * - * @return boolean + * @return bool */ public function canEdit() { @@ -75,7 +75,7 @@ public function canEdit() /** * Set whether or not the user can edit or add files. * - * @param $canEdit boolean + * @param bool $canEdit */ public function setCanEdit($canEdit) { @@ -86,9 +86,12 @@ public function setCanEdit($canEdit) // Overridden template methods // - /* + /** * Configure the grid + * * @see CategoryGridHandler::initialize + * + * @param null|mixed $args */ public function initialize($request, $args = null) { @@ -193,8 +196,8 @@ public function getFileNameColumn() /** * An action to add a new file * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -213,8 +216,8 @@ public function addFile($args, $request) /** * Save a new library file. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -239,8 +242,8 @@ public function saveFile($args, $request) /** * An action to add a new file * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -262,8 +265,8 @@ public function editFile($args, $request) /** * Save changes to an existing library file. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -291,8 +294,8 @@ public function updateFile($args, $request) /** * Delete a file * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -315,8 +318,8 @@ public function deleteFile($args, $request) /** * Upload a new library file. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -343,7 +346,7 @@ public function uploadFile($args, $request) * Returns a specific instance of the new form for this grid. * Must be implemented by subclasses. * - * @param $context Context + * @param Context $context */ public function _getNewFileForm($context) { @@ -354,8 +357,8 @@ public function _getNewFileForm($context) * Returns a specific instance of the edit form for this grid. * Must be implemented by subclasses. * - * @param $context Press - * @param $fileId int + * @param Press $context + * @param int $fileId */ public function _getEditFileForm($context, $fileId) { diff --git a/controllers/grid/files/LibraryFileGridRow.inc.php b/controllers/grid/files/LibraryFileGridRow.inc.php index cc2a0e9bda0..439e17236f3 100644 --- a/controllers/grid/files/LibraryFileGridRow.inc.php +++ b/controllers/grid/files/LibraryFileGridRow.inc.php @@ -23,10 +23,10 @@ class LibraryFileGridRow extends GridRow /** @var int LIBRARY_FILE_TYPE_... */ public $_fileType; - /** is the grid row read only **/ + /** @var bool is the grid row read only */ public $_canEdit; - /** the submission associated with submission library files **/ + /** @var Submission the submission associated with submission library files */ public $_submission; /** diff --git a/controllers/grid/files/SelectableSubmissionFileListCategoryGridHandler.inc.php b/controllers/grid/files/SelectableSubmissionFileListCategoryGridHandler.inc.php index 2e6de2f46fe..820e93d2efb 100644 --- a/controllers/grid/files/SelectableSubmissionFileListCategoryGridHandler.inc.php +++ b/controllers/grid/files/SelectableSubmissionFileListCategoryGridHandler.inc.php @@ -28,15 +28,15 @@ class SelectableSubmissionFileListCategoryGridHandler extends CategoryGridHandle /** @var FilesGridCapabilities */ public $_capabilities; - /** @var integer */ + /** @var int */ public $_stageId; /** * Constructor * - * @param $dataProvider GridDataProvider - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. - * @param $capabilities integer A bit map with zero or more + * @param GridDataProvider $dataProvider + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. + * @param int $capabilities A bit map with zero or more * FILE_GRID_* capabilities set. */ public function __construct($dataProvider, $stageId, $capabilities = 0) @@ -68,7 +68,7 @@ public function getCapabilities() /** * Get the workflow stage id. * - * @return integer + * @return int */ public function getStageId() { @@ -251,7 +251,7 @@ protected function getRowInstance() /** * Get all files of this grid to download. * - * @param $request Request + * @param Request $request * * @return array */ diff --git a/controllers/grid/files/SubmissionFilesCategoryGridDataProvider.inc.php b/controllers/grid/files/SubmissionFilesCategoryGridDataProvider.inc.php index 5900acbc218..acfbcebcb5e 100644 --- a/controllers/grid/files/SubmissionFilesCategoryGridDataProvider.inc.php +++ b/controllers/grid/files/SubmissionFilesCategoryGridDataProvider.inc.php @@ -26,11 +26,11 @@ class SubmissionFilesCategoryGridDataProvider extends CategoryGridDataProvider /** * Constructor * - * @param $fileStage int The current file stage that the grid is handling + * @param int $fileStage The current file stage that the grid is handling * (others file stages could be shown activating the grid filter, but this * is the file stage that will be used to bring files from other stages, upload * new file, etc). - * @param $dataProviderInitParams array Other parameters to initiate the grid + * @param array $dataProviderInitParams Other parameters to initiate the grid * data provider that this category grid data provider will use to implement * common behaviours and data. */ @@ -110,12 +110,12 @@ public function loadCategoryData($request, $categoryDataElement, $filter = null, $reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $stageId); } if ($reviewRound) { - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$submission->getId()]) ->filterByReviewRoundIds([$reviewRound->getId()]) ->filterByFileStages([$fileStage]); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); $stageSubmissionFiles = iterator_to_array($submissionFilesIterator); } else { $stageSubmissionFiles = []; @@ -123,10 +123,10 @@ public function loadCategoryData($request, $categoryDataElement, $filter = null, } else { // Filter the passed workflow stage files. if (!$this->_submissionFiles) { - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$submission->getId()]); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); $this->_submissionFiles = iterator_to_array($submissionFilesIterator); } $submissionFiles = $this->_submissionFiles; @@ -193,8 +193,8 @@ public function getFileStage() * Init the grid data provider that this category grid data provider * will use and return it. Override this to initiate another grid data provider. * - * @param $fileStage int - * @param $initParams array (optional) The parameters to initiate the grid data provider. + * @param int $fileStage + * @param array $initParams (optional) The parameters to initiate the grid data provider. * * @return SubmissionFilesGridDataProvider */ @@ -215,7 +215,7 @@ public function initGridDataProvider($fileStage, $initParams = null) * which file stage will be present on each workflow stage category * of the grid. * - * @param $stageId int + * @param int $stageId * * @return int|array */ diff --git a/controllers/grid/files/SubmissionFilesGridDataProvider.inc.php b/controllers/grid/files/SubmissionFilesGridDataProvider.inc.php index d067db2436d..ccbbab7a8e7 100644 --- a/controllers/grid/files/SubmissionFilesGridDataProvider.inc.php +++ b/controllers/grid/files/SubmissionFilesGridDataProvider.inc.php @@ -19,18 +19,18 @@ class SubmissionFilesGridDataProvider extends FilesGridDataProvider { - /** @var integer */ + /** @var int */ public $_stageId; - /** @var integer */ + /** @var int */ public $_fileStage; /** * Constructor * - * @param $fileStage integer One of the SubmissionFile::SUBMISSION_FILE_* constants. - * @param $viewableOnly boolean True iff only viewable files should be included. + * @param int $fileStage One of the SubmissionFile::SUBMISSION_FILE_* constants. + * @param bool $viewableOnly True iff only viewable files should be included. */ public function __construct($fileStage, $viewableOnly = false) { @@ -48,7 +48,7 @@ public function __construct($fileStage, $viewableOnly = false) /** * Set the workflow stage. * - * @param $stageId int WORKFLOW_STAGE_ID_... + * @param int $stageId WORKFLOW_STAGE_ID_... */ public function setStageId($stageId) { @@ -58,7 +58,7 @@ public function setStageId($stageId) /** * Get the workflow stage. * - * @return integer WORKFLOW_STAGE_ID_... + * @return int WORKFLOW_STAGE_ID_... */ public function getStageId() { @@ -85,7 +85,7 @@ public function getRequestArgs() /** * Get the file stage. * - * @return integer SubmissionFile::SUBMISSION_FILE_... + * @return int SubmissionFile::SUBMISSION_FILE_... */ public function getFileStage() { @@ -97,11 +97,11 @@ public function getFileStage() */ public function loadData($filter = []) { - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$this->getSubmission()->getId()]) ->filterByFileStages([$this->getFileStage()]); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); return $this->prepareSubmissionFileData(iterator_to_array($submissionFilesIterator), $this->_viewableOnly, $filter); } @@ -144,8 +144,8 @@ public function getAddFileAction($request) /** * Apply the filter to the list of revisions, returning only matching elements. * - * @param $revisions array List of potential submission files to include. - * @param $filter array Associative array of filter data + * @param array $revisions List of potential submission files to include. + * @param array $filter Associative array of filter data * * @return array */ @@ -170,9 +170,9 @@ protected function applyFilter($revisions, $filter) * data wrapped into an array so that grid implementations * can add further data. * - * @param $revisions array List of SubmissionFiles - * @param $viewableOnly boolean optional True iff only viewable files should be listed - * @param $filter array optional Associative array of filter conditions + * @param array $revisions List of SubmissionFiles + * @param bool $viewableOnly optional True iff only viewable files should be listed + * @param array $filter optional Associative array of filter conditions * * @return array */ diff --git a/controllers/grid/files/SubmissionFilesGridHandler.inc.php b/controllers/grid/files/SubmissionFilesGridHandler.inc.php index cfd349586a2..5906164501f 100644 --- a/controllers/grid/files/SubmissionFilesGridHandler.inc.php +++ b/controllers/grid/files/SubmissionFilesGridHandler.inc.php @@ -26,15 +26,15 @@ class SubmissionFilesGridHandler extends GridHandler /** @var FilesGridCapabilities */ public $_capabilities; - /** @var integer */ + /** @var int */ public $_stageId; /** * Constructor * - * @param $dataProvider GridDataProvider - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. - * @param $capabilities integer A bit map with zero or more + * @param GridDataProvider $dataProvider + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. + * @param int $capabilities A bit map with zero or more * FILE_GRID_* capabilities set. */ public function __construct($dataProvider, $stageId, $capabilities = 0) @@ -64,7 +64,7 @@ public function getCapabilities() /** * Set grid capabilities object. * - * @param $capabilities FilesGridCapabilities + * @param FilesGridCapabilities $capabilities */ public function setCapabilities($capabilities) { @@ -74,7 +74,7 @@ public function setCapabilities($capabilities) /** * Get the workflow stage id. * - * @return integer + * @return int */ public function getStageId() { @@ -207,7 +207,7 @@ public function getFilterSelectionData($request) /** * Get which columns can be used by users to filter data. * - * @return Array + * @return array */ protected function getFilterColumns() { diff --git a/controllers/grid/files/SubmissionFilesGridRow.inc.php b/controllers/grid/files/SubmissionFilesGridRow.inc.php index 2afeebe5c69..4c560ec4fad 100644 --- a/controllers/grid/files/SubmissionFilesGridRow.inc.php +++ b/controllers/grid/files/SubmissionFilesGridRow.inc.php @@ -26,8 +26,8 @@ class SubmissionFilesGridRow extends GridRow /** * Constructor * - * @param $capabilities FilesGridCapabilities - * @param $stageId int Stage ID (optional) + * @param FilesGridCapabilities $capabilities + * @param int $stageId Stage ID (optional) */ public function __construct($capabilities = null, $stageId = null) { @@ -43,7 +43,7 @@ public function __construct($capabilities = null, $stageId = null) /** * Can the user delete files from this grid? * - * @return boolean + * @return bool */ public function canDelete() { @@ -53,7 +53,7 @@ public function canDelete() /** * Can the user view file notes on this grid? * - * @return boolean + * @return bool */ public function canViewNotes() { @@ -63,7 +63,7 @@ public function canViewNotes() /** * Can the user manage files in this grid? * - * @return boolean + * @return bool */ public function canEdit() { diff --git a/controllers/grid/files/attachment/EditorSelectableReviewAttachmentsGridHandler.inc.php b/controllers/grid/files/attachment/EditorSelectableReviewAttachmentsGridHandler.inc.php deleted file mode 100644 index 2b59e4eaa9d..00000000000 --- a/controllers/grid/files/attachment/EditorSelectableReviewAttachmentsGridHandler.inc.php +++ /dev/null @@ -1,66 +0,0 @@ -addRoleAssignment( - [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], - ['fetchGrid', 'fetchRow'] - ); - - // Set the grid title. - $this->setTitle('grid.reviewAttachments.send.title'); - } - - /** - * @copydoc GridHandler::isDataElementSelected() - */ - public function isDataElementSelected($gridDataElement) - { - $file = $gridDataElement['submissionFile']; - switch ($file->getFileStage()) { - case SubmissionFile::SUBMISSION_FILE_ATTACHMENT: return true; - case SubmissionFile::SUBMISSION_FILE_REVIEW_FILE: return false; - } - return $file->getViewable(); - } - - /** - * @copydoc SelectableFileListGridHandler::getSelectName() - */ - public function getSelectName() - { - return 'selectedAttachments'; - } -} diff --git a/controllers/grid/files/attachment/ReviewerReviewAttachmentGridDataProvider.inc.php b/controllers/grid/files/attachment/ReviewerReviewAttachmentGridDataProvider.inc.php index c24c8c5a203..6af683206c3 100644 --- a/controllers/grid/files/attachment/ReviewerReviewAttachmentGridDataProvider.inc.php +++ b/controllers/grid/files/attachment/ReviewerReviewAttachmentGridDataProvider.inc.php @@ -21,7 +21,7 @@ class ReviewerReviewAttachmentGridDataProvider extends SubmissionFilesGridDataProvider { - /** @var integer */ + /** @var int */ public $_reviewId; /** @@ -85,13 +85,13 @@ public function getRequestArgs() */ public function loadData($filter = []) { - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterByAssoc( ASSOC_TYPE_REVIEW_ASSIGNMENT, [$this->_getReviewId()] )->filterBySubmissionIds([$this->getSubmission()->getId()]); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); return $this->prepareSubmissionFileData(iterator_to_array($submissionFilesIterator), false, $filter); } @@ -126,7 +126,7 @@ public function getAddFileAction($request) /** * Get the review id. * - * @return integer + * @return int */ public function _getReviewId() { diff --git a/controllers/grid/files/copyedit/CopyeditFilesGridHandler.inc.php b/controllers/grid/files/copyedit/CopyeditFilesGridHandler.inc.php index 70b31437018..eed3680585e 100644 --- a/controllers/grid/files/copyedit/CopyeditFilesGridHandler.inc.php +++ b/controllers/grid/files/copyedit/CopyeditFilesGridHandler.inc.php @@ -81,8 +81,8 @@ public function initialize($request, $args = null) /** * Show the form to allow the user to select files from previous stages * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/files/copyedit/ManageCopyeditFilesGridHandler.inc.php b/controllers/grid/files/copyedit/ManageCopyeditFilesGridHandler.inc.php index 92d64145967..27b9d4b0b21 100644 --- a/controllers/grid/files/copyedit/ManageCopyeditFilesGridHandler.inc.php +++ b/controllers/grid/files/copyedit/ManageCopyeditFilesGridHandler.inc.php @@ -63,8 +63,8 @@ public function __construct() /** * Save 'manage copyedited files' form * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/files/copyedit/SelectableCopyeditFilesGridHandler.inc.php b/controllers/grid/files/copyedit/SelectableCopyeditFilesGridHandler.inc.php deleted file mode 100644 index 675ea596056..00000000000 --- a/controllers/grid/files/copyedit/SelectableCopyeditFilesGridHandler.inc.php +++ /dev/null @@ -1,56 +0,0 @@ -addRoleAssignment( - [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], - ['fetchGrid', 'fetchRow'] - ); - - // Set the grid title. - $this->setTitle('submission.copyedited'); - } - - // - // Implemented methods from GridHandler. - // - /** - * @copydoc GridHandler::isDataElementSelected() - */ - public function isDataElementSelected($gridDataElement) - { - return true; - } -} diff --git a/controllers/grid/files/copyedit/form/ManageCopyeditFilesForm.inc.php b/controllers/grid/files/copyedit/form/ManageCopyeditFilesForm.inc.php index 5be25cf6874..45cf20e56cd 100644 --- a/controllers/grid/files/copyedit/form/ManageCopyeditFilesForm.inc.php +++ b/controllers/grid/files/copyedit/form/ManageCopyeditFilesForm.inc.php @@ -22,7 +22,7 @@ class ManageCopyeditFilesForm extends ManageSubmissionFilesForm /** * Constructor. * - * @param $submissionId int Submission ID. + * @param int $submissionId Submission ID. */ public function __construct($submissionId) { @@ -32,8 +32,8 @@ public function __construct($submissionId) /** * Save selection of copyedited files * - * @param $stageSubmissionFiles array List of submission files in this stage. - * @param $fileStage int SubmissionFile::SUBMISSION_FILE_... + * @param array $stageSubmissionFiles List of submission files in this stage. + * @param int $fileStage SubmissionFile::SUBMISSION_FILE_... */ public function execute($stageSubmissionFiles, $fileStage = null) { diff --git a/controllers/grid/files/dependent/DependentFilesGridDataProvider.inc.php b/controllers/grid/files/dependent/DependentFilesGridDataProvider.inc.php index a805281e884..a21ba4c7e2e 100644 --- a/controllers/grid/files/dependent/DependentFilesGridDataProvider.inc.php +++ b/controllers/grid/files/dependent/DependentFilesGridDataProvider.inc.php @@ -30,7 +30,7 @@ class DependentFilesGridDataProvider extends SubmissionFilesGridDataProvider /** * Constructor * - * @param $assocId int Association ID + * @param int $assocId Association ID */ public function __construct($assocId) { @@ -46,7 +46,7 @@ public function loadData($filter = []) { // Retrieve all dependent files for the given file stage and original submission file id (i.e. the main galley/production file) $submission = $this->getSubmission(); - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterByAssoc( ASSOC_TYPE_SUBMISSION_FILE, @@ -54,7 +54,7 @@ public function loadData($filter = []) )->filterBySubmissionIds([$submission->getId()]) ->filterByFileStages([$this->getFileStage()]) ->includeDependentFiles(); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); return $this->prepareSubmissionFileData(iterator_to_array($submissionFilesIterator), $this->_viewableOnly, $filter); } diff --git a/controllers/grid/files/fileList/FileListGridHandler.inc.php b/controllers/grid/files/fileList/FileListGridHandler.inc.php index e454b5b8f5d..6dacb5bb2d5 100644 --- a/controllers/grid/files/fileList/FileListGridHandler.inc.php +++ b/controllers/grid/files/fileList/FileListGridHandler.inc.php @@ -25,9 +25,9 @@ class FileListGridHandler extends SubmissionFilesGridHandler /** * Constructor * - * @param $dataProvider GridDataProvider - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. - * @param $capabilities integer A bit map with zero or more + * @param GridDataProvider $dataProvider + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. + * @param int $capabilities A bit map with zero or more * FILE_GRID_* capabilities set. */ public function __construct($dataProvider, $stageId, $capabilities = 0) diff --git a/controllers/grid/files/fileList/SelectableFileListGridHandler.inc.php b/controllers/grid/files/fileList/SelectableFileListGridHandler.inc.php index 30ea8bf59f6..e3e311f849e 100644 --- a/controllers/grid/files/fileList/SelectableFileListGridHandler.inc.php +++ b/controllers/grid/files/fileList/SelectableFileListGridHandler.inc.php @@ -23,9 +23,9 @@ class SelectableFileListGridHandler extends FileListGridHandler /** * Constructor * - * @param $dataProvider GridDataProvider - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. - * @param $capabilities integer A bit map with zero or more + * @param GridDataProvider $dataProvider + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. + * @param int $capabilities A bit map with zero or more * FILE_GRID_* capabilities set. */ public function __construct($dataProvider, $stageId, $capabilities = 0) diff --git a/controllers/grid/files/fileList/linkAction/DownloadAllLinkAction.inc.php b/controllers/grid/files/fileList/linkAction/DownloadAllLinkAction.inc.php index f5c7c5ce364..4cc52ec0282 100644 --- a/controllers/grid/files/fileList/linkAction/DownloadAllLinkAction.inc.php +++ b/controllers/grid/files/fileList/linkAction/DownloadAllLinkAction.inc.php @@ -24,8 +24,8 @@ class DownloadAllLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $actionArgs array + * @param Request $request + * @param array $actionArgs */ public function __construct($request, $actionArgs) { diff --git a/controllers/grid/files/fileList/linkAction/SelectFilesLinkAction.inc.php b/controllers/grid/files/fileList/linkAction/SelectFilesLinkAction.inc.php index 499f049d7eb..60c18836340 100644 --- a/controllers/grid/files/fileList/linkAction/SelectFilesLinkAction.inc.php +++ b/controllers/grid/files/fileList/linkAction/SelectFilesLinkAction.inc.php @@ -21,11 +21,11 @@ class SelectFilesLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $actionArgs array The parameters required by the + * @param Request $request + * @param array $actionArgs The parameters required by the * link action target to identify a list of files. - * @param $actionLabel string The localized label of the link action. - * @param $modalTitle string the (optional) title to be used for the modal. + * @param string $actionLabel The localized label of the link action. + * @param string $modalTitle the (optional) title to be used for the modal. */ public function __construct($request, $actionArgs, $actionLabel, $modalTitle = null) { diff --git a/controllers/grid/files/fileList/linkAction/SelectReviewFilesLinkAction.inc.php b/controllers/grid/files/fileList/linkAction/SelectReviewFilesLinkAction.inc.php index 0237fc809ea..325614a0aff 100644 --- a/controllers/grid/files/fileList/linkAction/SelectReviewFilesLinkAction.inc.php +++ b/controllers/grid/files/fileList/linkAction/SelectReviewFilesLinkAction.inc.php @@ -20,11 +20,11 @@ class SelectReviewFilesLinkAction extends SelectFilesLinkAction /** * Constructor * - * @param $request Request - * @param $reviewRound ReviewRound The review round from which to + * @param Request $request + * @param ReviewRound $reviewRound The review round from which to * select review files. - * @param $actionLabel string The localized label of the link action. - * @param $modalTitle string the (optional) title to be used for the modal. + * @param string $actionLabel The localized label of the link action. + * @param string $modalTitle the (optional) title to be used for the modal. */ public function __construct($request, $reviewRound, $actionLabel, $modalTitle = null) { diff --git a/controllers/grid/files/final/FinalDraftFilesGridHandler.inc.php b/controllers/grid/files/final/FinalDraftFilesGridHandler.inc.php index d59037ed947..47df1fa3e22 100644 --- a/controllers/grid/files/final/FinalDraftFilesGridHandler.inc.php +++ b/controllers/grid/files/final/FinalDraftFilesGridHandler.inc.php @@ -53,8 +53,8 @@ public function __construct() /** * Show the form to allow the user to select files from previous stages * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/files/final/ManageFinalDraftFilesGridHandler.inc.php b/controllers/grid/files/final/ManageFinalDraftFilesGridHandler.inc.php index 9b8af460669..4020731d3eb 100644 --- a/controllers/grid/files/final/ManageFinalDraftFilesGridHandler.inc.php +++ b/controllers/grid/files/final/ManageFinalDraftFilesGridHandler.inc.php @@ -60,8 +60,8 @@ public function __construct() /** * Save 'manage final draft files' form * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/files/final/SelectableFinalDraftFilesGridHandler.inc.php b/controllers/grid/files/final/SelectableFinalDraftFilesGridHandler.inc.php deleted file mode 100644 index 72533ffaf64..00000000000 --- a/controllers/grid/files/final/SelectableFinalDraftFilesGridHandler.inc.php +++ /dev/null @@ -1,54 +0,0 @@ -addRoleAssignment( - [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], - ['fetchGrid', 'fetchRow'] - ); - - // Set the grid title. - $this->setTitle('submission.finalDraft'); - } - - // - // Implemented methods from GridHandler. - // - /** - * @copydoc GridHandler::isDataElementSelected() - */ - public function isDataElementSelected($gridDataElement) - { - return false; - } -} diff --git a/controllers/grid/files/final/form/ManageFinalDraftFilesForm.inc.php b/controllers/grid/files/final/form/ManageFinalDraftFilesForm.inc.php index 7c29d916e7d..794d9aae5cb 100644 --- a/controllers/grid/files/final/form/ManageFinalDraftFilesForm.inc.php +++ b/controllers/grid/files/final/form/ManageFinalDraftFilesForm.inc.php @@ -22,7 +22,7 @@ class ManageFinalDraftFilesForm extends ManageSubmissionFilesForm /** * Constructor. * - * @param $submissionId int Submission ID. + * @param int $submissionId Submission ID. */ public function __construct($submissionId) { @@ -36,9 +36,9 @@ public function __construct($submissionId) /** * Save Selection of Final Draft files * - * @param $stageSubmissionFiles array The files that belongs to a file stage + * @param array $stageSubmissionFiles The files that belongs to a file stage * that is currently being used by a grid inside this form. - * @param $fileStage int SubmissionFile::SUBMISSION_FILE_... + * @param int $fileStage SubmissionFile::SUBMISSION_FILE_... * * @return array a list of all submission files marked as "final". */ diff --git a/controllers/grid/files/form/LibraryFileForm.inc.php b/controllers/grid/files/form/LibraryFileForm.inc.php index bcba87126f4..e7321b34025 100644 --- a/controllers/grid/files/form/LibraryFileForm.inc.php +++ b/controllers/grid/files/form/LibraryFileForm.inc.php @@ -20,17 +20,17 @@ class LibraryFileForm extends Form { - /** the id of the context this library file is attached to */ + /** @var int the id of the context this library file is attached to */ public $contextId; - /** the library file manager instantiated in this form. */ + /** @var LibraryFileManager the library file manager instantiated in this form. */ public $libraryFileManager; /** * Constructor. * - * @param $template string - * @param $contextId int + * @param string $template + * @param int $contextId */ public function __construct($template, $contextId) { diff --git a/controllers/grid/files/form/ManageSubmissionFilesForm.inc.php b/controllers/grid/files/form/ManageSubmissionFilesForm.inc.php index 268e383327e..723c25e2dc2 100644 --- a/controllers/grid/files/form/ManageSubmissionFilesForm.inc.php +++ b/controllers/grid/files/form/ManageSubmissionFilesForm.inc.php @@ -19,14 +19,14 @@ class ManageSubmissionFilesForm extends Form { - /** @var int **/ + /** @var int */ public $_submissionId; /** * Constructor. * - * @param $submissionId int Submission ID - * @param $template string Template filename + * @param int $submissionId Submission ID + * @param string $template Template filename */ public function __construct($submissionId, $template) { @@ -75,17 +75,17 @@ public function readInputData() /** * Save selection of submission files * - * @param $stageSubmissionFiles array The files that belongs to a file stage + * @param array $stageSubmissionFiles The files that belongs to a file stage * that is currently being used by a grid inside this form. - * @param $fileStage int SubmissionFile::SUBMISSION_FILE_... + * @param int $fileStage SubmissionFile::SUBMISSION_FILE_... */ public function execute($stageSubmissionFiles = null, $fileStage = null, ...$functionArgs) { $selectedFiles = (array)$this->getData('selectedFiles'); - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$this->getSubmissionId()]); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); foreach ($submissionFilesIterator as $submissionFile) { // Get the viewable flag value. @@ -98,7 +98,7 @@ public function execute($stageSubmissionFiles = null, $fileStage = null, ...$fun if ($this->fileExistsInStage($submissionFile, $stageSubmissionFiles, $fileStage)) { // ...update the "viewable" flag accordingly. if ($isViewable != $submissionFile->getData('viewable')) { - $submissionFile = Repo::submissionFiles() + $submissionFile = Repo::submissionFile() ->edit( $submissionFile, ['viewable' => $isViewable] @@ -116,9 +116,9 @@ public function execute($stageSubmissionFiles = null, $fileStage = null, ...$fun /** * Determine if a file with the same file stage is already present in the workflow stage. * - * @param $submissionFile SubmissionFile The submission file - * @param $stageSubmissionFiles array The list of submission files in the stage. - * @param $fileStage int FILE_STAGE_... + * @param SubmissionFile $submissionFile The submission file + * @param array $stageSubmissionFiles The list of submission files in the stage. + * @param int $fileStage FILE_STAGE_... */ protected function fileExistsInStage($submissionFile, $stageSubmissionFiles, $fileStage) { @@ -136,8 +136,8 @@ protected function fileExistsInStage($submissionFile, $stageSubmissionFiles, $fi /** * Make a copy of the file to the specified file stage. * - * @param $submissionFile SubmissionFile - * @param $fileStage int SubmissionFile::SUBMISSION_FILE_... + * @param SubmissionFile $submissionFile + * @param int $fileStage SubmissionFile::SUBMISSION_FILE_... * * @return SubmissionFile Resultant new submission file */ @@ -146,8 +146,8 @@ protected function importFile($submissionFile, $fileStage) $newSubmissionFile = clone $submissionFile; $newSubmissionFile->setData('fileStage', $fileStage); $newSubmissionFile->setData('sourceSubmissionFileId', $submissionFile->getId()); - $newSubmissionFileId = Repo::submissionFiles()->add($newSubmissionFile); + $newSubmissionFileId = Repo::submissionFile()->add($newSubmissionFile); - return Repo::submissionFiles()->get($newSubmissionFileId); + return Repo::submissionFile()->get($newSubmissionFileId); } } diff --git a/controllers/grid/files/proof/ManageProofFilesGridHandler.inc.php b/controllers/grid/files/proof/ManageProofFilesGridHandler.inc.php index f92e03af388..42e95ff4fe6 100644 --- a/controllers/grid/files/proof/ManageProofFilesGridHandler.inc.php +++ b/controllers/grid/files/proof/ManageProofFilesGridHandler.inc.php @@ -84,8 +84,8 @@ public function getRequestArgs() /** * Save 'manage proof files' form * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/files/proof/form/ManageProofFilesForm.inc.php b/controllers/grid/files/proof/form/ManageProofFilesForm.inc.php index e63f5b3c083..164b3389658 100644 --- a/controllers/grid/files/proof/form/ManageProofFilesForm.inc.php +++ b/controllers/grid/files/proof/form/ManageProofFilesForm.inc.php @@ -27,9 +27,9 @@ class ManageProofFilesForm extends ManageSubmissionFilesForm /** * Constructor. * - * @param $submissionId int Submission ID. - * @param $publicationId int Publication ID - * @param $representationId int Representation ID. + * @param int $submissionId Submission ID. + * @param int $publicationId Publication ID + * @param int $representationId Representation ID. */ public function __construct($submissionId, $publicationId, $representationId) { diff --git a/controllers/grid/files/query/ManageQueryNoteFilesGridHandler.inc.php b/controllers/grid/files/query/ManageQueryNoteFilesGridHandler.inc.php index 9ea9b02edc9..c86e8b79bd5 100644 --- a/controllers/grid/files/query/ManageQueryNoteFilesGridHandler.inc.php +++ b/controllers/grid/files/query/ManageQueryNoteFilesGridHandler.inc.php @@ -83,8 +83,8 @@ public function isDataElementInCategorySelected($categoryDataId, &$gridDataEleme /** * Save 'manage query files' form * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/files/query/QueryNoteFilesGridDataProvider.inc.php b/controllers/grid/files/query/QueryNoteFilesGridDataProvider.inc.php index 4c9597bcc64..e1eac6e84e6 100644 --- a/controllers/grid/files/query/QueryNoteFilesGridDataProvider.inc.php +++ b/controllers/grid/files/query/QueryNoteFilesGridDataProvider.inc.php @@ -29,7 +29,7 @@ class QueryNoteFilesGridDataProvider extends SubmissionFilesGridDataProvider /** * Constructor * - * @param $noteId int Note ID + * @param int $noteId Note ID */ public function __construct($noteId) { @@ -79,14 +79,14 @@ public function loadData($filter = []) throw new Exception('Invalid note ID specified!'); } - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterByAssoc( ASSOC_TYPE_NOTE, [$this->_noteId] )->filterBySubmissionIds([$submission->getId()]) ->filterByFileStages([(int) $this->getFileStage()]); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); return $this->prepareSubmissionFileData(iterator_to_array($submissionFilesIterator), $this->_viewableOnly, $filter); } diff --git a/controllers/grid/files/query/QueryNoteFilesGridHandler.inc.php b/controllers/grid/files/query/QueryNoteFilesGridHandler.inc.php index 6dbecca4100..99e74c2e0c2 100644 --- a/controllers/grid/files/query/QueryNoteFilesGridHandler.inc.php +++ b/controllers/grid/files/query/QueryNoteFilesGridHandler.inc.php @@ -77,8 +77,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Show the form to allow the user to select files from previous stages * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/files/query/form/ManageQueryNoteFilesForm.inc.php b/controllers/grid/files/query/form/ManageQueryNoteFilesForm.inc.php index e00796f23ba..1dcc161cb6f 100644 --- a/controllers/grid/files/query/form/ManageQueryNoteFilesForm.inc.php +++ b/controllers/grid/files/query/form/ManageQueryNoteFilesForm.inc.php @@ -33,10 +33,10 @@ class ManageQueryNoteFilesForm extends ManageSubmissionFilesForm /** * Constructor. * - * @param $submissionId int Submission ID. - * @param $queryId int Query ID. - * @param $noteId int Note ID. - * @param $actionArgs array Optional list of extra request parameters. + * @param int $submissionId Submission ID. + * @param int $queryId Query ID. + * @param int $noteId Note ID. + * @param array $actionArgs Optional list of extra request parameters. */ public function __construct($submissionId, $queryId, $noteId, $actionArgs = []) { @@ -65,8 +65,8 @@ public function fetch($request, $template = null, $display = false) /** * Save selection of query files * - * @param $stageSubmissionFiles array The list of submission files in the stage. - * @param $fileStage int SubmissionFile::SUBMISSION_FILE_... + * @param array $stageSubmissionFiles The list of submission files in the stage. + * @param int $fileStage SubmissionFile::SUBMISSION_FILE_... */ public function execute($stageSubmissionFiles, $fileStage = null) { diff --git a/controllers/grid/files/review/EditorReviewFilesGridHandler.inc.php b/controllers/grid/files/review/EditorReviewFilesGridHandler.inc.php index 4ca42fc564b..5e3f065c646 100644 --- a/controllers/grid/files/review/EditorReviewFilesGridHandler.inc.php +++ b/controllers/grid/files/review/EditorReviewFilesGridHandler.inc.php @@ -54,8 +54,8 @@ public function __construct() * * FIXME: Move to its own handler so that it can be re-used among grids. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/files/review/ManageReviewFilesGridHandler.inc.php b/controllers/grid/files/review/ManageReviewFilesGridHandler.inc.php index 276cf6f41bb..f2098e55774 100644 --- a/controllers/grid/files/review/ManageReviewFilesGridHandler.inc.php +++ b/controllers/grid/files/review/ManageReviewFilesGridHandler.inc.php @@ -58,8 +58,8 @@ public function __construct() /** * Save 'manage review files' form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/files/review/ReviewCategoryGridDataProvider.inc.php b/controllers/grid/files/review/ReviewCategoryGridDataProvider.inc.php index c252e63e902..87cb6b788be 100644 --- a/controllers/grid/files/review/ReviewCategoryGridDataProvider.inc.php +++ b/controllers/grid/files/review/ReviewCategoryGridDataProvider.inc.php @@ -20,8 +20,8 @@ class ReviewCategoryGridDataProvider extends SubmissionFilesCategoryGridDataProv /** * Constructor * - * @param $fileStage int - * @param $viewableOnly int Will be passed to the review grid data provider. + * @param int $fileStage + * @param int $viewableOnly Will be passed to the review grid data provider. * See parameter description there. */ public function __construct($fileStage, $viewableOnly = false) diff --git a/controllers/grid/files/review/ReviewGridDataProvider.inc.php b/controllers/grid/files/review/ReviewGridDataProvider.inc.php index a81d1f1e85a..a8c1e2f2357 100644 --- a/controllers/grid/files/review/ReviewGridDataProvider.inc.php +++ b/controllers/grid/files/review/ReviewGridDataProvider.inc.php @@ -19,7 +19,7 @@ class ReviewGridDataProvider extends SubmissionFilesGridDataProvider { - /** @var boolean */ + /** @var bool */ protected $_showAll; /** @@ -27,7 +27,7 @@ class ReviewGridDataProvider extends SubmissionFilesGridDataProvider * * @copydoc SubmissionFilesGridDataProvider::__construct() * - * @param $showAll boolean True iff all review round files should be included. + * @param bool $showAll True iff all review round files should be included. */ public function __construct($fileStageId, $viewableOnly = false, $showAll = false) { @@ -73,7 +73,7 @@ public function getRequestArgs() public function loadData($filter = []) { // Get all review files assigned to this submission. - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$this->getSubmission()->getId()]) ->filterByReviewRoundIds([$this->getReviewRound()->getId()]); @@ -82,7 +82,7 @@ public function loadData($filter = []) $collector = $collector->filterByFileStages([(int) $this->getFileStage()]); } - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); return $this->prepareSubmissionFileData(iterator_to_array($submissionFilesIterator), $this->_viewableOnly, $filter); } diff --git a/controllers/grid/files/review/ReviewRevisionsGridDataProvider.inc.php b/controllers/grid/files/review/ReviewRevisionsGridDataProvider.inc.php index 6c07064fa90..56ef7961f0d 100644 --- a/controllers/grid/files/review/ReviewRevisionsGridDataProvider.inc.php +++ b/controllers/grid/files/review/ReviewRevisionsGridDataProvider.inc.php @@ -41,13 +41,13 @@ public function loadData($filter = []) { // Grab the files that are new (incoming) revisions // of those currently assigned to the review round. - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$this->getSubmission()->getId()]) ->filterByReviewRoundIds([$this->getReviewRound()->getId()]) ->filterByFileStages([(int) $this->getFileStage()]); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); return $this->prepareSubmissionFileData(iterator_to_array($submissionFilesIterator), false, $filter); } diff --git a/controllers/grid/files/review/ReviewerReviewFilesGridDataProvider.inc.php b/controllers/grid/files/review/ReviewerReviewFilesGridDataProvider.inc.php index 349de05521c..a28148069d8 100644 --- a/controllers/grid/files/review/ReviewerReviewFilesGridDataProvider.inc.php +++ b/controllers/grid/files/review/ReviewerReviewFilesGridDataProvider.inc.php @@ -64,7 +64,7 @@ public function getAuthorizationPolicy($request, $args, $roleAssignments) * Extend the parent class to filter out review round files that aren't allowed * for this reviewer according to ReviewFilesDAO. * - * @param $filter array + * @param array $filter */ public function loadData($filter = []) { diff --git a/controllers/grid/files/review/SelectableReviewRevisionsGridHandler.inc.php b/controllers/grid/files/review/SelectableReviewRevisionsGridHandler.inc.php deleted file mode 100644 index 83d16b4fa4e..00000000000 --- a/controllers/grid/files/review/SelectableReviewRevisionsGridHandler.inc.php +++ /dev/null @@ -1,56 +0,0 @@ -addRoleAssignment( - [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], - ['fetchGrid', 'fetchRow'] - ); - - // Set the grid information. - $this->setTitle('editor.submission.revisions'); - } - - // - // Implemented methods from GridHandler. - // - /** - * @copydoc GridHandler::isDataElementSelected() - */ - public function isDataElementSelected($gridDataElement) - { - return true; - } -} diff --git a/controllers/grid/files/review/form/ManageReviewFilesForm.inc.php b/controllers/grid/files/review/form/ManageReviewFilesForm.inc.php index 26a9953f2cd..d1629d49734 100644 --- a/controllers/grid/files/review/form/ManageReviewFilesForm.inc.php +++ b/controllers/grid/files/review/form/ManageReviewFilesForm.inc.php @@ -21,10 +21,10 @@ class ManageReviewFilesForm extends ManageSubmissionFilesForm { - /** @var int **/ + /** @var int */ public $_stageId; - /** @var int **/ + /** @var int */ public $_reviewRoundId; @@ -95,7 +95,7 @@ public function initData() * @stageSubmissionFiles array The files that belongs to a file stage * that is currently being used by a grid inside this form. * - * @param $fileStage int SubmissionFile::SUBMISSION_FILE_... + * @param int $fileStage SubmissionFile::SUBMISSION_FILE_... */ public function execute($stageSubmissionFiles, $fileStage = null) { @@ -112,7 +112,7 @@ protected function importFile($submissionFile, $fileStage) { $newSubmissionFile = parent::importFile($submissionFile, $fileStage); - Repo::submissionFiles() + Repo::submissionFile() ->dao ->assignRevisionToReviewRound( $newSubmissionFile->getId(), diff --git a/controllers/grid/files/submission/SelectableSubmissionDetailsFilesGridHandler.inc.php b/controllers/grid/files/submission/SelectableSubmissionDetailsFilesGridHandler.inc.php deleted file mode 100644 index db97fcb8b6d..00000000000 --- a/controllers/grid/files/submission/SelectableSubmissionDetailsFilesGridHandler.inc.php +++ /dev/null @@ -1,45 +0,0 @@ -addRoleAssignment( - [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR, Role::ROLE_ID_ASSISTANT], - ['fetchGrid', 'fetchRow'] - ); - - // Set the grid title. - $this->setTitle('submission.submit.submissionFiles'); - } -} diff --git a/controllers/grid/files/submissionDocuments/SubmissionDocumentsFilesGridHandler.inc.php b/controllers/grid/files/submissionDocuments/SubmissionDocumentsFilesGridHandler.inc.php index 64f08dbe3c2..72e6657b780 100644 --- a/controllers/grid/files/submissionDocuments/SubmissionDocumentsFilesGridHandler.inc.php +++ b/controllers/grid/files/submissionDocuments/SubmissionDocumentsFilesGridHandler.inc.php @@ -125,8 +125,8 @@ protected function getRowInstance() /** * Load the (read only) context file library. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -142,7 +142,7 @@ public function viewLibrary($args, $request) /** * Returns a specific instance of the new form for this grid. * - * @param $context Context + * @param Context $context * * @return NewLibraryFileForm */ @@ -156,8 +156,8 @@ public function _getNewFileForm($context) /** * Returns a specific instance of the edit form for this grid. * - * @param $context Press - * @param $fileId int + * @param Context $context + * @param int $fileId * * @return EditLibraryFileForm */ diff --git a/controllers/grid/files/submissionDocuments/form/EditLibraryFileForm.inc.php b/controllers/grid/files/submissionDocuments/form/EditLibraryFileForm.inc.php index 5f12d28341e..922f027f900 100644 --- a/controllers/grid/files/submissionDocuments/form/EditLibraryFileForm.inc.php +++ b/controllers/grid/files/submissionDocuments/form/EditLibraryFileForm.inc.php @@ -17,17 +17,17 @@ class EditLibraryFileForm extends LibraryFileForm { - /** the file being edited, or null for new */ + /** @var LibraryFile the file being edited, or null for new */ public $libraryFile; - /** the id of the submission for this library file */ + /** @var int the id of the submission for this library file */ public $submissionId; /** * Constructor. * - * @param $contextId int - * @param $fileId int optional + * @param int $contextId + * @param int $fileId optional */ public function __construct($contextId, $fileId, $submissionId) { diff --git a/controllers/grid/files/submissionDocuments/form/NewLibraryFileForm.inc.php b/controllers/grid/files/submissionDocuments/form/NewLibraryFileForm.inc.php index 7e303e90f9f..85a375c33a6 100644 --- a/controllers/grid/files/submissionDocuments/form/NewLibraryFileForm.inc.php +++ b/controllers/grid/files/submissionDocuments/form/NewLibraryFileForm.inc.php @@ -27,7 +27,7 @@ class NewLibraryFileForm extends LibraryFileForm /** * Constructor. * - * @param $contextId int + * @param int $contextId */ public function __construct($contextId, $submissionId) { diff --git a/controllers/grid/languages/LanguageGridHandler.inc.php b/controllers/grid/languages/LanguageGridHandler.inc.php index 4cda910da10..864051d8fa2 100644 --- a/controllers/grid/languages/LanguageGridHandler.inc.php +++ b/controllers/grid/languages/LanguageGridHandler.inc.php @@ -76,8 +76,8 @@ protected function getRowInstance() /** * Save language management settings. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONObject JSON message */ @@ -176,8 +176,8 @@ public function saveLanguageSetting($args, $request) /** * Set context primary locale. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -252,7 +252,7 @@ public function addNameColumn() /** * Add primary column. * - * @param $columnId string The column id. + * @param string $columnId The column id. */ public function addPrimaryColumn($columnId) { @@ -309,10 +309,10 @@ public function addManagementColumns() /** * Add data related to management settings. * - * @param $request Request - * @param $data Array Data already loaded. + * @param Request $request + * @param array $data Data already loaded. * - * @return Array Same passed array, but with + * @return array Same passed array, but with * the extra management data inserted. */ public function addManagementData($request, $data) diff --git a/controllers/grid/navigationMenus/NavigationMenuItemsGridCellProvider.inc.php b/controllers/grid/navigationMenus/NavigationMenuItemsGridCellProvider.inc.php index 5855ba12219..c629534d184 100644 --- a/controllers/grid/navigationMenus/NavigationMenuItemsGridCellProvider.inc.php +++ b/controllers/grid/navigationMenus/NavigationMenuItemsGridCellProvider.inc.php @@ -34,8 +34,8 @@ public function getCellActions($request, $row, $column, $position = GridHandler: * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/navigationMenus/NavigationMenuItemsGridHandler.inc.php b/controllers/grid/navigationMenus/NavigationMenuItemsGridHandler.inc.php index aac8c3e4360..724c395a200 100644 --- a/controllers/grid/navigationMenus/NavigationMenuItemsGridHandler.inc.php +++ b/controllers/grid/navigationMenus/NavigationMenuItemsGridHandler.inc.php @@ -156,8 +156,8 @@ protected function getRowInstance() /** * Update NavigationMenuItem * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -203,8 +203,8 @@ public function updateNavigationMenuItem($args, $request) /** * Display form to edit a navigation menu item object. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -227,8 +227,8 @@ public function editNavigationMenuItem($args, $request) /** * Add NavigationMenuItem * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -253,8 +253,8 @@ public function addNavigationMenuItem($args, $request) /** * Delete a navigation Menu item. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/navigationMenus/NavigationMenusGridCellProvider.inc.php b/controllers/grid/navigationMenus/NavigationMenusGridCellProvider.inc.php index 0db0efb3131..db0a2206c79 100644 --- a/controllers/grid/navigationMenus/NavigationMenusGridCellProvider.inc.php +++ b/controllers/grid/navigationMenus/NavigationMenusGridCellProvider.inc.php @@ -53,8 +53,8 @@ public function getCellActions($request, $row, $column, $position = GridHandler: * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/navigationMenus/NavigationMenusGridHandler.inc.php b/controllers/grid/navigationMenus/NavigationMenusGridHandler.inc.php index 928f7c5d59a..b02582751a7 100644 --- a/controllers/grid/navigationMenus/NavigationMenusGridHandler.inc.php +++ b/controllers/grid/navigationMenus/NavigationMenusGridHandler.inc.php @@ -169,8 +169,8 @@ protected function getRowInstance() /** * Display form to add NavigationMenus. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return string */ @@ -182,8 +182,8 @@ public function addNavigationMenu($args, $request) /** * Display form to edit NavigationMenus. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -205,8 +205,8 @@ public function editNavigationMenu($args, $request) /** * Save an edited/inserted NavigationMenus. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -250,8 +250,8 @@ public function updateNavigationMenu($args, $request) /** * Delete a NavigationMenu. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/navigationMenus/form/NavigationMenuForm.inc.php b/controllers/grid/navigationMenus/form/NavigationMenuForm.inc.php index 5d3ed0a762d..775888c5cb9 100644 --- a/controllers/grid/navigationMenus/form/NavigationMenuForm.inc.php +++ b/controllers/grid/navigationMenus/form/NavigationMenuForm.inc.php @@ -32,8 +32,8 @@ class NavigationMenuForm extends Form /** * Constructor * - * @param $contextId int Context ID - * @param $navigationMenuId int NavigationMenu Id + * @param int $contextId Context ID + * @param int $navigationMenuId NavigationMenu Id */ public function __construct($contextId, $navigationMenuId = null) { diff --git a/controllers/grid/navigationMenus/form/PKPNavigationMenuItemsForm.inc.php b/controllers/grid/navigationMenus/form/PKPNavigationMenuItemsForm.inc.php index 3326eec4456..f4ac2497a77 100755 --- a/controllers/grid/navigationMenus/form/PKPNavigationMenuItemsForm.inc.php +++ b/controllers/grid/navigationMenus/form/PKPNavigationMenuItemsForm.inc.php @@ -30,8 +30,8 @@ class PKPNavigationMenuItemsForm extends Form /** * Constructor * - * @param $contextId int - * @param $navigationMenuItemId int + * @param int $contextId + * @param int $navigationMenuItemId */ public function __construct($contextId, $navigationMenuItemId) { diff --git a/controllers/grid/notifications/NotificationsGridCellProvider.inc.php b/controllers/grid/notifications/NotificationsGridCellProvider.inc.php index b9601bda932..289b5d6332f 100644 --- a/controllers/grid/notifications/NotificationsGridCellProvider.inc.php +++ b/controllers/grid/notifications/NotificationsGridCellProvider.inc.php @@ -29,8 +29,8 @@ class NotificationsGridCellProvider extends GridCellProvider /** * Get cell actions associated with this row/column combination * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array an array of LinkAction instances */ @@ -83,8 +83,8 @@ public function getCellActions($request, $row, $column, $position = GridHandler: * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ @@ -99,7 +99,7 @@ public function getTemplateVarsFromRowColumn($row, $column) /** * Get the title for a notification. * - * @param $notification Notification + * @param Notification $notification * * @return string */ @@ -167,7 +167,7 @@ public function _getTitle($notification) if (!isset($submissionId) && isset($fileId)) { assert(is_numeric($fileId)); - $submissionFile = Repo::submissionFiles()->get($fileId); + $submissionFile = Repo::submissionFile()->get($fileId); assert($submissionFile instanceof \PKP\submissionFile\SubmissionFile); $submissionId = $submissionFile->getData('submissionId'); } diff --git a/controllers/grid/notifications/NotificationsGridHandler.inc.php b/controllers/grid/notifications/NotificationsGridHandler.inc.php index 2e9da656cea..26f704456c8 100644 --- a/controllers/grid/notifications/NotificationsGridHandler.inc.php +++ b/controllers/grid/notifications/NotificationsGridHandler.inc.php @@ -178,8 +178,8 @@ protected function getNotificationsColumnTitle() /** * Mark notifications unread * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -206,8 +206,8 @@ public function markNew($args, $request) /** * Mark notifications unread * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -242,8 +242,8 @@ public function markRead($args, $request) /** * Delete notifications * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/plugins/PluginGalleryGridCellProvider.inc.php b/controllers/grid/plugins/PluginGalleryGridCellProvider.inc.php index f7a349a1020..e882e82d051 100644 --- a/controllers/grid/plugins/PluginGalleryGridCellProvider.inc.php +++ b/controllers/grid/plugins/PluginGalleryGridCellProvider.inc.php @@ -25,8 +25,8 @@ class PluginGalleryGridCellProvider extends GridCellProvider * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ @@ -72,8 +72,8 @@ public function getTemplateVarsFromRowColumn($row, $column) /** * Get cell actions associated with this row/column combination * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array an array of LinkAction instances */ diff --git a/controllers/grid/plugins/PluginGalleryGridHandler.inc.php b/controllers/grid/plugins/PluginGalleryGridHandler.inc.php index ad4da820bd1..50b89f1c28a 100644 --- a/controllers/grid/plugins/PluginGalleryGridHandler.inc.php +++ b/controllers/grid/plugins/PluginGalleryGridHandler.inc.php @@ -131,8 +131,8 @@ public function authorize($request, &$args, $roleAssignments) /** * @see GridHandler::loadData() * - * @param $request PKPRequest Request object - * @param $filter array Filter parameters + * @param PKPRequest $request Request object + * @param array $filter Filter parameters * * @return array Grid data. */ @@ -191,8 +191,8 @@ protected function renderFilter($request, $filterData = []) /** * View a plugin's details * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -259,8 +259,8 @@ public function viewPlugin($args, $request) /** * Upgrade a plugin * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function upgradePlugin($args, $request) { @@ -270,9 +270,9 @@ public function upgradePlugin($args, $request) /** * Install or upgrade a plugin * - * @param $args array - * @param $request PKPRequest - * @param $isUpgrade boolean + * @param array $args + * @param PKPRequest $request + * @param bool $isUpgrade */ public function installPlugin($args, $request, $isUpgrade = false) { @@ -342,7 +342,7 @@ public function installPlugin($args, $request, $isUpgrade = false) /** * Get the specified plugin. * - * @param $request PKPRequest + * @param PKPRequest $request * * @return GalleryPlugin */ diff --git a/controllers/grid/plugins/PluginGridCellProvider.inc.php b/controllers/grid/plugins/PluginGridCellProvider.inc.php index 52d0b6b54f1..3613d2bb8ef 100644 --- a/controllers/grid/plugins/PluginGridCellProvider.inc.php +++ b/controllers/grid/plugins/PluginGridCellProvider.inc.php @@ -26,8 +26,8 @@ class PluginGridCellProvider extends GridCellProvider * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/plugins/PluginGridRow.inc.php b/controllers/grid/plugins/PluginGridRow.inc.php index b6dd3f60b14..c46537a90ca 100644 --- a/controllers/grid/plugins/PluginGridRow.inc.php +++ b/controllers/grid/plugins/PluginGridRow.inc.php @@ -20,13 +20,13 @@ class PluginGridRow extends GridRow { - /** @var Array */ + /** @var array */ public $_userRoles; /** * Constructor * - * @param $userRoles array + * @param array $userRoles */ public function __construct($userRoles) { @@ -104,9 +104,9 @@ public function initialize($request, $template = null) /** * Return if user can edit a plugin settings or not. * - * @param $plugin Plugin + * @param Plugin $plugin * - * @return boolean + * @return bool */ protected function _canEdit($plugin) { diff --git a/controllers/grid/plugins/form/UploadPluginForm.inc.php b/controllers/grid/plugins/form/UploadPluginForm.inc.php index eef28bf253c..7e6ca4d980b 100644 --- a/controllers/grid/plugins/form/UploadPluginForm.inc.php +++ b/controllers/grid/plugins/form/UploadPluginForm.inc.php @@ -23,14 +23,14 @@ class UploadPluginForm extends Form { - /** @var String PLUGIN_ACTION_... */ + /** @var string PLUGIN_ACTION_... */ public $_function; /** * Constructor. * - * @param $function string PLUGIN_ACTION_... + * @param string $function PLUGIN_ACTION_... */ public function __construct($function) { diff --git a/controllers/grid/pubIds/form/PKPAssignPublicIdentifiersForm.inc.php b/controllers/grid/pubIds/form/PKPAssignPublicIdentifiersForm.inc.php index a045bab21f5..2b0c5198e02 100644 --- a/controllers/grid/pubIds/form/PKPAssignPublicIdentifiersForm.inc.php +++ b/controllers/grid/pubIds/form/PKPAssignPublicIdentifiersForm.inc.php @@ -29,7 +29,7 @@ class PKPAssignPublicIdentifiersForm extends Form */ public $_pubObject; - /** @var boolean */ + /** @var bool */ public $_approval; /** @@ -40,10 +40,10 @@ class PKPAssignPublicIdentifiersForm extends Form /** * Constructor. * - * @param $template string Form template - * @param $pubObject object - * @param $approval boolean - * @param $confirmationText string + * @param string $template Form template + * @param object $pubObject + * @param bool $approval + * @param string $confirmationText */ public function __construct($template, $pubObject, $approval, $confirmationText) { @@ -102,7 +102,7 @@ public function getPubObject() /** * Get weather it is an approval * - * @return boolean + * @return bool */ public function getApproval() { @@ -112,7 +112,7 @@ public function getApproval() /** * Get the context id * - * @return integer + * @return int */ public function getContextId() { @@ -141,7 +141,7 @@ public function readInputData() /** * Assign pub ids. * - * @param $save boolean + * @param bool $save * true if the pub id shall be saved here * false if this form is integrated somewhere else, where the pub object will be updated. */ diff --git a/controllers/grid/queries/QueriesAccessHelper.inc.php b/controllers/grid/queries/QueriesAccessHelper.inc.php index 279b32720f6..700d20dbb08 100644 --- a/controllers/grid/queries/QueriesAccessHelper.inc.php +++ b/controllers/grid/queries/QueriesAccessHelper.inc.php @@ -36,8 +36,8 @@ class QueriesAccessHelper /** * Constructor * - * @param $authorizedContext array - * @param $user User + * @param array $authorizedContext + * @param User $user */ public function __construct($authorizedContext, $user) { @@ -48,7 +48,7 @@ public function __construct($authorizedContext, $user) /** * Retrieve authorized context objects from the authorized context. * - * @param $assocType integer any of the ASSOC_TYPE_* constants + * @param int $assocType any of the ASSOC_TYPE_* constants */ public function getAuthorizedContextObject($assocType) { @@ -58,9 +58,9 @@ public function getAuthorizedContextObject($assocType) /** * Determine whether the current user can open/close a query. * - * @param $query Query + * @param Query $query * - * @return boolean True if the user is allowed to open/close the query. + * @return bool True if the user is allowed to open/close the query. */ public function getCanOpenClose($query) { @@ -81,9 +81,9 @@ public function getCanOpenClose($query) /** * Determine whether the user can re-order the queries. * - * @param $stageId int + * @param int $stageId * - * @return boolean + * @return bool */ public function getCanOrder($stageId) { @@ -93,9 +93,9 @@ public function getCanOrder($stageId) /** * Determine whether the user can create queries. * - * @param $stageId int + * @param int $stageId * - * @return boolean + * @return bool */ public function getCanCreate($stageId) { @@ -105,9 +105,9 @@ public function getCanCreate($stageId) /** * Determine whether the current user can edit a query. * - * @param $queryId int Query ID + * @param int $queryId Query ID * - * @return boolean True iff the user is allowed to edit the query. + * @return bool True iff the user is allowed to edit the query. */ public function getCanEdit($queryId) { @@ -136,9 +136,9 @@ public function getCanEdit($queryId) /** * Determine whether the current user can delete a query. * - * @param $queryId int Query ID + * @param int $queryId Query ID * - * @return boolean True iff the user is allowed to delete the query. + * @return bool True iff the user is allowed to delete the query. */ public function getCanDelete($queryId) { @@ -165,9 +165,9 @@ public function getCanDelete($queryId) /** * Determine whether the current user can list all queries on the submission * - * @param $stageId int The stage ID to load discussions for + * @param int $stageId The stage ID to load discussions for * - * @return boolean + * @return bool */ public function getCanListAll($stageId) { @@ -177,10 +177,10 @@ public function getCanListAll($stageId) /** * Determine whether the current user is assigned to the current query. * - * @param $userId int User ID - * @param $queryId int Query ID + * @param int $userId User ID + * @param int $queryId Query ID * - * @return boolean + * @return bool */ protected function isAssigned($userId, $queryId) { @@ -192,10 +192,10 @@ protected function isAssigned($userId, $queryId) * Determine whether the current user has role(s) in the current workflow * stage * - * @param $stageId int - * @param $roles array [ROLE_ID_...] + * @param int $stageId + * @param array $roles [ROLE_ID_...] * - * @return boolean + * @return bool */ protected function hasStageRole($stageId, $roles) { diff --git a/controllers/grid/queries/QueriesGridCellProvider.inc.php b/controllers/grid/queries/QueriesGridCellProvider.inc.php index 469288668de..fcb801ccb7e 100644 --- a/controllers/grid/queries/QueriesGridCellProvider.inc.php +++ b/controllers/grid/queries/QueriesGridCellProvider.inc.php @@ -22,10 +22,10 @@ class QueriesGridCellProvider extends DataObjectGridCellProvider { - /** @var Submission **/ + /** @var Submission */ public $_submission; - /** @var int **/ + /** @var int */ public $_stageId; /** @var QueriesAccessHelper */ @@ -34,9 +34,9 @@ class QueriesGridCellProvider extends DataObjectGridCellProvider /** * Constructor * - * @param $submission Submission - * @param $stageId int - * @param $queriesAccessHelper QueriesAccessHelper + * @param Submission $submission + * @param int $stageId + * @param QueriesAccessHelper $queriesAccessHelper */ public function __construct($submission, $stageId, $queriesAccessHelper) { @@ -53,8 +53,8 @@ public function __construct($submission, $stageId, $queriesAccessHelper) * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ @@ -129,7 +129,7 @@ public function getCellActions($request, $row, $column, $position = GridHandler: /** * Get request arguments. * - * @param $row \PKP\controllers\grid\GridRow + * @param \PKP\controllers\grid\GridRow $row * * @return array */ diff --git a/controllers/grid/queries/QueriesGridHandler.inc.php b/controllers/grid/queries/QueriesGridHandler.inc.php index 2fdd0298621..296358719a8 100644 --- a/controllers/grid/queries/QueriesGridHandler.inc.php +++ b/controllers/grid/queries/QueriesGridHandler.inc.php @@ -15,7 +15,9 @@ use APP\facades\Repo; use APP\notification\NotificationManager; +use APP\submission\Submission; use APP\template\TemplateManager; +use Illuminate\Support\Facades\Mail; use PKP\controllers\grid\feature\OrderGridItemsFeature; use PKP\controllers\grid\GridColumn; use PKP\controllers\grid\GridHandler; @@ -24,10 +26,10 @@ use PKP\linkAction\LinkAction; use PKP\linkAction\request\AjaxModal; use PKP\linkAction\request\RemoteActionConfirmationModal; -use PKP\mail\FormEmailData; +use PKP\mail\mailables\MailDiscussionMessage; use PKP\mail\SubmissionMailTemplate; +use PKP\notification\NotificationSubscriptionSettingsDAO; use PKP\notification\PKPNotification; -use PKP\observers\events\DiscussionMessageSent; use PKP\security\authorization\QueryAccessPolicy; use PKP\security\authorization\QueryWorkflowStageAccessPolicy; @@ -35,7 +37,7 @@ class QueriesGridHandler extends GridHandler { - /** @var integer WORKFLOW_STAGE_ID_... */ + /** @var int WORKFLOW_STAGE_ID_... */ public $_stageId; /** @var PKPRequest */ @@ -88,7 +90,7 @@ public function getQuery() /** * Get the stage id. * - * @return integer + * @return int */ public function getStageId() { @@ -335,8 +337,8 @@ public function loadData($request, $filter = null) /** * Add a query * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -360,8 +362,8 @@ public function addQuery($args, $request) /** * Delete a query. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -403,8 +405,8 @@ public function deleteQuery($args, $request) /** * Open a closed query. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -424,8 +426,8 @@ public function openQuery($args, $request) /** * Close an open query. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -455,8 +457,8 @@ public function getQueryNotesGridHandlerName() /** * Read a query * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -520,8 +522,8 @@ public function readQuery($args, $request) /** * Fetch the list of participants for a query * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -558,8 +560,8 @@ public function participants($args, $request) /** * Edit a query * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -586,8 +588,8 @@ public function editQuery($args, $request) /** * Save a query * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -642,8 +644,18 @@ public function updateQuery($args, $request) unset($added[$key]); } - $formData = new FormEmailData(); + $mailable = new MailDiscussionMessage($request->getContext(), $this->getSubmission()); + $emailTemplate = Repo::emailTemplate()->getByKey($request->getContext()->getId(), $mailable::getEmailTemplateKey()); + $mailable + ->body($emailTemplate->getLocalizedData('body')) + ->subject($emailTemplate->getLocalizedData('subject')) + ->sender($currentUser); + + /** @var NotificationSubscriptionSettingsDAO $notificationSubscriptionSettingsDAO */ + $notificationSubscriptionSettingsDao = DAORegistry::getDAO('NotificationSubscriptionSettingsDAO'); foreach ($added as $userId) { + $user = Repo::user()->get((int) $userId); + $notification = $notificationMgr->createNotification( $request, $userId, @@ -655,7 +667,18 @@ public function updateQuery($args, $request) null, true ); - $formData->addVariables([$userId => [ + + // Check if the user is unsubscribed + $notificationSubscriptionSettings = $notificationSubscriptionSettingsDao->getNotificationSubscriptionSettings( + NotificationSubscriptionSettingsDAO::BLOCKED_EMAIL_NOTIFICATION_KEY, + $user->getId(), + $request->getContext()->getId() + ); + if (in_array(PKPNotification::NOTIFICATION_TYPE_NEW_QUERY, $notificationSubscriptionSettings)) { + continue; + } + + $mailable->addData([ 'notificationContents' => $notificationMgr->getNotificationContents($request, $notification), 'url' => $notificationMgr->getNotificationUrl($request, $notification), 'unsubscribeLink' => @@ -664,28 +687,14 @@ public function updateQuery($args, $request) '\'>' . __('notification.unsubscribeNotifications') . '' - ]]); - } + ]); - $assocSubmission = Repo::submission()->get($query->getAssocId()); - - try { - event(new DiscussionMessageSent( - $query, - $request->getContext(), - $assocSubmission, - $formData->setRecipientIds($added)->setSenderId($request->getUser()->getId()) - )); - } catch (Swift_TransportException $e) { - $notificationMgr->createTrivialNotification( - $currentUser->getId(), - PKPNotification::NOTIFICATION_TYPE_ERROR, - ['contents' => __('email.compose.error')] - ); - trigger_error($e->getMessage(), E_USER_WARNING); + $mailable->recipients([$user]); + + Mail::send($mailable); } - return \PKP\db\DAO::getDataChangedEvent($query->getId()); } + // If this was new (placeholder) query that didn't validate, remember whether or not // we need to delete it on cancellation. if ($request->getUserVar('wasNew')) { @@ -708,8 +717,8 @@ public function updateQuery($args, $request) /** * Leave query * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -731,9 +740,9 @@ public function leaveQuery($args, $request) /** * Check if the current user can leave a query. Only allow if query has more than two participants. * - * @param $queryId int + * @param int $queryId * - * @return boolean + * @return bool */ public function _getCurrentUserCanLeave($queryId) { diff --git a/controllers/grid/queries/QueriesGridRow.inc.php b/controllers/grid/queries/QueriesGridRow.inc.php index 0a29ab0ba00..44948afc929 100644 --- a/controllers/grid/queries/QueriesGridRow.inc.php +++ b/controllers/grid/queries/QueriesGridRow.inc.php @@ -20,10 +20,10 @@ class QueriesGridRow extends GridRow { - /** @var Submission **/ + /** @var Submission */ public $_submission; - /** @var int **/ + /** @var int */ public $_stageId; /** @var QueriesAccessHelper */ @@ -31,9 +31,9 @@ class QueriesGridRow extends GridRow /** * Constructor * - * @param $submission Submission - * @param $stageId int - * @param $queriesAccessHelper QueriesAccessHelper + * @param Submission $submission + * @param int $stageId + * @param QueriesAccessHelper $queriesAccessHelper */ public function __construct($submission, $stageId, $queriesAccessHelper) { diff --git a/controllers/grid/queries/QueryNotesGridCellProvider.inc.php b/controllers/grid/queries/QueryNotesGridCellProvider.inc.php index c481bd7ac4e..b06e8dee374 100644 --- a/controllers/grid/queries/QueryNotesGridCellProvider.inc.php +++ b/controllers/grid/queries/QueryNotesGridCellProvider.inc.php @@ -27,7 +27,7 @@ class QueryNotesGridCellProvider extends DataObjectGridCellProvider /** * Constructor * - * @param $submission Submission + * @param Submission $submission */ public function __construct($submission) { @@ -42,8 +42,8 @@ public function __construct($submission) * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ @@ -70,14 +70,14 @@ public function getCellActions($request, $row, $column, $position = GridHandler: { switch ($column->getId()) { case 'contents': - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterByAssoc( ASSOC_TYPE_NOTE, [$row->getData()->getId()] )->filterBySubmissionIds([$this->_submission->getId()]) ->filterByFileStages([SubmissionFile::SUBMISSION_FILE_QUERY]); - $submissionFiles = Repo::submissionFiles()->getMany($collector); + $submissionFiles = Repo::submissionFile()->getMany($collector); import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction'); $actions = []; diff --git a/controllers/grid/queries/QueryNotesGridHandler.inc.php b/controllers/grid/queries/QueryNotesGridHandler.inc.php index 381960bcf31..8b18ef467c6 100644 --- a/controllers/grid/queries/QueryNotesGridHandler.inc.php +++ b/controllers/grid/queries/QueryNotesGridHandler.inc.php @@ -64,7 +64,7 @@ public function getQuery() /** * Get the stage id. * - * @return integer + * @return int */ public function getStageId() { @@ -178,8 +178,8 @@ public function loadData($request, $filter = null) /** * Present the form to add a new note. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function addNote($args, $request) { @@ -192,8 +192,8 @@ public function addNote($args, $request) /** * Insert a new note. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function insertNote($args, $request) { @@ -211,9 +211,9 @@ public function insertNote($args, $request) /** * Determine whether the current user can manage (delete) a note. * - * @param $note Note optional + * @param Note $note optional * - * @return boolean + * @return bool */ public function getCanManage($note) { @@ -232,8 +232,8 @@ public function getCanManage($note) /** * Delete a query note. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/queries/QueryNotesGridRow.inc.php b/controllers/grid/queries/QueryNotesGridRow.inc.php index f37dda6ed7b..5975cf31db8 100644 --- a/controllers/grid/queries/QueryNotesGridRow.inc.php +++ b/controllers/grid/queries/QueryNotesGridRow.inc.php @@ -19,7 +19,7 @@ class QueryNotesGridRow extends GridRow { - /** @var array **/ + /** @var array */ public $_actionArgs; /** @var Query */ @@ -31,9 +31,9 @@ class QueryNotesGridRow extends GridRow /** * Constructor * - * @param $actionArgs array Action arguments - * @param $query Query - * @param $queryNotesGrid The notes grid containing this row + * @param array $actionArgs Action arguments + * @param Query $query + * @param QueryNotesGridHandler $queryNotesGrid The notes grid containing this row */ public function __construct($actionArgs, $query, $queryNotesGrid) { diff --git a/controllers/grid/queries/QueryTitleGridColumn.inc.php b/controllers/grid/queries/QueryTitleGridColumn.inc.php index 96d518196d1..495af9c4cc8 100644 --- a/controllers/grid/queries/QueryTitleGridColumn.inc.php +++ b/controllers/grid/queries/QueryTitleGridColumn.inc.php @@ -27,7 +27,7 @@ class QueryTitleGridColumn extends GridColumn /** * Constructor * - * @param $actionArgs array Action args for link actions + * @param array $actionArgs Action args for link actions */ public function __construct($actionArgs) { diff --git a/controllers/grid/queries/form/QueryForm.inc.php b/controllers/grid/queries/form/QueryForm.inc.php index 13acedff214..6083f997da7 100644 --- a/controllers/grid/queries/form/QueryForm.inc.php +++ b/controllers/grid/queries/form/QueryForm.inc.php @@ -31,23 +31,23 @@ class QueryForm extends Form /** @var int Assoc ID (per _assocType) */ public $_assocId; - /** @var int The stage id associated with the query being edited **/ + /** @var int The stage id associated with the query being edited */ public $_stageId; - /** @var Query The query being edited **/ + /** @var Query The query being edited */ public $_query; - /** @var boolean True iff this is a newly-created query */ + /** @var bool True iff this is a newly-created query */ public $_isNew; /** * Constructor. * - * @param $request Request - * @param $assocType int ASSOC_TYPE_... - * @param $assocId int Assoc ID (per assocType) - * @param $stageId int WORKFLOW_STAGE_... - * @param $queryId int Optional query ID to edit. If none provided, a + * @param Request $request + * @param int $assocType ASSOC_TYPE_... + * @param int $assocId Assoc ID (per assocType) + * @param int $stageId WORKFLOW_STAGE_... + * @param int $queryId Optional query ID to edit. If none provided, a * (potentially temporary) query will be created. */ public function __construct($request, $assocType, $assocId, $stageId, $queryId = null) @@ -104,7 +104,6 @@ public function __construct($request, $assocType, $assocId, $stageId, $queryId = /** * Set the flag indiciating whether the query is new (i.e. creates a placeholder that needs deleting on cancel) * - * @param $isNew boolean */ public function setIsNew(bool $isNew) { @@ -124,7 +123,7 @@ public function getQuery() /** * Set the query * - * @param @query Query + * @param Query $query */ public function setQuery($query) { @@ -144,7 +143,7 @@ public function getStageId() /** * Set the stage id * - * @param int + * @param int $stageId */ public function setStageId($stageId) { @@ -164,7 +163,7 @@ public function getAssocType() /** * Set assoc type * - * @param $assocType int ASSOC_TYPE_... + * @param int $assocType ASSOC_TYPE_... */ public function setAssocType($assocType) { @@ -184,7 +183,7 @@ public function getAssocId() /** * Set assoc id * - * @param $assocId int + * @param int $assocId */ public function setAssocId($assocId) { @@ -222,8 +221,8 @@ public function initData() * * @see Form::fetch() * - * @param $request PKPRequest - * @param $actionArgs array Optional list of additional arguments + * @param PKPRequest $request + * @param array $actionArgs Optional list of additional arguments * @param null|mixed $template */ public function fetch($request, $template = null, $display = false, $actionArgs = []) diff --git a/controllers/grid/queries/form/QueryNoteForm.inc.php b/controllers/grid/queries/form/QueryNoteForm.inc.php index de64b82c779..c57b3a2433b 100644 --- a/controllers/grid/queries/form/QueryNoteForm.inc.php +++ b/controllers/grid/queries/form/QueryNoteForm.inc.php @@ -31,16 +31,16 @@ class QueryNoteForm extends Form /** @var int Note ID */ public $_noteId; - /** @var boolean Whether or not this is a new note */ + /** @var bool Whether or not this is a new note */ public $_isNew; /** * Constructor. * - * @param $actionArgs array Action arguments - * @param $query Query - * @param $user User The current user ID - * @param $noteId int The note ID to edit, or null for new. + * @param array $actionArgs Action arguments + * @param Query $query + * @param User $user The current user ID + * @param int $noteId The note ID to edit, or null for new. */ public function __construct($actionArgs, $query, $user, $noteId = null) { @@ -85,7 +85,7 @@ public function getQuery() /** * Set the query * - * @param @query Query + * @param Query $query */ public function setQuery($query) { diff --git a/controllers/grid/settings/SetupGridHandler.inc.php b/controllers/grid/settings/SetupGridHandler.inc.php index 293f9a64838..59eae280d10 100644 --- a/controllers/grid/settings/SetupGridHandler.inc.php +++ b/controllers/grid/settings/SetupGridHandler.inc.php @@ -48,7 +48,7 @@ public function initialize($request, $args = null) /** * @copydoc PKPHandler::authorize() * - * @param $contextRequired boolean + * @param bool $contextRequired */ public function authorize($request, &$args, $roleAssignments, $contextRequired = true) { @@ -61,8 +61,8 @@ public function authorize($request, &$args, $roleAssignments, $contextRequired = /** * Handle file uploads for cover/image art for things like Series and Categories. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function uploadImage($args, $request) { diff --git a/controllers/grid/settings/category/CategoryCategoryGridHandler.inc.php b/controllers/grid/settings/category/CategoryCategoryGridHandler.inc.php index 5d43825d188..3ab1f5ff3b7 100644 --- a/controllers/grid/settings/category/CategoryCategoryGridHandler.inc.php +++ b/controllers/grid/settings/category/CategoryCategoryGridHandler.inc.php @@ -216,8 +216,8 @@ public function loadCategoryData($request, &$category, $filter = null) /** * Handle the add category operation. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function addCategory($args, $request) { @@ -227,8 +227,8 @@ public function addCategory($args, $request) /** * Handle the edit category operation. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -244,8 +244,8 @@ public function editCategory($args, $request) /** * Update category data in database and grid. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -265,8 +265,8 @@ public function updateCategory($args, $request) /** * Delete a category * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -286,8 +286,8 @@ public function deleteCategory($args, $request) /** * Handle file uploads for cover/image art for things like Series and Categories. * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args * * @return JSONMessage JSON object */ @@ -314,7 +314,7 @@ public function uploadImage($args, $request) /** * Get a CategoryForm instance. * - * @param $request Request + * @param Request $request * * @return UserGroupForm */ diff --git a/controllers/grid/settings/category/form/CategoryForm.inc.php b/controllers/grid/settings/category/form/CategoryForm.inc.php index 0353d9eb862..99dd798643d 100644 --- a/controllers/grid/settings/category/form/CategoryForm.inc.php +++ b/controllers/grid/settings/category/form/CategoryForm.inc.php @@ -23,10 +23,10 @@ class CategoryForm extends Form { - /** @var Id of the category being edited */ + /** @var int Id of the category being edited */ public $_categoryId; - /** @var The context ID of the category being edited */ + /** @var int The context ID of the category being edited */ public $_contextId; /** @var int $_userId The current user ID */ @@ -42,8 +42,8 @@ class CategoryForm extends Form /** * Constructor. * - * @param $contextId Context id. - * @param $categoryId Category id. + * @param int $contextId Context id. + * @param int $categoryId Category id. */ public function __construct($contextId, $categoryId = null) { @@ -93,7 +93,7 @@ public function getCategoryId() /** * Set the category ID for this section. * - * @param $categoryId int + * @param int $categoryId */ public function setCategoryId($categoryId) { diff --git a/controllers/grid/settings/genre/GenreGridHandler.inc.php b/controllers/grid/settings/genre/GenreGridHandler.inc.php index 4ae10c31038..e86d09ba2f9 100644 --- a/controllers/grid/settings/genre/GenreGridHandler.inc.php +++ b/controllers/grid/settings/genre/GenreGridHandler.inc.php @@ -44,9 +44,12 @@ public function __construct() // // Overridden template methods // - /* + /** * Configure the grid + * * @see SetupGridHandler::initialize + * + * @param null|mixed $args */ public function initialize($request, $args = null) { @@ -174,8 +177,8 @@ public function setDataElementSequence($request, $rowId, $gridDataElement, $newS /** * An action to add a new Genre * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function addGenre($args, $request) { @@ -186,8 +189,8 @@ public function addGenre($args, $request) /** * An action to edit a Genre * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -208,8 +211,8 @@ public function editGenre($args, $request) /** * Update a Genre * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -235,8 +238,8 @@ public function updateGenre($args, $request) /** * Delete a Genre. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -257,8 +260,8 @@ public function deleteGenre($args, $request) * Restore the default Genre settings for the context. * All default settings that were available when the context instance was created will be restored. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/settings/genre/form/GenreForm.inc.php b/controllers/grid/settings/genre/form/GenreForm.inc.php index f231ed35acc..bf031b32163 100644 --- a/controllers/grid/settings/genre/form/GenreForm.inc.php +++ b/controllers/grid/settings/genre/form/GenreForm.inc.php @@ -19,13 +19,13 @@ class GenreForm extends Form { - /** the id for the genre being edited **/ + /** @var int the id for the genre being edited */ public $_genreId; /** * Set the genre id * - * @param $genreId int + * @param int $genreId */ public function setGenreId($genreId) { @@ -71,7 +71,7 @@ public function __construct($genreId = null) /** * Initialize form data from current settings. * - * @param $args array + * @param array $args */ public function initData($args = []) { @@ -136,7 +136,7 @@ public function readInputData() /** * @copydoc Form::execute() * - * @return boolean + * @return bool */ public function execute(...$functionArgs) { diff --git a/controllers/grid/settings/languages/ManageLanguageGridHandler.inc.php b/controllers/grid/settings/languages/ManageLanguageGridHandler.inc.php index 58dff90f95a..4748afc7583 100644 --- a/controllers/grid/settings/languages/ManageLanguageGridHandler.inc.php +++ b/controllers/grid/settings/languages/ManageLanguageGridHandler.inc.php @@ -95,8 +95,8 @@ public function initialize($request, $args = null) /** * Reload locale. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/settings/library/LibraryFileAdminGridDataProvider.inc.php b/controllers/grid/settings/library/LibraryFileAdminGridDataProvider.inc.php index d5adf41629f..86732ccda2d 100644 --- a/controllers/grid/settings/library/LibraryFileAdminGridDataProvider.inc.php +++ b/controllers/grid/settings/library/LibraryFileAdminGridDataProvider.inc.php @@ -18,10 +18,10 @@ class LibraryFileAdminGridDataProvider extends CategoryGridDataProvider { - /** the context for this library **/ + /** @var Context the context for this library */ public $_context; - /** whether or not this grid is editable **/ + /** @var bool Whether or not this grid is editable */ public $_canEdit; /** @@ -69,7 +69,7 @@ public function &getContext() /** * get whether or not this grid is editable (has actions). * - * @return boolean $canEdit + * @return bool $canEdit */ public function canEdit() { diff --git a/controllers/grid/settings/library/LibraryFileAdminGridHandler.inc.php b/controllers/grid/settings/library/LibraryFileAdminGridHandler.inc.php index 3171d308526..1719548189c 100644 --- a/controllers/grid/settings/library/LibraryFileAdminGridHandler.inc.php +++ b/controllers/grid/settings/library/LibraryFileAdminGridHandler.inc.php @@ -40,7 +40,7 @@ public function __construct() // Overridden template methods // - /* + /** * Configure the grid * @see LibraryGridHandler::initialize */ @@ -55,7 +55,7 @@ public function initialize($request, $args = null) /** * Returns a specific instance of the new form for this grid. * - * @param $context Context + * @param Context $context * * @return NewLibraryFileForm */ @@ -68,8 +68,8 @@ public function _getNewFileForm($context) /** * Returns a specific instance of the edit form for this grid. * - * @param $context Context - * @param $fileId int + * @param Context $context + * @param int $fileId * * @return EditLibraryFileForm */ diff --git a/controllers/grid/settings/library/form/EditLibraryFileForm.inc.php b/controllers/grid/settings/library/form/EditLibraryFileForm.inc.php index 72db6de92a6..54b826b2f75 100644 --- a/controllers/grid/settings/library/form/EditLibraryFileForm.inc.php +++ b/controllers/grid/settings/library/form/EditLibraryFileForm.inc.php @@ -17,17 +17,17 @@ class EditLibraryFileForm extends LibraryFileForm { - /** the file being edited, or null for new */ + /** @var LibraryFile the file being edited, or null for new */ public $libraryFile; - /** the id of the context this library file is attached to */ + /** @var int the id of the context this library file is attached to */ public $contextId; /** * Constructor. * - * @param $contextId int - * @param $fileId int optional + * @param int $contextId + * @param int $fileId optional */ public function __construct($contextId, $fileId) { diff --git a/controllers/grid/settings/library/form/NewLibraryFileForm.inc.php b/controllers/grid/settings/library/form/NewLibraryFileForm.inc.php index 55624ef40d0..1791030a5cf 100644 --- a/controllers/grid/settings/library/form/NewLibraryFileForm.inc.php +++ b/controllers/grid/settings/library/form/NewLibraryFileForm.inc.php @@ -23,7 +23,7 @@ class NewLibraryFileForm extends LibraryFileForm /** * Constructor. * - * @param $contextId int + * @param int $contextId */ public function __construct($contextId) { diff --git a/controllers/grid/settings/reviewForms/ReviewFormElementGridCellProvider.inc.php b/controllers/grid/settings/reviewForms/ReviewFormElementGridCellProvider.inc.php index 999d7e68e0f..8b5551cfaae 100644 --- a/controllers/grid/settings/reviewForms/ReviewFormElementGridCellProvider.inc.php +++ b/controllers/grid/settings/reviewForms/ReviewFormElementGridCellProvider.inc.php @@ -21,8 +21,8 @@ class ReviewFormElementGridCellProvider extends GridCellProvider * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/settings/reviewForms/ReviewFormElementsGridHandler.inc.php b/controllers/grid/settings/reviewForms/ReviewFormElementsGridHandler.inc.php index ae0e36f3544..766bf346f53 100644 --- a/controllers/grid/settings/reviewForms/ReviewFormElementsGridHandler.inc.php +++ b/controllers/grid/settings/reviewForms/ReviewFormElementsGridHandler.inc.php @@ -200,8 +200,8 @@ public function setDataElementSequence($request, $rowId, $gridDataElement, $newS /** * Add a new review form element. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -216,8 +216,8 @@ public function createReviewFormElement($args, $request) /** * Edit an existing review form element. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -235,8 +235,8 @@ public function editReviewFormElement($args, $request) /** * Save changes to a review form element. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -275,8 +275,8 @@ public function updateReviewFormElement($args, $request) /** * Delete a review form element. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/settings/reviewForms/ReviewFormGridCellProvider.inc.php b/controllers/grid/settings/reviewForms/ReviewFormGridCellProvider.inc.php index 2752da6e754..ec5103378f5 100644 --- a/controllers/grid/settings/reviewForms/ReviewFormGridCellProvider.inc.php +++ b/controllers/grid/settings/reviewForms/ReviewFormGridCellProvider.inc.php @@ -23,8 +23,8 @@ class ReviewFormGridCellProvider extends GridCellProvider * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/settings/reviewForms/ReviewFormGridHandler.inc.php b/controllers/grid/settings/reviewForms/ReviewFormGridHandler.inc.php index c4c3a9851d0..a5929b759e9 100644 --- a/controllers/grid/settings/reviewForms/ReviewFormGridHandler.inc.php +++ b/controllers/grid/settings/reviewForms/ReviewFormGridHandler.inc.php @@ -219,8 +219,8 @@ public function initFeatures($request, $args) /** * Preview a review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -244,8 +244,8 @@ public function reviewFormPreview($args, $request) /** * Add a new review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -260,8 +260,8 @@ public function createReviewForm($args, $request) /** * Edit an existing review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -288,8 +288,8 @@ public function editReviewForm($args, $request) /** * Edit an existing review form's basics (title, description) * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -308,8 +308,8 @@ public function reviewFormBasics($args, $request) /** * Display a list of the review form elements within a review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -334,8 +334,8 @@ public function reviewFormElements($args, $request) /** * Update an existing review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON message */ @@ -372,8 +372,8 @@ public function updateReviewForm($args, $request) /** * Copy a review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -418,8 +418,8 @@ public function copyReviewForm($args, $request) /** * Activate a review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -454,8 +454,8 @@ public function activateReviewForm($args, $request) /** * Deactivate a review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -490,8 +490,8 @@ public function deactivateReviewForm($args, $request) /** * Delete a review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/settings/reviewForms/form/PreviewReviewForm.inc.php b/controllers/grid/settings/reviewForms/form/PreviewReviewForm.inc.php index 1e898740334..5456c66446a 100644 --- a/controllers/grid/settings/reviewForms/form/PreviewReviewForm.inc.php +++ b/controllers/grid/settings/reviewForms/form/PreviewReviewForm.inc.php @@ -19,13 +19,13 @@ class PreviewReviewForm extends Form { - /** The ID of the review form being edited */ + /** @var int The ID of the review form being edited */ public $reviewFormId; /** * Constructor. * - * @param $reviewFormId omit for a new review form + * @param int $reviewFormId omit for a new review form */ public function __construct($reviewFormId = null) { diff --git a/controllers/grid/settings/reviewForms/form/ReviewFormElementForm.inc.php b/controllers/grid/settings/reviewForms/form/ReviewFormElementForm.inc.php index 52552ec84d7..0d6420e30d2 100644 --- a/controllers/grid/settings/reviewForms/form/ReviewFormElementForm.inc.php +++ b/controllers/grid/settings/reviewForms/form/ReviewFormElementForm.inc.php @@ -32,8 +32,8 @@ class ReviewFormElementForm extends Form /** * Constructor. * - * @param $reviewFormId int - * @param $reviewFormElementId int + * @param int $reviewFormId + * @param int $reviewFormElementId */ public function __construct($reviewFormId, $reviewFormElementId = null) { diff --git a/controllers/grid/settings/reviewForms/form/ReviewFormElements.inc.php b/controllers/grid/settings/reviewForms/form/ReviewFormElements.inc.php index 5aca3758741..abe0df4efdb 100644 --- a/controllers/grid/settings/reviewForms/form/ReviewFormElements.inc.php +++ b/controllers/grid/settings/reviewForms/form/ReviewFormElements.inc.php @@ -19,13 +19,13 @@ class ReviewFormElements extends Form { - /** The ID of the review form being edited */ + /** @var int The ID of the review form being edited */ public $reviewFormId; /** * Constructor. * - * @param $reviewFormId + * @param int $reviewFormId */ public function __construct($reviewFormId) { diff --git a/controllers/grid/settings/reviewForms/form/ReviewFormForm.inc.php b/controllers/grid/settings/reviewForms/form/ReviewFormForm.inc.php index b8d14faebdb..109dc6e7eab 100644 --- a/controllers/grid/settings/reviewForms/form/ReviewFormForm.inc.php +++ b/controllers/grid/settings/reviewForms/form/ReviewFormForm.inc.php @@ -20,13 +20,13 @@ class ReviewFormForm extends Form { - /** The ID of the review form being edited, if any */ + /** @var int The ID of the review form being edited, if any */ public $reviewFormId; /** * Constructor. * - * @param $reviewFormId omit for a new review form + * @param int $reviewFormId omit for a new review form */ public function __construct($reviewFormId = null) { diff --git a/controllers/grid/settings/roles/UserGroupGridCellProvider.inc.php b/controllers/grid/settings/roles/UserGroupGridCellProvider.inc.php index 44fef1b72ed..7da32760727 100644 --- a/controllers/grid/settings/roles/UserGroupGridCellProvider.inc.php +++ b/controllers/grid/settings/roles/UserGroupGridCellProvider.inc.php @@ -25,8 +25,8 @@ class UserGroupGridCellProvider extends GridCellProvider * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/settings/roles/UserGroupGridHandler.inc.php b/controllers/grid/settings/roles/UserGroupGridHandler.inc.php index 2341db1ac7c..b5474351644 100644 --- a/controllers/grid/settings/roles/UserGroupGridHandler.inc.php +++ b/controllers/grid/settings/roles/UserGroupGridHandler.inc.php @@ -30,7 +30,7 @@ class UserGroupGridHandler extends GridHandler { - /** @var integer Context id. */ + /** @var int Context id. */ private $_contextId; /** @var UserGroup User group object handled by some grid operations. */ @@ -269,8 +269,8 @@ public function initFeatures($request, $args) /** * Handle the add user group operation. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function addUserGroup($args, $request) { @@ -280,7 +280,7 @@ public function addUserGroup($args, $request) /** * Handle the edit user group operation. * - * @param $args array + * @param array $args * * @return JSONMessage JSON object */ @@ -296,8 +296,8 @@ public function editUserGroup($args, $request) /** * Update user group data on database and grid. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -321,8 +321,8 @@ public function updateUserGroup($args, $request) /** * Remove user group. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -383,8 +383,8 @@ public function removeUserGroup($args, $request) /** * Assign stage to user group. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function assignStage($args, $request) { @@ -394,8 +394,8 @@ public function assignStage($args, $request) /** * Unassign stage to user group. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function unassignStage($args, $request) { @@ -409,8 +409,8 @@ public function unassignStage($args, $request) /** * Toggle user group stage assignment. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -457,7 +457,7 @@ private function _toggleAssignment($args, $request) /** * Get a UserGroupForm instance. * - * @param $request Request + * @param Request $request * * @return UserGroupForm */ diff --git a/controllers/grid/settings/roles/form/UserGroupForm.inc.php b/controllers/grid/settings/roles/form/UserGroupForm.inc.php index ca1d96ba1c2..c5d2ebeecc5 100644 --- a/controllers/grid/settings/roles/form/UserGroupForm.inc.php +++ b/controllers/grid/settings/roles/form/UserGroupForm.inc.php @@ -22,18 +22,18 @@ class UserGroupForm extends Form { - /** @var Id of the user group being edited */ + /** @var int Id of the user group being edited */ public $_userGroupId; - /** @var The context of the user group being edited */ + /** @var int The context of the user group being edited */ public $_contextId; /** * Constructor. * - * @param $contextId Context id. - * @param $userGroupId User group id. + * @param Context $contextId id. + * @param User $userGroupId group id. */ public function __construct($contextId, $userGroupId = null) { @@ -212,7 +212,7 @@ public function execute(...$functionParams) if (in_array($userGroup->getRoleId(), UserGroupDAO::getNotChangeMetadataEditPermissionRoles())) { $userGroup->setPermitMetadataEdit(true); } else { - $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var stageAssignmentDao StageAssignmentDAO */ + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ $allUserAssignments = $stageAssignmentDao ->getByUserGroupId($userGroupId, $this->getContextId()) ->toAssociativeArray(); @@ -246,8 +246,8 @@ public function execute(...$functionParams) /** * Setup the stages assignments to a user group in database. * - * @param $userGroupId int User group id that will receive the stages. - * @param $userAssignedStages array of stages currently assigned to a user. + * @param int $userGroupId User group id that will receive the stages. + * @param array $userAssignedStages of stages currently assigned to a user. */ public function _assignStagesToUserGroup($userGroupId, $userAssignedStages) { @@ -284,8 +284,8 @@ public function _assignStagesToUserGroup($userGroupId, $userAssignedStages) /** * Set locale fields on a User Group object. * - * @param UserGroup - * @param Request + * @param UserGroup $userGroup + * @param Request $request * * @return UserGroup */ diff --git a/controllers/grid/settings/sections/form/PKPSectionForm.inc.php b/controllers/grid/settings/sections/form/PKPSectionForm.inc.php index a55d49a6f00..d8ff1ec65e6 100644 --- a/controllers/grid/settings/sections/form/PKPSectionForm.inc.php +++ b/controllers/grid/settings/sections/form/PKPSectionForm.inc.php @@ -20,7 +20,7 @@ class PKPSectionForm extends Form { - /** the id for the section being edited **/ + /** @var int the id for the section being edited */ public $_sectionId; /** @var int The current user ID */ @@ -35,9 +35,9 @@ class PKPSectionForm extends Form /** * Constructor. * - * @param $request PKPRequest - * @param $template string Template path - * @param $sectionId int optional + * @param PKPRequest $request + * @param string $template Template path + * @param int $sectionId optional */ public function __construct($request, $template, $sectionId = null) { @@ -76,7 +76,7 @@ public function getSectionId() /** * Set the section ID for this section. * - * @param $sectionId int + * @param int $sectionId */ public function setSectionId($sectionId) { diff --git a/controllers/grid/settings/submissionChecklist/SubmissionChecklistGridHandler.inc.php b/controllers/grid/settings/submissionChecklist/SubmissionChecklistGridHandler.inc.php index e7c4badd9b0..654d4d00c8b 100644 --- a/controllers/grid/settings/submissionChecklist/SubmissionChecklistGridHandler.inc.php +++ b/controllers/grid/settings/submissionChecklist/SubmissionChecklistGridHandler.inc.php @@ -121,8 +121,8 @@ protected function loadData($request, $filter) /** * An action to add a new submissionChecklist * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function addItem($args, $request) { @@ -133,8 +133,8 @@ public function addItem($args, $request) /** * An action to edit a submissionChecklist * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -152,8 +152,8 @@ public function editItem($args, $request) /** * Update a submissionChecklist * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -178,8 +178,8 @@ public function updateItem($args, $request) /** * Delete a submissionChecklist * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/settings/submissionChecklist/form/SubmissionChecklistForm.inc.php b/controllers/grid/settings/submissionChecklist/form/SubmissionChecklistForm.inc.php index 6a0478912a1..2e6943f9aee 100644 --- a/controllers/grid/settings/submissionChecklist/form/SubmissionChecklistForm.inc.php +++ b/controllers/grid/settings/submissionChecklist/form/SubmissionChecklistForm.inc.php @@ -18,7 +18,7 @@ class SubmissionChecklistForm extends Form { - /** @var int The id for the submissionChecklist being edited **/ + /** @var int The id for the submissionChecklist being edited */ public $submissionChecklistId; /** @@ -42,7 +42,7 @@ public function __construct($submissionChecklistId = null) * * @see Form::initData * - * @param $args array + * @param array $args */ public function initData($args) { diff --git a/controllers/grid/settings/user/UserGridHandler.inc.php b/controllers/grid/settings/user/UserGridHandler.inc.php index b496a84b4cb..5f321e39820 100644 --- a/controllers/grid/settings/user/UserGridHandler.inc.php +++ b/controllers/grid/settings/user/UserGridHandler.inc.php @@ -33,7 +33,7 @@ class UserGridHandler extends GridHandler { - /** integer user id for the user to remove */ + /** @var int user id for the user to remove */ public $_oldUserId; /** @@ -176,7 +176,7 @@ public function initFeatures($request, $args) /** * @copydoc GridHandler::loadData() * - * @param $request PKPRequest + * @param PKPRequest $request * * @return array Grid data. */ @@ -292,8 +292,8 @@ public function getJSHandler() /** * Add a new user. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function addUser($args, $request) { @@ -304,8 +304,8 @@ public function addUser($args, $request) /** * Edit an existing user. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -333,8 +333,8 @@ public function editUser($args, $request) /** * Update an existing user. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -381,8 +381,8 @@ public function updateUser($args, $request) /** * Update a newly created user's roles * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -416,8 +416,8 @@ public function updateUserRoles($args, $request) /** * Edit enable/disable user form * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return string Serialized JSON object */ @@ -451,8 +451,8 @@ public function editDisableUser($args, $request) /** * Enable/Disable an existing user * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -491,8 +491,8 @@ public function disableUser($args, $request) /** * Remove all user group assignments for a context for a given user. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -528,8 +528,8 @@ public function removeUser($args, $request) /** * Displays a modal to edit an email message to the user. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return string Serialized JSON object */ @@ -563,8 +563,8 @@ public function editEmail($args, $request) /** * Send the user email and close the modal. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -602,8 +602,8 @@ public function sendEmail($args, $request) /** * Allow user account merging, including attributed submissions etc. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/settings/user/UserGridRow.inc.php b/controllers/grid/settings/user/UserGridRow.inc.php index 1a0455bfe53..044c7628fef 100644 --- a/controllers/grid/settings/user/UserGridRow.inc.php +++ b/controllers/grid/settings/user/UserGridRow.inc.php @@ -21,7 +21,7 @@ class UserGridRow extends GridRow { - /** the user id of the old user to remove when merging users. */ + /** @var int the user id of the old user to remove when merging users. */ public $_oldUserId; /** diff --git a/controllers/grid/settings/user/form/UserDetailsForm.inc.php b/controllers/grid/settings/user/form/UserDetailsForm.inc.php index 9eb586b76c1..8b1172c91ed 100644 --- a/controllers/grid/settings/user/form/UserDetailsForm.inc.php +++ b/controllers/grid/settings/user/form/UserDetailsForm.inc.php @@ -29,15 +29,15 @@ class UserDetailsForm extends UserForm /** @var User */ public $user; - /** @var An optional author to base this user on */ + /** @var Author An optional author to base this user on */ public $author; /** * Constructor. * - * @param $request PKPRequest - * @param $userId int optional - * @param $author Author optional + * @param PKPRequest $request + * @param int $userId optional + * @param Author $author optional */ public function __construct($request, $userId = null, $author = null) { @@ -352,7 +352,7 @@ public function execute(...$functionParams) // Send welcome email to user $mail = new MailTemplate('USER_REGISTER'); $mail->setReplyTo($context->getData('contactEmail'), $context->getData('contactName')); - $mail->assignParams(['username' => $this->getData('username'), 'password' => $password, 'userFullName' => $this->user->getFullName()]); + $mail->assignParams(['recipientUsername' => $this->getData('username'), 'password' => $password, 'recipientName' => $this->user->getFullName()]); $mail->addRecipient($this->user->getEmail(), $this->user->getFullName()); if (!$mail->send()) { $notificationMgr = new NotificationManager(); diff --git a/controllers/grid/settings/user/form/UserDisableForm.inc.php b/controllers/grid/settings/user/form/UserDisableForm.inc.php index cf808f5cce0..4916713b6a4 100644 --- a/controllers/grid/settings/user/form/UserDisableForm.inc.php +++ b/controllers/grid/settings/user/form/UserDisableForm.inc.php @@ -19,10 +19,10 @@ class UserDisableForm extends Form { - /** @var the user id of user to enable/disable */ + /** @var int The user id of user to enable/disable */ public $_userId; - /** @var whether to enable or disable the user */ + /** @var bool Whether to enable or disable the user */ public $_enable; /** diff --git a/controllers/grid/settings/user/form/UserEmailForm.inc.php b/controllers/grid/settings/user/form/UserEmailForm.inc.php index 22ffe4ffd25..0543eaa632b 100644 --- a/controllers/grid/settings/user/form/UserEmailForm.inc.php +++ b/controllers/grid/settings/user/form/UserEmailForm.inc.php @@ -22,13 +22,13 @@ class UserEmailForm extends Form { - /** @var the user id of user to send email to */ + /** @var int The user id of user to send email to */ public $userId; /** * Constructor. * - * @param $userId int User ID to contact. + * @param int $userId User ID to contact. */ public function __construct($userId) { diff --git a/controllers/grid/settings/user/form/UserForm.inc.php b/controllers/grid/settings/user/form/UserForm.inc.php index fb27d0c0db7..d1acc6e2bf3 100644 --- a/controllers/grid/settings/user/form/UserForm.inc.php +++ b/controllers/grid/settings/user/form/UserForm.inc.php @@ -19,13 +19,13 @@ class UserForm extends Form { - /** @var Id of the user being edited */ + /** @var int Id of the user being edited */ public $userId; /** * Constructor. * - * @param $userId int optional + * @param int $userId optional */ public function __construct($template, $userId = null) { diff --git a/controllers/grid/users/author/AuthorGridHandler.inc.php b/controllers/grid/users/author/AuthorGridHandler.inc.php index a90bc382a4b..6e493b2eafe 100644 --- a/controllers/grid/users/author/AuthorGridHandler.inc.php +++ b/controllers/grid/users/author/AuthorGridHandler.inc.php @@ -33,7 +33,7 @@ class AuthorGridHandler extends GridHandler { - /** @var boolean */ + /** @var bool */ public $_readOnly; /** @var int */ @@ -81,7 +81,7 @@ public function getPublication() /** * Get whether or not this grid should be 'read only' * - * @return boolean + * @return bool */ public function getReadOnly() { @@ -91,7 +91,7 @@ public function getReadOnly() /** * Set the boolean for 'read only' status * - * @param boolean + * @param bool $readOnly */ public function setReadOnly($readOnly) { @@ -269,9 +269,9 @@ public function getRequestArgs() /** * Determines if there should be add/edit actions on this grid. * - * @param $user User + * @param User $user * - * @return boolean + * @return bool */ public function canAdminister($user) { @@ -324,8 +324,8 @@ protected function loadData($request, $filter = null) /** * An action to manually add a new author * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function addAuthor($args, $request) { @@ -340,8 +340,8 @@ public function addAuthor($args, $request) /** * Edit an author * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -366,8 +366,8 @@ public function editAuthor($args, $request) /** * Update an author * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -429,8 +429,8 @@ public function updateAuthor($args, $request) /** * Delete a author * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -456,8 +456,8 @@ public function deleteAuthor($args, $request) /** * Add a user with data initialized from an existing author. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/users/author/AuthorGridRow.inc.php b/controllers/grid/users/author/AuthorGridRow.inc.php index b06467740d2..41784583d1d 100644 --- a/controllers/grid/users/author/AuthorGridRow.inc.php +++ b/controllers/grid/users/author/AuthorGridRow.inc.php @@ -21,13 +21,13 @@ class AuthorGridRow extends GridRow { - /** @var Submission **/ + /** @var Submission */ public $_submission; - /** @var Publication **/ + /** @var Publication */ public $_publication; - /** @var boolean */ + /** @var bool */ public $_readOnly; /** @var int */ @@ -158,7 +158,7 @@ public function getRequestArgs() * * @param PKPRequest $request * - * @return boolean + * @return bool */ public function allowedToCreateUser($request) { @@ -168,7 +168,7 @@ public function allowedToCreateUser($request) /** * Determine if this grid row should be read only. * - * @return boolean + * @return bool */ public function isReadOnly() { diff --git a/controllers/grid/users/author/PKPAuthorGridCellProvider.inc.php b/controllers/grid/users/author/PKPAuthorGridCellProvider.inc.php index cf893459545..15c28119838 100644 --- a/controllers/grid/users/author/PKPAuthorGridCellProvider.inc.php +++ b/controllers/grid/users/author/PKPAuthorGridCellProvider.inc.php @@ -38,8 +38,8 @@ public function __construct($publication) * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/users/author/form/PKPAuthorForm.inc.php b/controllers/grid/users/author/form/PKPAuthorForm.inc.php index 322adb4a4e6..f293af3c5dc 100644 --- a/controllers/grid/users/author/form/PKPAuthorForm.inc.php +++ b/controllers/grid/users/author/form/PKPAuthorForm.inc.php @@ -25,10 +25,10 @@ class PKPAuthorForm extends Form { - /** The publication associated with the contributor being edited **/ + /** @var Publication publication associated with the contributor being edited */ public $_publication; - /** Author the author being edited **/ + /** @var Author the author being edited */ public $_author; /** @@ -79,7 +79,7 @@ public function getAuthor(): ?Author /** * Set the author * - * @param @author Author + * @param Author $author */ public function setAuthor($author) { @@ -99,7 +99,7 @@ public function getPublication() /** * Set the Publication * - * @param Publication + * @param Publication $publication */ public function setPublication($publication) { diff --git a/controllers/grid/users/exportableUsers/ExportableUsersGridHandler.inc.php b/controllers/grid/users/exportableUsers/ExportableUsersGridHandler.inc.php index 6f280bdde8a..ec6449e80f7 100644 --- a/controllers/grid/users/exportableUsers/ExportableUsersGridHandler.inc.php +++ b/controllers/grid/users/exportableUsers/ExportableUsersGridHandler.inc.php @@ -183,7 +183,7 @@ public function isDataElementSelected($gridDataElement) /** * @copydoc GridHandler::loadData() * - * @param $request PKPRequest + * @param PKPRequest $request * * @return array Grid data. */ diff --git a/controllers/grid/users/reviewer/AuthorReviewerGridCellProvider.inc.php b/controllers/grid/users/reviewer/AuthorReviewerGridCellProvider.inc.php index c682934dcde..53d3cddc250 100644 --- a/controllers/grid/users/reviewer/AuthorReviewerGridCellProvider.inc.php +++ b/controllers/grid/users/reviewer/AuthorReviewerGridCellProvider.inc.php @@ -25,8 +25,8 @@ class AuthorReviewerGridCellProvider extends DataObjectGridCellProvider /** * Gathers the state of a given cell given a $row/$column combination * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return string */ @@ -49,8 +49,8 @@ public function getCellState($row, $column) * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ @@ -80,8 +80,8 @@ public function getTemplateVarsFromRowColumn($row, $column) /** * Get cell actions associated with this row/column combination * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array an array of LinkAction instances */ @@ -118,7 +118,7 @@ public function getCellActions($request, $row, $column, $position = GridHandler: * Provide meaningful locale keys for the various grid status states. * * @param string $state - * @param $row \PKP\controllers\grid\GridRow + * @param \PKP\controllers\grid\GridRow $row * * @return string */ diff --git a/controllers/grid/users/reviewer/AuthorReviewerGridHandler.inc.php b/controllers/grid/users/reviewer/AuthorReviewerGridHandler.inc.php index 6fcde59b7ec..a9bec0f68e4 100644 --- a/controllers/grid/users/reviewer/AuthorReviewerGridHandler.inc.php +++ b/controllers/grid/users/reviewer/AuthorReviewerGridHandler.inc.php @@ -161,8 +161,8 @@ protected function loadData($request, $filter) * Open a modal to read the reviewer's review and * download any files they may have uploaded * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/grid/users/reviewer/ReviewerGridCellProvider.inc.php b/controllers/grid/users/reviewer/ReviewerGridCellProvider.inc.php index e168ee2306c..469bf068f38 100644 --- a/controllers/grid/users/reviewer/ReviewerGridCellProvider.inc.php +++ b/controllers/grid/users/reviewer/ReviewerGridCellProvider.inc.php @@ -19,13 +19,13 @@ class ReviewerGridCellProvider extends DataObjectGridCellProvider { - /** @var boolean Is the current user assigned as an author to this submission */ + /** @var bool Is the current user assigned as an author to this submission */ public $_isCurrentUserAssignedAuthor; /** * Constructor * - * @param $isCurrentUserAssignedAuthor boolean Is the current user assigned + * @param bool $isCurrentUserAssignedAuthor Is the current user assigned * as an author to this submission? */ public function __construct($isCurrentUserAssignedAuthor) @@ -40,8 +40,8 @@ public function __construct($isCurrentUserAssignedAuthor) /** * Gathers the state of a given cell given a $row/$column combination * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return string */ @@ -64,8 +64,8 @@ public function getCellState($row, $column) * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ @@ -99,8 +99,8 @@ public function getTemplateVarsFromRowColumn($row, $column) /** * Get cell actions associated with this row/column combination * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array an array of LinkAction instances */ @@ -155,7 +155,7 @@ public function getCellActions($request, $row, $column, $position = GridHandler: * Provide meaningful locale keys for the various grid status states. * * @param string $state - * @param $row \PKP\controllers\grid\GridRow + * @param \PKP\controllers\grid\GridRow $row * * @return string */ diff --git a/controllers/grid/users/reviewer/ReviewerGridRow.inc.php b/controllers/grid/users/reviewer/ReviewerGridRow.inc.php index 5dac25e2231..e06a8a48770 100644 --- a/controllers/grid/users/reviewer/ReviewerGridRow.inc.php +++ b/controllers/grid/users/reviewer/ReviewerGridRow.inc.php @@ -21,13 +21,13 @@ class ReviewerGridRow extends GridRow { - /** @var boolean Is the current user assigned as an author to this submission */ + /** @var bool Is the current user assigned as an author to this submission */ public $_isCurrentUserAssignedAuthor; /** * Constructor * - * @param $isCurrentUserAssignedAuthor boolean Is the current user assigned as an + * @param bool $isCurrentUserAssignedAuthor Is the current user assigned as an * author to this submission? */ public function __construct($isCurrentUserAssignedAuthor) diff --git a/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.inc.php b/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.inc.php index 14870985aa4..cdbaf97b453 100644 --- a/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.inc.php +++ b/controllers/grid/users/reviewer/form/AdvancedSearchReviewerForm.inc.php @@ -27,8 +27,8 @@ class AdvancedSearchReviewerForm extends ReviewerForm /** * Constructor. * - * @param $submission Submission - * @param $reviewRound ReviewRound + * @param Submission $submission + * @param ReviewRound $reviewRound */ public function __construct($submission, $reviewRound) { diff --git a/controllers/grid/users/reviewer/form/CreateReviewerForm.inc.php b/controllers/grid/users/reviewer/form/CreateReviewerForm.inc.php index caf620e7ff1..c1322031ba6 100644 --- a/controllers/grid/users/reviewer/form/CreateReviewerForm.inc.php +++ b/controllers/grid/users/reviewer/form/CreateReviewerForm.inc.php @@ -27,8 +27,8 @@ class CreateReviewerForm extends ReviewerForm /** * Constructor. * - * @param $submission Submission - * @param $reviewRound ReviewRound + * @param Submission $submission + * @param ReviewRound $reviewRound */ public function __construct($submission, $reviewRound) { @@ -150,7 +150,7 @@ public function execute(...$functionArgs) $request = Application::get()->getRequest(); $context = $request->getContext(); $mail->setReplyTo($context->getData('contactEmail'), $context->getData('contactName')); - $mail->assignParams(['username' => $this->getData('username'), 'password' => $password, 'userFullName' => $user->getFullName()]); + $mail->assignParams(['recipientUsername' => $this->getData('username'), 'password' => $password, 'recipientName' => $user->getFullName()]); $mail->addRecipient($user->getEmail(), $user->getFullName()); if (!$mail->send($request)) { $notificationMgr = new NotificationManager(); diff --git a/controllers/grid/users/reviewer/form/EditReviewForm.inc.php b/controllers/grid/users/reviewer/form/EditReviewForm.inc.php index 63b71e6fb94..0f3aae3d0a2 100644 --- a/controllers/grid/users/reviewer/form/EditReviewForm.inc.php +++ b/controllers/grid/users/reviewer/form/EditReviewForm.inc.php @@ -35,7 +35,7 @@ class EditReviewForm extends Form /** * Constructor. * - * @param $reviewAssignment ReviewAssignment + * @param ReviewAssignment $reviewAssignment */ public function __construct($reviewAssignment) { @@ -135,12 +135,12 @@ public function execute(...$functionArgs) $reviewFilesDao->revokeByReviewId($this->_reviewAssignment->getId()); $fileStages = [$this->_reviewRound->getStageId() == WORKFLOW_STAGE_ID_INTERNAL_REVIEW ? SubmissionFile::SUBMISSION_FILE_INTERNAL_REVIEW_FILE : SubmissionFile::SUBMISSION_FILE_REVIEW_FILE]; - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$this->_reviewAssignment->getSubmissionId()]) ->filterByReviewRoundIds([$this->_reviewRound->getId()]) ->filterByFileStages($fileStages); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); $selectedFiles = array_map(function ($id) { return (int) $id; }, (array) $this->getData('selectedFiles')); diff --git a/controllers/grid/users/reviewer/form/EmailReviewerForm.inc.php b/controllers/grid/users/reviewer/form/EmailReviewerForm.inc.php index 1df9d8021e0..62cf47b12f5 100644 --- a/controllers/grid/users/reviewer/form/EmailReviewerForm.inc.php +++ b/controllers/grid/users/reviewer/form/EmailReviewerForm.inc.php @@ -30,7 +30,7 @@ class EmailReviewerForm extends Form /** * Constructor. * - * @param $reviewAssignment ReviewAssignment The review assignment to use for this contact. + * @param ReviewAssignment $reviewAssignment The review assignment to use for this contact. */ public function __construct($reviewAssignment) { @@ -60,7 +60,7 @@ public function readInputData() /** * Display the form. * - * @param $requestArgs array Request parameters to bounce back with the form submission. + * @param array $requestArgs Request parameters to bounce back with the form submission. * @param null|mixed $template * * @see Form::fetch @@ -82,7 +82,7 @@ public function fetch($request, $template = null, $display = false, $requestArgs /** * Send the email * - * @param $submission Submission + * @param Submission $submission */ public function execute($submission, ...$functionArgs) { diff --git a/controllers/grid/users/reviewer/form/ReinstateReviewerForm.inc.php b/controllers/grid/users/reviewer/form/ReinstateReviewerForm.inc.php index e6c16093f64..eb423651038 100644 --- a/controllers/grid/users/reviewer/form/ReinstateReviewerForm.inc.php +++ b/controllers/grid/users/reviewer/form/ReinstateReviewerForm.inc.php @@ -28,9 +28,9 @@ class ReinstateReviewerForm extends ReviewerNotifyActionForm /** * Constructor * - * @param $reviewAssignment ReviewAssignment - * @param $reviewRound ReviewRound - * @param $submission Submission + * @param ReviewAssignment $reviewAssignment + * @param ReviewRound $reviewRound + * @param Submission $submission */ public function __construct($reviewAssignment, $reviewRound, $submission) { diff --git a/controllers/grid/users/reviewer/form/ReviewReminderForm.inc.php b/controllers/grid/users/reviewer/form/ReviewReminderForm.inc.php index 4b9a097de7a..1b0b423d9d3 100644 --- a/controllers/grid/users/reviewer/form/ReviewReminderForm.inc.php +++ b/controllers/grid/users/reviewer/form/ReviewReminderForm.inc.php @@ -24,7 +24,7 @@ class ReviewReminderForm extends Form { - /** The review assignment associated with the reviewer **/ + /** @var ReviewAssignment The review assignment associated with the reviewer */ public $_reviewAssignment; /** @@ -90,12 +90,12 @@ public function initData() $dispatcher = $request->getDispatcher(); $paramArray = [ - 'reviewerName' => $reviewer->getFullName(), + 'recipientName' => $reviewer->getFullName(), 'reviewDueDate' => $reviewDueDate, - 'editorialContactSignature' => $user->getContactSignature(), - 'reviewerUserName' => $reviewer->getUsername(), + 'signature' => $user->getContactSignature(), + 'recipientUsername' => $reviewer->getUsername(), 'passwordResetUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'login', 'resetPassword', $reviewer->getUsername(), ['confirm' => Validation::generatePasswordResetHash($reviewer->getId())]), - 'submissionReviewUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'reviewer', 'submission', null, ['submissionId' => $reviewAssignment->getSubmissionId()]) + 'reviewAssignmentUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'reviewer', 'submission', null, ['submissionId' => $reviewAssignment->getSubmissionId()]) ]; $email->assignParams($paramArray); @@ -120,13 +120,13 @@ public function fetch($request, $template = null, $display = false) $templateMgr = TemplateManager::getManager($request); $templateMgr->assign('emailVariables', [ - 'reviewerName' => __('user.name'), + 'recipientName' => __('user.name'), 'reviewDueDate' => __('reviewer.submission.reviewDueDate'), - 'submissionReviewUrl' => __('common.url'), + 'reviewAssignmentUrl' => __('common.url'), 'submissionTitle' => __('submission.title'), 'passwordResetUrl' => __('common.url'), - 'contextName' => $context->getLocalizedName(), - 'editorialContactSignature' => $user->getContactSignature(), + 'journalName' => $context->getLocalizedName(), + 'signature' => $user->getContactSignature(), ]); return parent::fetch($request, $template, $display); } @@ -174,11 +174,11 @@ public function execute(...$functionArgs) $email->addRecipient($reviewer->getEmail(), $reviewer->getFullName()); $email->setBody($this->getData('message')); $email->assignParams([ - 'reviewerName' => $reviewer->getFullName(), + 'recipientName' => $reviewer->getFullName(), 'reviewDueDate' => $reviewDueDate, 'passwordResetUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'login', 'resetPassword', $reviewer->getUsername(), ['confirm' => Validation::generatePasswordResetHash($reviewer->getId())]), - 'submissionReviewUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'reviewer', 'submission', null, $reviewUrlArgs), - 'editorialContactSignature' => $user->getContactSignature(), + 'reviewAssignmentUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'reviewer', 'submission', null, $reviewUrlArgs), + 'signature' => $user->getContactSignature(), ]); if (!$email->send($request)) { $notificationMgr = new NotificationManager(); @@ -198,7 +198,7 @@ public function execute(...$functionArgs) * Get the email template key depending on if reviewer one click access is * enabled or not. * - * @param $context Context The user's current context. + * @param Context $context The user's current context. * * @return int Email template key */ diff --git a/controllers/grid/users/reviewer/form/ReviewerForm.inc.php b/controllers/grid/users/reviewer/form/ReviewerForm.inc.php index cfeecc130de..b3106bdae94 100644 --- a/controllers/grid/users/reviewer/form/ReviewerForm.inc.php +++ b/controllers/grid/users/reviewer/form/ReviewerForm.inc.php @@ -29,23 +29,23 @@ class ReviewerForm extends Form { - /** The submission associated with the review assignment **/ + /** @var Submission The submission associated with the review assignment */ public $_submission; - /** The review round associated with the review assignment **/ + /** @var ReviewRound The review round associated with the review assignment */ public $_reviewRound; - /** An array of actions for the other reviewer forms */ + /** @var array An array of actions for the other reviewer forms */ public $_reviewerFormActions; - /** An array with all current user roles */ + /** @var array An array with all current user roles */ public $_userRoles; /** * Constructor. * - * @param $submission Submission - * @param $reviewRound ReviewRound + * @param Submission $submission + * @param ReviewRound $reviewRound */ public function __construct($submission, $reviewRound) { @@ -98,7 +98,7 @@ public function getReviewRound() /** * Set the submission * - * @param $submission Submission + * @param Submission $submission */ public function setSubmission($submission) { @@ -108,7 +108,7 @@ public function setSubmission($submission) /** * Set the ReviewRound * - * @param $reviewRound ReviewRound + * @param ReviewRound $reviewRound */ public function setReviewRound($reviewRound) { @@ -118,7 +118,7 @@ public function setReviewRound($reviewRound) /** * Set a reviewer form action * - * @param $action LinkAction + * @param LinkAction $action */ public function setReviewerFormAction($action) { @@ -128,7 +128,7 @@ public function setReviewerFormAction($action) /** * Set current user roles. * - * @param $userRoles Array + * @param array $userRoles */ public function setUserRoles($userRoles) { @@ -241,10 +241,10 @@ public function initData() $dispatcher = $request->getDispatcher(); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_REVIEWER); // reviewer.step1.requestBoilerplate $template->assignParams([ - 'contextUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context->getPath()), - 'editorialContactSignature' => $user->getContactSignature(), - 'signatureFullName' => $user->getFullname(), - 'passwordResetUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context->getPath(), 'login', 'lostPassword'), + 'journalUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context->getPath()), + 'signature' => $user->getContactSignature(), + 'senderName' => $user->getFullname(), + 'passwordLostUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context->getPath(), 'login', 'lostPassword'), 'messageToReviewer' => __('reviewer.step1.requestBoilerplate'), 'abstractTermIfEnabled' => ($submission->getLocalizedAbstract() == '' ? '' : __('common.abstract')), // Deprecated; for OJS 2.x templates ]); @@ -283,11 +283,11 @@ public function fetch($request, $template = null, $display = false) $templateMgr->assign('reviewForms', $reviewForms); $templateMgr->assign('emailVariables', [ - 'reviewerName' => __('user.name'), + 'recipientName' => __('user.name'), 'responseDueDate' => __('reviewer.submission.responseDueDate'), 'reviewDueDate' => __('reviewer.submission.reviewDueDate'), - 'submissionReviewUrl' => __('common.url'), - 'reviewerUserName' => __('user.username'), + 'reviewAssignmentUrl' => __('common.url'), + 'recipientUsername' => __('user.username'), ]); // Allow the default template $templateKeys[] = $this->_getMailTemplateKey($request->getContext()); @@ -404,12 +404,12 @@ public function execute(...$functionParams) $fileStages = [$stageId == WORKFLOW_STAGE_ID_INTERNAL_REVIEW ? SubmissionFile::SUBMISSION_FILE_INTERNAL_REVIEW_FILE : SubmissionFile::SUBMISSION_FILE_REVIEW_FILE]; // Grant access for this review to all selected files. - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$submission->getId()]) ->filterByReviewRoundIds([$currentReviewRound->getId()]) ->filterByFileStages($fileStages); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); $selectedFiles = array_map(function ($id) { return (int) $id; }, (array) $this->getData('selectedFiles')); @@ -441,7 +441,7 @@ public function execute(...$functionParams) /** * Get the link action that fetchs the advanced search form content * - * @param $request Request + * @param Request $request * * @return LinkAction */ @@ -468,12 +468,12 @@ public function getAdvancedSearchAction($request) /** * Check if a given user id is enrolled in reviewer user group. * - * @param $context Context - * @param $submission Submission - * @param $reviewRound ReviewRound - * @param $reviewerId int + * @param Context $context + * @param Submission $submission + * @param ReviewRound $reviewRound + * @param int $reviewerId * - * @return boolean + * @return bool */ public function _isValidReviewer($context, $submission, $reviewRound, $reviewerId) { @@ -495,7 +495,7 @@ public function _isValidReviewer($context, $submission, $reviewRound, $reviewerI * Get the email template key depending on if reviewer one click access is * enabled or not as well as on review round. * - * @param $context Context The user's current context. + * @param Context $context The user's current context. * * @return int Email template key */ diff --git a/controllers/grid/users/reviewer/form/ReviewerGossipForm.inc.php b/controllers/grid/users/reviewer/form/ReviewerGossipForm.inc.php index 66529243b2b..bea90e06ded 100644 --- a/controllers/grid/users/reviewer/form/ReviewerGossipForm.inc.php +++ b/controllers/grid/users/reviewer/form/ReviewerGossipForm.inc.php @@ -28,8 +28,8 @@ class ReviewerGossipForm extends Form /** * Constructor. * - * @param $user User The user to gossip about - * @param $requestArgs array Arguments used to route the form op to the + * @param User $user The user to gossip about + * @param array $requestArgs Arguments used to route the form op to the * correct submission, stage and review round */ public function __construct($user, $requestArgs) diff --git a/controllers/grid/users/reviewer/form/ReviewerNotifyActionForm.inc.php b/controllers/grid/users/reviewer/form/ReviewerNotifyActionForm.inc.php index 1ae661e64a6..cc3dbce8ff3 100644 --- a/controllers/grid/users/reviewer/form/ReviewerNotifyActionForm.inc.php +++ b/controllers/grid/users/reviewer/form/ReviewerNotifyActionForm.inc.php @@ -18,22 +18,22 @@ abstract class ReviewerNotifyActionForm extends Form { - /** The review assignment to alter */ + /** @var ReviewAssignment The review assignment to alter */ public $_reviewAssignment; - /** The submission associated with the review assignment **/ + /** @var Submission The submission associated with the review assignment */ public $_submission; - /** The review round associated with the review assignment **/ + /** @var ReviewRound The review round associated with the review assignment */ public $_reviewRound; /** * Constructor * - * @param $reviewAssignment ReviewAssignment - * @param $reviewRound ReviewRound - * @param $submission Submission - * @param $template string + * @param ReviewAssignment $reviewAssignment + * @param ReviewRound $reviewRound + * @param Submission $submission + * @param string $template */ public function __construct($reviewAssignment, $reviewRound, $submission, $template) { @@ -74,8 +74,8 @@ public function initData() $user = $request->getUser(); $template->assignParams([ - 'reviewerName' => $reviewer->getFullName(), - 'signatureFullName' => $user->getFullname(), + 'recipientName' => $reviewer->getFullName(), + 'senderName' => $user->getFullname(), ]); $template->replaceParams(); @@ -145,7 +145,7 @@ public function getReviewRound() /** * Set the submission * - * @param $submission Submission + * @param Submission $submission */ public function setSubmission($submission) { diff --git a/controllers/grid/users/reviewer/form/ThankReviewerForm.inc.php b/controllers/grid/users/reviewer/form/ThankReviewerForm.inc.php index 940d94e7139..94009e7bbc0 100644 --- a/controllers/grid/users/reviewer/form/ThankReviewerForm.inc.php +++ b/controllers/grid/users/reviewer/form/ThankReviewerForm.inc.php @@ -22,7 +22,7 @@ class ThankReviewerForm extends Form { - /** The review assignment associated with the reviewer **/ + /** @var ReviewAssignment The review assignment associated with the reviewer */ public $_reviewAssignment; /** @@ -73,10 +73,10 @@ public function initData() $dispatcher = $request->getDispatcher(); $email->assignParams([ - 'reviewerName' => $reviewer->getFullName(), - 'reviewerUserName' => $reviewer->getUsername(), + 'recipientName' => $reviewer->getFullName(), + 'recipientUsername' => $reviewer->getUsername(), 'passwordResetUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'login', 'resetPassword', $reviewer->getUsername(), ['confirm' => Validation::generatePasswordResetHash($reviewer->getId())]), - 'submissionReviewUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'reviewer', 'submission', null, ['submissionId' => $reviewAssignment->getSubmissionId()]) + 'reviewAssignmentUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'reviewer', 'submission', null, ['submissionId' => $reviewAssignment->getSubmissionId()]) ]); $email->replaceParams(); @@ -120,10 +120,10 @@ public function execute(...$functionArgs) $context = $request->getContext(); $user = $request->getUser(); $email->assignParams([ - 'reviewerName' => $reviewer->getFullName(), - 'contextUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context->getPath()), - 'editorialContactSignature' => $user->getContactSignature(), - 'signatureFullName' => $user->getFullname(), + 'recipientName' => $reviewer->getFullName(), + 'journalUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context->getPath()), + 'signature' => $user->getContactSignature(), + 'senderName' => $user->getFullname(), ]); if (!$email->send($request)) { $notificationMgr = new NotificationManager(); diff --git a/controllers/grid/users/stageParticipant/StageParticipantGridCategoryRow.inc.php b/controllers/grid/users/stageParticipant/StageParticipantGridCategoryRow.inc.php index 5ec2002849b..3e74411d53e 100644 --- a/controllers/grid/users/stageParticipant/StageParticipantGridCategoryRow.inc.php +++ b/controllers/grid/users/stageParticipant/StageParticipantGridCategoryRow.inc.php @@ -19,7 +19,7 @@ class StageParticipantGridCategoryRow extends GridCategoryRow { - /** @var Submission **/ + /** @var Submission */ public $_submission; /** @var int */ diff --git a/controllers/grid/users/stageParticipant/StageParticipantGridCellProvider.inc.php b/controllers/grid/users/stageParticipant/StageParticipantGridCellProvider.inc.php index a88b89eeb35..c8625da4e80 100644 --- a/controllers/grid/users/stageParticipant/StageParticipantGridCellProvider.inc.php +++ b/controllers/grid/users/stageParticipant/StageParticipantGridCellProvider.inc.php @@ -26,8 +26,8 @@ class StageParticipantGridCellProvider extends DataObjectGridCellProvider * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/users/stageParticipant/StageParticipantGridHandler.inc.php b/controllers/grid/users/stageParticipant/StageParticipantGridHandler.inc.php index a6313ab1eaa..a57e98b2d62 100644 --- a/controllers/grid/users/stageParticipant/StageParticipantGridHandler.inc.php +++ b/controllers/grid/users/stageParticipant/StageParticipantGridHandler.inc.php @@ -18,9 +18,9 @@ import('lib.pkp.controllers.grid.users.stageParticipant.StageParticipantGridCategoryRow'); use APP\facades\Repo; +use APP\i18n\AppLocale; use APP\log\SubmissionEventLogEntry; use APP\notification\NotificationManager; -use APP\workflow\EditorDecisionActionsManager; use PKP\controllers\grid\CategoryGridHandler; use PKP\controllers\grid\GridColumn; use PKP\core\JSONMessage; @@ -73,7 +73,7 @@ public function getSubmission() /** * Get the authorized workflow stage. * - * @return integer + * @return int */ public function getStageId() { @@ -97,7 +97,7 @@ public function authorize($request, &$args, $roleAssignments) * Determine whether the current user has admin priveleges for this * grid. * - * @return boolean + * @return bool */ protected function _canAdminister() { @@ -303,8 +303,8 @@ protected function loadData($request, $filter) /** * Add a participant to the stages * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -328,8 +328,8 @@ public function addParticipant($args, $request) /** * Update the row for the current userGroup's stage participant list. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -356,7 +356,7 @@ public function saveParticipant($args, $request) if ($userGroup->getRoleId() == Role::ROLE_ID_MANAGER) { $notificationMgr->updateNotification( $request, - (new EditorDecisionActionsManager())->getStageNotifications(), + $notificationMgr->getDecisionStageNotifications(), null, ASSOC_TYPE_SUBMISSION, $submission->getId() @@ -394,8 +394,8 @@ public function saveParticipant($args, $request) /** * Delete the participant from the user groups * - * @param $args - * @param $request + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -419,7 +419,7 @@ public function deleteParticipant($args, $request) $notificationMgr = new NotificationManager(); $notificationMgr->updateNotification( $request, - (new EditorDecisionActionsManager())->getStageNotifications(), + $notificationMgr->getDecisionStageNotifications(), null, ASSOC_TYPE_SUBMISSION, $submission->getId() @@ -456,8 +456,8 @@ public function deleteParticipant($args, $request) /** * Get the list of users for the specified user group * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -493,8 +493,8 @@ public function fetchUserList($args, $request) /** * Display the notify tab. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -512,8 +512,8 @@ public function viewNotify($args, $request) /** * Send a notification from the notify tab. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -559,20 +559,20 @@ public function sendNotification($args, $request) /** * Fetches an email template's message body and returns it via AJAX. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ public function fetchTemplateBody($args, $request) { $templateKey = $request->getUserVar('template'); - $template = new SubmissionMailTemplate($this->getSubmission(), $templateKey); + $template = new SubmissionMailTemplate($this->getSubmission(), $templateKey, null, null, false); if ($template) { $user = $request->getUser(); $template->assignParams([ - 'editorialContactSignature' => $user->getContactSignature(), - 'signatureFullName' => $user->getFullname(), + 'signature' => $user->getContactSignature(AppLocale::getLocale()), + 'senderName' => $user->getFullname(), ]); $template->replaceParams(); diff --git a/controllers/grid/users/stageParticipant/StageParticipantGridRow.inc.php b/controllers/grid/users/stageParticipant/StageParticipantGridRow.inc.php index c3c36bd1497..c684f593b24 100644 --- a/controllers/grid/users/stageParticipant/StageParticipantGridRow.inc.php +++ b/controllers/grid/users/stageParticipant/StageParticipantGridRow.inc.php @@ -27,7 +27,7 @@ class StageParticipantGridRow extends GridRow /** @var int */ public $_stageId; - /** @var boolean Whether the user can admin this row */ + /** @var bool Whether the user can admin this row */ public $_canAdminister; /** diff --git a/controllers/grid/users/stageParticipant/form/AddParticipantForm.inc.php b/controllers/grid/users/stageParticipant/form/AddParticipantForm.inc.php index 663a320a998..c922cbb3daf 100644 --- a/controllers/grid/users/stageParticipant/form/AddParticipantForm.inc.php +++ b/controllers/grid/users/stageParticipant/form/AddParticipantForm.inc.php @@ -21,27 +21,27 @@ class AddParticipantForm extends StageParticipantNotifyForm { - /** @var Submission The submission associated with the submission contributor being edited **/ + /** @var Submission The submission associated with the submission contributor being edited */ public $_submission; - /** @var int $_assignmentId Used for edit the assignment **/ + /** @var int $_assignmentId Used for edit the assignment */ public $_assignmentId; - /** @var array $_managerGroupIds Contains all manager group_ids **/ + /** @var array $_managerGroupIds Contains all manager group_ids */ public $_managerGroupIds; - /** @var array $_possibleRecommendOnlyUserGroupIds Contains all group_ids that can have the recommendOnly field available for change **/ + /** @var array $_possibleRecommendOnlyUserGroupIds Contains all group_ids that can have the recommendOnly field available for change */ public $_possibleRecommendOnlyUserGroupIds; - /** @var int $_contextId the current Context Id **/ + /** @var int $_contextId the current Context Id */ public $_contextId; /** * Constructor. * - * @param $submission Submission - * @param $stageId int STAGE_ID_... - * @param $assignmentId int Optional - Used for edit the assignment + * @param Submission $submission + * @param int $stageId STAGE_ID_... + * @param int $assignmentId Optional - Used for edit the assignment */ public function __construct($submission, $stageId, $assignmentId = null) { @@ -89,9 +89,9 @@ public function initialize() /** * Determine whether the specified user group is potentially restricted from editing metadata. * - * @param $userGroupId int + * @param int $userGroupId * - * @return boolean + * @return bool */ protected function _isChangePermitMetadataAllowed($userGroupId) { @@ -101,9 +101,9 @@ protected function _isChangePermitMetadataAllowed($userGroupId) /** * Determine whether the specified group is potentially required to make recommendations rather than decisions. * - * @param $userGroupId int + * @param int $userGroupId * - * @return boolean + * @return bool */ protected function _isChangeRecommendOnlyAllowed($userGroupId) { @@ -272,7 +272,7 @@ public function execute(...$functionParams) /** * whether or not to require a message field * - * @return boolean + * @return bool */ public function isMessageRequired() { diff --git a/controllers/grid/users/stageParticipant/form/PKPStageParticipantNotifyForm.inc.php b/controllers/grid/users/stageParticipant/form/PKPStageParticipantNotifyForm.inc.php index 951b5861b51..1b1e864bb74 100644 --- a/controllers/grid/users/stageParticipant/form/PKPStageParticipantNotifyForm.inc.php +++ b/controllers/grid/users/stageParticipant/form/PKPStageParticipantNotifyForm.inc.php @@ -33,7 +33,7 @@ abstract class PKPStageParticipantNotifyForm extends Form /** @var int The type of item the form is for (used to determine which email template to use) */ public $_itemType; - /** The stage Id **/ + /** @var int The stage Id */ public $_stageId; /** @var int the Submission id */ @@ -55,7 +55,7 @@ public function __construct($itemId, $itemType, $stageId, $template = null) if ($itemType == ASSOC_TYPE_SUBMISSION) { $this->_submissionId = $itemId; } else { - $submissionFile = Repo::submissionFiles()->get($itemId); + $submissionFile = Repo::submissionFile()->get($itemId); $this->_submissionId = $submissionFile->getData('submissionId'); } @@ -157,9 +157,9 @@ public function execute(...$functionParams) /** * Send a message to a user. * - * @param $userId int the user id to send email to. - * @param $submission Submission - * @param $request PKPRequest + * @param int $userId the user id to send email to. + * @param Submission $submission + * @param PKPRequest $request */ public function sendMessage($userId, $submission, $request) { @@ -178,14 +178,10 @@ public function sendMessage($userId, $submission, $request) // Parameters for various emails $email->assignParams([ - // COPYEDIT_REQUEST, LAYOUT_REQUEST, INDEX_REQUEST - 'participantName' => $user->getFullName(), - 'participantUsername' => $user->getUsername(), + // COPYEDIT_REQUEST, LAYOUT_REQUEST, INDEX_REQUEST, LAYOUT_COMPLETE, INDEX_COMPLETE, EDITOR_ASSIGN, EDITOR_ASSIGN + 'recipientName' => $user->getFullName(), + 'recipientUsername' => $user->getUsername(), 'submissionUrl' => $submissionUrl, - // LAYOUT_COMPLETE, INDEX_COMPLETE, EDITOR_ASSIGN - 'editorialContactName' => $user->getFullname(), - // EDITOR_ASSIGN - 'editorUsername' => $user->getUsername(), // AUTHOR ASSIGN, AUTHOR NOTIFY 'authorName' => $user->getFullName(), ]); @@ -264,7 +260,7 @@ public function sendMessage($userId, $submission, $request) /** * Get the available email template variable names for the given template name. * - * @param $emailKey string Email template key + * @param string $emailKey Email template key * * @return array */ @@ -274,17 +270,17 @@ public function getEmailVariableNames($emailKey) case 'COPYEDIT_REQUEST': case 'LAYOUT_REQUEST': case 'INDEX_REQUEST': return [ - 'participantName' => __('user.name'), - 'participantUsername' => __('user.username'), + 'recipientName' => __('user.name'), + 'recipientUsername' => __('user.username'), 'submissionUrl' => __('common.url'), ]; case 'LAYOUT_COMPLETE': case 'INDEX_COMPLETE': return [ - 'editorialContactName' => __('user.role.editor'), + 'recipientName' => __('user.role.editor'), ]; case 'EDITOR_ASSIGN': return [ - 'editorUsername' => __('user.username'), - 'editorialContactName' => __('user.role.editor'), + 'recipientUsername' => __('user.username'), + 'signature' => __('user.role.editor'), 'submissionUrl' => __('common.url'), ]; } @@ -303,11 +299,11 @@ public function getStageId() /** * Add upload task notifications. * - * @param $request PKPRequest - * @param $type int NOTIFICATION_TYPE_... - * @param $userId int User ID - * @param $submissionId int Submission ID - * @param $suppressEmail bool Indicates whether not to send the Notification email to the user. + * @param PKPRequest $request + * @param int $type NOTIFICATION_TYPE_... + * @param int $userId User ID + * @param int $submissionId Submission ID + * @param bool $suppressEmail Indicates whether not to send the Notification email to the user. */ private function _addAssignmentTaskNotification($request, $type, $userId, $submissionId, $suppressEmail = false) { @@ -339,8 +335,8 @@ private function _addAssignmentTaskNotification($request, $type, $userId, $submi /** * Convenience function for logging the message sent event and creating the notification. * - * @param $request PKPRequest - * @param $submission Submission + * @param PKPRequest $request + * @param Submission $submission */ public function _logEventAndCreateNotification($request, $submission) { @@ -355,7 +351,7 @@ public function _logEventAndCreateNotification($request, $submission) /** * whether or not to include the Notify Users listbuilder true, by default. * - * @return boolean + * @return bool */ public function isMessageRequired() { @@ -372,9 +368,9 @@ abstract protected function _getStageTemplates(); /** * Return app-specific mail template. * - * @param $submission Submission - * @param $templateKey string - * @param $includeSignature boolean + * @param Submission $submission + * @param string $templateKey + * @param bool $includeSignature * * @return SubmissionMailTemplate */ diff --git a/controllers/grid/users/stageParticipant/linkAction/NotifyLinkAction.inc.php b/controllers/grid/users/stageParticipant/linkAction/NotifyLinkAction.inc.php index 2f65eb479bd..8be32863c2a 100644 --- a/controllers/grid/users/stageParticipant/linkAction/NotifyLinkAction.inc.php +++ b/controllers/grid/users/stageParticipant/linkAction/NotifyLinkAction.inc.php @@ -20,10 +20,10 @@ class NotifyLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $submission Submission The submission - * @param $stageId int - * @param $userId optional + * @param Request $request + * @param Submission $submission The submission + * @param int $stageId + * @param int $userId optional * to show information about. */ public function __construct($request, &$submission, $stageId, $userId = null) diff --git a/controllers/grid/users/userSelect/UserSelectGridCellProvider.inc.php b/controllers/grid/users/userSelect/UserSelectGridCellProvider.inc.php index c29fc376eda..2155dbef8a6 100644 --- a/controllers/grid/users/userSelect/UserSelectGridCellProvider.inc.php +++ b/controllers/grid/users/userSelect/UserSelectGridCellProvider.inc.php @@ -24,7 +24,7 @@ class UserSelectGridCellProvider extends DataObjectGridCellProvider /** * Constructor * - * @param $userId int ID of preselected user. + * @param int $userId ID of preselected user. */ public function __construct($userId = null) { @@ -38,8 +38,8 @@ public function __construct($userId = null) * Extracts variables for a given column from a data element * so that they may be assigned to template before rendering. * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/grid/users/userSelect/UserSelectGridHandler.inc.php b/controllers/grid/users/userSelect/UserSelectGridHandler.inc.php index 242383ac566..18b3f8759d8 100644 --- a/controllers/grid/users/userSelect/UserSelectGridHandler.inc.php +++ b/controllers/grid/users/userSelect/UserSelectGridHandler.inc.php @@ -25,7 +25,7 @@ class UserSelectGridHandler extends GridHandler { - /** @var array (user group ID => user group name) **/ + /** @var array (user group ID => user group name) */ public $_userGroupOptions; /** @@ -207,7 +207,7 @@ public function getRequestArgs() /** * Determine whether a filter form should be collapsible. * - * @return boolean + * @return bool */ protected function isFilterFormCollapsible() { diff --git a/controllers/informationCenter/FileInformationCenterHandler.inc.php b/controllers/informationCenter/FileInformationCenterHandler.inc.php index 179ea53f018..e6bc3682f78 100644 --- a/controllers/informationCenter/FileInformationCenterHandler.inc.php +++ b/controllers/informationCenter/FileInformationCenterHandler.inc.php @@ -67,7 +67,7 @@ public function initialize($request) parent::initialize($request); $this->_stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); - $this->submissionFile = Repo::submissionFiles()->get($request->getUserVar('submissionFileId')); + $this->submissionFile = Repo::submissionFile()->get($request->getUserVar('submissionFileId')); // Ensure data integrity. if (!$this->_submission || !$this->submissionFile || $this->_submission->getId() != $this->submissionFile->getData('submissionId')) { @@ -78,8 +78,8 @@ public function initialize($request) /** * Display the main information center modal. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function viewInformationCenter($args, $request) { @@ -95,8 +95,8 @@ public function viewInformationCenter($args, $request) /** * Display the notes tab. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -118,8 +118,8 @@ public function viewNotes($args, $request) /** * Display the list of existing notes from prior files. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -146,8 +146,8 @@ public function _listPastNotes($args, $request) /** * Save a note. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -183,8 +183,8 @@ public function saveNote($args, $request) /** * Fetch the contents of the event log. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -240,7 +240,7 @@ public function _getAssocType() /** * Set up the template * - * @param $request PKPRequest + * @param PKPRequest $request */ public function setupTemplate($request) { diff --git a/controllers/informationCenter/InformationCenterHandler.inc.php b/controllers/informationCenter/InformationCenterHandler.inc.php index 8c5a01d3eff..a75d100d1ad 100644 --- a/controllers/informationCenter/InformationCenterHandler.inc.php +++ b/controllers/informationCenter/InformationCenterHandler.inc.php @@ -61,7 +61,7 @@ public function authorize($request, &$args, $roleAssignments) /** * Fetch and store away objects * - * @param $request PKPRequest + * @param PKPRequest $request */ public function initialize($request) { @@ -78,8 +78,8 @@ public function initialize($request) /** * Display the main information center modal. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -100,16 +100,16 @@ abstract public function viewNotes($args, $request); * Save a note. * Subclasses must implement. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ abstract public function saveNote($args, $request); /** * Delete a note. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -140,8 +140,8 @@ public function deleteNote($args, $request) /** * Display the list of existing notes. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -179,10 +179,10 @@ public function _getLinkParams() /** * Log an event for this file or submission * - * @param $request PKPRequest - * @param $object Submission or SubmissionFile - * @param $eventType int SUBMISSION_LOG_... - * @param $logClass SubmissionLog or SubmissionFileLog + * @param PKPRequest $request + * @param Submission|SubmissionFile $object + * @param int $eventType SUBMISSION_LOG_... + * @param SubmissionLog|SubmissionFileLog $logClass */ public function _logEvent($request, $object, $eventType, $logClass) { diff --git a/controllers/informationCenter/SubmissionInformationCenterHandler.inc.php b/controllers/informationCenter/SubmissionInformationCenterHandler.inc.php index 2fdb5b5245f..1f76dc4bf79 100644 --- a/controllers/informationCenter/SubmissionInformationCenterHandler.inc.php +++ b/controllers/informationCenter/SubmissionInformationCenterHandler.inc.php @@ -24,7 +24,7 @@ class SubmissionInformationCenterHandler extends InformationCenterHandler { - /** @var boolean Is the current user assigned to an editorial role for this submission */ + /** @var bool Is the current user assigned to an editorial role for this submission */ public $_isCurrentUserAssignedEditor; /** @@ -75,8 +75,8 @@ public function viewInformationCenter($args, $request) /** * Display the notes tab. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -97,8 +97,8 @@ public function viewNotes($args, $request) /** * Save a note. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function saveNote($args, $request) { @@ -132,8 +132,8 @@ public function saveNote($args, $request) /** * Fetch the contents of the event log. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/informationCenter/linkAction/FileInfoCenterLinkAction.inc.php b/controllers/informationCenter/linkAction/FileInfoCenterLinkAction.inc.php index 62ff0dca17f..32ca00205fb 100644 --- a/controllers/informationCenter/linkAction/FileInfoCenterLinkAction.inc.php +++ b/controllers/informationCenter/linkAction/FileInfoCenterLinkAction.inc.php @@ -21,10 +21,10 @@ class FileInfoCenterLinkAction extends FileLinkAction /** * Constructor * - * @param $request Request - * @param $submissionFile SubmissionFile the submission file + * @param Request $request + * @param SubmissionFile $submissionFile the submission file * to show information about. - * @param $stageId int (optional) The stage id that user is looking at. + * @param int $stageId (optional) The stage id that user is looking at. */ public function __construct($request, $submissionFile, $stageId = null) { @@ -43,9 +43,9 @@ public function __construct($request, $submissionFile, $stageId = null) /** * returns the modal for this link action. * - * @param $request PKPRequest - * @param $submissionFile SubmissionFile - * @param $stageId int + * @param PKPRequest $request + * @param SubmissionFile $submissionFile + * @param int $stageId * * @return AjaxModal */ diff --git a/controllers/informationCenter/linkAction/SubmissionInfoCenterLinkAction.inc.php b/controllers/informationCenter/linkAction/SubmissionInfoCenterLinkAction.inc.php index e4f76cfe40b..971bbf23add 100644 --- a/controllers/informationCenter/linkAction/SubmissionInfoCenterLinkAction.inc.php +++ b/controllers/informationCenter/linkAction/SubmissionInfoCenterLinkAction.inc.php @@ -22,10 +22,10 @@ class SubmissionInfoCenterLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $submissionId int the ID of the submission to present link for + * @param Request $request + * @param int $submissionId the ID of the submission to present link for * to show information about. - * @param $linkKey string optional locale key to display for link + * @param string $linkKey optional locale key to display for link */ public function __construct($request, $submissionId, $linkKey = 'informationCenter.editorialHistory') { diff --git a/controllers/listbuilder/settings/SetupListbuilderHandler.inc.php b/controllers/listbuilder/settings/SetupListbuilderHandler.inc.php index 846ced940f5..c79a427fc1d 100644 --- a/controllers/listbuilder/settings/SetupListbuilderHandler.inc.php +++ b/controllers/listbuilder/settings/SetupListbuilderHandler.inc.php @@ -37,7 +37,7 @@ public function __construct() /** * Set the current context * - * @param $context Context + * @param Context $context */ public function setContext($context) { diff --git a/controllers/listbuilder/settings/reviewForms/ReviewFormElementResponseItemListbuilderHandler.inc.php b/controllers/listbuilder/settings/reviewForms/ReviewFormElementResponseItemListbuilderHandler.inc.php index 165e7d69135..728464309e0 100644 --- a/controllers/listbuilder/settings/reviewForms/ReviewFormElementResponseItemListbuilderHandler.inc.php +++ b/controllers/listbuilder/settings/reviewForms/ReviewFormElementResponseItemListbuilderHandler.inc.php @@ -21,7 +21,7 @@ class ReviewFormElementResponseItemListbuilderHandler extends SetupListbuilderHandler { - /** @var int Review form element ID **/ + /** @var int Review form element ID */ public $_reviewFormElementId; diff --git a/controllers/listbuilder/users/UserListbuilderGridCellProvider.inc.php b/controllers/listbuilder/users/UserListbuilderGridCellProvider.inc.php index 81b474b9e86..30008ef395c 100644 --- a/controllers/listbuilder/users/UserListbuilderGridCellProvider.inc.php +++ b/controllers/listbuilder/users/UserListbuilderGridCellProvider.inc.php @@ -27,8 +27,8 @@ class UserListbuilderGridCellProvider extends GridCellProvider * * @see GridCellProvider::getTemplateVarsFromRowColumn() * - * @param $row \PKP\controllers\grid\GridRow - * @param $column GridColumn + * @param \PKP\controllers\grid\GridRow $row + * @param GridColumn $column * * @return array */ diff --git a/controllers/modals/documentLibrary/DocumentLibraryHandler.inc.php b/controllers/modals/documentLibrary/DocumentLibraryHandler.inc.php index ebbfc0bb2b8..517d1c7a28a 100644 --- a/controllers/modals/documentLibrary/DocumentLibraryHandler.inc.php +++ b/controllers/modals/documentLibrary/DocumentLibraryHandler.inc.php @@ -21,7 +21,7 @@ class DocumentLibraryHandler extends Handler { - /** The submission **/ + /** @var Submission */ public $_submission; /** @@ -80,8 +80,8 @@ public function getSubmission() /** * Display a list of the review form elements within a review form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/modals/documentLibrary/linkAction/SubmissionLibraryLinkAction.inc.php b/controllers/modals/documentLibrary/linkAction/SubmissionLibraryLinkAction.inc.php index 8e16c67846f..2f371186a60 100644 --- a/controllers/modals/documentLibrary/linkAction/SubmissionLibraryLinkAction.inc.php +++ b/controllers/modals/documentLibrary/linkAction/SubmissionLibraryLinkAction.inc.php @@ -21,8 +21,8 @@ class SubmissionLibraryLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $submissionId int the ID of the submission to present link for + * @param Request $request + * @param int $submissionId the ID of the submission to present link for * to show information about. */ public function __construct($request, $submissionId) diff --git a/controllers/modals/editorDecision/form/EditorDecisionWithEmailForm.inc.php b/controllers/modals/editorDecision/form/EditorDecisionWithEmailForm.inc.php deleted file mode 100644 index 128ccb07e37..00000000000 --- a/controllers/modals/editorDecision/form/EditorDecisionWithEmailForm.inc.php +++ /dev/null @@ -1,394 +0,0 @@ -_saveFormOperation; - } - - /** - * Set the operation to save this form. - * - * @param string $saveFormOperation - */ - public function setSaveFormOperation($saveFormOperation) - { - $this->_saveFormOperation = $saveFormOperation; - } - - // - // Implement protected template methods from Form - // - /** - * @see Form::initData() - * - * @param array $actionLabels - */ - public function initData($actionLabels = []) - { - $request = Application::get()->getRequest(); - $context = $request->getContext(); - $router = $request->getRouter(); - $dispatcher = $router->getDispatcher(); - - $submission = $this->getSubmission(); - $user = $request->getUser(); - - $emailKeys = [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT => 'EDITOR_DECISION_ACCEPT', - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE => 'EDITOR_DECISION_DECLINE', - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE => 'EDITOR_DECISION_INITIAL_DECLINE', - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW => 'EDITOR_DECISION_SEND_TO_EXTERNAL', - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_RESUBMIT => 'EDITOR_DECISION_RESUBMIT', - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS => 'EDITOR_DECISION_REVISIONS', - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION => 'EDITOR_DECISION_SEND_TO_PRODUCTION', - ]; - - $email = new SubmissionMailTemplate($submission, $emailKeys[$this->getDecision()]); - - $submissionUrl = $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'authorDashboard', 'submission', $submission->getId()); - $email->assignParams([ - 'authorName' => $submission->getAuthorString(), - 'submissionUrl' => $submissionUrl, - ]); - $email->replaceParams(); - - // If we are in review stage we need a review round. - $reviewRound = $this->getReviewRound(); - if (is_a($reviewRound, 'ReviewRound')) { - $this->setData('reviewRoundId', $reviewRound->getId()); - } - - $data = [ - 'submissionId' => $submission->getId(), - 'decision' => $this->getDecision(), - 'authorName' => $submission->getAuthorString(), - 'personalMessage' => $email->getBody(), - 'actionLabel' => $actionLabels[$this->getDecision()], - 'bccReviewers' => [] - ]; - foreach ($data as $key => $value) { - $this->setData($key, $value); - } - - return parent::initData(); - } - - /** - * @copydoc Form::readInputData() - */ - public function readInputData() - { - $this->readUserVars(['personalMessage', 'selectedAttachments', 'skipEmail', 'selectedLibraryFiles', 'bccReviewers']); - parent::readInputData(); - } - - /** - * @copydoc EditorDecisionForm::fetch() - * - * @param null|mixed $template - */ - public function fetch($request, $template = null, $display = false) - { - AppLocale::requireComponents(LOCALE_COMPONENT_PKP_REVIEWER); - $templateMgr = TemplateManager::getManager($request); - - // On the review stage, determine if any reviews are available for import - $stageId = $this->getStageId(); - if ($stageId == WORKFLOW_STAGE_ID_INTERNAL_REVIEW || $stageId == WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) { - $reviewsAvailable = false; - $submission = $this->getSubmission(); - $reviewRound = $this->getReviewRound(); - $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /** @var ReviewAssignmentDAO $reviewAssignmentDao */ - $reviewAssignments = $reviewAssignmentDao->getBySubmissionId($submission->getId(), $reviewRound->getId()); - - $reviewers = []; - /** @var \PKP\submission\reviewAssignment\ReviewAssignment $reviewAssignment */ - foreach ($reviewAssignments as $reviewAssignment) { - if ($reviewAssignment->getDateCompleted() != null) { - $reviewsAvailable = true; - } - if (in_array($reviewAssignment->getStatus(), [REVIEW_ASSIGNMENT_STATUS_COMPLETE, REVIEW_ASSIGNMENT_STATUS_RECEIVED, REVIEW_ASSIGNMENT_STATUS_THANKED])) { - $reviewers[$reviewAssignment->getReviewerId()] = $reviewAssignment->getReviewerFullName(); - } - } - - $templateMgr->assign([ - 'reviewsAvailable' => $reviewsAvailable, - 'reviewers' => $reviewers - ]); - - // Retrieve a URL to fetch the reviews - if ($reviewsAvailable) { - $router = $request->getRouter(); - $this->setData( - 'peerReviewUrl', - $router->url( - $request, - null, - null, - 'importPeerReviews', - null, - [ - 'submissionId' => $submission->getId(), - 'stageId' => $stageId, - 'reviewRoundId' => $reviewRound->getId() - ] - ) - ); - } - } - - // When this form is being used in review stages, we need a different - // save operation to allow the EditorDecisionHandler authorize the review - // round object. - if ($this->getSaveFormOperation()) { - $templateMgr = TemplateManager::getManager($request); - $templateMgr->assign('saveFormOperation', $this->getSaveFormOperation()); - } - - $templateMgr->assign('allowedVariables', $this->_getAllowedVariables($request)); - $templateMgr->assign('allowedVariablesType', $this->_getAllowedVariablesType()); - - return parent::fetch($request, $template, $display); - } - - - // - // Private helper methods - // - /** - * Retrieve the last review round and update it with the new status. - * - * The review round status is typically set according to the statuses of its - * ReviewAssignments. This method overrides that status and sets a new one - * based on an EditorDecision. - * - * @param Submission $submission - * @param integer $status One of the REVIEW_ROUND_STATUS_* constants. - * @param null|mixed $reviewRound - */ - public function _updateReviewRoundStatus($submission, $status, $reviewRound = null) - { - $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ - if (!$reviewRound) { - $reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId()); - } - - // If we don't have a review round, it's because the submission is being - // accepted without starting any of the review stages. In that case we - // do nothing. - if (is_a($reviewRound, 'ReviewRound')) { - $reviewRoundDao->updateStatus($reviewRound, $status); - } - } - - /** - * Sends an email with a personal message and the selected - * review attachements to the author. Also marks review attachments - * selected by the editor as "viewable" for the author. - * - * @param Submission $submission - * @param string $emailKey An email template. - * @param PKPRequest $request - */ - public function _sendReviewMailToAuthor($submission, $emailKey, $request) - { - // Send personal message to author. - $email = new SubmissionMailTemplate($submission, $emailKey, null, null, null, false); - $email->setBody($this->getData('personalMessage')); - - // Get submission authors in the same way as for the email template form, - // that editor sees. This also ensures that the recipient list is not empty. - $authors = Repo::author()->getSubmissionAuthors($submission, true); - foreach ($authors as $author) { - $email->addRecipient($author->getEmail(), $author->getFullName()); - } - - DAORegistry::getDAO('SubmissionEmailLogDAO'); // Load constants - $email->setEventType(SubmissionEmailLogEntry::SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR); - - // Get review round. - $reviewRound = $this->getReviewRound(); - - if (is_a($reviewRound, 'ReviewRound')) { - // Retrieve review indexes. - $reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO'); /** @var ReviewAssignmentDAO $reviewAssignmentDao */ - - $reviewAssignments = $reviewAssignmentDao->getBySubmissionId($submission->getId(), $reviewRound->getId()); - $reviewers = []; - /** @var \PKP\submission\reviewAssignment\ReviewAssignment $reviewAssignment */ - foreach ($reviewAssignments as $reviewAssignment) { - if (in_array($reviewAssignment->getStatus(), [REVIEW_ASSIGNMENT_STATUS_COMPLETE, REVIEW_ASSIGNMENT_STATUS_RECEIVED, REVIEW_ASSIGNMENT_STATUS_THANKED])) { - $reviewers[] = $reviewAssignment->getReviewerId(); - } - } - - foreach (array_intersect($reviewers, (array) $this->getData('bccReviewers')) as $reviewerId) { - $user = Repo::user()->get($reviewerId); - if ($user && !$user->getDisabled()) { - $email->addBcc($user->getEmail(), $user->getFullName()); - } - } - - $reviewIndexes = $reviewAssignmentDao->getReviewIndexesForRound($submission->getId(), $reviewRound->getId()); - assert(is_array($reviewIndexes)); - - // Add a review index for review attachments not associated with - // a review assignment (i.e. attachments uploaded by the editor). - $lastIndex = end($reviewIndexes); - $reviewIndexes[-1] = $lastIndex + 1; - - // Attach the selected reviewer attachments to the email. - $selectedAttachments = $this->getData('selectedAttachments'); - if (is_array($selectedAttachments)) { - foreach ($selectedAttachments as $submissionFileId) { - - // Retrieve the submission file. - $submissionFile = Repo::submissionFiles()->get($submissionFileId); - assert(is_a($submissionFile, 'SubmissionFile')); - - // Check the association information. - if ($submissionFile->getData('assocType') == ASSOC_TYPE_REVIEW_ASSIGNMENT) { - // The review attachment has been uploaded by a reviewer. - $reviewAssignmentId = $submissionFile->getData('assocId'); - assert(is_numeric($reviewAssignmentId)); - } else { - // The review attachment has been uploaded by the editor. - $reviewAssignmentId = -1; - } - - // Identify the corresponding review index. - assert(isset($reviewIndexes[$reviewAssignmentId])); - $reviewIndex = $reviewIndexes[$reviewAssignmentId]; - assert(!is_null($reviewIndex)); - - // Add the attachment to the email. - $path = rtrim(Config::getVar('files', 'files_dir'), '/') . '/' . $submissionFile->getData('path'); - $email->addAttachment( - $path, - PKPString::enumerateAlphabetically($reviewIndex) . '-' . $submissionFile->getLocalizedData('name') - ); - - // Update submission file to set viewable as true, so author - // can view the file on their submission summary page. - Repo::submissionFiles()->edit( - $submissionFile, - [ - 'viewable' => true - ] - ); - } - } - } - - // Attach the selected Library files as attachments to the email. - $libraryFileDao = DAORegistry::getDAO('LibraryFileDAO'); /** @var LibraryFileDAO $libraryFileDao */ - $selectedLibraryFilesAttachments = $this->getData('selectedLibraryFiles'); - if (is_array($selectedLibraryFilesAttachments)) { - foreach ($selectedLibraryFilesAttachments as $fileId) { - // Retrieve the Library file. - $libraryFile = $libraryFileDao->getById($fileId); - assert(is_a($libraryFile, 'LibraryFile')); - - $libraryFileManager = new LibraryFileManager($libraryFile->getContextId()); - - // Add the attachment to the email. - $email->addAttachment($libraryFile->getFilePath(), $libraryFile->getOriginalFileName()); - } - } - - // Send the email. - if (!$this->getData('skipEmail')) { - $router = $request->getRouter(); - $dispatcher = $router->getDispatcher(); - $context = $request->getContext(); - $user = $request->getUser(); - $email->assignParams([ - 'submissionUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'authorDashboard', 'submission', $submission->getId()), - 'contextName' => $context->getLocalizedName(), - 'authorName' => $submission->getAuthorString(), - 'editorialContactSignature' => $user->getContactSignature(), - ]); - if (!$email->send($request)) { - $notificationMgr = new NotificationManager(); - $notificationMgr->createTrivialNotification($request->getUser()->getId(), PKPNotification::NOTIFICATION_TYPE_ERROR, ['contents' => __('email.compose.error')]); - } - } - } - - /** - * Get a list of allowed email template variables. - * - * @param PKPRequest $request Request object - * - * @return array - */ - public function _getAllowedVariables($request) - { - $router = $request->getRouter(); - $dispatcher = $router->getDispatcher(); - $submission = $this->getSubmission(); - $user = $request->getUser(); - return [ - 'submissionUrl' => __('common.url'), - 'contextName' => $request->getContext()->getLocalizedName(), - 'editorialContactSignature' => strip_tags($user->getContactSignature(), '
'), - 'submissionTitle' => strip_tags($submission->getLocalizedTitle()), - 'authorName' => strip_tags($submission->getAuthorString()), - ]; - } - - /** - * Get a list of allowed email template variables type. - * - * @return array - */ - public function _getAllowedVariablesType() - { - return [ - 'contextName' => INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT, - 'editorialContactSignature' => INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT, - 'submissionTitle' => INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT, - 'authorName' => INSERT_TAG_VARIABLE_TYPE_PLAIN_TEXT, - ]; - } -} diff --git a/controllers/modals/editorDecision/form/InitiateReviewForm.inc.php b/controllers/modals/editorDecision/form/InitiateReviewForm.inc.php deleted file mode 100644 index 86c8ee6c0f5..00000000000 --- a/controllers/modals/editorDecision/form/InitiateReviewForm.inc.php +++ /dev/null @@ -1,70 +0,0 @@ -getRequest(); - - // Retrieve the submission. - $submission = $this->getSubmission(); - - // Record the decision. - $actionLabels = (new EditorDecisionActionsManager())->getActionLabels($request->getContext(), $submission, $this->getStageId(), [$this->_decision]); - $editorAction = new EditorAction(); - $editorAction->recordDecision($request, $submission, $this->_decision, $actionLabels); - - // Move to the internal review stage. - $editorAction->incrementWorkflowStage($submission, $this->_getStageId()); - - // Create an initial internal review round. - $this->_initiateReviewRound($submission, $this->_getStageId(), $request, ReviewRound::REVIEW_ROUND_STATUS_PENDING_REVIEWERS); - } -} diff --git a/controllers/modals/editorDecision/form/NewReviewRoundForm.inc.php b/controllers/modals/editorDecision/form/NewReviewRoundForm.inc.php deleted file mode 100644 index 48cfd9e5e08..00000000000 --- a/controllers/modals/editorDecision/form/NewReviewRoundForm.inc.php +++ /dev/null @@ -1,94 +0,0 @@ -getRequest(); - - // Retrieve the submission. - $submission = $this->getSubmission(); - - // Get this form decision actions labels. - $actionLabels = (new EditorDecisionActionsManager())->getActionLabels($request->getContext(), $submission, $this->getStageId(), $this->_getDecisions()); - - // Record the decision. - $reviewRound = $this->getReviewRound(); - $editorAction = new EditorAction(); - $editorAction->recordDecision($request, $submission, EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_NEW_ROUND, $actionLabels, $reviewRound); - - // Update the review round status. - $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ - $reviewRoundDao->updateStatus($reviewRound, ReviewRound::REVIEW_ROUND_STATUS_PENDING_REVIEWERS); - - // Create a new review round. - $newRound = $this->_initiateReviewRound( - $submission, - $submission->getStageId(), - $request, - ReviewRound::REVIEW_ROUND_STATUS_PENDING_REVIEWERS - ); - - parent::execute(...$functionArgs); - - return $newRound; - } - - // - // Private functions - // - /** - * Get this form decisions. - * - * @return array - */ - public function _getDecisions() - { - return [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_NEW_ROUND - ]; - } -} diff --git a/controllers/modals/editorDecision/form/PromoteForm.inc.php b/controllers/modals/editorDecision/form/PromoteForm.inc.php deleted file mode 100644 index 75f86d041e9..00000000000 --- a/controllers/modals/editorDecision/form/PromoteForm.inc.php +++ /dev/null @@ -1,235 +0,0 @@ -_getDecisions())) { - fatalError('Invalid decision!'); - } - - $this->setSaveFormOperation('savePromote'); - - parent::__construct( - $submission, - $decision, - $stageId, - 'controllers/modals/editorDecision/form/promoteForm.tpl', - $reviewRound - ); - - AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER); - } - - - // - // Implement protected template methods from Form - // - /** - * @copydoc EditorDecisionWithEmailForm::initData() - */ - public function initData($actionLabels = []) - { - $request = Application::get()->getRequest(); - $actionLabels = (new EditorDecisionActionsManager())->getActionLabels($request->getContext(), $this->getSubmission(), $this->getStageId(), $this->_getDecisions()); - - $this->setData('stageId', $this->getStageId()); - - // If payments are enabled for this stage/form, default to requiring them - $this->setData('requestPayment', true); - - return parent::initData($actionLabels); - } - - /** - * @copydoc Form::readInputData() - */ - public function readInputData() - { - $this->readUserVars(['requestPayment']); - parent::readInputData(); - } - - /** - * @copydoc Form::execute() - */ - public function execute(...$functionParams) - { - parent::execute(...$functionParams); - - $request = Application::get()->getRequest(); - - // Retrieve the submission. - $submission = $this->getSubmission(); - - // Get this form decision actions labels. - $actionLabels = (new EditorDecisionActionsManager())->getActionLabels($request->getContext(), $submission, $this->getStageId(), $this->_getDecisions()); - - // Record the decision. - $reviewRound = $this->getReviewRound(); - $decision = $this->getDecision(); - $editorAction = new EditorAction(); - $editorAction->recordDecision($request, $submission, $decision, $actionLabels, $reviewRound); - - // Identify email key and status of round. - switch ($decision) { - case EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT: - $emailKey = 'EDITOR_DECISION_ACCEPT'; - $status = ReviewRound::REVIEW_ROUND_STATUS_ACCEPTED; - - $this->_updateReviewRoundStatus($submission, $status, $reviewRound); - - // Move to the editing stage. - $editorAction->incrementWorkflowStage($submission, WORKFLOW_STAGE_ID_EDITING); - - - $selectedFiles = $this->getData('selectedFiles'); - if (is_array($selectedFiles)) { - foreach ($selectedFiles as $submissionFileId) { - $submissionFile = Repo::submissionFiles()->get($submissionFileId); - $newSubmissionFile = clone $submissionFile; - $newSubmissionFile->setData('fileStage', SubmissionFile::SUBMISSION_FILE_FINAL); - $newSubmissionFile->setData('sourceSubmissionFileId', $submissionFile->getId()); - $newSubmissionFile->setData('assocType', null); - $newSubmissionFile->setData('assocId', null); - - $newSubmissionFileId = Repo::submissionFiles()->add($newSubmissionFile); - - $newSubmissionFile = Repo::submissionFiles()->get($newSubmissionFileId); - } - } - - // Send email to the author. - $this->_sendReviewMailToAuthor($submission, $emailKey, $request); - break; - - case EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW: - $emailKey = 'EDITOR_DECISION_SEND_TO_EXTERNAL'; - $status = ReviewRound::REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL; - - $this->_updateReviewRoundStatus($submission, $status, $reviewRound); - - // Move to the external review stage. - $editorAction->incrementWorkflowStage($submission, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW); - - // Create an initial external review round. - $this->_initiateReviewRound($submission, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, $request, ReviewRound::REVIEW_ROUND_STATUS_PENDING_REVIEWERS); - - // Send email to the author. - $this->_sendReviewMailToAuthor($submission, $emailKey, $request); - break; - case EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION: - $emailKey = 'EDITOR_DECISION_SEND_TO_PRODUCTION'; - // FIXME: this is copy-pasted from above, save the FILE_GALLEY. - - // Move to the editing stage. - $editorAction->incrementWorkflowStage($submission, WORKFLOW_STAGE_ID_PRODUCTION); - - $selectedFiles = $this->getData('selectedFiles'); - if (is_array($selectedFiles)) { - foreach ($selectedFiles as $submissionFileId) { - $submissionFile = Repo::submissionFiles()->get($submissionFileId); - $newSubmissionFile = clone $submissionFile; - $newSubmissionFile->setData('fileStage', SubmissionFile::SUBMISSION_FILE_PRODUCTION_READY); - $newSubmissionFile->setData('sourceSubmissionFileId', $submissionFile->getId()); - $newSubmissionFile->setData('assocType', null); - $newSubmissionFile->setData('assocId', null); - $newSubmissionFileId = Repo::submissionFiles()->add($newSubmissionFile); - - $newSubmissionFile = Repo::submissionFiles()->get($newSubmissionFileId); - } - } - // Send email to the author. - $this->_sendReviewMailToAuthor($submission, $emailKey, $request); - break; - default: - throw new Exception('Unsupported decision!'); - } - - if ($this->getData('requestPayment')) { - $context = $request->getContext(); - $stageDecisions = (new EditorDecisionActionsManager())->getStageDecisions($context, $submission, $this->getStageId()); - $decisionData = $stageDecisions[$decision]; - if (isset($decisionData['paymentType'])) { - $paymentType = $decisionData['paymentType']; - - // Queue a payment. - $paymentManager = Application::getPaymentManager($context); - $queuedPayment = $paymentManager->createQueuedPayment($request, $paymentType, $request->getUser()->getId(), $submission->getId(), $decisionData['paymentAmount'], $decisionData['paymentCurrency']); - $paymentManager->queuePayment($queuedPayment); - - // Notify any authors that this needs payment. - $notificationMgr = new NotificationManager(); - $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ - $stageAssignments = $stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), Role::ROLE_ID_AUTHOR, null); - $userIds = []; - while ($stageAssignment = $stageAssignments->next()) { - if (!in_array($stageAssignment->getUserId(), $userIds)) { - $notificationMgr->createNotification( - $request, - $stageAssignment->getUserId(), - PKPNotification::NOTIFICATION_TYPE_PAYMENT_REQUIRED, - $context->getId(), - ASSOC_TYPE_QUEUED_PAYMENT, - $queuedPayment->getId(), - Notification::NOTIFICATION_LEVEL_TASK - ); - $userIds[] = $stageAssignment->getUserId(); - } - } - } - } - } - - // - // Private functions - // - /** - * Get this form decisions. - * - * @return array - */ - public function _getDecisions() - { - return [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW, - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_ACCEPT, - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_SEND_TO_PRODUCTION - ]; - } -} diff --git a/controllers/modals/editorDecision/form/RecommendationForm.inc.php b/controllers/modals/editorDecision/form/RecommendationForm.inc.php deleted file mode 100644 index 7055a85bbce..00000000000 --- a/controllers/modals/editorDecision/form/RecommendationForm.inc.php +++ /dev/null @@ -1,284 +0,0 @@ -_submission = $submission; - $this->_stageId = $stageId; - $this->_reviewRound = $reviewRound; - - // Validation checks for this form - $this->addCheck(new \PKP\form\validation\FormValidatorPost($this)); - $this->addCheck(new \PKP\form\validation\FormValidatorCSRF($this)); - } - - // - // Getters and Setters - // - /** - * Get the submission - * - * @return Submission - */ - public function getSubmission() - { - return $this->_submission; - } - - /** - * Get the stage Id - * - * @return int - */ - public function getStageId() - { - return $this->_stageId; - } - - /** - * Get the review round object. - * - * @return ReviewRound - */ - public function getReviewRound() - { - return $this->_reviewRound; - } - - // - // Overridden template methods from Form - // - /** - * @copydoc Form::initData() - */ - public function initData() - { - $submission = $this->getSubmission(); - - // Get the decision making editors, the e-mail about the recommendation will be send to - $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ - $editorsStageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($submission->getId(), $this->getStageId()); - $editorsStr = ''; - $i = 0; - foreach ($editorsStageAssignments as $editorsStageAssignment) { - if (!$editorsStageAssignment->getRecommendOnly()) { - $editorFullName = Repo::user()->get($editorsStageAssignment->getUserId(), true)->getFullName(); - $editorsStr .= ($i == 0) ? $editorFullName : ', ' . $editorFullName; - $i++; - } - } - // Get the editor recommendation e-mail template - $email = new SubmissionMailTemplate($submission, 'EDITOR_RECOMMENDATION'); - $request = Application::get()->getRequest(); - $router = $request->getRouter(); - $dispatcher = $router->getDispatcher(); - $user = $request->getUser(); - $submissionUrl = $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'workflow', 'index', [$submission->getId(), $this->getStageId()]); - $emailParams = [ - 'editors' => $editorsStr, - 'submissionUrl' => $submissionUrl, - ]; - $email->assignParams($emailParams); - $email->replaceParams(); - - // Get the recorded recommendations - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $editorRecommendations = $editDecisionDao->getEditorDecisions($submission->getId(), $this->getStageId(), null, $user->getId()); - - // Set form data - $recommendationOptions = (new EditorDecisionActionsManager())->getRecommendationOptions($this->getStageId()); - $data = [ - 'submissionId' => $submission->getId(), - 'stageId' => $this->getStageId(), - 'reviewRoundId' => $this->getReviewRound()->getId(), - 'editorRecommendations' => $editorRecommendations, - 'recommendationOptions' => $recommendationOptions, - 'editors' => $editorsStr, - 'personalMessage' => $email->getBody(), - ]; - foreach ($data as $key => $value) { - $this->setData($key, $value); - } - return parent::initData(); - } - - /** - * @copydoc Form::fetch() - * - * @param null|mixed $template - */ - public function fetch($request, $template = null, $display = false) - { - $templateMgr = TemplateManager::getManager($request); - $templateMgr->assign([ - 'allowedVariables' => [ - 'recommendation' => __('editor.submission.recommendation'), - ], - ]); - return parent::fetch($request, $template, $display); - } - - /** - * @copydoc Form::readInputData() - */ - public function readInputData() - { - $this->readUserVars(['recommendation', 'personalMessage', 'skipEmail', 'skipDiscussion']); - parent::readInputData(); - } - - /** - * @copydoc Form::execute() - */ - public function execute(...$functionParams) - { - parent::execute(...$functionParams); - - // Record the recommendation. - $request = Application::get()->getRequest(); - $submission = $this->getSubmission(); - $reviewRound = $this->getReviewRound(); - $recommendation = $this->getData('recommendation'); - - // Record the recommendation - $editorAction = new EditorAction(); - // Get editor action labels needed for the recording - $recommendationOptions = (new EditorDecisionActionsManager())->getRecommendationOptions($this->getStageId()); - $actionLabels = [$recommendation => $recommendationOptions[$recommendation]]; - $editorAction->recordDecision($request, $submission, $recommendation, $actionLabels, $reviewRound, $this->getStageId(), true); - - if (!$this->getData('skipEmail') || !$this->getData('skipDiscussion')) { - $router = $request->getRouter(); - $user = $request->getUser(); - - // Send the email to the decision making editors assigned to this submission. - $email = new SubmissionMailTemplate($submission, 'EDITOR_RECOMMENDATION', null, null, null, false); - $email->setBody($this->getData('personalMessage')); - - $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ - $editorsStageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($submission->getId(), $this->getStageId()); - foreach ($editorsStageAssignments as $editorsStageAssignment) { - if (!$editorsStageAssignment->getRecommendOnly()) { - $editor = Repo::user()->get($editorsStageAssignment->getUserId()); - if (!$editor) { - continue; - } // Disabled user - $editorFullName = $editor->getFullName(); - $email->addRecipient($editor->getEmail(), $editorFullName); - } - } - - DAORegistry::getDAO('SubmissionEmailLogDAO'); // Load constants - $email->setEventType(SubmissionEmailLogEntry::SUBMISSION_EMAIL_EDITOR_RECOMMEND_NOTIFY); - - $dispatcher = $router->getDispatcher(); - $submissionUrl = $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'workflow', 'index', [$submission->getId(), $this->getStageId()]); - $email->assignParams([ - 'editors' => $this->getData('editors'), - 'editorialContactSignature' => $user->getContactSignature(), - 'submissionUrl' => $submissionUrl, - 'recommendation' => __($recommendationOptions[$recommendation]), - ]); - if (!$this->getData('skipEmail')) { - if (!$email->send($request)) { - $notificationMgr = new NotificationManager(); - $notificationMgr->createTrivialNotification($request->getUser()->getId(), PKPNotification::NOTIFICATION_TYPE_ERROR, ['contents' => __('email.compose.error')]); - } - } - - if (!$this->getData('skipDiscussion')) { - // Create a discussion - $queryDao = DAORegistry::getDAO('QueryDAO'); /** @var QueryDAO $queryDao */ - $query = $queryDao->newDataObject(); - $query->setAssocType(ASSOC_TYPE_SUBMISSION); - $query->setAssocId($submission->getId()); - $query->setStageId($this->getStageId()); - $query->setSequence(REALLY_BIG_NUMBER); - $queryDao->insertObject($query); - $queryDao->resequence(ASSOC_TYPE_SUBMISSION, $submission->getId()); - - // Add the decision making editors as discussion participants - $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ - $discussionParticipantsIds = []; - $editorsStageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($submission->getId(), $this->getStageId()); - foreach ($editorsStageAssignments as $editorsStageAssignment) { - if (!$editorsStageAssignment->getRecommendOnly()) { - if (!in_array($editorsStageAssignment->getUserId(), $discussionParticipantsIds)) { - $discussionParticipantsIds[] = $editorsStageAssignment->getUserId(); - $queryDao->insertParticipant($query->getId(), $editorsStageAssignment->getUserId()); - } - } - } - - $noteDao = DAORegistry::getDAO('NoteDAO'); /** @var NoteDAO $noteDao */ - $note = $noteDao->newDataObject(); - $note->setAssocType(ASSOC_TYPE_QUERY); - $note->setAssocId($query->getId()); - $email->replaceParams(); - $note->setContents($email->getBody()); - $note->setTitle(__('editor.submission.recommendation')); - $note->setDateCreated(Core::getCurrentDate()); - $note->setDateModified(Core::getCurrentDate()); - $note->setUserId($user->getId()); - $noteDao->insertObject($note); - - // Add task - $notificationMgr = new NotificationManager(); - foreach ($discussionParticipantsIds as $discussionParticipantsId) { - $notificationMgr->createNotification( - $request, - $discussionParticipantsId, - PKPNotification::NOTIFICATION_TYPE_NEW_QUERY, - $request->getContext()->getId(), - ASSOC_TYPE_QUERY, - $query->getId(), - Notification::NOTIFICATION_LEVEL_TASK - ); - } - } - } - } -} diff --git a/controllers/modals/editorDecision/form/RevertDeclineForm.inc.php b/controllers/modals/editorDecision/form/RevertDeclineForm.inc.php deleted file mode 100644 index 39e2b6524d4..00000000000 --- a/controllers/modals/editorDecision/form/RevertDeclineForm.inc.php +++ /dev/null @@ -1,104 +0,0 @@ -setData('decision', $this->getDecision()); - // If we are in review stage we need a review round. - $reviewRound = $this->getReviewRound(); - if (is_a($reviewRound, 'ReviewRound')) { - $this->setData('reviewRoundId', $reviewRound->getId()); - } - return parent::initData(); - } - - /** - * @copydoc Form::execute() - */ - public function execute(...$formParams) - { - parent::execute(...$formParams); - - $request = Application::get()->getRequest(); - - // Retrieve the submission. - $submission = $this->getSubmission(); /** @var Submission $submission */ - - // Record the decision. - $actionLabels = (new EditorDecisionActionsManager())->getActionLabels($request->getContext(), $submission, $this->getStageId(), [$this->getDecision()]); - $editorAction = new EditorAction(); - $editorAction->recordDecision($request, $submission, $this->getDecision(), $actionLabels); - - $submission->setStatus(PKPSubmission::STATUS_QUEUED); // Always return submission to STATUS_QUEUED - - // If we are on a review round, return the round status - // prior to the decline decision - $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ - $reviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $this->getStageId()); - if (is_a($reviewRound, 'ReviewRound')) { - $reviewRound->setStatus(null); - $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ - $reviewRoundDao->updateStatus($reviewRound); - } - - Repo::submission()->dao->update($submission); - } - - // - // Private functions - // - /** - * Get this form decisions. - * - * @return array - */ - public function _getDecisions() - { - return [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_REVERT_DECLINE - ]; - } -} diff --git a/controllers/modals/editorDecision/form/SendReviewsForm.inc.php b/controllers/modals/editorDecision/form/SendReviewsForm.inc.php deleted file mode 100644 index c1b11604a49..00000000000 --- a/controllers/modals/editorDecision/form/SendReviewsForm.inc.php +++ /dev/null @@ -1,181 +0,0 @@ -_getDecisions())) { - fatalError('Invalid decision!'); - } - - $this->setSaveFormOperation('saveSendReviews'); - - parent::__construct( - $submission, - $decision, - $stageId, - 'controllers/modals/editorDecision/form/sendReviewsForm.tpl', - $reviewRound - ); - } - - - // - // Implement protected template methods from Form - // - /** - * @copydoc EditorDecisionWithEmailForm::initData() - */ - public function initData($actionLabels = []) - { - $request = Application::get()->getRequest(); - $actionLabels = (new EditorDecisionActionsManager())->getActionLabels($request->getContext(), $this->getSubmission(), $this->getStageId(), $this->_getDecisions()); - - return parent::initData($actionLabels); - } - - /** - * @copydoc Form::readInputData() - */ - public function readInputData() - { - $this->readUserVars(['decision']); - parent::readInputData(); - } - - /** - * @copydoc EditorDecisionWithEmailForm::fetch() - * - * @param null|mixed $template - */ - public function fetch($request, $template = null, $display = false) - { - $templateMgr = TemplateManager::getManager($request); - $router = $request->getRouter(); - $dispatcher = $router->getDispatcher(); - $submission = $this->getSubmission(); - $user = $request->getUser(); - - $revisionsEmail = new SubmissionMailTemplate($submission, 'EDITOR_DECISION_REVISIONS'); - $resubmitEmail = new SubmissionMailTemplate($submission, 'EDITOR_DECISION_RESUBMIT'); - - foreach ([$revisionsEmail, $resubmitEmail] as &$email) { - $email->assignParams([ - 'authorName' => $submission->getAuthorString(), - 'submissionUrl' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, null, 'authorDashboard', 'submission', $submission->getId()), - ]); - $email->replaceParams(); - } - - $templateMgr->assign([ - 'revisionsEmail' => $revisionsEmail->getBody(), - 'resubmitEmail' => $resubmitEmail->getBody(), - ]); - - return parent::fetch($request, $template, $display); - } - - /** - * @copydoc Form::execute() - */ - public function execute(...$functionArgs) - { - $request = Application::get()->getRequest(); - - // Retrieve the submission. - $submission = $this->getSubmission(); - - // Get this form decision actions labels. - $actionLabels = (new EditorDecisionActionsManager())->getActionLabels($request->getContext(), $submission, $this->getStageId(), $this->_getDecisions()); - - // Record the decision. - $reviewRound = $this->getReviewRound(); - $decision = $this->getDecision(); - $stageId = $this->getStageId(); - $editorAction = new EditorAction(); - $editorAction->recordDecision($request, $submission, $decision, $actionLabels, $reviewRound, $stageId); - - parent::execute(...$functionArgs); - - // Identify email key and status of round. - switch ($decision) { - case EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS: - $emailKey = 'EDITOR_DECISION_REVISIONS'; - $status = ReviewRound::REVIEW_ROUND_STATUS_REVISIONS_REQUESTED; - break; - - case EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_RESUBMIT: - $emailKey = 'EDITOR_DECISION_RESUBMIT'; - $status = ReviewRound::REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW; - break; - - case EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE: - $emailKey = 'EDITOR_DECISION_DECLINE'; - $status = ReviewRound::REVIEW_ROUND_STATUS_DECLINED; - break; - - case EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE: - $emailKey = 'EDITOR_DECISION_INITIAL_DECLINE'; - $status = ReviewRound::REVIEW_ROUND_STATUS_DECLINED; - break; - - default: - fatalError('Unsupported decision!'); - } - - $this->_updateReviewRoundStatus($submission, $status, $reviewRound); - - // Send email to the author. - $this->_sendReviewMailToAuthor($submission, $emailKey, $request); - } - - // - // Private functions - // - /** - * Get this form decisions. - * - * @return array - */ - public function _getDecisions() - { - return [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS, - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_RESUBMIT, - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_DECLINE, - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_INITIAL_DECLINE - ]; - } -} diff --git a/controllers/modals/publish/PublishHandler.inc.php b/controllers/modals/publish/PublishHandler.inc.php index 74097d7d49e..0f3da960b4b 100644 --- a/controllers/modals/publish/PublishHandler.inc.php +++ b/controllers/modals/publish/PublishHandler.inc.php @@ -25,10 +25,10 @@ class PublishHandler extends Handler { - /** @var Submission **/ + /** @var Submission */ public $submission; - /** @var Publication **/ + /** @var Publication */ public $publication; /** @@ -75,8 +75,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Display a publishing confirmation form * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ diff --git a/controllers/modals/review/ReviewerViewMetadataLinkAction.inc.php b/controllers/modals/review/ReviewerViewMetadataLinkAction.inc.php index e563e960813..245e3d0a56c 100644 --- a/controllers/modals/review/ReviewerViewMetadataLinkAction.inc.php +++ b/controllers/modals/review/ReviewerViewMetadataLinkAction.inc.php @@ -23,9 +23,9 @@ class ReviewerViewMetadataLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $submissionId integer - * @param $reviewAssignmentId integer + * @param Request $request + * @param int $submissionId + * @param int $reviewAssignmentId */ public function __construct($request, $submissionId, $reviewAssignmentId) { diff --git a/controllers/page/PageHandler.inc.php b/controllers/page/PageHandler.inc.php index 7ee059fb84e..40fa80fa3f4 100644 --- a/controllers/page/PageHandler.inc.php +++ b/controllers/page/PageHandler.inc.php @@ -47,8 +47,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Display the tasks component * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -62,8 +62,8 @@ public function tasks($args, $request) /** * Get the compiled CSS * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function css($args, $request) { @@ -84,7 +84,7 @@ public function css($args, $request) $styles = $templateManager->compileLess($name, 'styles/index.less'); if (!$templateManager->cacheLess($cachedFile, $styles)) { echo $styles; - die; + exit; } } break; @@ -101,7 +101,7 @@ public function css($args, $request) } header('Content-Length: ' . strlen($result)); echo $result; - die; + exit; } else { $cachedFile = $templateManager->getCachedLessFilePath($name); if (!file_exists($cachedFile)) { @@ -145,14 +145,14 @@ public function css($args, $request) // Give up if there are still no styles if (!$styles) { - die; + exit; } // Try to save the styles to a cached file. If we can't, // just print them out if (!$templateManager->cacheLess($cachedFile, $styles)) { echo $styles; - die; + exit; } } } @@ -163,6 +163,6 @@ public function css($args, $request) header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($cachedFile)) . ' GMT'); header('Content-Length: ' . filesize($cachedFile)); readfile($cachedFile); - die; + exit; } } diff --git a/controllers/review/linkAction/ReviewNotesLinkAction.inc.php b/controllers/review/linkAction/ReviewNotesLinkAction.inc.php index 49774a460f5..a2167d7052d 100644 --- a/controllers/review/linkAction/ReviewNotesLinkAction.inc.php +++ b/controllers/review/linkAction/ReviewNotesLinkAction.inc.php @@ -21,13 +21,13 @@ class ReviewNotesLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $reviewAssignment \PKP\submission\reviewAssignment\ReviewAssignment The review assignment + * @param Request $request + * @param \PKP\submission\reviewAssignment\ReviewAssignment $reviewAssignment The review assignment * to show information about. - * @param $submission Submission The reviewed submission. - * @param $user User The user. - * @param $handler string name of the gridhandler. - * @param $isUnread bool Has a review been read + * @param Submission $submission The reviewed submission. + * @param User $user The user. + * @param string $handler name of the gridhandler. + * @param bool $isUnread Has a review been read */ public function __construct($request, $reviewAssignment, $submission, $user, $handler, $isUnread = null) { diff --git a/controllers/review/linkAction/UnconsiderReviewLinkAction.inc.php b/controllers/review/linkAction/UnconsiderReviewLinkAction.inc.php index 8f79f6956f2..444ac37d080 100644 --- a/controllers/review/linkAction/UnconsiderReviewLinkAction.inc.php +++ b/controllers/review/linkAction/UnconsiderReviewLinkAction.inc.php @@ -24,10 +24,10 @@ class UnconsiderReviewLinkAction extends LinkAction /** * Constructor * - * @param $request Request - * @param $reviewAssignment \PKP\submission\reviewAssignment\ReviewAssignment The review assignment + * @param Request $request + * @param \PKP\submission\reviewAssignment\ReviewAssignment $reviewAssignment The review assignment * to show information about. - * @param $submission Submission The reviewed submission. + * @param Submission $submission The reviewed submission. */ public function __construct($request, $reviewAssignment, $submission) { diff --git a/controllers/statistics/ReportGeneratorHandler.inc.php b/controllers/statistics/ReportGeneratorHandler.inc.php index cec805cf2ca..d6fbfb55f27 100644 --- a/controllers/statistics/ReportGeneratorHandler.inc.php +++ b/controllers/statistics/ReportGeneratorHandler.inc.php @@ -47,8 +47,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Fetch form to generate custom reports. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -73,8 +73,8 @@ public function fetchReportGenerator($args, $request) /** * Save form to generate custom reports. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -99,8 +99,8 @@ public function saveReportGenerator($args, $request) * Fetch articles title and id from * the passed request variable issue id. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -131,8 +131,8 @@ public function fetchArticlesInfo($args, $request) * Fetch regions from the passed request * variable country id. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ diff --git a/controllers/statistics/form/PKPReportGeneratorForm.inc.php b/controllers/statistics/form/PKPReportGeneratorForm.inc.php index 3fec740fa7b..0794b48f3d7 100644 --- a/controllers/statistics/form/PKPReportGeneratorForm.inc.php +++ b/controllers/statistics/form/PKPReportGeneratorForm.inc.php @@ -51,16 +51,16 @@ abstract class PKPReportGeneratorForm extends Form /** * Constructor. * - * @param $columns array Report column names. - * @param $optionalColumns array Report column names that are optional. - * @param $objects array Object types. - * @param $fileTypes array File types. - * @param $metricType string The default report metric type. - * @param $defaultReportTemplates array Default report templates that + * @param array $columns Report column names. + * @param array $optionalColumns Report column names that are optional. + * @param array $objects Object types. + * @param array $fileTypes File types. + * @param string $metricType The default report metric type. + * @param array $defaultReportTemplates Default report templates that * defines columns and filters selections. The key for each array * item is expected to be a localized key that describes the * report Template. - * @param $reportTemplateIndex int (optional) Current report template index + * @param int $reportTemplateIndex (optional) Current report template index * from the passed default report templates array. */ public function __construct($columns, $optionalColumns, $objects, $fileTypes, $metricType, $defaultReportTemplates, $reportTemplateIndex = null) diff --git a/controllers/tab/authorDashboard/AuthorDashboardReviewRoundTabHandler.inc.php b/controllers/tab/authorDashboard/AuthorDashboardReviewRoundTabHandler.inc.php index 866a73640b1..160a9e11275 100644 --- a/controllers/tab/authorDashboard/AuthorDashboardReviewRoundTabHandler.inc.php +++ b/controllers/tab/authorDashboard/AuthorDashboardReviewRoundTabHandler.inc.php @@ -16,11 +16,12 @@ // Import the base Handler. import('pages.authorDashboard.AuthorDashboardHandler'); +use APP\core\Application; use APP\notification\Notification; use APP\template\TemplateManager; -use APP\workflow\EditorDecisionActionsManager; use PKP\core\JSONMessage; +use PKP\db\DAORegistry; use PKP\log\SubmissionEmailLogEntry; use PKP\notification\PKPNotification; use PKP\security\authorization\internal\ReviewRoundRequiredPolicy; @@ -29,7 +30,7 @@ class AuthorDashboardReviewRoundTabHandler extends AuthorDashboardHandler { - /** @var boolean Overwrite backend page handling of AuthorDashboardHandler */ + /** @var bool Overwrite backend page handling of AuthorDashboardHandler */ public $_isBackendPage = false; /** @@ -68,8 +69,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Fetch information for the author on the specified review round * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -78,9 +79,9 @@ public function fetchReviewRoundInfo($args, $request) $this->setupTemplate($request); $templateMgr = TemplateManager::getManager($request); - $reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND); - $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); - $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); + $reviewRound = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_REVIEW_ROUND); + $submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + $stageId = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_WORKFLOW_STAGE); if ($stageId !== WORKFLOW_STAGE_ID_INTERNAL_REVIEW && $stageId !== WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) { fatalError('Invalid Stage Id'); } @@ -91,7 +92,7 @@ public function fetchReviewRoundInfo($args, $request) 'submission' => $submission, 'reviewRoundNotificationRequestOptions' => [ Notification::NOTIFICATION_LEVEL_NORMAL => [ - PKPNotification::NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => [ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId()]], + PKPNotification::NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => [Application::ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId()]], Notification::NOTIFICATION_LEVEL_TRIVIAL => [] ], ]); @@ -102,15 +103,16 @@ public function fetchReviewRoundInfo($args, $request) $templateMgr->assign('showReviewerGrid', true); } - // Editor has taken an action and sent an email; Display the email - if ((new EditorDecisionActionsManager())->getEditorTakenActionInReviewRound($request->getContext(), $reviewRound)) { - $submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO'); /** @var SubmissionEmailLogDAO $submissionEmailLogDao */ - $user = $request->getUser(); - $templateMgr->assign([ - 'submissionEmails' => $submissionEmailLogDao->getByEventType($submission->getId(), SubmissionEmailLogEntry::SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR, $user->getId()), - 'showReviewAttachments' => true, - ]); - } + // Display notification emails to the author related to editorial decisions + $submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO'); /** @var SubmissionEmailLogDAO $submissionEmailLogDao */ + $templateMgr->assign([ + 'submissionEmails' => $submissionEmailLogDao->getByEventType( + $submission->getId(), + SubmissionEmailLogEntry::SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR, + $request->getUser()->getId() + ), + 'showReviewAttachments' => true, + ]); return $templateMgr->fetchJson('authorDashboard/reviewRoundInfo.tpl'); } diff --git a/controllers/tab/authorDashboard/AuthorDashboardTabHandler.inc.php b/controllers/tab/authorDashboard/AuthorDashboardTabHandler.inc.php index 537146663c0..d67e751e9bd 100644 --- a/controllers/tab/authorDashboard/AuthorDashboardTabHandler.inc.php +++ b/controllers/tab/authorDashboard/AuthorDashboardTabHandler.inc.php @@ -55,8 +55,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Fetch the specified authorDashboard tab. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -123,8 +123,8 @@ public function fetchTab($args, $request) /** * Get the last review round numbers in an array by stage name. * - * @param $submission Submission - * @param $stageId int WORKFLOW_STAGE_ID_... + * @param Submission $submission + * @param int $stageId WORKFLOW_STAGE_ID_... * * @return int Round number, 0 if none. */ @@ -141,7 +141,7 @@ protected function _getLastReviewRoundNumber($submission, $stageId) /** * Get the notification request options. * - * @param $submission Submission + * @param Submission $submission * * @return array */ diff --git a/controllers/tab/pubIds/form/PKPPublicIdentifiersForm.inc.php b/controllers/tab/pubIds/form/PKPPublicIdentifiersForm.inc.php index e214d5b77c5..209bbb21c81 100644 --- a/controllers/tab/pubIds/form/PKPPublicIdentifiersForm.inc.php +++ b/controllers/tab/pubIds/form/PKPPublicIdentifiersForm.inc.php @@ -47,9 +47,9 @@ class PKPPublicIdentifiersForm extends Form /** * Constructor. * - * @param $pubObject object - * @param $stageId integer - * @param $formParams array + * @param object $pubObject + * @param int $stageId + * @param array $formParams */ public function __construct($pubObject, $stageId = null, $formParams = null) { @@ -129,7 +129,7 @@ public function getPubObject() /** * Get the stage id * - * @return integer WORKFLOW_STAGE_ID_ + * @return int WORKFLOW_STAGE_ID_ */ public function getStageId() { @@ -139,7 +139,7 @@ public function getStageId() /** * Get the context id * - * @return integer + * @return int */ public function getContextId() { @@ -226,7 +226,7 @@ public function execute(...$functionArgs) } if ($pubObject instanceof SubmissionFile) { - Repo::submissionFiles()->edit($pubObject, []); + Repo::submissionFile()->edit($pubObject, []); return; } @@ -235,7 +235,7 @@ public function execute(...$functionArgs) /** * Clear pub id. * - * @param $pubIdPlugInClassName string + * @param string $pubIdPlugInClassName */ public function clearPubId($pubIdPlugInClassName) { @@ -246,9 +246,9 @@ public function clearPubId($pubIdPlugInClassName) /** * Get assoc type of the given object. * - * @param $pubObject + * @param object $pubObject * - * @return integer ASSOC_TYPE_ + * @return int ASSOC_TYPE_ */ public function getAssocType($pubObject) { diff --git a/controllers/tab/user/ProfileTabHandler.inc.php b/controllers/tab/user/ProfileTabHandler.inc.php index 67381003460..073a0e62470 100644 --- a/controllers/tab/user/ProfileTabHandler.inc.php +++ b/controllers/tab/user/ProfileTabHandler.inc.php @@ -49,8 +49,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Display form to edit user's identity. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -65,8 +65,8 @@ public function identity($args, $request) /** * Validate and save changes to user's identity info. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -88,8 +88,8 @@ public function saveIdentity($args, $request) /** * Display form to edit user's contact information. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -104,8 +104,8 @@ public function contact($args, $request) /** * Validate and save changes to user's contact info. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -127,8 +127,8 @@ public function saveContact($args, $request) /** * Display form to edit user's roles information. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -143,8 +143,8 @@ public function roles($args, $request) /** * Validate and save changes to user's roles info. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -166,8 +166,8 @@ public function saveRoles($args, $request) /** * Display form to edit user's publicProfile information. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -182,8 +182,8 @@ public function publicProfile($args, $request) /** * Upload a public profile image. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -201,8 +201,8 @@ public function uploadProfileImage($args, $request) /** * Remove a public profile image. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function deleteProfileImage($args, $request) { @@ -214,8 +214,8 @@ public function deleteProfileImage($args, $request) /** * Validate and save changes to user's publicProfile info. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -237,8 +237,8 @@ public function savePublicProfile($args, $request) /** * Display form to edit user's API key settings. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -253,8 +253,8 @@ public function apiProfile($args, $request) /** * Validate and save changes to user's API key settings. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -276,8 +276,8 @@ public function saveAPIProfile($args, $request) /** * Display form to change user's password. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -292,8 +292,8 @@ public function changePassword($args, $request) /** * Save user's new password. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -315,8 +315,8 @@ public function savePassword($args, $request) /** * Fetch notifications tab content. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ @@ -332,8 +332,8 @@ public function notificationSettings($args, $request) /** * Save user notification settings. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON-formatted response */ diff --git a/controllers/tab/workflow/PKPWorkflowTabHandler.inc.php b/controllers/tab/workflow/PKPWorkflowTabHandler.inc.php index 7efed8cad68..9774a93d5cd 100644 --- a/controllers/tab/workflow/PKPWorkflowTabHandler.inc.php +++ b/controllers/tab/workflow/PKPWorkflowTabHandler.inc.php @@ -16,11 +16,11 @@ use APP\handler\Handler; use APP\notification\Notification; use APP\notification\NotificationManager; +use APP\submission\Submission; use APP\template\TemplateManager; -use APP\workflow\EditorDecisionActionsManager; use PKP\core\JSONMessage; -use PKP\linkAction\LinkAction; -use PKP\linkAction\request\AjaxModal; +use PKP\core\PKPApplication; +use PKP\decision\types\NewExternalReviewRound; use PKP\notification\PKPNotification; use PKP\security\authorization\WorkflowStageAccessPolicy; use PKP\security\Role; @@ -58,8 +58,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Fetch the specified workflow tab. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -71,7 +71,8 @@ public function fetchTab($args, $request) $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE); $templateMgr->assign('stageId', $stageId); - $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); /** @var Submission $submission */ + /** @var Submission $submission */ + $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $templateMgr->assign('submission', $submission); switch ($stageId) { @@ -92,10 +93,7 @@ public function fetchTab($args, $request) // as the current review round tab index, if we have review rounds. if ($lastReviewRound) { $lastReviewRoundNumber = $lastReviewRound->getRound(); - $lastReviewRoundId = $lastReviewRound->getId(); $templateMgr->assign('lastReviewRoundNumber', $lastReviewRoundNumber); - } else { - $lastReviewRoundId = null; } // Add the round information to the template. @@ -103,32 +101,13 @@ public function fetchTab($args, $request) $templateMgr->assign('reviewRoundOp', $this->_identifyReviewRoundOp($stageId)); if ($submission->getStageId() == $selectedStageId && count($reviewRoundsArray) > 0) { - $dispatcher = $request->getDispatcher(); - - $newRoundAction = new LinkAction( - 'newRound', - new AjaxModal( - $dispatcher->url( - $request, - PKPApplication::ROUTE_COMPONENT, - null, - 'modals.editorDecision.EditorDecisionHandler', - 'newReviewRound', - null, - [ - 'submissionId' => $submission->getId(), - 'decision' => EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_NEW_ROUND, - 'stageId' => $selectedStageId, - 'reviewRoundId' => $lastReviewRoundId - ] - ), - __('editor.submission.newRound'), - 'modal_add_item' - ), - __('editor.submission.newRound'), - 'add_item_small' + if ($stageId === WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) { + $newReviewRoundType = new NewExternalReviewRound(); + } + $templateMgr->assign( + 'newRoundUrl', + $newReviewRoundType->getUrl($request, $request->getContext(), $submission, $lastReviewRound->getId()) ); - $templateMgr->assign('newRoundAction', $newRoundAction); } // Render the view. @@ -156,7 +135,7 @@ public function fetchTab($args, $request) /** * Setup variables for the template * - * @param $request Request + * @param Request $request */ public function setupTemplate($request) { @@ -193,7 +172,7 @@ public function setupTemplate($request) /** * Return the editor assignment notification type based on stage id. * - * @param $stageId int + * @param int $stageId * * @return int */ @@ -215,7 +194,7 @@ protected function getEditorAssignmentNotificationTypeByStageId($stageId) /** * Get all production notification options to be used in the production stage tab. * - * @param $submissionId int + * @param int $submissionId * * @return array */ @@ -224,9 +203,9 @@ abstract protected function getProductionNotificationOptions($submissionId); /** * Translate the requested operation to a stage id. * - * @param $request Request + * @param Request $request * - * @return integer One of the WORKFLOW_STAGE_* constants. + * @return int One of the WORKFLOW_STAGE_* constants. */ private function _identifyStageId($request) { diff --git a/controllers/wizard/fileUpload/FileUploadWizardHandler.inc.php b/controllers/wizard/fileUpload/FileUploadWizardHandler.inc.php index 075f9a30af1..e2ad8b90c5e 100644 --- a/controllers/wizard/fileUpload/FileUploadWizardHandler.inc.php +++ b/controllers/wizard/fileUpload/FileUploadWizardHandler.inc.php @@ -33,28 +33,28 @@ class FileUploadWizardHandler extends Handler { - /** @var integer */ + /** @var int */ public $_fileStage; /** @var array */ public $_uploaderRoles; - /** @var boolean */ + /** @var bool */ public $_revisionOnly; /** @var int */ public $_reviewRound; - /** @var integer */ + /** @var int */ public $_revisedFileId; - /** @var integer */ + /** @var int */ public $_assocType; - /** @var integer */ + /** @var int */ public $_assocId; - /** @var integer */ + /** @var int */ public $_queryId; @@ -85,7 +85,7 @@ public function authorize($request, &$args, $roleAssignments) // we don't need to validate in another places. $fileStage = (int) $request->getUserVar('fileStage'); if ($fileStage) { - $fileStages = Repo::submissionFiles()->getFileStages(); + $fileStages = Repo::submissionFile()->getFileStages(); if (!in_array($fileStage, $fileStages)) { return false; } @@ -245,7 +245,7 @@ public function getSubmission() /** * Get the authorized workflow stage. * - * @return integer One of the WORKFLOW_STAGE_ID_* constants. + * @return int One of the WORKFLOW_STAGE_ID_* constants. */ public function getStageId() { @@ -257,7 +257,7 @@ public function getStageId() * we upload files to. One of the SubmissionFile::SUBMISSION_FILE_* * constants. * - * @return integer + * @return int */ public function getFileStage() { @@ -277,7 +277,7 @@ public function getUploaderRoles() /** * Does this uploader only allow revisions and no new files? * - * @return boolean + * @return bool */ public function getRevisionOnly() { @@ -297,7 +297,7 @@ public function getReviewRound() /** * Get the id of the file to be revised (if any). * - * @return integer + * @return int */ public function getRevisedFileId() { @@ -307,7 +307,7 @@ public function getRevisedFileId() /** * Get the assoc type (if any) * - * @return integer + * @return int */ public function getAssocType() { @@ -317,7 +317,7 @@ public function getAssocType() /** * Get the assoc id (if any) * - * @return integer + * @return int */ public function getAssocId() { @@ -330,8 +330,8 @@ public function getAssocId() /** * Displays the file upload wizard. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -359,8 +359,8 @@ public function startWizard($args, $request) /** * Render the file upload form in its initial state. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -391,8 +391,8 @@ public function displayFileUploadForm($args, $request) /** * Upload a file and render the modified upload wizard. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -438,8 +438,8 @@ public function uploadFile($args, $request) * Edit the metadata of the latest revision of * the requested submission file. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -455,8 +455,8 @@ public function editMetadata($args, $request) /** * Display the final tab of the modal * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -488,8 +488,8 @@ public function finishFileSubmission($args, $request) * names from the revision detection pile (e.g. "Chapter 1" and * "Chapter 2") * - * @param $a string - * @param $b string + * @param string $a + * @param string $b */ public function _onlyNumbersDiffer($a, $b) { diff --git a/controllers/wizard/fileUpload/form/PKPSubmissionFilesUploadBaseForm.inc.php b/controllers/wizard/fileUpload/form/PKPSubmissionFilesUploadBaseForm.inc.php index bed00ce833b..9171f0f2ff7 100644 --- a/controllers/wizard/fileUpload/form/PKPSubmissionFilesUploadBaseForm.inc.php +++ b/controllers/wizard/fileUpload/form/PKPSubmissionFilesUploadBaseForm.inc.php @@ -17,7 +17,6 @@ use APP\facades\Repo; use APP\template\TemplateManager; -use Exception; use PKP\form\Form; use PKP\linkAction\LinkAction; @@ -27,7 +26,7 @@ class PKPSubmissionFilesUploadBaseForm extends Form { - /** @var integer */ + /** @var int */ public $_stageId; /** @var ReviewRound */ @@ -39,17 +38,17 @@ class PKPSubmissionFilesUploadBaseForm extends Form /** * Constructor. * - * @param $request Request - * @param $template string - * @param $submissionId integer - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. - * @param $fileStage integer - * @param $revisionOnly boolean - * @param $reviewRound ReviewRound - * @param $revisedFileId integer - * @param $assocType integer - * @param $assocId integer - * @param $queryId integer + * @param Request $request + * @param string $template + * @param int $submissionId + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. + * @param int $fileStage + * @param bool $revisionOnly + * @param ReviewRound $reviewRound + * @param int $revisedFileId + * @param int $assocType + * @param int $assocId + * @param int $queryId */ public function __construct( $request, @@ -114,7 +113,7 @@ public function __construct( /** * Get the workflow stage id. * - * @return integer + * @return int */ public function getStageId() { @@ -144,7 +143,7 @@ public function getRevisedFileId() /** * Get the associated type * - * @return integer + * @return int */ public function getAssocType() { @@ -154,7 +153,7 @@ public function getAssocType() /** * Get the associated id. * - * @return integer + * @return int */ public function getAssocId() { @@ -203,18 +202,18 @@ public function getSubmissionFiles() throw new Exception('Can not request submission files from another context.'); } - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterByReviewRoundIds([(int) $reviewRound->getId()]) ->filterBySubmissionIds([$submissionId]); - $submissionFilesIterator = Repo::submissionFiles()->getMany($collector); + $submissionFilesIterator = Repo::submissionFile()->getMany($collector); $this->_submissionFiles = iterator_to_array($submissionFilesIterator); } else { // No review round, e.g. for dependent or query files $this->_submissionFiles = []; } } else { - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterByFileStages([(int) $this->getData('fileStage')]) ->filterBySubmissionIds([(int) $this->getData('submissionId')]); @@ -226,7 +225,7 @@ public function getSubmissionFiles() } $this->_submissionFiles = iterator_to_array( - Repo::submissionFiles()->getMany($collector) + Repo::submissionFile()->getMany($collector) ); } } @@ -237,8 +236,8 @@ public function getSubmissionFiles() /** * Get the submission files possible to select/consider for revision by the given user. * - * @param $user User - * @param $uploadedFile uploaded SubmissionFile + * @param User $user + * @param SubmissionFile $uploadedFile uploaded file * * @return array a list of SubmissionFile instances. */ diff --git a/controllers/wizard/fileUpload/form/SubmissionFilesMetadataForm.inc.php b/controllers/wizard/fileUpload/form/SubmissionFilesMetadataForm.inc.php index 5d8d02e0f9d..9e7cbd9db2b 100644 --- a/controllers/wizard/fileUpload/form/SubmissionFilesMetadataForm.inc.php +++ b/controllers/wizard/fileUpload/form/SubmissionFilesMetadataForm.inc.php @@ -24,7 +24,7 @@ class SubmissionFilesMetadataForm extends Form /** @var SubmissionFile */ public $_submissionFile; - /** @var integer */ + /** @var int */ public $_stageId; /** @var ReviewRound */ @@ -33,10 +33,10 @@ class SubmissionFilesMetadataForm extends Form /** * Constructor. * - * @param $submissionFile SubmissionFile - * @param $stageId int One of the WORKFLOW_STAGE_ID_* constants. - * @param $reviewRound ReviewRound (optional) Current review round, if any. - * @param $template string Path and filename to template file (optional). + * @param SubmissionFile $submissionFile + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. + * @param ReviewRound $reviewRound (optional) Current review round, if any. + * @param string $template Path and filename to template file (optional). */ public function __construct($submissionFile, $stageId, $reviewRound = null, $template = null) { @@ -79,7 +79,7 @@ public function getSubmissionFile() /** * Get the workflow stage id. * - * @return integer + * @return int */ public function getStageId() { @@ -99,7 +99,7 @@ public function getReviewRound() /** * Set the "show buttons" flag * - * @param $showButtons boolean + * @param bool $showButtons */ public function setShowButtons($showButtons) { @@ -109,7 +109,7 @@ public function setShowButtons($showButtons) /** * Get the "show buttons" flag * - * @return boolean + * @return bool */ public function getShowButtons() { @@ -155,7 +155,7 @@ public function fetch($request, $template = null, $display = false) 'submissionFile' => $this->getSubmissionFile(), 'stageId' => $this->getStageId(), 'reviewRoundId' => $reviewRound ? $reviewRound->getId() : null, - 'supportsDependentFiles' => Repo::submissionFiles()->supportsDependentFiles($this->getSubmissionFile()), + 'supportsDependentFiles' => Repo::submissionFile()->supportsDependentFiles($this->getSubmissionFile()), 'genre' => $genre, ]); return parent::fetch($request, $template, $display); @@ -190,8 +190,8 @@ public function execute(...$functionParams) 'dateCreated' => $this->getData('dateCreated'), ]); - Repo::submissionFiles()->edit($this->getSubmissionFile(), $props); - $this->_submissionFile = Repo::submissionFiles()->get( + Repo::submissionFile()->edit($this->getSubmissionFile(), $props); + $this->_submissionFile = Repo::submissionFile()->get( $this->getSubmissionFile()->getId() ); diff --git a/controllers/wizard/fileUpload/form/SubmissionFilesUploadForm.inc.php b/controllers/wizard/fileUpload/form/SubmissionFilesUploadForm.inc.php index 021da2f84f8..e8ec552f52e 100644 --- a/controllers/wizard/fileUpload/form/SubmissionFilesUploadForm.inc.php +++ b/controllers/wizard/fileUpload/form/SubmissionFilesUploadForm.inc.php @@ -29,18 +29,18 @@ class SubmissionFilesUploadForm extends PKPSubmissionFilesUploadBaseForm /** * Constructor. * - * @param $request Request - * @param $submissionId integer - * @param $stageId integer One of the WORKFLOW_STAGE_ID_* constants. - * @param $uploaderRoles array - * @param $fileStage integer - * @param $revisionOnly boolean - * @param $stageId integer - * @param $reviewRound ReviewRound - * @param $revisedFileId integer - * @param $assocType integer - * @param $assocId integer - * @param $queryId integer + * @param Request $request + * @param int $submissionId + * @param int $stageId One of the WORKFLOW_STAGE_ID_* constants. + * @param array $uploaderRoles + * @param int $fileStage + * @param bool $revisionOnly + * @param int $stageId + * @param ReviewRound $reviewRound + * @param int $revisedFileId + * @param int $assocType + * @param int $assocId + * @param int $queryId */ public function __construct( $request, @@ -178,15 +178,15 @@ public function execute(...$functionParams) $fileManager = new FileManager(); $extension = $fileManager->parseFileExtension($_FILES['uploadedFile']['name']); - $submissionDir = Repo::submissionFiles()->getSubmissionDir($request->getContext()->getId(), $this->getData('submissionId')); + $submissionDir = Repo::submissionFile()->getSubmissionDir($request->getContext()->getId(), $this->getData('submissionId')); $fileId = Services::get('file')->add( $_FILES['uploadedFile']['tmp_name'], $submissionDir . '/' . uniqid() . '.' . $extension ); if ($this->getRevisedFileId()) { - $submissionFile = Repo::submissionFiles()->get($this->getRevisedFileId()); - Repo::submissionFiles()->edit( + $submissionFile = Repo::submissionFile()->get($this->getRevisedFileId()); + Repo::submissionFile()->edit( $submissionFile, [ 'fileId' => $fileId, @@ -197,9 +197,9 @@ public function execute(...$functionParams) ] ); - $submissionFile = Repo::submissionFiles()->get($this->getRevisedFileId()); + $submissionFile = Repo::submissionFile()->get($this->getRevisedFileId()); } else { - $submissionFile = Repo::submissionFiles()->dao->newDataObject(); + $submissionFile = Repo::submissionFile()->dao->newDataObject(); $submissionFile->setData('fileId', $fileId); $submissionFile->setData('fileStage', $this->getData('fileStage')); $submissionFile->setData('name', $_FILES['uploadedFile']['name'], $request->getContext()->getPrimaryLocale()); @@ -214,9 +214,9 @@ public function execute(...$functionParams) $submissionFile->setData('assocId', $this->getReviewRound()->getId()); } - $id = Repo::submissionFiles()->add($submissionFile); + $id = Repo::submissionFile()->add($submissionFile); - $submissionFile = Repo::submissionFiles()->get($id); + $submissionFile = Repo::submissionFile()->get($id); } if (!$submissionFile) { @@ -238,7 +238,7 @@ public function execute(...$functionParams) /** * Retrieve the genre list. * - * @param $request Request + * @param Request $request * * @return array */ diff --git a/includes/bootstrap.inc.php b/includes/bootstrap.inc.php index b02b04ee342..8ce36b47ea5 100644 --- a/includes/bootstrap.inc.php +++ b/includes/bootstrap.inc.php @@ -25,18 +25,13 @@ */ // Load Composer autoloader -require_once('lib/pkp/lib/vendor/autoload.php'); +require_once 'lib/pkp/lib/vendor/autoload.php'; -define('ENV_SEPARATOR', strtolower(substr(PHP_OS, 0, 3)) == 'win' ? ';' : ':'); -if (!defined('DIRECTORY_SEPARATOR')) { - // Older versions of PHP do not define this - define('DIRECTORY_SEPARATOR', strtolower(substr(PHP_OS, 0, 3)) == 'win' ? '\\' : '/'); -} define('BASE_SYS_DIR', dirname(INDEX_FILE_LOCATION)); chdir(BASE_SYS_DIR); // System-wide functions -require('./lib/pkp/includes/functions.inc.php'); +require_once './lib/pkp/includes/functions.inc.php'; // Register custom autoloader functions for namespaces spl_autoload_register(function ($class) { diff --git a/includes/functions.inc.php b/includes/functions.inc.php index 2fb24093011..52a73f3fbd2 100644 --- a/includes/functions.inc.php +++ b/includes/functions.inc.php @@ -18,21 +18,18 @@ * Emulate a Java-style import statement. * Simply includes the associated PHP file (using require_once so multiple calls to include the same file have no effect). * - * @param $class string the complete name of the class to be imported (e.g. 'lib.pkp.classes.core.Core') + * @param string $class the complete name of the class to be imported (e.g. 'lib.pkp.classes.core.Core') */ if (!function_exists('import')) { function import($class) { $filePath = str_replace('.', '/', $class) . '.inc.php'; - if ($filePath === 'lib/pkp/classes/webservice/WebService.inc.php') { - throw new Exception(); - } - require_once(BASE_SYS_DIR . '/' . $filePath); + require_once BASE_SYS_DIR . '/' . $filePath; } } /** - * Wrapper around die() to pretty-print an error message with an optional stack trace. + * Wrapper around exit() to pretty-print an error message with an optional stack trace. */ function fatalError($reason) { @@ -129,19 +126,7 @@ function fatalError($reason) return; } - die(); -} - -/** - * Check to see if the server meets a minimum version requirement for PHP. - * - * @param $version Name of version (see version_compare documentation) - * - * @return boolean - */ -function checkPhpVersion($version) -{ - return (version_compare(PHP_VERSION, $version) !== -1); + exit; } /** @@ -160,14 +145,14 @@ function checkPhpVersion($version) * to be forward compatible with this potential use * case. * - * @param $fullyQualifiedClassName string - * @param $expectedTypes string|array the class + * @param string $fullyQualifiedClassName + * @param string|array $expectedTypes the class * must conform to at least one of the given types. - * @param $expectedPackages string|array the class + * @param string|array $expectedPackages the class * must be part of at least one of the given packages. - * @param $expectedMethods string|array names of methods + * @param string|array $expectedMethods names of methods * that must all be present for the requested class. - * @param $constructorArg mixed constructor argument + * @param mixed $constructorArg constructor argument * * @return object|boolean the instantiated object or false * if the class instantiation didn't result in the expected @@ -259,28 +244,10 @@ function &instantiate($fullyQualifiedClassName, $expectedTypes = null, $expected return $classInstance; } -/** - * Remove empty elements from an array - * - * @param $array array - * - * @return array - */ -function arrayClean($array) -{ - if (!is_array($array)) { - return null; - } - return array_filter($array, function ($o) { - return !empty($o); - }); -} - - /** * Recursively strip HTML from a (multidimensional) array. * - * @param $values array + * @param array $values * * @return array the cleansed array */ @@ -300,7 +267,7 @@ function stripAssocArray($values) * Perform a code-safe strtolower, i.e. one that doesn't behave differently * based on different locales. (tr_TR, I'm looking at you.) * - * @param $str string Input string + * @param string $str Input string * * @return string */ @@ -313,7 +280,7 @@ function strtolower_codesafe($str) * Perform a code-safe strtoupper, i.e. one that doesn't behave differently * based on different locales. (tr_TR, I'm looking at you.) * - * @param $str string Input string + * @param string $str Input string * * @return string */ @@ -326,7 +293,7 @@ function strtoupper_codesafe($str) * Perform a code-safe lcfirst, i.e. one that doesn't behave differently * based on different locales. (tr_TR, I'm looking at you.) * - * @param $str string Input string + * @param string $str Input string * * @return string */ @@ -339,7 +306,7 @@ function lcfirst_codesafe($str) * Perform a code-safe ucfirst, i.e. one that doesn't behave differently * based on different locales. (tr_TR, I'm looking at you.) * - * @param $str string Input string + * @param string $str Input string * * @return string */ @@ -403,9 +370,9 @@ function customAutoload($rootPath, $prefix, $class) * * @see PKPLocale::translate() * - * @param $key string - * @param $params array named substitution parameters - * @param $locale string the locale to use + * @param string $key + * @param array $params named substitution parameters + * @param string $locale the locale to use * * @return string */ diff --git a/js/controllers/EditorialActionsHandler.js b/js/controllers/EditorialActionsHandler.js index f4bf8963823..e67cdacbce2 100644 --- a/js/controllers/EditorialActionsHandler.js +++ b/js/controllers/EditorialActionsHandler.js @@ -25,6 +25,10 @@ this.parent($element, options); $element.find('.pkp_workflow_change_decision') .click(this.callbackWrapper(this.showActions_)); + $element.find('[data-decision]') + .click(this.callbackWrapper(this.emitRevisionDecision_)); + $element.find('[data-recommendation]') + .click(this.callbackWrapper(this.emitRevisionRecommendation_)); }; $.pkp.classes.Helper.inherits( $.pkp.controllers.EditorialActionsHandler, $.pkp.classes.Handler); @@ -42,7 +46,31 @@ $.pkp.controllers.EditorialActionsHandler.prototype.showActions_ = function(sourceElement, event) { this.getHtmlElement().find('.pkp_workflow_change_decision').hide(); - this.getHtmlElement().find('.pkp_workflow_decided_actions').show(); + this.getHtmlElement().find('.pkp_workflow_decisions_options').removeClass('pkp_workflow_decisions_options_hidden'); + }; + + /** + * Emit an event when a request revisions decision is initiated + * + * @param {HTMLElement} sourceElement The clicked link. + * @param {Event} event The triggered event (click). + */ + $.pkp.controllers.EditorialActionsHandler.prototype.emitRevisionDecision_ = + function(sourceElement, event) { + var $el = $(sourceElement); + pkp.eventBus.$emit('decision:revisions', $el.data('reviewRoundId')); + }; + + /** + * Emit an event when a request revisions recommendation is initiated + * + * @param {HTMLElement} sourceElement The clicked link. + * @param {Event} event The triggered event (click). + */ + $.pkp.controllers.EditorialActionsHandler.prototype.emitRevisionRecommendation_ = + function(sourceElement, event) { + var $el = $(sourceElement); + pkp.eventBus.$emit('recommendation:revisions', $el.data('reviewRoundId')); }; diff --git a/js/controllers/modals/editorDecision/form/EditorDecisionFormHandler.js b/js/controllers/modals/editorDecision/form/EditorDecisionFormHandler.js deleted file mode 100644 index 62fbfd50ebc..00000000000 --- a/js/controllers/modals/editorDecision/form/EditorDecisionFormHandler.js +++ /dev/null @@ -1,250 +0,0 @@ -/** - * @defgroup js_controllers_modals_editorDecision_form - */ -/** - * @file js/controllers/modals/editorDecision/form/EditorDecisionFormHandler.js - * - * 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 EditorDecisionFormHandler - * @ingroup js_controllers_modals_editorDecision_form - * - * @brief Handle editor decision forms. - */ -(function($) { - - /** @type {Object} */ - $.pkp.controllers.modals = $.pkp.controllers.modals || - { editorDecision: {form: { } } }; - - - - /** - * @constructor - * - * @extends $.pkp.controllers.form.AjaxFormHandler - * - * @param {jQueryObject} $form the wrapped HTML form element. - * @param {{ - * peerReviewUrl: string?, - * revisionsEmail: string?, - * resubmitEmail: string? - * }} options form options - */ - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler = - function($form, options) { - - this.parent($form, options); - - if (options.peerReviewUrl !== null) { - this.peerReviewUrl_ = options.peerReviewUrl; - $('#importPeerReviews', $form).click( - this.callbackWrapper(this.importPeerReviews)); - } - - // Handle revisions, resubmit and decline decision forms - if (options.revisionsEmail !== null) { - this.revisionsEmail_ = options.revisionsEmail; - } - if (options.resubmitEmail !== null) { - this.resubmitEmail_ = options.resubmitEmail; - } - $('#skipEmail-send, #skipEmail-skip, ' + - '#skipDiscussion-send, #skipDiscussion-skip', $form).change( - this.callbackWrapper(this.toggleEmailDisplay)); - $('input[name="decision"]', $form).change( - this.callbackWrapper(this.toggleDecisionEmail)); - - // Handle promotion forms - this.setStep('email'); - var self = this; - $('.promoteForm-step-btn', $form).click(function(e) { - e.preventDefault(); - e.stopPropagation(); - var step = $(e.target).data('step'); - self.setStep(/** @type {string} */ (step)); - }); - }; - $.pkp.classes.Helper.inherits( - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler, - $.pkp.controllers.form.AjaxFormHandler); - - - // - // Private properties - // - /** - * The URL of the "fetch peer reviews" operation. - * @private - * @type {?string} - */ - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler. - peerReviewUrl_ = null; - - - /** - * The content of the revisions requested email. - * @private - * @type {?string} - */ - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler. - revisionsEmail_ = null; - - - /** - * The content of the resubmit for review email. - * @private - * @type {?string} - */ - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler. - resubmitEmail_ = null; - - - // - // Public methods - // - /** - * Retrieve reviews from the server. - * - * @param {HTMLElement} button The "import reviews" button. - * @param {Event} event The click event. - * @return {boolean} Return false to abort normal click event. - */ - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler. - prototype.importPeerReviews = function(button, event) { - - $.getJSON(this.peerReviewUrl_, this.callbackWrapper(this.insertPeerReviews)); - return false; - }; - - - /** - * Insert the peer reviews that have been returned from the server - * into the form. - * - * @param {Object} ajaxOptions The options that were passed into - * the AJAX call. - * @param {Object} jsonData The data returned from the server. - */ - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler. - prototype.insertPeerReviews = function(ajaxOptions, jsonData) { - - var processedJsonData = this.handleJson(jsonData), - $form = this.getHtmlElement(), - $textArea = $('textarea[id^="personalMessage"]', $form), - editor = tinyMCE.get(/** @type {string} */ ($textArea.attr('id'))), - currentContent = editor.getContent(); - - if (processedJsonData !== false) { - // Add the peer review text to the personal message to the author. - editor.setContent( - currentContent + processedJsonData.content + '
'); - } - - // Present any new notifications to the user. - this.trigger('notifyUser', [this.getHtmlElement()]); - }; - - - /** - * Show or hide the email depending on the `skipEmail` setting - */ - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler. - prototype.toggleEmailDisplay = function() { - var $emailDiv = $('#sendReviews-emailContent'), - $self = this.getHtmlElement(), - sendEmail = false, - createDiscussion = false, - $discussionToggles, - $attachementDiv = $('#libraryFileAttachments'); - - $('#skipEmail-send, #skipEmail-skip', $self).each(function() { - if ($(this).attr('id') === 'skipEmail-send' && $(this).prop('checked')) { - sendEmail = true; - } else if ($(this).attr('id') === 'skipEmail-skip' && - $(this).prop('checked')) { - sendEmail = false; - } - }); - - $discussionToggles = $('#skipDiscussion-send, #skipDiscussion-skip', $self); - if ($discussionToggles.length) { - $discussionToggles.each(function() { - if ($(this).attr('id') === 'skipDiscussion-send' && - $(this).prop('checked')) { - createDiscussion = true; - } else if ($(this).attr('id') === 'skipDiscussion-skip' && - $(this).prop('checked')) { - createDiscussion = false; - } - }); - } - - if (!sendEmail && !createDiscussion) { - $emailDiv.fadeOut(); - $attachementDiv.fadeOut(); - } else { - $emailDiv.fadeIn(); - $attachementDiv.fadeIn(); - } - }; - - - /** - * Update the email content depending on which decision was selected. - * - * Only used in the request revisions modal to choose between two decisions. - */ - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler. - prototype.toggleDecisionEmail = function() { - var emailContent = '', - isEmailDivVisible = $('#skipEmail-send').prop('checked'), - $emailDiv = $('#sendReviews-emailContent'), - textareaId = $('textarea[id^="personalMessage"]').attr('id'), - self = this; - - $('input[name="decision"]').each(function() { - if ($(this).attr('id') === 'decisionRevisions' && - $(this).prop('checked')) { - emailContent = self.revisionsEmail_; - } else if ($(this).attr('id') === 'decisionResubmit' && - $(this).prop('checked')) { - emailContent = self.resubmitEmail_; - } - }); - - tinyMCE.get(/** @type {string} */ (textareaId)).setContent(emailContent); - - if (isEmailDivVisible) { - $emailDiv.hide().fadeIn(); - } - }; - - - /** - * Display the requested step of the form - * - * Only used on promotion forms. - * - * @param {string} step Name of the step to display - */ - $.pkp.controllers.modals.editorDecision.form.EditorDecisionFormHandler. - prototype.setStep = function(step) { - var emailStepContent = - $('#promoteForm-step1, .promoteForm-step-btn[data-step="files"]'), - filesStepContent = $('#promoteForm-step2, #promoteForm-complete-btn,' + - ' .promoteForm-step-btn[data-step="email"]'); - - if (step === 'files') { - filesStepContent.show(); - emailStepContent.hide(); - } else { - emailStepContent.show(); - filesStepContent.hide(); - } - }; - - -}(jQuery)); diff --git a/js/load.js b/js/load.js index 6638a2c0155..f7407802a9c 100644 --- a/js/load.js +++ b/js/load.js @@ -18,8 +18,12 @@ import VueScrollTo from 'vue-scrollto'; // Global components of UI Library import Badge from '@/components/Badge/Badge.vue'; import Icon from '@/components/Icon/Icon.vue'; +import Panel from '@/components/Panel/Panel.vue'; +import PanelSection from '@/components/Panel/PanelSection.vue'; import PkpButton from '@/components/Button/Button.vue'; import Spinner from '@/components/Spinner/Spinner.vue'; +import Step from '@/components/Steps/Step.vue'; +import Steps from '@/components/Steps/Steps.vue'; import Tab from '@/components/Tabs/Tab.vue'; import Tabs from '@/components/Tabs/Tabs.vue'; @@ -37,8 +41,12 @@ Vue.mixin(GlobalMixins); // Register global components Vue.component('Badge', Badge); Vue.component('Icon', Icon); +Vue.component('Panel', Panel); +Vue.component('PanelSection', PanelSection); Vue.component('PkpButton', PkpButton); Vue.component('Spinner', Spinner); +Vue.component('Step', Step); +Vue.component('Steps', Steps); Vue.component('Tab', Tab); Vue.component('Tabs', Tabs); diff --git a/lib/adodb.diff b/lib/adodb.diff new file mode 100644 index 00000000000..0330e4b76d2 --- /dev/null +++ b/lib/adodb.diff @@ -0,0 +1,6755 @@ +diff --git adodb-csvlib.inc.php adodb-csvlib.inc.php +index 65c47f43..3dd61b66 100644 +--- adodb-csvlib.inc.php ++++ adodb-csvlib.inc.php +@@ -248,7 +248,7 @@ $ADODB_INCLUDED_CSV = 1; + //var_dump($arr); + if (!is_array($arr)) { + $err = "Recordset had unexpected EOF (in serialized recordset)"; +- if (get_magic_quotes_runtime()) $err .= ". Magic Quotes Runtime should be disabled!"; ++ if (false) $err .= ". Magic Quotes Runtime should be disabled!"; + return $false; + } + $rs = new $rsclass(); +diff --git adodb-datadict.inc.php adodb-datadict.inc.php +index dd2433e9..d91e841e 100644 +--- adodb-datadict.inc.php ++++ adodb-datadict.inc.php +@@ -517,11 +517,15 @@ class ADODB_DataDict { + { + $tabname = $this->TableName ($tabname); + if ($flds) { +- list($lines,$pkey,$idxs) = $this->_GenFields($flds); ++ // Avoid use of SERIAL for existing columns, 2014-04-14 ++ // by AS ++ list($lines,$pkey,$idxs) = $this->_GenFields($flds, false, false); + // genfields can return FALSE at times + if ($lines == null) $lines = array(); + $first = current($lines); + list(,$column_def) = preg_split("/[\t ]+/",$first,2); ++ } else { ++ $column_def = ''; + } + return array(sprintf($this->renameColumn,$tabname,$this->NameQuote($oldcolumn),$this->NameQuote($newcolumn),$column_def)); + } +@@ -594,7 +598,7 @@ class ADODB_DataDict { + + + +- function _GenFields($flds,$widespacing=false) ++ function _GenFields($flds,$widespacing=false,$allowSerial=true) + { + if (is_string($flds)) { + $padding = ' '; +@@ -683,7 +687,9 @@ class ADODB_DataDict { + break; + case 'UNSIGNED': $funsigned = true; break; + case 'AUTOINCREMENT': +- case 'AUTO': $fautoinc = true; $fnotnull = true; break; ++ case 'AUTO': // Serial type (psql) not allowed in ALTER TABLE statements (2014-04-14 AS) ++ if ($allowSerial) $fautoinc = true; ++ $fnotnull = true; break; + case 'KEY': + // a primary key col can be non unique in itself (if key spans many cols...) + case 'PRIMARY': $fprimary = $v; $fnotnull = true; /*$funiqueindex = true;*/ break; +@@ -959,6 +965,8 @@ class ADODB_DataDict { + return $this->CreateTableSQL($tablename, $flds, $tableoptions); + } + ++ $tableflds = $flds; ++ /* #2343: Null / Not Null column flag changes not respected by this code. + if (is_array($flds)) { + // Cycle through the update fields, comparing + // existing fields to fields to update. +@@ -994,15 +1002,19 @@ class ADODB_DataDict { + } + } + $flds = $holdflds; +- } ++ } */ + + + // already exists, alter table instead +- list($lines,$pkey,$idxs) = $this->_GenFields($flds); ++ // (Avoid use of SERIAL when altering existing fields for psql, ++ // 2014-04-14 by AS) ++ list($lines,$pkey,$idxs) = $this->_GenFields($flds, false, false); + // genfields can return FALSE at times + if ($lines == null) $lines = array(); + $alter = 'ALTER TABLE ' . $this->TableName($tablename); + $sql = array(); ++ $addSql = array(); ++ $recreate = false; + + foreach ( $lines as $id => $v ) { + if ( isset($cols[$id]) && is_object($cols[$id]) ) { +@@ -1011,15 +1023,25 @@ class ADODB_DataDict { + + // We are trying to change the size of the field, if not allowed, simply ignore the request. + // $flds[1] holds the type, $flds[2] holds the size -postnuke addition ++/* #2343: Null / Not Null column flag changes not respected by this code. + if ($flds && in_array(strtoupper(substr($flds[0][1],0,4)),$this->invalidResizeTypes4) + && (isset($flds[0][2]) && is_numeric($flds[0][2]))) { + if ($this->debug) ADOConnection::outp(sprintf("

%s cannot be changed to %s currently

", $flds[0][0], $flds[0][1])); + #echo "

$this->alterCol cannot be changed to $flds currently

"; + continue; + } +- $sql[] = $alter . $this->alterCol . ' ' . $v; ++*/ ++ $alter = $this->AlterColumnSQL($tablename, array($id => $tableflds[$id])); ++ if (empty($alter)) { ++ $recreate = true; ++ } else { ++ $sql[] = $alter; ++ } + } else { +- $sql[] = $alter . $this->addCol . ' ' . $v; ++ $add = $this->AddColumnSQL($tablename, array($id => $tableflds[$id]));; ++ unset($tableflds[$id]); ++ $sql[] = $add; ++ $addSql[] = $add; + } + } + +@@ -1028,6 +1050,10 @@ class ADODB_DataDict { + if ( !isset($lines[$id]) ) + $sql[] = $alter . $this->dropCol . ' ' . $v->name; + } ++ if ($recreate) { ++ $sql = $this->AlterColumnSQL($tablename, false, $tableflds, $tableoptions); ++ $sql[] = $addSql; ++ } + return $sql; + } + } // class +diff --git adodb-perf.inc.php adodb-perf.inc.php +index 064613b9..c3de73c0 100644 +--- adodb-perf.inc.php ++++ adodb-perf.inc.php +@@ -696,7 +696,7 @@ Committed_AS: 348732 kB + + // magic quotes + +- if (isset($_GET['sql']) && get_magic_quotes_gpc()) { ++ if (isset($_GET['sql']) && false) { + $_GET['sql'] = $_GET['sql'] = str_replace(array("\\'",'\"'),array("'",'"'),$_GET['sql']); + } + +@@ -1002,7 +1002,7 @@ Committed_AS: 348732 kB + + function undomq($m) + { +- if (get_magic_quotes_gpc()) { ++ if (false) { + // undo the damage + $m = str_replace('\\\\','\\',$m); + $m = str_replace('\"','"',$m); +diff --git adodb-xmlschema.inc.php adodb-xmlschema.inc.php +index b53d4e28..314a3558 100644 +--- adodb-xmlschema.inc.php ++++ adodb-xmlschema.inc.php +@@ -127,7 +127,7 @@ class dbObject { + * + * @access private + */ +- function _tag_open( &$parser, $tag, $attributes ) { ++ function _tag_open( $parser, $tag, $attributes ) { + + } + +@@ -136,7 +136,7 @@ class dbObject { + * + * @access private + */ +- function _tag_cdata( &$parser, $cdata ) { ++ function _tag_cdata( $parser, $cdata ) { + + } + +@@ -145,7 +145,7 @@ class dbObject { + * + * @access private + */ +- function _tag_close( &$parser, $tag ) { ++ function _tag_close( $parser, $tag ) { + + } + +@@ -258,7 +258,7 @@ class dbTable extends dbObject { + * + * @access private + */ +- function _tag_open( &$parser, $tag, $attributes ) { ++ function _tag_open( $parser, $tag, $attributes ) { + $this->currentElement = strtoupper( $tag ); + + switch( $this->currentElement ) { +@@ -317,7 +317,7 @@ class dbTable extends dbObject { + * + * @access private + */ +- function _tag_cdata( &$parser, $cdata ) { ++ function _tag_cdata( $parser, $cdata ) { + switch( $this->currentElement ) { + // Table constraint + case 'CONSTRAINT': +@@ -341,7 +341,7 @@ class dbTable extends dbObject { + * + * @access private + */ +- function _tag_close( &$parser, $tag ) { ++ function _tag_close( $parser, $tag ) { + $this->currentElement = ''; + + switch( strtoupper( $tag ) ) { +@@ -657,7 +657,7 @@ class dbIndex extends dbObject { + * + * @access private + */ +- function _tag_open( &$parser, $tag, $attributes ) { ++ function _tag_open( $parser, $tag, $attributes ) { + $this->currentElement = strtoupper( $tag ); + + switch( $this->currentElement ) { +@@ -684,7 +684,7 @@ class dbIndex extends dbObject { + * + * @access private + */ +- function _tag_cdata( &$parser, $cdata ) { ++ function _tag_cdata( $parser, $cdata ) { + switch( $this->currentElement ) { + // Index field name + case 'COL': +@@ -700,7 +700,7 @@ class dbIndex extends dbObject { + * + * @access private + */ +- function _tag_close( &$parser, $tag ) { ++ function _tag_close( $parser, $tag ) { + $this->currentElement = ''; + + switch( strtoupper( $tag ) ) { +@@ -799,7 +799,7 @@ class dbData extends dbObject { + * + * @access private + */ +- function _tag_open( &$parser, $tag, $attributes ) { ++ function _tag_open( $parser, $tag, $attributes ) { + $this->currentElement = strtoupper( $tag ); + + switch( $this->currentElement ) { +@@ -821,7 +821,7 @@ class dbData extends dbObject { + * + * @access private + */ +- function _tag_cdata( &$parser, $cdata ) { ++ function _tag_cdata( $parser, $cdata ) { + switch( $this->currentElement ) { + // Index field name + case 'F': +@@ -837,7 +837,7 @@ class dbData extends dbObject { + * + * @access private + */ +- function _tag_close( &$parser, $tag ) { ++ function _tag_close( $parser, $tag ) { + $this->currentElement = ''; + + switch( strtoupper( $tag ) ) { +@@ -1016,7 +1016,7 @@ class dbQuerySet extends dbObject { + * + * @access private + */ +- function _tag_open( &$parser, $tag, $attributes ) { ++ function _tag_open( $parser, $tag, $attributes ) { + $this->currentElement = strtoupper( $tag ); + + switch( $this->currentElement ) { +@@ -1038,7 +1038,7 @@ class dbQuerySet extends dbObject { + /** + * XML Callback to process CDATA elements + */ +- function _tag_cdata( &$parser, $cdata ) { ++ function _tag_cdata( $parser, $cdata ) { + switch( $this->currentElement ) { + // Line of queryset SQL data + case 'QUERY': +@@ -1054,7 +1054,7 @@ class dbQuerySet extends dbObject { + * + * @access private + */ +- function _tag_close( &$parser, $tag ) { ++ function _tag_close( $parser, $tag ) { + $this->currentElement = ''; + + switch( strtoupper( $tag ) ) { +@@ -1304,9 +1304,9 @@ class adoSchema { + */ + function __construct( $db ) { + // Initialize the environment +- $this->mgq = get_magic_quotes_runtime(); ++ $this->mgq = false; + if ($this->mgq !== false) { +- ini_set('magic_quotes_runtime', 0); ++ // ini_set('magic_quotes_runtime', 0); + } + + $this->db = $db; +@@ -1649,7 +1649,7 @@ class adoSchema { + * + * @access private + */ +- function _tag_open( &$parser, $tag, $attributes ) { ++ function _tag_open( $parser, $tag, $attributes ) { + switch( strtoupper( $tag ) ) { + case 'TABLE': + $this->obj = new dbTable( $this, $attributes ); +@@ -1672,7 +1672,7 @@ class adoSchema { + * + * @access private + */ +- function _tag_cdata( &$parser, $cdata ) { ++ function _tag_cdata( $parser, $cdata ) { + } + + /** +@@ -1681,7 +1681,7 @@ class adoSchema { + * @access private + * @internal + */ +- function _tag_close( &$parser, $tag ) { ++ function _tag_close( $parser, $tag ) { + + } + +@@ -2197,7 +2197,7 @@ class adoSchema { + */ + function Destroy() { + if ($this->mgq !== false) { +- ini_set('magic_quotes_runtime', $this->mgq ); ++ // ini_set('magic_quotes_runtime', $this->mgq ); + } + } + } +diff --git adodb-xmlschema03.inc.php adodb-xmlschema03.inc.php +index 4d1faad3..8a24339f 100644 +--- adodb-xmlschema03.inc.php ++++ adodb-xmlschema03.inc.php +@@ -1408,9 +1408,9 @@ class adoSchema { + */ + function __construct( $db ) { + // Initialize the environment +- $this->mgq = get_magic_quotes_runtime(); ++ $this->mgq = false; + if ($this->mgq !== false) { +- ini_set('magic_quotes_runtime', 0 ); ++ // ini_set('magic_quotes_runtime', 0 ); + } + + $this->db = $db; +@@ -2379,7 +2379,7 @@ class adoSchema { + */ + function Destroy() { + if ($this->mgq !== false) { +- ini_set('magic_quotes_runtime', $this->mgq ); ++ // ini_set('magic_quotes_runtime', $this->mgq ); + } + } + } +diff --git adodb.inc.php adodb.inc.php +index 8a969b99..5936fcd0 100644 +--- adodb.inc.php ++++ adodb.inc.php +@@ -862,7 +862,7 @@ if (!defined('_ADODB_LAYER')) { + * Requested by "Karsten Dambekalns" + */ + function QMagic($s) { +- return $this->qstr($s,get_magic_quotes_gpc()); ++ return $this->qstr($s,false); + } + + function q(&$s) { +@@ -2064,7 +2064,7 @@ if (!defined('_ADODB_LAYER')) { + if (!$rs) { + // no cached rs found + if ($this->debug) { +- if (get_magic_quotes_runtime() && !$this->memCache) { ++ if (false && !$this->memCache) { + ADOConnection::outp("Please disable magic_quotes_runtime - it corrupts cache files :("); + } + if ($this->debug !== -1) { +@@ -2956,7 +2956,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 + // undo magic quotes for " + $s = str_replace('\\"','"',$s); + +- if ($this->replaceQuote == "\\'" || ini_get('magic_quotes_sybase')) { ++ if ($this->replaceQuote == "\\'") { + // ' already quoted, no need to change anything + return $s; + } else { +@@ -2990,7 +2990,7 @@ http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/statements_1 + // undo magic quotes for " + $s = str_replace('\\"','"',$s); + +- if ($this->replaceQuote == "\\'" || ini_get('magic_quotes_sybase')) { ++ if ($this->replaceQuote == "\\'") { + // ' already quoted, no need to change anything + return "'$s'"; + } else { +diff --git datadict/datadict-postgres.inc.php datadict/datadict-postgres.inc.php +index 376da9a6..4711e71c 100644 +--- datadict/datadict-postgres.inc.php ++++ datadict/datadict-postgres.inc.php +@@ -148,6 +148,9 @@ class ADODB2_postgres extends ADODB_DataDict { + $sql[] = $alter . $v; + } + if ($not_null) { ++ if (isset($default)) { ++ $sql[] = 'UPDATE '.$tabname.' SET '.$colname.' = '.$this->connection->quote($default).' WHERE '.$colname.' IS NULL'; ++ } + list($colname) = explode(' ',$v); + $sql[] = 'ALTER TABLE '.$tabname.' ALTER COLUMN '.$colname.' SET NOT NULL'; + } +@@ -190,7 +193,9 @@ class ADODB2_postgres extends ADODB_DataDict { + if ($has_alter_column) { + $tabname = $this->TableName($tabname); + $sql = array(); +- list($lines,$pkey) = $this->_GenFields($flds); ++ // Avoid use of SERIAL when altering an existing column ++ // 2014-04-14 by AS ++ list($lines,$pkey) = $this->_GenFields($flds, false, false); + $set_null = false; + foreach($lines as $v) { + $alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' '; +@@ -311,37 +316,45 @@ class ADODB2_postgres extends ADODB_DataDict { + { + if ($dropflds && !is_array($dropflds)) $dropflds = explode(',',$dropflds); + $copyflds = array(); ++ $insertflds = array(); + foreach($this->MetaColumns($tabname) as $fld) { +- if (!$dropflds || !in_array($fld->name,$dropflds)) { ++ if ((!$dropflds || !in_array($fld->name,$dropflds)) && isset($tableflds[strtoupper($fld->name)])) { + // we need to explicit convert varchar to a number to be able to do an AlterColumn of a char column to a nummeric one +- if (preg_match('/'.$fld->name.' (I|I2|I4|I8|N|F)/i',$tableflds,$matches) && ++ if (((is_array($tableflds) ++ && in_array($tableflds[strtoupper($fld->name)]['TYPE'], array('I', 'I2', 'I4', 'I8', 'N', 'F'))) ++ || (!is_array($tableflds) ++ && preg_match('/'.$fld->name.' (I|I2|I4|I8|N|F)/i',$tableflds,$matches))) && + in_array($fld->type,array('varchar','char','text','bytea'))) { + $copyflds[] = "to_number($fld->name,'S9999999999999D99')"; + } else { + $copyflds[] = $fld->name; + } ++ $insertflds[] = $fld->name; + // identify the sequence name and the fld its on +- if ($fld->primary_key && $fld->has_default && +- preg_match("/nextval\('([^']+)'::text\)/",$fld->default_value,$matches)) { ++ if (isset($fld->primary_key) && $fld->primary_key && $fld->has_default && ++ preg_match("/nextval\('(?:[^']+\.)*([^']+)'::(text|regclass)\)/",$fld->default_value,$matches)) { + $seq_name = $matches[1]; + $seq_fld = $fld->name; + } + } + } + $copyflds = implode(', ',$copyflds); ++ $insertflds = implode(', ',$insertflds); + + $tempname = $tabname.'_tmp'; + $aSql[] = 'BEGIN'; // we use a transaction, to make sure not to loose the content of the table + $aSql[] = "SELECT * INTO TEMPORARY TABLE $tempname FROM $tabname"; + $aSql = array_merge($aSql,$this->DropTableSQL($tabname)); + $aSql = array_merge($aSql,$this->CreateTableSQL($tabname,$tableflds,$tableoptions)); +- $aSql[] = "INSERT INTO $tabname SELECT $copyflds FROM $tempname"; +- if ($seq_name && $seq_fld) { // if we have a sequence we need to set it again +- $seq_name = $tabname.'_'.$seq_fld.'_seq'; // has to be the name of the new implicit sequence ++ $aSql[] = "INSERT INTO $tabname ($insertflds) SELECT $copyflds FROM $tempname"; ++ if (isset($seq_name) && $seq_name && $seq_fld) { // if we have a sequence we need to set it again ++ // $seq_name = $tabname.'_'.$seq_fld.'_seq'; // has to be the name of the new implicit sequence ++ $seq_name = $this->makeObjectName($tabname, $seq_fld, 'seq'); + $aSql[] = "SELECT setval('$seq_name',MAX($seq_fld)) FROM $tabname"; + } + $aSql[] = "DROP TABLE $tempname"; + // recreate the indexes, if they not contain one of the droped columns ++ /* FIXME 2005-08-01 KJ - Temporarily disabled for XML schema upgrades + foreach($this->MetaIndexes($tabname) as $idx_name => $idx_data) + { + if (substr($idx_name,-5) != '_pkey' && (!$dropflds || !count(array_intersect($dropflds,$idx_data['columns'])))) { +@@ -349,10 +362,87 @@ class ADODB2_postgres extends ADODB_DataDict { + $idx_data['unique'] ? array('UNIQUE') : False)); + } + } ++ */ + $aSql[] = 'COMMIT'; + return $aSql; + } + ++ /* --- Added by Alec 2005-09-14: ++ In PostgreSQL <7.3, SERIAL columns can't be used because they ++ impose UNIQUE constraints on the column. In the best case (when ++ we want a UNIQUE constraint), this means that the index is ++ created twice -- once by ADODB, once by PostgreSQL -- and in ++ the worst case, an unwanted UNIQUE condition is imposed. ++ ++ The makeObjectName function was ported from PostgreSQL 7.1's ++ analyse.c. ++ --- */ ++ ++ function makeObjectName($name1, $name2, $typename) { ++ $overhead = 0; ++ ++ $name1chars = strlen($name1); ++ if ($name2) { ++ $name2chars = strlen($name2); ++ $overhead++; /* allow for separating underscore */ ++ } ++ else $name2chars = 0; ++ ++ if ($typename) $overhead += strlen($typename) + 1; ++ ++ $availchars = 64 - 1 - $overhead; /* --- 32 = default NAMEDATALEN in PostgreSQL --- */ ++ ++ /* ++ * If we must truncate, preferentially truncate the longer name. This ++ * logic could be expressed without a loop, but it's simple and ++ * obvious as a loop. ++ */ ++ while ($name1chars + $name2chars > $availchars) { ++ if ($name1chars > $name2chars) $name1chars--; ++ else $name2chars--; ++ } ++ ++ /* Now construct the string using the chosen lengths */ ++ $name = substr($name1, 0, $name1chars); ++ ++ if ($name2) $name .= '_' . substr($name2, 0, $name2chars); ++ if ($typename) $name .= '_' . $typename; ++ ++ return $name; ++ } ++ ++ function CreateTableSQL($tabname, $flds, $tableoptions=false) { ++ $sql = ADODB_DataDict::CreateTableSQL($tabname, $flds, $tableoptions); ++ ++ if (7.3 > (float) @$this->serverInfo['version']) { ++ foreach ($flds as $fld) { ++ $fld = _array_change_key_case($fld); ++ ++ $isAutoInc = false; ++ foreach($fld as $attr => $v) switch ($attr) { ++ case 'AUTOINCREMENT': ++ case 'AUTO': ++ $isAutoInc = true; ++ break; ++ case 'NAME': ++ $fname = $v; ++ break; ++ } ++ ++ if (isset($fname) && $isAutoInc) { ++ // This field is an AUTOINCREMENT. Create a sequence ++ // for it. ++ $sequenceName = $this->makeObjectName($tabname, $fname, 'seq'); ++ array_unshift($sql, "CREATE SEQUENCE $sequenceName"); ++ array_push($sql, "ALTER TABLE $tabname ALTER COLUMN $fname SET DEFAULT nextval('$sequenceName')"); ++ } ++ } ++ } ++ return $sql; ++ } ++ ++ /* --- End additions by Alec --- */ ++ + function DropTableSQL($tabname) + { + $sql = ADODB_DataDict::DropTableSQL($tabname); +@@ -367,6 +457,19 @@ class ADODB2_postgres extends ADODB_DataDict { + function _CreateSuffix($fname, &$ftype, $fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned) + { + if ($fautoinc) { ++ // Added by Alec 2005-09-14: With PostgreSQL < 7.3, we cannot ++ // use the SERIAL type because it forces the use of a unique ++ // index on that column; at best, this causes duplicate indexes ++ // to be created. At worst, it causes UNIQUE constraints to be ++ // put on columns that shouldn't have them. ++ ++ if (7.3 > (float) @$this->serverInfo['version']) { ++ $ftype = 'INTEGER'; ++ return ''; ++ } ++ ++ // --- ++ + $ftype = 'SERIAL'; + return ''; + } +@@ -382,15 +485,22 @@ class ADODB2_postgres extends ADODB_DataDict { + // this is still necessary if postgres < 7.3 or the SERIAL was created on an earlier version!!! + function _DropAutoIncrement($tabname) + { +- $tabname = $this->connection->quote('%'.$tabname.'%'); ++ // FIXME This Code ++ $seq = false; ++ foreach($this->MetaColumns($tabname) as $fld) { ++ if (isset($fld->primary_key) && $fld->primary_key && $fld->has_default && ++ preg_match("/nextval\('[\"]?(?:[^'\"]+\.)*([^'\"]+)[\"]?'::(?:text|regclass)\)/",$fld->default_value,$matches)) { ++ $seq = $matches[1]; ++ } ++ } + +- $seq = $this->connection->GetOne("SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relname LIKE $tabname AND relkind='S'"); ++ //$seq = $this->connection->GetOne("SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relname LIKE $tabname AND relkind='S'"); + + // check if a tables depends on the sequenz and it therefor cant and dont need to be droped separatly + if (!$seq || $this->connection->GetOne("SELECT relname FROM pg_class JOIN pg_depend ON pg_class.relfilenode=pg_depend.objid WHERE relname='$seq' AND relkind='S' AND deptype='i'")) { + return False; + } +- return "DROP SEQUENCE ".$seq; ++ return "DROP SEQUENCE IF EXISTS ".$seq; + } + + function RenameTableSQL($tabname,$newname) +diff --git drivers/adodb-postgres64.inc.php drivers/adodb-postgres64.inc.php +index b555fd55..de28d90e 100644 +--- drivers/adodb-postgres64.inc.php ++++ drivers/adodb-postgres64.inc.php +@@ -96,8 +96,8 @@ class ADODB_postgres64 extends ADOConnection{ + var $hasAffectedRows = true; + var $hasLimit = false; // set to true for pgsql 7 only. support pgsql/mysql SELECT * FROM TABLE LIMIT 10 + // below suggested by Freek Dijkstra +- var $true = 'TRUE'; // string that represents TRUE for a database +- var $false = 'FALSE'; // string that represents FALSE for a database ++ var $true = '1'; // string that represents TRUE for a database ++ var $false = '0'; // string that represents FALSE for a database + var $fmtDate = "'Y-m-d'"; // used by DBDate() as the default date format used by the database + var $fmtTimeStamp = "'Y-m-d H:i:s'"; // used by DBTimeStamp as the default timestamp fmt. + var $hasMoveFirst = true; +@@ -144,30 +144,43 @@ class ADODB_postgres64 extends ADOConnection{ + return " coalesce($field, $ifNull) "; + } + +- // get the last id - never tested +- function pg_insert_id($tablename,$fieldname) +- { +- $result=pg_query($this->_connectionID, 'SELECT last_value FROM '. $tablename .'_'. $fieldname .'_seq'); +- if ($result) { +- $arr = @pg_fetch_row($result,0); +- pg_free_result($result); +- if (isset($arr[0])) return $arr[0]; +- } +- return false; +- } +- + /** +- * Warning from http://www.php.net/manual/function.pg-getlastoid.php: +- * Using a OID as a unique identifier is not generally wise. +- * Unless you are very careful, you might end up with a tuple having +- * a different OID if a database must be reloaded. ++ * Get the last inserted ID for the specified table and column. ++ * @param $table string Optional table name ++ * @param $id string Optional column name + */ +- function _insertid($table,$column) +- { +- if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false; +- $oid = pg_getlastoid($this->_resultid); +- // to really return the id, we need the table and column-name, else we can only return the oid != id +- return empty($table) || empty($column) ? $oid : $this->GetOne("SELECT $column FROM $table WHERE oid=".(int)$oid); ++ function _insertid($table,$column) { ++ // If no table is specified, we can use LASTVAL() ++ if ($table === '') { ++ $result = pg_exec('SELECT LASTVAL()'); ++ $row = pg_fetch_row($result, 0); ++ return $row[0]; ++ } ++ ++ // If this is PostgreSQL >= 8.0 and a column is specified, use pg_get_serial_sequence ++ $info = $this->ServerInfo(); ++ if ($column !== '' && $info['version'] >= 8.0) { ++ $result = pg_exec("SELECT CURRVAL(pg_get_serial_sequence('$table', '$column'))"); ++ $row = pg_fetch_row($result, 0); ++ return $row[0]; ++ } ++ ++ // Try to identify the sequence name from the column descriptions ++ foreach($this->MetaColumns($table) as $fld) { ++ if ( ++ isset($fld->primary_key) && $fld->primary_key && $fld->has_default && ++ preg_match("/nextval\('(?:[^']+\.)*([^']+)'::(text|regclass)\)/",$fld->default_value,$matches) && ++ ($fld->name == $column || $column == '') // Field matches specified value or none given ++ ) { ++ $result = pg_exec('SELECT CURRVAL(\'' . $matches[1] . '\')'); ++ $row = pg_fetch_row($result, 0); ++assert($row[0] != 0); ++ return $row[0]; ++ } ++ } ++ ++ // Unable to identify sequence to use. ++ assert(false); + } + + function _affectedrows() +@@ -564,6 +577,9 @@ class ADODB_postgres64 extends ADOConnection{ + $fld->name = $rs->fields[0]; + $fld->type = $rs->fields[1]; + $fld->max_length = $rs->fields[2]; ++ $fld->primary_key = false; ++ $fld->auto_increment = false; ++ $fld->scale = null; + $fld->attnum = $rs->fields[6]; + + if ($fld->max_length <= 0) $fld->max_length = $rs->fields[3]-4; +@@ -1049,6 +1065,7 @@ class ADORecordSet_postgres64 extends ADORecordSet{ + + function _close() + { ++ if (!is_resource($this->_queryID)) return true; + return @pg_free_result($this->_queryID); + } + +diff --git scripts/.gitignore scripts/.gitignore +deleted file mode 100644 +index 3e0e62b2..00000000 +--- scripts/.gitignore ++++ /dev/null +@@ -1,2 +0,0 @@ +-# Python byte code +-*.pyc +diff --git scripts/TARADO5.BAT scripts/TARADO5.BAT +deleted file mode 100644 +index bf25ef99..00000000 +--- scripts/TARADO5.BAT ++++ /dev/null +@@ -1,49 +0,0 @@ +-@rem REQUIRES P:\INSTALLS\CMDUTILS +- +-echo Don't forget to strip LF's !!!!!!!!!!! +-pause +- +- +-set VER=518a +- +-d: +-cd \inetpub\wwwroot\php +- +-@del /s /q zadodb\*.* +-@mkdir zadodb +- +-@REM not for release -- make sure in VSS +-attrib -r adodb5\drivers\adodb-text.inc.php +-del adodb5\*.bak +-del adodb5\drivers\*.bak +-del adodb5\hs~*.* +-del adodb5\drivers\hs~*.* +-del adodb5\tests\hs~*.* +-del adodb5\drivers\adodb-text.inc.php +-del adodb5\.#* +-del adodb5\replicate\replicate-steps.php +-del adodb5\replicate\test*.php +-del adodb5\adodb-lite.inc.php +-attrib -r adodb5\*.php +-del adodb5\cute_icons_for_site\*.png +- +-del tmp.tar +-del adodb5*.tgz +-del adodb5*.zip +- +-@mkdir adodb5\docs +-move /y adodb5\*.htm adodb5\docs +- +-@rem CREATE TAR FILE +-tar -f adodb%VER%.tar -c adodb5/*.* adodb5/perf/*.* adodb5/session/*.* adodb5/pear/*.txt adodb5/pear/Auth/Container/ADOdb.php adodb5/session/old/*.* adodb5/drivers/*.* adodb5/lang/*.* adodb5/tests/*.* adodb5/cute_icons_for_site/*.* adodb5/datadict/*.* adodb5/contrib/*.* adodb5/xsl/*.* adodb5/docs/*.* +- +-@rem CREATE ZIP FILE +-cd zadodb +-tar -xf ..\adodb%VER%.TAR +-zip -r ..\adodb%VER%.zip adodb5 +-cd .. +- +-@rem CREATE TGZ FILE, THE RENAME CHANGES UPPERCASE TO LOWERCASE +-gzip -v ADODB%VER%.tar -S .tgz -9 +-rename ADODB%VER%.tar.TGZ adodb%VER%.tgz +- +diff --git scripts/buildrelease.py scripts/buildrelease.py +deleted file mode 100755 +index 0b37b97b..00000000 +--- scripts/buildrelease.py ++++ /dev/null +@@ -1,270 +0,0 @@ +-#!/usr/bin/python -u +-''' +- ADOdb release build script +- +- - Create release tag if it does not exist +- - Copy release files to target directory +- - Generate zip/tar balls +- - +-''' +- +-import errno +-import getopt +-import re +-import os +-from os import path +-import shutil +-import subprocess +-import sys +-import tempfile +- +-import updateversion +- +- +-# ADOdb Repository reference +-origin_repo = "https://github.com/ADOdb/ADOdb.git" +-release_branch = "master" +-release_prefix = "adodb" +- +-# Directories and files to exclude from release tarballs +-exclude_list = (".git*", +- "replicate", +- "scripts", +- "tests", +- # There are no png files in there... +- # "cute_icons_for_site/*.png", +- "hs~*.*", +- "adodb-text.inc.php", +- # This file does not exist in current repo +- # 'adodb-lite.inc.php' +- ) +- +-# Command-line options +-options = "hb:dfk" +-long_options = ["help", "branch", "debug", "fresh", "keep"] +- +-# Global flags +-debug_mode = False +-fresh_clone = False +-cleanup = True +- +- +-def usage(): +- print '''Usage: %s [options] version release_path +- +- Parameters: +- version ADOdb version to bundle (e.g. v5.19) +- release_path Where to save the release tarballs +- +- Options: +- -h | --help Show this usage message +- +- -b | --branch Use specified branch (defaults to '%s' for '.0' +- releases, or 'hotfix/' for patches) +- -d | --debug Debug mode (ignores upstream: no fetch, allows +- build even if local branch is not in sync) +- -f | --fresh Create a fresh clone of the repository +- -k | --keep Keep build directories after completion +- (useful for debugging) +-''' % ( +- path.basename(__file__), +- release_branch +- ) +-#end usage() +- +- +-def set_version_and_tag(version): +- ''' +- ''' +- global release_branch, debug_mode, fresh_clone, cleanup +- +- # Delete existing tag to force creation in debug mode +- if debug_mode: +- try: +- updateversion.tag_delete(version) +- except: +- pass +- +- # Checkout release branch +- subprocess.call("git checkout %s" % release_branch, shell=True) +- +- if not debug_mode: +- # Make sure we're up-to-date, ignore untracked files +- ret = subprocess.check_output( +- "git status --branch --porcelain --untracked-files=no", +- shell=True +- ) +- if not re.search(release_branch + "$", ret): +- print "\nERROR: branch must be aligned with upstream" +- sys.exit(4) +- +- # Update the code, create commit and tag +- updateversion.version_set(version) +- +- # Make sure we don't delete the modified repo +- if fresh_clone: +- cleanup = False +- +- +-def main(): +- global release_branch, debug_mode, fresh_clone, cleanup +- +- # Get command-line options +- try: +- opts, args = getopt.gnu_getopt(sys.argv[1:], options, long_options) +- except getopt.GetoptError, err: +- print str(err) +- usage() +- sys.exit(2) +- +- if len(args) < 2: +- usage() +- print "ERROR: please specify the version and release_path" +- sys.exit(1) +- +- for opt, val in opts: +- if opt in ("-h", "--help"): +- usage() +- sys.exit(0) +- +- elif opt in ("-b", "--branch"): +- release_branch = val +- +- elif opt in ("-d", "--debug"): +- debug_mode = True +- +- elif opt in ("-f", "--fresh"): +- fresh_clone = True +- +- elif opt in ("-k", "--keep"): +- cleanup = False +- +- # Mandatory parameters +- version = updateversion.version_check(args[0]) +- release_path = args[1] +- +- # Default release branch +- if updateversion.version_is_patch(version): +- release_branch = 'hotfix/' + version +- +- # ------------------------------------------------------------------------- +- # Start the build +- # +- global release_prefix +- +- print "Building ADOdb release %s into '%s'\n" % ( +- version, +- release_path +- ) +- +- if debug_mode: +- print "DEBUG MODE: ignoring upstream repository status" +- +- if fresh_clone: +- # Create a new repo clone +- print "Cloning a new repository" +- repo_path = tempfile.mkdtemp(prefix=release_prefix + "-", +- suffix=".git") +- subprocess.call( +- "git clone %s %s" % (origin_repo, repo_path), +- shell=True +- ) +- os.chdir(repo_path) +- else: +- repo_path = subprocess.check_output('git root', shell=True).rstrip() +- os.chdir(repo_path) +- +- # Check for any uncommitted changes +- try: +- subprocess.check_output( +- "git diff --exit-code && " +- "git diff --cached --exit-code", +- shell=True +- ) +- except: +- print "ERROR: there are uncommitted changes in the repository" +- sys.exit(3) +- +- # Update the repository +- if not debug_mode: +- print "Updating repository in '%s'" % os.getcwd() +- try: +- subprocess.check_output("git fetch", shell=True) +- except: +- print "ERROR: unable to fetch\n" +- sys.exit(3) +- +- # Check existence of Tag for version in repo, create if not found +- try: +- updateversion.tag_check(version) +- if debug_mode: +- set_version_and_tag(version) +- except: +- set_version_and_tag(version) +- +- # Copy files to release dir +- release_files = release_prefix + version.split(".")[0] +- release_tmp_dir = path.join(release_path, release_files) +- print "Copying release files to '%s'" % release_tmp_dir +- retry = True +- while True: +- try: +- shutil.copytree( +- repo_path, +- release_tmp_dir, +- ignore=shutil.ignore_patterns(*exclude_list) +- ) +- break +- except OSError, err: +- # First try and file exists, try to delete dir +- if retry and err.errno == errno.EEXIST: +- print "WARNING: Directory '%s' exists, delete it and retry" % ( +- release_tmp_dir +- ) +- shutil.rmtree(release_tmp_dir) +- retry = False +- continue +- else: +- # We already tried to delete or some other error occured +- raise +- +- # Create tarballs +- print "Creating release tarballs..." +- release_name = release_prefix + '-' + version +- print release_prefix, version, release_name +- +- os.chdir(release_path) +- print "- tar" +- subprocess.call( +- "tar -czf %s.tar.gz %s" % (release_name, release_files), +- shell=True +- ) +- print "- zip" +- subprocess.call( +- "zip -rq %s.zip %s" % (release_name, release_files), +- shell=True +- ) +- +- if cleanup: +- print "Deleting working directories" +- shutil.rmtree(release_tmp_dir) +- if fresh_clone: +- shutil.rmtree(repo_path) +- else: +- print "\nThe following working directories were kept:" +- if fresh_clone: +- print "- '%s' (repo clone)" % repo_path +- print "- '%s' (release temp dir)" % release_tmp_dir +- print "Delete them manually when they are no longer needed." +- +- # Done +- print "\nADOdb release %s build complete, files saved in '%s'." % ( +- version, +- release_path +- ) +- print "Don't forget to generate a README file with the changelog" +- +-#end main() +- +-if __name__ == "__main__": +- main() +diff --git scripts/updateversion.py scripts/updateversion.py +deleted file mode 100755 +index 0c39fd53..00000000 +--- scripts/updateversion.py ++++ /dev/null +@@ -1,399 +0,0 @@ +-#!/usr/bin/python -u +-''' +- ADOdb version update script +- +- Updates the version number, and release date in all php and html files +-''' +- +-from datetime import date +-import getopt +-import os +-from os import path +-import re +-import subprocess +-import sys +- +- +-# ADOdb version validation regex +-# These are used by sed - they are not PCRE ! +-_version_dev = "dev" +-_version_regex = "[Vv]?([0-9]\.[0-9]+)(\.([0-9]+))?(-?%s)?" % _version_dev +-_release_date_regex = "[0-9?]+-.*-[0-9]+" +-_changelog_file = "docs/changelog.md" +- +-_tag_prefix = "v" +- +- +-# Command-line options +-options = "hct" +-long_options = ["help", "commit", "tag"] +- +- +-def usage(): +- print '''Usage: %s version +- +- Parameters: +- version ADOdb version, format: [v]X.YY[a-z|dev] +- +- Options: +- -c | --commit Automatically commit the changes +- -t | --tag Create a tag for the new release +- -h | --help Show this usage message +-''' % ( +- path.basename(__file__) +- ) +-#end usage() +- +- +-def version_is_dev(version): +- ''' Returns true if version is a development release +- ''' +- return version.endswith(_version_dev) +- +- +-def version_is_patch(version): +- ''' Returns true if version is a patch release (i.e. X.Y.Z with Z > 0) +- ''' +- return not version.endswith('.0') +- +- +-def version_parse(version): +- ''' Breakdown the version into groups (Z and -dev are optional) +- 1:(X.Y), 2:(.Z), 3:(Z), 4:(-dev) +- ''' +- return re.match(r'^%s$' % _version_regex, version) +- +- +-def version_check(version): +- ''' Checks that the given version is valid, exits with error if not. +- Returns the SemVer-normalized version without the "v" prefix +- - add '.0' if missing patch bit +- - add '-' before dev release suffix if needed +- ''' +- vparse = version_parse(version) +- if not vparse: +- usage() +- print "ERROR: invalid version ! \n" +- sys.exit(1) +- +- vnorm = vparse.group(1) +- +- # Add .patch version component +- if vparse.group(2): +- vnorm += vparse.group(2) +- else: +- # None was specified, assume a .0 release +- vnorm += '.0' +- +- # Normalize version number +- if version_is_dev(version): +- vnorm += '-' + _version_dev +- +- return vnorm +- +- +-def get_release_date(version): +- ''' Returns the release date in DD-MMM-YYYY format +- For development releases, DD-MMM will be ??-??? +- ''' +- # Development release +- if version_is_dev(version): +- date_format = "??-???-%Y" +- else: +- date_format = "%d-%b-%Y" +- +- # Define release date +- return date.today().strftime(date_format) +- +- +-def sed_script(version): +- ''' Builds sed script to update version information in source files +- ''' +- +- # Version number and release date +- script = r"s/{}\s+(-?)\s+{}/v{} \5 {}/".format( +- _version_regex, +- _release_date_regex, +- version, +- get_release_date(version) +- ) +- +- return script +- +- +-def sed_filelist(): +- ''' Build list of files to update +- ''' +- dirlist = [] +- for root, dirs, files in os.walk(".", topdown=True): +- # Filter files by extensions +- files = [ +- f for f in files +- if re.search(r'\.(php|html?)$', f, re.IGNORECASE) +- ] +- for fname in files: +- dirlist.append(path.join(root, fname)) +- +- return dirlist +- +- +-def tag_name(version): +- return _tag_prefix + version +- +- +-def tag_check(version): +- ''' Checks if the tag for the specified version exists in the repository +- by attempting to check it out +- Throws exception if not +- ''' +- subprocess.check_call( +- "git checkout --quiet " + tag_name(version), +- stderr=subprocess.PIPE, +- shell=True) +- print "Tag '%s' already exists" % tag_name(version) +- +- +-def tag_delete(version): +- ''' Deletes the specified tag +- ''' +- subprocess.check_call( +- "git tag --delete " + tag_name(version), +- stderr=subprocess.PIPE, +- shell=True) +- +- +-def tag_create(version): +- ''' Creates the tag for the specified version +- Returns True if tag created +- ''' +- print "Creating release tag '%s'" % tag_name(version) +- result = subprocess.call( +- "git tag --sign --message '%s' %s" % ( +- "ADOdb version %s released %s" % ( +- version, +- get_release_date(version) +- ), +- tag_name(version) +- ), +- shell=True +- ) +- return result == 0 +- +- +-def section_exists(filename, version, print_message=True): +- ''' Checks given file for existing section with specified version +- ''' +- script = True +- for i, line in enumerate(open(filename)): +- if re.search(r'^## ' + version, line): +- if print_message: +- print " Existing section for v%s found," % version, +- return True +- return False +- +- +-def version_get_previous(version): +- ''' Returns the previous version number +- Don't decrease major versions (raises exception) +- ''' +- vprev = version.split('.') +- item = len(vprev) - 1 +- +- while item > 0: +- val = int(vprev[item]) +- if val > 0: +- vprev[item] = str(val - 1) +- break +- else: +- item -= 1 +- +- if item == 0: +- raise ValueError('Refusing to decrease major version number') +- +- return '.'.join(vprev) +- +- +-def update_changelog(version): +- ''' Updates the release date in the Change Log +- ''' +- print "Updating Changelog" +- +- vparse = version_parse(version) +- +- # Version number without '-dev' suffix +- version_release = vparse.group(1) + vparse.group(2) +- version_previous = version_get_previous(version_release) +- +- if not section_exists(_changelog_file, version_previous, False): +- raise ValueError( +- "ERROR: previous version %s does not exist in changelog" % +- version_previous +- ) +- +- # Check if version already exists in changelog +- version_exists = section_exists(_changelog_file, version_release) +- if (not version_exists +- and not version_is_patch(version) +- and not version_is_dev(version)): +- version += '-' + _version_dev +- +- release_date = get_release_date(version) +- +- # Development release +- # Insert a new section for next release before the most recent one +- if version_is_dev(version): +- # Check changelog file for existing section +- if version_exists: +- print "nothing to do" +- return +- +- # No existing section found, insert new one +- if version_is_patch(version_release): +- print " Inserting new section for hotfix release v%s" % version +- else: +- print " Inserting new section for v%s" % version_release +- # Adjust previous version number (remove patch component) +- version_previous = version_parse(version_previous).group(1) +- script = "1,/^## {0}/s/^## {0}.*$/## {1} - {2}\\n\\n\\0/".format( +- version_previous, +- version_release, +- release_date +- ) +- +- # Stable release (X.Y.0) +- # Replace the 1st occurence of markdown level 2 header matching version +- # and release date patterns +- elif not version_is_patch(version): +- print " Updating release date for v%s" % version +- script = r"s/^(## ){0}(\.0)? - {1}.*$/\1{2} - {3}/".format( +- vparse.group(1), +- _release_date_regex, +- version, +- release_date +- ) +- +- # Hotfix release (X.Y.[0-9]) +- # Insert a new section for the hotfix release before the most recent +- # section for version X.Y and display a warning message +- else: +- if version_exists: +- print 'updating release date' +- script = "s/^## {0}.*$/## {1} - {2}/".format( +- version.replace('.', '\.'), +- version, +- release_date +- ) +- else: +- print " Inserting new section for hotfix release v%s" % version +- script = "1,/^## {0}/s/^## {0}.*$/## {1} - {2}\\n\\n\\0/".format( +- version_previous, +- version, +- release_date +- ) +- +- print " WARNING: review '%s' to ensure added section is correct" % ( +- _changelog_file +- ) +- +- subprocess.call( +- "sed -r -i '%s' %s " % ( +- script, +- _changelog_file +- ), +- shell=True +- ) +-#end update_changelog +- +- +-def version_set(version, do_commit=True, do_tag=True): +- ''' Bump version number and set release date in source files +- ''' +- print "Preparing version bump commit" +- +- update_changelog(version) +- +- print "Updating version and date in source files" +- subprocess.call( +- "sed -r -i '%s' %s " % ( +- sed_script(version), +- " ".join(sed_filelist()) +- ), +- shell=True +- ) +- print "Version set to %s" % version +- +- if do_commit: +- # Commit changes +- print "Committing" +- commit_ok = subprocess.call( +- "git commit --all --message '%s'" % ( +- "Bump version to %s" % version +- ), +- shell=True +- ) +- +- if do_tag: +- tag_ok = tag_create(version) +- else: +- tag_ok = False +- +- if commit_ok == 0: +- print ''' +-NOTE: you should carefully review the new commit, making sure updates +-to the files are correct and no additional changes are required. +-If everything is fine, then the commit can be pushed upstream; +-otherwise: +- - Make the required corrections +- - Amend the commit ('git commit --all --amend' ) or create a new one''' +- +- if tag_ok: +- print ''' - Drop the tag ('git tag --delete %s') +- - run this script again +-''' % ( +- tag_name(version) +- ) +- +- else: +- print "Note: changes have been staged but not committed." +-#end version_set() +- +- +-def main(): +- # Get command-line options +- try: +- opts, args = getopt.gnu_getopt(sys.argv[1:], options, long_options) +- except getopt.GetoptError, err: +- print str(err) +- usage() +- sys.exit(2) +- +- if len(args) < 1: +- usage() +- print "ERROR: please specify the version" +- sys.exit(1) +- +- do_commit = False +- do_tag = False +- +- for opt, val in opts: +- if opt in ("-h", "--help"): +- usage() +- sys.exit(0) +- +- elif opt in ("-c", "--commit"): +- do_commit = True +- +- elif opt in ("-t", "--tag"): +- do_tag = True +- +- # Mandatory parameters +- version = version_check(args[0]) +- +- # Let's do it +- os.chdir(subprocess.check_output('git root', shell=True).rstrip()) +- version_set(version, do_commit, do_tag) +-#end main() +- +- +-if __name__ == "__main__": +- main() +diff --git scripts/uploadrelease.py scripts/uploadrelease.py +deleted file mode 100755 +index 5b295cbb..00000000 +--- scripts/uploadrelease.py ++++ /dev/null +@@ -1,172 +0,0 @@ +-#!/usr/bin/python -u +-''' +- ADOdb release upload script +-''' +- +-from distutils.version import LooseVersion +-import getopt +-import glob +-import os +-from os import path +-import re +-import subprocess +-import sys +- +- +-# Directories and files to exclude from release tarballs +-sf_files = "frs.sourceforge.net:/home/frs/project/adodb/" +-rsync_cmd = "rsync -vP --rsh ssh {opt} {src} {usr}@{dst}" +- +-# Command-line options +-options = "hn" +-long_options = ["help", "dry-run"] +- +- +-def usage(): +- print '''Usage: %s [options] username [release_path] +- +- This script will upload the files in the given directory (or the +- current one if unspecified) to Sourceforge. +- +- Parameters: +- username Sourceforge user account +- release_path Location of the release files to upload +- (see buildrelease.py) +- +- Options: +- -h | --help Show this usage message +- -n | --dry-run Do not upload the files +-''' % ( +- path.basename(__file__) +- ) +-#end usage() +- +- +-def call_rsync(usr, opt, src, dst): +- ''' Calls rsync to upload files with given parameters +- usr = ssh username +- opt = options +- src = source directory +- dst = target directory +- ''' +- global dry_run +- +- command = rsync_cmd.format(usr=usr, opt=opt, src=src, dst=dst) +- +- if dry_run: +- print command +- else: +- subprocess.call(command, shell=True) +- +- +-def get_release_version(): +- ''' Get the version number from the zip file to upload +- ''' +- try: +- zipfile = glob.glob('adodb-*.zip')[0] +- except IndexError: +- print "ERROR: release zip file not found in '%s'" % release_path +- sys.exit(1) +- +- try: +- version = re.search( +- "^adodb-([\d]+\.[\d]+\.[\d]+)\.zip$", +- zipfile +- ).group(1) +- except AttributeError: +- print "ERROR: unable to extract version number from '%s'" % zipfile +- print " Only 3 groups of digits separated by periods are allowed" +- sys.exit(1) +- +- return version +- +- +-def sourceforge_target_dir(version): +- ''' Returns the sourceforge target directory +- Base directory as defined in sf_files global variable, plus +- - if version >= 5.21: adodb-X.Y +- - for older versions: adodb-XYZ-for-php5 +- ''' +- # Keep only X.Y (discard patch number) +- short_version = version.rsplit('.', 1)[0] +- +- directory = 'adodb-php5-only/' +- if LooseVersion(version) >= LooseVersion('5.21'): +- directory += "adodb-" + short_version +- else: +- directory += "adodb-{}-for-php5".format(short_version.replace('.', '')) +- +- return directory +- +- +-def process_command_line(): +- ''' Retrieve command-line options and set global variables accordingly +- ''' +- global upload_files, upload_doc, dry_run, username, release_path +- +- # Get command-line options +- try: +- opts, args = getopt.gnu_getopt(sys.argv[1:], options, long_options) +- except getopt.GetoptError, err: +- print str(err) +- usage() +- sys.exit(2) +- +- if len(args) < 1: +- usage() +- print "ERROR: please specify the Sourceforge user and release_path" +- sys.exit(1) +- +- # Default values for flags +- dry_run = False +- +- for opt, val in opts: +- if opt in ("-h", "--help"): +- usage() +- sys.exit(0) +- +- elif opt in ("-n", "--dry-run"): +- dry_run = True +- +- # Mandatory parameters +- username = args[0] +- +- # Change to release directory, current if not specified +- try: +- release_path = args[1] +- os.chdir(release_path) +- except IndexError: +- release_path = os.getcwd() +- +- +-def upload_release_files(): +- ''' Upload release files from source directory to SourceForge +- ''' +- version = get_release_version() +- target = sf_files + sourceforge_target_dir(version) +- +- print +- print "Uploading release files..." +- print " Source:", release_path +- print " Target: " + target +- print +- call_rsync( +- username, +- "", +- path.join(release_path, "*"), +- target +- ) +- +- +-def main(): +- process_command_line() +- +- # Start upload process +- print "ADOdb release upload script" +- +- upload_release_files() +- +-#end main() +- +-if __name__ == "__main__": +- main() +diff --git tests/benchmark.php tests/benchmark.php +deleted file mode 100644 +index 7be23bb2..00000000 +--- tests/benchmark.php ++++ /dev/null +@@ -1,86 +0,0 @@ +- +- +- +- +- ADODB Benchmarks +- +- +- +-ADODB Version: $ADODB_version Host: $db->host   Database: $db->database"; +- +- // perform query once to cache results so we are only testing throughput +- $rs = $db->Execute($sql); +- if (!$rs){ +- print "Error in recordset

"; +- return; +- } +- $arr = $rs->GetArray(); +- //$db->debug = true; +- global $ADODB_COUNTRECS; +- $ADODB_COUNTRECS = false; +- $start = microtime(); +- for ($i=0; $i < $max; $i++) { +- $rs = $db->Execute($sql); +- $arr = $rs->GetArray(); +- // print $arr[0][1]; +- } +- $end = microtime(); +- $start = explode(' ',$start); +- $end = explode(' ',$end); +- +- //print_r($start); +- //print_r($end); +- +- // print_r($arr); +- $total = $end[0]+trim($end[1]) - $start[0]-trim($start[1]); +- printf ("

seconds = %8.2f for %d iterations each with %d records

",$total,$max, sizeof($arr)); +- flush(); +- +- +- //$db->Close(); +-} +-include("testdatabases.inc.php"); +- +-?> +- +- +- +- +diff --git tests/client.php tests/client.php +deleted file mode 100644 +index 0144519c..00000000 +--- tests/client.php ++++ /dev/null +@@ -1,199 +0,0 @@ +- +- +-'; +- var_dump(parse_url('odbc_mssql://userserver/')); +- die(); +- +-include('../adodb.inc.php'); +-include('../tohtml.inc.php'); +- +- function send2server($url,$sql) +- { +- $url .= '?sql='.urlencode($sql); +- print "

$url

"; +- $rs = csv2rs($url,$err); +- if ($err) print $err; +- return $rs; +- } +- +- function print_pre($s) +- { +- print "
";print_r($s);print "
"; +- } +- +- +-$serverURL = 'http://localhost/php/phplens/adodb/server.php'; +-$testhttp = false; +- +-$sql1 = "insertz into products (productname) values ('testprod 1')"; +-$sql2 = "insert into products (productname) values ('testprod 1')"; +-$sql3 = "insert into products (productname) values ('testprod 2')"; +-$sql4 = "delete from products where productid>80"; +-$sql5 = 'select * from products'; +- +-if ($testhttp) { +- print "Client Driver Tests

"; +- print "

Test Error

"; +- $rs = send2server($serverURL,$sql1); +- print_pre($rs); +- print "
"; +- +- print "

Test Insert

"; +- +- $rs = send2server($serverURL,$sql2); +- print_pre($rs); +- print "
"; +- +- print "

Test Insert2

"; +- +- $rs = send2server($serverURL,$sql3); +- print_pre($rs); +- print "
"; +- +- print "

Test Delete

"; +- +- $rs = send2server($serverURL,$sql4); +- print_pre($rs); +- print "
"; +- +- +- print "

Test Select

"; +- $rs = send2server($serverURL,$sql5); +- if ($rs) rs2html($rs); +- +- print "
"; +-} +- +- +-print "

CLIENT Driver Tests

"; +-$conn = ADONewConnection('csv'); +-$conn->Connect($serverURL); +-$conn->debug = true; +- +-print "

Bad SQL

"; +- +-$rs = $conn->Execute($sql1); +- +-print "

Insert SQL 1

"; +-$rs = $conn->Execute($sql2); +- +-print "

Insert SQL 2

"; +-$rs = $conn->Execute($sql3); +- +-print "

Select SQL

"; +-$rs = $conn->Execute($sql5); +-if ($rs) rs2html($rs); +- +-print "

Delete SQL

"; +-$rs = $conn->Execute($sql4); +- +-print "

Select SQL

"; +-$rs = $conn->Execute($sql5); +-if ($rs) rs2html($rs); +- +- +-/* EXPECTED RESULTS FOR HTTP TEST: +- +-Test Insert +-http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29 +- +-adorecordset Object +-( +- [dataProvider] => native +- [fields] => +- [blobSize] => 64 +- [canSeek] => +- [EOF] => 1 +- [emptyTimeStamp] => +- [emptyDate] => +- [debug] => +- [timeToLive] => 0 +- [bind] => +- [_numOfRows] => -1 +- [_numOfFields] => 0 +- [_queryID] => 1 +- [_currentRow] => -1 +- [_closed] => +- [_inited] => +- [sql] => insert into products (productname) values ('testprod') +- [affectedrows] => 1 +- [insertid] => 81 +-) +- +- +--------------------------------------------------------------------------------- +- +-Test Insert2 +-http://localhost/php/adodb/server.php?sql=insert+into+products+%28productname%29+values+%28%27testprod%27%29 +- +-adorecordset Object +-( +- [dataProvider] => native +- [fields] => +- [blobSize] => 64 +- [canSeek] => +- [EOF] => 1 +- [emptyTimeStamp] => +- [emptyDate] => +- [debug] => +- [timeToLive] => 0 +- [bind] => +- [_numOfRows] => -1 +- [_numOfFields] => 0 +- [_queryID] => 1 +- [_currentRow] => -1 +- [_closed] => +- [_inited] => +- [sql] => insert into products (productname) values ('testprod') +- [affectedrows] => 1 +- [insertid] => 82 +-) +- +- +--------------------------------------------------------------------------------- +- +-Test Delete +-http://localhost/php/adodb/server.php?sql=delete+from+products+where+productid%3E80 +- +-adorecordset Object +-( +- [dataProvider] => native +- [fields] => +- [blobSize] => 64 +- [canSeek] => +- [EOF] => 1 +- [emptyTimeStamp] => +- [emptyDate] => +- [debug] => +- [timeToLive] => 0 +- [bind] => +- [_numOfRows] => -1 +- [_numOfFields] => 0 +- [_queryID] => 1 +- [_currentRow] => -1 +- [_closed] => +- [_inited] => +- [sql] => delete from products where productid>80 +- [affectedrows] => 2 +- [insertid] => 0 +-) +- +-[more stuff deleted] +- . +- . +- . +-*/ +diff --git tests/pdo.php tests/pdo.php +deleted file mode 100644 +index 31ca5969..00000000 +--- tests/pdo.php ++++ /dev/null +@@ -1,92 +0,0 @@ +-"; +-try { +- echo "New Connection\n"; +- +- +- $dsn = 'pdo_mysql://root:@localhost/northwind?persist'; +- +- if (!empty($dsn)) { +- $DB = NewADOConnection($dsn) || die("CONNECT FAILED"); +- $connstr = $dsn; +- } else { +- +- $DB = NewADOConnection('pdo'); +- +- echo "Connect\n"; +- +- $u = ''; $p = ''; +- /* +- $connstr = 'odbc:nwind'; +- +- $connstr = 'oci:'; +- $u = 'scott'; +- $p = 'natsoft'; +- +- +- $connstr ="sqlite:d:\inetpub\adodb\sqlite.db"; +- */ +- +- $connstr = "mysql:dbname=northwind"; +- $u = 'root'; +- +- $connstr = "pgsql:dbname=test"; +- $u = 'tester'; +- $p = 'test'; +- +- $DB->Connect($connstr,$u,$p) || die("CONNECT FAILED"); +- +- } +- +- echo "connection string=$connstr\n Execute\n"; +- +- //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $rs = $DB->Execute("select * from ADOXYZ where id<3"); +- if ($DB->ErrorNo()) echo "*** errno=".$DB->ErrorNo() . " ".($DB->ErrorMsg())."\n"; +- +- +- //print_r(get_class_methods($DB->_stmt)); +- +- if (!$rs) die("NO RS"); +- +- echo "Meta\n"; +- for ($i=0; $i < $rs->NumCols(); $i++) { +- var_dump($rs->FetchField($i)); +- echo "
"; +- } +- +- echo "FETCH\n"; +- $cnt = 0; +- while (!$rs->EOF) { +- adodb_pr($rs->fields); +- $rs->MoveNext(); +- if ($cnt++ > 1000) break; +- } +- +- echo "
--------------------------------------------------------
\n\n\n"; +- +- $stmt = $DB->PrepareStmt("select * from ADOXYZ"); +- +- $rs = $stmt->Execute(); +- $cols = $stmt->NumCols(); // execute required +- +- echo "COLS = $cols"; +- for($i=1;$i<=$cols;$i++) { +- $v = $stmt->_stmt->getColumnMeta($i); +- var_dump($v); +- } +- +- echo "e=".$stmt->ErrorNo() . " ".($stmt->ErrorMsg())."\n"; +- while ($arr = $rs->FetchRow()) { +- adodb_pr($arr); +- } +- die("DONE\n"); +- +-} catch (exception $e) { +- echo "
";
+-	echo $e;
+-	echo "
"; +-} +diff --git tests/test-active-record.php tests/test-active-record.php +deleted file mode 100644 +index 59471620..00000000 +--- tests/test-active-record.php ++++ /dev/null +@@ -1,140 +0,0 @@ +-= 5) { +- include('../adodb-exceptions.inc.php'); +- echo "

Exceptions included

"; +- } +- } +- +- $db = NewADOConnection('mysql://root@localhost/northwind?persist'); +- $db->debug=1; +- ADOdb_Active_Record::SetDatabaseAdapter($db); +- +- +- $db->Execute("CREATE TEMPORARY TABLE `persons` ( +- `id` int(10) unsigned NOT NULL auto_increment, +- `name_first` varchar(100) NOT NULL default '', +- `name_last` varchar(100) NOT NULL default '', +- `favorite_color` varchar(100) NOT NULL default '', +- PRIMARY KEY (`id`) +- ) ENGINE=MyISAM; +- "); +- +- $db->Execute("CREATE TEMPORARY TABLE `children` ( +- `id` int(10) unsigned NOT NULL auto_increment, +- `person_id` int(10) unsigned NOT NULL, +- `name_first` varchar(100) NOT NULL default '', +- `name_last` varchar(100) NOT NULL default '', +- `favorite_pet` varchar(100) NOT NULL default '', +- PRIMARY KEY (`id`) +- ) ENGINE=MyISAM; +- "); +- +- class Person extends ADOdb_Active_Record{ function ret($v) {return $v;} } +- $person = new Person(); +- ADOdb_Active_Record::$_quoteNames = '111'; +- +- echo "

Output of getAttributeNames: "; +- var_dump($person->getAttributeNames()); +- +- /** +- * Outputs the following: +- * array(4) { +- * [0]=> +- * string(2) "id" +- * [1]=> +- * string(9) "name_first" +- * [2]=> +- * string(8) "name_last" +- * [3]=> +- * string(13) "favorite_color" +- * } +- */ +- +- $person = new Person(); +- $person->name_first = 'Andi'; +- $person->name_last = 'Gutmans'; +- $person->save(); // this save() will fail on INSERT as favorite_color is a must fill... +- +- +- $person = new Person(); +- $person->name_first = 'Andi'; +- $person->name_last = 'Gutmans'; +- $person->favorite_color = 'blue'; +- $person->save(); // this save will perform an INSERT successfully +- +- echo "

The Insert ID generated:"; print_r($person->id); +- +- $person->favorite_color = 'red'; +- $person->save(); // this save() will perform an UPDATE +- +- $person = new Person(); +- $person->name_first = 'John'; +- $person->name_last = 'Lim'; +- $person->favorite_color = 'lavender'; +- $person->save(); // this save will perform an INSERT successfully +- +- // load record where id=2 into a new ADOdb_Active_Record +- $person2 = new Person(); +- $person2->Load('id=2'); +- +- $activeArr = $db->GetActiveRecordsClass($class = "Person",$table = "Persons","id=".$db->Param(0),array(2)); +- $person2 = $activeArr[0]; +- echo "

Name (should be John): ",$person->name_first, "
Class (should be Person): ",get_class($person2),"
"; +- +- $db->Execute("insert into children (person_id,name_first,name_last) values (2,'Jill','Lim')"); +- $db->Execute("insert into children (person_id,name_first,name_last) values (2,'Joan','Lim')"); +- $db->Execute("insert into children (person_id,name_first,name_last) values (2,'JAMIE','Lim')"); +- +- $newperson2 = new Person(); +- $person2->HasMany('children','person_id'); +- $person2->Load('id=2'); +- $person2->name_last='green'; +- $c = $person2->children; +- $person2->save(); +- +- if (is_array($c) && sizeof($c) == 3 && $c[0]->name_first=='Jill' && $c[1]->name_first=='Joan' +- && $c[2]->name_first == 'JAMIE') echo "OK Loaded HasMany
"; +- else { +- var_dump($c); +- echo "error loading hasMany should have 3 array elements Jill Joan Jamie
"; +- } +- +- class Child extends ADOdb_Active_Record{}; +- $ch = new Child('children',array('id')); +- $ch->BelongsTo('person','person_id','id'); +- $ch->Load('id=1'); +- if ($ch->name_first !== 'Jill') echo "error in Loading Child
"; +- +- $p = $ch->person; +- if ($p->name_first != 'John') echo "Error loading belongsTo
"; +- else echo "OK loading BelongTo
"; +- +- $p->hasMany('children','person_id'); +- $p->LoadRelations('children', " Name_first like 'J%' order by id",1,2); +- if (sizeof($p->children) == 2 && $p->children[1]->name_first == 'JAMIE') echo "OK LoadRelations
"; +- else echo "error LoadRelations
"; +- +- $db->Execute("CREATE TEMPORARY TABLE `persons2` ( +- `id` int(10) unsigned NOT NULL auto_increment, +- `name_first` varchar(100) NOT NULL default '', +- `name_last` varchar(100) NOT NULL default '', +- `favorite_color` varchar(100) default '', +- PRIMARY KEY (`id`) +- ) ENGINE=MyISAM; +- "); +- +- $p = new adodb_active_record('persons2'); +- $p->name_first = 'James'; +- +- $p->name_last = 'James'; +- +- $p->HasMany('children','person_id'); +- $p->children; +- var_dump($p); +- $p->Save(); +diff --git tests/test-active-recs2.php tests/test-active-recs2.php +deleted file mode 100644 +index f5898fcd..00000000 +--- tests/test-active-recs2.php ++++ /dev/null +@@ -1,76 +0,0 @@ +-Connect("localhost","tester","test","test"); +-} else +- $db = NewADOConnection('oci8://scott:natsoft@/'); +- +- +-$arr = $db->ServerInfo(); +-echo "

$db->dataProvider: {$arr['description']}

"; +- +-$arr = $db->GetActiveRecords('products',' productid<10'); +-adodb_pr($arr); +- +-ADOdb_Active_Record::SetDatabaseAdapter($db); +-if (!$db) die('failed'); +- +- +- +- +-$rec = new ADODB_Active_Record('photos'); +- +-$rec = new ADODB_Active_Record('products'); +- +- +-adodb_pr($rec->getAttributeNames()); +- +-echo "
"; +- +- +-$rec->load('productid=2'); +-adodb_pr($rec); +- +-$db->debug=1; +- +- +-$rec->productname = 'Changie Chan'.rand(); +- +-$rec->insert(); +-$rec->update(); +- +-$rec->productname = 'Changie Chan 99'; +-$rec->replace(); +- +- +-$rec2 = new ADODB_Active_Record('products'); +-$rec->load('productid=3'); +-$rec->save(); +- +-$rec = new ADODB_Active_record('products'); +-$rec->productname = 'John ActiveRec'; +-$rec->notes = 22; +-#$rec->productid=0; +-$rec->discontinued=1; +-$rec->Save(); +-$rec->supplierid=33; +-$rec->Save(); +-$rec->discontinued=0; +-$rec->Save(); +-$rec->Delete(); +- +-echo "

Affected Rows after delete=".$db->Affected_Rows()."

"; +diff --git tests/test-active-relations.php tests/test-active-relations.php +deleted file mode 100644 +index 7a98d479..00000000 +--- tests/test-active-relations.php ++++ /dev/null +@@ -1,85 +0,0 @@ +-debug=1; +- ADOdb_Active_Record::SetDatabaseAdapter($db); +- +- $db->Execute("CREATE TEMPORARY TABLE `persons` ( +- `id` int(10) unsigned NOT NULL auto_increment, +- `name_first` varchar(100) NOT NULL default '', +- `name_last` varchar(100) NOT NULL default '', +- `favorite_color` varchar(100) NOT NULL default '', +- PRIMARY KEY (`id`) +- ) ENGINE=MyISAM; +- "); +- +- $db->Execute("CREATE TEMPORARY TABLE `children` ( +- `id` int(10) unsigned NOT NULL auto_increment, +- `person_id` int(10) unsigned NOT NULL, +- `name_first` varchar(100) NOT NULL default '', +- `name_last` varchar(100) NOT NULL default '', +- `favorite_pet` varchar(100) NOT NULL default '', +- PRIMARY KEY (`id`) +- ) ENGINE=MyISAM; +- "); +- +- +- $db->Execute("insert into children (person_id,name_first,name_last) values (1,'Jill','Lim')"); +- $db->Execute("insert into children (person_id,name_first,name_last) values (1,'Joan','Lim')"); +- $db->Execute("insert into children (person_id,name_first,name_last) values (1,'JAMIE','Lim')"); +- +- ADODB_Active_Record::TableHasMany('persons', 'children','person_id'); +- class person extends ADOdb_Active_Record{} +- +- $person = new person(); +-# $person->HasMany('children','person_id'); ## this is affects all other instances of Person +- +- $person->name_first = 'John'; +- $person->name_last = 'Lim'; +- $person->favorite_color = 'lavender'; +- $person->save(); // this save will perform an INSERT successfully +- +- $person2 = new person(); +- $person2->Load('id=1'); +- +- $c = $person2->children; +- if (is_array($c) && sizeof($c) == 3 && $c[0]->name_first=='Jill' && $c[1]->name_first=='Joan' +- && $c[2]->name_first == 'JAMIE') echo "OK Loaded HasMany
"; +- else { +- var_dump($c); +- echo "error loading hasMany should have 3 array elements Jill Joan Jamie
"; +- } +- +- class child extends ADOdb_Active_Record{}; +- ADODB_Active_Record::TableBelongsTo('children','person','person_id','id'); +- $ch = new Child('children',array('id')); +- +- $ch->Load('id=1'); +- if ($ch->name_first !== 'Jill') echo "error in Loading Child
"; +- +- $p = $ch->person; +- if (!$p || $p->name_first != 'John') echo "Error loading belongsTo
"; +- else echo "OK loading BelongTo
"; +- +- if ($p) { +- #$p->HasMany('children','person_id'); ## this is affects all other instances of Person +- $p->LoadRelations('children', 'order by id',1,2); +- if (sizeof($p->children) == 2 && $p->children[1]->name_first == 'JAMIE') echo "OK LoadRelations
"; +- else { +- var_dump($p->children); +- echo "error LoadRelations
"; +- } +- +- unset($p->children); +- $p->LoadRelations('children', " name_first like 'J%' order by id",1,2); +- } +- if ($p) +- foreach($p->children as $c) { +- echo " Saving $c->name_first
"; +- $c->name_first .= ' K.'; +- $c->Save(); +- } +diff --git tests/test-active-relationsx.php tests/test-active-relationsx.php +deleted file mode 100644 +index 0f28f728..00000000 +--- tests/test-active-relationsx.php ++++ /dev/null +@@ -1,418 +0,0 @@ +-\n", $txt); +- echo $txt; +- } +- +- include_once('../adodb.inc.php'); +- include_once('../adodb-active-recordx.inc.php'); +- +- +- $db = NewADOConnection('mysql://root@localhost/test'); +- $db->debug=0; +- ADOdb_Active_Record::SetDatabaseAdapter($db); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("Preparing database using SQL queries (creating 'people', 'children')\n"); +- +- $db->Execute("DROP TABLE `people`"); +- $db->Execute("DROP TABLE `children`"); +- $db->Execute("DROP TABLE `artists`"); +- $db->Execute("DROP TABLE `songs`"); +- +- $db->Execute("CREATE TABLE `people` ( +- `id` int(10) unsigned NOT NULL auto_increment, +- `name_first` varchar(100) NOT NULL default '', +- `name_last` varchar(100) NOT NULL default '', +- `favorite_color` varchar(100) NOT NULL default '', +- PRIMARY KEY (`id`) +- ) ENGINE=MyISAM; +- "); +- $db->Execute("CREATE TABLE `children` ( +- `person_id` int(10) unsigned NOT NULL, +- `name_first` varchar(100) NOT NULL default '', +- `name_last` varchar(100) NOT NULL default '', +- `favorite_pet` varchar(100) NOT NULL default '', +- `id` int(10) unsigned NOT NULL auto_increment, +- PRIMARY KEY (`id`) +- ) ENGINE=MyISAM; +- "); +- +- $db->Execute("CREATE TABLE `artists` ( +- `name` varchar(100) NOT NULL default '', +- `artistuniqueid` int(10) unsigned NOT NULL auto_increment, +- PRIMARY KEY (`artistuniqueid`) +- ) ENGINE=MyISAM; +- "); +- +- $db->Execute("CREATE TABLE `songs` ( +- `name` varchar(100) NOT NULL default '', +- `artistid` int(10) NOT NULL, +- `recordid` int(10) unsigned NOT NULL auto_increment, +- PRIMARY KEY (`recordid`) +- ) ENGINE=MyISAM; +- "); +- +- $db->Execute("insert into children (person_id,name_first,name_last,favorite_pet) values (1,'Jill','Lim','tortoise')"); +- $db->Execute("insert into children (person_id,name_first,name_last) values (1,'Joan','Lim')"); +- $db->Execute("insert into children (person_id,name_first,name_last) values (1,'JAMIE','Lim')"); +- +- $db->Execute("insert into artists (artistuniqueid, name) values(1,'Elvis Costello')"); +- $db->Execute("insert into songs (recordid, name, artistid) values(1,'No Hiding Place', 1)"); +- $db->Execute("insert into songs (recordid, name, artistid) values(2,'American Gangster Time', 1)"); +- +- // This class _implicitely_ relies on the 'people' table (pluralized form of 'person') +- class Person extends ADOdb_Active_Record +- { +- function __construct() +- { +- parent::__construct(); +- $this->hasMany('children'); +- } +- } +- // This class _implicitely_ relies on the 'children' table +- class Child extends ADOdb_Active_Record +- { +- function __construct() +- { +- parent::__construct(); +- $this->belongsTo('person'); +- } +- } +- // This class _explicitely_ relies on the 'children' table and shares its metadata with Child +- class Kid extends ADOdb_Active_Record +- { +- function __construct() +- { +- parent::__construct('children'); +- $this->belongsTo('person'); +- } +- } +- // This class _explicitely_ relies on the 'children' table but does not share its metadata +- class Rugrat extends ADOdb_Active_Record +- { +- function __construct() +- { +- parent::__construct('children', false, false, array('new' => true)); +- } +- } +- +- class Artist extends ADOdb_Active_Record +- { +- function __construct() +- { +- parent::__construct('artists', array('artistuniqueid')); +- $this->hasMany('songs', 'artistid'); +- } +- } +- class Song extends ADOdb_Active_Record +- { +- function __construct() +- { +- parent::__construct('songs', array('recordid')); +- $this->belongsTo('artist', 'artistid'); +- } +- } +- +- ar_echo("Inserting person in 'people' table ('John Lim, he likes lavender')\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $person = new Person(); +- $person->name_first = 'John'; +- $person->name_last = 'Lim'; +- $person->favorite_color = 'lavender'; +- $person->save(); // this save will perform an INSERT successfully +- +- $person = new Person(); +- $person->name_first = 'Lady'; +- $person->name_last = 'Cat'; +- $person->favorite_color = 'green'; +- $person->save(); +- +- $child = new Child(); +- $child->name_first = 'Fluffy'; +- $child->name_last = 'Cat'; +- $child->favorite_pet = 'Cat Lady'; +- $child->person_id = $person->id; +- $child->save(); +- +- $child = new Child(); +- $child->name_first = 'Sun'; +- $child->name_last = 'Cat'; +- $child->favorite_pet = 'Cat Lady'; +- $child->person_id = $person->id; +- $child->save(); +- +- $err_count = 0; +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("person->Find('id=1') [Lazy Method]\n"); +- ar_echo("person is loaded but its children will be loaded on-demand later on\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $person = new Person(); +- $people = $person->Find('id=1'); +- ar_echo((ar_assert(found($people, "'name_first' => 'John'"))) ? "[OK] Found John\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($people, "'favorite_pet' => 'tortoise'"))) ? "[OK] No relation yet\n" : "[!!] Found relation when I shouldn't\n"); +- ar_echo("\n-- Lazily Loading Children:\n\n"); +- foreach($people as $aperson) +- { +- foreach($aperson->children as $achild) +- { +- if($achild->name_first); +- } +- } +- ar_echo((ar_assert(found($people, "'favorite_pet' => 'tortoise'"))) ? "[OK] Found relation: child\n" : "[!!] Missing relation: child\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'Joan'"))) ? "[OK] Found Joan\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'JAMIE'"))) ? "[OK] Found JAMIE\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("person->Find('id=1' ... ADODB_WORK_AR) [Worker Method]\n"); +- ar_echo("person is loaded, and so are its children\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $person = new Person(); +- $people = $person->Find('id=1', false, false, array('loading' => ADODB_WORK_AR)); +- ar_echo((ar_assert(found($people, "'name_first' => 'John'"))) ? "[OK] Found John\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($people, "'favorite_pet' => 'tortoise'"))) ? "[OK] Found relation: child\n" : "[!!] Missing relation: child\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'Joan'"))) ? "[OK] Found Joan\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'JAMIE'"))) ? "[OK] Found JAMIE\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("person->Find('id=1' ... ADODB_JOIN_AR) [Join Method]\n"); +- ar_echo("person and its children are loaded using a single query\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $person = new Person(); +- // When I specifically ask for a join, I have to specify which table id I am looking up +- // otherwise the SQL parser will wonder which table's id that would be. +- $people = $person->Find('people.id=1', false, false, array('loading' => ADODB_JOIN_AR)); +- ar_echo((ar_assert(found($people, "'name_first' => 'John'"))) ? "[OK] Found John\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($people, "'favorite_pet' => 'tortoise'"))) ? "[OK] Found relation: child\n" : "[!!] Missing relation: child\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'Joan'"))) ? "[OK] Found Joan\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'JAMIE'"))) ? "[OK] Found JAMIE\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("person->Load('people.id=1') [Join Method]\n"); +- ar_echo("Load() always uses the join method since it returns only one row\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $person = new Person(); +- // Under the hood, Load(), since it returns only one row, always perform a join +- // Therefore we need to clarify which id we are talking about. +- $person->Load('people.id=1'); +- ar_echo((ar_assert(found($person, "'name_first' => 'John'"))) ? "[OK] Found John\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($person, "'favorite_pet' => 'tortoise'"))) ? "[OK] Found relation: child\n" : "[!!] Missing relation: child\n"); +- ar_echo((ar_assert(found($person, "'name_first' => 'Joan'"))) ? "[OK] Found Joan\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($person, "'name_first' => 'JAMIE'"))) ? "[OK] Found JAMIE\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("child->Load('children.id=1') [Join Method]\n"); +- ar_echo("We are now loading from the 'children' table, not from 'people'\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $child = new Child(); +- $child->Load('children.id=1'); +- ar_echo((ar_assert(found($child, "'name_first' => 'Jill'"))) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($child, "'favorite_color' => 'lavender'"))) ? "[OK] Found relation: person\n" : "[!!] Missing relation: person\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("child->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $child = new Child(); +- $children = $child->Find('id=1', false, false, array('loading' => ADODB_WORK_AR)); +- ar_echo((ar_assert(found($children, "'name_first' => 'Jill'"))) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($children, "'favorite_color' => 'lavender'"))) ? "[OK] Found relation: person\n" : "[!!] Missing relation: person\n"); +- ar_echo((ar_assert(notfound($children, "'name_first' => 'Joan'"))) ? "[OK] No Joan relation\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($children, "'name_first' => 'JAMIE'"))) ? "[OK] No JAMIE relation\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("kid->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]\n"); +- ar_echo("Where we see that kid shares relationships with child because they are stored\n"); +- ar_echo("in the common table's metadata structure.\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $kid = new Kid('children'); +- $kids = $kid->Find('children.id=1', false, false, array('loading' => ADODB_WORK_AR)); +- ar_echo((ar_assert(found($kids, "'name_first' => 'Jill'"))) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($kids, "'favorite_color' => 'lavender'"))) ? "[OK] Found relation: person\n" : "[!!] Missing relation: person\n"); +- ar_echo((ar_assert(notfound($kids, "'name_first' => 'Joan'"))) ? "[OK] No Joan relation\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($kids, "'name_first' => 'JAMIE'"))) ? "[OK] No JAMIE relation\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("kid->Find('children.id=1' ... ADODB_LAZY_AR) [Lazy Method]\n"); +- ar_echo("Of course, lazy loading also retrieve medata information...\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $kid = new Kid('children'); +- $kids = $kid->Find('children.id=1', false, false, array('loading' => ADODB_LAZY_AR)); +- ar_echo((ar_assert(found($kids, "'name_first' => 'Jill'"))) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($kids, "'favorite_color' => 'lavender'"))) ? "[OK] No relation yet\n" : "[!!] Found relation when I shouldn't\n"); +- ar_echo("\n-- Lazily Loading People:\n\n"); +- foreach($kids as $akid) +- { +- if($akid->person); +- } +- ar_echo((ar_assert(found($kids, "'favorite_color' => 'lavender'"))) ? "[OK] Found relation: person\n" : "[!!] Missing relation: person\n"); +- ar_echo((ar_assert(notfound($kids, "'name_first' => 'Joan'"))) ? "[OK] No Joan relation\n" : "[!!] Found relation when I shouldn't\n"); +- ar_echo((ar_assert(notfound($kids, "'name_first' => 'JAMIE'"))) ? "[OK] No JAMIE relation\n" : "[!!] Found relation when I shouldn't\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("rugrat->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]\n"); +- ar_echo("In rugrat's constructor it is specified that\nit must forget any existing relation\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $rugrat = new Rugrat('children'); +- $rugrats = $rugrat->Find('children.id=1', false, false, array('loading' => ADODB_WORK_AR)); +- ar_echo((ar_assert(found($rugrats, "'name_first' => 'Jill'"))) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($rugrats, "'favorite_color' => 'lavender'"))) ? "[OK] No relation found\n" : "[!!] Found relation when I shouldn't\n"); +- ar_echo((ar_assert(notfound($rugrats, "'name_first' => 'Joan'"))) ? "[OK] No Joan relation\n" : "[!!] Found relation when I shouldn't\n"); +- ar_echo((ar_assert(notfound($rugrats, "'name_first' => 'JAMIE'"))) ? "[OK] No JAMIE relation\n" : "[!!] Found relation when I shouldn't\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("kid->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]\n"); +- ar_echo("Note how only rugrat forgot its relations - kid is fine.\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $kid = new Kid('children'); +- $kids = $kid->Find('children.id=1', false, false, array('loading' => ADODB_WORK_AR)); +- ar_echo((ar_assert(found($kids, "'name_first' => 'Jill'"))) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($kids, "'favorite_color' => 'lavender'"))) ? "[OK] I did not forget relation: person\n" : "[!!] I should not have forgotten relation: person\n"); +- ar_echo((ar_assert(notfound($kids, "'name_first' => 'Joan'"))) ? "[OK] No Joan relation\n" : "[!!] Found relation when I shouldn't\n"); +- ar_echo((ar_assert(notfound($kids, "'name_first' => 'JAMIE'"))) ? "[OK] No JAMIE relation\n" : "[!!] Found relation when I shouldn't\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("rugrat->Find('children.id=1' ... ADODB_WORK_AR) [Worker Method]\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $rugrat = new Rugrat('children'); +- $rugrats = $rugrat->Find('children.id=1', false, false, array('loading' => ADODB_WORK_AR)); +- $arugrat = $rugrats[0]; +- ar_echo((ar_assert(found($arugrat, "'name_first' => 'Jill'"))) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($arugrat, "'favorite_color' => 'lavender'"))) ? "[OK] No relation yet\n" : "[!!] Found relation when I shouldn't\n"); +- +- ar_echo("\n-- Loading relations:\n\n"); +- $arugrat->belongsTo('person'); +- $arugrat->LoadRelations('person', 'order by id', 0, 2); +- ar_echo((ar_assert(found($arugrat, "'favorite_color' => 'lavender'"))) ? "[OK] Found relation: person\n" : "[!!] Missing relation: person\n"); +- ar_echo((ar_assert(found($arugrat, "'name_first' => 'Jill'"))) ? "[OK] Found Jill\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($arugrat, "'name_first' => 'Joan'"))) ? "[OK] No Joan relation\n" : "[!!] Found relation when I shouldn't\n"); +- ar_echo((ar_assert(notfound($arugrat, "'name_first' => 'JAMIE'"))) ? "[OK] No Joan relation\n" : "[!!] Found relation when I shouldn't\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("person->Find('1=1') [Lazy Method]\n"); +- ar_echo("And now for our finale...\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $person = new Person(); +- $people = $person->Find('1=1', false, false, array('loading' => ADODB_LAZY_AR)); +- ar_echo((ar_assert(found($people, "'name_first' => 'John'"))) ? "[OK] Found John\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($people, "'favorite_pet' => 'tortoise'"))) ? "[OK] No relation yet\n" : "[!!] Found relation when I shouldn't\n"); +- ar_echo((ar_assert(notfound($people, "'name_first' => 'Fluffy'"))) ? "[OK] No Fluffy yet\n" : "[!!] Found Fluffy relation when I shouldn't\n"); +- ar_echo("\n-- Lazily Loading Everybody:\n\n"); +- foreach($people as $aperson) +- { +- foreach($aperson->children as $achild) +- { +- if($achild->name_first); +- } +- } +- ar_echo((ar_assert(found($people, "'favorite_pet' => 'tortoise'"))) ? "[OK] Found relation: child\n" : "[!!] Missing relation: child\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'Joan'"))) ? "[OK] Found Joan\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'JAMIE'"))) ? "[OK] Found JAMIE\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'Lady'"))) ? "[OK] Found Cat Lady\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'Fluffy'"))) ? "[OK] Found Fluffy\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($people, "'name_first' => 'Sun'"))) ? "[OK] Found Sun\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("artist->Load('artistuniqueid=1') [Join Method]\n"); +- ar_echo("Yes, we are dabbling in the musical field now..\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $artist = new Artist(); +- $artist->Load('artistuniqueid=1'); +- ar_echo((ar_assert(found($artist, "'name' => 'Elvis Costello'"))) ? "[OK] Found Elvis Costello\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($artist, "'name' => 'No Hiding Place'"))) ? "[OK] Found relation: song\n" : "[!!] Missing relation: song\n"); +- +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("song->Load('recordid=1') [Join Method]\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $song = new Song(); +- $song->Load('recordid=1'); +- ar_echo((ar_assert(found($song, "'name' => 'No Hiding Place'"))) ? "[OK] Found song\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("artist->Find('artistuniqueid=1' ... ADODB_JOIN_AR) [Join Method]\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $artist = new Artist(); +- $artists = $artist->Find('artistuniqueid=1', false, false, array('loading' => ADODB_JOIN_AR)); +- ar_echo((ar_assert(found($artists, "'name' => 'Elvis Costello'"))) ? "[OK] Found Elvis Costello\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($artists, "'name' => 'No Hiding Place'"))) ? "[OK] Found relation: song\n" : "[!!] Missing relation: song\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("song->Find('recordid=1' ... ADODB_JOIN_AR) [Join Method]\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $song = new Song(); +- $songs = $song->Find('recordid=1', false, false, array('loading' => ADODB_JOIN_AR)); +- ar_echo((ar_assert(found($songs, "'name' => 'No Hiding Place'"))) ? "[OK] Found song\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("artist->Find('artistuniqueid=1' ... ADODB_WORK_AR) [Work Method]\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $artist = new Artist(); +- $artists = $artist->Find('artistuniqueid=1', false, false, array('loading' => ADODB_WORK_AR)); +- ar_echo((ar_assert(found($artists, "'name' => 'Elvis Costello'"))) ? "[OK] Found Elvis Costello\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(found($artists, "'name' => 'No Hiding Place'"))) ? "[OK] Found relation: song\n" : "[!!] Missing relation: song\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("song->Find('recordid=1' ... ADODB_JOIN_AR) [Join Method]\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $song = new Song(); +- $songs = $song->Find('recordid=1', false, false, array('loading' => ADODB_WORK_AR)); +- ar_echo((ar_assert(found($songs, "'name' => 'No Hiding Place'"))) ? "[OK] Found song\n" : "[!!] Find failed\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("artist->Find('artistuniqueid=1' ... ADODB_LAZY_AR) [Lazy Method]\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $artist = new Artist(); +- $artists = $artist->Find('artistuniqueid=1', false, false, array('loading' => ADODB_LAZY_AR)); +- ar_echo((ar_assert(found($artists, "'name' => 'Elvis Costello'"))) ? "[OK] Found Elvis Costello\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($artists, "'name' => 'No Hiding Place'"))) ? "[OK] No relation yet\n" : "[!!] Found relation when I shouldn't\n"); +- foreach($artists as $anartist) +- { +- foreach($anartist->songs as $asong) +- { +- if($asong->name); +- } +- } +- ar_echo((ar_assert(found($artists, "'name' => 'No Hiding Place'"))) ? "[OK] Found relation: song\n" : "[!!] Missing relation: song\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("song->Find('recordid=1' ... ADODB_LAZY_AR) [Lazy Method]\n"); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +- $song = new Song(); +- $songs = $song->Find('recordid=1', false, false, array('loading' => ADODB_LAZY_AR)); +- ar_echo((ar_assert(found($songs, "'name' => 'No Hiding Place'"))) ? "[OK] Found song\n" : "[!!] Find failed\n"); +- ar_echo((ar_assert(notfound($songs, "'name' => 'Elvis Costello'"))) ? "[OK] No relation yet\n" : "[!!] Found relation when I shouldn't\n"); +- foreach($songs as $asong) +- { +- if($asong->artist); +- } +- ar_echo((ar_assert(found($songs, "'name' => 'Elvis Costello'"))) ? "[OK] Found relation: artist\n" : "[!!] Missing relation: artist\n"); +- +- ar_echo("\n\n-------------------------------------------------------------------------------------------------------------------\n"); +- ar_echo("Test suite complete. " . (($err_count > 0) ? "$err_count errors found.\n" : "Success.\n")); +- ar_echo("-------------------------------------------------------------------------------------------------------------------\n"); +diff --git tests/test-datadict.php tests/test-datadict.php +deleted file mode 100644 +index 90b5aa9d..00000000 +--- tests/test-datadict.php ++++ /dev/null +@@ -1,251 +0,0 @@ +-$dbType

"; +- $db = NewADOConnection($dbType); +- $dict = NewDataDictionary($db); +- +- if (!$dict) continue; +- $dict->debug = 1; +- +- $opts = array('REPLACE','mysql' => 'ENGINE=INNODB', 'oci8' => 'TABLESPACE USERS'); +- +-/* $flds = array( +- array('id', 'I', +- 'AUTO','KEY'), +- +- array('name' => 'firstname', 'type' => 'varchar','size' => 30, +- 'DEFAULT'=>'Joan'), +- +- array('lastname','varchar',28, +- 'DEFAULT'=>'Chen','key'), +- +- array('averylonglongfieldname','X',1024, +- 'NOTNULL','default' => 'test'), +- +- array('price','N','7.2', +- 'NOTNULL','default' => '0.00'), +- +- array('MYDATE', 'D', +- 'DEFDATE'), +- array('TS','T', +- 'DEFTIMESTAMP') +- );*/ +- +- $flds = " +-ID I AUTO KEY, +-FIRSTNAME VARCHAR(30) DEFAULT 'Joan' INDEX idx_name, +-LASTNAME VARCHAR(28) DEFAULT 'Chen' key INDEX idx_name INDEX idx_lastname, +-averylonglongfieldname X(1024) DEFAULT 'test', +-price N(7.2) DEFAULT '0.00', +-MYDATE D DEFDATE INDEX idx_date, +-BIGFELLOW X NOTNULL, +-TS_SECS T DEFTIMESTAMP, +-TS_SUBSEC TS DEFTIMESTAMP +-"; +- +- +- $sqla = $dict->CreateDatabase('KUTU',array('postgres'=>"LOCATION='/u01/postdata'")); +- $dict->SetSchema('KUTU'); +- +- $sqli = ($dict->CreateTableSQL('testtable',$flds, $opts)); +- $sqla = array_merge($sqla,$sqli); +- +- $sqli = $dict->CreateIndexSQL('idx','testtable','price,firstname,lastname',array('BITMAP','FULLTEXT','CLUSTERED','HASH')); +- $sqla = array_merge($sqla,$sqli); +- $sqli = $dict->CreateIndexSQL('idx2','testtable','price,lastname');//,array('BITMAP','FULLTEXT','CLUSTERED')); +- $sqla = array_merge($sqla,$sqli); +- +- $addflds = array(array('height', 'F'),array('weight','F')); +- $sqli = $dict->AddColumnSQL('testtable',$addflds); +- $sqla = array_merge($sqla,$sqli); +- $addflds = array(array('height', 'F','NOTNULL'),array('weight','F','NOTNULL')); +- $sqli = $dict->AlterColumnSQL('testtable',$addflds); +- $sqla = array_merge($sqla,$sqli); +- +- +- printsqla($dbType,$sqla); +- +- if (file_exists('d:\inetpub\wwwroot\php\phplens\adodb\adodb.inc.php')) +- if ($dbType == 'mysqlt') { +- $db->Connect('localhost', "root", "", "test"); +- $dict->SetSchema(''); +- $sqla2 = $dict->ChangeTableSQL('adoxyz',$flds); +- if ($sqla2) printsqla($dbType,$sqla2); +- } +- if ($dbType == 'postgres') { +- if (@$db->Connect('localhost', "tester", "test", "test")); +- $dict->SetSchema(''); +- $sqla2 = $dict->ChangeTableSQL('adoxyz',$flds); +- if ($sqla2) printsqla($dbType,$sqla2); +- } +- +- if ($dbType == 'odbc_mssql') { +- $dsn = $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=localhost;Database=northwind;"; +- if (@$db->Connect($dsn, "sa", "natsoft", "test")); +- $dict->SetSchema(''); +- $sqla2 = $dict->ChangeTableSQL('adoxyz',$flds); +- if ($sqla2) printsqla($dbType,$sqla2); +- } +- +- +- +- adodb_pr($dict->databaseType); +- printsqla($dbType, $dict->DropColumnSQL('table',array('my col','`col2_with_Quotes`','A_col3','col3(10)'))); +- printsqla($dbType, $dict->ChangeTableSQL('adoxyz','LASTNAME varchar(32)')); +- +-} +- +-function printsqla($dbType,$sqla) +-{ +- print "

";
+-	//print_r($dict->MetaTables());
+-	foreach($sqla as $s) {
+-		$s = htmlspecialchars($s);
+-		print "$s;\n";
+-		if ($dbType == 'oci8') print "/\n";
+-	}
+-	print "

"; +-} +- +-/*** +- +-Generated SQL: +- +-mysql +- +-CREATE DATABASE KUTU; +-DROP TABLE KUTU.testtable; +-CREATE TABLE KUTU.testtable ( +-id INTEGER NOT NULL AUTO_INCREMENT, +-firstname VARCHAR(30) DEFAULT 'Joan', +-lastname VARCHAR(28) NOT NULL DEFAULT 'Chen', +-averylonglongfieldname LONGTEXT NOT NULL, +-price NUMERIC(7,2) NOT NULL DEFAULT 0.00, +-MYDATE DATE DEFAULT CURDATE(), +- PRIMARY KEY (id, lastname) +-)TYPE=ISAM; +-CREATE FULLTEXT INDEX idx ON KUTU.testtable (firstname,lastname); +-CREATE INDEX idx2 ON KUTU.testtable (price,lastname); +-ALTER TABLE KUTU.testtable ADD height DOUBLE; +-ALTER TABLE KUTU.testtable ADD weight DOUBLE; +-ALTER TABLE KUTU.testtable MODIFY COLUMN height DOUBLE NOT NULL; +-ALTER TABLE KUTU.testtable MODIFY COLUMN weight DOUBLE NOT NULL; +- +- +--------------------------------------------------------------------------------- +- +-oci8 +- +-CREATE USER KUTU IDENTIFIED BY tiger; +-/ +-GRANT CREATE SESSION, CREATE TABLE,UNLIMITED TABLESPACE,CREATE SEQUENCE TO KUTU; +-/ +-DROP TABLE KUTU.testtable CASCADE CONSTRAINTS; +-/ +-CREATE TABLE KUTU.testtable ( +-id NUMBER(16) NOT NULL, +-firstname VARCHAR(30) DEFAULT 'Joan', +-lastname VARCHAR(28) DEFAULT 'Chen' NOT NULL, +-averylonglongfieldname CLOB NOT NULL, +-price NUMBER(7,2) DEFAULT 0.00 NOT NULL, +-MYDATE DATE DEFAULT TRUNC(SYSDATE), +- PRIMARY KEY (id, lastname) +-)TABLESPACE USERS; +-/ +-DROP SEQUENCE KUTU.SEQ_testtable; +-/ +-CREATE SEQUENCE KUTU.SEQ_testtable; +-/ +-CREATE OR REPLACE TRIGGER KUTU.TRIG_SEQ_testtable BEFORE insert ON KUTU.testtable +- FOR EACH ROW +- BEGIN +- select KUTU.SEQ_testtable.nextval into :new.id from dual; +- END; +-/ +-CREATE BITMAP INDEX idx ON KUTU.testtable (firstname,lastname); +-/ +-CREATE INDEX idx2 ON KUTU.testtable (price,lastname); +-/ +-ALTER TABLE testtable ADD ( +- height NUMBER, +- weight NUMBER); +-/ +-ALTER TABLE testtable MODIFY( +- height NUMBER NOT NULL, +- weight NUMBER NOT NULL); +-/ +- +- +--------------------------------------------------------------------------------- +- +-postgres +-AlterColumnSQL not supported for PostgreSQL +- +- +-CREATE DATABASE KUTU LOCATION='/u01/postdata'; +-DROP TABLE KUTU.testtable; +-CREATE TABLE KUTU.testtable ( +-id SERIAL, +-firstname VARCHAR(30) DEFAULT 'Joan', +-lastname VARCHAR(28) DEFAULT 'Chen' NOT NULL, +-averylonglongfieldname TEXT NOT NULL, +-price NUMERIC(7,2) DEFAULT 0.00 NOT NULL, +-MYDATE DATE DEFAULT CURRENT_DATE, +- PRIMARY KEY (id, lastname) +-); +-CREATE INDEX idx ON KUTU.testtable USING HASH (firstname,lastname); +-CREATE INDEX idx2 ON KUTU.testtable (price,lastname); +-ALTER TABLE KUTU.testtable ADD height FLOAT8; +-ALTER TABLE KUTU.testtable ADD weight FLOAT8; +- +- +--------------------------------------------------------------------------------- +- +-odbc_mssql +- +-CREATE DATABASE KUTU; +-DROP TABLE KUTU.testtable; +-CREATE TABLE KUTU.testtable ( +-id INT IDENTITY(1,1) NOT NULL, +-firstname VARCHAR(30) DEFAULT 'Joan', +-lastname VARCHAR(28) DEFAULT 'Chen' NOT NULL, +-averylonglongfieldname TEXT NOT NULL, +-price NUMERIC(7,2) DEFAULT 0.00 NOT NULL, +-MYDATE DATETIME DEFAULT GetDate(), +- PRIMARY KEY (id, lastname) +-); +-CREATE CLUSTERED INDEX idx ON KUTU.testtable (firstname,lastname); +-CREATE INDEX idx2 ON KUTU.testtable (price,lastname); +-ALTER TABLE KUTU.testtable ADD +- height REAL, +- weight REAL; +-ALTER TABLE KUTU.testtable ALTER COLUMN height REAL NOT NULL; +-ALTER TABLE KUTU.testtable ALTER COLUMN weight REAL NOT NULL; +- +- +--------------------------------------------------------------------------------- +-*/ +- +- +-echo "

Test XML Schema

"; +-$ff = file('xmlschema.xml'); +-echo "
";
+-foreach($ff as $xml) echo htmlspecialchars($xml);
+-echo "
"; +-include_once('test-xmlschema.php'); +diff --git tests/test-perf.php tests/test-perf.php +deleted file mode 100644 +index 62465bef..00000000 +--- tests/test-perf.php ++++ /dev/null +@@ -1,48 +0,0 @@ +- $v) { +- if (strncmp($k,'test',4) == 0) $_SESSION['_db'] = $k; +- } +-} +- +-if (isset($_SESSION['_db'])) { +- $_db = $_SESSION['_db']; +- $_GET[$_db] = 1; +- $$_db = 1; +-} +- +-echo "

Performance Monitoring

"; +-include_once('testdatabases.inc.php'); +- +- +-function testdb($db) +-{ +- if (!$db) return; +- echo "";print_r($db->ServerInfo()); echo " user=".$db->user.""; +- +- $perf = NewPerfMonitor($db); +- +- # unit tests +- if (0) { +- //$DB->debug=1; +- echo "Data Cache Size=".$perf->DBParameter('data cache size').'

'; +- echo $perf->HealthCheck(); +- echo($perf->SuspiciousSQL()); +- echo($perf->ExpensiveSQL()); +- echo($perf->InvalidSQL()); +- echo $perf->Tables(); +- +- echo "

";
+-		echo $perf->HealthCheckCLI();
+-		$perf->Poll(3);
+-		die();
+-	}
+-
+-	if ($perf) $perf->UI(3);
+-}
+diff --git tests/test-pgblob.php tests/test-pgblob.php
+deleted file mode 100644
+index 3add99e6..00000000
+--- tests/test-pgblob.php
++++ /dev/null
+@@ -1,86 +0,0 @@
+-Param(false);
+-		$x = (rand() % 10) + 1;
+-		$db->debug= ($i==1);
+-		$id = $db->GetOne($sql,
+-			array('Z%','Z%',$x));
+-		if($id != $offset+$x) {
+-			print "

Error at $x"; +- break; +- } +- } +-} +- +-include_once('../adodb.inc.php'); +-$db = NewADOConnection('postgres7'); +-$db->PConnect('localhost','tester','test','test') || die("failed connection"); +- +-$enc = "GIF89a%01%00%01%00%80%FF%00%C0%C0%C0%00%00%00%21%F9%04%01%00%00%00%00%2C%00%00%00%00%01%00%01%00%00%01%012%00%3Bt_clear.gif%0D"; +-$val = rawurldecode($enc); +- +-$MAX = 1000; +- +-adodb_pr($db->ServerInfo()); +- +-echo "

Testing PREPARE/EXECUTE PLAN

"; +- +- +-$db->_bindInputArray = true; // requires postgresql 7.3+ and ability to modify database +-$t = getmicrotime(); +-doloop(); +-echo '

',$MAX,' times, with plan=',getmicrotime() - $t,'

'; +- +- +-$db->_bindInputArray = false; +-$t = getmicrotime(); +-doloop(); +-echo '

',$MAX,' times, no plan=',getmicrotime() - $t,'

'; +- +- +- +-echo "

Testing UPDATEBLOB

"; +-$db->debug=1; +- +-### TEST BEGINS +- +-$db->Execute("insert into photos (id,name) values(9999,'dot.gif')"); +-$db->UpdateBlob('photos','photo',$val,'id=9999'); +-$v = $db->GetOne('select photo from photos where id=9999'); +- +- +-### CLEANUP +- +-$db->Execute("delete from photos where id=9999"); +- +-### VALIDATION +- +-if ($v !== $val) echo "*** ERROR: Inserted value does not match downloaded val"; +-else echo "*** OK: Passed"; +- +-echo "
";
+-echo "INSERTED: ", $enc;
+-echo "
"; +-echo"RETURNED: ", rawurlencode($v); +-echo "

"; +-echo "INSERTED: ", $val; +-echo "


"; +-echo "RETURNED: ", $v; +diff --git tests/test-php5.php tests/test-php5.php +deleted file mode 100644 +index 1c63f12d..00000000 +--- tests/test-php5.php ++++ /dev/null +@@ -1,116 +0,0 @@ +-PHP ".PHP_VERSION."\n"; +-try { +- +-$dbt = 'oci8po'; +- +-try { +-switch($dbt) { +-case 'oci8po': +- $db = NewADOConnection("oci8po"); +- +- $db->Connect('localhost','scott','natsoft','sherkhan'); +- break; +-default: +-case 'mysql': +- $db = NewADOConnection("mysql"); +- $db->Connect('localhost','root','','northwind'); +- break; +- +-case 'mysqli': +- $db = NewADOConnection("mysqli://root:@localhost/northwind"); +- //$db->Connect('localhost','root','','test'); +- break; +-} +-} catch (exception $e){ +- echo "Connect Failed"; +- adodb_pr($e); +- die(); +-} +- +-$db->debug=1; +- +-$cnt = $db->GetOne("select count(*) from adoxyz where ?Prepare("select * from adoxyz where ?ErrorMsg(),"\n"; +-$rs = $db->Execute($stmt,array(10,20)); +- +-echo "
Foreach Iterator Test (rand=".rand().")
"; +-$i = 0; +-foreach($rs as $v) { +- $i += 1; +- echo "rec $i: "; $s1 = adodb_pr($v,true); $s2 = adodb_pr($rs->fields,true); +- if ($s1 != $s2 && !empty($v)) {adodb_pr($s1); adodb_pr($s2);} +- else echo "passed
"; +- flush(); +-} +- +-$rs = new ADORecordSet_empty(); +-foreach($rs as $v) { +- echo "

empty ";var_dump($v); +-} +- +- +-if ($i != $cnt) die("actual cnt is $i, cnt should be $cnt\n"); +-else echo "Count $i is correct
"; +- +-$rs = $db->Execute("select bad from badder"); +- +-} catch (exception $e) { +- adodb_pr($e); +- echo "

adodb_backtrace:

\n"; +- $e = adodb_backtrace($e->gettrace()); +-} +- +-$rs = $db->Execute("select distinct id, firstname,lastname from adoxyz order by id"); +-echo "Result=\n",$rs,"

"; +- +-echo "

Active Record

"; +- +- include_once("../adodb-active-record.inc.php"); +- ADOdb_Active_Record::SetDatabaseAdapter($db); +- +-try { +- class City extends ADOdb_Active_Record{}; +- $a = new City(); +- +-} catch(exception $e){ +- echo $e->getMessage(); +-} +- +-try { +- +- $a = new City(); +- +- echo "

Successfully created City()
"; +- #var_dump($a->GetPrimaryKeys()); +- $a->city = 'Kuala Lumpur'; +- $a->Save(); +- $a->Update(); +- #$a->SetPrimaryKeys(array('city')); +- $a->country = "M'sia"; +- $a->save(); +- $a->Delete(); +-} catch(exception $e){ +- echo $e->getMessage(); +-} +- +-//include_once("test-active-record.php"); +diff --git tests/test-xmlschema.php tests/test-xmlschema.php +deleted file mode 100644 +index c56cfec8..00000000 +--- tests/test-xmlschema.php ++++ /dev/null +@@ -1,53 +0,0 @@ +-Connect( 'localhost', 'root', '', 'test' ) || die('fail connect1'); +- +-// To create a schema object and build the query array. +-$schema = new adoSchema( $db ); +- +-// To upgrade an existing schema object, use the following +-// To upgrade an existing database to the provided schema, +-// uncomment the following line: +-#$schema->upgradeSchema(); +- +-print "SQL to build xmlschema.xml:\n

";
+-// Build the SQL array
+-$sql = $schema->ParseSchema( "xmlschema.xml" );
+-
+-var_dump( $sql );
+-print "
\n"; +- +-// Execute the SQL on the database +-//$result = $schema->ExecuteSchema( $sql ); +- +-// Finally, clean up after the XML parser +-// (PHP won't do this for you!) +-//$schema->Destroy(); +- +- +- +-print "SQL to build xmlschema-mssql.xml:\n
";
+-
+-$db2 = ADONewConnection('mssql');
+-$db2->Connect('','adodb','natsoft','northwind') || die("Fail 2");
+-
+-$db2->Execute("drop table simple_table");
+-
+-$schema = new adoSchema( $db2 );
+-$sql = $schema->ParseSchema( "xmlschema-mssql.xml" );
+-
+-print_r( $sql );
+-print "
\n"; +- +-$db2->debug=1; +- +-foreach ($sql as $s) +-$db2->Execute($s); +diff --git tests/test.php tests/test.php +deleted file mode 100644 +index 82178864..00000000 +--- tests/test.php ++++ /dev/null +@@ -1,1781 +0,0 @@ +-$msg

"; +- flush(); +-} +- +-function CheckWS($conn) +-{ +-global $ADODB_EXTENSION; +- +- include_once('../session/adodb-session.php'); +- if (defined('CHECKWSFAIL')){ echo " TESTING $conn ";flush();} +- $saved = $ADODB_EXTENSION; +- $db = ADONewConnection($conn); +- $ADODB_EXTENSION = $saved; +- if (headers_sent()) { +- print "

White space detected in adodb-$conn.inc.php or include file...

"; +- //die(); +- } +-} +- +-function do_strtolower(&$arr) +-{ +- foreach($arr as $k => $v) { +- if (is_object($v)) $arr[$k] = adodb_pr($v,true); +- else $arr[$k] = strtolower($v); +- } +-} +- +- +-function CountExecs($db, $sql, $inputarray) +-{ +-global $EXECS; $EXECS++; +-} +- +-function CountCachedExecs($db, $secs2cache, $sql, $inputarray) +-{ +-global $CACHED; $CACHED++; +-} +- +-// the table creation code is specific to the database, so we allow the user +-// to define their own table creation stuff +- +-function testdb(&$db,$createtab="create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)") +-{ +-GLOBAL $ADODB_vers,$ADODB_CACHE_DIR,$ADODB_FETCH_MODE,$ADODB_COUNTRECS; +- +- //adodb_pr($db); +- +-?>
+-

+-
 
+-

+-Execute('select lastname,firstname,lastname,id from ADOXYZ'); +- $arr = $rs->GetAssoc(); +- echo "
";print_r($arr);
+-	die();*/
+-
+-	if (!$db) die("testdb: database not inited");
+-	GLOBAL $EXECS, $CACHED;
+-
+-	$EXECS = 0;
+-	$CACHED = 0;
+-	//$db->Execute("drop table adodb_logsql");
+-	if ((rand()%3) == 0) @$db->Execute("delete from adodb_logsql");
+-	$db->debug=1;
+-
+-	$db->fnExecute = 'CountExecs';
+-	$db->fnCacheExecute = 'CountCachedExecs';
+-
+-	if (empty($_GET['nolog'])) {
+-		echo "

SQL Logging enabled

"; +- $db->LogSQL();/* +- $sql = +-"SELECT t1.sid, t1.sid, t1.title, t1.hometext, t1.notes, t1.aid, t1.informant, +-t2.url, t2.email, t1.catid, t3.title, t1.topic, t4.topicname, t4.topicimage, +-t4.topictext, t1.score, t1.ratings, t1.counter, t1.comments, t1.acomm +-FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_topics` `t4` +- WHERE ((t2.aid=t1.aid) AND (t3.catid=t1.catid) AND (t4.topicid=t1.topic) +- AND ((t1.alanguage='german') OR (t1.alanguage='')) AND (t1.ihome='0')) +- ORDER BY t1.time DESC"; +- $db->SelectLimit($sql); +- echo $db->ErrorMsg();*/ +- } +- $ADODB_CACHE_DIR = dirname(TempNam('/tmp','testadodb')); +- $db->debug = false; +- //print $db->UnixTimeStamp('2003-7-22 23:00:00'); +- +- $phpv = phpversion(); +- if (defined('ADODB_EXTENSION')) $ext = '   Extension '.ADODB_EXTENSION.' installed'; +- else $ext = ''; +- print "

ADODB Version: $ADODB_vers"; +- print "

Host: $db->host"; +- print "
Database: $db->database"; +- print "
PHP: $phpv $ext

"; +- +- flush(); +- +- print "Current timezone: " . date_default_timezone_get() . "

"; +- +- $arr = $db->ServerInfo(); +- print_r($arr); +- echo E_ALL,' ',E_STRICT, "
"; +- $e = error_reporting(E_ALL | E_STRICT); +- echo error_reporting(),'

'; +- flush(); +- #$db->debug=1; +- $tt = $db->Time(); +- if ($tt == 0) echo '
$db->Time failed'; +- else echo "
db->Time: ".date('d-m-Y H:i:s',$tt); +- echo '
'; +- +- echo "Date=",$db->UserDate('2002-04-07'),'
'; +- print "date1 (1969-02-20) = ".$db->DBDate('1969-2-20'); +- print "
date1 (1999-02-20) = ".$db->DBDate('1999-2-20'); +- print "
date1.1 1999 injection attack= ".$db->DBDate("'1999', ' injection attack '"); +- print "
date2 (1970-1-2) = ".$db->DBDate(24*3600)."

"; +- print "ts1 (1999-02-20 13:40:50) = ".$db->DBTimeStamp('1999-2-20 1:40:50 pm'); +- print "
ts1.1 (1999-02-20 13:40:00) = ".$db->DBTimeStamp('1999-2-20 13:40'); +- print "
ts2 (1999-02-20) = ".$db->DBTimeStamp('1999-2-20'); +- print "
ts2 (1999-02-20) = ".$db->DBTimeStamp("'1999-2-20', 'injection attack'"); +- print "
ts3 (1970-1-2 +/- timezone) = ".$db->DBTimeStamp(24*3600); +- print "
Fractional TS (1999-2-20 13:40:50.91): ".$db->DBTimeStamp($db->UnixTimeStamp('1999-2-20 13:40:50.91+1')); +- $dd = $db->UnixDate('1999-02-20'); +- print "
unixdate 1999-02-20 = ".date('Y-m-d',$dd)."

"; +- print "
ts4 =".($db->UnixTimeStamp("19700101000101")+8*3600); +- print "
ts5 =".$db->DBTimeStamp($db->UnixTimeStamp("20040110092123")); +- print "
ts6 =".$db->UserTimeStamp("20040110092123"); +- print "
ts7 =".$db->DBTimeStamp("20040110092123"); +- flush(); +- // mssql too slow in failing bad connection +- if (false && $db->databaseType != 'mssql') { +- print "

Testing bad connection. Ignore following error msgs:
"; +- $db2 = ADONewConnection(); +- $rez = $db2->Connect("bad connection"); +- $err = $db2->ErrorMsg(); +- print "Error='$err'

"; +- if ($rez) print "Cannot check if connection failed. The Connect() function returned true.

"; +- } +- #error_reporting($e); +- flush(); +- +- //$ADODB_COUNTRECS=false; +- $rs=$db->Execute('select * from ADOXYZ order by id'); +- if($rs === false) $create = true; +- else $rs->Close(); +- +- //if ($db->databaseType !='vfp') $db->Execute("drop table ADOXYZ"); +- +- if ($create) { +- if (false && $db->databaseType == 'ibase') { +- print "Please create the following table for testing:

$createtab

"; +- return; +- } else { +- $db->debug = 99; +- # $e = error_reporting(E_ALL-E_WARNING); +- $db->Execute($createtab); +- # error_reporting($e); +- } +- } +- #error_reporting(E_ALL); +- echo "

Testing Metatypes

"; +- $t = $db->MetaType('varchar'); +- if ($t != 'C') Err("Bad Metatype for varchar"); +- +- $rs = $db->Execute("delete from ADOXYZ"); // some ODBC drivers will fail the drop so we delete +- if ($rs) { +- if(! $rs->EOF) print "Error: RecordSet returned by Execute('delete...') should show EOF

"; +- $rs->Close(); +- } else print "err=".$db->ErrorMsg(); +- +- print "

Test select on empty table, FetchField when EOF, and GetInsertSQL

"; +- $rs = $db->Execute("select id,firstname from ADOXYZ where id=9999"); +- if ($rs && !$rs->EOF) print "Error: RecordSet returned by Execute(select...') on empty table should show EOF

"; +- if ($rs->EOF && (($ox = $rs->FetchField(0)) && !empty($ox->name))) { +- $record['id'] = 99; +- $record['firstname'] = 'John'; +- $sql = $db->GetInsertSQL($rs, $record); +- if (strtoupper($sql) != strtoupper("INSERT INTO ADOXYZ ( id, firstname ) VALUES ( 99, 'John' )")) Err("GetInsertSQL does not work on empty table: $sql"); +- } else { +- Err("FetchField does not work on empty recordset, meaning GetInsertSQL will fail..."); +- } +- if ($rs) $rs->Close(); +- flush(); +- //$db->debug=true; +- print "

Testing Commit: "; +- $time = $db->DBDate(time()); +- if (!$db->BeginTrans()) { +- print 'Transactions not supported

'; +- if ($db->hasTransactions) Err("hasTransactions should be false"); +- } else { /* COMMIT */ +- if (!$db->hasTransactions) Err("hasTransactions should be true"); +- if ($db->transCnt != 1) Err("Invalid transCnt = $db->transCnt (should be 1)"); +- $rs = $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values (99,'Should Not','Exist (Commit)',$time)"); +- if ($rs && $db->CommitTrans()) { +- $rs->Close(); +- $rs = $db->Execute("select * from ADOXYZ where id=99"); +- if ($rs === false || $rs->EOF) { +- print 'Data not saved

'; +- $rs = $db->Execute("select * from ADOXYZ where id=99"); +- print_r($rs); +- die(); +- } else print 'OK

'; +- if ($rs) $rs->Close(); +- } else { +- if (!$rs) { +- print "Insert failed

"; +- $db->RollbackTrans(); +- } else print "Commit failed

"; +- } +- if ($db->transCnt != 0) Err("Invalid transCnt = $db->transCnt (should be 0)"); +- +- /* ROLLBACK */ +- if (!$db->BeginTrans()) print "

Error in BeginTrans()

"; +- print "

Testing Rollback: "; +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values (100,'Should Not','Exist (Rollback)',$time)"); +- if ($db->RollbackTrans()) { +- $rs = $db->Execute("select * from ADOXYZ where id=100"); +- if ($rs && !$rs->EOF) print 'Fail: Data should rollback

'; +- else print 'OK

'; +- if ($rs) $rs->Close(); +- } else +- print "Commit failed

"; +- +- $rs = $db->Execute('delete from ADOXYZ where id>50'); +- if ($rs) $rs->Close(); +- +- if ($db->transCnt != 0) Err("Invalid transCnt = $db->transCnt (should be 0)"); +- } +- +- if (1) { +- print "

Testing MetaDatabases()

"; +- print_r( $db->MetaDatabases()); +- +- print "

Testing MetaTables() and MetaColumns()

"; +- $a = $db->MetaTables(); +- if ($a===false) print "MetaTables not supported

"; +- else { +- print "Array of tables and views: "; +- foreach($a as $v) print " ($v) "; +- print '

'; +- } +- +- $a = $db->MetaTables('VIEW'); +- if ($a===false) print "MetaTables not supported (views)

"; +- else { +- print "Array of views: "; +- foreach($a as $v) print " ($v) "; +- print '

'; +- } +- +- $a = $db->MetaTables(false,false,'aDo%'); +- if ($a===false) print "MetaTables not supported (mask)

"; +- else { +- print "Array of ado%: "; +- foreach($a as $v) print " ($v) "; +- print '

'; +- } +- +- $a = $db->MetaTables('TABLE'); +- if ($a===false) print "MetaTables not supported

"; +- else { +- print "Array of tables: "; +- foreach($a as $v) print " ($v) "; +- print '

'; +- } +- +- $db->debug=0; +- $rez = $db->MetaColumns("NOSUCHTABLEHERE"); +- if ($rez !== false) { +- Err("MetaColumns error handling failed"); +- var_dump($rez); +- } +- $db->debug=1; +- $a = $db->MetaColumns('ADOXYZ'); +- if ($a===false) print "MetaColumns not supported

"; +- else { +- print "

Columns of ADOXYZ:
"; +- foreach($a as $v) {print_r($v); echo "
";} +- echo "
"; +- } +- +- print "

Testing MetaIndexes

"; +- +- $a = $db->MetaIndexes(('ADOXYZ'),true); +- if ($a===false) print "MetaIndexes not supported

"; +- else { +- print "

Indexes of ADOXYZ:
"; +- adodb_pr($a); +- echo "
"; +- } +- print "

Testing MetaPrimaryKeys

"; +- $a = $db->MetaPrimaryKeys('ADOXYZ'); +- var_dump($a); +- } +- $rs = $db->Execute('delete from ADOXYZ'); +- if ($rs) $rs->Close(); +- +- $db->debug = false; +- +- +- switch ($db->databaseType) { +- case 'vfp': +- +- if (0) { +- // memo test +- $rs = $db->Execute("select data from memo"); +- rs2html($rs); +- } +- break; +- +- case 'postgres7': +- case 'postgres64': +- case 'postgres': +- case 'ibase': +- print "

Encode=".$db->BlobEncode("abc\0d\"' +-ef")."

";//' +- +- print "

Testing Foreign Keys

"; +- $arr = $db->MetaForeignKeys('ADOXYZ',false,true); +- print_r($arr); +- if (!$arr) Err("No MetaForeignKeys"); +- break; +- +- case 'odbc_mssql': +- case 'mssqlpo': +- print "

Testing Foreign Keys

"; +- $arr = $db->MetaForeignKeys('Orders',false,true); +- print_r($arr); +- if (!$arr) Err("Bad MetaForeignKeys"); +- if ($db->databaseType == 'odbc_mssql') break; +- +- case 'mssql': +- +- +-/* +-ASSUME Northwind available... +- +-CREATE PROCEDURE SalesByCategory +- @CategoryName nvarchar(15), @OrdYear nvarchar(4) = '1998' +-AS +-IF @OrdYear != '1996' AND @OrdYear != '1997' AND @OrdYear != '1998' +-BEGIN +- SELECT @OrdYear = '1998' +-END +- +-SELECT ProductName, +- TotalPurchase=ROUND(SUM(CONVERT(decimal(14,2), OD.Quantity * (1-OD.Discount) * OD.UnitPrice)), 0) +-FROM [Order Details] OD, Orders O, Products P, Categories C +-WHERE OD.OrderID = O.OrderID +- AND OD.ProductID = P.ProductID +- AND P.CategoryID = C.CategoryID +- AND C.CategoryName = @CategoryName +- AND SUBSTRING(CONVERT(nvarchar(22), O.OrderDate, 111), 1, 4) = @OrdYear +-GROUP BY ProductName +-ORDER BY ProductName +-GO +- +- +-CREATE PROCEDURE ADODBTestSP +-@a nvarchar(25) +-AS +-SELECT GETDATE() AS T, @a AS A +-GO +-*/ +- print "

Testing Stored Procedures for mssql

"; +- $saved = $db->debug; +- $db->debug=true; +- $assoc = $ADODB_FETCH_MODE; +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $cmd = $db->PrepareSP('ADODBTestSP'); +- $ss = "You should see me in the output."; +- $db->InParameter($cmd,$ss,'a'); +- $rs = $db->Execute($cmd); +- #var_dump($rs->fields); +- echo $rs->fields['T']." --- ".$rs->fields['A']."---
"; +- +- $cat = 'Dairy Products'; +- $yr = '1998'; +- +- $stmt = $db->PrepareSP('SalesByCategory'); +- $db->InParameter($stmt,$cat,'CategoryName'); +- $db->InParameter($stmt,$yr,'OrdYear'); +- $rs = $db->Execute($stmt); +- rs2html($rs); +- +- $cat = 'Grains/Cereals'; +- $yr = 1998; +- +- $stmt = $db->PrepareSP('SalesByCategory'); +- $db->InParameter($stmt,$cat,'CategoryName'); +- $db->InParameter($stmt,$yr,'OrdYear'); +- $rs = $db->Execute($stmt); +- rs2html($rs); +- +- $ADODB_FETCH_MODE = $assoc; +- +- /* +- Test out params - works in PHP 4.2.3 and 4.3.3 and 4.3.8 but not 4.3.0: +- +- CREATE PROCEDURE at_date_interval +- @days INTEGER, +- @start VARCHAR(20) OUT, +- @end VARCHAR(20) OUT +- AS +- BEGIN +- set @start = CONVERT(VARCHAR(20), getdate(), 101) +- set @end =CONVERT(VARCHAR(20), dateadd(day, @days, getdate()), 101 ) +- END +- GO +- */ +- $db->debug=1; +- $stmt = $db->PrepareSP('at_date_interval'); +- $days = 10; +- $begin_date = ''; +- $end_date = ''; +- $db->InParameter($stmt,$days,'days', 4, SQLINT4); +- $db->OutParameter($stmt,$begin_date,'start', 20, SQLVARCHAR ); +- $db->OutParameter($stmt,$end_date,'end', 20, SQLVARCHAR ); +- $db->Execute($stmt); +- if (empty($begin_date) or empty($end_date) or $begin_date == $end_date) { +- Err("MSSQL SP Test for OUT Failed"); +- print "begin=$begin_date end=$end_date

"; +- } else print "(Today +10days) = (begin=$begin_date end=$end_date)

"; +- +- $db->debug = $saved; +- break; +- case 'oci8': +- case 'oci8po': +- +- if (0) { +- $t = getmicrotime(); +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- $arr = $db->GetArray('select * from abalone_tree'); +- $arr = $db->GetArray('select * from abalone_tree'); +- $arr = $db->GetArray('select * from abalone_tree'); +- echo "

t = ",getmicrotime() - $t,"

"; +- die(); +- } +- +- # cleanup +- $db->Execute("delete from photos where id=99 or id=1"); +- $db->Execute("insert into photos (id) values(1)"); +- $db->Execute("update photos set photo=null,descclob=null where id=1"); +- +- $saved = $db->debug; +- $db->debug=true; +- +- +- +- /* +- CREATE TABLE PHOTOS +- ( +- ID NUMBER(16) primary key, +- PHOTO BLOB, +- DESCRIPTION VARCHAR2(4000 BYTE), +- DESCCLOB CLOB +- ); +- +- INSERT INTO PHOTOS (ID) VALUES(1); +- */ +- $s = ''; +- for ($i = 0; $i <= 500; $i++) { +- $s .= '1234567890'; +- } +- +- $sql = "INSERT INTO photos ( ID, photo) ". +- "VALUES ( :id, empty_blob() )". +- " RETURNING photo INTO :xx"; +- +- +- $blob_data = $s; +- $id = 99; +- +- $stmt = $db->PrepareSP($sql); +- $db->InParameter($stmt, $id, 'id'); +- $blob = $db->InParameter($stmt, $s, 'xx',-1, OCI_B_BLOB); +- $db->StartTrans(); +- $result = $db->Execute($stmt); +- $db->CompleteTrans(); +- +- $s2= $db->GetOne("select photo from photos where id=99"); +- echo "
---$s2"; +- if ($s !== $s2) Err("insert blob does not match"); +- +- print "

Testing Blob: size=".strlen($s)."

"; +- $ok = $db->Updateblob('photos','photo',$s,'id=1'); +- if (!$ok) Err("Blob failed 1"); +- else { +- $s2= $db->GetOne("select photo from photos where id=1"); +- if ($s !== $s2) Err("updateblob does not match"); +- } +- +- print "

Testing Clob: size=".strlen($s)."

"; +- $ok = $db->UpdateClob('photos','descclob',$s,'id=1'); +- if (!$ok) Err("Clob failed 1"); +- else { +- $s2= $db->GetOne("select descclob from photos where id=1"); +- if ($s !== $s2) Err("updateclob does not match"); +- } +- +- +- $s = ''; +- $s2 = ''; +- print "

Testing Foreign Keys

"; +- $arr = $db->MetaForeignKeys('emp','scott'); +- print_r($arr); +- if (!$arr) Err("Bad MetaForeignKeys"); +-/* +--- TEST PACKAGE +--- "Set scan off" turns off substitution variables. +-Set scan off; +- +-CREATE OR REPLACE PACKAGE Adodb AS +-TYPE TabType IS REF CURSOR RETURN TAB%ROWTYPE; +-PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames IN VARCHAR); +-PROCEDURE open_tab2 (tabcursor IN OUT TabType,tablenames IN OUT VARCHAR) ; +-PROCEDURE data_out(input IN VARCHAR, output OUT VARCHAR); +-PROCEDURE data_in(input IN VARCHAR); +-PROCEDURE myproc (p1 IN NUMBER, p2 OUT NUMBER); +-END Adodb; +-/ +- +- +-CREATE OR REPLACE PACKAGE BODY Adodb AS +-PROCEDURE open_tab (tabcursor IN OUT TabType,tablenames IN VARCHAR) IS +- BEGIN +- OPEN tabcursor FOR SELECT * FROM TAB WHERE tname LIKE tablenames; +- END open_tab; +- +- PROCEDURE open_tab2 (tabcursor IN OUT TabType,tablenames IN OUT VARCHAR) IS +- BEGIN +- OPEN tabcursor FOR SELECT * FROM TAB WHERE tname LIKE tablenames; +- tablenames := 'TEST'; +- END open_tab2; +- +-PROCEDURE data_out(input IN VARCHAR, output OUT VARCHAR) IS +- BEGIN +- output := 'Cinta Hati '||input; +- END; +- +-PROCEDURE data_in(input IN VARCHAR) IS +- ignore varchar(1000); +- BEGIN +- ignore := input; +- END; +- +-PROCEDURE myproc (p1 IN NUMBER, p2 OUT NUMBER) AS +-BEGIN +-p2 := p1; +-END; +-END Adodb; +-/ +- +-*/ +- +- print "

Testing Cursor Variables

"; +- $rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:zz,'A%'); END;",'zz'); +- +- if ($rs && !$rs->EOF) { +- $v = $db->GetOne("SELECT count(*) FROM tab where tname like 'A%'"); +- if ($v == $rs->RecordCount()) print "Test 1 RowCount: OK

"; +- else Err("Test 1 RowCount ".$rs->RecordCount().", actual = $v"); +- } else { +- print "Error in using Cursor Variables 1

"; +- } +- if ($rs) $rs->Close(); +- +- print "

Testing Stored Procedures for oci8

"; +- +- $stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;"); +- $a1 = 'Malaysia'; +- //$a2 = ''; # a2 doesn't even need to be defined! +- $db->InParameter($stmt,$a1,'a1'); +- $db->OutParameter($stmt,$a2,'a2'); +- $rs = $db->Execute($stmt); +- if ($rs) { +- if ($a2 !== 'Cinta Hati Malaysia') print "Stored Procedure Error: a2 = $a2

"; +- else echo "OK: a2=$a2

"; +- } else { +- print "Error in using Stored Procedure IN/Out Variables

"; +- } +- +- $tname = 'A%'; +- +- $stmt = $db->PrepareSP('select * from tab where tname like :tablename'); +- $db->Parameter($stmt,$tname,'tablename'); +- $rs = $db->Execute($stmt); +- rs2html($rs); +- +- $stmt = $db->PrepareSP("begin adodb.data_in(:a1); end;"); +- $db->InParameter($stmt,$a1,'a1'); +- $db->Execute($stmt); +- +- $db->debug = $saved; +- break; +- +- default: +- break; +- } +- $arr = array( +- array(1,'Caroline','Miranda'), +- array(2,'John','Lim'), +- array(3,'Wai Hun','See') +- ); +- //$db->debug=1; +- print "

Testing Bulk Insert of 3 rows

"; +- +-// $db->debug=1; +-// $db->Execute('select * from table where val=? AND value=?', array('val'=>'http ://www.whatever.com/test?=21', 'value'=>'blabl')); +- +- +- $sql = "insert into ADOXYZ (id,firstname,lastname) values (".$db->Param('0').",".$db->Param('1').",".$db->Param('2').")"; +- $db->bulkBind = true; +- $db->StartTrans(); +- $db->debug=99; +- $db->Execute($sql,$arr); +- $db->CompleteTrans(); +- $db->bulkBind = false; +- $rs = $db->Execute('select * from ADOXYZ order by id'); +- if (!$rs || $rs->RecordCount() != 3) Err("Bad bulk insert"); +- +- rs2html($rs); +- +- $db->Execute('delete from ADOXYZ'); +- +- print "

Inserting 50 rows

"; +- +- for ($i = 0; $i < 5; $i++) { +- +- $time = $db->DBDate(time()); +- if (empty($_GET['hide'])) $db->debug = true; +- switch($db->databaseType){ +- case 'mssqlpo': +- case 'mssql': +- $sqlt = "CREATE TABLE mytable ( +- row1 INT IDENTITY(1,1) NOT NULL, +- row2 varchar(16), +- PRIMARY KEY (row1))"; +- //$db->debug=1; +- if (!$db->Execute("delete from mytable")) +- $db->Execute($sqlt); +- +- $ok = $db->Execute("insert into mytable (row2) values ('test')"); +- $ins_id=$db->Insert_ID(); +- echo "Insert ID=";var_dump($ins_id); +- if ($ins_id == 0) Err("Bad Insert_ID()"); +- $ins_id2 = $db->GetOne("select row1 from mytable"); +- if ($ins_id != $ins_id2) Err("Bad Insert_ID() 2"); +- +- $arr = array(0=>'Caroline',1=>'Miranda'); +- $sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,?,?,$time)"; +- break; +- case 'mysqli': +- case 'mysqlt': +- case 'mysql': +- $sqlt = "CREATE TABLE `mytable` ( +- `row1` int(11) NOT NULL auto_increment, +- `row2` varchar(16) NOT NULL default '', +- PRIMARY KEY (`row1`), +- KEY `myindex` (`row1`,`row2`) +-) "; +- if (!$db->Execute("delete from mytable")) +- $db->Execute($sqlt); +- +- $ok = $db->Execute("insert into mytable (row2) values ('test')"); +- $ins_id=$db->Insert_ID(); +- echo "Insert ID=";var_dump($ins_id); +- if ($ins_id == 0) Err("Bad Insert_ID()"); +- $ins_id2 = $db->GetOne("select row1 from mytable"); +- if ($ins_id != $ins_id2) Err("Bad Insert_ID() 2"); +- +- default: +- $arr = array(0=>'Caroline',1=>'Miranda'); +- $sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,?,?,$time)"; +- break; +- +- case 'oci8': +- case 'oci805': +- $arr = array('first'=>'Caroline','last'=>'Miranda'); +- $amt = rand() % 100; +- $sql = "insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+0,:first,:last,$time)"; +- break; +- } +- if ($i & 1) { +- $sql = $db->Prepare($sql); +- } +- $rs = $db->Execute($sql,$arr); +- +- if ($rs === false) Err( 'Error inserting with parameters'); +- else $rs->Close(); +- $db->debug = false; +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+1,'John','Lim',$time)"); +- /*$ins_id=$db->Insert_ID(); +- echo "Insert ID=";var_dump($ins_id);*/ +- if ($db->databaseType == 'mysql') if ($ins_id == 0) Err('Bad Insert_ID'); +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+2,'Mary','Lamb',$time )"); +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+3,'George','Washington',$time )"); +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+4,'Mr. Alan','Tam',$time )"); +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+5,'Alan',".$db->quote("Turing'ton").",$time )"); +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created)values ($i*10+6,'Serena','Williams',$time )"); +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+7,'Yat Sun','Sun',$time )"); +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+8,'Wai Hun','See',$time )"); +- $db->Execute("insert into ADOXYZ (id,firstname,lastname,created) values ($i*10+9,'Steven','Oey',$time )"); +- } // for +- if (1) { +- $db->debug=1; +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $cnt = $db->GetOne("select count(*) from ADOXYZ"); +- $rs = $db->Execute('update ADOXYZ set id=id+1'); +- if (!is_object($rs)) { +- print_r($rs); +- err("Update should return object"); +- } +- if (!$rs) err("Update generated error"); +- +- $nrows = $db->Affected_Rows(); +- if ($nrows === false) print "

Affected_Rows() not supported

"; +- else if ($nrows != $cnt) print "

Affected_Rows() Error: $nrows returned (should be 50)

"; +- else print "

Affected_Rows() passed

"; +- } +- +- if ($db->dataProvider == 'oci8') $array = array('zid'=>1,'zdate'=>date('Y-m-d',time())); +- else $array=array(1,date('Y-m-d',time())); +- +- +- #$array = array(1,date('Y-m-d',time())); +- $id = $db->GetOne("select id from ADOXYZ +- where id=".$db->Param('zid')." and created>=".$db->Param('ZDATE')."", +- $array); +- if ($id != 1) Err("Bad bind; id=$id"); +- else echo "
Bind date/integer 1 passed"; +- +- $array =array(1,$db->BindDate(time())); +- $id = $db->GetOne("select id from ADOXYZ +- where id=".$db->Param('0')." and created>=".$db->Param('1')."", +- $array); +- if ($id != 1) Err("Bad bind; id=$id"); +- else echo "
Bind date/integer 2 passed"; +- +- $db->debug = false; +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- ////////////////////////////////////////////////////////////////////////////////////////// +- +- $rs = $db->Execute("select * from ADOXYZ where firstname = 'not known'"); +- if (!$rs || !$rs->EOF) print "

Error on empty recordset

"; +- else if ($rs->RecordCount() != 0) { +- print "

Error on RecordCount. Should be 0. Was ".$rs->RecordCount()."

"; +- print_r($rs->fields); +- } +- if ($db->databaseType !== 'odbc') { +- $rs = $db->Execute("select id,firstname,lastname,created,".$db->random." from ADOXYZ order by id"); +- if ($rs) { +- if ($rs->RecordCount() != 50) { +- print "

RecordCount returns ".$rs->RecordCount().", should be 50

"; +- adodb_pr($rs->GetArray()); +- $poc = $rs->PO_RecordCount('ADOXYZ'); +- if ($poc == 50) print "

    PO_RecordCount passed

"; +- else print "

PO_RecordCount returns wrong value: $poc

"; +- } else print "

RecordCount() passed

"; +- if (isset($rs->fields['firstname'])) print '

The fields columns can be indexed by column name.

'; +- else { +- Err( '

The fields columns cannot be indexed by column name.

'); +- print_r($rs->fields); +- } +- if (empty($_GET['hide'])) rs2html($rs); +- } +- else print "

Error in Execute of SELECT with random

"; +- } +- $val = $db->GetOne("select count(*) from ADOXYZ"); +- if ($val == 50) print "

GetOne returns ok

"; +- else print "

Fail: GetOne returns $val

"; +- +- echo "GetRow Test"; +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- $val1 = $db->GetRow("select count(*) from ADOXYZ"); +- $val2 = $db->GetRow("select count(*) from ADOXYZ"); +- if ($val1[0] == 50 and sizeof($val1) == 1 and $val2[0] == 50 and sizeof($val2) == 1) print "

GetRow returns ok

"; +- else { +- print_r($val); +- print "

Fail: GetRow returns {$val2[0]}

"; +- } +- +- print "

FetchObject/FetchNextObject Test

"; +- $rs = $db->Execute('select * from ADOXYZ'); +- if ($rs) { +- if (empty($rs->connection)) print "Connection object missing from recordset
"; +- +- while ($o = $rs->FetchNextObject()) { // calls FetchObject internally +- if (!is_string($o->FIRSTNAME) || !is_string($o->LASTNAME)) { +- print_r($o); +- print "

Firstname is not string

"; +- break; +- } +- } +- } else { +- print "

Failed rs

"; +- die("

ADOXYZ table cannot be read - die()"); +- } +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- print "

FetchObject/FetchNextObject Test 2

"; +- #$db->debug=99; +- $rs = $db->Execute('select * from ADOXYZ'); +- if (empty($rs->connection)) print "Connection object missing from recordset
"; +- print_r($rs->fields); +- while ($o = $rs->FetchNextObject()) { // calls FetchObject internally +- if (!is_string($o->FIRSTNAME) || !is_string($o->LASTNAME)) { +- print_r($o); +- print "

Firstname is not string

"; +- break; +- } +- } +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- +- $savefetch = $ADODB_FETCH_MODE; +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- +- print "

CacheSelectLimit Test...

"; +- $rs = $db->CacheSelectLimit('select id, firstname from ADOXYZ order by id',2); +- +- if (ADODB_ASSOC_CASE == 2 || $db->dataProvider == 'oci8') { +- $id = 'ID'; +- $fname = 'FIRSTNAME'; +- }else { +- $id = 'id'; +- $fname = 'firstname'; +- } +- +- +- if ($rs && !$rs->EOF) { +- if (isset($rs->fields[0])) { +- Err("ASSOC has numeric fields"); +- print_r($rs->fields); +- } +- if ($rs->fields[$id] != 1) {Err("Error"); print_r($rs->fields);}; +- if (trim($rs->fields[$fname]) != 'Caroline') {print Err("Error 2"); print_r($rs->fields);}; +- +- $rs->MoveNext(); +- if ($rs->fields[$id] != 2) {Err("Error 3"); print_r($rs->fields);}; +- $rs->MoveNext(); +- if (!$rs->EOF) { +- Err("Error EOF"); +- print_r($rs); +- } +- } +- +- print "

FETCH_MODE = ASSOC: Should get 1, Caroline ASSOC_CASE=".ADODB_ASSOC_CASE."

"; +- $rs = $db->SelectLimit('select id,firstname from ADOXYZ order by id',2); +- if ($rs && !$rs->EOF) { +- +- if ($rs->fields[$id] != 1) {Err("Error 1"); print_r($rs->fields);}; +- if (trim($rs->fields[$fname]) != 'Caroline') {Err("Error 2"); print_r($rs->fields);}; +- $rs->MoveNext(); +- if ($rs->fields[$id] != 2) {Err("Error 3"); print_r($rs->fields);}; +- $rs->MoveNext(); +- if (!$rs->EOF) Err("Error EOF"); +- else if (is_array($rs->fields) || $rs->fields) { +- Err("Error: ## fields should be set to false on EOF"); +- print_r($rs->fields); +- } +- } +- +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- print "

FETCH_MODE = NUM: Should get 1, Caroline

"; +- $rs = $db->SelectLimit('select id,firstname from ADOXYZ order by id',1); +- if ($rs && !$rs->EOF) { +- if (isset($rs->fields[$id])) Err("FETCH_NUM has ASSOC fields"); +- if ($rs->fields[0] != 1) {Err("Error 1"); print_r($rs->fields);}; +- if (trim($rs->fields[1]) != 'Caroline') {Err("Error 2");print_r($rs->fields);}; +- $rs->MoveNext(); +- if (!$rs->EOF) Err("Error EOF"); +- +- } +- $ADODB_FETCH_MODE = $savefetch; +- +- $db->debug = false; +- print "

GetRowAssoc Upper: Should get 1, Caroline

"; +- $rs = $db->SelectLimit('select id,firstname from ADOXYZ order by id',1); +- if ($rs && !$rs->EOF) { +- $arr = $rs->GetRowAssoc(ADODB_ASSOC_CASE_UPPER); +- +- if ($arr[strtoupper($id)] != 1) {Err("Error 1");print_r($arr);}; +- if (trim($arr[strtoupper($fname)]) != 'Caroline') {Err("Error 2"); print_r($arr);}; +- $rs->MoveNext(); +- if (!$rs->EOF) Err("Error EOF"); +- +- } +- print "

GetRowAssoc Lower: Should get 1, Caroline

"; +- $rs = $db->SelectLimit('select id,firstname from ADOXYZ order by id',1); +- if ($rs && !$rs->EOF) { +- $arr = $rs->GetRowAssoc(ADODB_ASSOC_CASE_LOWER); +- if ($arr['id'] != 1) {Err("Error 1"); print_r($arr);}; +- if (trim($arr['firstname']) != 'Caroline') {Err("Error 2"); print_r($arr);}; +- +- } +- +- print "

GetCol Test

"; +- $col = $db->GetCol('select distinct firstname from ADOXYZ order by 1'); +- if (!is_array($col)) Err("Col size is wrong"); +- if (trim($col[0]) != 'Alan' or trim($col[9]) != 'Yat Sun') Err("Col elements wrong"); +- +- +- $col = $db->CacheGetCol('select distinct firstname from ADOXYZ order by 1'); +- if (!is_array($col)) Err("Col size is wrong"); +- if (trim($col[0]) != 'Alan' or trim($col[9]) != 'Yat Sun') Err("Col elements wrong"); +- +- $db->debug = true; +- +- +- echo "

Date Update Test

"; +- $zdate = date('Y-m-d',time()+3600*24); +- $zdate = $db->DBDate($zdate); +- $db->Execute("update ADOXYZ set created=$zdate where id=1"); +- $row = $db->GetRow("select created,firstname from ADOXYZ where id=1"); +- print_r($row); echo "
"; +- +- +- +- print "

SelectLimit Distinct Test 1: Should see Caroline, John and Mary

"; +- $rs = $db->SelectLimit('select distinct * from ADOXYZ order by id',3); +- +- +- if ($rs && !$rs->EOF) { +- if (trim($rs->fields[1]) != 'Caroline') Err("Error 1 (exp Caroline), ".$rs->fields[1]); +- $rs->MoveNext(); +- +- if (trim($rs->fields[1]) != 'John') Err("Error 2 (exp John), ".$rs->fields[1]); +- $rs->MoveNext(); +- if (trim($rs->fields[1]) != 'Mary') Err("Error 3 (exp Mary),".$rs->fields[1]); +- $rs->MoveNext(); +- if (! $rs->EOF) Err("Error EOF"); +- //rs2html($rs); +- } else Err("Failed SelectLimit Test 1"); +- +- print "

SelectLimit Test 2: Should see Mary, George and Mr. Alan

"; +- $rs = $db->SelectLimit('select * from ADOXYZ order by id',3,2); +- if ($rs && !$rs->EOF) { +- if (trim($rs->fields[1]) != 'Mary') Err("Error 1 - No Mary, instead: ".$rs->fields[1]); +- $rs->MoveNext(); +- if (trim($rs->fields[1]) != 'George')Err("Error 2 - No George, instead: ".$rs->fields[1]); +- $rs->MoveNext(); +- if (trim($rs->fields[1]) != 'Mr. Alan') Err("Error 3 - No Mr. Alan, instead: ".$rs->fields[1]); +- $rs->MoveNext(); +- if (! $rs->EOF) Err("Error EOF"); +- // rs2html($rs); +- } +- else Err("Failed SelectLimit Test 2 ". ($rs ? 'EOF':'no RS')); +- +- print "

SelectLimit Test 3: Should see Wai Hun and Steven

"; +- $db->debug=1; +- global $A; $A=1; +- $rs = $db->SelectLimit('select * from ADOXYZ order by id',-1,48); +- $A=0; +- if ($rs && !$rs->EOF) { +- if (empty($rs->connection)) print "Connection object missing from recordset
"; +- if (trim($rs->fields[1]) != 'Wai Hun') Err("Error 1 ".$rs->fields[1]); +- $rs->MoveNext(); +- if (trim($rs->fields[1]) != 'Steven') Err("Error 2 ".$rs->fields[1]); +- $rs->MoveNext(); +- if (! $rs->EOF) { +- Err("Error EOF"); +- } +- //rs2html($rs); +- } +- else Err("Failed SelectLimit Test 3"); +- $db->debug = false; +- +- +- $rs = $db->Execute("select * from ADOXYZ order by id"); +- print "

Testing Move()

"; +- if (!$rs)Err( "Failed Move SELECT"); +- else { +- if (!$rs->Move(2)) { +- if (!$rs->canSeek) print "

$db->databaseType: Move(), MoveFirst() nor MoveLast() not supported.

"; +- else print '

RecordSet->canSeek property should be set to false

'; +- } else { +- $rs->MoveFirst(); +- if (trim($rs->Fields("firstname")) != 'Caroline') { +- print "

$db->databaseType: MoveFirst failed -- probably cannot scroll backwards

"; +- } +- else print "MoveFirst() OK
"; +- +- // Move(3) tests error handling -- MoveFirst should not move cursor +- $rs->Move(3); +- if (trim($rs->Fields("firstname")) != 'George') { +- print '

'.$rs->Fields("id")."$db->databaseType: Move(3) failed

"; +- } else print "Move(3) OK
"; +- +- $rs->Move(7); +- if (trim($rs->Fields("firstname")) != 'Yat Sun') { +- print '

'.$rs->Fields("id")."$db->databaseType: Move(7) failed

"; +- print_r($rs); +- } else print "Move(7) OK
"; +- if ($rs->EOF) Err("Move(7) is EOF already"); +- $rs->MoveLast(); +- if (trim($rs->Fields("firstname")) != 'Steven'){ +- print '

'.$rs->Fields("id")."$db->databaseType: MoveLast() failed

"; +- print_r($rs); +- }else print "MoveLast() OK
"; +- $rs->MoveNext(); +- if (!$rs->EOF) err("Bad MoveNext"); +- if ($rs->canSeek) { +- $rs->Move(3); +- if (trim($rs->Fields("firstname")) != 'George') { +- print '

'.$rs->Fields("id")."$db->databaseType: Move(3) after MoveLast failed

"; +- +- } else print "Move(3) after MoveLast() OK
"; +- } +- +- print "

Empty Move Test"; +- $rs = $db->Execute("select * from ADOXYZ where id > 0 and id < 0"); +- $rs->MoveFirst(); +- if (!$rs->EOF || $rs->fields) Err("Error in empty move first"); +- } +- } +- +- $rs = $db->Execute('select * from ADOXYZ where id = 2'); +- if ($rs->EOF || !is_array($rs->fields)) Err("Error in select"); +- $rs->MoveNext(); +- if (!$rs->EOF) Err("Error in EOF (xx) "); +- // $db->debug=true; +- print "

Testing ADODB_FETCH_ASSOC and concat: concat firstname and lastname

"; +- +- $save = $ADODB_FETCH_MODE; +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- if ($db->dataProvider == 'postgres') { +- $sql = "select ".$db->Concat('cast(firstname as varchar)',$db->qstr(' '),'lastname')." as fullname,id,".$db->sysTimeStamp." as d from ADOXYZ"; +- $rs = $db->Execute($sql); +- } else { +- $sql = "select distinct ".$db->Concat('firstname',$db->qstr(' '),'lastname')." as fullname,id,".$db->sysTimeStamp." as d from ADOXYZ"; +- $rs = $db->Execute($sql); +- } +- if ($rs) { +- if (empty($_GET['hide'])) rs2html($rs); +- } else { +- Err( "Failed Concat:".$sql); +- } +- $ADODB_FETCH_MODE = $save; +- print "
Testing GetArray() "; +- //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- +- $rs = $db->Execute("select * from ADOXYZ order by id"); +- if ($rs) { +- $arr = $rs->GetArray(10); +- if (sizeof($arr) != 10 || trim($arr[1][1]) != 'John' || trim($arr[1][2]) != 'Lim') print $arr[1][1].' '.$arr[1][2]."   ERROR
"; +- else print " OK
"; +- } +- +- $arr = $db->GetArray("select x from ADOXYZ"); +- $e = $db->ErrorMsg(); $e2 = $db->ErrorNo(); +- echo "Testing error handling, should see illegal column 'x' error=$e ($e2)
"; +- if (!$e || !$e2) Err("Error handling did not work"); +- print "Testing FetchNextObject for 1 object "; +- $rs = $db->Execute("select distinct lastname,firstname from ADOXYZ where firstname='Caroline'"); +- $fcnt = 0; +- if ($rs) +- while ($o = $rs->FetchNextObject()) { +- $fcnt += 1; +- } +- if ($fcnt == 1) print " OK
"; +- else print "FAILED
"; +- +- $stmt = $db->Prepare("select * from ADOXYZ where id < 3"); +- $rs = $db->Execute($stmt); +- if (!$rs) Err("Prepare failed"); +- else { +- $arr = $rs->GetArray(); +- if (!$arr) Err("Prepare failed 2"); +- if (sizeof($arr) != 2) Err("Prepare failed 3"); +- } +- print "Testing GetAssoc() "; +- +- +- if ($db->dataProvider == 'mysql') { +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $arr = $db->GetAssoc("SELECT 'adodb', '0'"); +- var_dump($arr); +- die(); +- } +- +- $savecrecs = $ADODB_COUNTRECS; +- $ADODB_COUNTRECS = false; +- //$arr = $db->GetArray("select lastname,firstname from ADOXYZ"); +- //print_r($arr); +- print "
"; +- $rs = $db->Execute("select distinct lastname,firstname,created from ADOXYZ"); +- +- if ($rs) { +- $arr = $rs->GetAssoc(); +- //print_r($arr); +- if (empty($arr['See']) || trim(reset($arr['See'])) != 'Wai Hun') print $arr['See']."   ERROR
"; +- else print " OK 1"; +- } +- +- $arr = $db->GetAssoc("select distinct lastname,firstname from ADOXYZ"); +- if ($arr) { +- //print_r($arr); +- if (empty($arr['See']) || trim($arr['See']) != 'Wai Hun') print $arr['See']."   ERROR
"; +- else print " OK 2
"; +- } +- // Comment this out to test countrecs = false +- $ADODB_COUNTRECS = $savecrecs; +- $db->debug=1; +- $query = $db->Prepare("select count(*) from ADOXYZ"); +- $rs = $db->CacheExecute(10,$query); +- if (reset($rs->fields) != 50) echo Err("$cnt wrong for Prepare/CacheGetOne"); +- +- for ($loop=0; $loop < 1; $loop++) { +- print "Testing GetMenu() and CacheExecute
"; +- $db->debug = true; +- $rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ"); +- +- +- +- +- if ($rs) print 'With blanks, Steven selected:'. $rs->GetMenu('menu','Steven').'
'; +- else print " Fail
"; +- $rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ"); +- +- if ($rs) print ' No blanks, Steven selected: '. $rs->GetMenu('menu','Steven',false).'
'; +- else print " Fail
"; +- +- $rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ"); +- +- if ($rs) print ' 1st line set to **** , Steven selected: '. $rs->GetMenu('menu','Steven','1st:****').'
'; +- else print " Fail
"; +- +- +- +- $rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ"); +- if ($rs) print ' Multiple, Alan selected: '. $rs->GetMenu('menu','Alan',false,true).'
'; +- else print " Fail
"; +- print '


'; +- +- $rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ"); +- if ($rs) { +- print ' Multiple, Alan and George selected: '. $rs->GetMenu('menu',array('Alan','George'),false,true); +- if (empty($rs->connection)) print "Connection object missing from recordset
"; +- } else print " Fail
"; +- print '


'; +- +- print "Testing GetMenu3()
"; +- $rs = $db->Execute("select ".$db->Concat('firstname',"'-'",'id').",id, lastname from ADOXYZ order by lastname,id"); +- if ($rs) print "Grouped Menu: ".$rs->GetMenu3('name'); +- else Err('Grouped Menu GetMenu3()'); +- print "
"; +- +- print "Testing GetMenu2()
"; +- $rs = $db->CacheExecute(4,"select distinct firstname,lastname from ADOXYZ"); +- if ($rs) print 'With blanks, Steven selected:'. $rs->GetMenu2('menu',('Oey')).'
'; +- else print " Fail
"; +- $rs = $db->CacheExecute(6,"select distinct firstname,lastname from ADOXYZ"); +- if ($rs) print ' No blanks, Steven selected: '. $rs->GetMenu2('menu',('Oey'),false).'
'; +- else print " Fail
"; +- } +- echo "

CacheExecute

"; +- +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- $rs = $db->CacheExecute(6,"select distinct firstname,lastname from ADOXYZ"); +- print_r($rs->fields); echo $rs->fetchMode;echo "
"; +- echo $rs->Fields($fname); +- +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $rs = $db->CacheExecute(6,"select distinct firstname,lastname from ADOXYZ"); +- print_r($rs->fields);echo "
"; +- echo $rs->Fields($fname); +- $db->debug = false; +- +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- // phplens +- +- $sql = 'select * from ADOXYZ where 0=1'; +- echo "

**Testing '$sql' (phplens compat 1)

"; +- $rs = $db->Execute($sql); +- if (!$rs) err( "No recordset returned for '$sql'"); +- if (!$rs->FieldCount()) err( "No fields returned for $sql"); +- if (!$rs->FetchField(1)) err( "FetchField failed for $sql"); +- +- $sql = 'select * from ADOXYZ order by 1'; +- echo "

**Testing '$sql' (phplens compat 2)

"; +- $rs = $db->Execute($sql); +- if (!$rs) err( "No recordset returned for '$sql'
".$db->ErrorMsg()."
"); +- +- +- $sql = 'select * from ADOXYZ order by 1,1'; +- echo "

**Testing '$sql' (phplens compat 3)

"; +- $rs = $db->Execute($sql); +- if (!$rs) err( "No recordset returned for '$sql'
".$db->ErrorMsg()."
"); +- +- +- // Move +- $rs1 = $db->Execute("select id from ADOXYZ where id <= 2 order by 1"); +- $rs2 = $db->Execute("select id from ADOXYZ where id = 3 or id = 4 order by 1"); +- +- if ($rs1) $rs1->MoveLast(); +- if ($rs2) $rs2->MoveLast(); +- +- if (empty($rs1) || empty($rs2) || $rs1->fields[0] != 2 || $rs2->fields[0] != 4) { +- $a = $rs1->fields[0]; +- $b = $rs2->fields[0]; +- print "

Error in multiple recordset test rs1=$a rs2=$b (should be rs1=2 rs2=4)

"; +- } else +- print "

Testing multiple recordsets OK

"; +- +- +- echo "

GenID test: "; +- for ($i=1; $i <= 10; $i++) +- echo "($i: ",$val = $db->GenID($db->databaseType.'abcseq7' ,5), ") "; +- if ($val == 0) Err("GenID not supported"); +- +- if ($val) { +- $db->DropSequence('abc_seq2'); +- $db->CreateSequence('abc_seq2'); +- $val = $db->GenID('abc_seq2'); +- $db->DropSequence('abc_seq2'); +- $db->CreateSequence('abc_seq2'); +- $val = $db->GenID('abc_seq2'); +- if ($val != 1) Err("Drop and Create Sequence not supported ($val)"); +- } +- echo "

"; +- +- if (substr($db->dataProvider,0,3) != 'notused') { // used to crash ado +- $sql = "select firstnames from ADOXYZ"; +- print "

Testing execution of illegal statement: $sql

"; +- if ($db->Execute($sql) === false) { +- print "

This returns the following ErrorMsg(): ".$db->ErrorMsg()." and ErrorNo(): ".$db->ErrorNo().'

'; +- } else +- print "

Error in error handling -- Execute() should return false

"; +- } else +- print "

ADO skipped error handling of bad select statement

"; +- +- print "

ASSOC TEST 2
"; +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $rs = $db->query('select * from ADOXYZ order by id'); +- if ($ee = $db->ErrorMsg()) { +- Err("Error message=$ee"); +- } +- if ($ee = $db->ErrorNo()) { +- Err("Error No = $ee"); +- } +- print_r($rs->fields); +- for($i=0;$i<$rs->FieldCount();$i++) +- { +- $fld=$rs->FetchField($i); +- print "
Field name is ".$fld->name; +- print " ".$rs->Fields($fld->name); +- } +- +- +- print "

BOTH TEST 2
"; +- if ($db->dataProvider == 'ado') { +- print "ADODB_FETCH_BOTH not supported for dataProvider=".$db->dataProvider."
"; +- } else { +- $ADODB_FETCH_MODE = ADODB_FETCH_BOTH; +- $rs = $db->query('select * from ADOXYZ order by id'); +- for($i=0;$i<$rs->FieldCount();$i++) +- { +- $fld=$rs->FetchField($i); +- print "
Field name is ".$fld->name; +- print " ".$rs->Fields($fld->name); +- } +- } +- +- print "

NUM TEST 2
"; +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- $rs = $db->query('select * from ADOXYZ order by id'); +- for($i=0;$i<$rs->FieldCount();$i++) +- { +- $fld=$rs->FetchField($i); +- print "
Field name is ".$fld->name; +- print " ".$rs->Fields($fld->name); +- } +- +- print "

ASSOC Test of SelectLimit
"; +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $rs = $db->selectlimit('select * from ADOXYZ order by id',3,4); +- $cnt = 0; +- while ($rs && !$rs->EOF) { +- $cnt += 1; +- if (!isset($rs->fields['firstname'])) { +- print "
ASSOC returned numeric field

"; +- break; +- } +- $rs->MoveNext(); +- } +- if ($cnt != 3) print "
Count should be 3, instead it was $cnt

"; +- +- +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- if ($db->sysDate) { +- $saved = $db->debug; +- $db->debug = 1; +- $rs = $db->Execute("select {$db->sysDate} from ADOXYZ where id=1"); +- if (ADORecordSet::UnixDate(date('Y-m-d')) != $rs->UnixDate($rs->fields[0])) { +- print "

Invalid date {$rs->fields[0]}

"; +- } else +- print "

Passed \$sysDate test ({$rs->fields[0]})

"; +- +- print_r($rs->FetchField(0)); +- print time(); +- $db->debug=$saved; +- } else { +- print "

\$db->sysDate not defined

"; +- } +- +- print "

Test CSV

"; +- include_once('../toexport.inc.php'); +- //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $rs = $db->SelectLimit('select id,firstname,lastname,created,\'He, he\' he,\'"\' q from ADOXYZ',10); +- +- print "
";
+-	print rs2csv($rs);
+-	print "
"; +- +- $rs = $db->SelectLimit('select id,firstname,lastname,created,\'The "young man", he said\' from ADOXYZ',10); +- +- if (PHP_VERSION < 5) { +- print "
";
+-		rs2tabout($rs);
+-		print "
"; +- } +- #print " CacheFlush "; +- #$db->CacheFlush(); +- +- $date = $db->SQLDate('d-m-M-Y-\QQ h:i:s A'); +- $sql = "SELECT $date from ADOXYZ"; +- print "

Test SQLDate: ".htmlspecialchars($sql)."

"; +- $rs = $db->SelectLimit($sql,1); +- $d = date('d-m-M-Y-').'Q'.(ceil(date('m')/3.0)).date(' h:i:s A'); +- if (!$rs) Err("SQLDate query returned no recordset"); +- else if ($d != $rs->fields[0]) Err("SQLDate 1 failed expected:
act:$d
sql:".$rs->fields[0]); +- +- $dbdate = $db->DBDate("1974-02-25"); +- if (substr($db->dataProvider, 0, 8) == 'postgres') { +- $dbdate .= "::TIMESTAMP"; +- } +- +- $date = $db->SQLDate('d-m-M-Y-\QQ h:i:s A', $dbdate); +- $sql = "SELECT $date from ADOXYZ"; +- print "

Test SQLDate: ".htmlspecialchars($sql)."

"; +- $db->debug=1; +- $rs = $db->SelectLimit($sql,1); +- $ts = ADOConnection::UnixDate('1974-02-25'); +- $d = date('d-m-M-Y-',$ts).'Q'.(ceil(date('m',$ts)/3.0)).date(' h:i:s A',$ts); +- if (!$rs) { +- Err("SQLDate query returned no recordset"); +- echo $db->ErrorMsg(),'
'; +- } else if ($d != reset($rs->fields)) { +- Err("SQLDate 2 failed expected:
act:$d
sql:".$rs->fields[0].'
'.$db->ErrorMsg()); +- } +- +- +- print "

Test Filter

"; +- $db->debug = 1; +- +- $rs = $db->SelectLimit('select * from ADOXYZ where id < 3 order by id'); +- +- $rs = RSFilter($rs,'do_strtolower'); +- if (trim($rs->fields[1]) != 'caroline' && trim($rs->fields[2]) != 'miranda') { +- err('**** RSFilter failed'); +- print_r($rs->fields); +- } +- +- rs2html($rs); +- +- $db->debug=1; +- +- +- print "

Test Replace

"; +- +- $ret = $db->Replace('ADOXYZ', +- array('id'=>1,'firstname'=>'Caroline','lastname'=>'Miranda'), +- array('id'), +- $autoq = true); +- if (!$ret) echo "

Error in replacing existing record

"; +- else { +- $saved = $db->debug; +- $db->debug = 0; +- $savec = $ADODB_COUNTRECS; +- $ADODB_COUNTRECS = true; +- $rs = $db->Execute('select * FROM ADOXYZ where id=1'); +- $db->debug = $saved; +- if ($rs->RecordCount() != 1) { +- $cnt = $rs->RecordCount(); +- rs2html($rs); +- print "Error - Replace failed, count=$cnt

"; +- } +- $ADODB_COUNTRECS = $savec; +- } +- $ret = $db->Replace('ADOXYZ', +- array('id'=>1000,'firstname'=>'Harun','lastname'=>'Al-Rashid'), +- array('id','firstname'), +- $autoq = true); +- if ($ret != 2) print "Replace failed: "; +- print "test A return value=$ret (2 expected)

"; +- +- $ret = $db->Replace('ADOXYZ', +- array('id'=>1000,'firstname'=>'Sherazade','lastname'=>'Al-Rashid'), +- 'id', +- $autoq = true); +- if ($ret != 1) +- if ($db->dataProvider == 'ibase' && $ret == 2); +- else print "Replace failed: "; +- print "test B return value=$ret (1 or if ibase then 2 expected)

"; +- +- print "

rs2rs Test

"; +- +- $rs = $db->Execute('select * from ADOXYZ where id>= 1 order by id'); +- $rs = $db->_rs2rs($rs); +- $rs->valueX = 'X'; +- $rs->MoveNext(); +- $rs = $db->_rs2rs($rs); +- if (!isset($rs->valueX)) err("rs2rs does not preserve array recordsets"); +- if (reset($rs->fields) != 1) err("rs2rs does not move to first row: id=".reset($rs->fields)); +- +- ///////////////////////////////////////////////////////////// +- include_once('../pivottable.inc.php'); +- print "

Pivot Test

"; +- $db->debug=true; +- $sql = PivotTableSQL( +- $db, # adodb connection +- 'ADOXYZ', # tables +- 'firstname', # row fields +- 'lastname', # column fields +- false, # join +- 'ID', # sum +- 'Sum ', # label for sum +- 'sum', # aggregate function +- true +- ); +- $rs = $db->Execute($sql); +- if ($rs) rs2html($rs); +- else Err("Pivot sql error"); +- +- $pear = false; //true; +- $db->debug=false; +- +- if ($pear) { +- // PEAR TESTS BELOW +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- +- include_once "PEAR.php"; +- $rs = $db->query('select * from ADOXYZ where id>0 and id<10 order by id'); +- +- $i = 0; +- if ($rs && !$rs->EOF) { +- while ($arr = $rs->fetchRow()) { +- $i++; +- //print "$i "; +- if ($arr[0] != $i) { +- print_r($arr); +- print "

PEAR DB emulation error 1.

"; +- $pear = false; +- break; +- } +- } +- $rs->Close(); +- } +- +- +- if ($i != $db->GetOne('select count(*) from ADOXYZ where id>0 and id<10')) { +- print "

PEAR DB emulation error 1.1 EOF ($i)

"; +- $pear = false; +- } +- +- $rs = $db->limitQuery('select * from ADOXYZ where id>0 order by id',$i=3,$top=3); +- $i2 = $i; +- if ($rs && !$rs->EOF) { +- +- while (!is_object($rs->fetchInto($arr))) { +- $i2++; +- +- // print_r($arr); +- // print "$i ";print_r($arr); +- if ($arr[0] != $i2) { +- print "

PEAR DB emulation error 2.

"; +- $pear = false; +- break; +- } +- } +- $rs->Close(); +- } +- if ($i2 != $i+$top) { +- print "

PEAR DB emulation error 2.1 EOF (correct=$i+$top, actual=$i2)

"; +- $pear = false; +- } +- } +- if ($pear) print "

PEAR DB emulation passed.

"; +- flush(); +- +- +- $rs = $db->SelectLimit("select ".$db->sysDate." from ADOXYZ",1); +- $date = $rs->fields[0]; +- if (!$date) Err("Bad sysDate"); +- else { +- $ds = $db->UserDate($date,"d m Y"); +- if ($ds != date("d m Y")) Err("Bad UserDate: ".$ds.' expected='.date("d m Y")); +- else echo "Passed UserDate: $ds

"; +- } +- $db->debug=1; +- if ($db->dataProvider == 'oci8') +- $rs = $db->SelectLimit("select to_char(".$db->sysTimeStamp.",'YYYY-MM-DD HH24:MI:SS') from ADOXYZ",1); +- else +- $rs = $db->SelectLimit("select ".$db->sysTimeStamp." from ADOXYZ",1); +- $date = $rs->fields[0]; +- if (!$date) Err("Bad sysTimeStamp"); +- else { +- $ds = $db->UserTimeStamp($date,"H \\h\\r\\s-d m Y"); +- if ($ds != date("H \\h\\r\\s-d m Y")) Err("Bad UserTimeStamp: ".$ds.", correct is ".date("H \\h\\r\\s-d m Y")); +- else echo "Passed UserTimeStamp: $ds

"; +- +- $date = 100; +- $ds = $db->UserTimeStamp($date,"H \\h\\r\\s-d m Y"); +- $ds2 = date("H \\h\\r\\s-d m Y",$date); +- if ($ds != $ds2) Err("Bad UserTimeStamp 2: $ds: $ds2"); +- else echo "Passed UserTimeStamp 2: $ds

"; +- } +- flush(); +- +- if ($db->hasTransactions) { +- $db->debug=1; +- echo "

Testing StartTrans CompleteTrans

"; +- $db->raiseErrorFn = false; +- +- $db->SetTransactionMode('SERIALIZABLE'); +- $db->StartTrans(); +- $rs = $db->Execute('select * from notable'); +- $db->StartTrans(); +- $db->BeginTrans(); +- $db->Execute("update ADOXYZ set firstname='Carolx' where id=1"); +- $db->CommitTrans(); +- $db->CompleteTrans(); +- $rez = $db->CompleteTrans(); +- $db->SetTransactionMode(''); +- $db->debug=0; +- if ($rez !== false) { +- if (is_null($rez)) Err("Error: _transOK not modified"); +- else Err("Error: CompleteTrans (1) should have failed"); +- } else { +- $name = $db->GetOne("Select firstname from ADOXYZ where id=1"); +- if ($name == "Carolx") Err("Error: CompleteTrans (2) should have failed"); +- else echo "

-- Passed StartTrans test1 - rolling back

"; +- } +- +- $db->StartTrans(); +- $db->BeginTrans(); +- $db->Execute("update ADOXYZ set firstname='Carolx' where id=1"); +- $db->RollbackTrans(); +- $rez = $db->CompleteTrans(); +- if ($rez !== true) Err("Error: CompleteTrans (1) should have succeeded"); +- else { +- $name = $db->GetOne("Select firstname from ADOXYZ where id=1"); +- if (trim($name) != "Carolx") Err("Error: CompleteTrans (2) should have succeeded, returned name=$name"); +- else echo "

-- Passed StartTrans test2 - commiting

"; +- } +- } +- flush(); +- $saved = $db->debug; +- $db->debug=1; +- $cnt = _adodb_getcount($db, 'select * from ADOXYZ where firstname in (select firstname from ADOXYZ)'); +- echo "Count= $cnt"; +- $db->debug=$saved; +- +- global $TESTERRS; +- $debugerr = true; +- +- global $ADODB_LANG;$ADODB_LANG = 'fr'; +- $db->debug = false; +- $TESTERRS = 0; +- $db->raiseErrorFn = 'adodb_test_err'; +- global $ERRNO; // from adodb_test_err +- $db->Execute('select * from nowhere'); +- $metae = $db->MetaError($ERRNO); +- if ($metae !== DB_ERROR_NOSUCHTABLE) print "

MetaError=".$metae." wrong, should be ".DB_ERROR_NOSUCHTABLE."

"; +- else print "

MetaError ok (".DB_ERROR_NOSUCHTABLE."): ".$db->MetaErrorMsg($metae)."

"; +- if ($TESTERRS != 1) print "raiseErrorFn select nowhere failed
"; +- $rs = $db->Execute('select * from ADOXYZ'); +- if ($debugerr) print " Move"; +- $rs->Move(100); +- $rs->_queryID = false; +- if ($debugerr) print " MoveNext"; +- $rs->MoveNext(); +- if ($debugerr) print " $rs=false"; +- $rs = false; +- +- flush(); +- +- print "

SetFetchMode() tests

"; +- $db->SetFetchMode(ADODB_FETCH_ASSOC); +- $rs = $db->SelectLimit('select firstname from ADOXYZ',1); +- if (!isset($rs->fields['firstname'])) Err("BAD FETCH ASSOC"); +- +- $ADODB_FETCH_MODE = ADODB_FETCH_NUM; +- $rs = $db->SelectLimit('select firstname from ADOXYZ',1); +- //var_dump($rs->fields); +- if (!isset($rs->fields['firstname'])) Err("BAD FETCH ASSOC"); +- +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $db->SetFetchMode(ADODB_FETCH_NUM); +- $rs = $db->SelectLimit('select firstname from ADOXYZ',1); +- if (!isset($rs->fields[0])) Err("BAD FETCH NUM"); +- +- flush(); +- +- print "

Test MetaTables again with SetFetchMode()

"; +- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- $db->SetFetchMode(ADODB_FETCH_ASSOC); +- print_r($db->MetaTables()); +- print "

"; +- +- //////////////////////////////////////////////////////////////////// +- +- print "

Testing Bad Connection

"; +- flush(); +- +- if (true || PHP_VERSION < 5) { +- if ($db->dataProvider == 'odbtp') $db->databaseType = 'odbtp'; +- $conn = NewADOConnection($db->databaseType); +- $conn->raiseErrorFn = 'adodb_test_err'; +- if (1) $conn->PConnect('abc','baduser','badpassword'); +- if ($TESTERRS == 2) print "raiseErrorFn tests passed
"; +- else print "raiseErrorFn tests failed ($TESTERRS)
"; +- +- flush(); +- } +- //////////////////////////////////////////////////////////////////// +- +- global $nocountrecs; +- +- if (isset($nocountrecs) && $ADODB_COUNTRECS) err("Error: \$ADODB_COUNTRECS is set"); +- if (empty($nocountrecs) && $ADODB_COUNTRECS==false) err("Error: \$ADODB_COUNTRECS is not set"); +- +- flush(); +-?> +-

+-
 
+-

+-Close(); +- if ($rs2) $rs2->Close(); +- if ($rs) $rs->Close(); +- $db->Close(); +- +- if ($db->transCnt != 0) Err("Error in transCnt=$db->transCnt (should be 0)"); +- +- +- printf("

Total queries=%d; total cached=%d

",$EXECS+$CACHED, $CACHED); +- flush(); +-} +- +-function adodb_test_err($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false) +-{ +-global $TESTERRS,$ERRNO; +- +- $ERRNO = $errno; +- $TESTERRS += 1; +- print "** $dbms ($fn): errno=$errno   errmsg=$errmsg ($p1,$p2)
"; +-} +- +-//-------------------------------------------------------------------------------------- +- +- +-@set_time_limit(240); // increase timeout +- +-include("../tohtml.inc.php"); +-include("../adodb.inc.php"); +-include("../rsfilter.inc.php"); +- +-/* White Space Check */ +- +-if (isset($_SERVER['argv'][1])) { +- //print_r($_SERVER['argv']); +- $_GET[$_SERVER['argv'][1]] = 1; +-} +- +-if (@$_SERVER['COMPUTERNAME'] == 'TIGRESS') { +- CheckWS('mysqlt'); +- CheckWS('postgres'); +- CheckWS('oci8po'); +- +- CheckWS('firebird'); +- CheckWS('sybase'); +- if (!ini_get('safe_mode')) CheckWS('informix'); +- +- CheckWS('ado_mssql'); +- CheckWS('ado_access'); +- CheckWS('mssql'); +- +- CheckWS('vfp'); +- CheckWS('sqlanywhere'); +- CheckWS('db2'); +- CheckWS('access'); +- CheckWS('odbc_mssql'); +- CheckWS('firebird15'); +- // +- CheckWS('oracle'); +- CheckWS('proxy'); +- CheckWS('fbsql'); +- print "White Space Check complete

"; +-} +-if (sizeof($_GET) == 0) $testmysql = true; +- +- +-foreach($_GET as $k=>$v) { +- // XSS protection (see Github issue #274) - only set variables for +- // expected get parameters used in testdatabases.inc.php +- if(preg_match('/^(test|no)\w+$/', $k)) { +- $$k = $v; +- } +-} +- +-?> +- +-ADODB Testing +- +-

ADODB Test

+- +-This script tests the following databases: Interbase, Oracle, Visual FoxPro, Microsoft Access (ODBC and ADO), MySQL, MSSQL (ODBC, native, ADO). +-There is also support for Sybase, PostgreSQL.

+-For the latest version of ADODB, visit
adodb.org.

+- +-Test GetInsertSQL/GetUpdateSQL   +- Sessions   +- Paging   +- Perf Monitor

+-vers=",ADOConnection::Version(); +- +- +- +-?> +-

ADODB Database Library (c) 2000-2014 John Lim. All rights reserved. Released under BSD and LGPL, PHP .

+- +- +diff --git tests/test2.php tests/test2.php +deleted file mode 100644 +index eb3b0258..00000000 +--- tests/test2.php ++++ /dev/null +@@ -1,25 +0,0 @@ +-debug=1; +- $access = 'd:\inetpub\wwwroot\php\NWIND.MDB'; +- $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;' +- . 'DATA SOURCE=' . $access . ';'; +- +- echo "

PHP ",PHP_VERSION,"

"; +- +- $db->Connect($myDSN) || die('fail'); +- +- print_r($db->ServerInfo()); +- +- try { +- $rs = $db->Execute("select $db->sysTimeStamp,* from adoxyz where id>02xx"); +- print_r($rs->fields); +- } catch(exception $e) { +- print_r($e); +- echo "

Date m/d/Y =",$db->UserDate($rs->fields[4],'m/d/Y'); +- } +diff --git tests/test3.php tests/test3.php +deleted file mode 100644 +index 1497f98a..00000000 +--- tests/test3.php ++++ /dev/null +@@ -1,44 +0,0 @@ +-Connect('','scott','natsoft'); +-$db->debug=1; +- +-$cnt = $db->GetOne("select count(*) from adoxyz"); +-$rs = $db->Execute("select * from adoxyz order by id"); +- +-$i = 0; +-foreach($rs as $k => $v) { +- $i += 1; +- echo $k; adodb_pr($v); +- flush(); +-} +- +-if ($i != $cnt) die("actual cnt is $i, cnt should be $cnt\n"); +- +- +- +-$rs = $db->Execute("select bad from badder"); +- +-} catch (exception $e) { +- adodb_pr($e); +- $e = adodb_backtrace($e->trace); +-} +diff --git tests/test4.php tests/test4.php +deleted file mode 100644 +index d7c76e2c..00000000 +--- tests/test4.php ++++ /dev/null +@@ -1,144 +0,0 @@ +-PConnect("", "sa", "natsoft", "northwind"); // connect to MySQL, testdb +- +-$conn = ADONewConnection("mysql"); // create a connection +-$conn->PConnect("localhost", "root", "", "test"); // connect to MySQL, testdb +- +- +-#$conn = ADONewConnection('oci8po'); +-#$conn->Connect('','scott','natsoft'); +- +-if (PHP_VERSION >= 5) { +- $connstr = "mysql:dbname=northwind"; +- $u = 'root';$p=''; +- $conn = ADONewConnection('pdo'); +- $conn->Connect($connstr, $u, $p); +-} +-//$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; +- +- +-$conn->debug=1; +-$conn->Execute("delete from adoxyz where lastname like 'Smi%'"); +- +-$rs = $conn->Execute($sql); // Execute the query and get the empty recordset +-$record = array(); // Initialize an array to hold the record data to insert +- +-if (strpos($conn->databaseType,'mysql')===false) $record['id'] = 751; +-$record["firstname"] = 'Jann'; +-$record["lastname"] = "Smitts"; +-$record["created"] = time(); +- +-$insertSQL = $conn->GetInsertSQL($rs, $record); +-$conn->Execute($insertSQL); // Insert the record into the database +- +-if (strpos($conn->databaseType,'mysql')===false) $record['id'] = 752; +-// Set the values for the fields in the record +-$record["firstname"] = 'anull'; +-$record["lastname"] = "Smith\$@//"; +-$record["created"] = time(); +- +-if (isset($_GET['f'])) $ADODB_FORCE_TYPE = $_GET['f']; +- +-//$record["id"] = -1; +- +-// Pass the empty recordset and the array containing the data to insert +-// into the GetInsertSQL function. The function will process the data and return +-// a fully formatted insert sql statement. +-$insertSQL = $conn->GetInsertSQL($rs, $record); +-$conn->Execute($insertSQL); // Insert the record into the database +- +- +- +-$insertSQL2 = $conn->GetInsertSQL($table='ADOXYZ', $record); +-if ($insertSQL != $insertSQL2) echo "

Walt's new stuff failed: $insertSQL2

"; +-//========================== +-// This code tests an update +- +-$sql = " +-SELECT * +-FROM ADOXYZ WHERE lastname=".$conn->Param('var'). " ORDER BY 1"; +-// Select a record to update +- +-$varr = array('var'=>$record['lastname'].''); +-$rs = $conn->Execute($sql,$varr); // Execute the query and get the existing record to update +-if (!$rs || $rs->EOF) print "

No record found!

"; +- +-$record = array(); // Initialize an array to hold the record data to update +- +- +-// Set the values for the fields in the record +-$record["firstName"] = "Caroline".rand(); +-//$record["lasTname"] = ""; // Update Caroline's lastname from Miranda to Smith +-$record["creAted"] = '2002-12-'.(rand()%30+1); +-$record['num'] = ''; +-// Pass the single record recordset and the array containing the data to update +-// into the GetUpdateSQL function. The function will process the data and return +-// a fully formatted update sql statement. +-// If the data has not changed, no recordset is returned +- +-$updateSQL = $conn->GetUpdateSQL($rs, $record); +-$conn->Execute($updateSQL,$varr); // Update the record in the database +-if ($conn->Affected_Rows() != 1)print "

Error1 : Rows Affected=".$conn->Affected_Rows().", should be 1

"; +- +-$record["firstName"] = "Caroline".rand(); +-$record["lasTname"] = "Smithy Jones"; // Update Caroline's lastname from Miranda to Smith +-$record["creAted"] = '2002-12-'.(rand()%30+1); +-$record['num'] = 331; +-$updateSQL = $conn->GetUpdateSQL($rs, $record); +-$conn->Execute($updateSQL,$varr); // Update the record in the database +-if ($conn->Affected_Rows() != 1)print "

Error 2: Rows Affected=".$conn->Affected_Rows().", should be 1

"; +- +-$rs = $conn->Execute("select * from ADOXYZ where lastname like 'Sm%'"); +-//adodb_pr($rs); +-rs2html($rs); +- +-$record["firstName"] = "Carol-new-".rand(); +-$record["lasTname"] = "Smithy"; // Update Caroline's lastname from Miranda to Smith +-$record["creAted"] = '2002-12-'.(rand()%30+1); +-$record['num'] = 331; +- +-$conn->AutoExecute('ADOXYZ',$record,'UPDATE', "lastname like 'Sm%'"); +-$rs = $conn->Execute("select * from ADOXYZ where lastname like 'Sm%'"); +-//adodb_pr($rs); +-rs2html($rs); +-} +- +- +-testsql(); +diff --git tests/test5.php tests/test5.php +deleted file mode 100644 +index e0597690..00000000 +--- tests/test5.php ++++ /dev/null +@@ -1,48 +0,0 @@ +-debug=1; +- $conn->PConnect("localhost","root","","xphplens"); +- print $conn->databaseType.':'.$conn->GenID().'
'; +-} +- +-if (0) { +- $conn = ADONewConnection("oci8"); // create a connection +- $conn->debug=1; +- $conn->PConnect("falcon", "scott", "tiger", "juris8.ecosystem.natsoft.com.my"); // connect to MySQL, testdb +- print $conn->databaseType.':'.$conn->GenID(); +-} +- +-if (0) { +- $conn = ADONewConnection("ibase"); // create a connection +- $conn->debug=1; +- $conn->Connect("localhost:c:\\Interbase\\Examples\\Database\\employee.gdb", "sysdba", "masterkey", ""); // connect to MySQL, testdb +- print $conn->databaseType.':'.$conn->GenID().'
'; +-} +- +-if (0) { +- $conn = ADONewConnection('postgres'); +- $conn->debug=1; +- @$conn->PConnect("susetikus","tester","test","test"); +- print $conn->databaseType.':'.$conn->GenID().'
'; +-} +diff --git tests/test_rs_array.php tests/test_rs_array.php +deleted file mode 100644 +index 547b20ad..00000000 +--- tests/test_rs_array.php ++++ /dev/null +@@ -1,46 +0,0 @@ +-InitArray($array,$typearr); +- +-while (!$rs->EOF) { +- print_r($rs->fields);echo "
"; +- $rs->MoveNext(); +-} +- +-echo "
1 Seek
"; +-$rs->Move(1); +-while (!$rs->EOF) { +- print_r($rs->fields);echo "
"; +- $rs->MoveNext(); +-} +- +-echo "
2 Seek
"; +-$rs->Move(2); +-while (!$rs->EOF) { +- print_r($rs->fields);echo "
"; +- $rs->MoveNext(); +-} +- +-echo "
3 Seek
"; +-$rs->Move(3); +-while (!$rs->EOF) { +- print_r($rs->fields);echo "
"; +- $rs->MoveNext(); +-} +- +- +- +-die(); +diff --git tests/testcache.php tests/testcache.php +deleted file mode 100644 +index af3a7465..00000000 +--- tests/testcache.php ++++ /dev/null +@@ -1,30 +0,0 @@ +- +- +-PConnect('nwind'); +-} else { +- $db = ADONewConnection('mysql'); +- $db->PConnect('mangrove','root','','xphplens'); +-} +-if (isset($cache)) $rs = $db->CacheExecute(120,'select * from products'); +-else $rs = $db->Execute('select * from products'); +- +-$arr = $rs->GetArray(); +-print sizeof($arr); +diff --git tests/testdatabases.inc.php tests/testdatabases.inc.php +deleted file mode 100644 +index 03e69466..00000000 +--- tests/testdatabases.inc.php ++++ /dev/null +@@ -1,478 +0,0 @@ +- +- +-
+-
+-> Access
+-> Interbase
+-> MSSQL
+-> MySQL
+-> MySQL ODBC
+-> MySQLi +-
+-
> SQLite
+-> MySQL Proxy
+-> Oracle (oci8)
+-> PostgreSQL
+-> PostgreSQL 9
+-> PostgreSQL ODBC
+-
+-> PgSQL PDO
+-> MySQL PDO
+-> SQLite PDO
+-> Access PDO
+-> MSSQL PDO
+- +-> OCI PDO
+- +-
> DB2
+-> VFP+ODBTP
+-> ADO (for mssql and access)
+-> $ADODB_COUNTRECS=false
+-> No SQL Logging
+-> ADOdb time test +-
+- +- +- +-FETCH MODE IS NOT ADODB_FETCH_DEFAULT"; +- +-if (isset($nocountrecs)) $ADODB_COUNTRECS = false; +- +-// cannot test databases below, but we include them anyway to check +-// if they parse ok... +- +-if (sizeof($_GET) || !isset($_SERVER['HTTP_HOST'])) { +- echo "
"; +- ADOLoadCode2("sybase"); +- ADOLoadCode2("postgres"); +- ADOLoadCode2("postgres7"); +- ADOLoadCode2("firebird"); +- ADOLoadCode2("borland_ibase"); +- ADOLoadCode2("informix"); +- ADOLoadCode2('mysqli'); +- if (defined('ODBC_BINMODE_RETURN')) { +- ADOLoadCode2("sqlanywhere"); +- ADOLoadCode2("access"); +- } +- ADOLoadCode2("mysql"); +- ADOLoadCode2("oci8"); +-} +- +-function ADOLoadCode2($d) +-{ +- ADOLoadCode($d); +- $c = ADONewConnection($d); +- echo "Loaded $d ",($c ? 'ok' : 'extension not installed'),"
"; +-} +- +-flush(); +- +-// dregad 2014-04-15 added serial field to avoid error with lastval() +-$pg_test_table = "create table ADOXYZ (id integer, firstname char(24), lastname varchar,created date, ser serial)"; +-$pg_hostname = 'localhost'; +-$pg_user = 'tester'; +-$pg_password = 'test'; +-$pg_database = 'northwind'; +-$pg_errmsg = "ERROR: PostgreSQL requires a database called '$pg_database' " +- . "on server '$pg_hostname', user '$pg_user', password '$pg_password'.
"; +- +-if (!empty($testpostgres)) { +- //ADOLoadCode("postgres"); +- +- $db = ADONewConnection('postgres'); +- print "

Connecting $db->databaseType...

"; +- if ($db->Connect($pg_hostname, $pg_user, $pg_password, $pg_database)) { +- testdb($db, $pg_test_table); +- } else { +- print $pg_errmsg . $db->ErrorMsg(); +- } +-} +- +-if (!empty($testpostgres9)) { +- //ADOLoadCode("postgres"); +- +- $db = ADONewConnection('postgres9'); +- print "

Connecting $db->databaseType...

"; +- if ($db->Connect($pg_hostname, $pg_user, $pg_password, $pg_database)) { +- testdb($db, $pg_test_table); +- } else { +- print $pg_errmsg . $db->ErrorMsg(); +- } +-} +- +-if (!empty($testpgodbc)) { +- +- $db = ADONewConnection('odbc'); +- $db->hasTransactions = false; +- print "

Connecting $db->databaseType...

"; +- +- if ($db->PConnect('Postgresql')) { +- $db->hasTransactions = true; +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); +- } else print "ERROR: PostgreSQL requires a database called test on server, user tester, password test.
".$db->ErrorMsg(); +-} +- +-if (!empty($testibase)) { +- //$_GET['nolog'] = true; +- $db = ADONewConnection('firebird'); +- print "

Connecting $db->databaseType...

"; +- if ($db->PConnect("localhost:d:\\firebird\\151\\examples\\EMPLOYEE.fdb", "sysdba", "masterkey", "")) +- testdb($db,"create table ADOXYZ (id integer, firstname char(24), lastname char(24),price numeric(12,2),created date)"); +- else print "ERROR: Interbase test requires a database called employee.gdb".'
'.$db->ErrorMsg(); +- +-} +- +- +-if (!empty($testsqlite)) { +- $path =urlencode('d:\inetpub\adodb\sqlite.db'); +- $dsn = "sqlite://$path/"; +- $db = ADONewConnection($dsn); +- //echo $dsn; +- +- //$db = ADONewConnection('sqlite'); +- +- +- if ($db && $db->PConnect("d:\\inetpub\\adodb\\sqlite.db", "", "", "")) { +- print "

Connecting $db->databaseType...

"; +- testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); +- } else +- print "ERROR: SQLite"; +- +-} +- +-if (!empty($testpdopgsql)) { +- $connstr = "pgsql:dbname=test"; +- $u = 'tester';$p='test'; +- $db = ADONewConnection('pdo'); +- print "

Connecting $db->databaseType...

"; +- $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); +-} +- +-if (!empty($testpdomysql)) { +- $connstr = "mysql:dbname=northwind"; +- $u = 'root';$p=''; +- $db = ADONewConnection('pdo'); +- print "

Connecting $db->databaseType...

"; +- $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); +- +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); +-} +- +-if (!empty($testpdomssql)) { +- $connstr = "mssql:dbname=northwind"; +- $u = 'sa';$p='natsoft'; +- $db = ADONewConnection('pdo'); +- print "

Connecting $db->databaseType...

"; +- $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); +- +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); +-} +- +-if (!empty($testpdosqlite)) { +- $connstr = "sqlite:d:/inetpub/adodb/sqlite-pdo.db3"; +- $u = '';$p=''; +- $db = ADONewConnection('pdo'); +- $db->hasTransactions = false; +- print "

Connecting $db->databaseType...

"; +- $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); +-} +- +-if (!empty($testpdoaccess)) { +- $connstr = 'odbc:nwind'; +- $u = '';$p=''; +- $db = ADONewConnection('pdo'); +- $db->hasTransactions = false; +- print "

Connecting $db->databaseType...

"; +- $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); +-} +- +-if (!empty($testpdoora)) { +- $connstr = 'oci:'; +- $u = 'scott';$p='natsoft'; +- $db = ADONewConnection('pdo'); +- #$db->hasTransactions = false; +- print "

Connecting $db->databaseType...

"; +- $db->Connect($connstr,$u,$p) || die("CONNECT FAILED"); +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); +-} +- +-// REQUIRES ODBC DSN CALLED nwind +-if (!empty($testaccess)) { +- $db = ADONewConnection('access'); +- print "

Connecting $db->databaseType...

"; +- $access = 'd:\inetpub\wwwroot\php\NWIND.MDB'; +- $dsn = "nwind"; +- $dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=$access;Uid=Admin;Pwd=;"; +- +- //$dsn = 'Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=' . $access . ';'; +- if ($db->PConnect($dsn, "", "", "")) +- testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); +- else print "ERROR: Access test requires a Windows ODBC DSN=nwind, Access driver"; +- +-} +- +-if (!empty($testaccess) && !empty($testado)) { // ADO ACCESS +- +- $db = ADONewConnection("ado_access"); +- print "

Connecting $db->databaseType...

"; +- +- $access = 'd:\inetpub\wwwroot\php\NWIND.MDB'; +- $myDSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;' +- . 'DATA SOURCE=' . $access . ';'; +- //. 'USER ID=;PASSWORD=;'; +- $_GET['nolog'] = 1; +- if ($db->PConnect($myDSN, "", "", "")) { +- print "ADO version=".$db->_connectionID->version."
"; +- testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); +- } else print "ERROR: Access test requires a Access database $access".'
'.$db->ErrorMsg(); +- +-} +- +-if (!empty($testvfp)) { // ODBC +- $db = ADONewConnection('vfp'); +- print "

Connecting $db->databaseType...

";flush(); +- +- if ( $db->PConnect("vfp-adoxyz")) { +- testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)"); +- } else print "ERROR: Visual FoxPro test requires a Windows ODBC DSN=vfp-adoxyz, VFP driver"; +- +- echo "
"; +- $db = ADONewConnection('odbtp'); +- +- if ( $db->PConnect('localhost','DRIVER={Microsoft Visual FoxPro Driver};SOURCETYPE=DBF;SOURCEDB=d:\inetpub\adodb;EXCLUSIVE=NO;')) { +- print "

Connecting $db->databaseType...

";flush(); +- testdb($db,"create table d:\\inetpub\\adodb\\ADOXYZ (id int, firstname char(24), lastname char(24),created date)"); +- } else print "ERROR: Visual FoxPro odbtp requires a Windows ODBC DSN=vfp-adoxyz, VFP driver"; +- +-} +- +- +-// REQUIRES MySQL server at localhost with database 'test' +-if (!empty($testmysql)) { // MYSQL +- +- +- if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; +- else $server = "mangrove"; +- $user = 'root'; $password = ''; $database = 'northwind'; +- $db = ADONewConnection("mysqlt://$user:$password@$server/$database?persist"); +- print "

Connecting $db->databaseType...

"; +- +- if (true || $db->PConnect($server, "root", "", "northwind")) { +- //$db->Execute("DROP TABLE ADOXYZ") || die('fail drop'); +- //$db->debug=1;$db->Execute('drop table ADOXYZ'); +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) Type=InnoDB"); +- } else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'
'.$db->ErrorMsg(); +-} +- +-// REQUIRES MySQL server at localhost with database 'test' +-if (!empty($testmysqli)) { // MYSQL +- +- $db = ADONewConnection('mysqli'); +- print "

Connecting $db->databaseType...

"; +- if (PHP_VERSION >= 5 || $_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; +- else $server = "mangrove"; +- if ($db->PConnect($server, "root", "", "northwind")) { +- //$db->debug=1;$db->Execute('drop table ADOXYZ'); +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)"); +- } else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'
'.$db->ErrorMsg(); +-} +- +- +-// REQUIRES MySQL server at localhost with database 'test' +-if (!empty($testmysqlodbc)) { // MYSQL +- +- $db = ADONewConnection('odbc'); +- $db->hasTransactions = false; +- print "

Connecting $db->databaseType...

"; +- if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; +- else $server = "mangrove"; +- if ($db->PConnect('mysql', "root", "")) +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); +- else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'
'.$db->ErrorMsg(); +-} +- +-if (!empty($testproxy)){ +- $db = ADONewConnection('proxy'); +- print "

Connecting $db->databaseType...

"; +- if ($_SERVER['HTTP_HOST'] == 'localhost') $server = 'localhost'; +- +- if ($db->PConnect('http://localhost/php/phplens/adodb/server.php')) +- testdb($db, +- "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date) type=innodb"); +- else print "ERROR: MySQL test requires a MySQL server on localhost, userid='admin', password='', database='test'".'
'.$db->ErrorMsg(); +- +-} +- +-ADOLoadCode('oci805'); +-ADOLoadCode("oci8po"); +- +-if (!empty($testoracle)) { +- $dsn = "oci8";//://scott:natsoft@kk2?persist"; +- $db = ADONewConnection($dsn );//'oci8'); +- +- //$db->debug=1; +- print "

Connecting $db->databaseType...

"; +- if ($db->Connect('mobydick', "scott", "natsoft",'SID=mobydick')) +- testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); +- else +- print "ERROR: Oracle test requires an Oracle server setup with scott/natsoft".'
'.$db->ErrorMsg(); +- +-} +-ADOLoadCode("oracle"); // no longer supported +-if (false && !empty($testoracle)) { +- +- $db = ADONewConnection(); +- print "

Connecting $db->databaseType...

"; +- if ($db->PConnect("", "scott", "tiger", "natsoft.domain")) +- testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); +- else print "ERROR: Oracle test requires an Oracle server setup with scott/tiger".'
'.$db->ErrorMsg(); +- +-} +- +-ADOLoadCode("odbc_db2"); // no longer supported +-if (!empty($testdb2)) { +- if (PHP_VERSION>=5.1) { +- $db = ADONewConnection("db2"); +- print "

Connecting $db->databaseType...

"; +- +- #$db->curMode = SQL_CUR_USE_ODBC; +- #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest"; +- if ($db->Connect('localhost','natsoft','guest','test')) { +- testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); +- } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'
'.$db->ErrorMsg(); +- } else { +- $db = ADONewConnection("odbc_db2"); +- print "

Connecting $db->databaseType...

"; +- +- $dsn = "db2test"; +- #$db->curMode = SQL_CUR_USE_ODBC; +- #$dsn = "driver={IBM db2 odbc DRIVER};Database=test;hostname=localhost;port=50000;protocol=TCPIP; uid=natsoft; pwd=guest"; +- if ($db->Connect($dsn)) { +- testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); +- } else print "ERROR: DB2 test requires an server setup with odbc data source db2_sample".'
'.$db->ErrorMsg(); +- } +-echo "
"; +-flush(); +- $dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP; uid=root; pwd=natsoft"; +- +- $db = ADONewConnection('odbtp'); +- if ($db->Connect('127.0.0.1',$dsn)) { +- +- $db->debug=1; +- $arr = $db->GetArray( "||SQLProcedures" ); adodb_pr($arr); +- $arr = $db->GetArray( "||SQLProcedureColumns|||GET_ROUTINE_SAR" );adodb_pr($arr); +- +- testdb($db,"create table ADOXYZ (id int, firstname varchar(24), lastname varchar(24),created date)"); +- } else echo ("ERROR Connection"); +- echo $db->ErrorMsg(); +-} +- +- +-$server = 'localhost'; +- +- +- +-ADOLoadCode("mssqlpo"); +-if (false && !empty($testmssql)) { // MS SQL Server -- the extension is buggy -- probably better to use ODBC +- $db = ADONewConnection("mssqlpo"); +- //$db->debug=1; +- print "

Connecting $db->databaseType...

"; +- +- $ok = $db->Connect('','sa','natsoft','northwind'); +- echo $db->ErrorMsg(); +- if ($ok /*or $db->PConnect("mangrove", "sa", "natsoft", "ai")*/) { +- AutoDetect_MSSQL_Date_Order($db); +- // $db->Execute('drop table adoxyz'); +- testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); +- } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='$server', userid='adodb', password='natsoft', database='ai'".'
'.$db->ErrorMsg(); +- +-} +- +- +-ADOLoadCode('odbc_mssql'); +-if (!empty($testmssql)) { // MS SQL Server via ODBC +- $db = ADONewConnection(); +- +- print "

Connecting $db->databaseType...

"; +- +- $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;"; +- $dsn = 'condor'; +- if ($db->PConnect($dsn, "sa", "natsoft", "")) { +- testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); +- } +- else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup"; +- +-} +- +-ADOLoadCode("ado_mssql"); +-if (!empty($testmssql) && !empty($testado) ) { // ADO ACCESS MSSQL -- thru ODBC -- DSN-less +- +- $db = ADONewConnection("ado_mssql"); +- //$db->debug=1; +- print "

Connecting DSN-less $db->databaseType...

"; +- +- $myDSN="PROVIDER=MSDASQL;DRIVER={SQL Server};" +- . "SERVER=$server;DATABASE=NorthWind;UID=adodb;PWD=natsoft;Trusted_Connection=No"; +- +- +- if ($db->PConnect($myDSN, "", "", "")) +- testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); +- else print "ERROR: MSSQL test 2 requires MS SQL 7"; +- +-} +- +-if (!empty($testmssql) && !empty($testado)) { // ADO ACCESS MSSQL with OLEDB provider +- +- $db = ADONewConnection("ado_mssql"); +- print "

Connecting DSN-less OLEDB Provider $db->databaseType...

"; +- //$db->debug=1; +- $myDSN="SERVER=localhost;DATABASE=northwind;Trusted_Connection=yes"; +- if ($db->PConnect($myDSN, "adodb", "natsoft", 'SQLOLEDB')) { +- testdb($db,"create table ADOXYZ (id int, firstname char(24), lastname char(24),created datetime)"); +- } else print "ERROR: MSSQL test 2 requires a MS SQL 7 on a server='mangrove', userid='sa', password='', database='ai'"; +- +-} +- +- +-if (extension_loaded('odbtp') && !empty($testmssql)) { // MS SQL Server via ODBC +- $db = ADONewConnection('odbtp'); +- +- $dsn = "PROVIDER=MSDASQL;Driver={SQL Server};Server=$server;Database=northwind;uid=adodb;pwd=natsoft"; +- +- if ($db->PConnect('localhost',$dsn, "", "")) { +- print "

Connecting $db->databaseType...

"; +- testdb($db,"create table ADOXYZ (id int, firstname char(24) null, lastname char(24) null,created datetime null)"); +- } +- else print "ERROR: MSSQL test 1 requires a MS SQL 7 server setup with DSN setup"; +- +-} +- +- +-print "

Tests Completed

"; +diff --git tests/testgenid.php tests/testgenid.php +deleted file mode 100644 +index 3310734a..00000000 +--- tests/testgenid.php ++++ /dev/null +@@ -1,35 +0,0 @@ +-Execute("drop table $table"); +- //$db->debug=true; +- +- $ctr = 5000; +- $lastnum = 0; +- +- while (--$ctr >= 0) { +- $num = $db->GenID($table); +- if ($num === false) { +- print "GenID returned false"; +- break; +- } +- if ($lastnum + 1 == $num) print " $num "; +- else { +- print " $num "; +- flush(); +- } +- $lastnum = $num; +- } +-} +diff --git tests/testmssql.php tests/testmssql.php +deleted file mode 100644 +index 292dc382..00000000 +--- tests/testmssql.php ++++ /dev/null +@@ -1,77 +0,0 @@ +-Connect('127.0.0.1','adodb','natsoft','northwind') or die('Fail'); +- +-$conn->debug =1; +-$query = 'select * from products'; +-$conn->SetFetchMode(ADODB_FETCH_ASSOC); +-$rs = $conn->Execute($query); +-echo "
";
+-while( !$rs->EOF ) {
+-	$output[] = $rs->fields;
+-	var_dump($rs->fields);
+-	$rs->MoveNext();
+-	print "

"; +-} +-die(); +- +- +-$p = $conn->Prepare('insert into products (productname,unitprice,dcreated) values (?,?,?)'); +-echo "

";
+-print_r($p);
+-
+-$conn->debug=1;
+-$conn->Execute($p,array('John'.rand(),33.3,$conn->DBDate(time())));
+-
+-$p = $conn->Prepare('select * from products where productname like ?');
+-$arr = $conn->getarray($p,array('V%'));
+-print_r($arr);
+-die();
+-
+-//$conn = ADONewConnection("mssql");
+-//$conn->Connect('mangrove','sa','natsoft','ai');
+-
+-//$conn->Connect('mangrove','sa','natsoft','ai');
+-$conn->debug=1;
+-$conn->Execute('delete from blobtest');
+-
+-$conn->Execute('insert into blobtest (id) values(1)');
+-$conn->UpdateBlobFile('blobtest','b1','../cute_icons_for_site/adodb.gif','id=1');
+-$rs = $conn->Execute('select b1 from blobtest where id=1');
+-
+-$output = "c:\\temp\\test_out-".date('H-i-s').".gif";
+-print "Saving file $output, size=".strlen($rs->fields[0])."

"; +-$fd = fopen($output, "wb"); +-fwrite($fd, $rs->fields[0]); +-fclose($fd); +- +-print " View Image"; +-//$rs = $conn->Execute('SELECT id,SUBSTRING(b1, 1, 10) FROM blobtest'); +-//rs2html($rs); +diff --git tests/testoci8.php tests/testoci8.php +deleted file mode 100644 +index aa66ad94..00000000 +--- tests/testoci8.php ++++ /dev/null +@@ -1,84 +0,0 @@ +- +- +-PConnect('','scott','natsoft'); +- if (!empty($testblob)) { +- $varHoldingBlob = 'ABC DEF GEF John TEST'; +- $num = time()%10240; +- // create table atable (id integer, ablob blob); +- $db->Execute('insert into ATABLE (id,ablob) values('.$num.',empty_blob())'); +- $db->UpdateBlob('ATABLE', 'ablob', $varHoldingBlob, 'id='.$num, 'BLOB'); +- +- $rs = $db->Execute('select * from atable'); +- +- if (!$rs) die("Empty RS"); +- if ($rs->EOF) die("EOF RS"); +- rs2html($rs); +- } +- $stmt = $db->Prepare('select * from adoxyz where id=?'); +- for ($i = 1; $i <= 10; $i++) { +- $rs = $db->Execute( +- $stmt, +- array($i)); +- +- if (!$rs) die("Empty RS"); +- if ($rs->EOF) die("EOF RS"); +- rs2html($rs); +- } +-} +-if (1) { +- $db = ADONewConnection('oci8'); +- $db->PConnect('','scott','natsoft'); +- $db->debug = true; +- $db->Execute("delete from emp where ename='John'"); +- print $db->Affected_Rows().'
'; +- $stmt = $db->Prepare('insert into emp (empno, ename) values (:empno, :ename)'); +- $rs = $db->Execute($stmt,array('empno'=>4321,'ename'=>'John')); +- // prepare not quite ready for prime time +- //$rs = $db->Execute($stmt,array('empno'=>3775,'ename'=>'John')); +- if (!$rs) die("Empty RS"); +- +- $db->setfetchmode(ADODB_FETCH_NUM); +- +- $vv = 'A%'; +- $stmt = $db->PrepareSP("BEGIN adodb.open_tab2(:rs,:tt); END;",true); +- $db->OutParameter($stmt, $cur, 'rs', -1, OCI_B_CURSOR); +- $db->OutParameter($stmt, $vv, 'tt'); +- $rs = $db->Execute($stmt); +- while (!$rs->EOF) { +- adodb_pr($rs->fields); +- $rs->MoveNext(); +- } +- echo " val = $vv"; +- +-} +- +-if (0) { +- $db = ADONewConnection('odbc_oracle'); +- if (!$db->PConnect('local_oracle','scott','tiger')) die('fail connect'); +- $db->debug = true; +- $rs = $db->Execute( +- 'select * from adoxyz where firstname=? and trim(lastname)=?', +- array('first'=>'Caroline','last'=>'Miranda')); +- if (!$rs) die("Empty RS"); +- if ($rs->EOF) die("EOF RS"); +- rs2html($rs); +-} +diff --git tests/testoci8cursor.php tests/testoci8cursor.php +deleted file mode 100644 +index 078ea7a6..00000000 +--- tests/testoci8cursor.php ++++ /dev/null +@@ -1,110 +0,0 @@ +-PConnect('','scott','natsoft'); +- $db->debug = 99; +- +- +-/* +-*/ +- +- define('MYNUM',5); +- +- +- $rs = $db->ExecuteCursor("BEGIN adodb.open_tab(:RS,'A%'); END;"); +- +- if ($rs && !$rs->EOF) { +- print "Test 1 RowCount: ".$rs->RecordCount()."

"; +- } else { +- print "Error in using Cursor Variables 1

"; +- } +- +- print "

Testing Stored Procedures for oci8

"; +- +- $stid = $db->PrepareSP('BEGIN adodb.myproc('.MYNUM.', :myov); END;'); +- $db->OutParameter($stid, $myov, 'myov'); +- $db->Execute($stid); +- if ($myov != MYNUM) print "

Error with myproc

"; +- +- +- $stmt = $db->PrepareSP("BEGIN adodb.data_out(:a1, :a2); END;",true); +- $a1 = 'Malaysia'; +- //$a2 = ''; # a2 doesn't even need to be defined! +- $db->InParameter($stmt,$a1,'a1'); +- $db->OutParameter($stmt,$a2,'a2'); +- $rs = $db->Execute($stmt); +- if ($rs) { +- if ($a2 !== 'Cinta Hati Malaysia') print "Stored Procedure Error: a2 = $a2

"; +- else echo "OK: a2=$a2

"; +- } else { +- print "Error in using Stored Procedure IN/Out Variables

"; +- } +- +- +- $tname = 'A%'; +- +- $stmt = $db->PrepareSP('select * from tab where tname like :tablename'); +- $db->Parameter($stmt,$tname,'tablename'); +- $rs = $db->Execute($stmt); +- rs2html($rs); +diff --git tests/testpaging.php tests/testpaging.php +deleted file mode 100644 +index 5b4a5290..00000000 +--- tests/testpaging.php ++++ /dev/null +@@ -1,87 +0,0 @@ +-PConnect('localhost','tester','test','test'); +-} +- +-if ($driver == 'access') { +- $db = NewADOConnection('access'); +- $db->PConnect("nwind", "", "", ""); +-} +- +-if ($driver == 'ibase') { +- $db = NewADOConnection('ibase'); +- $db->PConnect("localhost:e:\\firebird\\examples\\employee.gdb", "sysdba", "masterkey", ""); +- $sql = 'select distinct firstname, lastname from adoxyz order by firstname'; +- +-} +-if ($driver == 'mssql') { +- $db = NewADOConnection('mssql'); +- $db->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind'); +-} +-if ($driver == 'oci8') { +- $db = NewADOConnection('oci8'); +- $db->Connect('','scott','natsoft'); +- +-$sql = "select * from (select ID, firstname as \"First Name\", lastname as \"Last Name\" from adoxyz +- order by 1)"; +-} +- +-if ($driver == 'access') { +- $db = NewADOConnection('access'); +- $db->Connect('nwind'); +-} +- +-if (empty($driver) or $driver == 'mysql') { +- $db = NewADOConnection('mysql'); +- $db->Connect('localhost','root','','test'); +-} +- +-//$db->pageExecuteCountRows = false; +- +-$db->debug = true; +- +-if (0) { +-$rs = $db->Execute($sql); +-include_once('../toexport.inc.php'); +-print "

";
+-print rs2csv($rs); # return a string
+-
+-print '
'; +-$rs->MoveFirst(); # note, some databases do not support MoveFirst +-print rs2tab($rs); # return a string +- +-print '
'; +-$rs->MoveFirst(); +-rs2tabout($rs); # send to stdout directly +-print "
"; +-} +- +-$pager = new ADODB_Pager($db,$sql); +-$pager->showPageLinks = true; +-$pager->linksPerPage = 10; +-$pager->cache = 60; +-$pager->Render($rows=7); +diff --git tests/testpear.php tests/testpear.php +deleted file mode 100644 +index 0c6d58f4..00000000 +--- tests/testpear.php ++++ /dev/null +@@ -1,35 +0,0 @@ +-setFetchMode(ADODB_FETCH_ASSOC); +-$rs = $db->Query('select firstname,lastname from adoxyz'); +-$cnt = 0; +-while ($arr = $rs->FetchRow()) { +- print_r($arr); +- print "
"; +- $cnt += 1; +-} +- +-if ($cnt != 50) print "Error in \$cnt = $cnt"; +diff --git tests/testsessions.php tests/testsessions.php +deleted file mode 100644 +index 34836060..00000000 +--- tests/testsessions.php ++++ /dev/null +@@ -1,100 +0,0 @@ +-Notify Expiring=$ref, sessionkey=$key

"; +-} +- +-//------------------------------------------------------------------- +- +-error_reporting(E_ALL); +- +- +-ob_start(); +-include('../session/adodb-cryptsession2.php'); +- +- +-$options['debug'] = 1; +-$db = 'postgres'; +- +-#### CONNECTION +-switch($db) { +-case 'oci8': +- $options['table'] = 'adodb_sessions2'; +- ADOdb_Session::config('oci8', 'mobydick', 'jdev', 'natsoft', 'mobydick',$options); +- break; +- +-case 'postgres': +- $options['table'] = 'sessions2'; +- ADOdb_Session::config('postgres', 'localhost', 'postgres', 'natsoft', 'northwind',$options); +- break; +- +-case 'mysql': +-default: +- $options['table'] = 'sessions2'; +- ADOdb_Session::config('mysql', 'localhost', 'root', '', 'xphplens_2',$options); +- break; +- +- +-} +- +- +- +-#### SETUP NOTIFICATION +- $USER = 'JLIM'.rand(); +- $ADODB_SESSION_EXPIRE_NOTIFY = array('USER','NotifyExpire'); +- +- adodb_session_create_table(); +- session_start(); +- +- adodb_session_regenerate_id(); +- +-### SETUP SESSION VARIABLES +- if (empty($_SESSION['MONKEY'])) $_SESSION['MONKEY'] = array(1,'abc',44.41); +- else $_SESSION['MONKEY'][0] += 1; +- if (!isset($_GET['nochange'])) @$_SESSION['AVAR'] += 1; +- +- +-### START DISPLAY +- print "

PHP ".PHP_VERSION."

"; +- print "

\$_SESSION['AVAR']={$_SESSION['AVAR']}

"; +- +- print "
Cookies: "; +- print_r($_COOKIE); +- +- var_dump($_SESSION['MONKEY']); +- +-### RANDOMLY PERFORM Garbage Collection +-### In real-production environment, this is done for you +-### by php's session extension, which calls adodb_sess_gc() +-### automatically for you. See php.ini's +-### session.cookie_lifetime and session.gc_probability +- +- if (rand() % 5 == 0) { +- +- print "

Garbage Collection

"; +- adodb_sess_gc(10); +- +- if (rand() % 2 == 0) { +- print "

Random own session destroy

"; +- session_destroy(); +- } +- } else { +- $DB = ADODB_Session::_conn(); +- $sessk = $DB->qstr('%AZ'.rand().time()); +- $olddate = $DB->DBTimeStamp(time()-30*24*3600); +- $rr = $DB->qstr(rand()); +- $DB->Execute("insert into {$options['table']} (sesskey,expiry,expireref,sessdata,created,modified) values ($sessk,$olddate, $rr,'',$olddate,$olddate)"); +- } +diff --git tests/time.php tests/time.php +deleted file mode 100644 +index 8261e1e9..00000000 +--- tests/time.php ++++ /dev/null +@@ -1,16 +0,0 @@ +- +-" ); +-echo( "Converted: $convertedDate" ); //why is string returned as one day (3 not 4) less for this example?? +diff --git tests/tmssql.php tests/tmssql.php +deleted file mode 100644 +index 0f81311a..00000000 +--- tests/tmssql.php ++++ /dev/null +@@ -1,79 +0,0 @@ +-mssql"; +- $db = mssql_connect('JAGUAR\vsdotnet','adodb','natsoft') or die('No Connection'); +- mssql_select_db('northwind',$db); +- +- $rs = mssql_query('select getdate() as date',$db); +- $o = mssql_fetch_row($rs); +- print_r($o); +- mssql_free_result($rs); +- +- print "

Delete

"; flush(); +- $rs2 = mssql_query('delete from adoxyz',$db); +- $p = mssql_num_rows($rs2); +- mssql_free_result($rs2); +- +-} +- +-function tpear() +-{ +-include_once('DB.php'); +- +- print "

PEAR

"; +- $username = 'adodb'; +- $password = 'natsoft'; +- $hostname = 'JAGUAR\vsdotnet'; +- $databasename = 'northwind'; +- +- $dsn = "mssql://$username:$password@$hostname/$databasename"; +- $conn = DB::connect($dsn); +- print "date=".$conn->GetOne('select getdate()')."
"; +- @$conn->query('create table tester (id integer)'); +- print "

Delete

"; flush(); +- $rs = $conn->query('delete from tester'); +- print "date=".$conn->GetOne('select getdate()')."
"; +-} +- +-function tadodb() +-{ +-include_once('../adodb.inc.php'); +- +- print "

ADOdb

"; +- $conn = NewADOConnection('mssql'); +- $conn->Connect('JAGUAR\vsdotnet','adodb','natsoft','northwind'); +-// $conn->debug=1; +- print "date=".$conn->GetOne('select getdate()')."
"; +- $conn->Execute('create table tester (id integer)'); +- print "

Delete

"; flush(); +- $rs = $conn->Execute('delete from tester'); +- print "date=".$conn->GetOne('select getdate()')."
"; +-} +- +- +-$ACCEPTIP = '127.0.0.1'; +- +-$remote = $_SERVER["REMOTE_ADDR"]; +- +-if (!empty($ACCEPTIP)) +- if ($remote != '127.0.0.1' && $remote != $ACCEPTIP) +- die("Unauthorised client: '$remote'"); +- +-?> +-mssql +-pear +-adodb +- +- +- +- +- +- +- +- +- +- +- +- +- +-id +- +- +-id +- +- +- +-
+- +- SQL to be executed only on specific platforms +- +- insert into mytable ( row1, row2 ) values ( 12, 'postgres stuff' ) +- +- +- insert into mytable ( row1, row2 ) values ( 12, 'mysql stuff' ) +- +- +- INSERT into simple_table ( name, description ) values ( '12', 'Microsoft stuff' ) +- +- +-
+\ No newline at end of file +diff --git tests/xmlschema.xml tests/xmlschema.xml +deleted file mode 100644 +index ea48ae2b..00000000 +--- tests/xmlschema.xml ++++ /dev/null +@@ -1,33 +0,0 @@ +- +- +- +- +- An integer row that's a primary key and autoincrements +- +- +- +- +- A 16 character varchar row that can't be null +- +- +- +- row1 +- row2 +- +-
+- +- SQL to be executed only on specific platforms +- +- insert into mytable ( row1, row2 ) values ( 12, 'postgres stuff' ) +- +- +- insert into mytable ( row1, row2 ) values ( 12, 'mysql stuff' ) +- +- +- insert into mytable ( row1, row2 ) values ( 12, 'Microsoft stuff' ) +- +- +- +- +-
+-
+\ No newline at end of file diff --git a/locale/ar_IQ/manager.po b/locale/ar_IQ/manager.po index 6314c9eaa1e..ac769bf4d7e 100644 --- a/locale/ar_IQ/manager.po +++ b/locale/ar_IQ/manager.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:38+00:00\n" -"PO-Revision-Date: 2021-10-04 04:06+0000\n" +"PO-Revision-Date: 2021-12-04 03:31+0000\n" "Last-Translator: M. Ali \n" "Language-Team: Arabic \n" @@ -2125,10 +2125,10 @@ msgstr "الإشعارات" msgid "emailTemplate.variable.submission.submissionUrl" msgstr "الرابط المؤدي إلى طلب التقديم من وجهة هيئة التحرير" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "الأسماء الكاملة للمؤلفين" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "أسماء المؤلفين بصيغة جملة مختصرة" msgid "emailTemplate.variable.submission.submissionAbstract" @@ -2172,3 +2172,39 @@ msgstr "الاسم الكامل للمتلقي أو كل المتلقين" msgid "emailTemplate.variable.context.passwordLostUrl" msgstr "رابط الصفحة التي يمكن للمستخدم فيها استعادة كلمة المرور المفقودة" + +msgid "mailable.validateEmailSite.description" +msgstr "" +"هذا البريد الالكتروني يُرسل تلقائيًا إلى المستخدم الجديد عند تسجيله في " +"الموقع في حالة كون الإعدادات تتطلب التحقق من البريد الالكتروني." + +msgid "mailable.validateEmailSite.name" +msgstr "التحقق من البريد الالكتروني (الموقع)" + +msgid "mailable.mailReviewerUnassigned.description" +msgstr "هذا البريد الالكتروني يُرسل عندما يلغي المحرر تعيين المحكم." + +msgid "mailable.mailReviewerUnassigned.name" +msgstr "محكم تم إلغاء تعيينه" + +msgid "mailable.mailReviewerReinstate.description" +msgstr "" +"هذا البريد الالكتروني يُرسل عندما يُعيد المحرر المحكم الذي سبق وأن تم إلغاء " +"تعيينه." + +msgid "mailable.mailReviewerReinstate.name" +msgstr "محكم تمت إعادته" + +msgid "mailable.mailReviewerAssigned.description" +msgstr "هذا البريد الالكتروني يُرسل عند تعيين محكم لطلب التقديم." + +msgid "mailable.mailReviewerAssigned.name" +msgstr "المحكم تم تعيينه" + +msgid "mailable.mailDiscussionMessage.description" +msgstr "" +"هذا البريد الالكتروني يُرسل تلقائيًا إلى المشاركين في المناقشة عندما تُضاف " +"رسالة جديدة إليها." + +msgid "mailable.mailDiscussionMessage.name" +msgstr "رسالة جديدة من المناقشة" diff --git a/locale/ar_IQ/submission.po b/locale/ar_IQ/submission.po index b536f650df0..4b57dfe44ca 100644 --- a/locale/ar_IQ/submission.po +++ b/locale/ar_IQ/submission.po @@ -1,9 +1,10 @@ +# M. Ali , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:39+00:00\n" -"PO-Revision-Date: 2020-12-18 16:52+0000\n" +"PO-Revision-Date: 2021-12-04 03:31+0000\n" "Last-Translator: M. Ali \n" "Language-Team: Arabic \n" @@ -1916,3 +1917,6 @@ msgstr "طلب التقديم المرفوض أعيد تنشيطه." msgid "editor.submission.decision.revertDecline" msgstr "التراجع عن الرفض" + +msgid "category.category" +msgstr "الفئات" diff --git a/locale/ar_IQ/user.po b/locale/ar_IQ/user.po index 4ba48d3c508..c9488e2b687 100644 --- a/locale/ar_IQ/user.po +++ b/locale/ar_IQ/user.po @@ -141,15 +141,13 @@ msgstr "اسم الدخول أو كلمة المرور خاطئين. لطفاً msgid "user.login" msgstr "الدخول" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "رسالة تأكيد أُرسلت إلى عنوان بريدك الالكتروني. لطفاً اتبع التعليمات التي تجدها في تلك الرسالة لإعادة تعيين كلمة مرورك." msgid "user.login.lostPassword.invalidHash" msgstr "عذراً، الرابط الذي اتبعته قد انتهت صلاحيته أو ليس صحيحاً. لطفاً، جرب إعادة تعيين كلمة مرورك مرة أخرى." -msgid "user.login.lostPassword.invalidUser" -msgstr "لا يوجد مستخدم مسجل في الموقع باستعمال هذا البريد الالكتروني." - msgid "user.login.lostPassword.passwordSent" msgstr "كلمة مرور جديدة أُرسلت إلى عنوان بريدك الالكتروني. بإمكانك الآن الدخول إلى الموقع مستعملاً كلمة المرور الجديدة." diff --git a/locale/bg_BG/grid.po b/locale/bg_BG/grid.po index f5ec3e2c93b..bbc1c1b500b 100644 --- a/locale/bg_BG/grid.po +++ b/locale/bg_BG/grid.po @@ -1,7 +1,7 @@ # Cyril Kamburov , 2021. msgid "" msgstr "" -"PO-Revision-Date: 2021-11-30 13:27+0000\n" +"PO-Revision-Date: 2021-12-10 15:21+0000\n" "Last-Translator: Cyril Kamburov \n" "Language-Team: Bulgarian \n" @@ -53,3 +53,117 @@ msgstr "Настройки" msgid "grid.noItems" msgstr "Няма елементи" + +msgid "grid.action.selectFiles" +msgstr "Изберете файлове за управление" + +msgid "grid.action.editFile" +msgstr "Редактиране на файл" + +msgid "grid.action.addFile" +msgstr "Добавяне на файл" + +msgid "grid.action.addReviewer" +msgstr "Добавяне на рецензент" + +msgid "grid.action.email" +msgstr "Изпращане на имейл" + +msgid "grid.action.readReview" +msgstr "Прочитане на тази рецензия" + +msgid "grid.action.downloadAll" +msgstr "Сваляне на всички файлове като единичен архив" + +msgid "grid.action.moveItem" +msgstr "Преместване на елемент" + +msgid "grid.action.wizard" +msgstr "Помощник за настройките" + +msgid "grid.action.collapseAll" +msgstr "Редуциране на всички" + +msgid "grid.action.collapse" +msgstr "Редуциране" + +msgid "grid.action.extendAll" +msgstr "Показване на всички" + +msgid "grid.action.cancelOrdering" +msgstr "Отказ от подреждането" + +msgid "grid.action.order" +msgstr "Подреждане" + +msgid "grid.action.upgrade" +msgstr "Ъпгрейд (обновяване)" + +msgid "grid.action.addAuditor" +msgstr "Добавяне на одитор" + +msgid "grid.action.deleteAuthor" +msgstr "Изтриване на автор" + +msgid "grid.action.editAuthor" +msgstr "Редактиране на автор" + +msgid "grid.action.addAuthor" +msgstr "Добавяне на автор" + +msgid "grid.action.restoreDefaults.confirm" +msgstr "Наистина ли искате да възстановите настройките по подразбиране?" + +msgid "grid.action.restoreDefaults" +msgstr "Възстановяване на настройките по подразбиране" + +msgid "grid.action.moreInformation" +msgstr "Повече информация" + +msgid "grid.action.setApproval" +msgstr "Задаване на одобрение" + +msgid "grid.action.disapprove" +msgstr "Отмяна на одобрение" + +msgid "grid.action.approve" +msgstr "Одобрение" + +msgid "grid.action.edit" +msgstr "Редакция" + +msgid "grid.action.remove" +msgstr "Премахване" + +msgid "grid.action.editorialHistory" +msgstr "Редакционна история" + +msgid "grid.action.deleteSection" +msgstr "Изтриване на раздел" + +msgid "grid.action.export" +msgstr "Експорт" + +msgid "grid.action.editSection" +msgstr "Редактиране на раздел" + +msgid "grid.action.editMedia" +msgstr "Резакция на медия" + +msgid "grid.action.deleteMedia" +msgstr "Изтриване на медия" + +msgid "grid.action.deleteFile" +msgstr "Изтриване на файл" + +msgid "grid.action.delete" +msgstr "Изтриване" + +msgid "grid.action.reload" +msgstr "Презареждане" + +msgid "grid.action.approveCopyedit" +msgstr "Одобрете този файл с редакция за следващ етап на обработка" + +msgid "grid.action.unassignReviewer" +msgstr "Отменяне на рецензент" diff --git a/locale/bg_BG/user.po b/locale/bg_BG/user.po index ab023672b1c..539c8f9842a 100644 --- a/locale/bg_BG/user.po +++ b/locale/bg_BG/user.po @@ -272,14 +272,12 @@ msgstr "" "На вашия имейл адрес е изпратена нова парола. Вече можете да влезете в сайта " "с новата си парола." -msgid "user.login.lostPassword.invalidUser" -msgstr "Не съществува потребител с посочения имейл адрес." - msgid "user.login.lostPassword.invalidHash" msgstr "" "За съжаление връзката, върху която сте щракнали, е изтекла или не е валидна. " "Моля, опитайте да нулирате паролата си отново." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "" "На вашия имейл адрес е изпратено потвърждение. Моля, следвайте инструкциите " diff --git a/locale/bs_BA/user.po b/locale/bs_BA/user.po index c6d436aad0f..6c45e5f36f7 100644 --- a/locale/bs_BA/user.po +++ b/locale/bs_BA/user.po @@ -72,15 +72,13 @@ msgstr "Zaboravili ste lozinku?" msgid "user.login" msgstr "Prijava" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Potvrda je poslana na vašu adresu e-pošte. Molimo slijedite upute u e-pošti zbog ponovnog uspostavljanja vaše lozinke." msgid "user.login.lostPassword.invalidHash" msgstr "Oprostite, poveznica na koju ste kliknuli nije važeća ili nije valjana. Molimo pokušajte ponovno zatražiti izmjenu vaše lozinke." -msgid "user.login.lostPassword.invalidUser" -msgstr "Ne postoji korisnik s navedenom adresom e-pošte." - msgid "user.login.lostPassword.passwordSent" msgstr "Nova lozinka je poslana na vašu adresu e-pošte. Možete se sada prijaviti na stranici s vašom novom lozinkom." diff --git a/locale/ca_ES/user.po b/locale/ca_ES/user.po index 3833124c253..325b45da36b 100644 --- a/locale/ca_ES/user.po +++ b/locale/ca_ES/user.po @@ -114,15 +114,13 @@ msgstr "El nom d'usuari/ària o la contrasenya són no vàlids. Torneu-ho a inte msgid "user.login" msgstr "Inici de la sessió" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "S'ha enviat un missatge de confirmació a la vostra adreça electrònica. Seguiu les instruccions del correu electrònic per restablir la contrasenya." msgid "user.login.lostPassword.invalidHash" msgstr "L'enllaç que heu seleccionat ha vençut o bé no és vàlid. Intenteu restablir la contrasenya de nou." -msgid "user.login.lostPassword.invalidUser" -msgstr "No existeix cap usuari/usuària amb l’adreça electrònica especificada." - msgid "user.login.lostPassword.passwordSent" msgstr "S'ha enviat una nova contrasenya a la vostra adreça electrònica. Ja podeu iniciar la sessió amb aquesta contrasenya." diff --git a/locale/cs_CZ/admin.po b/locale/cs_CZ/admin.po index 78f31f184a8..426e5ff170e 100644 --- a/locale/cs_CZ/admin.po +++ b/locale/cs_CZ/admin.po @@ -1,9 +1,10 @@ +# Jiří Dlouhý , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:40+00:00\n" -"PO-Revision-Date: 2021-04-30 07:17+0000\n" +"PO-Revision-Date: 2022-01-11 15:46+0000\n" "Last-Translator: Jiří Dlouhý \n" "Language-Team: Czech \n" @@ -332,3 +333,6 @@ msgstr "Omezit hromadné e-maily" msgid "admin.settings.enableBulkEmails.label" msgstr "Hromadné e-maily" + +msgid "admin.scheduledTask.statisticsReport" +msgstr "Upozornění na redakční zprávu" diff --git a/locale/cs_CZ/grid.po b/locale/cs_CZ/grid.po index 88aa58e0a00..5f7ec7f9648 100644 --- a/locale/cs_CZ/grid.po +++ b/locale/cs_CZ/grid.po @@ -1,9 +1,10 @@ +# Jiří Dlouhý , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:41+00:00\n" -"PO-Revision-Date: 2021-04-30 07:17+0000\n" +"PO-Revision-Date: 2021-12-20 15:29+0000\n" "Last-Translator: Jiří Dlouhý \n" "Language-Team: Czech \n" @@ -673,3 +674,37 @@ msgstr "Zobrazit/vybrat uživatele" msgid "grid.action.removeUserGroup" msgstr "Odebrat tuto skupinu uživatelů" + +msgid "contributor.listPanel.preview.full" +msgstr "Plný" + +msgid "contributor.listPanel.preview.publicationLists" +msgstr "Seznam publikací" + +msgid "contributor.listPanel.preview.abbreviated" +msgstr "Zkráceně" + +msgid "contributor.listPanel.preview.display" +msgstr "Zobrazení" + +msgid "contributor.listPanel.preview.format" +msgstr "Formát" + +msgid "contributor.listPanel.preview.description" +msgstr "" +"Přispěvatelé do této publikace budou v časopise uvedeni v následujících " +"formátech." + +msgid "contributor.listPanel.preview" +msgstr "Náhled" + +msgid "author.users.contributor.setPrincipalContact" +msgstr "Nastavit primární kontakt" + +msgid "grid.action.deleteContributor.confirmationMessage" +msgstr "" +"Jste si jisti, že chcete odebrat {$jméno} jako přispěvatele? Tuto akci nelze " +"vzít zpět." + +msgid "grid.action.saveOrdering" +msgstr "Uložit pořadí" diff --git a/locale/cs_CZ/manager.po b/locale/cs_CZ/manager.po index 3f474f52604..d0d695767e5 100644 --- a/locale/cs_CZ/manager.po +++ b/locale/cs_CZ/manager.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:41+00:00\n" -"PO-Revision-Date: 2021-11-16 03:30+0000\n" +"PO-Revision-Date: 2021-12-24 03:18+0000\n" "Last-Translator: Jiří Dlouhý \n" "Language-Team: Czech \n" @@ -2252,10 +2252,10 @@ msgstr "Id: {$id}" msgid "emailTemplate.variable.submission.submissionUrl" msgstr "URL adresa příspěvku v redakčním backendu" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "Plná jména autorů" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "Jména autorů ve zkrácené formě" msgid "emailTemplate.variable.submission.submissionAbstract" @@ -2334,3 +2334,6 @@ msgstr "" msgid "mailable.mailDiscussionMessage.name" msgstr "Nová diskusní zpráva" + +msgid "emailTemplate.variable.site.siteContactEmail" +msgstr "E-mail hlavní kontaktní osoby webové stránky" diff --git a/locale/cs_CZ/reviewer.po b/locale/cs_CZ/reviewer.po index 5846758bf8d..9616c65edfd 100644 --- a/locale/cs_CZ/reviewer.po +++ b/locale/cs_CZ/reviewer.po @@ -1,10 +1,11 @@ +# Michal Jelínek , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:41+00:00\n" -"PO-Revision-Date: 2021-03-12 19:38+0000\n" -"Last-Translator: Jiří Dlouhý \n" +"PO-Revision-Date: 2021-12-22 10:00+0000\n" +"Last-Translator: Michal Jelínek \n" "Language-Team: Czech \n" "Language: cs_CZ\n" @@ -39,7 +40,7 @@ msgid "reviewer.submission.reviewerFiles" msgstr "Soubory recenzenta" msgid "reviewer.submission.declineReview" -msgstr "Odmítnout požadavek na recenzi¨" +msgstr "Odmítnout požadavek na recenzi" msgid "reviewer.submission.declineReviewMessage" msgstr "V následujícím poli můžete uvést důvody odmítnutí recenze." diff --git a/locale/cs_CZ/submission.po b/locale/cs_CZ/submission.po index f88c81c80f0..5799a6d72ee 100644 --- a/locale/cs_CZ/submission.po +++ b/locale/cs_CZ/submission.po @@ -1,9 +1,10 @@ +# Jiří Dlouhý , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:41+00:00\n" -"PO-Revision-Date: 2021-05-04 01:41+0000\n" +"PO-Revision-Date: 2021-12-20 15:29+0000\n" "Last-Translator: Jiří Dlouhý \n" "Language-Team: Czech \n" @@ -888,7 +889,8 @@ msgid "submission.submit.fileAdded" msgstr "Přehled přidaných souborů" msgid "submission.submit.includeInBrowse" -msgstr "Přidat tohoto autora do seznamu k prohlížení?" +msgstr "" +"Uveďte tohoto přispěvatele při identifikaci autorů v seznamech publikací." msgid "submission.submit.newFile" msgstr "Přidat další soubor" @@ -2002,3 +2004,9 @@ msgstr "" "Jeden nebo více recenzentů zmeškalo termín. Redakční tým byl upozorněn a " "přijme opatření, aby zajistil dokončení recenzí. V tuto chvíli nemusíte " "podnikat žádné kroky. Až bude učiněno rozhodnutí, budete upozorněni." + +msgid "category.category" +msgstr "Kategorie" + +msgid "submission.submit.includeInBrowse.title" +msgstr "Seznam publikací" diff --git a/locale/cs_CZ/user.po b/locale/cs_CZ/user.po index 35173e7595b..9f900e9bc07 100644 --- a/locale/cs_CZ/user.po +++ b/locale/cs_CZ/user.po @@ -1,9 +1,10 @@ +# Jiří Dlouhý , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:41+00:00\n" -"PO-Revision-Date: 2021-01-03 17:40+0000\n" +"PO-Revision-Date: 2021-12-20 15:29+0000\n" "Last-Translator: Jiří Dlouhý \n" "Language-Team: Czech \n" @@ -92,15 +93,13 @@ msgstr "Neplatné uživatelské jméno nebo heslo. Zkuste to prosím znovu." msgid "user.login" msgstr "Přihlášení" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Na Vaši emailovou adresu bylo odesláno potvrzení. Následujte prosím instrukce pro resetování Vašeho hesla uvedené v emailu." msgid "user.login.lostPassword.invalidHash" msgstr "Promiňte, odkaz, na který jste kliknul, vypršel nebo není platný. Pokuste se prosím znovu resetovat heslo." -msgid "user.login.lostPassword.invalidUser" -msgstr "Neexistuje žádný uživatel s uvedenou emailovou adresou." - msgid "user.login.lostPassword.passwordSent" msgstr "Nové heslo bylo odesláno na Vaši emailovou adresu. Nyní se můžete přihlásit pomocí nového hesla." @@ -463,8 +462,8 @@ msgstr "Je nutné zadat jméno." msgid "user.preferredPublicName.description" msgstr "" -"Jak si přejete být oslovován? Pokud chcete, můžete sem přidat pozdravy, " -"prostřední jména a tituly." +"Uveďte prosím celé jméno jak by autor měl být uveden v publikované práci. " +"Příklad: Dr. Alan P. Mwandenga" msgid "user.preferredPublicName" msgstr "Upřednostňované veřejné jméno" diff --git a/locale/da_DK/admin.po b/locale/da_DK/admin.po index da92edc3824..b7b7e7bfdb7 100644 --- a/locale/da_DK/admin.po +++ b/locale/da_DK/admin.po @@ -1,10 +1,11 @@ +# Alexandra Fogtmann-Schulz , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:41+00:00\n" -"PO-Revision-Date: 2021-01-21 12:53+0000\n" -"Last-Translator: Niels Erik Frederiksen \n" +"PO-Revision-Date: 2022-01-11 07:22+0000\n" +"Last-Translator: Alexandra Fogtmann-Schulz \n" "Language-Team: Danish \n" "Language: da_DK\n" @@ -346,3 +347,6 @@ msgstr "Begræns masse-e-mails" msgid "admin.settings.enableBulkEmails.label" msgstr "Masse-emails" + +msgid "admin.scheduledTask.statisticsReport" +msgstr "Notifikation om redaktionel rapport" diff --git a/locale/da_DK/grid.po b/locale/da_DK/grid.po index f3bcb6dc34e..811172e4b3d 100644 --- a/locale/da_DK/grid.po +++ b/locale/da_DK/grid.po @@ -1,12 +1,14 @@ +# Alexandra Fogtmann-Schulz , 2021. +# Jesper B. Thestrup , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:42+00:00\n" -"PO-Revision-Date: 2020-02-10 18:31+0000\n" -"Last-Translator: Niels Erik Frederiksen \n" -"Language-Team: Danish " -"\n" +"PO-Revision-Date: 2021-12-22 12:24+0000\n" +"Last-Translator: Jesper B. Thestrup \n" +"Language-Team: Danish \n" "Language: da_DK\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -679,3 +681,37 @@ msgstr "Opret en ny udgave" msgid "grid.action.removeUserGroup" msgstr "Fjern denne brugergruppe" + +msgid "contributor.listPanel.preview.publicationLists" +msgstr "Lister over udgivelser" + +msgid "contributor.listPanel.preview.abbreviated" +msgstr "Forkortet" + +msgid "contributor.listPanel.preview.display" +msgstr "Vis" + +msgid "contributor.listPanel.preview.description" +msgstr "" +"Bidragydere til denne publikation vil blive identificeret i dette tidsskrift " +"i de følgende formater." + +msgid "contributor.listPanel.preview" +msgstr "Forhåndsvisning" + +msgid "author.users.contributor.setPrincipalContact" +msgstr "Vælg som primær kontakt" + +msgid "grid.action.deleteContributor.confirmationMessage" +msgstr "" +"Er du sikker på, at du ønsker at fjerne {$name} som bidragyder? Denne " +"handling kan ikke fortrydes." + +msgid "grid.action.saveOrdering" +msgstr "Gem rækkefølge" + +msgid "contributor.listPanel.preview.full" +msgstr "Fuldt" + +msgid "contributor.listPanel.preview.format" +msgstr "Format" diff --git a/locale/da_DK/manager.po b/locale/da_DK/manager.po index 4881cacfaa3..18c845ca295 100644 --- a/locale/da_DK/manager.po +++ b/locale/da_DK/manager.po @@ -1,11 +1,12 @@ # Niels Erik Frederiksen , 2021. +# Alexandra Fogtmann-Schulz , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:42+00:00\n" -"PO-Revision-Date: 2021-11-16 03:30+0000\n" -"Last-Translator: Niels Erik Frederiksen \n" +"PO-Revision-Date: 2022-01-06 09:25+0000\n" +"Last-Translator: Alexandra Fogtmann-Schulz \n" "Language-Team: Danish \n" "Language: da_DK\n" @@ -2323,10 +2324,10 @@ msgstr "URL til en side, hvor brugeren kan gendanne en mistet adgangskode" msgid "emailTemplate.variable.submission.submissionUrl" msgstr "Indsendelsens URL i den redaktionelle backend" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "Forfatternes fulde navne" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "Forfatternavne i form af en forkortet streng" msgid "emailTemplate.variable.submission.submissionAbstract" @@ -2405,3 +2406,6 @@ msgstr "" msgid "mailable.mailDiscussionMessage.name" msgstr "Ny besked under drøftelser" + +msgid "emailTemplate.variable.site.siteContactEmail" +msgstr "E-mail på webstedets primære kontaktperson" diff --git a/locale/da_DK/submission.po b/locale/da_DK/submission.po index 18ea60e5641..ffbce56241c 100644 --- a/locale/da_DK/submission.po +++ b/locale/da_DK/submission.po @@ -1,10 +1,12 @@ +# Niels Erik Frederiksen , 2021. +# Alexandra Fogtmann-Schulz , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:43+00:00\n" -"PO-Revision-Date: 2020-12-09 09:51+0000\n" -"Last-Translator: Niels Erik Frederiksen \n" +"PO-Revision-Date: 2021-12-21 08:58+0000\n" +"Last-Translator: Alexandra Fogtmann-Schulz \n" "Language-Team: Danish \n" "Language: da_DK\n" @@ -1043,7 +1045,9 @@ msgid "submission.submit.selectPrincipalContact" msgstr "Primær kontaktperson for redaktionel korrespondance." msgid "submission.submit.includeInBrowse" -msgstr "Tilføj denne bidragyder til oversigtslisten?" +msgstr "" +"Tilføj denne bidragyder når forfattere identificeres i lister over " +"udgivelser." msgid "submission.upload.query" msgstr "Upload indlægsfil" @@ -2003,3 +2007,9 @@ msgstr "Afvist indsendelse genaktiveret." msgid "editor.submission.decision.revertDecline" msgstr "Omgør afvisning" + +msgid "category.category" +msgstr "Kategorier" + +msgid "submission.submit.includeInBrowse.title" +msgstr "Lister over udgivelser" diff --git a/locale/da_DK/user.po b/locale/da_DK/user.po index aaac46e0f01..98b6166b5ae 100644 --- a/locale/da_DK/user.po +++ b/locale/da_DK/user.po @@ -1,10 +1,11 @@ +# Alexandra Fogtmann-Schulz , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:43+00:00\n" -"PO-Revision-Date: 2020-11-30 10:51+0000\n" -"Last-Translator: Niels Erik Frederiksen \n" +"PO-Revision-Date: 2021-12-22 12:24+0000\n" +"Last-Translator: Alexandra Fogtmann-Schulz \n" "Language-Team: Danish \n" "Language: da_DK\n" @@ -73,15 +74,13 @@ msgstr "Ugyldigt brugernavn eller ugyldig adgangskode. Forsøg igen." msgid "user.login" msgstr "Login" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Der er sendt en bekræftelse til din e-mail-adresse. Følg instruktionerne i e-mailen for at nulstille din adgangskode." msgid "user.login.lostPassword.invalidHash" msgstr "Det link, du har klikket på, er udløbet eller er ikke gyldigt. Forsøg at nulstille din adgangskode igen." -msgid "user.login.lostPassword.invalidUser" -msgstr "Der findes ingen brugere med den angivne e-mail-adresse." - msgid "user.login.lostPassword.passwordSent" msgstr "Der er sendt en ny adgangskode til din e-mail-adresse. Du kan nu logge på webstedet med din nye adgangskode." @@ -458,5 +457,5 @@ msgstr "Foretrukket offentligt navn" msgid "user.preferredPublicName.description" msgstr "" -"Hvordan foretrækker du at blive tiltalt? Indledende hilsen, mellemnavne og " -"suffikser kan tilføjes her, hvis du ønsker det." +"Angiv forfatterens fulde navn, som det skal stå på udgivelsen. Fx: Dr. Alan " +"P. Mwandenga" diff --git a/locale/de_DE/manager.po b/locale/de_DE/manager.po index 4209b0a4dd8..bee00d1c74b 100644 --- a/locale/de_DE/manager.po +++ b/locale/de_DE/manager.po @@ -5,7 +5,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-27T09:47:24-07:00\n" -"PO-Revision-Date: 2021-10-21 09:07+0000\n" +"PO-Revision-Date: 2021-12-08 09:39+0000\n" "Last-Translator: Pia Piontkowitz \n" "Language-Team: German \n" @@ -2275,3 +2275,44 @@ msgid "emailTemplate.variable.context.passwordLostUrl" msgstr "" "Die URL zu einer Seite auf der ein/e Nutzer/in ein verlorenes Passwort " "wiederherstellen kann" + +msgid "mailable.validateEmailSite.description" +msgstr "" +"Diese E-Mail wird automatisch an neue Nutzer/innen gesendet wenn sie sich " +"auf der Seite registrieren, sofern die Überprüfung der E-Mail Adresse in den " +"Einstellungen verlangt wird." + +msgid "mailable.validateEmailSite.name" +msgstr "E-Mail überprüfen (Seite)" + +msgid "mailable.mailReviewerUnassigned.description" +msgstr "" +"Diese E-Mail wird verschickt wenn ein Editor die Zuordnung eines/r Gutachter/" +"in rückgängig macht." + +msgid "mailable.mailReviewerUnassigned.name" +msgstr "Gutachter/in nicht mehr zugeordnet" + +msgid "mailable.mailReviewerReinstate.description" +msgstr "" +"Diese E-Mail wird verschickt wenn ein/e Gutachter/in, die/der nicht mehr " +"zugeordnet war, von einem Editor wieder eingesetzt wird." + +msgid "mailable.mailReviewerReinstate.name" +msgstr "Gutachter/in wieder eingesetzt" + +msgid "mailable.mailReviewerAssigned.description" +msgstr "" +"Diese E-Mail wird verschickt wenn ein/e Gutachter/in einer Einreichung " +"zugewiesen wird." + +msgid "mailable.mailReviewerAssigned.name" +msgstr "Gutachter/in zugewiesen" + +msgid "mailable.mailDiscussionMessage.description" +msgstr "" +"Diese E-Mail wird automatisch an Diskussionsteilnehmende verschickt wenn ein " +"neuer Beitrag zu einer Diskussion hinzugefügt wurde." + +msgid "mailable.mailDiscussionMessage.name" +msgstr "Neuer Diskussionsbeitrag" diff --git a/locale/de_DE/submission.po b/locale/de_DE/submission.po index 76541e70a5a..eaf83c8d784 100644 --- a/locale/de_DE/submission.po +++ b/locale/de_DE/submission.po @@ -1,11 +1,12 @@ # Sebastian Wolf , 2021. +# Pia Piontkowitz , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-27T09:47:24-07:00\n" -"PO-Revision-Date: 2021-07-14 11:03+0000\n" -"Last-Translator: Sebastian Wolf \n" +"PO-Revision-Date: 2021-12-08 09:39+0000\n" +"Last-Translator: Pia Piontkowitz \n" "Language-Team: German \n" "Language: de_DE\n" @@ -2007,3 +2008,6 @@ msgid "submission.upload.instructions" msgstr "" "Laden Sie hier alle Dateien hoch, die die Redaktion zur Bewertung Ihrer " "Einreichung benötigt." + +msgid "category.category" +msgstr "Kategorien" diff --git a/locale/de_DE/user.po b/locale/de_DE/user.po index 2713176184f..4b776e06559 100644 --- a/locale/de_DE/user.po +++ b/locale/de_DE/user.po @@ -142,15 +142,13 @@ msgstr "Benutzer/innen-Name oder Passwort ungültig. Versuchen Sie es erneut." msgid "user.login" msgstr "Einloggen" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Eine Bestätigung wurde an Ihre E-Mail-Adresse versandt. Zur Wiederherstellung Ihres Passwortes folgen Sie bitte den Anweisungen aus der E-Mail." msgid "user.login.lostPassword.invalidHash" msgstr "Leider ist der Link, den Sie angeklickt haben, abgelaufen oder ungültig. Versuchen Sie bitte erneut, Ihr Passwort wiederherzustellen." -msgid "user.login.lostPassword.invalidUser" -msgstr "Zu der angegebenen E-Mail-Adresse existiert kein/e Benutzer/in." - msgid "user.login.lostPassword.passwordSent" msgstr "Ein neues Passwort wurde an Ihre E-Mail-Adresse versandt. Sie können sich jetzt mit dem neuen Passwort einloggen." diff --git a/locale/el_GR/admin.po b/locale/el_GR/admin.po index f9230e0a283..ab7405babc0 100644 --- a/locale/el_GR/admin.po +++ b/locale/el_GR/admin.po @@ -1,12 +1,13 @@ +# Jonas Raoni Soares da Silva , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:43+00:00\n" -"PO-Revision-Date: 2020-07-17 23:36+0000\n" -"Last-Translator: Manolis Saldaris \n" -"Language-Team: Greek " -"\n" +"PO-Revision-Date: 2021-12-26 09:24+0000\n" +"Last-Translator: Jonas Raoni Soares da Silva \n" +"Language-Team: Greek \n" "Language: el_GR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -42,7 +43,10 @@ msgid "admin.clearTemplateCache" msgstr "Καθαρισμός κρυφής μνήμης προτύπων" msgid "admin.configFileUpdatedInstructions" -msgstr "Το αρχείο ρυθμίσεων ενημερώθηκε επιτυχώς. Σε περίπτωση που ο ιστότοπος δεν λειτουργεί σωστά, ίσως χρειαστεί να παραμετροποιήσετε χειροκίνητα τις ρυθμίσεις με άμεση επεξεργασία του αρχείου <tt>config.inc.php</tt>." +msgstr "" +"Το αρχείο ρυθμίσεων ενημερώθηκε επιτυχώς. Σε περίπτωση που ο ιστότοπος δεν " +"λειτουργεί σωστά, ίσως χρειαστεί να παραμετροποιήσετε χειροκίνητα τις " +"ρυθμίσεις με άμεση επεξεργασία του αρχείου config.inc.php." msgid "admin.confirmClearTemplateCache" msgstr "Επιβεβαιώνετε τη διαγραφή των υπαρχόντων προτύπων από την κρυφή μνήμη;" @@ -63,7 +67,12 @@ msgid "admin.dateInstalled" msgstr "Ημερομηνία εγκατάστασης" msgid "admin.displayConfigFileInstructions" -msgstr "Τα περιεχόμενα των ενημερωμένων ρυθμίσεων εμφανίζονται παρακάτω. Για να εφαρμόσετε τις αλλαγές στις ρυθμίσεις πρέπει να ανοίξετε το αρχείο <tt>config.inc.php</tt> με κατάλληλο πρόγραμμα επεξεργασίας κειμένου και να αντικαταστήσετε τα περιεχόμενά του με το περιεχόμενο του ακόλουθου πεδίου κειμένου." +msgstr "" +"Τα περιεχόμενα των ενημερωμένων ρυθμίσεων εμφανίζονται παρακάτω. Για να " +"εφαρμόσετε τις αλλαγές στις ρυθμίσεις πρέπει να ανοίξετε το αρχείο " +"config.inc.php με κατάλληλο πρόγραμμα επεξεργασίας κειμένου και να " +"αντικαταστήσετε τα περιεχόμενά του με το περιεχόμενο του ακόλουθου πεδίου " +"κειμένου." msgid "admin.displayNewSystemConfig" msgstr "Προβολή νέων ρυθμίσεων" @@ -228,7 +237,9 @@ msgid "admin.siteSetup" msgstr "Παραμετροποίηση λειτουργιών ιστοτόπου" msgid "admin.systemConfigFileReadError" -msgstr "Το αρχείο ρυθμίσεων <tt>config.inc.php</tt> δεν υπάρχει, δεν είναι αναγνώσιμο, ή δεν είναι έγκυρο." +msgstr "" +"Το αρχείο ρυθμίσεων config.inc.php δεν υπάρχει, δεν είναι " +"αναγνώσιμο, ή δεν είναι έγκυρο." msgid "admin.systemInformation" msgstr "Πληροφορίες συστήματος" diff --git a/locale/el_GR/common.po b/locale/el_GR/common.po index 6518ef78597..dff285f322e 100644 --- a/locale/el_GR/common.po +++ b/locale/el_GR/common.po @@ -1,10 +1,11 @@ +# Jonas Raoni Soares da Silva , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:43+00:00\n" -"PO-Revision-Date: 2020-07-30 21:15+0000\n" -"Last-Translator: Manolis Saldaris \n" +"PO-Revision-Date: 2021-12-26 09:24+0000\n" +"Last-Translator: Jonas Raoni Soares da Silva \n" "Language-Team: Greek \n" "Language: el_GR\n" @@ -209,18 +210,34 @@ msgstr "Επικύρωση" msgid "common.ccLicense" msgstr "" "\n" -"\t\t<a target=\"_new\" rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/4.0/deed.el\">\n" -"\t\t\t<img alt=\"Creative Commons License\" class=\"EKT_CreativeCommons_IMG\" src=\"https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png\"/>\n" -"\t\t</a>\n" -"\t\t<br/>\n" -"\t\t<span>\n" -" Η χρήση του περιεχομένου καθορίζεται από την άδεια <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc-sa/4.0/deed.el\" target=\"_new\">Creative Commons Αναφορά Δημιουργού - Μη Εμπορική Χρήση - Παρόμοια Διανομή 4.0 Διεθνές</a> </span>" +"\t\t

\n" +"\t\t\n" +"\t\t\t\"Creative\n" +"\t\t\n" +"\t\t
\n" +"\t\tΗ χρήση του περιεχομένου καθορίζεται από την άδεια " +"Creative Commons Αναφορά Δημιουργού - Μη Εμπορική Χρήση - Παρόμοια Διανομή " +"4.0 Διεθνές.\n" +"\t" msgid "common.ccLicense.rt" msgstr "" "\n" -"\t\tΗ χρήση του περιεχομένου καθορίζεται από την άδεια Creative Commons Αναφορά Δημιουργού - Μη Εμπορική Χρήση - Παρόμοια Διανομή 4.0 Διεθνές\n" -"\t\t" +"\t
\n" +"\t\t
\n" +"\t\t\"Creative\n" +"\t\t
\n" +"\t\tΗ χρήση του περιεχομένου καθορίζεται από την άδεια " +"Creative Commons Αναφορά Δημιουργού - Μη Εμπορική Χρήση - Παρόμοια Διανομή " +"4.0 Διεθνές.\n" +"\t
\n" +"\t" msgid "common.changesSaved" msgstr "Οι αλλαγές σας αποθηκεύτηκαν." @@ -361,7 +378,9 @@ msgid "common.error.databaseErrorUnknown" msgstr "Προέκυψε άγνωστο σφάλμα στη σύνδεση της βάσης δεδομένων." msgid "common.error.framesRequired" -msgstr "Αυτή η σελίδα απαιτεί πλαίσια. <a href=\"{$url}\">Πατήστε εδώ</a> για την έκδοση χωρίς πλαίσια." +msgstr "" +"Αυτή η σελίδα απαιτεί πλαίσια. Πατήστε εδώ για την " +"έκδοση χωρίς πλαίσια." msgid "common.event" msgstr "Συμβάν" diff --git a/locale/el_GR/user.po b/locale/el_GR/user.po index d99e239e804..90861c77106 100644 --- a/locale/el_GR/user.po +++ b/locale/el_GR/user.po @@ -140,15 +140,13 @@ msgstr "Μη έγκυρο όνομα Χρήστη ή κωδικος πρόσβα msgid "user.login" msgstr "Σύνδεση" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Ένα μήνυμα επιβεβαίωσης έχει σταλεί στο ηλεκτρονικό σας ταχυδρομείο. Παρακαλούμε ακολουθήστε τις οδηγίες του μηνύματος για να αλλάξετε τον προσωπικό σας κωδικό πρόσβασης." msgid "user.login.lostPassword.invalidHash" msgstr "Η σύνδεση έχει λήξει ή δεν είναι έγκυρη. Παρακαλούμε προσπαθήστε ξανά να αλλάξετε τον προσωπικό σας κωδικό πρόσβασης." -msgid "user.login.lostPassword.invalidUser" -msgstr "Δε βρέθηκε Χρήστης με τη συγκεκριμένη διεύθυνση ηλεκτρονικού ταχυδρομείου." - msgid "user.login.lostPassword.passwordSent" msgstr "Ένας νέος κωδικός πρόσβασης έχει σταλεί στο ηλεκτρονικό σας ταχυδρομείο. Μπορείτε να συνδεθείτε στον ιστότοπο με την χρήση του νέου σας κωδικού." diff --git a/locale/en_US/admin.po b/locale/en_US/admin.po index 6aa9ab41668..e1db6209c23 100644 --- a/locale/en_US/admin.po +++ b/locale/en_US/admin.po @@ -137,6 +137,9 @@ msgstr "Publish submissions scheduled for publication" msgid "admin.scheduledTask.reviewReminder" msgstr "Review reminder" +msgid "admin.scheduledTask.statisticsReport" +msgstr "Editorial Report Notification" + msgid "admin.scheduledTask.subscriptionExpiryReminder" msgstr "Subscription expiry reminder" diff --git a/locale/en_US/api.po b/locale/en_US/api.po index 3680de59c6d..c9846937f49 100644 --- a/locale/en_US/api.po +++ b/locale/en_US/api.po @@ -23,6 +23,9 @@ msgstr "The API token could not be validated. This may indicate an error in the msgid "api.400.tokenCouldNotBeDecoded" msgstr "The apiToken could not be decoded because of the following error: {$error}" +msgid "api.400.requireEmailSubjectBody" +msgstr "You must provide a subject and body for the email." + msgid "api.files.400.notAllowedCreatedAt" msgstr "It is not possible to change the time this was created." @@ -44,6 +47,9 @@ msgstr "The announcement you requested was not found." msgid "api.contexts.400.localesNotSupported" msgstr "The following locales are not supported: {$locales}." +msgid "api.decisions.403.alreadyPublished" +msgstr "You can not record a decision or recommend a decision for this submission because it has already been published." + msgid "api.emails.400.missingBody" msgstr "You must include an email to be sent." @@ -143,9 +149,15 @@ msgstr "You must specify a review round when requesting files in a review stage. msgid "api.submissionFiles.400.noFileStageId" msgstr "You must provide a file stage." +msgid "api.submissionFiles.400.invalidFileStage" +msgstr "The file stage you provided is not valid." + msgid "api.submissionsFiles.400.noParams" msgstr "No changes could be found in the request to edit this file." +msgid "api.submissionFiles.400.reviewRoundIdRequired" +msgstr "You must provide a review round id when moving a file to this file stage." + msgid "api.submissionFiles.400.reviewRoundSubmissionNotMatch" msgstr "The review round you provided is not part of this submission." diff --git a/locale/en_US/common.po b/locale/en_US/common.po index 391c09fd778..522f3d5c9ac 100644 --- a/locale/en_US/common.po +++ b/locale/en_US/common.po @@ -125,9 +125,18 @@ msgstr "Inactive" msgid "common.add" msgstr "Add" +msgid "common.addCCBCC" +msgstr "Add CC/BCC" + msgid "common.addSelf" msgstr "Add Self" +msgid "common.attachedFiles" +msgstr "Attached Files" + +msgid "common.attachFiles" +msgstr "Attach Files" + msgid "common.name" msgstr "Name" @@ -306,6 +315,9 @@ msgstr "Deleting" msgid "common.deleteSelection" msgstr "Delete Selection" +msgid "common.deselect" +msgstr "Deselect" + msgid "common.designation" msgstr "Designation" @@ -405,6 +417,9 @@ msgstr "Add filter: {$filterTitle}" msgid "common.filterRemove" msgstr "Clear filter: {$filterTitle}" +msgid "common.findTemplate" +msgstr "Find Template" + msgid "common.from" msgstr "From" @@ -468,6 +483,12 @@ msgstr "{$value} or less" msgid "common.lessThanOnly" msgstr "Less than" +msgid "common.loadTemplate" +msgstr "Load a Template" + +msgid "common.keepWorking" +msgstr "Keep Working" + msgid "common.commaListSeparator" msgstr ", " @@ -546,6 +567,9 @@ msgstr "Notified: {$dateNotified}" msgid "common.noMatches" msgstr "No Matches" +msgid "common.numberedMore" +msgstr "{$number} more" + msgid "common.off" msgstr "Off" @@ -702,6 +726,9 @@ msgstr "Saving" msgid "common.search" msgstr "Search" +msgid "common.searching" +msgstr "Searching" + msgid "common.searchQuery" msgstr "Search Query" @@ -729,6 +756,9 @@ msgstr "Select {$name}" msgid "common.sendEmail" msgstr "Send Email" +msgid "common.showAllSteps" +msgstr "Show all steps" + msgid "common.size" msgstr "Size" @@ -753,6 +783,9 @@ msgstr "Subtitle" msgid "common.suggest" msgstr "Suggest" +msgid "common.switchTo" +msgstr "Switch to" + msgid "common.title" msgstr "Title" @@ -807,6 +840,9 @@ msgstr "Add File" msgid "common.upload.addFile" msgstr "Upload File" +msgid "common.upload.addFile.description" +msgstr "Upload a file from your computer." + msgid "common.upload.restore" msgstr "Restore Original" @@ -831,6 +867,9 @@ msgstr "[Nonexistent user]" msgid "common.view" msgstr "View" +msgid "common.viewError" +msgstr "View Error" + msgid "common.viewWithName" msgstr "View {$name}" @@ -900,6 +939,30 @@ msgstr "Upload File" msgid "email.addAttachment" msgstr "Add Attachment" +msgid "email.addAttachment.submissionFiles.attach" +msgstr "Attach Submission Files" + +msgid "email.addAttachment.submissionFiles.submissionDescription" +msgstr "Attach files uploaded by the author in the submission stage." + +msgid "email.addAttachment.submissionFiles.reviewDescription" +msgstr "Attach files uploaded during the submission workflow, such as revisions or files to be reviewed." + +msgid "email.addAttachment.libraryFiles" +msgstr "Library Files" + +msgid "email.addAttachment.libraryFiles.attach" +msgstr "Attach Library Files" + +msgid "email.addAttachment.libraryFiles.description" +msgstr "Attach files from the Submission and Publisher Libraries." + +msgid "email.addAttachment.reviewFiles.attach" +msgstr "Attach Review Files" + +msgid "email.addAttachment.reviewFiles.description" +msgstr "Attach files that were uploaded by reviewers" + msgid "email.addBccRecipient" msgstr "Add BCC" @@ -912,6 +975,9 @@ msgstr "Add Recipient" msgid "email.attachments" msgstr "Attachments" +msgid "email.attachmentNotFound" +msgstr "The file {$fileName} could not be attached." + msgid "email.bcc" msgstr "BCC" diff --git a/locale/en_US/editor.po b/locale/en_US/editor.po index 95403798007..8d686954b63 100644 --- a/locale/en_US/editor.po +++ b/locale/en_US/editor.po @@ -44,6 +44,42 @@ msgstr "Submission accepted for review." msgid "editor.submission.workflowDecision.changeDecision" msgstr "Change decision" +msgid "editor.submission.workflowDecision.disallowedDecision" +msgstr "You do not have permission to record this decision on this submission." + +msgid "editor.submission.workflowDecision.invalidEditor" +msgstr "The editor was not recognized and may not have permission to record a decision on this submission." + +msgid "editor.submission.workflowDecision.invalidRecipients" +msgstr "You can not send an email to the following recipients: {$names}." + +msgid "editor.submission.workflowDecision.invalidReviewRound" +msgstr "This review round could not be found." + +msgid "editor.submission.workflowDecision.invalidReviewRoundStage" +msgstr "A review round was provided but this decision is not taken during a review stage." + +msgid "editor.submission.workflowDecision.invalidReviewRoundSubmission" +msgstr "This review round is not part of this submission." + +msgid "editor.submission.workflowDecision.invalidStage" +msgstr "The submission is not at the appropriate stage of the workflow to take this decision." + +msgid "editor.submission.workflowDecision.noUnassignedDecisions" +msgstr "You must be assigned to this submission in order to record an editorial decision." + +msgid "editor.submission.workflowDecision.requiredReviewRound" +msgstr "A review round id must be provided in order to take this decision." + +msgid "editor.submission.workflowDecision.requiredDecidingEditor" +msgstr "A recommendation can not be made unless an editor is assigned to this stage who can take a final decision." + +msgid "editor.submission.workflowDecision.submissionInvalid" +msgstr "A decision could not be taken on this submission. The submission id is missing or does not match the requested submission." + +msgid "editor.submission.workflowDecision.typeInvalid" +msgstr "This decision could not be found. Please provide a recognized decision type." + msgid "editor.review.notInitiated" msgstr "The review process has not yet been initiated." @@ -161,6 +197,12 @@ msgstr "Revisions will not be subject to a new round of peer reviews." msgid "editor.review.NotifyAuthorResubmit" msgstr "Revisions will be subject to a new round of peer reviews." +msgid "editor.review.NotifyAuthorRevisions.recommendation" +msgstr "Revisions should not be subject to a new round of peer reviews." + +msgid "editor.review.NotifyAuthorResubmit.recommendation" +msgstr "Revisions should be subject to a new round of peer reviews." + msgid "editor.review.dateAccepted" msgstr "Review Acceptance Date" @@ -469,3 +511,27 @@ msgstr "Biography" msgid "reviewer.list.empty" msgstr "No reviewers found" + +msgid "editor.decision.cancelDecision" +msgstr "Cancel Decision" + +msgid "editor.decision.cancelDecision.confirmation" +msgstr "Are you sure you want to cancel this decision?" + +msgid "editor.decision.completeSteps" +msgstr "Complete the following steps to take this decision" + +msgid "editor.decision.dontSkipEmail" +msgstr "Don't skip this email" + +msgid "editor.decision.emailSkipped" +msgstr "This step has been skipped and no email will be sent." + +msgid "editor.decision.recordDecision" +msgstr "Record Decision" + +msgid "editor.decision.skipEmail" +msgstr "Skip this email" + +msgid "editor.decision.stepError" +msgstr "There was a problem with the {$stepName} step." diff --git a/locale/en_US/grid.po b/locale/en_US/grid.po index f1b6c2a131f..1e5045d85b5 100644 --- a/locale/en_US/grid.po +++ b/locale/en_US/grid.po @@ -128,6 +128,9 @@ msgstr "Upgrade" msgid "grid.action.order" msgstr "Order" +msgid "grid.action.saveOrdering" +msgstr "Save Order" + msgid "grid.action.cancelOrdering" msgstr "Cancel ordering" @@ -404,6 +407,9 @@ msgstr "Edit Contributor" msgid "grid.action.deleteContributor" msgstr "Delete Contributor" +msgid "grid.action.deleteContributor.confirmationMessage" +msgstr "Are you sure you want to remove {$name} as a contributor? This action can not be undone." + msgid "grid.action.newVersion" msgstr "Create a new version" @@ -452,9 +458,33 @@ msgstr "Role" msgid "author.users.contributor.principalContact" msgstr "Primary Contact" +msgid "author.users.contributor.setPrincipalContact" +msgstr "Set Primary Contact" + msgid "author.users.contributor.includeInBrowse" msgstr "In Browse Lists" +msgid "contributor.listPanel.preview" +msgstr "Preview" + +msgid "contributor.listPanel.preview.description" +msgstr "Contributors to this publication will be identified in this journal in the following formats." + +msgid "contributor.listPanel.preview.format" +msgstr "Format" + +msgid "contributor.listPanel.preview.display" +msgstr "Display" + +msgid "contributor.listPanel.preview.abbreviated" +msgstr "Abbreviated" + +msgid "contributor.listPanel.preview.publicationLists" +msgstr "Publication Lists" + +msgid "contributor.listPanel.preview.full" +msgstr "Full" + msgid "grid.roles.currentRoles" msgstr "Current Roles" diff --git a/locale/en_US/manager.po b/locale/en_US/manager.po index a956eebde85..289958643c9 100644 --- a/locale/en_US/manager.po +++ b/locale/en_US/manager.po @@ -727,6 +727,18 @@ msgstr "Notification of Author Submission" msgid "manager.setup.notifications.copySpecifiedAddress" msgstr "Send a copy to this email address" +msgid "manager.setup.notifyAllAuthors" +msgstr "Notify All Authors" + +msgid "manager.setup.notifyAllAuthors.description" +msgstr "Who should receive a notification email when an editorial decision is recorded?" + +msgid "manager.setup.notifyAllAuthors.allAuthors" +msgstr "Send an email notification to all authors of the submission." + +msgid "manager.setup.notifyAllAuthors.assignedAuthors" +msgstr "Only send an email to authors assigned to the submission workflow. Usually, this is the submitting author." + msgid "manager.setup.submissionsNotifications" msgstr "Notifications" @@ -2091,9 +2103,27 @@ msgstr "Process failed to parse authors" msgid "plugins.importexport.publication.exportFailed" msgstr "Process failed to parse publications" +msgid "emailTemplate.variable.allReviewersComments" +msgstr "All comments from completed reviews. Reviewer names are hidden for anonymous reviews" + msgid "emailTemplate.variable.context.passwordLostUrl" msgstr "The URL to a page where the user can recover a lost password" +msgid "emailTemplate.variable.context.submissionsUrl" +msgstr "The URL to view all of a user's assigned submissions. + +msgid "emailTemplate.variable.decision.name" +msgstr "The name of the decision that was taken." + +msgid "emailTemplate.variable.decision.description" +msgstr "A description of the decision that was taken." + +msgid "emailTemplate.variable.decision.stage" +msgstr "The stage of the editorial workflow this decision was taken in." + +msgid "emailTemplate.variable.decision.round" +msgstr "The round of review this decision was taken in, if the decision is related to a review stage." + msgid "emailTemplate.variable.recipient.userFullName" msgstr "The full name of the recipient or all recipients" @@ -2121,6 +2151,9 @@ msgstr "The email signature of the sender" msgid "emailTemplate.variable.site.siteContactName" msgstr "The full name of the website's primary contact" +msgid "emailTemplate.variable.site.siteContactEmail" +msgstr "The email of the website's primary contact" + msgid "emailTemplate.variable.stageAssignment.editors" msgstr "The editors assigned to this submission who can make a decision" @@ -2133,15 +2166,21 @@ msgstr "The submission's unique ID number" msgid "emailTemplate.variable.submission.submissionAbstract" msgstr "The submission's abstract" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "Author names in a form of a shortened string" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "The full names of the authors" +msgid "emailTemplate.variable.submission.authorSubmissionUrl" +msgstr "The author's URL to the submission" + msgid "emailTemplate.variable.submission.submissionUrl" msgstr "The URL to the submission in the editorial backend" +msgid "emailTemplate.variable.submission.submittingAuthorName" +msgstr "The names of the authors assigned to the submission workflow. Usually this is the submitting author" + msgid "mailable.mailDiscussionMessage.name" msgstr "New Discussion Message" @@ -2172,3 +2211,120 @@ msgstr "Validate Email (Site)" msgid "mailable.validateEmailSite.description" msgstr "This email is automatically sent to a new user when they register with the site when the settings require the email address to be validated." +msgid "mailable.decision.notifyOtherAuthors.name" +msgstr "Notify Other Authors" + +msgid "mailable.decision.notifyOtherAuthors.description" +msgstr "This email is sent to notify authors of a submission who are not assigned as participants that a decision has been made. Usually these are all others except the submitting author." + +msgid "mailable.decision.notifyOtherAuthors.variable.message.description" +msgstr "A copy of the email message that was sent to the submitting author" + +msgid "mailable.decision.notifyReviewer.name" +msgstr "Reviewer Acknowledgement" + +msgid "mailable.decision.notifyReviewer.description" +msgstr "This email is sent by an Editor to a Reviewer to notify them that a decision has been made regarding a submission that they reviewed." + +msgid "mailable.decision.notifyReviewer.variable.decisionDescription" +msgstr "A short description of this decision that is intended to be shared in an email notification sent to reviewers about this decision." + +msgid "mailable.decision.notifyReviewer.variable.decisionDescription.accept" +msgstr "We have chosen to accept this submission without revisions." + +msgid "mailable.decision.notifyReviewer.variable.decisionDescription.decline" +msgstr "We have chosen to decline this submission." + +msgid "mailable.decision.notifyReviewer.variable.decisionDescription.pendingRevisions" +msgstr "We have invited the authors to submit revisions." + +msgid "mailable.decision.notifyReviewer.variable.decisionDescription.resubmit" +msgstr "We have invited the authors to submit a revised version for further review." + +msgid "mailable.decision.accept.notifyAuthor.name" +msgstr "Submission Accepted" + +msgid "mailable.decision.accept.notifyAuthor.description" +msgstr "This email notifies the author that their submission has been accepted for publication." + +msgid "mailable.decision.backToCopyediting.notifyAuthor.name" +msgstr "Submission Sent Back to Copyediting" + +msgid "mailable.decision.backToCopyediting.notifyAuthor.description" +msgstr "This email notifies the author that their submission has been sent back to the copyediting stage." + +msgid "mailable.decision.backToReview.notifyAuthor.name" +msgstr "Submission Sent Back to Review" + +msgid "mailable.decision.backToReview.notifyAuthor.description" +msgstr "This email notifies the author that their submission has been sent back to the review stage." + +msgid "mailable.decision.backToSubmission.notifyAuthor.name" +msgstr "Submission Sent Back to Submission" + +msgid "mailable.decision.backToSubmission.notifyAuthor.description" +msgstr "This email notifies the author that their submission has been sent back to the submission stage." + +msgid "mailable.decision.decline.notifyAuthor.name" +msgstr "Submission Declined" + +msgid "mailable.decision.decline.notifyAuthor.description" +msgstr "This email notifies the author that their submission has been declined after peer review." + +msgid "mailable.decision.initialDecline.notifyAuthor.name" +msgstr "Submission Declined" + +msgid "mailable.decision.newReviewRound.notifyAuthor.name" +msgstr "New Review Round Initiated" + +msgid "mailable.decision.newReviewRound.notifyAuthor.description" +msgstr "This email notifies the author that a new round of review is beginning for their submission." + +msgid "mailable.decision.requestRevisions.notifyAuthor.name" +msgstr "Revisions Requested" + +msgid "mailable.decision.requestRevisions.notifyAuthor.description" +msgstr "This email notifies the author of a decision to requests revisions during peer review." + +msgid "mailable.decision.resubmit.notifyAuthor.name" +msgstr "Resubmit for Review" + +msgid "mailable.decision.resubmit.notifyAuthor.description" +msgstr "This email notifies the author of a \"revise and resubmit\" decision regarding their submission." + +msgid "mailable.decision.revertDecline.notifyAuthor.name" +msgstr "Reinstate Declined Submission" + +msgid "mailable.decision.revertDecline.notifyAuthor.description" +msgstr "This email notifies the author that a previous decision to decline their submission after peer review is being reverted." + +msgid "mailable.decision.revertInitialDecline.notifyAuthor.name" +msgstr "Reinstate Submission Declined Without Review" + +msgid "mailable.decision.revertInitialDecline.notifyAuthor.description" +msgstr "This email notifies the author that a previous decision to decline their submission without review is being reverted." + +msgid "mailable.decision.sendExternalReview.notifyAuthor.name" +msgstr "Sent to Review" + +msgid "mailable.decision.sendExternalReview.notifyAuthor.description" +msgstr "This email notifies the author that their submission is being sent to the review stage." + +msgid "mailable.decision.sendToProduction.notifyAuthor.name" +msgstr "Sent to Production" + +msgid "mailable.decision.sendToProduction.notifyAuthor.description" +msgstr "This email notifies the author that their submission is being sent to the production stage." + +msgid "mailable.decision.skipReview.notifyAuthor.name" +msgstr "Review Skipped" + +msgid "mailable.decision.skipReview.notifyAuthor.description" +msgstr "This email notifies the author that their submission is being sent directly to the copyediting stage and will not be peer reviewed." + +msgid "mailable.decision.recommendation.notifyEditors.name" +msgstr "Recommendation Made" + +msgid "mailable.decision.recommendation.notifyEditors.description" +msgstr "This message notifies a senior Editor or Section Editor that an editorial recommendation has been made regarding one of their assigned submissions. This message is used when an editor is only allowed to recommend an editorial decision and requires an authorized editor to record editorial decisions. This option can be selected when assigning participants to a submission." + diff --git a/locale/en_US/submission.po b/locale/en_US/submission.po index 6a98951c37d..5a09a13c154 100644 --- a/locale/en_US/submission.po +++ b/locale/en_US/submission.po @@ -575,6 +575,9 @@ msgstr "Are you sure you want to delete this event log entry?" msgid "submission.event.deleteLogEntry" msgstr "Delete Log Entry" +msgid "submission.event.decisionReviewerEmailSent" +msgstr "An email about the decision was sent to {$recipientCount} reviewer(s) with the subject {$subject}." + msgid "submission.event.submissionSubmitted" msgstr "Initial submission completed." @@ -1005,7 +1008,10 @@ msgid "submission.submit.fileAdded" msgstr "File Added" msgid "submission.submit.includeInBrowse" -msgstr "Include this contributor in browse lists?" +msgstr "Include this contributor when identifying authors in lists of publications." + +msgid "submission.submit.includeInBrowse.title" +msgstr "Publication Lists" msgid "submission.submit.newFile" msgstr "Add Another File" @@ -1331,27 +1337,204 @@ msgstr "Are you sure you want the authors of this submission to be able to edit msgid "editor.submission.decision" msgstr "Decision" +msgid "editor.submission.decision.notifyAuthors" +msgstr "Notify Authors" + +msgid "editor.submission.decision.notifyReviewers" +msgstr "Notify Reviewers" + +msgid "editor.submission.decision.notifyReviewers.description" +msgstr "Send an email to the reviewers to thank them for their review and let them know that a decision was taken." + msgid "editor.submission.decision.accept" msgstr "Accept Submission" +msgid "editor.submission.decision.accept.description" +msgstr "This submission will be accepted for publication and sent for copyediting." + +msgid "editor.submission.decision.accept.log" +msgstr "{$editorName} accepted this submission and sent it to the copyediting stage." + +msgid "editor.submission.decision.accept.completed" +msgstr "Submission Accepted" + +msgid "editor.submission.decision.accept.completedDescription" +msgstr "The submission, {$title}, has been accepted for publication and sent to the copyediting stage." + +msgid "editor.submission.decision.accept.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that their submission has been accepted for publication." + +msgid "editor.submission.decision.backToSubmission" +msgstr "Back to Submission" + +msgid "editor.submission.decision.backToSubmission.completed" +msgstr "Sent Back to Submission" + +msgid "editor.submission.decision.backToSubmission.completed.description" +msgstr "The submission, {$title}, was sent back to the submission stage." + +msgid "editor.submission.decision.backToSubmission.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that their submission is being sent back to the submission stage. Explain why this decision was made and inform the author of what further work will be undertaken before moving the submission forward." + +msgid "editor.submission.decision.backToSubmissionFromCopyediting.description" +msgstr "Revert the decision to accept this submission and send it back to the submission stage." + +msgid "editor.submission.decision.backToSubmissionFromCopyediting.log" +msgstr "{$editorName} reverted the decision to accept this submission and sent it back to the submission stage." + +msgid "editor.submission.decision.decline" +msgstr "Decline Submission" + +msgid "editor.submission.decision.decline.description" +msgstr "This submission will be declined for publication. The peer review stage will be closed and the submission will be archived." + +msgid "editor.submission.decision.decline.log" +msgstr "{$editorName} declined this submission." + +msgid "editor.submission.decision.decline.completed" +msgstr "Submission Declined" + +msgid "editor.submission.decision.decline.completed.description" +msgstr "The submission, {$title}, has been declined and sent to the archives." + +msgid "editor.submission.decision.decline.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that their submission has been declined." + +msgid "editor.submission.decision.initialDecline.description" +msgstr "This submission will be declined for publication. No further review will be conducted and the submission will be archived." + +msgid "editor.submission.decision.newReviewRound" +msgstr "New Review Round" + +msgid "editor.submission.decision.newReviewRound.description" +msgstr "Open another round of review for this submission." + +msgid "editor.submission.decision.newReviewRound.log" +msgstr "{$editorName} created a new round of review for this submission." + +msgid "editor.submission.decision.newReviewRound.completed" +msgstr "Review Round Created" + +msgid "editor.submission.decision.newReviewRound.completedDescription" +msgstr "A new round of review has been created for the submission, {$title}." + +msgid "editor.submission.decision.newReviewRound.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that their submission has been sent for a new round of review." + +msgid "editor.submission.decision.promoteFiles.copyediting" +msgstr "Select files that should be sent to the copyediting stage." + +msgid "editor.submission.decision.promoteFiles.review" +msgstr "Select files that should be sent for review." + msgid "editor.submission.decision.requestRevisions" msgstr "Request Revisions" +msgid "editor.submission.decision.requestRevisions.description" +msgstr "The author must provide revisions before this submission will be accepted for publication." + +msgid "editor.submission.decision.requestRevisions.log" +msgstr "{$editorName} requested revisions for this submission." + +msgid "editor.submission.decision.requestRevisions.completed" +msgstr "Revisions Requested" + +msgid "editor.submission.decision.requestRevisions.completed.description" +msgstr "Revisions for the submission, {$title}, have been requested." + +msgid "editor.submission.decision.requestRevisions.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that revisions will be required before this submission will be accepted for publication. Include all of the details that the author will need in order to revise their submission. Where appropriate, remember to anonymise any reviewer comments." + msgid "editor.submission.decision.resubmit" msgstr "Resubmit for Review" +msgid "editor.submission.decision.resubmit.description" +msgstr "The author must provide revisions that will be sent for another round of review before this submission will be accepted for publication." + +msgid "editor.submission.decision.resubmit.log" +msgstr "{$editorName} requested revisions for this submission that should be sent for another round of review." + +msgid "editor.submission.decision.resubmit.completed" +msgstr "Revisions Requested" + +msgid "editor.submission.decision.resubmit.completed.description" +msgstr "Revisions for the submission, {$title}, have been requested. A decision to send the revisions for another round of reviews was recorded." + +msgid "editor.submission.decision.resubmit.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that revisions will be need to be completed and sent for another round of review. Include all of the details that the author will need in order to revise their submission. Where appropriate, remember to anonymise any reviewer comments." + +msgid "editor.submission.decision.sendExternalReview" +msgstr "Send for Review" + +msgid "editor.submission.decision.sendExternalReview.description" +msgstr "This submission is ready to be sent for peer review." + +msgid "editor.submission.decision.sendExternalReview.log" +msgstr "{$editorName} sent this submission to the review stage." + +msgid "editor.submission.decision.sendExternalReview.completed" +msgstr "Sent for Review" + +msgid "editor.submission.decision.sendExternalReview.completed.description" +msgstr "The submission, {$title}, has been sent to the review stage." + msgid "editor.submission.decision.newRound" msgstr "New review round" -msgid "editor.submission.decision.decline" -msgstr "Decline Submission" - msgid "editor.submission.decision.sendToProduction" msgstr "Send To Production" +msgid "editor.submission.decision.sendToProduction.description" +msgstr "Send this submission to the production stage to be prepared for publication." + +msgid "editor.submission.decision.sendToProduction.log" +msgstr "{$editorName} sent this submission to the production stage." + +msgid "editor.submission.decision.sendToProduction.completed" +msgstr "Sent to Production" + +msgid "editor.submission.decision.sendToProduction.completed.description" +msgstr "The submission, {$title}, was sent to the production stage." + +msgid "editor.submission.decision.sendToProduction.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that this submission has been sent to the production stage." + +msgid "editor.submission.decision.backToCopyediting" +msgstr "Back to Copyediting" + +msgid "editor.submission.decision.backToCopyediting.description" +msgstr "Send this submission back to the copyediting stage." + +msgid "editor.submission.decision.backToCopyediting.log" +msgstr "{$editorName} sent this submission back to the copyediting stage." + +msgid "editor.submission.decision.backToCopyediting.completed" +msgstr "Sent Back to Copyediting" + +msgid "editor.submission.decision.backToCopyediting.completed.description" +msgstr "The submission, {$title}, was sent back to the copyediting stage." + +msgid "editor.submission.decision.backToCopyediting.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that this submission has been sent back to the copyediting stage. Explain why this decision was made and inform the author of what further editing will be required before this submission is ready for production." + msgid "editor.submission.decision.skipReview" msgstr "Accept and Skip Review" +msgid "editor.submission.decision.skipReview.description" +msgstr "Accept this submission for publication and skip the review stage. This decision will send the submission to the copyediting stage." + +msgid "editor.submission.decision.skipReview.log" +msgstr "{$editorName} skipped the review stage and sent this submission to the copyediting stage." + +msgid "editor.submission.decision.skipReview.completed" +msgstr "Skipped Review" + +msgid "editor.submission.decision.skipReview.completed.description" +msgstr "The submission, {$title}, skipped the review stage and has been sent to the copyediting stage." + +msgid "editor.submission.decision.skipReview.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that this submission has been accepted for publication and sent to the copyediting stage without review." + msgid "editor.submission.decision.sendInternalReview" msgstr "Send to Internal Review" @@ -1367,9 +1550,72 @@ msgstr "This file proof will no longer be publicly available for download or pur msgid "editor.submission.decision.revertDecline" msgstr "Revert Decline" +msgid "editor.submission.decision.revertDecline.description" +msgstr "Revert a previous decision to decline this submission and return it to the active editorial process." + +msgid "editor.submission.decision.revertDecline.log" +msgstr "{$editorName} reversed the decision to decline this submission." + +msgid "editor.submission.decision.revertDecline.completed" +msgstr "Submission Reactivated" + +msgid "editor.submission.decision.revertDecline.completed.description" +msgstr "The submission, {$title}, is now an active submission in the review stage." + +msgid "editor.submission.decision.revertDecline.notifyAuthorsDescription" +msgstr "Send an email to the authors to let them know that a previous decision to decline this submission has been reverted. Explain why the decision was reverted and let them know whether the submission is expected to undergo further review." + +msgid "editor.submission.decision.revertInitialDecline.completed.description" +msgstr "The submission, {$title}, is now active in the submission stage." + msgid "editor.submission.decision.noDecisionsAvailable" msgstr "Assign an editor to enable the editorial decisions for this stage." +msgid "editor.submission.recommend.notifyEditors.description" +msgstr "Send a message to the deciding editors to let them know the recommendation. Explain why this recommendation was made in response to the recommendations and comments submitted by reviewers." + +msgid "editor.submission.recommend.accept" +msgstr "Recommend Accept" + +msgid "editor.submission.recommend.accept.description" +msgstr "Recommend that this submission be accepted for publication and sent for copyediting." + +msgid "editor.submission.recommend.accept.log" +msgstr "{$editorName} recommended that this submission be accepted and sent for copyediting." + +msgid "editor.submission.recommend.completed" +msgstr "Recommendation Submitted" + +msgid "editor.submission.recommend.completed.description" +msgstr "Your recommendation has been recorded and the deciding editor(s) have been notified." + +msgid "editor.submission.recommend.revisions" +msgstr "Recommend Revisions" + +msgid "editor.submission.recommend.revisions.description" +msgstr "Recommend that revisions be requested from the author before this submission is accepted for publication." + +msgid "editor.submission.recommend.revisions.log" +msgstr "{$editorName} recommended that revisions be requested." + +msgid "editor.submission.recommend.resubmit" +msgstr "Recommend Resubmit for Review" + +msgid "editor.submission.recommend.resubmit.description" +msgstr "Recommend that the author is asked to submit revisions for another round of review." + +msgid "editor.submission.recommend.resubmit.log" +msgstr "{$editorName} recommended that revisions be requested and that these revisions be sent for another round of review." + +msgid "editor.submission.recommend.decline" +msgstr "Recommend Decline" + +msgid "editor.submission.recommend.decline.description" +msgstr "Recommend that the submission be declined for publication." + +msgid "editor.submission.recommend.decline.log" +msgstr "{$editorName} recommended that this submission be declined." + msgid "editor.submission.makeRecommendation" msgstr "Make Recommendation" @@ -1382,6 +1628,9 @@ msgstr "Recommendation: {$recommendation}" msgid "editor.submission.allRecommendations.display" msgstr "Recommendations: {$recommendations}" +msgid "editor.submission.recommendation.noDecidingEditors" +msgstr "You can not make a recommendation until an editor is assigned with permission to record a decision." + msgid "editor.submission.recommendation" msgstr "Recommendation" @@ -1391,15 +1640,6 @@ msgstr "Recommend an editorial decision for this submission." msgid "editor.submission.recordedRecommendations" msgstr "Recorded Recommendations" -msgid "editor.submission.decision.nextButton" -msgstr "Next: Select Files for {$stageName}" - -msgid "editor.submission.decision.selectFiles" -msgstr "Select the files you would like to forward to the {$stageName} stage." - -msgid "editor.submission.decision.previousAuthorNotification" -msgstr "Previous: Author Notification" - msgid "submission.currentStage" msgstr "Current stage" diff --git a/locale/en_US/user.po b/locale/en_US/user.po index 42e68751063..0fa6a334ae4 100644 --- a/locale/en_US/user.po +++ b/locale/en_US/user.po @@ -138,14 +138,11 @@ msgid "user.login" msgstr "Login" msgid "user.login.lostPassword.confirmationSent" -msgstr "A confirmation has been sent to your email address. Please follow the instructions in the email to reset your password." +msgstr "A confirmation has been sent to your email address if a matching account was found. Please follow the instructions in the email to reset your password." msgid "user.login.lostPassword.invalidHash" msgstr "Sorry, the link you clicked on has expired or is not valid. Please try resetting your password again." -msgid "user.login.lostPassword.invalidUser" -msgstr "No user exists with the specified email address." - msgid "user.login.lostPassword.passwordSent" msgstr "A new password has been sent to your email address. You may now login to the site with your new password." @@ -207,7 +204,7 @@ msgid "user.preferredPublicName" msgstr "Preferred Public Name" msgid "user.preferredPublicName.description" -msgstr "How do you prefer to be addressed? Salutations, middle names and suffixes can be added here if you would like." +msgstr "Please provide the full name as the author should be identified on the published work. Example: Dr. Alan P. Mwandenga" msgid "user.profile.changePasswordInstructions" msgstr "Enter your current and new passwords below to change the password for your account." diff --git a/locale/es_ES/user.po b/locale/es_ES/user.po index e68d93120f9..f0fda60ac4d 100644 --- a/locale/es_ES/user.po +++ b/locale/es_ES/user.po @@ -129,15 +129,13 @@ msgstr "El nombre de usuario/a o la contraseña no son válidos. Inténtelo de n msgid "user.login" msgstr "Entrar" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Se ha enviado una confirmación a su dirección de correo electrónico. Siga las instrucciones del correo electrónico para restablecer su contraseña." msgid "user.login.lostPassword.invalidHash" msgstr "El enlace ha caducado o no es válido. Intente restablecer su contraseña de nuevo." -msgid "user.login.lostPassword.invalidUser" -msgstr "No existe ningún usuario/a con la dirección de correo electrónico especificada." - msgid "user.login.lostPassword.passwordSent" msgstr "Se le ha enviado una nueva contraseña a su dirección de correo electrónico. Ahora puede iniciar sesión con la nueva contraseña." diff --git a/locale/eu_ES/user.po b/locale/eu_ES/user.po index c9a70b09b59..850f108375b 100644 --- a/locale/eu_ES/user.po +++ b/locale/eu_ES/user.po @@ -71,15 +71,13 @@ msgstr "Erabiltzaile-izena edo pasahitza ez da baliozkoa. Saiatu berriro." msgid "user.login" msgstr "Hasi saioa" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Berrespen bat bidali da zure helbide elektronikora. Jarraitu mezuan emandako azalpenak pasahitza berrezartzeko." msgid "user.login.lostPassword.invalidHash" msgstr "Sakatu duzun esteka iraungita dago edo ez da baliozkoa. Saiatu zure pasahitza berriro berrezartzen." -msgid "user.login.lostPassword.invalidUser" -msgstr "Ez dago helbide elektroniko hori duen erabiltzailerik." - msgid "user.login.lostPassword.passwordSent" msgstr "Pasahitz berri bat bidali da zure helbide elektronikora. Pasahitz berriarekin sartuko zara orain webgunean." diff --git a/locale/fa_IR/user.po b/locale/fa_IR/user.po index c5860400410..b3cc8770aab 100644 --- a/locale/fa_IR/user.po +++ b/locale/fa_IR/user.po @@ -119,15 +119,13 @@ msgstr "نام کاربری یا رمز عبور غلط است. لطفا از ن msgid "user.login" msgstr "ورود" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "یک نامه تاییدیه به آدرس ایمیل شما ارسال شد. لطفا دستورات مندرج در آن را بدقت اجرا کنید تا رمز عبورتان به روز شود." msgid "user.login.lostPassword.invalidHash" msgstr "متأسفانه لینکی که شما بر روی آن کلیک کرده اید تاریخ آن منقضی شده است یا دیگر وجود ندارد. برای دریافت رمز عبور از نو اقدام کنید." -msgid "user.login.lostPassword.invalidUser" -msgstr "هیچ کاربری با این ایمیل وجود ندارد." - msgid "user.login.lostPassword.passwordSent" msgstr "یک رمز عبور جدید به آدرس ایمیل شما ارسال گردید. با این رمز عبور جدید هم اکنون میتوانید وارد سایت شوید." diff --git a/locale/fi_FI/user.po b/locale/fi_FI/user.po index 7ebd16e0dc0..2ca9d16bba2 100644 --- a/locale/fi_FI/user.po +++ b/locale/fi_FI/user.po @@ -125,15 +125,13 @@ msgstr "Virheellinen käyttäjätunnus tai salasana. Yritä uudelleen." msgid "user.login" msgstr "Kirjautuminen" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Sähköpostiisi on lähetetty vahvistus. Seuraa sähköpostissa olevia ohjeita vaihtaaksesi salasanan." msgid "user.login.lostPassword.invalidHash" msgstr "Klikkaamasi linkki on vanhentunut tai se ei ole kelvollinen. Yritä vaihtaa salasana uudelleen." -msgid "user.login.lostPassword.invalidUser" -msgstr "Määritetty sähköpostiosoite ei kuulu yhdellekään käyttäjälle." - msgid "user.login.lostPassword.passwordSent" msgstr "Uusi salasana on lähetetty sähköpostiosoitteeseesi. Voit nyt kirjautua sivustolle uudella salasanallasi." diff --git a/locale/fr_CA/user.po b/locale/fr_CA/user.po index 1ce6c08cc2c..ddf0d088c52 100644 --- a/locale/fr_CA/user.po +++ b/locale/fr_CA/user.po @@ -144,15 +144,13 @@ msgstr "Nom d'utilisateur-trice ou mot de passe invalide. Veuillez essayer de no msgid "user.login" msgstr "Se connecter" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Une confirmation a été envoyée à votre adresse de courriel. Veuillez suivre les instructions dans le courriel pour réinitialiser votre mot de passe." msgid "user.login.lostPassword.invalidHash" msgstr "Désolé, le lien sur lequel vous avez cliqué est expiré ou n'est pas valide. Veuillez essayer de réinitialiser votre mot de passe de nouveau." -msgid "user.login.lostPassword.invalidUser" -msgstr "Il n'existe aucun-e utilisateur-trice ayant l'adresse de courriel indiquée." - msgid "user.login.lostPassword.passwordSent" msgstr "Un nouveau mot de passe a été envoyé à votre adresse de courriel. Vous pouvez maintenant vous connecter au site avec votre nouveau mot de passe." diff --git a/locale/fr_FR/manager.po b/locale/fr_FR/manager.po index 8c3a3eb08d2..0d31fd9cd34 100644 --- a/locale/fr_FR/manager.po +++ b/locale/fr_FR/manager.po @@ -1,10 +1,11 @@ +# Martin Brändle , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:49+00:00\n" -"PO-Revision-Date: 2021-02-01 13:53+0000\n" -"Last-Translator: Paul Heckler \n" +"PO-Revision-Date: 2022-01-11 13:18+0000\n" +"Last-Translator: Martin Brändle \n" "Language-Team: French \n" "Language: fr_FR\n" @@ -703,8 +704,8 @@ msgstr "" msgid "manager.setup.reviewOptions.reminders.submit.description" msgstr "" -"Envoyer un rappel si le rapporteur ou la rapporteuse n'a pas fait sa " -"recommandation dans le délai (en jours) suivant la date d'échéance." +"Envoyer un rappel si un(e) évaluateur(trice) n'a pas soumis de " +"recommandation dans le délai indiqué (en jours)." msgid "manager.setup.dependentGenre" msgstr "Genres dépendants" @@ -2323,3 +2324,170 @@ msgstr "ERREUR :" msgid "plugins.importexport.common.error.unknownContext" msgstr "Le chemin pour la revue, \"{$contextPath}\", n'existe pas." + +msgid "plugins.importexport.submission.cli.display" +msgstr "\"{$submissionId}\" - \"{$submissionTitle}\"" + +msgid "mailable.validateEmailSite.description" +msgstr "" +"Ce courriel est automatiquement envoyé à un nouvel utilisateur lors de son " +"inscription sur le site lorsque les paramètres exigent la validation de " +"l'adresse de courriel." + +msgid "mailable.validateEmailSite.name" +msgstr "Valider le courriel (site)" + +msgid "mailable.mailReviewerUnassigned.description" +msgstr "Ce courriel est envoyé lorsqu'un éditeur désassigne un réviseur." + +msgid "mailable.mailReviewerUnassigned.name" +msgstr "Evaluateur( trice) plus attribué(e)" + +msgid "mailable.mailReviewerReinstate.description" +msgstr "" +"Cet e-mail est envoyé lorsqu'un évaluateur qui n'était pas assigné est " +"réintégré par un éditeur." + +msgid "mailable.mailReviewerReinstate.name" +msgstr "Evaluateur(trice) réintégré(e)" + +msgid "mailable.mailReviewerAssigned.description" +msgstr "" +"Cet e-mail est envoyé lorsqu'un évaluateur est affecté à une soumission." + +msgid "mailable.mailReviewerAssigned.name" +msgstr "Evaluateur(trice) attribué(e)" + +msgid "mailable.mailDiscussionMessage.description" +msgstr "" +"Ce courriel est automatiquement envoyé aux participants de la discussion " +"lorsqu'un nouveau message est ajouté à la discussion." + +msgid "mailable.mailDiscussionMessage.name" +msgstr "Nouveau message de discussion" + +msgid "emailTemplate.variable.submission.submissionUrl" +msgstr "L'URL de la soumission dans le backend éditorial" + +msgid "emailTemplate.variable.submission.authors" +msgstr "Les noms complets des auteurs" + +msgid "emailTemplate.variable.submission.authorsShort" +msgstr "Noms des auteurs sous la forme d'une chaîne de caractères raccourcie" + +msgid "emailTemplate.variable.submission.submissionAbstract" +msgstr "Le résumé de la soumission" + +msgid "emailTemplate.variable.submission.submissionId" +msgstr "Le numéro d'identification unique de la soumission" + +msgid "emailTemplate.variable.submission.submissionTitle" +msgstr "Le titre de la soumission" + +msgid "emailTemplate.variable.stageAssignment.editors" +msgstr "" +"Les rédacteurs affectés à cette soumission qui peuvent prendre une décision" + +msgid "emailTemplate.variable.site.siteContactEmail" +msgstr "L'adresse de courriel du principal contact du site Web" + +msgid "emailTemplate.variable.site.siteContactName" +msgstr "Le nom complet du contact principal du site" + +msgid "emailTemplate.variable.sender.signature" +msgstr "La signature de l'expéditeur du courriel" + +msgid "emailTemplate.variable.sender.senderEmail" +msgstr "L'adresse de courriel de l'expéditeur/de l'expéditrice" + +msgid "emailTemplate.variable.sender.senderName" +msgstr "Le nom complet de l'expéditeur/de l'expéditrice" + +msgid "emailTemplate.variable.recipient.submissionReviewUrl" +msgstr "L'URL de la mission d'examen" + +msgid "emailTemplate.variable.recipient.responseDueDate" +msgstr "Date à laquelle l'évaluateur doit terminer l'évaluation" + +msgid "emailTemplate.variable.recipient.reviewDueDate" +msgstr "" +"Date à laquelle la personne chargée de l'évaluation doit accepter ou refuser " +"l'attribution" + +msgid "emailTemplate.variable.recipient.username" +msgstr "Le nom d'utilisateur du/de la destinataire ou de tous les destinataires" + +msgid "emailTemplate.variable.recipient.userFullName" +msgstr "Le nom complet du/de la destinataire ou de tous les destinataires" + +msgid "emailTemplate.variable.context.passwordLostUrl" +msgstr "L'URL d'une page où l'utilisateur peut récupérer un mot de passe perdu" + +msgid "plugins.importexport.publication.exportFailed" +msgstr "Le processus n'a pas réussi à analyser les publications" + +msgid "plugins.importexport.author.exportFailed" +msgstr "Le processus n'a pas réussi à analyser les auteurs" + +msgid "plugins.importexport.native.common.error.filter.configuration.count" +msgstr "" +"Mauvaise configuration du filtre [{$filterName}] : {$filterCount} " +"occurrences. Il ne devrait y en avoir qu'une seule." + +msgid "plugins.importexport.native.common.any" +msgstr "Éléments génériques" + +msgid "plugins.importexport.native.export.completed.downloadFile" +msgstr "Télécharger le fichier exporté avec le bouton ci-dessous." + +msgid "plugins.importexport.native.export.completed" +msgstr "Exportation complétée avec succès." + +msgid "plugins.importexport.native.export.download.results" +msgstr "Télécharger le fichier exporté" + +msgid "plugins.importexport.native.export.submissions.results" +msgstr "Exportation des résultats des soumissions" + +msgid "plugins.importexport.native.processFailed" +msgstr "" +"Le processus a échoué. Veuillez consulter les erreurs ou avertissements ci-" +"dessous." + +msgid "plugins.importexport.common.error.userGroupMissing" +msgstr "Groupe d'utilisateurs-trices manquant pour le nom d'usager {$param}" + +msgid "plugins.importexport.common.id" +msgstr "Id : {$id}" + +msgid "notification.localeSettingsCannotBeSaved" +msgstr "" +"Le paramètre de langue n'a pas pu être sauvegardé. Au moins une langue doit " +"être activée pour chaque option" + +msgid "manager.setup.notifications.copySubmissionAckAddress.invalid" +msgstr "Une ou plusieurs de ces adresses de courriel ne sont pas valables." + +msgid "manager.setup.notifications.copySubmissionAckAddress.description" +msgstr "" +"Une copie de l'e-mail de confirmation de soumission sera envoyée à chacune " +"des adresses e-mail saisies ici. Séparez les adresses e-mail multiples par " +"une virgule. Exemple : one@example.com,two@example.com" + +msgid "manager.setup.notifications.copySubmissionAckAddress" +msgstr "Informer tout le monde" + +msgid "manager.setup.notifications.copySubmissionAckPrimaryContact.disabled" +msgstr "Non" + +msgid "manager.setup.notifications.copySubmissionAckPrimaryContact.enabled" +msgstr "Oui, envoyer une copie à {$email}" + +msgid "manager.setup.notifications.copySubmissionAckPrimaryContact" +msgstr "Avertir le contact principal" + +msgid "manager.setup.submissionsNotifications" +msgstr "Notifications" + +msgid "manager.emails.otherTemplates" +msgstr "Autres modèles" diff --git a/locale/fr_FR/user.po b/locale/fr_FR/user.po index 0d43ce52960..aabe84050f2 100644 --- a/locale/fr_FR/user.po +++ b/locale/fr_FR/user.po @@ -71,15 +71,13 @@ msgstr "Nom d'usager ou mot de passe non valide. Veuillez essayer de nouveau." msgid "user.login" msgstr "Se connecter" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Une confirmation a été envoyée à votre adresse de courriel. Veuillez suivre les instructions dans le courriel pour réinitialiser votre mot de passe." msgid "user.login.lostPassword.invalidHash" msgstr "Malheureusement, le lien sur lequel vous avez cliqué est expiré ou n'est pas valide. Veuillez essayer de réinitialiser votre mot de passe encore une fois." -msgid "user.login.lostPassword.invalidUser" -msgstr "Aucun utilisateur n'existe avec l'adresse de courriel indiquée." - msgid "user.login.lostPassword.passwordSent" msgstr "Un nouveau mot de passe a été envoyé à votre adresse de courriel. Vous pouvez maintenant vous connecter au site avec votre nouveau mot de passe." diff --git a/locale/gl_ES/user.po b/locale/gl_ES/user.po index 95deace61a1..75b2a91dc97 100644 --- a/locale/gl_ES/user.po +++ b/locale/gl_ES/user.po @@ -391,15 +391,12 @@ msgstr "" "Enviouse un novo contrasinal ao seu enderezo de correo electrónico. Agora " "podes iniciar sesión no sitio co teu novo contrasinal." -msgid "user.login.lostPassword.invalidUser" -msgstr "" -"Non existe ningún usuario/a co enderezo de correo electrónico especificado." - msgid "user.login.lostPassword.invalidHash" msgstr "" "A ligazón caducou ou non é válida. Tenta restablecer o teu contrasinal de " "novo." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "" "Enviouse unha confirmación ao seu enderezo de correo electrónico. Siga as " diff --git a/locale/hr_HR/user.po b/locale/hr_HR/user.po index ea71f53d949..862aa9fb8e4 100644 --- a/locale/hr_HR/user.po +++ b/locale/hr_HR/user.po @@ -72,15 +72,13 @@ msgstr "Zaboravili ste lozinku?" msgid "user.login" msgstr "Prijava" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Potvrda je poslana na vašu adresu e-pošte. Molimo slijedite upute u e-pošti zbog ponovnog uspostavljanja vaše lozinke." msgid "user.login.lostPassword.invalidHash" msgstr "Oprostite, poveznica na koju ste kliknuli nije važeća ili nije valjana. Molimo pokušajte ponovno zatražiti izmjenu vaše lozinke." -msgid "user.login.lostPassword.invalidUser" -msgstr "Ne postoji korisnik s navedenom adresom e-pošte." - msgid "user.login.lostPassword.passwordSent" msgstr "Nova lozinka je poslana na vašu adresu e-pošte. Možete se sada prijaviti na stranici s vašom novom lozinkom." diff --git a/locale/hu_HU/manager.po b/locale/hu_HU/manager.po index c346fbc6ba6..c4bd59a41e5 100644 --- a/locale/hu_HU/manager.po +++ b/locale/hu_HU/manager.po @@ -2450,10 +2450,10 @@ msgstr "" msgid "emailTemplate.variable.submission.submissionUrl" msgstr "A kézirat URL-címe a szerkesztői rendszerben" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "Szerzők teljes neve" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "Szerzői nevek rövidített karakterlánc formájában" msgid "emailTemplate.variable.submission.submissionAbstract" diff --git a/locale/hu_HU/user.po b/locale/hu_HU/user.po index 76a65eaa66e..c6e85c9ef6c 100644 --- a/locale/hu_HU/user.po +++ b/locale/hu_HU/user.po @@ -141,15 +141,13 @@ msgstr "Érvénytelen felhasználónév vagy jelszó. Kérem, próbálja újra." msgid "user.login" msgstr "Belépés" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Egy visszaigazoló emailt küldtünk az email címére. Kérem, kövesse az abban lévő utasításokat a jelszava visszaállításához." msgid "user.login.lostPassword.invalidHash" msgstr "Elnézést, a link, amire kattintott már elévült vagy nem érvényes. Kérem, próbálja meg a jelszó visszaállítást még egyszer." -msgid "user.login.lostPassword.invalidUser" -msgstr "Ezzel az email címmel nincs felhasználó." - msgid "user.login.lostPassword.passwordSent" msgstr "Egy új jelszó ment az email címére. Az új jelszóval már be tud jelentkezni az oldalra." diff --git a/locale/id_ID/user.po b/locale/id_ID/user.po index 41285c8c0ab..97aa92607d9 100644 --- a/locale/id_ID/user.po +++ b/locale/id_ID/user.po @@ -110,15 +110,13 @@ msgstr "Login" msgid "user.logIn" msgstr "Login" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Konfirmasi telah dikirim ke alamat email Anda. Ikuti instruksi di email untuk mengatur ulang kata sandi Anda." msgid "user.login.lostPassword.invalidHash" msgstr "Maaf, tautan yang Anda klik telah berakhir atau tidak valid. Coba mengatur ulang kata sandi lagi." -msgid "user.login.lostPassword.invalidUser" -msgstr "Tidak ada pengguna dengan alamat email yang spesifik." - msgid "user.login.lostPassword.passwordSent" msgstr "Kata sandi baru telah dikirim ke alamat emal Anda. Anda sekarang bisa login ke situs dengan kata sandi baru Anda." diff --git a/locale/is_IS/admin.po b/locale/is_IS/admin.po new file mode 100644 index 00000000000..61c3b1d212e --- /dev/null +++ b/locale/is_IS/admin.po @@ -0,0 +1,366 @@ +# Kolbrun Reynisdottir , 2022. +msgid "" +msgstr "" +"PO-Revision-Date: 2022-01-11 15:46+0000\n" +"Last-Translator: Kolbrun Reynisdottir \n" +"Language-Team: Icelandic \n" +"Language: is\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n % 10 != 1 || n % 100 == 11;\n" +"X-Generator: Weblate 3.9.1\n" + +msgid "admin.fileLoader.moveFileFailed" +msgstr "" +"File {$filename} could not be moved from {$currentFilePath} to " +"{$destinationPath}" + +msgid "admin.fileLoader.pathNotAccessible" +msgstr "Folder {$path} is not a directory or is not readable." + +msgid "admin.fileLoader.wrongBasePathLocation" +msgstr "Base path {$path} must be inside the public files directory." + +msgid "admin.version" +msgstr "Version" + +msgid "admin.version.upToDate" +msgstr "Your system is up-to-date" + +msgid "admin.version.updateAvailable" +msgstr "An updated version is available" + +msgid "admin.versionRevision" +msgstr "Revision" + +msgid "admin.version.moreInfo" +msgstr "More Information" + +msgid "admin.versionMinor" +msgstr "Minor" + +msgid "admin.versionMajor" +msgstr "Major" + +msgid "admin.version.latest" +msgstr "Latest version" + +msgid "admin.versionHistory" +msgstr "Version history" + +msgid "admin.version.downloadPatch" +msgstr "Download Patch" + +msgid "admin.version.downloadPackage" +msgstr "Download" + +msgid "admin.version.checkForUpdates" +msgstr "Check for updates" + +msgid "admin.versionBuild" +msgstr "Build" + +msgid "admin.systemInformation" +msgstr "System Information" + +msgid "admin.systemConfigFileReadError" +msgstr "" +"The configuration file config.inc.php does not exist, is not " +"readable, or is invalid." + +msgid "admin.siteSetup" +msgstr "Site Setup" + +msgid "admin.siteSettings" +msgstr "Site Settings" + +msgid "admin.siteManagement" +msgstr "Site Management" + +msgid "admin.siteAdmin" +msgstr "Site Administration" + +msgid "admin.settings.siteTheme" +msgstr "Site Theme" + +msgid "admin.settings.siteTitle" +msgstr "Site Name" + +msgid "admin.settings.siteLogo" +msgstr "Site Logo" + +msgid "admin.settings.siteStyleSheet" +msgstr "Site style sheet" + +msgid "admin.settings.siteStyleSheetInvalid" +msgstr "Invalid site style sheet format. Accepted format is .css." + +msgid "admin.settings.siteLanguage" +msgstr "Site language" + +msgid "admin.settings.disableBulkEmailRoles.adminOnly" +msgstr "Only an administrator is allowed to modify this setting." + +msgid "admin.settings.disableBulkEmailRoles.label" +msgstr "Disable Roles" + +msgid "admin.settings.restrictBulkEmails" +msgstr "Restrict Bulk Emails" + +msgid "admin.settings.minPasswordLength" +msgstr "Minimum password length (characters)" + +msgid "admin.settings.introduction" +msgstr "Introduction" + +msgid "admin.settings.defaultMetricDescription" +msgstr "" +"\n" +"\t\tYour installation is configured to record more than one usage metric. " +"Usage statistics will be displayed in several contexts.\n" +"\t\tThere are cases where a single usage statistic must be used, e.g. to " +"display an ordered list of most-used submissions or to rank\n" +"\t\tsearch results. Please select one of the configured metrics as a default." +"\n" +"\t" + +msgid "admin.settings.contactName" +msgstr "Name of principal contact" + +msgid "admin.settings.contactEmail" +msgstr "Email of principal contact" + +msgid "admin.settings.enableBulkEmails.label" +msgstr "Bulk Emails" + +msgid "admin.settings.about" +msgstr "About the Site" + +msgid "admin.settings" +msgstr "Settings" + +msgid "admin.server.platform" +msgstr "OS platform" + +msgid "admin.server.phpVersion" +msgstr "PHP version" + +msgid "admin.serverInformation" +msgstr "Server Information" + +msgid "admin.server.dbVersion" +msgstr "Database server version" + +msgid "admin.server.dbDriver" +msgstr "Database driver" + +msgid "admin.server.apacheVersion" +msgstr "Apache version" + +msgid "admin.scheduledTask.statisticsReport" +msgstr "Editorial Report Notification" + +msgid "admin.scheduledTask.clearLogs" +msgstr "Clear Scheduled Task Execution Logs" + +msgid "admin.scheduledTask.subscriptionExpiryReminder" +msgstr "Subscription expiry reminder" + +msgid "admin.scheduledTask.reviewReminder" +msgstr "Review reminder" + +msgid "admin.systemInfo.settingName" +msgstr "Setting Name" + +msgid "admin.languages.installNewLocales" +msgstr "Install New Locales" + +msgid "admin.languages.installLocales" +msgstr "Install" + +msgid "admin.scheduledTask.downloadLog" +msgstr "" +"Your {$softwareName} installation automatically executed and finished this " +"task and you can download the log file here: {$url}" + +msgid "admin.scheduledTask.publishSubmissions" +msgstr "Publish submissions scheduled for publication" + +msgid "admin.scheduledTask.confirmClearLogs" +msgstr "Are you sure you want to delete all scheduled task execution logs?" + +msgid "admin.scheduledTask.noLog" +msgstr "Task produced no log." + +msgid "admin.scheduledTask.stopTime" +msgstr "Task process stopped." + +msgid "admin.scheduledTask.startTime" +msgstr "Task process started." + +msgid "admin.scheduledTask" +msgstr "Scheduled task" + +msgid "admin.phpInfo" +msgstr "Extended PHP Information" + +msgid "admin.languages.uninstall" +msgstr "Uninstall Locale" + +msgid "admin.languages.reload" +msgstr "Reload Locale" + +msgid "admin.languages.noLocalesAvailable" +msgstr "No additional locales are available for installation." + +msgid "admin.languages.languageSettings" +msgstr "Language Settings" + +msgid "admin.languages.installLocale" +msgstr "Install Locale" + +msgid "admin.languages.availableLocales" +msgstr "Available Locales" + +msgid "admin.languages.installLanguages" +msgstr "Manage Locales" + +msgid "admin.languages.installedLocales" +msgstr "Installed Locales" + +msgid "admin.languages.confirmReload" +msgstr "" +"Are you sure you want to reload this locale? This will erase any existing " +"locale-specific data such as customized email templates." + +msgid "admin.languages.confirmSitePrimaryLocaleChange" +msgstr "" +"Are you sure you want to change the site primary locale? Users' names, which " +"are required in the site's primary locale, will be copied from the existing " +"primary locale where they are missing." + +msgid "admin.languages.cantDisable" +msgstr "" +"This locale is the primary language of the site. You can't disable it until " +"you choose another primary locale." + +msgid "admin.expireSessions" +msgstr "Expire User Sessions" + +msgid "admin.displayNewSystemConfig" +msgstr "Display New Configuration" + +msgid "admin.displayConfigFileInstructions" +msgstr "" +"The contents of your updated configuration are displayed below. To apply the " +"configuration changes you must open config.inc.php in a suitable " +"text editor and replace its contents with the contents of the text field " +"below." + +msgid "admin.dateInstalled" +msgstr "Date installed" + +msgid "admin.currentVersion" +msgstr "Current version" + +msgid "admin.contexts.confirmDelete" +msgstr "" +"Are you sure you want to permanently delete {$contextName} and all of its " +"contents?" + +msgid "admin.contentsOfConfigFile" +msgstr "Contents of configuration file" + +msgid "admin.confirmExpireSessions" +msgstr "" +"Are you sure you want to expire all user sessions? All users who are " +"currently logged into the system will be forced to log in again (yourself " +"included)." + +msgid "admin.confirmClearTemplateCache" +msgstr "Are you sure you want to clear the cache of compiled templates?" + +msgid "admin.configFileUpdatedInstructions" +msgstr "" +"Your configuration file has been successfully updated. Please note that if " +"your site no longer functions correctly you may need to manually fix your " +"configuration by editing config.inc.php directly." + +msgid "admin.clearTemplateCache" +msgstr "Clear Template Cache" + +msgid "admin.clearDataCache" +msgstr "Clear Data Caches" + +msgid "admin.authSources" +msgstr "Authentication Sources" + +msgid "admin.auth.noneCreated" +msgstr "No authentication sources have been defined." + +msgid "admin.auth.create" +msgstr "Create authentication source" + +msgid "admin.auth.confirmDelete" +msgstr "Are you sure you want to permanently delete this authentication source?" + +msgid "admin.adminFunctions" +msgstr "Administrative Functions" + +msgid "admin.systemInfo.settingValue" +msgstr "Setting Value" + +msgid "admin.languages.noLocalesToDownload" +msgstr "There are no locales available for download." + +msgid "admin.error.executingUtil" +msgstr "" +"Error: can't execute \"{$utilPath}\". Check your {$utilVar} setting in " +"config.inc.php." + +msgid "admin.error.utilExecutionProblem" +msgstr "" +"The \"{$utilPath}\" program execution returned the following error: {$output}" + +msgid "admin.copyAccessLogFileTool.success" +msgstr "Success: {$filePath} to {$destinationPath}" + +msgid "admin.copyAccessLogFileTool.warning.fileAlreadyExists" +msgstr "" +"Warning: file {$filePath} already exists inside the usage stats directory." + +msgid "admin.copyAccessLogFileTool.error.deletingFile" +msgstr "Error: can't delete file {$tmpFilePath}" + +msgid "admin.copyAccessLogFileTool.error.copyingFile" +msgstr "Error: can't copy file from {$filePath} to {$tmpFilePath}" + +msgid "admin.copyAccessLogFileTool.error.acessingFile" +msgstr "Error: File {$filePath} don't exist or can't be accessed." + +msgid "admin.copyAccessLogFileTool.error.creatingFolder" +msgstr "Error: can't create temporary folder {$tmpDir}" + +msgid "admin.copyAccessLogFileTool.usage" +msgstr "" +"Copy the passed apache access log file(s), filtering the entries related " +"with this installation,\n" +"to the current files directory, inside the UsageStatsPlugin stage directory. " +"Must run under user with enough privilegies to read access apache log files." +"\n" +"\n" +"This tool will only copy files that aren't already inside the usageStats " +"file loader directories (stage, processing, archive, reject).\n" +"\n" +"Usage: {$scriptName} path/to/apache/log/file.log\n" +"Usage (processing all files inside a directory): {$scriptName} path/to/" +"apache/directory\n" +"\t" + +msgid "admin.fileLoader.emailSubject" +msgstr "File loader" + +msgid "admin.fileLoader.fileProcessed" +msgstr "File {$filename} was processed and archived." diff --git a/locale/is_IS/api.po b/locale/is_IS/api.po new file mode 100644 index 00000000000..76249a8a1ab --- /dev/null +++ b/locale/is_IS/api.po @@ -0,0 +1,16 @@ +# Kolbrun Reynisdottir , 2022. +msgid "" +msgstr "" +"PO-Revision-Date: 2022-01-11 15:46+0000\n" +"Last-Translator: Kolbrun Reynisdottir \n" +"Language-Team: Icelandic \n" +"Language: is\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n % 10 != 1 || n % 100 == 11;\n" +"X-Generator: Weblate 3.9.1\n" + +msgid "api.400.paramNotSupported" +msgstr "The {$param} parameter is not supported." diff --git a/locale/it_IT/manager.po b/locale/it_IT/manager.po index dd7aa3aaadf..dbd258c1742 100644 --- a/locale/it_IT/manager.po +++ b/locale/it_IT/manager.po @@ -1,11 +1,12 @@ # Alfredo Cosco , 2021. +# Martin Brändle , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:53+00:00\n" -"PO-Revision-Date: 2021-08-23 21:01+0000\n" -"Last-Translator: Alfredo Cosco \n" +"PO-Revision-Date: 2022-01-11 15:10+0000\n" +"Last-Translator: Martin Brändle \n" "Language-Team: Italian \n" "Language: it_IT\n" @@ -683,8 +684,8 @@ msgstr "" msgid "manager.setup.reviewOptions.reminders.submit.description" msgstr "" -"Invia un promemoria se il revisore non invia un parere entro (n) giorni dopo " -"la scadenza." +"Invia un promemoria se un revisore non ha presentato una raccomandazione " +"entro il tempo specificato (in giorni)." msgid "manager.setup.reviewOptions.reviewTime" msgstr "Tempo per la revisione" @@ -2000,7 +2001,6 @@ msgstr "Utenti registrati" msgid "manager.setup.theme.notFound" msgstr "Il tema selezionato non è installato o abilitato." -#, fuzzy msgid "manager.setup.reviewOptions.showAnonymousReviewLink" msgstr "" "Visualizzare il link a へのリンクを提示" + +msgid "manager.setup.reviewOptions.reviewMode" +msgstr "ディフォルトの査読モード" + +msgid "manager.setup.reviewOptions.reminders.submit.description" +msgstr "査読期限からこの日数以内に査読者が査読報告を提出しなかった場合、リマインドメールを送信します。" + +msgid "manager.setup.reviewOptions.reminders.response.description" +msgstr "回答期限から何日経っても査読者からの回答がない場合、リマインドメールを送信する。" + +msgid "manager.setup.reviewOptions.reminders.response" +msgstr "応答リマインド" + +msgid "manager.setup.reviewOptions.noteOnModification" +msgstr "デフォルト値は、編集作業中に査読ごとに変更できます。" + +msgid "manager.setup.reviewOptions.neverSendReminder" +msgstr "リマインドしない" + +msgid "manager.setup.reviewOptions.numWeeksPerReview" +msgstr "査読完了までの週数" + +msgid "manager.setup.reviewOptions.numWeeksPerResponse" +msgstr "査読依頼を受理または断るまでの週数。" + +msgid "manager.setup.reviewOptions.defaultReviewCompletionTime" +msgstr "デフォルトの完了期限" + +msgid "manager.setup.reviewOptions.defaultReviewResponseTime" +msgstr "デフォルトの応答期限" + +msgid "manager.setup.privacyStatement.description" +msgstr "" +"この声明は、ユーザー登録時、著者登録時、および一般に公開されている「個人情報の取り扱いについて」で表示されます。一部の管轄区域では、ユーザーデータの取り扱" +"い方法をこのプライバシーポリシーで開示することが法的に求められています。" + +msgid "manager.setup.dateTime.custom" +msgstr "カスタム" + +msgid "manager.setup.dateTime.shortDateTime" +msgstr "日付と時間(短縮)" + +msgid "manager.setup.dateTime.longDateTime" +msgstr "日付と時間" + +msgid "manager.setup.dateTime.time" +msgstr "時間" + +msgid "manager.setup.dateTime.shortDate" +msgstr "日付(短縮)" + +msgid "manager.setup.dateTime.longDate" +msgstr "日付" + +msgid "manager.setup.dateTime.description" +msgstr "" +"日付と時刻のフォーマットを選択してください。カスタムフォーマットの入力には、特殊なフォーマット文字が使えます。" + +msgid "manager.setup.dateTime.descriptionTitle" +msgstr "日付と時間フォーマット" + +msgid "manager.setup.dateTime" +msgstr "日付と時間" + +msgid "manager.setup.principalContactDescription" +msgstr "主任編集者、常務編集者、管理スタッフなどの連絡先を入力し、一般にアクセス可能なウェブサイトに表示することができます。" + +msgid "manager.setup.principalContact" +msgstr "連絡責任者" + +msgid "manager.setup.peerReview.description" +msgstr "" +"査読者と著者のための査読方針とプロセスを概説する。この説明には、通常、投稿論文の査読に使用される査読者の数、査読者が投稿論文を判断するよう求められる基準、" +"査読の実施に必要な予想時間、査読者を選択するために使用される原則などが含まれることが多い。" + +msgid "manager.setup.pageFooter.description" +msgstr "ウェブサイトの下部に表示させたい画像やテキスト、HTMLコードなどを入力してください。" + +msgid "manager.setup.pageFooter" +msgstr "ページフッター" + +msgid "manager.setup.pageHeaderLogoImageInvalid" +msgstr "ページヘッダーロゴの画像フォーマットが無効であるか、アップロードに失敗しました。使用可能なフォーマットは.gif、.jpg、.pngです。" + +msgid "manager.setup.openAccessPolicy.description" +msgstr "公開されたすべてのコンテンツにすぐに無料でアクセスできる場合は、オープンアクセスポリシーの説明を入力することができます。" + +msgid "manager.setup.openAccessPolicy" +msgstr "オープンアクセスポリシー" + +msgid "manager.setup.notifyUsers.sendAnother" +msgstr "別のメールを送る" + +msgid "manager.setup.notifyUsers.sent" +msgstr "メールが全員に正常に送信されました。" + +msgid "manager.setup.notifyUsers.sending" +msgstr "メールを送信します。送信が完了するまで、ブラウザで別の場所に移動しないでください。" + +msgid "manager.setup.notifyUsers.confirm" +msgstr "あなたはユーザー {$total} にメールを送信しようとしています。このメールを送信してもよろしいですか?" + +msgid "manager.setup.notifyUsers.send" +msgstr "メール送信" + +msgid "manager.setup.notifyUsers.copyDetails" +msgstr "このメールのコピーを {$email} に送ってください。" + +msgid "manager.setup.notifyUsers.description" +msgstr "メール通知を受け取るべきユーザーを選択します。" + +msgid "manager.setup.notifyUsers" +msgstr "通知" + +msgid "manager.setup.notifications.description" +msgstr "投稿者には、投稿を確認するメールが自動的に送信されます。このメールのコピーを以下にも送れます:" + +msgid "manager.setup.notifications.copySubmissionAckAddress.invalid" +msgstr "これらのメールアドレスのうち1つ以上が有効ではありません。" + +msgid "manager.setup.notifications.copySubmissionAckAddress.description" +msgstr "" +"投稿確認メールのコピーは、ここに入力されたいずれかのメールアドレスに送信されます。複数のメールアドレスを入力する場合は、コンマで区切ってください。例: " +"one@example.com,two@example.com" + +msgid "manager.setup.notifications.copySubmissionAckAddress" +msgstr "誰かに通知" + +msgid "manager.setup.notifications.copySubmissionAckPrimaryContact.disabled" +msgstr "いいえ" + +msgid "manager.setup.notifications.copySubmissionAckPrimaryContact.enabled" +msgstr "はい、{$email} にコピーを送ります" + +msgid "manager.setup.notifications.copySubmissionAckPrimaryContact" +msgstr "連絡責任者への通知" + +msgid "manager.setup.submissionsNotifications" +msgstr "通知" + +msgid "manager.setup.notifications.copySpecifiedAddress" +msgstr "このメールアドレスにコピーを送る" + +msgid "manager.setup.notifications" +msgstr "著者投稿のお知らせ" + +msgid "manager.setup.noTemporaryFile" +msgstr "アップロードしたファイルが見つかりませんでした。もう一度アップロードしてください。" + +msgid "manager.setup.logo" +msgstr "ロゴ" + +msgid "manager.setup.loggingAndAuditing" +msgstr "ロギングと監査" + +msgid "manager.setup.layout.sidebar.invalidBlock" +msgstr "{$name} ブロックが見つかりません。プラグインがインストールされ、有効になっていることを確認してください。" + +msgid "manager.setup.layout.sidebar" +msgstr "サイドバー" + +msgid "manager.setup.information.descriptionTitle" +msgstr "説明" + +msgid "manager.setup.homeTitleImageInvalid" +msgstr "" +"ホームページのヘッダータイトル画像のフォーマットが無効であるか、アップロードに失敗しました。使用可能なフォーマットは.gif、.jpg、.pngです。" + +msgid "manager.setup.homepageImageInvalid" +msgstr "ホームページの画像形式が無効であるか、アップロードに失敗しました。使用可能なフォーマットは.gif、.jpg、.pngです。" + +msgid "manager.setup.homepageImage.description" +msgstr "画像をアップロードして、ホームページ上で目立つように表示することができます。" + +msgid "manager.setup.homepageImage" +msgstr "ホームページ画像" + +msgid "manager.setup.favicon" +msgstr "ファビコン" + +msgid "manager.setup.errorDeletingItem" +msgstr "このアイテムを削除する際にエラーが生じました。" + +msgid "manager.setup.competingInterests" +msgstr "利益相反" + +msgid "manager.setup.checklist" +msgstr "チェックリスト" + +msgid "manager.setup.disableSubmissions" +msgstr "投稿の無効化" + +msgid "manager.setup.authorGuidelines.description" +msgstr "推奨されるガイドラインには、目録や書式の標準、投稿時に使用する一般的な引用形式の例が含まれています。" + +msgid "manager.setup.authorGuidelines" +msgstr "著者ガイドライン" + +msgid "manager.setup.copyrightNotice.description" +msgstr "投稿の際は、以下の著作権表示に同意していただく必要があります。" + +msgid "manager.setup.copyrightNotice" +msgstr "著作権情報" + +msgid "manager.setup.advanced" +msgstr "詳細" + +msgid "manager.setup.additionalContent.description" +msgstr "ここで入力した内容は、あなたのホームページに表示されます。" + +msgid "manager.setup.additionalContent" +msgstr "追加コンテンツ" + +msgid "manager.setup.publishingDescription" +msgstr "これらの詳細は、第三者のアーカイブ機関に提供されるメタデータに含まれることがあります。" + +msgid "manager.setup.publishing" +msgstr "出版の詳細" + +msgid "manager.affiliationAndSupport" +msgstr "スポンサー" + +msgid "manager.statistics.reports.filters.byLocation.description" +msgstr "国、地域、都市で絞り込みます。" + +msgid "manager.statistics.reports.filters.byLocation" +msgstr "地理的な位置で" + +msgid "manager.statistics.reports.filters.byTime.dimensionSelector" +msgstr "または、範囲を選択します:" + +msgid "manager.statistics.reports.filters.byTime" +msgstr "レポート範囲の選択" + +msgid "manager.statistics.reports.filters.byObject" +msgstr "オブジェクト種別やオブジェクトIDによって" + +msgid "manager.statistics.reports.filters.byContext" +msgstr "文脈で" + +msgid "manager.statistics.reports.reportUrl.label" +msgstr "" +"以下のURLを使用すると、現在のフォーム設定でレポートを生成することができます。このURLをコピーしてブラウザで開いてください。また、このURLをカスタム" +"レポートURLジェネレータとしてブックマークに保存することもできます。" + +msgid "manager.statistics.reports.reportUrl" +msgstr "レポートURL" + +msgid "manager.statistics.reports.form.columnsRequired" +msgstr "レポートを作成するには、少なくとも1つの列を選択する必要があります。" + +msgid "manager.statistics.reports.cities.label" +msgstr "コンマで区切られた1つ以上の都市名(例:都市名1,都市名2)" + +msgid "manager.statistics.reports.day.label" +msgstr "YYYYMMDD 形式を使用します。" + +msgid "manager.statistics.reports.month.label" +msgstr "YYYYMM 形式を使用します。" + +msgid "manager.statistics.reports.orderDir.desc" +msgstr "降順" + +msgid "manager.statistics.reports.orderDir.asc" +msgstr "昇順" + +msgid "manager.statistics.reports.orderDir" +msgstr "向き" + +msgid "manager.statistics.reports.orderBy" +msgstr "並び替え" + +msgid "manager.statistics.reports.currentMonth" +msgstr "今月" + +msgid "manager.statistics.reports.objectId.label" +msgstr "コンマで区切られた1つまたは複数のオブジェクトIDを定義します(例:1,2,3,4,5)。" + +msgid "manager.statistics.reports.columns.description" +msgstr "" +"レポートの作成に使用する列を定義します。ここで選択した列は、レポート内に表示されるデータを定義するだけでなく、統計の集約レベルも定義します。例えば、ID、" +"種別、月の3つの列を選択した場合、レポートは1ヶ月間のオブジェクトのすべてのビューを合計し、そのデータを1行に表示します。「月」ではなく「日」を選択した場" +"合、各オブジェクトは日ごとに行を持つことになります。" + +msgid "manager.statistics.reports.objectId" +msgstr "オブジェクトID" + +msgid "manager.statistics.reports.objectType" +msgstr "オブジェクト種別" + +msgid "manager.statistics.reports.objectNotFound" +msgstr "データベースにオブジェクトが存在しない" + +msgid "manager.statistics.reports.filters" +msgstr "フィルター" + +msgid "manager.statistics.reports.columns" +msgstr "列" + +msgid "manager.statistics.reports.advancedOptions.hide" +msgstr "詳細オプションを隠す" + +msgid "manager.statistics.reports.advancedOptions" +msgstr "詳細オプション" + +msgid "manager.statistics.reports.customReportGenerator" +msgstr "カスタムレポートジェネレーター" + +msgid "manager.statistics.reports.generateReport" +msgstr "カスタムレポートの生成" + +msgid "manager.statistics.reports.defaultReportTemplates" +msgstr "デフォルトのレポートテンプレート" + +msgid "manager.statistics.reports.optionalColumns.description" +msgstr "" +"イタリック体で*マークがついている項目は、現在のシステムの統計の数え方(メートル法)ではオプションとなっているデータです。統計プラグインの設定によって、そ" +"のデータがある場合とない場合があります。" + +msgid "manager.statistics.reports.aggregationColumns" +msgstr "統計情報を次で集約:" + +msgid "manager.statistics.reports.description" +msgstr "" +"システムでは、一定期間のサイト利用や投稿に関連する詳細を追跡するレポートが生成されます。レポートはCSV形式で作成されるため、表計算ソフトが必要となります" +"。" + +msgid "manager.statistics.reports" +msgstr "レポート" + +msgid "manager.statistics.region" +msgstr "地域" + +msgid "manager.statistics.city" +msgstr "都市" + +msgid "manager.statistics.defaultMetricDescription" +msgstr "" +"\n" +"\t\tお使いの {$contextObjectName} " +"は、複数の使用状況の指標を記録するように設定されています。使用状況の統計情報は、複数のコンテキストで表示されます。\n" +"\t\t最も使用された投稿の順序付きリストを表示したり、検索結果をランク付けしたりするなど、単一の使用統計を使用しなければならない場合があります。\n" +"\t\t設定されたメトリクスの1つをデフォルトとして選択してください。\n" +"\t" + +msgid "manager.statistics" +msgstr "統計 & レポート" + +msgid "manager.roles" +msgstr "役割" + +msgid "manager.reviewerSearch.form.instructions" +msgstr "" +"以下のフォームを使用して、検索したい用語の最大値を設定してください。 フォームには、これらのフィールドの事前計算された平均値があらかじめ入力されています。" + +msgid "manager.reviewerSearch.interests" +msgstr "査読での興味" + +msgid "manager.reviewerSearch.searchByName.short" +msgstr "名前で検索" + +msgid "manager.reviewerSearch.searchByName" +msgstr "査読者を名前で検索" + +msgid "manager.reviewerSearch.change" +msgstr "変更" + +msgid "manager.representative.inUse" +msgstr "1つ以上の投稿の出版フォーマットのマーケットメタデータに割り当てられているため、この代表者を削除することはできません。" + +msgid "manager.userSearch.searchByName" +msgstr "ユーザー名で検索" + +msgid "manager.readingTools" +msgstr "リーディングツール" + +msgid "manager.plugins" +msgstr "システムプラグイン" + +msgid "manager.plugins.sitePlugin" +msgstr "このプラグインはサイト全体で使用されます。このプラグインは、サイト管理者のみが管理できます。" + +msgid "manager.plugins.pluginManagement" +msgstr "プラグインの管理" + +msgid "manager.plugins.enable" +msgstr "有効" + +msgid "manager.plugins.disable" +msgstr "無効" + +msgid "manager.plugins.action" +msgstr "アクション:" + +msgid "manager.people.userMustChangePassword" +msgstr "次回ログイン時にパスワードの変更を要求する。" + +msgid "manager.people.userCreatedSuccessfully" +msgstr "ユーザーの作成に成功しました。" + +msgid "manager.people.unenroll" +msgstr "登録解除" + +msgid "manager.people.syncUsers" +msgstr "ユーザー登録の同期化" + +msgid "manager.people.signInAsUser" +msgstr "ログイン:ユーザー" + +msgid "manager.people.signInAs" +msgstr "ログイン:" + +msgid "manager.people.signedInAs" +msgstr "現在、{$username} としてログインしています" + +msgid "manager.people.remove" +msgstr "削除" + +msgid "manager.people" +msgstr "人々" + +msgid "manager.people.noneEnrolled" +msgstr "登録されているユーザーはいません。" + +msgid "manager.people.noMatchingUsers" +msgstr "該当するユーザーはいません。" + +msgid "manager.people.mustProvideName" +msgstr "最初にユーザーの名字くらいはご記入ください。" + +msgid "manager.people.mustChooseRole" +msgstr "ページ上部で役割を選択してから「ユーザー登録」をクリックしてください。" + +msgid "manager.people.mergeUsers" +msgstr "ユーザーの統合" + +msgid "manager.people.mergeUsers.confirm" +msgstr "" +"選択した {$oldAccountCount} アカウントを、ユーザー名「{$newUsername}」のアカウントに統合することでよろしいですか?" +"選択した {$oldAccountCount} アカウントは、その後存在しなくなります。この操作は元に戻せません。" + +msgid "manager.people.mergeUser" +msgstr "ユーザーの統合" + +msgid "manager.people.invalidUser" +msgstr "申し訳ありませんが、要求されたユーザーは存在しません。" + +msgid "manager.people.enrollUserAs" +msgstr "ユーザーを次で登録:" + +msgid "manager.people.enrollUserAsDescription" +msgstr "ユーザーは、いつでもロールに任命したり、ロールから外したりすることができます。" + +msgid "manager.people.enrollSync" +msgstr "登録の同期" + +msgid "manager.people.enrollSyncRole" +msgstr "役割の同期" + +msgid "manager.people.enrollSelected" +msgstr "選択されたユーザーの登録" + +msgid "manager.people.enrollment" +msgstr "登録" + +msgid "manager.people.enroll" +msgstr "ユーザー登録" + +msgid "manager.people.enable" +msgstr "有効" + +msgid "manager.people.emailUsers.selectUsers" +msgstr "メールを送信したいユーザーの名前の横のチェックボックスから選択してください" + +msgid "manager.people.emailUsers.selectLocale" +msgstr "言語選択" + +msgid "manager.people.emailUsers" +msgstr "ユーザーにメールを送る" + +msgid "manager.people.emailUsers.emailUsersEnrolledAs" +msgstr "登録されたユーザーにメールを送る:" + +msgid "manager.people.emailUsers.emailSelectedUsers" +msgstr "選択したユーザーにメールを送る" + +msgid "manager.people.editUser" +msgstr "ユーザーの編集" + +msgid "manager.people.editProfile" +msgstr "プロフィールの編集" + +msgid "manager.people.doNotEnroll" +msgstr "役割なし" + +msgid "manager.people.disable" +msgstr "無効" + +msgid "manager.people.createUserSendNotify" +msgstr "ユーザーに、ユーザー名とパスワードを含むウェルカムメールを送信する。" + +msgid "manager.people.createUserGeneratePassword" +msgstr "ランダムなパスワードを生成します。" + +msgid "manager.people.createUser" +msgstr "新規ユーザーの作成" + +msgid "manager.people.confirmUnenroll" +msgstr "このユーザーの登録を解除しますか?" + +msgid "manager.people.authSource" +msgstr "認証機関" + +msgid "manager.people.existingUserRequired" +msgstr "既存のユーザーを入力する必要があります。" + +msgid "manager.payment.timestamp" +msgstr "タイムスタンプ" + +msgid "manager.languages.supportedLocalesInstructions" +msgstr "サイトでサポートするすべての言語を、各ページに表示される言語選択メニューで選択します。メニューは、複数の言語を選択した場合にのみ表示されます。" + +msgid "manager.languages.alternateLocaleInstructions" +msgstr "" +"このシステムでは、オプションとして、特定の重要な情報を複数の追加言語で入力することができます。この機能を使用するには、代替言語を選択し、以下のオプションか" +"ら選択してください。" + +msgid "manager.language.reloadLocalizedDefaultSettings" +msgstr "ディフォルトに戻す" + +msgid "manager.reviewForms.noneChosen" +msgstr "なし / 自由形式レビュー" + +msgid "manager.reviewForms.list.description" +msgstr "" +"ここで作成された査読フォームは、2つのオープンテキストボックス(1つ目は「著者と編集者へ」、2つ目は「編集者へ」)で構成されるデフォルトのフォームの代わり" +"に査読者に提示・記入されます。査読フォームは、特定の出版セクション用に指定することができ、編集者は査読を任命に使用するフォームを選択できます。いずれの場合" +"も、編集者は著者に対応する査読を含めるオプションがあります。" + +msgid "manager.reviewForms.inReview" +msgstr "査読中" + +msgid "manager.reviewForms.form.titleRequired" +msgstr "査読フォームにはタイトルが必要です。" + +msgid "manager.language.forms" +msgstr "フォーム" + +msgid "manager.language.submissions" +msgstr "投稿" + +msgid "manager.language.ui" +msgstr "UI" + +msgid "manager.importExport" +msgstr "データのインポート/エクスポート" + +msgid "manager.groups.title" +msgstr "タイトル" + +msgid "manager.groups.membership.noUsers" +msgstr "ユーザーが見つかりませんでした。" + +msgid "manager.groups.membership.noneCreated" +msgstr "グループにメンバーがいません。" + +msgid "manager.groups.membership" +msgstr "会員" + +msgid "manager.groups.membership.confirmDelete" +msgstr "このグループメンバーを削除してよろしいですか?" + +msgid "manager.groups.membership.addMember" +msgstr "メンバーの追加" + +msgid "manager.groups.form.groupTitleRequired" +msgstr "グループタイトルが必要です。" + +msgid "manager.groups.editTitle" +msgstr "タイトルの編集" + +msgid "manager.groups.createTitle" +msgstr "タイトルの作成" + +msgid "manager.groups.confirmDelete" +msgstr "このグループを削除してよろしいですか?" + +msgid "manager.files.uploadFile" +msgstr "アップロードファイル" + +msgid "manager.files.uploadedFiles" +msgstr "アップロードファイル" + +msgid "manager.files.parentDir" +msgstr "親ディレクトリ" + +msgid "manager.files.indexOfDir" +msgstr "{$dir} の一覧" + +msgid "manager.files.emptyDir" +msgstr "このディレクトリにはファイルがありません。" + +msgid "manager.files.createDir" +msgstr "ディレクトリの作成" + +msgid "manager.files.confirmDelete" +msgstr "このファイルかディレクトリを削除しますか?なお、ディレクトリは空でないと削除できません。" + +msgid "manager.filesBrowser" +msgstr "ファイルブラウザー" + +msgid "manager.export.usersToCsv.description" +msgstr "Excel/CSVファイルにエクスポートするユーザーを選択してください。" + +msgid "manager.export.usersToCsv.label" +msgstr "Excel/CSV にエクスポート" + +msgid "manager.emails.subjectWithValue" +msgstr "件名: {$subject}" + +msgid "manager.emails.sentTo" +msgstr "宛先" + +msgid "manager.emails.sentFrom" +msgstr "送信元" + +msgid "manager.emails.resetToDefault" +msgstr "ディフォルトに戻す" + +msgid "manager.emails.reset.message" +msgstr "このテンプレートをリセットすると、すべてのメッセージデータがデフォルト値にリセットされ、変更内容はすべて失われます。 この操作を承認しますか?" + +msgid "manager.emails.resetComplete" +msgstr "メールテンプレートのリセットに成功しました。" + +msgid "manager.emails.reset" +msgstr "リセット" + +msgid "manager.emails.resetAll.complete" +msgstr "デフォルトのメールテンプレートが復元されました。" + +msgid "manager.emails.resetAll.message" +msgstr "すべてのテンプレートをリセットすると、メールテンプレートの変更内容はすべて失われます。 この操作を承認しますか?" + +msgid "manager.emails.resetAll" +msgstr "全てをリセット" + +msgid "manager.emails" +msgstr "準備されたメール" + +msgid "manager.emails.form.subjectRequired" +msgstr "メールにはタイトルが必要です。" + +msgid "manager.emails.form.bodyRequired" +msgstr "メールには件名が必要です。" + +msgid "manager.emails.form.emailKeyRequired" +msgstr "電子メールには、スペースや特殊文字を含まないユニークなEメールキーが必要です。" + +msgid "manager.emails.enable.message" +msgstr "メールを有効にしようとしています。 この操作を承認しますか?" + +msgid "manager.emails.enable" +msgstr "有効化" + +msgid "manager.emails.enabled" +msgstr "メールテンプレートを有効にする" + +msgid "manager.emails.emailTemplate.noDuplicateKeys" +msgstr "提供されたキーはすでに使用されています。" + +msgid "manager.emails.emailTemplate.contextRequired" +msgstr "メールテンプレートの追加には、コンテキストIDを指定する必要があります。" + +msgid "manager.emails.otherTemplates" +msgstr "他のテンプレート" + +msgid "manager.emails.emailTemplates" +msgstr "メールテンプレート" + +msgid "manager.emails.emailTemplate" +msgstr "メールテンプレート" + +msgid "manager.emails.emailKeyExists" +msgstr "指定されたキーを持つメールがすでに存在しています。メールのキーは一意でなければなりません。" + +msgid "manager.emails.emailKey.description" +msgstr "Eメールキーには、アルファベット、数字、アンダースコアしか使用できません。" + +msgid "manager.emails.emailKey" +msgstr "Eメールキー" + +msgid "manager.emails.editTestExample" +msgstr "メール文章例の編集" + +msgid "manager.emails.editEmail" +msgstr "メールの編集" + +msgid "manager.emails.disable.message" +msgstr "" +"このメールテンプレートを無効にしようとしています。 " +"このテンプレートを使用しているシステムプロセスがあった場合、そのプロセスは今後使用されません。この操作を承認しますか?" + +msgid "manager.emails.disable" +msgstr "無効" + +msgid "manager.emails.details" +msgstr "テンプレート詳細" + +msgid "manager.emails.data" +msgstr "テンプレートメッセージデータ" + +msgid "manager.emails.customTemplate" +msgstr "独自テンプレート" + +msgid "manager.emails.createEmail" +msgstr "電子メールの作成" + +msgid "manager.emails.addEmail" +msgstr "テンプレートの追加" + +msgid "manager.emails.confirmReset" +msgstr "このメールテンプレートをデフォルトに戻してよろしいですか?" + +msgid "manager.emails.confirmDelete" +msgstr "このメールテンプレートを削除してよろしいですか?" + +msgid "manager.publication.reviewReminders.success" +msgstr "査読リマインドの詳細を更新しました。" + +msgid "manager.publication.reviewerGuidance" +msgstr "査読ガイドライン" + +msgid "manager.publication.emails" +msgstr "電子メール" + +msgid "manager.publication.productionStage" +msgstr "制作" + +msgid "manager.publication.editorialStage" +msgstr "編集" + +msgid "manager.publication.submissionStage" +msgstr "投稿" + +msgid "manager.announcementTypes.typeName" +msgstr "告知種別" + +msgid "manager.announcementTypes.noneCreated" +msgstr "告知種別が作成されていません。" + +msgid "manager.announcementTypes.form.typeNameRequired" +msgstr "告知種別の名前が必要です。" + +msgid "manager.announcementTypes.form.typeName" +msgstr "名前" + +msgid "manager.announcementTypes.form.typeNameExists" +msgstr "この名前の告知種別はすでに存在しています。" + +msgid "manager.announcementTypes.editTitle" +msgstr "編集" + +msgid "manager.announcementTypes.edit" +msgstr "告知種別の編集" + +msgid "manager.announcementTypes.create" +msgstr "告知種別の作成" + +msgid "manager.announcementTypes.confirmDelete" +msgstr "警告! この告知種別に設定されたすべての告知が削除されます。このまま告知種別を削除してもよろしいですか?" + +msgid "manager.announcementTypes" +msgstr "告知種別" + +msgid "manager.announcements.type" +msgstr "種別" + +msgid "manager.announcements.title" +msgstr "タイトル" + +msgid "manager.announcements.noneCreated" +msgstr "告知は作成されていません。" + +msgid "manager.announcements.form.typeIdValid" +msgstr "有効な告知種別を選択してください。" + +msgid "manager.announcements.form.typeId" +msgstr "種別" + +msgid "manager.announcements.form.title" +msgstr "タイトル" + +msgid "manager.announcements.form.titleRequired" +msgstr "告知タイトルが必要です。" + +msgid "manager.announcementTypes.form.saveAndCreateAnother" +msgstr "保存して次の作成" + +msgid "manager.announcements.form.saveAndCreateAnother" +msgstr "保存して次の作成" + +msgid "manager.people.saveAndCreateAnotherUser" +msgstr "保存して次の作成" + +msgid "manager.announcements.form.descriptionShort" +msgstr "短い説明" + +msgid "manager.announcements.form.descriptionShortRequired" +msgstr "告知内容の短い説明が必要です。" + +msgid "manager.announcements.form.descriptionShortInstructions" +msgstr "告知タイトルと一緒に表示される簡単な説明文です。" + +msgid "manager.announcements.form.descriptionRequired" +msgstr "告知内容の説明が必要です。" + +msgid "manager.announcements.form.descriptionInstructions" +msgstr "告知内容の全文です。" + +msgid "manager.announcements.form.dateExpireYearIncompleteDate" +msgstr "有効期限の年に加えて、月や日を選択してください。" + +msgid "manager.announcements.form.dateExpireValid" +msgstr "お知らせの適切な有効期限を選択してください。" + +msgid "manager.announcements.form.dateExpireMonthIncompleteDate" +msgstr "有効期限の月に加えて、年や日を選択してください。" + +msgid "manager.announcements.form.dateExpireInstructions" +msgstr "この告知はこの日まで読者に表示されます。お知らせを無期限で表示する場合は、空白にしてください。" + +msgid "manager.announcements.form.dateExpire" +msgstr "有効期限" + +msgid "manager.announcements.form.dateExpireDayIncompleteDate" +msgstr "有効期限の日に加えて、年や月を選択してください。" + +msgid "manager.announcements.editTitle" +msgstr "編集" + +msgid "manager.announcements.edit" +msgstr "お知らせの編集" + +msgid "manager.announcements.deleteAnnouncement" +msgstr "お知らせの削除" + +msgid "manager.announcements.datePublish" +msgstr "公開済" + +msgid "manager.announcements.dateExpire" +msgstr "有効期限" + +msgid "manager.announcementTypes.createTitle" +msgstr "作成" + +msgid "manager.announcements.createTitle" +msgstr "作成" + +msgid "manager.announcements.create" +msgstr "新規告知の作成" + +msgid "manager.announcements.confirmDelete" +msgstr "お知らせ「{$title}」を永久に削除してよろしいですか?" + +msgid "manager.website.imageFileRequired" +msgstr "画像ファイルが必要です。ファイルの選択・アップロードをしていることを確認してください。" + +msgid "manager.website.appearance" +msgstr "外観" + +msgid "manager.website.information" +msgstr "情報" + +msgid "manager.statistics.reports.yesterday" +msgstr "昨日" + +msgid "manager.publication.reviewStage" +msgstr "査読" + +msgid "manager.setup.reviewOptions.reminders.submit" +msgstr "査読リマインド" diff --git a/locale/ja_JP/reviewer.po b/locale/ja_JP/reviewer.po index 38a25ba24ba..4552be555ef 100644 --- a/locale/ja_JP/reviewer.po +++ b/locale/ja_JP/reviewer.po @@ -1,7 +1,8 @@ +# TAKASHI IMAGIRE , 2021. msgid "" msgstr "" -"PO-Revision-Date: 2021-03-25 08:29+0000\n" -"Last-Translator: Bjorn-Ole Kamm \n" +"PO-Revision-Date: 2021-12-12 14:15+0000\n" +"Last-Translator: TAKASHI IMAGIRE \n" "Language-Team: Japanese \n" "Language: ja_JP\n" @@ -12,7 +13,7 @@ msgstr "" "X-Generator: Weblate 3.9.1\n" msgid "reviewer.submission.enterCompetingInterests" -msgstr "本雑誌には、査読者からの潜在的な競合する利益の開示に関するポリシーがあります。 このポリシーを確認してください。" +msgstr "本誌には、査読者からの潜在的な競合する利益の開示に関するポリシーがあります。 このポリシーを確認してください。" msgid "reviewer.step1.requestBoilerplate" msgstr "次の投稿の潜在的な査読者として選択されました。 以下は、提出物の概要と、この査読のスケジュールです。 ぜひご協力をお願いいたします。" @@ -34,7 +35,7 @@ msgstr "期限日について" msgid "reviewer.complete.whatNext" msgstr "" -"この投稿物の査読を完了していただきありがとうございます。 査読は正常に送信されました。 本雑誌が公開する論文の質に対する貢献に感謝します。 " +"この投稿物の査読を完了していただきありがとうございます。 査読は正常に送信されました。 本誌が公開する論文の質に対する貢献に感謝します。 " "必要に応じて、編集者が詳細について再度連絡する場合があります。" msgid "reviewer.confirmSubmit" diff --git a/locale/ja_JP/submission.po b/locale/ja_JP/submission.po index 771670d6263..b86a1eae470 100644 --- a/locale/ja_JP/submission.po +++ b/locale/ja_JP/submission.po @@ -1,6 +1,8 @@ +# TAKASHI IMAGIRE , 2021. +# Bjorn-Ole Kamm , 2021. msgid "" msgstr "" -"PO-Revision-Date: 2021-04-16 05:46+0000\n" +"PO-Revision-Date: 2021-12-22 12:24+0000\n" "Last-Translator: Bjorn-Ole Kamm \n" "Language-Team: Japanese \n" @@ -91,7 +93,7 @@ msgid "submission.submit.newFile" msgstr "他のファイルを追加" msgid "submission.submit.includeInBrowse" -msgstr "この寄稿者をリストで表示しますか。" +msgstr "この寄稿者を出版物のリストで表示しますか。" msgid "submission.submit.fileAdded" msgstr "ファイルが追加されました" @@ -154,7 +156,7 @@ msgid "submissions.noSubmissions" msgstr "投稿物はありません" msgid "submissions.incomplete" -msgstr "投稿未了" +msgstr "不完全" msgid "submissions.declined" msgstr "辞退" @@ -485,7 +487,7 @@ msgid "submission.event.reviewer.reviewReinitiated" msgstr "査読依頼が再開された" msgid "submission.event.reviewer.reviewRecommendation" -msgstr "査読審査結果ファイル" +msgstr "査読結果ファイル" msgid "submission.event.reviewer.reviewInitiated" msgstr "査読依頼が開始された" @@ -868,7 +870,7 @@ msgid "submission.submit.uploadStep" msgstr "1. ファイルアップロード" msgid "submission.status.published" -msgstr "出版済" +msgstr "公開済" msgid "submission.status.declined" msgstr "辞退" @@ -1151,7 +1153,7 @@ msgid "submission.submit.whatNext.return" msgstr "ダッシュボードに戻る" msgid "submission.submit.whatNext.create" -msgstr "新投稿を作成する" +msgstr "新規投稿を作成する" msgid "submission.submit.whatNext.review" msgstr "この投稿を確認する" @@ -1439,10 +1441,10 @@ msgid "submission.queries.submission" msgstr "査読前のディスカッション" msgid "editor.submission.roundStatus.recommendationsReady" -msgstr "編集者からの推薦が提出されました。" +msgstr "編集者からの査読結果が提出されました。" msgid "editor.submission.roundStatus.pendingRecommendations" -msgstr "編集者の推薦待ちです。" +msgstr "編集者の査読結果待ちです。" msgid "editor.submission.roundStatus.reviewOverdue" msgstr "期限切れの査読があります。" @@ -1457,10 +1459,10 @@ msgid "editor.submission.roundStatus.pendingReviews" msgstr "査読者の応答待ちです。" msgid "editor.submission.roundStatus.pendingReviewers" -msgstr "査読者が割り当てられる待ちです。" +msgstr "査読者の割り当て待ちです。" msgid "editor.submission.roundStatus.declined" -msgstr "投稿が謝絶されました。" +msgstr "投稿は辞退されました。" msgid "editor.submission.roundStatus.accepted" msgstr "投稿が採用されました。" @@ -1719,7 +1721,7 @@ msgid "submission.review.status.responseOverdue" msgstr "査読者が回答期限を過ぎている。" msgid "submission.review.status.declined" -msgstr "査読者が査読を謝絶した。" +msgstr "査読者が査読を辞退した。" msgid "submission.review.status.awaitingResponse" msgstr "査読者の応答待ちです。" @@ -1767,10 +1769,10 @@ msgid "notification.uploadedResponse" msgstr "応答がアップロードされました。" msgid "notification.type.editorDecisionRevertDecline" -msgstr "謝絶された投稿が復元されました。" +msgstr "辞退された投稿が復元されました。" msgid "notification.type.editorDecisionDecline" -msgstr "投稿が謝絶されました。" +msgstr "投稿は辞退されました。" msgid "notification.type.editorDecisionNewRound" msgstr "新しい査読ラウンドが開始されました。" @@ -1881,25 +1883,25 @@ msgid "editor.submission.decision.nextButton" msgstr "次:{$stageName}のためのファイルの選択" msgid "editor.submission.recordedRecommendations" -msgstr "推薦記録" +msgstr "保存された査読結果" msgid "editor.submission.recommendation.description" msgstr "この投稿の編集上の決定を推奨する。" msgid "editor.submission.recommendation" -msgstr "推薦" +msgstr "査読結果" msgid "editor.submission.allRecommendations.display" -msgstr "推薦: {$recommendation}" +msgstr "査読結果: {$recommendation}" msgid "editor.submission.recommendation.display" -msgstr "推薦: {$recommendation}" +msgstr "査読結果: {$recommendation}" msgid "editor.submission.changeRecommendation" -msgstr "推薦の編集" +msgstr "査読結果の編集" msgid "editor.submission.makeRecommendation" -msgstr "推薦の提出" +msgstr "査読結果の提出" msgid "editor.submission.decision.noDecisionsAvailable" msgstr "編集者を割り当てて、この段階の編集上の決定を可能にします。" @@ -1911,7 +1913,7 @@ msgid "editor.submission.decision.approveProofsDescription" msgstr "校正ファイルを使用可能にするには、承認済みにする必要があります。 承認しますか。" msgid "editor.submission.decision.disapproveProofsDescription" -msgstr "この校正は、ダウンロードまたは購入のために公開されなくなります。 承認を却下しますか。" +msgstr "この校正ファイルは、今後、一般にダウンロードや購入ができなくなります。非承認にしますか?" msgid "editor.submission.decision.approveProofs" msgstr "校正承認" @@ -1994,4 +1996,10 @@ msgid "editor.submission.stageParticipants" msgstr "参加者" msgid "editor.submission.roundStatus.recommendationsCompleted" -msgstr "全ての編集者推薦が提出され、決定が必要です。" +msgstr "全ての編集者の査読結果の提出と、最終決定が必要です。" + +msgid "category.category" +msgstr "カテゴリー" + +msgid "submission.submit.includeInBrowse.title" +msgstr "出版リスト" diff --git a/locale/ja_JP/user.po b/locale/ja_JP/user.po index 7209727b7b2..ba453d5597a 100644 --- a/locale/ja_JP/user.po +++ b/locale/ja_JP/user.po @@ -1,7 +1,8 @@ +# TAKASHI IMAGIRE , 2021. msgid "" msgstr "" -"PO-Revision-Date: 2021-03-03 20:34+0000\n" -"Last-Translator: Bjorn-Ole Kamm \n" +"PO-Revision-Date: 2021-12-12 14:15+0000\n" +"Last-Translator: TAKASHI IMAGIRE \n" "Language-Team: Japanese \n" "Language: ja_JP\n" @@ -135,7 +136,7 @@ msgstr "アカウント情報" msgid "user.privacyLink" msgstr "" -"本雑誌の個人情報保護方針に従ってデータを保存します。" +"本誌の個人情報保護方針に従ってデータを保存します。" msgid "user.apiKey.secretRequired" msgstr "APIキーを発行する前に、サイト管理者は設定ファイル( \"api_key_secret\" )にシークレットを設定する必要があります。" @@ -251,7 +252,7 @@ msgid "user.role.assistant" msgstr "雑誌アシスタント" msgid "user.register.registrationCompleted" -msgstr "登録が完了です。プロファイル情報を完成してください。" +msgstr "登録が完了です。プロフィール情報を完成させてください。" msgid "user.register.usernameRestriction" msgstr "ユーザー名に使えるのは、英小文字と数字、ハイフンとアンダーバーだけです。" @@ -289,7 +290,7 @@ msgstr "雑誌の最新号についてのお知らせを受けたいです。" msgid "user.register.form.privacyConsent" msgstr "" -"本雑誌の個人情報保護方針に従ってデータを収集し保存することに同意します。" msgid "user.login.resetPasswordInstructions" @@ -302,7 +303,7 @@ msgid "user.profile.repeatNewPassword" msgstr "新パスワードの確認" msgid "user.profile.publicProfile" -msgstr "ユーザープロファイル" +msgstr "ユーザープロフィール" msgid "user.profile" msgstr "ユーザー情報" @@ -332,7 +333,7 @@ msgid "user.profile.form.publishedNotifications" msgstr "最新号出版のメール通知" msgid "user.profile.form.profileImage" -msgstr "プロファイル画像" +msgstr "プロフィール画像" msgid "user.profile.form.passwordSameAsOld" msgstr "新パスワードは前のパスワードと同じです。" @@ -433,12 +434,10 @@ msgstr "登録ユーザーのメールアドレス" msgid "user.login.lostPassword.passwordSent" msgstr "新しいパスワードを指定のメールアドレスに送信しました。今後、新しいパスワードでこのサイトにログインすることができます。" -msgid "user.login.lostPassword.invalidUser" -msgstr "指定されたメールアドレスにユーザーが存在しません。" - msgid "user.login.lostPassword.invalidHash" msgstr "このリンクは有効期限切れ、または正しくありません。申し訳ありませんが、もう一度、パスワードのリセット処理を行ってください。" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "確認メールを入力されたメールアドレスに送信しました。メールに書かれている指示に従って、パスワードをリセットしてください。" diff --git a/locale/ka_GE/user.po b/locale/ka_GE/user.po index b8dce8e4494..c46a520f28c 100644 --- a/locale/ka_GE/user.po +++ b/locale/ka_GE/user.po @@ -245,6 +245,7 @@ msgstr "" msgid "user.login.loginError" msgstr "პაროლი, ან მომხმარებლის სახელი არასწორია, გთხოვთ, სცადოთ ხელახლა." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "" "დადასტურება გაიგზავნა თქვენს ელფოსტის მისამართზე. გთხოვთ, მიჰყვეთ ელფოსტის " @@ -255,9 +256,6 @@ msgstr "" "უკაცრავად, ბმულს, რომელზეც დააწკაპუნეთ, ვადა ამოიწურა ან არასწორია. გთხოვთ, " "ისევ სცადოთ თქვენი პაროლის გადაყენება." -msgid "user.login.lostPassword.invalidUser" -msgstr "მომხმარებელი არ არსებობს მითითებული ელფოსტის მისამართით." - msgid "user.login.lostPassword.passwordSent" msgstr "" "ახალი პაროლი გაიგზავნა თქვენს ელფოსტის მისამართზე. ახლა თქვენ შეგიძლიათ " diff --git a/locale/ku_IQ/user.po b/locale/ku_IQ/user.po index 815416b6676..888e349fa59 100644 --- a/locale/ku_IQ/user.po +++ b/locale/ku_IQ/user.po @@ -430,14 +430,12 @@ msgstr "" "وشەیەکی نهێنیی نوێ بۆ ئیمەیڵەکەت نێردرا. تۆ ئێستا دەتوانیت داخلی پەڕەکە ببیت " "بە بەکارهێنانی وشە نهێنییە نوێیەکە." -msgid "user.login.lostPassword.invalidUser" -msgstr "هیچ ئەژمارێکی تایبەت بەم ئیمەیڵە تۆمار نەکراوە." - msgid "user.login.lostPassword.invalidHash" msgstr "" "ببورە، ئەو لینکەی کە تۆ کلیکت لەسەر کردووە بەسەر چووە یان نادروستە. تکایە " "دیسان هەوڵی گۆڕینی وشەی نهێنییەکەت بدەوە." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "" "ئیمەیڵی دڵنیاکردنەوە بۆ ئیمەیڵەکەت نێردرا. تکایە بە گوێرەی ڕێنماییەکان کە بۆ " diff --git a/locale/mk_MK/manager.po b/locale/mk_MK/manager.po index 7fef8b4dae4..a52226ef161 100644 --- a/locale/mk_MK/manager.po +++ b/locale/mk_MK/manager.po @@ -2464,10 +2464,10 @@ msgstr "ИД: {$id}" msgid "emailTemplate.variable.submission.submissionUrl" msgstr "УРЛ од поднесокот во уредничкиот приод" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "Целосно име на авторите" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "Имиња на авторите во облик на скратен наслов" msgid "emailTemplate.variable.submission.submissionAbstract" diff --git a/locale/mk_MK/user.po b/locale/mk_MK/user.po index 9d3a3dc7585..83d2935fdf7 100644 --- a/locale/mk_MK/user.po +++ b/locale/mk_MK/user.po @@ -136,14 +136,12 @@ msgstr "" "Испратена нова лозинка на имејл. Сега можете да се најавите на страницата со " "вашата нова лозинка." -msgid "user.login.lostPassword.invalidUser" -msgstr "Ниту еден корисник не постои со наведениот имејл.." - msgid "user.login.lostPassword.invalidHash" msgstr "" "Линкот што го кликнавте истече или не е валиден. Обидете се повторно да ја " "поставите вашата лозинка." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "" "Испратена е потврда на вашиот имејл. Следете ги упатствата во имејлот за да " diff --git a/locale/ms_MY/user.po b/locale/ms_MY/user.po index 18cdefdef4a..c8ef4e85886 100644 --- a/locale/ms_MY/user.po +++ b/locale/ms_MY/user.po @@ -57,14 +57,12 @@ msgstr "" "Kata laluan baharu telah dihantar ke alamat e-mel anda. Anda kini boleh log " "masuk ke laman dengan kata laluan baharu anda." -msgid "user.login.lostPassword.invalidUser" -msgstr "Tiada pengguna wujud dengan alamat e-mel yang ditentukan." - msgid "user.login.lostPassword.invalidHash" msgstr "" "Maaf, pautan yang anda klik telah tamat tempoh atau tidak sah. Sila cuba " "tetapkan semula kata laluan anda sekali lagi." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "" "Pengesahan telah dihantar ke alamat e-mel anda. Sila ikut arahan dalam e-mel " diff --git a/locale/nb_NO/user.po b/locale/nb_NO/user.po index 82070632e45..a12db7fe452 100644 --- a/locale/nb_NO/user.po +++ b/locale/nb_NO/user.po @@ -83,6 +83,7 @@ msgstr "Ugyldig brukernavn eller passord. Prøv igjen." msgid "user.login" msgstr "Logg inn" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "" "Du har fått en bekreftelse tilsendt på e-post. Følg instruksjonene i e-" @@ -93,9 +94,6 @@ msgstr "" "Beklager, lenken du klikket på har utløpt eller er ugyldig. Prøv å " "tilbakestille passordet ditt igjen." -msgid "user.login.lostPassword.invalidUser" -msgstr "Det finnes ingen bruker med denne e-postadressen." - msgid "user.login.lostPassword.passwordSent" msgstr "" "Du har fått et nytt passord tilsendt på e-post. Du kan nå logge inn på " diff --git a/locale/nl_NL/user.po b/locale/nl_NL/user.po index b26e5919258..23ebd89e97b 100644 --- a/locale/nl_NL/user.po +++ b/locale/nl_NL/user.po @@ -137,15 +137,13 @@ msgstr "Verkeerde gebruikersnaam of wachtwoord. Probeer het opnieuw" msgid "user.login" msgstr "Inloggen" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Er is een bevestiging gestuurd naar uw e-mailadres. Volg de instructies in die e-mail om uw wachtwoord terug te zetten" msgid "user.login.lostPassword.invalidHash" msgstr "Helaas, de link waar u op klikte is verlopen of ongeldig. Probeer het terugzetten van uw wachtwoord opnieuw." -msgid "user.login.lostPassword.invalidUser" -msgstr "Er is geen gebruiker met dit e-mailadres." - msgid "user.login.lostPassword.passwordSent" msgstr "Er is een nieuw wachtwoord verstuurd naar uw e-mailadres. U kunt nu inloggen met uw nieuwe wachtwoord." diff --git a/locale/pl_PL/default.po b/locale/pl_PL/default.po index 7b0b63fd94c..ad4fa09463c 100644 --- a/locale/pl_PL/default.po +++ b/locale/pl_PL/default.po @@ -1,9 +1,10 @@ +# rl , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:57+00:00\n" -"PO-Revision-Date: 2020-11-27 10:51+0000\n" +"PO-Revision-Date: 2022-01-11 15:46+0000\n" "Last-Translator: rl \n" "Language-Team: Polish \n" @@ -140,3 +141,9 @@ msgstr "Obraz" msgid "default.genres.styleSheet" msgstr "Szablon HTML" + +msgid "default.contextSettings.emailSignature" +msgstr "" +"


{$contextName}

{$mailingAddress}

{$contactName}, {$contactEmail}

" diff --git a/locale/pl_PL/editor.po b/locale/pl_PL/editor.po index 24394aba2e4..e3eaddf7916 100644 --- a/locale/pl_PL/editor.po +++ b/locale/pl_PL/editor.po @@ -1,9 +1,10 @@ +# rl , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-01-30T17:13:02+00:00\n" -"PO-Revision-Date: 2020-12-10 15:07+0000\n" +"PO-Revision-Date: 2022-01-11 15:46+0000\n" "Last-Translator: rl \n" "Language-Team: Polish \n" @@ -469,3 +470,11 @@ msgstr "Historia aktywności" msgid "editor.submission.revertDeclineDescription" msgstr "Czy na pewno chcesz zmienić decyzje i nie odrzucać tego zgłoszenia?" + +msgid "editor.discussion.errorNotStageParticipant" +msgstr "Wybrany uczestnik nie jest przypisany do tego etapu." + +msgid "editor.discussion.errorAnonymousParticipants" +msgstr "" +"Nie można utworzyć dyskusji z wybranymi uczestnikami, ponieważ wpłynęłoby to " +"na anonimowość procesu recenzji." diff --git a/locale/pl_PL/submission.po b/locale/pl_PL/submission.po index b39b9bc268a..733ed210906 100644 --- a/locale/pl_PL/submission.po +++ b/locale/pl_PL/submission.po @@ -1,9 +1,10 @@ +# rl , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-01-30T17:13:39+00:00\n" -"PO-Revision-Date: 2020-12-10 15:07+0000\n" +"PO-Revision-Date: 2022-01-11 15:46+0000\n" "Last-Translator: rl \n" "Language-Team: Polish \n" @@ -974,7 +975,7 @@ msgid "submission.submit.fileAdded" msgstr "Plik dodany" msgid "submission.submit.includeInBrowse" -msgstr "Uwzględnić tego współautora w spisie?" +msgstr "Uwzględnij tego współautora w przypadku wyświetlania listy publikacji." msgid "submission.submit.newFile" msgstr "Dodaj kolejny plik" @@ -1702,7 +1703,7 @@ msgid "submission.list.currentStage" msgstr "Obecnie na etapie {$stage}." msgid "submission.list.assignEditor" -msgstr "Przypisany redaktor" +msgstr "Przypisz redaktora" msgid "grid.category.categories" msgstr "Kategorie" @@ -2107,3 +2108,9 @@ msgstr "Zgłoszenie przywrócone do kolejki." msgid "editor.submission.decision.revertDecline" msgstr "Przywróć" + +msgid "category.category" +msgstr "Kategorie" + +msgid "submission.submit.includeInBrowse.title" +msgstr "Widoczność na listach publikacji" diff --git a/locale/pl_PL/user.po b/locale/pl_PL/user.po index a8013624f74..628669058d7 100644 --- a/locale/pl_PL/user.po +++ b/locale/pl_PL/user.po @@ -105,6 +105,7 @@ msgstr "Błędna nazwa użytkownika lub hasło. Spróbuj ponownie." msgid "user.login" msgstr "Zaloguj się" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Potwierdzenie zostało wysłane na skrzynkę e-mail. Aby zmienić hasło, proszę postępować zgodnie ze wskazówkami zamieszczonymi w przesłanej wiadomości." @@ -113,9 +114,6 @@ msgstr "" "Przepraszamy, ten link jest nieaktywny. Spróbuj zresetować swoje hasło " "ponownie." -msgid "user.login.lostPassword.invalidUser" -msgstr "Użytkownik z takim adresem e-mail nie istnieje." - msgid "user.login.lostPassword.passwordSent" msgstr "Nowe hasło zostało przesłane na podany adres e-mail. Możesz zalogować się na witrynę używając nowego hasła." diff --git a/locale/pt_BR/common.po b/locale/pt_BR/common.po index d2eb93da8f8..144f7fd017d 100644 --- a/locale/pt_BR/common.po +++ b/locale/pt_BR/common.po @@ -1,12 +1,13 @@ # Diego José Macêdo , 2021. # Felipe Geremia Nievinski , 2021. +# Alex Mendonça , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-30T11:54:13-07:00\n" -"PO-Revision-Date: 2021-09-30 00:39+0000\n" -"Last-Translator: Felipe Geremia Nievinski \n" +"PO-Revision-Date: 2022-01-11 15:46+0000\n" +"Last-Translator: Alex Mendonça \n" "Language-Team: Portuguese (Brazil) \n" "Language: pt_BR\n" @@ -59,16 +60,16 @@ msgid "about.siteMap" msgstr "Mapa do Portal" msgid "announcement.announcements" -msgstr "Anúncios" +msgstr "Notícias" msgid "announcement.announcementsHome" -msgstr "Anúncios" +msgstr "Notícias" msgid "announcement.moreAnnouncements" -msgstr "Mais anúncios..." +msgstr "Mais notícias..." msgid "announcement.noneExist" -msgstr "Nenhum anúncio foi publicado." +msgstr "Nenhuma notícia foi publicada." msgid "announcement.posted" msgstr "Publicado" @@ -77,7 +78,7 @@ msgid "announcement.postedOn" msgstr "Postado em {$postDate}" msgid "announcement.view" -msgstr "Visualizar Anúncio" +msgstr "Visualizar Notícia" msgid "common.navigation.sidebar" msgstr "Barra lateral" diff --git a/locale/pt_BR/grid.po b/locale/pt_BR/grid.po index b5588ac88f0..91dc894e1c2 100644 --- a/locale/pt_BR/grid.po +++ b/locale/pt_BR/grid.po @@ -1,9 +1,10 @@ +# Diego José Macêdo , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-30T11:54:13-07:00\n" -"PO-Revision-Date: 2020-06-07 13:56+0000\n" +"PO-Revision-Date: 2021-12-22 12:24+0000\n" "Last-Translator: Diego José Macêdo \n" "Language-Team: Portuguese (Brazil) \n" @@ -686,3 +687,37 @@ msgstr "Remover este grupo de usuários" msgid "grid.action.uninstall" msgstr "Desinstalar" + +msgid "contributor.listPanel.preview.full" +msgstr "Completo" + +msgid "contributor.listPanel.preview.publicationLists" +msgstr "Listas de Publicação" + +msgid "contributor.listPanel.preview.abbreviated" +msgstr "Abreviado" + +msgid "contributor.listPanel.preview.display" +msgstr "Exibição" + +msgid "contributor.listPanel.preview.format" +msgstr "Formato" + +msgid "contributor.listPanel.preview.description" +msgstr "" +"Os colaboradores desta publicação serão identificados neste periódico nos " +"seguintes formatos." + +msgid "contributor.listPanel.preview" +msgstr "Pré-visualizar" + +msgid "author.users.contributor.setPrincipalContact" +msgstr "Definir contato principal" + +msgid "grid.action.deleteContributor.confirmationMessage" +msgstr "" +"Tem certeza que deseja remover {$name} como um colaborador? Essa ação não " +"pode ser desfeita." + +msgid "grid.action.saveOrdering" +msgstr "Salvar Ordem" diff --git a/locale/pt_BR/manager.po b/locale/pt_BR/manager.po index ab7ddb33c60..5700f331835 100644 --- a/locale/pt_BR/manager.po +++ b/locale/pt_BR/manager.po @@ -1,12 +1,13 @@ # Felipe Geremia Nievinski , 2021. # Diego José Macêdo , 2021. +# Alex Mendonça , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-30T11:54:13-07:00\n" -"PO-Revision-Date: 2021-11-22 17:39+0000\n" -"Last-Translator: Diego José Macêdo \n" +"PO-Revision-Date: 2022-01-11 15:46+0000\n" +"Last-Translator: Alex Mendonça \n" "Language-Team: Portuguese (Brazil) \n" "Language: pt_BR\n" @@ -26,13 +27,13 @@ msgid "manager.website.imageFileRequired" msgstr "Um arquivo de imagem é requerido. Certifique-se de que escolheu e enviou um arquivo." msgid "manager.announcements" -msgstr "Anúncios" +msgstr "Notícias" msgid "manager.announcements.confirmDelete" -msgstr "Deseja realmente excluir permanentemente o anúncio {$title}?" +msgstr "Deseja realmente excluir permanentemente a notícia {$title}?" msgid "manager.announcements.create" -msgstr "Criar novo anúncio" +msgstr "Criar nova notícia" msgid "manager.announcements.createTitle" msgstr "Criar" @@ -98,7 +99,7 @@ msgid "manager.announcements.form.typeIdValid" msgstr "Escolha um tipo válido de notícia." msgid "manager.announcements.noneCreated" -msgstr "Não há anúncios criados." +msgstr "Não há notícias criadas." msgid "manager.announcements.title" msgstr "Título" @@ -2262,10 +2263,10 @@ msgstr "Notificações" msgid "emailTemplate.variable.submission.submissionUrl" msgstr "Link para a submissão no sistema editorial" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "Nomes completos dos autores" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "Nomes dos autores na forma encurtada" msgid "emailTemplate.variable.submission.submissionAbstract" @@ -2348,3 +2349,6 @@ msgstr "" msgid "mailable.mailDiscussionMessage.name" msgstr "Nova mensagem de discussão" + +msgid "emailTemplate.variable.site.siteContactEmail" +msgstr "O e-mail do contato principal do site" diff --git a/locale/pt_BR/submission.po b/locale/pt_BR/submission.po index 512880d8dfb..71d13d61a82 100644 --- a/locale/pt_BR/submission.po +++ b/locale/pt_BR/submission.po @@ -1,10 +1,11 @@ +# Diego José Macêdo , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-30T11:54:14-07:00\n" -"PO-Revision-Date: 2021-04-10 12:55+0000\n" -"Last-Translator: Luiz Borges \n" +"PO-Revision-Date: 2021-12-22 12:24+0000\n" +"Last-Translator: Diego José Macêdo \n" "Language-Team: Portuguese (Brazil) \n" "Language: pt_BR\n" @@ -1214,7 +1215,7 @@ msgid "submission.submit.fileAdded" msgstr "Arquivo Adicionado" msgid "submission.submit.includeInBrowse" -msgstr "Incluir este autor em listas de navegação?" +msgstr "Inclua este autor ao identificar os autores em listas de publicações." msgid "submission.submit.newFile" msgstr "Enviar um Novo Arquivo" @@ -2329,3 +2330,9 @@ msgstr "Reverter Rejeição" msgid "notification.type.revertDecline" msgstr "A decisão de recusar esta submissão foi revertida." + +msgid "category.category" +msgstr "Categorias" + +msgid "submission.submit.includeInBrowse.title" +msgstr "Listas de Publicação" diff --git a/locale/pt_BR/user.po b/locale/pt_BR/user.po index d59ee716709..1037c50d028 100644 --- a/locale/pt_BR/user.po +++ b/locale/pt_BR/user.po @@ -1,10 +1,11 @@ +# Diego José Macêdo , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-09-30T11:54:14-07:00\n" -"PO-Revision-Date: 2021-02-06 03:57+0000\n" -"Last-Translator: Alex Mendonça \n" +"PO-Revision-Date: 2021-12-22 12:24+0000\n" +"Last-Translator: Diego José Macêdo \n" "Language-Team: Portuguese (Brazil) \n" "Language: pt_BR\n" @@ -137,15 +138,13 @@ msgstr "Login e/ou senha inválido(s). Tente novamente." msgid "user.login" msgstr "Acesso" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Um e-mail de confirmação foi enviado. Siga as instruções para criar uma nova senha." msgid "user.login.lostPassword.invalidHash" msgstr "O link acessado expirou ou é inválido. Lamentamos o inconveniente. Tente criar uma senha novamente." -msgid "user.login.lostPassword.invalidUser" -msgstr "Nenhum usuário cadastrado com o e-mail especificado." - msgid "user.login.lostPassword.passwordSent" msgstr "Uma nova senha foi enviada. Acesse o sistema com a nova senha." @@ -207,7 +206,9 @@ msgid "user.preferredPublicName" msgstr "Nome Público de Preferência" msgid "user.preferredPublicName.description" -msgstr "Como você prefere ser tratado(a)? Pronomes de tratamento, nomes do meio e sufixos podem ser adicionados aqui." +msgstr "" +"Por favor, forneça o nome completo, já que o autor deve ser identificado no " +"trabalho publicado. Exemplo: Dr. Alan P. Mwandenga" msgid "user.profile.changePasswordInstructions" msgstr "Digite as senhas atual e nova para alterar a senha de acesso ao cadastro." diff --git a/locale/pt_PT/admin.po b/locale/pt_PT/admin.po index 1b84873da50..20b3ebaaf91 100644 --- a/locale/pt_PT/admin.po +++ b/locale/pt_PT/admin.po @@ -1,9 +1,10 @@ +# Carla Marques , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:58+00:00\n" -"PO-Revision-Date: 2021-01-21 12:53+0000\n" +"PO-Revision-Date: 2022-01-11 15:46+0000\n" "Last-Translator: Carla Marques \n" "Language-Team: Portuguese (Portugal) \n" @@ -331,3 +332,6 @@ msgstr "Restringir E-mails em massa" msgid "admin.settings.enableBulkEmails.label" msgstr "E-mails em massa" + +msgid "admin.scheduledTask.statisticsReport" +msgstr "Notificação de Relatório Editorial" diff --git a/locale/pt_PT/grid.po b/locale/pt_PT/grid.po index 9dee9b8c0b5..4ef23f7e62b 100644 --- a/locale/pt_PT/grid.po +++ b/locale/pt_PT/grid.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:58+00:00\n" -"PO-Revision-Date: 2021-06-29 04:03+0000\n" +"PO-Revision-Date: 2021-12-22 12:24+0000\n" "Last-Translator: Carla Marques \n" "Language-Team: Portuguese (Portugal) \n" @@ -676,3 +676,37 @@ msgstr "Ver/Selecionar utilizadores" msgid "grid.action.removeUserGroup" msgstr "Remover este grupo de utilizadores" + +msgid "contributor.listPanel.preview.full" +msgstr "Completo" + +msgid "contributor.listPanel.preview.publicationLists" +msgstr "Listas de Publicação" + +msgid "contributor.listPanel.preview.abbreviated" +msgstr "Abreviado" + +msgid "contributor.listPanel.preview.display" +msgstr "Exibir" + +msgid "contributor.listPanel.preview.format" +msgstr "Formato" + +msgid "contributor.listPanel.preview.description" +msgstr "" +"Os contribuidores desta publicação serão indentificados nesta revista nos " +"seguintes formatos." + +msgid "contributor.listPanel.preview" +msgstr "Pré-visualizar" + +msgid "author.users.contributor.setPrincipalContact" +msgstr "Definir como Contacto Principal" + +msgid "grid.action.deleteContributor.confirmationMessage" +msgstr "" +"Deseja realmente eliminar {$name} como contribuidor? Esta ação não pode ser " +"desfeita." + +msgid "grid.action.saveOrdering" +msgstr "Guardar Ordem" diff --git a/locale/pt_PT/manager.po b/locale/pt_PT/manager.po index d901b5d5e12..62c96cab19f 100644 --- a/locale/pt_PT/manager.po +++ b/locale/pt_PT/manager.po @@ -1,10 +1,10 @@ -# Carla Marques , 2021. +# Carla Marques , 2021, 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:58+00:00\n" -"PO-Revision-Date: 2021-11-16 18:16+0000\n" +"PO-Revision-Date: 2022-01-06 09:25+0000\n" "Last-Translator: Carla Marques \n" "Language-Team: Portuguese (Portugal) \n" @@ -2266,10 +2266,10 @@ msgid "emailTemplate.variable.context.passwordLostUrl" msgstr "" "O URL para uma página onde o utilizador pode recuperar a password perdida" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "Nomes completos dos autores" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "Nomes dos autores de forma abreviada" msgid "emailTemplate.variable.submission.submissionUrl" @@ -2310,3 +2310,6 @@ msgid "mailable.mailDiscussionMessage.description" msgstr "" "Este e-mail é enviado automaticamente a participantes da discussão quando " "uma nova mensagem é adicionada à discussão." + +msgid "emailTemplate.variable.site.siteContactEmail" +msgstr "O e-mail do contacto principal do site" diff --git a/locale/pt_PT/submission.po b/locale/pt_PT/submission.po index 1cf34fabe5e..7bf6bd46f24 100644 --- a/locale/pt_PT/submission.po +++ b/locale/pt_PT/submission.po @@ -1,10 +1,11 @@ +# Carla Marques , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:59+00:00\n" -"PO-Revision-Date: 2021-04-10 12:55+0000\n" -"Last-Translator: Luiz Borges \n" +"PO-Revision-Date: 2021-12-22 12:24+0000\n" +"Last-Translator: Carla Marques \n" "Language-Team: Portuguese (Portugal) \n" "Language: pt_PT\n" @@ -976,7 +977,9 @@ msgid "submission.submit.fileAdded" msgstr "Ficheiro Adicionado" msgid "submission.submit.includeInBrowse" -msgstr "Adicionar este colaborador às listas de navegação?" +msgstr "" +"Adicionar este colaborador quando identificar os autores em listas de " +"publicação." msgid "submission.submit.newFile" msgstr "Adicionar outro Ficheiro" @@ -2018,3 +2021,9 @@ msgstr "" "notificada e irá proceder para assegurar-se que as revisões ficam " "concluídas. Não precisa de tomar qualquer ação neste momento. Será " "notificado quando uma decisão for tomada." + +msgid "category.category" +msgstr "Categorias" + +msgid "submission.submit.includeInBrowse.title" +msgstr "Listas de Publicação" diff --git a/locale/pt_PT/user.po b/locale/pt_PT/user.po index fbf13e17748..80cbade68a8 100644 --- a/locale/pt_PT/user.po +++ b/locale/pt_PT/user.po @@ -1,9 +1,10 @@ +# Carla Marques , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:49:59+00:00\n" -"PO-Revision-Date: 2020-12-29 10:52+0000\n" +"PO-Revision-Date: 2021-12-22 12:24+0000\n" "Last-Translator: Carla Marques \n" "Language-Team: Portuguese (Portugal) \n" @@ -71,15 +72,13 @@ msgstr "Nome de utilizador e/ou senha inválido(s). Tente novamente." msgid "user.login" msgstr "Autenticação" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Foi enviado um e-mail de confirmação. Siga as instruções para criar uma nova senha." msgid "user.login.lostPassword.invalidHash" msgstr "O link acedido expirou ou é inválido. Lamentamos o inconveniente. Tente criar uma senha novamente." -msgid "user.login.lostPassword.invalidUser" -msgstr "Nenhum utilizador registado com o e-mail especificado." - msgid "user.login.lostPassword.passwordSent" msgstr "Foi enviada uma nova senha. Aceda à revista com a nova senha." @@ -437,8 +436,8 @@ msgstr "É obrigatório inserir o nome próprio." msgid "user.preferredPublicName.description" msgstr "" -"Como prefere ser tratado(a)? Pode adicionar aqui saudações, nomes do meio e " -"sufixos se o desejar." +"Insira o nome completo do autor da forma que deverá aparecer no trabalho " +"publicado. Exemplo: Dr. Alan P. Mwandenga" msgid "user.preferredPublicName" msgstr "Nome Público Preferencial" diff --git a/locale/ro_RO/user.po b/locale/ro_RO/user.po index f2a9e59aaad..7c1c4023c34 100644 --- a/locale/ro_RO/user.po +++ b/locale/ro_RO/user.po @@ -336,14 +336,12 @@ msgstr "" "O nouă parolă a fost trimisă la adresa dvs. de e-mail. Acum vă puteți " "autentifica pe site cu noua parolă." -msgid "user.login.lostPassword.invalidUser" -msgstr "Nu există utilizator cu adresa de e-mail specificată." - msgid "user.login.lostPassword.invalidHash" msgstr "" "Ne pare rău, linkul pe care ai făcut clic a expirat sau nu este valid. " "Încercați să resetați parola din nou." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "" "A fost trimisă o confirmare la adresa dvs. de e-mail. Vă rugăm să urmați " diff --git a/locale/ru_RU/grid.po b/locale/ru_RU/grid.po index 1949bfe00a0..dca836f6c8a 100644 --- a/locale/ru_RU/grid.po +++ b/locale/ru_RU/grid.po @@ -1,15 +1,20 @@ +# Pavel Pisklakov , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: \n" -"Language-Team: \n" +"POT-Creation-Date: 2019-11-19T10:50:00+00:00\n" +"PO-Revision-Date: 2021-12-26 09:24+0000\n" +"Last-Translator: Pavel Pisklakov \n" +"Language-Team: Russian \n" +"Language: ru_RU\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2019-11-19T10:50:00+00:00\n" -"PO-Revision-Date: 2019-11-19T10:50:00+00:00\n" -"Language: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=" +"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 3.9.1\n" msgid "grid.noItems" msgstr "Нет элементов" @@ -670,3 +675,36 @@ msgstr "Меню навигации отсутствуют" msgid "grid.navigationMenus.navigationMenu.selectType" msgstr "Выберите тип..." + +msgid "contributor.listPanel.preview.description" +msgstr "" +"Авторы этой публикации будут указаны в этом журнале в следующих форматах." + +msgid "contributor.listPanel.preview.full" +msgstr "Полный" + +msgid "contributor.listPanel.preview.publicationLists" +msgstr "Списки публикаций" + +msgid "contributor.listPanel.preview.abbreviated" +msgstr "Сокращенный" + +msgid "contributor.listPanel.preview.display" +msgstr "Отображение" + +msgid "contributor.listPanel.preview.format" +msgstr "Формат" + +msgid "contributor.listPanel.preview" +msgstr "Просмотр" + +msgid "author.users.contributor.setPrincipalContact" +msgstr "Задать контактное лицо" + +msgid "grid.action.deleteContributor.confirmationMessage" +msgstr "" +"Вы уверены, что хотите удалить «{$name}» из списка авторов? Это действие " +"нельзя будет отменить." + +msgid "grid.action.saveOrdering" +msgstr "Сохранить порядок" diff --git a/locale/ru_RU/manager.po b/locale/ru_RU/manager.po index 49f3ddf0ed8..a4b9b8c9f99 100644 --- a/locale/ru_RU/manager.po +++ b/locale/ru_RU/manager.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:50:00+00:00\n" -"PO-Revision-Date: 2021-09-23 12:50+0000\n" +"PO-Revision-Date: 2021-12-26 09:24+0000\n" "Last-Translator: Pavel Pisklakov \n" "Language-Team: Russian \n" @@ -2143,10 +2143,10 @@ msgstr "Уведомления" msgid "emailTemplate.variable.submission.submissionUrl" msgstr "URL материала в бэкенде редакции" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "ФИО авторов" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "Имена авторов в форме короткой строки" msgid "emailTemplate.variable.submission.submissionAbstract" @@ -2190,3 +2190,43 @@ msgstr "ФИО получателя или всех получателей" msgid "emailTemplate.variable.context.passwordLostUrl" msgstr "URL страницы, где пользователь может восстановить потерянный пароль" + +msgid "mailable.validateEmailSite.description" +msgstr "" +"Это письмо автоматически отправляется новому пользователю, когда он " +"регистрируется на сайте, настройки которого требуют подтверждения адреса " +"электронной почты." + +msgid "mailable.validateEmailSite.name" +msgstr "Проверка адреса почты (сайт)" + +msgid "mailable.mailReviewerUnassigned.description" +msgstr "Это письмо отправляется, когда редактор отменяет назначение рецензента." + +msgid "mailable.mailReviewerUnassigned.name" +msgstr "Назначение рецензентом отменено" + +msgid "mailable.mailReviewerReinstate.description" +msgstr "" +"Это письмо отправляется, когда снятый с назначения рецензент снова " +"назначается редактором." + +msgid "mailable.mailReviewerReinstate.name" +msgstr "Рецензент назначен заново" + +msgid "mailable.mailReviewerAssigned.description" +msgstr "Это письмо отправляется, когда рецензенту назначают материал." + +msgid "mailable.mailReviewerAssigned.name" +msgstr "Назначен рецензент" + +msgid "mailable.mailDiscussionMessage.description" +msgstr "" +"Это письмо автоматически отправляется участникам обсуждения, когда в " +"обсуждение добавляется новое сообщение." + +msgid "mailable.mailDiscussionMessage.name" +msgstr "Новое сообщение в обсуждении" + +msgid "emailTemplate.variable.site.siteContactEmail" +msgstr "Адрес электронной почты основного контактного лица сайта" diff --git a/locale/ru_RU/submission.po b/locale/ru_RU/submission.po index 22db6c8f538..6ea11e3c410 100644 --- a/locale/ru_RU/submission.po +++ b/locale/ru_RU/submission.po @@ -1,9 +1,10 @@ +# Pavel Pisklakov , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:50:00+00:00\n" -"PO-Revision-Date: 2020-12-18 16:52+0000\n" +"PO-Revision-Date: 2021-12-26 09:24+0000\n" "Last-Translator: Pavel Pisklakov \n" "Language-Team: Russian \n" @@ -1009,7 +1010,7 @@ msgid "submission.submit.fileAdded" msgstr "Файл добавлен" msgid "submission.submit.includeInBrowse" -msgstr "Включить этого автора в список поиска?" +msgstr "Добавить этого автора при указании авторов в списках публикаций." msgid "submission.submit.newFile" msgstr "Добавить другой файл" @@ -1916,3 +1917,9 @@ msgstr "Отклонение материала было отменено." msgid "editor.submission.decision.revertDecline" msgstr "Отменить отклонение материала" + +msgid "category.category" +msgstr "Категории" + +msgid "submission.submit.includeInBrowse.title" +msgstr "Списки публикаций" diff --git a/locale/ru_RU/user.po b/locale/ru_RU/user.po index bdc696b1fb2..fb61593723d 100644 --- a/locale/ru_RU/user.po +++ b/locale/ru_RU/user.po @@ -1,15 +1,20 @@ +# Pavel Pisklakov , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: \n" -"Language-Team: \n" +"POT-Creation-Date: 2019-11-19T10:50:01+00:00\n" +"PO-Revision-Date: 2021-12-26 09:24+0000\n" +"Last-Translator: Pavel Pisklakov \n" +"Language-Team: Russian \n" +"Language: ru_RU\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2019-11-19T10:50:01+00:00\n" -"PO-Revision-Date: 2019-11-19T10:50:01+00:00\n" -"Language: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=" +"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 3.9.1\n" msgid "user.accountInformation" msgstr "Информация учетной записи" @@ -137,15 +142,13 @@ msgstr "Неправильное имя пользователя или паро msgid "user.login" msgstr "Войти в систему" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Подтверждение было отправлено на ваш адрес электронной почты. Пожалуйста, следуйте инструкциям в письме, чтобы сбросить пароль." msgid "user.login.lostPassword.invalidHash" msgstr "Извините, ссылка на которой вы щелкнули, просрочена или неправильна. Пожалуйста, попробуйте сбросить ваш пароль еще раз." -msgid "user.login.lostPassword.invalidUser" -msgstr "Пользователя с таким адресом электронной почты не существует." - msgid "user.login.lostPassword.passwordSent" msgstr "Новый пароль был отправлен на ваш адрес электронной почты. Теперь вы можете войти на сайт с вашим новым паролем." @@ -207,7 +210,9 @@ msgid "user.preferredPublicName" msgstr "Предпочитаемое обращение" msgid "user.preferredPublicName.description" -msgstr "Как вы хотите, чтобы к вам обращались? При желании вы можете добавить сюда приветствие, отчество/второе имя и суффиксы." +msgstr "" +"Пожалуйста, укажите полное имя автора так, как оно должно быть указано в " +"опубликованной работе. Например: Dr. Alan P. Mwandenga" msgid "user.profile.changePasswordInstructions" msgstr "Введите ниже ваши текущий и новый пароли для изменения пароля вашей учетной записи." diff --git a/locale/sl_SI/submission.po b/locale/sl_SI/submission.po index 09a33a00e21..c23fca5b131 100644 --- a/locale/sl_SI/submission.po +++ b/locale/sl_SI/submission.po @@ -1,9 +1,10 @@ +# Primož Svetek , 2021. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:50:02+00:00\n" -"PO-Revision-Date: 2021-04-25 17:28+0000\n" +"PO-Revision-Date: 2021-12-04 03:31+0000\n" "Last-Translator: Primož Svetek \n" "Language-Team: Slovenian \n" @@ -1990,3 +1991,6 @@ msgstr "" "Eden ali več recenzentov zamuja z recenzijo. Uredništvo je bilo obveščeno o " "tem in bo reagiralo, da bo zagotovilo dokončanje recenzije. Ta trenutek vam " "ni potrebno storiti ničesar. Ko bo odločitev sprejeta boste obveščeni." + +msgid "category.category" +msgstr "Kategorije" diff --git a/locale/sl_SI/user.po b/locale/sl_SI/user.po index 57043a5b106..53c700cbeda 100644 --- a/locale/sl_SI/user.po +++ b/locale/sl_SI/user.po @@ -126,15 +126,13 @@ msgstr "Napačno uporabniško ime ali geslo. Poskusite ponovno." msgid "user.login" msgstr "Prijava" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Potrdilo je bilo poslano na vaš e-poštni naslov. Prosimo sledite navodilom v sporočilu, da boste ponastavili vaše geslo." msgid "user.login.lostPassword.invalidHash" msgstr "Oprostite, povezava, ki ste jo uporabili, ni več veljavna ali pa je napačna. Poskusite ponovno ponastaviti geslo." -msgid "user.login.lostPassword.invalidUser" -msgstr "Uporabnik z vnešenim e-poštnim naslovom ne obstaja." - msgid "user.login.lostPassword.passwordSent" msgstr "Novo geslo je bilo poslano na vaš e-poštni naslov. Prijavite se lahko z novim geslom." diff --git a/locale/sr_RS@cyrillic/user.po b/locale/sr_RS@cyrillic/user.po index 876de8e692d..f55a3650926 100644 --- a/locale/sr_RS@cyrillic/user.po +++ b/locale/sr_RS@cyrillic/user.po @@ -83,9 +83,6 @@ msgstr "Неисправно корисничко име или лозинка. msgid "user.login" msgstr "Пријави се" -msgid "user.login.lostPassword.invalidUser" -msgstr "Не постоји корисник са датом адресом." - msgid "user.login.lostPassword.passwordSent" msgstr "Нова лозинка је послата на вашу адресу. Можете се пријавити у сајт са вашом новом лозинком." @@ -371,6 +368,7 @@ msgstr "Хвала што сте активирали ваш налог. Мож msgid "user.login.changePasswordInstructions" msgstr "Морате одабрати нову лозинку пре него се пријавите у сајт.

Молимо да унесете ваше корисничко име и вашу садашњу и нову лозинку како би изменили лозинку вашег налога." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Послата је потврда на вашу адресу. Следите инструкције у тој поруци да би променили лозинку." diff --git a/locale/sr_RS@latin/user.po b/locale/sr_RS@latin/user.po index 5402b40efff..ae4fe8d877f 100644 --- a/locale/sr_RS@latin/user.po +++ b/locale/sr_RS@latin/user.po @@ -83,9 +83,6 @@ msgstr "Neispravno korisničko ime ili lozinka. Pokušajte ponovo." msgid "user.login" msgstr "Prijavi se" -msgid "user.login.lostPassword.invalidUser" -msgstr "Ne postoji korisnik sa datom adresom." - msgid "user.login.lostPassword.passwordSent" msgstr "Nova lozinka je poslata na vašu adresu. Možete se prijaviti u sajt sa vašom novom lozinkom." @@ -371,6 +368,7 @@ msgstr "Hvala što ste aktivirali vaš nalog. Možete se prijaviti u sistem kori msgid "user.login.changePasswordInstructions" msgstr "Morate odabrati novu lozinku pre nego se prijavite u sajt.

Molimo da unesete vaše korisničko ime i vašu sadašnju i novu lozinku kako bi izmenili lozinku vašeg naloga." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Poslata je potvrda na vašu adresu. Sledite instrukcije u toj poruci da bi promenili lozinku." diff --git a/locale/sv_SE/user.po b/locale/sv_SE/user.po index 8855e0200e9..8ef403dc02d 100644 --- a/locale/sv_SE/user.po +++ b/locale/sv_SE/user.po @@ -134,15 +134,13 @@ msgstr "Fel användarnamn eller lösenord. Försök igen." msgid "user.login" msgstr "Logga in" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "Vi har skickat ett meddelande till din e-postadress för bekräftelse. Följ instruktionerna i meddelandet för att återställa ditt lösenord." msgid "user.login.lostPassword.invalidHash" msgstr "Länken du har klickat på har upphört eller är ogiltig. Prova att återställa ditt lösenord igen." -msgid "user.login.lostPassword.invalidUser" -msgstr "Det finns ingen användare med den här e-postadressen." - msgid "user.login.lostPassword.passwordSent" msgstr "Ett nytt lösenord har skickats till din e-postadress. Du kan nu logga in med det nya lösenordet." diff --git a/locale/tr_TR/grid.po b/locale/tr_TR/grid.po index e0f2891fca0..1a233511201 100644 --- a/locale/tr_TR/grid.po +++ b/locale/tr_TR/grid.po @@ -1,9 +1,10 @@ +# Hüseyin Körpeoğlu , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:50:07+00:00\n" -"PO-Revision-Date: 2020-06-20 11:39+0000\n" +"PO-Revision-Date: 2022-01-10 09:39+0000\n" "Last-Translator: Hüseyin Körpeoğlu \n" "Language-Team: Turkish \n" @@ -676,3 +677,37 @@ msgstr "Kullanıcıları Göster/Seç" msgid "grid.action.removeUserGroup" msgstr "Bu kullanıcı grubunu kaldır" + +msgid "grid.action.saveOrdering" +msgstr "Sıralamayı Kaydet" + +msgid "contributor.listPanel.preview.full" +msgstr "Tam" + +msgid "contributor.listPanel.preview.publicationLists" +msgstr "Yayın Listeleri" + +msgid "contributor.listPanel.preview.abbreviated" +msgstr "Kısaltılmış" + +msgid "contributor.listPanel.preview.display" +msgstr "Görünüm" + +msgid "contributor.listPanel.preview.format" +msgstr "Biçim" + +msgid "contributor.listPanel.preview.description" +msgstr "" +"Bu makaleye katkıda bulunanlar bu dergide aşağıdaki formatlarda " +"tanımlanacaktır." + +msgid "contributor.listPanel.preview" +msgstr "Önizle" + +msgid "author.users.contributor.setPrincipalContact" +msgstr "Birincil Kişi Olarak Belirle" + +msgid "grid.action.deleteContributor.confirmationMessage" +msgstr "" +"{$name} isimli kişiyi kaldırmak istediğinizden emin misiniz? Bu işlem geri " +"alınamaz." diff --git a/locale/tr_TR/manager.po b/locale/tr_TR/manager.po index 46b23d4fcf6..8fe245e9ced 100644 --- a/locale/tr_TR/manager.po +++ b/locale/tr_TR/manager.po @@ -1,10 +1,10 @@ -# Hüseyin Körpeoğlu , 2021. +# Hüseyin Körpeoğlu , 2021, 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:50:07+00:00\n" -"PO-Revision-Date: 2021-11-21 22:23+0000\n" +"PO-Revision-Date: 2022-01-10 09:39+0000\n" "Last-Translator: Hüseyin Körpeoğlu \n" "Language-Team: Turkish \n" @@ -2290,10 +2290,10 @@ msgstr "Bildirimler" msgid "emailTemplate.variable.submission.submissionUrl" msgstr "Editör ekranında aday makalenin URL'si" -msgid "emailTemplate.variable.submission.authorsFull" +msgid "emailTemplate.variable.submission.authors" msgstr "Yazarların tam isimleri" -msgid "emailTemplate.variable.submission.authors" +msgid "emailTemplate.variable.submission.authorsShort" msgstr "Kısaltılmış bir dize biçimindeki yazar adları" msgid "emailTemplate.variable.submission.submissionAbstract" @@ -2371,3 +2371,6 @@ msgstr "" msgid "mailable.mailDiscussionMessage.name" msgstr "Yeni Tartışma Mesajı" + +msgid "emailTemplate.variable.site.siteContactEmail" +msgstr "Birincil iletişim kişisinin e-postası" diff --git a/locale/tr_TR/submission.po b/locale/tr_TR/submission.po index 7b1e97ef3f7..9d93119c3bf 100644 --- a/locale/tr_TR/submission.po +++ b/locale/tr_TR/submission.po @@ -1,9 +1,10 @@ +# Hüseyin Körpeoğlu , 2021, 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:50:08+00:00\n" -"PO-Revision-Date: 2020-12-08 07:36+0000\n" +"PO-Revision-Date: 2022-01-10 09:39+0000\n" "Last-Translator: Hüseyin Körpeoğlu \n" "Language-Team: Turkish \n" @@ -2004,3 +2005,9 @@ msgstr "Reddedilen aday makale yeniden etkinleştirildi." msgid "editor.submission.decision.revertDecline" msgstr "Reddetmeyi Geri Al" + +msgid "category.category" +msgstr "Kategoriler" + +msgid "submission.submit.includeInBrowse.title" +msgstr "Yayın Listeleri" diff --git a/locale/tr_TR/user.po b/locale/tr_TR/user.po index 02dbec2c873..c24a8ea1445 100644 --- a/locale/tr_TR/user.po +++ b/locale/tr_TR/user.po @@ -1,9 +1,10 @@ +# Hüseyin Körpeoğlu , 2022. msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-19T10:50:08+00:00\n" -"PO-Revision-Date: 2020-11-27 10:51+0000\n" +"PO-Revision-Date: 2022-01-10 09:39+0000\n" "Last-Translator: Hüseyin Körpeoğlu \n" "Language-Team: Turkish \n" @@ -116,15 +117,13 @@ msgstr "Kullanıcı adı yada şifre hatalı girildi. Büyük-küçük harf uyum msgid "user.login" msgstr "Giriş" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "E-posta adresinize bir doğrulama mesajı gönderilmiştir. Şifrenizi yenilemek için bu e-postadaki talimatları uygulayınız." msgid "user.login.lostPassword.invalidHash" msgstr "Üzgünüz, tıklamış olduğunuz bağlantı geçerli değildir. Şifrenizi yenilemek için tekrar deneyiniz." -msgid "user.login.lostPassword.invalidUser" -msgstr "Belirtilen e-posta adresiyle kayıtlı bir kullanıcı bulunamamıştır." - msgid "user.login.lostPassword.passwordSent" msgstr "E-posta adresinize yeni şifreniz gönderilmiştir. Yeni şifrenizi kullanarak siteme bağlanabilirsiniz." @@ -464,8 +463,8 @@ msgstr "Belirli bir ad gerekli." msgid "user.preferredPublicName.description" msgstr "" -"Nasıl belirtmeyi tercih edersiniz? İsterseniz buraya selamlar, ikinci adlar " -"ve son ekler eklenebilir." +"Yazarın yayınlanmış çalışmada belirtilmesi gerektiğinden lütfen tam adı " +"belirtin. Örnek: Dr. Alan P. Mwandenga" msgid "user.preferredPublicName" msgstr "Tercih Edilen Genel Ad" diff --git a/locale/uk_UA/user.po b/locale/uk_UA/user.po index bb66dc1b4fd..199571dca87 100644 --- a/locale/uk_UA/user.po +++ b/locale/uk_UA/user.po @@ -126,15 +126,13 @@ msgstr "Невірне ім'я користувача або пароль. Бу msgid "user.login" msgstr "Увійти" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "На вашу адресу email було надіслане підтвердження. Виконайте вказані у листі інструкції, щоб змінити ваш пароль." msgid "user.login.lostPassword.invalidHash" msgstr "Вибачте, посилання застаріле або некоректне. Будь ласка, спробуйте знову змінити свій пароль." -msgid "user.login.lostPassword.invalidUser" -msgstr "Не існує користувача зі вказаною адресою email." - msgid "user.login.lostPassword.passwordSent" msgstr "На вашу адресу email був надісланий новий пароль. Тепер ви можете увійти на сайт зі своїм новим паролем." diff --git a/locale/vi_VN/user.po b/locale/vi_VN/user.po index 4829dd6c1c0..7a133affed2 100644 --- a/locale/vi_VN/user.po +++ b/locale/vi_VN/user.po @@ -334,14 +334,12 @@ msgstr "" "Một mật khẩu mới đã được gửi đến địa chỉ email của bạn. Bây giờ bạn có thể " "đăng nhập vào trang web bằng mật khẩu mới của mình." -msgid "user.login.lostPassword.invalidUser" -msgstr "Không có người dùng nào tồn tại với địa chỉ email được chỉ định." - msgid "user.login.lostPassword.invalidHash" msgstr "" "Xin lỗi, liên kết bạn nhấp vào đã hết hạn hoặc không hợp lệ. Vui lòng thử " "đặt lại mật khẩu của bạn một lần nữa." +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "" "Một xác nhận đã được gửi đến địa chỉ email của bạn. Vui lòng làm theo hướng " diff --git a/locale/zh_CN/user.po b/locale/zh_CN/user.po index 642fcc24f88..f621e48fec1 100644 --- a/locale/zh_CN/user.po +++ b/locale/zh_CN/user.po @@ -78,15 +78,13 @@ msgstr "无效的用户名或者密码,请重试." msgid "user.login" msgstr "登录" +#, fuzzy msgid "user.login.lostPassword.confirmationSent" msgstr "一封确认已发送到您的电子邮件地址,请按照电子邮件中的说明重置您的密码." msgid "user.login.lostPassword.invalidHash" msgstr "对不起,你点击链接已过期或无效,请尝试再次重置您的密码." -msgid "user.login.lostPassword.invalidUser" -msgstr "指定的电子邮件相关用户不存在." - msgid "user.login.lostPassword.passwordSent" msgstr "一个新的密码已发送到您的电子邮件地址.您现在可以使用新的密码登录了." diff --git a/pages/about/AboutContextHandler.inc.php b/pages/about/AboutContextHandler.inc.php index 85873eaec2a..c61297cc60b 100644 --- a/pages/about/AboutContextHandler.inc.php +++ b/pages/about/AboutContextHandler.inc.php @@ -48,8 +48,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Display about page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function index($args, $request) { @@ -61,8 +61,8 @@ public function index($args, $request) /** * Display editorialTeam page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function editorialTeam($args, $request) { @@ -74,8 +74,8 @@ public function editorialTeam($args, $request) /** * Display submissions page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function submissions($args, $request) { @@ -114,8 +114,8 @@ public function submissions($args, $request) /** * Display contact page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function contact($args, $request) { diff --git a/pages/about/AboutSiteHandler.inc.php b/pages/about/AboutSiteHandler.inc.php index f14274ecb02..27e8b8959d1 100644 --- a/pages/about/AboutSiteHandler.inc.php +++ b/pages/about/AboutSiteHandler.inc.php @@ -31,8 +31,8 @@ public function __construct() /** * Display aboutThisPublishingSystem page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function aboutThisPublishingSystem($args, $request) { @@ -57,8 +57,8 @@ public function aboutThisPublishingSystem($args, $request) /** * Display privacy policy page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function privacy($args, $request) { diff --git a/pages/admin/AdminHandler.inc.php b/pages/admin/AdminHandler.inc.php index e735ee8eab6..afd5e0b34f6 100644 --- a/pages/admin/AdminHandler.inc.php +++ b/pages/admin/AdminHandler.inc.php @@ -122,8 +122,8 @@ public function initialize($request) /** * Display site admin index page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function index($args, $request) { @@ -138,8 +138,8 @@ public function index($args, $request) /** * Display a list of the contexts hosted on the site. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function contexts($args, $request) { @@ -160,8 +160,8 @@ public function contexts($args, $request) /** * Display the administration settings page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function settings($args, $request) { @@ -219,7 +219,7 @@ public function settings($args, $request) /** * Business logic for site settings single/multiple contexts availability * - * @param $request PKPRequest + * @param PKPRequest $request * * @return array [siteComponent, availability (bool)] */ @@ -261,8 +261,8 @@ private function siteSettingsAvailability($request) /** * Display a settings wizard for a journal * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function wizard($args, $request) { @@ -338,8 +338,8 @@ public function wizard($args, $request) /** * Show system information summary. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function systemInfo($args, $request) { @@ -399,8 +399,8 @@ public function phpinfo() /** * Expire all user sessions (will log out all users currently logged in). * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function expireSessions($args, $request) { @@ -416,8 +416,8 @@ public function expireSessions($args, $request) /** * Clear compiled templates. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function clearTemplateCache($args, $request) { @@ -434,8 +434,8 @@ public function clearTemplateCache($args, $request) /** * Clear the data cache. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function clearDataCache($args, $request) { diff --git a/pages/announcement/AnnouncementHandler.inc.php b/pages/announcement/AnnouncementHandler.inc.php index dff1a421177..5fef882d193 100644 --- a/pages/announcement/AnnouncementHandler.inc.php +++ b/pages/announcement/AnnouncementHandler.inc.php @@ -41,8 +41,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Show public announcements page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return string */ @@ -75,8 +75,8 @@ public function index($args, $request) /** * View announcement details. * - * @param $args array first parameter is the ID of the announcement to display - * @param $request PKPRequest + * @param array $args first parameter is the ID of the announcement to display + * @param PKPRequest $request */ public function view($args, $request) { diff --git a/pages/authorDashboard/PKPAuthorDashboardHandler.inc.php b/pages/authorDashboard/PKPAuthorDashboardHandler.inc.php index 009021d618b..b3b76ae6b0c 100644 --- a/pages/authorDashboard/PKPAuthorDashboardHandler.inc.php +++ b/pages/authorDashboard/PKPAuthorDashboardHandler.inc.php @@ -13,17 +13,17 @@ * @brief Handle requests for the author dashboard. */ +use APP\decision\Decision; use APP\facades\Repo; use APP\handler\Handler; use APP\template\TemplateManager; -use APP\workflow\EditorDecisionActionsManager; use Illuminate\Support\Enumerable; use PKP\log\SubmissionEmailLogEntry; use PKP\security\authorization\AuthorDashboardAccessPolicy; use PKP\security\Role; - +use PKP\submission\GenreDAO; use PKP\submission\PKPSubmission; use PKP\submissionFile\SubmissionFile; use PKP\workflow\WorkflowStageDAO; @@ -69,8 +69,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Displays the author dashboard. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function submission($args, $request) { @@ -85,8 +85,8 @@ public function submission($args, $request) /** * Fetches information about a specific email and returns it. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -111,7 +111,7 @@ public function readSubmissionEmail($args, $request) * Get the SUBMISSION_FILE_... file stage based on the current * WORKFLOW_STAGE_... workflow stage. * - * @param $currentStage int WORKFLOW_STAGE_... + * @param int $currentStage WORKFLOW_STAGE_... * * @return int SUBMISSION_FILE_... */ @@ -159,6 +159,8 @@ public function setupTemplate($request) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $contextUserGroups = $userGroupDao->getByRoleId($submission->getData('contextId'), Role::ROLE_ID_AUTHOR)->toArray(); + $genreDao = DAORegistry::getDAO('GenreDAO'); /** @var GenreDAO $genreDao */ + $contextGenres = $genreDao->getEnabledByContextId($submission->getData('contextId'))->toArray(); $workflowStages = WorkflowStageDAO::getWorkflowStageKeysAndPaths(); $stageNotifications = []; @@ -166,9 +168,6 @@ public function setupTemplate($request) $stageNotifications[$stageId] = false; } - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $stageDecisions = $editDecisionDao->getEditorDecisions($submission->getId()); - // Add an upload revisions button when in the review stage // and the last decision is to request revisions $uploadFileUrl = ''; @@ -177,15 +176,20 @@ public function setupTemplate($request) $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ $lastReviewRound = $reviewRoundDao->getLastReviewRoundBySubmissionId($submission->getId(), $submission->getData('stageId')); if ($fileStage && is_a($lastReviewRound, 'ReviewRound')) { - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $editorDecisions = $editDecisionDao->getEditorDecisions($submission->getId(), $submission->getData('stageId'), $lastReviewRound->getRound()); - if (!empty($editorDecisions)) { - $lastDecision = end($editorDecisions)['decision']; + $editorDecisions = Repo::decision()->getMany( + Repo::decision() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByStageIds([$submission->getData('stageId')]) + ->filterByReviewRoundIds([$lastReviewRound->getId()]) + ); + if (!$editorDecisions->isEmpty()) { + $lastDecision = $editorDecisions->last(); $revisionDecisions = [ - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS, - EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_RESUBMIT + Decision::PENDING_REVISIONS, + Decision::RESUBMIT ]; - if (in_array($lastDecision, $revisionDecisions)) { + if (in_array($lastDecision->getData('decision'), $revisionDecisions)) { $actionArgs['submissionId'] = $submission->getId(); $actionArgs['stageId'] = $submission->getData('stageId'); $actionArgs['uploaderRoles'] = Role::ROLE_ID_AUTHOR; @@ -216,17 +220,18 @@ public function setupTemplate($request) $submissionApiUrl = $request->getDispatcher()->url($request, PKPApplication::ROUTE_API, $submissionContext->getData('urlPath'), 'submissions/' . $submission->getId()); $latestPublicationApiUrl = $request->getDispatcher()->url($request, PKPApplication::ROUTE_API, $submissionContext->getData('urlPath'), 'submissions/' . $submission->getId() . '/publications/' . $latestPublication->getId()); - $contributorsGridUrl = $request->getDispatcher()->url( + $contributorApiUrl = $request->getDispatcher()->url( $request, - PKPApplication::ROUTE_COMPONENT, - null, - 'grid.users.author.AuthorGridHandler', - 'fetchGrid', - null, - [ - 'submissionId' => $submission->getId(), - 'publicationId' => '__publicationId__', - ] + PKPApplication::ROUTE_API, + $request->getContext()->getPath('urlPath'), + 'submissions/' . $submission->getId() . '/publications/__publicationId__/contributors' + ); + + $contributorPublicationApiUrl = $request->getDispatcher()->url( + $request, + PKPApplication::ROUTE_API, + $request->getContext()->getPath('urlPath'), + 'submissions/' . $submission->getId() . '/publications' ); $submissionLibraryUrl = $request->getDispatcher()->url( @@ -241,6 +246,7 @@ public function setupTemplate($request) $titleAbstractForm = new PKP\components\forms\publication\PKPTitleAbstractForm($latestPublicationApiUrl, $locales, $latestPublication); $citationsForm = new PKP\components\forms\publication\PKPCitationsForm($latestPublicationApiUrl, $latestPublication); + $contributorForm = new PKP\components\forms\publication\PKPContributorForm($contributorApiUrl, $locales, $submissionContext); // Import constants import('classes.components.forms.publication.PublishForm'); @@ -271,7 +277,7 @@ public function setupTemplate($request) }); // Get full details of the working publication and the current publication - $mapper = Repo::publication()->getSchemaMap($submission, $contextUserGroups); + $mapper = Repo::publication()->getSchemaMap($submission, $contextUserGroups, $contextGenres); $workingPublicationProps = $mapper->map($submission->getLatestPublication()); $currentPublicationProps = $submission->getLatestPublication()->getId() === $submission->getCurrentPublication()->getId() ? $workingPublicationProps @@ -284,6 +290,24 @@ public function setupTemplate($request) $canEditPublication = false; } + $authorItems = []; + foreach ($latestPublication->getData('authors') as $contributor) { + $authorItems[] = Repo::author()->getSchemaMap()->map($contributor); + } + + $authorCollector = Repo::author()->getCollector(); + $authorCollector->filterByPublicationIds([$latestPublication->getId()]); + $contributorsListPanel = new \PKP\components\listPanels\PKPContributorsListPanel( + 'contributors', + __('publication.contributors'), + [ + 'form' => $contributorForm, + 'items' => $authorItems, + 'publicationApiUrl' => $contributorPublicationApiUrl, + 'canEditPublication' => $canEditPublication + ] + ); + // Check if current author can access ArticleGalleyGrid within production stage $canAccessProductionStage = true; $userAllowedStages = $this->getAuthorizedContextObject(ASSOC_TYPE_ACCESSIBLE_WORKFLOW_STAGES); @@ -296,8 +320,8 @@ public function setupTemplate($request) 'components' => [ FORM_TITLE_ABSTRACT => $titleAbstractForm->getConfig(), FORM_CITATIONS => $citationsForm->getConfig(), + $contributorsListPanel->id => $contributorsListPanel->getConfig(), ], - 'contributorsGridUrl' => $contributorsGridUrl, 'currentPublication' => $currentPublicationProps, 'publicationFormIds' => [ FORM_TITLE_ABSTRACT, @@ -336,6 +360,22 @@ public function setupTemplate($request) $state['publicationFormIds'][] = FORM_METADATA; } + $templateMgr->setLocaleKeys([ + 'common.order', + 'author.users.contributor.setPrincipalContact', + 'author.users.contributor.principalContact', + 'submission.contributors', + 'grid.action.saveOrdering', + 'grid.action.order', + 'contributor.listPanel.preview', + 'contributor.listPanel.preview.description', + 'contributor.listPanel.preview.display', + 'contributor.listPanel.preview.format', + 'contributor.listPanel.preview.abbreviated', + 'contributor.listPanel.preview.publicationLists', + 'contributor.listPanel.preview.full', + ]); + $templateMgr->setState($state); $templateMgr->assign([ diff --git a/pages/catalog/PKPCatalogHandler.inc.php b/pages/catalog/PKPCatalogHandler.inc.php index 920a720574c..c07beb327be 100644 --- a/pages/catalog/PKPCatalogHandler.inc.php +++ b/pages/catalog/PKPCatalogHandler.inc.php @@ -39,12 +39,12 @@ public function authorize($request, &$args, $roleAssignments) /** * View the content of a category. * - * @param $args array [ + * @param array $args [ * @option string Category path * @option int Page number if available * ] * - * @param $request PKPRequest + * @param PKPRequest $request * * @return string */ @@ -108,8 +108,8 @@ public function category($args, $request) /** * Serve the full sized image for a category. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function fullSize($args, $request) { @@ -132,8 +132,8 @@ public function fullSize($args, $request) /** * Serve the thumbnail for a category. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function thumbnail($args, $request) { @@ -165,12 +165,12 @@ public function setupTemplate($request) /** * Assign the pagination template variables * - * @param $request PKPRequest - * @param $submissionsCount int Number of monographs being shown - * @param $page int Page number being shown - * @param $count int Max number of monographs being shown - * @param $offset int Starting position of monographs - * @param $total int Total number of monographs available + * @param PKPRequest $request + * @param int $submissionsCount Number of monographs being shown + * @param int $page Page number being shown + * @param int $count Max number of monographs being shown + * @param int $offset Starting position of monographs + * @param int $total Total number of monographs available */ protected function _setupPaginationTemplate($request, $submissionsCount, $page, $count, $offset, $total) { diff --git a/pages/dashboard/DashboardHandler.inc.php b/pages/dashboard/DashboardHandler.inc.php index 8411ffadf3c..17cae3dafa3 100644 --- a/pages/dashboard/DashboardHandler.inc.php +++ b/pages/dashboard/DashboardHandler.inc.php @@ -55,8 +55,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Display about index page. * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args */ public function index($args, $request) { @@ -104,7 +104,11 @@ public function index($args, $request) $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByContextId($context->getId())->toArray(); - $items = Repo::submission()->getSchemaMap()->mapManyToSubmissionsList($items, $userGroups); + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($context->getId())->toArray(); + + $items = Repo::submission()->getSchemaMap()->mapManyToSubmissionsList($items, $userGroups, $genres); $myQueueListPanel = new \APP\components\listPanels\SubmissionsListPanel( SUBMISSIONS_LIST_MY_QUEUE, @@ -135,7 +139,7 @@ public function index($args, $request) 'apiUrl' => $apiUrl, 'getParams' => [ 'status' => PKPSubmission::STATUS_QUEUED, - 'assignedTo' => -1, + 'assignedTo' => \PKP\submission\Collector::UNASSIGNED, ], 'lazyLoad' => true, 'includeIssuesFilter' => $includeIssuesFilter, @@ -198,8 +202,8 @@ public function index($args, $request) /** * View tasks tab * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -214,7 +218,7 @@ public function tasks($args, $request) /** * Setup common template variables. * - * @param $request PKPRequest + * @param PKPRequest $request */ public function setupTemplate($request = null) { diff --git a/pages/decision/PKPDecisionHandler.inc.php b/pages/decision/PKPDecisionHandler.inc.php new file mode 100644 index 00000000000..74c6636686c --- /dev/null +++ b/pages/decision/PKPDecisionHandler.inc.php @@ -0,0 +1,241 @@ +addRoleAssignment( + [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR], + ['record'] + ); + } + + /** + * @copydoc PKPHandler::authorize() + */ + public function authorize($request, &$args, $roleAssignments): bool + { + $op = $request->getRouter()->getRequestedOp($request); + + if (!$op || $op !== 'record') { + return false; + } + + $this->addPolicy(new ContextAccessPolicy($request, $roleAssignments)); + $this->addPolicy(new SubmissionRequiredPolicy($request, $args, 'submissionId')); + $this->addPolicy(new DecisionWritePolicy($request, $args, (int) $request->getUserVar('decision'), $request->getUser())); + + return parent::authorize($request, $args, $roleAssignments); + } + + public function record($args, $request) + { + $this->setupTemplate($request); + $dispatcher = $request->getDispatcher(); + $context = $request->getContext(); + AppLocale::requireComponents([ + LOCALE_COMPONENT_PKP_SUBMISSION, + LOCALE_COMPONENT_APP_SUBMISSION, + LOCALE_COMPONENT_PKP_EDITOR, + LOCALE_COMPONENT_APP_EDITOR, + ]); + + $this->decisionType = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_DECISION_TYPE); + $this->submission = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_SUBMISSION); + + // Don't allow a decision unless the submission is at the correct stage + if ($this->submission->getData('stageId') !== $this->decisionType->getStageId()) { + $request->getDispatcher()->handle404(); + } + + // Don't allow a decision in a review stage unless there is a valid review round + if (in_array($this->decisionType->getStageId(), [WORKFLOW_STAGE_ID_INTERNAL_REVIEW, WORKFLOW_STAGE_ID_EXTERNAL_REVIEW])) { + $reviewRoundId = (int) $request->getUserVar('reviewRoundId'); + if (!$reviewRoundId) { + $request->getDispatcher()->handle404(); + } + $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ + $this->reviewRound = $reviewRoundDao->getById($reviewRoundId); + if (!$this->reviewRound || $this->reviewRound->getSubmissionId() !== $this->submission->getId()) { + $request->getDispatcher()->handle404(); + } + } + + // Don't allow a recommendation unless at least one deciding editor exists + if (Repo::decision()->isRecommendation($this->decisionType->getDecision())) { + /** @var StageAssignmentDAO $stageAssignmentDao */ + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); + $assignedEditorIds = $stageAssignmentDao->getDecidingEditorIds($this->submission->getId(), $this->decisionType->getStageId()); + if (!$assignedEditorIds) { + $request->getDispatcher()->handle404(); + } + } + + $workflow = $this->decisionType->getWorkflow( + $this->submission, + $context, + $request->getUser(), + $this->reviewRound + ); + + $templateMgr = TemplateManager::getManager($request); + $templateMgr->assign('pageComponent', 'DecisionPage'); + + $templateMgr->setState([ + 'abandonDecisionLabel' => __('editor.decision.cancelDecision'), + 'cancelConfirmationPrompt' => __('editor.decision.cancelDecision.confirmation'), + 'decision' => $this->decisionType->getDecision(), + 'decisionCompleteLabel' => $this->decisionType->getCompletedLabel(), + 'decisionCompleteDescription' => $this->decisionType->getCompletedMessage($this->submission), + 'emailTemplatesApiUrl' => $dispatcher->url( + $request, + Application::ROUTE_API, + $context->getData('urlPath'), + 'emailTemplates' + ), + 'fileGenres' => $this->getFileGenres($context), + 'keepWorkingLabel' => __('common.keepWorking'), + 'reviewRoundId' => $this->reviewRound ? $this->reviewRound->getId() : null, + 'stepErrorMessage' => __('editor.decision.stepError'), + 'stageId' => $this->submission->getStageId(), + 'submissionUrl' => $dispatcher->url( + $request, + Application::ROUTE_PAGE, + $context->getData('urlPath'), + 'workflow', + 'access', + [$this->submission->getId()] + ), + 'submissionApiUrl' => $dispatcher->url( + $request, + Application::ROUTE_API, + $context->getData('urlPath'), + 'submissions/' . $this->submission->getId() + ), + 'viewSubmissionLabel' => __('submission.list.viewSubmission'), + 'workflow' => $workflow->getState(), + ]); + + $templateMgr->assign([ + 'breadcrumbs' => $this->getBreadcrumb($this->submission, $context, $request, $dispatcher), + 'decisionType' => $this->decisionType, + 'pageWidth' => TemplateManager::PAGE_WIDTH_WIDE, + 'reviewRound' => $this->reviewRound, + 'submission' => $this->submission, + ]); + + $templateMgr->display('decision/record.tpl'); + } + + protected function getBreadcrumb(Submission $submission, Context $context, Request $request, Dispatcher $dispatcher) + { + $currentPublication = $submission->getCurrentPublication(); + $submissionTitle = Stringy::create( + join( + __('common.commaListSeparator'), + [ + $currentPublication->getShortAuthorString(), + $currentPublication->getLocalizedFullTitle(), + ] + ) + ); + if ($submissionTitle->length() > 50) { + $submissionTitle = $submissionTitle->safeTruncate(50) + ->append('...'); + } + + return [ + [ + 'id' => 'submissions', + 'name' => __('navigation.submissions'), + 'url' => $dispatcher->url( + $request, + Application::ROUTE_PAGE, + $context->getData('urlPath'), + 'submissions' + ), + ], + [ + 'id' => 'submission', + 'name' => $submissionTitle, + 'url' => $dispatcher->url( + $request, + Application::ROUTE_PAGE, + $context->getData('urlPath'), + 'workflow', + 'access', + [$submission->getId()] + ), + ], + [ + 'id' => 'decision', + 'name' => $this->decisionType->getLabel(), + ] + ]; + } + + protected function getFileGenres(Context $context): array + { + $fileGenres = []; + + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genreResults = $genreDao->getEnabledByContextId($context->getId()); + /** @var Genre $genre */ + while ($genre = $genreResults->next()) { + $fileGenres[] = [ + 'id' => $genre->getId(), + 'name' => $genre->getLocalizedName(), + 'isPrimary' => !$genre->getSupplementary() && !$genre->getDependent(), + ]; + } + + return $fileGenres; + } +} diff --git a/pages/help/HelpHandler.inc.php b/pages/help/HelpHandler.inc.php index 879eead9893..b3047a8c0d6 100644 --- a/pages/help/HelpHandler.inc.php +++ b/pages/help/HelpHandler.inc.php @@ -31,8 +31,8 @@ public function __construct() /** * Display help. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function index($args, $request) { diff --git a/pages/index/PKPIndexHandler.inc.php b/pages/index/PKPIndexHandler.inc.php index 3e269ec93e8..06fe7929e4d 100644 --- a/pages/index/PKPIndexHandler.inc.php +++ b/pages/index/PKPIndexHandler.inc.php @@ -23,8 +23,8 @@ class PKPIndexHandler extends Handler * * @protected * - * @param $context Context - * @param $templateMgr PKPTemplateManager + * @param Context $context + * @param PKPTemplateManager $templateMgr */ protected function _setupAnnouncements($context, $templateMgr) { diff --git a/pages/install/InstallHandler.inc.php b/pages/install/InstallHandler.inc.php index ced8825e5ae..8e92f80c920 100644 --- a/pages/install/InstallHandler.inc.php +++ b/pages/install/InstallHandler.inc.php @@ -28,8 +28,8 @@ class InstallHandler extends Handler * If no context is selected, list all. * Otherwise, display the index page for the selected context. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function index($args, $request) { @@ -56,7 +56,7 @@ public function index($args, $request) /** * Redirect to index if system has already been installed. * - * @param $request PKPRequest + * @param PKPRequest $request * @param null|mixed $requiredContexts */ public function validate($requiredContexts = null, $request = null) @@ -69,8 +69,8 @@ public function validate($requiredContexts = null, $request = null) /** * Execute installer. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function install($args, $request) { @@ -99,8 +99,8 @@ public function install($args, $request) /** * Display upgrade form. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function upgrade($args, $request) { @@ -124,8 +124,8 @@ public function upgrade($args, $request) /** * Execute upgrade. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function installUpgrade($args, $request) { @@ -149,7 +149,7 @@ public function installUpgrade($args, $request) /** * Set up the installer template. * - * @param $request PKPRequest + * @param PKPRequest $request */ public function setupTemplate($request) { diff --git a/pages/libraryFiles/LibraryFileHandler.inc.php b/pages/libraryFiles/LibraryFileHandler.inc.php index 34f0b6f8959..ccaf2385f90 100644 --- a/pages/libraryFiles/LibraryFileHandler.inc.php +++ b/pages/libraryFiles/LibraryFileHandler.inc.php @@ -27,7 +27,7 @@ class LibraryFileHandler extends Handler /** * Constructor. * - * @param $callingHandler Handler + * @param Handler $callingHandler */ public function __construct($callingHandler) { @@ -41,8 +41,8 @@ public function __construct($callingHandler) /** * Download a library public file. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function downloadPublic($args, $request) { @@ -65,8 +65,8 @@ public function downloadPublic($args, $request) /** * Download a library file. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function downloadLibraryFile($args, $request) { diff --git a/pages/login/LoginHandler.inc.php b/pages/login/LoginHandler.inc.php index d4074cf7156..f9894f78117 100644 --- a/pages/login/LoginHandler.inc.php +++ b/pages/login/LoginHandler.inc.php @@ -85,7 +85,7 @@ public function index($args, $request) /** * After a login has completed, direct the user somewhere. * - * @param $request PKPRequest + * @param PKPRequest $request */ public function _redirectAfterLogin($request) { @@ -203,37 +203,34 @@ public function requestResetPassword($args, $request) $templateMgr = TemplateManager::getManager($request); $email = $request->getUserVar('email'); - $user = Repo::user()->getUserByEmail($email); + $user = Repo::user()->getByEmail($email); - if ($user == null || ($hash = Validation::generatePasswordResetHash($user->getId())) == false) { - $templateMgr->assign('error', 'user.login.lostPassword.invalidUser'); - $templateMgr->display('frontend/pages/userLostPassword.tpl'); - } else { + if ($user !== null && ($hash = Validation::generatePasswordResetHash($user->getId())) !== false) { // Send email confirming password reset $mail = new MailTemplate('PASSWORD_RESET_CONFIRM'); $site = $request->getSite(); $this->_setMailFrom($request, $mail, $site); $mail->assignParams([ - 'url' => $request->url(null, 'login', 'resetPassword', $user->getUsername(), ['confirm' => $hash]), + 'passwordResetUrl' => $request->url(null, 'login', 'resetPassword', $user->getUsername(), ['confirm' => $hash]), 'siteTitle' => $site->getLocalizedTitle() ]); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); - - $templateMgr->assign([ - 'pageTitle' => 'user.login.resetPassword', - 'message' => 'user.login.lostPassword.confirmationSent', - 'backLink' => $request->url(null, $request->getRequestedPage()), - 'backLinkLabel' => 'user.login', - ]); - $templateMgr->display('frontend/pages/message.tpl'); } + + $templateMgr->assign([ + 'pageTitle' => 'user.login.resetPassword', + 'message' => 'user.login.lostPassword.confirmationSent', + 'backLink' => $request->url(null, $request->getRequestedPage()), + 'backLinkLabel' => 'user.login', + ]); + $templateMgr->display('frontend/pages/message.tpl'); } /** * Reset a user's password * - * @param $args array first param contains the username of the user whose password is to be reset + * @param array $args first param contains the username of the user whose password is to be reset */ public function resetPassword($args, $request) { @@ -279,7 +276,7 @@ public function resetPassword($args, $request) $mail = new MailTemplate('PASSWORD_RESET'); $this->_setMailFrom($request, $mail, $site); $mail->assignParams([ - 'username' => $user->getUsername(), + 'recipientUsername' => $user->getUsername(), 'password' => $newPassword, 'siteTitle' => $site->getLocalizedTitle() ]); @@ -302,7 +299,7 @@ public function resetPassword($args, $request) /** * Display form to change user's password. * - * @param $args array first argument may contain user's username + * @param array $args first argument may contain user's username */ public function changePassword($args, $request) { @@ -346,8 +343,8 @@ public function savePassword($args, $request) /** * Sign in as another user. * - * @param $args array ($userId) - * @param $request PKPRequest + * @param array $args ($userId) + * @param PKPRequest $request */ public function signInAsUser($args, $request) { @@ -386,8 +383,8 @@ public function signInAsUser($args, $request) /** * Restore original user account after signing in as a user. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function signOutAsUser($args, $request) { @@ -414,7 +411,7 @@ public function signOutAsUser($args, $request) /** * Redirect to redirectURL if exists else send to Home * - * @param $request PKPRequest + * @param PKPRequest $request */ public function _redirectByURL($request) { @@ -431,9 +428,9 @@ public function _redirectByURL($request) * Helper function - set mail From * can be overriden by child classes * - * @param $request PKPRequest + * @param PKPRequest $request * @param MailTemplate $mail - * @param $site Site + * @param Site $site */ public function _setMailFrom($request, $mail, $site) { @@ -445,7 +442,7 @@ public function _setMailFrom($request, $mail, $site) * Send the user "home" (typically to the dashboard, but that may not * always be available). * - * @param $request PKPRequest + * @param PKPRequest $request */ protected function sendHome($request) { diff --git a/pages/management/ManagementHandler.inc.php b/pages/management/ManagementHandler.inc.php index b68dc5c41dd..4185f56c490 100644 --- a/pages/management/ManagementHandler.inc.php +++ b/pages/management/ManagementHandler.inc.php @@ -52,9 +52,9 @@ public function initialize($request) /** * @see PKPHandler::authorize() * - * @param $request PKPRequest - * @param $args array - * @param $roleAssignments array + * @param PKPRequest $request + * @param array $args + * @param array $roleAssignments */ public function authorize($request, &$args, $roleAssignments) { @@ -65,8 +65,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Route requests to the appropriate operation. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function settings($args, $request) { @@ -101,8 +101,8 @@ public function settings($args, $request) /** * Display settings for a journal/press * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function context($args, $request) { @@ -161,8 +161,8 @@ public function context($args, $request) /** * Display website settings * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function website($args, $request) { @@ -224,8 +224,8 @@ public function website($args, $request) /** * Display workflow settings * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function workflow($args, $request) { @@ -291,8 +291,8 @@ public function workflow($args, $request) /** * Display distribution settings * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function distribution($args, $request) { @@ -334,8 +334,8 @@ public function distribution($args, $request) /** * Display list of announcements and announcement types * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function announcements($args, $request) { @@ -392,8 +392,8 @@ public function announcements($args, $request) /** * Display Access and Security page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function access($args, $request) { diff --git a/pages/management/PKPToolsHandler.inc.php b/pages/management/PKPToolsHandler.inc.php index 423bc146600..ed1dfb395d1 100644 --- a/pages/management/PKPToolsHandler.inc.php +++ b/pages/management/PKPToolsHandler.inc.php @@ -55,8 +55,8 @@ public function setupTemplate($request) /** * Route to other Tools operations * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function tools($args, $request) { @@ -79,8 +79,8 @@ public function tools($args, $request) /** * Display tools index page. * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args */ public function index($args, $request) { @@ -93,8 +93,8 @@ public function index($args, $request) /** * Import or export data. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function importexport($args, $request) { @@ -120,8 +120,8 @@ public function importexport($args, $request) /** * Display the permissipns area. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function permissions($args, $request) { @@ -135,8 +135,8 @@ public function permissions($args, $request) /** * Reset article/monograph permissions * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function resetPermissions($args, $request) { @@ -158,6 +158,6 @@ public function resetPermissions($args, $request) // method can communicate properly with the AjaxFormHandler. Returning a // JSONMessage, or JSONMessage::toString(), doesn't seem to do it. echo json_encode(true); - die; + exit; } } diff --git a/pages/navigationMenu/NavigationMenuItemHandler.inc.php b/pages/navigationMenu/NavigationMenuItemHandler.inc.php index 3cf5f15627e..0f4147f8242 100644 --- a/pages/navigationMenu/NavigationMenuItemHandler.inc.php +++ b/pages/navigationMenu/NavigationMenuItemHandler.inc.php @@ -41,8 +41,8 @@ public function authorize($request, &$args, $roleAssignments) /** * View NavigationMenuItem content preview page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function preview($args, $request) { @@ -94,8 +94,8 @@ public function preview($args, $request) /** * View NavigationMenuItem content page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function view($args, $request) { @@ -140,8 +140,8 @@ public function view($args, $request) /** * Handle index request (redirect to "view") * - * @param $args array Arguments array. - * @param $request PKPRequest Request object. + * @param array $args Arguments array. + * @param PKPRequest $request Request object. */ public function index($args, $request) { @@ -151,7 +151,7 @@ public function index($args, $request) /** * Set a $nmi to view. * - * @param $nmi NavigationMenuItem + * @param NavigationMenuItem $nmi */ public static function setPage($nmi) { diff --git a/pages/notification/NotificationHandler.inc.php b/pages/notification/NotificationHandler.inc.php index b4388424522..c3855a39997 100644 --- a/pages/notification/NotificationHandler.inc.php +++ b/pages/notification/NotificationHandler.inc.php @@ -26,8 +26,8 @@ class NotificationHandler extends Handler /** * Return formatted notification data using Json. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -78,8 +78,8 @@ public function fetchNotification($args, $request) /** * Notification Unsubscribe handler * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function unsubscribe($args, $request) { @@ -138,8 +138,8 @@ public function unsubscribe($args, $request) /** * Performs all unsubscribe validation token validations * - * @param $validationToken string - * @param $notificationId int + * @param string $validationToken + * @param int $notificationId * * @return Notification */ @@ -170,11 +170,11 @@ public function _validateUnsubscribeRequest($validationToken, $notificationId) /** * Get the notifications using options. * - * @param $notificationOptions Array - * @param $contextId int - * @param $userId int + * @param array $notificationOptions + * @param int $contextId + * @param int $userId * - * @return Array + * @return array */ public function _getNotificationsByOptions($notificationOptions, $contextId, $userId = null) { @@ -212,8 +212,8 @@ public function _getNotificationsByOptions($notificationOptions, $contextId, $us * Add notifications from a result factory to an array of * existing notifications. * - * @param $resultFactory DAOResultFactory - * @param $notificationArray Array + * @param DAOResultFactory $resultFactory + * @param array $notificationArray */ public function _addNotificationsToArray($resultFactory, $notificationArray) { diff --git a/pages/reviewer/PKPReviewerHandler.inc.php b/pages/reviewer/PKPReviewerHandler.inc.php index a38b277243b..cf83204f7c3 100644 --- a/pages/reviewer/PKPReviewerHandler.inc.php +++ b/pages/reviewer/PKPReviewerHandler.inc.php @@ -29,8 +29,8 @@ class PKPReviewerHandler extends Handler /** * Display the submission review page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function submission($args, $request) { @@ -64,8 +64,8 @@ public function submission($args, $request) /** * Display a step tab contents in the submission review page. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -109,8 +109,8 @@ public function step($args, $request) /** * Save a review step. * - * @param $args array first parameter is the step being saved - * @param $request PKPRequest + * @param array $args first parameter is the step being saved + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -158,8 +158,8 @@ public function saveStep($args, $request) /** * Show a form for the reviewer to enter regrets into. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -187,8 +187,8 @@ public function showDeclineReview($args, $request) /** * Save the reviewer regrets form and decline the review. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function saveDeclineReview($args, $request) { @@ -229,10 +229,10 @@ public function setupTemplate($request) /** * Get a review form for the current step. * - * @param $step int current step - * @param $request PKPRequest - * @param $reviewerSubmission ReviewerSubmission - * @param $reviewAssignment \PKP\submission\reviewAssignment\ReviewAssignment + * @param int $step current step + * @param PKPRequest $request + * @param ReviewerSubmission $reviewerSubmission + * @param \PKP\submission\reviewAssignment\ReviewAssignment $reviewAssignment */ public function getReviewForm($step, $request, $reviewerSubmission, $reviewAssignment) { diff --git a/pages/sitemap/PKPSitemapHandler.inc.php b/pages/sitemap/PKPSitemapHandler.inc.php index 9a76cbc0b0c..c3bab4ac678 100644 --- a/pages/sitemap/PKPSitemapHandler.inc.php +++ b/pages/sitemap/PKPSitemapHandler.inc.php @@ -28,8 +28,8 @@ class PKPSitemapHandler extends Handler * Generate an XML sitemap for webcrawlers * Creates a sitemap index if in site context, else creates a sitemap * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function index($args, $request) { @@ -52,7 +52,7 @@ public function index($args, $request) /** * Construct a sitemap index listing each context's individual sitemap * - * @param $request Request + * @param Request $request * * @return DOMDocument */ @@ -79,7 +79,7 @@ public function _createSitemapIndex($request) /** * Construct the sitemap * - * @param $request Request + * @param Request $request * * @return DOMDocument */ @@ -141,11 +141,11 @@ public function _createContextSitemap($request) /** * Create a url entry with children * - * @param $doc DOMDocument Reference to the XML document object - * @param $loc string URL of page (required) - * @param $lastmod string Last modification date of page (optional) - * @param $changefreq Frequency of page modifications (optional) - * @param $priority string Subjective priority assessment of page (optional) + * @param DOMDocument $doc Reference to the XML document object + * @param string $loc URL of page (required) + * @param string $lastmod Last modification date of page (optional) + * @param string $changefreq Frequency of page modifications (optional) + * @param string $priority Subjective priority assessment of page (optional) * * @return DOMNode */ diff --git a/pages/stats/PKPStatsHandler.inc.php b/pages/stats/PKPStatsHandler.inc.php index cc28874c765..3fc227bff3b 100644 --- a/pages/stats/PKPStatsHandler.inc.php +++ b/pages/stats/PKPStatsHandler.inc.php @@ -44,9 +44,9 @@ public function __construct() /** * @see PKPHandler::authorize() * - * @param $request PKPRequest - * @param $args array - * @param $roleAssignments array + * @param PKPRequest $request + * @param array $args + * @param array $roleAssignments */ public function authorize($request, &$args, $roleAssignments) { @@ -221,8 +221,8 @@ public function editorial($args, $request) /** * Display published submissions statistics page * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args */ public function publications($args, $request) { @@ -383,7 +383,7 @@ function ($item) { /** * Set up the basic template for reports. * - * @param $request PKPRequest + * @param PKPRequest $request */ public function setupTemplate($request) { @@ -394,8 +394,8 @@ public function setupTemplate($request) /** * Route to other Reports operations * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function reports($args, $request) { @@ -421,8 +421,8 @@ public function reports($args, $request) /** * Display report possibilities (report plugins) * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function displayReports($args, $request) { @@ -449,8 +449,8 @@ public function displayReports($args, $request) * Delegates to plugins operations * related to report generation. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function report($args, $request) { @@ -470,8 +470,8 @@ public function report($args, $request) /** * Display page to generate custom reports. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function reportGenerator($args, $request) { @@ -501,8 +501,8 @@ public function reportGenerator($args, $request) * Generate statistics reports from passed * request arguments. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function generateReport($args, $request) { @@ -674,8 +674,8 @@ public function generateReport($args, $request) * Get the row value based on the column key (usually assoc types) * and the current record. * - * @param $key string|int - * @param $record array + * @param string|int $key + * @param array $record * * @return string */ @@ -688,8 +688,8 @@ protected function getReportRowValue($key, $record) * Get data object title based on passed * assoc type and id. * - * @param $assocId int - * @param $assocType int + * @param int $assocId + * @param int $assocType * * @return string */ @@ -717,7 +717,7 @@ protected function getObjectTitle($assocId, $assocType) } return $section->getLocalizedTitle(); case ASSOC_TYPE_SUBMISSION_FILE: - $submissionFile = Repo::submissionFiles()->get($assocId); + $submissionFile = Repo::submissionFile()->get($assocId); if (!$submissionFile) { break; } diff --git a/pages/submission/PKPSubmissionHandler.inc.php b/pages/submission/PKPSubmissionHandler.inc.php index 592522df563..8ab391a45f6 100644 --- a/pages/submission/PKPSubmissionHandler.inc.php +++ b/pages/submission/PKPSubmissionHandler.inc.php @@ -91,8 +91,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Redirect to the new submission wizard by default. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function index($args, $request) { @@ -102,8 +102,8 @@ public function index($args, $request) /** * Display the tab set for the submission wizard. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function wizard($args, $request) { @@ -131,8 +131,8 @@ public function wizard($args, $request) * Display a step for the submission wizard. * Displays submission index page if a valid step is not specified. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -173,8 +173,8 @@ public function step($args, $request) /** * Save a submission step. * - * @param $args array first parameter is the step being saved - * @param $request Request + * @param array $args first parameter is the step being saved + * @param Request $request * * @return JSONMessage JSON object */ @@ -226,7 +226,7 @@ public function saveStep($args, $request) /** * Setup common template variables. * - * @param $request Request + * @param Request $request */ public function setupTemplate($request) { diff --git a/pages/user/PKPUserHandler.inc.php b/pages/user/PKPUserHandler.inc.php index a0aadc00168..0fe3d68ebb1 100644 --- a/pages/user/PKPUserHandler.inc.php +++ b/pages/user/PKPUserHandler.inc.php @@ -33,7 +33,7 @@ public function index($args, $request) /** * Change the locale for the current user. * - * @param $args array first parameter is the new locale + * @param array $args first parameter is the new locale */ public function setLocale($args, $request) { @@ -65,8 +65,8 @@ public function setLocale($args, $request) /** * Get interests for reviewer interests autocomplete. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request * * @return JSONMessage JSON object */ @@ -81,8 +81,8 @@ public function getInterests($args, $request) /** * Display an authorization denied message. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request */ public function authorizationDenied($args, $request) { diff --git a/pages/user/ProfileHandler.inc.php b/pages/user/ProfileHandler.inc.php index aade548783d..71e76f010e0 100644 --- a/pages/user/ProfileHandler.inc.php +++ b/pages/user/ProfileHandler.inc.php @@ -50,8 +50,8 @@ public function authorize($request, &$args, $roleAssignments) /** * Display user profile tabset. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function profile($args, $request) { diff --git a/pages/user/RegistrationHandler.inc.php b/pages/user/RegistrationHandler.inc.php index 2cbd08750fc..7aaf0c443bb 100644 --- a/pages/user/RegistrationHandler.inc.php +++ b/pages/user/RegistrationHandler.inc.php @@ -40,8 +40,8 @@ public function initialize($request) * Display registration form for new users, validate and execute that form, * or display a registration success page if the user is logged in. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function register($args, $request) { @@ -149,8 +149,8 @@ public function registerUser($args, $request) /** * Check credentials and activate a new user * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function activateUser($args, $request) { diff --git a/pages/workflow/PKPWorkflowHandler.inc.php b/pages/workflow/PKPWorkflowHandler.inc.php index 88c7469d831..5b660f54c4c 100644 --- a/pages/workflow/PKPWorkflowHandler.inc.php +++ b/pages/workflow/PKPWorkflowHandler.inc.php @@ -13,18 +13,20 @@ * @brief Handle requests for the submssion workflow. */ +use APP\decision\Decision; use APP\facades\Repo; use APP\handler\Handler; +use APP\i18n\AppLocale; +use APP\submission\Submission; use APP\template\TemplateManager; -use APP\workflow\EditorDecisionActionsManager; -use PKP\linkAction\LinkAction; -use PKP\linkAction\request\AjaxModal; +use PKP\db\DAORegistry; +use PKP\decision\Type; use PKP\notification\PKPNotification; use PKP\security\authorization\internal\SubmissionRequiredPolicy; use PKP\security\authorization\internal\UserAccessibleWorkflowStageRequiredPolicy; use PKP\security\authorization\WorkflowStageAccessPolicy; use PKP\security\Role; - +use PKP\stageAssignment\StageAssignmentDAO; use PKP\submission\PKPSubmission; use PKP\workflow\WorkflowStageDAO; @@ -69,8 +71,8 @@ public function authorize($request, &$args, $roleAssignments) * Redirect users to their most appropriate * submission workflow stage. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function access($args, $request) { @@ -108,8 +110,8 @@ public function access($args, $request) /** * Show the workflow stage, with the stage path as an #anchor. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function index($args, $request) { @@ -196,6 +198,10 @@ public function index($args, $request) $canAccessEditorialHistory = true; } + /** @var GenreDAO $genreDao */ + $genreDao = DAORegistry::getDAO('GenreDAO'); + $genres = $genreDao->getByContextId($submission->getData('contextId'))->toArray(); + $supportedSubmissionLocales = $submissionContext->getSupportedSubmissionLocales(); $localeNames = AppLocale::getAllLocales(); $locales = array_map(function ($localeKey) use ($localeNames) { @@ -205,18 +211,31 @@ public function index($args, $request) $latestPublication = $submission->getLatestPublication(); $submissionApiUrl = $request->getDispatcher()->url($request, PKPApplication::ROUTE_API, $submissionContext->getData('urlPath'), 'submissions/' . $submission->getId()); + $submissionFileApiUrl = $request->getDispatcher()->url($request, PKPApplication::ROUTE_API, $submissionContext->getData('urlPath'), 'submissions/' . $submission->getId() . '/files'); $latestPublicationApiUrl = $request->getDispatcher()->url($request, PKPApplication::ROUTE_API, $submissionContext->getData('urlPath'), 'submissions/' . $submission->getId() . '/publications/' . $latestPublication->getId()); - $contributorsGridUrl = $request->getDispatcher()->url( + $contributorApiUrl = $request->getDispatcher()->url( $request, - PKPApplication::ROUTE_COMPONENT, - null, - 'grid.users.author.AuthorGridHandler', - 'fetchGrid', - null, + PKPApplication::ROUTE_API, + $request->getContext()->getPath('urlPath'), + 'submissions/' . $submission->getId() . '/publications/__publicationId__/contributors' + ); + + $contributorPublicationApiUrl = $request->getDispatcher()->url( + $request, + PKPApplication::ROUTE_API, + $request->getContext()->getPath('urlPath'), + 'submissions/' . $submission->getId() . '/publications' + ); + + $decisionUrl = $request->url( + $submissionContext->getData('urlPath'), + 'decision', + 'record', + $submission->getId(), [ - 'submissionId' => $submission->getId(), - 'publicationId' => '__publicationId__', + 'decision' => '__decision__', + 'reviewRoundId' => '__reviewRoundId__', ] ); @@ -256,6 +275,27 @@ public function index($args, $request) $citationsForm = new PKP\components\forms\publication\PKPCitationsForm($latestPublicationApiUrl, $latestPublication); $publicationLicenseForm = new PKP\components\forms\publication\PKPPublicationLicenseForm($latestPublicationApiUrl, $locales, $latestPublication, $submissionContext, $authorUserGroups); $titleAbstractForm = new PKP\components\forms\publication\PKPTitleAbstractForm($latestPublicationApiUrl, $locales, $latestPublication); + $contributorForm = new PKP\components\forms\publication\PKPContributorForm($contributorApiUrl, $locales, $submissionContext); + $selectRevisionDecisionForm = new PKP\components\forms\decision\SelectRevisionDecisionForm(); + $selectRevisionRecommendationForm = new PKP\components\forms\decision\SelectRevisionRecommendationForm(); + + $authorItems = []; + foreach ($latestPublication->getData('authors') as $contributor) { + $authorItems[] = Repo::author()->getSchemaMap()->map($contributor); + } + + $authorCollector = Repo::author()->getCollector(); + $authorCollector->filterByPublicationIds([$latestPublication->getId()]); + $contributorsListPanel = new \PKP\components\listPanels\PKPContributorsListPanel( + 'contributors', + __('publication.contributors'), + [ + 'form' => $contributorForm, + 'items' => $authorItems, + 'publicationApiUrl' => $contributorPublicationApiUrl, + 'canEditPublication' => $canEditPublication + ] + ); // Import constants import('classes.components.forms.publication.PublishForm'); @@ -269,6 +309,8 @@ public function index($args, $request) 'FORM_PUBLICATION_LICENSE' => FORM_PUBLICATION_LICENSE, 'FORM_PUBLISH' => FORM_PUBLISH, 'FORM_TITLE_ABSTRACT' => FORM_TITLE_ABSTRACT, + 'FORM_SELECT_REVISION_DECISION' => FORM_SELECT_REVISION_DECISION, + 'FORM_SELECT_REVISION_RECOMMENDATION' => FORM_SELECT_REVISION_RECOMMENDATION, ]); // Get the submission props without the full publication details. We'll @@ -288,7 +330,7 @@ public function index($args, $request) }); // Get full details of the working publication and the current publication - $mapper = Repo::publication()->getSchemaMap($submission, $authorUserGroups); + $mapper = Repo::publication()->getSchemaMap($submission, $authorUserGroups, $genres); $workingPublicationProps = $mapper->map($submission->getLatestPublication()); $currentPublicationProps = $submission->getLatestPublication()->getId() === $submission->getCurrentPublication()->getId() ? $workingPublicationProps @@ -299,12 +341,15 @@ public function index($args, $request) 'canAccessPublication' => $canAccessPublication, 'canEditPublication' => $canEditPublication, 'components' => [ - FORM_CITATIONS => $citationsForm->getConfig(), - FORM_PUBLICATION_LICENSE => $publicationLicenseForm->getConfig(), - FORM_TITLE_ABSTRACT => $titleAbstractForm->getConfig(), + $contributorsListPanel->id => $contributorsListPanel->getConfig(), + $citationsForm->id => $citationsForm->getConfig(), + $publicationLicenseForm->id => $publicationLicenseForm->getConfig(), + $titleAbstractForm->id => $titleAbstractForm->getConfig(), + $selectRevisionDecisionForm->id => $selectRevisionDecisionForm->getConfig(), + $selectRevisionRecommendationForm->id => $selectRevisionRecommendationForm->getConfig(), ], - 'contributorsGridUrl' => $contributorsGridUrl, 'currentPublication' => $currentPublicationProps, + 'decisionUrl' => $decisionUrl, 'editorialHistoryUrl' => $editorialHistoryUrl, 'publicationFormIds' => [ FORM_CITATIONS, @@ -320,6 +365,7 @@ public function index($args, $request) 'schedulePublicationLabel' => __('editor.submission.schedulePublication'), 'statusLabel' => __('semicolon', ['label' => __('common.status')]), 'submission' => $submissionProps, + 'submissionFileApiUrl' => $submissionFileApiUrl, 'submissionApiUrl' => $submissionApiUrl, 'submissionLibraryLabel' => __('grid.libraryFiles.submission.title'), 'submissionLibraryUrl' => $submissionLibraryUrl, @@ -371,6 +417,22 @@ public function index($args, $request) $state['publicationFormIds'][] = FORM_PUBLICATION_IDENTIFIERS; } + $templateMgr->setLocaleKeys([ + 'common.order', + 'author.users.contributor.setPrincipalContact', + 'author.users.contributor.principalContact', + 'submission.contributors', + 'grid.action.saveOrdering', + 'grid.action.order', + 'contributor.listPanel.preview', + 'contributor.listPanel.preview.description', + 'contributor.listPanel.preview.display', + 'contributor.listPanel.preview.format', + 'contributor.listPanel.preview.abbreviated', + 'contributor.listPanel.preview.publicationLists', + 'contributor.listPanel.preview.full', + ]); + $templateMgr->setState($state); $templateMgr->assign([ @@ -400,8 +462,8 @@ public function index($args, $request) /** * Show the submission stage. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function submission($args, $request) { @@ -411,8 +473,8 @@ public function submission($args, $request) /** * Show the external review stage. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function externalReview($args, $request) { @@ -422,8 +484,8 @@ public function externalReview($args, $request) /** * Show the editorial stage * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args */ public function editorial($args, $request) { @@ -433,8 +495,8 @@ public function editorial($args, $request) /** * Show the production stage * - * @param $request PKPRequest - * @param $args array + * @param PKPRequest $request + * @param array $args */ public function production($args, $request) { @@ -444,8 +506,8 @@ public function production($args, $request) /** * Redirect all old stage paths to index * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ protected function _redirectToIndex($args, $request) { @@ -460,8 +522,8 @@ protected function _redirectToIndex($args, $request) /** * Fetch JSON-encoded editor decision options. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -483,6 +545,7 @@ public function editorDecisionActions($args, $request) // If a review round was specified, include it in the args; // must also check that this is the last round or decisions // cannot be recorded. + $reviewRound = null; if ($reviewRoundId) { $actionArgs['reviewRoundId'] = $reviewRoundId; $reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO'); /** @var ReviewRoundDAO $reviewRoundDao */ @@ -495,10 +558,9 @@ public function editorDecisionActions($args, $request) // If there is an editor assigned, retrieve stage decisions. $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /** @var StageAssignmentDAO $stageAssignmentDao */ $editorsStageAssignments = $stageAssignmentDao->getEditorsAssignedToStage($submission->getId(), $stageId); - $dispatcher = $request->getDispatcher(); $user = $request->getUser(); - $recommendOnly = $makeDecision = false; + $makeRecommendation = $makeDecision = false; // if the user is assigned several times in an editorial role, check his/her assignments permissions i.e. // if the user is assigned with both possibilities: to only recommend as well as make decision foreach ($editorsStageAssignments as $editorsStageAssignment) { @@ -506,7 +568,7 @@ public function editorDecisionActions($args, $request) if (!$editorsStageAssignment->getRecommendOnly()) { $makeDecision = true; } else { - $recommendOnly = true; + $makeRecommendation = true; } } } @@ -514,7 +576,7 @@ public function editorDecisionActions($args, $request) // If user is not assigned to the submission, // see if the user is manager, and // if the group is recommendOnly - if (!$recommendOnly && !$makeDecision) { + if (!$makeRecommendation && !$makeDecision) { $userGroupDao = DAORegistry::getDAO('UserGroupDAO'); /** @var UserGroupDAO $userGroupDao */ $userGroups = $userGroupDao->getByUserId($user->getId(), $request->getContext()->getId()); while ($userGroup = $userGroups->next()) { @@ -522,28 +584,33 @@ public function editorDecisionActions($args, $request) if (!$userGroup->getRecommendOnly()) { $makeDecision = true; } else { - $recommendOnly = true; + $makeRecommendation = true; } } } } - $editorActions = []; - $editorDecisions = []; - $lastRecommendation = $allRecommendations = null; + $lastRecommendation = null; + $allRecommendations = null; + $hasDecidingEditors = false; if (!empty($editorsStageAssignments) && (!$reviewRoundId || ($lastReviewRound && $reviewRoundId == $lastReviewRound->getId()))) { - $editDecisionDao = DAORegistry::getDAO('EditDecisionDAO'); /** @var EditDecisionDAO $editDecisionDao */ - $recommendationOptions = (new EditorDecisionActionsManager())->getRecommendationOptions($stageId); // If this is a review stage and the user has "recommend only role" if (($stageId == WORKFLOW_STAGE_ID_EXTERNAL_REVIEW || $stageId == WORKFLOW_STAGE_ID_INTERNAL_REVIEW)) { - if ($recommendOnly) { + if ($makeRecommendation) { // Get the made editorial decisions from the current user - $editorDecisions = $editDecisionDao->getEditorDecisions($submission->getId(), $stageId, $reviewRound->getRound(), $user->getId()); + $editorDecisions = Repo::decision()->getMany( + Repo::decision() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByStageIds([$stageId]) + ->filterByReviewRoundIds([$reviewRound->getId()]) + ->filterByEditorIds([$user->getId()]) + ); // Get the last recommendation foreach ($editorDecisions as $editorDecision) { - if (array_key_exists($editorDecision['decision'], $recommendationOptions)) { + if (Repo::decision()->isRecommendation($editorDecision->getData('decision'))) { if ($lastRecommendation) { - if ($editorDecision['dateDecided'] >= $lastRecommendation['dateDecided']) { + if ($editorDecision->getData('dateDecided') >= $lastRecommendation->getData('dateDecided')) { $lastRecommendation = $editorDecision; } } else { @@ -552,79 +619,45 @@ public function editorDecisionActions($args, $request) } } if ($lastRecommendation) { - $lastRecommendation = __($recommendationOptions[$lastRecommendation['decision']]); + $lastRecommendation = $this->getRecommendationLabel($lastRecommendation->getData('decision')); } - // Add the recommend link action. - $editorActions[] = - new LinkAction( - 'recommendation', - new AjaxModal( - $dispatcher->url( - $request, - PKPApplication::ROUTE_COMPONENT, - null, - 'modals.editorDecision.EditorDecisionHandler', - 'sendRecommendation', - null, - $actionArgs - ), - $lastRecommendation ? __('editor.submission.changeRecommendation') : __('editor.submission.makeRecommendation'), - 'review_recommendation' - ), - $lastRecommendation ? __('editor.submission.changeRecommendation') : __('editor.submission.makeRecommendation') - ); + + // At least one deciding editor must be assigned before a recommendation can be made + /** @var StageAssignmentDAO $stageAssignmentDao */ + $stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); + $decidingEditorIds = $stageAssignmentDao->getDecidingEditorIds($submission->getId(), $stageId); + $hasDecidingEditors = count($decidingEditorIds) > 0; } elseif ($makeDecision) { // Get the made editorial decisions from all users - $editorDecisions = $editDecisionDao->getEditorDecisions($submission->getId(), $stageId, $reviewRound->getRound()); + $editorDecisions = Repo::decision()->getMany( + Repo::decision() + ->getCollector() + ->filterBySubmissionIds([$submission->getId()]) + ->filterByStageIds([$stageId]) + ->filterByReviewRoundIds([$reviewRound->getId()]) + ); // Get all recommendations $recommendations = []; foreach ($editorDecisions as $editorDecision) { - if (array_key_exists($editorDecision['decision'], $recommendationOptions)) { - if (array_key_exists($editorDecision['editorId'], $recommendations)) { - if ($editorDecision['dateDecided'] >= $recommendations[$editorDecision['editorId']]['dateDecided']) { - $recommendations[$editorDecision['editorId']] = ['dateDecided' => $editorDecision['dateDecided'], 'decision' => $editorDecision['decision']]; + if (Repo::decision()->isRecommendation($editorDecision->getData('decision'))) { + if (array_key_exists($editorDecision->getData('editorId'), $recommendations)) { + if ($editorDecision->getData('dateDecided') >= $recommendations[$editorDecision->getData('editorId')]['dateDecided']) { + $recommendations[$editorDecision->getData('editorId')] = ['dateDecided' => $editorDecision->getData('dateDecided'), 'decision' => $editorDecision->getData('decision')]; } } else { - $recommendations[$editorDecision['editorId']] = ['dateDecided' => $editorDecision['dateDecided'], 'decision' => $editorDecision['decision']]; + $recommendations[$editorDecision->getData('editorId')] = ['dateDecided' => $editorDecision->getData('dateDecided'), 'decision' => $editorDecision->getData('decision')]; } } } - $i = 0; + $allRecommendations = []; foreach ($recommendations as $recommendation) { - $allRecommendations .= $i == 0 ? __($recommendationOptions[$recommendation['decision']]) : __('common.commaListSeparator') . __($recommendationOptions[$recommendation['decision']]); - $i++; + $allRecommendations[] = $this->getRecommendationLabel($recommendation['decision']); } + $allRecommendations = join(__('common.commaListSeparator'), $allRecommendations); } } - // Get the possible editor decisions for this stage - $decisions = (new EditorDecisionActionsManager())->getStageDecisions($request->getContext(), $submission, $stageId, $makeDecision); - // Iterate through the editor decisions and create a link action - // for each decision which as an operation associated with it. - foreach ($decisions as $decision => $action) { - if (empty($action['operation'])) { - continue; - } - $actionArgs['decision'] = $decision; - $editorActions[] = new LinkAction( - $action['name'], - new AjaxModal( - $dispatcher->url( - $request, - PKPApplication::ROUTE_COMPONENT, - null, - 'modals.editorDecision.EditorDecisionHandler', - $action['operation'], - null, - $actionArgs - ), - __($action['title']) - ), - __($action['title']) - ); - } } - $workflowStageDao = DAORegistry::getDAO('WorkflowStageDAO'); /** @var WorkflowStageDAO $workflowStageDao */ $hasSubmissionPassedThisStage = $submission->getStageId() > $stageId; $lastDecision = null; switch ($submission->getStatus()) { @@ -658,14 +691,34 @@ public function editorDecisionActions($args, $request) break; } + $canRecordDecision = + // Only allow decisions to be recorded on the submission's current stage + $submission->getData('stageId') == $stageId + + // Only allow decisions on the latest review round + && (!$lastReviewRound || $lastReviewRound->getId() == $reviewRoundId) + + // At least one deciding editor must be assigned to make a recommendation + && ($makeDecision || $hasDecidingEditors); + // Assign the actions to the template. $templateMgr = TemplateManager::getManager($request); $templateMgr->assign([ - 'editorActions' => $editorActions, + 'canRecordDecision' => $canRecordDecision, + 'decisions' => $this->getStageDecisionTypes($stageId), + 'recommendations' => $this->getStageRecommendationTypes($stageId), + 'primaryDecisions' => $this->getPrimaryDecisionTypes(), + 'warnableDecisions' => $this->getWarnableDecisionTypes(), 'editorsAssigned' => count($editorsStageAssignments) > 0, 'stageId' => $stageId, + 'reviewRoundId' => $reviewRound + ? $reviewRound->getId() + : null, 'lastDecision' => $lastDecision, - 'submissionStatus' => $submission->getStatus(), + 'lastReviewRound' => $lastReviewRound, + 'submission' => $submission, + 'makeRecommendation' => $makeRecommendation, + 'makeDecision' => $makeDecision, 'lastRecommendation' => $lastRecommendation, 'allRecommendations' => $allRecommendations, ]); @@ -675,8 +728,8 @@ public function editorDecisionActions($args, $request) /** * Fetch the JSON-encoded submission progress bar. * - * @param $args array - * @param $request Request + * @param array $args + * @param Request $request * * @return JSONMessage JSON object */ @@ -699,7 +752,7 @@ public function submissionProgressBar($args, $request) /** * Setup variables for the template * - * @param $request Request + * @param Request $request */ public function setupTemplate($request) { @@ -711,7 +764,7 @@ public function setupTemplate($request) * Placeholder method to be overridden by apps in order to add * app-specific data to the template * - * @param $request Request + * @param Request $request */ public function setupIndex($request) { @@ -724,10 +777,10 @@ public function setupIndex($request) /** * Translate the requested operation to a stage id. * - * @param $request Request - * @param $args array + * @param Request $request + * @param array $args * - * @return integer One of the WORKFLOW_STAGE_* constants. + * @return int One of the WORKFLOW_STAGE_* constants. */ protected function identifyStageId($request, $args) { @@ -756,11 +809,11 @@ protected function identifyStageId($request, $args) * Determine if a particular stage has a notification pending. If so, return true. * This is used to set the CSS class of the submission progress bar. * - * @param $user User - * @param $stageId integer - * @param $contextId integer + * @param User $user + * @param int $stageId + * @param int $contextId * - * @return boolean + * @return bool */ protected function notificationOptionsByStage($user, $stageId, $contextId) { @@ -787,6 +840,25 @@ protected function notificationOptionsByStage($user, $stageId, $contextId) return false; } + /** + * Get a label for a recommendation decision type + */ + protected function getRecommendationLabel(int $decisionType): string + { + switch ($decisionType) { + case Decision::RECOMMEND_PENDING_REVISIONS: + return 'editor.submission.decision.requestRevisions'; + case Decision::RECOMMEND_RESUBMIT: + return 'editor.submission.decision.resubmit'; + case Decision::RECOMMEND_ACCEPT: + return 'editor.submission.decision.accept'; + case Decision::RECOMMEND_DECLINE: + return 'editor.submission.decision.decline'; + } + + throw new Exception('Could not find label for unknown recommendation type.'); + } + // // Abstract protected methods. @@ -794,7 +866,7 @@ protected function notificationOptionsByStage($user, $stageId, $contextId) /** * Return the editor assignment notification type based on stage id. * - * @param $stageId int + * @param int $stageId * * @return int */ @@ -810,4 +882,36 @@ abstract protected function getEditorAssignmentNotificationTypeByStageId($stageI * @return string */ abstract protected function _getRepresentationsGridUrl($request, $submission); + + /** + * A helper method to get a list of editor decisions to + * show on the right panel of each stage + * + * @return string[] + */ + abstract protected function getStageDecisionTypes(int $stageId): array; + + /** + * A helper method to get a list of editor recommendations to + * show on the right panel of the review stage + * + * @return string[] + */ + abstract protected function getStageRecommendationTypes(int $stageId): array; + + /** + * Get the editor decision types that should be shown + * as primary buttons (eg - Accept) + * + * @return string[] + */ + abstract protected function getPrimaryDecisionTypes(): array; + + /** + * Get the editor decision types that should be shown + * as warnable buttons (eg - Decline) + * + * @return string[] + */ + abstract protected function getWarnableDecisionTypes(): array; } diff --git a/plugins/generic/acron/PKPAcronPlugin.inc.php b/plugins/generic/acron/PKPAcronPlugin.inc.php index 27279011ce3..4340804283a 100644 --- a/plugins/generic/acron/PKPAcronPlugin.inc.php +++ b/plugins/generic/acron/PKPAcronPlugin.inc.php @@ -143,10 +143,10 @@ public function manage($args, $request) /** * Post install hook to flag cron tab reload on every install/upgrade. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * - * @return boolean + * @return bool * * @see Installer::postInstall() for the hook call. */ @@ -159,10 +159,10 @@ public function callbackPostInstall($hookName, $args) /** * Load handler hook to check for tasks to run. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * - * @return boolean + * @return bool * * @see PKPPageRouter::loadHandler() for the hook call. */ @@ -201,10 +201,10 @@ public function callbackLoadHandler($hookName, $args) /** * Syncronize crontab with lazy load plugins management. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * - * @return boolean + * @return bool * * @see PluginHandler::plugin() for the hook call. */ @@ -243,10 +243,7 @@ public function callbackManage($hookName, $args) */ public function shutdownFunction() { - // After PHP 4.1.0, the execution of this callback is part of the request, - // so users will have no response until it finishes executing it. We avoid - // that by sending headers to the browser that makes them believe the script - // is over. + // Release requests from waiting the processing. header('Connection: close'); // This header is needed so avoid using any kind of compression. If zlib is // enabled, for example, the buffer will not output until the end of the diff --git a/plugins/generic/usageEvent/PKPUsageEventPlugin.inc.php b/plugins/generic/usageEvent/PKPUsageEventPlugin.inc.php index 15952b98941..1e12d049771 100644 --- a/plugins/generic/usageEvent/PKPUsageEventPlugin.inc.php +++ b/plugins/generic/usageEvent/PKPUsageEventPlugin.inc.php @@ -180,8 +180,8 @@ protected function getDownloadFinishedEventHooks() /** * Build an usage event. * - * @param $hookName string - * @param $args array + * @param string $hookName + * @param array $args * * @return array */ @@ -344,7 +344,7 @@ protected function buildUsageEvent($hookName, $args) // TODO: Classify LOCKSS or similar as 'internal' access. /* - * Comparison of our event log format with Apache log parameters... + * Comparison of our event log format with Apache log parameters... * * 1) default parameters: * %h: remote hostname or IP => $ip, $host @@ -392,12 +392,12 @@ protected function buildUsageEvent($hookName, $args) * Get usage event details based on the passed hook. * Subclasses should extend to implement application specifics. * - * @param $hookName string - * @param $hookArgs array - * @param $request PKPRequest - * @param $router PageRouter - * @param $templateMgr PKPTemplateManager - * @param $context Context + * @param string $hookName + * @param array $hookArgs + * @param PKPRequest $request + * @param PageRouter $router + * @param PKPTemplateManager $templateMgr + * @param Context $context * * @return array With the following data: * DataObject the published object, boolean download success, integer used published object assoc type, @@ -449,9 +449,9 @@ abstract protected function getHtmlPageAssocTypes(); * Whether or not the passed object is of a type that can have * different public identifiers, like DOI, URN, etc. * - * @param $pubObject DataObject + * @param DataObject $pubObject * - * @return boolean + * @return bool */ abstract protected function isPubIdObjectType($pubObject); } diff --git a/plugins/importexport/native/PKPNativeImportExportCLIDeployment.inc.php b/plugins/importexport/native/PKPNativeImportExportCLIDeployment.inc.php index dc172bc101f..d244731a5b5 100644 --- a/plugins/importexport/native/PKPNativeImportExportCLIDeployment.inc.php +++ b/plugins/importexport/native/PKPNativeImportExportCLIDeployment.inc.php @@ -77,8 +77,8 @@ public function parseCLI() * WARNING: This method is checked for by name in DepositPackage in the PLN plugin * to determine if options are supported! * - * @param &$args array - * #param $optCodes array + * @param array $args + * @param array $optCodes */ public function parseOpts(&$args, $optCodes) { diff --git a/plugins/importexport/native/PKPNativeImportExportCLIToolKit.inc.php b/plugins/importexport/native/PKPNativeImportExportCLIToolKit.inc.php index 6a7277cfc54..22ea87de4e8 100644 --- a/plugins/importexport/native/PKPNativeImportExportCLIToolKit.inc.php +++ b/plugins/importexport/native/PKPNativeImportExportCLIToolKit.inc.php @@ -19,7 +19,7 @@ class PKPNativeImportExportCLIToolKit /** * Echo a CLI Error Message * - * @param $errorMessage string + * @param string $errorMessage */ public function echoCLIError($errorMessage) { @@ -31,8 +31,8 @@ public function echoCLIError($errorMessage) /** * Echo export results * - * @param $deployment PKPNativeImportExportDeployment - * @param $xmlFile string + * @param PKPNativeImportExportDeployment $deployment + * @param string $xmlFile */ public function getCLIExportResult($deployment, $xmlFile) { @@ -52,7 +52,7 @@ public function getCLIExportResult($deployment, $xmlFile) /** * Echo import results * - * @param $deployment PKPNativeImportExportDeployment + * @param PKPNativeImportExportDeployment $deployment */ public function getCLIImportResult($deployment) { @@ -80,7 +80,7 @@ public function getCLIImportResult($deployment) /** * Echo import/export possible warnings and errors * - * @param $deployment PKPNativeImportExportDeployment + * @param PKPNativeImportExportDeployment $deployment */ public function getCLIProblems($deployment) { @@ -106,8 +106,8 @@ public function getCLIProblems($deployment) /** * Echo import/export possible warnings and errors * - * @param $relatedIssues array - * @param $title string + * @param array $relatedIssues + * @param string $title */ public function displayCLIIssues($relatedIssues, $title) { diff --git a/plugins/importexport/native/PKPNativeImportExportPlugin.inc.php b/plugins/importexport/native/PKPNativeImportExportPlugin.inc.php index 7fe5d6b148e..48be04abc2b 100644 --- a/plugins/importexport/native/PKPNativeImportExportPlugin.inc.php +++ b/plugins/importexport/native/PKPNativeImportExportPlugin.inc.php @@ -70,7 +70,7 @@ public function register($category, $path, $mainContextId = null) * Get the name of this plugin. The name must be unique within * its category. * - * @return String name of plugin + * @return string name of plugin */ public function getName() { @@ -233,10 +233,10 @@ public function display($args, $request) /** * Get the XML for a set of submissions. * - * @param $submissionIds array Array of submission IDs - * @param $context Context - * @param $user User|null - * @param $opts array + * @param array $submissionIds Array of submission IDs + * @param Context $context + * @param User|null $user + * @param array $opts * * @return string XML contents representing the supplied submission IDs. */ diff --git a/plugins/importexport/native/filter/NativeExportFilter.inc.php b/plugins/importexport/native/filter/NativeExportFilter.inc.php index 3548d0d8197..8e7cbce4214 100644 --- a/plugins/importexport/native/filter/NativeExportFilter.inc.php +++ b/plugins/importexport/native/filter/NativeExportFilter.inc.php @@ -18,14 +18,14 @@ class NativeExportFilter extends PKPImportExportFilter { - /** @var boolean If set to true no validation (e.g. XML validation) will be done */ + /** @var bool If set to true no validation (e.g. XML validation) will be done */ public $_noValidation = null; public $opts = []; /** * Set no validation option * - * @param $noValidation boolean + * @param bool $noValidation */ public function setNoValidation($noValidation) { @@ -35,7 +35,7 @@ public function setNoValidation($noValidation) /** * Get no validation option * - * @return boolean true|null + * @return bool true|null */ public function getNoValidation() { @@ -77,10 +77,10 @@ public function supports(&$input, &$output) * Create a set of child nodes of parentNode containing the * localeKey => value data representing translated content. * - * @param $doc DOMDocument - * @param $parentNode DOMNode - * @param $name string Node name - * @param $values array Array of locale key => value mappings + * @param DOMDocument $doc + * @param DOMNode $parentNode + * @param string $name Node name + * @param array $values Array of locale key => value mappings */ public function createLocalizedNodes($doc, $parentNode, $name, $values) { @@ -99,10 +99,10 @@ public function createLocalizedNodes($doc, $parentNode, $name, $values) /** * Create an optional node with a name and value. * - * @param $doc DOMDocument - * @param $parentNode DOMElement - * @param $name string - * @param $value string|null + * @param DOMDocument $doc + * @param DOMElement $parentNode + * @param string $name + * @param string|null $value * * @return DOMElement|null */ @@ -120,7 +120,7 @@ public function createOptionalNode($doc, $parentNode, $name, $value) /** * Set xml filtering opts * - * @param $opts array + * @param array $opts */ public function setOpts($opts) { diff --git a/plugins/importexport/native/filter/NativeImportFilter.inc.php b/plugins/importexport/native/filter/NativeImportFilter.inc.php index 2f12ca46afb..97e458c9c12 100644 --- a/plugins/importexport/native/filter/NativeImportFilter.inc.php +++ b/plugins/importexport/native/filter/NativeImportFilter.inc.php @@ -23,7 +23,7 @@ class NativeImportFilter extends PKPImportExportFilter /** * @see Filter::process() * - * @param $document DOMDocument|string + * @param DOMDocument|string $document * * @return array Array of imported documents */ @@ -86,7 +86,7 @@ public function getSingularElementName() /** * Handle a singular element import * - * @param $node DOMElement + * @param DOMElement $node */ public function handleElement($node) { @@ -96,7 +96,7 @@ public function handleElement($node) /** * Parse a localized element * - * @param $element DOMElement + * @param DOMElement $element * * @return array Array("locale_KEY", "Localized Text") */ @@ -108,8 +108,8 @@ public function parseLocalizedContent($element) /** * Import node to a given parent node * - * @param $n DOMElement The parent node - * @param $filter string The filter to execute it's import function + * @param DOMElement $n The parent node + * @param string $filter The filter to execute it's import function */ public function importWithXMLNode($n, $filter = null) { diff --git a/plugins/importexport/native/filter/NativeXmlPKPAuthorFilter.inc.php b/plugins/importexport/native/filter/NativeXmlPKPAuthorFilter.inc.php index 257651eaebc..787ac6274eb 100644 --- a/plugins/importexport/native/filter/NativeXmlPKPAuthorFilter.inc.php +++ b/plugins/importexport/native/filter/NativeXmlPKPAuthorFilter.inc.php @@ -23,7 +23,7 @@ class NativeXmlPKPAuthorFilter extends NativeImportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -69,7 +69,7 @@ public function getClassName() /** * Handle an author element * - * @param $node DOMElement + * @param DOMElement $node * * @return \PKP\author\Author */ @@ -173,8 +173,8 @@ public function handleElement($node) /** * Parse an identifier node * - * @param $element DOMElement - * @param $author \PKP\author\Author + * @param DOMElement $element + * @param \PKP\author\Author $author */ public function parseIdentifier($element, $author) { diff --git a/plugins/importexport/native/filter/NativeXmlPKPPublicationFilter.inc.php b/plugins/importexport/native/filter/NativeXmlPKPPublicationFilter.inc.php index 1a6f04301b7..0cf28e896d6 100644 --- a/plugins/importexport/native/filter/NativeXmlPKPPublicationFilter.inc.php +++ b/plugins/importexport/native/filter/NativeXmlPKPPublicationFilter.inc.php @@ -23,7 +23,7 @@ class NativeXmlPKPPublicationFilter extends NativeImportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -70,7 +70,7 @@ public function getSingularElementName() /** * Handle a singular element import. * - * @param $node DOMElement + * @param DOMElement $node */ public function handleElement($node) { @@ -117,8 +117,8 @@ public function handleElement($node) /** * Populate the entity object from the node * - * @param $publication PKPPublication - * @param $node DOMElement + * @param PKPPublication $publication + * @param DOMElement $node * * @return Publication */ @@ -134,8 +134,8 @@ public function populateObject($publication, $node) /** * Handle an element whose parent is the publication element. * - * @param $n DOMElement - * @param $publication PKPPublication + * @param DOMElement $n + * @param PKPPublication $publication */ public function handleChildElement($n, $publication) { @@ -198,8 +198,8 @@ public function handleChildElement($n, $publication) /** * Parse an identifier node and set up the publication object accordingly * - * @param $element DOMElement - * @param $publication PKPPublication + * @param DOMElement $element + * @param PKPPublication $publication */ public function parseIdentifier($element, $publication) { @@ -234,8 +234,8 @@ public function parseIdentifier($element, $publication) /** * Parse an authors element * - * @param $node DOMElement - * @param $publication PKPPublication + * @param DOMElement $node + * @param PKPPublication $publication */ public function parseAuthors($node, $publication) { @@ -250,8 +250,8 @@ public function parseAuthors($node, $publication) /** * Parse an author and add it to the submission. * - * @param $n DOMElement - * @param $publication Publication + * @param DOMElement $n + * @param Publication $publication */ public function parseAuthor($n, $publication) { @@ -261,8 +261,8 @@ public function parseAuthor($n, $publication) /** * Parse a publication citation and add it to the publication. * - * @param $n DOMElement - * @param $publication PKPPublication + * @param DOMElement $n + * @param PKPPublication $publication */ public function parseCitations($n, $publication) { @@ -332,7 +332,7 @@ public function getRepresentationExportFilterGroupName() /** * Get the import filter for a given element. * - * @param $elementName string Name of XML element + * @param string $elementName Name of XML element * * @return Filter */ diff --git a/plugins/importexport/native/filter/NativeXmlRepresentationFilter.inc.php b/plugins/importexport/native/filter/NativeXmlRepresentationFilter.inc.php index f79a2771852..aa6813f18c6 100644 --- a/plugins/importexport/native/filter/NativeXmlRepresentationFilter.inc.php +++ b/plugins/importexport/native/filter/NativeXmlRepresentationFilter.inc.php @@ -20,7 +20,7 @@ class NativeXmlRepresentationFilter extends NativeImportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -43,7 +43,7 @@ public function getClassName() /** * Handle a Representation element * - * @param $node DOMElement + * @param DOMElement $node * * @return Representation */ @@ -88,8 +88,8 @@ public function handleElement($node) /** * Parse an identifier node and set up the representation object accordingly * - * @param $element DOMElement - * @param $representation Representation + * @param DOMElement $element + * @param Representation $representation */ public function parseIdentifier($element, $representation) { diff --git a/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.inc.php b/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.inc.php index 280daacbb33..03a29e13dac 100644 --- a/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.inc.php +++ b/plugins/importexport/native/filter/NativeXmlSubmissionFileFilter.inc.php @@ -30,7 +30,7 @@ class NativeXmlSubmissionFileFilter extends NativeImportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -76,7 +76,7 @@ public function getClassName() /** * Handle a submission file element * - * @param $node DOMElement + * @param DOMElement $node * * @return SubmissionFile|null Null if skipping this file */ @@ -127,7 +127,7 @@ public function handleElement($node) ? (int) $user->getId() : Application::get()->getRequest()->getUser()->getId(); - $submissionFile = Repo::submissionFiles()->dao->newDataObject(); + $submissionFile = Repo::submissionFile()->dao->newDataObject(); $submissionFile->setData('submissionId', $submission->getId()); $submissionFile->setData('locale', $submission->getLocale()); $submissionFile->setData('fileStage', $stageId); @@ -234,9 +234,9 @@ public function handleElement($node) // Add and edit the submission file revisions one-by-one so that a useful activity // log is built and past revisions can be accessed if (count($allRevisionIds) < 2) { - $submissionFileId = Repo::submissionFiles()->add($submissionFile); + $submissionFileId = Repo::submissionFile()->add($submissionFile); - $submissionFile = Repo::submissionFiles()->get($submissionFileId); + $submissionFile = Repo::submissionFile()->get($submissionFileId); } else { $currentFileId = $submissionFile->getData('fileId'); $allRevisionIds = array_filter($allRevisionIds, function ($fileId) use ($currentFileId) { @@ -249,20 +249,20 @@ public function handleElement($node) foreach ($allRevisionIds as $i => $fileId) { if ($i === 0) { $submissionFile->setData('fileId', $fileId); - $id = Repo::submissionFiles()->add($submissionFile); + $id = Repo::submissionFile()->add($submissionFile); - $submissionFile = Repo::submissionFiles()->get($submissionFileId); + $submissionFile = Repo::submissionFile()->get($submissionFileId); } else { - Repo::submissionFiles()->edit($submissionFile, ['fileId' => $fileId]); + Repo::submissionFile()->edit($submissionFile, ['fileId' => $fileId]); } } - Repo::submissionFiles()->edit( + Repo::submissionFile()->edit( $submissionFile, ['fileId' => $currentFileId] ); - $submissionFile = Repo::submissionFiles()->get($submissionFileId); + $submissionFile = Repo::submissionFile()->get($submissionFileId); } $deployment->setSubmissionFileDBId($submissionFileId, $submissionFile->getId()); @@ -273,7 +273,7 @@ public function handleElement($node) /** * Handle a revision element * - * @param $node DOMElement + * @param DOMElement $node * * @return int|null The new file id if successful */ @@ -354,7 +354,7 @@ public function handleRevisionElement($node) } else { clearstatcache(true, $temporaryFilename); $fileManager = new FileManager(); - $submissionDir = Repo::submissionFiles()->getSubmissionDir($submission->getData('contextId'), $submission->getId()); + $submissionDir = Repo::submissionFile()->getSubmissionDir($submission->getData('contextId'), $submission->getId()); $newFileId = Services::get('file')->add( $temporaryFilename, $submissionDir . '/' . uniqid() . '.' . $node->getAttribute('extension') @@ -371,8 +371,8 @@ public function handleRevisionElement($node) /** * Parse an identifier node and set up the representation object accordingly * - * @param $element DOMElement - * @param $submissionFile SubmissionFile + * @param DOMElement $element + * @param SubmissionFile $submissionFile */ public function parseIdentifier($element, $submissionFile) { @@ -400,7 +400,7 @@ public function parseIdentifier($element, $submissionFile) /** * Instantiate a submission file. * - * @param $tagName string + * @param string $tagName * * @return SubmissionFile */ diff --git a/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php b/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php index a8264c05432..6bb12a3d637 100644 --- a/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php +++ b/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php @@ -25,7 +25,7 @@ class NativeXmlSubmissionFilter extends NativeImportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -74,7 +74,7 @@ public function getSingularElementName() /** * Handle a singular element import. * - * @param $node DOMElement + * @param DOMElement $node */ public function handleElement($node) { @@ -116,8 +116,8 @@ public function handleElement($node) /** * Populate the submission object from the node * - * @param $submission Submission - * @param $node DOMElement + * @param Submission $submission + * @param DOMElement $node * * @return Submission */ @@ -135,8 +135,8 @@ public function populateObject($submission, $node) /** * Handle an element whose parent is the submission element. * - * @param $n DOMElement - * @param $submission Submission + * @param DOMElement $n + * @param Submission $submission */ public function handleChildElement($n, $submission) { @@ -162,8 +162,8 @@ public function handleChildElement($n, $submission) /** * Parse an identifier node and set up the submission object accordingly * - * @param $element DOMElement - * @param $submission Submission + * @param DOMElement $element + * @param Submission $submission */ public function parseIdentifier($element, $submission) { @@ -180,8 +180,8 @@ public function parseIdentifier($element, $submission) /** * Parse a submission file and add it to the submission. * - * @param $n DOMElement - * @param $submission Submission + * @param DOMElement $n + * @param Submission $submission */ public function parseSubmissionFile($n, $submission) { @@ -196,7 +196,7 @@ public function parseSubmissionFile($n, $submission) /** * @see Filter::process() * - * @param $document DOMDocument|string + * @param DOMDocument|string $document * * @return array Array of imported documents */ @@ -220,8 +220,8 @@ public function &process(&$document) /** * Parse a submission publication and add it to the submission. * - * @param $n DOMElement - * @param $submission Submission + * @param DOMElement $n + * @param Submission $submission */ public function parsePublication($n, $submission) { @@ -240,7 +240,7 @@ public function parsePublication($n, $submission) /** * Get the import filter for a given element. * - * @param $elementName string Name of XML element + * @param string $elementName Name of XML element * * @return Filter */ diff --git a/plugins/importexport/native/filter/PKPAuthorNativeXmlFilter.inc.php b/plugins/importexport/native/filter/PKPAuthorNativeXmlFilter.inc.php index ffccb40d309..495be7d825e 100644 --- a/plugins/importexport/native/filter/PKPAuthorNativeXmlFilter.inc.php +++ b/plugins/importexport/native/filter/PKPAuthorNativeXmlFilter.inc.php @@ -20,7 +20,7 @@ class PKPAuthorNativeXmlFilter extends NativeExportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -47,7 +47,7 @@ public function getClassName() /** * @see Filter::process() * - * @param $authors array Array of authors + * @param array $authors Array of authors * * @return DOMDocument */ @@ -77,8 +77,8 @@ public function &process(&$authors) /** * Create and return an author node. * - * @param $doc DOMDocument - * @param $author \PKP\author\Author + * @param DOMDocument $doc + * @param \PKP\author\Author $author * * @return DOMElement */ diff --git a/plugins/importexport/native/filter/PKPNativeFilterHelper.inc.php b/plugins/importexport/native/filter/PKPNativeFilterHelper.inc.php index 0194a3960da..972b44b8801 100644 --- a/plugins/importexport/native/filter/PKPNativeFilterHelper.inc.php +++ b/plugins/importexport/native/filter/PKPNativeFilterHelper.inc.php @@ -19,9 +19,9 @@ class PKPNativeFilterHelper /** * Create and return an object covers node. * - * @param $filter NativeExportFilter - * @param $doc DOMDocument - * @param $object Publication + * @param NativeExportFilter $filter + * @param DOMDocument $doc + * @param Publication $object * * @return DOMElement? */ @@ -60,9 +60,9 @@ public function createPublicationCoversNode($filter, $doc, $object) /** * Parse out the object covers. * - * @param $filter NativeExportFilter - * @param $node DOMElement - * @param $object Publication + * @param NativeExportFilter $filter + * @param DOMElement $node + * @param Publication $object */ public function parsePublicationCovers($filter, $node, $object) { @@ -89,9 +89,9 @@ public function parsePublicationCovers($filter, $node, $object) /** * Parse out the cover and store it in the object. * - * @param $filter NativeExportFilter - * @param $node DOMElement - * @param $object Publication + * @param NativeExportFilter $filter + * @param DOMElement $node + * @param Publication $object */ public function parsePublicationCover($filter, $node, $object) { diff --git a/plugins/importexport/native/filter/PKPPublicationNativeXmlFilter.inc.php b/plugins/importexport/native/filter/PKPPublicationNativeXmlFilter.inc.php index ba4537be1f6..807afee622e 100644 --- a/plugins/importexport/native/filter/PKPPublicationNativeXmlFilter.inc.php +++ b/plugins/importexport/native/filter/PKPPublicationNativeXmlFilter.inc.php @@ -22,7 +22,7 @@ class PKPPublicationNativeXmlFilter extends NativeExportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -47,7 +47,7 @@ public function getClassName() /** * @see Filter::process() * - * @param $entity PKPPublication + * @param PKPPublication $entity * * @return DOMDocument */ @@ -72,8 +72,8 @@ public function &process(&$entity) /** * Create and return an entity node. * - * @param $doc DOMDocument - * @param $entity PKPPublication + * @param DOMDocument $doc + * @param PKPPublication $entity * * @return DOMElement */ @@ -136,9 +136,9 @@ public function createEntityNode($doc, $entity) /** * Create and add identifier nodes to a submission node. * - * @param $doc DOMDocument - * @param $entityNode DOMElement - * @param $entity PKPPublication + * @param DOMDocument $doc + * @param DOMElement $entityNode + * @param PKPPublication $entity */ public function addIdentifiers($doc, $entityNode, $entity) { @@ -166,10 +166,10 @@ public function addIdentifiers($doc, $entityNode, $entity) /** * Add a single pub ID element for a given plugin to the document. * - * @param $doc DOMDocument - * @param $entityNode DOMElement - * @param $entity PKPPublication - * @param $pubIdPlugin PubIdPlugin + * @param DOMDocument $doc + * @param DOMElement $entityNode + * @param PKPPublication $entity + * @param PubIdPlugin $pubIdPlugin * * @return DOMElement|null */ @@ -189,9 +189,9 @@ public function addPubIdentifier($doc, $entityNode, $entity, $pubIdPlugin) /** * Add the publication metadata for a publication to its DOM element. * - * @param $doc DOMDocument - * @param $entityNode DOMElement - * @param $entity PKPPublication + * @param DOMDocument $doc + * @param DOMElement $entityNode + * @param PKPPublication $entity */ public function addMetadata($doc, $entityNode, $entity) { @@ -231,11 +231,11 @@ public function addMetadata($doc, $entityNode, $entity) /** * Add publication's controlled vocabulary to its DOM element. * - * @param $doc DOMDocument - * @param $entityNode DOMElement - * @param $controlledVocabulariesNodeName string Parent node name - * @param $controlledVocabularyNodeName string Item node name - * @param $controlledVocabulary array Associative array (locale => array of items) + * @param DOMDocument $doc + * @param DOMElement $entityNode + * @param string $controlledVocabulariesNodeName Parent node name + * @param string $controlledVocabularyNodeName Item node name + * @param array $controlledVocabulary Associative array (locale => array of items) */ public function addControlledVocabulary($doc, $entityNode, $controlledVocabulariesNodeName, $controlledVocabularyNodeName, $controlledVocabulary) { @@ -257,9 +257,9 @@ public function addControlledVocabulary($doc, $entityNode, $controlledVocabulari /** * Add the author metadata for a submission to its DOM element. * - * @param $doc DOMDocument - * @param $entityNode DOMElement - * @param $entity PKPPublication + * @param DOMDocument $doc + * @param DOMElement $entityNode + * @param PKPPublication $entity */ public function addAuthors($doc, $entityNode, $entity) { @@ -282,9 +282,9 @@ public function addAuthors($doc, $entityNode, $entity) /** * Add the representations of a publication to its DOM element. * - * @param $doc DOMDocument - * @param $entityNode DOMElement - * @param $entity Publication + * @param DOMDocument $doc + * @param DOMElement $entityNode + * @param Publication $entity */ public function addRepresentations($doc, $entityNode, $entity) { @@ -321,7 +321,7 @@ public function _getControlledVocabulariesMappings() /** * Get the submission files associated with this representation * - * @param $representation Representation + * @param Representation $representation * * @return array */ @@ -333,9 +333,9 @@ public function getFiles($representation) /** * Create and return a Citations node. * - * @param $doc DOMDocument - * @param $deployment - * @param $publication Publication + * @param DOMDocument $doc + * @param NativeImportExportDeployment $deployment + * @param Publication $publication * * @return DOMElement */ diff --git a/plugins/importexport/native/filter/RepresentationNativeXmlFilter.inc.php b/plugins/importexport/native/filter/RepresentationNativeXmlFilter.inc.php index 93e107c4b31..ea2240de29a 100644 --- a/plugins/importexport/native/filter/RepresentationNativeXmlFilter.inc.php +++ b/plugins/importexport/native/filter/RepresentationNativeXmlFilter.inc.php @@ -20,7 +20,7 @@ class RepresentationNativeXmlFilter extends NativeExportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -47,7 +47,7 @@ public function getClassName() /** * @see Filter::process() * - * @param $representation Representation + * @param Representation $representation * * @return DOMDocument */ @@ -72,8 +72,8 @@ public function &process(&$representation) /** * Create and return a representation node. * - * @param $doc DOMDocument - * @param $representation Representation + * @param DOMDocument $doc + * @param Representation $representation * * @return DOMElement */ @@ -116,9 +116,9 @@ public function createRepresentationNode($doc, $representation) /** * Create and add identifier nodes to a representation node. * - * @param $doc DOMDocument - * @param $representationNode DOMElement - * @param $representation Representation + * @param DOMDocument $doc + * @param DOMElement $representationNode + * @param Representation $representation */ public function addIdentifiers($doc, $representationNode, $representation) { @@ -146,10 +146,10 @@ public function addIdentifiers($doc, $representationNode, $representation) /** * Add a single pub ID element for a given plugin to the representation. * - * @param $doc DOMDocument - * @param $representationNode DOMElement - * @param $representation Representation - * @param $pubIdPlugin PubIdPlugin + * @param DOMDocument $doc + * @param DOMElement $representationNode + * @param Representation $representation + * @param PubIdPlugin $pubIdPlugin * * @return DOMElement|null */ @@ -172,7 +172,7 @@ public function addPubIdentifier($doc, $representationNode, $representation, $pu /** * Get the submission files associated with this representation * - * @param $representation Representation + * @param Representation $representation * * @return array */ diff --git a/plugins/importexport/native/filter/SubmissionFileNativeXmlFilter.inc.php b/plugins/importexport/native/filter/SubmissionFileNativeXmlFilter.inc.php index 0d9734c19e4..3c18d02cf09 100644 --- a/plugins/importexport/native/filter/SubmissionFileNativeXmlFilter.inc.php +++ b/plugins/importexport/native/filter/SubmissionFileNativeXmlFilter.inc.php @@ -26,7 +26,7 @@ class SubmissionFileNativeXmlFilter extends NativeExportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -52,7 +52,7 @@ public function getClassName() /** * @see Filter::process() * - * @param $submissionFile SubmissionFile + * @param SubmissionFile $submissionFile * * @return DOMDocument */ @@ -77,8 +77,8 @@ public function &process(&$submissionFile) /** * Create and return a submissionFile node. * - * @param $doc DOMDocument - * @param $submissionFile SubmissionFile + * @param DOMDocument $doc + * @param SubmissionFile $submissionFile * * @return DOMElement */ @@ -150,7 +150,7 @@ public function createSubmissionFileNode($doc, $submissionFile) } // Create the revision nodes - $revisions = Repo::submissionFiles()->getRevisions(($submissionFile->getId())); + $revisions = Repo::submissionFile()->getRevisions(($submissionFile->getId())); foreach ($revisions as $revision) { $localPath = rtrim(Config::getVar('files', 'files_dir'), '/') . '/' . $revision->path; $revisionNode = $doc->createElementNS($deployment->getNamespace(), 'file'); @@ -161,7 +161,7 @@ public function createSubmissionFileNode($doc, $submissionFile) if (array_key_exists('no-embed', $this->opts)) { $hrefNode = $doc->createElementNS($deployment->getNamespace(), 'href'); if (array_key_exists('use-file-urls', $this->opts)) { - $stageId = Repo::submissionFiles()->getWorkflowStageId($submissionFile); + $stageId = Repo::submissionFile()->getWorkflowStageId($submissionFile); $dispatcher = Application::get()->getDispatcher(); $request = Application::get()->getRequest(); $params = [ @@ -192,9 +192,9 @@ public function createSubmissionFileNode($doc, $submissionFile) /** * Create and add identifier nodes to a submission node. * - * @param $doc DOMDocument - * @param $revisionNode DOMElement - * @param $submissionFile SubmissionFile + * @param DOMDocument $doc + * @param DOMElement $revisionNode + * @param SubmissionFile $submissionFile */ public function addIdentifiers($doc, $revisionNode, $submissionFile) { @@ -219,10 +219,10 @@ public function addIdentifiers($doc, $revisionNode, $submissionFile) /** * Add a single pub ID element for a given plugin to the document. * - * @param $doc DOMDocument - * @param $revisionNode DOMElement - * @param $submissionFile SubmissionFile - * @param $pubIdPlugin PubIdPlugin + * @param DOMDocument $doc + * @param DOMElement $revisionNode + * @param SubmissionFile $submissionFile + * @param PubIdPlugin $pubIdPlugin * * @return DOMElement|null */ diff --git a/plugins/importexport/native/filter/SubmissionNativeXmlFilter.inc.php b/plugins/importexport/native/filter/SubmissionNativeXmlFilter.inc.php index 4d39745d002..d7a7e148335 100644 --- a/plugins/importexport/native/filter/SubmissionNativeXmlFilter.inc.php +++ b/plugins/importexport/native/filter/SubmissionNativeXmlFilter.inc.php @@ -25,7 +25,7 @@ class SubmissionNativeXmlFilter extends NativeExportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -52,7 +52,7 @@ public function getClassName() /** * @see Filter::process() * - * @param $submissions array Array of submissions + * @param array $submissions Array of submissions * * @return DOMDocument */ @@ -87,8 +87,8 @@ public function &process(&$submissions) /** * Create and return a submission node. * - * @param $doc DOMDocument - * @param $submission Submission + * @param DOMDocument $doc + * @param Submission $submission * * @return DOMElement */ @@ -119,9 +119,9 @@ public function createSubmissionNode($doc, $submission) /** * Create and add identifier nodes to a submission node. * - * @param $doc DOMDocument - * @param $submissionNode DOMElement - * @param $submission Submission + * @param DOMDocument $doc + * @param DOMElement $submissionNode + * @param Submission $submission */ public function addIdentifiers($doc, $submissionNode, $submission) { @@ -136,18 +136,18 @@ public function addIdentifiers($doc, $submissionNode, $submission) /** * Add the submission files to its DOM element. * - * @param $doc DOMDocument - * @param $submissionNode DOMElement - * @param $submission Submission + * @param DOMDocument $doc + * @param DOMElement $submissionNode + * @param Submission $submission */ public function addFiles($doc, $submissionNode, $submission) { - $collector = Repo::submissionFiles() + $collector = Repo::submissionFile() ->getCollector() ->filterBySubmissionIds([$submission->getId()]) ->includeDependentFiles(); - $submissionFiles = Repo::submissionFiles()->getMany($collector); + $submissionFiles = Repo::submissionFile()->getMany($collector); foreach ($submissionFiles as $submissionFile) { // Skip files attached to objects that are not included in the export, // such as files uploaded to discussions and files uploaded by reviewers @@ -166,9 +166,9 @@ public function addFiles($doc, $submissionNode, $submission) /** * Add the submission files to its DOM element. * - * @param $doc DOMDocument - * @param $submissionNode DOMElement - * @param $submission Submission + * @param DOMDocument $doc + * @param DOMElement $submissionNode + * @param Submission $submission */ public function addPublications($doc, $submissionNode, $submission) { @@ -199,7 +199,7 @@ public function addPublications($doc, $submissionNode, $submission) * Sets a flag to always include the node, even if there * may only be one submission. * - * @param boolean $includeSubmissionsNode + * @param bool $includeSubmissionsNode */ public function setIncludeSubmissionsNode($includeSubmissionsNode) { @@ -210,7 +210,7 @@ public function setIncludeSubmissionsNode($includeSubmissionsNode) * Returnes whether to always include the node, even if there * may only be one submission. * - * @return boolean $includeSubmissionsNode + * @return bool $includeSubmissionsNode */ public function getIncludeSubmissionsNode() { diff --git a/plugins/importexport/users/PKPUserImportExportDeployment.inc.php b/plugins/importexport/users/PKPUserImportExportDeployment.inc.php index c3f2c11e482..bc6c07589d7 100644 --- a/plugins/importexport/users/PKPUserImportExportDeployment.inc.php +++ b/plugins/importexport/users/PKPUserImportExportDeployment.inc.php @@ -24,8 +24,8 @@ class PKPUserImportExportDeployment extends PKPImportExportDeployment /** * Constructor * - * @param $context Context - * @param $user User + * @param Context $context + * @param User $user */ public function __construct($context, $user) { @@ -37,7 +37,7 @@ public function __construct($context, $user) /** * Set the site. * - * @param $site Site + * @param Site $site */ public function setSite($site) { diff --git a/plugins/importexport/users/PKPUserImportExportPlugin.inc.php b/plugins/importexport/users/PKPUserImportExportPlugin.inc.php index 81ff2ede58e..795740c94f3 100644 --- a/plugins/importexport/users/PKPUserImportExportPlugin.inc.php +++ b/plugins/importexport/users/PKPUserImportExportPlugin.inc.php @@ -39,7 +39,7 @@ public function register($category, $path, $mainContextId = null) * Get the name of this plugin. The name must be unique within * its category. * - * @return String name of plugin + * @return string name of plugin */ public function getName() { @@ -77,8 +77,8 @@ public function getPluginSettingsPrefix() /** * Display the plugin. * - * @param $args array - * @param $request PKPRequest + * @param array $args + * @param PKPRequest $request */ public function display($args, $request) { @@ -188,9 +188,9 @@ public function display($args, $request) /** * Get the XML for all of users. * - * @param $context Context - * @param $user User - * @param $filter Filter byRef parameter - import/export filter used + * @param Context $context + * @param User $user + * @param Filter $filter byRef parameter - import/export filter used * * @return string XML contents representing the supplied user IDs. */ @@ -208,10 +208,10 @@ public function exportAllUsers($context, $user, &$filter = null) /** * Get the XML for a set of users. * - * @param $ids array mixed Array of users or user IDs - * @param $context Context - * @param $user User - * @param $filter Filter byRef parameter - import/export filter used + * @param array $ids mixed Array of users or user IDs + * @param Context $context + * @param User $user + * @param Filter $filter byRef parameter - import/export filter used * * @return string XML contents representing the supplied user IDs. */ @@ -248,10 +248,10 @@ public function exportUsers($ids, $context, $user, &$filter = null) /** * Get the XML for a set of users. * - * @param $importXml string XML contents to import - * @param $context Context - * @param $user User - * @param $filter Filter byRef parameter - import/export filter used + * @param string $importXml XML contents to import + * @param Context $context + * @param User $user + * @param Filter $filter byRef parameter - import/export filter used * * @return array Set of imported users */ @@ -267,9 +267,9 @@ public function importUsers($importXml, $context, $user, &$filter = null) /** * Return user filter for import purposes * - * @param $context Context - * @param $user User - * @param $isImport bool return Import Filter if true - export if false + * @param Context $context + * @param User $user + * @param bool $isImport return Import Filter if true - export if false * * @return Filter */ diff --git a/plugins/importexport/users/filter/NativeXmlUserGroupFilter.inc.php b/plugins/importexport/users/filter/NativeXmlUserGroupFilter.inc.php index 28785cc221e..92eb6b13d6e 100644 --- a/plugins/importexport/users/filter/NativeXmlUserGroupFilter.inc.php +++ b/plugins/importexport/users/filter/NativeXmlUserGroupFilter.inc.php @@ -20,7 +20,7 @@ class NativeXmlUserGroupFilter extends NativeImportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -66,7 +66,7 @@ public function getClassName() /** * Handle a user_group element * - * @param $node DOMElement + * @param DOMElement $node * * @return array Array of UserGroup objects */ diff --git a/plugins/importexport/users/filter/PKPUserUserXmlFilter.inc.php b/plugins/importexport/users/filter/PKPUserUserXmlFilter.inc.php index 7af93e152ed..f6c080c4763 100644 --- a/plugins/importexport/users/filter/PKPUserUserXmlFilter.inc.php +++ b/plugins/importexport/users/filter/PKPUserUserXmlFilter.inc.php @@ -22,7 +22,7 @@ class PKPUserUserXmlFilter extends NativeExportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -49,7 +49,7 @@ public function getClassName() /** * @see Filter::process() * - * @param $users array Array of users + * @param array $users Array of users * * @return DOMDocument */ @@ -81,8 +81,8 @@ public function &process(&$users) /** * Create and return a user node. * - * @param $doc DOMDocument - * @param $user User + * @param DOMDocument $doc + * @param User $user * * @return DOMElement */ diff --git a/plugins/importexport/users/filter/UserGroupNativeXmlFilter.inc.php b/plugins/importexport/users/filter/UserGroupNativeXmlFilter.inc.php index 10882972a13..3b70084d0b7 100644 --- a/plugins/importexport/users/filter/UserGroupNativeXmlFilter.inc.php +++ b/plugins/importexport/users/filter/UserGroupNativeXmlFilter.inc.php @@ -20,7 +20,7 @@ class UserGroupNativeXmlFilter extends NativeExportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -47,7 +47,7 @@ public function getClassName() /** * @see Filter::process() * - * @param $userGroups array Array of user groups + * @param array $userGroups Array of user groups * * @return DOMDocument */ @@ -75,8 +75,8 @@ public function &process(&$userGroups) /** * Create and return a user group node. * - * @param $doc DOMDocument - * @param $userGroup UserGroup + * @param DOMDocument $doc + * @param UserGroup $userGroup * * @return DOMElement */ diff --git a/plugins/importexport/users/filter/UserXmlPKPUserFilter.inc.php b/plugins/importexport/users/filter/UserXmlPKPUserFilter.inc.php index d717343eaee..e2e5a6e6c37 100644 --- a/plugins/importexport/users/filter/UserXmlPKPUserFilter.inc.php +++ b/plugins/importexport/users/filter/UserXmlPKPUserFilter.inc.php @@ -24,7 +24,7 @@ class UserXmlPKPUserFilter extends NativeImportFilter /** * Constructor * - * @param $filterGroup FilterGroup + * @param FilterGroup $filterGroup */ public function __construct($filterGroup) { @@ -59,7 +59,7 @@ public function getClassName() /** * Handle a user_groups element * - * @param $node DOMElement + * @param DOMElement $node * * @return array Array of UserGroup objects */ @@ -78,7 +78,7 @@ public function parseUserGroup($node) /** * Handle a users element * - * @param $node DOMElement + * @param DOMElement $node * * @return array Array of User objects */ @@ -258,7 +258,7 @@ public function parseUser($node) if ($password) { $mail = new MailTemplate('USER_REGISTER'); $mail->setReplyTo($context->getSetting('contactEmail'), $context->getSetting('contactName')); - $mail->assignParams(['username' => $user->getUsername(), 'password' => $password, 'userFullName' => $user->getFullName()]); + $mail->assignParams(['recipientUsername' => $user->getUsername(), 'password' => $password, 'recipientName' => $user->getFullName()]); $mail->addRecipient($user->getEmail(), $user->getFullName()); $mail->send(); } @@ -296,7 +296,7 @@ public function parseUser($node) /** * Handle a singular element import. * - * @param $node DOMElement + * @param DOMElement $node */ public function handleElement($node) { @@ -313,7 +313,7 @@ public function handleElement($node) /** * Handle an element whose parent is the submission element. * - * @param $n DOMElement + * @param DOMElement $n */ public function handleChildElement($n) { @@ -332,8 +332,8 @@ public function handleChildElement($n) /** * Validation process for imported passwords * - * @param $userToImport User ByRef. The user that is being imported. - * @param $encryption string null, sha1, md5 (or any other encryption algorithm defined) + * @param User $userToImport ByRef. The user that is being imported. + * @param string $encryption null, sha1, md5 (or any other encryption algorithm defined) * * @return string if a new password is generated, the function returns it. */ diff --git a/plugins/metadata/dc11/schema/PKPDc11Schema.inc.php b/plugins/metadata/dc11/schema/PKPDc11Schema.inc.php index 8654bd35d5c..d781ed83d3a 100644 --- a/plugins/metadata/dc11/schema/PKPDc11Schema.inc.php +++ b/plugins/metadata/dc11/schema/PKPDc11Schema.inc.php @@ -29,7 +29,7 @@ class PKPDc11Schema extends MetadataSchema /** * Constructor * - * @param $appSpecificAssocType integer + * @param int $appSpecificAssocType */ public function __construct($appSpecificAssocType, $classname = 'plugins.metadata.dc11.schema.Dc11Schema') { diff --git a/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormatPlugin_DC.inc.php b/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormatPlugin_DC.inc.php index 6927555dcc3..3d9f244cb17 100755 --- a/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormatPlugin_DC.inc.php +++ b/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormatPlugin_DC.inc.php @@ -22,7 +22,7 @@ class PKPOAIMetadataFormatPlugin_DC extends OAIMetadataFormatPlugin * Get the name of this plugin. The name must be unique within * its category. * - * @return String name of plugin + * @return string name of plugin */ public function getName() { diff --git a/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormat_DC.inc.php b/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormat_DC.inc.php index 0ae6e7e0f67..7db66286c61 100755 --- a/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormat_DC.inc.php +++ b/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormat_DC.inc.php @@ -55,8 +55,8 @@ public function toXml($dataObject, $format = null) /** * Format XML for single DC element. * - * @param $propertyName string - * @param $multilingual boolean optional + * @param string $propertyName + * @param bool $multilingual optional */ public function formatElement($propertyName, $values, $multilingual = false) { diff --git a/schemas/author.json b/schemas/author.json index c24627b29c3..327faca8241 100644 --- a/schemas/author.json +++ b/schemas/author.json @@ -12,12 +12,18 @@ "type": "string", "description": "The scholarly institution this contributor is employed by or affiliated with.", "multilingual": "true", - "apiSummary": true + "apiSummary": true, + "validation": [ + "nullable" + ] }, "biography": { "type": "string", "description": "An optional bio statement about this contributor.", - "multilingual": "true" + "multilingual": "true", + "validation": [ + "nullable" + ] }, "country": { "type": "string" @@ -32,7 +38,16 @@ "familyName": { "type": "string", "multilingual": "true", - "apiSummary": true + "apiSummary": true, + "validation": [ + "nullable" + ] + }, + "fullName": { + "type": "string", + "description": "The full name of the author. This will be the preferredPublicName or, if that is not available, a string containing the givenName and familyName.", + "apiSummary": true, + "readOnly": true }, "givenName": { "type": "string", @@ -57,6 +72,7 @@ "description": "The ORCID of this contributor. See: https://orcid.org/", "apiSummary": true, "validation": [ + "nullable", "orcid" ] }, @@ -64,7 +80,10 @@ "type": "string", "description": "An optional field for contributors to specify how they prefer to be identified in this publication.", "multilingual": "true", - "apiSummary": true + "apiSummary": true, + "validation": [ + "nullable" + ] }, "publicationId": { "type": "integer", @@ -85,13 +104,20 @@ "type": "string", "description": "An optional URL to this contributor's webpage.", "validation": [ - "url" + "url", + "nullable" ] }, "userGroupId": { "type": "integer", - "description": "in which user group should this contributor be identified. Usually one of the author roles, such as Author or Translator.", + "description": "The ID of this contributor's assigned user group. See userGroupName.", "apiSummary": true + }, + "userGroupName": { + "type": "string", + "description": "The name of this contributor's role in the publication, such as 'Author' or 'Translator'.", + "apiSummary": true, + "readOnly": true } } } diff --git a/schemas/context.json b/schemas/context.json index bc432cb58bb..ad9f00e769c 100644 --- a/schemas/context.json +++ b/schemas/context.json @@ -415,6 +415,14 @@ "nullable" ] }, + "notifyAllAuthors": { + "type": "boolean", + "default": true, + "description": "When enabled, all authors of a submission will receive a notification when an editorial decision is made regarding a submission. When disabled, only authors assigned to the submission will be notified.", + "validation": [ + "nullable" + ] + }, "numAnnouncementsHomepage": { "type": "integer", "validation": [ diff --git a/schemas/decision.json b/schemas/decision.json new file mode 100644 index 00000000000..eb652938e1d --- /dev/null +++ b/schemas/decision.json @@ -0,0 +1,78 @@ +{ + "title": "Editorial Decision", + "description": "An editorial decision such as accept, decline or request revisions.", + "required": [ + "dateDecided", + "decision", + "editorId", + "stageId", + "submissionId" + ], + "properties": { + "_href": { + "type": "string", + "description": "The URL to this decision in the REST API.", + "format": "uri", + "readOnly": true, + "apiSummary": true + }, + "actions": { + "type": "array", + "description": "A list of actions to be taken with this decision, such as sending an email. Each decision supports different actions with different properties. See the examples for support decision actions.", + "writeOnly": true, + "items": { + "type": "object" + } + }, + "dateDecided": { + "type": "string", + "description": "The date the decision was taken.", + "apiSummary": true, + "validation": [ + "date_format:Y-m-d H:i:s" + ] + }, + "decision": { + "type": "integer", + "description": "The decision that was made. One of the `SUBMISSION_EDITOR_DECISION_` constants.", + "apiSummary": true + }, + "editorId": { + "type": "integer", + "description": "The user id of the editor who took the decision.", + "apiSummary": true + }, + "id": { + "type": "integer", + "apiSummary": true, + "readOnly": true + }, + "reviewRoundId": { + "type": "integer", + "description": "The unique id of the review round when this decision was taken. This is a globally unique id. It does not represent whether the decision was taken in the first or second round of reviews for a submission. See `round` below.", + "apiSummary": true, + "validation": [ + "nullable" + ] + }, + "round": { + "type": "integer", + "description": "The sequential review round when this decision was taken. For example, the first, second or third round of review for this submission.", + "apiSummary": true + }, + "stageId": { + "type": "integer", + "description": "The workflow stage when this decision was taken. One of the `WORKFLOW_STAGE_ID_` constants.", + "apiSummary": true, + "validation": [ + "min:1", + "max:5" + ] + }, + "submissionId": { + "type": "integer", + "description": "The decision applies to this submission.", + "apiSummary": true + } + } +} diff --git a/schemas/publication.json b/schemas/publication.json index 9603b435fb6..11fd6986365 100644 --- a/schemas/publication.json +++ b/schemas/publication.json @@ -36,6 +36,12 @@ "apiSummary": true, "readOnly": true }, + "authorsStringIncludeInBrowse": { + "type": "string", + "description": "A list of authors that are included in publication lists, like tables of content and search results, rendered with the appropriate separators according to the locale.", + "apiSummary": true, + "readOnly": true + }, "authorsStringShort": { "type": "string", "description": "A shortened version of the authors rendered with the appropriate separators according to the locale.", diff --git a/schemas/submissionFile.json b/schemas/submissionFile.json index b31e3121bf9..54ceb2f1214 100644 --- a/schemas/submissionFile.json +++ b/schemas/submissionFile.json @@ -126,6 +126,17 @@ "type": "integer", "apiSummary": true }, + "genreIsPrimary": { + "type": "boolean", + "apiSummary": true, + "readOnly": true + }, + "genreName": { + "type": "string", + "multilingual": true, + "apiSummary": true, + "readOnly": true + }, "language": { "type": "string", "apiSummary": true, diff --git a/schemas/user.json b/schemas/user.json index e37afd7e214..d3dc1115629 100644 --- a/schemas/user.json +++ b/schemas/user.json @@ -127,7 +127,6 @@ }, "gossip": { "type": "string", - "multilingual": true, "apiSummary": true, "validation": [ "nullable" @@ -213,6 +212,15 @@ "nullable" ] }, + "preferredPublicName": { + "type": "string", + "description": "An optional field for users to specify how they prefer to be identified.", + "multilingual": "true", + "apiSummary": true, + "validation": [ + "nullable" + ] + }, "signature": { "type": "string", "multilingual": true, diff --git a/styles/pages/workflow.less b/styles/pages/workflow.less index d08e6e71b35..5221fdac44e 100644 --- a/styles/pages/workflow.less +++ b/styles/pages/workflow.less @@ -92,59 +92,43 @@ } .pkp_workflow_decisions { - margin: 0 0 1rem; - padding-left: 0; - list-style: none; - - a { - &:extend(.pkp_button all); - width: 100%; - text-align: center; - - &.pkp_linkaction_decline { - &:extend(.pkp_button_offset all); - } + margin-bottom: 1rem; - &.pkp_linkaction_externalReview, - &.pkp_linkaction_sendToProduction, - &.pkp_linkaction_schedulePublication, - &.pkp_linkaction_toPublication { - &:extend(.pkp_button_primary all); - } + > * + * { + margin-top: 1rem; } - button { - width: 100%; + ul { + margin: 0; + padding: 0; + list-style: none; } li + li { margin-top: 0.5rem; } + + .pkp_button { + width: 100%; + text-align: center; + } } -.pkp_no_workflow_decisions, -.pkp_workflow_decided, -.pkp_workflow_recommendations { +.pkp_workflow_last_decision, +.pkp_workflow_recommendations, +.pkp_no_workflow_decisions { margin-bottom: 1rem; + border: @bg-border-light; + border-radius: @radius; padding: 1rem; font-size: @font-sml; line-height: @line-sml; - box-shadow: 0 1px 1px rgba(0,0,0,0.2); - border-radius: @radius; - border-top: @grid-border; -} - -.pkp_workflow_decided_actions { - display: none; - - .pkp_controllers_linkAction { - margin-top: 1rem; - } } .pkp_workflow_change_decision { - padding: 0; - margin-top: 0; + display: block; + padding: 0.5rem 0; + margin-top: 0.5rem; background: transparent; border: none; box-shadow: none; @@ -156,6 +140,10 @@ text-align: left; } +.pkp_workflow_decisions_options_hidden { + display: none; +} + .export_actions { padding-left: 2rem; padding-right: 2rem; @@ -383,6 +371,12 @@ } } +// View of a sent email opened from the activity log +.pkp_workflow_email_log_view { + font-size: @font-sml; + line-height: @line-sml; +} + // @todo .pkp_page_header { diff --git a/styles/rtl.less b/styles/rtl.less index 9f0e0bbe5a6..84174586b58 100644 --- a/styles/rtl.less +++ b/styles/rtl.less @@ -140,9 +140,4 @@ body[dir="rtl"] { right: 0; } } - - // Submission workflow - .pkp_workflow_decisions { - padding-right: 0; - } } diff --git a/templates/common/urlInEl.tpl b/templates/common/urlInEl.tpl index 957f65d965c..3ea4270c162 100644 --- a/templates/common/urlInEl.tpl +++ b/templates/common/urlInEl.tpl @@ -10,9 +10,9 @@ *} - -
-

{translate key="editor.submission.externalReviewDescription"}

- - {csrf} - - - - - {capture assign=filesForReviewUrl}{url router=\PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.files.submission.SelectableSubmissionDetailsFilesGridHandler" op="fetchGrid" submissionId=$submissionId stageId=$stageId escape=false}{/capture} - {load_url_in_div id="filesForReviewGrid" url=$filesForReviewUrl} - {fbvFormButtons submitText="editor.submission.decision.sendExternalReview"} -
diff --git a/templates/controllers/modals/editorDecision/form/newReviewRoundForm.tpl b/templates/controllers/modals/editorDecision/form/newReviewRoundForm.tpl deleted file mode 100644 index c727d5698c7..00000000000 --- a/templates/controllers/modals/editorDecision/form/newReviewRoundForm.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{** - * templates/controllers/modals/editorDecision/form/newReviewRoundForm.tpl - * - * Copyright (c) 2014-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky - * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. - * - * Form used to create a new review round (after the first round) - * - *} - - -
-

{translate key="editor.submission.newRoundDescription"}

- - {csrf} - - - - - - - {capture assign=newRoundRevisionsUrl}{url router=\PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.files.review.SelectableReviewRevisionsGridHandler" op="fetchGrid" submissionId=$submissionId stageId=$stageId reviewRoundId=$reviewRoundId escape=false}{/capture} - {load_url_in_div id="newRoundRevisionsGrid" url=$newRoundRevisionsUrl} - - {fbvFormButtons submitText="editor.submission.createNewRound"} -
diff --git a/templates/controllers/modals/editorDecision/form/promoteForm.tpl b/templates/controllers/modals/editorDecision/form/promoteForm.tpl deleted file mode 100644 index d9da478304f..00000000000 --- a/templates/controllers/modals/editorDecision/form/promoteForm.tpl +++ /dev/null @@ -1,131 +0,0 @@ -{** - * templates/controllers/modals/editorDecision/form/promoteForm.tpl - * - * Copyright (c) 2014-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky - * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. - * - * Form used to send reviews to author - * - *} - - - -
- {csrf} - - - - - -
- {if array_key_exists('help', $decisionData)} -

{translate key=$decisionData.help}

- {/if} - - {capture assign="sendEmailLabel"}{translate key="editor.submissionReview.sendEmail" authorName=$authorName|escape}{/capture} - {if $skipEmail} - {assign var="skipEmailSkip" value=true} - {else} - {assign var="skipEmailSend" value=true} - {/if} - {fbvFormSection title="common.sendEmail"} -
    - {fbvElement type="radio" id="skipEmail-send" name="skipEmail" value="0" checked=$skipEmailSend label=$sendEmailLabel translate=false} - {fbvElement type="radio" id="skipEmail-skip" name="skipEmail" value="1" checked=$skipEmailSkip label="editor.submissionReview.skipEmail"} -
- {/fbvFormSection} - -
- {* Message to author textarea *} - {fbvFormSection for="personalMessage"} - {fbvElement type="textarea" name="personalMessage" id="personalMessage" value=$personalMessage rich=true variables=$allowedVariables variablesType=$allowedVariablesType} - {/fbvFormSection} - - {* Button to add reviews to the email automatically *} - {if $reviewsAvailable} - {fbvFormSection} - - - {translate key="submission.comments.addReviews"} - - {/fbvFormSection} - {/if} - - {if isset($reviewers)} - {include file="controllers/modals/editorDecision/form/bccReviewers.tpl" - reviewers=$reviewers - selected=$bccReviewers - } - {/if} -
- - {if $decisionData.paymentType} - {fbvFormSection title="common.payment"} -
    - {fbvElement type="radio" id="requestPayment-request" name="requestPayment" value="1" checked=$requestPayment|compare:1 label=$decisionData.requestPaymentText translate=false} - {fbvElement type="radio" id="requestPayment-waive" name="requestPayment" value="0" checked=$requestPayment|compare:0 label=$decisionData.waivePaymentText translate=false} -
- {/fbvFormSection} - {/if} - - {** Some decisions can be made before review is initiated (i.e. no attachments). **} - {if $reviewRoundId} -
- {capture assign=reviewAttachmentsGridUrl}{url router=\PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.files.attachment.EditorSelectableReviewAttachmentsGridHandler" op="fetchGrid" submissionId=$submissionId stageId=$stageId reviewRoundId=$reviewRoundId escape=false}{/capture} - {load_url_in_div id="reviewAttachmentsGridContainer" url=$reviewAttachmentsGridUrl} -
- {/if} - -
- {capture assign=libraryAttachmentsGridUrl}{url router=\PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.files.SelectableLibraryFileGridHandler" op="fetchGrid" submissionId=$submissionId escape=false}{/capture} - {capture assign=libraryAttachmentsGrid}{load_url_in_div id="libraryFilesAttachmentsGridContainer" url=$libraryAttachmentsGridUrl}{/capture} - {include file="controllers/extrasOnDemand.tpl" - id="libraryFileAttachmentsExtras" - widgetWrapper="#libraryFileAttachments" - moreDetailsText="settings.libraryFiles.public.selectLibraryFiles" - lessDetailsText="settings.libraryFiles.public.selectLibraryFiles" - extraContent=$libraryAttachmentsGrid - } -
-
- -
- {capture assign="stageName"}{translate key=$decisionData.toStage}{/capture} -

{translate key="editor.submission.decision.selectFiles" stageName=$stageName}

- {* Show a different grid depending on whether we're in review or before the review stage *} - {if $stageId == $smarty.const.WORKFLOW_STAGE_ID_SUBMISSION} - {capture assign=filesToPromoteGridUrl}{url router=\PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.files.submission.SelectableSubmissionDetailsFilesGridHandler" op="fetchGrid" submissionId=$submissionId stageId=$stageId escape=false}{/capture} - {elseif $reviewRoundId} - {** a set $reviewRoundId var implies we are INTERNAL_REVIEW or EXTERNAL_REVIEW **} - {capture assign=filesToPromoteGridUrl}{url router=\PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.files.review.SelectableReviewRevisionsGridHandler" op="fetchGrid" submissionId=$submissionId stageId=$stageId reviewRoundId=$reviewRoundId escape=false}{/capture} - {elseif $stageId == $smarty.const.WORKFLOW_STAGE_ID_EDITING} - {capture assign=filesToPromoteGridUrl}{url router=\PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.files.copyedit.SelectableCopyeditFilesGridHandler" op="fetchGrid" submissionId=$submissionId stageId=$stageId escape=false}{/capture} - {capture assign=draftFilesToPromoteGridUrl}{url router=\PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.files.final.SelectableFinalDraftFilesGridHandler" op="fetchGrid" submissionId=$submissionId stageId=$stageId escape=false}{/capture} - {load_url_in_div id="draftFilesToPromoteGridUrl" url=$draftFilesToPromoteGridUrl} - {/if} - {load_url_in_div id="filesToPromoteGrid" url=$filesToPromoteGridUrl} -
- - {fbvFormSection class="formButtons form_buttons"} - - - {fbvElement type="submit" class="submitFormButton pkp_button_primary" id="promoteForm-complete-btn" label="editor.submissionReview.recordDecision"} - - {assign var=cancelButtonId value="cancelFormButton"|concat:"-"|uniqid} - {translate key="common.cancel"} - {/fbvFormSection} -
diff --git a/templates/controllers/modals/editorDecision/form/recommendationForm.tpl b/templates/controllers/modals/editorDecision/form/recommendationForm.tpl deleted file mode 100644 index 773ea5bfa22..00000000000 --- a/templates/controllers/modals/editorDecision/form/recommendationForm.tpl +++ /dev/null @@ -1,72 +0,0 @@ -{** - * templates/controllers/modals/editorDecision/form/recommendationForm.tpl - * - * Copyright (c) 2014-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky - * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. - * - * Form used to send the editor recommendation - * - *} - - - -
- {csrf} - - - - - {if !empty($editorRecommendations)} - {fbvFormSection label="editor.submission.recordedRecommendations"} - {foreach from=$editorRecommendations item=editorRecommendation} -
- {translate key="submission.round" round=$editorRecommendation.round} ({$editorRecommendation.dateDecided|date_format:$datetimeFormatShort}): {translate key=$recommendationOptions[$editorRecommendation.decision]} -
- {/foreach} - {/fbvFormSection} - {/if} - - {fbvFormSection label="editor.submission.recommendation" description=$description|default:"editor.submission.recommendation.description"} - {fbvElement type="select" id="recommendation" name="recommendation" from=$recommendationOptions selected=$recommendation size=$fbvStyles.size.MEDIUM required=$required|default:true disabled=$readOnly} - {/fbvFormSection} - - {capture assign="sendEmailLabel"}{translate key="editor.submissionReview.sendEmail.editors" editorNames=$editors}{/capture} - {if $skipEmail} - {assign var="skipEmailSkip" value=true} - {else} - {assign var="skipEmailSend" value=true} - {/if} - {fbvFormSection title="editor.submissionReview.recordRecommendation.notifyEditors"} -
    - {fbvElement type="radio" id="skipEmail-send" name="skipEmail" value="0" checked=$skipEmailSend label=$sendEmailLabel translate=false} - {fbvElement type="radio" id="skipEmail-skip" name="skipEmail" value="1" checked=$skipEmailSkip label="editor.submissionReview.skipEmail"} -
- {/fbvFormSection} - - {if $skipDiscussion} - {assign var="skipDiscussionSkip" value=true} - {else} - {assign var="skipDiscussionSend" value=true} - {/if} - {fbvFormSection} -
    - {fbvElement type="radio" id="skipDiscussion-send" name="skipDiscussion" value="0" checked=$skipDiscussionSend label="editor.submissionReview.recordRecommendation.createDiscussion"} - {fbvElement type="radio" id="skipDiscussion-skip" name="skipDiscussion" value="1" checked=$skipDiscussionSkip label="editor.submissionReview.recordRecommendation.skipDiscussion"} -
- {/fbvFormSection} - -
- {fbvFormSection for="personalMessage"} - {fbvElement type="textarea" name="personalMessage" id="personalMessage" value=$personalMessage rich=true variables=$allowedVariables variablesType=$allowedVariablesType} - {/fbvFormSection} -
- - {fbvFormButtons submitText="editor.submissionReview.recordRecommendation"} -
diff --git a/templates/controllers/modals/editorDecision/form/revertDeclineForm.tpl b/templates/controllers/modals/editorDecision/form/revertDeclineForm.tpl deleted file mode 100644 index 31cdcbf1849..00000000000 --- a/templates/controllers/modals/editorDecision/form/revertDeclineForm.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{** - * templates/controllers/modals/editorDecision/form/revertDeclineForm.tpl - * - * Copyright (c) 2014-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky - * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. - * - * Form used revert a decline decision - * - *} - - -
- {csrf} - - - - - - -

{translate key="editor.submission.revertDeclineDescription"}

- - {fbvFormButtons submitText="editor.submission.decision.revertDecline"} - -
\ No newline at end of file diff --git a/templates/controllers/modals/editorDecision/form/sendReviewsForm.tpl b/templates/controllers/modals/editorDecision/form/sendReviewsForm.tpl deleted file mode 100644 index 7a470835090..00000000000 --- a/templates/controllers/modals/editorDecision/form/sendReviewsForm.tpl +++ /dev/null @@ -1,101 +0,0 @@ -{** - * templates/controllers/modals/editorDecision/form/sendReviewsForm.tpl - * - * Copyright (c) 2014-2021 Simon Fraser University - * Copyright (c) 2003-2021 John Willinsky - * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. - * - * @brief Form used to send reviews to author - * - * @uses $revisionsEmail string Email body for requesting revisions that don't - * require another round of review. - * @uses $resubmitEmail string Email body for asking the author to resubmit for - * another round of review. - *} - - -
- {csrf} - - - - - {* Set the decision or allow the decision to be selected *} - {if $decision != \APP\workflow\EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS && $decision != \APP\workflow\EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_RESUBMIT} - - {else} - {if $decision == \APP\workflow\EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS} - {assign var="checkedRevisions" value="1"} - {elseif $decision == \APP\workflow\EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_RESUBMIT} - {assign var="checkedResubmit" value="1"} - {/if} - {fbvFormSection title="editor.review.newReviewRound"} -
    - {fbvElement type="radio" id="decisionRevisions" name="decision" value=\APP\workflow\EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_PENDING_REVISIONS checked=$checkedRevisions label="editor.review.NotifyAuthorRevisions"} - {fbvElement type="radio" id="decisionResubmit" name="decision" value=\APP\workflow\EditorDecisionActionsManager::SUBMISSION_EDITOR_DECISION_RESUBMIT checked=$checkedResubmit label="editor.review.NotifyAuthorResubmit"} -
- {/fbvFormSection} - {/if} - - {capture assign="sendEmailLabel"}{translate key="editor.submissionReview.sendEmail" authorName=$authorName|escape}{/capture} - {if $skipEmail} - {assign var="skipEmailSkip" value=true} - {else} - {assign var="skipEmailSend" value=true} - {/if} - {fbvFormSection title="common.sendEmail"} -
    - {fbvElement type="radio" id="skipEmail-send" name="skipEmail" value="0" checked=$skipEmailSend label=$sendEmailLabel translate=false} - {fbvElement type="radio" id="skipEmail-skip" name="skipEmail" value="1" checked=$skipEmailSkip label="editor.submissionReview.skipEmail"} -
- {/fbvFormSection} - -
- {* Message to author textarea *} - {fbvFormSection for="personalMessage"} - {fbvElement type="textarea" name="personalMessage" id="personalMessage" value=$personalMessage rich=true variables=$allowedVariables variablesType=$allowedVariablesType} - {/fbvFormSection} - - {* Button to add reviews to the email automatically *} - {if $reviewsAvailable} - {fbvFormSection} - - - {translate key="submission.comments.addReviews"} - - {/fbvFormSection} - {/if} - - {if isset($reviewers)} - {include file="controllers/modals/editorDecision/form/bccReviewers.tpl" - reviewers=$reviewers - selected=$bccReviewers - } - {/if} -
- - {** Some decisions can be made before review is initiated (i.e. no attachments). **} - {if $reviewRoundId} -
- {capture assign=reviewAttachmentsGridUrl}{url router=\PKP\core\PKPApplication::ROUTE_COMPONENT component="grid.files.attachment.EditorSelectableReviewAttachmentsGridHandler" op="fetchGrid" submissionId=$submissionId stageId=$stageId reviewRoundId=$reviewRoundId escape=false}{/capture} - {load_url_in_div id="reviewAttachmentsGridContainer" url=$reviewAttachmentsGridUrl} -
- {/if} - - {fbvFormButtons submitText="editor.submissionReview.recordDecision"} -
diff --git a/templates/controllers/tab/workflow/review.tpl b/templates/controllers/tab/workflow/review.tpl index f7175c5c788..d9c9d47020f 100644 --- a/templates/controllers/tab/workflow/review.tpl +++ b/templates/controllers/tab/workflow/review.tpl @@ -19,7 +19,6 @@ {ldelim} {assign var=roundIndex value=$lastReviewRoundNumber-1} selected: {$roundIndex}, - disabled: [{$lastReviewRoundNumber}] {rdelim} ); {rdelim}); @@ -33,9 +32,14 @@ getId() stageId=$reviewRound->getStageId() reviewRoundId=$reviewRound->getId()}">{translate key="submission.round" round=$reviewRound->getRound()} {/foreach} - {if $newRoundAction} + {if $newRoundUrl}
  • - {include file="linkAction/linkAction.tpl" image="add_item" action=$newRoundAction contextId="newRoundTabContainer"} + {translate key="editor.submission.newRound"} +
  • {/if} diff --git a/templates/decision/record.tpl b/templates/decision/record.tpl new file mode 100644 index 00000000000..2017d18cd2f --- /dev/null +++ b/templates/decision/record.tpl @@ -0,0 +1,189 @@ +{** + * templates/management/workflow.tpl + * + * Copyright (c) 2014-2021 Simon Fraser University + * Copyright (c) 2003-2021 John Willinsky + * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. + * + * @brief The workflow settings page. + *} +{extends file="layouts/backend.tpl"} + +{block name="page"} +
    +

    + + +

    +

    + {$decisionType->getDescription()} +

    + + + {{ error }} + + + + + + + + + + + + +
    + +{/block} \ No newline at end of file diff --git a/templates/frontend/pages/userLostPassword.tpl b/templates/frontend/pages/userLostPassword.tpl index 1c41917340d..591d39b79d7 100644 --- a/templates/frontend/pages/userLostPassword.tpl +++ b/templates/frontend/pages/userLostPassword.tpl @@ -20,11 +20,6 @@
    {csrf} - {if $error} -
    - {translate key=$error} -
    - {/if}