From 21727e00f5238903edf94e2efc56d62aa42bed4c Mon Sep 17 00:00:00 2001
From: Katrin Fischer
Date: Thu, 7 Apr 2011 11:41:31 +0200
Subject: [PATCH] Bug 5422: Separate state field for patron's addresses
Signed-off-by: Magnus Enger
Signed-off-by: Chris Cormack
---
C4/Auth_with_ldap.pm | 127 +++++++++-------
C4/SIP/ILS/Patron.pm | 137 +++++++++---------
.../modules/help/tools/import_borrowers.tmpl | 4 +-
.../en/modules/members/memberentrygen.tmpl | 40 ++++-
.../prog/en/modules/members/moremember.tmpl | 9 +-
.../prog/en/modules/opac-userupdate.tmpl | 12 +-
members/moremember.pl | 2 +-
opac/opac-userupdate.pl | 2 +-
8 files changed, 195 insertions(+), 138 deletions(-)
diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm
index b25697ce36..acbd923514 100644
--- a/C4/Auth_with_ldap.pm
+++ b/C4/Auth_with_ldap.pm
@@ -308,62 +308,77 @@ C4::Auth - Authenticates Koha users
What are the required fields? Well, in mysql you can check the database table "borrowers" like this:
mysql> show COLUMNS from borrowers;
- +------------------+--------------+------+-----+---------+----------------+
- | Field | Type | Null | Key | Default | Extra |
- +------------------+--------------+------+-----+---------+----------------+
- | borrowernumber | int(11) | NO | PRI | NULL | auto_increment |
- | cardnumber | varchar(16) | YES | UNI | NULL | |
- | surname | mediumtext | NO | | | |
- | firstname | text | YES | | NULL | |
- | title | mediumtext | YES | | NULL | |
- | othernames | mediumtext | YES | | NULL | |
- | initials | text | YES | | NULL | |
- | streetnumber | varchar(10) | YES | | NULL | |
- | streettype | varchar(50) | YES | | NULL | |
- | address | mediumtext | NO | | | |
- | address2 | text | YES | | NULL | |
- | city | mediumtext | NO | | | |
- | zipcode | varchar(25) | YES | | NULL | |
- | email | mediumtext | YES | | NULL | |
- | phone | text | YES | | NULL | |
- | mobile | varchar(50) | YES | | NULL | |
- | fax | mediumtext | YES | | NULL | |
- | emailpro | text | YES | | NULL | |
- | phonepro | text | YES | | NULL | |
- | B_streetnumber | varchar(10) | YES | | NULL | |
- | B_streettype | varchar(50) | YES | | NULL | |
- | B_address | varchar(100) | YES | | NULL | |
- | B_city | mediumtext | YES | | NULL | |
- | B_zipcode | varchar(25) | YES | | NULL | |
- | B_email | text | YES | | NULL | |
- | B_phone | mediumtext | YES | | NULL | |
- | dateofbirth | date | YES | | NULL | |
- | branchcode | varchar(10) | NO | MUL | | |
- | categorycode | varchar(10) | NO | MUL | | |
- | dateenrolled | date | YES | | NULL | |
- | dateexpiry | date | YES | | NULL | |
- | gonenoaddress | tinyint(1) | YES | | NULL | |
- | lost | tinyint(1) | YES | | NULL | |
- | debarred | tinyint(1) | YES | | NULL | |
- | contactname | mediumtext | YES | | NULL | |
- | contactfirstname | text | YES | | NULL | |
- | contacttitle | text | YES | | NULL | |
- | guarantorid | int(11) | YES | | NULL | |
- | borrowernotes | mediumtext | YES | | NULL | |
- | relationship | varchar(100) | YES | | NULL | |
- | ethnicity | varchar(50) | YES | | NULL | |
- | ethnotes | varchar(255) | YES | | NULL | |
- | sex | varchar(1) | YES | | NULL | |
- | password | varchar(30) | YES | | NULL | |
- | flags | int(11) | YES | | NULL | |
- | userid | varchar(30) | YES | MUL | NULL | | # UNIQUE in next release.
- | opacnote | mediumtext | YES | | NULL | |
- | contactnote | varchar(255) | YES | | NULL | |
- | sort1 | varchar(80) | YES | | NULL | |
- | sort2 | varchar(80) | YES | | NULL | |
- +------------------+--------------+------+-----+---------+----------------+
- 50 rows in set (0.01 sec)
-
+ +---------------------+--------------+------+-----+---------+----------------+
+ | Field | Type | Null | Key | Default | Extra |
+ +---------------------+--------------+------+-----+---------+----------------+
+ | borrowernumber | int(11) | NO | PRI | NULL | auto_increment |
+ | cardnumber | varchar(16) | YES | UNI | NULL | |
+ | surname | mediumtext | NO | | NULL | |
+ | firstname | text | YES | | NULL | |
+ | title | mediumtext | YES | | NULL | |
+ | othernames | mediumtext | YES | | NULL | |
+ | initials | text | YES | | NULL | |
+ | streetnumber | varchar(10) | YES | | NULL | |
+ | streettype | varchar(50) | YES | | NULL | |
+ | address | mediumtext | NO | | NULL | |
+ | address2 | text | YES | | NULL | |
+ | city | mediumtext | NO | | NULL | |
+ | state | mediumtext | YES | | NULL | |
+ | zipcode | varchar(25) | YES | | NULL | |
+ | country | text | YES | | NULL | |
+ | email | mediumtext | YES | | NULL | |
+ | phone | text | YES | | NULL | |
+ | mobile | varchar(50) | YES | | NULL | |
+ | fax | mediumtext | YES | | NULL | |
+ | emailpro | text | YES | | NULL | |
+ | phonepro | text | YES | | NULL | |
+ | B_streetnumber | varchar(10) | YES | | NULL | |
+ | B_streettype | varchar(50) | YES | | NULL | |
+ | B_address | varchar(100) | YES | | NULL | |
+ | B_address2 | text | YES | | NULL | |
+ | B_city | mediumtext | YES | | NULL | |
+ | B_state | mediumtext | YES | | NULL | |
+ | B_zipcode | varchar(25) | YES | | NULL | |
+ | B_country | text | YES | | NULL | |
+ | B_email | text | YES | | NULL | |
+ | B_phone | mediumtext | YES | | NULL | |
+ | dateofbirth | date | YES | | NULL | |
+ | branchcode | varchar(10) | NO | MUL | | |
+ | categorycode | varchar(10) | NO | MUL | | |
+ | dateenrolled | date | YES | | NULL | |
+ | dateexpiry | date | YES | | NULL | |
+ | gonenoaddress | tinyint(1) | YES | | NULL | |
+ | lost | tinyint(1) | YES | | NULL | |
+ | debarred | tinyint(1) | YES | | NULL | |
+ | contactname | mediumtext | YES | | NULL | |
+ | contactfirstname | text | YES | | NULL | |
+ | contacttitle | text | YES | | NULL | |
+ | guarantorid | int(11) | YES | MUL | NULL | |
+ | borrowernotes | mediumtext | YES | | NULL | |
+ | relationship | varchar(100) | YES | | NULL | |
+ | ethnicity | varchar(50) | YES | | NULL | |
+ | ethnotes | varchar(255) | YES | | NULL | |
+ | sex | varchar(1) | YES | | NULL | |
+ | password | varchar(30) | YES | | NULL | |
+ | flags | int(11) | YES | | NULL | |
+ | userid | varchar(30) | YES | MUL | NULL | |
+ | opacnote | mediumtext | YES | | NULL | |
+ | contactnote | varchar(255) | YES | | NULL | |
+ | sort1 | varchar(80) | YES | | NULL | |
+ | sort2 | varchar(80) | YES | | NULL | |
+ | altcontactfirstname | varchar(255) | YES | | NULL | |
+ | altcontactsurname | varchar(255) | YES | | NULL | |
+ | altcontactaddress1 | varchar(255) | YES | | NULL | |
+ | altcontactaddress2 | varchar(255) | YES | | NULL | |
+ | altcontactaddress3 | varchar(255) | YES | | NULL | |
+ | altcontactstate | mediumtext | YES | | NULL | |
+ | altcontactzipcode | varchar(50) | YES | | NULL | |
+ | altcontactcountry | text | YES | | NULL | |
+ | altcontactphone | varchar(50) | YES | | NULL | |
+ | smsalertnumber | varchar(50) | YES | | NULL | |
+ | privacy | int(11) | NO | | 1 | |
+ +---------------------+--------------+------+-----+---------+----------------+
+ 66 rows in set (0.00 sec)
Where Null="NO", the field is required.
=head1 KOHA_CONF and field mapping
diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm
index 3f4e136156..2b0b443f0c 100644
--- a/C4/SIP/ILS/Patron.pm
+++ b/C4/SIP/ILS/Patron.pm
@@ -389,72 +389,77 @@ __END__
);
From borrowers table:
- +---------------------+--------------+------+-----+
- | Field | Type | Null | Key |
- +---------------------+--------------+------+-----+
- | borrowernumber | int(11) | NO | PRI |
- | cardnumber | varchar(16) | YES | UNI |
- | surname | mediumtext | NO | |
- | firstname | text | YES | |
- | title | mediumtext | YES | |
- | othernames | mediumtext | YES | |
- | initials | text | YES | |
- | streetnumber | varchar(10) | YES | |
- | streettype | varchar(50) | YES | |
- | address | mediumtext | NO | |
- | address2 | text | YES | |
- | city | mediumtext | NO | |
- | zipcode | varchar(25) | YES | |
- | country | text | YES | |
- | email | mediumtext | YES | |
- | phone | text | YES | |
- | mobile | varchar(50) | YES | |
- | fax | mediumtext | YES | |
- | emailpro | text | YES | |
- | phonepro | text | YES | |
- | B_streetnumber | varchar(10) | YES | |
- | B_streettype | varchar(50) | YES | |
- | B_address | varchar(100) | YES | |
- | B_address2 | text | YES | |
- | B_city | mediumtext | YES | |
- | B_zipcode | varchar(25) | YES | |
- | B_country | text | YES | |
- | B_email | text | YES | |
- | B_phone | mediumtext | YES | |
- | dateofbirth | date | YES | |
- | branchcode | varchar(10) | NO | MUL |
- | categorycode | varchar(10) | NO | MUL |
- | dateenrolled | date | YES | |
- | dateexpiry | date | YES | |
- | gonenoaddress | tinyint(1) | YES | |
- | lost | tinyint(1) | YES | |
- | debarred | tinyint(1) | YES | |
- | contactname | mediumtext | YES | |
- | contactfirstname | text | YES | |
- | contacttitle | text | YES | |
- | guarantorid | int(11) | YES | |
- | borrowernotes | mediumtext | YES | |
- | relationship | varchar(100) | YES | |
- | ethnicity | varchar(50) | YES | |
- | ethnotes | varchar(255) | YES | |
- | sex | varchar(1) | YES | |
- | password | varchar(30) | YES | |
- | flags | int(11) | YES | |
- | userid | varchar(30) | YES | MUL |
- | opacnote | mediumtext | YES | |
- | contactnote | varchar(255) | YES | |
- | sort1 | varchar(80) | YES | |
- | sort2 | varchar(80) | YES | |
- | altcontactfirstname | varchar(255) | YES | |
- | altcontactsurname | varchar(255) | YES | |
- | altcontactaddress1 | varchar(255) | YES | |
- | altcontactaddress2 | varchar(255) | YES | |
- | altcontactaddress3 | varchar(255) | YES | |
- | altcontactzipcode | varchar(50) | YES | |
- | altcontactcountry | text | YES | |
- | altcontactphone | varchar(50) | YES | |
- | smsalertnumber | varchar(50) | YES | |
- +---------------------+--------------+------+-----+
++---------------------+--------------+------+-----+---------+----------------+
+| Field | Type | Null | Key | Default | Extra |
++---------------------+--------------+------+-----+---------+----------------+
+| borrowernumber | int(11) | NO | PRI | NULL | auto_increment |
+| cardnumber | varchar(16) | YES | UNI | NULL | |
+| surname | mediumtext | NO | | NULL | |
+| firstname | text | YES | | NULL | |
+| title | mediumtext | YES | | NULL | |
+| othernames | mediumtext | YES | | NULL | |
+| initials | text | YES | | NULL | |
+| streetnumber | varchar(10) | YES | | NULL | |
+| streettype | varchar(50) | YES | | NULL | |
+| address | mediumtext | NO | | NULL | |
+| address2 | text | YES | | NULL | |
+| city | mediumtext | NO | | NULL | |
+| state | mediumtext | YES | | NULL | |
+| zipcode | varchar(25) | YES | | NULL | |
+| country | text | YES | | NULL | |
+| email | mediumtext | YES | | NULL | |
+| phone | text | YES | | NULL | |
+| mobile | varchar(50) | YES | | NULL | |
+| fax | mediumtext | YES | | NULL | |
+| emailpro | text | YES | | NULL | |
+| phonepro | text | YES | | NULL | |
+| B_streetnumber | varchar(10) | YES | | NULL | |
+| B_streettype | varchar(50) | YES | | NULL | |
+| B_address | varchar(100) | YES | | NULL | |
+| B_address2 | text | YES | | NULL | |
+| B_city | mediumtext | YES | | NULL | |
+| B_state | mediumtext | YES | | NULL | |
+| B_zipcode | varchar(25) | YES | | NULL | |
+| B_country | text | YES | | NULL | |
+| B_email | text | YES | | NULL | |
+| B_phone | mediumtext | YES | | NULL | |
+| dateofbirth | date | YES | | NULL | |
+| branchcode | varchar(10) | NO | MUL | | |
+| categorycode | varchar(10) | NO | MUL | | |
+| dateenrolled | date | YES | | NULL | |
+| dateexpiry | date | YES | | NULL | |
+| gonenoaddress | tinyint(1) | YES | | NULL | |
+| lost | tinyint(1) | YES | | NULL | |
+| debarred | tinyint(1) | YES | | NULL | |
+| contactname | mediumtext | YES | | NULL | |
+| contactfirstname | text | YES | | NULL | |
+| contacttitle | text | YES | | NULL | |
+| guarantorid | int(11) | YES | MUL | NULL | |
+| borrowernotes | mediumtext | YES | | NULL | |
+| relationship | varchar(100) | YES | | NULL | |
+| ethnicity | varchar(50) | YES | | NULL | |
+| ethnotes | varchar(255) | YES | | NULL | |
+| sex | varchar(1) | YES | | NULL | |
+| password | varchar(30) | YES | | NULL | |
+| flags | int(11) | YES | | NULL | |
+| userid | varchar(30) | YES | MUL | NULL | |
+| opacnote | mediumtext | YES | | NULL | |
+| contactnote | varchar(255) | YES | | NULL | |
+| sort1 | varchar(80) | YES | | NULL | |
+| sort2 | varchar(80) | YES | | NULL | |
+| altcontactfirstname | varchar(255) | YES | | NULL | |
+| altcontactsurname | varchar(255) | YES | | NULL | |
+| altcontactaddress1 | varchar(255) | YES | | NULL | |
+| altcontactaddress2 | varchar(255) | YES | | NULL | |
+| altcontactaddress3 | varchar(255) | YES | | NULL | |
+| altcontactstate | mediumtext | YES | | NULL | |
+| altcontactzipcode | varchar(50) | YES | | NULL | |
+| altcontactcountry | text | YES | | NULL | |
+| altcontactphone | varchar(50) | YES | | NULL | |
+| smsalertnumber | varchar(50) | YES | | NULL | |
+| privacy | int(11) | NO | | 1 | |
++---------------------+--------------+------+-----+---------+----------------+
+
From C4::Members
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 c0b7f112b5..a27c8f0ed9 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 @@
- Format your file with the following fields
- - '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_address2', 'B_city', 'B_zipcode', 'B_country', 'B_email', 'B_phone', 'dateofbirth', 'branchcode', 'categorycode', 'dateenrolled', 'dateexpiry', 'gonenoaddress', 'lost', 'debarred', 'contactname', 'contactfirstname', 'contacttitle', 'guarantorid', 'borrowernotes', 'relationship', 'ethnicity', 'ethnotes', 'sex', 'password', 'flags', 'userid', 'opacnote', 'contactnote', 'sort1', 'sort2', 'altcontactfirstname', 'altcontactsurname', 'altcontactaddress1', 'altcontactaddress2', 'altcontactaddress3', 'altcontactzipcode', 'altcontactcountry', 'altcontactphone', 'smsalertnumber', 'patron_attributes'
+
- 'surname', 'firstname', 'title', 'othernames', 'initials', 'streetnumber', 'streettype', 'address', 'address2', 'city', 'state', 'zipcode', 'country', 'email', 'phone', 'mobile', 'fax', 'emailpro', 'phonepro', 'B_streetnumber', 'B_streettype', 'B_address', 'B_address2', 'B_city', 'B_state', 'B_zipcode', 'B_country', 'B_email', 'B_phone', 'dateofbirth', 'branchcode', 'categorycode', 'dateenrolled', 'dateexpiry', 'gonenoaddress', 'lost', 'debarred', 'contactname', 'contactfirstname', 'contacttitle', 'guarantorid', 'borrowernotes', 'relationship', 'ethnicity', 'ethnotes', 'sex', 'password', 'flags', 'userid', 'opacnote', 'contactnote', 'sort1', 'sort2', 'altcontactfirstname', 'altcontactsurname', 'altcontactaddress1', 'altcontactaddress2', 'altcontactaddress3', 'altcontactstate', 'altcontactzipcode', 'altcontactcountry', 'altcontactphone', 'smsalertnumber', 'patron_attributes'
-
@@ -28,4 +28,4 @@ TIP: If your passwords are already encrypted, talk to your systems administrator
- Click 'Import'
- You will be brought to a confirmation screen.
-
\ No newline at end of file
+
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 6cee5b25d4..feede9d5ef 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tmpl
@@ -407,7 +407,7 @@
+ City:
" onclick="this.value=''" />
or choose
@@ -425,6 +425,16 @@
Required
+ -
+
+
-
@@ -549,9 +559,19 @@
- City, State:
- " onclick="this.value=''" />
+ City:
+ " />
Required
+
+ -
+
+
+
+
+
+ State:
+ " />
+ Required
-
@@ -654,10 +674,20 @@
- City, State:
- " onclick="this.value=''" size="40" />
+ City:
+ " size="20" />
Required
+ -
+
+
+
+
+
+ State:
+ " size="20" />
+ Required
+
-
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
index 2081073d00..2b6327f640 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
@@ -185,7 +185,8 @@ function validate1(date) {
-
+
+
@@ -358,7 +359,8 @@ function validate1(date) {
- Address:
- Address 2:
- - City, State:
+ - City:
+ - State:
- Zip/Postal Code:
- Country:
- Phone:
@@ -380,7 +382,8 @@ function validate1(date) {
- First name:
- Address:
- Address 2:
- - City, State:
+ - City:
+ - State:
- Zip/Postal Code:
- Country:
- Phone:
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl
index 024442e743..1d128459f4 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl
@@ -30,7 +30,8 @@
" name="streetnumber" />
" id="address" />
" id="address2" />
-City, State: " name="city" />
+City: " name="city" />
+State: " name="state" />
Zip Code: " name="zipcode" />
Country: " name="country" />
Home Phone: " name="phone" />
@@ -54,7 +55,8 @@
" name="B_address2" />
-City, State: " name="B_city" />
+City: " name="B_city" />
+State: " name="B_state" />
Zip Code: " name="B_zipcode" />
Country: " name="B_country" />
Phone: " name="B_phone" />
@@ -107,7 +109,8 @@
Other Name:
Address:
-City, State:
+City:
+State:
Zip Code:
Country:
Home Phone:
@@ -137,7 +140,8 @@
- Alternate Address:
-
-- City, State:
+- City:
+- State:
- Zip Code:
- Country:
- Phone:
diff --git a/members/moremember.pl b/members/moremember.pl
index 9dcfa3ad21..c11073f461 100755
--- a/members/moremember.pl
+++ b/members/moremember.pl
@@ -159,7 +159,7 @@ my $catcode;
if ( $category_type eq 'C') {
if ($data->{guarantorid} ) {
my $data2 = GetMember( 'borrowernumber' => $data->{'guarantorid'} );
- foreach (qw(address city B_address B_city phone mobile zipcode country B_country)) {
+ foreach (qw(address address2 city state B_address B_address2 B_city B_state phone mobile zipcode B_zipcode country B_country)) {
$data->{$_} = $data2->{$_};
}
}
diff --git a/opac/opac-userupdate.pl b/opac/opac-userupdate.pl
index 2e8fb5e255..aa5858a9f7 100755
--- a/opac/opac-userupdate.pl
+++ b/opac/opac-userupdate.pl
@@ -53,7 +53,7 @@ my $lib = GetBranchDetail($borr->{'branchcode'});
# handle the new information....
# collect the form values and send an email.
my @fields = (
- 'surname','firstname','othernames','streetnumber','address','address2','city','zipcode','country','phone','mobile','fax','phonepro', 'email','emailpro','B_streetnumber','B_address','B_address2','B_city','B_zipcode','B_country','B_phone','B_email','dateofbirth','sex'
+ 'surname','firstname','othernames','streetnumber','address','address2','city','state','zipcode','country','phone','mobile','fax','phonepro', 'emailaddress','emailpro','B_streetnumber','B_address','B_address2','B_city','B_state','B_zipcode','B_country','B_phone','B_email','dateofbirth','sex'
);
my $update;
my $updateemailaddress = $lib->{'branchemail'};
--
2.39.5