Example #1
0
 /**
  * Looks up a deliverable to display.
  *
  * @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_add($handler_id, array $args, array &$data)
 {
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         throw new midcom_error_forbidden('Only POST requests are allowed here.');
     }
     $this->_salesproject = new org_openpsa_sales_salesproject_dba($args[0]);
     $this->_salesproject->require_do('midgard:create');
     if (!array_key_exists('product', $_POST)) {
         throw new midcom_error('No product specified, aborting.');
     }
     $this->_product = new org_openpsa_products_product_dba((int) $_POST['product']);
     $this->_prepare_datamanager();
     $data['controller'] = $this->_controller;
     // Process form
     switch ($data['controller']->process_form()) {
         case 'save':
             $formdata = $data['controller']->datamanager->types;
             $this->_master->process_notify_date($formdata, $this->_deliverable);
         case 'cancel':
             return new midcom_response_relocate("salesproject/{$this->_salesproject->guid}/");
     }
     org_openpsa_helpers::dm2_savecancel($this);
     $this->add_breadcrumb("salesproject/{$this->_salesproject->guid}/", $this->_salesproject->title);
     $this->add_breadcrumb('', $this->_l10n->get('add offer'));
 }