[Vtigercrm-commits] [vtiger-commits] r9222 - /vtigercrm/trunk/modules/Calendar/CalendarCommon.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Thu Aug 31 06:28:14 EDT 2006


Author: saraj
Date: Thu Aug 31 04:28:10 2006
New Revision: 9222

Log:
changes made to fix the calendar related issue  --Minnie

Modified:
    vtigercrm/trunk/modules/Calendar/CalendarCommon.php

Modified: vtigercrm/trunk/modules/Calendar/CalendarCommon.php
==============================================================================
--- vtigercrm/trunk/modules/Calendar/CalendarCommon.php (original)
+++ vtigercrm/trunk/modules/Calendar/CalendarCommon.php Thu Aug 31 04:28:10 2006
@@ -98,40 +98,51 @@
 		$hr = $sthr+0;
 		if($hr <= 11)
 		{
+			if($hr == 0)
+				$sthr = 12;
 			$timearr['starthour'] = $sthr;
 			$timearr['startfmt'] = 'am';
 		}
 		else
 		{
-			if($hr == 12)
-				$sthr = $hr;
-			else
-				$sthr = $hr - 12;
+			if($hr == 12) $sthr = $hr;
+			else $sthr = $hr - 12;
+				
 			if($sthr <= 9 && strlen(trim($sthr)) < 2)
-                        {
                                 $hrvalue= '0'.$sthr;
-                        }else $hrvalue=$sthr;
+			else $hrvalue=$sthr;
+			
 			$timearr['starthour'] = $hrvalue;
 			$timearr['startfmt'] = 'pm';
 		}
-		$ehr = $edhr+0;
-                if($ehr <= 11)
+		$edhr = $edhr+0;
+                if($edhr <= 11)
                 {
-                        $timearr['endhour'] = $edhr;
+			if($edhr == 0)
+				$edhr = 12;
+				
+			if($edhr <= 9 && strlen(trim($edhr)) < 2)
+				$edhr = '0'.$edhr;
+			$timearr['endhour'] = $edhr;
                         $timearr['endfmt'] = 'am';
                 }
                 else
                 {
+			$fmt = 'pm';
 			if($edhr == 12)
 				$edhr =	$edhr;
 			else
+			{
 				$edhr = $edhr - 12;
+				if($edhr == 12)
+					$fmt = 'am';
+			}
                         if($edhr <= 9 && strlen(trim($edhr)) < 2)
-                        {
                                 $hrvalue= '0'.$edhr;
-                        }else $hrvalue=$edhr;
+			else $hrvalue=$edhr;
+			
                         $timearr['endhour'] = $hrvalue;
-                        $timearr['endfmt'] = 'pm';
+                        $timearr['endfmt'] = $fmt;
                 }
 		$timearr['startmin']  = $stmin;
 		$timearr['endmin']    = $edmin;
@@ -139,6 +150,10 @@
 	}
 	if($format == '24')
 	{
+		if($edhr <= 9 && strlen(trim($edhr)) < 2)
+			$edhr = '0'.$edhr;
+		if($sthr <= 9 && strlen(trim($sthr)) < 2)
+			$sthr = '0'.$sthr;
 		$timearr['starthour'] = $sthr;
 		$timearr['startmin']  = $stmin;
 		$timearr['startfmt']  = '';
@@ -162,19 +177,27 @@
 	if($format == 'am/pm')
 	{
 		$combo .= '<select class=small name="'.$bimode.'hr" id="'.$bimode.'hr">';
-		for($i=1;$i<=12;$i++)
-		{
-			if($i <= 9 && strlen(trim($i)) < 2)
-			{
-				$hrvalue= '0'.$i;
-			}
-			//elseif($i == 12) $hrvalue = '00';
-			else $hrvalue= $i;
+		for($i=0;$i<12;$i++)
+		{
+			if($i == 0)
+			{
+				$hrtext= 12;
+				$hrvalue = 12;
+			}
+			else
+			{	
+				if($i <= 9 && strlen(trim($i)) < 2)
+				{
+					$hrtext= '0'.$i;
+				}
+				else $hrtext= $i;
+				$hrvalue =  $hrtext;
+			}
 			if($hour == $hrvalue)
 				$hrsel = 'selected';
 			else
 				$hrsel = '';
-			$combo .= '<option value="'.$hrvalue.'" "'.$hrsel.'">'.$i.'</option>';
+			$combo .= '<option value="'.$hrvalue.'" "'.$hrsel.'">'.$hrtext.'</option>';
 		}
 		$combo .= '</select>&nbsp;';
 		$combo .= '<select name="'.$bimode.'min" id="'.$bimode.'min" class=small value="'.$min.'">';
@@ -223,7 +246,7 @@
 					$hrsel = 'selected';
 				else
 					$hrsel = '';
-				$combo .= '<option value="'.$hrvalue.'" "'.$hrsel.'">'.$i.'</option>';
+				$combo .= '<option value="'.$hrvalue.'" "'.$hrsel.'">'.$hrvalue.'</option>';
 			}
 			$combo .= '</select>Hr&nbsp;';
 			$combo .= '<select name="'.$bimode.'min" id="'.$bimode.'min" class=small value="'.$min.'">';





More information about the vtigercrm-commits mailing list