|
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 unless $suggestion->{$field}; |
| 480 |
} |
| 481 |
|
| 452 |
my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid}); |
482 |
my $rs = Koha::Database->new->schema->resultset('Suggestion')->find($suggestion->{suggestionid}); |
| 453 |
my $status_update_table = 1; |
483 |
my $status_update_table = 1; |
| 454 |
eval { |
484 |
eval { |