Closed Bug 418995 Opened 12 years ago Closed 12 years ago

CSV import creates empty fields datastores

Categories

(Calendar :: Import and Export, defect)

defect
Not set
minor

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: Hb, Assigned: Hb)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6 Mnenhy/0.7.5.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13pre) Gecko/20080220 Calendar/0.8pre

Importing events from a CSV file sets always the properties description, category or location even if they will contain no data. 

Opening one of these events with the "Edit Event" dialog box shortly afterwards will internally delete these empty properties. Now the problem arises: On closing the dialog the user will be asked if he wants to "Save the changed data" even if he did change nothing.

Reproducible: Always

Steps to Reproduce:
1. Import a CSV file with emtpy fields for the description. Choose a lokal ICS file as data storage.
2. Copy that ICS file.
3. Open one of the events with the "Edit Events" dialog and try to close the dialog.
Actual Results:  
A message box appears.

Expected Results:  
No message box because I changed no data.

This behaviour is gone after some time. Probably the fields are corrected in the next refresh cycle.
Resolution:

> -      if ("descriptionIndex" in args)
> -          event.setProperty("DESCRIPTION", parseTextField(eventFields[args.descriptionIndex]));
> -      ... 
>
> +      // Avoid setting empty properties
> +      var txt = "";
> +      if ("descriptionIndex" in args) {
> +          txt = parseTextField(eventFields[args.descriptionIndex])
> +          if (txt) {
> +              event.setProperty("DESCRIPTION", txt);
> +          }
> +      } ...

Use the variable txt and check if it is not emtpy.


Enhancement:
> +      // Using the "Private" field only for getting privacy status.
> +      // "Sensitivity" is neglected for now.
> +      if ("privateIndex" in args) {
> +          if (locale.valueTrue == eventFields[args.privateIndex]) {
> +              event.privacy = "PRIVATE";
> +          }
> +      }
Assignee: nobody → hb
Status: NEW → ASSIGNED
Attachment #304940 - Flags: review?(mvl)
Comment on attachment 304940 [details] [diff] [review]
Patch_v1 Setting properties only if valid data was read

r=mvl
Attachment #304940 - Flags: review?(mvl) → review+
Keywords: checkin-needed
Patch checked in on HEAD and MOZILLA_1_8_BRANCH.

--> FIXED
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 0.8
OS: Windows XP → All
Hardware: PC → All
verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.