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
e24b38a7
Commit
e24b38a7
authored
Oct 18, 2008
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 460293: Implement Bugzilla::Object::set_all and have editkeywords.cgi use it
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
parent
d9e6f240
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
6 deletions
+39
-6
Object.pm
Bugzilla/Object.pm
+35
-4
editkeywords.cgi
editkeywords.cgi
+4
-2
No files found.
Bugzilla/Object.pm
View file @
e24b38a7
...
...
@@ -240,6 +240,14 @@ sub set {
$self
->
{
$field
}
=
$value
;
}
sub
set_all
{
my
(
$self
,
$params
)
=
@_
;
foreach
my
$key
(
keys
%
$params
)
{
my
$method
=
"set_$key"
;
$self
->
$method
(
$params
->
{
$key
});
}
}
sub
update
{
my
$self
=
shift
;
...
...
@@ -743,10 +751,10 @@ not safe to use the object after it has been removed from the database.
=back
=head2
Subclass Helpe
rs
=head2
Mutato
rs
These
functions are intended only for use by subclasses. If
you call them from anywhere else, they will throw a C<CodeError
>.
These
are used for updating the values in objects, before calling
C<update
>.
=over
...
...
@@ -767,9 +775,11 @@ C<set> will call it with C<($value, $field)> as arguments, after running
the validator for this particular field. C<_set_global_validator> does not
return anything.
See L</VALIDATORS> for more information.
B<NOTE>: This function is intended only for use by subclasses. If
you call it from anywhere else, it will throw a C<CodeError>.
=item B<Params>
=over
...
...
@@ -785,6 +795,27 @@ be the same as the name of the field in L</VALIDATORS>, if it exists there.
=back
=item C<set_all>
=over
=item B<Description>
This is a convenience function which is simpler than calling many different
C<set_> functions in a row. You pass a hashref of parameters and it calls
C<set_$key($value)> for every item in the hashref.
=item B<Params>
Takes a hashref of the fields that need to be set, pointing to the value
that should be passed to the C<set_> function that is called.
=item B<Returns> (nothing)
=back
=back
=head2 Simple Validators
...
...
editkeywords.cgi
View file @
e24b38a7
...
...
@@ -131,8 +131,10 @@ if ($action eq 'update') {
my
$keyword
=
new
Bugzilla::
Keyword
(
$key_id
)
||
ThrowCodeError
(
'invalid_keyword_id'
,
{
id
=>
$key_id
});
$keyword
->
set_name
(
$cgi
->
param
(
'name'
));
$keyword
->
set_description
(
$cgi
->
param
(
'description'
));
$keyword
->
set_all
({
name
=>
scalar
$cgi
->
param
(
'name'
),
description
=>
scalar
$cgi
->
param
(
'description'
),
});
my
$changes
=
$keyword
->
update
();
delete_token
(
$token
);
...
...
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