Changeset 1664
- Timestamp:
- 03/02/10 14:06:22 (5 months ago)
- Location:
- trunk
- Files:
-
- 5 modified
-
plugins/ullTimePlugin/lib/model/doctrine/PluginUllTimeReporting.class.php (modified) (3 diffs)
-
plugins/ullTimePlugin/modules/ullTime/lib/BaseUllTimeActions.class.php (modified) (1 diff)
-
plugins/ullTimePlugin/modules/ullTime/templates/editSuccess.php (modified) (9 diffs)
-
plugins/ullTimeThemeNGPlugin/web/css/main.css (modified) (1 diff)
-
test/unit/ullTimePlugin/UllTimeReportingTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/ullTimePlugin/lib/model/doctrine/PluginUllTimeReporting.class.php
r1142 r1664 6 6 abstract class PluginUllTimeReporting extends BaseUllTimeReporting 7 7 { 8 8 9 9 /** 10 10 * pre save hook 11 * 11 * 12 12 * auto calculate totals 13 13 * … … 17 17 { 18 18 $this->total_break_seconds = 0; 19 19 20 20 if ($this->begin_break1_at && $this->end_break1_at) 21 21 { 22 22 $this->total_break_seconds += strtotime($this->end_break1_at) - strtotime($this->begin_break1_at); 23 23 } 24 24 25 25 if ($this->begin_break2_at && $this->end_break2_at) 26 26 { 27 27 $this->total_break_seconds += strtotime($this->end_break2_at) - strtotime($this->begin_break2_at); 28 } 29 28 } 29 30 30 if ($this->begin_break3_at && $this->end_break3_at) 31 31 { … … 36 36 { 37 37 $this->total_work_seconds = strtotime($this->end_work_at) - strtotime($this->begin_work_at) - $this->total_break_seconds; 38 } 39 } 38 } 39 } 40 41 public function getBreakDuration($breakNum) 42 { 43 $beginField = 'begin_break' . $breakNum . '_at'; 44 $endField = 'end_break' . $breakNum . '_at'; 45 if ($this[$beginField] && $this[$endField]) 46 { 47 return strtotime($this[$endField]) - strtotime($this[$beginField]); 48 } 49 else 50 { 51 return 0; 52 } 53 } 40 54 41 55 } -
trunk/plugins/ullTimePlugin/modules/ullTime/lib/BaseUllTimeActions.class.php
r1646 r1664 163 163 $this->addGlobalValidators(); 164 164 165 $this->sum_time = UllTimeReportingTable::findTotalWorkSecondsByDateAndUserId($request->getParameter('date'), $this->user_id); 166 $this->is_today = ($request->getParameter('date') == date("Y-m-d",time())); 165 //$this->sum_time = UllTimeReportingTable::findTotalWorkSecondsByDateAndUserId($request->getParameter('date'), $this->user_id); 166 //$this->is_today = ($request->getParameter('date') == date("Y-m-d",time())); 167 $this->break_1_duration = $this->doc->getBreakDuration(1); 168 $this->break_2_duration = $this->doc->getBreakDuration(2); 169 $this->break_3_duration = $this->doc->getBreakDuration(3); 167 170 $this->up_to_now = strtotime(date("H:i",time())) - strtotime($this->doc->begin_work_at) - $this->doc->total_break_seconds; 171 172 $sumTime = UllTimeReportingTable::findTotalWorkSecondsByDateAndUserId($request->getParameter('date'), $this->user_id); 173 if (($request->getParameter('date') != date("Y-m-d",time())) || !$this->doc->begin_work_at) 174 { 175 $this->up_to_now = 0; 176 } 177 178 if($sumTime > 0) 179 { 180 $this->up_to_now = $sumTime; 181 } 168 182 169 183 $this->breadcrumbForEdit(); -
trunk/plugins/ullTimePlugin/modules/ullTime/templates/editSuccess.php
r1608 r1664 2 2 3 3 <?php include_partial('ullTableTool/flash', array('name' => 'message')) ?> 4 <?php $timeDurationWidget = new ullWidgetTimeDurationRead(); ?> 4 5 5 6 <h3> … … 15 16 <div class="edit_container"> 16 17 <table class="edit_table ull_time_edit_table_worktime"> 18 19 <col class="col_edit_list_name"/> 20 <col class="col_edit_list_begin"/> 21 <col class="col_edit_list_end"/> 22 <col class="col_edit_list_sum"/> 23 17 24 <thead> 18 25 <tr class="color_dark_bg"> … … 20 27 <th class="color_dark_bg"><?php echo __('Begin', null, 'common') ?></th> 21 28 <th class="color_dark_bg"><?php echo __('End', null, 'common') ?></th> 29 <th class="color_dark_bg"><?php echo __('Total', null, 'common') ?></th> 22 30 </tr> 23 31 </thead> … … 34 42 <?php echo $generator->getForm()->offsetGet('end_work_at')->renderError() ?> 35 43 </td> 44 <td> 45 <?php echo $timeDurationWidget->render(null, $up_to_now); ?> 46 </td> 36 47 </tr> 37 48 … … 39 50 </table> 40 51 52 41 53 <table class="edit_table"> 54 55 <col class="col_edit_list_name"/> 56 <col class="col_edit_list_begin"/> 57 <col class="col_edit_list_end"/> 58 <col class="col_edit_list_sum"/> 59 42 60 <thead> 43 61 <tr class="color_dark_bg"> … … 45 63 <th class="color_dark_bg"><?php echo __('Begin', null, 'common') ?></th> 46 64 <th class="color_dark_bg"><?php echo __('End', null, 'common') ?></th> 65 <th class="color_dark_bg"><?php echo __('Total', null, 'common') ?></th> 47 66 </tr> 48 67 </thead> … … 59 78 <?php echo $generator->getForm()->offsetGet('end_break1_at')->renderError() ?> 60 79 </td> 80 <td> 81 <?php echo $timeDurationWidget->render(null, $break_1_duration); ?> 82 </td> 61 83 </tr> 62 84 <tr> … … 70 92 <?php echo $generator->getForm()->offsetGet('end_break2_at')->renderError() ?> 71 93 </td> 94 <td> 95 <?php echo $timeDurationWidget->render(null, $break_2_duration); ?> 96 </td> 72 97 </tr> 73 98 <tr> … … 80 105 <?php echo $generator->getForm()->offsetGet('end_break3_at')->render() ?> 81 106 <?php echo $generator->getForm()->offsetGet('end_break3_at')->renderError() ?> 107 </td> 108 <td> 109 <?php echo $timeDurationWidget->render(null, $break_3_duration); ?> 82 110 </td> 83 111 </tr> -
trunk/plugins/ullTimeThemeNGPlugin/web/css/main.css
r1649 r1664 81 81 82 82 /* Make the time duration columns as thin as possible to make alignment to the right looking good */ 83 .col_duration_seconds_header, .col_period_list_time_total, .col_period_list_project_total, .col_period_list_delta {83 .col_duration_seconds_header, .col_period_list_time_total, .col_period_list_project_total, .col_period_list_delta, .col_edit_list_sum { 84 84 width: 1em; 85 85 } -
trunk/test/unit/ullTimePlugin/UllTimeReportingTest.php
r1142 r1664 10 10 sfContext::createInstance($configuration); 11 11 12 $t = new myTestCase( 2, new lime_output_color, $configuration);12 $t = new myTestCase(5, new lime_output_color, $configuration); 13 13 $path = dirname(__FILE__); 14 14 $t->setFixturesPath($path); … … 32 32 $t->is($report->total_work_seconds, 28800, 'Generates the correct work total'); 33 33 $t->is($report->total_break_seconds, 1800, 'Generates the correct break total'); 34 35 $t->diag('getBreakSum()'); 36 $report = new UllTimeReporting; 37 $report->UllUser = $user; 38 $report->date = '2009-09-18'; 39 $report->begin_work_at = '08:30:00'; 40 $report->end_work_at = '17:00:00'; 41 $report->begin_break1_at = '10:00:00'; 42 $report->end_break1_at = '10:10:00'; 43 $report->begin_break2_at = '12:40:00'; 34 44 45 $report->save(); 46 $t->is($report->getBreakDuration(1), 600, 'Returns the correct break1 seconds'); 47 $t->is($report->getBreakDuration(2), 0, 'Returns zero for empty end time'); 48 $t->is($report->getBreakDuration(3), 0, 'Returns zero for empty begin and end time'); 49 50
