Nasty error showing up if you enter an invalid bug id on a case-run

This commit is contained in:
ghendricks%novell.com 2006-12-02 00:15:21 +00:00
Родитель f59b2ad453
Коммит ccb6d1bc81
3 изменённых файлов: 10 добавлений и 13 удалений

Просмотреть файл

@ -118,12 +118,8 @@
<div class="cc_i">
<a href="enter_bug.cgi?product=[% caserun.run.plan.product.name FILTER url_quote %]&caserun_id=[% caserun.id FILTER none %]&version=[% caserun.run.plan.product_version FILTER url_quote %]&component=[% caserun.case.components.0.name FILTER url_quote %]&short_desc=Test%20Case%20[% caserun.case.id FILTER none %]%20-%20[% caserun.case.summary FILTER url_quote %]&comment=STATUS:%20[% caserun.status %]%0D%0ABUILD:%20[% caserun.build.name FILTER url_quote %]%0D%0AENVIRONMENT:%20[% caserun.environment.name FILTER url_quote %]%0D%0ANOTES:%20[% caserun.notes FILTER url_quote %]%0D%0A&assigned_to=[% caserun.case.components.0.default_assignee.login FILTER url_quote %]&qa_contact=[% caserun.case.components.0.default_qa_contact.login FILTER url_quote %]" target="_blank"><img src="testopia/img/snew.gif" alt="Log a New Bug" title="Log a New Bug" style="vertical-align:text-bottom;" /></a>&nbsp;
</div>
<div style="float:left;"><input type="text" size="6" value="" id="mbg[% index %]" [% enabled %]
[% IF caserun.canedit %]
onkeyup="edt_attch([% index %]);"
[% END %]
/></div>
<div class="cc_i"><input type="button" value="Attach Bug" id="sk[% index %]" disabled="true" onclick="attch([% index %], [% caserun.id FILTER none %], document.getElementById('mbg[% index %]').value);"/></div>
<div style="float:left;"><input type="text" size="6" value="" id="mbg[% index %]" [% enabled %]/></div>
<div class="cc_i"><input type="button" value="Attach Bug" id="sk[% index %]" onclick="attch([% index %], [% caserun.id FILTER none %], document.getElementById('mbg[% index %]').value);"/></div>
[%##### Assignee #####%]
<div class="cc_i"><input value="[% user.login FILTER html %]" id="assignee_[% index %]" /><input type="button" value="Assign" onclick="chOwn([% index %], [% caserun.id FILTER none %], document.getElementById('assignee_[% index %]').value)">
<a href="javascript:userLookup('document.Create.assigned_to', document.Create.assigned_to.value);">

Просмотреть файл

@ -44,12 +44,6 @@ function validBugid(bugid) {
return (v != NaN) && (v > 0);
}
function edt_attch(index) {
var bugid=document.getElementById('mbg'+index).value;
document.getElementById('sk'+index).disabled = !validBugid(bugid);
}
function fillrow(data, idx){
//document.write(data);
if (data.substring(0,5) == 'Error'){

Просмотреть файл

@ -41,6 +41,7 @@ my $query_limit = 15000;
require "globals.pl";
Bugzilla->login();
Bugzilla->batch(1);
print Bugzilla->cgi->header();
my $dbh = Bugzilla->dbh;
@ -296,7 +297,13 @@ elsif ($action eq 'attach_bug'){
}
my @buglist;
foreach my $bug (split(/[\s,]+/, $cgi->param('bugs'))){
ValidateBugID($bug);
eval{
ValidateBugID($bug);
};
if ($@){
print "<span style='font-weight:bold; color:#FF0000;'>Error - Invalid bug id or alias</span>";
exit;
}
push @buglist, $bug;
}
foreach my $bug (@buglist){