<?php 
/**
 * Система управления сайтом HostCMS v. 5.xx
 * Copyright © 2005-2010 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru
 *
 * Обработчик добавления/редактирования системы оплаты.
 * 
 * Файл: /admin/shop/action/add_system_of_pay.php
 * 
 * @author Hostmake LLC
 * @version 5.x
 */
$param = array();
$shop = & singleton('shop');
/* Данные о платежной системе */
if (isset($_REQUEST['edit_system_of_pay']))
{
	$param['id'] = to_int($_REQUEST['edit_system_of_pay']);
}
$param['name'] = to_str($_REQUEST['system_of_pay_name']);
$param['description'] = to_str($_REQUEST['system_of_pay_description']);
if (isset($_REQUEST['system_of_pay_is_active']))
{
	$param['is_active'] = '1';
}
else 
{
	$param['is_active'] = '0';
}
/* Обработчик платежной системы */
$param['handler'] = trim(to_str($_REQUEST['system_of_pay_handler']));
$param['currency_id'] = to_int($_REQUEST['system_of_pay_currency']);
$param['shop_system_of_pay_order'] = to_int($_REQUEST['shop_system_of_pay_order']);
$param['shop_shops_id'] = to_int($_REQUEST['shop_shops_id_param']);

if ($system = $shop->InsertSystemOfPay($param))
{
	$admin_forms = new admin_forms();
	$window_id = $admin_forms->GetWindowId();
	?><script type="text/javascript">
	$.appendInput('<?php echo $window_id?>', 'EditAddSystemOfPay', 'edit_system_of_pay', '<?php echo $system?>');
	</script><?php

	if (isset($_REQUEST['edit_system_of_pay']))
	{
		show_message($GLOBALS['MSG_shops']['success_update_system_of_pay']);
	}
	else 
	{
		show_message($GLOBALS['MSG_shops']['success_add_system_of_pay']);
	}
}
else
{
	if (isset($_REQUEST['edit_system_of_pay']))
	{
		show_error_message($GLOBALS['MSG_shops']['error_update_system_of_pay']);
	}
	else 
	{
		show_error_message($GLOBALS['MSG_shops']['error_add_system_of_pay']);
	}
}
?>