<?php
// +---------------------------------------------------------------------------------------+
// | TenderSystem                                                                          |
// +---------------------------------------------------------------------------------------+
// | The contents of this file are subject to the TenderSystem Public License Version 1.1  |
// | ("License"); you may not use this file except in compliance with the License. You may |
// | obtain a copy of the License at http://www.tendersystem.com/tpl/                      |
// |                                                                                       |
// | Software distributed under the License is distributed on an "AS IS" basis, WITHOUT    |
// | WARRANTY OF ANY KIND, either express or implied. See the License for the specific     |
// | language governing rights and limitations under the License.                          |
// |                                                                                       |
// | All copies of the Covered Code must include the "Powered by TenderSystem" logo and    |
// | ValueCard copyright notice on every user interface screen and in every outgoing       |
// | email in the same form as they appear in the distribution.                            |
// |                                                                                       |
// | The Original Code is: TenderSystem                                                    |
// | The Initial Developer of the Original Code is ValueCard (Pty) Limited.                |
// | Portions created by ValueCard are Copyright (C) 2002 ValueCard (Pty) Limited.         |
// | All Rights Reserved.                                                                  |
// | Contributor(s): __________________.                                                   |
// +---------------------------------------------------------------------------------------+

/**
* Add ratings
* @package TenderSystem
* @subpackage rating
* @copyright Copyright &copy; 2002, ValueCard (Pty) Ltd
* @license http://www.tendersystem.com/tpl/ TenderSystem Public License
* @version 
*/

// field request errors and type 
$fields_request = array (
	'add'			=> array(),
	'first_rate'	=> array(),
	'second_rate'	=> array(),
	'third_rate'	=> array(),
	'fourth_rate'	=> array(),
	'fifth_rate'	=> array(),
	'rating_comment'=> array(),
	'supplierid'	=> array("e60",	REQUEST_NUMBER,	FORMAT_NONE,	"e61"),
	'usersid'		=> array("",	REQUEST_NUMBER,	FORMAT_NONE,	"e61")
);
if(!get_request($fields_request,$action,$error,$cfg)) {
	// display error
	xml_generator("rating","error",$error,$params,$cfg);
}
$params = array(
	'module'			=> 'rating',
	'function'			=> 'add_view',
	'supplierid'		=> $action['supplierid'],
	'usersid'			=> $action['usersid']
);
if($action['add'] && ($action['first_rate'] || $action['second_rate'] || $action['third_rate'] || $action['fourth_rate'] || $action['fifth_rate'] || $action['rating_comment'])) {
	$params['add']['first_rate'] = $action['first_rate'];
	$params['add']['second_rate'] = $action['second_rate'];
	$params['add']['third_rate'] = $action['third_rate'];
	$params['add']['fourth_rate'] = $action['fourth_rate'];
	$params['add']['fifth_rate'] = $action['fifth_rate'];
	$params['add']['rating_comment'] = $action['rating_comment'];
}
// send the message to app
send_message($params,$cfg);

?>