Esempio n. 1
0
 /**
  * @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_list($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     $siteconfig = org_openpsa_core_siteconfig::get_instance();
     $this->_sales_url = $siteconfig->get_node_full_url('org.openpsa.sales');
     $provider = new org_openpsa_widgets_grid_provider($this, 'local');
     $provider->add_order('start');
     $data['grid'] = $provider->get_grid('scheduled');
     midcom::get('head')->set_pagetitle($this->_l10n->get('scheduled invoices'));
     $this->add_breadcrumb('', $this->_l10n->get('scheduled invoices'));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => '', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('dashboard'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png'));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'invoice/new/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create invoice'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')));
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => 'projects/', MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('project invoicing'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/printer.png', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')));
 }
Esempio n. 2
0
 /**
  * List all tasks, optionally filtered by status
  */
 private function _handler_list_all($args)
 {
     // Default to open tasks list if none specified
     if (!isset($args[1]) || empty($args[1])) {
         $this->_request_data['view_identifier'] = 'open';
         $args[1] = 'open';
     }
     switch ($args[1]) {
         case 'agreement':
             if (!$args[2]) {
                 throw new midcom_error('Invalid arguments for agreement filter');
             }
             $agreement_id = (int) $args[2];
             $this->_request_data['agreement'] = $agreement_id;
             $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($agreement_id);
             $title = sprintf($this->_l10n->get('tasks for agreement %s'), $deliverable->title);
             midcom::get('head')->set_pagetitle($title);
             $this->add_breadcrumb("", $title);
             $this->_qb->add_constraint('agreement', '=', $deliverable->id);
             $this->_provider->add_order('end', 'DESC');
             break;
         case 'all':
         case 'both':
             $args[1] = 'all';
             $this->_provider->add_order('end', 'DESC');
             break;
         case 'open':
             $this->set_active_leaf($this->_topic->id . ':tasks_open');
             $this->_qb->add_constraint('status', '<', org_openpsa_projects_task_status_dba::CLOSED);
             $this->_provider->add_order('end');
             break;
         case 'closed':
             $this->set_active_leaf($this->_topic->id . ':tasks_closed');
             $this->_qb->add_constraint('status', '=', org_openpsa_projects_task_status_dba::CLOSED);
             $this->_provider->add_order('end', 'DESC');
             break;
         case 'current':
             $this->_qb->add_constraint('status', 'IN', array(org_openpsa_projects_task_status_dba::ACCEPTED, org_openpsa_projects_task_status_dba::STARTED, org_openpsa_projects_task_status_dba::REJECTED, org_openpsa_projects_task_status_dba::REOPENED));
             $this->_provider->add_order('end');
             break;
         case 'invoiceable':
             $this->set_active_leaf($this->_topic->id . ':tasks_invoiceable');
             $this->_qb->add_constraint('invoiceableHours', '>', 0);
             $this->_provider->add_order('end');
             break;
         case 'invoiced':
             $this->set_active_leaf($this->_topic->id . ':tasks_invoiced');
             $this->_qb->add_constraint('invoicedHours', '>', 0);
             $this->_provider->add_order('end', 'DESC');
             break;
         default:
             throw new midcom_error("Filter {$args[1]} not recognized");
     }
     $qf = new org_openpsa_core_queryfilter('org_openpsa_task_list_' . $args[1]);
     $qf->add_filter(new org_openpsa_core_filter('priority', '<=', $this->_request_data['priority_array']));
     $date_filter = new org_openpsa_core_filter('timeframe');
     $date_filter->set('mode', 'timeframe');
     $date_filter->set('helptext', $this->_l10n->get("timeframe"));
     $date_filter->set('fieldname', array('start' => 'start', 'end' => 'end'));
     $qf->add_filter($date_filter);
     $qf->apply_filters($this->_qb);
     $this->_request_data["qf"] = $qf;
     $this->_request_data['table-heading'] = $args[1] . ' tasks';
     $this->_request_data['view'] = 'grid';
 }
Esempio n. 3
0
 /**
  * Displays older versions of the document
  *
  * @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_versions($handler_id, array $args, array &$data)
 {
     $this->_document = $this->_load_document($args[0]);
     $this->_provider = new org_openpsa_widgets_grid_provider($this, 'local');
     $this->_provider->add_order('created', 'DESC');
 }
Esempio n. 4
0
 private function _show_invoice_list($type = 'all')
 {
     $this->_list_type = $type;
     $provider = new org_openpsa_widgets_grid_provider($this, 'local');
     if ($provider->count_rows() == 0) {
         return;
     }
     switch ($this->_list_type) {
         case 'paid':
             $provider->add_order('paid', 'DESC');
             break;
         case 'unsent':
             $provider->add_order('index_number');
             break;
         case 'overdue':
         case 'open':
             $provider->add_order('due');
             break;
     }
     $grid_id = $type . '_invoices_grid';
     if ($this->_deliverable) {
         $grid_id = 'd_' . $this->_deliverable->id . $grid_id;
         $this->_request_data['totals']['deliverable'] = 0;
     }
     $this->_request_data['grid'] = $provider->get_grid($grid_id);
     $this->_request_data['list_type'] = $this->_list_type;
     $label = $type == 'all' ? 'invoices' : $type . ' invoices';
     $this->_request_data['list_label'] = $this->_l10n->get($label);
     midcom_show_style('show-grid');
 }