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
78094dfe
Commit
78094dfe
authored
Jul 19, 2006
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 339379: Make Bugzilla::Product use Bugzilla::Object
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk
parent
33bdddf6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
87 deletions
+18
-87
Product.pm
Bugzilla/Product.pm
+15
-84
User.pm
Bugzilla/User.pm
+1
-1
collectstats.pl
collectstats.pl
+1
-1
editflagtypes.cgi
editflagtypes.cgi
+1
-1
No files found.
Bugzilla/Product.pm
View file @
78094dfe
...
...
@@ -25,12 +25,16 @@ use Bugzilla::Util;
use
Bugzilla::
Group
;
use
Bugzilla::
Error
;
use
base
qw(Bugzilla::Object)
;
use
constant
DEFAULT_CLASSIFICATION_ID
=>
1
;
###############################
#### Initialization ####
###############################
use
constant
DB_TABLE
=>
'products'
;
use
constant
DB_COLUMNS
=>
qw(
products.id
products.name
...
...
@@ -44,52 +48,6 @@ use constant DB_COLUMNS => qw(
products.defaultmilestone
)
;
my
$columns
=
join
(
", "
,
DB_COLUMNS
);
sub
new
{
my
$invocant
=
shift
;
my
$class
=
ref
(
$invocant
)
||
$invocant
;
my
$self
=
{};
bless
(
$self
,
$class
);
return
$self
->
_init
(
@_
);
}
sub
_init
{
my
$self
=
shift
;
my
(
$param
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$id
=
$param
unless
(
ref
$param
eq
'HASH'
);
my
$product
;
if
(
defined
$id
)
{
detaint_natural
(
$id
)
||
ThrowCodeError
(
'param_must_be_numeric'
,
{
function
=>
'Bugzilla::Product::_init'
});
$product
=
$dbh
->
selectrow_hashref
(
qq{
SELECT $columns FROM products
WHERE id = ?}
,
undef
,
$id
);
}
elsif
(
defined
$param
->
{
'name'
})
{
trick_taint
(
$param
->
{
'name'
});
$product
=
$dbh
->
selectrow_hashref
(
qq{
SELECT $columns FROM products
WHERE name = ?}
,
undef
,
$param
->
{
'name'
});
}
else
{
ThrowCodeError
(
'bad_arg'
,
{
argument
=>
'param'
,
function
=>
'Bugzilla::Product::_init'
});
}
return
undef
unless
(
defined
$product
);
foreach
my
$field
(
keys
%
$product
)
{
$self
->
{
$field
}
=
$product
->
{
$field
};
}
return
$self
;
}
###############################
#### Methods ####
...
...
@@ -211,8 +169,6 @@ sub bug_ids {
#### Accessors ######
###############################
sub
id
{
return
$_
[
0
]
->
{
'id'
};
}
sub
name
{
return
$_
[
0
]
->
{
'name'
};
}
sub
description
{
return
$_
[
0
]
->
{
'description'
};
}
sub
milestone_url
{
return
$_
[
0
]
->
{
'milestoneurl'
};
}
sub
disallow_new
{
return
$_
[
0
]
->
{
'disallownew'
};
}
...
...
@@ -226,19 +182,6 @@ sub classification_id { return $_[0]->{'classification_id'}; }
#### Subroutines ######
###############################
sub
get_all_products
{
my
$dbh
=
Bugzilla
->
dbh
;
my
$ids
=
$dbh
->
selectcol_arrayref
(
q{
SELECT id FROM products ORDER BY name}
);
my
@products
;
foreach
my
$id
(
@$ids
)
{
push
@products
,
new
Bugzilla::
Product
(
$id
);
}
return
@products
;
}
sub
check_product
{
my
(
$product_name
)
=
@_
;
...
...
@@ -266,7 +209,7 @@ Bugzilla::Product - Bugzilla product class.
use Bugzilla::Product;
my $product = new Bugzilla::Product(1);
my $product = new Bugzilla::Product(
'AcmeProduct'
);
my $product = new Bugzilla::Product(
{ name => 'AcmeProduct' }
);
my @components = $product->components();
my $groups_controls = $product->group_controls();
...
...
@@ -288,25 +231,17 @@ Bugzilla::Product - Bugzilla product class.
=head1 DESCRIPTION
Product.pm represents a product object.
Product.pm represents a product object. It is an implementation
of L<Bugzilla::Object>, and thus provides all methods that
L<Bugzilla::Object> provides.
The methods that are specific to C<Bugzilla::Product> are listed
below.
=head1 METHODS
=over
=item C<new($param)>
Description: The constructor is used to load an existing product
by passing a product id or a hash.
Params: $param - If you pass an integer, the integer is the
product id from the database that we want to
read in. If you pass in a hash with 'name' key,
then the value of the name key is the name of a
product from the DB.
Returns: A Bugzilla::Product object.
=item C<components()>
Description: Returns an array of component objects belonging to
...
...
@@ -365,14 +300,6 @@ Product.pm represents a product object.
=over
=item C<get_all_products()>
Description: Returns all products from the database.
Params: none.
Returns: Bugzilla::Product object list.
=item C<check_product($product_name)>
Description: Checks if the product name was passed in and if is a valid
...
...
@@ -384,4 +311,8 @@ Product.pm represents a product object.
=back
=head1 SEE ALSO
L<Bugzilla::Object>
=cut
Bugzilla/User.pm
View file @
78094dfe
...
...
@@ -632,7 +632,7 @@ sub get_enterable_products {
}
my
@products
;
foreach
my
$product
(
Bugzilla::Product
::
get_all_products
()
)
{
foreach
my
$product
(
Bugzilla::
Product
->
get_all
)
{
if
(
$self
->
can_enter_product
(
$product
->
name
))
{
push
(
@products
,
$product
);
}
...
...
collectstats.pl
View file @
78094dfe
...
...
@@ -68,7 +68,7 @@ if ($#ARGV >= 0 && $ARGV[0] eq "--regenerate") {
my
$datadir
=
bz_locations
()
->
{
'datadir'
};
my
@myproducts
=
map
{
$_
->
name
}
Bugzilla::Product
::
get_all_products
()
;
my
@myproducts
=
map
{
$_
->
name
}
Bugzilla::
Product
->
get_all
;
unshift
(
@myproducts
,
"-All-"
);
# As we can now customize the list of resolutions, looking at the actual list
...
...
editflagtypes.cgi
View file @
78094dfe
...
...
@@ -517,7 +517,7 @@ sub deactivate {
sub
get_products_and_components
{
my
$vars
=
shift
;
my
@products
=
Bugzilla::Product
::
get_all_products
()
;
my
@products
=
Bugzilla::
Product
->
get_all
;
# We require all unique component names.
my
%
components
;
foreach
my
$product
(
@products
)
{
...
...
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