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

(-)a/C4/Suggestions.pm (-32 lines)
Lines 435-454 Insert a new suggestion on database with value given on input arg. Link Here
435
sub NewSuggestion {
435
sub NewSuggestion {
436
    my ($suggestion) = @_;
436
    my ($suggestion) = @_;
437
437
438
    for my $field ( qw(
439
        suggestedby
440
        managedby
441
        manageddate
442
        acceptedby
443
        accepteddate
444
        rejectedby
445
        rejecteddate
446
        budgetid
447
    ) ) {
448
        # Set the fields to NULL if not given.
449
        $suggestion->{$field} ||= undef;
450
    }
451
452
    $suggestion->{STATUS} = "ASKED" unless $suggestion->{STATUS};
438
    $suggestion->{STATUS} = "ASKED" unless $suggestion->{STATUS};
453
439
454
    $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate};
440
    $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate};
Lines 524-546 sub ModSuggestion { Link Here
524
    my ($suggestion) = @_;
510
    my ($suggestion) = @_;
525
    return unless( $suggestion and defined($suggestion->{suggestionid}) );
511
    return unless( $suggestion and defined($suggestion->{suggestionid}) );
526
512
527
    for my $field ( qw(
528
        suggestedby
529
        managedby
530
        manageddate
531
        acceptedby
532
        accepteddate
533
        rejectedby
534
        rejecteddate
535
        budgetid
536
    ) ) {
537
        # Set the fields to NULL if not given.
538
        $suggestion->{$field} = undef
539
          if exists $suggestion->{$field}
540
          and ($suggestion->{$field} eq '0'
541
            or $suggestion->{$field} eq '' );
542
    }
543
544
    my $suggestion_object = Koha::Suggestions->find( $suggestion->{suggestionid} );
513
    my $suggestion_object = Koha::Suggestions->find( $suggestion->{suggestionid} );
545
    eval { # FIXME Must raise an exception instead
514
    eval { # FIXME Must raise an exception instead
546
        $suggestion_object->set($suggestion)->store;
515
        $suggestion_object->set($suggestion)->store;
547
- 

Return to bug 22907