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

(-)a/C4/Items.pm (-3 / +16 lines)
Lines 537-550 sub ModItem { Link Here
537
537
538
    $item->{onloan} = undef if $item->{itemlost};
538
    $item->{onloan} = undef if $item->{itemlost};
539
539
540
541
    my @fields = qw( itemlost wthdrawn );
542
543
    # Only call GetItem if we need to set an "on" date field
540
    if ( $item->{itemlost} || $item->{wthdrawn} ) {
544
    if ( $item->{itemlost} || $item->{wthdrawn} ) {
541
        my $pre_mod_item = GetItem( $item->{'itemnumber'} );
545
        my $pre_mod_item = GetItem( $item->{'itemnumber'} );
542
        for my $field (qw( itemlost wthdrawn )) {
546
        for my $field (@fields) {
543
            if ( defined( $item->{$field} ) ) {
547
            if ( defined( $item->{$field} ) ) {
544
                unless ( $pre_mod_item->{$field} ) {
548
                unless ( $pre_mod_item->{$field} ) {
545
                    if ( $item->{$field} ) {
549
                    if ( $item->{$field} ) {
546
                        $item->{ $field . '_on' } =
550
                        $item->{ $field . '_on' } =
547
                          DateTime::Format::MySQL->format_datetime( dt_from_string() );
551
                          DateTime::Format::MySQL->format_datetime(
552
                            dt_from_string() );
548
                    }
553
                    }
549
                }
554
                }
550
            }
555
            }
Lines 554-559 sub ModItem { Link Here
554
        }
559
        }
555
    }
560
    }
556
561
562
    # If the field is defined but empty, we are removing and,
563
    # and thus need to clear out the 'on' field as well
564
    for my $field (@fields) {
565
        if ( defined( $item->{$field} ) && !$item->{$field} ) {
566
            $item->{ $field . '_on' } = undef;
567
        }
568
    }
569
570
557
    _set_derived_columns_for_mod($item);
571
    _set_derived_columns_for_mod($item);
558
    _do_column_fixes_for_mod($item);
572
    _do_column_fixes_for_mod($item);
559
    # FIXME add checks
573
    # FIXME add checks
560
- 

Return to bug 9673