Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.5.5

Bug #1798 Week class doesn't support selections that span months
Submitted: 2004-07-05 21:04 UTC
From: tj-pear at drennan dot bc dot ca Assigned: quipo
Status: Closed Package: Calendar
PHP Version: 4.3.4 OS: Win32/Linux/Mac OS X
Roadmaps: (Not assigned)    
Subscription  


 [2004-07-05 21:04 UTC] tj-pear at drennan dot bc dot ca
Description: ------------ The setSelection function in the Calendar/Week.php class checks to see if the object's year and month match each of the passed in selection dates. This check should be removed in order to allow support for selections that cross from one month and/or year into the following month/year because this check will fail which will prevent the selection from being done. Here is a new setSelection function which fixes this problem: function setSelection($sDates) { foreach ($sDates as $sDate) { foreach ($this->children as $key => $child) { if ($child->thisDay() == $sDate->thisDay() && $child->thisMonth() == $sDate->thisMonth() && $child->thisYear() == $sDate->thisYear()) { $this->children[$key] = $sDate; $this->children[$key]->setSelected(); } } } reset($this->children); } Note: This is note the same problem as Bug #1440 but that solution has been applied to the above function. Reproduce code: --------------- A test script (based on example 15) which demonstrates this can be found at: http://drennan.bc.ca/projects/pear/Calendar_Week_bug_test.phps The script builds a Week object using a date from the last partial week in Dec 2003 and another Week object using a date from the first partial week from Jan 2004. It then passes in a set of days that span the part of the Week in Dec 2003 and the part of the week in Jan 2004 to each of the weeks and verifies that all of the days are selected for each of the built week objects. Expected result: ---------------- All of the days of the week should be selected (indicated by a PASSED indicator given for the day) for both of the two tests in the test script. Actual result: -------------- For test 1 (using date from first month) only the days in that month are selected. For test 2 (using date from second month) only the days in that month are selected.

Comments

 [2004-07-08 10:15 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!