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
bffa52bd
Commit
bffa52bd
authored
Dec 19, 2006
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 339385: Make Bugzilla::Version use Bugzilla::Object
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=myk
parent
b7c87a72
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
46 deletions
+45
-46
Schema.pm
Bugzilla/DB/Schema.pm
+2
-0
DB.pm
Bugzilla/Install/DB.pm
+3
-0
Product.pm
Bugzilla/Product.pm
+3
-7
Version.pm
Bugzilla/Version.pm
+35
-37
importxml.pl
importxml.pl
+2
-2
No files found.
Bugzilla/DB/Schema.pm
View file @
bffa52bd
...
@@ -501,6 +501,8 @@ use constant ABSTRACT_SCHEMA => {
...
@@ -501,6 +501,8 @@ use constant ABSTRACT_SCHEMA => {
milestones
=>
{
milestones
=>
{
FIELDS
=>
[
FIELDS
=>
[
id
=>
{
TYPE
=>
'MEDIUMSERIAL'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
},
product_id
=>
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
},
product_id
=>
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
},
value
=>
{
TYPE
=>
'varchar(20)'
,
NOTNULL
=>
1
},
value
=>
{
TYPE
=>
'varchar(20)'
,
NOTNULL
=>
1
},
sortkey
=>
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
,
sortkey
=>
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
,
...
...
Bugzilla/Install/DB.pm
View file @
bffa52bd
...
@@ -514,6 +514,9 @@ sub update_table_definitions {
...
@@ -514,6 +514,9 @@ sub update_table_definitions {
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
,
DEFAULT
=>
'0'
});
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
,
DEFAULT
=>
'0'
});
$dbh
->
bz_add_column
(
'longdescs'
,
'extra_data'
,
{
TYPE
=>
'varchar(255)'
});
$dbh
->
bz_add_column
(
'longdescs'
,
'extra_data'
,
{
TYPE
=>
'varchar(255)'
});
$dbh
->
bz_add_column
(
'versions'
,
'id'
,
{
TYPE
=>
'MEDIUMSERIAL'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
});
################################################################
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
################################################################
...
...
Bugzilla/Product.pm
View file @
bffa52bd
...
@@ -106,15 +106,11 @@ sub versions {
...
@@ -106,15 +106,11 @@ sub versions {
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
if
(
!
defined
$self
->
{
versions
})
{
if
(
!
defined
$self
->
{
versions
})
{
my
$
value
s
=
$dbh
->
selectcol_arrayref
(
q{
my
$
id
s
=
$dbh
->
selectcol_arrayref
(
q{
SELECT
value
FROM versions
SELECT
id
FROM versions
WHERE product_id = ?}
,
undef
,
$self
->
id
);
WHERE product_id = ?}
,
undef
,
$self
->
id
);
my
@versions
;
$self
->
{
versions
}
=
Bugzilla::
Version
->
new_from_list
(
$ids
);
foreach
my
$value
(
sort
{
vers_cmp
(
lc
(
$a
),
lc
(
$b
))
}
@$values
)
{
push
@versions
,
new
Bugzilla::
Version
(
$self
->
id
,
$value
);
}
$self
->
{
versions
}
=
\
@versions
;
}
}
return
$self
->
{
versions
};
return
$self
->
{
versions
};
}
}
...
...
Bugzilla/Version.pm
View file @
bffa52bd
...
@@ -13,11 +13,14 @@
...
@@ -13,11 +13,14 @@
# The Original Code is the Bugzilla Bug Tracking System.
# The Original Code is the Bugzilla Bug Tracking System.
#
#
# Contributor(s): Tiago R. Mello <timello@async.com.br>
# Contributor(s): Tiago R. Mello <timello@async.com.br>
# Max Kanat-Alexander <mkanat@bugzilla.org>
use
strict
;
use
strict
;
package
Bugzilla::
Version
;
package
Bugzilla::
Version
;
use
base
qw(Bugzilla::Object)
;
use
Bugzilla::
Util
;
use
Bugzilla::
Util
;
use
Bugzilla::
Error
;
use
Bugzilla::
Error
;
...
@@ -27,49 +30,44 @@ use Bugzilla::Error;
...
@@ -27,49 +30,44 @@ use Bugzilla::Error;
use
constant
DEFAULT_VERSION
=>
'unspecified'
;
use
constant
DEFAULT_VERSION
=>
'unspecified'
;
use
constant
DB_TABLE
=>
'versions'
;
use
constant
DB_COLUMNS
=>
qw(
use
constant
DB_COLUMNS
=>
qw(
versions.value
id
versions.product_id
value
product_id
)
;
)
;
our
$columns
=
join
(
", "
,
DB_COLUMNS
);
use
constant
NAME_FIELD
=>
'value'
;
use
constant
LIST_ORDER
=>
NAME_FIELD
;
sub
new
{
sub
new
{
my
$invocant
=
shift
;
my
$class
=
shift
;
my
$class
=
ref
(
$invocant
)
||
$invocant
;
my
$param
=
shift
;
my
$self
=
{};
bless
(
$self
,
$class
);
return
$self
->
_init
(
@_
);
}
sub
_init
{
my
$self
=
shift
;
my
(
$product_id
,
$value
)
=
(
@_
);
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$version
;
my
$product
;
if
(
ref
$param
)
{
if
(
defined
$product_id
$product
=
$param
->
{
product
};
&&
detaint_natural
(
$product_id
)
my
$name
=
$param
->
{
name
};
&&
defined
$value
)
{
if
(
!
defined
$product
)
{
trick_taint
(
$value
);
$version
=
$dbh
->
selectrow_hashref
(
qq{
SELECT $columns FROM versions
WHERE value = ?
AND product_id = ?}
,
undef
,
(
$value
,
$product_id
));
}
else
{
ThrowCodeError
(
'bad_arg'
,
ThrowCodeError
(
'bad_arg'
,
{
argument
=>
'product_id/value'
,
{
argument
=>
'product'
,
function
=>
'Bugzilla::Version::_init'
});
function
=>
"${class}::new"
});
}
if
(
!
defined
$name
)
{
ThrowCodeError
(
'bad_arg'
,
{
argument
=>
'name'
,
function
=>
"${class}::new"
});
}
}
return
undef
unless
(
defined
$version
);
my
$condition
=
'product_id = ? AND value = ?'
;
my
@values
=
(
$product
->
id
,
$name
);
foreach
my
$field
(
keys
%
$version
)
{
$param
=
{
condition
=>
$condition
,
values
=>
\
@values
};
$self
->
{
$field
}
=
$version
->
{
$field
};
}
}
return
$self
;
unshift
@_
,
$param
;
return
$class
->
SUPER::
new
(
@_
);
}
}
sub
bug_count
{
sub
bug_count
{
...
@@ -110,7 +108,7 @@ sub update {
...
@@ -110,7 +108,7 @@ sub update {
$name
=
clean_text
(
$name
);
$name
=
clean_text
(
$name
);
return
0
if
(
$name
eq
$self
->
name
);
return
0
if
(
$name
eq
$self
->
name
);
my
$version
=
new
Bugzilla::
Version
(
$self
->
product_id
,
$name
);
my
$version
=
new
Bugzilla::
Version
(
{
product
=>
$product
,
name
=>
$name
}
);
if
(
$version
)
{
if
(
$version
)
{
ThrowUserError
(
'version_already_exists'
,
ThrowUserError
(
'version_already_exists'
,
...
@@ -147,7 +145,8 @@ sub check_version {
...
@@ -147,7 +145,8 @@ sub check_version {
my
(
$product
,
$version_name
)
=
@_
;
my
(
$product
,
$version_name
)
=
@_
;
$version_name
||
ThrowUserError
(
'version_not_specified'
);
$version_name
||
ThrowUserError
(
'version_not_specified'
);
my
$version
=
new
Bugzilla::
Version
(
$product
->
id
,
$version_name
);
my
$version
=
new
Bugzilla::
Version
(
{
product
=>
$product
,
name
=>
$version_name
});
unless
(
$version
)
{
unless
(
$version
)
{
ThrowUserError
(
'version_not_valid'
,
ThrowUserError
(
'version_not_valid'
,
{
'product'
=>
$product
->
name
,
{
'product'
=>
$product
->
name
,
...
@@ -166,7 +165,7 @@ sub create {
...
@@ -166,7 +165,7 @@ sub create {
# Remove unprintable characters
# Remove unprintable characters
$name
=
clean_text
(
$name
);
$name
=
clean_text
(
$name
);
my
$version
=
new
Bugzilla::
Version
(
$product
->
id
,
$name
);
my
$version
=
new
Bugzilla::
Version
(
{
product
=>
$product
,
name
=>
$name
}
);
if
(
$version
)
{
if
(
$version
)
{
ThrowUserError
(
'version_already_exists'
,
ThrowUserError
(
'version_already_exists'
,
{
'name'
=>
$version
->
name
,
{
'name'
=>
$version
->
name
,
...
@@ -178,8 +177,7 @@ sub create {
...
@@ -178,8 +177,7 @@ sub create {
$dbh
->
do
(
q{INSERT INTO versions (value, product_id)
$dbh
->
do
(
q{INSERT INTO versions (value, product_id)
VALUES (?, ?)}
,
undef
,
(
$name
,
$product
->
id
));
VALUES (?, ?)}
,
undef
,
(
$name
,
$product
->
id
));
$version
=
new
Bugzilla::
Version
(
$product
->
id
,
$name
);
return
new
Bugzilla::
Version
(
$dbh
->
bz_last_key
(
'versions'
,
'id'
));
return
$version
;
}
}
1
;
1
;
...
...
importxml.pl
View file @
bffa52bd
...
@@ -671,8 +671,8 @@ sub process_bug {
...
@@ -671,8 +671,8 @@ sub process_bug {
# Since there is no default version for a product, we check that the one
# Since there is no default version for a product, we check that the one
# coming over is valid. If not we will use the first one in @versions
# coming over is valid. If not we will use the first one in @versions
# and warn them.
# and warn them.
my
$version
=
my
$version
=
new
Bugzilla::
Version
(
new
Bugzilla::
Version
(
$product
->
id
,
$bug_fields
{
'version'
}
);
{
product
=>
$product
,
name
=>
$bug_fields
{
'version'
}
}
);
push
(
@query
,
"version"
);
push
(
@query
,
"version"
);
if
(
$version
)
{
if
(
$version
)
{
...
...
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