コード例 #1
0
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 */
require_once('includes/common.php');
require_once('includes/SI_User.php');

checkLogin("admin");

require_once('includes/SI_RateStructure.php');

$rate_structure = new SI_RateStructure();
$rate_structures = $rate_structure->retrieveSet("ORDER BY name");
if($rate_structures === FALSE){
	$error_msg .= "Error getting rate structures!\n";
	debug_message($rate_structure->getLastError());
}

$title = "Rate Structure Administration";

require('header.php') ?>
<div class="tableContainer">
<a href="javascript:;" class="tCollapse" onclick="toggleGrid(this)"><img src="images/arrow_down.jpg" alt="Hide table" />Rate Structures</a><div>
	<div class="gridToolbar">
		  <a href="rate_structure.php?mode=add" style="background-image:url(images/new_invoice.png);">New Rate Structure</a>
	</div>
<table border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td><a href="" onclick="return sortTable('bodyId', 0, 1, false)">Name</a></td>
		<td>Edit</td>
		<td>Delete</td>		
コード例 #2
0
	$_POST['price'] = preg_replace('/[^0-9\.]/','', $_POST['price']);
}

// Clean up cost
if(!empty($_POST['cost'])){
	$_POST['cost'] = preg_replace('/[^0-9\.]/','', $_POST['cost']);
}

// Handle minor requests
if($_REQUEST['mode'] == 'delete_item_code'){
	if(empty($_REQUEST['id'])){
		$error_msg .= "Error: No ID specified!\n";
	}else{
		if(!$rate_structure->get($_REQUEST['id'])){
			$error_msg .= "Error retrieving rate_structure information!\n";
			debug_message($rate_structure->getLastError());
		}
	}

	if($rate_structure->deleteItemCode($_REQUEST['item_code_id']) === FALSE){
		$error_msg .= "Error removing item code!\n";
		debug_message($rate_structure->getLastError());
	}

	$_REQUEST['mode'] = 'edit';	
}elseif($_REQUEST['mode'] == 'delete_line'){
	$line = new SI_RateStructureLine();
	if($line->delete($_REQUEST['line_id']) === FALSE){
		$error_msg .= "Error removing line!\n";
		debug_message($line->getLastError());	
	}