Fix a PHP notice / Pluf exception in case any issue type field is cleared.
This commit is contained in:
parent
f412099f69
commit
9bcb5f9456
@ -373,25 +373,28 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
|||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$issue->setAssoc($tag);
|
$issue->setAssoc($tag);
|
||||||
}
|
}
|
||||||
// add relations
|
// add relations (if any)
|
||||||
$verb = $this->cleaned_data['relation_type0'];
|
if (!empty($this->cleaned_data['relation_type0'])) {
|
||||||
$other_verb = $this->relation_types[$verb];
|
$verb = $this->cleaned_data['relation_type0'];
|
||||||
$related_issues = preg_split('/\s*,\s*/', $this->cleaned_data['relation_issue0'], -1, PREG_SPLIT_NO_EMPTY);
|
$other_verb = $this->relation_types[$verb];
|
||||||
foreach ($related_issues as $related_issue_id) {
|
$related_issues = preg_split('/\s*,\s*/', $this->cleaned_data['relation_issue0'], -1, PREG_SPLIT_NO_EMPTY);
|
||||||
$related_issue = new IDF_Issue($related_issue_id);
|
|
||||||
$rel = new IDF_IssueRelation();
|
|
||||||
$rel->issue = $issue;
|
|
||||||
$rel->verb = $verb;
|
|
||||||
$rel->other_issue = $related_issue;
|
|
||||||
$rel->submitter = $this->user;
|
|
||||||
$rel->create();
|
|
||||||
|
|
||||||
$other_rel = new IDF_IssueRelation();
|
foreach ($related_issues as $related_issue_id) {
|
||||||
$other_rel->issue = $related_issue;
|
$related_issue = new IDF_Issue($related_issue_id);
|
||||||
$other_rel->verb = $other_verb;
|
$rel = new IDF_IssueRelation();
|
||||||
$other_rel->other_issue = $issue;
|
$rel->issue = $issue;
|
||||||
$other_rel->submitter = $this->user;
|
$rel->verb = $verb;
|
||||||
$other_rel->create();
|
$rel->other_issue = $related_issue;
|
||||||
|
$rel->submitter = $this->user;
|
||||||
|
$rel->create();
|
||||||
|
|
||||||
|
$other_rel = new IDF_IssueRelation();
|
||||||
|
$other_rel->issue = $related_issue;
|
||||||
|
$other_rel->verb = $other_verb;
|
||||||
|
$other_rel->other_issue = $issue;
|
||||||
|
$other_rel->submitter = $this->user;
|
||||||
|
$other_rel->create();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the first comment
|
// add the first comment
|
||||||
|
@ -208,6 +208,9 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate
|
|||||||
$normRelatedIssues = array();
|
$normRelatedIssues = array();
|
||||||
for ($idx = 0; isset($this->cleaned_data['relation_type'.$idx]); ++$idx) {
|
for ($idx = 0; isset($this->cleaned_data['relation_type'.$idx]); ++$idx) {
|
||||||
$verb = $this->cleaned_data['relation_type'.$idx];
|
$verb = $this->cleaned_data['relation_type'.$idx];
|
||||||
|
if (empty($verb))
|
||||||
|
continue;
|
||||||
|
|
||||||
$ids = preg_split('/\s*,\s*/', $this->cleaned_data['relation_issue'.$idx],
|
$ids = preg_split('/\s*,\s*/', $this->cleaned_data['relation_issue'.$idx],
|
||||||
-1, PREG_SPLIT_NO_EMPTY);
|
-1, PREG_SPLIT_NO_EMPTY);
|
||||||
if (count($ids) == 0)
|
if (count($ids) == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user