kopia lustrzana https://github.com/magicbug/Cloudlog
				
				
				
			Need a few more LEFT OUTER joins to prevent empty results
							rodzic
							
								
									515fe68f6b
								
							
						
					
					
						commit
						5f3788a892
					
				| 
						 | 
				
			
			@ -50,7 +50,7 @@ class adif_data extends CI_Model {
 | 
			
		|||
        $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
 | 
			
		||||
 | 
			
		||||
        $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
 | 
			
		||||
        $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
 | 
			
		||||
        $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer');
 | 
			
		||||
 | 
			
		||||
        return $this->db->get();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -71,7 +71,7 @@ class adif_data extends CI_Model {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
        $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
 | 
			
		||||
        $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
 | 
			
		||||
        $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer');
 | 
			
		||||
 | 
			
		||||
        return $this->db->get();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -109,7 +109,7 @@ class adif_data extends CI_Model {
 | 
			
		|||
        $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
 | 
			
		||||
 | 
			
		||||
        $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
 | 
			
		||||
        $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
 | 
			
		||||
        $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer');
 | 
			
		||||
 | 
			
		||||
        return $this->db->get();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -130,7 +130,7 @@ class adif_data extends CI_Model {
 | 
			
		|||
        $this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
 | 
			
		||||
 | 
			
		||||
        $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
 | 
			
		||||
        $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
 | 
			
		||||
        $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer');
 | 
			
		||||
 | 
			
		||||
        return $this->db->get();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -158,7 +158,7 @@ class adif_data extends CI_Model {
 | 
			
		|||
		$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "ASC");
 | 
			
		||||
 | 
			
		||||
		$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
 | 
			
		||||
		$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
 | 
			
		||||
		$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer');
 | 
			
		||||
 | 
			
		||||
		return $this->db->get();
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -65,7 +65,7 @@ class Clublog_model extends CI_Model {
 | 
			
		|||
	function get_clublog_qsos($station_id){
 | 
			
		||||
		$this->db->select('*, dxcc_entities.name as station_country');
 | 
			
		||||
		$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
 | 
			
		||||
		$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left');
 | 
			
		||||
		$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer');
 | 
			
		||||
		$this->db->where($this->config->item('table_name').'.station_id', $station_id);
 | 
			
		||||
		$this->db->group_start();
 | 
			
		||||
		$this->db->where("COL_CLUBLOG_QSO_UPLOAD_STATUS", null);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -295,7 +295,7 @@ class Logbook_model extends CI_Model {
 | 
			
		|||
  public function check_station($id){
 | 
			
		||||
 | 
			
		||||
    $this->db->select('station_profile.*, dxcc_entities.name as station_country');
 | 
			
		||||
    $this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left');
 | 
			
		||||
    $this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer');
 | 
			
		||||
    $this->db->where('station_id', $id);
 | 
			
		||||
    $query = $this->db->get('station_profile');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1312,7 +1312,7 @@ class Logbook_model extends CI_Model {
 | 
			
		|||
    function get_qrz_qsos($station_id){
 | 
			
		||||
        $sql = 'select *, dxcc_entities.name as station_country from ' . $this->config->item('table_name') . ' thcv ' .
 | 
			
		||||
            ' left join station_profile on thcv.station_id = station_profile.station_id' .
 | 
			
		||||
            ' left join dxcc_entities on thcv.col_my_dxcc = dxcc_entities.adif' .
 | 
			
		||||
            ' left outer join dxcc_entities on thcv.col_my_dxcc = dxcc_entities.adif' .
 | 
			
		||||
            ' where thcv.station_id = ' . $station_id .
 | 
			
		||||
            ' and (COL_QRZCOM_QSO_UPLOAD_STATUS is NULL
 | 
			
		||||
            or COL_QRZCOM_QSO_UPLOAD_STATUS = ""
 | 
			
		||||
| 
						 | 
				
			
			@ -1332,7 +1332,7 @@ class Logbook_model extends CI_Model {
 | 
			
		|||
			FROM %s qsos
 | 
			
		||||
			INNER JOIN station_profile ON qsos.station_id = station_profile.station_id
 | 
			
		||||
			LEFT JOIN dxcc_entities on qsos.col_my_dxcc = dxcc_entities.adif
 | 
			
		||||
			LEFT JOIN webadif ON qsos.COL_PRIMARY_KEY = webadif.qso_id
 | 
			
		||||
			LEFT OUTER JOIN webadif ON qsos.COL_PRIMARY_KEY = webadif.qso_id
 | 
			
		||||
			WHERE qsos.station_id = %d
 | 
			
		||||
        AND qsos.COL_SAT_NAME = 'QO-100'
 | 
			
		||||
			  AND webadif.upload_date IS NULL
 | 
			
		||||
| 
						 | 
				
			
			@ -3184,7 +3184,7 @@ class Logbook_model extends CI_Model {
 | 
			
		|||
            if($station_id != "0") {
 | 
			
		||||
              $this->db->select('station_profile.*, dxcc_entities.name as station_country');
 | 
			
		||||
              $this->db->where('station_id', $station_id);
 | 
			
		||||
              $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
 | 
			
		||||
              $this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer');
 | 
			
		||||
              $station_result = $this->db->get('station_profile');
 | 
			
		||||
 | 
			
		||||
                if ($station_result->num_rows() > 0){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -122,7 +122,7 @@ class Logbookadvanced_model extends CI_Model {
 | 
			
		|||
            SELECT *, dxcc_entities.name AS station_country
 | 
			
		||||
			FROM " . $this->config->item('table_name') . " qsos
 | 
			
		||||
			INNER JOIN station_profile ON qsos.station_id = station_profile.station_id
 | 
			
		||||
			INNER JOIN dxcc_entities ON qsos.COL_MY_DXCC = dxcc_entities.adif
 | 
			
		||||
			LEFT OUTER JOIN dxcc_entities ON qsos.COL_MY_DXCC = dxcc_entities.adif
 | 
			
		||||
			WHERE station_profile.user_id =  ?
 | 
			
		||||
			$where
 | 
			
		||||
			ORDER BY qsos.COL_TIME_ON desc
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ class Stations extends CI_Model {
 | 
			
		|||
		$this->db->select('station_profile.*, dxcc_entities.name as station_country, dxcc_entities.end as dxcc_end, count('.$this->config->item('table_name').'.station_id) as qso_total');
 | 
			
		||||
        $this->db->from('station_profile');
 | 
			
		||||
        $this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id','left');
 | 
			
		||||
        $this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left');
 | 
			
		||||
        $this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer');
 | 
			
		||||
       	$this->db->group_by('station_profile.station_id');
 | 
			
		||||
		$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
 | 
			
		||||
		$this->db->or_where('station_profile.user_id =', NULL);
 | 
			
		||||
| 
						 | 
				
			
			@ -19,14 +19,14 @@ class Stations extends CI_Model {
 | 
			
		|||
	function all() {
 | 
			
		||||
		$this->db->select('station_profile.*, dxcc_entities.name as station_country');
 | 
			
		||||
		$this->db->from('station_profile');
 | 
			
		||||
		$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left');
 | 
			
		||||
		$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer');
 | 
			
		||||
		return $this->db->get();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	function all_of_user() {
 | 
			
		||||
		$this->db->select('station_profile.*, dxcc_entities.name as station_country, dxcc_entities.end as dxcc_end');
 | 
			
		||||
		$this->db->where('user_id', $this->session->userdata('user_id'));
 | 
			
		||||
		$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left');
 | 
			
		||||
		$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer');
 | 
			
		||||
		return $this->db->get('station_profile');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -264,7 +264,7 @@ class Stations extends CI_Model {
 | 
			
		|||
 | 
			
		||||
		$this->db->select('station_profile.*, dxcc_entities.name as station_country');
 | 
			
		||||
		$this->db->where('station_id', $clean_id);
 | 
			
		||||
		$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
 | 
			
		||||
		$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer');
 | 
			
		||||
		$query = $this->db->get('station_profile');
 | 
			
		||||
 | 
			
		||||
		$row = $query->row();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue