diff --git a/DeleteIncompleteSubmissionsPlugin.inc.php b/DeleteIncompleteSubmissionsPlugin.php similarity index 75% rename from DeleteIncompleteSubmissionsPlugin.inc.php rename to DeleteIncompleteSubmissionsPlugin.php index 07012b4..788e6b2 100644 --- a/DeleteIncompleteSubmissionsPlugin.inc.php +++ b/DeleteIncompleteSubmissionsPlugin.php @@ -1,6 +1,24 @@ getRouter(); - import('lib.pkp.classes.linkAction.request.AjaxModal'); return array_merge( $this->getEnabled() ? [ new LinkAction( @@ -51,7 +68,6 @@ public function manage($args, $request) switch ($request->getUserVar('verb')) { case 'deletion': $context = $request->getContext(); - $this->import('form.DeleteIncompleteSubmissionsSettingsForm'); $form = new DeleteIncompleteSubmissionsSettingsForm($this, $context->getId()); if ($request->getUserVar('save')) { diff --git a/README.md b/README.md index 029f90d..cb3ad74 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,13 @@ This plugin allows editors to delete incomplete submissions from the journal. +It allows the editor to set a threshold, in days, to safeguard the deletion of submissions that are not meant to be deleted at the moment. + # Compatibility -This plugin is compatible with OJS 3.3.0 +This plugin is compatible with **OJS 3.4.0** + +For compatibility with other versions of OJS, please refer to this repository branches. # Installation @@ -14,7 +18,7 @@ Upload the package in the `Website > Plugins` section of the Dashboard. # Usage -After installing the plugin, it will appear in the plugins list, from there, activate the plugin, then expand the options in the arrow, and click on the `Delete submissions...` option: +After installing the plugin, it will appear in the plugins list, from there, activate the plugin, then expand the options in the arrow, and click on the ***`Delete submissions...`*** action: ![](screenshots/plugin-options.png) diff --git a/index.php b/index.php deleted file mode 100644 index 6006655..0000000 --- a/index.php +++ /dev/null @@ -1,20 +0,0 @@ -getMany([ - 'contextId' => $this->contextId, 'isIncomplete' => true, 'daysInactive' => $deletionThreshold - ]); - - foreach ($submissions as $submission) { - try { - $submissionService->delete($submission); - } catch (\Throwable $th) { - error_log('The submission ' . $submission->getId() . ' was not deleted. Reason:' . $th->getMessage()); + $submissions = Repo::submission() + ->getCollector() + ->filterByContextIds([$this->contextId]) + ->filterByIncomplete(true) + ->filterByDaysInactive($deletionThreshold) + ->getMany(); + + try { + foreach ($submissions as $submission) { + Repo::submission()->delete($submission); } + } catch (\Throwable $th) { + error_log('The submission ' . $submission->getId() . ' was not deleted. Reason:' . $th->getMessage()); } } } diff --git a/version.xml b/version.xml index 8db5fba..fcf95b5 100644 --- a/version.xml +++ b/version.xml @@ -13,6 +13,6 @@ deleteIncompleteSubmissions plugins.generic - 0.1.3.0 - 2024-02-14 + 0.2.0.0 + 2024-06-20 \ No newline at end of file