if($invoice->update() === FALSE){ $error_msg .= "Error updating invoice information!"; debug_message($invoice->getLastError()); }else{ //Add discount line if($_POST['discount_line'] == 'Y'){ if($invoice->addDiscountLine() === FALSE){ $error_msg = "Error calculating discount line\n"; debug_message($invoice->getLastError()); } } if($old_invoice->company_id != $invoice->company_id){ $ct = new SI_CompanyTransaction(); if($ct->get($invoice->trans_id) === FALSE){ $error_msg .= "Error getting transaction for invoice!"; debug_message($ct->getLastError()); }else{ $ct->company_id = $invoice->company_id; if($ct->update() === FALSE){ $error_msg .= "Error moving company transaction with new price"; debug_message($ct->getLastError()); }else{ goBack(); } } } } }