From 86eab6287d4d63dfa1fee1055dee4b55d27c4ada Mon Sep 17 00:00:00 2001 From: Joshua Perry <45966243+jpez-development@users.noreply.github.com> Date: Sun, 5 Feb 2023 12:05:49 +0000 Subject: [PATCH] fix --- jobs/controllers/Jobs.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jobs/controllers/Jobs.php b/jobs/controllers/Jobs.php index 9451be2..ec9820d 100644 --- a/jobs/controllers/Jobs.php +++ b/jobs/controllers/Jobs.php @@ -37,7 +37,7 @@ class Jobs { $this->vars['jobs'] = $this->jobsTable->find($columns, $values, $comparators); } else { - $this->vars['jobs'] = $this->jobsTable->find(['categoryId', "closingDate"], ["value0" => $cat[0]->id, "value1" => date("y-m-d")], ["=", ">"]); + $this->vars['jobs'] = $this->jobsTable->find(['categoryId', 'closingDate'], ["value0" => $cat[0]->id, "value1" => date("y-m-d")], ["=", ">"]); } $this->vars['heading'] = $cat[0]->name; @@ -85,8 +85,13 @@ class Jobs { 'jobId' => $_POST['jobId'], 'cv' => $fileName ]; - $this->appsTable->save($record); - $this->vars['response'] = 'Your application is complete. We will contact you after the closing date.'; + if (count($this->appsTable->find(['email', 'jobId'], ['value0' => $_POST['email'], 'value1' => $_POST['jobId']])) > 0) { + $this->vars['response'] = 'You have already applied for this job'; + } + else { + $this->appsTable->save($record); + $this->vars['response'] = 'Your application is complete. We will contact you after the closing date.'; + } } else { $this->vars['response'] = 'There was an error uploading your CV';