| @@ -27,13 +27,8 @@ | ||
| 27 | 27 | $this->settings = $settings; |
| 28 | 28 | $this->t = $t; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function getShifts() | |
| 32 | - { | |
| 33 | - return $this->shifts; | |
| 34 | - } | |
| 35 | - | |
| 36 | 31 | public function reset() |
| 37 | 32 | { |
| 38 | 33 | $this->qty = 0; |
| 39 | 34 | $this->duration = 0; |
| @@ -48,9 +43,9 @@ | ||
| 48 | 43 | $id = $model->getId(); |
| 49 | 44 | if( isset($this->shifts[$id]) ){ |
| 50 | 45 | return $this; |
| 51 | 46 | } |
| 52 | - $this->shifts[$id] = $model; | |
| 47 | + $this->shifts[$id] = $id; | |
| 53 | 48 | |
| 54 | 49 | $start = $model->getStart(); |
| 55 | 50 | $end = $model->getEnd(); |
| 56 | 51 | |
| @@ -88,24 +83,19 @@ | ||
| 88 | 83 | } |
| 89 | 84 | |
| 90 | 85 | $noBreak = $this->settings->get( 'shifttypes_nobreak' ); |
| 91 | 86 | if( ! $noBreak ){ |
| 92 | - $breakStart = (string) $model->getBreakStart(); | |
| 93 | - $breakEnd = (string) $model->getBreakEnd(); | |
| 87 | + $breakStart = $model->getBreakStart(); | |
| 88 | + $breakEnd = $model->getBreakEnd(); | |
| 94 | 89 | |
| 95 | - if( $breakStart OR $breakEnd ){ | |
| 96 | - // if( $breakStart < $start ) $breakStart = $start; | |
| 97 | - // if( $breakEnd > $end ) $breakEnd = $end; | |
| 90 | + if( ! ((NULL === $breakStart) && (NULL === $breakEnd)) ){ | |
| 91 | + $this->t->setDateTimeDb( $breakStart ); | |
| 92 | + $breakStartTs = $this->t->getTimestamp(); | |
| 93 | + $this->t->setDateTimeDb( $breakEnd ); | |
| 94 | + $breakEndTs = $this->t->getTimestamp(); | |
| 98 | 95 | |
| 99 | - if( ($breakStart >= $start) && ($breakEnd <= $end) ){ | |
| 100 | - $this->t->setDateTimeDb( $breakStart ); | |
| 101 | - $breakStartTs = $this->t->getTimestamp(); | |
| 102 | - $this->t->setDateTimeDb( $breakEnd ); | |
| 103 | - $breakEndTs = $this->t->getTimestamp(); | |
| 104 | - | |
| 105 | - $breakDuration = abs( $breakEndTs - $breakStartTs ); | |
| 106 | - $duration = $duration - $breakDuration; | |
| 107 | - } | |
| 96 | + $breakDuration = abs( $breakEndTs - $breakStartTs ); | |
| 97 | + $duration = $duration - $breakDuration; | |
| 108 | 98 | } |
| 109 | 99 | } |
| 110 | 100 | |
| 111 | 101 | $this->qty++; |