/** * Method to populate line items for this invoice * * This method will populate all line items for this * invoice by calling the getInvoiceLines method on the * {@link SI_InvoiceLine} class with this invoice's $id * as the parameter. * * @access private * @see getLastError() * @see $_lines * @see SI_InvoiceLine::getInvoiceLines() * @return TRUE|FALSE TRUE on success or FALSE on error */ function _populateLines(){ $il = new SI_InvoiceLine(); $result = $il->getInvoiceLines($this->id); if($result === FALSE){ $this->error = "SI_Invoice::_populateLines(): Error getting invoice lines: ".$il->getLastError()."\n"; return FALSE; } $this->_lines = $result; return TRUE; }
// Clean up unit_price if(!empty($_POST['unit_price'])){ $_POST['unit_price'] = preg_replace('/[^0-9\.-]/','',$_POST['unit_price']); } // Prepare our variables $line_added = false; if($_REQUEST['mode'] == 'add_ta_link' || $_REQUEST['mode'] == 'add_sp_link' || $_REQUEST['mode'] == 'add_ex_link' || $_REQUEST['mode'] == 'delete_link' || $_REQUEST['mode'] == 'edit' || $_REQUEST['mode'] == 'delete'){ if($_REQUEST['mode'] != 'delete' && intval($_REQUEST['id']) == 0 && intval($_REQUEST['invoice_id']) != 0){ // We must be adding $line->invoice_id = $_REQUEST['invoice_id']; if($line->add() === FALSE){ $error_msg .= "Error adding new line item to invoice!"; debug_message($line->getLastError()); } $_REQUEST['id'] = $line->id; $line_added = true; }elseif(intval($_REQUEST['id']) == 0 && intval($_REQUEST['invoice_id']) == 0){ fatal_error('You must provide an invoice id when adding a new line!'); } if($line->get($_REQUEST['id']) === FALSE){ $error_msg .= "Error getting invoice line"; debug_message($line->getLastError()); } $invoice = $line->getInvoice(); if($invoice === FALSE){ $error_msg .= "Error retreiving invoice information!\n";