Bugzilla – Attachment 45931 Details for
Bug 15295
Move the C4::Branch related code to Koha::Libraries - part 2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15295! Koha::Libraries - Remove ModBranchCategoryInfo
Bug-15295-KohaLibraries---Remove-ModBranchCategory.patch (text/plain), 3.81 KB, created by
Martin Renvoize (ashimema)
on 2015-12-23 05:16:26 UTC
(
hide
)
Description:
Bug 15295! Koha::Libraries - Remove ModBranchCategoryInfo
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2015-12-23 05:16:26 UTC
Size:
3.81 KB
patch
obsolete
>From 83a40eaf1848ce5dca4879a7ae8fc319b6ecaba7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 3 Dec 2015 15:02:35 +0000 >Subject: [PATCH] Bug 15295! Koha::Libraries - Remove ModBranchCategoryInfo > >This has been replaced with Koha::Library->update_categories and >Koha::Library->add_to_categories > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >http://bugs.koha-community.org/show_bug.cgi?id=15294 >--- > C4/Branch.pm | 22 ---------------------- > t/db_dependent/Branch.t | 20 +++++--------------- > 2 files changed, 5 insertions(+), 37 deletions(-) > >diff --git a/C4/Branch.pm b/C4/Branch.pm >index c4e4cc1..7e8b187 100644 >--- a/C4/Branch.pm >+++ b/C4/Branch.pm >@@ -38,7 +38,6 @@ BEGIN { > &ModBranch > &GetBranchInfo > &GetBranchesInCategory >- &ModBranchCategoryInfo > &mybranch > ); > @EXPORT_OK = qw( &onlymine &mybranch ); >@@ -381,27 +380,6 @@ sub GetBranchInfo { > return \@results; > } > >-=head2 ModBranchCategoryInfo >- >-&ModBranchCategoryInfo($data); >-sets the data from the editbranch form, and writes to the database... >- >-=cut >- >-sub ModBranchCategoryInfo { >- my ($data) = @_; >- my $dbh = C4::Context->dbh; >- if ($data->{'add'}){ >- # we are doing an insert >- my $sth = $dbh->prepare("INSERT INTO branchcategories (categorycode,categoryname,codedescription,categorytype,show_in_pulldown) VALUES (?,?,?,?,?)"); >- $sth->execute(uc( $data->{'categorycode'} ),$data->{'categoryname'}, $data->{'codedescription'},$data->{'categorytype'},$data->{'show_in_pulldown'} ); >- } >- else { >- # modifying >- my $sth = $dbh->prepare("UPDATE branchcategories SET categoryname=?,codedescription=?,categorytype=?,show_in_pulldown=? WHERE categorycode=?"); >- $sth->execute($data->{'categoryname'}, $data->{'codedescription'},$data->{'categorytype'},$data->{'show_in_pulldown'},uc( $data->{'categorycode'} ) ); >- } >-} > 1; > __END__ > >diff --git a/t/db_dependent/Branch.t b/t/db_dependent/Branch.t >index 791f545..9076a2d 100644 >--- a/t/db_dependent/Branch.t >+++ b/t/db_dependent/Branch.t >@@ -43,7 +43,6 @@ can_ok( > ModBranch > GetBranchInfo > GetBranchesInCategory >- ModBranchCategoryInfo > mybranch > ) > ); >@@ -166,7 +165,6 @@ is_deeply( $branchdetail, $b1 , "GetBranchDetail gives the details of BRA"); > my $count_cat = Koha::LibraryCategories->search->count; > > my $cat1 = { >- add => 1, > categorycode => 'CAT1', > categoryname => 'catname1', > codedescription => 'catdesc1', >@@ -174,7 +172,6 @@ my $cat1 = { > show_in_pulldown => 1 > }; > my $cat2 = { >- add => 1, > categorycode => 'CAT2', > categoryname => 'catname2', > categorytype => 'catype2', >@@ -190,19 +187,12 @@ my %new_category = ( > show_in_pulldown => 1, > ); > >-ModBranchCategoryInfo({ >- add => 1, >- %new_category, >-}); >- >-ModBranchCategoryInfo($cat1); >-ModBranchCategoryInfo($cat2); >+Koha::LibraryCategory->new(\%new_category)->store; >+Koha::LibraryCategory->new($cat1)->store; >+Koha::LibraryCategory->new($cat2)->store; > > my $categories = Koha::LibraryCategories->search; > is( $categories->count, $count_cat + 3, "Two categories added" ); >-delete $cat1->{add}; >-delete $cat2->{add}; >-delete $new_category{add}; > > my $del = Koha::LibraryCategories->find( $cat2->{categorycode} )->delete; > is( $del, 1, 'One row affected' ); >@@ -226,8 +216,8 @@ $b2->{issuing} = undef; > $b2->{categories} = \@cat; > is_deeply( @$b2info[0], $b2, 'BRB has the category CAT1' ); > >-ModBranchCategoryInfo({add => 1,%$cat2}); >-is( Koha::LibraryCategories->search->count, $count_cat + 3, "Two catgories added" ); >+Koha::LibraryCategory->new($cat2)->store; >+is( Koha::LibraryCategories->search->count, $count_cat + 3, "Two categories added" ); > $b2 = { > branchcode => 'BRB', > branchname => 'BranchB', >-- >2.1.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 15295
:
45368
|
45369
|
45370
|
45371
|
45372
|
45373
|
45374
|
45375
|
45752
|
45754
|
45755
|
45756
|
45757
|
45760
|
45763
|
45764
|
45765
|
45924
|
45925
|
45926
|
45927
|
45928
|
45929
|
45930
| 45931 |
46684
|
46696