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; }
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{ $ct->amount -= $ill->getPrice(); if($ct->update() === FALSE){ $error_msg .= "Error updating company transaction with new price";