Skip to content

Commit

Permalink
Merge pull request #1756 from phl0/updateQslDatesOnEdit
Browse files Browse the repository at this point in the history
  • Loading branch information
magicbug authored Nov 8, 2022
2 parents 2de9612 + 9114183 commit 161941d
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions application/models/Logbook_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,30 @@ function edit() {
$qsl_recv = 'N';
}

if ($this->input->post('eqsl_sent')) {
$eqsl_sent = $this->input->post('eqsl_sent');
} else {
$eqsl_sent = 'N';
}

if ($this->input->post('eqsl_recv')) {
$eqsl_recv = $this->input->post('eqsl_recv');
} else {
$eqsl_recv = 'N';
}

if ($this->input->post('lotw_sent')) {
$lotw_sent = $this->input->post('lotw_sent');
} else {
$lotw_sent = 'N';
}

if ($this->input->post('lotw_recv')) {
$lotw_recv = $this->input->post('lotw_recv');
} else {
$lotw_recv = 'N';
}

if ($qsl_sent == 'N') {
$qslsdate = null;
} elseif (!$qso->COL_QSLSDATE || $qso->COL_QSL_SENT != $qsl_sent) {
Expand All @@ -628,6 +652,38 @@ function edit() {
$qslrdate = $qso->COL_QSLRDATE;
}

if ($eqsl_sent == 'N') {
$eqslsdate = null;
} elseif (!$qso->COL_EQSL_QSLSDATE || $qso->COL_EQSL_QSL_SENT != $eqsl_sent) {
$eqslsdate = date('Y-m-d H:i:s');
} else {
$eqslsdate = $qso->COL_EQSL_QSLSDATE;
}

if ($eqsl_recv == 'N') {
$eqslrdate = null;
} elseif (!$qso->COL_EQSL_QSLRDATE || $qso->COL_EQSL_QSL_RCVD != $eqsl_recv) {
$eqslrdate = date('Y-m-d H:i:s');
} else {
$eqslrdate = $qso->COL_EQSL_QSLRDATE;
}

if ($lotw_sent == 'N') {
$lotwsdate = null;
} elseif (!$qso->COL_LOTW_QSLSDATE || $qso->COL_LOTW_QSL_SENT != $lotw_sent) {
$lotwsdate = date('Y-m-d H:i:s');
} else {
$lotwsdate = $qso->COL_LOTW_QSLSDATE;
}

if ($lotw_recv == 'N') {
$lotwrdate = null;
} elseif (!$qso->COL_LOTW_QSLRDATE || $qso->COL_LOTW_QSL_RCVD != $lotw_recv) {
$lotwrdate = date('Y-m-d H:i:s');
} else {
$lotwrdate = $qso->COL_LOTW_QSLRDATE;
}

$data = array(
'COL_TIME_ON' => $this->input->post('time_on'),
'COL_TIME_OFF' => $this->input->post('time_off'),
Expand Down Expand Up @@ -655,9 +711,13 @@ function edit() {
'COL_QSL_RCVD' => $qsl_recv,
'COL_QSL_SENT_VIA' => $this->input->post('qsl_sent_method'),
'COL_QSL_RCVD_VIA' => $this->input->post('qsl_recv_method'),
'COL_EQSL_QSLSDATE' => $eqslsdate,
'COL_EQSL_QSLRDATE' => $eqslrdate,
'COL_EQSL_QSL_SENT' => $this->input->post('eqsl_sent'),
'COL_EQSL_QSL_RCVD' => $this->input->post('eqsl_recv'),
'COL_QSLMSG' => $this->input->post('qslmsg'),
'COL_LOTW_QSLSDATE' => $lotwsdate,
'COL_LOTW_QSLRDATE' => $lotwrdate,
'COL_LOTW_QSL_SENT' => $this->input->post('lotw_sent'),
'COL_LOTW_QSL_RCVD' => $this->input->post('lotw_recv'),
'COL_IOTA' => $this->input->post('iota_ref'),
Expand Down

0 comments on commit 161941d

Please sign in to comment.