debug_message($company->getLastError()); } if(isset($_POST['save_top'])){ $old_invoice = $invoice; $timestamp = getTSFromInput($_POST['timestamp']); $_POST['timestamp'] = $timestamp; $invoice->updateFromAssocArray($_POST); 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";