function get($id = NULL){
		global $db_conn;

		if(!isset($id)){
			$id = $this->id;
		}

		if(!isset($id)){
			$this->error = "SI_InvoiceLineLink::get() : InvoiceLineLink id not set\n";
			return FALSE;
		}

		$InvoiceLineLink = SI_InvoiceLineLink::retrieveSet("WHERE id = $id", TRUE);
		if($InvoiceLineLink === FALSE){
			return FALSE;
		}

		if(isset($InvoiceLineLink[0])){
			$this->_populateData($InvoiceLineLink[0]);
			$this->stripSlashes();
		}else{
			$this->error = "SI_InvoiceLineLink::get() : No data retrieved from query\n";
			return FALSE;
		}
		return TRUE;
	}
示例#2
0
	function _populateLinks(){
		$ill = new SI_InvoiceLineLink();
		$links = $ill->retrieveSet("WHERE invoice_line_id = ".$this->id); 
		if($links === FALSE){
			$this->error = "SI_InvoiceLine::_populateLinks(): Error getting links: ".$ill->getLastError();
			return FALSE;			
		}
		
		$this->_links =& $links;
		
		return TRUE; 
	}
示例#3
0
					debug_message($ct->getLastError());	
				}else{
					header('Location: '.getCurrentURL(null, false).'?mode=edit&id='.$line->id."\r\n");
					die();
				}	
			}
		}
	}

	$_REQUEST['mode'] = 'edit';
}elseif($_REQUEST['mode'] == 'delete_link'){
	if(intval($_REQUEST['link_id']) == 0){
		fatal_error("You must provide a link id to delete a link!");
	}

	$ill = new SI_InvoiceLineLink();
	if($ill->get($_REQUEST['link_id']) === FALSE){
		$error_msg .= "Could not get invoice line!";
		debug_message($ill->getLastError());	
	}else{
		$line->quantity -= $ill->getQuantity();
		$line->addTax();
		if($line->update() === FALSE){
			$error_msg .= "Could not update quantity on line item!";
			debug_message($line->getLastError());	
		}else{
			$ct = new SI_CompanyTransaction();
			if($ct->get($invoice->trans_id) === FALSE){
				$error_msg .= "Error getting transaction for invoice!";
				debug_message($ct->getLastError());	
			}else{