From c36098e3168165f01fd8784da82747df03a9ae97 Mon Sep 17 00:00:00 2001
From: Katrin Fischer
Date: Fri, 4 Sep 2009 17:37:14 +0200
Subject: [PATCH] Bug 3464: Added altcontactcountry and B_address2 to borrowers
and deletedborrowers
- added altcontactcountry and B_address2 to tables borrowers and deletedborrowers so that all addresses offer the same fields
- changed B_country and country to work with syspref BorrowerMandatoryField
- changed display of Alternate Address on borrower detail page, added labels, lines and edit button to match the other sections
Signed-off-by: Galen Charlton
---
C4/Members.pm | 2 +
C4/SIP/ILS/Patron.pm | 5 ++
installer/data/Pg/kohastructure.sql | 24 ++++++++-
installer/data/mysql/kohastructure.sql | 4 ++
installer/data/mysql/updatedatabase.pl | 9 ++++
.../modules/help/tools/import_borrowers.tmpl | 2 +-
.../en/modules/members/memberentrygen.tmpl | 53 +++++++++++++++----
.../prog/en/modules/members/moremember.tmpl | 17 +++---
.../prog/en/modules/opac-userdetails.tmpl | 2 +-
.../prog/en/modules/opac-userupdate.tmpl | 8 +--
members/memberentry.pl | 6 +--
11 files changed, 107 insertions(+), 25 deletions(-)
diff --git a/C4/Members.pm b/C4/Members.pm
index d82e5e4918..5bb3476559 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -694,6 +694,7 @@ sub AddMember {
. ",dateexpiry=" . $dbh->quote( $data{'dateexpiry'} )
. ",contactnote=" . $dbh->quote( $data{'contactnote'} )
. ",B_address=" . $dbh->quote( $data{'B_address'} )
+ . ",B_address2=" . $dbh->quote( $data{'B_address2'} )
. ",B_zipcode=" . $dbh->quote( $data{'B_zipcode'} )
. ",B_country=" . $dbh->quote( $data{'B_country'} )
. ",B_city=" . $dbh->quote( $data{'B_city'} )
@@ -722,6 +723,7 @@ sub AddMember {
. ",altcontactaddress2=" . $dbh->quote( $data{'altcontactaddress2'} )
. ",altcontactaddress3=" . $dbh->quote( $data{'altcontactaddress3'} )
. ",altcontactzipcode=" . $dbh->quote( $data{'altcontactzipcode'} )
+ . ",altcontactcountry=" . $dbh->quote( $data{'altcontactcountry'} )
. ",altcontactphone=" . $dbh->quote( $data{'altcontactphone'} ) ;
$debug and print STDERR "AddMember SQL: ($query)\n";
my $sth = $dbh->prepare($query);
diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm
index 29e7464e9a..51e3141b46 100644
--- a/C4/SIP/ILS/Patron.pm
+++ b/C4/SIP/ILS/Patron.pm
@@ -384,6 +384,7 @@ From borrowers table:
| address2 | text | YES | |
| city | mediumtext | NO | |
| zipcode | varchar(25) | YES | |
+| country | text | YES | |
| email | mediumtext | YES | |
| phone | text | YES | |
| mobile | varchar(50) | YES | |
@@ -393,8 +394,10 @@ From borrowers table:
| 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 | |
@@ -427,7 +430,9 @@ From borrowers table:
| altcontactaddress2 | varchar(255) | YES | |
| altcontactaddress3 | varchar(255) | YES | |
| altcontactzipcode | varchar(50) | YES | |
+| altcontactcountry | text | YES | |
| altcontactphone | varchar(50) | YES | |
+| smsalertnumber | varchar(50) | YES | |
+---------------------+--------------+------+-----+
From C4::Members
diff --git a/installer/data/Pg/kohastructure.sql b/installer/data/Pg/kohastructure.sql
index 69abd2469f..12967dcba3 100644
--- a/installer/data/Pg/kohastructure.sql
+++ b/installer/data/Pg/kohastructure.sql
@@ -483,6 +483,7 @@ phonepro text,
B_streetnumber varchar(10) default NULL,
B_streettype varchar(50) default NULL,
B_address varchar(100) default NULL,
+B_address2 text default NULL,
B_city text,
B_zipcode varchar(25) default NULL,
B_country text,
@@ -511,7 +512,16 @@ userid varchar(30) default NULL,
opacnote text,
contactnote varchar(255) default NULL,
sort1 varchar(80) default NULL,
-sort2 varchar(80) default NULL
+sort2 varchar(80) default NULL,
+altcontactfirstname varchar(255) default NULL,
+altcontactsurname varchar(255) default NULL,
+altcontactaddress1 varchar(255) default NULL,
+altcontactaddress2 varchar(255) default NULL,
+altcontactaddress3 varchar(255) default NULL,
+altcontactzipcode varchar(50) default NULL,
+altcontactcountry text default NULL,
+altcontactphone varchar(50) default NULL,
+smsalertnumber varchar(50) default NULL
);
CREATE INDEX borrowers_branchcode_idx ON borrowers (branchcode);
CREATE INDEX borrowers_borrowernumber_idx ON borrowers (borrowernumber);
@@ -769,6 +779,7 @@ phonepro text,
B_streetnumber varchar(10) default NULL,
B_streettype varchar(50) default NULL,
B_address varchar(100) default NULL,
+B_address2 text default NULL,
B_city text,
B_zipcode varchar(25) default NULL,
B_email text,
@@ -796,7 +807,16 @@ userid varchar(30) default NULL,
opacnote text,
contactnote varchar(255) default NULL,
sort1 varchar(80) default NULL,
-sort2 varchar(80) default NULL
+sort2 varchar(80) default NULL,
+altcontactfirstname varchar(255) default NULL,
+altcontactsurname varchar(255) default NULL,
+altcontactaddress1 varchar(255) default NULL,
+altcontactaddress2 varchar(255) default NULL,
+altcontactaddress3 varchar(255) default NULL,
+altcontactzipcode varchar(50) default NULL,
+altcontactcountry text default NULL,
+altcontactphone varchar(50) default NULL,
+smsalertnumber varchar(50) default NULL
);
CREATE INDEX deletedborrowers_borrowernumber_idx ON deletedborrowers (borrowernumber);
CREATE INDEX deletedborrowers_cardnumber_idx ON deletedborrowers (cardnumber);
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index eb319b5971..23e5b10b11 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -454,6 +454,7 @@ CREATE TABLE `borrowers` (
`B_streetnumber` varchar(10) default NULL,
`B_streettype` varchar(50) default NULL,
`B_address` varchar(100) default NULL,
+ `B_address2` text default NULL,
`B_city` mediumtext,
`B_zipcode` varchar(25) default NULL,
`B_country` text,
@@ -489,6 +490,7 @@ CREATE TABLE `borrowers` (
`altcontactaddress2` varchar(255) default NULL,
`altcontactaddress3` varchar(255) default NULL,
`altcontactzipcode` varchar(50) default NULL,
+ `altcontactcountry` text default NULL,
`altcontactphone` varchar(50) default NULL,
`smsalertnumber` varchar(50) default NULL,
UNIQUE KEY `cardnumber` (`cardnumber`),
@@ -872,6 +874,7 @@ CREATE TABLE `deletedborrowers` (
`B_streetnumber` varchar(10) default NULL,
`B_streettype` varchar(50) default NULL,
`B_address` varchar(100) default NULL,
+ `B_address2` text default NULL,
`B_city` mediumtext,
`B_zipcode` varchar(25) default NULL,
`B_country` text,
@@ -907,6 +910,7 @@ CREATE TABLE `deletedborrowers` (
`altcontactaddress2` varchar(255) default NULL,
`altcontactaddress3` varchar(255) default NULL,
`altcontactzipcode` varchar(50) default NULL,
+ `altcontactcountry` text default NULL,
`altcontactphone` varchar(50) default NULL,
`smsalertnumber` varchar(50) default NULL,
KEY `borrowernumber` (`borrowernumber`),
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index e783a838fe..f5ccb26170 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2604,6 +2604,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = '3.01.00.053';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("ALTER TABLE borrowers ADD `B_address2` text AFTER B_address");
+ $dbh->do("ALTER TABLE borrowers ADD `altcontactcountry` text AFTER altcontactzipcode");
+ $dbh->do("ALTER TABLE deletedborrowers ADD `B_address2` text AFTER B_address");
+ $dbh->do("ALTER TABLE deletedborrowers ADD `altcontactcountry` text AFTER altcontactzipcode");
+ SetVersion ($DBversion);
+ print "Upgrade to $DBversion done (bug 1600, bug 3454: add altcontactcountry and B_address2 to borrowers and deletedborrowers)\n";
+}
=item DropAllForeignKeys($table)
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 5576350f35..c0b7f112b5 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
- - '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'
+
- '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'
+ -
+
+
-
@@ -526,10 +543,16 @@
" />
Required
- -
- Country:
- " />
-
+ -
+
+
+
+
+
+ Country:
+ " />
+ Required
+
-
@@ -561,6 +584,8 @@
+
+
+
+
@@ -333,9 +334,11 @@ if (nodename =="barcodes[]"){
Alternate Address
-
-
-
+
- Address:
+ - Address 2:
+ - City, State:
+ - Zip/Postal Code:
+ - Country:
- Surname:
@@ -345,15 +348,17 @@ if (nodename =="barcodes[]"){
- Relationship:
+
@@ -516,7 +521,7 @@ if (nodename =="barcodes[]"){
Call Number |
Barcode |
Priority |
- Delete? |
+ Delete?alter |
">
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tmpl
index 273cbfbf1b..174b8bdc7d 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tmpl
@@ -21,7 +21,7 @@ Card Number: |
Contact Details
Mailing Address: | , |
-Permanent Address: | , |
+Permanent Address: | , , |
Phone (Home): | |
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 ad638e8702..4ae620c1cf 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 @@
" id="address" />
" id="address2" />
- City, State: " name="city" />
-- Zip Code: " />
+- Zip Code: " name="zipcode" />
+- Country: " name="country" />
- Home Phone: " name="phone" />
- Mobile Phone: " name="mobile" />
- Fax: " name="fax" />
@@ -92,11 +93,12 @@
-
Permanent or Alternate Address:
-
+
- City, State: " name="B_city" />
-- Zip Code " />
+- Zip Code " name="B_zipcode" />
+- Country " name="B_country" />