/** * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. */ public function _handler_process($handler_id, array $args, array &$data) { midcom::get('auth')->require_valid_user(); if (empty($_POST['id']) || empty($_POST['action'])) { throw new midcom_error('Incomplete POST data'); } $invoice = new org_openpsa_invoices_invoice_dba((int) $_POST['id']); $invoice->require_do('midgard:update'); midcom::get()->skip_page_style = true; $data['message'] = array('title' => $this->_l10n->get($this->_component), 'type' => 'error'); switch ($_POST['action']) { case 'mark_sent': $data['success'] = $this->_mark_as_sent($invoice); break; case 'send_by_mail': $data['success'] = $this->_send_by_mail($invoice); break; case 'mark_paid': $data['success'] = $this->_mark_as_paid($invoice); break; default: debug_add("The action " . $_POST["action"] . " is unknown"); throw new midcom_error_notfound('Unknown operation'); } if ($data['success']) { $data['message']['type'] = 'ok'; } if (!empty($_POST['relocate'])) { midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.invoices'), $data['message']['message'], $data['message']['type']); return new midcom_response_relocate(''); } $data['next_action'] = $this->_master->render_invoice_actions($invoice); $data['invoice'] = $invoice; }