// merge 1.4 (5397)

This commit is contained in:
fBrignoli
2011-04-22 16:00:58 +00:00
parent 0cd5856fe5
commit ff49083fb6
126 changed files with 3390 additions and 1430 deletions
+4 -2
View File
@@ -610,7 +610,7 @@ if (Tools::isSubmit('getAdminHomeElement'))
$isoCountry = Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'));
$context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5)));
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context);
$content = @file_get_contents('https://www.prestashop.com/partner/preactivation/preactivation-block.php?version=1.0&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'&protocol='.$protocol.'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&date_creation='._PS_CREATION_DATE_.'&v='._PS_VERSION_.'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context);
if (!$content)
die('NOK');
$content = explode('|', $content);
@@ -629,6 +629,8 @@ if (Tools::isSubmit('getAdminHomeElement'))
}
}
}
else
$result['partner_preactivation'] = '';
// DISCOVER PRESTASHOP
$content = @file_get_contents('https://www.prestashop.com/partner/prestashop/prestashop-link.php?iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang, false, $context);
@@ -648,4 +650,4 @@ if (Tools::isSubmit('getAdminHomeElement'))
die(Tools::jsonEncode($result));
}
}
+191 -111
View File
@@ -62,7 +62,7 @@ class AdminAddresses extends AdminTab
'address1' => array('title' => $this->l('Address'), 'width' => 200),
'postcode' => array('title' => $this->l('Postcode/ Zip Code'), 'align' => 'right', 'width' => 50),
'city' => array('title' => $this->l('City'), 'width' => 150),
'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'cl!id_country'));
'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'id_country'));
parent::__construct();
}
@@ -275,6 +275,13 @@ class AdminAddresses extends AdminTab
<input type="text" size="33" name="email" value="'.htmlentities(Tools::getValue('email'), ENT_COMPAT, 'UTF-8').'" style="text-transform: lowercase;" /> <sup>*</sup>
</div>';
}
echo '
<label for="dni">'.$this->l('Identification Number').'</label>
<div class="margin-form">
<input type="text" name="dni" id="dni" value="'.htmlentities($this->getFieldValue($obj, 'dni'), ENT_COMPAT, 'UTF-8').'" />
<p>'.$this->l('DNI / NIF / NIE').'</p>
</div>';
echo '<label>'.$this->l('Alias').'</label>
<div class="margin-form">
<input type="text" size="33" name="alias" value="'.htmlentities($this->getFieldValue($obj, 'alias'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
@@ -282,143 +289,216 @@ class AdminAddresses extends AdminTab
</div>';
break;
}
if ($this->addressType != 'manufacturer')
{
echo '<label>'.$this->l('Company').'</label>
<div class="margin-form">
<input type="text" size="33" name="company" value="'.htmlentities($this->getFieldValue($obj, 'company'), ENT_COMPAT, 'UTF-8').'" />
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
</div>';
$addresses_fields = $this->processAddressFormat();
$addresses_fields = $addresses_fields["dlv_all_fields"]; // we use delivery address
if ((Configuration::get('VATNUMBER_MANAGEMENT') AND file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php')) && VatNumber::isApplicable(Configuration::get('PS_COUNTRY_DEFAULT')))
echo '<div id="vat_area" style="display: visible">';
else if(Configuration::get('VATNUMBER_MANAGEMENT'))
echo '<div id="vat_area" style="display: hidden">';
else
echo'<div style="display: none;">';
foreach($addresses_fields as $addr_field_item)
{
if ($addr_field_item == 'company')
{
if ($this->addressType != 'manufacturer')
{
echo '<label>'.$this->l('Company').'</label>
<div class="margin-form">
<input type="text" size="33" name="company" value="'.htmlentities($this->getFieldValue($obj, 'company'), ENT_COMPAT, 'UTF-8').'" />
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
</div>';
if ((Configuration::get('VATNUMBER_MANAGEMENT') AND file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php')) && VatNumber::isApplicable(Configuration::get('PS_COUNTRY_DEFAULT')))
echo '<div id="vat_area" style="display: visible">';
else if(Configuration::get('VATNUMBER_MANAGEMENT'))
echo '<div id="vat_area" style="display: hidden">';
else
echo'<div style="display: none;">';
echo '<label>'.$this->l('VAT number').'</label>
<div class="margin-form">
<div class="margin-form">
<input type="text" size="33" name="vat_number" value="'.htmlentities($this->getFieldValue($obj, 'vat_number'), ENT_COMPAT, 'UTF-8').'" />
</div>
</div>';
}
</div>
</div>';
}
}
elseif ($addr_field_item == 'lastname')
{
echo '
<label>'.$this->l('Last name').'</label>
<div class="margin-form">
<label>'.$this->l('Last name').'</label>
<div class="margin-form">
<input type="text" size="33" name="lastname" value="'.htmlentities($this->getFieldValue($obj, 'lastname'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"{}_$%:<span class="hint-pointer">&nbsp;</span></span>
</div>
<label>'.$this->l('First name').'</label>
<div class="margin-form">
</div>';
}
elseif ($addr_field_item == 'firstname')
{
echo '
<label>'.$this->l('First name').'</label>
<div class="margin-form">
<input type="text" size="33" name="firstname" value="'.htmlentities($this->getFieldValue($obj, 'firstname'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"{}_$%:<span class="hint-pointer">&nbsp;</span></span>
</div>
<label for="dni">'.$this->l('Identification Number').'</label>
<div class="margin-form">
<input type="text" name="dni" id="dni" value="'.htmlentities($this->getFieldValue($obj, 'dni'), ENT_COMPAT, 'UTF-8').'" />
<p>'.$this->l('DNI / NIF / NIE').'</p>
</div>
<label>'.$this->l('Address').'</label>
<div class="margin-form">
<input type="text" size="33" name="address1" value="'.htmlentities($this->getFieldValue($obj, 'address1'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
</div>
<label>'.$this->l('Address').' (2):</label>
<div class="margin-form">
<input type="text" size="33" name="address2" value="'.htmlentities($this->getFieldValue($obj, 'address2'), ENT_COMPAT, 'UTF-8').'" />
</div>
<label>'.$this->l('Postcode/ Zip Code').'</label>
<div class="margin-form">
<input type="text" size="33" name="postcode" value="'.htmlentities($this->getFieldValue($obj, 'postcode'), ENT_COMPAT, 'UTF-8').'" />
</div>
<label>'.$this->l('City').'</label>
<div class="margin-form">
<input type="text" size="33" name="city" value="'.htmlentities($this->getFieldValue($obj, 'city'), ENT_COMPAT, 'UTF-8').'" style="text-transform: uppercase;" /> <sup>*</sup>
</div>
<label>'.$this->l('Country').'</label>
<div class="margin-form">
<select name="id_country" id="id_country" />';
$selectedCountry = $this->getFieldValue($obj, 'id_country');
foreach ($this->countriesArray AS $id_country => $name)
echo ' <option value="'.$id_country.'"'.((!$selectedCountry AND Configuration::get('PS_COUNTRY_DEFAULT') == $id_country) ? ' selected="selected"' : ($selectedCountry == $id_country ? ' selected="selected"' : '')).'>'.$name.'</option>';
echo ' </select> <sup>*</sup>
</div>';
$id_country_ajax = (int)$this->getFieldValue($obj, 'id_country');
echo '
<script type="text/javascript">
$(document).ready(function(){
ajaxStates ();
$(\'#id_country\').change(function() {
ajaxStates ();
});
function ajaxStates ()
{
$.ajax({
url: "ajax.php",
cache: false,
data: "ajaxStates=1&id_country="+$(\'#id_country\').val()+"&id_state="+$(\'#id_state\').val(),
success: function(html)
{
if (html == \'false\')
{
$("#contains_states").fadeOut();
$(\'#id_state option[value=0]\').attr("selected", "selected");
}
else
{
$("#id_state").html(html);
$("#contains_states").fadeIn();
$(\'#id_state option[value='.(int)$obj->id_state.']\').attr("selected", "selected");
}
}
});
';
if (file_exists(_MODULE_DIR_.'vatnumber/ajax.php'))
echo ' $.ajax({
type: "GET",
url: "'._MODULE_DIR_.'vatnumber/ajax.php?id_country="+$(\'#id_country\').val(),
success: function(isApplicable)
{
if(isApplicable == 1)
$(\'#vat_area\').show();
else
$(\'#vat_area\').hide();
}
});';
echo ' };
});
</script>
<div id="contains_states" '.(!Country::containsStates((int)$selectedCountry) ? 'style="display:none;"' : '').'>
<label>'.$this->l('State').'</label>
</div>';
}
elseif ($addr_field_item == 'address1')
{
echo '
<label>'.$this->l('Address').'</label>
<div class="margin-form">
<select name="id_state" id="id_state">
</select>
</div>
<input type="text" size="33" name="address1" value="'.htmlentities($this->getFieldValue($obj, 'address1'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
</div>';
}
elseif ($addr_field_item == 'address2')
{
echo '
<label>'.$this->l('Address').' (2):</label>
<div class="margin-form">
<input type="text" size="33" name="address2" value="'.htmlentities($this->getFieldValue($obj, 'address2'), ENT_COMPAT, 'UTF-8').'" />
</div>';
}
elseif ($addr_field_item == 'postcode')
{
echo '
<label>'.$this->l('Postcode/ Zip Code').'</label>
<div class="margin-form">
<input type="text" size="33" name="postcode" value="'.htmlentities($this->getFieldValue($obj, 'postcode'), ENT_COMPAT, 'UTF-8').'" />
</div>';
}
elseif ($addr_field_item == 'city')
{
echo '
<label>'.$this->l('City').'</label>
<div class="margin-form">
<input type="text" size="33" name="city" value="'.htmlentities($this->getFieldValue($obj, 'city'), ENT_COMPAT, 'UTF-8').'" style="text-transform: uppercase;" /> <sup>*</sup>
</div>';
}
elseif ($addr_field_item == 'country')
{
echo '
<label>'.$this->l('Country').'</label>
<div class="margin-form">
<select name="id_country" id="id_country" />';
$selectedCountry = $this->getFieldValue($obj, 'id_country');
foreach ($this->countriesArray AS $id_country => $name)
echo ' <option value="'.$id_country.'"'.((!$selectedCountry AND Configuration::get('PS_COUNTRY_DEFAULT') == $id_country) ? ' selected="selected"' : ($selectedCountry == $id_country ? ' selected="selected"' : '')).'>'.$name.'</option>';
echo ' </select> <sup>*</sup>
</div>';
echo '
<div id="contains_states" '.(!Country::containsStates((int)$selectedCountry) ? 'style="display:none;"' : '').'>
<label>'.$this->l('State').'</label>
<div class="margin-form">
<select name="id_state" id="id_state">
</select>
</div>
</div>';
$id_country_ajax = (int)$this->getFieldValue($obj, 'id_country');
echo '
<script type="text/javascript">
$(document).ready(function(){
ajaxStates ();
$(\'#id_country\').change(function() {
ajaxStates ();
});
function ajaxStates ()
{
$.ajax({
url: "ajax.php",
cache: false,
data: "ajaxStates=1&id_country="+$(\'#id_country\').val()+"&id_state="+$(\'#id_state\').val(),
success: function(html)
{
if (html == \'false\')
{
$("#contains_states").fadeOut();
$(\'#id_state option[value=0]\').attr("selected", "selected");
}
else
{
$("#id_state").html(html);
$("#contains_states").fadeIn();
$(\'#id_state option[value='.(int)$obj->id_state.']\').attr("selected", "selected");
}
}
}); ';
if (file_exists(_MODULE_DIR_.'vatnumber/ajax.php'))
echo ' $.ajax({
type: "GET",
url: "'._MODULE_DIR_.'vatnumber/ajax.php?id_country="+$(\'#id_country\').val(),
success: function(isApplicable)
{
if(isApplicable == 1)
$(\'#vat_area\').show();
else
$(\'#vat_area\').hide();
}
});';
echo ' }; }); </script>';
}
} // End foreach
echo '
<label>'.$this->l('Home phone').'</label>
<div class="margin-form">
<input type="text" size="33" name="phone" value="'.htmlentities($this->getFieldValue($obj, 'phone'), ENT_COMPAT, 'UTF-8').'" />
</div>
</div>';
echo '
<label>'.$this->l('Mobile phone').'</label>
<div class="margin-form">
<input type="text" size="33" name="phone_mobile" value="'.htmlentities($this->getFieldValue($obj, 'phone_mobile'), ENT_COMPAT, 'UTF-8').'" />
</div>
</div>';
echo '
<label>'.$this->l('Other').'</label>
<div class="margin-form">
<textarea name="other" cols="36" rows="4">'.htmlentities($this->getFieldValue($obj, 'other'), ENT_COMPAT, 'UTF-8').'</textarea>
<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
</div>
</div>';
echo '
<div class="margin-form">
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
</div>
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
</fieldset>
</fieldset>';
echo '
</form>';
}
protected function processAddressFormat()
{
$tmp_addr = new Address((int)Tools::getValue("id_address"));
$selectedCountry = (!is_null($tmp_addr)) ? $tmp_addr->id_country : (int)(Configuration::get('PS_COUNTRY_DEFAULT'));
$inv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry);
$dlv_adr_fields = AddressFormat::getOrderedAddressFields($selectedCountry);
$inv_all_fields = array();
$dlv_all_fields = array();
$out = array();
foreach (array('inv','dlv') as $adr_type)
{
foreach (${$adr_type.'_adr_fields'} as $fields_line)
foreach(explode(' ',$fields_line) as $field_item)
${$adr_type.'_all_fields'}[] = trim($field_item);
$out[$adr_type.'_adr_fields'] = ${$adr_type.'_adr_fields'};
$out[$adr_type.'_all_fields'] = ${$adr_type.'_all_fields'};
}
return $out;
}
}
+1
View File
@@ -59,6 +59,7 @@ class AdminContact extends AdminPreferences
'PS_SHOP_FAX' => array('title' => $this->l('Fax:'), 'validation' => 'isGenericName', 'size' => 30, 'type' => 'text'),
);
parent::__construct();
}
public function postProcess()
+43
View File
@@ -59,7 +59,35 @@ class AdminCountries extends AdminTab
if (isset($_GET['delete'.$this->table]) OR Tools::getValue('submitDel'.$this->table))
$this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.');
else
{
if (Tools::getValue('submitAdd'.$this->table))
{
$id_country = Tools::getValue('id_country');
$tmp_addr_format = new AddressFormat($id_country);
$save_status = false;
$is_new = is_null($tmp_addr_format->id_country);
if ($is_new)
{
$tmp_addr_format = new AddressFormat();
$tmp_addr_format->id_country = $id_country;
}
$tmp_addr_format->format = Tools::getValue('address_layout');
if (strlen($tmp_addr_format->format) > 0)
{
if ($tmp_addr_format->checkFormatFields())
$save_status = ($is_new) ? $tmp_addr_format->save(): $tmp_addr_format->update();
if (!$save_status)
$this->_errors[] = Tools::displayError('Invalid address layout'.Db::getInstance()->getMsgError());
}
unset($tmp_addr_format);
}
return parent::postProcess();
}
}
public function displayForm($isMainTab = true)
@@ -113,6 +141,7 @@ class AdminCountries extends AdminTab
$zones = Zone::getZones();
foreach ($zones AS $zone)
echo ' <option value="'.(int)($zone['id_zone']).'"'.(($this->getFieldValue($obj, 'id_zone') == $zone['id_zone']) ? ' selected="selected"' : '').'>'.$zone['name'].'</option>';
$address_layout = AddressFormat::getAddressCountryFormat($obj->id);
echo ' </select>
<p>'.$this->l('Geographical zone where country is located').'</p>
</div>
@@ -128,6 +157,12 @@ class AdminCountries extends AdminTab
<input type="text" name="zip_code_format" id="zip_code_format" value="'.$this->getFieldValue($obj, 'zip_code_format').'" onkeyup="$(\'#zip_code_format\').val($(\'#zip_code_format\').val().toUpperCase());" /> <sup>*</sup>
<p>'.$this->l('National zip code (L for a letter, N for a number and C for the Iso code), e.g., NNNNN for France. No verification if undefined').'.</p>
</div>
<label class="address_layout">'.$this->l('Address layout:').' </label>
<div class="margin-form" style="vertical-align: top;">
<p style="float: left;"><textarea id="ordered_fields" name="address_layout" style="width: 300px;height: 120px;">'.$address_layout.'</textarea></p>
<p style="float: left;margin-left: 10px;"><a href="#" onClick="$(\'textarea#ordered_fields\').val(unescape(\''.urlencode($address_layout).'\'.replace(/\+/g, \' \')));return false;" class="button">'.$this->l('Reset address layout').'</a></p>
<p class="clear">'.$this->l('Possible fields :').' '.implode(', ', (Address::getDispFieldsValidate())).'</p>
</div>
<label>'.$this->l('Status:').' </label>
<div class="margin-form">
<input type="radio" name="active" id="active_on" value="1" '.((!$obj->id OR $this->getFieldValue($obj, 'active')) ? 'checked="checked" ' : '').'/>
@@ -150,6 +185,14 @@ class AdminCountries extends AdminTab
<input type="radio" name="need_identification_number" id="need_identification_number_off" value="0" '.((!$this->getFieldValue($obj, 'need_identification_number') AND $obj->id) ? 'checked="checked" ' : '').'/>
<label class="t" for="need_identification_number_off"> <img src="../img/admin/disabled.gif" alt="" title="" />'.$this->l('No').'</label>
</div>
<div class="clear"></div>
<label>'.$this->l('Display tax label:').' </label>
<div class="margin-form">
<input type="radio" name="display_tax_label" id="display_tax_label_on" value="1" '.((!$obj->id OR $this->getFieldValue($obj, 'display_tax_label')) ? 'checked="checked" ' : '').'/>
<label class="t" for="display_tax_label_on"> <img src="../img/admin/enabled.gif" alt="" title="" />'.$this->l('Yes').'</label>
<input type="radio" name="display_tax_label" id="display_tax_label_off" value="0" '.((!$this->getFieldValue($obj, 'display_tax_label') AND $obj->id) ? 'checked="checked" ' : '').'/>
<label class="t" for="display_tax_label_off"> <img src="../img/admin/disabled.gif" alt="" title="" />'.$this->l('No').'</label>
</div>
<div class="margin-form">
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
</div>
+4 -3
View File
@@ -90,7 +90,7 @@ class AdminEmployees extends AdminTab
return;
$profiles = Profile::getProfiles((int)($cookie->id_lang));
echo '<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
echo '<script type="text/javascript" src="'._PS_JS_DIR_.'/jquery/jquery-colorpicker.js"></script>
<script type="text/javascript">
var employeePage = true;
</script>
@@ -118,8 +118,9 @@ class AdminEmployees extends AdminTab
<input type="text" size="33" name="email" value="'.htmlentities($this->getFieldValue($obj, 'email'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
</div><div class="clear">&nbsp;</div>
<label>'.$this->l('Back office color:').' </label>
<div class="margin-form">
<input type="color" data-hex="true" class="color mColorPickerInput" name="bo_color" value="'.htmlentities($this->getFieldValue($obj, 'bo_color'), ENT_COMPAT, 'UTF-8').'" />
<div class="margin-form">';
// Note : width= fix Firefox 4 display bug related to colorpicker librarie
echo '<input type="color" width="50px" data-hex="true" class="color mColorPickerInput" name="bo_color" value="'.htmlentities($this->getFieldValue($obj, 'bo_color'), ENT_COMPAT, 'UTF-8').'" />
<p>'.$this->l('Back office background will be displayed in this color. HTML colors only (e.g.,').' "lightblue", "#CC6600")</p>
</div><div class="clear">&nbsp;</div>
<label>'.$this->l('Language:').' </label>
+1 -1
View File
@@ -1291,7 +1291,7 @@ class AdminImport extends AdminTab
return sizeof($tmp);
}
private function _usortFiles($a, $b)
private static function _usortFiles($a, $b)
{
$a = strrev(substr(strrev($a), 0, 14));
$b = strrev(substr(strrev($b), 0, 14));
+1 -1
View File
@@ -531,7 +531,7 @@ class AdminModules extends AdminTab
}
if ($showCountryModules)
if (isset($module->limited_countries) AND ((is_array($module->limited_countries) AND !in_array(strtolower($isoCountryDefault), $module->limited_countries)) OR (!is_array($module->limited_countries) AND strtolower($isoCountryDefault) != strval($module->limited_countries))))
if (isset($module->limited_countries) AND ((is_array($module->limited_countries) AND sizeof($module->limited_countries) AND !in_array(strtolower($isoCountryDefault), $module->limited_countries)) OR (!is_array($module->limited_countries) AND strtolower($isoCountryDefault) != strval($module->limited_countries))))
unset($modules[$key]);
if (!empty($filterName))
+65 -16
View File
@@ -685,27 +685,22 @@ class AdminOrders extends AdminTab
<a href="?tab=AdminAddresses&id_address='.$addressDelivery->id.'&addaddress&realedit=1&id_order='.$order->id.($addressDelivery->id == $addressInvoice->id ? '&address_type=1' : '').'&token='.Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)($cookie->id_employee)).'&back='.urlencode($_SERVER['REQUEST_URI']).'"><img src="../img/admin/edit.gif" /></a>
<a href="http://maps.google.com/maps?f=q&hl='.$currentLanguage->iso_code.'&geocode=&q='.$addressDelivery->address1.' '.$addressDelivery->postcode.' '.$addressDelivery->city.($addressDelivery->id_state ? ' '.$deliveryState->name: '').'" target="_blank"><img src="../img/admin/google.gif" alt="" class="middle" /></a>
</div>
'. (!empty($addressDelivery->company) ? $addressDelivery->company.'<br />' : '') .$addressDelivery->firstname.' '.$addressDelivery->lastname.'<br />
'.$addressDelivery->address1.'<br />'. (!empty($addressDelivery->address2) ? $addressDelivery->address2.'<br />' : '') .'
'.$addressDelivery->postcode.' '.$addressDelivery->city.'<br />
'.$addressDelivery->country.($addressDelivery->id_state ? ' - '.$deliveryState->name : '').'<br />
'.(!empty($addressDelivery->phone) ? $addressDelivery->phone.'<br />' : '').'
'.(!empty($addressDelivery->phone_mobile) ? $addressDelivery->phone_mobile.'<br />' : '').'
'.(!empty($addressDelivery->other) ? '<hr />'.$addressDelivery->other.'<br />' : '').'
</fieldset>
'.$this->displayAddressDetail($addressDelivery)
// . (!empty($addressDelivery->company) ? $addressDelivery->company.'<br />' : '') .$addressDelivery->firstname.' '.$addressDelivery->lastname.'<br />
// '.$addressDelivery->address1.'<br />'. (!empty($addressDelivery->address2) ? $addressDelivery->address2.'<br />' : '') .'
// '.$addressDelivery->postcode.' '.$addressDelivery->city.'<br />
// '.$addressDelivery->country.($addressDelivery->id_state ? ' - '.$deliveryState->name : '').'<br />
// '.(!empty($addressDelivery->phone) ? $addressDelivery->phone.'<br />' : '').'
// '.(!empty($addressDelivery->phone_mobile) ? $addressDelivery->phone_mobile.'<br />' : '').'
// '.(!empty($addressDelivery->other) ? '<hr />'.$addressDelivery->other.'<br />' : '').'
.'</fieldset>
</div>
<div style="float: left; margin-left: 40px">
<fieldset style="width: 400px;">
<legend><img src="../img/admin/invoice.gif" alt="'.$this->l('Invoice address').'" />'.$this->l('Invoice address').'</legend>
<div style="float: right"><a href="?tab=AdminAddresses&id_address='.$addressInvoice->id.'&addaddress&realedit=1&id_order='.$order->id.($addressDelivery->id == $addressInvoice->id ? '&address_type=2' : '').'&back='.urlencode($_SERVER['REQUEST_URI']).'&token='.Tools::getAdminToken('AdminAddresses'.(int)(Tab::getIdFromClassName('AdminAddresses')).(int)($cookie->id_employee)).'"><img src="../img/admin/edit.gif" /></a></div>
'. (!empty($addressInvoice->company) ? $addressInvoice->company.'<br />' : '').(!empty($addressInvoice->vat_number) ? $addressInvoice->vat_number.'<br />' : '').$addressInvoice->firstname.' '.$addressInvoice->lastname.'<br />
'.$addressInvoice->address1.'<br />'. (!empty($addressInvoice->address2) ? $addressInvoice->address2.'<br />' : '') .'
'.$addressInvoice->postcode.' '.$addressInvoice->city.'<br />
'.$addressInvoice->country.($addressInvoice->id_state ? ' - '.$invoiceState->name : '').'<br />
'.(!empty($addressInvoice->phone) ? $addressInvoice->phone.'<br />' : '').'
'.(!empty($addressInvoice->phone_mobile) ? $addressInvoice->phone_mobile.'<br />' : '').'
'.(!empty($addressInvoice->other) ? '<hr />'.$addressInvoice->other.'<br />' : '').'
</fieldset>
'.$this->displayAddressDetail($addressInvoice)
.'</fieldset>
</div>
<div class="clear">&nbsp;</div>';
@@ -935,6 +930,60 @@ class AdminOrders extends AdminTab
echo '<br /><br /><a href="'.$currentIndex.'&token='.$this->token.'"><img src="../img/admin/arrow2.gif" /> '.$this->l('Back to list').'</a><br />';
}
public function displayAddressDetail($address)
{
$optional_fields = array(
'company' => 1
, 'phone' => 1
, 'phone_mobile' => 1
, 'address2' => 1
);
$out = '';
$address_datas = AddressFormat::getAddressCountryFormat($address->id_country);
$field_other = $address->other;
$lines_out = $address->getOrderedValues(array(
'spacer' => ' '
, 'optional' => $optional_fields
)
, $address_datas);
$out = implode("<br />", $lines_out) .((!(is_null($field_other) || $field_other == '') )? '<hr />'.$field_other: '');
return $out;
}
/**
* returns String array values according to the given string pattern
*
*/
public function getOrderedValues($address, $pattern, array $given_values = null)
{
$out = array();
if (!empty($fields) && $fields != '' && !is_null($address))
{
$sep = "\n";
$line_sep = ' ';
$lines = explode($sep, $pattern);
foreach ($lines as $one_line)
{
if(!empty($one_line) && $one_line!= '')
{
$tmp_values = array();
$words = explode($line_sep, trim($one_line));
$tmp_words = array();
// String append instead of Array append
foreach ($words as $one_word)
$tmp_values[$one_word] = (is_null($given_values)) ? $address->{$one_word} : $given_values[$one_word];
$out[] = array($tmp_values, implode(' ', $tmp_values));
}
}
}
return $out;
}
public function display()
{
global $cookie;
+4 -1
View File
@@ -270,6 +270,7 @@ class AdminPreferences extends AdminTab
$val[$language['id_lang']] = isset($values['cast']) ? $values['cast'](Tools::getValue($field.'_'.$language['id_lang'])) : Tools::getValue($field.'_'.$language['id_lang']);
else
$val = isset($values['cast']) ? $values['cast'](Tools::getValue($field)) : Tools::getValue($field);
Configuration::updateValue($field, $val);
}
Tools::redirectAdmin($currentIndex.'&conf=6'.'&token='.$this->token);
@@ -303,10 +304,11 @@ class AdminPreferences extends AdminTab
$tab['db_prefix'] = _DB_PREFIX_;
$tab['db_user'] = _DB_USER_;
$tab['db_passwd'] = '';
return $tab;
}
private function getDivLang($fields)
private function getDivLang($fields)
{
$tab = array();
foreach ($fields AS $key => $field)
@@ -347,6 +349,7 @@ class AdminPreferences extends AdminTab
if (isset($field['required']) AND $field['required'])
$required = true;
$val = $this->getVal($confValues, $key);
if (!in_array($field['type'], array('image', 'radio', 'container', 'container_end')) OR isset($field['show']))
echo '<div style="clear: both; padding-top:15px;">'.($field['title'] ? '<label >'.$field['title'].'</label>' : '').'<div class="margin-form" style="padding-top:5px;">';
+15 -31
View File
@@ -420,12 +420,13 @@ class AdminTranslations extends AdminTab
foreach ($matches[1] AS $key)
{
$module_key = ($is_default ? self::DEFAULT_THEME_NAME : '').'<{'.Tools::strtolower($module_name).'}'.($is_default ? 'prestashop' : $theme_name).'>'.Tools::strtolower($template_name).'_'.md5($key);
$module_key = ($is_default ? self::DEFAULT_THEME_NAME : '').'<{'.Tools::strtolower($module_name).'}'.strtolower($is_default ? 'prestashop' : $theme_name).'>'.Tools::strtolower($template_name).'_'.md5($key);
// to avoid duplicate entry
if (!in_array($module_key, $array_check_duplicate))
{
$array_check_duplicate[] = $module_key;
$this->modules_translations[($is_default ? self::DEFAULT_THEME_NAME : $theme_name)][$module_name][$template_name][$key] = key_exists($module_key, $_MODULES) ? html_entity_decode($_MODULES[$module_key], ENT_COMPAT, 'UTF-8') : '';
$this->modules_translations[strtolower($is_default ? self::DEFAULT_THEME_NAME : $theme_name)][$module_name][$template_name][$key]
= key_exists($module_key, $_MODULES) ? html_entity_decode($_MODULES[$module_key], ENT_COMPAT, 'UTF-8') : '';
$this->total_expression++;
}
}
@@ -1486,39 +1487,22 @@ class AdminTranslations extends AdminTab
}
protected function getTinyMCEForMails($iso_lang)
{
// TinyMCE
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso_lang.'.js') ? $iso_lang : 'en');
$ad = dirname($_SERVER["PHP_SELF"]);
return '
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
var iso = \''.$isoTinyMCE.'\' ;
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
var ad = \''.$ad.'\' ;
</script>
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce.inc.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "specific_textareas",
editor_deselector : "noEditor",
theme : "advanced",
plugins : "safari,pagebreak,style,layer,table,advimage,advlink,inlinepopups,media,searchreplace,contextmenu,paste,directionality,fullscreen",
// Theme options
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,pagebreak",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
content_css : "'.__PS_BASE_URI__.'themes/'._THEME_NAME_.'/css/global.css",
document_base_url : "'.__PS_BASE_URI__.'",
width: "600",
height: "600",
font_size_style_values : "8pt, 10pt, 12pt, 14pt, 18pt, 24pt, 36pt",
elements : "nourlconvert",
entity_encoding: "raw",
convert_urls : false,
language : "'.(file_exists(_PS_ROOT_DIR_.'/js/tinymce/jscripts/tiny_mce/langs/'.$iso_lang.'.js') ? $iso_lang : 'en').'"
});
function displayTiny(obj) {
function displayTiny(obj) {
tinyMCE.get(obj.attr(\'name\')).show();
}
</script>
';
</script>';
}
public function displayFormMails($lang, $noDisplay = false)
{