Index: branches/5.1.x/units/taxes/taxes_tag_processor.php =================================================================== diff -u -N -r13147 -r13465 --- branches/5.1.x/units/taxes/taxes_tag_processor.php (.../taxes_tag_processor.php) (revision 13147) +++ branches/5.1.x/units/taxes/taxes_tag_processor.php (.../taxes_tag_processor.php) (revision 13465) @@ -1,6 +1,6 @@ Application->recallObject('tax'); - $zone->SetDBField('TaxZoneId', $zone->ID); - $destination =& $this->Application->recallObject('taxdst'); + $object =& $this->getObject($params); + /* @var $object kDBItem */ - if(!$this->Application->GetVar('loaded')) - { - if ($zone->GetID() == 0) - { - $this->Application->DeleteVar('taxdst'); - } - else - { - $sql = 'SELECT * FROM '.$destination->TableName.' WHERE TaxZoneId='.$zone->GetID(); - $res = $this->Conn->Query($sql); - if (is_array($res)) foreach ($res as $dest_record) - { - $temp[$dest_record['TaxZoneDestId']]['TaxZoneDestId'] = $dest_record['TaxZoneDestId']; - $temp[$dest_record['TaxZoneDestId']]['StdDestId'] = $dest_record['StdDestId']; - $temp[$dest_record['TaxZoneDestId']]['DestValue'] = $dest_record['DestValue']; - } - $this->Application->SetVar('taxdst', $temp); - } - } - $destination =& $this->Application->recallObject('taxdst'); + $destination_table = $this->getDestinationsTable($params); + $selected_country_id = (int)$this->Application->GetVar('CountrySelector'); - $hidden_clause = ''; + $name_field = 'l' . $this->Application->GetVar('m_lang') . '_Name'; + $id_field = $this->Application->getUnitOption('country-state', 'IDField'); + $table_name = $this->Application->getUnitOption('country-state', 'TableName'); - switch ( $zone->GetDBField('Type') ) - { - case 1: + switch ($params['show']) { + case 'current': + // selected countries in current zone + $sql = 'SELECT cs.' . $name_field . ', cs.' . $id_field . ' + FROM ' . $table_name . ' cs + LEFT JOIN ' . $destination_table . ' zd ON zd.StdDestId = cs.' . $id_field . ' + WHERE cs.Type = ' . DESTINATION_TYPE_COUNTRY . ' AND zd.TaxZoneId = ' . $object->GetID() . ' + ORDER BY cs.' . $name_field; + break; - $sql = 'SELECT * FROM '.TABLE_PREFIX.'StdDestinations WHERE DestType=1'; - $res = $this->Conn->Query($sql, 'DestId'); - - $dropdown = ''."\n"; - - $form_params = Array(); - $form_params['dropdown'] = $dropdown; - $form_params['block'] = $param['block']; - $form_params['res'] = $res; - $ret = $this->ShowDestionationForm($form_params); + case 'available': + // available countries in current zone + $sql = 'SELECT cs.' . $name_field . ', cs.' . $id_field . ' + FROM ' . $table_name . ' cs + LEFT JOIN ' . $destination_table . ' zd ON zd.StdDestId = cs.' . $id_field . ' + WHERE cs.Type = ' . DESTINATION_TYPE_COUNTRY . ' AND zd.TaxZoneId IS NULL + ORDER BY cs.' . $name_field; break; - case 2: - $country_sql = 'SELECT d1.* FROM '.TABLE_PREFIX.'StdDestinations d1, - '.TABLE_PREFIX.'StdDestinations d2 - WHERE d1.DestType=1 AND d1.DestId=d2.DestParentId - GROUP BY d1.DestId'; - if( !($current_country = $this->Application->GetVar('StatesCountry')) ) - { - $current_country_sql = 'SELECT sd.DestParentId FROM '.TABLE_PREFIX.'StdDestinations sd - LEFT JOIN '.$destination->TableName.' zd - ON zd.StdDestId = sd.DestId - WHERE sd.DestType=2 AND zd.TaxZoneId='.$zone->GetDBField('TaxZoneId'); - if($zone->GetDBField('TaxZoneId')) - { - $current_country = $this->Conn->GetOne($current_country_sql); - } + case 'all': + // always preselect 1st country, when user haven't selected any + if (!$selected_country_id) { + $sql = 'SELECT StdDestId + FROM ' . $destination_table . ' + WHERE TaxZoneId = ' . $object->GetID(); + $selected_country_id = $this->Conn->GetOne($sql); - if(!$current_country) - { - $current_country_sql = 'SELECT DestId FROM '.TABLE_PREFIX.'StdDestinations WHERE DestType=1'; - $current_country = $this->Conn->GetOne($current_country_sql); + if ($selected_country_id) { + $this->Application->SetVar('CountrySelector', $selected_country_id); } } - $states_sql = 'SELECT * FROM '.TABLE_PREFIX.'StdDestinations WHERE DestType=2 AND DestParentId='.$current_country; - $countries = $this->Conn->Query($country_sql, 'DestId'); - $states = $this->Conn->Query($states_sql, 'DestId'); - if($countries) - { - $countries_dropdown = ''."\n"; - } - - if($states) - { - $states_dropdown = ''."\n"; - } - - $form_params = Array(); - $table = ''; - $table .= '
'.$this->Application->Phrase('la_Country').': '.$countries_dropdown.'
'.$this->Application->Phrase('la_State').': '.$states_dropdown.'
'; - $form_params['dropdown'] = $table; - $form_params['block'] = $param['block']; - $form_params['res'] = $states; - $ret = $this->ShowDestionationForm($form_params); - + // all countries + $sql = 'SELECT ' . $name_field . ', ' . $id_field . ' + FROM ' . $table_name . ' + WHERE Type = ' . DESTINATION_TYPE_COUNTRY . ' + ORDER BY ' . $name_field; break; - case 3: - if( !($current_country = $this->Application->GetVar('StatesCountry')) ) - { - $current_country_sql = 'SELECT sd.DestParentId FROM '.TABLE_PREFIX.'StdDestinations sd - LEFT JOIN '.$destination->TableName.' zd - ON zd.StdDestId = sd.DestId - WHERE sd.DestType=2 AND zd.TaxZoneId='.$zone->GetDBField('TaxZoneId'); - if($zone->GetDBField('TaxZoneId')) - { - $current_country = $this->Conn->GetOne($current_country_sql); - } + case 'has_states': + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ - if(!$current_country) - { - $current_country_sql = 'SELECT StdDestId FROM '.$destination->TableName.' WHERE TaxZoneId='.$zone->GetID(); - $current_country = $this->Conn->GetOne($current_country_sql); - } + $has_states = $cs_helper->getCountriesWithStates(); - if(!$current_country) - { - $current_country_sql = 'SELECT DestId FROM '.TABLE_PREFIX.'StdDestinations WHERE DestType=1'; - $current_country = $this->Conn->GetOne($current_country_sql); - } - - + if ($selected_country_id && !array_key_exists($selected_country_id, $has_states)) { + list ($selected_country_id, ) = each($has_states); + $this->Application->SetVar('CountrySelector', $selected_country_id); } - $country_sql = 'SELECT d1.* FROM '.TABLE_PREFIX.'StdDestinations d1 - WHERE d1.DestType=1 - GROUP BY d1.DestId'; - $countries = $this->Conn->Query($country_sql, 'DestId'); + // preselect country from 1st found state + if (!$selected_country_id) { + $sql = 'SELECT cs.StateCountryId + FROM ' . $table_name . ' cs + LEFT JOIN ' . $destination_table . ' zd ON zd.StdDestId = cs.' . $id_field . ' + WHERE (cs.Type = ' . DESTINATION_TYPE_STATE . ') AND (zd.TaxZoneId = ' . $object->GetID() . ')'; + $selected_country_id = $this->Conn->GetOne($sql); - if($countries) - { - $countries_dropdown = ''."\n"; - } - - $sql = 'SELECT DestValue FROM '.$this->Application->getUnitOption('taxdst', 'TableName').' WHERE NOT(DestValue IS NULL) AND DestValue<>"" AND StdDestId='.$current_country; - $res = array_unique( $this->Conn->GetCol($sql) ); - $dropdown = ''; - if($res) - { - $dropdown .= ' or '."\n"; } - $table = ''; - $table .= '
'.$this->Application->Phrase('la_Country').': '.$countries_dropdown.'
'.$this->Application->Phrase('la_fld_ZIP').': '.$dropdown.'
'; - - $form_params = Array(); - $form_params['dropdown'] = $table; - $form_params['block'] = $param['block']; - $form_params['res'] = $res; - $ret = $this->ShowDestionationForm($form_params); - + // gets only countries with states + $sql = 'SELECT ' . $name_field . ', ' . $id_field . ' + FROM ' . $table_name . ' + WHERE Type = ' . DESTINATION_TYPE_COUNTRY . ' AND ' . $id_field . ' IN (' . implode(',', array_keys($has_states)) . ') + ORDER BY ' . $name_field; break; + default: + trigger_error('Unknown "show" parameter value "' . $params['show'] . '" used.', E_USER_ERROR); + break; } - $ret .= $hidden_clause; - return $ret; - } - */ - /* - function ShowDestionationForm($param) - { - $add_button = ''; + $ret = ''; + $countries = $this->Conn->GetCol($sql, $id_field); - $main_processor =& $this->Application->RecallObject('m_TagProcessor'); - $oddevenparam['odd'] = 'table-color1'; - $oddevenparam['even'] = 'table-color2'; - $ret = ''.$param['dropdown'].''.$add_button.''; + $block_params = $this->prepareTagParams($params); + $block_params['name'] = $params['block']; - $dest_list = $this->Application->GetVar('taxdst'); - if (is_array($dest_list)) - { + foreach ($countries as $country_id => $country_name) { + $block_params['id'] = $country_id; + $block_params['destination_title'] = $country_name; + $block_params['selected'] = $selected_country_id == $country_id ? ' selected="selected"' : ''; - - if (sizeof($dest_list)>0){ - $ret .= ' '; - $ret .= ''; - if($destination['StdDestId'] && !$destination['DestValue']) - { - $params['destination_title'] = $param['res'][$destination['StdDestId']]['DestName']; - $hidden .= ''; - } - else - { - $params['destination_title'] = $destination['DestValue']; - $hidden .= ''; - } - - $params['name'] = $param['block']; - $ret .= $main_processor->ParseBlock($params); - } - $ret .= ''; - - $ret .= ''; - $ret .= $hidden; - $ret .= " "; - }else{ - - } + $ret .= $this->Application->ParseBlock($block_params); } -// ][TaxZoneDestId]" name="taxdst[][TaxZoneDestId]" value=""> return $ret; } - */ - function ShowCountries($param){ - $param = $this->prepareTagParams($param); - $param['name'] = $param['block']; + function ShowStates($params) + { + $object =& $this->getObject($params); + /* @var $object kDBItem */ - $destination = &$this->Application->recallObject('taxdst'); - $zone = &$this->Application->recallObject('tax'); + $destination_table = $this->getDestinationsTable($params); - switch ($param['show']){ + $name_field = 'l' . $this->Application->GetVar('m_lang') . '_Name'; + $id_field = $this->Application->getUnitOption('country-state', 'IDField'); + $table_name = $this->Application->getUnitOption('country-state', 'TableName'); + + $country_id = $this->Application->GetVar('CountrySelector'); + + switch ($params['show']) { case 'current': - $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'; + // selected states for current country and zone + $sql = 'SELECT cs.' . $name_field . ', cs.' . $id_field . ' + FROM ' . $table_name . ' cs + LEFT JOIN ' . $destination_table . ' zd ON zd.StdDestId = cs.' . $id_field . ' + WHERE + cs.Type = ' . DESTINATION_TYPE_STATE . ' AND + cs.StateCountryId = ' . $country_id . ' AND + zd.TaxZoneId = ' . $object->GetID() . ' + ORDER BY cs.' . $name_field; 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 zd.TaxZoneId IS NULL - ORDER BY l' . $this->Application->GetVar('lang.current_id') . '_Translation'; + // available states for current country and zone + $sql = 'SELECT cs.' . $name_field . ', cs.' . $id_field . ' + FROM ' . $table_name . ' cs + LEFT JOIN ' . $destination_table . ' zd ON zd.StdDestId = cs.' . $id_field . ' + WHERE + cs.Type = ' . DESTINATION_TYPE_STATE . ' + AND zd.TaxZoneId IS NULL + AND cs.StateCountryId = ' . $country_id . ' + ORDER BY cs.' . $name_field; break; case 'all': - $selected_country = $this->Application->GetVar('CountrySelector'); - if (!$selected_country){ - // get 1st available country ID - $selected_country = $this->Conn->GetOne('SELECT StdDestId FROM '.$destination->TableName.' - WHERE TaxZoneId='.$zone->GetDBField('TaxZoneId')); - if ($selected_country){ - $this->Application->SetVar('CountrySelector', $selected_country); - } - } - - $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'; + // all possible states for selected country + $sql = 'SELECT ' . $name_field . ', ' . $id_field . ' + FROM ' . $table_name . ' + WHERE Type = ' . DESTINATION_TYPE_STATE . ' AND StateCountryId = ' . $country_id . ' + ORDER BY ' . $name_field; break; - case 'has_states': - $has_states = $this->Conn->GetCol('SELECT DISTINCT DestParentId FROM '.TABLE_PREFIX.'StdDestinations sd - WHERE sd.DestType=2'); - $selected_country = $this->Application->GetVar('CountrySelector'); - - if ($selected_country && !in_array($selected_country, $has_states)){ - $selected_country = $has_states[0]; - $this->Application->SetVar('CountrySelector', $selected_country); - } - - if (!$selected_country){ - // get 1st available country ID - $selected_country = $this->Conn->GetOne('SELECT DestParentId FROM '.TABLE_PREFIX.'StdDestinations sd - LEFT JOIN '.$destination->TableName.' zd - ON zd.StdDestId = sd.DestId - WHERE sd.DestType=2 - AND zd.TaxZoneId='.$zone->GetDBField('TaxZoneId')); - if ($selected_country){ - $this->Application->SetVar('CountrySelector', $selected_country); - } - else { - $selected_country = $has_states[0]; - $this->Application->SetVar('CountrySelector', $selected_country); - } - } - - $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'; + default: + trigger_error('Unknown "show" parameter value "' . $params['show'] . '" used.', E_USER_ERROR); break; } - $countries = $this->Conn->Query($sql); - $o = ''; + $ret = ''; + $states = $this->Conn->GetCol($sql, $id_field); + $block_params = $this->prepareTagParams($params); + $block_params['name'] = $params['block']; - foreach($countries as $key => $country) { - $param['id'] = $country['DestId']; - $param['destination_title'] = $this->Application->Phrase($country['DestName']); - if (isset($selected_country) && $selected_country == $param['id']){ - $param['selected'] = ' selected="selected"'; - } - else { - $param['selected']=''; - } - $o .= $this->Application->ParseBlock($param); + foreach($states as $state_id => $state_name) { + $block_params['id'] = $state_id; + $block_params['destination_title'] = $state_name; + + $ret .= $this->Application->ParseBlock($block_params); } - return $o; + return $ret; } - function ShowStates($param) + function ShowZips($params) { - $param = $this->prepareTagParams($param); - $param['name'] = $param['block']; + $object =& $this->getObject($params); + /* @var $object kDBItem */ - $destination = &$this->Application->recallObject('taxdst'); - $zone = &$this->Application->recallObject('tax'); + $destination_table = $this->getDestinationsTable($params); - 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 + $country_id = (int)$this->Application->GetVar('CountrySelector'); + + $current_sql = 'SELECT DestValue + FROM ' . $destination_table . ' 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'; + COALESCE(DestValue, "") <> "" AND + TaxZoneId = ' . $object->GetID() . ' + ORDER BY DestValue'; + + switch ($params['show']) { + case 'current': + $sql = $current_sql; 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 + $selected_zips = $this->Conn->GetCol($current_sql); + $selected_zips = array_map(Array (&$this->Conn, 'qstr'), $selected_zips); + + $sql = 'SELECT DISTINCT DestValue + FROM ' . $this->Application->getUnitOption('taxdst', 'TableName') . ' 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'; + COALESCE(DestValue, "") <> "" AND + TaxZoneId <> ' . $object->GetID() . ' AND + ' . ($selected_zips ? 'DestValue NOT IN (' . implode(',', $selected_zips) . ') AND' : '') . ' + StdDestId = ' . $country_id . ' + ORDER BY DestValue'; 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 sd.DestParentId='.$this->Application->GetVar('CountrySelector').' - ORDER BY l' . $this->Application->GetVar('lang.current_id') . '_Translation'; + default: + trigger_error('Unknown "show" parameter value "' . $params['show'] . '" used.', E_USER_ERROR); break; } - $states = $this->Conn->Query($sql); - $o = ''; - foreach($states as $key => $state) { - $param['id'] = $state['DestId']; - $param['destination_title'] = $this->Application->Phrase($state['DestName']); - $o .= $this->Application->ParseBlock($param); - } - return $o; + $zips = $this->Conn->GetCol($sql); - } + $ret = ''; + $block_params = $this->prepareTagParams($params); + $block_params['name'] = $params['block']; - function ShowZips($param){ + foreach($zips as $zip) { + $block_params['id'] = '0|' . $zip; + $block_params['destination_title'] = $zip; - $param = $this->prepareTagParams($param); - $param['name'] = $param['block']; + $ret .= $this->Application->ParseBlock($block_params); + } - $destination = &$this->Application->recallObject('taxdst'); - $zone = &$this->Application->recallObject('tax'); + return $ret; + } - $country_selector = $this->Application->GetVar('CountrySelector'); - if (!$country_selector){ - $country_selector=0; - } + /** + * Returns table for shipping zone destinations + * + * @param Array $params + * @return string + */ + function getDestinationsTable($params) + { + static $table_name = ''; - switch ($param['show']){ - case 'current': - $sql = 'SELECT * FROM '.$destination->TableName.' - WHERE NOT(DestValue IS NULL) - AND DestValue<>"" - AND TaxZoneID='.$zone->GetDBField('TaxZoneId').' - ORDER BY DestValue - '; - break; - case 'available': - $selected_zips = $this->Conn->GetCol('SELECT DestValue FROM '.$destination->TableName.' - WHERE NOT(DestValue IS NULL) - AND DestValue<>"" - AND TaxZoneID='.$zone->GetDBField('TaxZoneId').' - ORDER BY DestValue - '); + if (!$table_name) { + $object =& $this->getObject($params); + /* @var $object kDBItem */ - $sql = 'SELECT DISTINCT(DestValue) FROM '.$this->Application->getUnitOption('taxdst', 'TableName').' - WHERE NOT(DestValue IS NULL) - AND TaxZoneID!='.$zone->GetDBField('TaxZoneId').' - AND DestValue NOT IN ("'.implode('", "', $selected_zips).'") - AND DestValue<>"" AND StdDestId='.$country_selector.' - ORDER BY DestValue - '; + $table_name = $this->Application->getUnitOption('taxdst', 'TableName'); - break; - case 'all': - $sql = 'SELECT sd.* FROM '.TABLE_PREFIX.'StdDestinations sd - WHERE sd.DestType=3 AND sd.DestParentId='.$country_selector.' - ORDER BY DestValue - '; - break; + if ($object->IsTempTable()) { + $table_name = $this->Application->GetTempName($table_name, 'prefix:' . $this->Prefix); + } } - $zips = $this->Conn->Query($sql); - $o = ''; - foreach($zips as $key => $zip) { - $param['id'] = $zip['DestId'].'|'.$zip['DestValue']; - $param['destination_title'] = $zip['DestValue']; - $o .= $this->Application->ParseBlock($param); - } - return $o; - + return $table_name; } - } \ No newline at end of file Index: branches/5.1.x/install/upgrades.sql =================================================================== diff -u -N -r13110 -r13465 --- branches/5.1.x/install/upgrades.sql (.../upgrades.sql) (revision 13110) +++ branches/5.1.x/install/upgrades.sql (.../upgrades.sql) (revision 13465) @@ -122,4 +122,8 @@ # ===== v 5.0.2 ===== # ===== v 5.1.0-B1 ===== -UPDATE Modules SET Path = 'modules/in-commerce/' WHERE `Name` = 'In-Commerce'; \ No newline at end of file +UPDATE Modules SET Path = 'modules/in-commerce/' WHERE `Name` = 'In-Commerce'; + +UPDATE ConfigurationValues +SET ValueList = '0=lu_none||SELECT l%3$s_Name AS OptionName, CountryStateId AS OptionValue FROM CountryStates WHERE Type = 1 ORDER BY OptionName' +WHERE ValueList = '0=lu_none||SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM StdDestinations WHERE DestParentId IS NULL Order BY OptionName'; \ No newline at end of file Index: branches/5.1.x/units/shipping_quote_engines/usps.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/shipping_quote_engines/usps.php (.../usps.php) (revision 13100) +++ branches/5.1.x/units/shipping_quote_engines/usps.php (.../usps.php) (revision 13465) @@ -1,6 +1,6 @@ Application->ConfigValue('Comm_Shipping_Country'); if ($country != '') { - $db =& $this->Application->GetADODBConnection(); - $this->shipping_origin_country = $db->GetOne( - 'SELECT DestAbbr2 - FROM '.TABLE_PREFIX.'StdDestinations - WHERE - DestAbbr = '.$db->qstr($country).' - AND destType = 1 - ' - ); + $this->shipping_origin_country = $this->GetUSPSCountry($country, ''); } + $contact_name = trim($this->_prepare_xml_param($this->Application->ConfigValue('Comm_Contacts_Name'))); $split_pos = strpos($contact_name, ' '); if ($split_pos === false) { @@ -1003,11 +996,14 @@ return array('TrackingNumber' => $TrackingNumber, 'PostnetBarCode' => $PostnetBarCode, 'Postage' => $Postage); } - function GetUSPSCountry($country) + function GetUSPSCountry($country, $default = 'US') { - $country = $this->Application->Conn->GetOne('SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations WHERE DestAbbr = '.$this->Application->Conn->qstr($country)); - if ( $country == '' ) $country = 'US'; - return $country; + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $country = $cs_helper->getCountryIso($country); + + return $country == '' ? $default : $country; } function GetShippingQuotes($params = null) Index: branches/5.1.x/units/gateways/gw_classes/google_checkout.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/gateways/gw_classes/google_checkout.php (.../google_checkout.php) (revision 13100) +++ branches/5.1.x/units/gateways/gw_classes/google_checkout.php (.../google_checkout.php) (revision 13465) @@ -1,6 +1,6 @@ $address_info['POSTAL-CODE'], ); - $shipping_address['ShippingCountry'] = $this->getCountryISO($address_info['COUNTRY-CODE']); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + $shipping_address['ShippingCountry'] = $cs_helper->getCountryIso($address_info['COUNTRY-CODE'], true); + $order->SetDBFieldsFromHash($shipping_address); $order->Update(); @@ -514,6 +517,10 @@ 'REGION' => 'State', 'POSTAL-CODE' => 'Zip', ); + + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + foreach ($user_address as $field_prefix => $address_details) { foreach ($address_mapping as $src_field => $dst_field) { $order->SetDBField($field_prefix.$dst_field, $address_details[$src_field]); @@ -523,7 +530,7 @@ $order->SetDBField($field_prefix.'Phone', '-'); // required field } - $order->SetDBField($field_prefix.'Country', $this->getCountryISO($address_details['COUNTRY-CODE'])); + $order->SetDBField( $field_prefix.'Country', $cs_helper->getCountryIso($address_details['COUNTRY-CODE'], true) ); } $order->SetDBField('OnHold', 1); @@ -808,20 +815,6 @@ } /** - * Returns 3 symbols ISO code from 2 symbols ISO code - * - * @param string $country_code - * @return string - */ - function getCountryISO($country_code) - { - $sql = 'SELECT DestAbbr - FROM '.TABLE_PREFIX.'StdDestinations - WHERE DestAbbr2 = '.$this->Conn->qstr($country_code); - return $this->Conn->GetOne($sql); - } - - /** * Retrieves shipping types available for given order * * @param OrdersItem $order Index: branches/5.1.x/units/gateways/gw_classes/multicards.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/gateways/gw_classes/multicards.php (.../multicards.php) (revision 13100) +++ branches/5.1.x/units/gateways/gw_classes/multicards.php (.../multicards.php) (revision 13465) @@ -1,6 +1,6 @@ Conn->GetOne( sprintf($sql, $this->Conn->qstr($item_data['BillingCountry']) ) ); $ret['cust_country'] = $item_data['BillingCountry']; $ret['user1'] = $this->Application->GetSID().','.MD5($item_data['OrderId']); Index: branches/5.1.x/units/orders/orders_item.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/orders/orders_item.php (.../orders_item.php) (revision 13100) +++ branches/5.1.x/units/orders/orders_item.php (.../orders_item.php) (revision 13465) @@ -1,6 +1,6 @@ Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ - $shipping_country_id = (int) $this->Conn->GetOne( sprintf($sql, 1, $this->Conn->qstr($this->GetDBField('ShippingCountry') ) ) ); - $shipping_state_id = (int) $this->Conn->GetOne( sprintf($sql, 2, $this->Conn->qstr($this->GetDBField('ShippingState') ) ) ); + $shipping_country_id = $cs_helper->getCountryStateId($this->GetDBField('ShippingCountry'), DESTINATION_TYPE_COUNTRY); + $shipping_state_id = $cs_helper->getCountryStateId($this->GetDBField('ShippingState'), DESTINATION_TYPE_STATE); $shipping_zip = (string) $this->GetDBField('ShippingZip'); - $billing_country_id = (int) $this->Conn->GetOne( sprintf($sql, 1, $this->Conn->qstr($this->GetDBField('BillingCountry') ) ) ); - $billing_state_id = (int) $this->Conn->GetOne( sprintf($sql, 2, $this->Conn->qstr($this->GetDBField('BillingState') ) ) ); + $billing_country_id = $cs_helper->getCountryStateId($this->GetDBField('BillingCountry'), DESTINATION_TYPE_COUNTRY); + $billing_state_id = $cs_helper->getCountryStateId($this->GetDBField('BillingState'), DESTINATION_TYPE_STATE); $billing_zip = (string) $this->GetDBField('BillingZip'); /* Index: branches/5.1.x/units/orders/orders_event_handler.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 13100) +++ branches/5.1.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 13465) @@ -1,6 +1,6 @@ Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + $address =& $this->Application->recallObject('addr.-item','addr', Array('skip_autoload' => true)); $addr_list =& $this->Application->recallObject('addr', 'addr_List', Array('per_page'=>-1, 'skip_counting'=>true) ); $addr_list->Query(); @@ -592,16 +594,6 @@ { $this->setBillingAddress($event); - $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - - $object =& $event->getObject(); - if( $object->HasTangibleItems() ) - { - $cs_helper->CheckStateField($event, 'ShippingState', 'ShippingCountry'); - } - - $cs_helper->CheckStateField($event, 'BillingState', 'BillingCountry'); - parent::OnUpdate($event); if ($this->Application->isAdminUser) { @@ -616,6 +608,9 @@ } else { // strange: recalculate total amount on error + $object =& $event->getObject(); + /* @var $object kDBItem */ + $object->SetDBField('TotalAmount', $object->getTotalAmount()); } } @@ -664,28 +659,6 @@ } } - /** - * Enter description here... - * - * @param kEvent $event - */ - function OnPreSave(&$event) - { - $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - - $object =& $event->getObject(); - if ( $object->GetID() !== false) - { - if( $object->HasTangibleItems() ) - { - $cs_helper->CheckStateField($event, 'ShippingState', 'ShippingCountry'); - } - $cs_helper->CheckStateField($event, 'BillingState', 'BillingCountry'); - } - - parent::OnPreSave($event); - } - function OnUpdateCart(&$event) { $this->Application->HandleEvent($items_event, 'orditems:OnUpdate'); @@ -1199,9 +1172,8 @@ foreach ($req_fields as $field) { $order->Fields[$field]['required'] = $has_tangibles; } - if ($cs_helper->CountryHasStates( getArrayValue($field_values, 'ShippingCountry') )) { - $order->Fields['ShippingState']['required'] = true; // $has_tangibles - } + + $order->setRequired('ShippingState', $cs_helper->CountryHasStates( $field_values['ShippingCountry'] )); } // billing address required fields @@ -1210,9 +1182,8 @@ foreach ($req_fields as $field) { $order->Fields[$field]['required'] = true; } - if ($cs_helper->CountryHasStates( getArrayValue($field_values, 'BillingCountry') )) { - $order->Fields['BillingState']['required'] = true; - } + + $order->setRequired('BillingState', $cs_helper->CountryHasStates( $field_values['BillingCountry'] )); } $check_cc = $this->Application->GetVar('check_credit_card'); @@ -1965,6 +1936,8 @@ $object->SetDBField('PaymentCVV2', $this->Application->RecallVar('CVV2Code') ); $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + $cs_helper->PopulateStates($event, 'ShippingState', 'ShippingCountry'); $cs_helper->PopulateStates($event, 'BillingState', 'BillingCountry'); @@ -1975,19 +1948,49 @@ } /** + * Processes states + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + parent::OnBeforeItemCreate($event); + + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $cs_helper->PopulateStates($event, 'ShippingState', 'ShippingCountry'); + $cs_helper->PopulateStates($event, 'BillingState', 'BillingCountry'); + } + + /** * Enter description here... * * @param kEvent $event */ function OnBeforeItemUpdate(&$event) { + parent::OnBeforeItemUpdate($event); + + $object =& $event->getObject(); + /* @var $object OrdersItem */ + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + $cs_helper->PopulateStates($event, 'ShippingState', 'ShippingCountry'); $cs_helper->PopulateStates($event, 'BillingState', 'BillingCountry'); - $object = &$event->getObject(); - if ($object->GetDBField('Status') > ORDER_STATUS_PENDING) return; + if ($object->HasTangibleItems()) { + $cs_helper->CheckStateField($event, 'ShippingState', 'ShippingCountry', false); + } + $cs_helper->CheckStateField($event, 'BillingState', 'BillingCountry', false); + + if ($object->GetDBField('Status') > ORDER_STATUS_PENDING) { + return ; + } + $this->CheckUser($event); if(!$object->GetDBField('OrderIP')) { Index: branches/5.1.x/admin_templates/discounts/gift_certificate_edit.tpl =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/admin_templates/discounts/gift_certificate_edit.tpl (.../gift_certificate_edit.tpl) (revision 13100) +++ branches/5.1.x/admin_templates/discounts/gift_certificate_edit.tpl (.../gift_certificate_edit.tpl) (revision 13465) @@ -140,7 +140,7 @@ - + Index: branches/5.1.x/admin_templates/taxes/taxes_edit.tpl =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/admin_templates/taxes/taxes_edit.tpl (.../taxes_edit.tpl) (revision 13100) +++ branches/5.1.x/admin_templates/taxes/taxes_edit.tpl (.../taxes_edit.tpl) (revision 13465) @@ -54,7 +54,7 @@ - + @@ -173,17 +173,15 @@ - - - + - + - + Index: branches/5.1.x/units/shipping_quote_engines/intershipper.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/shipping_quote_engines/intershipper.php (.../intershipper.php) (revision 13100) +++ branches/5.1.x/units/shipping_quote_engines/intershipper.php (.../intershipper.php) (revision 13465) @@ -1,6 +1,6 @@ Application->ConfigValue('Comm_StoreName'); $params['orig_addr1'] = $this->Application->ConfigValue('Comm_Shipping_AddressLine1'); $params['orig_addr2'] = $this->Application->ConfigValue('Comm_Shipping_AddressLine2'); @@ -173,21 +171,23 @@ $params['orig_postal'] = $this->Application->ConfigValue('Comm_Shipping_ZIP'); $params['orig_country'] = $this->Application->ConfigValue('Comm_Shipping_Country'); } - if( mb_strlen($params['orig_country']) == 3) - { - $sql = 'SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations WHERE DestAbbr = "'.$params['orig_country'].'"'; - $params['orig_country'] = $db->GetOne($sql); + + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + if (strlen($params['orig_country']) == 3) { + // got 3symbol ISO code -> resolve to 2symbol ISO code + $params['orig_country'] = $cs_helper->getCountryIso( $params['orig_country'] ); } - if( mb_strlen($params['orig_state']) != 2) - { - $sql = ' SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations - WHERE DestName = "'.$params['orig_state'].'"'; - $params['orig_state'] = $db->GetOne($sql); + + if (strlen($params['orig_state']) != 2) { + // got state name instead of ISO code -> resolve it to ISO code + $country_iso = $cs_helper->getCountryIso($params['orig_country'], true); + $params['orig_state'] = $cs_helper->getStateIso($params['orig_state'], $country_iso); } - if(isset($custom_params['ShipMethod'])) - { - $params['ShipMethod'] = $custom_params['ShipMethod']; + if (isset($custom_params['ShipMethod'])) { + $params['ShipMethod'] = $custom_params['ShipMethod']; } $params['packages'] = $custom_params['packages']; @@ -199,10 +199,10 @@ $params['dest_state'] = $custom_params['dest_state']; $params['dest_postal'] = $custom_params['dest_postal']; $params['dest_country'] = $custom_params['dest_country']; - if( mb_strlen($params['dest_country']) == 3) - { - $sql = 'SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations WHERE DestAbbr = "'.$params['dest_country'].'"'; - $params['dest_country'] = $db->GetOne($sql); + + if (strlen($params['dest_country']) == 3) { + // got 3symbol ISO code -> resolve to 2symbol ISO code + $params['dest_country'] = $cs_helper->getCountryIso( $params['dest_country'] ); } if(!$params['dest_city'] || !$params['dest_country'] || Index: branches/5.1.x/units/shipping_quote_engines/custom_shipping_quote_engine.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/shipping_quote_engines/custom_shipping_quote_engine.php (.../custom_shipping_quote_engine.php) (revision 13100) +++ branches/5.1.x/units/shipping_quote_engines/custom_shipping_quote_engine.php (.../custom_shipping_quote_engine.php) (revision 13465) @@ -1,6 +1,6 @@ Application->GetADODBConnection(); - $user_country_id = (int) $db->GetOne('SELECT DestId FROM '.TABLE_PREFIX.'StdDestinations WHERE DestType=1 AND DestAbbr = '.$db->qstr($user_country_abbr)); - $user_state_id = (int) $db->GetOne('SELECT DestId FROM '.TABLE_PREFIX.'StdDestinations WHERE DestType=2 AND DestAbbr = '.$db->qstr($user_state_abbr)); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $user_country_id = $cs_helper->getCountryStateId($user_country, DESTINATION_TYPE_COUNTRY); + $user_state_id = $cs_helper->getCountryStateId($user_state, DESTINATION_TYPE_STATE); + $user_zip = (string) $user_zip; $weight = (float) $weight; $items = (int) $items; Index: branches/5.1.x/units/addresses/addresses_event_handler.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/addresses/addresses_event_handler.php (.../addresses_event_handler.php) (revision 13100) +++ branches/5.1.x/units/addresses/addresses_event_handler.php (.../addresses_event_handler.php) (revision 13465) @@ -1,6 +1,6 @@ Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $cs_helper->CheckStateField($event, 'State', 'Country'); + $cs_helper->PopulateStates($event, 'State', 'Country'); + $this->processLastUsed($object, 'Shipping'); $this->processLastUsed($object, 'Billing'); } function OnUpdate(&$event) { - $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - /* @var $cs_helper kCountryStatesHelper */ - - $cs_helper->CheckStateField($event, 'State', 'Country'); - parent::OnUpdate($event); $this->setNextTemplate($event); @@ -111,11 +112,6 @@ */ function OnCreate(&$event) { - $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - /* @var $cs_helper kCountryStatesHelper */ - - $cs_helper->CheckStateField($event, 'State', 'Country'); - parent::OnCreate($event); $this->setNextTemplate($event); @@ -140,22 +136,20 @@ } /** - * [HOOK] Prefill states dropdown with correct values + * Fills states for object country * * @param kEvent $event - * @access public */ - function OnPrepareStates(&$event) + function OnAfterItemLoad(&$event) { + parent::OnAfterItemLoad($event); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - $cs_helper->PopulateStates($event, 'State', 'Country'); + /* @var $cs_helper kCountryStatesHelper */ - $object =& $event->MasterEvent->getObject(); - - if( $object->isRequired('Country') && $cs_helper->CountryHasStates( $object->GetDBField('Country') ) ) $object->setRequired('State', true); + $cs_helper->PopulateStates($event, 'State', 'Country'); } - /** * [HOOK] Update PortalUser table when address marked as ProfileAddress is changed via addr prefix object * @@ -303,6 +297,12 @@ $object->SetDBField('PortalUserId', $this->Application->RecallVar('user_id')); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $cs_helper->CheckStateField($event, 'State', 'Country'); + $cs_helper->PopulateStates($event, 'State', 'Country'); + $this->processLastUsed($object, 'Shipping'); $this->processLastUsed($object, 'Billing'); } Index: branches/5.1.x/units/manufacturers/manufacturers_event_handler.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/manufacturers/manufacturers_event_handler.php (.../manufacturers_event_handler.php) (revision 13100) +++ branches/5.1.x/units/manufacturers/manufacturers_event_handler.php (.../manufacturers_event_handler.php) (revision 13465) @@ -1,6 +1,6 @@ Application->recallObject('CountryStatesHelper'); - $cs_helper->PopulateStates($event, 'State', 'Country'); + parent::OnAfterItemLoad($event); - $object =& $event->getObject(); - - if( $object->isRequired('Country') && $cs_helper->CountryHasStates( $object->GetDBField('Country') ) ) $object->setRequired('State', true); - } - - function OnUpdate(&$event) - { $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - $cs_helper->CheckStateField($event, 'State', 'Country'); + /* @var $cs_helper kCountryStatesHelper */ - parent::OnUpdate($event); + $cs_helper->PopulateStates($event, 'State', 'Country'); } - function OnCreate(&$event) + /** + * Processes states + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) { + parent::OnBeforeItemUpdate($event); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - $cs_helper->CheckStateField($event, 'State', 'Country'); + /* @var $cs_helper kCountryStatesHelper */ - parent::OnCreate($event); + $cs_helper->CheckStateField($event, 'State', 'Country'); + $cs_helper->PopulateStates($event, 'State', 'Country'); } - function OnPreSave(&$event) + /** + * Processes states + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) { + parent::OnBeforeItemCreate($event); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - $cs_helper->CheckStateField($event, 'State', 'Country'); + /* @var $cs_helper kCountryStatesHelper */ - parent::OnPreSave($event); + $cs_helper->CheckStateField($event, 'State', 'Country'); + $cs_helper->PopulateStates($event, 'State', 'Country'); } - } \ No newline at end of file Index: branches/5.1.x/units/shipping_quote_engines/shipping_quote_engine_event_handler.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/shipping_quote_engines/shipping_quote_engine_event_handler.php (.../shipping_quote_engine_event_handler.php) (revision 13100) +++ branches/5.1.x/units/shipping_quote_engines/shipping_quote_engine_event_handler.php (.../shipping_quote_engine_event_handler.php) (revision 13465) @@ -1,6 +1,6 @@ SetDBField('Properties', $properties); $from_country = $this->Application->ConfigValue('Comm_Shipping_Country'); - if( mb_strlen($from_country) == 3) - { - $sql = 'SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations WHERE DestAbbr = "'.$from_country.'"'; - $from_country = $this->Conn->GetOne($sql); + if (strlen($from_country) == 3) { + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + // get 2symbol ISO code from 3symbol ISO code + $from_country = $cs_helper->getCountryIso($from_country); } + if( !function_exists('curl_init') ) { $object->FieldErrors['Status']['pseudo'] = 'curl_not_present'; Index: branches/5.1.x/units/orders/orders_tag_processor.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/orders/orders_tag_processor.php (.../orders_tag_processor.php) (revision 13100) +++ branches/5.1.x/units/orders/orders_tag_processor.php (.../orders_tag_processor.php) (revision 13465) @@ -1,6 +1,6 @@ Application->ConfigValue('Comm_'.$field); if ($field == 'Country') { - $sql = 'SELECT DestName - FROM '.TABLE_PREFIX.'StdDestinations - WHERE DestAbbr = '.$this->Conn->qstr($value); - $value = $this->Application->Phrase( $this->Conn->GetOne($sql) ); + $current_language = $this->Application->GetVar('m_lang'); + $primary_language = $this->Application->GetDefaultLanguageId(); + + $sql = 'SELECT IF(l' . $current_language . '_Name = "", l' . $primary_language . '_Name, l' . $current_language . '_Name) + FROM ' . TABLE_PREFIX . 'CountryStates + WHERE IsoCode = ' . $this->Conn->qstr($value); + $value = $this->Conn->GetOne($sql); } if ($field == 'Country' && $value) { @@ -814,7 +817,7 @@ $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); /* @var $cs_helper kCountryStatesHelper */ - $cs_helper->PopulateStates(new kEvent('u:OnBuild') , 'State', 'Country'); + $cs_helper->PopulateStates(new kEvent('u:OnBuild'), 'State', 'Country'); } function UserLink($params) Index: branches/5.1.x/units/gateways/gw_classes/paypal_direct.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/gateways/gw_classes/paypal_direct.php (.../paypal_direct.php) (revision 13100) +++ branches/5.1.x/units/gateways/gw_classes/paypal_direct.php (.../paypal_direct.php) (revision 13465) @@ -1,6 +1,6 @@ Conn->GetOne( sprintf($sql, $this->Conn->qstr($item_data['BillingCountry']) ) ); + + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $post_fields['COUNTRYCODE'] = $cs_helper->getCountryIso( $item_data['BillingCountry'] ); $post_fields['ZIP'] = $item_data['BillingZip']; $post_fields['INVNUM'] = $item_data['OrderNumber']; $post_fields['CUSTOM'] = $item_data['PortalUserId']; @@ -115,8 +118,7 @@ } $post_fields['x_email'] = $billing_email; $post_fields['x_phone'] = $item_data['BillingPhone']; - $sql = 'SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations WHERE DestAbbr = %s'; - $post_fields['x_country'] = $this->Conn->GetOne( sprintf($sql, $this->Conn->qstr($item_data['BillingCountry']) ) ); + $post_fields['x_country'] = $cs_helper->getCountryIso( $item_data['BillingCountry'] ); $post_fields['x_cust_id'] = $item_data['PortalUserId']; $post_fields['x_invoice_num'] = $item_data['OrderNumber']; Index: branches/5.1.x/units/gateways/gw_classes/paypal.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/gateways/gw_classes/paypal.php (.../paypal.php) (revision 13100) +++ branches/5.1.x/units/gateways/gw_classes/paypal.php (.../paypal.php) (revision 13465) @@ -1,6 +1,6 @@ Conn->GetOne( sprintf($sql, $this->Conn->qstr($item_data['BillingCountry']) ) ); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $ret['country'] = $cs_helper->getCountryIso( $item_data['BillingCountry'] ); $ret['notify_url'] = $this->Application->BaseURL('/in-commerce').'gw_notify.php?sid='.$this->Application->GetSID().'&admin=1&order_id='.$item_data['OrderId']; $ret['cmd'] = '_xclick'; // act as "Buy Now" PayPal button return $ret; @@ -142,9 +144,11 @@ $ret['city'] = $item_data['BillingCity']; $ret['state'] = $item_data['BillingState']; $ret['zip'] = $item_data['BillingZip']; - $sql = 'SELECT DestAbbr2 FROM '.TABLE_PREFIX.'StdDestinations WHERE DestAbbr = %s'; - $ret['country'] = $this->Conn->GetOne( sprintf($sql, $this->Conn->qstr($item_data['BillingCountry']) ) ); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $ret['country'] = $cs_helper->getCountryIso( $item_data['BillingCountry'] ); $ret['notify_url'] = $this->Application->BaseURL('/in-commerce').'gw_notify.php?sid='.$this->Application->GetSID().'&admin=1&order_id='.$item_data['OrderId'].'&payment_type_id='.$tag_params['payment_type_id']; $ret['cmd'] = '_xclick-subscriptions'; // act as "Buy Now" PayPal button Index: branches/5.1.x/units/addresses/addresses_config.php =================================================================== diff -u -N -r13156 -r13465 --- branches/5.1.x/units/addresses/addresses_config.php (.../addresses_config.php) (revision 13156) +++ branches/5.1.x/units/addresses/addresses_config.php (.../addresses_config.php) (revision 13465) @@ -1,6 +1,6 @@ true, 'Hooks' => Array( - Array( - 'Mode' => hAFTER, - 'Conditional' => false, - 'HookToPrefix' => '', - 'HookToSpecial' => '*', - 'HookToEvent' => Array('OnAfterItemLoad', 'OnBeforeItemCreate', 'OnBeforeItemUpdate'), - 'DoPrefix' => '', - 'DoSpecial' => '*', - 'DoEvent' => 'OnPrepareStates', - ), - // create/update profile addres (in addresses table) Array( 'Mode' => hAFTER, @@ -107,12 +96,11 @@ 'Country' => Array( 'type' => 'string', 'formatter' => 'kOptionsFormatter', - 'options_sql' => ' SELECT %1$s - FROM '.TABLE_PREFIX.'StdDestinations - LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = '.TABLE_PREFIX.'StdDestinations.DestName - WHERE DestType = 1 - ORDER BY l%2$s_Translation', - 'option_key_field' => 'DestAbbr', 'option_title_field' => 'l%2$s_Translation', + 'options_sql' => ' SELECT IF(l%2$s_Name = "", l%3$s_Name, l%2$s_Name) AS Name, IsoCode + FROM ' . TABLE_PREFIX . 'CountryStates + WHERE Type = ' . DESTINATION_TYPE_COUNTRY . ' + ORDER BY Name', + 'option_key_field' => 'IsoCode', 'option_title_field' => 'Name', 'not_null' => '1', 'required' => 1, 'default' => '' ), Index: branches/5.1.x/units/manufacturers/manufacturers_config.php =================================================================== diff -u -N -r13156 -r13465 --- branches/5.1.x/units/manufacturers/manufacturers_config.php (.../manufacturers_config.php) (revision 13156) +++ branches/5.1.x/units/manufacturers/manufacturers_config.php (.../manufacturers_config.php) (revision 13465) @@ -1,6 +1,6 @@ Array('class'=>'ManufacturersEventHandler','file'=>'manufacturers_event_handler.php','build_event'=>'OnBuild'), 'TagProcessorClass' => Array('class'=>'ManufacturersTagProcessor','file'=>'manufacturers_tag_processor.php','build_event'=>'OnBuild'), 'AutoLoad' => true, - 'Hooks' => Array( - Array( - 'Mode' => hAFTER, - 'Conditional' => false, - 'HookToPrefix' => 'manuf', - 'HookToSpecial' => '', - 'HookToEvent' => Array('OnAfterItemLoad', 'OnBeforeItemCreate', 'OnBeforeItemUpdate', 'OnUpdateAddress'), - 'DoPrefix' => '', - 'DoSpecial' => '', - 'DoEvent' => 'OnPrepareStates', - ), - ), + 'QueryString' => Array( 1 => 'id', 2 => 'Page', @@ -115,12 +104,11 @@ 'Country' => Array( 'type' => 'string', 'formatter' => 'kOptionsFormatter', - 'options_sql' => ' SELECT %1$s - FROM '.TABLE_PREFIX.'StdDestinations - LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = '.TABLE_PREFIX.'StdDestinations.DestName - WHERE DestType = 1 - ORDER BY l%2$s_Translation', - 'option_key_field' => 'DestAbbr', 'option_title_field' => 'l%2$s_Translation', 'default' => null + 'options_sql' => ' SELECT IF(l%2$s_Name = "", l%3$s_Name, l%2$s_Name) AS Name, IsoCode + FROM '.TABLE_PREFIX.'CountryStates + WHERE Type = ' . DESTINATION_TYPE_COUNTRY . ' + ORDER BY Name', + 'option_key_field' => 'IsoCode', 'option_title_field' => 'Name', 'default' => null ), ), Index: branches/5.1.x/units/gateways/gw_classes/authorizenet.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/gateways/gw_classes/authorizenet.php (.../authorizenet.php) (revision 13100) +++ branches/5.1.x/units/gateways/gw_classes/authorizenet.php (.../authorizenet.php) (revision 13465) @@ -1,6 +1,6 @@ Conn->GetOne( sprintf($sql, $this->Conn->qstr($item_data['BillingCountry']) ) ); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $post_fields['x_country'] = $cs_helper->getCountryIso( $item_data['BillingCountry'] ); $post_fields['x_cust_id'] = $item_data['PortalUserId']; $post_fields['x_invoice_num'] = $item_data['OrderNumber']; $post_fields['x_description'] = 'Invoice #'.$item_data['OrderNumber']; Index: branches/5.1.x/units/gateways/gw_classes/worldpay.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/gateways/gw_classes/worldpay.php (.../worldpay.php) (revision 13100) +++ branches/5.1.x/units/gateways/gw_classes/worldpay.php (.../worldpay.php) (revision 13465) @@ -1,6 +1,6 @@ Conn->GetOne( sprintf($sql, $this->Conn->qstr($item_data['BillingCountry']) ) ); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); + /* @var $cs_helper kCountryStatesHelper */ + + $ret['country'] = $cs_helper->getCountryIso( $item_data['BillingCountry'] ); $ret['tel'] = $item_data['BillingPhone']; $ret['fax'] = $item_data['BillingFax']; $ret['email'] = $item_data['BillingEmail']; Index: branches/5.1.x/units/orders/orders_config.php =================================================================== diff -u -N -r13156 -r13465 --- branches/5.1.x/units/orders/orders_config.php (.../orders_config.php) (revision 13156) +++ branches/5.1.x/units/orders/orders_config.php (.../orders_config.php) (revision 13465) @@ -1,6 +1,6 @@ Array( 'type' => 'string', 'formatter' => 'kOptionsFormatter', - 'options_sql' => ' SELECT %1$s - FROM '.TABLE_PREFIX.'StdDestinations - LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = '.TABLE_PREFIX.'StdDestinations.DestName - WHERE DestType = 1 - ORDER BY l%2$s_Translation', - 'option_key_field' => 'DestAbbr', 'option_title_field' => 'l%2$s_Translation', + 'options_sql' => ' SELECT IF(l%2$s_Name = "", l%3$s_Name, l%2$s_Name) AS Name, IsoCode + FROM '.TABLE_PREFIX.'CountryStates + WHERE Type = ' . DESTINATION_TYPE_COUNTRY . ' + ORDER BY Name', + 'option_key_field' => 'IsoCode', 'option_title_field' => 'Name', 'not_null' => 1, 'default' => 'USA' ), 'VAT' => Array('type' => 'float','formatter'=>'kFormatter','not_null'=>1,'default' => '0','format'=>'%01.2f'), @@ -365,12 +364,11 @@ 'ShippingZip' => Array('type' => 'string','not_null' => '1','default' => ''), 'ShippingCountry' => Array( 'type' => 'string', 'formatter' => 'kOptionsFormatter', - 'options_sql' => ' SELECT %1$s - FROM '.TABLE_PREFIX.'StdDestinations - LEFT JOIN '.TABLE_PREFIX.'Phrase ON '.TABLE_PREFIX.'Phrase.Phrase = '.TABLE_PREFIX.'StdDestinations.DestName - WHERE DestType = 1 - ORDER BY l%2$s_Translation', - 'option_key_field' => 'DestAbbr', 'option_title_field' => 'l%2$s_Translation', + 'options_sql' => ' SELECT IF(l%2$s_Name = "", l%3$s_Name, l%2$s_Name) AS Name, IsoCode + FROM '.TABLE_PREFIX.'CountryStates + WHERE Type = ' . DESTINATION_TYPE_COUNTRY . ' + ORDER BY Name', + 'option_key_field' => 'IsoCode', 'option_title_field' => 'Name', 'not_null' => 1, 'default' => 'USA' ), 'ShippingType' => Array('type' => 'int','formatter'=>'kOptionsFormatter','options_sql'=>'SELECT %s FROM '.TABLE_PREFIX.'ShippingType WHERE Status = 1','option_key_field'=>'ShippingID','option_title_field'=>'Name', 'not_null' => 1, 'default' => 0), Index: branches/5.1.x/install/install_data.sql =================================================================== diff -u -N -r13441 -r13465 --- branches/5.1.x/install/install_data.sql (.../install_data.sql) (revision 13441) +++ branches/5.1.x/install/install_data.sql (.../install_data.sql) (revision 13465) @@ -10,13 +10,13 @@ INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_AddressLine2', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_AddressLine2', 'text', NULL, NULL, 20.02, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_City', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_City', 'text', NULL, NULL, 20.03, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_ZIP', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_ZIP', 'text', NULL, NULL, 20.04, 0, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Country', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_Country', 'select', NULL, '0=lu_none,SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM StdDestinations WHERE DestParentId IS NULL Order BY OptionName', 20.05, 0, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Country', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_Country', 'select', NULL, '0=lu_none||SELECT l%3$s_Name AS OptionName, CountryStateId AS OptionValue FROM CountryStates WHERE Type = 1 ORDER BY OptionName', 20.05, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_State', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_StoreAddress', 'la_State', 'text', NULL, '', 20.06, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Shipping_AddressLine1', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_AddressLine1', 'text', NULL, NULL, 30.01, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Shipping_AddressLine2', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_AddressLine2', 'text', NULL, NULL, 30.02, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Shipping_City', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_City', 'text', NULL, NULL, 30.03, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Shipping_ZIP', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_ZIP', 'text', NULL, NULL, 30.04, 0, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Shipping_Country', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_Country', 'select', NULL, '0=lu_none,SELECT DestName AS OptionName, DestAbbr AS OptionValue FROM StdDestinations WHERE DestParentId IS NULL Order BY OptionName', 30.05, 0, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Shipping_Country', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_Country', 'select', NULL, '0=lu_none||SELECT l%3$s_Name AS OptionName, CountryStateId AS OptionValue FROM CountryStates WHERE Type = 1 ORDER BY OptionName', 30.05, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Shipping_State', '', 'In-Commerce', 'in-commerce:contacts', 'la_Text_ShippingAddress', 'la_State', 'text', NULL, NULL, 30.06, 0, 1, NULL); # Section "in-commerce:general": @@ -32,18 +32,18 @@ INSERT INTO ConfigurationValues VALUES(DEFAULT, 'MaxAddresses', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_MaxAddresses', 'text', NULL, NULL, 10.1, 0, 0, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_MaskProcessedCreditCards', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Orders', 'la_MaskProcessedCreditCards', 'checkbox', NULL, NULL, 10.11, 0, 0, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_AllowOrderingInNonPrimaryCurrency', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_Currencies', 'la_AllowOrderingInNonPrimaryCurrency', 'checkbox', NULL, NULL, 20.01, 0, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_ExchangeRateSource', '3', 'In-Commerce', 'in-commerce:general', 'la_Text_Currencies', 'la_ExchangeRateSource', 'select', NULL, '2=la_FederalReserveBank,3=la_EuropeanCentralBank,1=la_BankOfLatvia', 20.02, 0, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_ExchangeRateSource', '3', 'In-Commerce', 'in-commerce:general', 'la_Text_Currencies', 'la_ExchangeRateSource', 'select', NULL, '2=la_FederalReserveBank||3=la_EuropeanCentralBank||1=la_BankOfLatvia', 20.02, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_DefaultCouponDuration', '14', 'In-Commerce', 'in-commerce:general', 'la_Text_Coupons', 'la_conf_DefaultCouponDuration', 'text', NULL, NULL, 30.01, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_RegisterAsAffiliate', '0', 'In-Commerce', 'in-commerce:general', 'la_Text_Affiliates', 'la_prompt_register_as_affiliate', 'checkbox', NULL, '', 40.01, 0, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_AffiliateStorageMethod', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_Affiliates', 'la_prompt_affiliate_storage_method', 'radio', NULL, '1=la_opt_Session,2=la_opt_PermanentCookie', 40.02, 0, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_AffiliateStorageMethod', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_Affiliates', 'la_prompt_affiliate_storage_method', 'radio', NULL, '1=la_opt_Session||2=la_opt_PermanentCookie', 40.02, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_AffiliateCookieDuration', '30', 'In-Commerce', 'in-commerce:general', 'la_Text_Affiliates', 'la_prompt_affiliate_cookie_duration', 'text', NULL, '', 40.03, 0, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_PriceBracketCalculation', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_PricingCalculation', 'la_prompt_PriceBracketCalculation', 'radio', NULL, '1=la_opt_PriceCalculationByPrimary,2=la_opt_PriceCalculationByOptimal', 50, 0, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_PriceBracketCalculation', '1', 'In-Commerce', 'in-commerce:general', 'la_Text_PricingCalculation', 'la_prompt_PriceBracketCalculation', 'radio', NULL, '1=la_opt_PriceCalculationByPrimary||2=la_opt_PriceCalculationByOptimal', 50, 0, 1, NULL); # Section "in-commerce:output": -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_OrderProductsBy', 'Name', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_OrderProductsBy', 'select', NULL, '=la_none,Name=la_fld_Title,SKU=la_fld_SKU,Manufacturer=la_fld_Manufacturer,Price=la_fld_Price,CreatedOn=la_fld_CreatedOn,Modified=la_fld_Modified,Qty=la_fld_Qty,SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM CustomField WHERE (Type = 11) AND (IsSystem = 0)', 10.01, 1, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_OrderProductsByDir', 'ASC', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_OrderProductsBy', 'select', NULL, 'ASC=la_common_Ascending,DESC=la_common_Descending', 10.01, 2, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_OrderProductsThenBy', 'Price', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_ThenBy', 'select', NULL, '=la_none,Name=la_fld_Title,SKU=la_fld_SKU,Manufacturer=la_fld_Manufacturer,Price=la_fld_Price,CreatedOn=la_fld_CreatedOn,Modified=la_fld_Modified,Qty=la_fld_Qty,SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM CustomField WHERE (Type = 11) AND (IsSystem = 0)', 10.02, 1, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_OrderProductsThenByDir', 'ASC', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_ThenBy', 'select', NULL, 'ASC=la_common_Ascending,DESC=la_common_Descending', 10.02, 2, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_OrderProductsBy', 'Name', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_OrderProductsBy', 'select', NULL, '=la_none||Name=la_fld_Title||SKU=la_fld_SKU||Manufacturer=la_fld_Manufacturer||Price=la_fld_Price||CreatedOn=la_fld_CreatedOn||Modified=la_fld_Modified||Qty=la_fld_Qty||SELECT Prompt AS OptionName CONCAT("cust_" FieldName) AS OptionValue FROM CustomField WHERE (Type = 11) AND (IsSystem = 0)', 10.01, 1, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_OrderProductsByDir', 'ASC', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_OrderProductsBy', 'select', NULL, 'ASC=la_common_Ascending||DESC=la_common_Descending', 10.01, 2, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_OrderProductsThenBy', 'Price', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_ThenBy', 'select', NULL, '=la_none||Name=la_fld_Title||SKU=la_fld_SKU||Manufacturer=la_fld_Manufacturer||Price=la_fld_Price||CreatedOn=la_fld_CreatedOn||Modified=la_fld_Modified||Qty=la_fld_Qty||SELECT Prompt AS OptionName CONCAT("cust_" FieldName) AS OptionValue FROM CustomField WHERE (Type = 11) AND (IsSystem = 0)', 10.02, 1, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_OrderProductsThenByDir', 'ASC', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_ThenBy', 'select', NULL, 'ASC=la_common_Ascending||DESC=la_common_Descending', 10.02, 2, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Perpage_Products', '10', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_Perpage_Products', 'text', NULL, NULL, 10.03, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Perpage_Products_Short', '3', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_Perpage_Products_Shortlist', 'text', NULL, NULL, 10.04, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Product_NewDays', '7', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_DaysToBeNew', 'text', NULL, NULL, 10.05, 0, 1, NULL); @@ -52,11 +52,11 @@ INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Product_MaxHotNumber', '5', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_fld_Product_MaxHotNumber', 'text', NULL, NULL, 10.08, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'products_EditorPicksAboveRegular', '1', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_conf_EditorPicksAboveRegular', 'checkbox', NULL, NULL, 10.09, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_RatingDelay_Value', '30', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_prompt_DupRating', 'text', '', 'style="width: 50px;"', 10.1, 1, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_RatingDelay_Interval', '86400', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_prompt_DupRating', 'select', '', '1=la_opt_Sec,60=la_opt_Min,3600=la_opt_Hour,86400=la_opt_Day,604800=la_opt_Week,2419200=la_opt_Month,29030400=la_opt_Year', 10.1, 2, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_RatingDelay_Interval', '86400', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_prompt_DupRating', 'select', '', '1=la_opt_Sec||60=la_opt_Min||3600=la_opt_Hour||86400=la_opt_Day||604800=la_opt_Week||2419200=la_opt_Month||29030400=la_opt_Year', 10.1, 2, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'ShowProductImagesInOrders', '0', 'In-Commerce', 'in-commerce:output', 'la_Text_Products', 'la_config_ShowProductImagesInOrders', 'checkbox', NULL, NULL, 10.11, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Perpage_Reviews', '10', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_config_PerpageReviews', 'text', NULL, NULL, 20.01, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_ReviewDelay_Value', '30', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_prompt_DupReviews', 'text', '', 'style="width: 50px;"', 20.02, 1, 1, NULL); -INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_ReviewDelay_Interval', '86400', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_prompt_DupReviews', 'select', '', '1=la_opt_Sec,60=la_opt_Min,3600=la_opt_Hour,86400=la_opt_Day,604800=la_opt_Week,2419200=la_opt_Month,29030400=la_opt_Year', 20.02, 2, 1, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'product_ReviewDelay_Interval', '86400', 'In-Commerce', 'in-commerce:output', 'la_Text_Reviews', 'la_prompt_DupReviews', 'select', '', '1=la_opt_Sec||60=la_opt_Min||3600=la_opt_Hour||86400=la_opt_Day||604800=la_opt_Week||2419200=la_opt_Month||29030400=la_opt_Year', 20.02, 2, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Perpage_Manufacturers', '10', 'In-Commerce', 'in-commerce:output', 'la_Text_Manufacturers', 'la_Perpage_Manufacturers', 'text', NULL, NULL, 30.01, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Comm_Perpage_Manufacturers_Short', '3', 'In-Commerce', 'in-commerce:output', 'la_Text_Manufacturers', 'la_Perpage_Manufacturers_Short', 'text', NULL, NULL, 30.02, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'p_CategoryTemplate', '/in-commerce/designs/section', 'In-Commerce', 'in-commerce:output', 'la_section_Templates', 'la_fld_CategoryTemplate', 'text', '', '', 40.01, 0, 0, NULL); Index: branches/5.1.x/admin_templates/shipping/zone_edit.tpl =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/admin_templates/shipping/zone_edit.tpl (.../zone_edit.tpl) (revision 13100) +++ branches/5.1.x/admin_templates/shipping/zone_edit.tpl (.../zone_edit.tpl) (revision 13465) @@ -56,7 +56,7 @@ - + @@ -160,6 +160,9 @@ + + +
@@ -171,17 +174,15 @@ - - - + - + - + @@ -193,8 +194,7 @@ -][ShippingTypeID]" id="z[][ShippingTypeID]" value=""> -"> +