Permalink
Browse files

Fixed bugs with bulk operations in admin area, fixed account bug in r…

…eporting
  • Loading branch information...
1 parent 77289fc commit 6c44e09030cf2bea6624ef13e247d79801bd54ff Timo Haberkern committed Mar 5, 2012
View
@@ -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!
@@ -1,5 +1,5 @@
all:
- version: 1.3.4
+ version: 1.3.5
user:
cultures: [de,en]
@@ -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>
@@ -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>
@@ -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');
@@ -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');
@@ -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>
@@ -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');
@@ -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>
@@ -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();
@@ -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();
@@ -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)) {
@@ -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;
}
}
@@ -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)) {
@@ -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;
}

0 comments on commit 6c44e09

Please sign in to comment.