diff --git a/application/config/migration.php b/application/config/migration.php
index 9399b8d87..2eb36735a 100644
--- a/application/config/migration.php
+++ b/application/config/migration.php
@@ -22,7 +22,7 @@ $config['migration_enabled'] = TRUE;
|
*/
-$config['migration_version'] = 198;
+$config['migration_version'] = 199;
/*
|--------------------------------------------------------------------------
diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php
index 075910ec6..c47847d4d 100644
--- a/application/controllers/Lotw.php
+++ b/application/controllers/Lotw.php
@@ -314,14 +314,14 @@ class Lotw extends CI_Controller {
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
//Execute the request
$result = curl_exec($ch);
- //If an error occured, throw an exception
- //with the error message.
if(curl_errno($ch)){
- throw new Exception(curl_error($ch));
+ echo $station_profile->station_callsign." (".$station_profile->station_profile_name.") Upload Failed"."
";
+ $this->LotwCert->last_upload($data['lotw_cert_info']->lotw_cert_id, "Upload failed");
}
$pos = strpos($result, "");
@@ -329,12 +329,13 @@ class Lotw extends CI_Controller {
if ($pos === false) {
// Upload of TQ8 Failed for unknown reason
echo $station_profile->station_callsign." (".$station_profile->station_profile_name.") Upload Failed"."
";
+ $this->LotwCert->last_upload($data['lotw_cert_info']->lotw_cert_id, "Upload failed");
} else {
// Upload of TQ8 was successfull
echo "Upload Successful - ".$filename_for_saving."
";
- $this->LotwCert->last_upload($data['lotw_cert_info']->lotw_cert_id);
+ $this->LotwCert->last_upload($data['lotw_cert_info']->lotw_cert_id, "Success");
// Mark QSOs as Sent
foreach ($qso_id_array as $qso_number) {
diff --git a/application/language/dutch/lotw_lang.php b/application/language/dutch/lotw_lang.php
index d7c2488a8..2bc3518ac 100644
--- a/application/language/dutch/lotw_lang.php
+++ b/application/language/dutch/lotw_lang.php
@@ -18,7 +18,7 @@ $lang['lotw_date_created'] = 'Date Created';
$lang['lotw_date_expires'] = 'Date Expires';
$lang['lotw_qso_start_date'] = 'QSO Start Date';
$lang['lotw_qso_end_date'] = 'QSO End Date';
-$lang['lotw_status'] = 'Status / Last upload';
+$lang['lotw_status'] = 'Status';
$lang['lotw_options'] = 'Options';
$lang['lotw_valid'] = 'Valid';
$lang['lotw_expired'] = 'Expired';
diff --git a/application/language/english/lotw_lang.php b/application/language/english/lotw_lang.php
index ce3d63fe2..98f963dd2 100644
--- a/application/language/english/lotw_lang.php
+++ b/application/language/english/lotw_lang.php
@@ -18,7 +18,7 @@ $lang['lotw_date_created'] = 'Date Created';
$lang['lotw_date_expires'] = 'Date Expires';
$lang['lotw_qso_start_date'] = 'QSO Start Date';
$lang['lotw_qso_end_date'] = 'QSO End Date';
-$lang['lotw_status'] = 'Status / Last upload';
+$lang['lotw_status'] = 'Status';
$lang['lotw_options'] = 'Options';
$lang['lotw_valid'] = 'Valid';
$lang['lotw_expired'] = 'Expired';
@@ -60,7 +60,7 @@ $lang['lotw_cert_expired'] = 'At least one of your LoTW certificates is expired!
// Lotw User
$lang['lotw_user'] = 'This station uses LoTW.';
-$lang['lotw_last_upload'] = 'Last upload';
+$lang['lotw_last_upload'] = 'Last Upload';
// Upload folder permissions
$lang['lotw_upload_folder_permissions'] = 'Upload folder is not writable. Please contact your admin.';
diff --git a/application/language/finnish/lotw_lang.php b/application/language/finnish/lotw_lang.php
index 9f10ca4f2..93c231fa4 100644
--- a/application/language/finnish/lotw_lang.php
+++ b/application/language/finnish/lotw_lang.php
@@ -18,7 +18,7 @@ $lang['lotw_date_created'] = 'Päivä jolloin luotu';
$lang['lotw_date_expires'] = 'Päivä joloin vanhenee';
$lang['lotw_qso_start_date'] = 'QSO aloituspäivä';
$lang['lotw_qso_end_date'] = 'QSO lopetuspäivä';
-$lang['lotw_status'] = 'Status / Last upload';
+$lang['lotw_status'] = 'Status';
$lang['lotw_options'] = 'Lisävaihtoehdot';
$lang['lotw_valid'] = 'Voimassa';
$lang['lotw_expired'] = 'Vanhentunut';
diff --git a/application/language/german/lotw_lang.php b/application/language/german/lotw_lang.php
index 3b281051a..666ef9461 100644
--- a/application/language/german/lotw_lang.php
+++ b/application/language/german/lotw_lang.php
@@ -18,7 +18,7 @@ $lang['lotw_date_created'] = 'Ausstellungsdatum';
$lang['lotw_date_expires'] = 'Ablaufdatum';
$lang['lotw_qso_start_date'] = 'QSO Startdatum';
$lang['lotw_qso_end_date'] = 'QSO Enddatum';
-$lang['lotw_status'] = 'Status / Letzter Upload';
+$lang['lotw_status'] = 'Status';
$lang['lotw_options'] = 'Optionen';
$lang['lotw_valid'] = 'Gültig';
$lang['lotw_expired'] = 'Abgelaufen';
diff --git a/application/language/greek/lotw_lang.php b/application/language/greek/lotw_lang.php
index 5bdc75bbf..c0dee7fa4 100644
--- a/application/language/greek/lotw_lang.php
+++ b/application/language/greek/lotw_lang.php
@@ -18,7 +18,7 @@ $lang['lotw_date_created'] = 'Ημερομηνία Δημιουργίας';
$lang['lotw_date_expires'] = 'Ημερομηνία Λήξης ';
$lang['lotw_qso_start_date'] = 'Ημερομηνία έναρξης QSO';
$lang['lotw_qso_end_date'] = 'Ημερομηνία λήξης QSO';
-$lang['lotw_status'] = 'Κατάσταση / Τελευταία μεταφόρτωση';
+$lang['lotw_status'] = 'Κατάσταση';
$lang['lotw_options'] = 'Επιλογές';
$lang['lotw_valid'] = 'Εγκυρος';
$lang['lotw_expired'] = 'Ληγμένο';
@@ -60,7 +60,7 @@ $lang['lotw_cert_expired'] = 'Τουλάχιστον ένα από τα πιστ
// Lotw User
$lang['lotw_user'] = 'This station uses LoTW.';
-$lang['lotw_last_upload'] = 'Last upload';
+$lang['lotw_last_upload'] = 'Τελευταία μεταφόρτωση';
// Upload folder permissions
$lang['lotw_upload_folder_permissions'] = 'Upload folder is not writable. Please contact your admin.';
diff --git a/application/migrations/199_add_lotw_upload_status_message.php b/application/migrations/199_add_lotw_upload_status_message.php
new file mode 100644
index 000000000..5074bc5cc
--- /dev/null
+++ b/application/migrations/199_add_lotw_upload_status_message.php
@@ -0,0 +1,35 @@
+db->field_exists('last_upload_fail', 'lotw_certs')) {
+ $fields = array(
+ 'last_upload_fail DATETIME NULL DEFAULT NULL AFTER `last_upload`'
+ );
+ $this->dbforge->add_column('lotw_certs', $fields);
+ }
+ if (!$this->db->field_exists('last_upload_status', 'lotw_certs')) {
+ $fields = array(
+ 'last_upload_status VARCHAR(50) NULL DEFAULT NULL AFTER `last_upload_fail`',
+ );
+ $this->dbforge->add_column('lotw_certs', $fields);
+ }
+ }
+
+ public function down()
+ {
+ if ($this->db->field_exists('last_upload_fail', 'lotw_certs')) {
+ $this->dbforge->drop_column('lotw_certs', 'last_upload_fail');
+ }
+ if ($this->db->field_exists('last_upload_status', 'lotw_certs')) {
+ $this->dbforge->drop_column('lotw_certs', 'last_upload_status');
+ }
+ }
+}
diff --git a/application/models/LotwCert.php b/application/models/LotwCert.php
index 1dab45159..1b46901f1 100644
--- a/application/models/LotwCert.php
+++ b/application/models/LotwCert.php
@@ -12,7 +12,7 @@ class LotwCert extends CI_Model {
*/
function lotw_certs($user_id) {
- $this->db->select('lotw_certs.lotw_cert_id as lotw_cert_id, lotw_certs.callsign as callsign, dxcc_entities.name as cert_dxcc, dxcc_entities.end as cert_dxcc_end, lotw_certs.qso_start_date as qso_start_date, lotw_certs.qso_end_date as qso_end_date, lotw_certs.date_created as date_created, lotw_certs.date_expires as date_expires, lotw_certs.last_upload as last_upload');
+ $this->db->select('lotw_certs.lotw_cert_id as lotw_cert_id, lotw_certs.callsign as callsign, dxcc_entities.name as cert_dxcc, dxcc_entities.end as cert_dxcc_end, lotw_certs.qso_start_date as qso_start_date, lotw_certs.qso_end_date as qso_end_date, lotw_certs.date_created as date_created, lotw_certs.date_expires as date_expires, lotw_certs.last_upload as last_upload, lotw_certs.last_upload_fail as last_upload_fail, lotw_certs.last_upload_status as last_upload_status');
$this->db->where('user_id', $user_id);
$this->db->join('dxcc_entities','lotw_certs.cert_dxcc_id = dxcc_entities.adif','left');
$this->db->order_by('cert_dxcc', 'ASC');
@@ -77,19 +77,29 @@ class LotwCert extends CI_Model {
$this->db->delete('lotw_certs');
}
- function last_upload($certID) {
+ function last_upload($certID, $message) {
- $data = array(
- 'last_upload' => date("Y-m-d H:i:s"),
- );
+ if ($message == "Success") {
+ $data = array(
+ 'last_upload' => date("Y-m-d H:i:s"),
+ 'last_upload_status' => $message,
+ );
+ $this->db->where('lotw_cert_id', $certID);
+ $this->db->update('lotw_certs', $data);
+ return "Updated";
+ }
+ else if ($message == "Upload failed") {
+ $data = array(
+ 'last_upload_fail' => date("Y-m-d H:i:s"),
+ 'last_upload_status' => $message,
+ );
- $this->db->where('lotw_cert_id', $certID);
-
- $this->db->update('lotw_certs', $data);
-
- return "Updated";
- }
+ $this->db->where('lotw_cert_id', $certID);
+ $this->db->update('lotw_certs', $data);
+ return "Updated";
+ }
+ }
function empty_table($table) {
$this->db->empty_table($table);
diff --git a/application/views/lotw_views/index.php b/application/views/lotw_views/index.php
index 64a53a166..a6e9869df 100644
--- a/application/views/lotw_views/index.php
+++ b/application/views/lotw_views/index.php
@@ -40,6 +40,7 @@