diff --git a/application/config/migration.php b/application/config/migration.php index e7a709b2..63903572 100644 --- a/application/config/migration.php +++ b/application/config/migration.php @@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE; | be upgraded / downgraded to. | */ -$config['migration_version'] = 98; +$config['migration_version'] = 99; /* |-------------------------------------------------------------------------- diff --git a/application/controllers/Band.php b/application/controllers/Band.php index 910561a6..acce57b8 100644 --- a/application/controllers/Band.php +++ b/application/controllers/Band.php @@ -127,6 +127,7 @@ class Band extends CI_Controller { $band['sota'] = $this->security->xss_clean($this->input->post('sota')); $band['uscounties'] = $this->security->xss_clean($this->input->post('uscounties')); $band['was'] = $this->security->xss_clean($this->input->post('was')); + $band['wwff'] = $this->security->xss_clean($this->input->post('wwff')); $band['vucc'] = $this->security->xss_clean($this->input->post('vucc')); $this->load->model('bands'); diff --git a/application/migrations/099_add_wwff_to_bandxuser.php b/application/migrations/099_add_wwff_to_bandxuser.php new file mode 100644 index 00000000..8faa8333 --- /dev/null +++ b/application/migrations/099_add_wwff_to_bandxuser.php @@ -0,0 +1,26 @@ +db->field_exists('wwff', 'bandxuser')) { + $fields = array( + 'wwff' => array( + 'type' => 'INT', + 'constraint' => 20, + 'unsigned' => TRUE, + ), + ); + $this->dbforge->add_column('bandxuser', $fields); + + $this->db->query("update bandxuser set wwff = 1"); + } + } + + public function down() + { + $this->dbforge->drop_column('bandxuser', 'wwff'); + } +} diff --git a/application/models/Bands.php b/application/models/Bands.php index 8a9b2344..a31582e5 100644 --- a/application/models/Bands.php +++ b/application/models/Bands.php @@ -251,6 +251,7 @@ class Bands extends CI_Model { 'sota' => $band['sota'] == "true" ? '1' : '0', 'uscounties' => $band['uscounties'] == "true" ? '1' : '0', 'was' => $band['was'] == "true" ? '1' : '0', + 'wwff' => $band['wwff'] == "true" ? '1' : '0', 'vucc' => $band['vucc'] == "true" ? '1' : '0' ); @@ -278,8 +279,8 @@ class Bands extends CI_Model { $this->db->insert('bands', $data); } - $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, vucc) - select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);"); + $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, wwff, vucc) + select bands.id, " . $this->session->userdata('user_id') . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands where band ='".$data['band']."' and not exists (select 1 from bandxuser where userid = " . $this->session->userdata('user_id') . " and bandid = bands.id);"); } function getband($id) { diff --git a/application/models/User_model.php b/application/models/User_model.php index 136739e0..2292ed0b 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -152,7 +152,7 @@ class User_Model extends CI_Model { // Add user and insert bandsettings for user $this->db->insert($this->config->item('auth_table'), $data); $insert_id = $this->db->insert_id(); - $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); + $this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); return OK; } else { return EUSERNAMEEXISTS; diff --git a/application/models/Wwff.php b/application/models/Wwff.php index f34bfaba..93908d7e 100644 --- a/application/models/Wwff.php +++ b/application/models/Wwff.php @@ -11,7 +11,12 @@ class Wwff extends CI_Model { return null; } + $this->load->model('bands'); + + $bandslots = $this->bands->get_worked_bands('wwff'); + $this->db->where_in("station_id", $logbooks_locations_array); + $this->db->where_in("col_band", $bandslots); $this->db->order_by("COL_WWFF_REF", "ASC"); $this->db->where('COL_WWFF_REF !=', ''); diff --git a/application/views/bands/index.php b/application/views/bands/index.php index 0c9faefd..ad01691e 100644 --- a/application/views/bands/index.php +++ b/application/views/bands/index.php @@ -35,8 +35,9 @@ SIG SOTA US Counties - WAS VUCC + WAS + WWFF Bandgroup SSB QRG DATA QRG @@ -57,8 +58,9 @@ sig == 1) {echo 'checked';}?>> sota == 1) {echo 'checked';}?>> uscounties == 1) {echo 'checked';}?>> - was == 1) {echo 'checked';}?>> vucc == 1) {echo 'checked';}?>> + was == 1) {echo 'checked';}?>> + wwff == 1) {echo 'checked';}?>> bandgroup;?> ssb;?> data;?>