Bug 10033 - dangerous query in _koha_modify_item
The SQL query build in C4::Items::_koha_modify_item performs an update on a row of items table identified by itemnumber.
Actually the query is build using a hash of datas :
for my $key ( keys %$item ) {
$query.="$key=?,";
push @bind, $item->{$key};
}
But this hash contains 'itemnumber' key, so you get an update including the primary key.
It is actually harmless but may be dangerous.
This patch simply skips itemnumber key in above loop.
Test plan :
Check you can create and modify items.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 598dfe2722)
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit ba8e383cf6)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
This commit is contained in:
parent
700af3fb21
commit
60465fc463
|
|
@ -2254,6 +2254,7 @@ sub _koha_modify_item {
|
|||
my $query = "UPDATE items SET ";
|
||||
my @bind;
|
||||
for my $key ( keys %$item ) {
|
||||
next if ( $key eq 'itemnumber' );
|
||||
$query.="$key=?,";
|
||||
push @bind, $item->{$key};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue