Lines 34-53
use C4::Debug;
Link Here
|
34 |
|
34 |
|
35 |
sub Init{ |
35 |
sub Init{ |
36 |
my $suggestion= shift @_; |
36 |
my $suggestion= shift @_; |
37 |
foreach my $date ( qw(suggesteddate manageddate) ){ |
37 |
# "Managed by" is used only when a suggestion is being edited (not when created) |
38 |
$suggestion->{$date}=(($suggestion->{$date} eq "0000-00-00" ||$suggestion->{$date} eq "")? |
38 |
if ($suggestion->{'suggesteddate'} eq "0000-00-00" ||$suggestion->{'suggesteddate'} eq "") { |
39 |
$suggestion->{$date}=C4::Dates->today: |
39 |
# new suggestion |
40 |
format_date($suggestion->{$date}) |
40 |
$suggestion->{'suggesteddate'} = C4::Dates->today; |
41 |
); |
41 |
$suggestion->{'suggestedby'} = C4::Context->userenv->{"number"} unless ($suggestion->{'suggestedby'}); |
42 |
} |
42 |
} |
|
|
43 |
else { |
44 |
# editing of an existing suggestion |
45 |
$suggestion->{'manageddate'} = C4::Dates->today; |
46 |
warn $suggestion->{'manageddate'}; |
47 |
$suggestion->{'managedby'} = C4::Context->userenv->{"number"} unless ($suggestion->{'managedby'}); |
48 |
# suggesteddate, when coming from the DB, needs to be formated |
49 |
$suggestion->{'suggesteddate'} = format_date($suggestion->{'suggesteddate'}); |
50 |
} |
43 |
foreach my $date ( qw(rejecteddate accepteddate) ){ |
51 |
foreach my $date ( qw(rejecteddate accepteddate) ){ |
44 |
$suggestion->{$date}=(($suggestion->{$date} eq "0000-00-00" ||$suggestion->{$date} eq "")? |
52 |
$suggestion->{$date}=(($suggestion->{$date} eq "0000-00-00" ||$suggestion->{$date} eq "")? |
45 |
"": |
53 |
"": |
46 |
format_date($suggestion->{$date}) |
54 |
format_date($suggestion->{$date}) |
47 |
); |
55 |
); |
48 |
} |
56 |
} |
49 |
$suggestion->{'managedby'}=C4::Context->userenv->{"number"} unless ($suggestion->{'managedby'}); |
|
|
50 |
$suggestion->{'createdby'}=C4::Context->userenv->{"number"} unless ($suggestion->{'createdby'}); |
51 |
$suggestion->{'branchcode'}=C4::Context->userenv->{"branch"} unless ($suggestion->{'branchcode'}); |
57 |
$suggestion->{'branchcode'}=C4::Context->userenv->{"branch"} unless ($suggestion->{'branchcode'}); |
52 |
} |
58 |
} |
53 |
|
59 |
|
54 |
- |
|
|