PluginProbe
ShiftController Employee Shift Scheduling / 4.9.66
ShiftController Employee Shift Scheduling v4.9.66
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
← All changes | sh4/shifts/duration.php +10 -20 4.9.954.9.66 View file →
@@ -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++;