Bugzilla – Attachment 30053 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 - Remove $dbh
Bug-12583-DelItem-prototype---Remove-dbh.patch (text/plain), 3.01 KB, created by
Chris Cormack
on 2014-07-25 00:43:42 UTC
(
hide
)
Description:
Bug 12583: DelItem prototype - Remove $dbh
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2014-07-25 00:43:42 UTC
Size:
3.01 KB
patch
obsolete
>From e5ad0ad2fbb76d6da7f80400550dbbb77e065257 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 16 Jul 2014 13:39:07 +0200 >Subject: [PATCH] Bug 12583: DelItem prototype - Remove $dbh > >Since C4::Context->dbh shares the DB handler, it's useless to pass it to >routines. > >Test plan: >Try to remove an item from the Koha interface. >Verify that unit tests pass. > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > C4/Acquisition.pm | 2 +- > C4/Items.pm | 16 ++++++++-------- > t/db_dependent/Items.t | 2 +- > 3 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 7904cbe..1a48926 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1861,7 +1861,7 @@ sub DelOrder { > $sth->execute( $bibnum, $ordernumber ); > my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); > foreach my $itemnumber (@itemnumbers){ >- C4::Items::DelItem( $dbh, $bibnum, $itemnumber ); >+ C4::Items::DelItem( $bibnum, $itemnumber ); > } > return; > } >diff --git a/C4/Items.pm b/C4/Items.pm >index 6ab04e3..f644c75 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -632,18 +632,17 @@ sub ModDateLastSeen { > > =head2 DelItem > >- DelItem($dbh, $biblionumber, $itemnumber); >+ DelItem( $biblionumber, $itemnumber ); > > Exported function (core API) for deleting an item record in Koha. > > =cut > > sub DelItem { >- my ( $dbh, $biblionumber, $itemnumber ) = @_; >- >+ my ( $biblionumber, $itemnumber ) = @_; >+ > # FIXME check the item has no current issues >- >- _koha_delete_item( $dbh, $itemnumber ); >+ _koha_delete_item( $itemnumber ); > > # get the MARC record > my $record = GetMarcBiblio($biblionumber); >@@ -2288,7 +2287,7 @@ sub DelItemCheck { > } elsif ($countanalytics > 0){ > $error = "linked_analytics"; > } else { >- DelItem($dbh, $biblionumber, $itemnumber); >+ DelItem($biblionumber, $itemnumber); > return 1; > } > } >@@ -2330,15 +2329,16 @@ sub _koha_modify_item { > > =head2 _koha_delete_item > >- _koha_delete_item( $dbh, $itemnum ); >+ _koha_delete_item( $itemnum ); > > Internal function to delete an item record from the koha tables > > =cut > > sub _koha_delete_item { >- my ( $dbh, $itemnum ) = @_; >+ my ( $itemnum ) = @_; > >+ my $dbh = C4::Context->dbh; > # save the deleted item to deleteditems table > my $sth = $dbh->prepare("SELECT * FROM items WHERE itemnumber=?"); > $sth->execute($itemnum); >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index f5561fc..7afdbec 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($dbh, $bibnum, $itemnumber); >+ DelItem($bibnum, $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