66use PKP \form \Form ;
77use PKP \form \validation \FormValidatorCSRF ;
88use PKP \form \validation \FormValidatorPost ;
9+ use PKP \form \validation \FormValidatorCustom ;
910use APP \core \Application ;
1011use APP \facades \Repo ;
1112
@@ -26,6 +27,23 @@ public function __construct($plugin, $contextId)
2627
2728 $ this ->addCheck (new FormValidatorPost ($ this ));
2829 $ this ->addCheck (new FormValidatorCSRF ($ this ));
30+ $ this ->addCheck (new FormValidatorCustom (
31+ $ this ,
32+ 'deletionThreshold ' ,
33+ 'required ' ,
34+ 'plugins.generic.deleteIncompleteSubmissions.validation.integer ' ,
35+ function ($ deletionThreshold ) {
36+ if (is_int ($ deletionThreshold )) {
37+ return $ deletionThreshold > 0 ;
38+ }
39+
40+ if (!is_string ($ deletionThreshold ) || !preg_match ('/^\d+$/ ' , $ deletionThreshold )) {
41+ return false ;
42+ }
43+
44+ return (int ) $ deletionThreshold > 0 ;
45+ }
46+ ));
2947 }
3048
3149 public function readInputData ()
@@ -38,7 +56,6 @@ public function fetch($request, $template = null, $display = false)
3856 $ templateMgr = TemplateManager::getManager ($ request );
3957 $ templateMgr ->assign ('pluginName ' , $ this ->plugin ->getName ());
4058 $ templateMgr ->assign ('applicationName ' , Application::get ()->getName ());
41- $ templateMgr ->assign ('thresholdValues ' , range (0 , 60 ));
4259 $ templateMgr ->assign ('defaultThreshold ' , 15 );
4360
4461 return parent ::fetch ($ request , $ template , $ display );
0 commit comments