From c60f58060516252b45d74a0a3f91e133108a3940 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Mon, 20 Dec 2010 19:08:28 -0500 Subject: [PATCH] removed deprecated files --- hermes/lib/Forms/Deliverable.php | 60 -------- hermes/lib/Forms/Export.php | 52 ------- hermes/lib/Forms/Search.php | 206 ------------------------- hermes/lib/Forms/Time.php | 317 --------------------------------------- 4 files changed, 635 deletions(-) delete mode 100644 hermes/lib/Forms/Deliverable.php delete mode 100644 hermes/lib/Forms/Export.php delete mode 100644 hermes/lib/Forms/Search.php delete mode 100644 hermes/lib/Forms/Time.php diff --git a/hermes/lib/Forms/Deliverable.php b/hermes/lib/Forms/Deliverable.php deleted file mode 100644 index 51acdb2b3..000000000 --- a/hermes/lib/Forms/Deliverable.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @package Hermes - */ -class DeliverableClientSelector extends Horde_Form { - - function DeliverableClientSelector(&$vars) - { - parent::Horde_Form($vars, _("Select Client")); - - require 'Horde/Form/Action.php'; - $action = &Horde_Form_Action::factory('submit'); - list($clienttype, $clientparams) = $this->getClientType(); - - $cli = &$this->addVariable(_("Client"), 'client_id', $clienttype, true, false, null, $clientparams); - $cli->setAction($action); - $this->setButtons(_("Edit Deliverables")); - } - - function getClientType() - { - $clients = Hermes::listClients(); - if (is_a($clients, 'PEAR_Error')) { - return array('invalid', array(sprintf(_("An error occurred listing clients: %s"), - $clients->getMessage()))); - } elseif (count($clients)) { - return array('enum', array($clients)); - } else { - return array('invalid', array(_("There are no clients which you have access to."))); - } - } - -} - -class DeliverableForm extends Horde_Form { - - function DeliverableForm(&$vars) - { - parent::Horde_Form($vars, _("Deliverable Detail")); - - $this->addHidden('', 'deliverable_id', 'text', false); - $this->addHidden('', 'client_id', 'text', false); - $this->addHidden('', 'parent', 'text', false); - - $this->addVariable(_("Display Name"), 'name', 'text', true); - $this->addVariable(_("Active?"), 'active', 'boolean', true); - $this->addVariable(_("Estimated Hours"), 'estimate', 'number', false); - $this->addVariable(_("Description"), 'description', 'longtext', false); - } - -} diff --git a/hermes/lib/Forms/Export.php b/hermes/lib/Forms/Export.php deleted file mode 100644 index 544b482cd..000000000 --- a/hermes/lib/Forms/Export.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @author Jason M. Felice - * @package Hermes - */ -class ExportForm extends Horde_Form { - - var $_useFormToken = false; - - function ExportForm(&$vars) - { - $perms = $GLOBALS['injector']->getInstance('Horde_Perms');; - - parent::Horde_Form($vars, _("Export Search Results")); - - $formats = array('hermes_csv' => _("Comma-Separated Variable (.csv)"), - 'hermes_xls' => _("Microsoft Excel (.xls)"), - 'iif' => _("QuickBooks (.iif)"), - 'hermes_tsv' => _("Tab-Separated Variable (.tsv, .txt)"), - ); - - $this->addVariable(_("Select the export format"), 'format', 'enum', - true, false, null, array($formats)); - - if ($perms->hasPermission('hermes:review', $GLOBALS['registry']->getAuth(), - Horde_Perms::EDIT)) { - $yesno = array('yes' => _("Yes"), - 'no' => _("No")); - $var = &$this->addVariable(_("Mark the time as exported?"), - 'mark_exported', 'enum', true, false, - null, array($yesno)); - $var->setDefault('no'); - } - - $this->setButtons(_("Export")); - } - -} diff --git a/hermes/lib/Forms/Search.php b/hermes/lib/Forms/Search.php deleted file mode 100644 index bc1c6f06a..000000000 --- a/hermes/lib/Forms/Search.php +++ /dev/null @@ -1,206 +0,0 @@ - - * @package Hermes - */ -class SearchForm extends Horde_Form { - - var $_useFormToken = false; - - function SearchForm(&$vars) - { - parent::Horde_Form($vars, _("Search For Time")); - $perms = $GLOBALS['injector']->getInstance('Horde_Perms'); - - if ($perms->hasPermission('hermes:review', $GLOBALS['registry']->getAuth(), Horde_Perms::SHOW)) { - $type = Hermes::getEmployeesType(); - $this->addVariable(_("Employees"), 'employees', $type[0], false, - false, null, $type[1]); - } - - require_once 'Horde/Form/Action.php'; - $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($this->getCostObjectType($vars))); - - $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")); - } - - function getClientsType() - { - try { - $clients = Hermes::listClients(); - } catch (Exception $e) { - return array('invalid', array(sprintf(_("An error occurred listing clients: %s"), $e->getMessage()))); - } - $clients = array('' => _("- - None - -")) + $clients; - - return array('multienum', array($clients)); - } - - function getJobTypesType() - { - try { - $types = $GLOBALS['injector']->getInstance('Hermes_Driver')->listJobTypes(); - } catch (Horde_Exception $e) { - return array('invalid', array(sprintf(_("An error occurred listing job types: %s"), - $e->getMessage()))); - } - $values = array(); - foreach ($types as $id => $type) { - $values[$id] = $type['name']; - if (empty($type['enabled'])) { - $values[$id] .= _(" (DISABLED)"); - } - } - - return array('multienum', array($values)); - } - - function getCostObjectType($vars) - { - global $registry; - - $clients = $vars->get('clients'); - if (count($clients) == 0){ - $clients = array(''); - } - - $costobjects = array(); - foreach ($clients as $client) { - $criteria = array('user' => $GLOBALS['registry']->getAuth(), - 'active' => true, - 'client_id' => $client); - - foreach ($registry->listApps() as $app) { - if ($registry->hasMethod('listCostObjects', $app)) { - try { - $res = $registry->callByPackage($app, 'listCostObjects', array($criteria)); - } catch (Horde_Exception $e) { - $GLOBALS['notification']->push(sprintf(_("Error retrieving cost objects from \"%s\": %s"), $registry->get('name', $app), $res->getMessage()), 'horde.error'); - continue; - } - foreach (array_keys($res) as $catkey) { - foreach (array_keys($res[$catkey]['objects']) as $okey){ - $res[$catkey]['objects'][$okey]['id'] = $app . ':' . - $res[$catkey]['objects'][$okey]['id']; - } - } - $costobjects = array_merge($costobjects, $res); - } - } - } - - $elts = array(); - $counter = 0; - foreach ($costobjects as $category) { - Horde_Array::arraySort($category['objects'], 'name'); - foreach ($category['objects'] as $object) { - $name = $object['name']; - if (Horde_String::length($name) > 80) { - $name = Horde_String::substr($name, 0, 76) . ' ...'; - } - $elts[$object['id']] = $name; - } - } - - return $elts; - } - - - function getSearchCriteria(&$vars) - { - if (!$this->isValid() || !$this->isSubmitted()) { - return null; - } - $this->getInfo($vars, $info); - $perms = $GLOBALS['injector']->getInstance('Horde_Perms'); - - $criteria = array(); - if ($perms->hasPermission('hermes:review', $GLOBALS['registry']->getAuth(), Horde_Perms::SHOW)) { - if (!empty($info['employees'])) { - $auth = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Auth')->create(); - if (!$auth->hasCapability('list')) { - $criteria['employee'] = explode(',', $info['employees']); - } else { - $criteria['employee'] = $info['employees']; - } - } - } else { - $criteria['employee'] = $GLOBALS['registry']->getAuth(); - } - if (!empty($info['clients'])) { - $criteria['client'] = $info['clients']; - } - if (!empty($info['jobtypes'])) { - $criteria['jobtype'] = $info['jobtypes']; - } - if (!empty($info['costobjects'])) { - $criteria['costobject'] = $info['costobjects']; - } - if (!empty($info['start'])) { - $dt = new Date($info['start']); - $criteria['start'] = $dt->getDate(DATE_FORMAT_UNIXTIME); - } - if (!empty($info['end'])) { - $dt = new Date($info['end']); - $dt->setHour(23); - $dt->setMinute(59); - $dt->setSecond(59); - $criteria['end'] = $dt->getDate(DATE_FORMAT_UNIXTIME); - } - if (isset($info['submitted']) && $info['submitted'] != '') { - $criteria['submitted'] = $info['submitted']; - } - if (isset($info['exported']) && $info['exported'] != '') { - $criteria['exported'] = $info['exported']; - } - if (isset($info['billable']) && $info['billable'] != '') { - $criteria['billable'] = $info['billable']; - } - - return $criteria; - } - -} diff --git a/hermes/lib/Forms/Time.php b/hermes/lib/Forms/Time.php deleted file mode 100644 index 4974121bb..000000000 --- a/hermes/lib/Forms/Time.php +++ /dev/null @@ -1,317 +0,0 @@ - - * @package Hermes - */ -class TimeForm extends Horde_Form -{ - function TimeForm(&$vars, $name = null) - { - parent::Horde_Form($vars, $name); - } - - function getJobTypeType() - { - try { - $types = $GLOBALS['injector']->getInstance('Hermes_Driver')->listJobTypes(array('enabled' => true)); - } catch (Horde_Exception $e) { - return array('invalid', array(sprintf(_("An error occurred listing job types: %s"), $e->getMessage()))); - } - if (count($types)) { - $values = array(); - foreach ($types as $id => $type) { - $values[$id] = $type['name']; - } - return array('enum', array($values)); - } - - return array('invalid', array(_("There are no job types configured."))); - } - - function getClientType() - { - try { - $clients = Hermes::listClients(); - } catch (Horde_Exception $e) { - return array('invalid', array(sprintf(_("An error occurred listing clients: %s"), $e->getMessage()))); - } - if ($clients) { - if (count($clients) > 1) { - $clients = array('' => _("--- Select A Client ---")) + $clients; - } - return array('enum', array($clients)); - } else { - return array('invalid', array(_("There are no clients which you have access to."))); - } - } - - /** - */ - function getCostObjectType($clientID = null) - { - global $registry; - - /* Check to see if any other active applications are exporting cost - * objects to which we might want to bill our time. */ - $criteria = array('user' => $GLOBALS['registry']->getAuth(), - 'active' => true); - if (!empty($clientID)) { - $criteria['client_id'] = $clientID; - } - - $costobjects = array(); - foreach ($registry->listApps() as $app) { - if (!$registry->hasMethod('listCostObjects', $app)) { - continue; - } - - try { - $result = $registry->callByPackage($app, 'listCostObjects', array($criteria)); - } catch (Horde_Exception $e) { - $GLOBALS['notification']->push(sprintf(_("Error retrieving cost objects from \"%s\": %s"), $registry->get('name', $app), $e->getMessage()), 'horde.error'); - continue; - } - - foreach (array_keys($result) as $catkey) { - foreach (array_keys($result[$catkey]['objects']) as $okey){ - $result[$catkey]['objects'][$okey]['id'] = $app . ':' . - $result[$catkey]['objects'][$okey]['id']; - } - } - - if ($app == $registry->getApp()) { - $costobjects = array_merge($result, $costobjects); - } else { - $costobjects = array_merge($costobjects, $result); - } - } - - $elts = array('' => _("--- No Cost Object ---")); - $counter = 0; - foreach ($costobjects as $category) { - Horde_Array::arraySort($category['objects'], 'name'); - $elts['category%' . $counter++] = sprintf('--- %s ---', $category['category']); - foreach ($category['objects'] as $object) { - $name = $object['name']; - if (Horde_String::length($name) > 80) { - $name = Horde_String::substr($name, 0, 76) . ' ...'; - } - - $hours = 0.0; - $filter = array('costobject' => $object['id']); - if (!empty($GLOBALS['conf']['time']['sum_billable_only'])) { - $filter['billable'] = true; - } - $result = $GLOBALS['injector']->getInstance('Hermes_Driver')->getHours($filter, array('hours')); - foreach ($result as $entry) { - if (!empty($entry['hours'])) { - $hours += $entry['hours']; - } - } - - /* Show summary of hours versus estimate for this - * deliverable. */ - if (empty($object['estimate'])) { - $name .= sprintf(_(" (%0.2f hours)"), $hours); - } else { - $name .= sprintf(_(" (%d%%, %0.2f of %0.2f hours)"), - (int)($hours / $object['estimate'] * 100), - $hours, $object['estimate']); - } - - $elts[$object['id']] = $name; - } - } - - return $elts; - } - -} - -/** - * TimeEntryForm Class. - * - * $Horde: hermes/lib/Forms/Time.php,v 1.23 2009/07/08 18:29:08 slusarz Exp $ - * - * Copyright 2002-2009 The Horde Project (http://www.horde.org/) - * - * See the enclosed file LICENSE for license information (BSD). If you - * did not receive this file, see http://www.horde.org/licenses/bsdl.php. - * - * @author Chuck Hagenbuch - * @package Hermes - */ -class TimeEntryForm extends TimeForm -{ - /** - * Reference to the form field storing the cost objects. - * - * @var Horde_Form_Variable - */ - var $_costObjects; - - function TimeEntryForm(&$vars) - { - global $hermes, $conf; - - if ($vars->exists('id')) { - parent::TimeForm($vars, _("Update Time")); - $delete_link = Horde::link(Horde_Util::addParameter(Horde::url('time.php'), 'delete', $vars->get('id')), _("Delete Entry")) . _("Delete"); - $this->setExtra('' . $delete_link . ''); - } else { - parent::TimeForm($vars, _("New Time")); - } - $this->setButtons(_("Save")); - - list($clienttype, $clientparams) = $this->getClientType(); - if ($clienttype == 'enum') { - require_once 'Horde/Form/Action.php'; - $action = &Horde_Form_Action::factory('submit'); - } - - list($typetype, $typeparams) = $this->getJobTypeType(); - - if ($vars->exists('id')) { - $this->addHidden('', 'id', 'int', true); - } - - if ($vars->exists('url')) { - $this->addHidden('', 'url', 'text', true); - } - - $var = &$this->addVariable(_("Date"), 'date', 'monthdayyear', true, - false, null, array(date('Y') - 1)); - $var->setDefault(date('Y-m-d')); - - $cli = &$this->addVariable(_("Client"), 'client', $clienttype, true, false, null, $clientparams); - if (isset($action)) { - $cli->setAction($action); - $cli->setOption('trackchange', true); - } - - $this->addVariable(_("Job Type"), 'type', $typetype, true, false, null, $typeparams); - - $this->_costObjects = &$this->addVariable( - _("Cost Object"), 'costobject', 'enum', false, false, null, - array(array())); - - $this->addVariable(_("Hours"), 'hours', 'number', true); - - if ($conf['time']['choose_ifbillable']) { - $yesno = array(1 => _("Yes"), 0 => _("No")); - $this->addVariable(_("Billable?"), 'billable', 'enum', true, false, null, array($yesno)); - } - - if ($vars->exists('client')) { - try { - $info = $GLOBALS['injector']->getInstance('Hermes_Driver')->getClientSettings($vars->get('client')); - } catch (Horde_Exception $e) {} - if (!$info['enterdescription']) { - $vars->set('description', _("See Attached Timesheet")); - } - } - $descvar = &$this->addVariable(_("Description"), 'description', 'longtext', true, false, null, array(4, 60)); - $this->addVariable(_("Additional Notes"), 'note', 'longtext', false, false, null, array(4, 60)); - } - - function setCostObjects($vars) - { - $this->_costObjects->type->setValues( - $this->getCostObjectType($vars->get('client'))); - } - -} - -/** - * TimeReviewForm Class. - * - * $Horde: hermes/lib/Forms/Time.php,v 1.23 2009/07/08 18:29:08 slusarz Exp $ - * - * Copyright 2003-2009 The Horde Project (http://www.horde.org/) - * - * See the enclosed file LICENSE for license information (BSD). If you - * did not receive this file, see http://www.horde.org/licenses/bsdl.php. - * - * @author Jay 'Eraserhead' Felice - * @package Hermes - */ -class TimeReviewForm extends TimeForm { - - function TimeReviewForm(&$vars) - { - global $hermes, $conf; - - parent::TimeForm($vars, _("Update Submitted Time")); - $this->setButtons(_("Update time")); - - list($clienttype, $clientparams) = $this->getClientType(); - if ($clienttype == 'enum') { - $map = array(); - $clients = Hermes::listClients(); - foreach ($clients as $id => $name) { - try { - $info = $GLOBALS['injector']->getInstance('Hermes_Driver')->getClientSettings($id); - $map[$id] = $info['enterdescription'] ? '' : _("See Attached Timesheet"); - } catch (Horde_Exception $e) { - $map[$id] = ''; - } - } - require_once 'Horde/Form/Action.php'; - $action = &Horde_Form_Action::factory('conditional_setvalue', - array('map' => $map, - 'target' => 'description')); - } - - list($typetype, $typeparams) = $this->getJobTypeType(); - - $this->addHidden('', 'id', 'int', true); - - $employees = array(); - - require_once 'Horde/Identity.php'; - $auth = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Auth')->create(); - try { - $users = $auth->listUsers(); - foreach ($users as $user) { - $identity = &Identity::singleton('none', $user); - $employees[$user] = $identity->getValue('fullname'); - } - } catch (Horde_Exception $e) {} - - $this->addVariable(_("Employee"), 'employee', 'enum', true, false, null, array($employees)); - - $var = &$this->addVariable(_("Date"), 'date', 'monthdayyear', true); - $var->setDefault(date('y-m-d')); - - - $cli = &$this->addVariable(_("Client"), 'client', $clienttype, true, false, null, $clientparams); - if (isset($action)) { - $cli->setAction($action); - } - - $this->addVariable(_("Job Type"), 'type', $typetype, true, false, null, $typeparams); - $this->addVariable(_("Hours"), 'hours', 'number', true); - - if ($conf['time']['choose_ifbillable']) { - $yesno = array(1 => _("Yes"), 0 => _("No")); - $this->addVariable(_("Billable?"), 'billable', 'enum', true, false, null, array($yesno)); - } - - $this->addVariable(_("Description"), 'description', 'longtext', true, false, null, array(4, 60)); - $this->addVariable(_("Additional Notes"), 'note', 'longtext', false, false, null, array(4, 60)); - } - -} -- 2.11.0