diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index a9d3da43..3e33e787 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -421,8 +421,9 @@ class Awards extends CI_Controller { $data['bands'] = $bands; // Used for displaying selected band(s) in the table in the view if($this->input->method() === 'post') { - $postdata['lotw'] = $this->input->post('lotw'); $postdata['qsl'] = $this->input->post('qsl'); + $postdata['lotw'] = $this->input->post('lotw'); + $postdata['eqsl'] = $this->input->post('eqsl'); $postdata['worked'] = $this->input->post('worked'); $postdata['confirmed'] = $this->input->post('confirmed'); $postdata['notworked'] = $this->input->post('notworked'); @@ -430,8 +431,9 @@ class Awards extends CI_Controller { $postdata['mode'] = $this->input->post('mode'); } else { // Setting default values at first load of page - $postdata['lotw'] = 1; $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; @@ -615,8 +617,9 @@ class Awards extends CI_Controller { $bands[] = $band_type; - $postdata['lotw'] = 1; $postdata['qsl'] = 1; + $postdata['lotw'] = 1; + $postdata['eqsl'] = 0; $postdata['worked'] = 1; $postdata['confirmed'] = 1; $postdata['notworked'] = 1; diff --git a/application/models/Was.php b/application/models/Was.php index fc3d9f28..34686121 100644 --- a/application/models/Was.php +++ b/application/models/Was.php @@ -19,6 +19,19 @@ class was extends CI_Model { $states = array(); // Used for keeping track of which states that are not worked + $qsl = ""; + if ($postdata['confirmed'] != NULL) { + if ($postdata['qsl'] != NULL ) { + $qsl .= "Q"; + } + if ($postdata['lotw'] != NULL ) { + $qsl .= "L"; + } + if ($postdata['eqsl'] != NULL ) { + $qsl .= "E"; + } + } + foreach ($stateArray as $state) { // Generating array for use in the table $states[$state]['count'] = 0; // Inits each state's count } @@ -32,14 +45,14 @@ class was extends CI_Model { if ($postdata['worked'] != NULL) { $wasBand = $this->getWasWorked($location_list, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = '
'; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } if ($postdata['confirmed'] != NULL) { $wasBand = $this->getWasConfirmed($location_list, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = ''; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } @@ -238,16 +251,20 @@ class was extends CI_Model { function addQslToQuery($postdata) { $sql = ''; - if ($postdata['lotw'] != NULL and $postdata['qsl'] == NULL) { - $sql .= " and col_lotw_qsl_rcvd = 'Y'"; - } - - if ($postdata['qsl'] != NULL and $postdata['lotw'] == NULL) { - $sql .= " and col_qsl_rcvd = 'Y'"; - } - - if ($postdata['qsl'] != NULL && $postdata['lotw'] != NULL) { - $sql .= " and (col_qsl_rcvd = 'Y' or col_lotw_qsl_rcvd = 'Y')"; + $qsl = array(); + if ($postdata['lotw'] != NULL || $postdata['qsl'] != NULL || $postdata['eqsl'] != NULL) { + $sql .= ' and ('; + if ($postdata['qsl'] != NULL) { + array_push($qsl, "col_qsl_rcvd = 'Y'"); + } + if ($postdata['lotw'] != NULL) { + array_push($qsl, "col_lotw_qsl_rcvd = 'Y'"); + } + if ($postdata['eqsl'] != NULL) { + array_push($qsl, "col_eqsl_qsl_rcvd = 'Y'"); + } + $sql .= implode(' or ', $qsl); + $sql .= ')'; } return $sql; } diff --git a/application/views/awards/was/index.php b/application/views/awards/was/index.php index 22e8bb99..410d4190 100644 --- a/application/views/awards/was/index.php +++ b/application/views/awards/was/index.php @@ -24,7 +24,7 @@