Thingy now requires at least 1 field per new Thing
This commit is contained in:
parent
3f4de3612f
commit
22acd6eb8d
3 changed files with 21 additions and 5 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
7.5.22
|
7.5.22
|
||||||
- fixed: Layout template now gets prepared correctly
|
- fixed: Layout template now gets prepared correctly
|
||||||
- fixed: When user does not have permissions to search/edit a thing a proper error is shown.
|
- fixed: When user does not have permissions to search/edit a thing a proper error is shown.
|
||||||
|
- fixed: Thingy now requires at least 1 field for a new Thing.
|
||||||
|
|
||||||
7.5.21
|
7.5.21
|
||||||
- fixed: purchase detail screen shows incorrectly in Safari
|
- fixed: purchase detail screen shows incorrectly in Safari
|
||||||
|
|
|
||||||
|
|
@ -1185,6 +1185,7 @@ before the form is submitted.
|
||||||
|
|
||||||
sub www_editThing {
|
sub www_editThing {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
my $warning = shift;
|
||||||
my $session = $self->session;
|
my $session = $self->session;
|
||||||
my ($tabForm, $output, %properties, $tab, %afterSave, %defaultView, $fields);
|
my ($tabForm, $output, %properties, $tab, %afterSave, %defaultView, $fields);
|
||||||
my ($fieldsHTML, $fieldsViewScreen, $fieldsSearchScreen);
|
my ($fieldsHTML, $fieldsViewScreen, $fieldsSearchScreen);
|
||||||
|
|
@ -1563,8 +1564,9 @@ sub www_editThing {
|
||||||
-value => $properties{thingsPerPage},
|
-value => $properties{thingsPerPage},
|
||||||
);
|
);
|
||||||
$tab->raw($fieldsSearchScreen);
|
$tab->raw($fieldsSearchScreen);
|
||||||
|
#if($warning){$output .= "<script> alert('$warning');</script>";}
|
||||||
$output = $tabForm->print;
|
if($warning){$output .= "$warning";}
|
||||||
|
$output .= $tabForm->print;
|
||||||
|
|
||||||
my $dialog = "<div id='addDialog'>\n"
|
my $dialog = "<div id='addDialog'>\n"
|
||||||
."<div class='hd'>".$i18n->get('add field label')."</div>\n"
|
."<div class='hd'>".$i18n->get('add field label')."</div>\n"
|
||||||
|
|
@ -1599,6 +1601,10 @@ sub www_editThingSave {
|
||||||
my $form = $self->session->form;
|
my $form = $self->session->form;
|
||||||
my ($thingId, $fields);
|
my ($thingId, $fields);
|
||||||
$thingId = $self->session->form->process("thingId");
|
$thingId = $self->session->form->process("thingId");
|
||||||
|
|
||||||
|
$fields = $self->session->db->read('select * from Thingy_fields where assetId = '.$self->session->db->quote($self->get("assetId")).' and thingId = '.$self->session->db->quote($thingId).' order by sequenceNumber');
|
||||||
|
|
||||||
|
|
||||||
$self->setCollateral("Thingy_things","thingId",{
|
$self->setCollateral("Thingy_things","thingId",{
|
||||||
thingId=>$thingId,
|
thingId=>$thingId,
|
||||||
label=>$form->process("label"),
|
label=>$form->process("label"),
|
||||||
|
|
@ -1625,7 +1631,12 @@ sub www_editThingSave {
|
||||||
sortBy=>$form->process("sortBy"),
|
sortBy=>$form->process("sortBy"),
|
||||||
},0,1);
|
},0,1);
|
||||||
|
|
||||||
$fields = $self->session->db->read('select * from Thingy_fields where assetId = '.$self->session->db->quote($self->get("assetId")).' and thingId = '.$self->session->db->quote($thingId).' order by sequenceNumber');
|
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) {
|
while (my $field = $fields->hashRef) {
|
||||||
my $display = $self->session->form->process("display_".$field->{fieldId}) || 0;
|
my $display = $self->session->form->process("display_".$field->{fieldId}) || 0;
|
||||||
my $viewScreenTitle = $self->session->form->process("viewScreenTitle_".$field->{fieldId}) || 0;
|
my $viewScreenTitle = $self->session->form->process("viewScreenTitle_".$field->{fieldId}) || 0;
|
||||||
|
|
|
||||||
|
|
@ -934,8 +934,12 @@ search has been done.|,
|
||||||
'no permission to search' => {
|
'no permission to search' => {
|
||||||
message => q|You do not have permissions to search this Thing.|,
|
message => q|You do not have permissions to search this Thing.|,
|
||||||
lastUpdated => 1219424285,
|
lastUpdated => 1219424285,
|
||||||
}
|
},
|
||||||
|
|
||||||
|
'thing must have fields' => {
|
||||||
|
message => q|Error: You must assign fields to your new Thing.|,
|
||||||
|
lastUpdated => 1219424285,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue