Return data for costobjects, optionally filtered by client_ids.
public static getCostObjectType ( mixed $client_ids = null ) : array | ||
$client_ids | mixed | A client id or an array of client ids to filter cost obejcts by. |
return | array | An array of cost objects data. |
public function __construct(&$vars) { parent::__construct($vars, _("Search For Time")); if ($GLOBALS['registry']->isAdmin(array('permission' => 'hermes:review'))) { $type = Hermes::getEmployeesType(); $this->addVariable(_("Employees"), 'employees', $type[0], false, false, null, array($type[1])); } $type = $this->getClientsType(); $cli = $this->addVariable(_("Clients"), 'clients', $type[0], false, false, null, $type[1]); $cli->setAction(Horde_Form_Action::factory('submit')); $cli->setOption('trackchange', true); $type = $this->getJobTypesType(); $this->addVariable(_("Job Types"), 'jobtypes', $type[0], false, false, null, $type[1]); $this->addVariable(_("Cost Objects"), 'costobjects', 'multienum', false, false, null, array(Hermes::getCostObjectType($vars->get('clients')))); $this->addVariable(_("Do not include entries before"), 'start', 'monthdayyear', false, false, null, array(date('Y') - 10)); $this->addVariable(_("Do not include entries after"), 'end', 'monthdayyear', false, false, null, array(date('Y') - 10)); $states = array('' => '', '1' => _("Yes"), '0' => _("No")); $this->addVariable(_("Submitted?"), 'submitted', 'enum', false, false, null, array($states)); $this->addVariable(_("Exported?"), 'exported', 'enum', false, false, null, array($states)); $this->addVariable(_("Billable?"), 'billable', 'enum', false, false, null, array($states)); $this->setButtons(_("Search")); }
/** * Get a list of client deliverables suitable for building a select list. * Expects the following in $this->vars: * - c: The client id, or an array of client ids if querying for specific * clients. Returns all deliverables otherwise. * * @return array @see Hermes::getCostObjectType */ public function listDeliverablesSelect() { $client = !empty($this->vars->c) ? $this->vars->c : null; return Hermes::getCostObjectType($client); }
function setCostObjects($vars) { $this->_costObjects->type->setValues(Hermes::getCostObjectType($vars->get('client'))); }