Perform the check BEFORE saving the Thing properties. Fixes bug #12157.

This commit is contained in:
Colin Kuskie 2011-06-27 21:32:57 -07:00
parent ac8d95e20a
commit 4027b5b4d8
2 changed files with 7 additions and 6 deletions

View file

@ -5,6 +5,7 @@
- fixed #12164: Calendar feeds with tons of ;adminId=XXXXXX added
- fixed #12167: Calendar Next/Prev Month/Year confusion
- fixed #12172: Underground User Style template shows up in Style wizard during site creation
- fixed #12157: www_editThingSave
7.10.18
- fixed #12138: Version tag gets create by entering and direct leaving

View file

@ -2508,6 +2508,12 @@ sub www_editThingSave {
my $thingId = $self->session->form->process("thingId");
my $fields = $self->getFields($thingId);
if($fields->rows < 1){
$self->session->log->warn("Thing failed to create because it had no fields");
my $i18n = WebGUI::International->new($self->session, "Asset_Thingy");
return $self->www_editThing($i18n->get("thing must have fields"));
}
my $thing = {
thingId => $thingId,
label => $form->process("label"),
@ -2538,12 +2544,6 @@ sub www_editThingSave {
};
$self->setCollateral("Thingy_things", "thingId", $thing, 0, 1);
if($fields->rows < 1){
$self->session->log->warn("Thing failed to create because it had no fields");
my $i18n = WebGUI::International->new($self->session, "Asset_Thingy");
return $self->www_editThing($i18n->get("thing must have fields"));
}
while (my $field = $fields->hashRef) {
my $display = $self->session->form->process("display_".$field->{fieldId}) || 0;
my $viewScreenTitle = $self->session->form->process("viewScreenTitle_".$field->{fieldId}) || 0;