diff --git a/ObjectsForReviewPlugin.inc.php b/ObjectsForReviewPlugin.inc.php index 44a0f1d..40dd64f 100755 --- a/ObjectsForReviewPlugin.inc.php +++ b/ObjectsForReviewPlugin.inc.php @@ -46,12 +46,6 @@ function getInstallEmailTemplatesFile() { return ($this->getPluginPath() . '/emailTemplates.xml'); } - /** - * @see PKPPlugin::getInstallEmailTemplateDataFile() - */ - function getInstallEmailTemplateDataFile() { - return ($this->getPluginPath() . '/locale/{$installedLocale}/emailTemplates.xml'); - } /** * @copydoc Plugin::getActions() @@ -60,7 +54,7 @@ function getActions($request, $verb) { $router = $request->getRouter(); import('lib.pkp.classes.linkAction.request.AjaxModal'); return array_merge( - $this->getEnabled()?array( + $this->getEnabled()?[ new LinkAction( 'settings', new AjaxModal( @@ -70,7 +64,7 @@ function getActions($request, $verb) { __('manager.plugins.settings'), null ), - ):array(), + ]:[], parent::getActions($request, $verb) ); } @@ -108,6 +102,7 @@ function manage($args, $request) { * @copydoc Plugin::register() */ function register($category, $path, $mainContextId = null) { + $success = parent::register($category, $path, $mainContextId); if ($success && $this->getEnabled($mainContextId)) { @@ -188,7 +183,7 @@ function setupGridHandler($hookName, $params) { function addToPublicationForms($hookName, $params) { $smarty =& $params[1]; $output =& $params[2]; - $submission = $smarty->get_template_vars('submission'); + $submission = $smarty->getTemplateVars('submission'); $smarty->assign([ 'submissionId' => $submission->getId(), ]); @@ -221,7 +216,7 @@ function addSubmissionDisplay($hookName, $params) { $templateMgr = $params[1]; $output =& $params[2]; - $submission = $templateMgr->get_template_vars('monograph') ? $templateMgr->get_template_vars('monograph') : $templateMgr->get_template_vars('article'); + $submission = $templateMgr->getTemplateVars('monograph') ? $templateMgr->getTemplateVars('monograph') : $templateMgr->getTemplateVars('article'); $objectForReviewDao = DAORegistry::getDAO('ObjectForReviewDAO'); $objectsForReview = $objectForReviewDao->getBySubmissionId($submission->getId()); @@ -252,7 +247,7 @@ function addSubmissionDisplay($hookName, $params) { * Hook to ArticleDAO::_fromRow and MonographDAO::_fromRow and display objectForReview as subtitle * @param $hookName string * @param $params array - */ + */ function addSubtitleDisplay($hookName, $params) { // NOTE Not working in 3.2, need to rewrite this $submission =& $params[0]; @@ -275,10 +270,11 @@ function addSubtitleDisplay($hookName, $params) { } /** - * @copydoc Plugin::getInstallSchemaFile() + * @copydoc Plugin::getInstallMigration() */ - function getInstallSchemaFile() { - return $this->getPluginPath() . '/schema.xml'; + function getInstallMigration() { + $this->import('ObjectsForReviewSchemaMigration'); + return new ObjectsForReviewSchemaMigration(); } /** @@ -443,7 +439,7 @@ function getMailTemplate($emailKey, $context = null) { * Send mail to editor when object is reserved or cancelled * * @param User $user - * @param $object + * @param $object * @param $template Send either the reserve or cancel mail */ public function notifyEditor($user, $objectDescription, $mailTemplate) { diff --git a/ObjectsForReviewSchemaMigration.inc.php b/ObjectsForReviewSchemaMigration.inc.php new file mode 100755 index 0000000..9a04f95 --- /dev/null +++ b/ObjectsForReviewSchemaMigration.inc.php @@ -0,0 +1,49 @@ +create('objects_for_review', function (Blueprint $table) { + $table->bigInteger('object_id')->autoIncrement(); + $table->bigInteger('submission_id')->nullable(); + $table->bigInteger('context_id'); + $table->bigInteger('user_id')->nullable(); + $table->string('identifier', 255); + $table->string('identifier_type', 255); + $table->string('resource_type', 255); + $table->string('creator', 255); + $table->datetime('date_created'); + }); + + Capsule::schema()->create('objects_for_review_settings', function (Blueprint $table) { + $table->bigInteger('object_id'); + $table->string('locale', 14)->default(''); + $table->string('setting_name', 255); + $table->longText('setting_value')->nullable(); + $table->string('setting_type', 6)->comment('(bool|int|float|string|object)'); + $table->index(['object_id'], 'objects_for_review_settings_id'); + $table->unique(['object_id', 'locale', 'setting_name'], 'objects_for_review_settings_pkey'); + }); + } + +} diff --git a/ObjectsForReviewSettingsForm.inc.php b/ObjectsForReviewSettingsForm.inc.php index 09d869a..8da4477 100644 --- a/ObjectsForReviewSettingsForm.inc.php +++ b/ObjectsForReviewSettingsForm.inc.php @@ -42,7 +42,7 @@ function __construct($plugin, $journalId) { * Initialize form data. */ function initData() { - $request = Application::getRequest(); + $request = Application::get()->getRequest(); $context = $request->getContext(); $this->_data = array( 'displayAsSubtitle' => $this->_plugin->getSetting($this->_journalId, 'displayAsSubtitle'), @@ -73,7 +73,7 @@ function fetch($request, $template = null, $display = false) { * Save settings. */ function execute(...$functionArgs) { - $request = Application::getRequest(); + $request = Application::get()->getRequest(); $context = $request->getContext(); $this->_plugin->updateSetting($this->_journalId, 'displayAsSubtitle', $this->getData('displayAsSubtitle'), 'bool'); $this->_plugin->updateSetting($this->_journalId, 'displayAsList', $this->getData('displayAsList'), 'bool'); diff --git a/README.md b/README.md index a092e08..cd81eb4 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Objects for Review Plugin for OJS3 +# Objects for Review Plugin for OJS 3.3 ## About @@ -15,4 +15,4 @@ The frontend object listing uses https://github.com/tristen/tablesort for table This plugin is licensed under the GNU General Public License v3. See the file LICENSE for the complete terms of this license. -The license for https://github.com/tristen/tablesort included in the repository is MIT. See https://github.com/tristen/tablesort/blob/gh-pages/LICENCE \ No newline at end of file +The license for https://github.com/tristen/tablesort included in the repository is MIT. See https://github.com/tristen/tablesort/blob/gh-pages/LICENCE diff --git a/classes/ObjectForReviewDAO.inc.php b/classes/ObjectForReviewDAO.inc.php index 7053244..65bde63 100644 --- a/classes/ObjectForReviewDAO.inc.php +++ b/classes/ObjectForReviewDAO.inc.php @@ -24,7 +24,7 @@ class ObjectForReviewDAO extends DAO { * @param $submissionId int (optional) Submission ID */ function getById($objectId, $submissionId = null) { - $params = array((int) $objectId); + $params = [(int) $objectId]; if ($submissionId) $params[] = (int) $submissionId; $result = $this->retrieve( @@ -33,12 +33,8 @@ function getById($objectId, $submissionId = null) { $params ); - $returner = null; - if ($result->RecordCount() != 0) { - $returner = $this->_fromRow($result->GetRowAssoc(false)); - } - $result->Close(); - return $returner; + $row = $result->current(); + return $row ? $this->_fromRow((array) $row) : null; } /** @@ -47,7 +43,7 @@ function getById($objectId, $submissionId = null) { * @param $contextId int (optional) context ID */ function getBySubmissionId($submissionId, $contextId = null) { - $params = array((int) $submissionId); + $params = [(int) $submissionId]; if ($contextId) $params[] = (int) $contextId; $result = $this->retrieve( @@ -66,7 +62,7 @@ function getBySubmissionId($submissionId, $contextId = null) { * @param $withoutSubmissionOnly true if only objects without a submission should be included */ function getByUserId($userId, $contextId = null, $withoutSubmissionOnly = false) { - $params = array((int) $userId); + $params = [(int) $userId]; if ($contextId) $params[] = (int) $contextId; $result = $this->retrieve( @@ -91,7 +87,7 @@ function getAll($contextId, $withoutSubmissionOnly = false, $managerCreatedOnly 'SELECT * FROM objects_for_review WHERE context_id = ?' . ($withoutSubmissionOnly?' AND submission_id IS NULL':'') . ($managerCreatedOnly?" AND creator = 'manager'":""), - $contextId + [$contextId] ); return new DAOResultFactory($result, $this, '_fromRow'); } @@ -159,12 +155,12 @@ function updateObject($objectForReview) { function deleteById($objectId) { $this->update( 'DELETE FROM objects_for_review WHERE object_id = ?', - (int) $objectId + [(int) $objectId] ); $this->update( 'DELETE FROM objects_for_review_settings WHERE object_id = ?', - (int) $objectId + [(int) $objectId] ); } diff --git a/controllers/grid/form/ObjectsForReviewForm.inc.php b/controllers/grid/form/ObjectsForReviewForm.inc.php index 0530850..b40f0fb 100755 --- a/controllers/grid/form/ObjectsForReviewForm.inc.php +++ b/controllers/grid/form/ObjectsForReviewForm.inc.php @@ -140,6 +140,7 @@ function execute(...$functionArgs) { $objectForReview->setTitle($title); $objectForReview->setYear($this->getData('year')); $objectForReview->setPublisher($this->getData('publisher')); + $objectForReview->setCreator("workflow"); if ($objectId) { $objectForReviewDao->updateObject($objectForReview); diff --git a/emailTemplates.xml b/emailTemplates.xml index 6fa07f6..355315d 100644 --- a/emailTemplates.xml +++ b/emailTemplates.xml @@ -10,6 +10,6 @@ * Email templates XML file. --> - - + + diff --git a/locale/de_DE/emailTemplates.po b/locale/de_DE/emails.po similarity index 100% rename from locale/de_DE/emailTemplates.po rename to locale/de_DE/emails.po diff --git a/locale/en_US/emailTemplates.po b/locale/en_US/emails.po similarity index 100% rename from locale/en_US/emailTemplates.po rename to locale/en_US/emails.po diff --git a/locale/fi_FI/emailTemplates.po b/locale/fi_FI/emails.po similarity index 100% rename from locale/fi_FI/emailTemplates.po rename to locale/fi_FI/emails.po diff --git a/schema.xml b/schema.xml deleted file mode 100644 index 5360a7a..0000000 --- a/schema.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - List of objects for review -
- - - - - - - - - - - - - - - - (bool|int|float|string|object) - - Objects for review settings. - - object_id - - - object_id - locale - setting_name - - -
-
diff --git a/version.xml b/version.xml index a6c1044..a5b154a 100755 --- a/version.xml +++ b/version.xml @@ -13,8 +13,8 @@ objectsForReview plugins.generic - 3.0.1.0 - 2021-02-21 + 3.3.0.0 + 2023-02-19 1 ObjectsForReviewPlugin