[Vtigercrm-commits] [vtiger-commits] r11082 - in /vtigercrm/branches/5.0.3: Smarty/templates/ActivityEditView.tpl Smarty/templates/QuickCreate.tpl include/js/general.js modules/Calendar/addEventUI.php modules/Calendar/script.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon May 28 07:54:35 EDT 2007


Author: richie
Date: Mon May 28 05:54:27 2007
New Revision: 11082

Log:
fix calendar related issue. --minnie

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/ActivityEditView.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/QuickCreate.tpl
    vtigercrm/branches/5.0.3/include/js/general.js
    vtigercrm/branches/5.0.3/modules/Calendar/addEventUI.php
    vtigercrm/branches/5.0.3/modules/Calendar/script.js

Modified: vtigercrm/branches/5.0.3/Smarty/templates/ActivityEditView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/ActivityEditView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/ActivityEditView.tpl Mon May 28 05:54:27 2007
@@ -529,11 +529,11 @@
                                                                                                                 {/section}
                                                                                                         </select>
 													</td>
-													<td><select name="recurringtype">
-													<option value="Daily" onClick="ghide('repeatWeekUI'); ghide('repeatMonthUI');" {if $ACTIVITYDATA.eventrecurringtype eq 'Daily'} selected {/if}>{$MOD.LBL_DAYS}</option>
-													<option value="Weekly" onClick="gshow('repeatWeekUI'); ghide('repeatMonthUI');" {if $ACTIVITYDATA.eventrecurringtype eq 'Weekly'} selected {/if}>{$MOD.LBL_WEEKS}</option>
-												<option value="Monthly" onClick="ghide('repeatWeekUI'); gshow('repeatMonthUI');" {if $ACTIVITYDATA.eventrecurringtype eq 'Monthly'} selected {/if}>{$MOD.LBL_MONTHS}</option>
-													<option value="Yearly" onClick="ghide('repeatWeekUI'); ghide('repeatMonthUI');"; {if $ACTIVITYDATA.eventrecurringtype eq 'Yearly'} selected {/if}>{$MOD.LBL_YEAR}</option>
+													<td><select name="recurringtype" onChange="rptoptDisp(this)">
+													<option value="Daily" {if $ACTIVITYDATA.eventrecurringtype eq 'Daily'} selected {/if}>{$MOD.LBL_DAYS}</option>
+													<option value="Weekly" {if $ACTIVITYDATA.eventrecurringtype eq 'Weekly'} selected {/if}>{$MOD.LBL_WEEKS}</option>
+												<option value="Monthly" {if $ACTIVITYDATA.eventrecurringtype eq 'Monthly'} selected {/if}>{$MOD.LBL_MONTHS}</option>
+													<option value="Yearly" {if $ACTIVITYDATA.eventrecurringtype eq 'Yearly'} selected {/if}>{$MOD.LBL_YEAR}</option>
 													</select>
 													</td>
 												</tr>

Modified: vtigercrm/branches/5.0.3/Smarty/templates/QuickCreate.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/QuickCreate.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/QuickCreate.tpl Mon May 28 05:54:27 2007
@@ -415,9 +415,15 @@
 </table>
 {if $QCMODULE eq 'Event'}
 <SCRIPT id="qcvalidate">
-        var qcfieldname = new Array('subject','date_start','eventstatus','activitytype','due_date','time_end');
-        var qcfieldlabel = new Array('Subject','Start Date & Time','Status','Activity Type','End Date & Time','End Date & Time');
-        var qcfielddatatype = new Array('V~M','DT~M~time_start','V~O','V~O','D~M~OTH~GE~date_start~Start Date & Time','T~M');
+        var qcfieldname = new Array('subject','date_start','time_start','eventstatus','activitytype','due_date','time_end');
+        var qcfieldlabel = new Array('Subject','Start Date & Time','Start Date & Time','Activity Type','End Date & Time','End Date & Time');
+        var qcfielddatatype = new Array('V~M','DT~M~time_start','T~O','V~O','V~O','D~M~OTH~GE~date_start~Start Date & Time','T~M');
+</SCRIPT>
+{elseif $QCMODULE eq 'Todo'}
+<SCRIPT id="qcvalidate">
+	var qcfieldname = new Array('subject','date_start','time_start','taskstatus');
+        var qcfieldlabel = new Array('Subject','Start Date & Time','Start Date & Time','Status');
+        var qcfielddatatype = new Array('V~M','DT~M~time_start','T~O','V~O');
 </SCRIPT>
 {else}
 <SCRIPT id="qcvalidate">

Modified: vtigercrm/branches/5.0.3/include/js/general.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/general.js (original)
+++ vtigercrm/branches/5.0.3/include/js/general.js Mon May 28 05:54:27 2007
@@ -956,19 +956,19 @@
 			if(fieldname[j] == "date_start" || fieldname[j] == "task_date_start" )
 			{
 				var datelabel = fieldlabel[j]
-					var datefield = fieldname[j]
-					var startdatevalue = getObj(datefield).value.replace(/^\s+/g, '').replace(/\s+$/g, '')
+				var datefield = fieldname[j]
+				var startdatevalue = getObj(datefield).value.replace(/^\s+/g, '').replace(/\s+$/g, '')
 			}
 			if(fieldname[j] == "time_start" || fieldname[j] == "task_time_start")
 			{
 				var timelabel = fieldlabel[j]
-					var timefield = fieldname[j]
-					var timeval=getObj(timefield).value.replace(/^\s+/g, '').replace(/\s+$/g, '')
+				var timefield = fieldname[j]
+				var timeval=getObj(timefield).value.replace(/^\s+/g, '').replace(/\s+$/g, '')
 			}
 			if(fieldname[j] == "eventstatus" || fieldname[j] == "taskstatus")
 			{
 				var statusvalue = getObj(fieldname[j]).value.replace(/^\s+/g, '').replace(/\s+$/g, '')
-					var statuslabel = fieldlabel[j++]
+				var statuslabel = fieldlabel[j++]
 			}
 		}
 	}
@@ -992,18 +992,18 @@
 
                chktime = new Date()
 
+               chktime.setMinutes(minval)
+               chktime.setHours(hourval)
                chktime.setYear(yyyy)
                chktime.setMonth(mm-1)
                chktime.setDate(dd)
-               chktime.setHours(hourval)
-               chktime.setMinutes(minval)
                 if (!compareDates(chkdate,datelabel,currdate,alert_arr.DATE_SHOULDNOT_PAST,"GE")) {
                         getObj(datefield).focus()
                         return false
                 }
                 else if(!compareDates(chktime,timelabel,currdate,alert_arr.TIME_SHOULDNOT_PAST,"GE"))
                 {
-                        getObj(timefield).focus()
+                        getObj(datefield).focus()
                         return false
                 }
                 else return true

Modified: vtigercrm/branches/5.0.3/modules/Calendar/addEventUI.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/addEventUI.php (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/addEventUI.php Mon May 28 05:54:27 2007
@@ -513,11 +513,11 @@
 								<?php } ?>	
 								</select></td>
 								<td>
-									<select name="recurringtype">
-										<option value="Daily" onClick="ghide('repeatWeekUI'); ghide('repeatMonthUI');"><?php echo $mod_strings['LBL_DAYS']; ?></option>
-										<option value="Weekly" onClick="gshow('repeatWeekUI'); ghide('repeatMonthUI');"><?php echo $mod_strings['LBL_WEEKS']; ?></option>
-										<option value="Monthly" onClick="ghide('repeatWeekUI'); gshow('repeatMonthUI');"><?php echo $mod_strings['LBL_MONTHS']; ?></option>
-										<option value="Yearly" onClick="ghide('repeatWeekUI'); ghide('repeatMonthUI');";><?php echo $mod_strings['LBL_YEAR']; ?></option>
+									<select name="recurringtype" onChange="rptoptDisp(this)">
+										<option value="Daily"><?php echo $mod_strings['LBL_DAYS']; ?></option>
+										<option value="Weekly"><?php echo $mod_strings['LBL_WEEKS']; ?></option>
+										<option value="Monthly"><?php echo $mod_strings['LBL_MONTHS']; ?></option>
+										<option value="Yearly"><?php echo $mod_strings['LBL_YEAR']; ?></option>
 									</select>
 								</td>
 								</tr>

Modified: vtigercrm/branches/5.0.3/modules/Calendar/script.js
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Calendar/script.js (original)
+++ vtigercrm/branches/5.0.3/modules/Calendar/script.js Mon May 28 05:54:27 2007
@@ -128,6 +128,32 @@
 	}
 }
 
+function rptoptDisp(Opt){
+	var currOpt = Opt.options[Opt.selectedIndex].value;
+	if(currOpt == "Daily")
+	{
+		ghide('repeatWeekUI');
+		ghide('repeatMonthUI');
+	}
+	else if(currOpt == "Weekly")
+	{
+		if(document.getElementById('repeatWeekUI').style.display == "none");
+			document.getElementById('repeatWeekUI').style.display = "block";
+		ghide('repeatMonthUI');
+	}
+	else if(currOpt == "Monthly")
+	{
+		ghide('repeatWeekUI');
+		if(document.getElementById('repeatMonthUI').style.display == "none");
+                        document.getElementById('repeatMonthUI').style.display = "block";
+	}
+	else if(currOpt == "Yearly")
+	{
+		ghide('repeatWeekUI');
+                ghide('repeatMonthUI');
+	}
+}
+
 function Taskshow(argg1,type,startdate,starthr,startmin,startfmt)
 {
 	var y=document.getElementById(argg1).style;
@@ -200,108 +226,98 @@
 	followupformat = document.EditView.followup_startfmt.value;
         followuphour = parseInt(document.EditView.followup_starthr.value,10);
         followupmin = parseInt(document.EditView.followup_startmin.value,10);
+
+	if(startformat != '')
+	{
+		if(startformat == 'pm')
+		{
+			if(starthour == 12)
+				starthour = 12;
+			else
+				starthour = starthour + 12;
+		}
+		else
+		{
+			if(starthour == 12)
+				starthour = 0;
+			else
+				starthour = starthour;
+		}
+	}
+	if(endformat != '')
+	{
+		if(endformat == 'pm')
+		{
+			if(endhour == 12)
+				endhour = 12;
+			else
+				endhour = endhour + 12;
+		}
+		else
+		{
+			if(endhour == 12)
+				endhour = 0;
+			else
+				endhour = endhour;
+		}
+	}
+	var dateval1=getObj('date_start').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
+        var dateval2=getObj('due_date').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
+	var dateelements1=splitDateVal(dateval1);
+        var dateelements2=splitDateVal(dateval2);
+        dd1=dateelements1[0]
+       	mm1=dateelements1[1]
+        yyyy1=dateelements1[2]
+
+       	dd2=dateelements2[0]
+        mm2=dateelements2[1]
+       	yyyy2=dateelements2[2]
+
+	var date1=new Date()
+        var date2=new Date()
+
+       	date1.setYear(yyyy1)
+        date1.setMonth(mm1-1)
+       	date1.setDate(dd1)
+
+        date2.setYear(yyyy2)
+       	date2.setMonth(mm2-1)
+        date2.setDate(dd2)
+
+	durationinmin = (endhour*60+endmin) - (starthour*60+startmin);
+       	if(durationinmin >= 60)
+       	{
+       		hour = durationinmin/60;
+       		minute = durationinmin%60;
+       	}
+       	else
+       	{
+       		hour = 0;
+       		minute = durationinmin;
+        }
+	document.EditView.duration_hours.value = hour;
+	document.EditView.duration_minutes.value = minute;
+	event_starthour = _2digit(starthour);
+	event_startmin = _2digit(startmin);
+	event_endhour = _2digit(endhour);
+	event_endmin = _2digit(endmin);
+        document.EditView.time_start.value = event_starthour+':'+event_startmin;
+        document.EditView.time_end.value = event_endhour+':'+event_endmin;
 	if(formValidate())
 	{
-		if(startformat != '')
-		{
-			if(startformat == 'pm')
-			{
-				if(starthour == 12)
-					starthour = 12;
-				else
-					starthour = starthour + 12;
-			}
-			else
-			{
-				if(starthour == 12)
-                                        starthour = 0;
-				else
-					starthour = starthour;
-			}
-		}
-		if(endformat != '')
-		{
-			if(endformat == 'pm')
-			{
-				if(endhour == 12)
-					endhour = 12;
-				else
-					endhour = endhour + 12;
-			}
-			else
-			{
-				if(endhour == 12)
-					endhour = 0;
-				else
-					endhour = endhour;
-			}
-		}
-		var dateval1=getObj('date_start').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
-	        var dateval2=getObj('due_date').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
 		var dateval3=getObj('followup_date').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
-		var dateelements1=splitDateVal(dateval1);
-      		var dateelements2=splitDateVal(dateval2);
 		var dateelements3=splitDateVal(dateval3);
-
-	        dd1=dateelements1[0]
-        	mm1=dateelements1[1]
-	        yyyy1=dateelements1[2]
-
-        	dd2=dateelements2[0]
-	        mm2=dateelements2[1]
-        	yyyy2=dateelements2[2]
 
 		dd3=dateelements3[0]
                 mm3=dateelements3[1]
                 yyyy3=dateelements3[2]
 
-		var date1=new Date()
-	        var date2=new Date()
 		var date3=new Date()
-
-        	date1.setYear(yyyy1)
-	        date1.setMonth(mm1-1)
-        	date1.setDate(dd1)
-
-	        date2.setYear(yyyy2)
-        	date2.setMonth(mm2-1)
-	        date2.setDate(dd2)
 		
 		date3.setYear(yyyy3)
                 date3.setMonth(mm3-1)
                 date3.setDate(dd3)
 
-		if (date2<=date1)
-		{
-			if((endhour*60+endmin) <= (starthour*60+startmin))
-			{
-				alert(alert_arr.ENDTIME_GREATER_THAN_STARTTIME);
-				document.EditView.endhr.focus();
-				return false;
-			}
-			else
-			{
-				durationinmin = (endhour*60+endmin) - (starthour*60+startmin);
-                		if(durationinmin >= 60)
-              			{
-              				hour = durationinmin/60;
-                        		minute = durationinmin%60;
-                		}
-                		else
-                		{
-                        		hour = 0;
-                        		minute = durationinmin;
-                		}
-				document.EditView.duration_hours.value = hour;
-                		document.EditView.duration_minutes.value = minute;
-			}
-		}
-		event_starthour = _2digit(starthour);
-		event_startmin = _2digit(startmin);
-		event_endhour = _2digit(endhour);
-		event_endmin = _2digit(endmin);
-                document.EditView.time_start.value = event_starthour+':'+event_startmin;
-                document.EditView.time_end.value = event_endhour+':'+event_endmin;
 		// Added for Aydin Kurt-Elli requirement START -by Minnie
                 if (document.EditView.followup.checked == true && document.getElementById('date_table_thirdtd').style.display == 'block' )
                 {
@@ -357,6 +373,18 @@
                         document.EditView.followup_time_end.value = followupendhour+':'+followupendmin;
                 }
                 // Added for Aydin Kurt-Elli requirement END -by Minnie
+		//added to avoid db error while giving characters in the repeat "every n no of day in month" text box
+		if(document.EditView.recurringtype.value =="Monthly")
+		{
+			if((document.EditView.repeatMonth[0].checked == true) && (isNaN(document.EditView.repeatMonth_date.value)))
+			{
+				alert(alert_arr.INVALID +' "'+document.EditView.repeatMonth_date.value+'" ');
+				document.EditView.repeatMonth_date.focus();
+				return false;
+			}
+		}
+		//end
+
 		return true;
 	}
 	else return false;
@@ -555,11 +583,26 @@
                         }
                         // Added for Aydin Kurt-Elli requirement END -by Minnie -->
 
+			//added to avoid db error while giving characters in the repeat "every n no of day in month" text box
+                        if(document.EditView.recurringtype.value =="Monthly")
+                        {
+                                if((document.EditView.repeatMonth[0].checked == true) && (isNaN(document.EditView.repeatMonth_date.value)))
+                                {
+                                        alert(alert_arr.INVALID +' "'+document.EditView.repeatMonth_date.value+'" ');
+                                        document.EditView.repeatMonth_date.focus();
+                                        return false;
+                                }
+                        }
+                        //end
+
+
                         //added to check Start Date & Time,if Activity Status is Planned.//start
                         if(document.EditView.eventstatus.value == "Planned")
                         {
                                 var currdate=new Date()
                                 var chkdate=new Date()
+				chkdate.setMinutes(event_startmin)
+				chkdate.setHours(event_starthour)
                                 chkdate.setYear(yyyy1)
                                 chkdate.setMonth(mm1-1)
                                 chkdate.setDate(dd1)





More information about the vtigercrm-commits mailing list