case 'no hawk': $Invoice->delFlag(Invoice::FLAG_HAWK); $Invoice->save(); Session::flash('info', 'Hawk monitoring has been removed from this invoice'); $this->redirect('/invoice/view?i=' . $Invoice['id']); break; case 'copy': // Copy Invoice $I_Copy = new Invoice(); foreach (array('contact_id', 'requester', 'kind', 'status', 'base_rate', 'base_unit', 'bill_address_id', 'ship_address_id', 'note') as $x) { $I_Copy[$x] = $Invoice[$x]; } $I_Copy->setFlag(Invoice::FLAG_OPEN); $I_Copy->save(); // Copy Invoice Items $list = $Invoice->getInvoiceItems(); foreach ($list as $II_Orig) { $II_Copy = new InvoiceItem(null); $II_Copy['invoice_id'] = $I_Copy['id']; foreach (array('quantity', 'rate', 'unit', 'name', 'note', 'tax_rate') as $x) { $II_Copy[$x] = $II_Orig[$x]; } $II_Copy->save(); } Radix::redirect('/invoice/view?i=' . $I_Copy['id']); break; case 'paid': // New Transaction Holder $at = new \stdClass(); $at->AccountJournalEntry = new AccountJournalEntry(); $at->AccountJournalEntry['date'] = date('Y-m-d');