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

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

Return to bug 23463