Bugzilla – Attachment 42202 Details for
Bug 14544
Move the list related code to Koha::Virtualshelves
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14544: Get rid of DelShelf
Bug-14544-Get-rid-of-DelShelf.patch (text/plain), 4.42 KB, created by
Alex Arnaud
on 2015-09-02 12:34:56 UTC
(
hide
)
Description:
Bug 14544: Get rid of DelShelf
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2015-09-02 12:34:56 UTC
Size:
4.42 KB
patch
obsolete
>From ff535eb14459f296824024aea116b00b958a8db8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 15 Jul 2015 17:16:34 +0100 >Subject: [PATCH] Bug 14544: Get rid of DelShelf > >Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> >--- > C4/VirtualShelves.pm | 24 +++--------------------- > C4/VirtualShelves/Page.pm | 2 +- > t/db_dependent/VirtualShelves.t | 6 +++--- > t/db_dependent/Virtualshelves.t | 7 ++++++- > 4 files changed, 13 insertions(+), 26 deletions(-) > >diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm >index 0f5e900..e7201f0 100644 >--- a/C4/VirtualShelves.pm >+++ b/C4/VirtualShelves.pm >@@ -44,7 +44,7 @@ BEGIN { > &AddToShelf > &ModShelf > &ShelfPossibleAction >- &DelFromShelf &DelShelf >+ &DelFromShelf > &GetBibliosShelves > &AddShare &AcceptShare &RemoveShare &IsSharedList > ); >@@ -508,24 +508,6 @@ sub DelFromShelf { > return $t; > } > >-=head2 DelShelf >- >- $Number = DelShelf($shelfnumber); >- >-This function deletes the shelf number, and all of it's content. >-Authorization to do so MUST have been checked before calling, while using >-ShelfPossibleAction with manage parameter. >- >-=cut >- >-sub DelShelf { >- my ($shelfnumber)= @_; >- return unless $shelfnumber && $shelfnumber =~ /^\d+$/; >- my $dbh = C4::Context->dbh; >- my $sth = $dbh->prepare("DELETE FROM virtualshelves WHERE shelfnumber=?"); >- return $sth->execute($shelfnumber); >-} >- > =head2 GetBibliosShelves > > This finds all the public lists that this bib record is in. >@@ -596,8 +578,8 @@ sub HandleDelBorrower { > #Instead of deleting we could also disown lists (based on a pref). > #In that way we could save shared and public lists. > #The current table constraints support that idea now. >- #This pref should then govern the results of other routines such as >- #DelShelf too. >+ #This pref should then govern the results of other routines/methods such as >+ #Koha::Virtualshelf->new->delete too. > } > > =head2 AddShare >diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm >index 9e3b39d..8d7bb5f 100644 >--- a/C4/VirtualShelves/Page.pm >+++ b/C4/VirtualShelves/Page.pm >@@ -418,7 +418,7 @@ sub shelfpage { > $name = $shelflist->{$number}->{'shelfname'}; > delete $shelflist->{$number}; > } >- unless ( DelShelf($number) ) { >+ unless( Koha::Virtualshelves->find($number)->delete ) { > push( @paramsloop, { delete_fail => $name } ); > last; > } >diff --git a/t/db_dependent/VirtualShelves.t b/t/db_dependent/VirtualShelves.t >index 07933c5..f4dc31d 100755 >--- a/t/db_dependent/VirtualShelves.t >+++ b/t/db_dependent/VirtualShelves.t >@@ -173,15 +173,15 @@ for my $i (0..9) { > is(IsSharedList($sh),$n? 1: '', "Checked IsSharedList for shelf $sh"); > } > >-#----------------TEST DelShelf & DelFromShelf functions------------------------# >+#----------------TEST Koha::Virtualshelf->delete & DelFromShelf functions------------------------# > > for my $i (0..9){ > my $shelfnumber = $shelves[$i]->{number}; > if($shelfnumber<0) { >- ok(1, 'Skip DelShelf for shelf -1'); >+ ok(1, 'Skip Koha::Virtualshelf->delete for shelf -1'); > next; > } >- my $status = DelShelf($shelfnumber); >+ my $status = Koha::Virtualshelves->find($shelfnumber)->delete; > is($status, 1, "deleted shelf $shelfnumber and its contents"); > } > >diff --git a/t/db_dependent/Virtualshelves.t b/t/db_dependent/Virtualshelves.t >index bfd2dc0..407011f 100644 >--- a/t/db_dependent/Virtualshelves.t >+++ b/t/db_dependent/Virtualshelves.t >@@ -18,7 +18,7 @@ $dbh->do(q|DELETE FROM virtualshelves|); > my $builder = t::lib::TestBuilder->new; > > subtest 'CRUD' => sub { >- plan tests => 11; >+ plan tests => 13; > my $patron = $builder->build({ > source => 'Borrower', > }); >@@ -72,4 +72,9 @@ subtest 'CRUD' => sub { > )->store; > $number_of_shelves = Koha::Virtualshelves->search->count; > is( $number_of_shelves, 2, 'Another patron should be able to create a shelf with an existing shelfname'); >+ >+ my $is_deleted = Koha::Virtualshelves->find( $shelf->shelfnumber )->delete; >+ is( $is_deleted, 1, 'The shelf has been deleted correctly' ); >+ $number_of_shelves = Koha::Virtualshelves->search->count; >+ is( $number_of_shelves, 1, 'To be sure the shelf has been deleted' ); > }; >-- >1.7.10.4
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 14544
:
41034
|
41035
|
41036
|
41037
|
41038
|
41039
|
41040
|
41041
|
41042
|
41403
|
41404
|
41405
|
41406
|
41407
|
41408
|
41409
|
41410
|
41411
|
41412
|
41584
|
41585
|
41586
|
41587
|
41588
|
41589
|
41590
|
41591
|
41592
|
41593
|
41594
|
41595
|
41596
|
41597
|
41598
|
41599
|
41600
|
41601
|
41716
|
41717
|
41718
|
41719
|
41720
|
41721
|
41722
|
41723
|
41724
|
41725
|
41726
|
41727
|
41728
|
41729
|
41730
|
41731
|
41732
|
41733
|
41766
|
41909
|
41910
|
41913
|
41914
|
41915
|
41917
|
41918
|
41919
|
41924
|
41927
|
41931
|
41932
|
41953
|
41954
|
41955
|
41956
|
41957
|
41958
|
41959
|
41960
|
41961
|
41962
|
41963
|
41964
|
41965
|
41966
|
41967
|
41968
|
41969
|
41970
|
41973
|
41974
|
41975
|
41976
|
41977
|
41978
|
41979
|
41980
|
41981
|
41982
|
41983
|
41986
|
41988
|
42192
|
42199
|
42200
|
42201
|
42202
|
42203
|
42204
|
42205
|
42206
|
42207
|
42208
|
42209
|
42210
|
42211
|
42212
|
42213
|
42214
|
42215
|
42216
|
42217
|
42218
|
42219
|
42638
|
43223
|
43224
|
43225
|
43226
|
43227
|
43228
|
43229
|
43230
|
43231
|
43232
|
43233
|
43234
|
43235
|
43236
|
43237
|
43238
|
43239
|
43240
|
43241
|
43242
|
43243
|
43296
|
43334
|
43335
|
43403
|
43456
|
43457
|
43458
|
43459
|
43460
|
43461
|
43462
|
43463
|
43464
|
43465
|
43466
|
43467
|
43469
|
43470
|
43471
|
43472
|
43473
|
43474
|
43475
|
43476
|
43477
|
43478
|
43479
|
43480
|
43481
|
43482
|
43485
|
43486
|
43487
|
44467
|
44468
|
44469
|
44470
|
44471
|
44472
|
44473
|
44474
|
44475
|
44476
|
44477
|
44478
|
44479
|
44480
|
44481
|
44482
|
44483
|
44484
|
44485
|
44486
|
44487
|
44758
|
44845
|
44852
|
44863
|
44872