diff --git a/application/controllers/Api.php b/application/controllers/Api.php index 2eaf99a7..a69bd561 100644 --- a/application/controllers/Api.php +++ b/application/controllers/Api.php @@ -5,38 +5,7 @@ class API extends CI_Controller { // Do absolutely nothing function index() { - } - - /* - TODOs - - Search Callsign (Return Json) - - Add QSO return json - */ - - - function search_callsign($callsign) { - $this->db->select('COL_PRIMARY_KEY, COL_CALL, COL_MODE, COL_SUBMODE, COL_BAND, COL_COUNTRY, COL_FREQ, COL_GRIDSQUARE, COL_RST_RCVD, COL_RST_SENT, COL_SAT_MODE, COL_SAT_NAME'); - //$this->db->select("DATE_FORMAT(COL_TIME_ON, '%H:%i') AS time_on", FALSE ); - //$this->db->select("DATE_FORMAT(COL_TIME_ON, '%d/%c/%Y') AS date_on", FALSE ); - $this->db->like('COL_CALL', $callsign); - $this->db->or_like('COL_GRIDSQUARE', $callsign); - $query = $this->db->get($this->config->item('table_name')); - - - $results = array(); - - foreach ($query->result() as $result) - { - $results[] = $result; - } - - header('Content-type: application/json'); - - //$arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5); - echo $_GET['jsoncallback'].'('.json_encode($results).')'; //assign resulting code to $_GET['jsoncallback]. - - //echo json_encode($results); - + echo "nothing to see"; } function help() diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 736fc077..1bb0432c 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -104,6 +104,7 @@ class Logbookadvanced extends CI_Controller { 'propmode' => xss_clean($this->input->post('propmode')), 'gridsquare' => xss_clean($this->input->post('gridsquare')), 'state' => xss_clean($this->input->post('state')), + 'cqzone' => xss_clean($this->input->post('cqzone')), 'qsoresults' => xss_clean($this->input->post('qsoresults')), 'sats' => xss_clean($this->input->post('sats')), 'lotwSent' => xss_clean($this->input->post('lotwSent')), diff --git a/application/controllers/Qrz.php b/application/controllers/Qrz.php index 13d35421..68eb29db 100644 --- a/application/controllers/Qrz.php +++ b/application/controllers/Qrz.php @@ -71,9 +71,15 @@ class Qrz extends CI_Controller { $result = $this->logbook_model->push_qso_to_qrz($qrz_api_key, $adif); } - if ($result['status'] == 'OK') { + if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') && ($result['message'] == 'STATUS=FAIL&REASON=Unable to add QSO to database: duplicate&EXTENDED=')) ){ $this->markqso($qso->COL_PRIMARY_KEY); $i++; + } elseif ( ($result['status']=='error') && (substr($result['message'],0,11) == 'STATUS=AUTH')) { + log_message('error', 'QRZ upload failed for qso: Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON); + log_message('error', 'QRZ upload failed with the following message: ' .$result['message']); + log_message('error', 'QRZ upload stopped for Station_ID: ' .$station_id); + $errormessages[] = $result['message'] . ' Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON; + break; /* If key is invalid, immediate stop syncing for more QSOs of this station */ } else { log_message('error', 'QRZ upload failed for qso: Call: ' . $qso->COL_CALL . ' Band: ' . $qso->COL_BAND . ' Mode: ' . $qso->COL_MODE . ' Time: ' . $qso->COL_TIME_ON); log_message('error', 'QRZ upload failed with the following message: ' .$result['message']); diff --git a/application/controllers/Update.php b/application/controllers/Update.php index 59c914de..cd56804c 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -189,7 +189,7 @@ class Update extends CI_Controller { gzclose($gz); if (file_put_contents($this->make_update_path("cty.xml"), $data) === FALSE) { - $this->update_status("FAILED: Could not write to LoTW users file"); + $this->update_status("FAILED: Could not write to cty.xml file"); return; } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index e612c5ff..400b2197 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -519,7 +519,7 @@ class Logbook_model extends CI_Model { $adif = $CI->adifhelper->getAdifLine($qso[0]); $result = $this->push_qso_to_qrz($result->qrzapikey, $adif); - if ($result['status'] == 'OK') { + if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') && ($result['message'] == 'STATUS=FAIL&REASON=Unable to add QSO to database: duplicate&EXTENDED=')) ){ $this->mark_qrz_qsos_sent($last_id); } } diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index cc361181..8fb7f61d 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -89,6 +89,11 @@ class Logbookadvanced_model extends CI_Model { $binding[] = $searchCriteria['state']; } + if ($searchCriteria['cqzone'] !== '') { + $conditions[] = "COL_CQZ = ?"; + $binding[] = $searchCriteria['cqzone']; + } + if ($searchCriteria['gridsquare'] !== '') { $conditions[] = "(COL_GRIDSQUARE like ? or COL_VUCC_GRIDS like ?)"; $binding[] = '%' . $searchCriteria['gridsquare'] . '%'; diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 671ba95c..894e2483 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -144,6 +144,18 @@ +