Index: branches/5.1.x/units/taxes/taxes_tag_processor.php =================================================================== diff -u -r13100 -r13147 --- branches/5.1.x/units/taxes/taxes_tag_processor.php (.../taxes_tag_processor.php) (revision 13100) +++ branches/5.1.x/units/taxes/taxes_tag_processor.php (.../taxes_tag_processor.php) (revision 13147) @@ -1,6 +1,6 @@ TableName.' zd - ON zd.StdDestId = sd.DestId - LEFT JOIN '.TABLE_PREFIX.'Phrase - ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName - WHERE sd.DestType=1 - AND LanguageId='.$this->Application->GetVar('lang.current_id').' - AND zd.TaxZoneId='.$zone->GetDBField('TaxZoneId').' - ORDER BY Translation - '; + $sql = 'SELECT sd.* + FROM '.TABLE_PREFIX.'StdDestinations sd + LEFT JOIN '.$destination->TableName.' zd ON zd.StdDestId = sd.DestId + LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName + WHERE sd.DestType = 1 AND zd.TaxZoneId = '.$zone->GetDBField('TaxZoneId').' + ORDER BY l' . $this->Application->GetVar('lang.current_id') . '_Translation'; break; + case 'available': - $sql = 'SELECT sd.* FROM '.TABLE_PREFIX.'StdDestinations sd - LEFT JOIN '.$destination->TableName.' zd - ON zd.StdDestId = sd.DestId - LEFT JOIN '.TABLE_PREFIX.'Phrase - ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName - WHERE sd.DestType=1 - AND LanguageId='.$this->Application->GetVar('lang.current_id').' - AND zd.TaxZoneId IS NULL - ORDER BY Translation - '; + $sql = 'SELECT sd.* + FROM '.TABLE_PREFIX.'StdDestinations sd + LEFT JOIN '.$destination->TableName.' zd ON zd.StdDestId = sd.DestId + LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName + WHERE sd.DestType = 1 AND zd.TaxZoneId IS NULL + ORDER BY l' . $this->Application->GetVar('lang.current_id') . '_Translation'; break; - case 'all': + case 'all': $selected_country = $this->Application->GetVar('CountrySelector'); if (!$selected_country){ // get 1st available country ID @@ -304,14 +297,13 @@ } } - $sql = 'SELECT sd.* FROM '.TABLE_PREFIX.'StdDestinations sd - LEFT JOIN '.TABLE_PREFIX.'Phrase - ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName - WHERE sd.DestType=1 - AND LanguageId='.$this->Application->GetVar('lang.current_id').' - ORDER BY Translation - '; + $sql = 'SELECT sd.* + FROM '.TABLE_PREFIX.'StdDestinations sd + LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName + WHERE sd.DestType = 1 + ORDER BY l' . $this->Application->GetVar('lang.current_id') . '_Translation'; break; + case 'has_states': $has_states = $this->Conn->GetCol('SELECT DISTINCT DestParentId FROM '.TABLE_PREFIX.'StdDestinations sd WHERE sd.DestType=2'); @@ -338,15 +330,11 @@ } } - - $sql = 'SELECT sd.* FROM '.TABLE_PREFIX.'StdDestinations sd - LEFT JOIN '.TABLE_PREFIX.'Phrase - ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName - WHERE sd.DestType=1 - AND LanguageId='.$this->Application->GetVar('lang.current_id').' - AND DestId IN ('.implode(',', $has_states).') - ORDER BY Translation - '; + $sql = 'SELECT sd.* + FROM '.TABLE_PREFIX.'StdDestinations sd + LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName + WHERE sd.DestType = 1 AND DestId IN ('.implode(',', $has_states).') + ORDER BY l' . $this->Application->GetVar('lang.current_id') . '_Translation'; break; } @@ -369,8 +357,8 @@ } - function ShowStates($param){ - + function ShowStates($param) + { $param = $this->prepareTagParams($param); $param['name'] = $param['block']; @@ -379,41 +367,35 @@ switch ($param['show']){ case 'current': - $sql = 'SELECT * FROM '.TABLE_PREFIX.'StdDestinations sd - LEFT JOIN '.$destination->TableName.' zd - ON zd.StdDestId = sd.DestId - LEFT JOIN '.TABLE_PREFIX.'Phrase - ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName - WHERE sd.DestType=2 - AND LanguageId='.$this->Application->GetVar('lang.current_id').' - AND sd.DestParentId='.$this->Application->GetVar('CountrySelector').' - AND zd.TaxZoneId='.$zone->GetDBField('TaxZoneId').' - ORDER BY Translation - '; + $sql = 'SELECT * + FROM '.TABLE_PREFIX.'StdDestinations sd + LEFT JOIN '.$destination->TableName.' zd ON zd.StdDestId = sd.DestId + LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName + WHERE + sd.DestType=2 + AND sd.DestParentId='.$this->Application->GetVar('CountrySelector').' + AND zd.TaxZoneId='.$zone->GetDBField('TaxZoneId').' + ORDER BY l' . $this->Application->GetVar('lang.current_id') . '_Translation'; break; - case 'available': - $sql = 'SELECT * FROM '.TABLE_PREFIX.'StdDestinations sd - LEFT JOIN '.$destination->TableName.' zd - ON zd.StdDestId = sd.DestId - LEFT JOIN '.TABLE_PREFIX.'Phrase - ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName - WHERE sd.DestType=2 - AND LanguageId='.$this->Application->GetVar('lang.current_id').' - AND zd.TaxZoneId IS NULL - AND sd.DestParentId='.$this->Application->GetVar('CountrySelector').' - ORDER BY Translation - '; + case 'available': + $sql = 'SELECT * + FROM '.TABLE_PREFIX.'StdDestinations sd + LEFT JOIN '.$destination->TableName.' zd ON zd.StdDestId = sd.DestId + LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName + WHERE + sd.DestType=2 + AND zd.TaxZoneId IS NULL + AND sd.DestParentId='.$this->Application->GetVar('CountrySelector').' + ORDER BY l' . $this->Application->GetVar('lang.current_id') . '_Translation'; break; + case 'all': - $sql = 'SELECT sd.* FROM '.TABLE_PREFIX.'StdDestinations sd - LEFT JOIN '.TABLE_PREFIX.'Phrase - ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName - WHERE sd.DestType=2 - AND LanguageId='.$this->Application->GetVar('lang.current_id').' - AND sd.DestParentId='.$this->Application->GetVar('CountrySelector').' - ORDER BY Translation - '; + $sql = 'SELECT sd.* + FROM '.TABLE_PREFIX.'StdDestinations sd + LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = sd.DestName + WHERE sd.DestType = 2 AND sd.DestParentId='.$this->Application->GetVar('CountrySelector').' + ORDER BY l' . $this->Application->GetVar('lang.current_id') . '_Translation'; break; }