[QSLPrint] Only set bureau for those QSOs that does not have col_qsl_sent_via
这个提交包含在:
		
							父节点
							
								
									fd450673db
								
							
						
					
					
						当前提交
						c4ac74c4ff
					
				
					共有  3 个文件被更改,包括 42 次插入 和 16 次删除
				
			
		|  | @ -136,11 +136,11 @@ class QSLPrint extends CI_Controller { | |||
| 		$this->load->model('user_model'); | ||||
| 		if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } | ||||
| 
 | ||||
| 			// Update Logbook to Mark Paper Card Received
 | ||||
| 			// Update Logbook to Mark Paper Card Sent
 | ||||
| 
 | ||||
| 			$this->qslprint_model->mark_qsos_printed($station_id); | ||||
| 
 | ||||
| 			$this->session->set_flashdata('notice', 'QSOs are marked as sent via buro'); | ||||
| 			$this->session->set_flashdata('notice', 'QSOs are marked as sent'); | ||||
| 
 | ||||
| 			redirect('logbook'); | ||||
| 	} | ||||
|  |  | |||
|  | @ -7,14 +7,10 @@ class Qslprint_model extends CI_Model { | |||
| 		$CI->load->model('Stations'); | ||||
| 		$station_id = $CI->Stations->find_active(); | ||||
| 
 | ||||
| 		$data = array( | ||||
| 			'COL_QSLSDATE' => date('Y-m-d'), | ||||
| 			'COL_QSL_SENT' => "Y", | ||||
| 			'COL_QSL_SENT_VIA' => "B", | ||||
| 		); | ||||
| 		$station_ids = array(); | ||||
| 
 | ||||
| 		if ($station_id2 == NULL) { | ||||
| 			$this->db->where("station_id", $station_id); | ||||
| 			array_push($station_ids, $station_id); | ||||
| 		} else if ($station_id2 == 'All') { | ||||
| 			// get all stations of user
 | ||||
| 			$stations = $CI->Stations->all_of_user(); | ||||
|  | @ -22,18 +18,48 @@ class Qslprint_model extends CI_Model { | |||
| 			foreach ($stations->result() as $row) { | ||||
| 				array_push($station_ids, $row->station_id); | ||||
| 			} | ||||
| 
 | ||||
| 			// filter by all stations
 | ||||
| 			$this->db->where_in("station_id", $station_ids); | ||||
| 		} else if ($station_id2 != 'All') { | ||||
| 		} else { | ||||
| 			// be sure that station belongs to user
 | ||||
| 			if (!$CI->Stations->check_station_is_accessible($station_id2)) { | ||||
| 				return; | ||||
| 			} | ||||
| 			$this->db->where("station_id", $station_id2); | ||||
| 			array_push($station_ids, $station_id2); | ||||
| 		} | ||||
| 
 | ||||
| 		$this->update_qsos_bureau($station_ids); | ||||
| 
 | ||||
| 		$this->update_qsos($station_ids); | ||||
| 	} | ||||
| 
 | ||||
| 	/* | ||||
| 	 * Updates the QSOs that do not have any COL_QSL_SENT_VIA set | ||||
| 	 */ | ||||
| 	 function update_qsos_bureau($station_ids) { | ||||
| 		$data = array( | ||||
| 			'COL_QSLSDATE' => date('Y-m-d'), | ||||
| 			'COL_QSL_SENT' => "Y", | ||||
| 			'COL_QSL_SENT_VIA' => "B", | ||||
| 		); | ||||
| 
 | ||||
| 		$this->db->where_in("station_id", $station_ids); | ||||
| 		$this->db->where_in("COL_QSL_SENT", array("R","Q")); | ||||
| 		$this->db->where("coalesce(COL_QSL_SENT_VIA, '') = ''"); | ||||
| 
 | ||||
| 		$this->db->update($this->config->item('table_name'), $data); | ||||
| 	} | ||||
| 
 | ||||
| 	/* | ||||
| 	 * Updates the QSOs that do have COL_QSL_SENT_VIA set | ||||
| 	 */ | ||||
| 	function update_qsos($station_ids) { | ||||
| 		$data = array( | ||||
| 			'COL_QSLSDATE' => date('Y-m-d'), | ||||
| 			'COL_QSL_SENT' => "Y", | ||||
| 		); | ||||
| 		 | ||||
| 		$this->db->where_in("station_id", $station_ids); | ||||
| 		$this->db->where_in("COL_QSL_SENT", array("R","Q")); | ||||
| 		$this->db->where("coalesce(COL_QSL_SENT_VIA, '') != ''"); | ||||
| 
 | ||||
| 		$this->db->update($this->config->item('table_name'), $data); | ||||
| 	} | ||||
|  |  | |||
|  | @ -56,11 +56,11 @@ if ($qsos->result() != NULL) { | |||
| 	echo '</tbody></table>'; | ||||
| 	?>
 | ||||
| 
 | ||||
| 	<p><a href="<?php echo site_url('qslprint/exportcsv/' . $station_id); ?>" title="Export CSV-file" target="_blank" class="btn btn-primary">Export requested QSLs to CSV-file</a></p> | ||||
| 	<p><a href="<?php echo site_url('qslprint/exportcsv/' . $station_id); ?>" title="Export CSV-file" class="btn btn-primary">Export requested QSLs to CSV-file</a></p> | ||||
| 
 | ||||
| 	<p><a href="<?php echo site_url('qslprint/exportadif/' . $station_id); ?>" title="Export ADIF" target="_blank" class="btn btn-primary">Export requested QSLs to ADIF-file</a></p> | ||||
| 	<p><a href="<?php echo site_url('qslprint/exportadif/' . $station_id); ?>" title="Export ADIF" class="btn btn-primary">Export requested QSLs to ADIF-file</a></p> | ||||
| 
 | ||||
| 	<p><a href="<?php echo site_url('qslprint/qsl_printed/' . $station_id); ?>" title="Mark QSLs as printed" target="_blank" class="btn btn-primary">Mark requested QSLs as sent</a></p> | ||||
| 	<p><a href="<?php echo site_url('qslprint/qsl_printed/' . $station_id); ?>" title="Mark QSLs as printed" class="btn btn-primary">Mark requested QSLs as sent</a></p> | ||||
| 
 | ||||
| <?php | ||||
| } else { | ||||
|  |  | |||
		正在加载…
	
		在新工单中引用