Hi,
The modificaiton of templates may need some reviewing.
Sébastien.
>From d02147827569bad9efc53fdea87fc471be789085 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?S=C3=A9bastien=20Hinderer?= <[email protected]>
Date: Fri, 24 Jul 2009 11:00:07 +0200
Subject: [PATCH 1/3] Database structure modification.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="utf-8"
Adds 5 columns to the `branches` table: `branchzip`, `branchcity`,
`branchcountry`, `branchurlè` and `branchnote`.
I/O operations for these fields are not included.
---
installer/data/Pg/kohastructure.sql | 7 ++++++-
installer/data/mysql/kohastructure.sql | 5 +++++
installer/data/mysql/updatedatabase.pl | 19 +++++++++++++++++++
3 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/installer/data/Pg/kohastructure.sql b/installer/data/Pg/kohastructure.sql
index 9243ad5..8c444fe 100644
--- a/installer/data/Pg/kohastructure.sql
+++ b/installer/data/Pg/kohastructure.sql
@@ -540,12 +540,17 @@ branchname text NOT NULL,
branchaddress1 text,
branchaddress2 text,
branchaddress3 text,
+branchzip varchar(25) default NULL,
+branchcity mediumtext,
+branchcountry text,
branchphone text,
branchfax text,
branchemail text,
+branchurl mediumtext,
issuing int default NULL,
branchip varchar(15) default NULL,
-branchprinter varchar(100) default NULL
+branchprinter varchar(100) default NULL,
+branchnotes mediumtext
);
--
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 2b2e0c9..591ab58 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -569,12 +569,17 @@ CREATE TABLE `branches` (
`branchaddress1` mediumtext,
`branchaddress2` mediumtext,
`branchaddress3` mediumtext,
+ `branchzip` varchar(25) default NULL,
+ `branchcity` mediumtext,
+ `branchcountry` text,
`branchphone` mediumtext,
`branchfax` mediumtext,
`branchemail` mediumtext,
+ `branchurl` mediumtext,
`issuing` tinyint(4) default NULL,
`branchip` varchar(15) default NULL,
`branchprinter` varchar(100) default NULL,
+ `branchnotes` mediumtext,
UNIQUE KEY `branchcode` (`branchcode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 58497c8..ea126f8 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2467,6 +2467,25 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
print "Upgrade to $DBversion done (added FilterBeforeOverdueReport syspref and new index on authorised_values)\n";
}
+=item
+
+ Deal with branches
+
+=cut
+
+my $DBversion = "3.01.00.038";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ # update branches table
+ #
+ $dbh->do("ALTER TABLE branches ADD `branchzip` varchar(25) default NULL AFTER `branchaddress3`");
+ $dbh->do("ALTER TABLE branches ADD `branchcity` mediumtext AFTER `branchzip`");
+ $dbh->do("ALTER TABLE branches ADD `branchcountry` text AFTER `branchcity`");
+ $dbh->do("ALTER TABLE branches ADD `branchurl` mediumtext AFTER `branchemail`");
+ $dbh->do("ALTER TABLE branches ADD `branchnotes` mediumtext AFTER `branchprinter`");
+ print "Upgrade to $DBversion done (branches)\n";
+ SetVersion ($DBversion);
+}
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
--
1.6.3.3
>From 434e9375128d129edf479d07ed486a3dec002d7c Mon Sep 17 00:00:00 2001
From: =?utf-8?q?S=C3=A9bastien=20Hinderer?= <[email protected]>
Date: Mon, 27 Jul 2009 10:33:27 +0200
Subject: [PATCH 2/3] C4/Branch.pm: the branch{zip,city,country,url,notes} rows should
be taken into account during Add and Mod operations.
Content-Type: text/plain; charset="utf-8"
---
C4/Branch.pm | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/C4/Branch.pm b/C4/Branch.pm
index 7dfd737..a6ab59c 100644
--- a/C4/Branch.pm
+++ b/C4/Branch.pm
@@ -199,34 +199,43 @@ sub ModBranch {
my $query = "
INSERT INTO branches
(branchcode,branchname,branchaddress1,
- branchaddress2,branchaddress3,branchphone,
- branchfax,branchemail,branchip,branchprinter)
- VALUES (?,?,?,?,?,?,?,?,?,?)
+ branchaddress2,branchaddress3,branchzip,branchcity,
+ branchcountry,branchphone,branchfax,branchemail,
+ branchurl,branchip,branchprinter,branchnotes)
+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
";
my $sth = $dbh->prepare($query);
$sth->execute(
$data->{'branchcode'}, $data->{'branchname'},
$data->{'branchaddress1'}, $data->{'branchaddress2'},
- $data->{'branchaddress3'}, $data->{'branchphone'},
- $data->{'branchfax'}, $data->{'branchemail'},
+ $data->{'branchaddress3'}, $data->{'branchzip'},
+ $data->{'branchcity'}, $data->{'branchcountry'},
+ $data->{'branchphone'}, $data->{'branchfax'},
+ $data->{'branchemail'}, $data->{'branchurl'},
$data->{'branchip'}, $data->{'branchprinter'},
+ $data->{'branchnotes'},
);
return 1 if $dbh->err;
} else {
my $query = "
UPDATE branches
SET branchname=?,branchaddress1=?,
- branchaddress2=?,branchaddress3=?,branchphone=?,
- branchfax=?,branchemail=?,branchip=?,branchprinter=?
+ branchaddress2=?,branchaddress3=?,branchzip=?,
+ branchcity=?,branchcountry=?,branchphone=?,
+ branchfax=?,branchemail=?,branchurl=?,branchip=?,
+ branchprinter=?,branchnotes=?
WHERE branchcode=?
";
my $sth = $dbh->prepare($query);
$sth->execute(
$data->{'branchname'},
$data->{'branchaddress1'}, $data->{'branchaddress2'},
- $data->{'branchaddress3'}, $data->{'branchphone'},
- $data->{'branchfax'}, $data->{'branchemail'},
+ $data->{'branchaddress3'}, $data->{'branchzip'},
+ $data->{'branchcity'}, $data->{'branchcountry'},
+ $data->{'branchphone'}, $data->{'branchfax'},
+ $data->{'branchemail'}, $data->{'branchurl'},
$data->{'branchip'}, $data->{'branchprinter'},
+ $data->{'branchnotes'},
$data->{'branchcode'},
);
}
--
1.6.3.3
>From f037d7cd82ba31b41b1170e1bc5ba29316a84659 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?S=C3=A9bastien=20Hinderer?= <[email protected]>
Date: Mon, 27 Jul 2009 11:43:24 +0200
Subject: [PATCH 3/3] Modifies branches script and template so that the newly added rows
are taken into account.
Content-Type: text/plain; charset="utf-8"
---
admin/branches.pl | 19 +++++++++++++++----
.../prog/en/modules/admin/branches.tmpl | 15 +++++++++++++++
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/admin/branches.pl b/admin/branches.pl
index ed7625c..10ebe34 100755
--- a/admin/branches.pl
+++ b/admin/branches.pl
@@ -214,10 +214,15 @@ sub editbranchform {
branchaddress1 => $data->{'branchaddress1'},
branchaddress2 => $data->{'branchaddress2'},
branchaddress3 => $data->{'branchaddress3'},
+ branchzip => $data->{'branchzip'},
+ branchcity => $data->{'branchcity'},
+ branchcountry => $data->{'branchcountry'},
branchphone => $data->{'branchphone'},
branchfax => $data->{'branchfax'},
branchemail => $data->{'branchemail'},
- branchip => $data->{'branchip'}
+ branchurl => $data->{'branchurl'},
+ branchip => $data->{'branchip'},
+ branchnotes => $data->{'branchnotes'},
);
}
@@ -301,9 +306,13 @@ sub branchinfotable {
# - branchaddress1 \
# - branchaddress2 |
# - branchaddress3 | comprising the old "address" field
+ # - branchzip |
+ # - branchcity |
+ # - branchcountry |
# - branchphone |
# - branchfax |
# - branchemail /
+ # - branchurl /
# - address-empty-p (1 if no address information, 0 otherwise)
# - categories (containing a static error message)
# - category_list (loop containing "categoryname")
@@ -316,9 +325,11 @@ sub branchinfotable {
my $address_empty_p = 1;
for my $field (
'branchaddress1', 'branchaddress2',
- 'branchaddress3', 'branchphone',
- 'branchfax', 'branchemail',
- 'branchip', 'branchprinter'
+ 'branchaddress3', 'branchzip',
+ 'branchcity', 'branchcountry',
+ 'branchphone', 'branchfax',
+ 'branchemail', 'branchurl',
+ 'branchip', 'branchprinter', 'branchnotes'
)
{
$row{$field} = $branch->{$field};
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl
index 2b71304..2d03b63 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tmpl
@@ -109,9 +109,13 @@
<li><label for="branchaddress1">Address Line 1</label><input type="text" name="branchaddress1" id="branchaddress1" value="<!-- TMPL_VAR name="branchaddress1" escape="HTML" -->" /></li>
<li><label for="branchaddress2">Address Line 2</label><input type="text" name="branchaddress2" id="branchaddress2" value="<!-- TMPL_VAR name="branchaddress2" escape="HTML" -->" /></li>
<li><label for="branchaddress3">Address Line 3</label><input type="text" name="branchaddress3" id="branchaddress3" value="<!-- TMPL_VAR name="branchaddress3" escape="HTML" -->" /></li>
+ <li><label for="branchzip">Zip/Postal Code</label><input type="text" name="branchzip" id="branchzip" value="<!-- TMPL_VAR name="branchzip" escape="HTML" -->" /></li>
+ <li><label for="branchcity">City</label><input type="text" name="branchcity" id="branchcity" value="<!-- TMPL_VAR name="branchcity" escape="HTML" -->" /></li>
+ <li><label for="branchcountry">Country</label><input type="text" name="branchcountry" id="branchcountry" value="<!-- TMPL_VAR name="branchcountry" escape="HTML" -->" /></li>
<li><label for="branchphone">Phone</label><input type="text" name="branchphone" id="branchphone" value="<!-- TMPL_VAR name="branchphone" escape="HTML" -->" /></li>
<li><label for="branchfax">Fax</label><input type="text" name="branchfax" id="branchfax" value="<!-- TMPL_VAR name="branchfax" escape="HTML" -->" /></li>
<li><label for="branchemail">Email</label><input type="text" name="branchemail" id="branchemail" value="<!-- TMPL_VAR name="branchemail" escape="HTML" -->" /></li>
+ <li><label for="branchurl">URL</label><input type="text" name="branchurl" id="branchurl" value="<!-- TMPL_VAR name="branchurl" escape="HTML" -->" /></li>
<li><label for="branchip">IP</label><input type="text" name="branchip" id="branchip" value="<!-- TMPL_VAR name="branchip" escape="HTML" -->" /> <span class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</span></li>
<!--
<li><label for="branchprinter">Library Printer</label>
@@ -126,6 +130,7 @@
<!-- /TMPL_LOOP -->
</select></li>
-->
+ <li><label for="branchnotes">Notes</label><input type="text" name="branchnotes" id="branchnotes" value="<!-- TMPL_VAR name="branchnotes" escape="HTML" -->" /></li>
</ol>
</fieldset>
<fieldset class="action"><input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a></fieldset>
@@ -183,12 +188,22 @@
<br /><!-- TMPL_VAR name="branchaddress2" escape="HTML" --><!-- /TMPL_IF -->
<!-- TMPL_IF name="branchaddress3" -->
<br /><!-- TMPL_VAR name="branchaddress3" escape="HTML" --><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="branchzip" -->
+ <br /><!-- TMPL_VAR name="branchzip" escape="HTML" --><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="branchcity" -->
+ <br /><!-- TMPL_VAR name="branchcity" escape="HTML" --><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="branchcountry" -->
+ <br /><!-- TMPL_VAR name="branchcountry" escape="HTML" --><!-- /TMPL_IF -->
<!-- TMPL_IF name="branchphone" -->
<br />Ph: <!-- TMPL_VAR name="branchphone" escape="HTML" --><!-- /TMPL_IF -->
<!-- TMPL_IF name="branchfax" -->
<br />Fax: <!-- TMPL_VAR name="branchfax" escape="HTML" --><!-- /TMPL_IF -->
<!-- TMPL_IF name="branchemail" -->
<br />Email: <!-- TMPL_VAR name="branchemail" escape="HTML" --><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="branchurl" -->
+ <br />URL: <!-- TMPL_VAR name="branchurl" escape="HTML" --><!-- /TMPL_IF -->
+ <!-- TMPL_IF name="branchnotes" -->
+ <br />Notes: <!-- TMPL_VAR name="branchnotesl" escape="HTML" --><!-- /TMPL_IF -->
<!-- /TMPL_IF -->
</td>
<td>
--
1.6.3.3
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches