Lines 28-33
use C4::Output;
Link Here
|
28 |
use C4::Dates qw(format_date format_date_in_iso); |
28 |
use C4::Dates qw(format_date format_date_in_iso); |
29 |
use C4::Debug; |
29 |
use C4::Debug; |
30 |
use C4::Letters; |
30 |
use C4::Letters; |
|
|
31 |
use Koha::DateUtils qw( dt_from_string ); |
32 |
|
31 |
use List::MoreUtils qw(any); |
33 |
use List::MoreUtils qw(any); |
32 |
use C4::Dates qw(format_date_in_iso); |
34 |
use C4::Dates qw(format_date_in_iso); |
33 |
use base qw(Exporter); |
35 |
use base qw(Exporter); |
Lines 428-433
sub NewSuggestion {
Link Here
|
428 |
|
430 |
|
429 |
$suggestion->{STATUS} = "ASKED" unless $suggestion->{STATUS}; |
431 |
$suggestion->{STATUS} = "ASKED" unless $suggestion->{STATUS}; |
430 |
|
432 |
|
|
|
433 |
for my $field ( qw( |
434 |
suggestedby |
435 |
managedby |
436 |
manageddate |
437 |
acceptedby |
438 |
accepteddate |
439 |
rejectedby |
440 |
rejecteddate |
441 |
) ) { |
442 |
# Set the fields to NULL if not given. |
443 |
$suggestion->{$field} ||= undef; |
444 |
} |
445 |
|
446 |
$suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate}; |
447 |
|
431 |
my $rs = Koha::Database->new->schema->resultset('Suggestion'); |
448 |
my $rs = Koha::Database->new->schema->resultset('Suggestion'); |
432 |
return $rs->create($suggestion)->id; |
449 |
return $rs->create($suggestion)->id; |
433 |
} |
450 |
} |
Lines 449-454
sub ModSuggestion {
Link Here
|
449 |
my ($suggestion) = @_; |
466 |
my ($suggestion) = @_; |
450 |
return unless( $suggestion and defined($suggestion->{suggestionid}) ); |
467 |
return unless( $suggestion and defined($suggestion->{suggestionid}) ); |
451 |
|
468 |
|
|
|
469 |
for my $field ( qw( |
470 |
suggestedby |
471 |
managedby |
472 |
manageddate |
473 |
acceptedby |
474 |
accepteddate |
475 |
rejectedby |
476 |
rejecteddate |
477 |
) ) { |
478 |
# Set the fields to NULL if not given. |
479 |
$suggestion->{$field} = undef |
480 |
if exists $suggestion->{$field} |
481 |
and ($suggestion->{$field} == '0' |
482 |
or $suggestion->{$field} == '' ); |
483 |
} |
484 |
|
452 |
my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid}); |
485 |
my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid}); |
453 |
my $status_update_table = 1; |
486 |
my $status_update_table = 1; |
454 |
eval { |
487 |
eval { |