From 9c31eab2dcbc8a60b14a7a3a35c34c79af2c5e12 Mon Sep 17 00:00:00 2001 From: megan_w Date: Thu, 10 Apr 2008 09:56:38 +0000 Subject: [PATCH] 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. --- plugins/ktcore/KTValidators.php | 2 -- plugins/ktcore/folder/addDocument.php | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/ktcore/KTValidators.php b/plugins/ktcore/KTValidators.php index c5b5a3e..06eb766 100644 --- a/plugins/ktcore/KTValidators.php +++ b/plugins/ktcore/KTValidators.php @@ -249,8 +249,6 @@ class KTRequiredFileValidator extends KTValidator { $val = KTUtil::arrayGet($_FILES, $this->sInputVariable); if (empty($val) || empty($val['name'])) { $errors[$this->sBasename] = _kt("You must select a file to upload."); - }else{ - $errors[$this->sBasename] = _kt("Please reselect the file to upload."); } return array( diff --git a/plugins/ktcore/folder/addDocument.php b/plugins/ktcore/folder/addDocument.php index 7f6c1d1..6eaeefa 100644 --- a/plugins/ktcore/folder/addDocument.php +++ b/plugins/ktcore/folder/addDocument.php @@ -185,7 +185,10 @@ class KTFolderAddDocumentAction extends KTFolderAction { $oForm = $this->form_initialdata(); $res = $oForm->validate(); if (!empty($res['errors'])) { - return $oForm->handleError(); + if(!isset($res['errors']['file'])){ + $aError['file'] = array(_kt('Please reselect the file to upload.')); + } + return $oForm->handleError('', $aError); } $data = $res['results']; $key = KTUtil::randomString(32); -- libgit2 0.21.4