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

(-)a/C4/Suggestions.pm (+30 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
        suggesteddate
434
        managedby
435
        manageddate
436
        acceptedby
437
        accepteddate
438
        rejectedby
439
        rejecteddate
440
    ) ) {
441
        # Set the fields to NULL if not given.
442
        # Be careful, the following should *not* be //=
443
        $suggestion->{$field} ||= undef;
444
    }
445
431
    my $rs = Koha::Database->new->schema->resultset('Suggestion');
446
    my $rs = Koha::Database->new->schema->resultset('Suggestion');
432
    return $rs->create($suggestion)->id;
447
    return $rs->create($suggestion)->id;
433
}
448
}
Lines 456-461 sub ModSuggestion { Link Here
456
    };
471
    };
457
    $status_update_table = 0 if( $@ );
472
    $status_update_table = 0 if( $@ );
458
473
474
    for my $field ( qw(
475
        suggestedby
476
        suggesteddate
477
        managedby
478
        manageddate
479
        acceptedby
480
        accepteddate
481
        rejectedby
482
        rejecteddate
483
    ) ) {
484
        # Set the fields to NULL if not given.
485
        # Be careful, the following should *not* be //=
486
        $suggestion->{$field} ||= undef;
487
    }
488
459
    if ( $suggestion->{STATUS} ) {
489
    if ( $suggestion->{STATUS} ) {
460
490
461
        # fetch the entire updated suggestion so that we can populate the letter
491
        # 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