Commit 9c31eab2dcbc8a60b14a7a3a35c34c79af2c5e12

Authored by megan_w
1 parent 2f47e6c9

KTS-3191

"Add Document: Missing Document type deletes source File selection"
Fixed. Moved the message from the validation to addDocument. It now only appears if there are other errors in the form.

Committed by: Megan Watson
Reviewed by: Jonathan Byrne



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8360 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/KTValidators.php
@@ -249,8 +249,6 @@ class KTRequiredFileValidator extends KTValidator { @@ -249,8 +249,6 @@ class KTRequiredFileValidator extends KTValidator {
249 $val = KTUtil::arrayGet($_FILES, $this->sInputVariable); 249 $val = KTUtil::arrayGet($_FILES, $this->sInputVariable);
250 if (empty($val) || empty($val['name'])) { 250 if (empty($val) || empty($val['name'])) {
251 $errors[$this->sBasename] = _kt("You must select a file to upload."); 251 $errors[$this->sBasename] = _kt("You must select a file to upload.");
252 - }else{  
253 - $errors[$this->sBasename] = _kt("Please reselect the file to upload.");  
254 } 252 }
255 253
256 return array( 254 return array(
plugins/ktcore/folder/addDocument.php
@@ -185,7 +185,10 @@ class KTFolderAddDocumentAction extends KTFolderAction { @@ -185,7 +185,10 @@ class KTFolderAddDocumentAction extends KTFolderAction {
185 $oForm = $this->form_initialdata(); 185 $oForm = $this->form_initialdata();
186 $res = $oForm->validate(); 186 $res = $oForm->validate();
187 if (!empty($res['errors'])) { 187 if (!empty($res['errors'])) {
188 - return $oForm->handleError(); 188 + if(!isset($res['errors']['file'])){
  189 + $aError['file'] = array(_kt('Please reselect the file to upload.'));
  190 + }
  191 + return $oForm->handleError('', $aError);
189 } 192 }
190 $data = $res['results']; 193 $data = $res['results'];
191 $key = KTUtil::randomString(32); 194 $key = KTUtil::randomString(32);