Skip to content
Snippets Groups Projects
Commit 0db91642 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #987 from greezybacon/issue/891


forms: Ensure the issue summary will have data

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents cb026cbf 93c390c3
No related branches found
No related tags found
No related merge requests found
......@@ -330,7 +330,10 @@ class DynamicFormField extends VerySimpleModel {
array($this->getField(), $what), $args);
}
function getField() {
function getField($cache=true) {
if (!$cache)
return new FormField($this->ht);
if (!isset($this->_field))
$this->_field = new FormField($this->ht);
return $this->_field;
......
......@@ -154,7 +154,11 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
$('#field-config').show();
return false;
"><i class="icon-edit"></i> Config</a>
<?php } ?></td>
<?php } ?>
<div class="error" style="white-space:normal"><?php
if ($ferrors['type']) echo $ferrors['type'];
?></div>
</td>
<td><input type="checkbox" name="private-<?php echo $id; ?>"
<?php if ($f->get('private')) echo 'checked="checked"'; ?>
<?php echo $force_privacy ?>/></td>
......
......@@ -46,6 +46,13 @@ if($_POST) {
$field->addError('Field variable name is not unique', 'name');
if (preg_match('/[.{}\'"`; ]/u', $field->get('name')))
$field->addError('Invalid character in variable name. Please use letters and numbers only.', 'name');
// Subject (Issue Summary) must always have data
if ($form->get('type') == 'T' && $field->get('name') == 'subject') {
if (($f = $field->getField(false)->getImpl()) && !$f->hasData())
$field->addError('The issue summary must be a field '
.'that supports user input, such as short answer',
'type');
}
if ($field->get('name'))
$names[] = $field->get('name');
if ($field->isValid())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment