// Fixed revision 13573

This commit is contained in:
bMancone
2012-02-28 13:13:47 +00:00
parent 7b5ddd5039
commit 362258ede6
14 changed files with 85 additions and 45 deletions

View File

@@ -192,6 +192,12 @@
<!-- Right column -->
<div style="width: 49%; float:right;">
<div class="button-command-prev-next">
<b>{l s='Orders'}</b> :
{if $previousOrder}<a class="button" href="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$previousOrder}">{l s='< Prev'}</a>{/if}
{if $nextOrder}<a class="button" href="{$link->getAdminLink('AdminOrders')}&vieworder&id_order={$nextOrder}">{l s='Next >'}</a>{/if}
</div>
<div class="clear"></div>
<!-- Documents block -->
<fieldset>
<legend><img src="../img/admin/details.gif" /> {l s='Documents'}</legend>
@@ -564,7 +570,7 @@
{l s='tax included.'}
{/if}
{if Configuration::get('PS_ORDER_RETURN')}
{if !Configuration::get('PS_ORDER_RETURN')}
<br /><br />{l s='Merchandise returns are disabled'}
{/if}
</div>

View File

@@ -28,6 +28,18 @@
{block name="other_input"}
{if isset($supply_order) && $supply_order->id > 0 && isset($supply_order_states)}
<script>
$(document).ready(function() {
$('#id_supply_order_state option').each(function () {
if ($(this).attr('disabled') == false)
$(this).attr('selected', true);
return ($(this).attr('disabled') == true);
});
});
</script>
<input type="hidden" name="id_supply_order" id="id_supply_order" value="{$supply_order->id}">
<label>{l s='Status of the order:'}</label>

View File

@@ -160,11 +160,14 @@ class CMSCore extends ObjectModel
public static function cleanPositions($id_category)
{
$result = Db::getInstance()->executeS('
$sql = '
SELECT `id_cms`
FROM `'._DB_PREFIX_.'cms`
WHERE `id_cms_category` = '.(int)$id_category.'
ORDER BY `position`');
ORDER BY `position`';
$result = Db::getInstance()->executeS($sql);
for ($i = 0, $total = count($result); $i < $total; ++$i)
{
$sql = 'UPDATE `'._DB_PREFIX_.'cms`
@@ -178,7 +181,12 @@ class CMSCore extends ObjectModel
public static function getLastPosition($id_category)
{
return (Db::getInstance()->getValue('SELECT MAX(position)+1 FROM `'._DB_PREFIX_.'cms` WHERE `id_cms_category` = '.(int)$id_category));
$sql = '
SELECT MAX(position) + 1
FROM `'._DB_PREFIX_.'cms`
WHERE `id_cms_category` = '.(int)$id_category;
return (Db::getInstance()->getValue($sql));
}
public static function getCMSPages($id_lang = null, $id_cms_category = null, $active = true)
@@ -207,6 +215,7 @@ class CMSCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'lang` AS l ON c.`id_lang` = l.`id_lang`
WHERE c.`id_cms` = '.(int)$id_cms.'
AND l.`active` = 1';
return Db::getInstance()->executeS($sql);
}
}

View File

@@ -307,6 +307,11 @@ abstract class CacheCore
return isset(Cache::$local[$key]) ? Cache::$local[$key] : null;
}
public static function retrieveAll()
{
return Cache::$local;
}
public static function isStored($key)
{
return isset(Cache::$local[$key]);
@@ -324,4 +329,5 @@ abstract class CacheCore
else
unset(Cache::$local[$key]);
}
}

View File

@@ -165,6 +165,8 @@ class SupplyOrderStateCore extends ObjectModel
if ($ids)
$query->where('s.id_supply_order_state NOT IN('.implode(',', array_map('intval', $ids)).')');
$query->orderBy('sl.name ASC');
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
}

View File

@@ -51,7 +51,7 @@ class AdminAddressesControllerCore extends AdminController
$countries = Country::getCountries($this->context->language->id);
foreach ($countries as $country)
$this->countries_array[$country['id_country']] = $country['name'];
$this->fieldsDisplay = array(
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'firstname' => array('title' => $this->l('First name'), 'width' => 120, 'filter_key' => 'a!firstname'),
@@ -187,24 +187,42 @@ class AdminAddressesControllerCore extends AdminController
}
else if ($addr_field_item == 'lastname')
{
if (isset($customer) &&
!Tools::isSubmit('submit'.strtoupper($this->table)) &&
Validate::isLoadedObject($customer) &&
!Validate::isLoadedObject($this->object))
$default_value = $customer->lastname;
else
$default_value = '';
$temp_fields[] = array(
'type' => 'text',
'label' => $this->l('Last name'),
'name' => 'lastname',
'size' => 33,
'required' => true,
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer">&nbsp;</span>'
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer">&nbsp;</span>',
'default_value' => $default_value,
);
}
else if ($addr_field_item == 'firstname')
{
if (isset($customer) &&
!Tools::isSubmit('submit'.strtoupper($this->table)) &&
Validate::isLoadedObject($customer) &&
!Validate::isLoadedObject($this->object))
$default_value = $customer->firstname;
else
$default_value = '';
$temp_fields[] = array(
'type' => 'text',
'label' => $this->l('First name'),
'name' => 'firstname',
'size' => 33,
'required' => true,
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer">&nbsp;</span>'
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer">&nbsp;</span>',
'default_value' => $default_value,
);
}
else if ($addr_field_item == 'address1')
@@ -254,11 +272,11 @@ class AdminAddressesControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => false,
'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country',
'name' => 'name',
'preselect_country' => true,
)
);
$temp_fields[] = array(
@@ -272,17 +290,9 @@ class AdminAddressesControllerCore extends AdminController
'name' => 'name',
)
);
$this->fields_value['id_country'] = Configuration::get('PS_COUNTRY_DEFAULT');
}
}
if (isset($customer) && !Tools::isSubmit('submit'.strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object))
{
$this->fields_value['lastname'] = $customer->lastname;
$this->fields_value['firstname'] = $customer->firstname;
}
// merge address format with the rest of the form
array_splice($this->fields_form['input'], 3, 0, $temp_fields);
@@ -373,7 +383,7 @@ class AdminAddressesControllerCore extends AdminController
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
}
}
public function processAdd($token)
{
if (Tools::getValue('submitFormAjax'))

View File

@@ -76,9 +76,10 @@ class AdminCmsContentControllerCore extends AdminController
if ($this->display == 'edit_category')
$this->content .= $this->adminCMSCategories->renderForm();
elseif ($this->display == 'edit_page')
else if ($this->display == 'edit_page')
$this->content .= $this->adminCMS->renderForm();
elseif ($this->display == 'view_page'){}
else if ($this->display == 'view_page')
$fixme = 'fixme';// @FIXME
else
{
$id_cms_category = (int)(Tools::getValue('id_cms_category'));
@@ -112,14 +113,14 @@ class AdminCmsContentControllerCore extends AdminController
|| isset($_GET['updatecms_category'])
|| isset($_GET['addcms_category']))
$this->display = 'edit_category';
elseif (((Tools::isSubmit('submitAddcms') || Tools::isSubmit('submitAddcmsAndStay')) && count($this->adminCMS->errors))
else if (((Tools::isSubmit('submitAddcms') || Tools::isSubmit('submitAddcmsAndStay')) && count($this->adminCMS->errors))
|| isset($_GET['updatecms'])
|| isset($_GET['addcms']))
$this->display = 'edit_page';
else
{
$this->display = 'list';
$this->id_cms_category = (int)(Tools::getValue('id_cms_category'));
$this->id_cms_category = (int)Tools::getValue('id_cms_category');
}
if (Tools::isSubmit('submitDelcms')
@@ -129,7 +130,7 @@ class AdminCmsContentControllerCore extends AdminController
|| Tools::isSubmit('viewcms')
|| (Tools::isSubmit('statuscms') && Tools::isSubmit('id_cms')) && (Tools::isSubmit('position') && !Tools::isSubmit('id_cms_category_to_move')))
$this->adminCMS->postProcess();
elseif (Tools::isSubmit('submitDelcms_category')
else if (Tools::isSubmit('submitDelcms_category')
|| Tools::isSubmit('submitAddcms_categoryAndBackToParent')
|| Tools::isSubmit('submitAddcms_category')
|| isset($_GET['deletecms_category'])

View File

@@ -53,7 +53,7 @@ class AdminCmsControllerCore extends AdminController
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'cms_category` c ON (c.`id_cms_category` = a.`id_cms_category`)';
$this->_select = 'a.position ';
$this->_filter = 'AND c.id_cms_category = '.(int)($this->_category->id);
$this->_filter = 'AND c.id_cms_category = '.(int)$this->_category->id;
parent::__construct();
}
@@ -231,7 +231,7 @@ class AdminCmsControllerCore extends AdminController
Configuration::updateValue('PS_CONDITIONS', 0);
Configuration::updateValue('PS_CONDITIONS_CMS_ID', 0);
}
$cms = new CMS((int)(Tools::getValue('id_cms')));
$cms = new CMS((int)Tools::getValue('id_cms'));
$cms->cleanPositions($cms->id_cms_category);
if (!$cms->delete())
$this->errors[] = Tools::displayError('An error occurred while deleting object.').' <b>'.$this->table.' ('.Db::getInstance()->getMsgError().')</b>';

View File

@@ -405,16 +405,6 @@ class AdminCustomerThreadsControllerCore extends AdminController
$this->errors[] = Tools::displayError('An error occurred, your message was not sent. Please contact your system administrator.');
}
}
/*
if (Tools::isSubmit('submitGeneral'.$this->table))
{
p($_POST);
die('toto');
//PS_SAV_IMAP_OPT
}
*/
return parent::postProcess();
}

View File

@@ -456,11 +456,11 @@ class AdminManufacturersControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => false,
'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country',
'name' => 'name',
'preselect_country' => true,
)
);
$form['input'][] = array(

View File

@@ -124,11 +124,11 @@ class AdminStatesControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => false,
'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id, false, true),
'id' => 'id_country',
'name' => 'name',
'preselect_country' => true,
),
'desc' => $this->l('Country where state, region or city is located')
),

View File

@@ -180,11 +180,11 @@ class AdminStoresControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => true,
'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country',
'name' => 'name',
'preselect_country' => true,
)
),
array(

View File

@@ -139,11 +139,11 @@ class AdminSuppliersControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => true,
'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id, false),
'id' => 'id_country',
'name' => 'name',
'preselect_country' => true,
),
'desc' => $this->l('Country where the state, region or city is located')
),

View File

@@ -44,7 +44,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
$this->identifier = 'id_supply_order';
$this->lang = false;
$this->is_template_list = false;
$this->multishop_context = Shop::CONTEXT_ALL;
$this->multishop_context = Shop::CONTEXT_ALL;
$this->addRowAction('updatereceipt');
$this->addRowAction('changestate');
@@ -805,6 +805,10 @@ class AdminSupplyOrdersControllerCore extends AdminController
$helper->override_folder = 'supply_orders_receipt_history/';
$helper->toolbar_btn = $this->toolbar_btn;
$helper->ajax_params = array(
'display_product_history' => 1,
);
$helper->currentIndex = self::$currentIndex.$action;
// display these global order informations
@@ -1451,7 +1455,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
public function ajaxProcess()
{
// tests if an id is submit
if (Tools::isSubmit('id'))
if (Tools::isSubmit('id') && !Tools::isSubmit('display_product_history'))
{
// overrides attributes
$this->identifier = 'id_supply_order_history';
@@ -1524,14 +1528,14 @@ class AdminSupplyOrdersControllerCore extends AdminController
echo Tools::jsonEncode(array('use_parent_structure' => false, 'data' => $content));
}
else if (Tools::isSubmit('id_supply_order_detail'))
else if (Tools::isSubmit('id') && Tools::isSubmit('display_product_history'))
{
$this->identifier = 'id_supply_order_receipt_history';
$this->table = 'supply_order_receipt_history';
$this->display = 'list';
$this->lang = false;
$lang_id = (int)$this->context->language->id;
$id_supply_order_detail = (int)Tools::getValue('id_supply_order_detail');
$id_supply_order_detail = (int)Tools::getValue('id');
unset($this->fieldsDisplay);
$this->fieldsDisplay = array(
@@ -2023,14 +2027,13 @@ class AdminSupplyOrdersControllerCore extends AdminController
$manager = StockManagerFactory::getManager();
foreach ($items as $item)
{
$diff = 0;
$diff = (int)$threshold;
if ($supply_order->is_template != 0)
{
$real_quantity = (int)$manager->getProductRealQuantities($item['id_product'], $item['id_product_attribute'], $supply_order->id_warehouse, true);
$diff = (int)$threshold - (int)$real_quantity;
}
else
$diff = (int)$threshold;
if ($diff > 0)
{
@@ -2060,6 +2063,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
// updates supply order
$supply_order->update();
}
/**