diff --git a/docs/changelog/5.x.x.txt b/docs/changelog/5.x.x.txt
index 237ea2aae..7da751bb1 100644
--- a/docs/changelog/5.x.x.txt
+++ b/docs/changelog/5.x.x.txt
@@ -12,7 +12,6 @@
- Added support for record deletion in DataForm (Thanks to Hal Roberts.)
- Templatized the HttpProxy wobject. (Thanks to Len Kranendonk.)
- Added a "Search for" and "Stop at" option to HttpProxy. (Thanks to Len Kranendonk.)
- - Fixed a bug in the PreviousDropMenu macro.
- Enhanced HTMLArea editor to include table editing. (Thanks to Irving Carrion.)
@@ -22,6 +21,7 @@
- Updated Portuguese translation. (Thanks to Marcelo Ennes.)
- Updated Dutch translation. (Thanks to Leo Noordergraaf, ProcoliX, BNC Distribution, and Hugo Van der Kooij.)
- Updated German translation. (Thanks to Andreas Graf.)
+ - Fixed a bug in the PreviousDropMenu macro.
- Added an association for PPS attachments.
- Readded wobject date range check that was accidentally removed.
- Fixed a bug that caused incompatibility in the HTML Area image manager with
@@ -30,8 +30,27 @@
- Usernames can now be 100 characters long.
- Page ordering wasn't always maintained when deploying packages, this is now
fixed. (Thanks to Y.H.Khoe.)
+ - Errors could have occured if you specified an image name in a collateral
+ macro that did not exist.
- Email address didn't validate when it contained a dash (-). (Thanks to
Fekke.)
+ - The calendar wizard was too narrow and wrapping on some browsers.
+ - The size attribute was missing from the email method in the Form package.
+ (Thanks to Andreas Graf.)
+ - Data Form: Was displaying mail fields in admin mode even when mailing was
+ disabled.
+ - Data Form: Dates were reset to epoch if a required field caused the form to
+ error.
+ - Data Form: If a site had two data forms with the same field names the list
+ template would be broken.
+ - Data Form: No longer keys on field name, which was dangerous, but instead
+ keys on fieldId.
+ - Data Form: Date and Date Time fields were displaying epoch to the end user
+ rather than human readable dates.
+ - Data Form: A bug in the default acknowlegement caused hidden fields to be
+ displayed.
+ - Data Form: CC and BCC would not be sent if the TO was specified as a
+ username or group name instead of an email address.
5.4.3
diff --git a/lib/WebGUI/Form.pm b/lib/WebGUI/Form.pm
index 3ccd10762..3b398768e 100644
--- a/lib/WebGUI/Form.pm
+++ b/lib/WebGUI/Form.pm
@@ -363,7 +363,7 @@ sub date {
});
$output .= '';
return $output;
}
@@ -454,6 +454,7 @@ sub email {
$output .= text({
name=>$_[0]->{name},
value=>$_[0]->{value},
+ size=>$_[0]->{size},
extras=>' onChange="emailCheck(this.value)" '.$_[0]->{extras}
});
return $output;
@@ -1517,7 +1518,7 @@ sub timeField {
});
$output .= '';
return $output;
}
diff --git a/lib/WebGUI/Macro/I_imageWithTags.pm b/lib/WebGUI/Macro/I_imageWithTags.pm
index 9a348ac8c..b8816e2c2 100644
--- a/lib/WebGUI/Macro/I_imageWithTags.pm
+++ b/lib/WebGUI/Macro/I_imageWithTags.pm
@@ -18,8 +18,11 @@ use WebGUI::Session;
#-------------------------------------------------------------------
sub process {
my @param = WebGUI::Macro::getParams($_[0]);
- my $collateral = WebGUI::Collateral->find($param[0]);
- return 'get("parameters").' />';
+ if (my $collateral = WebGUI::Collateral->find($param[0])) {
+ return 'get("parameters").' />';
+ } else {
+ return "";
+ }
}
diff --git a/lib/WebGUI/Macro/i_imageNoTags.pm b/lib/WebGUI/Macro/i_imageNoTags.pm
index 05a5dd752..2a964cf96 100644
--- a/lib/WebGUI/Macro/i_imageNoTags.pm
+++ b/lib/WebGUI/Macro/i_imageNoTags.pm
@@ -18,8 +18,11 @@ use WebGUI::Session;
#-------------------------------------------------------------------
sub process {
my @param = WebGUI::Macro::getParams($_[0]);
- my $collateral = WebGUI::Collateral->find($param[0]);
- return $collateral->getURL;
+ if (my $collateral = WebGUI::Collateral->find($param[0])) {
+ return $collateral->getURL;
+ } else {
+ return "";
+ }
}
diff --git a/lib/WebGUI/Wobject/DataForm.pm b/lib/WebGUI/Wobject/DataForm.pm
index 2790c27c1..13b8f0282 100644
--- a/lib/WebGUI/Wobject/DataForm.pm
+++ b/lib/WebGUI/Wobject/DataForm.pm
@@ -129,7 +129,7 @@ sub getListTemplateVars {
while (my $record = $a->hashRef) {
my @dataLoop;
my $b = WebGUI::SQL->read("select b.name, b.label, b.isMailField, a.value from DataForm_entryData a left join DataForm_field b
- on a.name=b.name where a.DataForm_entryId=".$record->{DataForm_entryId}."
+ on a.DataForm_fieldId=b.DataForm_fieldId where a.DataForm_entryId=".$record->{DataForm_entryId}."
order by b.sequenceNumber");
while (my $data = $b->hashRef) {
push(@dataLoop,{
@@ -189,7 +189,7 @@ sub getRecordTemplateVars {
$var->{epoch} = $entry->{submissionDate};
$var->{"edit.URL"} = WebGUI::URL::page('func=view&wid='.$self->get("wobjectId").'&entryId='.$var->{entryId});
$where .= " and b.DataForm_entryId=".$var->{entryId};
- $join = "left join DataForm_entryData as b on a.name=b.name";
+ $join = "left join DataForm_entryData as b on a.DataForm_fieldId=b.DataForm_fieldId";
$select .= ", b.value";
}
my %data;
@@ -199,15 +199,19 @@ sub getRecordTemplateVars {
my $formValue = $session{form}{$data{name}};
if ((not exists $data{value}) && $session{form}{func} ne "editSave" && $session{form}{func} ne "editFieldSave" && defined $formValue) {
$data{value} = $formValue;
+ $data{value} = WebGUI::DateTime::setToEpoch($data{value}) if ($data{type} eq "date");
}
if (not exists $data{value}) {
$data{value} = WebGUI::Macro::process($data{defaultValue});
}
- my $hidden = (($data{status} eq "hidden" || ($data{isMailField} && !$self->get("mailData"))) && !$session{var}{adminOn});
+ my $hidden = (($data{status} eq "hidden" && !$session{var}{adminOn}) || ($data{isMailField} && !$self->get("mailData")));
+ my $value = $data{value};
+ $value = WebGUI::DateTime::epochToHuman($value,"%z") if ($data{type} eq "date");
+ $value = WebGUI::DateTime::epochToHuman($value) if ($data{type} eq "dateTime");
push(@fields,{
"field.form" => _createField(\%data),
"field.name" => $data{name},
- "field.value" => $data{value},
+ "field.value" => $value,
"field.label" => $data{label},
"field.isMailField" => $data{isMailField},
"field.isHidden" => $hidden,
@@ -284,14 +288,7 @@ sub sendEmail {
}
}
if ($to =~ /\@/) {
- WebGUI::Mail::send(
- $to,
- $subject,
- $message,
- $cc,
- $from,
- $bcc
- );
+ WebGUI::Mail::send($to, $subject, $message, $cc, $from, $bcc);
} else {
my ($userId) = WebGUI::SQL->quickArray("select userId from users where username=".quote($to));
my $groupId;
@@ -303,6 +300,12 @@ sub sendEmail {
WebGUI::ErrorHandler::warn($_[0]->get("wobjectId").": Unable to send message, no user or group found.");
} else {
WebGUI::MessageLog::addEntry($userId, $groupId, $subject, $message);
+ if ($cc) {
+ WebGUI::Mail::send($cc, $subject, $message, "", $from);
+ }
+ if ($bcc) {
+ WebGUI::Mail::send($bcc, $subject, $message, "", $from);
+ }
}
}
}
@@ -555,19 +558,19 @@ sub www_exportTab {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditWobject($_[0]->get("wobjectId")));
$session{header}{filename} = WebGUI::URL::urlize($_[0]->get("title")).".tab";
$session{header}{mimetype} = "text/plain";
- my @fields = WebGUI::SQL->buildArray("select name from DataForm_field where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
+ my %fields = WebGUI::SQL->buildHash("select DataForm_fieldId,name from DataForm_field where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
my $select = "select a.DataForm_entryId as entryId, a.ipAddress, a.username, a.userId, a.submissionDate";
my $from = " from DataForm_entry a";
my $join;
my $where = " where a.wobjectId=".$_[0]->get("wobjectId");
my $orderBy = " order by a.DataForm_entryId";
my $columnCounter = "b";
- foreach my $field (@fields) {
+ foreach my $fieldId (keys %fields) {
my $extension = "";
- $extension = "mail_" if (isIn($field, qw(to from cc bcc subject)));
- $select .= ", ".$columnCounter.".value as ".$extension.$field;
+ $extension = "mail_" if (isIn($fields{$fieldId}, qw(to from cc bcc subject)));
+ $select .= ", ".$columnCounter.".value as ".$extension.$fields{$fieldId};
$join .= " left join DataForm_entryData ".$columnCounter." on a.DataForm_entryId=".$columnCounter.".DataForm_entryId and "
- .$columnCounter.".name=".quote($field);
+ .$columnCounter.".DataForm_fieldId=".quote($fieldId);
$columnCounter++;
}
return WebGUI::SQL->quickTab($select.$from.$join.$where.$orderBy);
@@ -618,14 +621,14 @@ sub www_process {
}
unless ($hadErrors) {
my ($exists) = WebGUI::SQL->quickArray("select count(*) from DataForm_entryData where DataForm_entryId=$entryId
- and name=".quote($row{name}));
+ and DataForm_fieldId=".quote($row{DataForm_fieldId}));
if ($exists) {
WebGUI::SQL->write("update DataForm_entryData set value=".quote($value)."
- where DataForm_entryId=$entryId and name=".quote($row{name}));
+ where DataForm_entryId=$entryId and DataForm_fieldId=".quote($row{DataForm_fieldId}));
$updating = 1;
} else {
WebGUI::SQL->write("insert into DataForm_entryData (DataForm_entryId,wobjectId,name,value) values
- ($entryId, ".$_[0]->get("wobjectId").", ".quote($row{name}).", ".quote($value).")");
+ ($entryId, $row{DataForm_fieldId}, ".$_[0]->get("wobjectId").", ".quote($value).")");
}
}
}