Bugzilla – Attachment 37673 Details for
Bug 10011
Branch limitiations are not saved on creating a new patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10011: Save branch limitations on creating a new patron category
Bug-10011-Save-branch-limitations-on-creating-a-ne.patch (text/plain), 2.76 KB, created by
Mark Tompsett
on 2015-04-11 05:27:34 UTC
(
hide
)
Description:
Bug 10011: Save branch limitations on creating a new patron category
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-04-11 05:27:34 UTC
Size:
2.76 KB
patch
obsolete
>From 9350d18ae0063b81d296016479ce0ed165e14735 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 10 Apr 2015 13:51:31 +0200 >Subject: [PATCH] Bug 10011: Save branch limitations on creating a new patron > category > >The code was just badly placed. >It should be executed on update but also on insert. > >Test plan: >1/ Create a new patron category and select 1+ branch limitations >2/ Confirm it's correctly saved >3/ Edit it and change the branch limitations >4/ Confirm it's correctly saved > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >NOTE: Not a C4 or Koha library, so tests not required. Though, > this code could be cleaned up and have the DB stuff put > into some sort of library with tests to prevent regression. > However, that dream is beyond the scope of this bug. >--- > admin/categorie.pl | 33 +++++++++++++++++---------------- > 1 file changed, 17 insertions(+), 16 deletions(-) > >diff --git a/admin/categorie.pl b/admin/categorie.pl >index bb0b72e..445645e 100755 >--- a/admin/categorie.pl >+++ b/admin/categorie.pl >@@ -207,22 +207,6 @@ elsif ( $op eq 'add_validate' ) { > 'categorycode' > ) > ); >- my @branches = $input->param("branches"); >- if (@branches) { >- $sth = $dbh->prepare( >- "DELETE FROM categories_branches WHERE categorycode = ?" >- ); >- $sth->execute( $input->param("categorycode") ); >- $sth = $dbh->prepare( >- "INSERT INTO categories_branches ( categorycode, branchcode ) VALUES ( ?, ? )" >- ); >- for my $branchcode (@branches) { >- next if not $branchcode; >- $sth->bind_param( 1, $input->param("categorycode") ); >- $sth->bind_param( 2, $branchcode ); >- $sth->execute; >- } >- } > $sth->finish; > } > else { >@@ -261,6 +245,23 @@ elsif ( $op eq 'add_validate' ) { > } > } > >+ my @branches = $input->param("branches"); >+ if (@branches) { >+ my $sth = $dbh->prepare( >+ "DELETE FROM categories_branches WHERE categorycode = ?" >+ ); >+ $sth->execute( $input->param("categorycode") ); >+ $sth = $dbh->prepare( >+ "INSERT INTO categories_branches ( categorycode, branchcode ) VALUES ( ?, ? )" >+ ); >+ for my $branchcode (@branches) { >+ next if not $branchcode; >+ $sth->bind_param( 1, $input->param("categorycode") ); >+ $sth->bind_param( 2, $branchcode ); >+ $sth->execute; >+ } >+ } >+ > if ( C4::Context->preference('EnhancedMessagingPreferences') ) { > C4::Form::MessagingPreferences::handle_form_action( $input, > { categorycode => $input->param('categorycode') }, $template ); >-- >1.9.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 10011
:
37644
|
37673
|
37994