Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
99ad6a4e
You need to sign in or sign up before continuing.
Commit
99ad6a4e
authored
Jun 03, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 567846: Modify set_status, set_resolution, and set_dup_id to use
VALIDATOR_DEPENDENCIES, so that they don't need custom code in set_all.
parent
a476a7bf
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
29 deletions
+43
-29
Bug.pm
Bugzilla/Bug.pm
+29
-21
Object.pm
Bugzilla/Object.pm
+11
-4
attachment.cgi
attachment.cgi
+1
-1
Extension.pm
extensions/Voting/Extension.pm
+1
-1
process_bug.cgi
process_bug.cgi
+1
-2
No files found.
Bugzilla/Bug.pm
View file @
99ad6a4e
...
...
@@ -192,11 +192,13 @@ sub VALIDATOR_DEPENDENCIES {
my
%
deps
=
(
assigned_to
=>
[
'component'
],
bug_status
=>
[
'product'
,
'comment'
],
bug_status
=>
[
'product'
,
'comment'
,
'target_milestone'
],
cc
=>
[
'component'
],
component
=>
[
'product'
],
dup_id
=>
[
'bug_status'
,
'resolution'
],
groups
=>
[
'product'
],
keywords
=>
[
'product'
],
resolution
=>
[
'bug_status'
],
qa_contact
=>
[
'component'
],
target_milestone
=>
[
'product'
],
version
=>
[
'product'
],
...
...
@@ -1971,7 +1973,6 @@ sub set_all {
my
%
normal_set_all
;
foreach
my
$name
(
keys
%
$params
)
{
# These are handled separately below.
next
if
grep
(
$_
eq
$name
,
qw(status resolution dup_id)
);
if
(
$self
->
can
(
"set_$name"
))
{
$normal_set_all
{
$name
}
=
$params
->
{
$name
};
}
...
...
@@ -2010,22 +2011,6 @@ sub set_all {
{
ThrowUserError
(
'dupe_not_allowed'
);
}
# Seting the status, resolution, and dupe_of has to be done
# down here, because the validity of status changes depends on
# other fields, such as Target Milestone.
if
(
exists
$params
->
{
'status'
})
{
$self
->
set_status
(
$params
->
{
'status'
},
{
resolution
=>
$params
->
{
'resolution'
},
dupe_of
=>
$params
->
{
'dup_id'
}
});
}
elsif
(
exists
$params
->
{
'resolution'
})
{
$self
->
set_resolution
(
$params
->
{
'resolution'
},
{
dupe_of
=>
$params
->
{
'dup_id'
}
});
}
elsif
(
exists
$params
->
{
'dup_id'
})
{
$self
->
set_dup_id
(
$params
->
{
'dup_id'
});
}
}
# Helper for set_all that helps with fields that have an "add/remove"
...
...
@@ -2121,6 +2106,21 @@ sub set_dup_id {
my
$new
=
$self
->
dup_id
;
return
if
$old
==
$new
;
# Make sure that we have the DUPLICATE resolution. This is needed
# if somebody calls set_dup_id without calling set_bug_status or
# set_resolution.
if
(
$self
->
resolution
ne
'DUPLICATE'
)
{
# Even if the current status is VERIFIED, we change it back to
# RESOLVED (or whatever the duplicate_or_move_bug_status is) here,
# because that's the same thing the UI does when you click on the
# "Mark as Duplicate" link. If people really want to retain their
# current status, they can use set_bug_status and set the DUPLICATE
# resolution before getting here.
$self
->
set_bug_status
(
Bugzilla
->
params
->
{
'duplicate_or_move_bug_status'
},
{
resolution
=>
'DUPLICATE'
});
}
# Update the other bug.
my
$dupe_of
=
new
Bugzilla::
Bug
(
$self
->
dup_id
);
if
(
delete
$self
->
{
_add_dup_cc
})
{
...
...
@@ -2343,13 +2343,17 @@ sub set_resolution {
# of another, theoretically. Note that this code block will also run
# when going between different closed states.
if
(
$self
->
resolution
eq
'DUPLICATE'
)
{
if
(
$params
->
{
dupe_of
})
{
$self
->
set_dup_id
(
$
params
->
{
dupe_of
}
);
if
(
my
$dup_id
=
$params
->
{
dup_id
})
{
$self
->
set_dup_id
(
$
dup_id
);
}
elsif
(
!
$self
->
dup_id
)
{
ThrowUserError
(
'dupe_id_required'
);
}
}
# This method has handled dup_id, so set_all doesn't have to worry
# about it now.
delete
$params
->
{
dup_id
};
}
sub
clear_resolution
{
my
$self
=
shift
;
...
...
@@ -2360,7 +2364,7 @@ sub clear_resolution {
$self
->
_clear_dup_id
;
}
sub
set_severity
{
$_
[
0
]
->
set
(
'bug_severity'
,
$_
[
1
]);
}
sub
set_status
{
sub
set_
bug_
status
{
my
(
$self
,
$status
,
$params
)
=
@_
;
my
$old_status
=
$self
->
status
;
$self
->
set
(
'bug_status'
,
$status
);
...
...
@@ -2373,6 +2377,10 @@ sub set_status {
# Check for the everconfirmed transition
$self
->
_set_everconfirmed
(
$new_status
->
name
eq
'UNCONFIRMED'
?
0
:
1
);
$self
->
clear_resolution
();
# Calling clear_resolution handled the "resolution" and "dup_id"
# setting, so set_all doesn't have to worry about them.
delete
$params
->
{
resolution
};
delete
$params
->
{
dup_id
};
}
else
{
# We do this here so that we can make sure closed statuses have
...
...
Bugzilla/Object.pm
View file @
99ad6a4e
...
...
@@ -316,13 +316,20 @@ sub set {
sub
set_all
{
my
(
$self
,
$params
)
=
@_
;
my
@sorted_names
=
$self
->
_sort_by_dep
(
keys
%
$params
);
# Don't let setters modify the values in $params for the caller.
my
%
field_values
=
%
$params
;
my
@sorted_names
=
$self
->
_sort_by_dep
(
keys
%
field_values
);
foreach
my
$key
(
@sorted_names
)
{
# It's possible for one set_ method to delete a key from $params
# for another set method, so if that's happened, we don't call the
# other set method.
next
if
!
exists
$field_values
{
$key
};
my
$method
=
"set_$key"
;
$self
->
$method
(
$
params
->
{
$key
}
);
$self
->
$method
(
$
field_values
{
$key
},
\%
field_values
);
}
Bugzilla::Hook::
process
(
'object_end_of_set_all'
,
{
object
=>
$self
,
params
=>
$param
s
});
Bugzilla::Hook::
process
(
'object_end_of_set_all'
,
{
object
=>
$self
,
params
=>
\%
field_value
s
});
}
sub
update
{
...
...
attachment.cgi
View file @
99ad6a4e
...
...
@@ -515,7 +515,7 @@ sub insert {
&&
(
$bug_status
->
name
ne
'UNCONFIRMED'
||
$bug
->
product_obj
->
allows_unconfirmed
))
{
$bug
->
set_status
(
$bug_status
->
name
);
$bug
->
set_
bug_
status
(
$bug_status
->
name
);
$bug
->
clear_resolution
();
}
# Make sure the person we are taking the bug from gets mail.
...
...
extensions/Voting/Extension.pm
View file @
99ad6a4e
...
...
@@ -844,7 +844,7 @@ sub _confirm_if_vote_confirmed {
}
ThrowCodeError
(
'voting_no_open_bug_status'
)
unless
$new_status
;
# We cannot call $bug->set_status() here, because a user without
# We cannot call $bug->set_
bug_
status() here, because a user without
# canconfirm privs should still be able to confirm a bug by
# popular vote. We already know the new status is valid, so it's safe.
$bug
->
{
bug_status
}
=
$new_status
;
...
...
process_bug.cgi
View file @
99ad6a4e
...
...
@@ -262,7 +262,6 @@ my %field_translation = (
set_default_qa_contact
=>
'reset_qa_contact'
,
keywordaction
=>
'keywords_action'
,
confirm_product_change
=>
'product_change_confirmed'
,
bug_status
=>
'status'
,
);
my
%
set_all_fields
=
(
other_bugs
=>
\
@bug_objects
);
...
...
@@ -409,7 +408,7 @@ if ($move_action eq Bugzilla->params->{'move-button-text'}) {
my
$new_status
=
Bugzilla
->
params
->
{
'duplicate_or_move_bug_status'
};
foreach
my
$bug
(
@bug_objects
)
{
$bug
->
set_status
(
$new_status
,
{
resolution
=>
'MOVED'
,
moving
=>
1
});
$bug
->
set_
bug_
status
(
$new_status
,
{
resolution
=>
'MOVED'
,
moving
=>
1
});
}
$_
->
update
()
foreach
@bug_objects
;
$dbh
->
bz_commit_transaction
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment