From 91c172f315b511d6f8cd36f18d9ae68acc4ad50c Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 26 Aug 2020 21:20:58 +0100 Subject: [PATCH] Update Last_Upload field inside lotw_cert table when tq8 upload is successful --- application/controllers/Lotw.php | 2 ++ application/models/LotwCert.php | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index 2a464193..57de9e80 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -253,6 +253,8 @@ class Lotw extends CI_Controller { echo "Upload Successful - ".$filename_for_saving; + $this->LotwCert->last_upload($data['lotw_cert_info']->lotw_cert_id); + // Mark QSOs as Sent foreach ($qso_id_array as $qso_number) { $this->Logbook_model->mark_lotw_sent($qso_number); diff --git a/application/models/LotwCert.php b/application/models/LotwCert.php index c43b7f83..6cb1c2a1 100644 --- a/application/models/LotwCert.php +++ b/application/models/LotwCert.php @@ -73,6 +73,20 @@ class LotwCert extends CI_Model { $this->db->where('user_id', $user_id); $this->db->delete('lotw_certs'); } + + function last_upload($certID) { + + $data = array( + 'last_upload' => date("Y-m-d H:i:s"), + ); + + + $this->db->where('lotw_cert_id', $certID); + + $this->db->update('lotw_certs', $data); + + return "Updated"; + } function empty_table($table) { $this->db->empty_table($table);