fixed: DataForm will create fields with duplicate names but doesn't use them separately

This commit is contained in:
Graham Knop 2008-03-24 09:43:40 +00:00
parent dd6f6ef461
commit 5bc3ebfd43
2 changed files with 8 additions and 0 deletions

View file

@ -15,6 +15,7 @@
- fixed: Collaboration System threads can return other object types when asked for replies
- fixed: Able to cut or trash system assets
- fixed: Can't purge uncommitted assets if not using its version tag
- fixed: DataForm will create fields with duplicate names but doesn't use them separately
7.5.7
- fixed: HttpProxy mixes original site's content encoding with WebGUI's

View file

@ -1068,6 +1068,13 @@ sub www_editFieldSave {
my $name = $self->session->url->urlize($form->process("name") || $form->process("label"));
$name =~ s/\-//g;
$name =~ s/\///g;
my $exists = 1;
while ($exists) {
$exists = $self->session->db->quickScalar('SELECT DataForm_fieldId FROM DataForm_field WHERE assetId=? AND name=?', [$self->getId, $name]);
if ($exists) {
$name =~ s/(\d+|)$/$1 + 1/e; # increment number at the end of the name
}
}
$self->setCollateral("DataForm_field","DataForm_fieldId",{
DataForm_fieldId=>$form->process("fid"),
width=>$form->process("width", 'integer'),