View | Details | Raw Unified | Return to bug 12627
Collapse All | Expand All

(-)a/C4/Suggestions.pm (+28 lines)
Lines 428-433 sub NewSuggestion { Link Here
428
428
429
    $suggestion->{STATUS} = "ASKED" unless $suggestion->{STATUS};
429
    $suggestion->{STATUS} = "ASKED" unless $suggestion->{STATUS};
430
430
431
    for my $field ( qw(
432
        suggestedby
433
        managedby
434
        manageddate
435
        acceptedby
436
        accepteddate
437
        rejectedby
438
        rejecteddate
439
    ) ) {
440
        # Set the fields to NULL if not given.
441
        # Be careful, the following should *not* be //=
442
        $suggestion->{$field} ||= undef;
443
    }
444
431
    my $rs = Koha::Database->new->schema->resultset('Suggestion');
445
    my $rs = Koha::Database->new->schema->resultset('Suggestion');
432
    return $rs->create($suggestion)->id;
446
    return $rs->create($suggestion)->id;
433
}
447
}
Lines 456-461 sub ModSuggestion { Link Here
456
    };
470
    };
457
    $status_update_table = 0 if( $@ );
471
    $status_update_table = 0 if( $@ );
458
472
473
    for my $field ( qw(
474
        suggestedby
475
        managedby
476
        manageddate
477
        acceptedby
478
        accepteddate
479
        rejectedby
480
        rejecteddate
481
    ) ) {
482
        # Set the fields to NULL if not given.
483
        # Be careful, the following should *not* be //=
484
        $suggestion->{$field} ||= undef;
485
    }
486
459
    if ( $suggestion->{STATUS} ) {
487
    if ( $suggestion->{STATUS} ) {
460
488
461
        # fetch the entire updated suggestion so that we can populate the letter
489
        # fetch the entire updated suggestion so that we can populate the letter
(-)a/suggestion/suggestion.pl (-2 / +4 lines)
Lines 124-130 $template->param('borrowernumber' => $borrowernumber); Link Here
124
##  Operations
124
##  Operations
125
##
125
##
126
if ( $op =~ /save/i ) {
126
if ( $op =~ /save/i ) {
127
        if ( $suggestion_only->{"STATUS"} ) {
127
    $suggestion_only->{suggesteddate} = dt_from_string( $suggestion_only->{suggesteddate} )
128
        if $suggestion_only->{suggesteddate};
129
130
    if ( $suggestion_only->{"STATUS"} ) {
128
        if ( my $tmpstatus = lc( $suggestion_only->{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) {
131
        if ( my $tmpstatus = lc( $suggestion_only->{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) {
129
            $suggestion_only->{ lc( $suggestion_only->{"STATUS"}) . "date" } = dt_from_string;
132
            $suggestion_only->{ lc( $suggestion_only->{"STATUS"}) . "date" } = dt_from_string;
130
            $suggestion_only->{ lc( $suggestion_only->{"STATUS"}) . "by" }   = C4::Context->userenv->{number};
133
            $suggestion_only->{ lc( $suggestion_only->{"STATUS"}) . "by" }   = C4::Context->userenv->{number};
131
- 

Return to bug 12627