Bugzilla – Attachment 30054 Details for
Bug 12583
DelItem takes $dbh in parameter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12583: DelItem prototype - prefer hashref
Bug-12583-DelItem-prototype---prefer-hashref.patch (text/plain), 2.89 KB, created by
Chris Cormack
on 2014-07-25 00:43:55 UTC
(
hide
)
Description:
Bug 12583: DelItem prototype - prefer hashref
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2014-07-25 00:43:55 UTC
Size:
2.89 KB
patch
obsolete
>From bd13981c8ab35b73ffb6ecec23203d2af230a294 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 16 Jul 2014 13:44:39 +0200 >Subject: [PATCH] Bug 12583: DelItem prototype - prefer hashref > >To delete an item, only the itemnumber should be mandatory. The DelItem >routine can retrieve the biblionumber from the itemnumber. > >Test plan: >Verify that t/db_dependent/Items/DelItem.t passes > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > C4/Acquisition.pm | 7 ++++++- > C4/Items.pm | 18 +++++++++++++++--- > t/db_dependent/Items.t | 2 +- > 3 files changed, 22 insertions(+), 5 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 1a48926..0d1745c 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1861,7 +1861,12 @@ sub DelOrder { > $sth->execute( $bibnum, $ordernumber ); > my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); > foreach my $itemnumber (@itemnumbers){ >- C4::Items::DelItem( $bibnum, $itemnumber ); >+ C4::Items::DelItem( >+ { >+ biblionumber => $bibnum, >+ itemnumber => $itemnumber >+ } >+ ); > } > return; > } >diff --git a/C4/Items.pm b/C4/Items.pm >index f644c75..4aaa078 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -632,14 +632,21 @@ sub ModDateLastSeen { > > =head2 DelItem > >- DelItem( $biblionumber, $itemnumber ); >+ DelItem({ itemnumber => $itemnumber, [ biblionumber => $biblionumber ] } ); > > Exported function (core API) for deleting an item record in Koha. > > =cut > > sub DelItem { >- my ( $biblionumber, $itemnumber ) = @_; >+ my ( $params ) = @_; >+ >+ my $itemnumber = $params->{itemnumber}; >+ my $biblionumber = $params->{biblionumber}; >+ >+ unless ($biblionumber) { >+ $biblionumber = C4::Biblio::GetBiblionumberFromItemnumber($itemnumber); >+ } > > # FIXME check the item has no current issues > _koha_delete_item( $itemnumber ); >@@ -2287,7 +2294,12 @@ sub DelItemCheck { > } elsif ($countanalytics > 0){ > $error = "linked_analytics"; > } else { >- DelItem($biblionumber, $itemnumber); >+ DelItem( >+ { >+ biblionumber => $biblionumber, >+ itemnumber => $itemnumber >+ } >+ ); > return 1; > } > } >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 7afdbec..157db89 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -58,7 +58,7 @@ subtest 'General Add, Get and Del tests' => sub { > cmp_ok($moditem->{'barcode'}, '==', '987654321', 'Modified item barcode successfully to: '.$moditem->{'barcode'} . '.'); > > # Delete item. >- DelItem($bibnum, $itemnumber); >+ DelItem({ biblionumber => $bibnum, itemnumber => $itemnumber }); > my $getdeleted = GetItem($itemnumber); > is($getdeleted->{'itemnumber'}, undef, "Item deleted as expected."); > >-- >2.0.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12583
:
29746
|
29747
|
29748
|
30053
|
30054
|
30055
|
30110
|
30111
|
30112