[PATCH 2/3] Takes columns country and B_country of table borrowers into account in related operations.

Sébastien Hinderer Sebastien.Hinderer at ens-lyon.org
Sun Aug 2 07:50:08 CEST 2009


---
 C4/Members.pm                                      |    2 ++
 circ/circulation.pl                                |    1 +
 circ/ysearch.pl                                    |    5 +++--
 .../intranet-tmpl/prog/en/includes/circ-menu.inc   |    1 +
 .../en/modules/help/tools/import_borrowers.tmpl    |    2 +-
 .../prog/en/modules/members/member.tmpl            |    2 +-
 .../prog/en/modules/members/memberentrygen.tmpl    |    8 ++++++++
 labels/pcard-member-search.pl                      |    1 +
 members/boraccount.pl                              |    1 +
 members/guarantor_search.pl                        |    1 +
 members/mancredit.pl                               |    1 +
 members/maninvoice.pl                              |    1 +
 members/member-flags.pl                            |    1 +
 members/member-password.pl                         |    1 +
 members/member.pl                                  |    1 +
 members/memberentry.pl                             |    5 +++--
 members/moremember.pl                              |    2 +-
 members/pay.pl                                     |    1 +
 members/readingrec.pl                              |    1 +
 misc/cronjobs/overdue_notices.pl                   |    4 ++--
 tools/import_borrowers.pl                          |    4 ++--
 21 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/C4/Members.pm b/C4/Members.pm
index b2ce916..d82e5e4 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -677,6 +677,7 @@ sub AddMember {
       . ",address="     . $dbh->quote( $data{'address'} )
       . ",address2="    . $dbh->quote( $data{'address2'} )
       . ",zipcode="     . $dbh->quote( $data{'zipcode'} )
+      . ",country="     . $dbh->quote( $data{'country'} )
       . ",city="        . $dbh->quote( $data{'city'} )
       . ",phone="       . $dbh->quote( $data{'phone'} )
       . ",email="       . $dbh->quote( $data{'email'} )
@@ -694,6 +695,7 @@ sub AddMember {
       . ",contactnote=" . $dbh->quote( $data{'contactnote'} )
       . ",B_address="   . $dbh->quote( $data{'B_address'} )
       . ",B_zipcode="   . $dbh->quote( $data{'B_zipcode'} )
+      . ",B_country="   . $dbh->quote( $data{'B_country'} )
       . ",B_city="      . $dbh->quote( $data{'B_city'} )
       . ",B_phone="     . $dbh->quote( $data{'B_phone'} )
       . ",B_email="     . $dbh->quote( $data{'B_email'} )
diff --git a/circ/circulation.pl b/circ/circulation.pl
index 986b10c..09b1131 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -663,6 +663,7 @@ $template->param(
     borrowernotes     => $borrower->{'borrowernotes'},
     city              => $borrower->{'city'},
     zipcode	          => $borrower->{'zipcode'},
+    country	          => $borrower->{'country'},
     phone             => $borrower->{'phone'} || $borrower->{'mobile'},
     cardnumber        => $borrower->{'cardnumber'},
     amountold         => $amountold,
diff --git a/circ/ysearch.pl b/circ/ysearch.pl
index 136ca76..c7a9b67 100755
--- a/circ/ysearch.pl
+++ b/circ/ysearch.pl
@@ -41,7 +41,7 @@ if ($auth_status ne "ok") {
 }
 
 my $dbh = C4::Context->dbh;
-my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode 
+my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode, country 
              FROM borrowers 
              WHERE surname LIKE ?
              OR firstname LIKE ?
@@ -55,6 +55,7 @@ while ( my $rec = $sth->fetchrow_hashref ) {
           $rec->{cardnumber} . "\t" .
           $rec->{address} . "\t" .
           $rec->{city} . "\t" .
-          $rec->{zip} .
+          $rec->{zip} . "\t" .
+          $rec->{country} .
           "\n";
 }
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
index 6c88037..67e7b39 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
@@ -23,6 +23,7 @@
     <!-- TMPL_IF NAME="city" -->
             <!-- TMPL_VAR NAME="city" -->
 	    <!-- TMPL_VAR NAME="zipcode" -->
+	    <!-- TMPL_IF NAME="country" -->, <!-- TMPL_VAR NAME="country" --><!-- /TMPL_IF -->
     <!-- TMPL_ELSE -->
         <span class="empty">No city stored.</span>
     <!-- /TMPL_IF --></li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/import_borrowers.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/import_borrowers.tmpl
index ef2c0e1..5576350 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/import_borrowers.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/import_borrowers.tmpl
@@ -7,7 +7,7 @@
 			<ul>
 				<li>Format your file with the following fields
 				<ul>
-					<li>'cardnumber',    'surname',      'firstname',        'title',     'othernames',    'initials',     'streetnumber',     'streettype',     'address',       'address2',     'city',             'zipcode',     'email',         'phone',        'mobile',           'fax',     'emailpro',      'phonepro',     'B_streetnumber',   'B_streettype',     'B_address',     'B_city',       'B_zipcode',        'B_email',     'B_phone',       'dateofbirth',  'branchcode',       'categorycode',     'dateenrolled',  'dateexpiry',   'gonenoaddress',    'lost',     'debarred',      'contactname',  'contactfirstname', 'contacttitle',     'borrowernotes', 'relationship', 'ethnicity',        'ethnotes',     'sex',           'userid',       'opacnote',         'contactnote',     'password',      'sort1',        'sort2'
+					<li>'cardnumber',    'surname',      'firstname',        'title',     'othernames',    'initials',     'streetnumber',     'streettype',     'address',       'address2',     'city',             'zipcode',     'country',     'email',         'phone',        'mobile',           'fax',     'emailpro',      'phonepro',     'B_streetnumber',   'B_streettype',     'B_address',     'B_city',       'B_zipcode',        'B_country',        'B_email',     'B_phone',       'dateofbirth',  'branchcode',       'categorycode',     'dateenrolled',  'dateexpiry',   'gonenoaddress',    'lost',     'debarred',      'contactname',  'contactfirstname', 'contacttitle',     'borrowernotes', 'relationship', 'ethnicity',        'ethnotes',     'sex',           'userid',       'opacnote',         'contactnote',     'password',      'sort1',        'sort2'
 					<ul>
 						<li>
 					    <span style="background-color: #ffe599">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl
index 0873983..96b29ac 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tmpl
@@ -75,7 +75,7 @@
     <!-- /TMPL_UNLESS -->
     <!-- /TMPL_IF -->
     <td><!-- TMPL_VAR NAME="cardnumber" --></td>
-    <td style="white-space: nowrap;"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" --></a> <br /> <!-- TMPL_VAR NAME="address" --><!-- TMPL_IF NAME="address2" --><br /><!-- TMPL_VAR NAME="address2" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="city" --><br /><!-- TMPL_VAR NAME=city --><!-- /TMPL_IF --><!-- TMPL_IF NAME="zipcode" -->  <!-- TMPL_VAR NAME="zipcode" --><!-- /TMPL_IF --></td>
+    <td style="white-space: nowrap;"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" --></a> <br /> <!-- TMPL_VAR NAME="address" --><!-- TMPL_IF NAME="address2" --><br /><!-- TMPL_VAR NAME="address2" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="city" --><br /><!-- TMPL_VAR NAME=city --><!-- /TMPL_IF --><!-- TMPL_IF NAME="zipcode" -->  <!-- TMPL_VAR NAME="zipcode" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="country" -->, <!-- TMPL_VAR NAME="country" --><!-- /TMPL_IF --></td>
     <td><!-- TMPL_VAR NAME="category_description" --> (<!-- TMPL_VAR name="category_type" -->)</td>
     <td><!-- TMPL_VAR NAME="branchcode" --></td>
     <td><!-- TMPL_VAR NAME="dateexpiry" --></td>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
index abcc658..546ded5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
@@ -415,6 +415,10 @@
       <input type="text" name="zipcode" id="zipcode" size="10" value="<!-- TMPL_VAR NAME="zipcode" -->" />
 	  <!-- TMPL_IF NAME="mandatoryzipcode" --><span class="required">Required</span><!-- /TMPL_IF -->
     </li>
+    <li>
+      <label for="country">Country: </label>
+      <input type="text" name="country" id="country" value="<!-- TMPL_VAR NAME="country" -->" />
+    </li>
   
 	</ol>
     </fieldset>
@@ -520,6 +524,10 @@
 				<input type="text" id="B_zipcode" name="B_zipcode" maxlength="10" size="10" value="<!-- TMPL_VAR NAME="B_zipcode" -->" />
 	  <!-- TMPL_IF NAME="mandatoryB_zipcode" --><span class="required">Required</span><!-- /TMPL_IF -->
 			</li>
+	    <li>
+	        <label for="B_country">Country: </label>
+	        <input type="text" name="B_country" id="B_country" value="<!-- TMPL_VAR NAME="B_country" -->" />
+	    </li>
             <li>
                 <!-- TMPL_IF NAME="mandatoryB_phone" -->
                 <label for="B_phone" class="required">
diff --git a/labels/pcard-member-search.pl b/labels/pcard-member-search.pl
index 1ff5cf1..b269a5c 100755
--- a/labels/pcard-member-search.pl
+++ b/labels/pcard-member-search.pl
@@ -113,6 +113,7 @@ for (my $i=($startfrom-1)*$resultsperpage; $i < $to; $i++){
 	address2 => $results->[$i]{'address2'},
     city => $results->[$i]{'city'},
 	zipcode => $results->[$i]{'zipcode'},
+	country => $results->[$i]{'country'},
     branchcode => $results->[$i]{'branchcode'},
     overdues => $od,
     issues => $issue,
diff --git a/members/boraccount.pl b/members/boraccount.pl
index 40dd68a..d1d1fa7 100755
--- a/members/boraccount.pl
+++ b/members/boraccount.pl
@@ -114,6 +114,7 @@ $template->param(
     address2            => $data->{'address2'},
     city                => $data->{'city'},
     zipcode             => $data->{'zipcode'},
+    country             => $data->{'country'},
     phone               => $data->{'phone'},
     email               => $data->{'email'},
     branchcode          => $data->{'branchcode'},
diff --git a/members/guarantor_search.pl b/members/guarantor_search.pl
index 881df94..4224da8 100755
--- a/members/guarantor_search.pl
+++ b/members/guarantor_search.pl
@@ -83,6 +83,7 @@ if ($member ne ''){
 		address => $results->[$i]{'address'},
 		city => $results->[$i]{'city'},
 		zipcode => $results->[$i]{'zipcode'},
+		country => $results->[$i]{'country'},
 		branchcode => $results->[$i]{'branchcode'},
 		guarantorinfo =>$guarantorinfo,
 		#op
diff --git a/members/mancredit.pl b/members/mancredit.pl
index 5a7ec1d..c2b49bd 100755
--- a/members/mancredit.pl
+++ b/members/mancredit.pl
@@ -81,6 +81,7 @@ if ($add){
 		    address2 => $data->{'address2'},
 		    city => $data->{'city'},
 		    zipcode => $data->{'zipcode'},
+		    country => $data->{'country'},
 		    phone => $data->{'phone'},
 		    email => $data->{'email'},
 		    branchcode => $data->{'branchcode'},
diff --git a/members/maninvoice.pl b/members/maninvoice.pl
index 4ad2067..a0b0832 100755
--- a/members/maninvoice.pl
+++ b/members/maninvoice.pl
@@ -98,6 +98,7 @@ if ($add){
 		address2 => $data->{'address2'},
 		city => $data->{'city'},
 		zipcode => $data->{'zipcode'},
+		country => $data->{'country'},
 		phone => $data->{'phone'},
 		email => $data->{'email'},
 		branchcode => $data->{'branchcode'},
diff --git a/members/member-flags.pl b/members/member-flags.pl
index d2eea2f..b71d704 100755
--- a/members/member-flags.pl
+++ b/members/member-flags.pl
@@ -177,6 +177,7 @@ $template->param(
 		address2 => $bor->{'address2'},
 		city => $bor->{'city'},
 		zipcode => $bor->{'zipcode'},
+		country => $bor->{'country'},
 		phone => $bor->{'phone'},
 		email => $bor->{'email'},
 		branchcode => $bor->{'branchcode'},
diff --git a/members/member-password.pl b/members/member-password.pl
index f18db80..696a436 100755
--- a/members/member-password.pl
+++ b/members/member-password.pl
@@ -100,6 +100,7 @@ $template->param( picture => 1 ) if $picture;
 	    address2 => $bor->{'address2'},
 	    city => $bor->{'city'},
 	    zipcode => $bor->{'zipcode'},
+	    country => $bor->{'country'},
 	    phone => $bor->{'phone'},
 	    email => $bor->{'email'},
 	    branchcode => $bor->{'branchcode'},
diff --git a/members/member.pl b/members/member.pl
index b43b30b..fcc6ee1 100755
--- a/members/member.pl
+++ b/members/member.pl
@@ -109,6 +109,7 @@ for (my $i=($startfrom-1)*$resultsperpage; $i < $to; $i++){
 	address2 => $results->[$i]{'address2'},
     city => $results->[$i]{'city'},
 	zipcode => $results->[$i]{'zipcode'},
+	country => $results->[$i]{'country'},
     branchcode => $results->[$i]{'branchcode'},
     overdues => $od,
     issues => $issue,
diff --git a/members/memberentry.pl b/members/memberentry.pl
index c259dfd..c7beb7f 100755
--- a/members/memberentry.pl
+++ b/members/memberentry.pl
@@ -210,18 +210,19 @@ if ( defined($guarantorid) and
             $newdata{'contactname'}     = $guarantordata->{'surname'};
             $newdata{'contacttitle'}    = $guarantordata->{'title'};
 	        foreach (qw(streetnumber address streettype address2
-                        zipcode city phone phonepro mobile fax email emailpro branchcode)) {
+                        zipcode country city phone phonepro mobile fax email emailpro branchcode)) {
 		        $newdata{$_} = $guarantordata->{$_};
 	        }
         }
     }
 }
 
-###############test to take the right zipcode and city name ##############
+###############test to take the right zipcode, country and city name ##############
 if (!defined($guarantorid) or $guarantorid eq '' or $guarantorid eq '0') {
     # set only if parameter was passed from the form
     $newdata{'city'}    = $input->param('city')    if defined($input->param('city'));
     $newdata{'zipcode'} = $input->param('zipcode') if defined($input->param('zipcode'));
+    $newdata{'country'} = $input->param('counry') if defined($input->param('country'));
 }
 
 #builds default userid
diff --git a/members/moremember.pl b/members/moremember.pl
index 494121f..a76d142 100755
--- a/members/moremember.pl
+++ b/members/moremember.pl
@@ -137,7 +137,7 @@ my $catcode;
 if ( $category_type eq 'C') {
 	if ($data->{'guarantorid'} ne '0' ) {
     	my $data2 = GetMember( $data->{'guarantorid'} ,'borrowernumber');
-    	foreach (qw(address city B_address B_city phone mobile zipcode)) {
+    	foreach (qw(address city B_address B_city phone mobile zipcode country B_country)) {
     	    $data->{$_} = $data2->{$_};
     	}
    }
diff --git a/members/pay.pl b/members/pay.pl
index 06ae687..8e8567c 100755
--- a/members/pay.pl
+++ b/members/pay.pl
@@ -155,6 +155,7 @@ $template->param( picture => 1 ) if $picture;
 	address2 => $data->{'address2'},
 	city => $data->{'city'},
 	zipcode => $data->{'zipcode'},
+	country => $data->{'country'},
 	phone => $data->{'phone'},
 	email => $data->{'email'},
 	branchcode => $data->{'branchcode'},
diff --git a/members/readingrec.pl b/members/readingrec.pl
index 6107ef4..7ffdfee 100755
--- a/members/readingrec.pl
+++ b/members/readingrec.pl
@@ -109,6 +109,7 @@ $template->param(
 						address2 => $data->{'address2'},
 					    city => $data->{'city'},
 						zipcode => $data->{'zipcode'},
+						country => $data->{'country'},
 						phone => $data->{'phone'},
 						email => $data->{'email'},
 			   			branchcode => $data->{'branchcode'},
diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl
index 23ce459..831cdfc 100755
--- a/misc/cronjobs/overdue_notices.pl
+++ b/misc/cronjobs/overdue_notices.pl
@@ -290,7 +290,7 @@ if ( defined $csvfilename ) {
     } else {
         open $csv_fh, ">", $csvfilename or die "unable to open $csvfilename: $!";
     }
-    if ( $csv->combine(qw(name surname address1 address2 zipcode city email itemcount itemsinfo)) ) {
+    if ( $csv->combine(qw(name surname address1 address2 zipcode city country email itemcount itemsinfo)) ) {
         print $csv_fh $csv->string, "\n";
     } else {
         $verbose and warn 'combine failed on argument: ' . $csv->error_input;
@@ -340,7 +340,7 @@ END_SQL
             # <date> <itemcount> <firstname> <lastname> <address1> <address2> <address3> <city> <postcode>
 
             my $borrower_sql = <<'END_SQL';
-SELECT COUNT(*), issues.borrowernumber, firstname, surname, address, address2, city, zipcode, email, MIN(date_due) as longest_issue
+SELECT COUNT(*), issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, MIN(date_due) as longest_issue
 FROM   issues,borrowers,categories
 WHERE  issues.borrowernumber=borrowers.borrowernumber
 AND    borrowers.categorycode=categories.categorycode
diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl
index f987fa3..ebbff4f 100755
--- a/tools/import_borrowers.pl
+++ b/tools/import_borrowers.pl
@@ -22,9 +22,9 @@
 # File format
 #
 # cardnumber,surname,firstname,title,othernames,initials,streetnumber,streettype,
-# address line , address line 2, city, zipcode, email, phone, mobile, fax, work email, work phone,
+# address line , address line 2, city, zipcode, contry, email, phone, mobile, fax, work email, work phone,
 # alternate streetnumber, alternate streettype, alternate address line 1, alternate city,
-# alternate zipcode, alternate email, alternate phone, date of birth, branchcode,
+# alternate zipcode, alternate country, alternate email, alternate phone, date of birth, branchcode,
 # categorycode, enrollment date, expiry date, noaddress, lost, debarred, contact surname,
 # contact firstname, contact title, borrower notes, contact relationship, ethnicity, ethnicity notes
 # gender, username, opac note, contact note, password, sort one, sort two
-- 
1.6.3.3


--r5Pyd7+fXNt84Ff3
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-Update-Koha-version-3.01.00.038-3.01.00.039.patch"



More information about the Koha-patches mailing list