line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::bif::update::project; |
2
|
1
|
|
|
1
|
|
5569
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
5
|
use Bif::Mo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
5
|
1
|
|
|
1
|
|
666
|
use DBIx::ThinSQL qw/sq qv/; |
|
1
|
|
|
|
|
27121
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
708
|
use IO::Prompt::Tiny qw/prompt/; |
|
1
|
|
|
|
|
590
|
|
|
1
|
|
|
|
|
351
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.1.5_5'; |
9
|
|
|
|
|
|
|
extends 'App::bif'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub run { |
12
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
13
|
1
|
|
|
|
|
4
|
my $opts = $self->opts; |
14
|
1
|
|
|
|
|
6
|
my $dbw = $self->dbw; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$dbw->txn( |
17
|
|
|
|
|
|
|
sub { |
18
|
|
|
|
|
|
|
my $info = |
19
|
0
|
0
|
|
0
|
|
|
$self->get_project( $opts->{id} ? $opts->{id} : $opts->{path} ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$self->start_work( |
22
|
|
|
|
|
|
|
node_id => $info->{id}, |
23
|
0
|
|
|
|
|
|
start => time, |
24
|
|
|
|
|
|
|
start_comment => "update project", |
25
|
|
|
|
|
|
|
billable => 1, |
26
|
|
|
|
|
|
|
save => 1, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my ( $status_ids, $invalid ); |
30
|
0
|
0
|
|
|
|
|
if ( $opts->{status} ) { |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
( $status_ids, $invalid ) = |
33
|
0
|
|
|
|
|
|
$dbw->status_ids( $info->{id}, 'project', $opts->{status} ); |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
return $self->err( 'InvalidStatus', |
36
|
|
|
|
|
|
|
'unknown status(s): ' . join( ', ', @$invalid ) ) |
37
|
|
|
|
|
|
|
if @$invalid; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
0
|
|
|
|
|
if ( $opts->{reply} ) { |
41
|
|
|
|
|
|
|
my $uinfo = |
42
|
0
|
|
|
|
|
|
$self->get_change( $opts->{reply}, $info->{first_change_id} ); |
43
|
0
|
|
|
|
|
|
$opts->{parent_uid} = $uinfo->{id}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else { |
46
|
0
|
|
|
|
|
|
$opts->{parent_uid} = $info->{first_change_id}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$opts->{message} ||= |
50
|
0
|
|
0
|
|
|
|
$self->prompt_edit( opts => $self, id => $info->{id} ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$opts->{change_id} = |
53
|
0
|
|
|
|
|
|
$self->new_change( parent_id => $opts->{parent_uid}, ); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$dbw->xdo( |
56
|
|
|
|
|
|
|
insert_into => 'func_update_project', |
57
|
|
|
|
|
|
|
values => { |
58
|
|
|
|
|
|
|
id => $info->{id}, |
59
|
|
|
|
|
|
|
change_id => $opts->{change_id}, |
60
|
|
|
|
|
|
|
title => $opts->{title}, |
61
|
0
|
|
|
|
|
|
project_status_id => $status_ids->[0], |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$self->stop_work( |
66
|
|
|
|
|
|
|
stop => time, |
67
|
|
|
|
|
|
|
restore => 1, |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$self->save_work( |
71
|
|
|
|
|
|
|
node_id => $info->{id}, |
72
|
|
|
|
|
|
|
change_id => $opts->{change_id}, |
73
|
0
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
$self->end_change( |
76
|
|
|
|
|
|
|
id => $opts->{change_id}, |
77
|
|
|
|
|
|
|
action_format => "update project $info->{path} (%s)", |
78
|
|
|
|
|
|
|
action_node_id_1 => $info->{id}, |
79
|
|
|
|
|
|
|
message => $opts->{message}, |
80
|
0
|
|
|
|
|
|
); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
0
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return $self->ok('ChangeProject'); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
__END__ |