Added ption to turn-off auto-match on direct requests

This commit is contained in:
Andreas Kristiansen
2025-08-04 11:47:31 +02:00
parent 4a4b07264d
commit 2fce91899a
3 changed files with 53 additions and 9 deletions

View File

@@ -239,6 +239,7 @@ class User extends CI_Controller {
$data['oqrs_grouped_search'] = $this->input->post('oqrs_grouped_search') ?? 'off';
$data['oqrs_grouped_search_show_station_name'] = $this->input->post('oqrs_grouped_search_show_station_name') ?? 'off';
$data['oqrs_auto_matching'] = $this->input->post('oqrs_auto_matching') ?? 'on';
$data['oqrs_direct_auto_matching'] = $this->input->post('oqrs_direct_auto_matching') ?? 'on';
$this->load->view('user/edit', $data);
} else {
$this->load->view('user/edit', $data);
@@ -302,7 +303,8 @@ class User extends CI_Controller {
$this->input->post('global_oqrs_text') ?? '',
$this->input->post('oqrs_grouped_search') ?? 'off',
$this->input->post('oqrs_grouped_search_show_station_name') ?? 'off',
$this->input->post('oqrs_auto_matching') ?? 'on')
$this->input->post('oqrs_auto_matching') ?? 'on',
$this->input->post('oqrs_direct_auto_matching') ?? 'on')
) {
// Check for errors
case EUSERNAMEEXISTS:
@@ -358,6 +360,8 @@ class User extends CI_Controller {
$data['global_oqrs_text'] = $this->input->post('global_oqrs_text') ?? '';
$data['oqrs_grouped_search'] = $this->input->post('oqrs_grouped_search') ?? 'off';
$data['oqrs_grouped_search_show_station_name'] = $this->input->post('oqrs_grouped_search_show_station_name') ?? 'off';
$data['oqrs_auto_matching'] = $this->input->post('oqrs_auto_matching') ?? 'on';
$data['oqrs_direct_auto_matching'] = $this->input->post('oqrs_direct_auto_matching') ?? 'on';
$this->load->view('user/edit', $data);
$this->load->view('interface_assets/footer', $footerData);
}
@@ -812,6 +816,15 @@ class User extends CI_Controller {
}
}
if($this->input->post('oqrs_direct_auto_matching')) {
$data['oqrs_direct_auto_matching'] = $this->input->post('oqrs_direct_auto_matching', false);
} else {
$qkey_opt = $this->user_options_model->get_options('oqrs',array('option_name'=>'oqrs_direct_auto_matching','option_key'=>'boolean'), $this->uri->segment(3))->result();
if (count($qkey_opt) > 0) {
$data['oqrs_direct_auto_matching'] = $qkey_opt[0]->option_value;
}
}
// [MAP Custom] GET user options //
$options_object = $this->user_options_model->get_options('map_custom')->result();
if (count($options_object)>0) {
@@ -908,6 +921,7 @@ class User extends CI_Controller {
$this->user_options_model->set_option('oqrs', 'oqrs_grouped_search', array('boolean'=>$this->input->post('oqrs_grouped_search', true)));
$this->user_options_model->set_option('oqrs', 'oqrs_grouped_search_show_station_name', array('boolean'=>$this->input->post('oqrs_grouped_search_show_station_name', true)));
$this->user_options_model->set_option('oqrs', 'oqrs_auto_matching', array('boolean'=>$this->input->post('oqrs_auto_matching', true)));
$this->user_options_model->set_option('oqrs', 'oqrs_direct_auto_matching', array('boolean'=>$this->input->post('oqrs_direct_auto_matching', true)));
$this->session->set_flashdata('success', sprintf(__("User %s edited"), $this->input->post('user_name', true)));
redirect('user/edit/'.$this->uri->segment(3));
@@ -965,6 +979,7 @@ class User extends CI_Controller {
$data['oqrs_grouped_search'] = $this->input->post('oqrs_grouped_search', true);
$data['oqrs_grouped_search_show_station_name'] = $this->input->post('oqrs_grouped_search_show_station_name', true);
$data['oqrs_auto_matching'] = $this->input->post('oqrs_auto_matching', true);
$data['oqrs_direct_auto_matching'] = $this->input->post('oqrs_direct_auto_matching', true);
$this->load->view('user/edit');
$this->load->view('interface_assets/footer');

View File

@@ -143,12 +143,16 @@ class Oqrs_model extends CI_Model {
);
if ($this->get_auto_queue_option($postdata['station_id']) == 'on') {
$qsoid = $this->check_oqrs($data);
if($this->get_direct_auto_queue_option($postdata['station_id']) == 'off' && $data['qslroute'] == 'D') {
$data['qsoid'] = 0; // Explicitly set qsoid when skipping auto-queue
} else {
$qsoid = $this->check_oqrs($data);
if ($qsoid > 0) {
$data['status'] = '3';
if ($qsoid > 0) {
$data['status'] = '3';
}
$data['qsoid'] = $qsoid;
}
$data['qsoid'] = $qsoid;
}
// Check if this entry already exists in the oqrs table on the same date
@@ -193,12 +197,16 @@ class Oqrs_model extends CI_Model {
);
if ($this->get_auto_queue_option($qso[4]) == 'on') {
$qsoid = $this->check_oqrs($data);
if($this->get_direct_auto_queue_option($qso[4]) == 'off' && $data['qslroute'] == 'D') {
$data['qsoid'] = 0; // Explicitly set qsoid when skipping auto-queue
} else {
$qsoid = $this->check_oqrs($data);
if ($qsoid > 0) {
$data['status'] = '3';
if ($qsoid > 0) {
$data['status'] = '3';
}
$data['qsoid'] = $qsoid;
}
$data['qsoid'] = $qsoid;
}
// Check if this entry already exists in the oqrs table on the same date
@@ -309,6 +317,18 @@ class Oqrs_model extends CI_Model {
return 'on';
}
function get_direct_auto_queue_option($station_id) {
$this->load->model('stations');
$user = $this->stations->get_user_from_station($station_id);
$qkey_opt = $this->user_options_model->get_options('oqrs',array('option_name'=>'oqrs_direct_auto_matching','option_key'=>'boolean'), $user->user_id)->result();
if (count($qkey_opt) > 0) {
return $qkey_opt[0]->option_value;
}
return 'on';
}
function check_oqrs($qsodata) {
$binding = [];

View File

@@ -717,6 +717,15 @@
</select>
<small id="oqrs_auto_matching_help" class="form-text text-muted"><?= __("If this is on, automatic OQRS matching will happen, and the system will try to match incoming requests with existing logs automatically."); ?></small>
</div>
<div class="mb-3">
<label for="oqrs_direct_auto_matching"><?= __("Automatic OQRS matching for direct requests"); ?></label>
<select name="oqrs_direct_auto_matching" class="form-select" id="oqrs_direct_auto_matching">
<option value="off" <?php if(($oqrs_direct_auto_matching ?? 'on') == "off") { echo "selected=\"selected\""; } ?>><?= __("Off"); ?></option>
<option value="on" <?php if(($oqrs_direct_auto_matching ?? 'on') == "on") { echo "selected=\"selected\""; } ?>><?= __("On"); ?></option>
</select>
<small id="oqrs_direct_auto_matching_help" class="form-text text-muted"><?= __("If this is on, automatic OQRS matching for direct request will happen."); ?></small>
</div>
</div>
</div>
</div>