From 740e21a346dd3f10a22ea826f5df62455cfcad5e Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Thu, 2 Feb 2012 15:52:02 +1300 Subject: [PATCH] bug_7264: [SIGNED-OFF] Added opac_info field to branches table. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rhe contents are displayed on the opac detail screen as a branch popup Signed-off-by: Magnus Enger Applied the patch and then could enter information for each library in Administration › Libraries and Groups, with a nice MCE interface. In the OPAC the entered information is displayed in a popup, but only for those libraries that have the info, if a library lacks info it looks exactly as it used to. It's possible to mouse over the popup, so providing links in the popup will work. I think the popup needs a border to stand out more, I have created a separate, followup patch for that. --- C4/Branch.pm | 10 ++++---- C4/Items.pm | 13 ++-------- admin/branches.pl | 4 ++- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 +++++++ .../prog/en/modules/admin/branches.tt | 22 +++++++++++++++++++ .../prog/en/lib/jquery/plugins/jquery.tools.min.js | 11 +++++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 23 +++++++++++++++++++- 8 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/prog/en/lib/jquery/plugins/jquery.tools.min.js diff --git a/C4/Branch.pm b/C4/Branch.pm index 7bd0326..2153028 100644 --- a/C4/Branch.pm +++ b/C4/Branch.pm @@ -204,8 +204,8 @@ sub ModBranch { (branchcode,branchname,branchaddress1, branchaddress2,branchaddress3,branchzip,branchcity,branchstate, branchcountry,branchphone,branchfax,branchemail, - branchurl,branchip,branchprinter,branchnotes) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + branchurl,branchip,branchprinter,branchnotes,opac_info) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) "; my $sth = $dbh->prepare($query); $sth->execute( @@ -217,7 +217,7 @@ sub ModBranch { $data->{'branchphone'}, $data->{'branchfax'}, $data->{'branchemail'}, $data->{'branchurl'}, $data->{'branchip'}, $data->{'branchprinter'}, - $data->{'branchnotes'}, + $data->{'branchnotes'}, $data->{opac_info}, ); return 1 if $dbh->err; } else { @@ -227,7 +227,7 @@ sub ModBranch { branchaddress2=?,branchaddress3=?,branchzip=?, branchcity=?,branchstate=?,branchcountry=?,branchphone=?, branchfax=?,branchemail=?,branchurl=?,branchip=?, - branchprinter=?,branchnotes=? + branchprinter=?,branchnotes=?,opac_info=? WHERE branchcode=? "; my $sth = $dbh->prepare($query); @@ -240,7 +240,7 @@ sub ModBranch { $data->{'branchphone'}, $data->{'branchfax'}, $data->{'branchemail'}, $data->{'branchurl'}, $data->{'branchip'}, $data->{'branchprinter'}, - $data->{'branchnotes'}, + $data->{'branchnotes'}, $data->{opac_info}, $data->{'branchcode'}, ); } diff --git a/C4/Items.pm b/C4/Items.pm index 04cb417..786f7a8 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1184,7 +1184,9 @@ sub GetItemsInfo { items.notforloan as itemnotforloan, itemtypes.description, itemtypes.notforloan as notforloan_per_itemtype, - branchurl + branchurl, + branchname, + branches.opac_info as branch_opac_info FROM items LEFT JOIN branches ON items.holdingbranch = branches.branchcode LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber @@ -1235,15 +1237,6 @@ sub GetItemsInfo { # value. $count_reserves = $restype; } - #get branch information..... - my $bsth = $dbh->prepare( - "SELECT * FROM branches WHERE branchcode = ? - " - ); - $bsth->execute( $data->{'holdingbranch'} ); - if ( my $bdata = $bsth->fetchrow_hashref ) { - $data->{'branchname'} = $bdata->{'branchname'}; - } $data->{'datedue'} = $datedue; $data->{'count_reserves'} = $count_reserves; diff --git a/admin/branches.pl b/admin/branches.pl index 12c49e2..c12762d 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -328,6 +328,7 @@ sub branchinfotable { # - branchfax | # - branchemail / # - branchurl / + # - opac_info (can contain HTML) # - address-empty-p (1 if no address information, 0 otherwise) # - categories (containing a static error message) # - category_list (loop containing "categoryname") @@ -343,7 +344,7 @@ sub branchinfotable { 'branchaddress3', 'branchzip', 'branchcity', 'branchstate', 'branchcountry', 'branchphone', 'branchfax', - 'branchemail', 'branchurl', + 'branchemail', 'branchurl', 'opac_info', 'branchip', 'branchprinter', 'branchnotes' ) { @@ -406,6 +407,7 @@ sub _branch_to_template { branchfax => $data->{'branchfax'}, branchemail => $data->{'branchemail'}, branchurl => $data->{'branchurl'}, + opac_info => $data->{'opac_info'}, branchip => $data->{'branchip'}, branchnotes => $data->{'branchnotes'}, ); diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 37113c2..da19647 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -361,6 +361,7 @@ CREATE TABLE `branches` ( -- information about your libraries or branches are st `branchip` varchar(15) default NULL, -- the IP address for your library or branch `branchprinter` varchar(100) default NULL, -- unused in Koha `branchnotes` mediumtext, -- notes related to your library or branch + opac_info text, -- HTML that displays in OPAC UNIQUE KEY `branchcode` (`branchcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 099dfb9..26faadd 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4663,6 +4663,14 @@ ENDOFRENEWAL print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n"; SetVersion($DBversion); } + +$DBversion = "3.07.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE branches ADD opac_info text;"); + print "Upgrade to $DBversion done add opac_info to branches \n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index df5e56c..b819e01 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -13,6 +13,25 @@ [% INCLUDE 'doc-head-close.inc' %] + + [% INCLUDE 'header.inc' %] @@ -122,6 +141,7 @@
  • +
  • Can be entered as a single IP, or a subnet such as 192.168.1.*