'Last day of the month' recurrence rule has been screwed up

VERIFIED FIXED in 0.8

Status

defect
VERIFIED FIXED
12 years ago
12 years ago

People

(Reporter: michael.buettner, Assigned: Fallen)

Tracking

({regression})

Dependency tree / graph
Bug Flags:
blocking-calendar0.8 +

Details

Attachments

(1 attachment)

The 'last sunday/monday/.../saturday of the month' recurrence rule can't be modified once set up. The error console shows the following exception:

Error: occurrence is not defined
Source File: chrome://calendar/content/sun-calendar-event-dialog-recurrence.js
Line: 163

Steps to reprduce:

1) create a new event
2) select repeat drop down -> custom option
3) select recurrence pattern -> repeat monthly
4) select 'the last sunday' (can be arbitrary)
5) close the dialog -> ok
6) click on the recurrence pattern text displaying the recurrence rule

The recurrence dialog opens but the previously established rule is lost. This is a regression from bug 383272.
Blocks: 383272
Keywords: regression
I can confirm the failure. But after opening the event the recurrence preview in the Event dialog is empty but Custom... is selected in the dropdown menu. Choosing Custom... again open the Recurrences dialog with the following error:

Warning: reference to undefined property byDayRuleComponent[0]
Source File: chrome://calendar/content/sun-calendar-event-dialog-recurrence.js
Line: 168

Warning: reference to undefined property days[val[i] - 1]
Source File: chrome://calendar/content/calendar-daypicker.xml
Line: 271

Error: days[val[i] - 1] has no properties
Source File: chrome://calendar/content/calendar-daypicker.xml
Line: 271

Regression Range:
WORKS in Sunbird 0.8pre (2007-10-26-05)
FAILS in Sunbird 0.8pre (2007-10-27-05)
Flags: blocking-calendar0.8?
Still exists using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12pre) Gecko/2008012408 Calendar/0.8pre.

Not being able to correctly edit a just created event justifies blocking‑calendar0.8+ in my opinion.
Flags: blocking-calendar0.8? → blocking-calendar0.8+
Posted patch Fix v1Splinter Review
This patch fixes, also some style nits for the function I changed things in. The important changes are:

-    function getWeekdayOfRule(aByDayRuleComponent) {
-        var occurrence = (aByDayRuleComponent - (aByDayRuleComponent % 8)) / 8;
-        return aByDayRuleComponent % 8;
+    function getOrdinalAndWeekdayOfRule(aByDayRuleComponent) {
+        return {
+            ordinal: (aByDayRuleComponent - (aByDayRuleComponent % 8)) / 8,
+            weekday: Math.abs(aByDayRuleComponent % 8)
+        };
     }
@@ ... @@
         if (byDayRuleComponent.length > 0) {
             document.getElementById("monthly-group").selectedIndex = 0;
-            var weekday = getWeekdayOfRule(byDayRuleComponent[0]);
-            setElementValue("monthly-ordinal", occurrence);
-            setElementValue("monthly-weekday", Math.abs(weekday));
+            var ruleInfo = getOrdinalAndWeekdayOfRule(byDayRuleComponent[0]);
+            setElementValue("monthly-ordinal", ruleInfo.ordinal);
+            setElementValue("monthly-weekday", ruleInfo.weekday);
@@ ... @@
-            var weekday = getWeekdayOfRule(byDayRuleComponent[0]);
-            setElementValue("yearly-ordinal", occurrence);
-            setElementValue("yearly-weekday", weekday);
+            var ruleInfo = getOrdinalAndWeekdayOfRule(byDayRuleComponent[0]);
+            setElementValue("yearly-ordinal", ruleInfo.ordinal);
+            setElementValue("yearly-weekday", ruleInfo.weekday);
Assignee: nobody → philipp
Status: NEW → ASSIGNED
Comment on attachment 303856 [details] [diff] [review]
Fix v1

Anyone who is available for reviewing this patch, feel free!
Attachment #303856 - Flags: review?
Attachment #303856 - Flags: review? → review?(Berend.Cornelius)
Comment on attachment 303856 [details] [diff] [review]
Fix v1

r=berend
Attachment #303856 - Flags: review?(Berend.Cornelius) → review+
Checked in on HEAD and MOZILLA_1_8_BRANCH

-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → 0.8
checked in nightly build 2008021821 -> task is fixed and verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.