This topic is locked
[SOLVED]

 Weekly View Showing Extra Records

11/7/2013 1:31:40 PM
Calendar Template general questions
S
Stoneman author

I'm having a problem with my calweekly_list.php page displaying data incorrectly. It displays all records for the Day regardless of the month or year for the actual Date. The Date for the day of week is correct.
So for Monday, November 4, 2013

I will have the following dated records included

2/4/2008

10/4/2013

8/4/2009

etc

It will display any record that has the day as the 4th.
Does anyone else have this problem - How can I fix it.
Using Version 7 with template pack 7.
Thanks,

S
Stoneman author 11/7/2013

this code takes care of the problem. Place the following change in CalWeeklyList Before Display Event which is the function BeforeShowList(&$xt,&$templatefile,&$pageObject)
change this line ---

$strSQL2="select ".AddTableWrappers("calcalendar")."., ".AddTableWrappers("calcategory").".".AddFieldWrappers("Color")." from ".AddTableWrappers("calcalendar")." left join ".AddTableWrappers("calcategory")." on ".AddTableWrappers("calcategory").".".AddFieldWrappers("id")."=".AddTableWrappers("calcalendar").".".AddFieldWrappers("Category")." where ".AddFieldWrappers("Recurrence")."=0 ".$strWhereClause." and Day(".AddFieldWrappers("DateField").")=".mydate("j",strtotime($datatmp["DateField"]))." order by ".AddFieldWrappers("TimeField");
to -----

$strSQL2="select ".AddTableWrappers("calcalendar").".
, ".AddTableWrappers("calcategory").".".AddFieldWrappers("Color")." from ".AddTableWrappers("calcalendar")." left join ".AddTableWrappers("calcategory")." on ".AddTableWrappers("calcategory").".".AddFieldWrappers("id")."=".AddTableWrappers("calcalendar").".".AddFieldWrappers("Category")." where ".AddFieldWrappers("Recurrence")."=0 ".$strWhereClause." and Day(".AddFieldWrappers("DateField").")=".mydate("j",strtotime($datatmp["DateField"]))." and Year(".AddFieldWrappers("DateField").")=".mydate("Y",strtotime($datatmp["DateField"]))." and Month(".AddFieldWrappers("DateField").")=".mydate("m",strtotime($datatmp["DateField"]))." order by ".AddFieldWrappers("TimeField");

B
bersani 12/9/2013

I tried the new code but it gave me an error message. I found 3 places to substitute the line of code in the event; I tried substituting one line at a time and no change in weekly output until I substituted the third line of code and got an error message.

S
Stoneman author 12/10/2013



I tried the new code but it gave me an error message. I found 3 places to substitute the line of code in the event; I tried substituting one line at a time and no change in weekly output until I substituted the third line of code and got an error message.


Sorry - I should have specified that my code was for the third occurrence (or the Else part of the if-elseif-else statemanets).(MYSQL database). I would need to see the error code and or the other changes you made to the code to be able to help as this is the code that I am using. It just adds the year and month to the where clause to filter for the current year and month data only. If you cut and pasted make sure you still have a ";" at the end if you typed it in check all punctuation.
Ed