Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Commit

Permalink
Fixed bugs with bulk operations in admin area, fixed account bug in r…
Browse files Browse the repository at this point in the history
…eporting
  • Loading branch information
Timo Haberkern authored and Timo Haberkern committed Mar 5, 2012
1 parent 77289fc commit 6c44e09
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -22,7 +22,7 @@ At the moment there is no installation automatic process to help you doing a pro

1. Get your copy of TimeHive via [GitHub](https://github.com/thaberkern/timehive).

* Please use the official download-package for this. Only these package including the needed Symfony-Libraries! The current release package is [V.1.3.3](https://github.com/downloads/thaberkern/timehive/timehive-1.3.3.zip)
* Please use the official download-package for this. Only these package including the needed Symfony-Libraries! The current release package is [V.1.3.5](https://github.com/downloads/thaberkern/timehive/timehive-1.3.5.zip)

2. Copy the sourcecode to one of your Webservers.
3. Create a virtual host with the web-directory as the root-folder. If you have an existing Webserver with a given file structure rename the webfolder with the root folder of your webserver. Do not (!!) copy the entire timehive folder to the root folder!
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/config/app.yml
@@ -1,5 +1,5 @@
all:
version: 1.3.4
version: 1.3.5

user:
cultures: [de,en]
6 changes: 5 additions & 1 deletion apps/frontend/i18n/messages.de.xml
Expand Up @@ -618,7 +618,11 @@
<trans-unit id="160">
<source>Your TimeHive account activation</source>
<target>Ihre TimeHive Account Informationen</target>
</trans-unit>
</trans-unit>
<trans-unit id="161">
<source>Do you really want to execute this bulk operation?</source>
<target>Wollen Sie diese Sammelaktion wirklich ausführen?</target>
</trans-unit>
<trans-unit id="10000">
<source>credential.group.timetracking</source>
<target>Zeiterfassung</target>
Expand Down
4 changes: 3 additions & 1 deletion apps/frontend/modules/adminProject/templates/listSuccess.php
Expand Up @@ -11,7 +11,9 @@
</div>
<?php endif; ?>
<div id="box1-tabular" class="content">
<form class="plain" action="<?php echo url_for('adminProject/bulk');?>" method="post">
<form class="plain" action="<?php echo url_for('adminProject/bulk');?>"
onsubmit="return confirm('<?php echo __('Do you really want to execute this bulk operation?');?>')"
method="post">
<table cellspacing="0">
<thead>
<tr>
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/modules/adminRole/actions/actions.class.php
Expand Up @@ -91,6 +91,7 @@ public function executeBulk(sfWebRequest $request)
$query->update('Role r')
->set('deleted_at', '?', date('Y-m-d H:i:s'))
->whereIn('r.id', $ids)
->andWhere('it.account_id = ?', $this->getUser()->getAttribute('account_id'))
->execute();

$this->redirect('adminRole/list');
Expand Down
Expand Up @@ -96,6 +96,7 @@ public function executeBulk(sfWebRequest $request)
$query->update('TimeItemType it')
->set('deleted_at', '?', date('Y-m-d H:i:s'))
->whereIn('it.id', $ids)
->andWhere('it.account_id = ?', $this->getUser()->getAttribute('account_id'))
->execute();

$this->redirect('adminTimeItemType/list');
Expand Down
Expand Up @@ -6,7 +6,9 @@
<?php include_partial('global/adminHeaderMenu');?>
</div>
<div id="box1-tabular" class="content">
<form class="plain" action="<?php echo url_for('adminTimeItemType/bulk');?>" method="post">
<form class="plain" action="<?php echo url_for('adminTimeItemType/bulk');?>"
onsubmit="return confirm('<?php echo __('Do you really want to execute this bulk operation?');?>')"
method="post">
<table cellspacing="0">
<thead>
<tr>
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/modules/adminUser/actions/actions.class.php
Expand Up @@ -80,6 +80,7 @@ public function executeBulk(sfWebRequest $request)
}

$query->whereIn('u.id', $ids);
$query->andWhere('it.account_id = ?', $this->getUser()->getAttribute('account_id'));
$query->execute();

$this->redirect('adminUser/list');
Expand Down
4 changes: 3 additions & 1 deletion apps/frontend/modules/adminUser/templates/listSuccess.php
Expand Up @@ -11,7 +11,9 @@
</div>
<?php endif; ?>
<div id="box1-tabular" class="content">
<form class="plain" action="<?php echo url_for('adminUser/bulk');?>" method="post">
<form class="plain" action="<?php echo url_for('adminUser/bulk');?>"
onsubmit="return confirm('<?php echo __('Do you really want to execute this bulk operation?');?>')"
method="post">
<table cellspacing="0">
<thead>
<tr>
Expand Down
10 changes: 8 additions & 2 deletions apps/frontend/modules/report/actions/actions.class.php
Expand Up @@ -29,7 +29,9 @@ public function executeLastBookings(sfWebRequest $request)
$pagesize = $request->getParameter('pagesize', 20);
$this->last_bookings_pager = new sfDoctrinePager('TimeLogItem', $pagesize);
$this->last_bookings_pager->setQuery(TimeLogItemTable::getInstance()
->getFilterQuery($filter, $this->getUser()->getAttribute('uid')));
->getFilterQuery($filter,
$this->getUser()->getAttribute('uid'),
$account_id));
$this->last_bookings_pager->setPage($request->getParameter('page', 1));
$this->last_bookings_pager->init();

Expand All @@ -43,10 +45,14 @@ public function executeMissingBookings(sfWebRequest $request)
{
$filter = $this->checkFilter($request);

$account_id = $this->getUser()->getAttribute('account_id');

$pagesize = $request->getParameter('pagesize', 20);
$this->no_bookings_pager = new sfDoctrinePager('MissingTimeItemEntry', $pagesize);
$this->no_bookings_pager->setQuery(MissingTimeItemEntryTable::getInstance()
->getFilterQuery($filter, $this->getUser()->getAttribute('uid')));
->getFilterQuery($filter,
$this->getUser()->getAttribute('uid'),
$account_id));
$this->no_bookings_pager->setPage($request->getParameter('page', 1));
$this->no_bookings_pager->init();

Expand Down
5 changes: 4 additions & 1 deletion lib/model/doctrine/MissingTimeItemEntryTable.class.php
Expand Up @@ -15,10 +15,11 @@ public function getForUserQuery($user_id)
->orderBy('e.day DESC');
}

public function getFilterQuery($filter, $user_id = null)
public function getFilterQuery($filter, $user_id = null, $account_id)
{
$query = Doctrine_Query::create()
->from('MissingTimeItemEntry e')
->innerJoin('e.User u')
->orderBy('e.day DESC');

if (array_key_exists('user', $filter)) {
Expand All @@ -39,6 +40,8 @@ public function getFilterQuery($filter, $user_id = null)
$query->andWhere('e.day<=?', array($filter['dateTo']));
}

$query->andWhere('u.account_id = ?', $account_id);

return $query;
}
}
5 changes: 4 additions & 1 deletion lib/model/doctrine/TimeLogItemTable.class.php
Expand Up @@ -29,10 +29,11 @@ public function updateMissedBookingsForWeek($week_number, $year, $user)
}
}

public function getFilterQuery($filter, $user_id = null)
public function getFilterQuery($filter, $user_id = null, $account_id)
{
$query = Doctrine_Query::create()
->from('TimeLogItem e')
->innerJoin('e.User u')
->orderBy('e.itemdate DESC');

if (array_key_exists('user', $filter)) {
Expand All @@ -59,6 +60,8 @@ public function getFilterQuery($filter, $user_id = null)
$query->andWhere('e.itemdate<=?', array($filter['dateTo']));
}

$query->andWhere('u.account_id = ?', $account_id);

return $query;
}

Expand Down

0 comments on commit 6c44e09

Please sign in to comment.