Fix for Logbook Model - now loads without a logbook defined. Fixed #1481

这个提交包含在:
Andreas 2022-07-02 23:40:04 +02:00
父节点 c8c7aab2c6
当前提交 a28eb44ac4
共有 4 个文件被更改,包括 18 次插入11 次删除

查看文件

@ -1018,7 +1018,10 @@ class Logbook_model extends CI_Model {
$logbooks_locations_array = $StationLocationsArray; $logbooks_locations_array = $StationLocationsArray;
} }
//$this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_NAME, '.$this->config->item('table_name').'.COL_COUNTRY, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*'); if (empty($logbooks_locations_array)) {
return array();
}
$this->db->from($this->config->item('table_name')); $this->db->from($this->config->item('table_name'));
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');

查看文件

@ -207,7 +207,7 @@ class Logbooks_model extends CI_Model {
return $relationships_array; return $relationships_array;
} }
else{ else{
return false; return array();
} }
} }

查看文件

@ -1,7 +1,10 @@
<div class="container logbook"> <div class="container logbook">
<h2><?php echo $this->lang->line('gen_hamradio_logbook'); ?></h2> <h2><?php echo $this->lang->line('gen_hamradio_logbook'); ?></h2>
<h6><?php echo $this->lang->line('gen_hamradio_logbook').": ".$this->logbooks_model->find_name($this->session->userdata('active_station_logbook')); ?> <?php echo $this->lang->line('general_word_location').": ".$this->stations->find_name(); ?></h6> <?php if ($results) { ?>
<h6><?php echo $this->lang->line('gen_hamradio_logbook').": ".$this->logbooks_model->find_name($this->session->userdata('active_station_logbook')); ?> <?php echo $this->lang->line('general_word_location').": ".$this->stations->find_name(); ?></h6>
<?php } ?>
<?php if($this->session->flashdata('notice')) { ?> <?php if($this->session->flashdata('notice')) { ?>
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">

查看文件

@ -18,8 +18,8 @@ function echo_table_header_col($ctx, $name) {
function echo_table_col($row, $name) { function echo_table_col($row, $name) {
switch($name) { switch($name) {
case 'Mode': echo '<td>'; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . '</td>'; break; case 'Mode': echo '<td>'; echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . '</td>'; break;
case 'RSTS': echo '<td>' . $row->COL_RST_SENT; if ($row->COL_STX) { echo '<span data-toggle="tooltip" data-original-title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_STX); echo '</span>';} if ($row->COL_STX_STRING) { echo '<span data-toggle="tooltip" data-original-title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_STX_STRING . '</span>';} echo '</td>'; break; case 'RSTS': echo '<td>' . $row->COL_RST_SENT; if ($row->COL_STX) { echo '<span data-toggle="tooltip" data-original-title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_STX); echo '</span>';} if ($row->COL_STX_STRING) { echo '<span data-toggle="tooltip" data-original-title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_STX_STRING . '</span>';} echo '</td>'; break;
case 'RSTR': echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span data-toggle="tooltip" data-original-title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_SRX); echo '</span>';} if ($row->COL_SRX_STRING) { echo '<span data-toggle="tooltip" data-original-title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';} echo '</td>'; break; case 'RSTR': echo '<td>' . $row->COL_RST_RCVD; if ($row->COL_SRX) { echo '<span data-toggle="tooltip" data-original-title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge badge-light">'; printf("%03d", $row->COL_SRX); echo '</span>';} if ($row->COL_SRX_STRING) { echo '<span data-toggle="tooltip" data-original-title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge badge-light">' . $row->COL_SRX_STRING . '</span>';} echo '</td>'; break;
case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY))) . '</td>'; break; case 'Country': echo '<td>' . ucwords(strtolower(($row->COL_COUNTRY))) . '</td>'; break;
case 'IOTA': echo '<td>' . ($row->COL_IOTA) . '</td>'; break; case 'IOTA': echo '<td>' . ($row->COL_IOTA) . '</td>'; break;
case 'SOTA': echo '<td>' . ($row->COL_SOTA_REF) . '</td>'; break; case 'SOTA': echo '<td>' . ($row->COL_SOTA_REF) . '</td>'; break;
@ -39,6 +39,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
} }
?> ?>
<?php if ($results) { ?>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
@ -48,7 +49,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
<td><?php echo $this->lang->line('general_word_time'); ?></td> <td><?php echo $this->lang->line('general_word_time'); ?></td>
<?php } ?> <?php } ?>
<td><?php echo $this->lang->line('gen_hamradio_call'); ?></td> <td><?php echo $this->lang->line('gen_hamradio_call'); ?></td>
<?php <?php
echo_table_header_col($this, $this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1')); echo_table_header_col($this, $this->session->userdata('user_column1')==""?'Mode':$this->session->userdata('user_column1'));
echo_table_header_col($this, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2')); echo_table_header_col($this, $this->session->userdata('user_column2')==""?'RSTS':$this->session->userdata('user_column2'));
echo_table_header_col($this, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3')); echo_table_header_col($this, $this->session->userdata('user_column3')==""?'RSTR':$this->session->userdata('user_column3'));
@ -70,8 +71,8 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
<?php } ?> <?php } ?>
</tr> </tr>
<?php $i = 0; foreach ($results->result() as $row) { ?> <?php $i = 0;
<?php foreach ($results->result() as $row) {
// Get Date format // Get Date format
if($this->session->userdata('user_date_format')) { if($this->session->userdata('user_date_format')) {
// If Logged in and session exists // If Logged in and session exists
@ -80,8 +81,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
// Get Default date format from /config/cloudlog.php // Get Default date format from /config/cloudlog.php
$custom_date_format = $this->config->item('qso_date_format'); $custom_date_format = $this->config->item('qso_date_format');
} }
?> echo '<tr class="tr'.($i & 1).'" id ="qso_'. $row->COL_PRIMARY_KEY .'">'; ?>
<?php echo '<tr class="tr'.($i & 1).'" id ="qso_'. $row->COL_PRIMARY_KEY .'">'; ?>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($custom_date_format, $timestamp); ?></td> <td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($custom_date_format, $timestamp); ?></td>
<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?> <?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE || ($this->config->item('show_time'))) { ?>
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td> <td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date('H:i', $timestamp); ?></td>
@ -247,7 +247,8 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
</tr> </tr>
<?php $i++; } ?> <?php $i++; } ?>
</table> </table></div>
<?php } ?>
<?php if (isset($this->pagination)){ ?> <?php if (isset($this->pagination)){ ?>
<?php <?php