Selaa lähdekoodia

Seperated time codes based on user type (full time/part time)

Adam Day 9 vuotta sitten
vanhempi
commit
0d9896d252
2 muutettua tiedostoa jossa 18 lisäystä ja 2 poistoa
  1. 17 1
      application/models/codeModel.php
  2. 1 1
      application/models/weeklyReportModel.php

+ 17 - 1
application/models/codeModel.php

@@ -96,7 +96,23 @@
 
 		function allCodes()
 		{
-			$sql = "SELECT id, name FROM timeCodes WHERE 1 ORDER BY name ASC";
+
+			$auth = Staple_Auth::get();
+			$uid = $auth->getAuthId();
+			$user = new userModel();
+			$user->userInfo($uid);
+
+			$type = $user->getType();
+
+			if($type == 'part')
+			{
+				$sql = "SELECT id, name FROM timeCodes WHERE type = 'part' ORDER BY name ASC";
+			}
+			else
+			{
+				$sql = "SELECT id, name FROM timeCodes WHERE 1 ORDER BY name ASC";
+			}
+
 			if($this->db->query($sql)->fetch_row() > 0)
 			{
 				$query = $this->db->query($sql);

+ 1 - 1
application/models/weeklyReportModel.php

@@ -68,7 +68,7 @@ class weeklyReportModel extends Staple_Model
         $ret['year'] = $year;
 
         //Week Start
-        $dto->setTime(24,0,0);
+        $dto->setTime(0,0,0);
         $ret['start']['unix'] = $dto->format('U');
         $ret['start']['formatted'] = $dto->format('Y-m-d');
         $ret['start']['dayName'] = $dto->format('l');