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
af7d2134
Commit
af7d2134
authored
Oct 07, 2005
by
mkanat%kerio.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 309749: Remove get_x_by_y functions from the new .pm files, in favor of object methods
Patch By AndrÃ
©
Batosti <batosti@async.com.br> r=LpSolit, a=justdave
parent
b808272b
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
161 deletions
+51
-161
Component.pm
Bugzilla/Component.pm
+0
-36
Group.pm
Bugzilla/Group.pm
+0
-33
Milestone.pm
Bugzilla/Milestone.pm
+0
-36
Product.pm
Bugzilla/Product.pm
+48
-8
Version.pm
Bugzilla/Version.pm
+0
-36
editcomponents.cgi
editcomponents.cgi
+1
-4
editmilestones.cgi
editmilestones.cgi
+1
-4
editversions.cgi
editversions.cgi
+1
-4
No files found.
Bugzilla/Component.pm
View file @
af7d2134
...
...
@@ -145,32 +145,6 @@ sub product_id { return $_[0]->{'product_id'}; }
#### Subroutines ####
###############################
sub
get_components_by_product
{
my
(
$product_id
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$stored_product_id
=
$product_id
;
unless
(
detaint_natural
(
$product_id
))
{
ThrowCodeError
(
'invalid_numeric_argument'
,
{
argument
=>
'product_id'
,
value
=>
$stored_product_id
,
function
=>
'Bugzilla::Component::get_components_by_product'
}
);
}
my
$ids
=
$dbh
->
selectcol_arrayref
(
q{
SELECT id FROM components
WHERE product_id = ?}
,
undef
,
$product_id
);
my
@components
;
foreach
my
$id
(
@$ids
)
{
push
@components
,
new
Bugzilla::
Component
(
$id
);
}
return
@components
;
}
sub
check_component
{
my
(
$product
,
$comp_name
)
=
@_
;
...
...
@@ -217,7 +191,6 @@ Bugzilla::Component - Bugzilla product component class.
my $default_assignee = $component->default_assignee;
my $default_qa_contact = $component->default_qa_contact;
my @components = Bugzilla::Component::get_components_by_product($id);
my $component = Bugzilla::Component::check_component($product, 'AcmeComp');
=head1 DESCRIPTION
...
...
@@ -282,15 +255,6 @@ Component.pm represents a Product Component object.
=over
=item C<get_components_by_product($product_id)>
Description: Returns all components that belong to the supplied product.
Params: $product_id - Integer with a Bugzilla product id.
Returns: An array of Bugzilla::Component objects.
=item C<check_component($product, $comp_name)>
Description: Checks if the component name was passed in and if it is a valid
...
...
Bugzilla/Group.pm
View file @
af7d2134
...
...
@@ -124,27 +124,6 @@ sub ValidateGroupName {
return
$ret
;
}
sub
get_group_controls_by_product
{
my
(
$product_id
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$query
=
qq{SELECT
$columns,
group_control_map.entry,
group_control_map.membercontrol,
group_control_map.othercontrol,
group_control_map.canedit
FROM groups
LEFT JOIN group_control_map
ON groups.id = group_control_map.group_id
WHERE group_control_map.product_id = ?
AND groups.isbuggroup != 0
ORDER BY groups.name}
;
my
$groups
=
$dbh
->
selectall_hashref
(
$query
,
'id'
,
undef
,
(
$product_id
));
return
$groups
;
}
sub
get_all_groups
{
my
$dbh
=
Bugzilla
->
dbh
;
...
...
@@ -181,7 +160,6 @@ Bugzilla::Group - Bugzilla group class.
my $is_active = $group->is_active;
my $group_id = Bugzilla::Group::ValidateGroupName('admin', @users);
my $groups = Bugzilla::Group::get_group_controls_by_product(1);
my @groups = Bugzilla::get_all_groups();
=head1 DESCRIPTION
...
...
@@ -223,17 +201,6 @@ Group.pm represents a Bugzilla Group object.
Returns: It returns the group id if successful
and undef otherwise.
=item C<get_group_controls_by_product($product_id)>
Description: Returns all group controls of a specific product.
It is encouraged to use Bugzilla::Product object
instead of directly calling this routine.
Params: $product_id - Integer with a Bugzilla product id.
Returns: A hash with group id as key and hash containing the
group data as value.
=item C<get_all_groups()>
Description: Returns all groups available, including both
...
...
Bugzilla/Milestone.pm
View file @
af7d2134
...
...
@@ -98,32 +98,6 @@ sub sortkey { return $_[0]->{'sortkey'}; }
##### Subroutines #####
################################
sub
get_milestones_by_product
{
my
(
$product_id
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$stored_product_id
=
$product_id
;
unless
(
detaint_natural
(
$product_id
))
{
ThrowCodeError
(
'invalid_numeric_argument'
,
{
argument
=>
'product_id'
,
value
=>
$stored_product_id
,
function
=>
'Bugzilla::Milestone::get_milestones_by_product'
}
);
}
my
$values
=
$dbh
->
selectcol_arrayref
(
q{
SELECT value FROM milestones
WHERE product_id = ?}
,
undef
,
$product_id
);
my
@milestones
;
foreach
my
$value
(
@$values
)
{
push
@milestones
,
new
Bugzilla::
Milestone
(
$product_id
,
$value
);
}
return
@milestones
;
}
sub
check_milestone
{
my
(
$product
,
$milestone_name
)
=
@_
;
...
...
@@ -172,7 +146,6 @@ Bugzilla::Milestone - Bugzilla product milestone class.
my $product_id = $milestone->product_id;
my $value = $milestone->value;
my $hash_ref = Bugzilla::Milestone::get_milestones_by_product(1);
my $milestone = $hash_ref->{'milestone_value'};
=head1 DESCRIPTION
...
...
@@ -207,15 +180,6 @@ Milestone.pm represents a Product Milestone object.
=over
=item C<get_milestones_by_product($product_id)>
Description: Returns all product milestones that belong
to the supplied product.
Params: $product_id - Integer with a product id.
Returns: Bugzilla::Milestone object list.
=item C<check_milestone($product, $milestone_name)>
Description: Checks if a milestone name was passed in
...
...
Bugzilla/Product.pm
View file @
af7d2134
...
...
@@ -96,10 +96,17 @@ sub _init {
sub
components
{
my
$self
=
shift
;
my
$dbh
=
Bugzilla
->
dbh
;
if
(
!
defined
$self
->
{
components
})
{
my
@components
=
Bugzilla::Component::
get_components_by_product
(
$self
->
id
);
my
$ids
=
$dbh
->
selectcol_arrayref
(
q{
SELECT id FROM components
WHERE product_id = ?}
,
undef
,
$self
->
id
);
my
@components
;
foreach
my
$id
(
@$ids
)
{
push
@components
,
new
Bugzilla::
Component
(
$id
);
}
$self
->
{
components
}
=
\
@components
;
}
return
$self
->
{
components
};
...
...
@@ -117,20 +124,46 @@ sub classification {
sub
group_controls
{
my
$self
=
shift
;
my
$dbh
=
Bugzilla
->
dbh
;
if
(
!
defined
$self
->
{
group_controls
})
{
$self
->
{
group_controls
}
=
Bugzilla::Group::
get_group_controls_by_product
(
$self
->
id
);
my
$query
=
qq{SELECT
groups.id,
groups.name,
groups.description,
groups.isbuggroup,
groups.last_changed,
groups.userregexp,
groups.isactive,
group_control_map.entry,
group_control_map.membercontrol,
group_control_map.othercontrol,
group_control_map.canedit
FROM groups
LEFT JOIN group_control_map
ON groups.id = group_control_map.group_id
WHERE group_control_map.product_id = ?
AND groups.isbuggroup != 0
ORDER BY groups.name}
;
my
$self
->
{
group_controls
}
=
$dbh
->
selectall_hashref
(
$query
,
'id'
,
undef
,
$self
->
id
);
}
return
$self
->
{
group_controls
};
}
sub
versions
{
my
$self
=
shift
;
my
$dbh
=
Bugzilla
->
dbh
;
if
(
!
defined
$self
->
{
versions
})
{
my
@versions
=
Bugzilla::Version::
get_versions_by_product
(
$self
->
id
);
my
$values
=
$dbh
->
selectcol_arrayref
(
q{
SELECT value FROM versions
WHERE product_id = ?}
,
undef
,
$self
->
id
);
my
@versions
;
foreach
my
$value
(
@$values
)
{
push
@versions
,
new
Bugzilla::
Version
(
$self
->
id
,
$value
);
}
$self
->
{
versions
}
=
\
@versions
;
}
return
$self
->
{
versions
};
...
...
@@ -138,10 +171,17 @@ sub versions {
sub
milestones
{
my
$self
=
shift
;
my
$dbh
=
Bugzilla
->
dbh
;
if
(
!
defined
$self
->
{
milestones
})
{
my
@milestones
=
Bugzilla::Milestone::
get_milestones_by_product
(
$self
->
id
);
my
$values
=
$dbh
->
selectcol_arrayref
(
q{
SELECT value FROM milestones
WHERE product_id = ?}
,
undef
,
$self
->
id
);
my
@milestones
;
foreach
my
$value
(
@$values
)
{
push
@milestones
,
new
Bugzilla::
Milestone
(
$self
->
id
,
$value
);
}
$self
->
{
milestones
}
=
\
@milestones
;
}
return
$self
->
{
milestones
};
...
...
Bugzilla/Version.pm
View file @
af7d2134
...
...
@@ -96,32 +96,6 @@ sub product_id { return $_[0]->{'product_id'}; }
##### Subroutines ###
###############################
sub
get_versions_by_product
{
my
(
$product_id
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$stored_product_id
=
$product_id
;
unless
(
detaint_natural
(
$product_id
))
{
ThrowCodeError
(
'invalid_numeric_argument'
,
{
argument
=>
'product_id'
,
value
=>
$stored_product_id
,
function
=>
'Bugzilla::Version::get_versions_by_product'
}
);
}
my
$values
=
$dbh
->
selectcol_arrayref
(
q{
SELECT value FROM versions
WHERE product_id = ?}
,
undef
,
$product_id
);
my
@versions
;
foreach
my
$value
(
@$values
)
{
push
@versions
,
new
Bugzilla::
Version
(
$product_id
,
$value
);
}
return
@versions
;
}
sub
check_version
{
my
(
$product
,
$version_name
)
=
@_
;
...
...
@@ -152,7 +126,6 @@ Bugzilla::Version - Bugzilla product version class.
my $product_id = $version->product_id;
my $value = $version->value;
my $hash_ref = Bugzilla::Version::get_versions_by_product(1);
my $version = $hash_ref->{'version_value'};
my $version = Bugzilla::Version::check_version($product_obj,
...
...
@@ -190,15 +163,6 @@ Version.pm represents a Product Version object.
=over
=item C<get_versions_by_product($product_id)>
Description: Returns all product versions that belong
to the supplied product.
Params: $product_id - Integer with a product id.
Returns: Bugzilla::Version object list.
=item C<check_version($product, $version_name)>
Description: Checks if the version name exists for the product name.
...
...
editcomponents.cgi
View file @
af7d2134
...
...
@@ -92,12 +92,9 @@ my $product = Bugzilla::Product::check_product($product_name);
unless
(
$action
)
{
my
@components
=
Bugzilla::Component::
get_components_by_product
(
$product
->
id
);
$vars
->
{
'showbugcounts'
}
=
$showbugcounts
;
$vars
->
{
'product'
}
=
$product
->
name
;
$vars
->
{
'components'
}
=
\
@
components
;
$vars
->
{
'components'
}
=
$product
->
components
;
$template
->
process
(
"admin/components/list.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
...
...
editmilestones.cgi
View file @
af7d2134
...
...
@@ -80,12 +80,9 @@ my $product = Bugzilla::Product::check_product($product_name);
unless
(
$action
)
{
my
@milestones
=
Bugzilla::Milestone::
get_milestones_by_product
(
$product
->
id
);
$vars
->
{
'showbugcounts'
}
=
$showbugcounts
;
$vars
->
{
'product'
}
=
$product
->
name
;
$vars
->
{
'milestones'
}
=
\
@
milestones
;
$vars
->
{
'milestones'
}
=
$product
->
milestones
;
$vars
->
{
'default_milestone'
}
=
$product
->
default_milestone
;
$template
->
process
(
"admin/milestones/list.html.tmpl"
,
$vars
)
...
...
editversions.cgi
View file @
af7d2134
...
...
@@ -88,12 +88,9 @@ my $product = Bugzilla::Product::check_product($product_name);
#
unless
(
$action
)
{
my
@versions
=
Bugzilla::Version::
get_versions_by_product
(
$product
->
id
);
$vars
->
{
'showbugcounts'
}
=
$showbugcounts
;
$vars
->
{
'product'
}
=
$product
->
name
;
$vars
->
{
'versions'
}
=
\
@
versions
;
$vars
->
{
'versions'
}
=
$product
->
versions
;
$template
->
process
(
"admin/versions/list.html.tmpl"
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
...
...
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