Logbook model: More changes to prevent strings being inserted into non-string columns

This commit is contained in:
Michael Cullen 2019-05-17 02:00:06 +01:00
parent af3f405d7f
commit 2f85b199be

View File

@ -929,26 +929,26 @@ class Logbook_model extends CI_Model {
'COL_EQSL_QSLRDATE' => (!empty($record['eqsl_qslrdate'])) ? $record['eqsl_qslrdate'] : null,
'COL_EQSL_QSLSDATE' => (!empty($record['eqsl_qslsdate'])) ? $record['eqsl_qslsdate'] : null,
'COL_EQSL_STATUS' => (!empty($record['eqsl_status'])) ? $record['eqsl_status'] : '',
'COL_FISTS' => (!empty($record['fists'])) ? $record['fists'] : '',
'COL_FISTS_CC' => (!empty($record['fists_cc'])) ? $record['fists_cc'] : '',
'COL_FORCE_INIT' => (!empty($record['force_init'])) ? $record['force_init'] : '',
'COL_FISTS' => (!empty($record['fists'])) ? $record['fists'] : null,
'COL_FISTS_CC' => (!empty($record['fists_cc'])) ? $record['fists_cc'] : null,
'COL_FORCE_INIT' => (!empty($record['force_init'])) ? $record['force_init'] : null,
'COL_FREQ' => $freq,
'COL_FREQ_RX' => (!empty($record['freq_rx'])) ? $record['freq_rx'] : '',
'COL_FREQ_RX' => (!empty($record['freq_rx'])) ? $record['freq_rx'] : null,
'COL_GRIDSQUARE' => (!empty($record['gridsquare'])) ? $record['gridsquare'] : '',
'COL_HEADING' => (!empty($record['heading'])) ? $record['heading'] : '',
'COL_HRDLOG_QSO_UPLOAD_DATE' => (!empty($record['hrdlog_qso_upload_date'])) ? $record['hrdlog_qso_upload_date'] : '',
'COL_HEADING' => (!empty($record['heading'])) ? $record['heading'] : null,
'COL_HRDLOG_QSO_UPLOAD_DATE' => (!empty($record['hrdlog_qso_upload_date'])) ? $record['hrdlog_qso_upload_date'] : null,
'COL_HRDLOG_QSO_UPLOAD_STATUS' => (!empty($record['hrdlog_qso_upload_status'])) ? $record['hrdlog_qso_upload_status'] : '',
'COL_IOTA' => (!empty($record['iota'])) ? $record['iota'] : '',
'COL_ITUZ' => (!empty($record['ituz'])) ? $record['ituz'] : '',
'COL_K_INDEX' => (!empty($record['k_index'])) ? $record['k_index'] : '',
'COL_LAT' => (!empty($record['lat'])) ? $record['lat'] : '',
'COL_LON' => (!empty($record['lon'])) ? $record['lon'] : '',
'COL_ITUZ' => (!empty($record['ituz'])) ? $record['ituz'] : null,
'COL_K_INDEX' => (!empty($record['k_index'])) ? $record['k_index'] : null,
'COL_LAT' => (!empty($record['lat'])) ? $record['lat'] : null,
'COL_LON' => (!empty($record['lon'])) ? $record['lon'] : null,
'COL_LOTW_QSL_RCVD' => (!empty($record['lotw_qsl_rcvd'])) ? $record['lotw_qsl_rcvd'] : '',
'COL_LOTW_QSL_SENT' => (!empty($record['lotw_qsl_sent'])) ? $record['lotw_qsl_sent'] : '',
'COL_LOTW_QSLRDATE' => (!empty($record['lotw_qslrdate'])) ? $record['lotw_qslrdate'] : '',
'COL_LOTW_QSLSDATE' => (!empty($record['lotw_qslsdate'])) ? $record['lotw_qslsdate'] : '',
'COL_LOTW_QSLRDATE' => (!empty($record['lotw_qslrdate'])) ? $record['lotw_qslrdate'] : null,
'COL_LOTW_QSLSDATE' => (!empty($record['lotw_qslsdate'])) ? $record['lotw_qslsdate'] : null,
'COL_LOTW_STATUS' => (!empty($record['lotw_status'])) ? $record['lotw_status'] : '',
'COL_MAX_BURSTS' => (!empty($record['max_bursts'])) ? $record['max_bursts'] : '',
'COL_MAX_BURSTS' => (!empty($record['max_bursts'])) ? $record['max_bursts'] : null,
'COL_MODE' => (!empty($record['mode'])) ? $record['mode'] : '',
'COL_MS_SHOWER' => (!empty($record['ms_shower'])) ? $record['ms_shower'] : '',
'COL_MY_ANTENNA' => (!empty($record['my_antenna'])) ? $record['my_antenna'] : '',
@ -957,16 +957,16 @@ class Logbook_model extends CI_Model {
'COL_MY_CITY_INTL' => (!empty($record['my_city_intl'])) ? $record['my_city_intl'] : '',
'COL_MY_CNTY' => (!empty($record['my_cnty'])) ? $record['my_cnty'] : '',
'COL_MY_COUNTRY' => (!empty($record['my_country'])) ? $record['my_country'] : '',
'COL_MY_COUNTRY_INTL' => (!empty($record['my_country_intl'])) ? $record['my_country_intl'] : '',
'COL_MY_CQ_ZONE' => (!empty($record['my_dxcc'])) ? $record['my_dxcc'] : '',
'COL_MY_DXCC' => (!empty($record['my_dxcc'])) ? $record['my_dxcc'] : '',
'COL_MY_FISTS' => (!empty($record['my_fists'])) ? $record['my_fists'] : '',
'COL_MY_COUNTRY_INTL' => (!empty($record['my_country_intl'])) ? $record['my_country_intl'] : null,
'COL_MY_CQ_ZONE' => (!empty($record['my_dxcc'])) ? $record['my_dxcc'] : null,
'COL_MY_DXCC' => (!empty($record['my_dxcc'])) ? $record['my_dxcc'] : null,
'COL_MY_FISTS' => (!empty($record['my_fists'])) ? $record['my_fists'] : null,
'COL_MY_GRIDSQUARE' => (!empty($record['my_gridsquare'])) ? $record['my_gridsquare'] : '',
'COL_MY_IOTA' => (!empty($record['my_iota'])) ? $record['my_iota'] : '',
'COL_MY_IOTA_ISLAND_ID' => (!empty($record['my_iota_island_id'])) ? $record['my_iota_island_id'] : '',
'COL_MY_ITU_ZONE' => (!empty($record['my_itu_zone'])) ? $record['my_itu_zone'] : '',
'COL_MY_LAT' => (!empty($record['my_lat'])) ? $record['my_lat'] : '',
'COL_MY_LON' => (!empty($record['my_lon'])) ? $record['my_lon'] : '',
'COL_MY_ITU_ZONE' => (!empty($record['my_itu_zone'])) ? $record['my_itu_zone'] : null,
'COL_MY_LAT' => (!empty($record['my_lat'])) ? $record['my_lat'] : null,
'COL_MY_LON' => (!empty($record['my_lon'])) ? $record['my_lon'] : null,
'COL_MY_NAME' => (!empty($record['my_name'])) ? $record['my_name'] : '',
'COL_MY_NAME_INTL' => (!empty($record['my_name_intl'])) ? $record['my_name_intl'] : '',
'COL_MY_POSTAL_CODE' => (!empty($record['my_postal_code'])) ? $record['my_postal_code'] : '',
@ -987,15 +987,15 @@ class Logbook_model extends CI_Model {
'COL_NAME_INTL' => (!empty($record['name_intl'])) ? $record['name_intl']: '',
'COL_NOTES' => (!empty($record['notes'])) ? $record['notes'] : '',
'COL_NOTES_INTL' => (!empty($record['notes_intl'])) ? $record['notes_intl'] : '',
'COL_NR_BURSTS' => (!empty($record['nr_bursts'])) ? $record['nr_bursts'] : '',
'COL_NR_PINGS' => (!empty($record['nr_pings'])) ? $record['nr_pings'] : '',
'COL_NR_BURSTS' => (!empty($record['nr_bursts'])) ? $record['nr_bursts'] : null,
'COL_NR_PINGS' => (!empty($record['nr_pings'])) ? $record['nr_pings'] : null,
'COL_OPERATOR' => (!empty($record['operator'])) ? $record['operator'] : '',
'COL_OWNER_CALLSIGN' => (!empty($record['owner_callsign'])) ? $record['owner_callsign'] : '',
'COL_PFX' => (!empty($record['pfx'])) ? $record['pfx'] : '',
'COL_PRECEDENCE' => (!empty($record['precedence'])) ? $record['precedence'] : '',
'COL_PROP_MODE' => (!empty($record['prop_mode'])) ? $record['prop_mode'] : '',
'COL_PUBLIC_KEY' => (!empty($record['public_key'])) ? $record['public_key'] : '',
'COL_QRZCOM_QSO_UPLOAD_DATE' => (!empty($record['qrzcom_qso_upload_date'])) ? $record['qrzcom_qso_upload_date'] : '',
'COL_QRZCOM_QSO_UPLOAD_DATE' => (!empty($record['qrzcom_qso_upload_date'])) ? $record['qrzcom_qso_upload_date'] : null,
'COL_QRZCOM_QSO_UPLOAD_STATUS' => (!empty($record['qrzcom_qso_upload_status'])) ? $record['qrzcom_qso_upload_status'] : '',
'COL_QSL_RCVD' => (!empty($record['qsl_rcvd'])) ? $record['qsl_rcvd'] : '',
'COL_QSL_RCVD_VIA' => (!empty($record['qsl_rcvd_via'])) ? $record['qsl_rcvd_via'] : '',
@ -1003,12 +1003,12 @@ class Logbook_model extends CI_Model {
'COL_QSL_SENT_VIA' => (!empty($record['qsl_sent_via'])) ? $record['qsl_sent_via'] : '',
'COL_QSL_VIA' => (!empty($record['qsl_via'])) ? $record['qsl_via'] : '',
'COL_QSLMSG' => (!empty($record['qslmsg'])) ? $record['qslmsg'] : '',
'COL_QSLRDATE' => (!empty($record['qslrdate'])) ? $record['qslrdate']: '',
'COL_QSLSDATE' => (!empty($record['qslsdate'])) ? $record['qslsdate'] : '',
'COL_QSLRDATE' => (!empty($record['qslrdate'])) ? $record['qslrdate']: null,
'COL_QSLSDATE' => (!empty($record['qslsdate'])) ? $record['qslsdate'] : null,
'COL_QSO_COMPLETE' => (!empty($record['qso_complete'])) ? $record['qso_complete'] : '',
'COL_QSO_DATE' => (!empty($record['qso_date'])) ? $record['qso_date'] : '',
'COL_QSO_DATE_OFF' => (!empty($record['qso_date_off'])) ? $record['qso_date_off'] : '',
'COL_QSO_RANDOM' => (!empty($record['qso_random'])) ? $record['qso_random'] : '',
'COL_QSO_DATE' => (!empty($record['qso_date'])) ? $record['qso_date'] : null,
'COL_QSO_DATE_OFF' => (!empty($record['qso_date_off'])) ? $record['qso_date_off'] : null,
'COL_QSO_RANDOM' => (!empty($record['qso_random'])) ? $record['qso_random'] : null,
'COL_QTH' => (!empty($record['qth'])) ? $record['qth'] : '',
'COL_QTH_INTL' => (!empty($record['qth_intl'])) ? $record['qth_intl'] : '',
'COL_REGION' => (!empty($record['region'])) ? $record['region'] : '',
@ -1016,10 +1016,10 @@ class Logbook_model extends CI_Model {
'COL_RIG_INTL' => (!empty($record['rig_intl'])) ? $record['rig_intl'] : '',
'COL_RST_RCVD' => $rst_rx,
'COL_RST_SENT' => $rst_tx,
'COL_RX_PWR' => (!empty($record['rx_pwr'])) ? $record['rx_pwr'] : '',
'COL_RX_PWR' => (!empty($record['rx_pwr'])) ? $record['rx_pwr'] : null,
'COL_SAT_MODE' => (!empty($record['sat_mode'])) ? $record['sat_mode'] : '',
'COL_SAT_NAME' => (!empty($record['sat_name'])) ? $record['sat_name'] : '',
'COL_SFI' => (!empty($record['sfi'])) ? $record['sfi'] : '',
'COL_SFI' => (!empty($record['sfi'])) ? $record['sfi'] : null,
'COL_SIG' => (!empty($record['sig'])) ? $record['sig'] : '',
'COL_SIG_INFO' => (!empty($record['sig_info'])) ? $record['sig_info'] : '',
'COL_SIG_INFO_INTL' => (!empty($record['sig_info_intl'])) ? $record['sig_info_intl'] : '',
@ -1027,18 +1027,18 @@ class Logbook_model extends CI_Model {
'COL_SILENT_KEY' => (!empty($record['silent_key'])) ? $record['silent_key'] : '',
'COL_SKCC' => (!empty($record['skcc'])) ? $record['skcc'] : '',
'COL_SOTA_REF' => (!empty($record['sota_ref'])) ? $record['sota_ref'] : '',
'COL_SRX' => (!empty($record['srx'])) ? $record['srx'] : '',
'COL_SRX' => (!empty($record['srx'])) ? $record['srx'] : null,
'COL_SRX_STRING' => (!empty($record['srx_string'])) ? $record['srx_string'] : '',
'COL_STATE' => (!empty($record['state'])) ? $record['state'] : '',
'COL_STATION_CALLSIGN' => (!empty($record['station_callsign'])) ? $record['station_callsign'] : '',
'COL_STX' => (!empty($record['stx'])) ? $record['stx'] : '',
'COL_STX' => (!empty($record['stx'])) ? $record['stx'] : null,
'COL_STX_STRING' => (!empty($record['stx_string'])) ? $record['stx_string'] : '',
'COL_SUBMODE' => (!empty($record['submode'])) ? $record['submode'] : '',
'COL_SWL' => (!empty($record['swl'])) ? $record['swl'] : '',
'COL_TEN_TEN' => (!empty($record['ten_ten'])) ? $record['ten_ten'] : '',
'COL_SWL' => (!empty($record['swl'])) ? $record['swl'] : null,
'COL_TEN_TEN' => (!empty($record['ten_ten'])) ? $record['ten_ten'] : null,
'COL_TIME_ON' => $time_on,
'COL_TIME_OFF' => $time_off,
'COL_TX_PWR' => (!empty($record['tx_pwr'])) ? $record['tx_pwr'] : '',
'COL_TX_PWR' => (!empty($record['tx_pwr'])) ? $record['tx_pwr'] : null,
'COL_UKSMG' => (!empty($record['uksmg'])) ? $record['uksmg'] : '',
'COL_USACA_COUNTIES' => (!empty($record['usaca_counties'])) ? $record['usaca_counties'] : '',
'COL_VUCC_GRIDS' =>((!empty($record['vucc_grids']))) ? $record['vucc_grids'] : '',
@ -1064,9 +1064,11 @@ class Logbook_model extends CI_Model {
$dxcc_result = $this->db->select('`call`, `entity`, `adif`, `cqz`')
->where('call', substr($call, 0, $i))
->where('(start <= ', $date)
->or_where("start = '0000-00-00')", NULL, false)
->or_where("start = '0000-00-00'", NULL, false)
->or_where("start is null)", NULL, false)
->where('(end >= ', $date)
->or_where("end = '0000-00-00')", NULL, false)
->or_where("end = '0000-00-00'", NULL, false)
->or_where("end is null)", NULL, false)
->get('dxcc_prefixes');
//$dxcc_result = $this->db->query("select `call`, `entity`, `adif` from dxcc_prefixes where `call` = '".substr($call, 0, $i) ."'");