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

(-)a/C4/Items.pm (-35 lines)
Lines 1551-1590 sub DelItemCheck { Link Here
1551
    return $status;
1551
    return $status;
1552
}
1552
}
1553
1553
1554
=head2 _koha_modify_item
1555
1556
  my ($itemnumber,$error) =_koha_modify_item( $item );
1557
1558
Perform the actual update of the C<items> row.  Note that this
1559
routine accepts a hashref specifying the columns to update.
1560
1561
=cut
1562
1563
sub _koha_modify_item {
1564
    my ( $item ) = @_;
1565
    my $dbh=C4::Context->dbh;  
1566
    my $error;
1567
1568
    my $query = "UPDATE items SET ";
1569
    my @bind;
1570
    _mod_item_dates( $item );
1571
    for my $key ( keys %$item ) {
1572
        next if ( $key eq 'itemnumber' );
1573
        $query.="$key=?,";
1574
        push @bind, $item->{$key};
1575
    }
1576
    $query =~ s/,$//;
1577
    $query .= " WHERE itemnumber=?";
1578
    push @bind, $item->{'itemnumber'};
1579
    my $sth = $dbh->prepare($query);
1580
    $sth->execute(@bind);
1581
    if ( $sth->err ) {
1582
        $error.="ERROR in _koha_modify_item $query: ".$sth->errstr;
1583
        warn $error;
1584
    }
1585
    return ($item->{'itemnumber'},$error);
1586
}
1587
1588
sub _mod_item_dates { # date formatting for date fields in item hash
1554
sub _mod_item_dates { # date formatting for date fields in item hash
1589
    my ( $item ) = @_;
1555
    my ( $item ) = @_;
1590
    return if !$item || ref($item) ne 'HASH';
1556
    return if !$item || ref($item) ne 'HASH';
1591
- 

Return to bug 23463