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

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

Return to bug 23463