Fix a PHP notice / Pluf exception in case any issue type field is cleared.

This commit is contained in:
Thomas Keller 2011-05-31 10:51:24 +02:00
parent f412099f69
commit 9bcb5f9456
2 changed files with 24 additions and 18 deletions

View File

@ -373,10 +373,12 @@ class IDF_Form_IssueCreate extends Pluf_Form
foreach ($tags as $tag) {
$issue->setAssoc($tag);
}
// add relations
// add relations (if any)
if (!empty($this->cleaned_data['relation_type0'])) {
$verb = $this->cleaned_data['relation_type0'];
$other_verb = $this->relation_types[$verb];
$related_issues = preg_split('/\s*,\s*/', $this->cleaned_data['relation_issue0'], -1, PREG_SPLIT_NO_EMPTY);
foreach ($related_issues as $related_issue_id) {
$related_issue = new IDF_Issue($related_issue_id);
$rel = new IDF_IssueRelation();
@ -393,6 +395,7 @@ class IDF_Form_IssueCreate extends Pluf_Form
$other_rel->submitter = $this->user;
$other_rel->create();
}
}
// add the first comment
$comment = new IDF_IssueComment();

View File

@ -208,6 +208,9 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate
$normRelatedIssues = array();
for ($idx = 0; isset($this->cleaned_data['relation_type'.$idx]); ++$idx) {
$verb = $this->cleaned_data['relation_type'.$idx];
if (empty($verb))
continue;
$ids = preg_split('/\s*,\s*/', $this->cleaned_data['relation_issue'.$idx],
-1, PREG_SPLIT_NO_EMPTY);
if (count($ids) == 0)