Bug 12627: Fix date management
C4::Dates->today returns a string formatted depending on the dateformat syspref. Before the original patch, SQLHelper managed both format (string formatted and DateTime. Now DBIX::Class only manages DateTime, so the call to NewSuggestion and ModSuggestion should pass a DateTime object Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
81ff0a449d
commit
8dfc4326e8
|
|
@ -29,6 +29,8 @@ use C4::Koha;
|
|||
use C4::Dates;
|
||||
use C4::Scrubber;
|
||||
|
||||
use Koha::DateUtils qw( dt_from_string );
|
||||
|
||||
my $input = new CGI;
|
||||
my $allsuggestions = $input->param('showall');
|
||||
my $op = $input->param('op');
|
||||
|
|
@ -91,7 +93,7 @@ if ( $op eq "add_confirm" ) {
|
|||
foreach my $suggest (keys %$suggestion){
|
||||
$suggestion->{$suggest} = $scrubber->scrub($suggestion->{$suggest});
|
||||
}
|
||||
$$suggestion{'suggesteddate'}=C4::Dates->today;
|
||||
$suggestion->{suggesteddate} = dt_from_string;
|
||||
$$suggestion{'branchcode'}= $input->param('branch') || C4::Context->userenv->{"branch"};
|
||||
|
||||
&NewSuggestion($suggestion);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ use C4::Search;
|
|||
use C4::Dates qw(format_date);
|
||||
use C4::Members;
|
||||
use C4::Debug;
|
||||
|
||||
use Koha::DateUtils qw( dt_from_string );
|
||||
|
||||
use URI::Escape;
|
||||
|
||||
sub Init{
|
||||
|
|
@ -123,10 +126,10 @@ $template->param('borrowernumber' => $borrowernumber);
|
|||
if ( $op =~ /save/i ) {
|
||||
if ( $suggestion_only->{"STATUS"} ) {
|
||||
if ( my $tmpstatus = lc( $suggestion_only->{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) {
|
||||
$suggestion_only->{ lc( $suggestion_only->{"STATUS"}) . "date" } = C4::Dates->today;
|
||||
$suggestion_only->{ lc( $suggestion_only->{"STATUS"}) . "date" } = dt_from_string;
|
||||
$suggestion_only->{ lc( $suggestion_only->{"STATUS"}) . "by" } = C4::Context->userenv->{number};
|
||||
}
|
||||
$suggestion_only->{"manageddate"} = C4::Dates->today;
|
||||
$suggestion_only->{manageddate} = dt_from_string;
|
||||
$suggestion_only->{"managedby"} = C4::Context->userenv->{number};
|
||||
}
|
||||
if ( $suggestion_only->{'suggestionid'} > 0 ) {
|
||||
|
|
@ -167,14 +170,14 @@ elsif ($op eq "change" ) {
|
|||
# set accepted/rejected/managed informations if applicable
|
||||
# ie= if the librarian has choosen some action on the suggestions
|
||||
if ($suggestion_only->{"STATUS"} eq "ACCEPTED"){
|
||||
$suggestion_only->{"accepteddate"}=C4::Dates->today;
|
||||
$suggestion_only->{accepteddate} = dt_from_string;
|
||||
$suggestion_only->{"acceptedby"}=C4::Context->userenv->{number};
|
||||
} elsif ($suggestion_only->{"STATUS"} eq "REJECTED"){
|
||||
$suggestion_only->{"rejecteddate"}=C4::Dates->today;
|
||||
$suggestion_only->{rejecteddate} = dt_from_string;
|
||||
$suggestion_only->{"rejectedby"}=C4::Context->userenv->{number};
|
||||
}
|
||||
if ($suggestion_only->{"STATUS"}){
|
||||
$suggestion_only->{"manageddate"}=C4::Dates->today;
|
||||
$suggestion_only->{manageddate} = dt_from_string;
|
||||
$suggestion_only->{"managedby"}=C4::Context->userenv->{number};
|
||||
}
|
||||
if ( my $reason = $$suggestion_ref{"reason$tabcode"}){
|
||||
|
|
|
|||
Loading…
Reference in New Issue