validate_add($d)) { return False; } $q = "INSERT INTO #__{sc}_order_status (vendor_id, order_status_code,"; $q .= "order_status_name, list_order) "; $q .= "VALUES ("; $q .= "'$ps_vendor_id','"; $q .= $d["order_status_code"] . "','"; $q .= $d["order_status_name"] . "','"; $q .= $d["list_order"] . "')"; $db->query($q); $db->next_record(); return True; } /************************************************************************** * name: update() * created by: pablo * description: updates function information * parameters: * returns: **************************************************************************/ function update(&$d) { $db = new ps_DB; $ps_vendor_id = $_SESSION["ps_vendor_id"]; $timestamp = time(); if (!$this->validate_update($d)) { return False; } $q = "UPDATE #__{sc}_order_status SET "; $q .= "order_status_code='" . $d["order_status_code"]; $q .= "',order_status_name='" . $d["order_status_name"]; $q .= "',list_order='" . $d["list_order"]; $q .= "' WHERE order_status_id='" . $d["order_status_id"] . "'"; $q .= " AND vendor_id='$ps_vendor_id'"; $db->query($q); $db->next_record(); return True; } /** * Controller for Deleting Records. */ function delete(&$d) { if (!$this->validate_delete($d)) { return False; } $record_id = $d["order_status_id"]; if( is_array( $record_id)) { foreach( $record_id as $record) { if( !$this->delete_record( $record, $d )) return false; } return true; } else { return $this->delete_record( $record_id, $d ); } } /** * Deletes one Record. */ function delete_record( $record_id, &$d ) { global $db; $ps_vendor_id = $_SESSION["ps_vendor_id"]; $q = "DELETE from #__{sc}_order_status WHERE order_status_id='$record_id'"; $q .= " AND vendor_id='$ps_vendor_id'"; $db->query($q); return True; } function list_order_status($order_status_code, $extra="") { echo $this->getOrderStatus( $order_status_code, $extra ); } function getOrderStatus( $order_status_code, $extra="") { $db = new ps_DB; $q = "SELECT order_status_id, order_status_code, order_status_name FROM #__{sc}_order_status ORDER BY list_order"; $db->query($q); $html = "\n"; return $html; } function getOrderStatusName( $order_status_code ) { $db = new ps_DB; $q = "SELECT order_status_id, order_status_name FROM #__{sc}_order_status WHERE `order_status_code`='".$order_status_code."'"; $db->query($q); $db->next_record(); return $db->f("order_status_name"); } } ?>