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/controller/time.php +13 -40 4.9.774.9.66 View file →
@@ -45,10 +45,10 @@
45 45 $shiftType = $this->shiftTypesQuery->findById( $shiftTypeId );
46 46
47 47 $timeStart = $shiftType->getStart();
48 48 $timeEnd = $shiftType->getEnd();
49 - $startBreak = (string) $shiftType->getBreakStart();
50 - $endBreak = (string) $shiftType->getBreakEnd();
49 + $startBreak = $shiftType->getBreakStart();
50 + $endBreak = $shiftType->getBreakEnd();
51 51 }
52 52 else {
53 53 $time = $this->post->get('time');
54 54
@@ -60,9 +60,9 @@
60 60 }
61 61
62 62 list( $timeStart, $timeEnd ) = explode( '-', $time );
63 63
64 - $startBreak = $endBreak = '';
64 + $startBreak = $endBreak = NULL;
65 65 $breakOn = $this->post->get('break_on');
66 66 if( $breakOn ){
67 67 $break = $this->post->get('break');
68 68 list( $startBreak, $endBreak ) = explode( '-', $break );
@@ -79,46 +79,19 @@
79 79 ->modify( '+' . $timeEnd . ' seconds' )
80 80 ->formatDateTimeDb()
81 81 ;
82 82
83 - if( strlen($startBreak) ){
84 - $this->t->setDateDb( $date );
85 - if( $startBreak ){
86 - $this->t->modify( '+' . $startBreak . ' seconds' );
87 - }
88 - $startBreak = $this->t->formatDateTimeDb();
83 + if( NULL !== $startBreak ){
84 + $startBreak = $this->t->setDateDb( $date )
85 + ->modify( '+' . $startBreak . ' seconds' )
86 + ->formatDateTimeDb()
87 + ;
89 88 }
90 -
91 - if( strlen($endBreak) ){
92 - $this->t->setDateDb( $date );
93 - if( $endBreak ){
94 - $this->t->modify( '+' . $endBreak . ' seconds' );
95 - }
96 - $endBreak = $this->t->formatDateTimeDb();
97 - }
98 -
99 - if( $startBreak OR $endBreak ){
100 - if( ($startBreak < $start) OR ($endBreak > $end) ){
101 - $errors = array();
102 - $msg = '__Incorrect luch break time__';
103 - $errors['break'] = $msg;
104 -
105 - // $id = $shift->getId();
106 - // $to = 'shifts/' . $id . '/time';
107 -
108 - $to = $this->post->get( 'back' );
109 - $to = $this->post->get( 'back' );
110 - if( $to ){
111 - $to = json_decode( $to, TRUE );
112 - }
113 - else {
114 - $to = array( 'schedule', array() );
115 - }
116 -
117 - // throw new HC3_ExceptionArray( $errors );
118 - $return = array( $to, $msg, true );
119 - return $return;
120 - }
89 + if( NULL !== $endBreak ){
90 + $endBreak = $this->t->setDateDb( $date )
91 + ->modify( '+' . $endBreak . ' seconds' )
92 + ->formatDateTimeDb()
93 + ;
121 94 }
122 95
123 96 // check if it creates a conflict
124 97 $calendar = $shift->getCalendar();