[Koha-patches] [PATCH] Bug 6116: Adding a child patron

Julian Maurice julian.maurice at biblibre.com
Thu Apr 7 15:49:54 CEST 2011


From: Christophe Croullebois <christophe.croullebois at biblibre.com>

When adding a patron who is a child, the default library is not set when defining a guarantor, this patch corrects the problem.
More, for children with no guarantors, the default branch is the editing branch.

BibLibre MT5795
---
 .../prog/en/modules/members/guarantor_search.tmpl  |    5 +++--
 members/memberentry.pl                             |    8 +++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tmpl
index 13fb052..9c8a4f4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/guarantor_search.tmpl
@@ -6,7 +6,7 @@
     </style>
     <script type="text/javascript">
         <!--
-        function fillguarantor(id, surname, firstname, streetnumber, address, city, zipcode) {
+        function fillguarantor(id, surname, firstname, streetnumber, address, city, zipcode, branchcode) {
             var $ = window.opener.$;
             var form = $('#entryform').get(0);
 
@@ -32,6 +32,7 @@
             form.address.value = address;
             form.city.value = city;
             form.zipcode.value = zipcode;
+            form.branchcode.value = branchcode;
 
             form.guarantorsearch.value = 'Change';
             self.close();
@@ -76,7 +77,7 @@
 				<td><p><!-- TMPL_VAR NAME="address" --> <!-- TMPL_VAR NAME="city" --></p></td>
                 <td>
                     <form action="">
-                        <input type="button" onclick="fillguarantor('<!-- TMPL_VAR NAME="borrowernumber" -->', '<!-- TMPL_VAR NAME="surname" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="firstname" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="streetnumber" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="address" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="city" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="zipcode" ESCAPE=JS -->'); return false;" value="Select"/>
+                        <input type="button" onclick="fillguarantor('<!-- TMPL_VAR NAME="borrowernumber" -->', '<!-- TMPL_VAR NAME="surname" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="firstname" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="streetnumber" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="address" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="city" ESCAPE=JS -->', '<!-- TMPL_VAR NAME="zipcode" ESCAPE=JS -->','<!-- TMPL_VAR NAME="branchcode" ESCAPE=JS -->'); return false;" value="Select"/>
                     </form>
                 </td>
 			</tr>
diff --git a/members/memberentry.pl b/members/memberentry.pl
index 52b39b8..7a51d1b 100755
--- a/members/memberentry.pl
+++ b/members/memberentry.pl
@@ -374,7 +374,7 @@ if ($nok or !$nodouble){
 } 
 if (C4::Context->preference("IndependantBranches")) {
     my $userenv = C4::Context->userenv;
-    if ($userenv->{flags} % 2 != 1 && $data{branchcode}){
+    if ($userenv->{flags} % 2 != 1 && $data{'branchcode'}){
         unless ($userenv->{branch} eq $data{'branchcode'}){
             print $input->redirect("/cgi-bin/koha/members/members-home.pl");
             exit;
@@ -493,7 +493,7 @@ my $borrotitlepopup = CGI::popup_menu(-name=>'title',
         -default=>$default_borrowertitle
         );    
 
-my @relationships = split /,|\|/, C4::Context->preference('BorrowerRelationship');
+my @relationships = split /,|\|/, C4::Context->preference('borrowerRelationship');
 my @relshipdata;
 while (@relationships) {
   my $relship = shift @relationships || '';
@@ -549,7 +549,9 @@ if(scalar(@select_branch) > 0){
 # --------------------------------------------------------------------------------------------------------
   #in modify mod :default value from $CGIbranch comes from borrowers table
   #in add mod: default value come from branches table (ip correspendence)
-$default=$data{'branchcode'}  if ($op eq 'modify' || ($op eq 'add' && $category_type eq 'C'));
+if (defined ($data{'branchcode'}) and ( $op eq 'modify' || ( $op eq 'add' && $category_type eq 'C' ) )) {
+    $default = $data{'branchcode'};
+}
 $CGIbranch = CGI::scrolling_list(-id    => 'branchcode',
             -name   => 'branchcode',
             -values => \@select_branch,
-- 
1.7.4.1



More information about the Koha-patches mailing list