Merge pull request #537 from mbridak/fix_dxcc_exceptions
Fix calls showing in the wrong dxcc region.
这个提交包含在:
当前提交
2393954b99
共有 1 个文件被更改,包括 23 次插入 和 10 次删除
|
|
@ -1915,6 +1915,18 @@ class Logbook_model extends CI_Model {
|
||||||
public function check_dxcc_table($call, $date){
|
public function check_dxcc_table($call, $date){
|
||||||
$len = strlen($call);
|
$len = strlen($call);
|
||||||
|
|
||||||
|
$dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`')
|
||||||
|
->where('call', $call)
|
||||||
|
->where('(start <= ', $date)
|
||||||
|
->or_where('start is null)', NULL, false)
|
||||||
|
->where('(end >= ', $date)
|
||||||
|
->or_where('end is null)', NULL, false)
|
||||||
|
->get('dxcc_exceptions');
|
||||||
|
|
||||||
|
if ($dxcc_exceptions->num_rows() > 0){
|
||||||
|
$row = $dxcc_exceptions->row_array();
|
||||||
|
return array($row['adif'], $row['entity'], $row['cqz']);
|
||||||
|
}
|
||||||
// query the table, removing a character from the right until a match
|
// query the table, removing a character from the right until a match
|
||||||
for ($i = $len; $i > 0; $i--){
|
for ($i = $len; $i > 0; $i--){
|
||||||
//printf("searching for %s\n", substr($call, 0, $i));
|
//printf("searching for %s\n", substr($call, 0, $i));
|
||||||
|
|
@ -1941,16 +1953,17 @@ class Logbook_model extends CI_Model {
|
||||||
public function dxcc_lookup($call, $date){
|
public function dxcc_lookup($call, $date){
|
||||||
$len = strlen($call);
|
$len = strlen($call);
|
||||||
|
|
||||||
$this->db->where('call', $call);
|
$dxcc_exceptions = $this->db->select('`entity`, `adif`, `cqz`')
|
||||||
$this->db->where('CURDATE() between start and end');
|
->where('call', $call)
|
||||||
|
->where('(start <= CURDATE()')
|
||||||
$query = $this->db->get('dxcc_exceptions');
|
->or_where('start is null', NULL, false)
|
||||||
|
->where('end >= CURDATE()')
|
||||||
|
->or_where('end is null)', NULL, false)
|
||||||
|
->get('dxcc_exceptions');
|
||||||
|
|
||||||
|
|
||||||
if ($query->num_rows() > 0){
|
if ($dxcc_exceptions->num_rows() > 0){
|
||||||
|
$row = $dxcc_exceptions->row_array();
|
||||||
$row = $query->row_array();
|
|
||||||
|
|
||||||
return $row;
|
return $row;
|
||||||
} else {
|
} else {
|
||||||
// query the table, removing a character from the right until a match
|
// query the table, removing a character from the right until a match
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用