Merge pull request #1514 from AndreasK79/empty_logbook_fix

Fix for Logbook Model - now loads without a logbook defined. Fixes #1481
这个提交包含在:
Andreas Kristiansen 2022-07-03 16:39:58 +02:00 提交者 GitHub
当前提交 5e7c59a420
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 6 个文件被更改,包括 24 次插入11 次删除

查看文件

@ -50,6 +50,10 @@ class Logbook extends CI_Controller {
//load the model and get results //load the model and get results
$data['results'] = $this->logbook_model->get_qsos($config['per_page'],$this->uri->segment(3)); $data['results'] = $this->logbook_model->get_qsos($config['per_page'],$this->uri->segment(3));
if(!$data['results']) {
$this->session->set_flashdata('notice', $this->lang->line('error_no_logbook_found') . ' <a href="' . site_url('logbooks') . '" title="Station Logbooks">Station Logbooks</a>');
}
// Calculate Lat/Lng from Locator to use on Maps // Calculate Lat/Lng from Locator to use on Maps
if($this->session->userdata('user_locator')) { if($this->session->userdata('user_locator')) {
$this->load->library('qra'); $this->load->library('qra');

查看文件

@ -118,3 +118,5 @@ $lang['dashboard_countries_breakdown'] = 'Countries Breakdown';
$lang['gen_from_date'] = 'From date'; $lang['gen_from_date'] = 'From date';
$lang['gen_this_qso_was_confirmed_on'] = 'This QSO was confirmed on'; $lang['gen_this_qso_was_confirmed_on'] = 'This QSO was confirmed on';
$lang['error_no_logbook_found'] = 'No logbooks were found. You need to define a logbook under Station Logbooks! Do it here:';

查看文件

@ -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>
<?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> <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">

查看文件

@ -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>
@ -245,7 +245,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