diff --git a/application/controllers/Labels.php b/application/controllers/Labels.php index 91bc10f5b..395953d86 100644 --- a/application/controllers/Labels.php +++ b/application/controllers/Labels.php @@ -143,11 +143,13 @@ class Labels extends CI_Controller { $offset = xss_clean($this->input->post('startat')); $grid = $this->input->post('grid') === "true" ? 1 : 0; $via = $this->input->post('via') === "true" ? 1 : 0; + $qslmsg = $this->input->post('qslmsg') === "true" ? 1 : 0; + $tnxmsg = $this->input->post('tnxmsg') === "true" ? 1 : 0; $reference = $this->input->post('reference') == "true" ? 1 : 0; $this->load->model('labels_model'); $result = $this->labels_model->export_printrequestedids($ids); - $this->prepareLabel($result, true, $offset, $grid, $via, $reference); + $this->prepareLabel($result, true, $offset, $grid, $via, $reference, $qslmsg, $tnxmsg); } public function print($station_id) { @@ -155,19 +157,21 @@ class Labels extends CI_Controller { $offset = xss_clean($this->input->post('startat')); $grid = xss_clean($this->input->post('grid') ?? 0); $via = xss_clean($this->input->post('via') ?? 0); + $qslmsg = xss_clean($this->input->post('qslmsg') ?? 0); + $tnxmsg = xss_clean($this->input->post('tnxmsg') ?? 0); $reference = xss_clean($this->input->post('reference') ?? 0); $this->load->model('stations'); if ($this->stations->check_station_is_accessible($station_id)) { $this->load->model('labels_model'); $result = $this->labels_model->export_printrequested($clean_id); - $this->prepareLabel($result, false, $offset, $grid, $via, $reference); + $this->prepareLabel($result, false, $offset, $grid, $via, $reference, $qslmsg, $tnxmsg); } else { redirect('labels'); } } - function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false, $via = false, $reference = false) { + function prepareLabel($qsos, $jscall = false, $offset = 1, $grid = false, $via = false, $reference = false, $qslmsg = false, $tnxmsg = true) { $this->load->model('labels_model'); $label = $this->labels_model->getDefaultLabel(); @@ -243,9 +247,9 @@ class Labels extends CI_Controller { if ($qsos->num_rows() > 0) { if ($label->qsos == 1) { - $this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation, $grid, $via, $reference); + $this->makeMultiQsoLabel($qsos->result(), $pdf, 1, $offset, $ptype->orientation, $grid, $via, $reference, $qslmsg, $tnxmsg); } else { - $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation, $grid, $via, $reference); + $this->makeMultiQsoLabel($qsos->result(), $pdf, $label->qsos, $offset, $ptype->orientation, $grid, $via, $reference, $qslmsg, $tnxmsg); } } else { $this->session->set_flashdata('message', __('0 QSOs found for print!')); @@ -254,7 +258,7 @@ class Labels extends CI_Controller { $pdf->Output(); } - function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid, $via, $reference) { + function makeMultiQsoLabel($qsos, $pdf, $numberofqsos, $offset, $orientation, $grid, $via, $reference, $qslmsg, $tnxmsg) { $text = ''; $current_callsign = ''; $current_sat = ''; @@ -271,7 +275,7 @@ class Labels extends CI_Controller { ( ($qso->COL_BAND_RX !== $current_sat_bandrx) && ($this->pretty_sat_mode($qso->COL_SAT_MODE) !== '')) ) { // ((($qso->COL_SAT_NAME ?? '' !== $current_sat) || ($qso->COL_CALL !== $current_callsign)) && ($qso->COL_SAT_NAME ?? '' !== '') && ($col->COL_BAND_RX ?? '' !== $current_sat_bandrx))) { if (!empty($qso_data)) { - $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via, $reference); + $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via, $reference, $qslmsg, $tnxmsg); $qso_data = []; } $current_callsign = $qso->COL_CALL; @@ -297,11 +301,13 @@ class Labels extends CI_Controller { 'sota' => $qso->station_sota ?? '', 'iota' => $qso->station_iota ?? '', 'pota' => $qso->station_pota ?? '', - 'wwff' => $qso->station_wwff ?? '' + 'wwff' => $qso->station_wwff ?? '', + 'qslmsg' => $qso->COL_QSLMSG ?? '', + ]; } if (!empty($qso_data)) { - $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via, $reference); + $this->finalizeData($pdf, $current_callsign, $qso_data, $numberofqsos, $orientation, $grid, $via, $reference, $qslmsg, $tnxmsg); } } // New begin @@ -309,7 +315,7 @@ class Labels extends CI_Controller { return(strlen($sat_mode ?? '') == 2 ? (strtoupper($sat_mode[0]).'/'.strtoupper($sat_mode[1])) : strtoupper($sat_mode ?? '')); } - function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation, $grid, $via, $reference) { + function finalizeData($pdf, $current_callsign, &$preliminaryData, $qso_per_label,$orientation, $grid, $via, $reference, $qslmsg, $tnxmsg) { $tableData = []; $count_qso = 0; @@ -329,7 +335,7 @@ class Labels extends CI_Controller { if($count_qso == $qso_per_label){ - $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via, $reference); + $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via, $reference, $qslmsg, $tnxmsg); $tableData = []; // reset the data $count_qso = 0; // reset the counter } @@ -337,12 +343,12 @@ class Labels extends CI_Controller { } // generate label for remaining QSOs if($count_qso > 0){ - $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via, $reference); + $this->generateLabel($pdf, $current_callsign, $tableData,$count_qso,$qso,$orientation, $grid, $via, $reference, $qslmsg, $tnxmsg); $preliminaryData = []; // reset the data } } - function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true, $via=false, $reference = false){ + function generateLabel($pdf, $current_callsign, $tableData,$numofqsos,$qso,$orientation,$grid=true, $via=false, $reference = false, $qslmsg = false, $tnxmsg = true){ $builder = new \AsciiTable\Builder(); $builder->addRows($tableData); $toradio = "To Radio: "; @@ -377,9 +383,16 @@ class Labels extends CI_Controller { if (!empty($qso['wwff'])) { $ref_text .= "WWFF:".$qso['wwff']; $ref_avail = true;} if ($ref_avail == true) {$text .= $ref_text."\n";} } - $text .= "Thanks for the QSO".($numofqsos>1 ? 's' : ''); - $text .= " | ".($qso['qsl_recvd'] == 'Y' ? 'TNX' : 'PSE')." QSL"; - $pdf->Add_Label($text,$orientation); } + if ($qslmsg) { + if (!empty($qso['qslmsg'])) { $text .= $qso['qslmsg']."\n";} + } + if ($tnxmsg) { + $text .= "Thanks for the QSO".($numofqsos>1 ? 's' : ''); + $text .= " | ".($qso['qsl_recvd'] == 'Y' ? 'TNX' : 'PSE')." QSL"; + } + + $pdf->Add_Label($text,$orientation); } + // New End diff --git a/application/views/labels/startatform.php b/application/views/labels/startatform.php index 268cf212e..62fa9dfb9 100644 --- a/application/views/labels/startatform.php +++ b/application/views/labels/startatform.php @@ -18,6 +18,18 @@ +