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
6807999c
Commit
6807999c
authored
Feb 14, 2012
by
Dave Lawrence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 714370 - Add accessors to the Flag.pm object for modification_date and creation_date
r/a=LpSolit
parent
578d62ae
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
Flag.pm
Bugzilla/Flag.pm
+25
-4
No files found.
Bugzilla/Flag.pm
View file @
6807999c
...
@@ -65,15 +65,21 @@ use constant AUDIT_REMOVES => 0;
...
@@ -65,15 +65,21 @@ use constant AUDIT_REMOVES => 0;
use
constant
SKIP_REQUESTEE_ON_ERROR
=>
1
;
use
constant
SKIP_REQUESTEE_ON_ERROR
=>
1
;
use
constant
DB_COLUMNS
=>
qw(
sub
DB_COLUMNS
{
my
$dbh
=
Bugzilla
->
dbh
;
return
qw(
id
id
type_id
type_id
bug_id
bug_id
attach_id
attach_id
requestee_id
requestee_id
setter_id
setter_id
status
status)
,
)
;
$dbh
->
sql_date_format
(
'creation_date'
,
'%Y.%m.%d %H:%i:%s'
)
.
' AS creation_date'
,
$dbh
->
sql_date_format
(
'modification_date'
,
'%Y.%m.%d %H:%i:%s'
)
.
' AS modification_date'
;
}
use
constant
UPDATE_COLUMNS
=>
qw(
use
constant
UPDATE_COLUMNS
=>
qw(
requestee_id
requestee_id
...
@@ -118,6 +124,14 @@ Returns the ID of the attachment this flag belongs to, if any.
...
@@ -118,6 +124,14 @@ Returns the ID of the attachment this flag belongs to, if any.
Returns the status '+', '-', '?' of the flag.
Returns the status '+', '-', '?' of the flag.
=item C<creation_date>
Returns the timestamp when the flag was created.
=item C<modification_date>
Returns the timestamp when the flag was last modified.
=back
=back
=cut
=cut
...
@@ -130,6 +144,8 @@ sub attach_id { return $_[0]->{'attach_id'}; }
...
@@ -130,6 +144,8 @@ sub attach_id { return $_[0]->{'attach_id'}; }
sub
status
{
return
$_
[
0
]
->
{
'status'
};
}
sub
status
{
return
$_
[
0
]
->
{
'status'
};
}
sub
setter_id
{
return
$_
[
0
]
->
{
'setter_id'
};
}
sub
setter_id
{
return
$_
[
0
]
->
{
'setter_id'
};
}
sub
requestee_id
{
return
$_
[
0
]
->
{
'requestee_id'
};
}
sub
requestee_id
{
return
$_
[
0
]
->
{
'requestee_id'
};
}
sub
creation_date
{
return
$_
[
0
]
->
{
'creation_date'
};
}
sub
modification_date
{
return
$_
[
0
]
->
{
'modification_date'
};
}
###############################
###############################
#### Methods ####
#### Methods ####
...
@@ -414,10 +430,14 @@ Creates a flag record in the database.
...
@@ -414,10 +430,14 @@ Creates a flag record in the database.
sub
create
{
sub
create
{
my
(
$class
,
$flag
,
$timestamp
)
=
@_
;
my
(
$class
,
$flag
,
$timestamp
)
=
@_
;
$timestamp
||=
Bugzilla
->
dbh
->
selectrow_array
(
'SELECT
NOW(
)'
);
$timestamp
||=
Bugzilla
->
dbh
->
selectrow_array
(
'SELECT
LOCALTIMESTAMP(0
)'
);
my
$params
=
{};
my
$params
=
{};
my
@columns
=
grep
{
$_
ne
'id'
}
$class
->
_get_db_columns
;
my
@columns
=
grep
{
$_
ne
'id'
}
$class
->
_get_db_columns
;
# Some columns use date formatting so use alias instead
@columns
=
map
{
/\s+AS\s+(.*)$/
?
$1
:
$_
}
@columns
;
$params
->
{
$_
}
=
$flag
->
{
$_
}
foreach
@columns
;
$params
->
{
$_
}
=
$flag
->
{
$_
}
foreach
@columns
;
$params
->
{
creation_date
}
=
$params
->
{
modification_date
}
=
$timestamp
;
$params
->
{
creation_date
}
=
$params
->
{
modification_date
}
=
$timestamp
;
...
@@ -436,6 +456,7 @@ sub update {
...
@@ -436,6 +456,7 @@ sub update {
if
(
scalar
(
keys
%
$changes
))
{
if
(
scalar
(
keys
%
$changes
))
{
$dbh
->
do
(
'UPDATE flags SET modification_date = ? WHERE id = ?'
,
$dbh
->
do
(
'UPDATE flags SET modification_date = ? WHERE id = ?'
,
undef
,
(
$timestamp
,
$self
->
id
));
undef
,
(
$timestamp
,
$self
->
id
));
$self
->
{
'modification_date'
}
=
format_time
(
$timestamp
,
'%Y.%m.%d %T'
);
}
}
return
$changes
;
return
$changes
;
}
}
...
...
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