<?php 
/**
 * Система управления сайтом HostCMS v. 5.xx
 * Copyright © 2005-2010 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru
 *
 * Обработчик добавления/редактирования статуса заказа.
 * 
 * Файл: /admin/shop/action/add_order_status.php
 * 
 * @author Hostmake LLC
 * @version 5.x
 */
$param = array();
$shop = & singleton('shop');
if (isset($_REQUEST['edit_order_status']))
{
	$param['id'] = to_int($_REQUEST['edit_order_status']);
}

$param['name'] = to_str($_REQUEST['order_status_name']);
$param['description'] = to_str($_REQUEST['order_status_description']);

if ($order_status = $shop->InsertOrderStatus($param))
{
	$admin_forms = new admin_forms();
	$window_id = $admin_forms->GetWindowId();
	?><script type="text/javascript">
	$.appendInput('<?php echo $window_id?>', 'EditAddOrderStatus', 'edit_order_status', '<?php echo $order_status?>');
	</script><?php

	if (isset($_REQUEST['edit_order_status'])) 
	{
		show_message($GLOBALS['MSG_shops']['success_edit_order_status']);
	}
	else 
	{
		show_message($GLOBALS['MSG_shops']['success_add_order_status']);
	}
}
else
{
	if (isset($_REQUEST['edit_order_status'])) 
	{
		show_error_message($GLOBALS['MSG_shops']['error_edit_order_status']);
	}
	else 
	{
		show_error_message($GLOBALS['MSG_shops']['error_add_order_status']);
	}
}
?>