Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 10 commits
  • 11 files changed
  • 0 commit comments
  • 1 contributor
View
11 README
@@ -0,0 +1,11 @@
+Tine 2.0 - Professional Open Source Groupware and CRM
+-----------------------------------------------------
+
+Tine 2.0 is an open source project which combines groupware and CRM in one consistent interface.
+
+Tine 2.0 is web-based and optimises collaboration and organisation of groups in a lasting manner.
+
+Tine 2.0 unites all the advantages of open source software with an extraordinarily high level of usability and an equally high standard of professional software development.
+This is what makes the difference between Tine 2.0 and many other existing groupware solutions.
+
+----> http://www.tine20.org
View
15 tests/tine20/Timetracker/JsonTest.php
@@ -453,7 +453,6 @@ protected function _createTsAndSearch($_startDate, $_filterType)
/**
* try to search for Timesheets (with combined is_billable + cleared)
- *
*/
public function testSearchTimesheetsWithCombinedIsBillableAndCleared()
{
@@ -468,12 +467,24 @@ public function testSearchTimesheetsWithCombinedIsBillableAndCleared()
Timetracker_Controller_Timeaccount::getInstance()->update($ta);
// search & check
- $search = $this->_json->searchTimesheets($this->_getTimesheetFilter(), $this->_getPaging('is_billable_combined'));
+ $search = $this->_json->searchTimesheets($this->_getTimesheetFilter(array(
+ 'field' => 'is_cleared_combined',
+ 'operator' => 'equals',
+ 'value' => FALSE,
+ )), $this->_getPaging('is_billable_combined'));
$this->assertEquals(0, $search['results'][0]['is_billable_combined'], 'is_billable_combined mismatch');
$this->assertEquals(0, $search['results'][0]['is_cleared_combined'], 'is_cleared_combined mismatch');
$this->assertEquals(1, $search['totalcount']);
$this->assertEquals(30, $search['totalsum']);
$this->assertEquals(0, $search['totalsumbillable']);
+
+ // search again with is_billable filter
+ $search = $this->_json->searchTimesheets($this->_getTimesheetFilter(array(
+ 'field' => 'is_billable_combined',
+ 'operator' => 'equals',
+ 'value' => FALSE,
+ )), $this->_getPaging('is_billable_combined'));
+ $this->assertEquals(0, $search['results'][0]['is_billable_combined'], 'is_billable_combined mismatch');
}
/******* persistent filter tests *****************/
View
11 tine20/Setup/Controller.php
@@ -1128,14 +1128,13 @@ public function createImportExportDefinitions($_application)
foreach (new DirectoryIterator($path) as $item) {
$filename = $path . DIRECTORY_SEPARATOR . $item->getFileName();
if (preg_match("/\.xml/", $filename)) {
- // @todo move try catch here and remove param from updateOrCreateFromFilename
try {
Tinebase_ImportExportDefinition::getInstance()->updateOrCreateFromFilename($filename, $_application);
- } catch (Tinebase_Exception_Record_Validation $terv) {
- Setup_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Not installing import/export definion: ' . $terv->getMessage());
- } catch (Zend_Db_Statement_Exception $zdse) {
- Setup_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Not installing import/export definion: ' . $zdse->getMessage());
- }
+ } catch (Exception $e) {
+ Setup_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__
+ . ' Not installing import/export definion from file: ' . $filename
+ . $e->getMessage());
+ }
}
}
}
View
12 tine20/Timetracker/Backend/Timesheet.php
@@ -7,7 +7,6 @@
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Philipp Schüle <p.schuele@metaways.de>
* @copyright Copyright (c) 2007-2011 Metaways Infosystems GmbH (http://www.metaways.de)
- * @version $Id$
*/
/**
@@ -70,6 +69,8 @@ class Timetracker_Backend_Timesheet extends Tinebase_Backend_Sql_SearchImproved
'joinId' => 'timeaccount_id',
'select' => array('is_billable_combined' => '(timetracker_timesheet.is_billable*timetracker_timeaccount.is_billable)'),
'singleValue' => TRUE,
+ // needs to be preserved in select
+ 'preserve' => TRUE,
),
'is_cleared_combined' => array(
'table' => 'timetracker_timeaccount',
@@ -77,13 +78,8 @@ class Timetracker_Backend_Timesheet extends Tinebase_Backend_Sql_SearchImproved
'joinId' => 'timeaccount_id',
'select' => array('is_cleared_combined' => "(timetracker_timesheet.is_cleared|(IF(STRCMP(timetracker_timeaccount.status, 'billed'),0,1)))"),
'singleValue' => TRUE,
- ),
- 'timetracker_timeaccount.is_billable' => array(
- 'table' => 'timetracker_timeaccount',
- 'joinOn' => 'id',
- 'joinId' => 'timeaccount_id',
- 'select' => array('timetracker_timeaccount.is_billable' => 'timetracker_timeaccount.is_billable'),
- 'singleValue' => TRUE,
+ // needs to be preserved in select
+ 'preserve' => TRUE,
),
);
}
View
28 tine20/Timetracker/Model/TimesheetFilter.php
@@ -5,9 +5,8 @@
* @package Tinebase
* @subpackage Filter
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
- * @copyright Copyright (c) 2007-2008 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright Copyright (c) 2007-2011 Metaways Infosystems GmbH (http://www.metaways.de)
* @author Cornelius Weiss <c.weiss@metaways.de>
- * @version $Id$
*/
/**
@@ -46,9 +45,14 @@ class Timetracker_Model_TimesheetFilter extends Tinebase_Model_Filter_FilterGrou
),
'account_id' => array('filter' => 'Tinebase_Model_Filter_User'),
'start_date' => array('filter' => 'Tinebase_Model_Filter_Date'),
- 'is_billable' => array('filter' => 'Tinebase_Model_Filter_Bool', 'options' => array('fields' => array('timetracker_timesheet.is_billable','timetracker_timeaccount.is_billable'))),
- //'is_cleared' => array('filter' => 'Tinebase_Model_Filter_Bool'),
- 'is_cleared' => array('custom' => TRUE),
+ 'is_billable_combined' => array(
+ 'filter' => 'Tinebase_Model_Filter_Bool',
+ 'options' => array('leftOperand' => '(timetracker_timesheet.is_billable*timetracker_timeaccount.is_billable)'),
+ ),
+ 'is_cleared_combined' => array(
+ 'filter' => 'Tinebase_Model_Filter_Bool',
+ 'options' => array('leftOperand' => "(timetracker_timesheet.is_cleared|(IF(STRCMP(timetracker_timeaccount.status, 'billed'),0,1)))"),
+ ),
'tag' => array('filter' => 'Tinebase_Model_Filter_Tag', 'options' => array('idProperty' => 'timetracker_timesheet.id')),
'customfield' => array('filter' => 'Tinebase_Model_Filter_CustomField', 'options' => array('idProperty' => 'timetracker_timesheet.id')),
);
@@ -112,20 +116,6 @@ public function appendFilterSql($_select, $_backend)
}
/**
- * gets additional columns required for from() of search Zend_Db_Select
- *
- * @return array
- */
- public function getRequiredColumnsForSelect()
- {
- $result = parent::getRequiredColumnsForSelect();
-
- $result[] = 'timetracker_timeaccount.is_billable';
-
- return $result;
- }
-
- /**
* append acl filter
*
* @param Zend_Db_Select $_select
View
11 tine20/Timetracker/js/Models.js
@@ -137,17 +137,6 @@ Tine.Timetracker.Model.Timeaccount.getFilterModel = function() {
{filtertype: 'tinebase.tag', app: app}
];
}
-/**
- * filter model for timeaccounts
- *
-Tine.Timetracker.Model.TimeaccountFilter = [
- {field: 'query', filter: Tine.Tinebase.Model.filter.Query},
- {field: 'tags', filter: Tine.Tinebase.Model.filter.Tag, options: {appName: 'Timetracker'} },
- {field: 'description', filter: Tine.Tinebase.Model.filter.Text, options: {operators: ['contains']} },
- {field: 'created_by', filter: Tine.Tinebase.Model.filter.User},
- {field: 'status', filter: Tine.Timetracker.TimeAccountStatusGridFilter}
-];
-*/
/**
* Model of a grant
View
4 tine20/Timetracker/js/TimesheetGridPanel.js
@@ -187,8 +187,8 @@ Tine.Timetracker.TimesheetGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
{label: this.app.i18n._('Account'), field: 'account_id', valueType: 'user'},
{label: this.app.i18n._('Date'), field: 'start_date', valueType: 'date', pastOnly: true},
{label: this.app.i18n._('Description'), field: 'description', defaultOperator: 'contains'},
- {label: this.app.i18n._('Billable'), field: 'is_billable', valueType: 'bool', defaultValue: true },
- {label: this.app.i18n._('Cleared'), field: 'is_cleared', valueType: 'bool', defaultValue: false },
+ {label: this.app.i18n._('Billable'), field: 'is_billable_combined', valueType: 'bool', defaultValue: true },
+ {label: this.app.i18n._('Cleared'), field: 'is_cleared_combined', valueType: 'bool', defaultValue: false },
{filtertype: 'tinebase.tag', app: this.app},
{filtertype: 'timetracker.timeaccount'}
].concat(this.getCustomfieldFilters()),
View
15 tine20/Tinebase/Backend/Sql/SearchImproved.php
@@ -326,9 +326,12 @@ protected function _addForeignTableJoins(Zend_Db_Select $_select, $_cols, $_grou
$groupBy = ($_groupBy !== NULL) ? $_groupBy : $this->_tableName . '.' . $this->_identifier;
$_select->group($groupBy);
+ $cols = (array) $_cols;
foreach ($this->_foreignTables as $foreignColumn => $join) {
// only join if field is in cols
- if ($_cols == '*' || array_key_exists($foreignColumn, $_cols)) {
+ if (in_array('*', $cols) || array_key_exists($foreignColumn, $cols)) {
+ if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' foreign column: ' . $foreignColumn);
+
$selectArray = (array_key_exists('select', $join))
? $join['select']
: ((array_key_exists('field', $join) && (! array_key_exists('singleValue', $join) || ! $join['singleValue']))
@@ -336,7 +339,7 @@ protected function _addForeignTableJoins(Zend_Db_Select $_select, $_cols, $_grou
: array($foreignColumn => $join['table'] . '.id'));
$joinId = (array_key_exists('joinId', $join)) ? $join['joinId'] : $this->_identifier;
- $this->_removeColFromSelect($_select, $_cols, $foreignColumn);
+ $this->_removeColFromSelect($_select, $cols, $foreignColumn);
try {
$_select->joinLeft(
@@ -344,6 +347,10 @@ protected function _addForeignTableJoins(Zend_Db_Select $_select, $_cols, $_grou
/* on */ $this->_db->quoteIdentifier($this->_tableName . '.' . $joinId) . ' = ' . $this->_db->quoteIdentifier($join['table'] . '.' . $join['joinOn']),
/* select */ $selectArray
);
+ // need to add it to cols to prevent _removeColFromSelect from removing it
+ if (array_key_exists('preserve', $join) && $join['preserve'] && array_key_exists($foreignColumn, $selectArray)) {
+ $cols[$foreignColumn] = $selectArray[$foreignColumn];
+ }
} catch (Zend_Db_Select_Exception $zdse) {
// @todo get joins from Zend_Db_Select before trying to join the same tables twice
$_select->columns($selectArray, $join['table']);
@@ -360,12 +367,12 @@ protected function _addForeignTableJoins(Zend_Db_Select $_select, $_cols, $_grou
* @param array|string $_cols
* @param string $_column
*/
- protected function _removeColFromSelect(Zend_Db_Select $_select, $_cols, $_column)
+ protected function _removeColFromSelect(Zend_Db_Select $_select, &$_cols, $_column)
{
if (! is_array($_cols)) {
return;
}
-
+
foreach ($_cols as $name => $correlation) {
if ($name == $_column) {
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Removing ' . $_column . ' from columns.');
View
10 tine20/Tinebase/ImportExportDefinition.php
@@ -96,11 +96,11 @@ public function getExportDefinitionsForApplication(Tinebase_Model_Application $_
public function getFromFile($_filename, $_applicationId, $_name = NULL)
{
if (file_exists($_filename)) {
-
+ $basename = basename($_filename);
$content = file_get_contents($_filename);
$config = new Zend_Config_Xml($_filename);
if ($_name === NULL) {
- $name = ($config->name) ? $config->name : $_filename;
+ $name = ($config->name) ? $config->name : preg_replace("/\.xml/", '', $basename);
} else {
$name = $_name;
}
@@ -112,7 +112,8 @@ public function getFromFile($_filename, $_applicationId, $_name = NULL)
'type' => $config->type,
'model' => $config->model,
'plugin' => $config->plugin,
- 'plugin_options' => $content
+ 'plugin_options' => $content,
+ 'filename' => $basename,
));
return $definition;
@@ -165,9 +166,6 @@ public function updateOrCreateFromFilename($_filename, $_application, $_name = N
$_name
);
- // @todo remove path from filename here instead of just using the name
- $definition->filename = $definition->name . '.xml';
-
// try to get definition and update if it exists
try {
$existing = $this->getByName($definition->name);
View
5 tine20/Tinebase/Model/Filter/Bool.php
@@ -5,9 +5,8 @@
* @package Tinebase
* @subpackage Filter
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
- * @copyright Copyright (c) 2007-2008 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright Copyright (c) 2007-2011 Metaways Infosystems GmbH (http://www.metaways.de)
* @author Cornelius Weiss <c.weiss@metaways.de>
- * @version $Id$
*/
/**
@@ -58,6 +57,8 @@ public function appendFilterSql($_select, $_backend)
$_select->orwhere($quotedField . $action['sqlop'], $value);
}
}
+ } else if (! empty($this->_options['leftOperand'])) {
+ $_select->where($this->_options['leftOperand'] . $action['sqlop'], $value);
} else {
$_select->where($this->_getQuotedFieldName($_backend) . $action['sqlop'], $value);
}
View
9 tine20/Tinebase/Model/Filter/FilterGroup.php
@@ -430,17 +430,20 @@ public function getRequiredColumnsForSelect()
$result = array();
foreach ($this->getFilterObjects() as $filter) {
- // @todo check single filters for requirements
+ $field = $filter->getField();
+ if (array_key_exists('options', $this->_filterModel[$field]) && array_key_exists('requiredCols', $this->_filterModel[$field]['options'])) {
+ $result = array_merge($result, $this->_filterModel[$field]['options']['requiredCols']);
+ }
}
- if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($this->_customData, TRUE));
-
foreach ($this->_customData as $custom) {
// check custom filter for requirements
if (array_key_exists('requiredCols', $this->_filterModel[$custom['field']])) {
$result = array_merge($result, $this->_filterModel[$custom['field']]['requiredCols']);
}
}
+
+ if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($result, TRUE));
return $result;
}

No commit comments for this range

Something went wrong with that request. Please try again.