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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
7072d6a6
Commit
7072d6a6
authored
May 14, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 561296: A fix allowing updating a field value's name when it is
the default value r=LpSolit, a=LpSolit
parent
80130158
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
9 deletions
+41
-9
CGI.pm
Bugzilla/CGI.pm
+8
-0
Choice.pm
Bugzilla/Field/Choice.pm
+20
-1
editvalues.cgi
editvalues.cgi
+3
-3
edit.html.tmpl
template/en/default/admin/fieldvalues/edit.html.tmpl
+5
-1
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+5
-4
No files found.
Bugzilla/CGI.pm
View file @
7072d6a6
...
...
@@ -329,6 +329,14 @@ sub _fix_utf8 {
return
$input
;
}
sub
should_set
{
my
(
$self
,
$param
)
=
@_
;
my
$set
=
(
defined
$self
->
param
(
$param
)
or
defined
$self
->
param
(
"defined_$param"
))
?
1
:
0
;
return
$set
;
}
# The various parts of Bugzilla which create cookies don't want to have to
# pass them around to all of the callers. Instead, store them locally here,
# and then output as required from |header|.
...
...
Bugzilla/Field/Choice.pm
View file @
7072d6a6
...
...
@@ -61,7 +61,7 @@ use constant VALIDATORS => {
value
=>
\&
_check_value
,
sortkey
=>
\&
_check_sortkey
,
visibility_value_id
=>
\&
_check_visibility_value_id
,
isactive
=>
\&
Bugzilla::Object::
check_boolean
,
isactive
=>
\&
_check_isactive
,
};
use
constant
CLASS_MAP
=>
{
...
...
@@ -216,6 +216,25 @@ sub set_visibility_value {
# Validators #
##############
sub
_check_isactive
{
my
(
$invocant
,
$value
)
=
@_
;
$value
=
Bugzilla::Object::
check_boolean
(
$invocant
,
$value
);
if
(
!
$value
and
ref
$invocant
)
{
if
(
$invocant
->
is_default
)
{
my
$field
=
$invocant
->
field
;
ThrowUserError
(
'fieldvalue_is_default'
,
{
value
=>
$invocant
,
field
=>
$field
,
param_name
=>
$invocant
->
DEFAULT_MAP
->
{
$field
->
name
}
});
}
if
(
$invocant
->
is_static
)
{
ThrowUserError
(
'fieldvalue_not_deletable'
,
{
value
=>
$invocant
,
field
=>
$invocant
->
field
});
}
}
return
$value
;
}
sub
_check_value
{
my
(
$invocant
,
$value
)
=
@_
;
...
...
editvalues.cgi
View file @
7072d6a6
...
...
@@ -181,12 +181,12 @@ if ($action eq 'edit') {
if
(
$action
eq
'update'
)
{
check_token_data
(
$token
,
'edit_field_value'
);
$vars
->
{
'value_old'
}
=
$value
->
name
;
if
(
$cgi
->
should_set
(
'is_active'
))
{
$value
->
set_is_active
(
$cgi
->
param
(
'is_active'
));
}
$value
->
set_name
(
$cgi
->
param
(
'value_new'
));
$value
->
set_sortkey
(
$cgi
->
param
(
'sortkey'
));
$value
->
set_visibility_value
(
$cgi
->
param
(
'visibility_value_id'
));
if
(
!
(
$value
->
is_static
||
$value
->
is_default
))
{
$value
->
set_is_active
(
$cgi
->
param
(
'is_active'
));
}
$vars
->
{
'changes'
}
=
$value
->
update
();
delete_token
(
$token
);
$vars
->
{
'message'
}
=
'field_value_updated'
;
...
...
template/en/default/admin/fieldvalues/edit.html.tmpl
View file @
7072d6a6
...
...
@@ -94,7 +94,11 @@
[% ELSIF value.is_static %]
This value is non-deletable and cannot be disabled.
[% END %]
</td>
[% IF !(value.is_default OR value.is_static) %]
<input id="defined_is_active" name="defined_is_active"
type="hidden" value="1">
[% END %]
</td>
</tr>
</table>
<input type="hidden" name="value" value="[% value.name FILTER html %]">
...
...
template/en/default/global/user-error.html.tmpl
View file @
7072d6a6
...
...
@@ -521,7 +521,8 @@
[% ELSIF error == "fieldvalue_is_default" %]
[% title = "Specified Field Value Is Default" %]
'[% value.name FILTER html %]' is the default value for
the '[% field.description FILTER html %]' field and cannot be deleted.
the '[% field.description FILTER html %]' field and cannot be deleted
or disabled.
[% IF user.in_group('tweakparams') %]
You have to <a href="editparams.cgi?section=bugfields#
[%- param_name FILTER url_quote %]">change</a> the default value first.
...
...
@@ -541,9 +542,9 @@
[% ELSIF error == "fieldvalue_not_deletable" %]
[% title = "Field Value Not Deletable" %]
The value '[% value.name FILTER html %]' cannot be removed
because
it plays some special role for the '[% field.description FILTER html %]'
field.
The value '[% value.name FILTER html %]' cannot be removed
or
disabled, because it plays some special role for the
'[% field.description FILTER html %]'
field.
[% ELSIF error == "fieldvalue_reserved_word" %]
[% title = "Reserved Word Not Allowed" %]
...
...
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