leantime
leantime copied to clipboard
Increase the usage of expressions with combined operators
:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of combined operators accordingly.
diff --git a/src/core/class.helper.php b/src/core/class.helper.php
index 25d6100..580b28d 100644
--- a/src/core/class.helper.php
+++ b/src/core/class.helper.php
@@ -231,11 +231,11 @@ function getMultipleValues( $arr)
for($i=0; $i<$sizearr; $i++){
- $myLIST=$myLIST.$arr[$i];
+ $myLIST .= $arr[$i];
if ($i>=0) {
if ($i<$sizearr-1 ) {
- $myLIST=$myLIST.",";
+ $myLIST .= ",";
}
}
}
@@ -465,7 +465,7 @@ public function time2Seconds($time, $mode=1)
}elseif($mode == 2) {
if($time<0) {
- $time = $time * -1;
+ $time *= -1;
$sign = '- ';
}else{
$sign = '';
diff --git a/src/domain/projects/controllers/class.showProject.php b/src/domain/projects/controllers/class.showProject.php
index 2f5cb50..a3b59c9 100644
--- a/src/domain/projects/controllers/class.showProject.php
+++ b/src/domain/projects/controllers/class.showProject.php
@@ -281,7 +281,7 @@ public function run()
$steps = 50;
}
- $max = $max + $steps;
+ $max += $steps;
$tpl->assign('timesheetsAllHours', $allHours);
diff --git a/src/domain/projects/repositories/class.projects.php b/src/domain/projects/repositories/class.projects.php
index 44e5ca1..819c487 100644
--- a/src/domain/projects/repositories/class.projects.php
+++ b/src/domain/projects/repositories/class.projects.php
@@ -473,7 +473,7 @@ public function getProjectBookedHoursArray($id)
$value = $results[$key]['totalHours'];
}
- $total = $total + $value;
+ $total += $value;
$chartArr[$dayKey] = $total;
}
diff --git a/src/domain/projects/templates/submodules/timesheet.sub.php b/src/domain/projects/templates/submodules/timesheet.sub.php
index d8db0d1..38de644 100644
--- a/src/domain/projects/templates/submodules/timesheet.sub.php
+++ b/src/domain/projects/templates/submodules/timesheet.sub.php
@@ -118,7 +118,7 @@
<?php
$sum = 0;
foreach($this->get('allTimesheets') as $row) {
- $sum = $sum + $row['hours'];?>
+ $sum += $row['hours'];?>
<tr>
<td><a href="index.php?act=timesheets.editTime&id=<?php echo $row['id']; ?>"><?php echo $row['id']; ?></a></td>
<td><?php echo $helper->timestamp2date($row['workDate'], 2); ?></td>
diff --git a/src/domain/tickets/templates/submodules/subTasks.sub.php b/src/domain/tickets/templates/submodules/subTasks.sub.php
index e44c68b..dc6b5fb 100644
--- a/src/domain/tickets/templates/submodules/subTasks.sub.php
+++ b/src/domain/tickets/templates/submodules/subTasks.sub.php
@@ -26,8 +26,8 @@
$sumPlanHours = 0;
$sumEstHours = 0;
foreach($this->get('allSubTasks') as $subticket) {
- $sumPlanHours = $sumPlanHours + $subticket['planHours'];
- $sumEstHours = $sumEstHours + $subticket['hourRemaining'];
+ $sumPlanHours += $subticket['planHours'];
+ $sumEstHours += $subticket['hourRemaining'];
?>
<tr>
<form method="post" action="#subtasks">
diff --git a/src/domain/tickets/templates/submodules/timesheet.sub.php b/src/domain/tickets/templates/submodules/timesheet.sub.php
index f83c94e..62a64d8 100644
--- a/src/domain/tickets/templates/submodules/timesheet.sub.php
+++ b/src/domain/tickets/templates/submodules/timesheet.sub.php
@@ -69,7 +69,7 @@
<?php
$sum = 0;
foreach ($this->get('ticketHours') as $hours){
- $sum = $sum + $hours['summe'];
+ $sum += $hours['summe'];
echo"labels.push('".date($this->__("language.dateformat"), strtotime($hours['utc']))."');
";
diff --git a/src/domain/timesheets/templates/showAll.tpl.php b/src/domain/timesheets/templates/showAll.tpl.php
index 3040ca7..72c88b8 100644
--- a/src/domain/timesheets/templates/showAll.tpl.php
+++ b/src/domain/timesheets/templates/showAll.tpl.php
@@ -181,7 +181,7 @@
$billableSum = 0;
foreach($this->get('allTimesheets') as $row) {
- $sum = $sum + $row['hours'];?>
+ $sum += $row['hours'];?>
<tr>
<td data-order="<?=$this->e($row['id']); ?>">
<?php if ($login::userIsAtLeast("clientManager")) { ?>
diff --git a/src/domain/timesheets/templates/showMyList.tpl.php b/src/domain/timesheets/templates/showMyList.tpl.php
index 68bd8d0..cc933b1 100644
--- a/src/domain/timesheets/templates/showMyList.tpl.php
+++ b/src/domain/timesheets/templates/showMyList.tpl.php
@@ -112,7 +112,7 @@
$billableSum = 0;
foreach($this->get('allTimesheets') as $row) {
- $sum = $sum + $row['hours'];?>
+ $sum += $row['hours'];?>
<tr>
<td data-order="<?=$this->e($row['id']); ?>"> <a href="<?=BASE_URL?>/timesheets/editTime/<?=$row['id']?>" class="editTimeModal">#<?=$row['id']." - ".$this->__('label.edit'); ?> </a></td>
<td data-order="<?php echo $this->getFormattedDateString($row['workDate']); ?>">