Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
Merge branch 'pu/pm/HrWtrLimitWorkingTimeMaxDuration' into '2022.11'
Browse files Browse the repository at this point in the history
fix(HR WTR) fixed limitWorkingTime BL max duration

See merge request tine20/tine20!3700
  • Loading branch information
paulmhh committed Apr 12, 2023
2 parents fc6a076 + 7fd8183 commit 1dc3847
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions tine20/HumanResources/BL/DailyWTReport/LimitWorkingTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage BL
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Paul Mehrer <p.mehrer@metaways.de>
* @copyright Copyright (c) 2019-2022 Metaways Infosystems GmbH (http://www.metaways.de)
* @copyright Copyright (c) 2019-2023 Metaways Infosystems GmbH (http://www.metaways.de)
*
*/

Expand Down Expand Up @@ -120,8 +120,9 @@ protected function _checkMaxDuration(HumanResources_BL_DailyWTReport_Data $_data
$duration += $timeSlot->end->getTimestamp() - $timeSlot->start->getTimestamp();

if ($duration > $maxDuration) {
if ($maxDuration - $duration !== $timeSlot->end->getTimestamp() - $timeSlot->start->getTimestamp()) {
$timeSlot->end->subSecond($maxDuration - $duration);
$diff = $duration - $maxDuration;
if ($diff !== $timeSlot->end->getTimestamp() - $timeSlot->start->getTimestamp()) {
$timeSlot->end->subSecond($diff);
if (!next($_data->timeSlots)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage Model
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
* @author Paul Mehrer <p.mehrer@metaways.de>
* @copyright Copyright (c) 2019-2022 Metaways Infosystems GmbH (http://www.metaways.de)
* @copyright Copyright (c) 2019-2023 Metaways Infosystems GmbH (http://www.metaways.de)
*
*/

Expand Down Expand Up @@ -63,6 +63,7 @@ class HumanResources_Model_BLDailyWTReport_LimitWorkingTimeConfig extends Tineba
],
self::FLDS_MAX_DURATION => [
self::TYPE => self::TYPE_INTEGER,
self::SPECIAL_TYPE => self::SPECIAL_TYPE_DURATION_SEC,
self::LABEL => 'Maximum duration', // _('Maximum duration')
self::VALIDATORS => [Zend_Filter_Input::ALLOW_EMPTY => true],
],
Expand Down

0 comments on commit 1dc3847

Please sign in to comment.