Example #1
0
 * http://www.gnu.org/copyleft/gpl.html
 *
 */
require_once('includes/common.php');
checkLogin('admin');

require_once('includes/SI_Company.php');
require_once('includes/SI_RateStructure.php');
$title = '';
$company = new SI_Company();

if($_REQUEST['mode'] == 'add'){
	$title = "Add Company";
	
	if($_POST['save']){
		$company->updateFromAssocArray($_POST);
		if($company->add() !== false){
			goBack();
		}else{
			$error_msg .= "Error adding Company!\n";
			debug_message($company->getLastError());
		}
	}
}else if($_REQUEST['mode'] == 'edit'){
	$title = "Edit Company";
	if(empty($_REQUEST['id'])){
		$error_msg .= "Error: No ID specified!\n";
	}else{
		if(!$company->get($_REQUEST['id'])){
			$error_msg .= "Error retrieving company information!\n";
			debug_message($company->getLastError());