[Koha-patches] [PATCH] Bug 5806 If you choose SearchMyLibraryOnly you should only see items from tha selected library and nothing else.

Peter Lorimer peter at oslo.ie
Wed Jul 27 19:15:01 CEST 2011


---
 C4/Accounts.pm                                     |   26 +++--
 C4/Acquisition.pm                                  |   21 ++--
 C4/Auth.pm                                         |   16 +--
 C4/Auth_with_ldap.pm                               |   27 ++---
 C4/Biblio.pm                                       |  124 ++++++-------------
 C4/Branch.pm                                       |   45 ++++++-
 C4/Budgets.pm                                      |   34 ++++--
 C4/Category.pm                                     |   18 +++
 C4/Circulation.pm                                  |   40 +++++-
 C4/Creators/PDF.pm                                 |    2 -
 C4/Form/MessagingPreferences.pm                    |   21 +--
 C4/Installer/PerlDependencies.pm                   |    7 +-
 C4/ItemCirculationAlertPreference.pm               |    4 +-
 C4/ItemType.pm                                     |   12 ++-
 C4/Items.pm                                        |   49 ++++++--
 C4/Koha.pm                                         |   38 +++++-
 C4/Labels/Label.pm                                 |    4 +-
 C4/Letters.pm                                      |   24 ++--
 C4/Log.pm                                          |    2 +-
 C4/Members.pm                                      |  106 +++++++++-------
 C4/Members/Attributes.pm                           |    5 -
 C4/Record.pm                                       |   17 +--
 C4/Reserves.pm                                     |   15 +--
 C4/Search.pm                                       |   34 +++++-
 C4/Templates.pm                                    |    1 +
 C4/VirtualShelves.pm                               |    2 +-
 acqui/addorder.pl                                  |    1 -
 acqui/basketgroup.pl                               |   16 ++-
 acqui/histsearch.pl                                |   14 +--
 acqui/neworderempty.pl                             |    8 --
 admin/aqbudgetperiods.pl                           |   26 ++++
 admin/aqbudgets.pl                                 |    6 +-
 admin/aqcontract.pl                                |   32 ++----
 admin/auth_tag_structure.pl                        |   17 ++--
 admin/authorised_values.pl                         |   16 +++-
 admin/branches.pl                                  |   22 +++-
 admin/categorie.pl                                 |   14 ++-
 admin/cities.pl                                    |   38 +++++--
 admin/item_circulation_alerts.pl                   |    4 +-
 admin/itemtypes.pl                                 |   42 ++++--
 admin/roadtype.pl                                  |   14 ++-
 admin/smart-rules.pl                               |   64 ++++++++--
 basket/basket.pl                                   |    2 +-
 basket/sendbasket.pl                               |    2 +-
 catalogue/detail.pl                                |   32 ++++-
 catalogue/detailprint.pl                           |    2 +-
 catalogue/search.pl                                |   48 ++-----
 cataloguing/addbiblio.pl                           |   12 +--
 cataloguing/additem.pl                             |   69 +++++++++--
 cataloguing/z3950_search.pl                        |    7 +-
 circ/circulation.pl                                |    7 +-
 circ/overdue.pl                                    |   25 ++++-
 circ/returns.pl                                    |    6 -
 circ/ysearch.pl                                    |   30 ++++-
 debian/build-git-snapshot                          |    2 +-
 debian/changelog                                   |   40 ------
 debian/control                                     |    4 +-
 debian/control.in                                  |    1 -
 debian/koha-common.install                         |    1 -
 debian/koha-common.postinst                        |    6 -
 debian/rules                                       |   12 +-
 docs/history.txt                                   |  132 +++++++++-----------
 etc/koha-conf.xml                                  |   83 +------------
 etc/zebradb/biblios/etc/bib1.att                   |    1 -
 etc/zebradb/marc_defs/marc21/biblios/record.abs    |   55 ++++----
 help.pl                                            |   55 +++++++--
 installer/data/mysql/de-DE/mandatory/sysprefs.sql  |    4 +-
 .../mysql/de-DE/optional/sample_creator_data.sql   |    2 +-
 installer/data/mysql/en/mandatory/sysprefs.sql     |    2 -
 .../data/mysql/en/optional/sample_creator_data.sql |    2 +-
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    4 +-
 .../sample_notices_message_attributes.sql          |   11 +-
 installer/data/mysql/it-IT/necessari/sysprefs.sql  |    2 -
 .../data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql   |    1 -
 .../nb-NO/2-Valgfritt/sample_creator_data.sql      |    2 +-
 installer/data/mysql/pl-PL/mandatory/sysprefs.sql  |    4 +-
 ...m_preferences_full_optimal_for_install_only.sql |    4 +-
 ...m_preferences_full_optimal_for_install_only.sql |    2 -
 installer/data/mysql/updatedatabase.pl             |  106 +++++-----------
 koha-tmpl/intranet-tmpl/prog/en/columns.def        |    2 +-
 .../intranet-tmpl/prog/en/css/staff-global.css     |   63 +---------
 .../intranet-tmpl/prog/en/includes/admin-menu.inc  |   15 ---
 .../prog/en/includes/circ-toolbar.inc              |    2 +-
 .../intranet-tmpl/prog/en/includes/facets.inc      |    7 +-
 .../prog/en/includes/members-toolbar.inc           |    2 +-
 .../prog/en/includes/patron-search.inc             |    9 +-
 .../prog/en/includes/serials-toolbar.inc           |    4 +-
 koha-tmpl/intranet-tmpl/prog/en/modules/about.tt   |   57 +--------
 .../prog/en/modules/acqui/neworderempty.tt         |   21 +---
 .../prog/en/modules/admin/aqbudgetperiods.tt       |    8 +-
 .../prog/en/modules/admin/aqbudgets.tt             |    1 -
 .../prog/en/modules/admin/authorised_values.tt     |   12 +-
 .../en/modules/admin/branch_transfer_limits.tt     |   11 +-
 .../prog/en/modules/admin/branches.tt              |    8 +-
 .../prog/en/modules/admin/categorie.tt             |   40 +++---
 .../intranet-tmpl/prog/en/modules/admin/cities.tt  |    4 +-
 .../en/modules/admin/item_circulation_alerts.tt    |    9 +-
 .../prog/en/modules/admin/itemtypes.tt             |    2 +-
 .../en/modules/admin/marc_subfields_structure.tt   |    6 +-
 .../prog/en/modules/admin/preferences/admin.pref   |   11 ++
 .../prog/en/modules/admin/preferences/opac.pref    |   18 +---
 .../en/modules/admin/preferences/staff_client.pref |    2 +-
 .../prog/en/modules/admin/roadtype.tt              |    2 +-
 .../modules/authorities/searchresultlist-auth.tt   |    6 +-
 .../intranet-tmpl/prog/en/modules/basket/basket.tt |   10 +-
 .../prog/en/modules/catalogue/advsearch.tt         |  132 ++++++++++++++------
 .../prog/en/modules/catalogue/detail.tt            |   10 +-
 .../prog/en/modules/catalogue/issuehistory.tt      |    3 +-
 .../prog/en/modules/catalogue/results.tt           |   18 ++--
 .../prog/en/modules/cataloguing/addbiblio.tt       |    4 +-
 .../prog/en/modules/cataloguing/moveitem.tt        |    9 +-
 .../prog/en/modules/cataloguing/z3950_search.tt    |    6 +-
 .../prog/en/modules/circ/bookcount.tt              |    2 +-
 .../prog/en/modules/circ/circulation-home.tt       |    4 +-
 .../prog/en/modules/circ/circulation.tt            |    4 +-
 .../intranet-tmpl/prog/en/modules/circ/overdue.tt  |   21 ++--
 .../intranet-tmpl/prog/en/modules/circ/returns.tt  |    3 +-
 .../prog/en/modules/help/members/moremember.tt     |    2 +-
 .../prog/en/modules/help/tools/overduerules.tt     |    4 +-
 .../intranet-tmpl/prog/en/modules/labels/result.tt |    2 +-
 .../prog/en/modules/members/member.tt              |    2 +-
 .../prog/en/modules/members/memberentrygen.tt      |   18 +---
 .../prog/en/modules/members/moremember-brief.tt    |    2 +-
 .../prog/en/modules/members/moremember-print.tt    |    8 --
 .../prog/en/modules/members/moremember.tt          |    6 +-
 .../prog/en/modules/members/update-child.tt        |   18 +---
 .../prog/en/modules/patroncards/members-search.tt  |    2 +-
 .../prog/en/modules/reports/borrowers_stats.tt     |    2 +-
 .../prog/en/modules/reports/dictionary.tt          |   98 +++++++-------
 .../en/modules/reports/guided_reports_start.tt     |   21 ++-
 .../prog/en/modules/reserve/request.tt             |   17 ++--
 .../prog/en/modules/serials/acqui-search-result.tt |    4 +-
 .../prog/en/modules/serials/member-search.tt       |    3 +-
 .../prog/en/modules/serials/routing.tt             |   11 +-
 .../prog/en/modules/serials/serials-edit.tt        |   19 ++--
 .../prog/en/modules/serials/serials-home.tt        |    2 +-
 .../prog/en/modules/serials/serials-recieve.tt     |    3 +-
 .../prog/en/modules/serials/subscription-add.tt    |   28 ++--
 .../intranet-tmpl/prog/en/modules/tags/review.tt   |    8 +-
 .../prog/en/modules/tools/batchMod-del.tt          |    5 +-
 .../prog/en/modules/tools/batchMod-edit.tt         |    5 +-
 .../prog/en/modules/tools/holidays.tt              |   31 ++---
 .../prog/en/modules/tools/koha-news.tt             |   16 ++--
 .../prog/en/modules/tools/manage-marc-import.tt    |    4 +-
 .../prog/en/modules/tools/overduerules.tt          |   10 +-
 koha-tmpl/opac-tmpl/prog/en/css/opac.css           |    4 -
 .../opac-tmpl/prog/en/includes/item-status.inc     |   36 +++---
 .../opac-tmpl/prog/en/includes/opac-facets.inc     |   15 ++-
 .../opac-tmpl/prog/en/modules/opac-ISBDdetail.tt   |    2 +-
 .../opac-tmpl/prog/en/modules/opac-MARCdetail.tt   |    2 +-
 .../prog/en/modules/opac-addbybiblionumber.tt      |    2 +-
 .../opac-tmpl/prog/en/modules/opac-advsearch.tt    |    4 +-
 .../en/modules/opac-authoritiessearchresultlist.tt |    2 +-
 koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt |   20 ++--
 .../opac-tmpl/prog/en/modules/opac-downloadcart.tt |    2 +-
 .../prog/en/modules/opac-downloadshelf.tt          |   51 +++-----
 .../opac-tmpl/prog/en/modules/opac-opensearch.tt   |    2 +-
 .../opac-tmpl/prog/en/modules/opac-privacy.tt      |    2 +-
 .../prog/en/modules/opac-readingrecord.tt          |    2 +-
 .../opac-tmpl/prog/en/modules/opac-reserve.tt      |   37 +++---
 .../opac-tmpl/prog/en/modules/opac-results.tt      |   10 +-
 koha-tmpl/opac-tmpl/prog/en/modules/opac-review.tt |    6 +-
 .../prog/en/modules/opac-sendshelfform.tt          |   41 +++----
 .../prog/en/modules/opac-serial-issues.tt          |    4 +-
 .../opac-tmpl/prog/en/modules/opac-shelves.tt      |    2 +-
 .../prog/en/modules/opac-showreviews-rss.tt        |    2 +-
 .../opac-tmpl/prog/en/modules/opac-showreviews.tt  |    8 +-
 koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt   |   90 ++++++++++----
 .../opac-tmpl/prog/en/modules/opac-userdetails.tt  |    2 +-
 .../opac-tmpl/prog/en/modules/opac-userupdate.tt   |    4 +-
 kohaversion.pl                                     |    2 +-
 labels/label-create-xml.pl                         |    5 +-
 labels/label-edit-batch.pl                         |    2 +-
 labels/label-edit-layout.pl                        |    2 +-
 labels/label-manage.pl                             |    2 +-
 mainpage.pl                                        |    6 +
 members/mancredit.pl                               |    5 +-
 members/maninvoice.pl                              |    5 +-
 members/member.pl                                  |   30 ++++-
 members/memberentry.pl                             |  117 +++++++++++-------
 members/members-home.pl                            |   24 +++--
 members/moremember.pl                              |    2 +-
 misc/admin/koha-preferences                        |    2 -
 misc/bin/koha-pazpar2-ctl.sh                       |   25 ----
 misc/bin/koha-zebra-ctl.sh                         |   25 ----
 misc/cronjobs/advance_notices.pl                   |   39 ++----
 misc/cronjobs/crontab.example                      |   73 +-----------
 misc/cronjobs/overdue_notices.pl                   |    3 -
 misc/maintenance/remove_items_from_biblioitems.pl  |   11 +--
 misc/migration_tools/rebuild_zebra.pl              |   50 +++-----
 misc/translator/tmpl_process3.pl                   |   15 ---
 opac/opac-ISBDdetail.pl                            |    7 +-
 opac/opac-MARCdetail.pl                            |    2 +-
 opac/opac-authorities-home.pl                      |   26 ++--
 opac/opac-authoritiesdetail.pl                     |   16 ++-
 opac/opac-detail.pl                                |   18 +--
 opac/opac-downloadshelf.pl                         |   85 ++++++-------
 opac/opac-main.pl                                  |   35 +++++-
 opac/opac-renew.pl                                 |   27 +----
 opac/opac-reserve.pl                               |    6 +-
 opac/opac-search.pl                                |   61 ++++------
 opac/opac-sendbasket.pl                            |    2 +-
 opac/opac-sendshelf.pl                             |   11 +--
 opac/opac-showreviews.pl                           |   10 --
 opac/opac-topissues.pl                             |    6 +-
 opac/opac-user.pl                                  |   28 +++--
 opac/sco/sco-main.pl                               |    2 +-
 patroncards/edit-batch.pl                          |    2 +-
 patroncards/manage.pl                              |    2 +-
 reports/acquisitions_stats.pl                      |   15 ++-
 reports/bor_issues_top.pl                          |   12 ++-
 reports/borrowers_out.pl                           |   20 +++-
 reports/borrowers_stats.pl                         |   11 ++-
 reports/cat_issues_top.pl                          |   19 +++-
 reports/catalogue_stats.pl                         |    8 ++
 reports/guided_reports.pl                          |    6 +-
 reports/issues_avg_stats.pl                        |   54 ++++----
 reports/reservereport.pl                           |    2 +-
 reserve/placerequest.pl                            |   22 ++--
 reserve/request.pl                                 |   77 ++++++------
 serials/routing-preview.pl                         |    2 +-
 serials/serials-edit.pl                            |    1 -
 serials/subscription-add.pl                        |   12 +-
 suggestion/suggestion.pl                           |   12 +--
 t/db_dependent/Biblio.t                            |   36 +-----
 tools/export.pl                                    |   17 ++--
 tools/holidays.pl                                  |   20 ++--
 tools/import_borrowers.pl                          |   10 +--
 tools/inventory.pl                                 |    6 +-
 tools/koha-news.pl                                 |    2 +-
 tools/picture-upload.pl                            |   12 +--
 virtualshelves/sendshelf.pl                        |    2 +-
 232 files changed, 2075 insertions(+), 2153 deletions(-)

diff --git a/C4/Accounts.pm b/C4/Accounts.pm
index 3275099..32054f4 100644
--- a/C4/Accounts.pm
+++ b/C4/Accounts.pm
@@ -169,11 +169,13 @@ sub makepayment {
     my $data = $sth->fetchrow_hashref;
     $sth->finish;
 
-    $sth = $dbh->prepare("UPDATE accountlines
-			        SET amountoutstanding = 0
-			      WHERE borrowernumber = ?
-				AND accountno = ?");
-    $sth->execute($borrowernumber, $accountno);
+    $dbh->do(
+        "UPDATE  accountlines
+        SET     amountoutstanding = 0
+        WHERE   borrowernumber = $borrowernumber
+          AND   accountno = $accountno
+        "
+    );
 
     #  print $updquery;
 #    $dbh->do( "
@@ -185,18 +187,20 @@ sub makepayment {
 
     # create new line
     my $payment = 0 - $amount;
-    $sth = $dbh->prepare("INSERT INTO accountlines
-					 (borrowernumber, accountno, date, amount,
-					  description, accounttype, amountoutstanding)
-				  VALUES (?,?,now(),?,?,'Pay',0)");
-    $sth->execute($borrowernumber, $nextaccntno, $payment, "Payment,thanks - $user");
+    $dbh->do( "
+        INSERT INTO     accountlines
+                        (borrowernumber, accountno, date, amount,
+                         description, accounttype, amountoutstanding)
+        VALUES          ($borrowernumber, $nextaccntno, now(), $payment,
+                        'Payment,thanks - $user', 'Pay', 0)
+        " );
 
     # FIXME - The second argument to &UpdateStats is supposed to be the
     # branch code.
     # UpdateStats is now being passed $accountno too. MTJ
     UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber,
         $accountno );
-    #from perldoc: for SELECT only #$sth->finish;
+    $sth->finish;
 
     #check to see what accounttype
     if ( $data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L' ) {
diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index 738fe16..e431bd2 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -233,7 +233,7 @@ sub GetBasketAsCSV {
     my $output; 
 
     # TODO: Translate headers
-    my @headers = qw(contractname ordernumber entrydate isbn author title publishercode collectiontitle notes quantity rrp);
+    my @headers = qw(contractname ordernumber line entrydate isbn author title publishercode collectiontitle notes quantity rrp);
 
     $csv->combine(@headers);                                                                                                        
     $output = $csv->string() . "\n";	
@@ -241,17 +241,16 @@ sub GetBasketAsCSV {
     my @rows;
     foreach my $order (@orders) {
 	my @cols;
-	# newlines are not valid characters for Text::CSV combine()
-        $order->{'notes'} =~ s/[\r\n]+//g;
+	my $bd = GetBiblioData($order->{'biblionumber'});
 	push(@cols,
 		$contract->{'contractname'},
 		$order->{'ordernumber'},
 		$order->{'entrydate'}, 
 		$order->{'isbn'},
-		$order->{'author'},
-		$order->{'title'},
-		$order->{'publishercode'},
-		$order->{'collectiontitle'},
+		$bd->{'author'},
+		$bd->{'title'},
+		$bd->{'publishercode'},
+		$bd->{'collectiontitle'},
 		$order->{'notes'},
 		$order->{'quantity'},
 		$order->{'rrp'},
@@ -259,6 +258,10 @@ sub GetBasketAsCSV {
 	push (@rows, \@cols);
     }
 
+    # Sort by publishercode 
+    # TODO: Sort by publishercode then by title
+    @rows = sort { @$a[7] cmp @$b[7] } @rows;
+
     foreach my $row (@rows) {
 	$csv->combine(@$row);                                                                                                                    
 	$output .= $csv->string() . "\n";    
@@ -1349,9 +1352,8 @@ sub GetParcels {
                 sum(quantity) AS itemsexpected,
                 sum(quantityreceived) AS itemsreceived
         FROM   aqorders LEFT JOIN aqbasket ON aqbasket.basketno = aqorders.basketno
-        WHERE aqbasket.booksellerid = ? and datereceived IS NOT NULL
+        WHERE aqbasket.booksellerid = $bookseller and datereceived IS NOT NULL
     ";
-    push @query_params, $bookseller;
 
     if ( defined $code ) {
         $strsth .= ' and aqorders.booksellerinvoicenumber like ? ';
@@ -1432,7 +1434,6 @@ sub GetLateOrders {
             OR datereceived IS NULL
             OR aqorders.quantityreceived < aqorders.quantity
         )
-        AND (aqorders.datecancellationprinted IS NULL OR aqorders.datecancellationprinted='0000-00-00')
     ";
     my $having = "";
     if ($dbdriver eq "mysql") {
diff --git a/C4/Auth.pm b/C4/Auth.pm
index f580e53..b416449 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -137,15 +137,12 @@ sub get_template_and_user {
     my $in       = shift;
     my $template =
       gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'} );
-    my ( $user, $cookie, $sessionID, $flags );
-    if ( $in->{'template_name'} !~m/maintenance/ ) {
-        ( $user, $cookie, $sessionID, $flags ) = checkauth(
-            $in->{'query'},
-            $in->{'authnotrequired'},
-            $in->{'flagsrequired'},
-            $in->{'type'}
-        );
-    }
+    my ( $user, $cookie, $sessionID, $flags ) = checkauth(
+        $in->{'query'},
+        $in->{'authnotrequired'},
+        $in->{'flagsrequired'},
+        $in->{'type'}
+    ) unless ($in->{'template_name'}=~/maintenance/);
 
     my $borrowernumber;
     my $insecure = C4::Context->preference('insecure');
@@ -458,7 +455,6 @@ sub get_template_and_user {
             opacuserlogin             => "" . C4::Context->preference("opacuserlogin"),
             reviewson                 => C4::Context->preference("reviewson"),
             ShowReviewer              => C4::Context->preference("ShowReviewer"),
-            ShowReviewerPhoto         => C4::Context->preference("ShowReviewerPhoto"),
             suggestion                => "" . C4::Context->preference("suggestion"),
             virtualshelves            => "" . C4::Context->preference("virtualshelves"),
             OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"),
diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm
index 5baa07f..acbd923 100644
--- a/C4/Auth_with_ldap.pm
+++ b/C4/Auth_with_ldap.pm
@@ -82,6 +82,11 @@ sub search_method {
     my $userid = shift or return;
 	my $uid_field = $mapping{userid}->{is} or die ldapserver_error("mapping for 'userid'");
 	my $filter = Net::LDAP::Filter->new("$uid_field=$userid") or die "Failed to create new Net::LDAP::Filter";
+    my $res = ($config{anonymous}) ? $db->bind : $db->bind($ldapname, password=>$ldappassword);
+    if ($res->code) {		# connection refused
+        warn "LDAP bind failed as ldapuser " . ($ldapname || '[ANONYMOUS]') . ": " . description($res);
+        return 0;
+    }
 	my $search = $db->search(
 		  base => $base,
 	 	filter => $filter,
@@ -119,21 +124,10 @@ sub checkpw_ldap {
         }
 
 	# FIXME dpavlin -- we really need $userldapentry leater on even if using auth_by_bind!
-
-	# BUG #5094
-	# 2010-08-04 JeremyC
-	# a $userldapentry is only needed if either updating or replicating are enabled
-	if($config{update} or $config{replicate}) {
-	    my $search = search_method($db, $userid) or return 0;   # warnings are in the sub
-	    $userldapentry = $search->shift_entry;
-	}
+	my $search = search_method($db, $userid) or return 0;   # warnings are in the sub
+	$userldapentry = $search->shift_entry;
 
 	} else {
-		my $res = ($config{anonymous}) ? $db->bind : $db->bind($ldapname, password=>$ldappassword);
-		if ($res->code) {		# connection refused
-			warn "LDAP bind failed as ldapuser " . ($ldapname || '[ANONYMOUS]') . ": " . description($res);
-			return 0;
-		}
         my $search = search_method($db, $userid) or return 0;   # warnings are in the sub
         $userldapentry = $search->shift_entry;
 		my $cmpmesg = $db->compare( $userldapentry, attr=>'userpassword', value => $password );
@@ -171,9 +165,8 @@ sub checkpw_ldap {
 	if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) {
    		my @types = C4::Members::AttributeTypes::GetAttributeTypes();
 		my @attributes = grep{my $key=$_; any{$_ eq $key}@types;} keys %borrower;
-        my $extended_patron_attributes;
-        @{$extended_patron_attributes} =
-          map { { code => $_, value => $borrower{$_} } } @attributes;
+		my $extended_patron_attributes = map{{code=>$_,value=>$borrower{$_}}}@attributes;
+		my $extended_patron_attributes = [] unless $extended_patron_attributes;
 		my @errors;
 		#Check before add
 		for (my $i; $i< scalar(@$extended_patron_attributes)-1;$i++) {
@@ -217,7 +210,7 @@ sub ldap_entry_2_hash ($$) {
 	$debug and print STDERR "Finsihed \%memberhash has ", scalar(keys %memberhash), " keys\n",
 					"Referencing \%mapping with ", scalar(keys %mapping), " keys\n";
 	foreach my $key (keys %mapping) {
-		my  $data = $memberhash{ lc($mapping{$key}->{is}) }; # Net::LDAP returns all names in lowercase
+		my  $data = $memberhash{$mapping{$key}->{is}}; 
 		$debug and printf STDERR "mapping %20s ==> %-20s (%s)\n", $key, $mapping{$key}->{is}, $data;
 		unless (defined $data) { 
 			$data = $mapping{$key}->{content} || '';	# default or failsafe ''
diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index a91562c..6e14a2c 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -21,7 +21,6 @@ package C4::Biblio;
 
 use strict;
 use warnings;
-use Carp;
 
 # use utf8;
 use MARC::Record;
@@ -295,23 +294,11 @@ and biblionumber data for indexing.
 
 sub ModBiblio {
     my ( $record, $biblionumber, $frameworkcode ) = @_;
-    croak "No record" unless $record;
-
     if ( C4::Context->preference("CataloguingLog") ) {
         my $newrecord = GetMarcBiblio($biblionumber);
         logaction( "CATALOGUING", "MODIFY", $biblionumber, "BEFORE=>" . $newrecord->as_formatted );
     }
 
-    # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to
-    # throw an exception which probably won't be handled.
-    foreach my $field ($record->fields()) {
-        if (! $field->is_control_field()) {
-            if (scalar($field->subfields()) == 0 || (scalar($field->subfields()) == 1 && $field->subfield('9'))) {
-                $record->delete_field($field);
-            }
-        }
-    }
-
     SetUTF8Flag($record);
     my $dbh = C4::Context->dbh;
 
@@ -319,6 +306,14 @@ sub ModBiblio {
 
     _strip_item_fields($record, $frameworkcode);
 
+    foreach my $field ($record->fields()) {
+        if (! $field->is_control_field()) {
+            if (scalar($field->subfields()) == 0) {
+                $record->delete_fields($field);
+            }
+        }
+    }
+
     # update biblionumber and biblioitemnumber in MARC
     # FIXME - this is assuming a 1 to 1 relationship between
     # biblios and biblioitems
@@ -361,11 +356,13 @@ sub _strip_item_fields {
     # delete any item fields from incoming record to avoid
     # duplication or incorrect data - use AddItem() or ModItem()
     # to change items
+if (defined $record)
+{
     foreach my $field ( $record->field($itemtag) ) {
         $record->delete_field($field);
     }
 }
-
+}
 =head2 ModBiblioframework
 
    ModBiblioframework($biblionumber,$frameworkcode);
@@ -1180,8 +1177,8 @@ sub GetCOinSBiblio {
     if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
 
         # Setting datas
-        $aulast  = $record->subfield( '700', 'a' ) || '';
-        $aufirst = $record->subfield( '700', 'b' ) || '';
+        $aulast  = $record->subfield( '700', 'a' );
+        $aufirst = $record->subfield( '700', 'b' );
         $oauthors = "&amp;rft.au=$aufirst $aulast";
 
         # others authors
@@ -1194,10 +1191,10 @@ sub GetCOinSBiblio {
           ( $mtx eq 'dc' )
           ? "&amp;rft.title=" . $record->subfield( '200', 'a' )
           : "&amp;rft.title=" . $record->subfield( '200', 'a' ) . "&amp;rft.btitle=" . $record->subfield( '200', 'a' );
-        $pubyear   = $record->subfield( '210', 'd' ) || '';
-        $publisher = $record->subfield( '210', 'c' ) || '';
-        $isbn      = $record->subfield( '010', 'a' ) || '';
-        $issn      = $record->subfield( '011', 'a' ) || '';
+        $pubyear   = $record->subfield( '210', 'd' );
+        $publisher = $record->subfield( '210', 'c' );
+        $isbn      = $record->subfield( '010', 'a' );
+        $issn      = $record->subfield( '011', 'a' );
     } else {
 
         # MARC21 need some improve
@@ -1513,10 +1510,7 @@ sub GetMarcSubjects {
             my $value     = $subject_subfield->[1];
             my $linkvalue = $value;
             $linkvalue =~ s/(\(|\))//g;
-            my $operator;
-            if ( $counter != 0 ) {
-                $operator = ' and ';
-            }
+            my $operator = " and " unless $counter == 0;
             if ( $code eq 9 ) {
                 $found9 = 1;
                 @link_loop = ( { 'limit' => 'an', link => "$linkvalue" } );
@@ -1524,10 +1518,7 @@ sub GetMarcSubjects {
             if ( not $found9 ) {
                 push @link_loop, { 'limit' => $subject_limit, link => $linkvalue, operator => $operator };
             }
-            my $separator;
-            if ( $counter != 0 ) {
-                $separator = C4::Context->preference('authoritysep');
-            }
+            my $separator = C4::Context->preference("authoritysep") unless $counter == 0;
 
             # ignore $9
             my @this_link_loop = @link_loop;
@@ -1585,10 +1576,7 @@ sub GetMarcAuthors {
             my $value        = $authors_subfield->[1];
             my $linkvalue    = $value;
             $linkvalue =~ s/(\(|\))//g;
-            my $operator;
-            if ( $count_auth != 0 ) {
-                $operator = ' and ';
-            }
+            my $operator = " and " unless $count_auth == 0;
 
             # if we have an authority link, use that as the link, otherwise use standard searching
             if ($subfield9) {
@@ -1604,17 +1592,8 @@ sub GetMarcAuthors {
             $value = GetAuthorisedValueDesc( $field->tag(), $authors_subfield->[0], $authors_subfield->[1], '', $tagslib )
               if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /4/ ) );
             my @this_link_loop = @link_loop;
-            my $separator;
-            if ( $count_auth != 0 ) {
-                $separator = C4::Context->preference('authoritysep');
-            }
-            push @subfields_loop,
-              { code      => $subfieldcode,
-                value     => $value,
-                link_loop => \@this_link_loop,
-                separator => $separator
-              }
-              unless ( $authors_subfield->[0] eq '9' );
+            my $separator = C4::Context->preference("authoritysep") unless $count_auth == 0;
+            push @subfields_loop, { code => $subfieldcode, value => $value, link_loop => \@this_link_loop, separator => $separator } unless ( $authors_subfield->[0] eq '9' );
             $count_auth++;
         }
         push @marcauthors, { MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop };
@@ -1725,27 +1704,13 @@ sub GetMarcSeries {
             my $value     = $series_subfield->[1];
             my $linkvalue = $value;
             $linkvalue =~ s/(\(|\))//g;
-            if ( $counter != 0 ) {
-                push @link_loop, { link => $linkvalue, operator => ' and ', };
-            } else {
-                push @link_loop, { link => $linkvalue, operator => undef, };
-            }
-            my $separator;
-            if ( $counter != 0 ) {
-                $separator = C4::Context->preference('authoritysep');
-            }
+            my $operator = " and " unless $counter == 0;
+            push @link_loop, { link => $linkvalue, operator => $operator };
+            my $separator = C4::Context->preference("authoritysep") unless $counter == 0;
             if ($volume_number) {
                 push @subfields_loop, { volumenum => $value };
             } else {
-                if ( $series_subfield->[0] ne '9' ) {
-                    push @subfields_loop, {
-                        code      => $code,
-                        value     => $value,
-                        link_loop => \@link_loop,
-                        separator => $separator,
-                        volumenum => $volume_number,
-                    };
-                }
+                push @subfields_loop, { code => $code, value => $value, link_loop => \@link_loop, separator => $separator, volumenum => $volume_number } unless ( $series_subfield->[0] eq '9' );
             }
             $counter++;
         }
@@ -2361,11 +2326,8 @@ sub PrepareItemrecordDisplay {
     my $tagslib = &GetMarcStructure( 1, $frameworkcode );
 
     # return nothing if we don't have found an existing framework.
-    return q{} unless $tagslib;
-    my $itemrecord;
-    if ($itemnum) {
-        $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum );
-    }
+    return "" unless $tagslib;
+    my $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum ) if ($itemnum);
     my @loop_data;
     my $authorised_values_sth = $dbh->prepare( "SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib" );
     foreach my $tag ( sort keys %{$tagslib} ) {
@@ -2404,20 +2366,15 @@ sub PrepareItemrecordDisplay {
                     && C4::Context->preference('itemcallnumber') ) {
                     my $CNtag      = substr( C4::Context->preference('itemcallnumber'), 0, 3 );
                     my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 );
-                    if ($itemrecord) {
-                        my $temp = $itemrecord->field($CNtag);
-                        if ($temp) {
-                            $defaultvalue = $temp->subfield($CNsubfield);
-                        }
+                    my $temp = $itemrecord->field($CNtag) if ($itemrecord);
+                    if ($temp) {
+                        $defaultvalue = $temp->subfield($CNsubfield);
                     }
                 }
                 if (   $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
                     && $defaultvalues
                     && $defaultvalues->{'callnumber'} ) {
-                    my $temp;
-                    if ($itemrecord) {
-                        $temp = $itemrecord->field($subfield);
-                    }
+                    my $temp = $itemrecord->field($subfield) if ($itemrecord);
                     unless ($temp) {
                         $defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues;
                     }
@@ -2425,10 +2382,7 @@ sub PrepareItemrecordDisplay {
                 if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' )
                     && $defaultvalues
                     && $defaultvalues->{'branchcode'} ) {
-                    my $temp;
-                    if ($itemrecord) {
-                        $temp = $itemrecord->field($subfield);
-                    }
+                    my $temp = $itemrecord->field($subfield) if ($itemrecord);
                     unless ($temp) {
                         $defaultvalue = $defaultvalues->{branchcode} if $defaultvalues;
                     }
@@ -2553,10 +2507,8 @@ sub PrepareItemrecordDisplay {
             }
         }
     }
-    my $itemnumber;
-    if ( $itemrecord && $itemrecord->field($itemtagfield) ) {
-        $itemnumber = $itemrecord->subfield( $itemtagfield, $itemtagsubfield );
-    }
+    my $itemnumber = $itemrecord->subfield( $itemtagfield, $itemtagsubfield )
+      if ( $itemrecord && $itemrecord->field($itemtagfield) );
     return {
         'itemtagfield'    => $itemtagfield,
         'itemtagsubfield' => $itemtagsubfield,
@@ -2715,7 +2667,6 @@ per the bib's MARC framework.
 
 sub EmbedItemsInMarcBiblio {
     my ($marc, $biblionumber) = @_;
-    croak "No MARC record" unless $marc;
 
     my $frameworkcode = GetFrameworkCode($biblionumber);
     _strip_item_fields($marc, $frameworkcode);
@@ -2730,7 +2681,10 @@ sub EmbedItemsInMarcBiblio {
         my $item_marc = C4::Items::GetMarcItem($biblionumber, $itemnumber);
         push @item_fields, $item_marc->field($itemtag);
     }
-    $marc->insert_fields_ordered(@item_fields);
+        if (defined $marc)
+        {
+             $marc->insert_fields_ordered(@item_fields);
+        }   
 }
 
 =head1 INTERNAL FUNCTIONS
diff --git a/C4/Branch.pm b/C4/Branch.pm
index abcdbd6..f2d7720 100644
--- a/C4/Branch.pm
+++ b/C4/Branch.pm
@@ -101,18 +101,42 @@ Create a branch selector with the following code.
 
 =cut
 
+sub scooterGetCatValues
+{
+    my $branchcode = @_;
+        my $dbh = C4::Context->dbh();
+        my $query = "SELECT categorycode, description FROM categories WHERE categorycode like '" . C4::Branch::mybranch() . ".%'";
+        my $sth =  my $sth=$dbh->prepare( $query);
+        $sth->execute;
+        my $branchcats = $sth->fetchall_arrayref({});
+        $sth->finish();
+
+        return( $branchcats, $sth->rows );
+
+
+}
+
 sub GetBranches {
     my ($onlymine)=@_;
     # returns a reference to a hash of references to ALL branches...
     my %branches;
     my $dbh = C4::Context->dbh;
-    my $sth;
-    my $query="SELECT * FROM branches";
+    my ($sth,$query);
     my @bind_parameters;
-    if ($onlymine && C4::Context->userenv && C4::Context->userenv->{branch}){
+    
+     if ( C4::Context->preference("searchMyLibraryOnly") && not C4::Branch->mybranch() eq 'NO_LIBRARY_SET' )
+          {
+              $query="SELECT * FROM branches WHERE branchcode = '" . C4::Branch->mybranch() . "' " ;
+       }
+       else {
+   $query="SELECT * FROM branches";  
+          
+    
+    if ( $onlymine && C4::Context->userenv && C4::Context->userenv->{branch}   ){
       $query .= ' WHERE branchcode = ? ';
       push @bind_parameters, C4::Context->userenv->{branch};
     }
+           }
         $query.=" ORDER BY branchname";
     $sth = $dbh->prepare($query);
     $sth->execute( @bind_parameters );
@@ -141,6 +165,21 @@ sub GetBranches {
     return ( \%branches );
 }
 
+
+sub homeBranchFromItem
+{
+my $item = $_[0];
+
+my $dbh = C4::Context::dbh();
+my $sql = "SELECT homebranch FROM items WHERE itemnumber = ?";
+my $sth = $dbh->prepare($sql);
+$sth->execute($item);
+my @row = $sth->fetchrow_array();
+
+return $row[0];    
+}
+
+
 sub onlymine {
     return 
     C4::Context->preference('IndependantBranches') &&
diff --git a/C4/Budgets.pm b/C4/Budgets.pm
index d516a12..7f74347 100644
--- a/C4/Budgets.pm
+++ b/C4/Budgets.pm
@@ -448,15 +448,26 @@ sub GetBudgetPeriod {
 		$sth = $dbh->prepare( qq|
               SELECT      *
                 FROM aqbudgetperiods
-                WHERE budget_period_id=? |
+                WHERE budget_period_id=? AND budget_period_description LIKE ? |
 		);
-		$sth->execute($budget_period_id);
+		$sth->execute($budget_period_id, C4::Branch->mybranch() . '%');
 	} else {         # ACTIVE BUDGET
+	
+	if (C4::Context->Preference("searchMyLibraryOnly"))
+	{
+		$sth = $dbh->prepare("
+			  SELECT      *
+                FROM aqbudgetperiods
+                WHERE budget_period_active=1 AND budget_period_description LIKE '" . C4::Branch->mybranch() . "%'  "
+		);
+	}	
+	else {
 		$sth = $dbh->prepare(qq|
 			  SELECT      *
                 FROM aqbudgetperiods
                 WHERE budget_period_active=1 |
-		);
+		);		
+	}
 		$sth->execute();
 	}
 	my $data = $sth->fetchrow_hashref;
@@ -490,12 +501,21 @@ sub GetBudgetHierarchy {
     my ( $budget_period_id, $branchcode, $owner ) = @_;
     my @bind_params;
     my $dbh   = C4::Context->dbh;
-    my $query = qq|
+    
+    my $query;
+        
+     $query = qq|
                     SELECT aqbudgets.*, aqbudgetperiods.budget_period_active
                     FROM aqbudgets 
                     JOIN aqbudgetperiods USING (budget_period_id)|;
                         
 	my @where_strings;
+	
+    if (C4::Context->preference("searchMyLibraryOnly"))
+    {
+	push @where_strings," aqbudgets.budget_code like '" . C4::Branch->mybranch() . "%'";
+	
+    }
     # show only period X if requested
     if ($budget_period_id) {
         push @where_strings," aqbudgets.budget_period_id = ?";
@@ -519,6 +539,7 @@ sub GetBudgetHierarchy {
     }
 	$query.=" WHERE ".join(' AND ', @where_strings) if @where_strings;
 	$debug && warn $query,join(",", at bind_params);
+	#die($query);
 	my $sth = $dbh->prepare($query);
 	$sth->execute(@bind_params);
 	my $results = $sth->fetchall_arrayref({});
@@ -590,10 +611,7 @@ sub GetBudgetHierarchy {
 # add budget-percent and allocation, and flags for html-template
 	foreach my $r (@sort) {
 		my $subs_href = $r->{'child'};
-        my @subs_arr = ();
-        if ( defined $subs_href ) {
-            @subs_arr = @{$subs_href};
-        }
+        my @subs_arr = @$subs_href if defined $subs_href;
 
         my $moo = $r->{'budget_code_indent'};
         $moo =~ s/\ /\&nbsp\;/g;
diff --git a/C4/Category.pm b/C4/Category.pm
index b81e88f..0436829 100644
--- a/C4/Category.pm
+++ b/C4/Category.pm
@@ -73,12 +73,16 @@ C<description>.
 sub all {
     my ($class) = @_;
     my $dbh = C4::Context->dbh;
+    
+   
+    
     return    map { $class->new($_) }    @{$dbh->selectall_arrayref(
         # The categories table is small enough for
         # `SELECT *` to be harmless.
         "SELECT * FROM categories ORDER BY description",
         { Slice => {} },
     )};
+    
 }
 
 
@@ -136,6 +140,20 @@ These are read-only accessors for attributes of a C4::Category object.
 
 =cut
 
+
+sub bybranch 
+{
+	
+    my ($class) = @_;
+    my $dbh = C4::Context->dbh;
+
+           return    map { $class->new($_) }    @{$dbh->selectall_arrayref(
+        "SELECT * FROM categories where categorycode like '" . C4::Branch::mybranch() ."%' ORDER BY description",
+        { Slice => {} },
+    )};
+    
+	
+}
 sub AUTOLOAD {
     my $self = shift;
     my $attr = $AUTOLOAD;
diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 179fe70..382edf5 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -2052,14 +2052,18 @@ sub GetBiblioIssues {
     my $biblionumber = shift;
     return undef unless $biblionumber;
     my $dbh   = C4::Context->dbh;
-    my $query = "
+    my $query;
+    
+    if (C4::Context->preference("searchMyLibraryOnly"))
+     {
+       $query = "
         SELECT issues.*,items.barcode,biblio.biblionumber,biblio.title, biblio.author,borrowers.cardnumber,borrowers.surname,borrowers.firstname
         FROM issues
             LEFT JOIN borrowers ON borrowers.borrowernumber = issues.borrowernumber
             LEFT JOIN items ON issues.itemnumber = items.itemnumber
             LEFT JOIN biblioitems ON items.itemnumber = biblioitems.biblioitemnumber
             LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
-        WHERE biblio.biblionumber = ?
+        WHERE biblio.biblionumber = ? and borrowers.branchcode = '" . C4::Branch->mybranch() . "' 
         UNION ALL
         SELECT old_issues.*,items.barcode,biblio.biblionumber,biblio.title, biblio.author,borrowers.cardnumber,borrowers.surname,borrowers.firstname
         FROM old_issues
@@ -2067,9 +2071,32 @@ sub GetBiblioIssues {
             LEFT JOIN items ON old_issues.itemnumber = items.itemnumber
             LEFT JOIN biblioitems ON items.itemnumber = biblioitems.biblioitemnumber
             LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
-        WHERE biblio.biblionumber = ?
+        WHERE biblio.biblionumber = ? and borrowers.branchcode = '" . C4::Branch->mybranch() . "' 
         ORDER BY timestamp
     ";
+     }
+     else {
+       $query = "
+        SELECT issues.*,items.barcode,biblio.biblionumber,biblio.title, biblio.author,borrowers.cardnumber,borrowers.surname,borrowers.firstname
+        FROM issues
+            LEFT JOIN borrowers ON borrowers.borrowernumber = issues.borrowernumber
+            LEFT JOIN items ON issues.itemnumber = items.itemnumber
+            LEFT JOIN biblioitems ON items.itemnumber = biblioitems.biblioitemnumber
+            LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
+        WHERE biblio.biblionumber = ? 
+        UNION ALL
+        SELECT old_issues.*,items.barcode,biblio.biblionumber,biblio.title, biblio.author,borrowers.cardnumber,borrowers.surname,borrowers.firstname
+        FROM old_issues
+            LEFT JOIN borrowers ON borrowers.borrowernumber = old_issues.borrowernumber
+            LEFT JOIN items ON old_issues.itemnumber = items.itemnumber
+            LEFT JOIN biblioitems ON items.itemnumber = biblioitems.biblioitemnumber
+            LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber
+        WHERE biblio.biblionumber = ? 
+        ORDER BY timestamp
+    ";    
+     }
+     
+   #  die($query . '-' . $biblionumber);
     my $sth = $dbh->prepare($query);
     $sth->execute($biblionumber, $biblionumber);
 
@@ -2093,10 +2120,9 @@ sub GetUpcomingDueIssues {
     my $dbh = C4::Context->dbh;
 
     my $statement = <<END_SQL;
-SELECT issues.*, items.itype as itemtype, items.homebranch, TO_DAYS( date_due )-TO_DAYS( NOW() ) as days_until_due, branches.branchemail
+SELECT issues.*, items.itype as itemtype, items.homebranch, TO_DAYS( date_due )-TO_DAYS( NOW() ) as days_until_due
 FROM issues 
 LEFT JOIN items USING (itemnumber)
-LEFT OUTER JOIN branches USING (branchcode)
 WhERE returndate is NULL
 AND ( TO_DAYS( NOW() )-TO_DAYS( date_due ) ) < ?
 END_SQL
@@ -2614,8 +2640,8 @@ sub SendCirculationAlert {
     my ($type, $item, $borrower, $branch) =
         ($opts->{type}, $opts->{item}, $opts->{borrower}, $opts->{branch});
     my %message_name = (
-        CHECKIN  => 'Item_Check_in',
-        CHECKOUT => 'Item_Checkout',
+        CHECKIN  => 'Item Check-in',
+        CHECKOUT => 'Item Checkout',
     );
     my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences({
         borrowernumber => $borrower->{borrowernumber},
diff --git a/C4/Creators/PDF.pm b/C4/Creators/PDF.pm
index 0aae09c..d181bdb 100644
--- a/C4/Creators/PDF.pm
+++ b/C4/Creators/PDF.pm
@@ -49,8 +49,6 @@ sub new {
 
 sub End {
     my $self = shift;
-    # if the pdf stream is utf8, explicitly set it to utf8; this avoids at lease some wide character errors -chris_n
-    utf8::encode($PDF::Reuse::stream) if utf8::is_utf8($PDF::Reuse::stream);
     prEnd();
 }
 
diff --git a/C4/Form/MessagingPreferences.pm b/C4/Form/MessagingPreferences.pm
index 4bc742d..808719f 100644
--- a/C4/Form/MessagingPreferences.pm
+++ b/C4/Form/MessagingPreferences.pm
@@ -54,7 +54,7 @@ the same thing in staff and OPAC.
 
 =head2 handle_form_action
 
-    C4::Form::MessagingPreferences::handle_form_action($input, { categorycode => 'CPL' }, $template, $insert);
+    C4::Form::MessagingPreferences::handle_form_action($input, { categorycode => 'CPL' }, $template);
 
 Processes CGI parameters and updates the target patron or patron category's
 preferences.
@@ -64,16 +64,17 @@ C<$input> is the CGI query object.
 C<$target_params> is a hashref containing either a C<categorycode> key or a C<borrowernumber> key 
 identifying the patron or patron category whose messaging preferences are to be updated.
 
-C<$template> is the Template::Toolkit object for the response; this routine
+C<$template> is the HTML::Template::Pro object for the response; this routine
 adds a settings_updated template variable.
 
 =cut
 
 sub handle_form_action {
-    my ($query, $target_params, $template, $insert, $categorycode) = @_;
+    my ($query, $target_params, $template) = @_;
     my $messaging_options = C4::Members::Messaging::GetMessagingOptions();
+
     # TODO: If a "NONE" box and another are checked somehow (javascript failed), we should pay attention to the "NONE" box
-    my $prefs_set = 0;
+    
     OPTION: foreach my $option ( @$messaging_options ) {
         my $updater = { %{ $target_params }, 
                         message_attribute_id    => $option->{'message_attribute_id'} };
@@ -95,16 +96,8 @@ sub handle_form_action {
         }
 
         C4::Members::Messaging::SetMessagingPreference( $updater );
-
-	if ($query->param( $option->{'message_attribute_id'})){
-	    $prefs_set = 1;
-	}
-    }
-    if (! $prefs_set && $insert){
-        # this is new borrower, and we have no preferences set, use the defaults
-	$target_params->{categorycode} = $categorycode;
-        C4::Members::Messaging::SetMessagingPreferencesFromDefaults( $target_params );
     }
+
     # show the success message
     $template->param( settings_updated => 1 );
 }
@@ -119,7 +112,7 @@ and fills the corresponding template variables.
 C<$target_params> is a hashref containing either a C<categorycode> key or a C<borrowernumber> key 
 identifying the patron or patron category.
 
-C<$template> is the Template::Toolkit object for the response.
+C<$template> is the HTML::Template::Pro object for the response.
 
 =cut
 
diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm
index c201fab..576dde4 100644
--- a/C4/Installer/PerlDependencies.pm
+++ b/C4/Installer/PerlDependencies.pm
@@ -202,7 +202,7 @@ our $PERL_DEPS = {
     'Graphics::Magick' => {
         'usage'    => 'Patron Card Creator Feature',
         'required' => '0',
-        'min_ver'  => '1.3.05'
+        'min_ver'  => '1.3.5'
     },
     'MARC::Charset' => {
         'usage'    => 'Core',
@@ -479,11 +479,6 @@ our $PERL_DEPS = {
 	'required' => '1',
 	'min_ver'  => '2.22',
     },
-    'Gravatar::URL' => {
-        'usage'    => 'Photos in OPAC reviews',
-        'required' => '0',
-        'min_ver'  => '1.03',
-    },
 };
 
 1;
diff --git a/C4/ItemCirculationAlertPreference.pm b/C4/ItemCirculationAlertPreference.pm
index 0c5844a..dca3fba 100644
--- a/C4/ItemCirculationAlertPreference.pm
+++ b/C4/ItemCirculationAlertPreference.pm
@@ -328,8 +328,8 @@ sub grid {
     my ($class, $where) = @_;
     my @branch_prefs = $class->find($where);
     my @default_prefs = $class->find({ branchcode => '*', notification => $where->{notification} });
-    my @cc = C4::Category->all;
-    my @it = C4::ItemType->all;
+    my @cc = C4::Category->bybranch;
+    my @it = C4::ItemType->bybranch;
     my $notification = $where->{notification};
     my %disabled = map {
         my $key = $_->categorycode . "-" . $_->item_type . "-" . $notification;
diff --git a/C4/ItemType.pm b/C4/ItemType.pm
index e66d917..0f83425 100644
--- a/C4/ItemType.pm
+++ b/C4/ItemType.pm
@@ -81,7 +81,17 @@ sub all {
     )};
 }
 
-
+sub bybranch {
+    my ($class) = @_;
+    my $dbh = C4::Context->dbh;
+    return    map { $class->new($_) }    @{$dbh->selectall_arrayref(
+        # The itemtypes table is small enough for
+        # `SELECT *` to be harmless.
+        "SELECT * FROM itemtypes WHERE itemtype LIKE '" . C4::Branch->mybranch() . "%' ORDER BY description",
+        { Slice => {} },
+    )};   
+    
+}
 
 
 =head2 Object Methods
diff --git a/C4/Items.pm b/C4/Items.pm
index 9342564..d55fe27 100644
--- a/C4/Items.pm
+++ b/C4/Items.pm
@@ -135,19 +135,40 @@ names to values.  If C<$serial> is true, include serial publication data.
 sub GetItem {
     my ($itemnumber,$barcode, $serial) = @_;
     my $dbh = C4::Context->dbh;
-	my $data;
+    my ($data,$sth);
+
     if ($itemnumber) {
-        my $sth = $dbh->prepare("
+     if (C4::Context->preferences("searchMyLibraryOnly"))
+      {
+        $sth = $dbh->prepare("
+            SELECT * FROM items 
+            WHERE itemnumber = ? and itype like ? ");
+            $sth->execute($itemnumber,C4::Branch->mybranch() . '%');
+       }
+        else {
+               $sth = $dbh->prepare("
             SELECT * FROM items 
-            WHERE itemnumber = ?");
-        $sth->execute($itemnumber);
+            WHERE itemnumber = ?  ");
+            $sth->execute($itemnumber);
+          }
+
         $data = $sth->fetchrow_hashref;
     } else {
-        my $sth = $dbh->prepare("
+     if (C4::Context->preferences("searchMyLibraryOnly"))
+      {
+        $sth = $dbh->prepare("
+            SELECT * FROM items 
+            WHERE barcode = ? and itype like ? "
+            );
+        $sth->execute($barcode,C4::Branch->mybranch() . '%');	
+      }
+       else { 
+        $sth = $dbh->prepare("
             SELECT * FROM items 
             WHERE barcode = ?"
             );
-        $sth->execute($barcode);		
+        $sth->execute($barcode);       
+           }	
         $data = $sth->fetchrow_hashref;
     }
     if ( $serial) {      
@@ -156,11 +177,13 @@ sub GetItem {
         ($data->{'serialseq'} , $data->{'publisheddate'}) = $ssth->fetchrow_array();
     }
 	#if we don't have an items.itype, use biblioitems.itemtype.
+# SCOOT1
 	if( ! $data->{'itype'} ) {
-		my $sth = $dbh->prepare("SELECT itemtype FROM biblioitems  WHERE biblionumber = ?");
+		my $sth = $dbh->prepare("SELECT itemtype FROM biblioitems  WHERE   biblionumber = ?");
 		$sth->execute($data->{'biblionumber'});
 		($data->{'itype'}) = $sth->fetchrow_array;
 	}
+	#die (Dumper($data));
     return $data;
 }    # sub GetItem
 
@@ -1112,12 +1135,16 @@ sub GetItemsByBiblioitemnumber {
 
 =head2 GetItemsInfo
 
-  @results = GetItemsInfo($biblionumber);
+  @results = GetItemsInfo($biblionumber, $type);
 
-Returns information about items with the given biblionumber.
+Returns information about books with the given biblionumber.
+
+C<$type> may be either C<intra> or anything else. If it is not set to
+C<intra>, then the search will exclude lost, very overdue, and
+withdrawn items.
 
 C<GetItemsInfo> returns a list of references-to-hash. Each element
-contains a number of keys. Most of them are attributes from the
+contains a number of keys. Most of them are table items from the
 C<biblio>, C<biblioitems>, C<items>, and C<itemtypes> tables in the
 Koha database. Other keys include:
 
@@ -1153,7 +1180,7 @@ If this is set, it is set to C<One Order>.
 =cut
 
 sub GetItemsInfo {
-    my ( $biblionumber ) = @_;
+    my ( $biblionumber, $type ) = @_;
     my $dbh   = C4::Context->dbh;
     # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
     my $query = "
diff --git a/C4/Koha.pm b/C4/Koha.pm
index 06b2ec5..6bd8e6e 100644
--- a/C4/Koha.pm
+++ b/C4/Koha.pm
@@ -241,10 +241,22 @@ sub GetItemTypes {
     # returns a reference to a hash of references to itemtypes...
     my %itemtypes;
     my $dbh   = C4::Context->dbh;
-    my $query = qq|
+    my $query;
+    
+     if (C4::Context->preference("searchMyLibraryOnly"))
+ { 
+        $query = "
+        SELECT *
+        FROM   itemtypes
+          WHERE itemtype LIKE '" . C4::Branch->mybranch() . "%'  
+    ";
+ }
+ else {
+    $query = qq|
         SELECT *
         FROM   itemtypes
     |;
+}
     my $sth = $dbh->prepare($query);
     $sth->execute;
     while ( my $IT = $sth->fetchrow_hashref ) {
@@ -1020,7 +1032,16 @@ sub GetAuthorisedValues {
 	my @results;
     my $dbh      = C4::Context->dbh;
     my $query    = "SELECT * FROM authorised_values";
-    $query .= " WHERE category = '" . $category . "'" if $category;
+ 
+           if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+    $query .= " WHERE authorised_value like '" . C4::Branch->mybranch() . "%' AND  category = '" . $category . "'" if $category;
+}
+else
+{
+  $query .= " WHERE   category = '" . $category . "'" if $category;
+}
+
     $query .= " ORDER BY category, lib, lib_opac";
     my $sth = $dbh->prepare($query);
     $sth->execute;
@@ -1093,11 +1114,20 @@ sub GetKohaAuthorisedValues {
   my ($kohafield,$fwcode,$opac) = @_;
   $fwcode='' unless $fwcode;
   my %values;
+  my $sth;
+  
   my $dbh = C4::Context->dbh;
   my $avcode = GetAuthValCode($kohafield,$fwcode);
-  if ($avcode) {  
-	my $sth = $dbh->prepare("select authorised_value, lib, lib_opac from authorised_values where category=? ");
+  if ($avcode) { 
+       if ( C4::Context->preference("searchMyLibraryOnly") && not C4::Branch->mybranch() eq 'NO_LIBRARY_SET' )
+          {
+            $sth = $dbh->prepare("select authorised_value, lib, lib_opac from authorised_values where category=? AND authorised_value LIKE ?");  
+            $sth->execute($avcode,C4::Branch->mybranch() . '%');
+          }     
+          else {
+	$sth = $dbh->prepare("select authorised_value, lib, lib_opac from authorised_values where category=? ");
    	$sth->execute($avcode);
+   	}
 	while ( my ($val, $lib, $lib_opac) = $sth->fetchrow_array ) { 
 		$values{$val} = ($opac && $lib_opac) ? $lib_opac : $lib;
    	}
diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm
index 930e0f6..0c98d6f 100644
--- a/C4/Labels/Label.pm
+++ b/C4/Labels/Label.pm
@@ -100,9 +100,7 @@ sub _get_text_fields {
     my $format_string = shift;
     my $csv = Text::CSV_XS->new({allow_whitespace => 1});
     my $status = $csv->parse($format_string);
-    my @sorted_fields = map {{ 'code' => $_, desc => $_ }} 
-                        map { $_ eq 'callnumber' ? 'itemcallnumber' : $_ } # see bug 5653
-                        $csv->fields();
+    my @sorted_fields = map {{ 'code' => $_, desc => $_ }} $csv->fields();
     my $error = $csv->error_input();
     warn sprintf('Text field sort failed with this error: %s', $error) if $error;
     return \@sorted_fields;
diff --git a/C4/Letters.pm b/C4/Letters.pm
index cb47c7e..c894a57 100644
--- a/C4/Letters.pm
+++ b/C4/Letters.pm
@@ -323,14 +323,12 @@ sub SendAlerts {
         $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
         $letter->{content} =~
           s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
-        foreach my $data ( @{$dataorders} ) {
-            if ( $letter->{content} =~ m/(<<.*>>)/ ) {
-                my $line = $1;
-                foreach my $field ( keys %{$data} ) {
-                    $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
-                }
-                $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
+        foreach my $data (@$dataorders) {
+            my $line = $1 if ( $letter->{content} =~ m/(<<.*>>)/ );
+            foreach my $field ( keys %$data ) {
+                $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
             }
+            $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
         }
         $letter->{content} =~ s/<<[^>]*>>//g;
         my $innerletter = $letter;
@@ -393,14 +391,12 @@ sub SendAlerts {
         $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
         $letter->{content} =~
           s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
-        foreach my $data ( @{$dataorders} ) {
-            if ( $letter->{content} =~ m/(<<.*>>)/ ) {
-                my $line = $1;
-                foreach my $field ( keys %{$data} ) {
-                    $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
-                }
-                $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
+        foreach my $data (@$dataorders) {
+            my $line = $1 if ( $letter->{content} =~ m/(<<.*>>)/ );
+            foreach my $field ( keys %$data ) {
+                $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
             }
+            $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
         }
         $letter->{content} =~ s/<<[^>]*>>//g;
         my $innerletter = $letter;
diff --git a/C4/Log.pm b/C4/Log.pm
index 98cd8d5..822cda5 100644
--- a/C4/Log.pm
+++ b/C4/Log.pm
@@ -213,7 +213,7 @@ sub GetLogs {
     my @parameters;
     $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom;   #fix me - mysql specific
     $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$iso_dateto."\" " if $iso_dateto;
-    if($user ne "") {
+    if($user) {
     	$query .= " AND user = ? ";
     	push(@parameters,$user);
     }
diff --git a/C4/Members.pm b/C4/Members.pm
index 670042f..f926496 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -205,10 +205,19 @@ sub SearchMember {
     }
     else    # advanced search looking in surname, firstname and othernames
     {
+     
         @data  = split( ' ', $searchstring );
         $count = @data;
-        $query .= " WHERE ";
-        if (C4::Context->preference("IndependantBranches") && !$showallbranches){
+        
+     
+           if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+        $query .= " WHERE categories.categorycode like '" . C4::Branch::mybranch() . "%' AND ";
+          }
+          else { 
+         $query .= " WHERE ";              
+          }
+          if (C4::Context->preference("IndependantBranches") && !$showallbranches){
           if (C4::Context->userenv && C4::Context->userenv->{flags} % 2 !=1 && C4::Context->userenv->{'branch'}){
             $query.=" borrowers.branchcode =".$dbh->quote(C4::Context->userenv->{'branch'})." AND " unless (C4::Context->userenv->{'branch'} eq "insecure");
           }      
@@ -245,6 +254,7 @@ sub SearchMember {
         # FIXME - .= <<EOT;
     }
 
+    #die($query);
     $sth = $dbh->prepare($query);
 
     $debug and print STDERR "Q $orderby : $query\n";
@@ -772,17 +782,17 @@ sub ModMember {
         }
     }
 	my $execute_success=UpdateInTable("borrowers",\%data);
-    if ($execute_success) { # only proceed if the update was a success
-        # ok if its an adult (type) it may have borrowers that depend on it as a guarantor
-        # so when we update information for an adult we should check for guarantees and update the relevant part
-        # of their records, ie addresses and phone numbers
-        my $borrowercategory= GetBorrowercategory( $data{'category_type'} );
-        if ( exists  $borrowercategory->{'category_type'} && $borrowercategory->{'category_type'} eq ('A' || 'S') ) {
-            # is adult check guarantees;
-            UpdateGuarantees(%data);
-        }
-        logaction("MEMBERS", "MODIFY", $data{'borrowernumber'}, "UPDATE (executed w/ arg: $data{'borrowernumber'})") if C4::Context->preference("BorrowersLog");
+# ok if its an adult (type) it may have borrowers that depend on it as a guarantor
+# so when we update information for an adult we should check for guarantees and update the relevant part
+# of their records, ie addresses and phone numbers
+    my $borrowercategory= GetBorrowercategory( $data{'category_type'} );
+    if ( exists  $borrowercategory->{'category_type'} && $borrowercategory->{'category_type'} eq ('A' || 'S') ) {
+        # is adult check guarantees;
+        UpdateGuarantees(%data);
     }
+    logaction("MEMBERS", "MODIFY", $data{'borrowernumber'}, "UPDATE (executed w/ arg: $data{'borrowernumber'})") 
+        if C4::Context->preference("BorrowersLog");
+
     return $execute_success;
 }
 
@@ -792,9 +802,7 @@ sub ModMember {
   $borrowernumber = &AddMember(%borrower);
 
 insert new borrower into table
-Returns the borrowernumber upon success
-
-Returns as undef upon any db error without further processing
+Returns the borrowernumber
 
 =cut
 
@@ -802,10 +810,8 @@ Returns as undef upon any db error without further processing
 sub AddMember {
     my (%data) = @_;
     my $dbh = C4::Context->dbh;
-	# generate a proper login if none provided
-	$data{'userid'} = Generate_Userid($data{'borrowernumber'}, $data{'firstname'}, $data{'surname'}) if $data{'userid'} eq '';
-	# create a disabled account if no password provided
-	$data{'password'} = ($data{'password'})? md5_base64($data{'password'}) : '!';
+    $data{'userid'} = '' unless $data{'password'};
+    $data{'password'} = md5_base64( $data{'password'} ) if $data{'password'};
 	$data{'borrowernumber'}=InsertInTable("borrowers",\%data);	
     # mysql_insertid is probably bad.  not necessarily accurate and mysql-specific at best.
     logaction("MEMBERS", "CREATE", $data{'borrowernumber'}, "") if C4::Context->preference("BorrowersLog");
@@ -814,15 +820,10 @@ sub AddMember {
     my $sth = $dbh->prepare("SELECT enrolmentfee FROM categories WHERE categorycode=?");
     $sth->execute($data{'categorycode'});
     my ($enrolmentfee) = $sth->fetchrow;
-    if ($sth->err) {
-        warn sprintf('Database returned the following error: %s', $sth->errstr);
-        return;
-    }
     if ($enrolmentfee && $enrolmentfee > 0) {
         # insert fee in patron debts
         manualinvoice($data{'borrowernumber'}, '', '', 'A', $enrolmentfee);
     }
-
     return $data{'borrowernumber'};
 }
 
@@ -909,7 +910,6 @@ sub fixup_cardnumber ($) {
 
     #     if ($cardnumber !~ /\S/ && $autonumber_members) {
     ($autonumber_members) or return $cardnumber;
-    defined($cardnumber) or return $cardnumber;
     my $checkdigit = C4::Context->preference('checkdigit');
     my $dbh = C4::Context->dbh;
     if ( $checkdigit and $checkdigit eq 'katipo' ) {
@@ -1125,7 +1125,7 @@ sub GetAllIssues {
   LEFT JOIN items on items.itemnumber=old_issues.itemnumber
   LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
   LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
-  WHERE borrowernumber=? AND old_issues.itemnumber IS NOT NULL
+  WHERE borrowernumber=? 
   order by $order";
     if ( $limit != 0 ) {
         $query .= " limit $limit";
@@ -1177,11 +1177,9 @@ sub GetMemberAccountRecords {
     $sth->execute( @bind );
     my $total = 0;
     while ( my $data = $sth->fetchrow_hashref ) {
-        if ( $data->{itemnumber} ) {
-            my $biblio = GetBiblioFromItemNumber( $data->{itemnumber} );
-            $data->{biblionumber} = $biblio->{biblionumber};
-            $data->{title}        = $biblio->{title};
-        }
+		my $biblio = GetBiblioFromItemNumber($data->{itemnumber}) if $data->{itemnumber};
+		$data->{biblionumber} = $biblio->{biblionumber};
+	        $data->{title} = $biblio->{title};
         $acctlines[$numlines] = $data;
         $numlines++;
         $total += int(1000 * $data->{'amountoutstanding'}); # convert float to integer to avoid round-off errors
@@ -1273,8 +1271,6 @@ sub checkuniquemember {
 
 sub checkcardnumber {
     my ($cardnumber,$borrowernumber) = @_;
-    # If cardnumber is null, we assume they're allowed.
-    return 0 if !defined($cardnumber);
     my $dbh = C4::Context->dbh;
     my $query = "SELECT * FROM borrowers WHERE cardnumber=?";
     $query .= " AND borrowernumber <> ?" if ($borrowernumber);
@@ -1417,9 +1413,10 @@ to category descriptions.
 
 #'
 sub GetborCatFromCatType {
-    my ( $category_type, $action ) = @_;
+    my ( $category_type, $action,$categorycode ) = @_;
 	# FIXME - This API  seems both limited and dangerous. 
     my $dbh     = C4::Context->dbh;
+    
     my $request = qq|   SELECT categorycode,description 
             FROM categories 
             $action
@@ -1482,15 +1479,25 @@ If no category code provided, the function returns all the categories.
 
 sub GetBorrowercategoryList {
     my $dbh       = C4::Context->dbh;
-    my $sth       =
-    $dbh->prepare(
-    "SELECT * 
-    FROM categories 
-    ORDER BY description"
-        );
-    $sth->execute;
-    my $data =
-    $sth->fetchall_arrayref({});
+    my ($sth,$sql);
+    
+     
+           if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+               $sql = "SELECT * FROM categories where categorycode LIKE ? ORDER BY description";
+               $sth = $dbh->prepare($sql);
+               $sth->execute(C4::Branch->mybranch() . '%');
+           }
+           else
+           {
+               $sql = "SELECT * FROM categories  ORDER BY description";
+               $sth = $dbh->prepare($sql);
+               $sth->execute;
+           }
+           
+
+ 
+   my $data = $sth->fetchall_arrayref({});
     return $data;
 }    # sub getborrowercategory
 
@@ -1627,9 +1634,16 @@ sub add_member_orgs {
 sub GetCities {
 
     my $dbh   = C4::Context->dbh;
+    my $sql = "SELECT cityid,city_zipcode,city_name FROM cities ORDER BY city_name";
+    my $sth = $dbh->prepare($sql);
+    my $branch = C4::Branch->mybranch();
+   
+    
     my $city_arr = $dbh->selectall_arrayref(
-        q|SELECT cityid,city_zipcode,city_name FROM cities ORDER BY city_name|,
+        "SELECT cityid,city_zipcode,city_name FROM cities where city_name LIKE '$branch%' ORDER BY city_name",
         { Slice => {} });
+    
+    
     if ( @{$city_arr} ) {
         unshift @{$city_arr}, {
             city_zipcode => q{},
@@ -1773,10 +1787,10 @@ sub GetRoadTypes {
     my $dbh   = C4::Context->dbh;
     my $query = qq|
 SELECT roadtypeid,road_type 
-FROM roadtype 
+FROM roadtype where road_type like ? 
 ORDER BY road_type|;
     my $sth = $dbh->prepare($query);
-    $sth->execute();
+    $sth->execute(C4::Branch->mybranch . '%');
     my %roadtype;
     my @id;
 
diff --git a/C4/Members/Attributes.pm b/C4/Members/Attributes.pm
index 35d6702..24c6f71 100644
--- a/C4/Members/Attributes.pm
+++ b/C4/Members/Attributes.pm
@@ -203,12 +203,7 @@ sub SetBorrowerAttributes {
     foreach my $attr (@$attr_list) {
         $attr->{password} = undef unless exists $attr->{password};
         $sth->execute($borrowernumber, $attr->{code}, $attr->{value}, $attr->{password});
-        if ($sth->err) {
-            warn sprintf('Database returned the following error: %s', $sth->errstr);
-            return; # bail immediately on errors
-        }
     }
-    return 1; # borower attributes successfully set
 }
 
 =head2 extended_attributes_code_value_arrayref 
diff --git a/C4/Record.pm b/C4/Record.pm
index cecb6ed..c5727f3 100644
--- a/C4/Record.pm
+++ b/C4/Record.pm
@@ -266,19 +266,12 @@ sub marc2modsxml {
 sub marc2endnote {
     my ($marc) = @_;
 	my $marc_rec_obj =  MARC::Record->new_from_usmarc($marc);
-    my ( $abstract, $f260a, $f710a );
-    my $f260 = $marc_rec_obj->field('260');
-    if ($f260) {
-        $f260a = $f260->subfield('a') if $f260;
-    }
+	my $f260 = $marc_rec_obj->field('260');
+	my $f260a = $f260->subfield('a') if $f260;
     my $f710 = $marc_rec_obj->field('710');
-    if ($f710) {
-        $f710a = $f710->subfield('a');
-    }
-    my $f500 = $marc_rec_obj->field('500');
-    if ($f500) {
-        $abstract = $f500->subfield('a');
-    }
+    my $f710a = $f710->subfield('a') if $f710;
+	my $f500 = $marc_rec_obj->field('500');
+	my $abstract = $f500->subfield('a') if $f500;
 	my $fields = {
 		DB => C4::Context->preference("LibraryName"),
 		Title => $marc_rec_obj->title(),	
diff --git a/C4/Reserves.pm b/C4/Reserves.pm
index 8373840..87e2325 100644
--- a/C4/Reserves.pm
+++ b/C4/Reserves.pm
@@ -1662,22 +1662,11 @@ sub _koha_notify_reserve {
 
     my $dbh = C4::Context->dbh;
     my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
-    
-    # Try to get the borrower's email address
-    my $to_address;
-    my $which_address = C4::Context->preference('AutoEmailPrimaryAddress');
-    # If the system preference is set to 'first valid' (value == OFF), look up email address
-    if ($which_address eq 'OFF') {
-        $to_address = C4::Members::GetFirstValidEmailAddress( $borrowernumber );
-    } else {
-        $to_address = $borrower->{$which_address};
-    }
-    
     my $letter_code;
     my $print_mode = 0;
     my $messagingprefs;
-    if ( $to_address || $borrower->{'smsalertnumber'} ) {
-        $messagingprefs = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber, message_name => 'Hold_Filled' } );
+    if ( $borrower->{'email'} || $borrower->{'smsalertnumber'} ) {
+        $messagingprefs = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber, message_name => 'Hold Filled' } );
 
         return if ( !defined( $messagingprefs->{'letter_code'} ) );
         $letter_code = $messagingprefs->{'letter_code'};
diff --git a/C4/Search.pm b/C4/Search.pm
index c3cff65..5648faa 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -33,6 +33,7 @@ use C4::Debug;
 use C4::Items;
 use YAML;
 use URI::Escape;
+use Business::ISBN;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
 
@@ -1423,7 +1424,15 @@ sub searchResults {
     #find branchname
     #get branch information.....
     my %branches;
-    my $bsth =$dbh->prepare("SELECT branchcode,branchname FROM branches"); # FIXME : use C4::Branch::GetBranches
+    my $bsth;
+              if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+            $bsth =$dbh->prepare("SELECT branchcode,branchname FROM branches WHERE branchcode = '". C4::Branch::mybranch() ."' "); # FIXME : use C4::Branch::GetBranches
+            }
+            else
+            {
+             $bsth =$dbh->prepare("SELECT branchcode,branchname FROM branches ");                
+            }
     $bsth->execute();
     while ( my $bdata = $bsth->fetchrow_hashref ) {
         $branches{ $bdata->{'branchcode'} } = $bdata->{'branchname'};
@@ -1671,7 +1680,7 @@ sub searchResults {
 		    ($reservestatus, $reserveitem) = C4::Reserves::CheckReserves($item->{itemnumber});
                 }
 
-                # item is withdrawn, lost, damaged, not for loan, reserved or in transit
+                # item is withdrawn, lost or damaged
                 if (   $item->{wthdrawn}
                     || $item->{itemlost}
                     || $item->{damaged}
@@ -1686,8 +1695,8 @@ sub searchResults {
                     $item_in_transit_count++ if $transfertwhen ne '';
 		    $item_onhold_count++     if $reservestatus eq 'Waiting';
                     $item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan};
-                    
-                    # can place hold on item ?
+
+ # can place hold on item ?
                     if ((!$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems'))
                       && !$item->{itemlost}
                       && !$item->{withdrawn}
@@ -1695,6 +1704,7 @@ sub searchResults {
                         $can_place_holds = 1;
                     }
                     
+
                     $other_count++;
 
                     my $key = $prefix . $item->{status};
@@ -2599,9 +2609,20 @@ $template->param ( MYLOOP => C4::Search::z3950_search_args($searchscalar) )
 
 =cut
 
+
+
+
 sub z3950_search_args {
     my $bibrec = shift;
-    $bibrec = { title => $bibrec } if !ref $bibrec;
+    my $isbn = Business::ISBN->new($bibrec); 
+ 
+    if (defined $isbn && $isbn->is_valid)
+    {
+    $bibrec = { isbn => $bibrec } if !ref $bibrec;
+}
+else {
+     $bibrec = { title => $bibrec } if !ref $bibrec;
+}
     my $array = [];
     for my $field (qw/ lccn isbn issn title author dewey subject /)
     {
@@ -2641,6 +2662,9 @@ OR adds a new authority record
 =cut
 
 
+
+
+
 sub BiblioAddAuthorities{
   my ( $record, $frameworkcode ) = @_;
   my $dbh=C4::Context->dbh;
diff --git a/C4/Templates.pm b/C4/Templates.pm
index 4368492..8939be5 100644
--- a/C4/Templates.pm
+++ b/C4/Templates.pm
@@ -191,6 +191,7 @@ sub themelanguage {
         $lang = $languages[0] || 'en';
     }
     my $theme = 'prog'; # in the event of theme failure default to 'prog' -fbcit
+    my $dbh = C4::Context->dbh;
     my @themes;
     if ( $interface eq "intranet" ) {
         @themes = split " ", C4::Context->preference("template");
diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm
index df54de8..6ed7549 100644
--- a/C4/VirtualShelves.pm
+++ b/C4/VirtualShelves.pm
@@ -292,7 +292,7 @@ sub GetShelfContents ($;$$$) {
 	}
     my $query =
        " SELECT vc.biblionumber, vc.shelfnumber, vc.dateadded, itemtypes.*,
-            biblio.*, biblioitems.itemtype, biblioitems.publicationyear as year, biblioitems.publishercode, biblioitems.place, biblioitems.size, biblioitems.pages
+            biblio.*, biblioitems.itemtype, biblioitems.publicationyear, biblioitems.publishercode, biblioitems.place, biblioitems.size, biblioitems.pages
          FROM   virtualshelfcontents vc
 		 LEFT JOIN biblio      ON      vc.biblionumber =      biblio.biblionumber
 		 LEFT JOIN biblioitems ON  biblio.biblionumber = biblioitems.biblionumber
diff --git a/acqui/addorder.pl b/acqui/addorder.pl
index e321d2c..44623ec 100755
--- a/acqui/addorder.pl
+++ b/acqui/addorder.pl
@@ -204,7 +204,6 @@ if ( $orderinfo->{quantity} ne '0' ) {
                 "biblioitems.publishercode"   => $$orderinfo{publishercode}   ? $$orderinfo{publishercode} : "",
                 "biblioitems.publicationyear" => $$orderinfo{publicationyear} ? $$orderinfo{publicationyear}: "",
                 "biblio.copyrightdate"        => $$orderinfo{publicationyear} ? $$orderinfo{publicationyear}: "",
-                "biblioitems.itemtype"        => $$orderinfo{itemtype} ? $$orderinfo{itemtype} : "",
             });
 
         # create the record in catalogue, with framework ''
diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl
index 08356f8..457b616 100755
--- a/acqui/basketgroup.pl
+++ b/acqui/basketgroup.pl
@@ -305,22 +305,26 @@ if ( $op eq "add" ) {
         # Build the combobox to select the billing place
         my @billingplaceloop;
         for (sort keys %$branches) {
-            push @billingplaceloop, {
+            my $selected = 1 if $_ eq $billingplace;
+            my %row = (
                 value      => $_,
-                selected   => $_ eq $billingplace,
+                selected   => $selected,
                 branchname => $branches->{$_}->{branchname},
-            };
+            );
+            push @billingplaceloop, \%row;
         }
         $template->param( billingplaceloop => \@billingplaceloop );
         
         # Build the combobox to select the delivery place
         my @deliveryplaceloop;
         for (sort keys %$branches) {
-            push @deliveryplaceloop, {
+            my $selected = 1 if $_ eq $deliveryplace;
+            my %row = (
                 value      => $_,
-                selected   => $_ eq $deliveryplace,
+                selected   => $selected,
                 branchname => $branches->{$_}->{branchname},
-            };
+            );
+            push @deliveryplaceloop, \%row;
         }
         $template->param( deliveryplaceloop => \@deliveryplaceloop );
 
diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl
index 2c41742..0190e4a 100755
--- a/acqui/histsearch.pl
+++ b/acqui/histsearch.pl
@@ -75,17 +75,11 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     }
 );
 
-my ( $from_iso, $to_iso, $d );
-if ( $d = $input->param('from') ) {
-    $from_iso = C4::Dates->new($d)->output('iso');
-}
-if ( $d = $input->param('iso') ) {
-    $to_iso = C4::Dates->new($d)->output('iso');
-}
-
+my $from_iso = C4::Dates->new($input->param('from'))->output('iso') if $input->param('from');
+my   $to_iso =   C4::Dates->new($input->param('to'))->output('iso') if $input->param('iso');
 my ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) =
-  GetHistory( $title, $author, $name, $from_iso, $to_iso );
-
+  &GetHistory( $title, $author, $name, $from_iso, $to_iso );
+  
 $template->param(
     suggestions_loop        => $order_loop,
     total_qty               => $total_qty,
diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl
index db3e852..386dda7 100755
--- a/acqui/neworderempty.pl
+++ b/acqui/neworderempty.pl
@@ -132,11 +132,6 @@ if ( $ordernumber eq '' and defined $params->{'breedingid'}){
     my ($marcrecord, $encoding) = MARCfindbreeding($params->{'breedingid'});
     die("Could not find the selected record in the reservoir, bailing") unless $marcrecord;
 
-    # Remove all the items (952) from the imported record
-    foreach my $item ($marcrecord->field('952')) {
-        $marcrecord->delete_field($item);
-    }
-
     my $duplicatetitle;
 #look for duplicates
     ($biblionumber,$duplicatetitle) = FindDuplicate($marcrecord);
@@ -329,8 +324,6 @@ if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
     
     $template->param(items => \@itemloop);
 }
-# Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio
-my @itemtypes = C4::ItemType->all unless C4::Context->preference('item-level_itypes');
 
 # fill template
 $template->param(
@@ -375,7 +368,6 @@ $template->param(
     budget_loop      => $budget_loop,
     isbn             => $data->{'isbn'},
     seriestitle      => $data->{'seriestitle'},
-    itemtypeloop     => \@itemtypes,
     quantity         => $data->{'quantity'},
     quantityrec      => $data->{'quantity'},
     rrp              => $data->{'rrp'},
diff --git a/admin/aqbudgetperiods.pl b/admin/aqbudgetperiods.pl
index 724c7e5..aca4688 100755
--- a/admin/aqbudgetperiods.pl
+++ b/admin/aqbudgetperiods.pl
@@ -173,6 +173,8 @@ elsif ( $op eq 'delete_confirmed' ) {
 # -------------------------------------------------------------------
 # display the list of budget periods
     my $results = GetBudgetPeriods();
+    use Data::Dumper::Simple;
+   # die (Dumper(@$results[0]->{budget_period_description}));
 	$template->param( period_button_only => 1 ) unless (@$results) ;
     my $page = $input->param('page') || 1;
     my $first = ( $page - 1 ) * $pagesize;
@@ -186,7 +188,28 @@ elsif ( $op eq 'delete_confirmed' ) {
 		FormatData($budgetperiod);
         $budgetperiod->{'budget_period_total'}     = $num->format_price( $budgetperiod->{'budget_period_total'} );
         $budgetperiod->{budget_active} = 1;
+        if (C4::Context->preference("searchMyLibraryOnly"))
+        {
+		#die(Dumper(@$results));
+		my $str;
+		for (@$results)
+		{
+		$str = substr($_->{budget_period_description},0,3);
+		
+
+	             if ($str eq C4::Branch->mybranch())
+	             {
+			
+                      push( @period_loop, $budgetperiod );
+                      	   
+	             }
+	         }
+	 
+	}
+	else {
+		 	
         push( @period_loop, $budgetperiod );
+          }
     }
     my $budget_period_dropbox = GetBudgetPeriodsDropbox();
 
@@ -197,4 +220,7 @@ elsif ( $op eq 'delete_confirmed' ) {
     );
 
 $template->param($op=>1);
+$template->param('homebranch'=>C4::Branch->mybranch());
+
 output_html_with_http_headers $input, $cookie, $template->output;
+
diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl
index 3ff1bd6..e34f2cc 100755
--- a/admin/aqbudgets.pl
+++ b/admin/aqbudgets.pl
@@ -323,11 +323,7 @@ if ($op eq 'add_form') {
         );
     }
 
-    my $budget_period_total;
-    if ( $period->{budget_period_total} ) {
-        $budget_period_total =
-          $num->format_price( $period->{budget_period_total} );
-    }
+    my $budget_period_total = $num->format_price($$period{budget_period_total}) if $$period{budget_period_total};
     $template->param(
         else                   => 1,
         budget                 => \@loop,
diff --git a/admin/aqcontract.pl b/admin/aqcontract.pl
index 7126c99..07fb757 100755
--- a/admin/aqcontract.pl
+++ b/admin/aqcontract.pl
@@ -59,29 +59,17 @@ $template->param(
 if ( $op eq 'add_form' ) {
     $template->param( add_form => 1 );
 
-   # if contractnumber exists, it's a modify action, so read values to modify...
-    if ($contractnumber) {
-        my $contract =
-          @{ GetContract( { contractnumber => $contractnumber } ) }[0];
-
-        $template->param(
-            contractnumber      => $contract->{contractnumber},
-            contractname        => $contract->{contractname},
-            contractdescription => $contract->{contractdescription},
-            contractstartdate => format_date( $contract->{contractstartdate} ),
-            contractenddate   => format_date( $contract->{contractenddate} ),
-            DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar,
-        );
-    } else {
-        $template->param(
-            contractnumber           => undef,
-            contractname             => undef,
-            contractdescription      => undef,
-            contractstartdate        => undef,
-            contractenddate          => undef,
-            DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar,
-        );
-    }
+    # if contractnumber exists, it's a modify action, so read values to modify...
+    my $contract = @{GetContract( { contractnumber => $contractnumber } )}[0] if $contractnumber;
+
+    $template->param(
+        contractnumber           => $$contract{contractnumber},
+        contractname             => $$contract{contractname},
+        contractdescription      => $$contract{contractdescription},
+        contractstartdate        => format_date( $$contract{contractstartdate} ),
+        contractenddate          => format_date( $$contract{contractenddate} ),
+        DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar,
+    );
 
     # END $OP eq ADD_FORM
 }
diff --git a/admin/auth_tag_structure.pl b/admin/auth_tag_structure.pl
index bd3dc93..9c55df3 100755
--- a/admin/auth_tag_structure.pl
+++ b/admin/auth_tag_structure.pl
@@ -55,14 +55,15 @@ my ($template, $loggedinuser, $cookie)
 			     });
 
 # get authtype list
-my $authtypes     = getauthtypes;
-my @authtypesloop = ();
-foreach my $thisauthtype ( keys %{$authtypes} ) {
-    push @authtypesloop,
-      { value        => $thisauthtype,
-        selected     => $thisauthtype eq $authtypecode,
-        authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
-      };
+my $authtypes = getauthtypes;
+my @authtypesloop;
+foreach my $thisauthtype (keys %$authtypes) {
+	my $selected = 1 if $thisauthtype eq $authtypecode;
+	my %row =(value => $thisauthtype,
+				selected => $selected,
+				authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
+			);
+	push @authtypesloop, \%row;
 }
 
 my $sth;
diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl
index c26f3a9..c7c7387 100755
--- a/admin/authorised_values.pl
+++ b/admin/authorised_values.pl
@@ -191,6 +191,7 @@ exit 0;
 sub default_form {
 	# build categories list
 	my $sth = $dbh->prepare("select distinct category from authorised_values");
+	my $ownbranch = C4::Branch->mybranch();
 	$sth->execute;
 	my @category_list;
 	my %categories;     # a hash, to check that some hardcoded categories exist.
@@ -219,6 +220,9 @@ sub default_form {
     my $count = scalar(@$results);
 	my @loop_data = ();
 	# builds value list
+	
+	
+	
 	for (my $i=0; $i < $count; $i++){
 		my %row_data;  # get a fresh hash for the row data
 		$row_data{category}              = $results->[$i]{'category'};
@@ -228,8 +232,18 @@ sub default_form {
 		$row_data{imageurl}              = getitemtypeimagelocation( 'intranet', $results->[$i]{'imageurl'} );
 		$row_data{edit}                  = "$script_name?op=add_form&amp;id=".$results->[$i]{'id'}."&amp;offset=$offset";
 		$row_data{delete}                = "$script_name?op=delete_confirm&amp;searchfield=$searchfield&amp;id=".$results->[$i]{'id'}."&amp;offset=$offset";
-		push(@loop_data, \%row_data);
+ if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+		   if (substr($row_data{authorised_value},0,4) eq $ownbranch . '.')
+		   {
+		     push(@loop_data, \%row_data);
+	           }
+            }
+            else {
+                     push(@loop_data, \%row_data);		
+	         }
 	}
+	
 
 	$template->param( loop     => \@loop_data,
                           tab_list => $tab_list,
diff --git a/admin/branches.pl b/admin/branches.pl
index d6388f5..9687c24 100755
--- a/admin/branches.pl
+++ b/admin/branches.pl
@@ -189,10 +189,12 @@ elsif ( $op eq 'addcategory_validate' ) {
 elsif ( $op eq 'delete_category' ) {
 
     # if the user has pressed the "delete branch" button.
-    if ( CheckBranchCategorycode($categorycode) ) {
+    my $message = "MESSAGE8" if CheckBranchCategorycode($categorycode);
+    if ($message) {
         $template->param( else => 1 );
-        default( 'MESSAGE8', $template );
-    } else {
+        default($message,$template);
+    }
+    else {
         $template->param( delete_category => 1 );
         $template->param( categorycode    => $categorycode );
     }
@@ -308,6 +310,7 @@ sub branchinfotable {
 
     my ($branchcode,$innertemplate) = @_;
     my $branchinfo = $branchcode ? GetBranchInfo($branchcode) : GetBranchInfo();
+    my $ownbranch = C4::Branch->mybranch();
     my @loop_data = ();
     foreach my $branch (@$branchinfo) {
         #
@@ -367,7 +370,18 @@ sub branchinfotable {
         $row{'branch_code'} = $branch->{'branchcode'};
         $row{'value'}       = $branch->{'branchcode'};
 
-        push @loop_data, \%row;
+           if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+                   if ($branch->{'branchcode'} eq $ownbranch)
+                   {
+                     push @loop_data, \%row;
+                   }
+           }
+             else
+             {
+               push @loop_data, \%row;
+             }
+          
     }
     my @branchcategories = ();
 	for my $ctype ( GetCategoryTypes() ) {
diff --git a/admin/categorie.pl b/admin/categorie.pl
index 576d7ca..2178f90 100755
--- a/admin/categorie.pl
+++ b/admin/categorie.pl
@@ -67,7 +67,6 @@ my $searchfield=$input->param('description');
 my $script_name="/cgi-bin/koha/admin/categorie.pl";
 my $categorycode=$input->param('categorycode');
 my $op = $input->param('op');
-
 my ($template, $loggedinuser, $cookie)
     = get_template_and_user({template_name => "admin/categorie.tmpl",
 			     query => $input,
@@ -194,6 +193,8 @@ if ($op eq 'add_form') {
 } else { # DEFAULT
 	$template->param(else => 1);
 	my @loop;
+	my $ownbranch = C4::Branch->mybranch();
+	    
 	my ($count,$results)=StringSearch($searchfield,'web');
 	for (my $i=0; $i < $count; $i++){
 		my %row = (
@@ -214,7 +215,16 @@ if ($op eq 'add_form') {
             my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'});
             $row{messaging_prefs} = $brief_prefs if @$brief_prefs;
         }
-		push @loop, \%row;
+            
+             if ( C4::Context->preference("searchMyLibraryOnly")  )
+             {
+		      if (substr($row{'categorycode'},0,4) eq $ownbranch . '.')
+		      {
+            	        push @loop, \%row;
+	              }
+             }
+             else { push @loop, \%row; }
+	
 	}
 	$template->param(loop => \@loop);
 	# check that I (institution) and C (child) exists. otherwise => warning to the user
diff --git a/admin/cities.pl b/admin/cities.pl
index 58e33ae..251fbff 100755
--- a/admin/cities.pl
+++ b/admin/cities.pl
@@ -1,5 +1,5 @@
 #! /usr/bin/perl
-
+ 
 # Copyright 2006 SAN OUEST-PROVENCE et Paul POULAIN
 #
 # This file is part of Koha.
@@ -23,10 +23,21 @@ use CGI;
 use C4::Context;
 use C4::Auth;
 use C4::Output;
-
+use Data::Dumper::Simple;
 sub StringSearch {
-	my $sth = C4::Context->dbh->prepare("SELECT * FROM cities WHERE (city_name LIKE ?)");
-	$sth->execute("%" . (shift || '') . "%");
+	my $sth;
+	         if ( C4::Context->preference("searchMyLibraryOnly")  )
+             {
+              my $ownbranch = C4::Branch->mybranch();	
+	         $sth = C4::Context->dbh->prepare("SELECT * FROM cities WHERE (city_name LIKE ?)");
+	          $sth->execute("%" . $ownbranch . "%");
+             }
+             else {
+             	 $sth = C4::Context->dbh->prepare("SELECT * FROM cities WHERE (city_name LIKE ?)");
+             	 $sth->execute("%" . (shift || '') . "%");
+             }
+	          
+	
     return $sth->fetchall_arrayref({});
 }
 
@@ -36,6 +47,7 @@ my $searchfield = $input->param('city_name');
 my $cityid      = $input->param('cityid');
 my $op          = $input->param('op') || '';
 
+
 my ($template, $loggedinuser, $cookie)
     = get_template_and_user({template_name => "admin/cities.tmpl",
 			     query => $input,
@@ -44,6 +56,7 @@ my ($template, $loggedinuser, $cookie)
 			     flagsrequired => {parameters => 1},
 			     debug => 1,
 			     });
+			     
 
 $template->param(	script_name => $script_name,
 		 	cityid     => $cityid ,
@@ -57,12 +70,17 @@ if ($op eq 'add_form') {
 	
 	#---- if primkey exists, it's a modify action, so read values to modify...
 	my $data;
-	if ($cityid) {
-		my $sth=$dbh->prepare("select cityid,city_name,city_zipcode from cities where  cityid=?");
-		$sth->execute($cityid);
+	if ($cityid) {	                                     
+                    	my $sth=$dbh->prepare("select cityid,city_name,city_zipcode from cities where  cityid=?");
+                    	$sth->execute($cityid);
+                    
+		
 		$data=$sth->fetchrow_hashref;
 	}
 
+      
+            
+
 	$template->param(	
 				city_name       => $data->{'city_name'},
 				city_zipcode    => $data->{'city_zipcode'});
@@ -102,8 +120,12 @@ if ($op eq 'add_form') {
 	exit;   # FIXME: what's the point of redirecting to this same page?
 													# END $OP eq DELETE_CONFIRMED
 } else { # DEFAULT
+
 	$template->param(else => 1);
 	$template->param(loop => StringSearch($searchfield));
-
+	
+ 
 } #---- END $OP eq DEFAULT
 output_html_with_http_headers $input, $cookie, $template->output;
+
+
diff --git a/admin/item_circulation_alerts.pl b/admin/item_circulation_alerts.pl
index bba5d60..fb85222 100755
--- a/admin/item_circulation_alerts.pl
+++ b/admin/item_circulation_alerts.pl
@@ -85,10 +85,10 @@ sub show {
     my $branch_name = exists($br->{$branch}) && $br->{$branch}->{branchname};
 
     my @categories = (
-        C4::Category->all
+        C4::Category->bybranch
     );
     my @item_types = map { br($_, 'description') }  (
-        C4::ItemType->all
+        C4::ItemType->bybranch
     );
     my $grid_checkout = $preferences->grid({ branchcode => $branch, notification => 'CHECKOUT' });
     my $grid_checkin  = $preferences->grid({ branchcode => $branch, notification => 'CHECKIN' });
diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl
index 3219da3..5797d12 100755
--- a/admin/itemtypes.pl
+++ b/admin/itemtypes.pl
@@ -55,12 +55,28 @@ use C4::Output;
 sub StringSearch {
     my ( $searchstring, $type ) = @_;
     my $dbh = C4::Context->dbh;
+    my $ownbranch = C4::Branch->mybranch();
     $searchstring =~ s/\'/\\\'/g;
     my @data = split( ' ', $searchstring );
-    my $sth = $dbh->prepare(
-        "SELECT * FROM itemtypes WHERE (description LIKE ?) ORDER BY itemtype"
+    my $sth;
+    
+    
+     if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+            $sth = $dbh->prepare(
+                   "SELECT * FROM itemtypes WHERE (itemtype LIKE ?) ORDER BY itemtype"
 	);
-    $sth->execute("$data[0]%");
+	    
+    $sth->execute("$ownbranch%");
+           }
+           else {
+                   $sth = $dbh->prepare(
+                   "SELECT * FROM itemtypes WHERE (description LIKE ?) ORDER BY itemtype"
+	        );
+	    
+               $sth->execute("$data[0]%");
+               
+                 }
     return $sth->fetchall_arrayref({});		# return ref-to-array of ref-to-hashes
 								# like [ fetchrow_hashref(), fetchrow_hashref() ... ]
 }
@@ -188,17 +204,15 @@ elsif ( $op eq 'add_validate' ) {
     # called by default form, used to confirm deletion of data in DB
 }
 elsif ( $op eq 'delete_confirm' ) {
-    # Check both items and biblioitems
-    my $sth = $dbh->prepare('
-        SELECT COUNT(*) AS total FROM (
-            SELECT itemtype AS t FROM biblioitems
-            UNION
-            SELECT itype AS t FROM items
-        ) AS tmp
-        WHERE tmp.t=?
-    ');
-    $sth->execute($itemtype);
-    my $total = $sth->fetchrow_hashref->{'total'};
+    # Check both categoryitem and biblioitems, see Bug 199
+    my $total = 0;
+    for my $table ('biblioitems') {
+        my $sth =
+          $dbh->prepare(
+            "select count(*) as total from $table where itemtype=?");
+        $sth->execute($itemtype);
+        $total += $sth->fetchrow_hashref->{total};
+    }
 
     my $sth =
       $dbh->prepare(
diff --git a/admin/roadtype.pl b/admin/roadtype.pl
index a756594..3d6845f 100755
--- a/admin/roadtype.pl
+++ b/admin/roadtype.pl
@@ -27,8 +27,18 @@ use C4::Auth;
 
 
 sub StringSearch  {
-    my $sth = C4::Context->dbh->prepare("Select * from roadtype where (road_type like ?) ORDER BY road_type");
-    $sth->execute((shift || '') . '%');
+	   my $sth;
+             if ( C4::Context->preference("searchMyLibraryOnly")  )
+             {
+              my $ownbranch = C4::Branch->mybranch();   
+              $sth = C4::Context->dbh->prepare("Select * from roadtype where (road_type like ?) ORDER BY road_type");
+              $sth->execute("%" . $ownbranch . "%");
+              
+             }
+             else {
+              $sth = C4::Context->dbh->prepare("Select * from roadtype where (road_type like ?) ORDER BY road_type");
+              $sth->execute((shift || '') . '%');
+             }
     return $sth->fetchall_arrayref({});
 }
 
diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl
index f290934..7e04190 100755
--- a/admin/smart-rules.pl
+++ b/admin/smart-rules.pl
@@ -338,24 +338,62 @@ elsif ($op eq "add-branch-item") {
 
 my $branches = GetBranches();
 my @branchloop;
+my $mybranchcode = C4::Branch->mybranch();
+ 
+my $bnSql = "SELECT branchname FROM branches WHERE branchcode = ?";
+my $bnsth = $dbh->prepare($bnSql);
+$bnsth->execute($mybranchcode);
+my @bnarr = $bnsth->fetchrow_array();
+my $mybranchname = $bnarr[0];
+
+              if ( C4::Context->preference("searchMyLibraryOnly")  )
+             {
+             my %row = 	(value =>$mybranchcode,
+                selected => 1,
+                branchname => $mybranchname,
+            );
+             push @branchloop, \%row; 
+             }
+             else {
 for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
-    push @branchloop, {
-        value      => $thisbranch,
-        selected   => $thisbranch eq $branch,
-        branchname => $branches->{$thisbranch}->{'branchname'},
-    };
+    my $selected = 1 if $thisbranch eq $branch;
+    my %row =(value => $thisbranch,
+                selected => $selected,
+                branchname => $branches->{$thisbranch}->{'branchname'},
+            );
+           
+              push @branchloop, \%row;
+                     }
 }
-
-my $sth=$dbh->prepare("SELECT description,categorycode FROM categories ORDER BY description");
-$sth->execute;
+         my $sth;
+             if ( C4::Context->preference("searchMyLibraryOnly")  )
+             {
+              $sth=$dbh->prepare("SELECT description,categorycode FROM categories WHERE categorycode LIKE ? ORDER BY description");
+              $sth->execute(C4::Branch->mybranch() . '%');             	
+
+             }
+             else
+             {
+             $sth=$dbh->prepare("SELECT description,categorycode FROM categories ORDER BY description");
+             $sth->execute;
+              }
+              
 my @category_loop;
 while (my $data=$sth->fetchrow_hashref){
     push @category_loop,$data;
 }
 
 $sth->finish;
-$sth=$dbh->prepare("SELECT description,itemtype FROM itemtypes ORDER BY description");
-$sth->execute;
+         
+             if ( C4::Context->preference("searchMyLibraryOnly")  )
+             {
+              $sth=$dbh->prepare("SELECT description,itemtype FROM itemtypes WHERE itemtype LIKE ? ORDER BY description");
+              $sth->execute(C4::Branch->mybranch() . '%');
+             }
+             else {
+              $sth=$dbh->prepare("SELECT description,itemtype FROM itemtypes ORDER BY description");
+              $sth->execute;             	
+             }
 # $i=0;
 my @row_loop;
 my @itemtypes;
@@ -375,7 +413,6 @@ my $sth2 = $dbh->prepare("
 $sth2->execute($branch);
 
 while (my $row = $sth2->fetchrow_hashref) {
-    $row->{'current_branch'} ||= $row->{'branchcode'};
     $row->{'humanitemtype'} ||= $row->{'itemtype'};
     $row->{'default_humanitemtype'} = 1 if $row->{'humanitemtype'} eq '*';
     $row->{'humancategorycode'} ||= $row->{'categorycode'};
@@ -425,7 +462,7 @@ foreach my $entry (@sorted_branch_cat_rules, @sorted_row_loop) {
     $entry->{unlimited_maxissueqty} = 1 unless defined($entry->{maxissueqty});
 }
 
- at sorted_row_loop = sort by_category_and_itemtype @row_loop;
+my @sorted_row_loop = sort by_category_and_itemtype @row_loop;
 
 my $sth_branch_item;
 if ($branch eq "*") {
@@ -529,3 +566,6 @@ sub by_itemtype {
         return $a->{'humanitemtype'} cmp $b->{'humanitemtype'};
     }
 }
+
+
+
diff --git a/basket/basket.pl b/basket/basket.pl
index 8fc15e4..ed6e5a4 100755
--- a/basket/basket.pl
+++ b/basket/basket.pl
@@ -66,7 +66,7 @@ foreach my $biblionumber ( @bibs ) {
     my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
     my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
     my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
-    my @items            = GetItemsInfo( $biblionumber );
+    my @items            = &GetItemsInfo( $biblionumber, 'opac' );
 
     my $hasauthors = 0;
     if($dat->{'author'} || @$marcauthorsarray) {
diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl
index 66f73fa..107a737 100755
--- a/basket/sendbasket.pl
+++ b/basket/sendbasket.pl
@@ -80,7 +80,7 @@ if ( $email_add ) {
         my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
         my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
 
-        my @items = GetItemsInfo( $biblionumber );
+        my @items = &GetItemsInfo( $biblionumber, 'opac' );
 
         my $hasauthors = 0;
         if($dat->{'author'} || @$marcauthorsarray) {
diff --git a/catalogue/detail.pl b/catalogue/detail.pl
index 8738737..18d7e8b 100755
--- a/catalogue/detail.pl
+++ b/catalogue/detail.pl
@@ -37,9 +37,10 @@ use C4::External::Amazon;
 use C4::Search;		# enabled_staff_search_views
 use C4::VirtualShelves;
 use C4::XSLT;
-
+use Data::Dumper::Simple;
 # use Smart::Comments;
 
+
 my $query = CGI->new();
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     {
@@ -112,7 +113,8 @@ my $branches = GetBranches();
 my $itemtypes = GetItemTypes();
 my $dbh = C4::Context->dbh;
 
-my @all_items = GetItemsInfo( $biblionumber );
+# 'intra' param included, even though it's not respected in GetItemsInfo currently
+my @all_items= GetItemsInfo($biblionumber, 'intra');
 my @items;
 for my $itm (@all_items) {
     push @items, $itm unless ( $itm->{itemlost} && GetHideLostItemsPreference($borrowernumber) && !$showallitems);
@@ -158,9 +160,11 @@ my (@itemloop, %itemfields);
 my $norequests = 1;
 my $authvalcode_items_itemlost = GetAuthValCode('items.itemlost',$fw);
 my $authvalcode_items_damaged  = GetAuthValCode('items.damaged', $fw);
+my $ownbranch = C4::Branch->mybranch();
+
 foreach my $item (@items) {
 
-    $item->{homebranch}        = GetBranchName($item->{homebranch});
+    $item->{homebranch}        = GetBranchName($item->{branchcode});
 
     # can place holds defaults to yes
     $norequests = 0 unless ( ( $item->{'notforloan'} > 0 ) || ( $item->{'itemnotforloan'} > 0 ) );
@@ -223,7 +227,16 @@ foreach my $item (@items) {
         $item->{waitingdate} = format_date($wait_hashref->{waitingdate});
     }
 
-    push @itemloop, $item;
+
+    if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+	       if ($item->{holdingbranch} eq C4::Branch->mybranch())
+	       {
+                 push @itemloop, $item;
+                }
+          } 
+else { push @itemloop, $item;
+}
 }
 
 $template->param( norequests => $norequests );
@@ -281,6 +294,9 @@ foreach ( keys %{$dat} ) {
 # does not work: my %views_enabled = map { $_ => 1 } $template->query(loop => 'EnableViews');
 # method query not found?!?!
 
+
+
+  
 $template->param(
     itemloop        => \@itemloop,
     biblionumber        => $biblionumber,
@@ -288,8 +304,12 @@ $template->param(
     subscriptions       => \@subs,
     subscriptionsnumber => $subscriptionsnumber,
     subscriptiontitle   => $dat->{title},
+   
 );
-
+       
+ 
+	
+  
 # $debug and $template->param(debug_display => 1);
 
 # Lists
@@ -353,3 +373,5 @@ if (C4::Context->preference('OPACBaseURL')){
 }
 
 output_html_with_http_headers $query, $cookie, $template->output;
+
+
diff --git a/catalogue/detailprint.pl b/catalogue/detailprint.pl
index fe92fe5..41d346f 100755
--- a/catalogue/detailprint.pl
+++ b/catalogue/detailprint.pl
@@ -35,7 +35,7 @@ my $type  = $query->param('type');
 my $biblionumber = $query->param('biblionumber');
 
 # change back when ive fixed request.pl
-my @items = GetItemsInfo( $biblionumber );
+my @items = GetItemsInfo( $biblionumber, $type );
 my $norequests = 1;
 foreach my $itm (@items) {
     $norequests = 0 unless $itm->{'notforloan'};
diff --git a/catalogue/search.pl b/catalogue/search.pl
index e49507e..e1e9a98 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -289,19 +289,15 @@ if ( $template_type eq 'advsearch' ) {
     $template->param(outer_sup_servers_loop => $secondary_servers_loop,);
 
     # set the default sorting
-    if (   C4::Context->preference('OPACdefaultSortField')
-        && C4::Context->preference('OPACdefaultSortOrder') ) {
-        my $default_sort_by =
-            C4::Context->preference('defaultSortField') . '_'
-          . C4::Context->preference('defaultSortOrder');
-        $template->param( $default_sort_by => 1 );
-    }
+    my $default_sort_by = C4::Context->preference('defaultSortField')."_".C4::Context->preference('defaultSortOrder')
+        if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
+    $template->param($default_sort_by => 1);
 
     # determine what to display next to the search boxes (ie, boolean option
     # shouldn't appear on the first one, scan indexes should, adding a new
     # box should only appear on the last, etc.
     my @search_boxes_array;
-    my $search_boxes_count = 3; # begin whith 3 boxes
+    my $search_boxes_count = C4::Context->preference("OPACAdvSearchInputCount") || 3; # FIXME: using OPAC sysprefs?
     # FIXME: all this junk can be done in TMPL using __first__ and __last__
     for (my $i=1;$i<=$search_boxes_count;$i++) {
         # if it's the first one, don't display boolean option, but show scan indexes
@@ -358,13 +354,8 @@ my $params = $cgi->Vars;
 # sort by is used to sort the query
 # in theory can have more than one but generally there's just one
 my @sort_by;
-my $default_sort_by;
-if (   C4::Context->preference('defaultSortField')
-    && C4::Context->preference('defaultSortOrder') ) {
-    $default_sort_by =
-        C4::Context->preference('defaultSortField') . '_'
-      . C4::Context->preference('defaultSortOrder');
-}
+my $default_sort_by = C4::Context->preference('defaultSortField')."_".C4::Context->preference('defaultSortOrder') 
+    if (C4::Context->preference('defaultSortField') && C4::Context->preference('defaultSortOrder'));
 
 @sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
 $sort_by[0] = $default_sort_by unless $sort_by[0];
@@ -480,7 +471,7 @@ my $scan_index_to_use;
 
 for my $this_cgi ( split('&',$query_cgi) ) {
     next unless $this_cgi;
-    $this_cgi =~ m/(.*?)=(.*)/;
+    $this_cgi =~ m/(.?)=(.*)/;
     my $input_name = $1;
     my $input_value = $2;
     push @query_inputs, { input_name => $input_name, input_value => $input_value };
@@ -594,10 +585,7 @@ for (my $i=0;$i<@servers;$i++) {
             # default page number
             my $current_page_number = 1;
             $current_page_number = ($offset / $results_per_page + 1) if $offset;
-            my $previous_page_offset;
-            if ( $offset >= $results_per_page ) {
-                $previous_page_offset = $offset - $results_per_page;
-            }
+            my $previous_page_offset = $offset - $results_per_page unless ($offset - $results_per_page <0);
             my $next_page_offset = $offset + $results_per_page;
             # If we're within the first 10 pages, keep it simple
             #warn "current page:".$current_page_number;
@@ -611,14 +599,10 @@ for (my $i=0;$i<@servers;$i++) {
                     my $this_offset = (($i*$results_per_page)-$results_per_page);
                     # the page number for this page
                     my $this_page_number = $i;
+                    # it should only be highlighted if it's the current page
+                    my $highlight = 1 if ($this_page_number == $current_page_number);
                     # put it in the array
-                    push @page_numbers,
-                      { offset    => $this_offset,
-                        pg        => $this_page_number,
-                        # it should only be highlighted if it's the current page
-                        highlight => $this_page_number == $current_page_number,
-                        sort_by   => join ' ', @sort_by
-                      };
+                    push @page_numbers, { offset => $this_offset, pg => $this_page_number, highlight => $highlight, sort_by => join " ", at sort_by };
                                 
                 }
                         
@@ -629,13 +613,9 @@ for (my $i=0;$i<@servers;$i++) {
                 for (my $i=$current_page_number; $i<=($current_page_number + 20 );$i++) {
                     my $this_offset = ((($i-9)*$results_per_page)-$results_per_page);
                     my $this_page_number = $i-9;
-                    if ( $this_page_number <= $pages ) {
-                        push @page_numbers,
-                          { offset    => $this_offset,
-                            pg        => $this_page_number,
-                            highlight => $this_page_number == $current_page_number,
-                            sort_by   => join ' ', @sort_by
-                          };
+                    my $highlight = 1 if ($this_page_number == $current_page_number);
+                    if ($this_page_number <= $pages) {
+                        push @page_numbers, { offset => $this_offset, pg => $this_page_number, highlight => $highlight, sort_by => join " ", at sort_by };
                     }
                 }
             }
diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index e912c66..7e146c0 100755
--- a/cataloguing/addbiblio.pl
+++ b/cataloguing/addbiblio.pl
@@ -913,17 +913,11 @@ if ($biblionumber) {
 #-------------------------------------------------------------------------------------
 if ( $op eq "addbiblio" ) {
 #-------------------------------------------------------------------------------------
-    $template->param(
-        biblionumberdata => $biblionumber,
-    );
     # getting html input
     my @params = $input->param();
     $record = TransformHtmlToMarc( \@params , $input );
     # check for a duplicate
-    my ( $duplicatebiblionumber, $duplicatetitle );
-    if ( !$is_a_modif ) {
-        ( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($record);
-    }
+    my ($duplicatebiblionumber,$duplicatetitle) = FindDuplicate($record) if (!$is_a_modif);
     my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
     # it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate)
     if ( !$duplicatebiblionumber or $confirm_not_duplicate ) {
@@ -1002,10 +996,6 @@ elsif ( $op eq "delete" ) {
    #----------------------------------------------------------------------------
    # If we're in a duplication case, we have to set to "" the biblionumber
    # as we'll save the biblio as a new one.
-    $template->param(
-        biblionumberdata => $biblionumber,
-        op               => $op,
-    );
     if ( $op eq "duplicate" ) {
         $biblionumber = "";
     }
diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index faa9a0a..2be407a 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -8,7 +8,7 @@
 #
 # Koha is free software; you can redistribute it and/or modify it under the
 # terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
+# Foundation; eiher version 2 of the License, or (at your option) any later
 # version.
 #
 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -34,7 +34,7 @@ use C4::Dates;
 use List::MoreUtils qw/any/;
 
 use MARC::File::XML;
-
+use Data::Dumper::Simple;
 my $dbh = C4::Context->dbh;
 
 sub find_value {
@@ -95,11 +95,17 @@ sub _increment_barcode {
 
 sub generate_subfield_form {
         my ($tag, $subfieldtag, $value, $tagslib,$subfieldlib, $branches, $today_iso, $biblionumber, $temp, $loop_data, $i) = @_;
-        
+        my $authorised_values_sth;
         my %subfield_data;
-        my $dbh = C4::Context->dbh;        
-        my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib");
+        my $dbh = C4::Context->dbh; 
         
+        if (C4::Context->preference("searchMyLibraryOnly"))
+        {       
+         $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? AND authorised_value like '" . C4::Branch->mybranch() . "%' ORDER BY lib");
+    }
+    else {
+         $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib");     
+    }
         my $index_subfield = int(rand(1000000)); 
         if ($subfieldtag eq '@'){
             $subfield_data{id} = "tag_".$tag."_subfield_00_".$index_subfield;
@@ -141,7 +147,7 @@ sub generate_subfield_form {
         
         my $attributes_no_value = qq(tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" );
         my $attributes          = qq($attributes_no_value value="$value" );
-        
+        my $sth;
         if ( $subfieldlib->{authorised_value} ) {
             my @authorised_values;
             my %authorised_lib;
@@ -155,7 +161,15 @@ sub generate_subfield_form {
             }
             elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
                   push @authorised_values, "" unless ( $subfieldlib->{mandatory} );
-                  my $sth = $dbh->prepare("SELECT itemtype,description FROM itemtypes ORDER BY description");
+                  
+                          if (C4::Context->preference("searchMyLibraryOnly"))
+                           {  
+                  $sth = $dbh->prepare("SELECT itemtype,description FROM itemtypes where itemtype like '" . C4::Branch->mybranch() . "%' ORDER BY description");
+                           }
+                           else {
+ $sth =  dbh->prepare("SELECT itemtype,description FROM itemtypes ORDER BY description");
+                                              
+}
                   $sth->execute;
                   while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) {
                       push @authorised_values, $itemtype;
@@ -545,14 +559,29 @@ my ($holdingbrtagf,$holdingbrtagsubf) = &GetMarcFromKohaField("items.holdingbran
 # First, the existing items for display
 my @item_value_loop;
 my @header_value_loop;
+my $itemloc;
+my $ownbranch = C4::Branch->mybranch();
 for my $row ( @big_array ) {
     my %row_data;
-    my @item_fields = map +{ field => $_ || '' }, @$row{ sort keys(%witness) };
+    my @item_fields = map +{ field => $_ || '' }, @$row{ sort keys(%witness) };    
     $row_data{item_value} = [ @item_fields ];
     $row_data{itemnumber} = $row->{itemnumber};
+    $itemloc = GetItem( $itemnumber );
+    $row_data{location} = $itemloc->{location};    
     #reporting this_row values
     $row_data{'nomod'} = $row->{'nomod'};
-    push(@item_value_loop,\%row_data);
+
+        if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+               $itemloc = C4::Branch::homeBranchFromItem($row_data{itemnumber});
+              
+             
+               if ($itemloc eq $ownbranch)
+               {
+             push(@item_value_loop,\%row_data);
+         }
+           }
+           else { push(@item_value_loop,\%row_data); }
 }
 foreach my $subfield_code (sort keys(%witness)) {
     my %header_value;
@@ -570,8 +599,14 @@ my $onlymine = C4::Context->preference('IndependantBranches') &&
                C4::Context->userenv                           && 
                C4::Context->userenv->{flags}!=1               && 
                C4::Context->userenv->{branch};
+               
+ 
+        if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+               $onlymine = 1;
+            }                 
 my $branches = GetBranchesLoop(C4::Context->userenv->{branch},$onlymine);  # build once ahead of time, instead of multiple times later.
-
+   
 # We generate form, from actuel record
 @fields = ();
 if($itemrecord){
@@ -595,6 +630,7 @@ if($itemrecord){
 
                 }
             }
+         
     # and now we add fields that are empty
 
 foreach my $tag ( keys %{$tagslib}){
@@ -609,6 +645,7 @@ foreach my $tag ( keys %{$tagslib}){
             my $subfield_data = generate_subfield_form($tag, $subtag, $value, $tagslib, $tagslib->{$tag}->{$subtag}, $branches, $today_iso, $biblionumber, $temp, \@loop_data, $i); 
             push (@loop_data, $subfield_data);
             $i++;
+            
         } 
   }
 }
@@ -633,4 +670,16 @@ $template->param(
 foreach my $error (@errors) {
     $template->param($error => 1);
 }
+
+
+# die (Dumper(@loop_data));
+
 output_html_with_http_headers $input, $cookie, $template->output;
+my $ctr;
+for  $ctr (0..scalar @loop_data-1)
+{
+    if (@loop_data[$ctr]->{'tag'} == 952 && @loop_data[$ctr]->{'subfield'} == 8)
+    {
+print @loop_data[$ctr]->{'id'} . '<br>';  
+    }
+}    
\ No newline at end of file
diff --git a/cataloguing/z3950_search.pl b/cataloguing/z3950_search.pl
index b12a9c9..36a6935 100755
--- a/cataloguing/z3950_search.pl
+++ b/cataloguing/z3950_search.pl
@@ -120,7 +120,12 @@ else {
     if ($isbn || $issn) {
         $term=$isbn if ($isbn);
         $term=$issn if ($issn);
-        $query .= " \@or \@attr 1=8 \"$term\" \@attr 1=7 \"$term\" ";
+        
+        
+        $query .= " \@attr 1=7 \"$term\" ";
+
+        #Uncomment out below to revert to original script
+        #$query .= " \@or \@attr 1=8 \"$term\" \@attr 1=7 \"$term\" ";
         $nterms++;
     }
     if ($title) {
diff --git a/circ/circulation.pl b/circ/circulation.pl
index c34db54..1f0fd5c 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -230,7 +230,7 @@ if ($borrowernumber) {
             0 , $borrower->{'enrolmentperiod'});
     }
     # if the expiry date is before today ie they have expired
-    if ( !$borrower->{'dateexpiry'} || $warning_year*$warning_month*$warning_day==0
+    if ( $warning_year*$warning_month*$warning_day==0 
         || Date_to_Days($today_year,     $today_month, $today_day  ) 
          > Date_to_Days($warning_year, $warning_month, $warning_day) )
     {
@@ -238,7 +238,7 @@ if ($borrowernumber) {
         $template->param(
             flagged  => "1",
             noissues => "1",
-            expired => "1",
+            expired     => format_date($borrower->{dateexpiry}),
             renewaldate => format_date("$renew_year-$renew_month-$renew_day")
         );
     }
@@ -488,7 +488,9 @@ if ($borrower) {
 
 my @values;
 my %labels;
+
 my $CGIselectborrower;
+
 if ($borrowerslist) {
     foreach (
         sort {(lc $a->{'surname'} cmp lc $b->{'surname'} || lc $a->{'firstname'} cmp lc $b->{'firstname'})
@@ -499,6 +501,7 @@ if ($borrowerslist) {
         $labels{ $_->{'borrowernumber'} } =
 "$_->{'surname'}, $_->{'firstname'} ... ($_->{'cardnumber'} - $_->{'categorycode'}) ...  $_->{'address'} ";
     }
+   
     $CGIselectborrower = CGI::scrolling_list(
         -name     => 'borrowernumber',
         -class    => 'focus',
diff --git a/circ/overdue.pl b/circ/overdue.pl
index 18851a6..2fa09ff 100755
--- a/circ/overdue.pl
+++ b/circ/overdue.pl
@@ -59,8 +59,15 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
 my $dbh = C4::Context->dbh;
 
 my $req;
-$req = $dbh->prepare( "select categorycode, description from categories order by description");
+ if (C4::Context->preference("searchMyLibraryOnly"))
+ { 
+$req = $dbh->prepare( "select categorycode, description from categories where categorycode like '" . C4::Branch->mybranch() . "%' order by description");
+}
+else {
+  $req = $dbh->prepare( "select categorycode, description from categories order by description");  
+}
 $req->execute;
+
 my @borcatloop;
 while (my ($catcode, $description) =$req->fetchrow) {
     push @borcatloop, {
@@ -69,8 +76,13 @@ while (my ($catcode, $description) =$req->fetchrow) {
         catname  => $description,
     };
 }
-
+ if (C4::Context->preference("searchMyLibraryOnly"))
+ { 
+   $req = $dbh->prepare( "select itemtype, description from itemtypes where itemtype like '" . C4::Branch->mybranch() . "%' order by description");  
+ }
+ else {
 $req = $dbh->prepare( "select itemtype, description from itemtypes order by description");
+}
 $req->execute;
 my @itemtypeloop;
 while (my ($itemtype, $description) =$req->fetchrow) {
@@ -262,6 +274,12 @@ if ($noreport) {
     LEFT JOIN biblio      ON (biblio.biblionumber=items.biblionumber )
     WHERE 1=1 "; # placeholder, since it is possible that none of the additional
                  # conditions will be selected by user
+    
+ if (C4::Context->preference("searchMyLibraryOnly"))
+ {   
+    $strsth.=" AND issues.branchcode = '" . C4::Branch->mybranch() . "' ";
+  }  
+    
     $strsth.=" AND date_due               < '" . $todaysdate     . "' " unless ($showall);
     $strsth.=" AND (borrowers.firstname like '".$bornamefilter."%' or borrowers.surname like '".$bornamefilter."%' or borrowers.cardnumber like '".$bornamefilter."%')" if($bornamefilter) ;
     $strsth.=" AND borrowers.categorycode = '" . $borcatfilter   . "' " if $borcatfilter;
@@ -301,6 +319,7 @@ if ($noreport) {
             push @patron_attr_value_loop, { value => join(', ', sort { lc $a cmp lc $b } @displayvalues) };
         }
 
+
         push @overduedata, {
             duedate                => format_date($data->{date_due}),
             borrowernumber         => $data->{borrowernumber},
@@ -404,3 +423,5 @@ sub build_csv {
 
     return join("\n", @lines) . "\n";
 }
+
+
diff --git a/circ/returns.pl b/circ/returns.pl
index bb5230b..d7fad0c 100755
--- a/circ/returns.pl
+++ b/circ/returns.pl
@@ -537,7 +537,6 @@ if ($borrower) {
 my $returned_counter = ( C4::Context->preference('numReturnedItemsToShow') ) ? C4::Context->preference('numReturnedItemsToShow') : 8;
 my $count = 0;
 my @riloop;
-my $shelflocations = GetKohaAuthorisedValues('items.location','');
 foreach ( sort { $a <=> $b } keys %returneditems ) {
     my %ri;
     if ( $count++ < $returned_counter ) {
@@ -576,11 +575,6 @@ foreach ( sort { $a <=> $b } keys %returneditems ) {
         $ri{ccode}            = $biblio->{'ccode'};
         $ri{itemnumber}       = $biblio->{'itemnumber'};
         $ri{barcode}          = $bar_code;
-
-        $ri{location}         = $biblio->{'location'};
-        my $shelfcode = $ri{'location'};
-        $ri{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) );
-
     }
     else {
         last;
diff --git a/circ/ysearch.pl b/circ/ysearch.pl
index f8fc52a..f0360d4 100755
--- a/circ/ysearch.pl
+++ b/circ/ysearch.pl
@@ -42,21 +42,45 @@ if ($auth_status ne "ok") {
 }
 
 my $dbh = C4::Context->dbh;
-my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode, country 
+
+
+my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode, country , branchcode 
              FROM borrowers 
              WHERE surname LIKE ?
              OR firstname LIKE ?
              OR cardnumber LIKE ?
              ORDER BY surname, firstname);
+
+       
+
 my $sth = $dbh->prepare( $sql );
+
 $sth->execute("$query%", "$query%", "$query%");
 
 while ( my $rec = $sth->fetchrow_hashref ) {
+
+if (C4::Context->preference("searchMyLibraryFirst"))
+  {    
+    if ($rec->{branchcode} eq C4::Branch->mybranch())
+    {
     print $rec->{surname} . ", " . $rec->{firstname} . "\t" .
           $rec->{cardnumber} . "\t" .
           $rec->{address} . "\t" .
           $rec->{city} . "\t" .
           $rec->{zip} . "\t" .
-          $rec->{country} .
-          "\n";
+          $rec->{country} . "\t" .
+     
+                 "\n";
+         }
+     }    
+     else {
+       
+          print $rec->{surname} . ", " . $rec->{firstname} . "\t" .
+          $rec->{address} . "\t" .
+          $rec->{city} . "\t" .
+          $rec->{zip} . "\t" .
+          $rec->{country} . "\t" .
+     
+                 "\n";
+     }
 }
diff --git a/debian/build-git-snapshot b/debian/build-git-snapshot
index 3847024..4768719 100755
--- a/debian/build-git-snapshot
+++ b/debian/build-git-snapshot
@@ -30,7 +30,7 @@ latest_sha1() {
 }
 
 newversion() {
-    printf '3.5-1~git%s.%s' $(date +%Y%m%d%H%M%S) $(latest_sha1)
+    printf '3.3-1~git%s.%s' $(date +%Y%m%d%H%M%S) $(latest_sha1)
 }
 
 adjust_debian_changelog() {
diff --git a/debian/changelog b/debian/changelog
index 7a01bb1..f710ca5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,43 +1,3 @@
-koha (3.2.9-1) squeeze; urgency=high
-
-  * New upstream release (3.02.09)
-  * This is a security release, see
-    http://lists.katipo.co.nz/pipermail/koha/2011-May/029046.html
-
- -- Robin Sheat <robin at catalyst.net.nz>  Tue, 17 May 2011 16:09:09 +1200
-
-koha (3.2.7-1) squeeze; urgency=low
-
-  * New upstream release (3.02.07) 
-
- -- Robin Sheat <robin at catalyst.net.nz>  Tue, 19 Apr 2011 14:35:49 +1200
-
-koha (3.2.6-1) squeeze; urgency=low
-
-  * New upstream release (3.02.06) 
-
- -- Robin Sheat <robin at catalyst.net.nz>  Tue, 29 Mar 2011 14:38:28 +1300
-
-koha (3.2.5-1) squeeze; urgency=high
-
-  * New upstream release (3.02.05)
-  * This is a security release, see
-    http://lists.katipo.co.nz/pipermail/koha/2011-February/027771.html
-
- -- Robin Sheat <robin at catalyst.net.nz>  Fri, 25 Feb 2011 11:39:21 +1300
-
-koha (3.2.3-1) squeeze; urgency=low
-
-  * New upstream release (3.02.03) 
-
- -- Robin Sheat <robin at catalyst.net.nz>  Tue, 08 Feb 2011 10:50:10 +1300
-
-koha (3.2.2-1) squeeze; urgency=low
-
-  * New upstream release (3.02.02) 
-
- -- Robin Sheat <robin at catalyst.net.nz>  Sun, 09 Jan 2011 19:42:04 +1300
-
 koha (3.2.1-1) squeeze; urgency=low
 
   * New upstream release. 
diff --git a/debian/control b/debian/control
index 19f1edc..add095f 100644
--- a/debian/control
+++ b/debian/control
@@ -6,8 +6,7 @@ Standards-Version: 3.8.4
 # NOTA BENE: Build dependencies end up as runtime dependencies as well.
 # See debian/rules, the override_dh_gencontrol rules. 
 # There are some exceptions.
-Build-Depends: libcgi-session-driver-memcached-perl,
- libalgorithm-checkdigits-perl,
+Build-Depends: libalgorithm-checkdigits-perl,
  libauthen-cas-client-perl,
  libbiblio-endnotestyle-perl,
  libbusiness-isbn-perl,
@@ -87,7 +86,6 @@ Depends: ${misc:Depends}, ${koha:Depends},
  apache2-mpm-itk,
  at,
  daemon,
- debconf,
  idzebra-2.0,
  libjs-jquery,
  libjs-yui,
diff --git a/debian/control.in b/debian/control.in
index 2c14de9..090b7b3 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -16,7 +16,6 @@ Depends: ${misc:Depends}, ${koha:Depends},
  apache2-mpm-itk,
  at,
  daemon,
- debconf,
  idzebra-2.0,
  libjs-jquery,
  libjs-yui,
diff --git a/debian/koha-common.install b/debian/koha-common.install
index a970719..6ed2587 100644
--- a/debian/koha-common.install
+++ b/debian/koha-common.install
@@ -25,5 +25,4 @@ debian/scripts/koha-restore                 usr/sbin
 debian/scripts/koha-start-zebra             usr/sbin
 debian/scripts/koha-stop-zebra              usr/sbin
 debian/scripts/koha-upgrade-schema          usr/sbin
-debian/scripts/koha-upgrade-to-3.4          usr/sbin
 debian/scripts/*.8                          usr/share/man/man8
diff --git a/debian/koha-common.postinst b/debian/koha-common.postinst
index 7fa4513..64a7980 100644
--- a/debian/koha-common.postinst
+++ b/debian/koha-common.postinst
@@ -2,8 +2,6 @@
 
 set -e
 
-. /usr/share/debconf/confmodule
-
 conf=/etc/mysql/koha-common.cnf
 if [ ! -e "$conf" ] && [ ! -L "$conf" ]
 then
@@ -13,7 +11,3 @@ fi
 #DEBHELPER#
 
 koha-upgrade-schema $(koha-list)
-
-db_stop
-
-exit 0
diff --git a/debian/rules b/debian/rules
index 1b20293..25f111a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,12 +19,12 @@ override_dh_auto_install:
 	rm -r $(TMP)/var/run
 	rm -r $(TMP)/var/lock
 	rm $(TMP)/var/log/koha/README
-#	rm $(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/lib/jquery/jquery.js
-#	ln -s /usr/share/javascript/jquery/jquery.js \
-#	   $(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/lib/jquery/jquery.js
-#	rm $(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/lib/jquery/jquery.js
-#	ln -s /usr/share/javascript/jquery/jquery.js \
-#	   $(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/lib/jquery/jquery.js
+	rm $(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/lib/jquery/jquery.js
+	ln -s /usr/share/javascript/jquery/jquery.js \
+	   $(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/lib/jquery/jquery.js
+	rm $(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/lib/jquery/jquery.js
+	ln -s /usr/share/javascript/jquery/jquery.js \
+	   $(TMP)/usr/share/koha/opac/htdocs/opac-tmpl/prog/en/lib/jquery/jquery.js
 	rm -r \
 		$(TMP)/usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/js/tinymce
 	ln -s /usr/share/tinymce2/www \
diff --git a/docs/history.txt b/docs/history.txt
index 6600a4f..02e40d4 100644
--- a/docs/history.txt
+++ b/docs/history.txt
@@ -44,17 +44,17 @@ November 8 2001	 Steve Tonessen succeeds Chris Cormack as Release manager
 January 24 2002	 First message to the main koha list from Stephen Hedges at NPL
 February 1 2002	 First message to the main koha list from Paul Poulain
 February 22 2002	 Paul Poulain sends an email saying he will work on Koha
-March 6 2002	 Paul Poulain becomes the 7th committer to Koha
+March 6 2002	 Paul becomes the 7th committer to Koha
 March 13 2002	 Katipo's new developer Finlay Thompson becomes the 8th committer to Koha
 March 14 2002	 First email from Joshua Ferraro
 March 20 2002	 Roger Buck sets up the first Koha wiki
 March 30 2002	 Nicholas Rosasco begins work on a documentation site
 April 2 2002	 Pat Eyler introduces himself to the community
-April 9 2002	 Pat Eyler becomes 9th committer to Koha
+April 9 2002	 Pat Eyler becomes 8th committer to Koha
 April 14 2002	 Chris Cormack asks Nicholas Rosasco to help coordinate the developers with him
-April 10 2002	 Gynn Lomax (of Katipo) becomes 10th committer to Koha
+April 10 2002	 Gynn Lomax (of Katipo) becomes 9th committer to Koha
 April 20 2002	 irc channel #koha set up on irc.katipo.co.nz 
-April 21 2002	 Roger Buck becomes 11th committer to Koha
+April 21 2002	 Roger Buck becomes 10th committer to Koha
 April 24 2002	 Chris Cormack branches cvs to make rel-1-2 branch
 April 24 2002	 Pat Eyler starts a who's who page on the wiki
 May 1 2002	 Chris announces 1.2.0-rc1
@@ -62,8 +62,8 @@ May 8 2002	 Paul Poulain sends his MARC support proposal to the devel list
 May 11 2002	 Steve Tonnesen outlines a structure for HTML::Template and the Koha templates
 May 14 2002	 Chris Cormack branches cvs and creates rel-1-4-marc branch for work on MARC
 May 15 2002	 Steve Tonnesen makes the irc logs publicly available
-May 18 2002	 Alan Millar becomes 12th committer to Koha
-May 27 2002	 Mike Mylonas becomes 13th committer to Koha
+May 18 2002	 Alan Millar becomes 11th committer to Koha
+May 27 2002	 Mike Mylonas becomes 12th committer to Koha
 May 23 2002	 Steve Tonnesen makes searchable logs of the irc channel available
 May 23 2002	 Koha 1.1.2rc1 released
 May 28 2002	 Rachel Hamilton-Williams puts up Katipo's Koha work on the wiki to avoid duplication of effort
@@ -92,40 +92,40 @@ August 26 2002	 Nelsonville public library announce their intention to migrate t
 September 3 2002	 Nelsonville RFP's gain traction
 September 11 2002	 Philanthropy Australia goes live with koha http://www.linuxpr.com/releases/5107.html
 September 12 2002	 Article about Koha and NPL in computerworld http://computerworld.co.nz/news.nsf/news/CC256CED0016AD1ECC256C30007B0AB9?Opendocument&HighLight=2,koha
-September 19 2002	 Dorian Meid becomes the 14th committer to Koha
-September 22 2002	 Andrew Arensburger becomes the 15th committer to Koha, with the neat C4::Context
+September 19 2002	 Dorian Meid becomes the 13th committer to Koha
+September 22 2002	 Andrew Arensburger becomes the 14th committer to Koha, with the neat C4::Context
 September 22 2002	 Koha and NPL written about in Computerworld NZ
 September 25 2002	 Koha 1.3.0 released - Mulitple MARC flavours supported
 September 27 2002	 Koha mentioned in Biblio-Tech review
 October 14 2000	 Koha 1.3.1 released
-October 16 2002	 David Strainchamps becomes 16th committer to Koha
+October 16 2002	 David Strainchamps 15th committer to Koha
 October 16 2002	 Koha 1.3.1 released
 October 23-25 2002	 NPL (Joshua Ferraro, Stephen Hedges & Owen Leonard) plus Chris Cormack at Ohio Library conference, Columbus
 October 30-31 2002	 Chris Cormack speaks at Think Linux Toledo, Chris, Joshua Ferraro and Stephen Hedges man a stand 
-November 14 2002	 Henri-Damien Laurent becomes 17th committer to Koha
+November 14 2002	 Henri-Damien Laurent becomes 16th committer to Koha
 Novemer 21 2002	 Kohausers page is started
 November ?? 2002	 Chawner, Brenda. 2002. Koha: an open source success story. http://mustafa.emeraldinsight.com/vl=12220074/cl=48/nw=1/rpsv/librarylink/technology/nov02.htm
-November 30 2002	 Francisco M. Marzoa Alonso becomes 18th committer to Koha
+November 30 2002	 Francisco M. Marzoa Alonso 17th committer to Koha
 December 2 2002	 Koha 1.3.2 released ??
 Decemeber 6 2002	 Koha mentioned in an article about opensource in American Libraries
 December 6 2002	 First known install in france ND-Dombes Abbey 
 December ?? 2002	 Koha 1.2.3 released
 December 13 2002	 Rob Weir posts links to his Windows32 packages, begins the lifelong task of preparing windows packages
-January 6 2003	 Andy?? becomes 19th committer to Koha
+January 6 2003	 Andy?? becomes 18th committer to Koha
 January 8 2003	 Koha 1.3.3 released
 January 12 2003	Benedict finishes the translation of the templates into polish	translation, polish
-January 19 2003	 Ambrose Li becomes the 20th committer to Koha
+January 19 2003	 Ambrose Li becomes the 19th committer to Koha
 February 1 2003	 Article from Pat Eyler about Koha in linux Journal
 February 4 2003	 Koha Cafepress shop opens.
 February 5 2003	 Koha 1.9.0 is released, 2.0.0 becomes much closer
 February 13 2003	 "Open source library system a welcome gift" http://computerworld.co.nz/news.nsf/news/CC256CED0016AD1ECC256CCB000D1EA7?Opendocument&HighLight=2,koha
-February 17 2003	 Mike Hansen becomes the 21st committer to Koha
+February 17 2003	 Mike Hansen becomes the 20th committer to Koha
 February ?? 2003	 Nicolas Morin tells us that Koha was mentioned in the French monthly periodical ARCHIMAG
 February 26 2003	Helena Gironès begins work on a Catalan translation	translation, catalan
 March 11 2003	 Ingrid Lacis appointed QA Manager
 March 11 2003	 Steve Tonnesen appointed Release Manager for 2.1/2.2, Paul Poulain later takes over this role
 March 28 2003	 Koha-testing mailing list set up
-April 5 2003	 Al Banks becomes the 22nd committer to Koha
+April 5 2003	 Al Banks becomes the 21st committer to Koha
 April 5 2003	 Koha 1.9.1 released
 April 11 2003	 Rob Weir updates the Koha windows packages, now a few clicks to do an install
 April 12 2003	 Koha 1.9.2 released
@@ -134,31 +134,31 @@ May 3 2003	Dorian Meid translate the opac into German	translation, german
 May 9 2003	 Ingrid resigns as QA manager
 May 6 2003	software.coop (as TTLLP) publicly offer Koha support
 May 15 2003	 Pat Eyler, Steve Tonnesen and Chris Cormack add RSS support to Koha
-May 21 2003	 MJ Ray becomes the 23rd committer to Koha
+May 21 2003	 M J Ray becomes the 22nd committer to Koha
 May 22 2003	 Paul Poulain commits new bulkmarcimport tool to Koha
 May 22 2003	 Koha 1.9.3 released
 May 26 2003	 Koha wins Trophee Du Libre Award
 June 8-23	 Rachel and Chris from Katipo go to Vienna to do Koha training for UNIDO (United Nations Industrial Development Organisation)
-June 17 2003	 Serge Renaux becomes the 24th committer to Koha
-June 20 2003	 Jerome Vizcaino becomes the 25th committer to Koha
+June 17 2003	 Serge Renaux becomes the 23rd committer to Koha
+June 20 2003	 Jerome Vizcaino becomes the 24th committer to Koha
 June 21 2003	 Paul Gear makes available rpm's of all of Koha's dependencies
-June 23 2003	 Michel Lerenard becomes the 26th committer to Koha
+June 23 2003	 Michel Lerenard becomes the 25th committer to Koha
 June 24 2003	 Koha 2.0.0pre1 released
-June 24 2003	 Joshua Ferraro becomes the 27th committer to Koha
-July 9 2003	 Pierre Cauchois becomes the 28th committer to Koha
+June 24 2003	 Joshua Ferraro becomes the 26th committer to Koha
+July 9 2003	 Pierre Cauchois becomes the 27th committer to Koha
 July 11 2003	 Koha 2.0.0pre2 released
 July 17 2003	 Students at ESIEE develop a feature to allow Koha to use LDAP to authenticate
 July 17 2003	 Ecole des mines de Paris commit to using Koha
 July 17 2003	 The University of Buffalo decide to use Koha as a teaching tool for Library and Information Studies Students
 August 1 2003	Calyx begin their first Koha installation
 August 19 2003	 NPL announces they are live with Koha
-August 26 2003	 Richard Anderson (at Katipo) becomes the 29th committer to Koha
+August 26 2003	 Richard Anderson (at Katipo) becomes the 28th committer to Koha
 September 9 2003	 Koha 2.0.0pre3 released
 September 23 2003	 Koha 2.0.0pre4 released
 October 1 2003	 Koha mentioned by Prime Minister of NZ when she was talking to the Chamber of Commerce
 October 3-5 2003	 Open communication for open source software develoment: the Koha experience. Paper read at LITA National Forum, at Norfolk, VA. http://www.ala.org/ala/lita/litaevents/litanatlforum/forumprograms/cs1-6chawner.ppt
 October 25 2003	 Koha 2.0.0pre5 released
-November 1 2003	 Owen Leonard becomes the 30th committer to Koha
+November 1 2003	 Owen Leonard becomes the 29th committer to Koha
 November 7 2003	 2 articles about Koha on webjunction New Zealand Leads the Way: the Horowhenua Open Source Story and Nelsonville Public Library: Questions and Answers About Open Source
 December 4 2003	 Koha 2.0.0rc1 released
 December 5 2003	 Paul Poulain commits a new translation tool
@@ -171,12 +171,12 @@ Jan 29 2004	 Paul Poulain announces release of 2.0.0rc3
 Feb 11 2004	 Paul Poulain announces release of 2.0.0rc4
 Feb 19 2004	 Stephen Hedges provides his migrating to Koha documentation to the community
 Mar 7 2004	 Installation guide improved and released in pdf format
-Mar 30 2004	 Baiju M provides a neat guide for migrating from CDS/ISIS to Koha document
+Mar 30 2004	 Baiju M provides a neat migrating from CDS/ISIS to Koha document
 April 1 2004	 Koha 2.0.0 released
 April 17 2004	 Nicholas S. Rosasco resurrects and updates the FAQ
 April 17 2004	 Seminar on Koha at Cairo University, Egypt
 May 13-16 2004	 Zeki Celikbas presents Koha at a linux festival in Ankara, Turkey
-May 25 2004	 doXulting becomes the 31st committer to Koha
+May 25 2004	 doXulting becomes the 30th committer to Koha
 May 29 2004	 Brooke adds the Newbie Guide to the wiki, newbies around the world rejoice
 May 31 2004	 "When profit's not the only goal" http://computerworld.co.nz/news.nsf/devt/04240726AC168409CC25723600334225?Opendocument&HighLight=2,koha
 June 3 2004	 MJ Ray (release maintainer for 2.0.x) starts experimenting with using arch for Koha version control 
@@ -188,7 +188,7 @@ June 30 2004	 Koha 2.1.0 released
 June 30 2004	 MJ Ray announces Koha 2.0.1beta2 released
 June 30 2004	 Christopher Brown-Syed emails to tell us Koha and University of Buffalo are continuin their relationship
 July 7 2004	 Paul Poulain uses some of the suggestions from University of Buffalo to improve MARC support in Koha
-August 18 2004	 Stephen Hedges becomes the 32nd committer to Koha
+August 18 2004	 Stephen Hedges becomes the 31st committer to Koha
 August 19 2004	 Koha 2.1.1 released
 August 26 2004	 Katipo installing Koha at Lianza conference (as well as presenting) http://www.katipo.co.nz/about-us/news/nr1092719045.shtml
 September 1 2004	Martín Longo starts work on translating Koha to spanish	translation, spanish
@@ -200,7 +200,7 @@ October 20 2004	 Koha 2.1.3 released
 October 29 2004	 Koha 2.0.2beta released
 October 29 2004	Gerry Arthus starts work on a Turkish translation	translation, turkish
 November 17 2004	 Koha 2.2.0rc1 released
-November 17 2004	 MJ Ray releases Koha 2.0.2
+November 17 2004	 M J Ray releases Koha 2.0.2
 November 20 2004	 Koha 2.2.0rc2 released
 November 23 2004	 Koha 2.2.0rc3 released
 December 9 2004	 Koha 2.2.0rc4 released
@@ -217,7 +217,7 @@ March 10 2005	Matti Lassila writes to say work is continuing on a Finnish transl
 April 7 2005	Lars ?? translates the MARC21 labels to swedish	translation, swedish
 April 8 2005	 Koha 2.2.2 released
 April 13 2005	 Liblime announce they are providing Koha support
-April 19 2005	 Shaun Evans becomes the 33rd committer to Koha
+April 19 2005	 Shaun Evans becomes the 32nd committer to Koha
 April 24 2005	 Set Parameters and Migrate Your Data to Koha 2.2, English translation of Paul Poulain's Paramétrer et migrer, by Regula Sebastiao. On kohadocs.org
 April 26 2005	 Koha 2.2.2b released
 May 2 2005	 Koha translated to Swedish	translation,sweden
@@ -233,10 +233,10 @@ May 25 2005	 #koha-fr channel started on irc						       community, french
 May 25 2005	 Chris Cormack commits some Plucene scripts in cvs Head and Joshua Ferraro does some testing	  search, fulltext
 May 26 2005	 Koha webdesign IRC meeting website
 May 31 2005	 Bugsquashing session
-June 2 2005	 Waylon Robertson becomes the 34th committer to Koha
-June 3 2005	 Gavin ?? becomes the 35th committer to Koha
+June 2 2005	 Waylon Robertson becomes the 33rd committer to Koha
+June 3 2005	 Gavin ?? becomes the 34th committer to Koha
 June 3 2005	 Joshua Ferraro and Chris Cormack discuss trying out Koha for fulltext search on irc	searching, fulltext
-June 3 2005	 Friedrich zur Hellen becomes the 36th committer to Koha
+June 3 2005	 Friedrich zur Hellen becomes the 35th committer to Koha
 June 5 2005	 Joshua experiments with Zebra, finds very positive and encouraging results	searching, fulltext
 June 11 2005	MJ Ray presents Koha to the British & Irish Association of Law Librarians 36th Annual Study Conference and Exhibition
 June 13 2005 	 Catalogue KOHA : mode d’emploi (in French) by the Bibliothèque de sociologie du CNRS, Paris is published on www.kohadocs.org
@@ -253,7 +253,7 @@ July 12 2005	 MJ Ray sets up Planet Koha, gathering all Koha blogs on one page
 July 13 2005	 hatem ibraheem writes to say that MSA university (Modern Sience and Arts university) http://www.msa.eun.eg/library.htm using Koha	community, library, Egypt
 August 13 2005	 "Koha Coding Standards and Guidelines for Contributors." on http://www.kohadocs.org  documentation
 August 18 2005	 An expanded version of the first chapter of the Koha Users Guide is now available at http://www.kohadocs.org/usersguide.	documentation
-August 19 2005	 Mason James (at Katipo) becomes the 37th committer to Koha
+August 19 2005	 Mason James (at Katipo) becomes the 36th committer to Koha
 August 23 2005	 A new document is available on http://www.kohadocs.org -- "MARC Holdings, Koha, and Migration" by Thomas Dukleth.  Look for it in section 2.2, "Migration."	documentation
 August 26 2005	 A new link to a document has been added to http://www.kohadocs.org -- "Gestion de la bibliothèque du LabSAD avec le logiciel Koha" by Caroline Naget (available in pdf format only).  This document is in the General Information section because it covers several aspects of Koha: installing on Gentoo Linux, setting parameters, and use.
 September 8 2005	New website softlaunched
@@ -269,7 +269,7 @@ November 6 2005	 The French-language Koha users guide, "Manuel d’utilisation d
 November 8 2005	 Koha cvs moved to savannah from sourceforge, mailing lists follow
 November 14 2005	Anthony Youngman suggests using git
 November 27 2005	A new version of the Koha 2.2 Users Guide is now available on www.kohadocs.org (in the General Information section)
-December 13 2005	Thomas Dukleth becomes the 38th committer to Koha
+December 13 2005	Thomas Dukleth becomes the 37th committer to Koha
 January 10 2006	 Koha version 2.2.5 is released
 January 13 2006	 Henri Damien Laurent announces new French Koha website
 January 17 2006	 New material has been added to the Koha Users Guide to bring it up to date with version 2.2.5.  There is also new material on acquiring MARC records (Z39.50 and file imports) and templating.  View the Users Guide at http://www.kohadocs.org/usersguide/
@@ -282,27 +282,27 @@ January 27 2006	  the first Chinese (Traditional) document on http://www.kohadoc
 February 4 2006	Joshua Ferraro commits first cut of Amazon content integration with Koha
 February 6 2006	IRC meeting
 February 11 2006	 Article in computerworld about Koha http://computerworld.co.nz/news.nsf/news/3F65C01EAB666AC6CC25710F00805997?Opendocument&HighLight=2,koha
-February 23 2006	 Robert Lyon (working at Katipo) becomes the 39th committer to Koha
+February 23 2006	 Robert Lyon (working at Katipo) becomes the 38th committer to Koha
 February 24 2006	Tümer Garip writes inventory management tool
 February 27 2006	 "Fear and loathing: is open source a developer's dream or business nightmare?" http://computerworld.co.nz/news.nsf/spec/68C09CE2C8B8A483CC25711F001161D9?Opendocument&HighLight=2,koha
 March 3 2006	Paul Poulain commits the holiday management code written by Tümer Garip
 March 6 2006	First email to the devel list from Pierrick Le Gall from INEO
 March 6 2006	IRC meeting
-March 7 2006	Pierrick Le Gall becomes the 40th committer to Koha
+March 7 2006	Pierrick Le Gall becomes the 39th committer to Koha
 March 13 2006	IRC meeting
 March 17 2006	First email from Kyle Hall at ccfls to the Mailing list
 March 24 2006	Joshua Ferraro has revised his document about installing Koha on Debian to accommodate Koha version 2.2.6 and Debian sarge (3.1).  Find it on www.kohadocs.org under "System Administration."	documentation
 April 3	2006	Developer meeting on IRC
-April 11 2006	 Tümer Garip becomes the 41st committer to Koha (major influence in the addition of zebra to Koha and other)
+April 11 2006	 Tümer Garip becomes the 40th committer to Koha (major influence in the addition of zebra to Koha and other)
 April 14 2006	Pierrick Le Gall begins as translation manager
 May 2,3 2006	 Kohacon in Paris http://www.koha.org/community/conferences/
-May 12 2006	 Bruno Toumi (from San Ouest Provence) becomes the 42nd committer to Koha
+May 12 2006	 Bruno Tuomi (from San Ouest Provence) becomes the 41st committer to Koha
 May 12-18 2006	 Developers week at Bibliotheque du Centre de Mathematiques et Informatique (CMI) at the Universite de Provence, in Marseille
-May 19 2006	 Arnaud Laurin (also from SAN-OP) becomes the 43rd committer to Koha
+May 19 2006	 Arnaud Laurin (also from SAN-OP) becomes the 42nd committer to Koha
 May 31 2006	First email from Mike Hafen to the devel list
 June 1 2006	Antoine Farnault hired by Paul Poulain and Henri Damien Laurent to work on Koha
 June 5 2006	IRC meeting
-July 5 2006	Antoine Farnault becomes the 44th committer to Koha
+July 5 2006	Antoine Farnault becomes the 43rd committer to Koha
 July 12 2006	Koha 2.3.0 released	release
 July 18 2006	Katipo starts a dedicated Koha team.
 July 18 2006	Paolo Pozzan starts translating koha to Italian	translation, italian
@@ -322,10 +322,10 @@ January 11 2007	Tag cloud and new browsing feature added to Koha
 January 17 2007	 contribs.koha.org goes live, Thanks to Pierrick Le Gall for the extensions manager. 
 February 15 2007	 Frédéric Demians from Tamil announces plan to offer support services around Koha
 March 8 2007	 Koha 2.2.8 released
-March 10 2007	 Ryan Higgins (of Liblime) becomes the 45th committer to Koha
+March 10 2007	 Ryan Higgins (of Liblime) becomes the 44th committer to Koha
 March 12 2007	 "Software development benefits from open source" http://computerworld.co.nz/news.nsf/devt/2B9B1FE8678CC680CC257299000A233F?Opendocument&HighLight=2,koha
 March 17 2007	 Liblime accepted to google summer of code, call out to the mailing list for project ideas
-March 28 2007	 H. Passini becomes the 46th committer to Koha
+March 28 2007	 Passini becomes the 45th committer to Koha
 March 31 2007	 Katipo sells Koha division to Liblime http://katipo.co.nz/about-us/news/nr1175402768.shtml
 April 1 2007	 Russel Garlick, Chris Cormack and Mason James start at Liblime
 April 10 2007	Agnes Imecs begins work on a Hungarian translation of Koha	translation, hungarian
@@ -339,46 +339,47 @@ June 25 2007	 Second Koha day http://blog.bigballofwax.co.nz/2007/06/25/koha-pro
 June 25 2007	Beda Szukics announces updates to the german translations	translation, german
 July 3 2007	 Koha day http://lists.katipo.co.nz/public/koha/2007-July/012026.html
 July 28 2007	 Koha day http://blog.bigballofwax.co.nz/2007/07/28/koha-project-day-3/
-September 14 2007	 Russel Garlick becomes the 47th committer to Koha
+September 14 2007	 Russel Garlick becomes the 46th committer to Koha
 September 24 2007	 Chris Hammond-Trashor emails to tell the community that Koha has gone live in Samoa. http://www.nelsonlibrary.ws/
 October 2 2007	 "Pharmac publishes directly with open source" http://computerworld.co.nz/news.nsf/news/25F72F231ABF8F5ACC2573630083A579?Opendocument&HighLight=2,koha
-October 3 2007	 Joe Atzberger becomes the 48th committer to Koha
-October 3 2007	 Chris Catalfo becomes the 49th committer to Koha
+October 3 2007	 Joe Atzberger becomes the 47th committer to Koha
+October 3 2007	 Chris Catalfo becomes the 48th committer to Koha
 October 4 2007	 Biblibre formed
-October 10 2007	 Frédéric Demians becomes the 50th committer to Koha
+October 10 2007	 Frederic Demians becomes the 49th committer to Koha
 October 12 2007	Axel Bojer working on Norwegian translation	translation, norwegian
-October 17 2007	 Galen Charlton becomes the 51st committer to Koha
+October 17 2007	 Galen Charlton becomes the 50th committer to Koha
 October 18 2007	 Chris Cormack wins Open Source contributor of the year at the NZ Open Source awards. Koha was a finalist for project of the year http://lists.katipo.co.nz/public/koha/2007-October/012579.html
 October 30 2007	 "Open source is a viable option, says the SSC" http://computerworld.co.nz/news.nsf/news/30E7D1CD947D73ABCC25737F00834E88?Opendocument&HighLight=2,koha
-November 6 2007	Chris Nighswonger becomes the 52nd committer to Koha	developer
-December 21 2007	 Daniel Banzli becomes the 53rd committer to Koha	developer
+November 6 2007	Chris Nighswonger becomes the 51st committer to Koha	developer
+December 21 2007	 Daniel Banzli becomes the 52nd committer to Koha	developer
 January 5 2008	 Koha 3.0.0 Alpha is released	release
 January 28 2008	Anousak Souphavanh working on a Lao translation of Koha	translation, lao
-February 23 2008	 Jesse Weaver becomes the 54th committer to Koha	developer
+February 23 2008	 Jesse Weaver becomes the 53rd committer to Koha	developer
 March 3 2008	 Russel Garlick, Chris Cormack and Mason James leave Liblime Liblime NZ closed
 March 11 2008	Kurt Debrouwer working on a Dutch translation	translation, dutch
 March 12 2009	Vladimir Mircevski working on a Serbian translation	translation, serbian
-March 19 2008	 Andrew Moore becomes the 55th committer to Koha	developer
+March 19 2008	 Andrew Moore becomes the 54th committer to Koha	developer
 March 23 2008	 Koha 3.0.0 Beta is released
-April 2 2008	 Darrell Ulm becomes the 56th committer to Koha	developer
+April 2 2008	 Darrell Ulm becomes the 55th committer to Koha	developer
 April 5 2008	 Koha 3.0.0 Beta 2 is released
 April 7 2008	 Bug 2000 registered at bugs.koha.org
 April 13 2008	 Voting opens for new Koha website theme
-April 24 2008	 Marc Chantreux becomes the 57th committer to Koha	developer
+April 24 2008	 Marc Chantreux becomes the 56th committer to Koha	developer
 April 24 2008	Marijana Glavica working on a Croatian translation	translation, croatian
-April 25 2008	 Frère Sébastien Marie becomes the 58th committer to Koha	developer
+April 25 2008	 Frère Sébastien Marie becomes the 57th committer to Koha	developer
 April 26 2008	 Polytechnic University Koha Installation becomes the 58th committer to Koha	developer
-May 6 2008	 Nicole Engard becomes the 60th committer to Koha	developer
-May 18 2008	 Koha production??? becomes the 61st committer to Koha	developer
-May 28 2008	 Michael Hafen becomes the 62nd committer to Koha	developer
-June 17 2008	 Daniel Kahn Gillmor becomes the 63rd committer to Koha	developer
-June 21 2008	 Ricardo Dias Marques becomes the 64th committer to Koha	developer
+May 6 2008	 NCE becomes the 59th committer to Koha	developer
+May 18 2008	 Koha production??? becomes the 60th committer to Koha	developer
+May 28 2008	 Michael Hafen becomes the 61st committer to Koha	developer
+June 17 2008	 Daniel Kahn Gillmor becomes the 62nd committer to Koha	developer
+June 21 2008	 Ricardo Dias Marques becomes the 63rd committer to Koha	developer
 June 24 2008	 String freeze for Koha 3.0.0 announced
 June 24 2008	 Koha 3.0.0 rc1 released
 July 2008	Nicole Engard releases the Koha 3.0.0 manual on Google Sites
-July 1 2008	 Philippe Jaillon becomes the 65th committer to Koha	developer
-July 4 2008	 DeAndre Carroll becomes the 66th committer to Koha	developer
+July 1 2008	 Philippe Jaillon becomes the 64th committer to Koha	developer
+July 4 2008	 DeAndre Carroll becomes the 65th committer to Koha	developer
 July 8 2008	 Draft manual for koha 3.0.0 made available
+July 11 2008	 Nicole Engard becomes the 66th committer to Koha	developer
 July 28 2008	 "Enterprise doors open for open source" http://computerworld.co.nz/news.nsf/spec/446B512F34E476C0CC25749000796965?Opendocument&HighLight=2,koha
 August 2 2008	 Danny Bouman becomes the 67th committer to Koha	developer
 August 8 2008	 Southeastern University becomes the 68th committer to Koha	developer
@@ -457,7 +458,7 @@ December 2 2009 General meeting http://wiki.koha-community.org/wiki/General_IRC_
 December 3 2009	Foundation meeting http://wiki.koha-community.org/wiki/Foundation_Forming_IRC_Meeting,_3_December_2009
 December 9 2009	Piotr Wejman becomes the 98th committer to have a patch accepted	developer
 December 19 2009	Koha 3.0.5 released	releases
-December 20 2009 Ian Walls (NYUHSL) becomes the 99th committer to have a patch accepted	developer
+December 20 2009 NYUHSL becomes the 99th committer to have a patch accepted	developer
 December 23 2009	Sharon Moreland becomes the 100th committer to have a patch accepted (sent via Liz Rea)	developer
 December 23 2009	Nicolas Morin becomes the 101st committed to have a patch accepted	developer
 January 13 2010	IRC General Meeting http://wiki.koha-community.org/wiki/General_IRC_Meeting,_13_January_2010
@@ -541,13 +542,4 @@ April 8 2011	Mark Gavillet becomes the  139th developer to have a patch pushed
 April 9 2011	Frederic Durand becomes the 140th developer to have a patch pushed
 April 9 2011	Jonathan Druart becomes the 141st developer to have a patch pushed
 April 16 2011	Koha 3.2.7 released	releases
-April 20 2011   Fernando Canizo becomes the 142nd developer to have a patch pushed
 April 22 2011	Koha 3.4.0 released	releases
-May 15 2011	Koha 3.2.8 released	releases
-May 15 2011	Koha 3.2.9 released	releases
-May 22 2011	Koha 3.4.1 released	releases
-June 1 2011	Fridolyn Somers becomes the 143rd developer to have a patch pushed
-June 3 2011	Elliott Davis becomes the 144th developer to have a patch pushed
-June 15 2011	First ever global sign off day
-June 17 2011	Jeremy Crabtree becomes the 145th developer to have a patch pushed
-July 5 2011 Francois Marier becomes the 146th developer to have a patch pushed
diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml
index 686a15b..819cc55 100644
--- a/etc/koha-conf.xml
+++ b/etc/koha-conf.xml
@@ -11,13 +11,8 @@
 <listen id="biblioserver" >tcp:localhost:9998/bibliosocket</listen>
 <listen id="authorityserver" >tcp:localhost:9999/authoritysocket</listen>
 -->
-
-<!-- Uncomment the following entry if you want to run the public Z39.50 server.
-    Also uncomment the <server> and <serverinfo> sections for id 'publicserver' 
-    under PUBLICSERVER'S BIBLIOGRAPHIC RECORDS title-->
-<!--
-<listen id="publicserver" >tcp:@:__ZEBRA_SRU_BIBLIOS_PORT__</listen>
--->
+<!-- public server runs on tcp -->
+<!-- <listen id="publicserver" >tcp:@:9999</listen> -->
 
 <!-- Settings for special biblio server instance for PazPar2.
      Because PazPar2 only connects to a Z39.50 server using TCP/IP,
@@ -178,80 +173,6 @@ __PAZPAR2_TOGGLE_XML_POST__
     <password>__ZEBRA_PASS__</password>
 </serverinfo>
 
-<!-- PUBLICSERVER'S BIBLIOGRAPHIC RECORDS -->
-<!--
-<server id="publicserver"  listenref="publicserver"> 
-    <directory>__ZEBRA_DATA_DIR__/biblios</directory>
-    <config>__ZEBRA_CONF_DIR__/zebra-biblios.cfg</config>
-    <cql2rpn>__ZEBRA_CONF_DIR__/pqf.properties</cql2rpn>
-     <retrievalinfo>
-       <retrieval syntax="usmarc" name="F"/>
-       <retrieval syntax="usmarc" name="B"/>
-       <retrieval syntax="xml" name="F"/>
-       <retrieval syntax="xml" name="B"/>
-       <retrieval syntax="xml" name="marcxml"
-                  identifier="info:srw/schema/1/marcxml-v1.1">
-         <backend syntax="usmarc" name="F">
-           <marc inputformat="marc" outputformat="marcxml"
-                 inputcharset="utf-8"/>
-         </backend>
-       </retrieval>
-       <retrieval syntax="xml" name="dc">
-         <backend syntax="usmarc" name="F">
-           <marc inputformat="marc" outputformat="marcxml"
-                 inputcharset="utf-8"/>
-           <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2DC.xsl"/>
-         </backend>
-       </retrieval>
-       <retrieval syntax="xml" name="mods">
-         <backend syntax="usmarc" name="F">
-           <marc inputformat="marc" outputformat="marcxml"
-                 inputcharset="utf-8"/>
-           <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2MODS.xsl"/>
-         </backend>
-       </retrieval>
-       <retrieval syntax="xml" name="rdfdc">
-         <backend syntax="usmarc" name="F">
-           <marc inputformat="marc" outputformat="marcxml"
-                 inputcharset="utf-8"/>
-           <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2RDFDC.xsl"/>
-         </backend>
-       </retrieval>
-       <retrieval syntax="xml" name="rss2">
-         <backend syntax="usmarc" name="F">
-           <marc inputformat="marc" outputformat="marcxml"
-                 inputcharset="utf-8"/>
-           <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slim2RSS2.xsl"/>
-         </backend>
-       </retrieval>
-       <retrieval syntax="xml" name="utils">
-         <backend syntax="usmarc" name="F">
-           <marc inputformat="marc" outputformat="marcxml"
-                 inputcharset="utf-8"/>
-           <xslt stylesheet="__INTRANET_TMPL_DIR__/prog/en/xslt/MARC21slimUtils.xsl"/>
-         </backend>
-       </retrieval>
-     </retrievalinfo>
-    <xi:include href="__KOHA_CONF_DIR__/zebradb/explain-biblios.xml"
-                xmlns:xi="http://www.w3.org/2001/XInclude">
-      <xi:fallback>
-      <explain xmlns="http://explain.z3950.org/dtd/2.0/">
-          <serverInfo>
-            <host>__ZEBRA_SRU_HOST__</host>
-            <port>__ZEBRA_SRU_BIBLIOS_PORT__</port>
-            <database>biblios</database>
-          </serverInfo>
-        </explain>
-      </xi:fallback>
-    </xi:include>
-</server>
-<serverinfo id="publicserver">
-        <ccl2rpn>__ZEBRA_CONF_DIR__/ccl.properties</ccl2rpn>
-        <user>__ZEBRA_USER__</user>    
-        <password>__ZEBRA_PASS__</password>
-</serverinfo>
--->
-
 <!-- ADDITIONAL KOHA CONFIGURATION DIRECTIVE -->
 <!-- db_scheme should follow the DBD driver name --> 
 <!-- port info: mysql:3306 Pg:5432 (5433 on Debian) -->
diff --git a/etc/zebradb/biblios/etc/bib1.att b/etc/zebradb/biblios/etc/bib1.att
index c156fb4..ed68092 100644
--- a/etc/zebradb/biblios/etc/bib1.att
+++ b/etc/zebradb/biblios/etc/bib1.att
@@ -107,7 +107,6 @@ att 1036    Author-Title-Subject
 att 1045    Record-control-number
 att 1062    stocknumber
 att 1079    Subject-topical
-att 1096    Title-later
 
 
 # Koha Local-Use Biblio Indexes
diff --git a/etc/zebradb/marc_defs/marc21/biblios/record.abs b/etc/zebradb/marc_defs/marc21/biblios/record.abs
index 7a67d68..6826d4a 100755
--- a/etc/zebradb/marc_defs/marc21/biblios/record.abs
+++ b/etc/zebradb/marc_defs/marc21/biblios/record.abs
@@ -89,21 +89,21 @@ melm 086        Number-govt-pub
 
 melm 100$9      Cross-Reference:w,Koha-Auth-Number
 melm 100$a      Author,Author:p,Author:s,Editor,Author-personal-bibliography,Author-personal-bibliography:p,Author-personal-bibliography:s
-melm 100        Author,Author:p,Author:s,Author-title,Author-name-personal,Name,Name-and-title,Personal-name
+melm 100        Author,Author-title,Author-name-personal,Name,Name-and-title,Personal-name
 melm 110$9      Koha-Auth-Number
-melm 110        Author,Author:p,Author:s,Author-title,Author-name-corporate,Name,Name-and-title,Corporate-name
+melm 110        Author,Author-title,Author-name-corporate,Name,Name-and-title,Corporate-name
 melm 111$9      Koha-Auth-Number
-melm 111        Author,Author:p,Author:s,Author-title,Author-name-corporate,Name,Name-and-title,Conference-name
+melm 111        Author,Author-title,Author-name-corporate,Name,Name-and-title,Conference-name
 melm 130$n      Thematic-number
 melm 130$r      Music-key
 melm 130$9      Koha-Auth-Number
-melm 130        Title,Title:p,Title-uniform
+melm 130        Title,Title-uniform
 
-melm 210        Title,Title:p,Title-abbreviated
-melm 211        Title,Title:p,Title-abbreviated
-melm 212        Title,Title:p,Title-other-variant
-melm 214        Title,Title:p,Title-expanded
-melm 222        Title,Title:p,Title-key
+melm 210        Title,Title-abbreviated
+melm 211        Title,Title-abbreviated
+melm 212        Title,Title-other-variant
+melm 214        Title,Title-expanded
+melm 222        Title,Title-key
 melm 240$r      Music-key
 melm 240$n      Thematic-number
 melm 240        Title:w,Title:p,Title-uniform
@@ -157,21 +157,21 @@ melm 526$d      arp,arp:n
 #melm 541$d     Date-of-acquisition,Date-of-acquisition:s
 melm 590        Note:w,Note:p
 
-melm 600$a      Name-and-title,Name,Personal-name,Subject-name-personal,Subject,Subject:p
-melm 600$t      Name-and-title,Title,Subject,Subject:p
+melm 600$a      Name-and-title,Name,Personal-name,Subject-name-personal,Subject
+melm 600$t      Name-and-title,Title,Subject
 melm 600$9      Koha-Auth-Number
 #melm 600       Name,Personal-name,Subject-heading,Subject-name-personal
 melm 600        Name,Personal-name,Subject-name-personal,Subject,Subject:p
-melm 610$a      Name-and-title,Subject,Subject:p
-melm 610$t      Name-and-title,Title,Subject,Subject:p
+melm 610$a      Name-and-title
+melm 610$t      Name-and-title,Title
 melm 610$9      Koha-Auth-Number
 melm 610        Name,Subject,Subject:p,Corporate-name
-melm 611$a      Name-and-title,Subject,Subject:p
-melm 611$t      Name-and-title,Title,Subject,Subject:p
+melm 611$a      Name-and-title
+melm 611$t      Name-and-title,Title
 melm 611$9      Koha-Auth-Number
 melm 611        Conference-name,Name,Subject,Subject:p
-melm 630$n      Thematic-number,Subject:Subject:p
-melm 630$r      Music-key,Subject,Subject:p
+melm 630$n      Thematic-number
+melm 630$r      Music-key
 melm 630$9      Koha-Auth-Number
 melm 630        Subject,Subject:p
 melm 650$9      Koha-Auth-Number    
@@ -190,10 +190,9 @@ melm 656$9      Koha-Auth-Number
 melm 656        Subject,Subject:p
 melm 657$9      Koha-Auth-Number    
 melm 657        Subject,Subject:p
-melm 658$a	curriculum:w,curriculum:p,Subject,Subject:p
-melm 658$b	curriculum:w,curriculum:p,Subject,Subject:p
-melm 658$c	curriculum:w,curriculum:p,Subject,Subject:p
-melm 658        Subject,Subject:p
+melm 658$a	curriculum:w,curriculum:p
+melm 658$b	curriculum:w,curriculum:p
+melm 658$c	curriculum:w,curriculum:p
 melm 690$9      Koha-Auth-Number    
 melm 690        Subject,Subject:p
 
@@ -203,24 +202,24 @@ melm 700$n      Thematic-number
 melm 700$r      Music-key
 #melm 700$t     author,Author-title,Name-and-title,Title,Title-uniform
 melm 700$t      Author-title,Name-and-title,Title,Title-uniform
-melm 700        Author,Author:p,Author-name-personal,Name,Editor,Personal-name
+melm 700        Author,Author-name-corporate,Author-name-personal,Name,Editor,Personal-name
 #melm 710$t     author,Author-title,Name-and-title,Title,Title-uniform
 melm 710$t      Author-title,Name-and-title,Title,Title-uniform
 #melm 710$a     author,author:p,Name-and-title
 melm 710$a      Name-and-title
 melm 710$9      Koha-Auth-Number    
-melm 710        Author,Author:p,Corporate-name,Name
+melm 710        Author,Corporate-name,Name
 melm 711$a      Name-and-title
 #melm 711$t     author,Author-title,Title,Title-uniform
 melm 711$t      Author-title,Title,Title-uniform
 melm 711$9      Koha-Auth-Number    
 #melm 711       author,Author-name-corporate,Name,Conference-name
-melm 711        Author,Author:p,Author-name-corporate,Name,Conference-name
+melm 711        Author-name-corporate,Name,Conference-name
 melm 730$n      Thematic-number
 melm 730$r      Music-key
 melm 730$9      Koha-Auth-Number
-melm 730        Title,Title:p,Title-uniform
-melm 740        Title,Title:p,Title-other-variant
+melm 730        Title,Title-uniform
+melm 740        Title,Title-other-variant
 melm 751$a      Name-geographic
 melm 751$9      Koha-Auth-Number
 melm 751        Name-geographic
@@ -235,9 +234,9 @@ melm 776$w      Record-control-number
 melm 777$w      Record-control-number
 melm 780$t      Title
 melm 780$w      Record-control-number
-melm 780        Title,Title:p,Title-former,Related-periodical
+melm 780        Title,Title-former,Related-periodical
 melm 785$w      Record-control-number
-melm 785        Title,Title:p,Title-later,Related-periodical
+melm 785        Related-periodical
 melm 787$w      Record-control-number
 
 melm 800$a      Name-and-title
diff --git a/help.pl b/help.pl
index 58354b0..f871e3c 100755
--- a/help.pl
+++ b/help.pl
@@ -18,9 +18,9 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
+use HTML::Template::Pro;
 use warnings;
-use C4::Templates;
-use C4::Output;
+use C4::Output;    # contains gettemplate
 # use C4::Auth;
 use C4::Context;
 use CGI;
@@ -30,16 +30,49 @@ my $query = new CGI;
 # find the script that called the online help using the CGI referer()
 our $refer = $query->referer();
 
-$refer =~ /koha\/(.*)\.pl/;
-my $from = "modules/help/$1.tt";
-
-my $htdocs = C4::Context->config('intrahtdocs');
-my ( $theme, $lang ) = themelanguage( $htdocs, $from, "intranet", $query );
-unless ( -e "$htdocs/$theme/$lang/$from" ) {
-    $from = "modules/help/nohelp.tt";
-    ( $theme, $lang ) = themelanguage( $htdocs, $from, "intranet", $query );
+# workaround for popup not functioning correctly in IE
+my $referurl = $query->param('url');
+if ($referurl) {
+    $refer = $query->param('url');
 }
-my $template = C4::Templates->new('intranet', "$htdocs/$theme/$lang/$from");
 
+$refer =~ /.*koha\/(.*)\.pl.*/;
+my $from = "modules/help/$1.tmpl";
+
+my $template = gethelptemplate( $from, "intranet" );
+
+# my $template
 output_html_with_http_headers $query, "", $template->output;
 
+sub gethelptemplate {
+    my ($tmplbase) = @_;
+
+    my $htdocs;
+    $htdocs = C4::Context->config('intrahtdocs');
+    my ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, "intranet", $query );
+    unless ( -e "$htdocs/$theme/$lang/$tmplbase" ) {
+        $tmplbase = "modules/help/nohelp.tmpl";
+        ( $theme, $lang ) = themelanguage( $htdocs, $tmplbase, "intranet", $query );
+    }
+    my $template = HTML::Template::Pro->new(
+        filename          => "$htdocs/$theme/$lang/$tmplbase",
+        die_on_bad_params => 0,
+        global_vars       => 1,
+        path              => ["$htdocs/$theme/$lang/includes"]
+    );
+
+    # XXX temporary patch for Bug 182 for themelang
+    $template->param(
+        themelang => '/intranet-tmpl' . "/$theme/$lang",
+        interface => '/intranet-tmpl',
+        theme     => $theme,
+        lang      => $lang,
+        intranetcolorstylesheet =>
+          C4::Context->preference("intranetcolorstylesheet"),
+        intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+        IntranetNav        => C4::Context->preference("IntranetNav"),
+		yuipath => (C4::Context->preference("yuipath") eq "local"?"/intranet-tmpl/$theme/$lang/lib/yui":C4::Context->preference("yuipath")),
+        referer            => $refer,
+    );
+    return $template;
+}
diff --git a/installer/data/mysql/de-DE/mandatory/sysprefs.sql b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
index 6eb67a3..c7c885d 100755
--- a/installer/data/mysql/de-DE/mandatory/sysprefs.sql
+++ b/installer/data/mysql/de-DE/mandatory/sysprefs.sql
@@ -99,7 +99,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog',1,'If ON, enables the circulation (returns) log',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson',1,'If ON, enables patron reviews of bibliographic records in the OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC','','YesNo');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SpecifyDueDate',1,'Define whether to display \"Specify Due Date\" form in Circulation','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionHistory','simplified','Define the display preference for serials issue history in OPAC','simplified|full','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionLog',1,'If ON, enables subscriptions log',NULL,'YesNo');
@@ -312,5 +311,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems' ,'','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O    pacHiddenItems.txt for more informations.','','Textarea');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
\ No newline at end of file
diff --git a/installer/data/mysql/de-DE/optional/sample_creator_data.sql b/installer/data/mysql/de-DE/optional/sample_creator_data.sql
index 91d7d00..bcd610a 100644
--- a/installer/data/mysql/de-DE/optional/sample_creator_data.sql
+++ b/installer/data/mysql/de-DE/optional/sample_creator_data.sql
@@ -3,7 +3,7 @@
 
 LOCK TABLES `creator_layouts` WRITE;
 /*!40000 ALTER TABLE `creator_layouts` DISABLE KEYS */;
-INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
+INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
   <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63">
     <data_source image_name="none" image_source="patronimages" />
   </images>
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 0abf9d8..f98b053 100755
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -100,7 +100,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog',1,'If ON, enables the circulation (returns) log',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson',1,'If ON, enables patron reviews of bibliographic records in the OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC','','YesNo');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SpecifyDueDate',1,'Define whether to display \"Specify Due Date\" form in Circulation','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionHistory','simplified','Define the display preference for serials issue history in OPAC','simplified|full','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionLog',1,'If ON, enables subscriptions log',NULL,'YesNo');
@@ -313,4 +312,3 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
diff --git a/installer/data/mysql/en/optional/sample_creator_data.sql b/installer/data/mysql/en/optional/sample_creator_data.sql
index 91d7d00..bcd610a 100644
--- a/installer/data/mysql/en/optional/sample_creator_data.sql
+++ b/installer/data/mysql/en/optional/sample_creator_data.sql
@@ -3,7 +3,7 @@
 
 LOCK TABLES `creator_layouts` WRITE;
 /*!40000 ALTER TABLE `creator_layouts` DISABLE KEYS */;
-INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
+INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
   <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63">
     <data_source image_name="none" image_source="patronimages" />
   </images>
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index 59a258f..185c74b 100755
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -112,7 +112,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog', '0', 'Activer ce paramètre pour enregistrer les actions sur la circulation (les retours)', '', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson', '1', 'Active ou non les commentaires sur notice à l''OPAC', '', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC','','YesNo');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SessionStorage', 'mysql', 'Utiliser mySQL ou un fichier temporaire pour stocker les informations de session. mySQL pose problème dans certains cas en France. Si vous avez des problèmes de perte d''identifiant, choisissez tmp', 'mysql|tmp', 'Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionHistory', 'simplified', 'Ce paramètre définit la vue par défaut de l''état de collection, pour les abonnements. Habituellement, c''est "simplified". Choisissez "full" pour avoir l''état de collection complet par défaut', 'simplified|full', 'Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionLog', '0', 'Activer ce paramètre pour enregistrer les actions sur le bulletinage', '', 'YesNo');
@@ -313,5 +312,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
\ No newline at end of file
diff --git a/installer/data/mysql/it-IT/necessari/sample_notices_message_attributes.sql b/installer/data/mysql/it-IT/necessari/sample_notices_message_attributes.sql
index 63d07fd..231af9c 100644
--- a/installer/data/mysql/it-IT/necessari/sample_notices_message_attributes.sql
+++ b/installer/data/mysql/it-IT/necessari/sample_notices_message_attributes.sql
@@ -3,9 +3,10 @@ SET FOREIGN_KEY_CHECKS=0;
 insert into `message_attributes`
 (`message_attribute_id`, message_name, `takes_days`)
 values
-(1, 'Item_Due', 0),
-(2, 'Advance_Notice', 1),
-(4, 'Hold_Filled', 0),
-(5, 'Item_Check_in', 0),
-(6, 'Item_Checkout', 0);
+(1, 'Item DUE', 0),
+(2, 'Advance Notice', 1),
+(4, 'Hold Filled', 0),
+(5, 'Item Check-in', 0),
+(6, 'Item Checkout', 0);
+
 SET FOREIGN_KEY_CHECKS=1;
diff --git a/installer/data/mysql/it-IT/necessari/sysprefs.sql b/installer/data/mysql/it-IT/necessari/sysprefs.sql
index dcdf0ee..fca0cfb 100755
--- a/installer/data/mysql/it-IT/necessari/sysprefs.sql
+++ b/installer/data/mysql/it-IT/necessari/sysprefs.sql
@@ -168,7 +168,6 @@ insert into `systempreferences` (`variable`, `value`, `options`, `explanation`,
 insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('ReturnLog','1','','Se su ON, abilita i log delle restituzioni dal prestito.','YesNo');
 insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('reviewson','1','','Se ON, abilita la possibilità per gli utenti a inserire recensioni di record bibliografici nell\'OPAC.','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC','','YesNo');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC','','YesNo');
 insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('RoutingSerials','1','','Se ON, il serial routing è attivato.','YesNo');
 insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('SearchMyLibraryFirst','0','','Se ON, le ricerche in OPAC restituiranno risultati limitatamente alla biblioteca impostata di default dell’utente  se questi si è loggato.','YesNo');
 insert into `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) values('SessionStorage','mysql','mysql|Pg|tmp','Per usare un database o un file temporaneo per l\'archiviazione dei dati della sessione.','Choice');
@@ -300,4 +299,3 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O    pacHiddenItems.txt for more informations.','','Textarea');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql
index ca71769..b1c6fb5 100644
--- a/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql
+++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sysprefs.sql
@@ -118,7 +118,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnBeforeExpiry',0,'If ON, checkout will be prevented if returndate is after patron card expiry',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog',1,'If ON, enables the circulation (returns) log',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson',1,'If ON, enables patron reviews of bibliographic records in the OPAC','','YesNo');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SpecifyDueDate',1,'Define whether to display \"Specify Due Date\" form in Circulation','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionHistory','simplified','Define the display preference for serials issue history in OPAC','simplified|full','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionLog',1,'If ON, enables subscriptions log',NULL,'YesNo');
diff --git a/installer/data/mysql/nb-NO/2-Valgfritt/sample_creator_data.sql b/installer/data/mysql/nb-NO/2-Valgfritt/sample_creator_data.sql
index 91d7d00..bcd610a 100644
--- a/installer/data/mysql/nb-NO/2-Valgfritt/sample_creator_data.sql
+++ b/installer/data/mysql/nb-NO/2-Valgfritt/sample_creator_data.sql
@@ -3,7 +3,7 @@
 
 LOCK TABLES `creator_layouts` WRITE;
 /*!40000 ALTER TABLE `creator_layouts` DISABLE KEYS */;
-INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
+INSERT INTO `creator_layouts` VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, callnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
   <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63">
     <data_source image_name="none" image_source="patronimages" />
   </images>
diff --git a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
index 58ba035..c39e231 100755
--- a/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
+++ b/installer/data/mysql/pl-PL/mandatory/sysprefs.sql
@@ -98,7 +98,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog',1,'If ON, enables the circulation (returns) log',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson',1,'If ON, enables patron reviews of bibliographic records in the OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC','','YesNo');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SpecifyDueDate',1,'Define whether to display \"Specify Due Date\" form in Circulation','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionHistory','simplified','Define the display preference for serials issue history in OPAC','simplified|full','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionLog',1,'If ON, enables subscriptions log',NULL,'YesNo');
@@ -311,5 +310,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
\ No newline at end of file
diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
index 54c533c..a7c6a10 100755
--- a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
+++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql
@@ -127,7 +127,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog',1,'If ON, enables the circulation (returns) log',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson',1,'If ON, enables patron reviews of bibliographic records in the OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC','','YesNo');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SpecifyDueDate',1,'Define whether to display \"Specify Due Date\" form in Circulation','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionHistory','simplified','Define the display preference for serials issue history in OPAC','simplified|full','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionLog',1,'If ON, enables subscriptions log',NULL,'YesNo');
@@ -366,5 +365,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsField','','The MARC field/subfield that contains alternate holdings information for bibs taht do not have items attached (e.g. 852abchi for libraries converting from MARC Magician).',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','','Textarea');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
\ No newline at end of file
diff --git a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
index 9f095ab..f370766 100755
--- a/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
+++ b/installer/data/mysql/uk-UA/mandatory/system_preferences_full_optimal_for_install_only.sql
@@ -126,7 +126,6 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnLog',1,'If ON, enables the circulation (returns) log',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('reviewson',1,'If ON, enables patron reviews of bibliographic records in the OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC','','YesNo');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SpecifyDueDate',1,'Define whether to display \"Specify Due Date\" form in Circulation','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionHistory','simplified','Define the display preference for serials issue history in OPAC','simplified|full','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SubscriptionLog',1,'If ON, enables subscriptions log',NULL,'YesNo');
@@ -392,4 +391,3 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AlternateHoldingsSeparator','','The string to use to separate subfields in alternate holdings displays.',NULL,'free');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHiddenItems','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/O    pacHiddenItems.txt for more informations.','','Textarea');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('numSearchRSSResults',50,'Specify the maximum number of results to display on a RSS page of results',NULL,'Integer');
-INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 9cbc8db..52951e7 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2547,7 +2547,7 @@ $DBversion = '3.01.00.045';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'If this is switched on, patron''s cardnumber will be shown instead of their name on the holds and catalog screens', 'YesNo')");
     SetVersion ($DBversion);
-    print "Upgrade to $DBversion done (added a preference to hide the patrons name in the staff catalog)\n";
+    print "Upgrade to $DBversion done (added a preference to hide the patrons name in the staff catalog)";
 }
 
 $DBversion = "3.01.00.046";
@@ -2717,7 +2717,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
           PRIMARY KEY  (`id`)
         ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
              ");
-    SetVersion ($DBversion);print "Upgrade to $DBversion done (Created table fieldmapping)\n";print "Upgrade to 3.01.00.064 done (Version number skipped: nothing done)\n";
+    SetVersion ($DBversion);
 }
 
 $DBversion = '3.01.00.065';
@@ -2765,7 +2765,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 $DBversion = "3.01.00.068";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	$dbh->do("ALTER TABLE issuingrules ADD COLUMN `finedays` int(11) default NULL AFTER `fine` ");
-	print "Upgrade to $DBversion done (Adding finedays in issuingrules table)\n";
+	print "Upgrade done (Adding finedays in issuingrules table)\n";
     SetVersion ($DBversion);
 }
 
@@ -2788,13 +2788,13 @@ CREATE TABLE IF NOT EXISTS `search_history` (
 SEARCHHIST
 	$dbh->do($create);
 
-	print "Upgrade to $DBversion done (added OPAC search history preference and table)\n";
+	print "Upgrade done (added OPAC search history preference and table)\n";
 }
 
 $DBversion = "3.01.00.070";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	$dbh->do("ALTER TABLE authorised_values ADD COLUMN `lib_opac` VARCHAR(80) default NULL AFTER `lib`");
-	print "Upgrade to $DBversion done (Added a lib_opac field in authorised_values table)\n";
+	print "Upgrade done (Added a lib_opac field in authorised_values table)\n";
 }
 
 $DBversion = "3.01.00.071";
@@ -3169,14 +3169,14 @@ ALTER table suggestions
     ADD itemtype VARCHAR(30) default NULL
     ;
 SUGGESTIONS
-    print "Upgrade to $DBversion done (Suggestions)\n";
+    print "Upgrade to $DBversion done Suggestions";
     SetVersion ($DBversion);
 }
 
 $DBversion = "3.01.00.087";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("ALTER table aqbudgets drop column budget_amount_sublevel;");
-    print "Upgrade to $DBversion done (Drop column budget_amount_sublevel from aqbudgets)\n";
+    print "Upgrade to $DBversion done drop column budget_amount_sublevel from aqbudgets\n";
     SetVersion ($DBversion);
 }
 
@@ -3319,7 +3319,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 $DBversion = "3.01.00.100";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	$dbh->do("INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('casAuthentication', '0', '', 'Enable or disable CAS authentication', 'YesNo'), ('casLogout', '1', '', 'Does a logout from Koha should also log out of CAS ?', 'YesNo'), ('casServerUrl', 'https://localhost:8443/cas', '', 'URL of the cas server', 'Free')");
-	print "Upgrade to $DBversion done (added CAS authentication system preferences)\n";
+	print "Upgrade done (added CAS authentication system preferences)\n";
     SetVersion ($DBversion);
 }
 
@@ -3341,14 +3341,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do(
     "UPDATE permissions set description = 'Edit catalog (Modify bibliographic/holdings data)' where module_bit = 9 and code = 'edit_catalogue'"
     );
-	print "Upgrade to $DBversion done (fixed spelling error in edit_catalogue permission)\n";
+	print "Upgrade done (fixed spelling error in edit_catalogue permission)\n";
     SetVersion ($DBversion);
 }
 
 $DBversion = "3.01.00.103";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	$dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES (13, 'moderate_tags', 'Moderate patron tags')");
-	print "Upgrade to $DBversion done (adding patron permissions for tags tool)\n";
+	print "Upgrade done (adding patron permissions for tags tool)\n";
     SetVersion ($DBversion);
 }
 
@@ -3402,7 +3402,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 $DBversion = "3.01.00.106";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	$dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ( 'OpacAddMastheadLibraryPulldown', '0', '', 'Adds a pulldown menu to select the library to search on the opac masthead.', 'YesNo' )");
-	print "Upgrade to $DBversion done (added OpacAddMastheadLibraryPulldown system preferences)\n";
+	print "Upgrade done (added OpacAddMastheadLibraryPulldown system preferences)\n";
     SetVersion ($DBversion);
 }
 
@@ -3421,7 +3421,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	ADD `field_separator` VARCHAR( 2 ) NOT NULL AFTER `csv_separator` ,
 	ADD `subfield_separator` VARCHAR( 2 ) NOT NULL AFTER `field_separator` 
 	});
-	print "Upgrade to $DBversion done (added separators for csv export)\n";
+	print "Upgrade done (added separators for csv export)\n";
     SetVersion ($DBversion);
 }
 
@@ -3430,27 +3430,27 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	$dbh->do(qq{
 	ALTER TABLE `export_format` ADD `encoding` VARCHAR(255) NOT NULL AFTER `subfield_separator`
 	});
-	print "Upgrade to $DBversion done (added encoding for csv export)\n";
+	print "Upgrade done (added encoding for csv export)\n";
     SetVersion ($DBversion);
 }
 
 $DBversion = '3.01.00.110';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do('ALTER TABLE `categories` ADD COLUMN `enrolmentperioddate` DATE NULL DEFAULT NULL AFTER `enrolmentperiod`');
-    print "Upgrade to $DBversion done (Add enrolment period date support)\n";
+    print "Upgrade done (Add enrolment period date support)\n";
     SetVersion ($DBversion);
 }
 
 $DBversion = '3.01.00.111';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    print "Upgrade to $DBversion done (mark DBrev for 3.2-alpha release)\n";
+    print "Upgrade done (mark DBrev for 3.2-alpha release)\n";
     SetVersion ($DBversion);
 }
 
 $DBversion = '3.01.00.112';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	$dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SpineLabelShowPrintOnBibDetails', '0', '', 'If turned on, a \"Print Label\" link will appear for each item on the bib details page in the staff interface.', 'YesNo');");
-	print "Upgrade to $DBversion done ( added Show Spine Label Printer on Bib Items Details preferences )\n";
+	print "Upgrade done ( added Show Spine Label Printer on Bib Items Details preferences )\n";
     SetVersion ($DBversion);
 }
 
@@ -3464,7 +3464,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do(
         "INSERT INTO systempreferences (variable,value,type)
          VALUES('OPACXSLTDetailsDisplay',?,'YesNo')", {}, $value ? 1 : 0);
-    print "Upgrade to $DBversion done (added two new syspref: OPACXSLTResultsDisplay and OPACXSLTDetailDisplay). You may have to go in Admin > System preference to tweak XSLT related syspref both in OPAC and Search tabs.\n";
+    print "Upgrade done (added two new syspref: OPACXSLTResultsDisplay and OPACXSLTDetailDisplay). You may have to go in Admin > System preference to tweak XSLT related syspref both in OPAC and Search tabs.\n     ";
     SetVersion ($DBversion);
 }
 
@@ -3490,7 +3490,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	if (C4::Context->preference('OrderPdfFormat') eq 'pdfformat::example'){
 		$dbh->do("UPDATE `systempreferences` set value='pdfformat::layout2pages' WHERE variable='OrderPdfFormat'");
 	}
-	print "Upgrade to $DBversion done (corrected default OrderPdfFormat value if still set wrong )\n";
+	print "Upgrade done ( corrected default OrderPdfFormat value if still set wrong )\n";
     SetVersion ($DBversion);
 }
 
@@ -3615,7 +3615,7 @@ $DBversion = "3.01.00.129";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 	$dbh->do("UPDATE `permissions` SET `code` = 'items_batchdel' WHERE `permissions`.`module_bit` =13 AND `permissions`.`code` = 'batchdel' LIMIT 1 ;");
 	$dbh->do("UPDATE `permissions` SET `code` = 'items_batchmod' WHERE `permissions`.`module_bit` =13 AND `permissions`.`code` = 'batchmod' LIMIT 1 ;");
-	print "Upgrade to $DBversion done (Change permissions names for item batch modification / deletion)\n";
+	print "Upgrade done (Change permissions names for item batch modification / deletion)\n";
 
     SetVersion ($DBversion);
 }
@@ -3623,7 +3623,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 $DBversion = "3.01.00.130";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("UPDATE reserves SET expirationdate = NULL WHERE expirationdate = '0000-00-00'");
-    print "Upgrade to $DBversion done (change reserves.expirationdate values of 0000-00-00 to NULL (bug 1532)\n";
+    print "Upgrade done (change reserves.expirationdate values of 0000-00-00 to NULL (bug 1532)"; 
     SetVersion ($DBversion);
 }
 
@@ -3655,7 +3655,7 @@ if (C4::Context->preference('Version') < TransformToNum($DBversion)){
 $DBversion = '3.01.00.134';
 if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('DisplayMultiPlaceHold','1','Display the ability to place multiple holds or not','','YesNo')");
-    print "Upgrade to $DBversion done (adding syspref DisplayMultiPlaceHold to control whether multiple holds can be placed from the search results page)\n";
+    print "Upgrade to $DBversion done adding syspref DisplayMultiPlaceHold to control whether multiple holds can be placed from the search results page";
     SetVersion ($DBversion);
 }
 
@@ -3665,7 +3665,7 @@ if (C4::Context->preference('Version') < TransformToNum($DBversion)){
         INSERT INTO `letter` (module, code, name, title, content) VALUES
 ('reserves', 'HOLD_PRINT', 'Hold Available for Pickup (print notice)', 'Hold Available for Pickup (print notice)', '<<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n\r\n\r\nChange Service Requested\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>>\r\n<<borrowers.address>>\r\n<<borrowers.city>> <<borrowers.zipcode>>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<<borrowers.firstname>> <<borrowers.surname>> <<borrowers.cardnumber>>\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\n')
 ");
-    print "Upgrade to $DBversion done (bug 4377: added HOLD_PRINT message template)\n";
+    print "Upgrade to $DBversion done (bug 4377: added HOLD_PRINT message template)";
     SetVersion ($DBversion);
 }
 
@@ -3674,7 +3674,7 @@ if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     $dbh->do(qq{
 INSERT INTO permissions (module_bit, code, description) VALUES
    ( 9, 'edit_items', 'Edit Items');});
-    print "Upgrade to $DBversion done (Adding a new permission to edit items)\n";
+    print "Upgrade to $DBversion done Adding a new permission to edit items";
     SetVersion ($DBversion);
 }
 
@@ -3691,14 +3691,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
           (15, 'renew_subscription', 'Renew a subscription'),
           (15, 'routing', 'Routing');
                  ");
-    print "Upgrade to $DBversion done (adding granular permissions for serials)\n";
+    print "Upgrade to $DBversion done (adding granular permissions for serials)";
     SetVersion ($DBversion);
 }
 
 $DBversion = "3.01.00.138";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("DELETE FROM systempreferences WHERE variable = 'GranularPermissions'");
-    print "Upgrade to $DBversion done (bug 4896: removing GranularPermissions syspref; use of granular permissions is now the default)\n";
+    print "Upgrade to $DBversion done (bug 4896: removing GranularPermissions syspref; use of granular permissions is now the default)";
     SetVersion ($DBversion);
 }
 
@@ -3720,14 +3720,14 @@ $DBversion = '3.01.00.141';
 if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     $dbh->do(qq{DELETE FROM message_attributes WHERE message_attribute_id=3;});
     $dbh->do(qq{DELETE FROM letter WHERE code='EVENT' AND title='Upcoming Library Event';});
-    print "Upgrade to $DBversion done Remove upcoming events messaging option (bug 2434)\n";
+    print "Upgrade to $DBversion done Remove upcoming events messaging option (bug 2434)";
     SetVersion ($DBversion);
 }
 
 $DBversion = '3.01.00.142';
 if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     $dbh->do(qq{DELETE FROM message_transports WHERE message_attribute_id=3;});
-    print "Upgrade to $DBversion done (Remove upcoming events messaging option part 2 (bug 2434))\n";
+    print "Upgrade to $DBversion done Remove upcoming events messaging option part 2 (bug 2434)";
     SetVersion ($DBversion);
 }
 
@@ -3735,14 +3735,14 @@ $DBversion = '3.01.00.143';
 if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     $dbh->do(qq{CREATE INDEX auth_value_idx ON authorised_values (authorised_value)});
     $dbh->do(qq{CREATE INDEX auth_val_cat_idx ON borrower_attribute_types (authorised_value_category)});
-    print "Upgrade to $DBversion done (Create index on authorised_values and borrower_attribute_types (bug 4139))\n";
+    print "Create index on authorised_values and borrower_attribute_types (bug 4139)";
     SetVersion ($DBversion);
 }
 
 $DBversion = '3.01.00.144';
 if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     $dbh->do(qq{UPDATE systempreferences SET value='normal' where value='default' and variable='IntranetBiblioDefaultView'});
-    print "Upgrade to $DBversion done (Update the 'default' to 'normal' for the IntranetBiblioDefaultView syspref (bug 5007))\n";
+    print "Update the 'default' to 'normal' for the IntranetBiblioDefaultView syspref (bug 5007)";
     SetVersion ($DBversion);
 }
 
@@ -3925,7 +3925,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 $DBversion = '3.03.00.008';
 if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACNoResultsFound','','Display this HTML when no results are found for a search in the OPAC','70|10','Textarea')");
-    print "Upgrade to $DBversion done (adding syspref OPACNoResultsFound to control what displays when no results are found for a search in the OPAC.)\n";
+    print "Upgrade to $DBversion done adding syspref OPACNoResultsFound to control what displays when no results are found for a search in the OPAC.";
     SetVersion ($DBversion);
 }
 
@@ -4216,27 +4216,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 }
 
 $DBversion = '3.03.00.042';
-if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    stocknumber_checker();
-    print "Upgrade to $DBversion done (5860 Index itemstocknumber)\n";
+if (C4::Context->preference("Version") < TransformToNum($DBversion) && $original_version < TransformToNum("3.02.06.001")) {
+    $dbh->do("ALTER TABLE `items` DROP INDEX `itemsstocknumberidx`;");
+    $dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);");
+    print "Upgrade to $DBversion done (Change items.stocknumber to be not unique)\n";
     SetVersion ($DBversion);
 }
 
-sub stocknumber_checker { #code reused later on
-  my @row;
-  #drop the obsolete itemSStocknumber idx if it exists
-  @row = $dbh->selectrow_array("SHOW INDEXES FROM items WHERE key_name='itemsstocknumberidx'");
-  $dbh->do("ALTER TABLE `items` DROP INDEX `itemsstocknumberidx`;") if @row;
-
-  #check itemstocknumber idx; remove it if it is unique
-  @row = $dbh->selectrow_array("SHOW INDEXES FROM items WHERE key_name='itemstocknumberidx' AND non_unique=0");
-  $dbh->do("ALTER TABLE `items` DROP INDEX `itemstocknumberidx`;") if @row;
-
-  #add itemstocknumber index non-unique IF it still not exists
-  @row = $dbh->selectrow_array("SHOW INDEXES FROM items WHERE key_name='itemstocknumberidx'");
-  $dbh->do("ALTER TABLE items ADD INDEX itemstocknumberidx (stocknumber);") unless @row;
-}
-
 $DBversion = "3.03.00.043";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 
@@ -4346,30 +4332,6 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
-$DBversion = '3.05.00.002';
-if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    #follow up fix 5860: some installs already past 3.3.0.42
-    stocknumber_checker();
-    print "Upgrade to $DBversion done (Fix for stocknumber index)\n";
-    SetVersion ($DBversion);
-}
-
-$DBversion = "3.05.00.003";
-if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
-    $dbh->do(qq{
-    INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacRenewalBranch','checkoutbranch','Choose how the branch for an OPAC renewal is recorded in statistics','itemhomebranch|patronhomebranch|checkoutbranch|null','Choice');
-    });
-    print "Upgrade to $DBversion done (Adds New System preference OpacRenewalBranch)\n";
-    SetVersion($DBversion);
-}
-
-$DBversion = "3.05.00.004";
-if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC',NULL,'YesNo');");
-    print "Upgrade to $DBversion done (Add syspref ShowReviewerPhoto)\n";
-    SetVersion($DBversion);
-}
-
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/columns.def b/koha-tmpl/intranet-tmpl/prog/en/columns.def
index 3c67949..b8d6e8c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/columns.def
+++ b/koha-tmpl/intranet-tmpl/prog/en/columns.def
@@ -22,7 +22,7 @@ borrowers.categorycode	Borrowers Category
 borrowers.dateenrolled	Date Enrolled
 borrowers.gonenoaddress	Address Missing
 borrowers.lost	Lost Card
-borrowers.debarred	Restricted
+borrowers.debarred	Debarred
 borrowers.studentnumber	 Student Id number
 borrowers.school	School
 borrowers.contactname	Contact Name
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index b018e4f..c211507 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -17,9 +17,7 @@ a:hover {
 	color : #669ACC;
 }
 
-a.overdue,
-.overdue,
-.debit {
+a.overdue,.overdue {
 	color : #cc0000;
 }
 
@@ -556,15 +554,6 @@ div.yui-b fieldset.brief li.radio input {
 	padding:0.3em 0;
 }
 
-div.yui-b fieldset.brief fieldset {
-	margin : 0 .3em;
-	padding : .5em;
-}
-
-div.yui-b fieldset.brief fieldset legend {
-	font-size : 85%;
-}
-
 fieldset.rows {  
 border-width : 1px;
 border-bottom : 1px solid #666;
@@ -1214,23 +1203,6 @@ div.message h5 {
 div.message ul+h4 {
 	margin-top : .7em;
 }
-
-div.note {
-	background: #f4f6fa;
-	background-repeat : no-repeat;
-	background-position : left center;
-	background-image : url("../../img/note.png");
-	background-image: url("../../img/note.png"), -moz-linear-gradient(top, #f4f6fa 0%, #e8edf6 100%); /* FF3.6+ */
-	background-image: url("../../img/note.png"), -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f4f6fa), color-stop(100%,#e8edf6)); /* Chrome,Safari4+ */
-	background-image: url("../../img/note.png"), -webkit-linear-gradient(top, #f4f6fa 0%,#e8edf6 100%); /* Chrome10+,Safari5.1+ */
-	background-image: url("../../img/note.png"), -o-linear-gradient(top, #f4f6fa 0%,#e8edf6 100%); /* Opera11.10+ */
-	background-image: url("../../img/note.png"), -ms-linear-gradient(top, #f4f6fa 0%,#e8edf6 100%); /* IE10+ */
-	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f6fa', endColorstr='#e8edf6',GradientType=0 ); /* IE6-9 */
-	background-image: url("../../img/note.png"), linear-gradient(top, #f4f6fa 0%,#e8edf6 100%); /* W3C */
-	border : 1px solid #BCBCBC;
-	padding : .5em .5em .5em 20px;
-	margin : .5em 0;
-}
  
  div.results {
  	padding : .7em 0;
@@ -1759,8 +1731,7 @@ tr.reserved td {
 tr.transfered td {
 	background-color : #e8f0f6;
 }
-.waitinghere,
-.credit {
+.waitinghere {
 	color : #669900;
 }
 
@@ -2017,34 +1988,4 @@ fieldset.rows+h3 {clear:both;padding-top:.5em;}
 .importing .importing_msg {
     padding-left: 10px;
     padding-bottom: 10px;
-}
-
-#advanced-search fieldset {
-	border : 1px solid #EEE;
-	-moz-border-radius : 3px;
-	border-radius : 3px;
-}
-
-#advanced-search fieldset.action {
-	border : 0;
-}
-
-#advanced-search fieldset fieldset {
-	border : 1px solid #EEE;
-	margin : 0;
-	padding : .3em .5em;
-	-moz-border-radius : 0;
-	border-radius : 0;
-}
-#advanced-search fieldset fieldset+fieldset {
-	border-top : 0;
-}
-#advanced-search table {
-	border-spacing : 5px;
-	border-collapse : separate;
-	border-width : 0;
-}
-#advanced-search td {
-	border : 1px solid #EEE;
-	padding : 0.3em 0.4em;
 }
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc
index e9537f4..e1dde68 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc
@@ -1,16 +1,3 @@
-<script type="text/javascript">//<![CDATA[
-    $(document).ready(function() {
-        var path = location.pathname.substring(1);
-        var url = window.location.toString();
-        url.match(/\?(.+)$/);
-        var params = RegExp.$1;
-        if (params) { params = "?" + params; }
-        $('#navmenulist a[href$="/' + path + params + '"]').css('font-weight','bold');
-    });
-//]]>
-</script>
-<div id="navmenu">
-<div id="navmenulist">
 <h5>System Preferences</h5>
 <ul>
 	<li><a href="/cgi-bin/koha/admin/preferences.pl">System Preferences</a></li>
@@ -61,5 +48,3 @@
 	<!-- <li><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></li> -->
 	<li><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 Client Targets</a></li>
 </ul>
-</div>
-</div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc
index 503f954..1377aa5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc
@@ -27,7 +27,7 @@ function confirm_reregistration() {
 function update_child() {
     // var borrowernumbervalue= $("#borrowernumber").attr("value"); 
 [% IF ( CATCODE_MULTI ) %]
- window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=[% borrowernumber %]','UpdateChild','width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes');
+ window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=[% borrowernumber %]','UpdateChild','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes');
 [% ELSE %]
  confirm_updatechild();
 [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc
index bdeadde..4c05620 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc
@@ -17,9 +17,14 @@
 [% IF ( facets_loo.type_label_Series ) %]Series[% END %]
 [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %]
 <ul>
-        [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;limit=[% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value %]">[% facet.facet_label_value %]</a> [% IF ( facet.displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %][% IF ( facets_loo.expandable ) %]
+        [% FOREACH facet IN facets_loo.facets %]
+        [% IF facet.facet_label_value != "*" %]
+        <li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %]
+        [% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;limit=[% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value %]">[% facet.facet_label_value %]</a> [% IF ( facet.displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %]
+        [% IF ( facets_loo.expandable ) %]
         <li class="showmore"><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
 [% END %]
+[% END %]
 </ul></li>
 [% END %]
 </ul>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
index afad863..9331f5f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
@@ -25,7 +25,7 @@ function confirm_reregistration() {
 
 function update_child() {
 [% IF ( CATCODE_MULTI ) %]
- window.open('update-child.pl?op=multi&borrowernumber=[% borrowernumber %]','UpdateChild','width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes');
+ window.open('update-child.pl?op=multi&borrowernumber=[% borrowernumber %]','UpdateChild','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes');
 [% ELSE %]
  confirm_updatechild();
 [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
index bea0510..e8e56dc 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
@@ -67,11 +67,16 @@ YAHOO.util.Event.onContentReady("header_search", function() {
         <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
       [% END %]</select>
                  <label for="categorycode">Category: </label><select name="categorycode" id="categorycode">
-        <option value="">Any</option>[% FOREACH categorie IN categories %]
+        <option value="">Any</option>
+        [% FOREACH categorie IN categories %]
+         [% IF categorie.categorycode.substr(0,3) == homebranch %]
+         
         [% IF ( categorie.selected ) %]
+       
+       
         <option value="[% categorie.categorycode %]" selected="selected">[% categorie.description %]</option>[% ELSE %]
         <option value="[% categorie.categorycode %]">[% categorie.description %]</option>[% END %]
-      [% END %]</select>
+      [% END %][% END %]</select>
 	</p>
 	[% END %]
 </form>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc
index 3e22038..a330601 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc
@@ -18,7 +18,7 @@
     [% IF ( subscriptionid ) %]
 	    var editmenu = [
 	        [% IF ( CAN_user_serials_edit_subscription ) %]
-		    { text: _("Edit Subscription"),  [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=modify&amp;subscriptionid=[% subscriptionid %]" },
+		    { text: _("Edit Subscription"),  [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=mod&amp;subscriptionid=[% subscriptionid %]" },
 		[% END %]
 	        [% IF ( CAN_user_serials_create_subscription ) %]
 		    { text: _("Edit as New (Duplicate)"), [% IF ( cannotedit ) %]disabled: true, [% END %] url: "/cgi-bin/koha/serials/subscription-add.pl?op=dup&amp;subscriptionid=[% subscriptionid %]" },
@@ -69,7 +69,7 @@ onclick: {fn:function(){popup([% subscriptionid %])}}
 
 	    [% IF ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription ) %]
 		[% UNLESS ( cannotedit ) %]
-		    <li id="editmenuc"><a id="edit" href="/cgi-bin/koha/serials/subscription-add.pl?op=modify&amp;subscriptionid=[% subscriptionid %]">Edit</a></li>
+		    <li id="editmenuc"><a id="edit" href="/cgi-bin/koha/serials/subscription-add.pl?op=mod&amp;subscriptionid=[% subscriptionid %]">Edit</a></li>
 		[% END %]
 	    [% END %]
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
index 4f2adc0..84eb9a1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
@@ -99,29 +99,23 @@
                 
             <h2>Koha Release Team</h2>
             <ul>
-               <li><strong>Colin Campbell</strong>(Koha 3.4 QA Manager)</li>
                <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544614260">Galen Charlton</a></strong> (Koha 3.2 Release Manager)</li>
-	           <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544609030">Chris Cormack</a></strong> (Koha 1.x, 3.4, 3.6 Release Manager, Koha 3.2 Translation Manager)</li>
-	           <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6620692210484">Frédéric Demians</a></strong>(Koha 3.4, 3.6 Translation Manager)</li>
+	           <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544609030">Chris Cormack</a></strong> (Koha 1.x Release Manager, Koha 3.2 Translation Manager)</li>
 	           <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544646984">Nicole C. Engard</a></strong> (Koha 3.x Documentation Manager)</li>
 	           <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544609053">Joshua Ferraro</a></strong> (Koha 3.0 Release Manager &amp; Translation Manager)</li>
 	           <li><strong>Rachel Hamilton-Williams</strong> (Kaitiaki from 2004 to present)</li>
 	           <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544614275">Henri-Damien Laurent</a></strong> (Koha 3.0 Release Maintainer)</li>
 	           <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544609147">Owen Leonard</a></strong> (Koha 3.x Interface Design)</li>
-               <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544615991">Chris Nighswonger</a></strong> (Koha 3.2, 3.4 Release Maintainer)</li>
+               <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544615991">Chris Nighswonger</a></strong> (Koha 3.2 Release Maintainer)</li>
 	           <li><strong><a href="https://www.ohloh.net/p/koha/contributors/6618544612249">Paul Poulain</a></strong> (Koha 2.0 Release Manager, Koha 2.2 Release Manager/Maintainer)</li>
 	           <li><strong><a href="http://www.ohloh.net/p/koha/contributors/6620692116417">MJ Ray</a></strong> (Koha 2.0 Release Maintainer)</li>
-                <li><strong>Ian Walls</strong> Koha 3.6 QA Manager</li>
                 </ul>
             <h2>Koha Development Team</h2>
 			<ul>
                 <li>Md. Aftabuddin</li>
-		<li>Edward Allen</li>
                 <li>Francisco M. Marzoa Alonso</li>
                 <li>Cindy Murdock Ames</li>
-                <li>Richard Anderson</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6620692181851">Nahuel Angelinetti</a></li>
-		<li>Tomás Cohen Arazi</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6620692124662">Andrew Arensburger (the small and great C4::Context module)</a></li>
                 <li>Alex Arnaud</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6618544614259">Joe Atzberger</a></li>
@@ -137,63 +131,40 @@
                 <li>Roger Buck</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6620692376789">Jared Camins-Esakov</a></li>
                 <li>Colin Campbell</li>
-		<li>Fernando Canizo</li>
-		<li>Frédérick Capovilla</li>
                 <li>DeAndre Carroll</li>
                 <li>Chris Catalfo (new plugin MARC editor)</li>
                 <li>Marc Chantreux</li>
-		<li>Jerome Charaoui</li>
-                <li>Andrew Chilton</li>
                 <li>Garry Collum</li>
-		<li>John Copeland</li>
-		<li>Jeremy Crabtree</li>
-		<li>Christophe Croullebois</li>
-                <li>Nate Curulla</li>
                 <li>Vincent Danjean</li>
-                <li>Elliott Davis</li>
-		<li>Doug Dearden</li>
                 <li>Kip DeGraaf</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6620692210484">Frédéric Demians</a></li>
-		<li>Jonathan Druart</li>
-		<li>Serhij Dubyk</li>
                 <li>Thomas Dukleth (MARC Frameworks Maintenance)</li>
-		<li>Frederic Durand</li>
                 <li>Sebastiaan Durand</li>
                 <li>Ecole des Mines de Saint Etienne, Philippe Jaillon (OAI-PMH support)</li>
                 <li>Stephen Edwards</li>
                 <li>Andrew Elwell</li>
-                <li>Brian Engard</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6618544677502">Magnus Enger</a></li>
                 <li>Esiee School (Jérome Vizcaino, Michel Lerenard, Pierre Cauchois)</li>
-		<li>Shaun Evans</li>
-                <li>Pat Eyler (Kaitiaki from 2002 to 2004)</li>
+                <li>Pate Eyler (Kaitiaki from 2002 to 2004)</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6618544609865">Antoine Farnault</a></li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6618544670742">Katrin Fischer</a></li>
                 <li>Clay Fouts</li>
-		<li>Claudia Forsman</li>
                 <li>Marco Gaiarin</li>
-                <li>Pierrick Le Gall</li>
                 <li>Brendan A. Gallagher</li>
                 <li>Tumer Garip</li>
                 <li>Russel Garlick</li>
-		<li>Mark Gavillet</li>
                 <li>Daniel Kahn Gillmor</li>
                 <li>David Goldfein</li>
-                <li>Daniel Grobani</li>
                 <li>Amit Gupta</li>
                 <li>Michael Hafen</li>
-		<li>Christopher Hall</li>
                 <li>Mike Hansen</li>
                 <li>Brian Harrington</li>
-                <li>Friedrich zur Hellen</li>
                 <li>Michaes Herman</li>
                 <li>Wolfgang Heymans</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6618544614261">Ryan Higgins</a></li>
                 <li>Sèbastien Hinderer</li>
-		<li>Stephanie Hogan</li>
                 <li>Daniel Holth</li>
                 <li>Andrew Hooper</li>
-                <li>Matthew Hunt</li>
                 <li>Christopher Hyde</li>
                 <li>Cory Jaeger</li>
                 <li>Srdjan Jankovic</li>
@@ -201,43 +172,28 @@
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6620692132429">Mason James</a></li>
                 <li>Mike Johnson</li>
                 <li>Donovan Jones</li>
-		<li>Janusz Kaczmarek</li>
                 <li>Koustubha Kale</li>
                 <li>Arnaud Laurin</li>
                 <li>Ambrose Li (translation tool)</li>
                 <li>Gynn Lomax</li>
                 <li>Robert Lyon (Corporate Serials)</li>
-                <li>Francois Marier</li>
                 <li>Frère Sébastien Marie</li>
                 <li>Ricardo Dias Marques</li>
-		<li>Julian Maurice</li>
                 <li>Brig C. McCoy</li>
                 <li>Dorian Meid (German translation)</li>
                 <li>Matthias Meusburger</li>
-		<li>Sophie Meynieux</li>
-                <li>Alan Millar</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6618544607803">Andrew Moore</a></li>
                 <li>Sharon Moreland</li>
                 <li>Nicolas Morin</li>
  		<li>Mike Mylonas</li>
                 <li><a href="https://www.ohloh.net/accounts/cnighswonger">Chris Nighswonger</a></li>
-		<li>Eric Olsen</li>
-		<li>H. Passini</li>
-		<li>Dobrica Pavlinusic</li>
                 <li>Polytechnic University</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6620692116417">MJ Ray</a></li>
                 <li>Liz Rea</li>
                 <li>Allen Reinmeyer</li>
-                <li>Serge Renaux</li>
-                <li>Waylon Robertson</li>
-                <li>Marcel de Rooy</li>
-		<li>Salvador Zaragoza Rubio</li>
-		<li>Brice Sanchez</li>
                 <li><a href="https://www.ohloh.net/p/koha/contributors/6618544619438">Robin Sheat</a></li>
-		<li>Zach Sim</li>
                 <li>Savitra Sirohi</li>
                 <li>Pawel Skuza (Polish for 1.2)</li>
-                <li>Fridolyn Somers</li>
                 <li>Southeastern University</li>
                 <li>Glen Stewart</li>
 		<li>Will Stokes</li>
@@ -252,7 +208,6 @@
                 <li>Andrei V. Toutoukine</li>
                 <li>Darrell Ulm</li>
                 <li>Universidad ORT Uruguay (Ernesto Silva, Andres Tarallo)</li>
-		<li>Reed Wade</li>
 		<li>Ian Walls</li>
                 <li><a href="http://www.ohloh.net/accounts/janewagner">Jane Wagner</a></li>
                 <li><a href="https://www.ohloh.net/accounts/pianohacker">Jesse Weaver</a></li>
@@ -263,7 +218,7 @@
                 <li>James Winter</li>
                 <li>Lars Wirzenius</li>
 			</ul>
-            <h3>Contributing Companies and Institutions</h3>
+            <h3>Contributing Companies</h3>
             <ul>
                 <li><strong>BibLibre</strong>, France</li>
                 <li><strong>Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)</strong>, Germany</li>
@@ -271,12 +226,10 @@
 		<li><strong>Calyx</strong>, Australia</li>
 		<li><strong>Catalyst IT</strong>, New Zealand</li>
                 <li><strong>Katipo Communications</strong>, New Zealand</li>
-                <li><strong>LibLime</strong>, USA</li>
-                <li><strong>Libriotech</strong>, Norway</li> 
+                <li><strong>LibLime</strong>, USA</li> 
 		<li><strong>Nelsonville Public Library</strong>, Ohio, USA</li>
 		<li><strong>PTFS</strong>, Maryland, USA</li>
 		<li><strong>PTFS Europe Ltd</strong>, United Kingdom</li>
-		<li><strong>Rijksmuseum</strong>, Amsterdam, The Netherlands</li>
 		<li><strong>SAN-Ouest Provence</strong>, France</li>
 		<li><strong>Software Coop</strong>, United Kingdom</li>
 		<li><strong>Tamil</strong>, France</li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
index d6044fc..d6c8459 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
@@ -249,23 +249,6 @@ $(document).ready(function()
                 <input type="text" size="50" name="series" id="series" value="[% seriestitle %]" />
             [% END %]
         </li>
-        </li>
-            [% UNLESS ( biblionumber ) %]
-            [% IF ( itemtypeloop ) %]
-            <li>
-                <span class="label">Item type:</span>
-                <select name="itemtype" style="width:12em;">
-                [% FOREACH itemtype IN itemtypeloop %]
-                    [% IF ( itemtype.selected ) %]
-                        <option value="[% itemtype.itemtype %]" selected="selected">[% itemtype.description %]</option>
-                    [% ELSE %]
-                        <option value="[% itemtype.itemtype %]">[% itemtype.description %]</option>
-                    [% END %]
-                [% END %]
-                </select>
-            </li>
-            [% END %]
-            [% END %]
         </ol>
     </fieldset>
     [% IF ( items ) %]
@@ -278,8 +261,8 @@ $(document).ready(function()
         [% FOREACH item IN items %]
         <div id="outeritemblock">
         <div id="itemblock">
-            <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
-                <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
+            <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li>
+                <div class="subfield_line" style="[% iteminformatio.hidden %];" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
 
                     <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
                     [% iteminformatio.marc_value %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt
index dbbcdd5..ca3fc73 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt
@@ -260,9 +260,9 @@
     <table id="periodsh">
     <thead>
 	    <tr>
-	        <th>Budget Name</th>
+	        <th>Budget Name [%  (homebranch) %]</th>
 	        <th>Start Date</th>
-	        <th>End Date</th>
+	        <th>End Dat e</th>
 	        <th>Active</th>
 	        <th>Locked</th>
 	        <th>Total</th>
@@ -271,6 +271,8 @@
 	</thead>
 	<tbody>
 	    [% FOREACH period_loo IN period_loop %]
+	  
+	    [% IF period_loo.budget_period_description.substr(0,3) == homebranch %]
 	        [% IF ( loop.odd ) %]
 	            <tr>
 	        [% ELSE %]
@@ -288,7 +290,7 @@
 	           	<a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id %]">Add Fund</a>
 	        </td>
 	        </tr>
-	    [% END %]
+	    [% END %][% END %]
 	    [% UNLESS ( period_loop ) %]
     	<tr><td colspan="7">No budget</td></tr>
     	[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt
index ca623f3..af6a238 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt
@@ -319,7 +319,6 @@
     [% IF ( budget_perm_1 ) %]<option value="1" selected="selected">Owner</option>[% ELSE %]<option value="1">Owner</option>[% END %]
     [% IF ( budget_perm_2 ) %]<option value="2" selected="selected">Library</option>[% ELSE %]<option value="2">Library</option>[% END %]
     </option>
-    </select>
     </li>
 
     <li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
index f235634..e72349a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
@@ -50,9 +50,6 @@
 	   [% IF ( action_add_value ) %]New authorized value[% END %]
 	   [% IF ( action_add_category ) %]New category[% END %]
 	</h1>
-
-    [% IF ( action_modify ) %]<div class="note"><strong>NOTE:</strong> If you change an authorized value, existing records using it won't be updated.</div>[% END %]
-
 	<form action="[% script_name %]" name="Aform" method="post">
 	<input type="hidden" name="op" value="add_validate" />
     <input type="hidden" name="offset" value="[% offset %]" />
@@ -176,10 +173,15 @@
 </ul></div>
 
 <h1>Authorized values</h1>
-<div class="note"><strong>NOTE:</strong> If you change an authorized value, existing records using it won't be updated.</div>
+<p>These values can be used in many pull down menus throughout the Koha system. You can define as many categories as you want, and as many authorized values as you want in each category.</p>
+
+<p>When you define the MARC subfield structure, you can link a subfield to a authorized-value category. When the user ask for adding of modifying a biblio, the subfield is not entered through a free field, but though a list of authorized values</p>
 
 [% IF ( duplicate_category ) %]
-<div class="dialog alert">Could not add value &quot;[% duplicate_value %]&quot; for category &quot;[% duplicate_category %]&quot; &mdash; value already present.
+<div>
+<span class="problem">Could not add value &quot;[% duplicate_value %]&quot; for category 
+    &quot;[% duplicate_category %]&quot; &mdash; value already present.
+</span>
 </div>
 [% END %]
 <form action="/cgi-bin/koha/admin/authorised_values.pl" method="post" id="category"><label for="searchfield">Show Category: </label>[% tab_list %] <input type="submit" value="Submit" /></form>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt
index cf7ada3..9410c23 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt
@@ -101,11 +101,11 @@
 	
 	<span id="pager[% codes_loo.code %]table" class="pager">
 	<form class="formpager">&nbsp;<strong>page(s)</strong>&nbsp;:
-		<img src="[% interface %]/[% theme %]/img/first.png" class="first"/>
-		<img src="[% interface %]/[% theme %]/img/prev.png" class="prev"/>
+		<img src="[% codes_loo.interface %]/prog/img/first.png" class="first"/>
+		<img src="[% codes_loo.interface %]/prog/img/prev.png" class="prev"/>
 		<input type="text" size="5" class="pagedisplay"/>
-		<img src="[% interface %]/[% theme %]/img/next.png" class="next"/>
-		<img src="[% interface %]/[% theme %]/img/last.png" class="last"/>
+		<img src="[% codes_loo.interface %]/prog/img/next.png" class="next"/>
+		<img src="[% codes_loo.interface %]/prog/img/last.png" class="last"/>
 		, entries/page : 
 		<select class="pagesize">
         	<option selected="selected" value="10">10</option>
@@ -127,7 +127,8 @@
 
 			<tbody>
 					[% FOREACH to_branch_loo IN codes_loo.to_branch_loop %]
-						[% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
+						[% UNLESS ( loop.odd ) %]<tr class="highlight"><!-- TMPL_ELSE
+--><tr>[% END %]
 							<td><label style="min-width:400px;" for="[% to_branch_loo.code %][% to_branch_loo.toBranch %]row">[% to_branch_loo.toBranch %] - [% to_branch_loo.toBranchname %]</label></td>
 							<td><input type="checkbox" id="[% to_branch_loo.code %][% to_branch_loo.toBranch %]row" name="[% to_branch_loo.code %]_[% to_branch_loo.toBranch %]" [% IF ( to_branch_loo.isChecked ) %]checked="checked" [% END %] /></td>
 						</tr>
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 b92ad52..0b1a914 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
@@ -91,7 +91,7 @@
         </li>
         <li>
             <label for="branchname">Name</label>
-            <input type="text" name="branchname" id="branchname" size="80" value="[% branch_name |html %]" />&nbsp;
+            <input type="text" name="branchname" id="branchname" size="40" maxlength="80" value="[% branch_name |html %]" />&nbsp;
         </li>
 	</ol>
 	</fieldset>
@@ -301,16 +301,16 @@
                     [% categorycode %]
                 [% ELSE %]
                 <label for="categorycode">Category code:</label>
-                    <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" value="[% categorycode |html %]" />
+                    <input type="text" name="categorycode" id="categorycode" size="11" maxlength="10" value="[% categorycode |html %]" />
                 [% END %]
             </li>
         <li>
             <label for="categoryname">Name: </label>
-            <input type="text" name="categoryname" id="categoryname" size="32" maxlength="32" value="[% categoryname |html %]" />
+            <input type="text" name="categoryname" id="categoryname" size="40" maxlength="80" value="[% categoryname |html %]" />
         </li>
         <li>
             <label for="codedescription">Description: </label>
-            <input type="text" name="codedescription" id="codedescription" size="70" value="[% codedescription |html %]" />
+            <input type="text" name="codedescription" id="codedescription" size="70" maxlength="80" value="[% codedescription |html %]" />
         </li>
 		<li>
 		<label for="categorytype">Category Type: </label>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt
index c2e5062..6031aa2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt
@@ -9,8 +9,7 @@
 <script type="text/javascript" id="js">$(document).ready(function() {
 	$("#table_categorie").tablesorter({
 		sortList: [[0,0]],
-		widgets: ['zebra'],
-		headers: { 11: { sorter: false}}
+		headers: { 10: { sorter: false}}
 	}).tablesorterPager({container: $("#pagertable_categorie"),positionFixed: false,size: 20});
 }); </script>
 [% INCLUDE 'calendar.inc' %]
@@ -301,7 +300,11 @@ Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
 			<th scope="col" colspan="2">&nbsp; </th>
 		</thead>
 		[% FOREACH loo IN loop %]
+		[% UNLESS ( loop.odd ) %]
+			<tr class="highlight">
+		[% ELSE %]
 			<tr>
+		[% END %]
                         <td>[% loo.categorycode |html %]</td>
                         <td>
                             <a href="[% loo.script_name %]?op=add_form&amp;categorycode=[% loo.categorycode |url %]">[% loo.description |html %]</a>
@@ -328,26 +331,23 @@ Confirm Deletion of Category [% categorycode |html %][% END %]</legend>
                         <td>[% IF ( loo.overduenoticerequired ) %]Yes[% ELSE %]No[% END %]</td>
                         <td>[% IF ( loo.hidelostitems ) %]Hidden[% ELSE %]Shown[% END %]</td>
                         <td>[% loo.reservefee %]</td>
-                        [% IF ( EnhancedMessagingPreferences ) %]
-                        <td style="white-space: nowrap; font-size:80%;">
+                        [% IF ( loo.EnhancedMessagingPreferences ) %]
+                        <td>
                             [% IF ( loo.messaging_prefs ) %]
-                              [% FOREACH prefs IN loo.messaging_prefs %]
-	                                [% FOREACH transport IN prefs.transports %]
-                                         [% IF ( transport.transport ) %]
-			                                [% IF ( prefs.Item_Due ) %]Item Due
-			                                [% ELSIF ( prefs.Advance_Notice ) %]Advance Notice
-			                                [% ELSIF ( prefs.Upcoming_Events ) %]Upcoming Events
-			                                [% ELSIF ( prefs.Hold_Filled ) %]Hold Filled
-			                                [% ELSIF ( prefs.Item_Check_in ) %]Item Check-in
-			                                [% ELSIF ( prefs.Item_Checkout ) %]Item Checkout
-			                                [% ELSE %]Unknown
-			                                [% END %]:
-				                            <strong>[% transport.transport %]</strong><br />
-				                         [% ELSE %]None<br />[% END %]
-	                                [% END %]
-                                [% END %]
+                                [% IF ( messaging_preference.Item_Due ) %]Item Due
+                                [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance Notice
+                                [% ELSIF ( messaging_preference.Upcoming_Events ) %]Upcoming Events
+                                [% ELSIF ( messaging_preference.Hold_Filled ) %]Hold Filled
+                                [% ELSIF ( messaging_preference.Item_Check_in ) %]Item Check-in
+                                [% ELSIF ( messaging_preference.Item_Checkout ) %]Item Checkout
+                                [% ELSE %]Unknown 
+                                [% END %] :
+                                [% FOREACH transport IN messaging_pref.transports %]
+                                    [% transport.transport %]
+                                [% END %]                                
+                                <br />
                             [% ELSE %]
-                                None
+                                none
                             [% END %]
                         </td>
                         [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt
index 2e9bdd2..dd25420 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/cities.tt
@@ -63,11 +63,11 @@
 	[% END %]
 	<li>
 	<label for="city_name">City, State: </label>
-	<input type="text" name="city_name" id="city_name" size="80" maxlength="100" value="[% city_name |html %]" />
+	<input type="text" name="city_name" id="city_name" size="40" maxlength="80" value="[% city_name |html %]" />
 	</li>
 	<li>				
 	<label for="city_zipcode">Zip/Postal code: </label>
-	<input type="text" name="city_zipcode" id="city_zipcode" size="20" maxlength="20" value="[% city_zipcode %]" />
+	<input type="text" name="city_zipcode" id="city_zipcode" size="10" maxlength="10" value="[% city_zipcode %]" />
 	</li></ol></fieldset>
 	
 	<fieldset class="action">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/item_circulation_alerts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/item_circulation_alerts.tt
index 9a976a0..8025500 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/item_circulation_alerts.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/item_circulation_alerts.tt
@@ -8,6 +8,7 @@ table.grid thead th {
 
 table.grid tbody th {
   text-align: right;
+  width: 100px;
 }
 
 table.grid tbody td {
@@ -19,7 +20,7 @@ table.grid tbody td.info {
 }
 
 table.grid.active tbody td {
-  width: 10%;
+  width: 1%;
   cursor: pointer;
 }
 
@@ -152,10 +153,10 @@ $(function(){
 
 <div id="checkout">
 <h3>Checkout</h3>
-<table class="grid active" width="100%">
+<table class="grid" width="100%">
 <thead>
 <tr>
-  <th>&nbsp;</th>
+  <th></th>
   [% FOREACH item_type IN item_types %]
   <th>[% item_type.br_description %]</th>
   [% END %]
@@ -176,7 +177,7 @@ $(function(){
 
 <div id="checkin">
 <h3>Check-in</h3>
-<table class="grid active" width="100%">
+<table class="grid" width="100%">
 <thead>
 <tr>
   <th>&nbsp;</th>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
index 9174247..8ce9744 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
@@ -171,7 +171,7 @@ Item Types Administration
       </li>
   [% END %]
       <li>
-          <label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" />      </li>
+          <label for="description">Description</label><input type="text" id="description" name="description" size="48" maxlength="80" value="[% description |html %]" />      </li>
      [% IF ( noItemTypeImages ) %]
 	 <li><span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&amp;searchfield=noItemTypeImages">noItemTypeImages system preference</a></li></ol>
 	 [% ELSE %]</ol>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt
index 154aea5..a65297b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt
@@ -181,7 +181,7 @@
 [% ELSE %]
 <tr>
 [% END %]
-    <td><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&amp;tagfield=[% loo.tagfield %]&amp;frameworkcode=[% frameworkcode %]#sub[% loo.tagsubfield %]field">[% loo.tagsubfield %]</a></td>
+    <td><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&amp;tagfield=[% loo.tagfield %]&amp;frameworkcode=[% loo.frameworkcode %]#sub[% loo.tagsubfield %]field">[% loo.tagsubfield %]</a></td>
     <td>
         [% IF ( loo.subfield_ignored ) %]
             <i>[% loo.liblibrarian %]</i>
@@ -206,8 +206,8 @@
             [% IF ( loo.link ) %] | Link:[% loo.link %],[% END %]
         [% END %]
     </td>
-    <td><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&amp;tagfield=[% loo.tagfield %]&amp;frameworkcode=[% frameworkcode %]#sub[% loo.tagsubfield %]field">Edit</a></td>
-    <td><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=delete_confirm&amp;tagfield=[% loo.tagfield %]&amp;tagsubfield=[% loo.tagsubfield %]&amp;frameworkcode=[% frameworkcode %]">Delete</a></td>
+    <td><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&amp;tagfield=[% loo.tagfield %]&amp;frameworkcode=[% loo.frameworkcode %]#sub[% loo.tagsubfield %]field">Edit</a></td>
+    <td><a class="" href="[% loo.delete %]">Delete</a></td>
 </tr>
 [% END %]
 </table>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref
index a2ecc5c..09b696a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref
@@ -95,3 +95,14 @@ Administration:
         -
             - The CAS Authentication Server can be found at
             - pref: casServerUrl           
+            
+    Search My Library Only:
+        -
+            - pref: searchMyLibraryOnly
+              default: 1
+              choices:
+                  yes: Use
+                  no: "Don't use"
+            - Filter Data based on Library.
+  
+            
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
index f4be568..7f92cd6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -138,7 +138,7 @@ OPAC:
               type: textarea
               class: code
         -
-            - "Show the following HTML on the left hand column of the main page and patron account on the OPAC (generally navigation links):"
+            - "Show the following HTML on the left hand column of all pages on the OPAC (generally navigation links):"
             - pref: OpacNav
               type: textarea
               class: code
@@ -252,12 +252,6 @@ OPAC:
                   no: Hide
             - reviewer's name above comments in OPAC.
         -
-            - pref: ShowReviewerPhoto
-              choices:
-                  yes: Show
-                  no: Hide
-            - reviewer's photo beside comments in OPAC.
-        -
             - pref: RequestOnOpac
               choices:
                   yes: Allow
@@ -307,16 +301,6 @@ OPAC:
                   no: "Don't allow"
             - patrons to renew their own books on the OPAC.
         -
-            - Use 
-            - pref: OpacRenewalBranch
-              choices:
-                  itemhomebranch: "The Items' home branch"
-                  patronhomebranch: "The Patrons' home branch"
-                  checkoutbranch: "The branch the item was checked out from"
-                  null: "NULL"
-                  opacrenew: "OPACRenew"
-            - as branchcode to store in the statistics table
-        -
             - Only allow patrons to renew their own books on the OPAC if they have less than
             - pref: OPACFineNoRenewals
               class: currency
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
index df0a434..abde94a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref
@@ -36,7 +36,7 @@ Staff Client:
               type: textarea
               class: code
         -
-            - "Show the following HTML to the left of the More menu at the top of each page on the staff client (should be a list of links or blank):"
+            - "Show the following HTML in the More menu at the top of each page on the staff client (should be a list of links or blank):"
             - pref: IntranetNav
               type: textarea
               class: code
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/roadtype.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/roadtype.tt
index 2e6e8a1..b0bad31 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/roadtype.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/roadtype.tt
@@ -81,7 +81,7 @@
 [% END %]
 	<li>			
 		<label for="road_type">Road type: </label>
-	<input  type="text" name="road_type" id="road_type" size="80" maxlength="100" value="[% road_type |html %]" />
+	<input  type="text" name="road_type" id="road_type" size="40" maxlength="80" value="[% road_type |html %]" />
 	</li></ol></fieldset>
 	
 	<fieldset class="action">					  
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt
index ba22e9c..cda1191 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt
@@ -31,7 +31,7 @@ function jumpfull(page)
                     [% IF ( number.highlight ) %]
                         [% number.number %]
                     [% ELSE %]
-                        <a href="auth_finder.pl?startfrom=[% number.startfrom %]&amp;authtypecode=[% authtypecode %][% FOREACH searchdat IN number.searchdata %]&amp;[% searchdat.term %]=[% searchdat.val %][% END %]&amp;op=do_search&amp;type=intranet&amp;index=[% index %]&amp;tagid=[% tagid %]&amp;orderby=[% orderby %]">
+                        <a href="auth_finder.pl?startfrom=[% number.startfrom %]&amp;authtypecode=[% number.authtypecode %][% FOREACH searchdat IN number.searchdata %]&amp;[% searchdat.term %]=[% searchdat.val %][% END %]&amp;op=do_search&amp;type=intranet&amp;index=[% number.index %]&amp;tagid=[% number.tagid %]&amp;orderby=[% number.orderby %]">
                             [% number.number %]</a>
                     [% END %]
                 [% END %]
@@ -72,7 +72,7 @@ function jumpfull(page)
                         <td>
                           [% IF ( resul.repets ) %]
                             [% FOREACH repet IN resul.repets %]
-                              <a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=[% resul.authid %]&amp;index=[% repet.index %]&amp;repet=[% repet.repet %]')" title="[% repet.value %]">[% repet.repet %]</a>
+                              <a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=[% repet.authid %]&amp;index=[% repet.index %]&amp;repet=[% repet.repet %]')" title="[% repet.value %]">[% repet.repet %]</a>
                             [% END %]
                           [% ELSE %]
                             <a href="javascript:jumpfull('blinddetail-biblio-search.pl?authid=[% resul.authid %]&amp;index=[% index %]')">choose</a>
@@ -94,7 +94,7 @@ function jumpfull(page)
                     [% IF ( number.highlight ) %]
                         [% number.number %]
                     [% ELSE %]
-                        <a href="auth_finder.pl?startfrom=[% number.startfrom %]&amp;authtypecode=[% authtypecode %][% FOREACH searchdat IN number.searchdata %]&amp;[% searchdat.term %]=[% searchdat.val %][% END %]&amp;op=do_search&amp;type=intranet&amp;index=[% index %]&amp;tagid=[% tagid %]&amp;orderby=[% orderby %]">
+                        <a href="auth_finder.pl?startfrom=[% number.startfrom %]&amp;authtypecode=[% number.authtypecode %][% FOREACH searchdat IN number.searchdata %]&amp;[% searchdat.term %]=[% searchdat.val %][% END %]&amp;op=do_search&amp;type=intranet&amp;index=[% number.index %]&amp;tagid=[% number.tagid %]&amp;orderby=[% number.orderby %]">
                             [% number.number %]</a>
                     [% END %]
                 [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
index 38b25e2..84504b4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt
@@ -132,7 +132,7 @@ function placeHold () {
             <form action="basket.pl" method="get" name="bookbag_form" id="bookbag_form">
     [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
     <h3>
-        [% IF ( print_basket ) %]
+        [% IF ( BIBLIO_RESULT.print_basket ) %]
             [% BIBLIO_RESULT.title |html %]
                 [% IF ( BIBLIO_RESULT.subtitle ) %] [% BIBLIO_RESULT.subtitle %][% END %]
                 [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author %][% END %]
@@ -301,7 +301,7 @@ function placeHold () {
 </p>
     <table id="itemst">
 	<thead><tr>
-	    [% UNLESS ( print_basket ) %]<th>&nbsp;</th>[% END %]
+	    <th>&nbsp;</th>
 	    <th>Title</th>
 	    <th>Item Type</th>
 	    <th>Location</th>
@@ -313,7 +313,7 @@ function placeHold () {
             [% ELSE %]
                 <tr>
             [% END %]
-            [% UNLESS ( print_basket ) %]<td>
+            [% UNLESS ( BIBLIO_RESULT.print_basket ) %]<td>
                         <input type="checkbox" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked);" />
 
                 </td> [% END %]
@@ -347,9 +347,13 @@ function placeHold () {
     </table></form>
 [% END %]
 
+[% IF ( print_basket ) %]
+<a href="#back" class="screen">&lt;&lt; Back to Cart</a>
+[% ELSE %]
 <form name="myform" action="basket/basket.pl" method="get">
     <input type="hidden" name="records" id="records" />
 </form>
+[% END %]
 
 </div>
 </div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt
index 7e6b5ad..bfa5179 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt
@@ -43,8 +43,8 @@
 
 [% IF ( outer_servers_loop ) %]
 <!-- REMOTE DATABASES -->
-<fieldset id="databases">
-    <legend>Select remote databases</legend>
+<fieldset>
+    <legend>Select remote databases:</legend>
                 [% FOREACH outer_servers_loo IN outer_servers_loop %]
                 [% IF ( outer_servers_loo.checked ) %]<input type="checkbox" id="[% outer_servers_loo.id %]" name="[% outer_servers_loo.name %]" checked="checked" value="[% outer_servers_loo.value %]" />[% ELSE %]<input type="checkbox" id="[% outer_servers_loo.id %]" name="[% outer_servers_loo.name %]" value="[% outer_servers_loo.value %]" />[% END %]
 <label for="[% outer_servers_loo.id %]"><img alt="[% outer_servers_loo.id %]" src="[% themelang %]/images/[% outer_servers_loo.icon %]" />[% outer_servers_loo.label %]</label>
@@ -54,8 +54,8 @@
 [% END %]
 
 <!-- BOOLEAN SEARCH OPTIONS -->
-    <fieldset id="searchterms">
-    <legend>Search For </legend>
+    <fieldset>
+    <legend>Search For: </legend>
     [% FOREACH search_box IN search_boxes_loop %]
         [% IF ( search_boxes_label ) %]<div style="text-indent: 4.5em;">[% ELSE %]<div>[% END %]
 			[% IF ( expanded_options ) %]
@@ -74,7 +74,7 @@
                     <a href="JavaScript:add_field();" id="ButtonPlus" title="Add another field">[+]</a>
 				[% END %]
               [% IF ( search_box.scan_index ) %]
-                <label for="scan">Scan Indexes</label> <input type="checkbox" name="scan" id="scan" value="1" />
+                <label for="scan">Scan Indexes</label><input type="checkbox" name="scan" id="scan" value="1" />
               [% END %]
             [% END %]
 		</div>
@@ -83,19 +83,20 @@
 <!-- /BOOLEAN SEARCH OPTIONS -->
 
 <!-- SEARCH BUTTONS -->
-            <fieldset class="action" id="submit1"><input class="submit" type="submit" accesskey="s" value="Search" />
+            <p><input class="submit" type="submit" accesskey="s" value="Search" />
             [% IF ( expanded_options ) %]
             <a href="/cgi-bin/koha/catalogue/search.pl?expanded_options=0">[Fewer Options]</a>
             [% ELSE %]
             <a href="/cgi-bin/koha/catalogue/search.pl?expanded_options=1">[More options]</a>
             [% END %]
             <a href="/cgi-bin/koha/catalogue/search.pl?do=Clear">[New search]</a>
-            </fieldset>
+            </p>
 <!-- /SEARCH BUTTONS -->
 
+    <div id="itemtypelist">
 <!-- ITEMTYPE LIMITS -->
-	<fieldset id="itemtypelist">
-     <legend>Limit to any of the following</legend>
+	<fieldset>
+     <legend>Limit to any of the following:</legend>
     <table>
         <tr>
       [% FOREACH itemtypeloo IN itemtypeloop %]
@@ -112,21 +113,23 @@
     </table>
 	</fieldset>
 <!-- /ITEMTYPE LIMITS -->
+    </div>
 
 [% IF ( expanded_options ) %]
+<div id="basiclimits" class="container">
 <!-- BASIC LIMITS -->
- <fieldset id="basiclimits">
-	<legend>Limits</legend>
-<fieldset id="pubrange">
+ <fieldset>
+	<legend>Limits:</legend>
+<div id="pubrange" class="container">
 <!-- PUB / COPY YEAR LIMIT --><!-- FIXME: add publication,copyright,acquisition options -->
 	<p><label for="limit-yr">Year: </label>
-		<input type="text" size="15" name="limit-yr" id="limit-yr" value=""/>&nbsp;&nbsp;(format: yyyy-yyyy)</p>
+		<input type="text" size="15" name="limit-yr" id="" value=""/>&nbsp;&nbsp;(format: yyyy-yyyy)</p>
 <!-- /PUB / COPY YEAR LIMIT -->
-</fieldset>
-<fieldset id="language">
+</div>
+<div id="language" class="container">
 <!-- LANGUAGE LIMIT -->
 		<p><label for="language-limit">Language: </label>                                        
-		<select name="limit" id="language-limit">
+		<select name="limit">
 		<option value="">No Limit</option>
 		[% FOREACH search_languages_loo IN search_languages_loop %]
 		[% IF ( search_languages_loo.selected ) %]
@@ -138,18 +141,20 @@
 		[% END %]
 		</select></p><!-- <a href="">Show all languages</a>-->
 <!-- /LANGUAGE LIMIT -->
-</fieldset>
+</div>
 </fieldset>
 <!-- /BASIC LIMITS -->
+</div>
 [% END %]
 
 
 [% IF ( UNIMARC ) %]
 [% INCLUDE 'subtypes_unimarc.inc' %]
 [% ELSE %]
+<div id="subtype" class="container">
 <!-- SUBTYPE LIMITS -->
-        <fieldset id="subtype">
-        <legend>Subtype limits</legend><p>
+        <fieldset>
+        <legend>Subtype limits:</legend><p>
         
         <select name="limit" class="subtype">
             <option value="" selected="selected" class="menuheader">Any audience</option>
@@ -215,16 +220,66 @@
        </p>
 
 </fieldset>
+</div>
 [% END %]
 
-<!-- AVAILABILITY LIMITS -->
-    <fieldset id="availability"><legend>Location and availability</legend>
-<fieldset id="currently-avail">
-        <p><label for="available-items">Only items currently available</label> <input type="checkbox" id="available-items" name="limit" value="available" /></p>
+[% IF ( template_defined_limits ) %]
+<div id="advsearch-itemtype" class="container">
+<!-- TYPE LIMITS -->
+    <fieldset>
+
+    <legend>Limit to any of the following</legend>
+    <table class="itemtypes">
+            <tr>
+            <td><input type="checkbox" id="mc-bks" name="limit" value="mc:t" />
+			<label for="mc-bks" title="Books, Pamphlets, Technical reports, Manuscripts, Legal papers, Theses and dissertations">
+			<img border="0" src="/intranet-tmpl/prog/img/AF.gif" alt="Books" />Books</label></td>
+			<td><input type="checkbox" id="mc-vis" name="limit" value="mc:v" />
+			<label for="mc-vis" title="Motion pictures, Videorecordings, Filmstrips, Slides, Transparencies, Photos, Cards, Charts, Drawings">
+			<img border="0" src="/intranet-tmpl/prog/en/images/AV Aids.gif" alt="Visual Materials" />Visual Materials</label></td>
+            <td><input type="checkbox" id="mc-sr" name="limit" value="mc-rtype:i" />
+			<label for="mc-sr" title="Spoken, Books on CD and Cassette">
+			<img border="0" src="/intranet-tmpl/prog/en/images/AF.gif" alt="Books on Tape" />Books on Tape</label></td>
+            </tr>
+
+            <tr>
+            <td><input type="checkbox" id="mc-cf" name="limit" value="mc:c" />
+			<label for="mc-cf" title="Computer files, Data, Software">
+			<img border="0" src="/intranet-tmpl/prog/en/images/CD-ROM software.gif" alt="Computer Files" />Computer Files</label></td>
+            <td><input type="checkbox" id="mc-lh" name="limit" value="mc-collection:LH" />
+			<label for="mc-lh" title="Local History Materials">
+			<img border="0" src="/intranet-tmpl/prog/en/images/Local history.gif" alt="Local History Materials" />Local History Materials</label></td>
+            <td><input type="checkbox" id="mc-map" name="limit" value="mc:a" />
+			<label for="mc-map" title="Maps, Globes">
+			<img border="0" src="/intranet-tmpl/prog/en/images/PF.gif " alt="Maps" />Maps</label></td>
+            </tr>
+
+            <tr>
+            <td><input type="checkbox" id="mc-mus" name="limit" value="mc-rtype:j" />
+			<label for="mc-mus" title="Music">
+			<img border="0" src="/intranet-tmpl/prog/en/images/CDM.gif" alt="Music" />Music</label></td>
+            <td><input type="checkbox" id="mc-kit" name="limit" value="mc-rtype:o" />
+			<label for="mc-kit" title="Kits"><img border="0" src="/intranet-tmpl/prog/en/images/KIT.gif" alt="Kits" />Kits</label></td>
+            <td><input type="checkbox" id="mc-ref" name="limit" value="mc-collection:REF" />
+			<label for="mc-ref" title="Reference">
+			<img border="0" src="/intranet-tmpl/prog/en/images/REF.gif" alt="Reference" />Reference</label></td>
+            </tr>
+            
+            </table>
 </fieldset>
+</div>
+[% END %]
+<!-- /TYPE LIMITS -->
 
-<fieldset id="select-libs">
-        <p><label for="branchloop">Individual Libraries:</label><select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'>
+<div id="availability" class="container">
+<!-- AVAILABILITY LIMITS -->
+    <fieldset><legend>Location and availability: </legend>
+<div id="currently-avail" class="container">
+        <label for="available-items">Only items currently available</label> <input type="checkbox" id="available-items" name="limit" value="available" />
+</div>
+<p />
+<div id="select-libs" class="container">
+        <label for="branchloop">Individual Libraries:</label><select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'>
         <option value="">All Libraries</option>
         [% FOREACH branchloo IN branchloop %]
         [% IF ( branchloo.selected ) %]
@@ -233,42 +288,47 @@
         <option value="branch:[% branchloo.value %]">[% branchloo.branchname %]</option>
         [% END %]
         [% END %]
-        </select></p>
+        </select>
     <!-- <input type="hidden" name="limit" value="branch: MAIN" /> -->
         [% IF ( searchdomainloop ) %]
     <p>OR</p> <!-- should addjs to grey out group pulldown if a library is selected. -->
-        <p><label for="categoryloop">Groups of Libraries</label><select name="multibranchlimit" id="categoryloop">
+        <label for="categoryloop">Groups of Libraries</label><select name="multibranchlimit" id="categoryloop">
         <option value=""> -- none -- </option>
         [% FOREACH searchdomainloo IN searchdomainloop %]
         <option value="[% searchdomainloo.categorycode %]">[% searchdomainloo.categoryname %]</option>
         [% END %]
-        </select></p>
+        </select>
     [% END %]
-</fieldset>
+</div>
     </fieldset>
 <!-- /AVAILABILITY LIMITS -->
+</div>
 
 <!-- RANK LIMITS -->
-<fieldset id="sortby"><legend>Sorting</legend>
-    <p>
-    <label for="sort_by">Sort by </label><select id="sort_by" name="sort_by">
+
+<div id="sortby" class="container">
+<fieldset><legend>Sort by: </legend>
+    <p><select id="sort_by" name="sort_by">
   [% INCLUDE 'resort_form.inc' %]
     </select>
         </p>
 </fieldset>
-<!-- /RANK LIMITS -->
+</div>
+<!-- RANK LIMITS -->
+
+</div>
+
 
 <!-- SEARCH BUTTONS -->
-            <fieldset class="action" id="submit2"><input class="submit" type="submit" accesskey="s" value="Search" />
+            <p><input class="submit" type="submit" accesskey="s" value="Search" />
             [% IF ( expanded_options ) %]
             <a href="/cgi-bin/koha/catalogue/search.pl?expanded_options=0">[Fewer Options]</a>
             [% ELSE %]
             <a href="/cgi-bin/koha/catalogue/search.pl?expanded_options=1">[More options]</a>
             [% END %]
             <a href="/cgi-bin/koha/catalogue/search.pl?do=Clear">[New search]</a> 
-            </fieldset>
+            </p>
 <!-- /SEARCH BUTTONS -->
-</div>
 </form>
 </div>
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
index 2ea7091..a019733 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -138,14 +138,14 @@ function verify_images() {
                 [% IF ( pages ) %] [% END %][% pages %] [% IF ( illus ) %][% illus %][% END %]
                 [% IF ( size ) %][% size %][% END %]
         </li>
-[% IF ( MARCURLS ) %]<li>
+[% IF ( MARCurlS ) %]<li>
     
 	<strong>Online Resources:</strong>
-    <ul>    [% FOREACH MARCurl IN MARCURLS %]
+    <ul>    [% FOREACH MARCurl IN MARCurlS %]
 		<li>[% IF ( MARCurl.part ) %][% MARCurl.part %]
 			<br />[% END %] 
 		<!-- here you might do a tmpl_if name="toc" and use greybox or equivalent for table of contents -->
-		<a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]">[% MARCurl.linktext %]</a>
+		<a href="[% MARCurl.MARCurl %]" title="[% MARCurl.MARCurl %]">[% MARCurl.linktext %]</a>
 			[% IF ( MARCurl.notes ) %]<ul>[% FOREACH note IN MARCurl.notes %]<li>[% note.note %]</li>[% END %]</ul>[% END %]</li>
             [% END %]</ul>
 </li>
@@ -273,7 +273,7 @@ function verify_images() {
 						<span class="datedue">Checked out
                     [% UNLESS ( itemloo.NOTSAMEBRANCH ) %]
                           to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.borrowernumber %]">
-			  [% IF ( itemloo.hidepatronname ) %]
+			  [% IF ( hidepatronname ) %]
 			      [% itemloo.cardnumber %]
 			  [% ELSE %]
 			      [% itemloo.firstname %] [% itemloo.surname %]
@@ -355,7 +355,7 @@ function verify_images() {
                     </td>
                     <td class="datelastseen">[% itemloo.datelastseen %]</td>
                     <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?type=[% itemloo.type %]&amp;itemnumber=[% itemloo.itemnumber %]&amp;biblionumber=[% itemloo.biblionumber %]&amp;bi=[% itemloo.biblioitemnumber %]#item[% itemloo.itemnumber %]">[% itemloo.barcode %]</a></td>
-				[% IF ( volinfo ) %]	<td class="enumchron">
+				[% IF ( itemloo.volinfo ) %]	<td class="enumchron">
 					[% IF ( itemdata_enumchron ) %]
 						[% IF ( itemloo.enumchron ) %]
 						[% itemloo.enumchron %][% IF ( itemloo.serialseq ) %] -- [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt
index bc2490f..d4443f0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt
@@ -33,7 +33,8 @@
             </tr></thead>
             <tbody>
         [% FOREACH issue IN issues %]
-        [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
+        [% UNLESS ( loop.odd ) %]<tr class="highlight"><!-- TMPL_ELSE
+--><tr>[% END %]
                 <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% issue.borrowernumber %]">[% issue.surname %][% IF ( issue.firstname ) %], [% issue.firstname %][% END %]</a></td>
                 <td>[% IF ( issue.barcode ) %]
                         <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% issue.biblionumber %]&amp;itemnumber=[% issue.itemnumber %]">[% issue.barcode %]</a>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
index e1f84b8..11f2cf4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
@@ -412,13 +412,13 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                 <table>
                     <tr>
                         [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]<th>&nbsp;</th>[% END %][% END %]
-                        <th colspan="2">Results</th>
+                        <th>Results</th>
                         <th>Location</th>
                     </tr>
                         <!-- Actual Search Results -->
                         [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
                          [% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
-                            [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]
+                            [% IF ( SEARCH_RESULT.AmazonEnabled ) %][% IF ( SEARCH_RESULT.AmazonCoverImages ) %]
                                 <td>
                                     <a class="p1" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
 									
@@ -429,7 +429,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                                 <input type="checkbox" class="selection" id="bib[% SEARCH_RESULT.biblionumber %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber %]" style="display:none" />
                             </td>
                             <td>
-                                <p>[% SEARCH_RESULT.result_number %].
+                                <p><!--[% SEARCH_RESULT.result_number %]-->
                                  [% biblionumber = SEARCH_RESULT.biblionumber %]
 
 				[% INCLUDE 'biblio-default-view.inc' %]
@@ -505,20 +505,22 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
 
                                     [% IF ( SEARCH_RESULT.availablecount ) %]
                                     [% SEARCH_RESULT.availablecount %] available:
-                                    <ul>
+                                    <!-- <ul>
                                     [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %]
 
                                         [% IF ( noItemTypeImages ) %]<li>[% ELSE %][% IF ( item_level_itypes ) %][% IF ( available_items_loo.imageurl ) %]<li style="list-style: none; list-style-type: none;"><img src="[% available_items_loo.imageurl %]" title="[% available_items_loo.description %]" alt="[% available_items_loo.description %]" />[% ELSE %]<li>[% END %][% ELSE %]<li>[% END %][% END %]
-                                        [% IF ( available_items_loo.branchname ) %][% available_items_loo.branchname %][% END %]
+                                       [% IF ( available_items_loo.branchname ) %][% available_items_loo.branchname %][% END %]
                                         [% IF ( available_items_loo.location ) %][% available_items_loo.location %][% END %]
                                         [% IF ( available_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=[% available_items_loo.itemcallnumber |url %]">[% available_items_loo.itemcallnumber %]</a>][% END %]
                                         ([% available_items_loo.count %])</li>
-                                    [% END %]</ul>
+                                        
+                                        
+                                    [% END %]</ul> -->
                                     [% END %]
 
                                    [% IF ( SEARCH_RESULT.onloancount ) %]
                                    <span class="status">[% SEARCH_RESULT.onloancount %] on loan:</span>
-                                    <ul>
+                                   <!-- <ul>
                                     [% FOREACH onloan_items_loo IN SEARCH_RESULT.onloan_items_loop %]
                                        [% IF ( noItemTypeImages ) %]<li>[% ELSE %][% IF ( item_level_itypes ) %]
                                         [% IF ( onloan_items_loo.imageurl ) %]
@@ -530,7 +532,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                                         [% IF ( onloan_items_loo.location ) %][% onloan_items_loo.location %][% END %]
                                         [% IF ( onloan_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=[% onloan_items_loo.itemcallnumber |url %]">[% onloan_items_loo.itemcallnumber %]</a>][% END %]
                                         ([% onloan_items_loo.count %][% IF ( onloan_items_loo.longoverdue ) %], [% onloan_items_loo.longoverdue %] long overdue[% END %]) date due: [% onloan_items_loo.due_date %]</li>
-                                    [% END %]</ul>
+                                    [% END %]</ul> -->
                                     [% END %]
 
                                     [% IF ( SEARCH_RESULT.othercount ) %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
index 0a73ace..fa0c5e8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
@@ -142,7 +142,7 @@ function AreMandatoriesNotOk(){
         	[% END %]
     		[% FOREACH subfield_loo IN innerloo.subfield_loop %]
     			[% IF ( subfield_loo.mandatory ) %]mandatories.push("[% subfield_loo.id %]");
-                   	tab.push("[% BIG_LOO.number %]");
+                   	tab.push("[% subfield_loo.number %]");
                    	label.push("[% subfield_loo.marc_lib %]");
                 [% END %]
             [% END %]
@@ -255,7 +255,7 @@ function GetZ3950Terms(){
 
 function Changefwk(FwkList) {
 	var fwk = FwkList.options[FwkList.selectedIndex].value;
-	window.location = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumberdata %]&op=[% op %]&breedingid=[% breedingid %]&mode=[% popup %]&frameworkcode="+fwk;
+ 	window.location = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&breedingid=[% breedingid %]&frameworkcode="+fwk;
 
 }
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt
index 553d130..4956f18 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt
@@ -27,16 +27,11 @@
 [% ELSIF ( BiblioDefaultViewisbd ) %]
 	<form action="/cgi-bin/koha/catalogue/ISBDdetail.pl" method="post">
 [% ELSE %]
-	<form method="link" action="/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblionumber %]"/>
-[% END %]
-	    <input type="submit" class="attachanother" value="Attach Another Item"/>
-	    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
-	</form>
 	<form action="/cgi-bin/koha/catalogue/detail.pl" method="post">
+[% END %]
 	    <input type="submit"  class="approve" value="OK" />
 	    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
-	</form>
-</div>
+	</form></div>
 
     [% ELSE %]
 	[% IF ( missingparameter ) %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt
index 5adc074..1ee7823 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt
@@ -40,7 +40,6 @@ $(document).ready(function(){
         /* Inline edit/delete links */
         $("td").click(function(event){
             var $tgt = $(event.target);
-            var row = $(this).parent();
             $(".linktools").hide();
             $("tr").removeClass("selected");
             if($tgt.is("a")||$tgt.is(":nth-child(7)")||$tgt.is(":nth-child(8)")||$tgt.is(":nth-child(9)")||$tgt.is(":nth-child(10)")){
@@ -51,6 +50,7 @@ $(document).ready(function(){
                 var left = position.left+5;
                 $(".linktools",row).show().css("position","absolute").css("top",top).css("left",left);
             }
+            var row = $(this).parent();
             row.addClass("selected");
         });
     $("form[name='f']").submit(function(){
@@ -160,7 +160,6 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
         [% END %]
     [% END %]</tbody>
 </table>
-<p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_search.pl"><input type="hidden" name="biblionumber" value="[% biblionumber %]"/><input type="hidden" name="frameworkcode" value="[% frameworkcode %]"/><input type="submit" value="Try Another Search"/></form></p>
     [% ELSE %]
         [% IF ( emptyserverlist ) %]
             You didn't select any Z39.50 target.
@@ -169,8 +168,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
                 Connection failed to [% errcon.server %]
             [% END %]
         [% END %]
-	<p>Nothing found.</p>
-	<p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_search.pl"><input type="hidden" name="biblionumber" value="[% biblionumber %]"/><input type="hidden" name="frameworkcode" value="[% frameworkcode %]"/><input type="submit" value="Try Another Search"/></form></p>
+	<p>Nothing found. <a href="/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber %]">Try another search</a>.</p>
     [% END %]
 
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt
index 43ef0c9..f22e407 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/bookcount.tt
@@ -49,7 +49,7 @@ $(document).ready(function(){
             <td>[% IF ( branchloo.seen ) %]
                     <span style="display:none;">[% branchloo.seen %][% branchloo.seentime %]</span>
                     <!-- invisible span for eventual use by tablesorter -->
-                    [% branchloo.seen %] [% branchloo.seentime %]
+                    [% DEFAULT branchloo.seentime="??:??" %] [% branchloo.seen %] 
                 [% ELSE %]Never
                 [% END %]
             </td>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt
index 2383599..6c2f69a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt
@@ -38,9 +38,9 @@
 	<li>    <a href="/cgi-bin/koha/circ/waitingreserves.pl" title="holds waiting for patron pickup">Holds awaiting pickup</a></li>
 	<li>    <a href="/cgi-bin/koha/circ/reserveratios.pl">Hold ratios</a></li>
 	<li>    <a href="/cgi-bin/koha/circ/transferstoreceive.pl" title="transfers to receive at your library">Transfers to receive</a></li>
-	[% IF ( CAN_user_reports_execute_reports ) %]<li>    <a href="/cgi-bin/koha/circ/overdue.pl">Overdues</a>
+	<li>    <a href="/cgi-bin/koha/circ/overdue.pl">Overdues</a>
 	- <b>Warning:</b> This report is very resource intensive on
-	systems with large numbers of overdue items.</li>[% END %]
+	systems with large numbers of overdue items.</li>
 	<li>    <a href="/cgi-bin/koha/circ/branchoverdues.pl">Overdues with fines</a> - Limited to your library.  See report help for other details.</li>
 <!--	<li>    <a href="/cgi-bin/koha/circ/billing.pl">Billing</a></li> -->
 <!--	<li>    <a href="/cgi-bin/koha/circ/stats.pl?time=yesterday">Daily reconciliation</a></li> -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index cb03d89..afa6ec5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -207,7 +207,7 @@ function refocus(calendar) {
                 <select name="type" id="type" onchange="this.form.borrower_message.value=this.options[this.selectedIndex].value;">
                     <option value="">Select Note</option>
                     [% FOREACH canned_bor_notes_loo IN canned_bor_notes_loop %]
-                    <option value="[% canned_bor_notes_loo.lib %]">[% canned_bor_notes_loo.lib %]</option>
+                    <option value="[% canned_bor_notes_loo.lib %]">[% canned_bor_notes_loo.authorised_value %]</option>
                     [% END %]
                 </select>
         </li>
@@ -554,7 +554,7 @@ No patron matched <span class="ex">[% message %]</span>
 
 			[% IF ( expired ) %]
 			<li><span class="circ-hlt">Expiration:</span> Patron's card has expired.
-			[% IF ( expiry ) %]Patron's card expired on [% expiry %][% END %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;cardnumber=[% cardnumber %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">Edit Details</a>
+			Patron's card expired on [% expiry %] <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% borrowernumber %]&amp;cardnumber=[% cardnumber %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">Edit Details</a>
 
 			</li>
 			[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
index c511b1c..9f4ec8d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
@@ -118,7 +118,7 @@
         <td>[% overdueloo.duedate %]</td>
         <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% overdueloo.borrowernumber %]">[% overdueloo.name %]</a>
         [% IF ( overdueloo.email ) %][<a href="mailto:[% overdueloo.email %]?subject=Overdue: [% overdueloo.title |html %]">email</a>][% END %]
-        [% IF ( overdueloo.phone ) %]([% overdueloo.phone %])[% ELSIF ( overdueloo.mobile ) %]([% overdueloo.mobile %])[% ELSIF ( overdueloo.phonepro ) %]([% overdueloo.phonepro %])[% END %]</td>
+        ([% IF ( overdueloo.phone ) %][% overdueloo.phone %][% ELSIF ( overdueloo.mobile ) %][% overdueloo.mobile %][% ELSIF ( overdueloo.phonepro ) %][% overdueloo.phonepro %][% END %])</td>
         <td>[% overdueloo.branchcode %]</td>
         <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overdueloo.biblionumber %][% overdueloo.title |html %]  [% overdueloo.subtitle %]</a> [% IF ( overdueloo.author ) %], by [% overdueloo.author %][% END %]
         </td>
@@ -137,11 +137,12 @@
 <form method="post" action="/cgi-bin/koha/circ/overdue.pl">
   <fieldset class="brief">
 <h4>Filter On:</h4>
-	<fieldset><legend>Date due:</legend>
 	<ol>
-    <li><label for="dateduefrom">From:</label>
-	<input type="text" id="dateduefrom" name="dateduefrom" size="10" value="[% dateduefrom %]" />
+    <li style="border: dashed; border-width:1px;">Date due:
+	<label for="dateduefrom">From:
 	<img src="[% themelang %]/lib/calendar/cal.gif" id="dateduefrom_button" alt="Show Calendar" />
+	</label>
+	<input type="text" id="dateduefrom" name="dateduefrom" size="20" value="[% dateduefrom %]" />
 	<script language="JavaScript" type="text/javascript">
 	    Calendar.setup(
 	    {
@@ -151,11 +152,11 @@
 	    }
 	    );
 	</script>
-	</li>
-	<li>
-	<label for="datedueto">To:</label>
-	<input type="text" id="datedueto" name="datedueto" size="10" value="[% datedueto %]" />
+
+	<label for="datedueto">To:
 	<img src="[% themelang %]/lib/calendar/cal.gif" id="datedueto_button" alt="Show Calendar" />
+	</label>
+	<input type="text" id="datedueto" name="datedueto" size="20" value="[% datedueto %]" />
 	<script language="JavaScript" type="text/javascript">
 	    Calendar.setup(
 	    {
@@ -166,8 +167,6 @@
 	    );
 	</script>
     </li>
-    </ol></fieldset>
-    <ol>
     <li><label>Name or cardnumber:</label><input type="text" name="borname" value="[% borname |html %]" /></li>
     <li><label>Patron category:</label><select name="borcat" id="borcat"><option value="">Any</option>
       [% FOREACH borcatloo IN borcatloop %]
@@ -179,7 +178,7 @@
         <select name="borflag" size="1" id="borflag">
             <option value="">None</option>
             <option value="gonenoaddress"[% IF ( borflag_gonenoaddress ) %] selected="selected"[% END %]>Address in question</option>
-            <option value="debarred"[% IF ( borflag_debarred ) %] selected="selected"[% END %]>Restricted</option>
+            <option value="debarred"[% IF ( borflag_debarred ) %] selected="selected"[% END %]>Debarred</option>
             <option value="lost"[% IF ( borflag_lost ) %] selected="selected"[% END %]>Lost Card</option>
         </select>
     </li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
index c02be49..620f770 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
@@ -396,7 +396,7 @@ function Dopop(link) {
 [% IF ( riloop ) %]
     <h2>Checked-In items</h2>
     <table>
-	<tr><th>Due Date</th><th>Title</th>	<th>Author</th>	<th>Barcode</th><th>Shelving Location</th><th>Call Number</th><th>Type</th>	<th>Patron</th><th>Note</th></tr>
+	<tr><th>Due Date</th><th>Title</th>	<th>Author</th>	<th>Barcode</th><th>Call Number</th><th>Type</th>	<th>Patron</th><th>Note</th></tr>
 
         [% FOREACH riloo IN riloop %]
             <tr>
@@ -412,7 +412,6 @@ function Dopop(link) {
                     [% riloo.itemtitle |html %]</a></td>
 			<td>[% riloo.itemauthor %]</td>
             <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% riloo.itembiblionumber %]&amp;itemnumber=[% riloo.itemnumber %]#item[% riloo.itemnumber %]">[% riloo.barcode %]</a></td>
-            <td>[% riloo.location %]</td>
             <td>[% riloo.itemcallnumber %]</td>
             <td>[% riloo.itemtype %] [% riloo.ccode %]</td>
 			<td>[% IF ( riloo.duedate ) %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/moremember.tt
index 9384e6f..d0ead07 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/moremember.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/moremember.tt
@@ -63,7 +63,7 @@ In the case of patrons who are marked as 'Child' or 'Professional' and their Gua
 	<li>Patrons can also be blocked from checking items out by setting Patron Flags
 <ul>
 	<li>If you would like your circulation staff to confirm a patron's address before checking items out to the patron, you can see the 'Gone no Address' flag</li>
-	<li>If you would like to prevent a patron from checking items out or performing circulation actions at the library you can set the 'Restricted' flag
+	<li>If you would like to bar a patron from the library you can set the 'Debarred' flag
 <ul>
 	<li>This flag can automatically be set with the Overdue/Notice Status Triggers</li>
 </ul>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/overduerules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/overduerules.tt
index 7b7704b..630ef0c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/overduerules.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/tools/overduerules.tt
@@ -12,9 +12,9 @@
 
 <ul><li>Delay is the number of days after an issue is due before an action is triggered.</li>
 <ul><li style="color:#990000;"><strong>Important: These rules should not be used for Advanced Notices.  Advanced Notices should be set using the Enhanched Messaging Preferences on the Patron Profile.</strong></li>
-<li style="color:#990000;"><strong>Important: If you want Koha to trigger an action (send a letter or restrict a member), a delay value is required.</strong></li></ul>
+<li style="color:#990000;"><strong>Important: If you want Koha to trigger an action (send a letter or debar member), a delay value is required.</strong></li></ul>
 <li>To send additional notices, click on the tabs for 'Second' and 'Third' notice</li>
-<li>If you would like to prevent a patron from checking items out because of their overdue items, check the 'Restrict' box, this will put a notice on the patron's record at checkout informing the librarian that the patron cannot check out due to overdue items.</li></ul>
+<li>If you would like to prevent a patron from checking items out because of their overdue items, check the 'Debar' box, this will put a notice on the patron's record at checkout informing the librarian that the patron cannot check out due to overdue items.</li></ul>
 
 <p>If the numbers you've entered in a give row beneath the 'delay' columns are logically inconsistent, Koha will give you an alert, and explain the inconsistency.</p>
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt
index 4513a25..16bbf25 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt
@@ -93,7 +93,7 @@
                         <td align="center"><input type="checkbox" name="action" value="[% text_field.field_value %]"></td>
                     [% ELSIF ( text_field.link_field ) %]
                         <td align="center">
-			    <a onclick="add_item('[% text_field.field_value %]',[% batch_id %], '[% text_field.type %]'); return false" href="/cgi-bin/koha/barcodes/label-edit-batch.pl?op=add&amp;batch_id=[% batch_id %]&amp;item_number=[% text_field.field_value %]">Add</a>
+			    <a onclick="add_item('[% text_field.field_value %]',[% text_field.batch_id %], '[% text_field.type %]'); return false" href="/cgi-bin/koha/barcodes/label-edit-batch.pl?op=add&amp;batch_id=[% text_field.batch_id %]&amp;item_number=[% text_field.field_value %]">Add</a>
                         </td>
                     [% ELSE %]
                         <td align="center">[% text_field.field_value %]</td>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt
index 85b1d3e..9965362 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt
@@ -65,7 +65,7 @@
 							<td>[% resultsloo.branchcode %]</td>
 							<td>[% resultsloo.dateexpiry %]</td>
 							<td>[% IF ( resultsloo.overdues ) %]<span class="overdue"><strong>[% resultsloo.overdues %]</strong></span>[% ELSE %][% resultsloo.overdues %][% END %]/[% resultsloo.issues %]</td>
-							<td>[% IF ( resultsloo.fines < 0 ) %]<span class="credit">[% resultsloo.fines %]</span> [% ELSIF resultsloo.fines > 0 %] <span class="debit"><strong>[% resultsloo.fines %]</strong></span> [% ELSE %] [% resultsloo.fines %] [% END %]</td>
+							<td>[% resultsloo.fines %]</td>
 							<td>[% resultsloo.borrowernotes %]</td>
 							<td>[% IF ( resultsloo.category_type ) %]
 									<a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% resultsloo.borrowernumber %]&amp;category_type=[% resultsloo.category_type %]">Edit</a>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
index f96c27f..a4361cd 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -162,18 +162,7 @@
 <input type="hidden" name="borrowernumber" value="[% IF ( opduplicate ) %][% ELSE %][% borrowernumber %][% END %]" />
 <input type="hidden" name="nodouble"  value="[% IF ( opduplicate ) %][% ELSE %][% nodouble %][% END %]" />
 [% IF ( step ) %]<input type="hidden" name="step"  value="[% step %]" />[% END %]
-[% IF ( opadd ) %]<input type="hidden" name="op" value="insert" />
-[% ELSIF ( opduplicate ) %]
-<input type="hidden" name="op" value="insert" />
-[% ELSE %]
-<input type="hidden" name="op" value="save" />
-[% IF step == 4 || step == 5 || step == 6 || step == 2 || step == 1 %]
-[%# Only put the cardnumber if we arent showing it in the form later %]
-[% IF cardnumber %]
-<input type="hidden" name="cardnumber" value="[% cardnumber %]">
-[% END %]
-[% END %]
-[% END %]
+[% IF ( opadd ) %]<input type="hidden" name="op" value="insert" />[% ELSIF ( opduplicate ) %]<input type="hidden" name="op" value="insert" />[% ELSE %]<input type="hidden" name="op" value="save" />[% END %]
 
 [% IF ( step_1 ) %]
 	<fieldset class="rows" id="memberentry_identity">
@@ -958,7 +947,7 @@
 			[% FOREACH flagloo IN flagloop %]
 				<li><label class="radio" for="yes[% flagloo.name %]">
 				[% IF ( flagloo.key == 'gonenoaddress' ) %]Gone no Address:[% END %]
-				[% IF ( flagloo.key == 'debarred' ) %]Restricted:[% END %]
+				[% IF ( flagloo.key == 'debarred' ) %]Debarred:[% END %]
 				[% IF ( flagloo.key == 'lost' ) %]Lost Card:[% END %]
                 </label>
 				<label for="yes[% flagloo.name %]">Yes </label>
@@ -1083,9 +1072,6 @@
     [% END %]
     <input type="hidden" name="setting_messaging_prefs" value="1" />
     <legend>Patron messaging preferences</legend>
-    [% IF type_only %]
-        <i>If no preferences are selected, the default preferences for the category chosen will be applied on save, otherwise your selection here is saved</i>
-    [% END %]
     [% INCLUDE 'messaging-preference-form.inc' %]
     [% IF ( SMSSendDriver ) %]
         <p><label for="SMSnumber">SMS number:</label> 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt
index 87c7a1d..9ad6dbd 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-brief.tt
@@ -48,7 +48,7 @@
     [% END %]
     <li><span class="label">Initials: </span>[% initials %]</li>
     <li><span class="label">Date of birth:</span>[% dateofbirth %]</li>
-    <li><span class="label">Gender:</span>[% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]</li>[% END %]
+    <li><span class="label">Sex:</span>[% sex %]</li>[% END %]
     [% IF ( printethnicityline ) %]
     <li><span class="label">Ethnicity:</span>[% ethnicity %]</li>
     <li><span class="label">Ethnicity notes: </span>[% ethnotes %]</li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt
index f84052b..0452614 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt
@@ -3,14 +3,6 @@
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon %][% ELSE %][% themelang %]/includes/favicon.ico[% END %]" type="image/x-icon" />
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/print.css" />
-<script language="javascript">
-    function printThenClose() {
-        window.print();
-        window.close();
-    }
-</script>
-<body onload="printThenClose();">
-
 </head>
 <body>
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
index 6287611..8384dfb 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -163,7 +163,7 @@ function validate1(date) {
             <form class="inline compact" action="/cgi-bin/koha/members/setdebar.pl" method="post">
                 <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
                 <input type="hidden" name="status" value="0" />
-                <input type="submit" value="Lift Restriction" />
+                <input type="submit" value="Lift Debarment" />
             </form>
             </li>
         [% END %]
@@ -212,9 +212,7 @@ function validate1(date) {
     [% END %]
     <li><span class="label">Initials: </span>[% initials %]</li>
     <li><span class="label">Date of birth:</span>[% dateofbirth %]</li>
-    <li><span class="label">Gender:</span>
-    [% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]
-    </li>[% END %]
+    <li><span class="label">Sex:</span>[% sex %]</li>[% END %]
     [% IF ( printethnicityline ) %]
     <li><span class="label">Ethnicity:</span>[% ethnicity %]</li>
     <li><span class="label">Ethnicity notes: </span>[% ethnotes %]</li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt
index 81fa3b6..f73ce2d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt
@@ -1,16 +1,6 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Choose Adult category</title>
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script type="text/javascript">
-	$(document).ready(function() {
-		$.tablesorter.defaults.widgets = ['zebra'];
-		$("#catst").tablesorter({
-			sortList: [[2,0]],
-			headers: { 0: { sorter: false }}
-		});
-	});
-</script>
 <style type="text/css"> 
 	   #custom-doc { width:29em;*width:28.3em;min-width:377px; margin:auto; text-align:left; } 
 </style> 
@@ -51,15 +41,12 @@ window.close();
 
 <form method="post" action="update-child.pl">
 <fieldset>
-<table id="catst">
-<thead>
+<table>
 <tr>
 <th>&nbsp;</th>
 <th>Code</th>
 <th>Description</th>
 </tr>
-</thead>
-<tbody>
 [% FOREACH CAT_LOO IN CAT_LOOP %]
 <tr>
 <td>
@@ -68,7 +55,6 @@ window.close();
 <td><label for="catcode[% CAT_LOO.catcode %]"><strong>[% CAT_LOO.catdesc %]</strong></label></td> 
 </tr>
 [% END %]
-</tbody>
 </table>
 <input type="hidden" name="op" value="update" />
 <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
@@ -86,4 +72,4 @@ window.close();
 
 
 </div>
-[% INCLUDE 'popup-bottom.inc' %]
+[% INCLUDE 'intranet-bottom.inc' %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt
index a67c080..55095d9 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/members-search.tt
@@ -118,7 +118,7 @@ function add_item(borrowernum,batch_id,type_id){
     <td>[% resultsloo.branchcode %]</td>
     <td>[% resultsloo.dateexpiry %]</td>
     <td>[% resultsloo.borrowernotes %]</td>
-    <td><a onclick="add_item('[% resultsloo.borrowernumber %]',[% batch_id %]); return false" href="/cgi-bin/koha/patroncards/edit-batch.pl?borrower_number=[% resultsloo.borrowernumber %]&amp;batch_id=[% batch_id %]&amp;op=add">Add</a></td>
+    <td><a onclick="add_item('[% resultsloo.borrowernumber %]',[% resultsloo.batch_id %]); return false" href="/cgi-bin/koha/patroncards/edit-batch.pl?borrower_number=[% resultsloo.borrowernumber %]&amp;batch_id=[% resultsloo.batch_id %]&amp;op=add">Add</a></td>
     </tr>
     [% END %]
     </table>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
index 78f927b..b177838 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
@@ -209,7 +209,7 @@
                     </td>
                 </tr>
             <tr>
-                <td>Gender</td>
+                <td>Sex</td>
                 <td><input type="radio" name="Line" value="sex" /></td>
                 <td><input type="radio" name="Column" value="sex" /></td>
                 <td>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt
index f6d48ba..23505ad 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt
@@ -19,55 +19,55 @@
 [% END %]
 <h1>Dictionary</h1>
 [% IF ( start_dictionary ) %]
-	<p>Use the dictionary to define custom criteria for reporting.</p>
+<p>Use the dictionary to define custom criteria for reporting.</p>
 
-		[% IF ( definitions ) %]
-		<h2>Current Terms</h2>
-		<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
-		<input type="hidden" name="phase" value="View Dictionary" />
-		[% IF ( areas ) %]
-			Filter by area <select name="areas">
-			<option value="">All</option>
-			[% FOREACH area IN areas %]
-			    [% IF ( area.selected ) %]
-			        <option value="[% area.id %]" selected="selected" >[% area.name %]</option>
-			    [% ELSE %]
-			        <option value="[% area.id %]">[% area.name %]</option>
-			    [% END %]
-			[% END %]
-			</select>
-			<input name="submit" value="Go" type="submit" />
-			</form>
-			<br />
-		[% END %]
-		<table border="1" cellspacing="0" cellpadding="5">
-		<tr>
-		<th>Name</th>
-		<th>Description</th>
-		<th>Area</th>
-		<th>Definition</th>
-		<th>&nbsp;</th>
-		</tr>
-		[% FOREACH definition IN definitions %]
-			[% UNLESS ( loop.odd ) %]
-				<tr class="highlight" valign="top">
-			[% ELSE %]
-				<tr valign="top">
-			[% END %]
-			<td>[% definition.name %]</td>
-			<td>[% definition.description %]</td>
-			<td>[% definition.areaname %]</td>
-			<td>[% definition.saved_sql %]</td>
-			<td><form method="post" action="/cgi-bin/koha/reports/dictionary.pl">
-			<input type="hidden" name="id" value="[% definition.id %]" />
-			<input type="hidden" name="phase" value="Delete Definition" />
-			<input type="submit" name="submit" value="Delete Definition" />
-			</form></td>
-			</tr>
-		[% END %]
-		</table>
-		[% END %]
+
+<h2>Current Terms</h2>
+<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
+<input type="hidden" name="phase" value="View Dictionary" />
+Filter by area <select name="areas">
+<option value="">All</option>
+[% FOREACH area IN areas %]     
+    [% IF ( area.selected ) %]
+        <option value="[% area.id %]" selected="selected" >[% area.name %]</option>
+    [% ELSE %]
+        <option value="[% area.id %]">[% area.name %]</option>
+    [% END %]
+[% END %]
+</select> 
+<input name="submit" value="Go" type="submit" />
+</form>
+<br />
+<table border="1" cellspacing="0" cellpadding="5">
+<tr>
+<th>Name</th>
+<th>Description</th>
+<th>Area</th>
+<th>Definition</th>
+<th>&nbsp;</th>
+</tr>
+[% IF ( definitions ) %]
+[% FOREACH definition IN definitions %]
+[% UNLESS ( loop.odd ) %]
+<tr class="highlight" valign="top">
+[% ELSE %]
+<tr valign="top">
+[% END %]
+<td>[% definition.name %]</td>
+<td>[% definition.description %]</td>
+<td>[% definition.areaname %]</td>
+<td>[% definition.saved_sql %]</td>
+<td><form method="post" action="/cgi-bin/koha/reports/dictionary.pl">
+<input type="hidden" name="id" value="[% definition.id %]" />
+<input type="hidden" name="phase" value="Delete Definition" />
+<input type="submit" name="submit" value="Delete Definition" />
+</form></td>
+</tr>
+[% END %]
 [% END %]
+</table>
+[% END %]
+
 
 [% IF ( new_dictionary ) %]
 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
@@ -214,7 +214,7 @@
 <script type="text/javascript">                            
 Calendar.setup({             
 inputField     : "[% column.name %]_start_value",    
-ifFormat       : "[% DHTMLcalendar_dateformat %]",
+ifFormat       : "[% column.DHTMLcalendar_dateformat %]",
 button         : "buttonfrom1",                            
 align          : "Tl"                  
 });
@@ -230,7 +230,7 @@ align          : "Tl"
 <script type="text/javascript">                            
 Calendar.setup({             
 inputField     : "[% column.name %]_end_value",    
-ifFormat       : "[% DHTMLcalendar_dateformat %]",
+ifFormat       : "[% column.DHTMLcalendar_dateformat %]",
 button         : "buttonfrom2",
 align          : "Tl"                  
 });
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
index e3df4e2..24c5a13 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
@@ -331,7 +331,7 @@ canned reports and writing custom SQL reports.</p>
             <script type="text/javascript">   
             Calendar.setup({  
             inputField     : "[% criteri.name %]_value",
-            ifFormat       : "[% DHTMLcalendar_dateformat %]",
+            ifFormat       : "[% criteri.DHTMLcalendar_dateformat %]",
             button         : "buttonfrom[% criteri.name %]",
             align          : "Tl" 
             });     
@@ -354,7 +354,7 @@ canned reports and writing custom SQL reports.</p>
             <script type="text/javascript">   
                 Calendar.setup({  
                 inputField     : "from_[% criteri.name %]_value",
-                ifFormat       : "[% DHTMLcalendar_dateformat %]",
+                ifFormat       : "[% criteri.DHTMLcalendar_dateformat %]",
                 button         : "buttonfromfrom_[% criteri.name %]",
                 align          : "Tl" 
                 });     
@@ -365,7 +365,7 @@ canned reports and writing custom SQL reports.</p>
             <script type="text/javascript">   
                 Calendar.setup({  
                 inputField     : "to_[% criteri.name %]_value",
-                ifFormat       : "[% DHTMLcalendar_dateformat %]",
+                ifFormat       : "[% criteri.DHTMLcalendar_dateformat %]",
                 button         : "buttonfromto_[% criteri.name %]",
                 align          : "Tl" 
                 });     
@@ -392,7 +392,8 @@ canned reports and writing custom SQL reports.</p>
 [% IF ( definitions ) %]
 <fieldset><legend>Dictionary Definitions</legend><table>
 [% FOREACH definition IN definitions %]
-    <tr><td><input type="checkbox" name="definition" value="[% definition.id %]" /> [% definition.name %]</td></tr>
+    <tr><td><input type="checkbox" name="definition" value="<!--
+TMPL_VAR NAME="id" -->" /> [% definition.name %]</td></tr>
 [% END %]
 </table>
 [% END %]
@@ -414,7 +415,10 @@ canned reports and writing custom SQL reports.</p>
 <input type="hidden" name="criteria" value="[% criteriastring %]" />
 <fieldset><table>
 [% FOREACH total_b IN total_by %]
-<tr><td><input type="checkbox" name="total_by" id="[% total_b.name %]" value="[% total_b.name %]" /> <label for="[% total_b.name %]">[% total_b.name %]</label></td>
+<tr><td><input type="checkbox" name="total_by" id="<!-- TMPL_VAR
+NAME="name" -->" value="<!-- TMPL_VAR
+NAME="name" -->" /> <label for="<!-- TMPL_VAR
+NAME="name" -->">[% total_b.name %]</label></td>
 <td><select name="[% total_b.name %]_tvalue">
 
 [% FOREACH selec IN total_b.select %]
@@ -443,7 +447,10 @@ canned reports and writing custom SQL reports.</p>
 <input type="hidden" name="definition" value="[% definition %]" />
 <input type="hidden" name="totals" value="[% totals %]" />
 <fieldset><table>[% FOREACH order_b IN order_by %]
-<tr><td><input type="checkbox" id="[% order_b.name %]" name="order_by" value="[% order_b.name %]" /> <label for="[% order_b.name %]">[% order_b.name %]</label></td><td>
+<tr><td><input type="checkbox" id="<!-- TMPL_VAR
+NAME="name" -->" name="order_by" value="<!-- TMPL_VAR
+NAME="name" -->" /> <label for="<!-- TMPL_VAR
+NAME="name" -->">[% order_b.name %]</label></td><td>
 <select name="[% order_b.name %]_ovalue">
 
 [% FOREACH selec IN order_b.select %]
@@ -511,7 +518,7 @@ canned reports and writing custom SQL reports.</p>
 [% IF ( notes ) %]<p>[% notes %]</p>[% END %]
 [% IF ( unlimited_total ) %]<p>Total number of rows matching the (unlimited) query is [% unlimited_total %].</p>[% END %]
 <pre id="sql_output">[% sql %]</pre>
-<div class="pages">[% pagination_bar %]</div>
+<div class="pages">[% DEFAULT pagination_bar="" %]</div>
 [% UNLESS ( errors ) %]
 <table>
 <tr>[% FOREACH header_ro IN header_row %]<th>[% header_ro.cell %]</th>[% END %]</tr>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
index cbcfc55..66c9235 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
@@ -169,7 +169,7 @@ function checkMultiHold() {
     <h1>Confirm Holds</h1>
   [% END %]
 
-  [% UNLESS ( borrowernumber ) %]
+  [% UNLESS ( cardnumber ) %]
     [% IF ( messageborrower ) %]
       <div class="dialog alert"><h3>Patron Not Found</h3><p>No patron with this name, Please, try another</p> </div>
     [% END %]
@@ -243,7 +243,7 @@ function checkMultiHold() {
             <form action="placerequest.pl" method="post" onsubmit="return checkMultiHold();" name="form">
         [% END %]
 
-        <input type="hidden" size="10" name="borrowernumber" value="[% borrowernumber %]" />
+        <input type="hidden" size="10" name="member" value="[% cardnumber %]" />
         <input type="hidden" name="type" value="str8" />
 
         [% IF ( multi_hold ) %]
@@ -262,7 +262,7 @@ function checkMultiHold() {
         [% END %]
 
        <ol> <li><span class="label">Patron:</span>
-            [% IF ( borrowernumber ) %]
+            [% IF ( cardnumber ) %]
                 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">[% borrowerfirstname %] [% borrowersurname %] ([% cardnumber %])</a>
             [% ELSE %]
                 Not defined yet
@@ -312,7 +312,6 @@ function checkMultiHold() {
 		);
 		//]]>
 	    </script>
-        <a href='#' onclick="document.getElementById('reserve_date').value='';">Clear Date</a>
 	</li>
 	[% END %]
 
@@ -358,7 +357,7 @@ function checkMultiHold() {
 </ol>
    [% UNLESS ( multi_hold ) %]
         <fieldset class="action">
-            [% IF ( borrowernumber ) %]
+            [% IF ( cardnumber ) %]
                 [% IF ( override_required ) %]
                     <input type="submit" class="warning" value="Place Hold" />
                 [% ELSIF ( none_available ) %]
@@ -465,7 +464,7 @@ function checkMultiHold() {
         </table>
     [% IF ( bibitemloo.hiddencount ) %]
         <form>
-        <p class="hiddencount"><a href="request.pl?biblionumber=[% bibitemloo.biblionumber %]&borrowernumber=[% bibitemloo.borrowernumber %]&showallitems=1">Show all items ([% bibitemloo.hiddencount %] hidden)</a></p>
+        <p class="hiddencount"><a href="request.pl?biblionumber=[% bibitemloo.biblionumber %]&cardnumber=[% bibitemloo.cardnumber %]&showallitems=1">Show all items ([% bibitemloo.hiddencount %] hidden)</a></p>
         </form>
     [% END %] <!-- hiddencount -->
     [% END %] <!-- bibitemloop -->
@@ -538,7 +537,7 @@ function checkMultiHold() {
   [% END %]<!-- /multi_hold -->
 
     <fieldset class="action">
-        [% IF ( borrowernumber ) %]
+        [% IF ( cardnumber ) %]
             [% IF ( override_required ) %]
                 <input type="submit" class="warning" value="Place Hold" />
             [% ELSIF ( none_available ) %]
@@ -552,7 +551,7 @@ function checkMultiHold() {
 	</fieldset>
 [% END %]
 
-[% UNLESS ( borrowernumber ) %]
+[% UNLESS ( cardnumber ) %]
 [% IF ( reserveloop ) %]
 <form name="T[% time %]" action="modrequest.pl" method="post">
   [% IF ( multi_hold ) %]
@@ -631,7 +630,7 @@ function checkMultiHold() {
         <td>
           <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% reserveloo.borrowernumber %]" >
 	  [% IF ( reserveloo.hidename ) %]
-	      [% reserveloo.cardnumber (reserveloo.borrowernumber) %]
+	      [% reserveloo.cardnumber %]
 	  [% ELSE %]
 	      [% reserveloo.firstname %] [% reserveloo.surname %]
 	  [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search-result.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search-result.tt
index 2a29f72..b92aafb 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search-result.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search-result.tt
@@ -6,7 +6,7 @@
 function GetIt(aqbooksellerid,name)
 {
   opener.document.f.aqbooksellerid.value = aqbooksellerid;
-  opener.document.f.aqbooksellername.value = name;
+  opener.document.f.aqbooksellername.value = unescape(name);
   window.close();
 }
 </script>
@@ -33,7 +33,7 @@ function GetIt(aqbooksellerid,name)
         <tr>
         [% END %]
 			<td>[% loop_supplier.name %]</td>
-			<td><a href="#" onclick="GetIt([% loop_supplier.aqbooksellerid %],$(this).parent().prev().text())">Choose</a></td>
+			<td><a href="#" onclick="GetIt([% loop_supplier.aqbooksellerid %],'[% loop_supplier.name |url %]')">Choose</a></td>
 		</tr>
 	[% END %]
 </table>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/member-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/member-search.tt
index 91172be..64c23d6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/member-search.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/member-search.tt
@@ -64,7 +64,8 @@ function add_member(subscriptionid,borrowernumber){
 		<td>[% resultsloo.cardnumber %] </td>
 		<td>[% resultsloo.surname %], [% resultsloo.firstname %] </td>
 		<td>[% resultsloo.branchcode %] </td>
-		<td><a onclick="add_member([% subscriptionid %],[% resultsloo.borrowernumber %]); return false" href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% resultsloo.subscriptionid %]&amp;borrowernumber=[% resultsloo.borrowernumber %]&amp;op=add">Add</a></td></tr>
+		<td><a onclick="add_member(<!-- TMPL_VAR
+		NAME="subscriptionid" -->,[% resultsloo.borrowernumber %]); return false" href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% resultsloo.subscriptionid %]&amp;borrowernumber=[% resultsloo.borrowernumber %]&amp;op=add">Add</a></td></tr>
 		[% END %]
 	</tbody>
 </table>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt
index 85c42b1..581ca97 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt
@@ -55,14 +55,17 @@ function search_member(subscriptionid){
 [% FOREACH memberloo IN memberloop %]
         <tr><td>[% memberloo.name %]</td>
             <td>[% memberloo.routingbox %]</td>
-            <td><a href="/cgi-bin/koha/serials/routing.pl?routingid=[% memberloo.routingid %]&amp;subscriptionid=[% subscriptionid %]&amp;op=delete">Delete</a></td></tr>
+            <td><a href="/cgi-bin/koha/serials/routing.pl?routingid=[% memberloo.routingid %]&amp;subscriptionid=[% memberloo.subscriptionid %]&amp;op=delete">Delete</a></td></tr>
 [% END %]
-        </table><p style="margin-left:10em;"><a onclick="search_member([% subscriptionid %]); return false"
-href="/cgi-bin/koha/serials/member-search.pl?subscriptionid=[% subscriptionid %]" class="button">Add recipients</a> &nbsp; <a
+        </table><p style="margin-left:10em;"><a onclick="search_member(<!-- TMPL_VAR
+NAME="subscriptionid" -->); return false"
+href="/cgi-bin/koha/serials/member-search.pl?subscriptionid=<!-- TMPL_VAR
+NAME="subscriptionid" -->" class="button">Add recipients</a> &nbsp; <a
 href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscriptionid %]&amp;op=delete" class="button">Delete All</a></p></li>
 [% ELSE %]
 <li><span class="label">Recipients:</span>
-    <a onclick="search_member([% subscriptionid %]); return false" href="/cgi-bin/koha/serials/member-search.pl?subscriptionid=[% subscriptionid %]" class="button">Add recipients</a></li>
+    <a onclick="search_member(<!-- TMPL_VAR NAME="subscriptionid"
+-->); return false" href="/cgi-bin/koha/serials/member-search.pl?subscriptionid=[% subscriptionid %]" class="button">Add recipients</a></li>
 [% END %]
 
 	<li><label for="notes">Notes:</label><textarea name="notes" id="notes" rows="3" cols="50">[% routingnotes %]</textarea></li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt
index 304c6ca..145166d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt
@@ -178,7 +178,7 @@ $(document).ready(function() {
 	<div class="yui-b">
 
 <h1>Serial Edition <i>[% bibliotitle %]</i>
-	[% IF location %] ( [% location %] ) [% END %]
+	i[% IF location %] ( [% location %] ) [% END %]
     [% IF ( callnumber ) %] callnumber: [% callnumber %][% END %]</h1>
 <form method="post" name="f" action="serials-edit.pl" id="serials_edit">
 <!--onsubmit="return barcode_check()">-->
@@ -287,17 +287,17 @@ $(document).ready(function() {
         [% FOREACH item IN serialslis.items %]
         <div id="item[% item.serialid %][% item.countitems %]" class="items">
         <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li>
-               <div class="subfield_line" style="[% iteminformatio.hidden %];" id="subfield[% item.serialid %][% item.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
+               <div class="subfield_line" style="[% iteminformatio.hidden %];" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
                               
                 <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
                 [% iteminformatio.marc_value %]
-                <input type="hidden" name="itemid" value="[% item.itemid %]" />
+                <input type="hidden" name="itemid" value="[% iteminformatio.itemid %]" />
                 <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
                 <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
                 <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
                 <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
                 [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
-                    <span class="buttonPlus" onclick="CloneSubfield('subfield[% item.serialid %][% item.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
+                    <span class="buttonPlus" onclick="CloneSubfield('subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
                 [% END %]
         
             </div></li>
@@ -326,7 +326,7 @@ $(document).ready(function() {
             <input type="hidden" name="biblionumber" value="[% newserialloo.biblionumber %]" />
             <input type="hidden" name="itemcount" value="[% newserialloo.issuesatonce %]" />
             <input type="hidden" name="user" value="[% newserialloo.librarian %]" />
-            Supplemental Issue <input type="text" name="serialseq" id="serialseq[% newserialloo.serialid %]" value="" size="20" maxlength="100" onchange="if (this.value!=''){unHideItems('items[% newserialloo.subscriptionid %][% newserialloo.serialid %]','label[% newserialloo.subscriptionid %][% newserialloo.serialid %]', '[% newserialloo.serialid %]')} else {HideItems('items[% newserialloo.subscriptionid %][% newserialloo.serialid %]','label[% newserialloo.subscriptionid %][% newserialloo.serialid %]')}" />
+            Supplemental Issue <input type="text" name="serialseq" value="" size="20" maxlength="100" onchange="if (this.value!=''){unHideItems('items[% newserialloo.subscriptionid %][% newserialloo.serialid %]','label[% newserialloo.subscriptionid %][% newserialloo.serialid %]', '[% newserialloo.serialid %]')} else {HideItems('items[% newserialloo.subscriptionid %][% newserialloo.serialid %]','label[% newserialloo.subscriptionid %][% newserialloo.serialid %]')}" />
         </td>
         <td>
             <input type="text" name="publisheddate" value="[% newserialloo.publisheddate %]" size="10" maxlength="15" />
@@ -335,8 +335,7 @@ $(document).ready(function() {
             <input type="text" name="planneddate" id="supexpecteddate" value="[% newserialloo.planneddate %]" size="10" maxlength="15" />
         </td>
         <td>
-            <select name="status" size="1" id="addstatus[% newserialloo.serialid %]" onchange="if (this.value==2){unHideItems('items'+'[% newserialloo.subscriptionid %][% newserialloo.serialid %]','label[% newserialloo.subscriptionid %][% newserialloo.serialid %]','[% newserialloo.serialid %]'); changeDate2('[% newserialloo.arriveddate %]')} else if (this.value==7){changeDate('[% newserialloo.arriveddate %]')} else { HideItems('items'+'[% newserialloo.subscriptionid %]'+[% newserialloo.serialid %],'label[% serialslis.subscriptionid %][% serialslis.serialid %]'); changeDate2('[% serialslis.planneddate %]')}" >
-
+            <select name="status" size="1" id="addstatus[% newserialloo.serialid %]" onchange="if (this.value==2 || this.value==7){changeDate2('[% newserialloo.arriveddate %]')} else {changeDate2('[% newserialloo.planneddate %]')}" >
                     <option value="">----</option>
   [% IF ( newserialloo.status1 ) %]
                     <option value="1" selected="selected">Expected</option>
@@ -390,17 +389,17 @@ $(document).ready(function() {
           <div class="cataloguing_additem_itemlist">
         <div id="item[% newserialloo.serialid %][% newserialloo.countitems %]" class="items">
         <ol>[% FOREACH iteminformatio IN newserialloo.iteminformation %]<li>
-               <div class="subfield_line" style="[% iteminformatio.hidden %];" id="subfield[% newserialloo.serialid %][% newserialloo.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
+               <div class="subfield_line" style="[% iteminformatio.hidden %];" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
    
                 <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
                 [% iteminformatio.marc_value %]
-                <input type="hidden" name="itemid" value="[% newserialloo.itemid %]" />
+                <input type="hidden" name="itemid" value="[% iteminformatio.itemid %]" />
                 <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
                 <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
                 <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
                 <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
                 [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
-                    <span class="buttonPlus" onclick="CloneSubfield('subfield[% newserialloo.serialid %][% newserialloo.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
+                    <span class="buttonPlus" onclick="CloneSubfield('subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
                 [% END %]
         </div>
        </li>[% END %]</ol>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt
index 7753fd3..56a8214 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt
@@ -110,7 +110,7 @@ Serials updated :
                 [% IF ( subscription.branchcode ) %][% subscription.branchcode %][% END %]
                 [% IF ( subscription.callnumber ) %]([% subscription.callnumber %])[% END %]
                 </td>
-                [% IF ( routing ) %]
+                [% IF ( subscription.routing ) %]
                 <td>
                 [% IF ( subscription.cannotedit ) %]
                   &nbsp;        
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-recieve.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-recieve.tt
index f45ffeb..33f267a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-recieve.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-recieve.tt
@@ -4,7 +4,8 @@
 <script language="JavaScript" type="text/javascript">
 //<![CDATA[
 function popup() {
-	window.open("subscription-renew.pl?subscriptionid=[% subscriptionid %]","subscription_renewal",'width=700,height=400,toolbar=false,scrollbars=yes');
+	window.open("subscription-renew.pl?subscriptionid=<!-- TMPL_VAR
+name="subscriptionid">","subscription_renewal",'width=700,height=400,toolbar=false,scrollbars=yes');
 }
 
 function barcode_check(){
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
index d5d1615..b20ced4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
@@ -1,5 +1,5 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Serials &rsaquo; [% IF ( modify ) %][% bibliotitle |html %] &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</title>
+<title>Koha &rsaquo; Serials &rsaquo; [% IF ( modname ) %][% bibliotitle |html %] &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
 
@@ -931,7 +931,7 @@ $(document).ready(function() {
 	}
 	);
    //  $(".widelabel").attr("width", "300px");  // labels stay skinny in IE7 anyway.
-[% IF ( modify ) %]
+[% IF ( modname ) %]
     set_num_pattern_from_template_vars();
     [% IF ( hemisphere ) %]
 	is_hemisphere = [% hemisphere %] ;
@@ -952,15 +952,15 @@ $(document).ready(function() {
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'serials-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; [% IF ( modify ) %]<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscriptionid %]"><i>[% bibliotitle |html %]</i></a> &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; [% IF ( modname ) %]<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscriptionid %]"><i>[% bibliotitle |html %]</i></a> &rsaquo; Modify subscription[% ELSE %]New subscription[% END %]</div>
 
 <div id="doc3" class="yui-t7">
    
    <div id="bd">
-<h1>[% IF ( modify ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %]</h1>
+<h1>[% IF ( modname ) %] Modify subscription for <i>[% bibliotitle |html %]</i>[% ELSE %]Add a new subscription[% END %]</h1>
    <div class="yui-g">
     <form method="post" name="f" action="/cgi-bin/koha/serials/subscription-add.pl">
-[% IF ( modify ) %]
+[% IF ( modname ) %]
         <input type="hidden" name="op" value="modsubscription" />
         <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
 [% ELSE %]
@@ -988,7 +988,7 @@ $(document).ready(function() {
                 (<input type="text" name="title" value="[% bibliotitle %]" disabled="disabled" readonly="readonly" />) <span class="required" title="Subscriptions must be associated with a bibliographic record">Required</span>
                <div class="inputnote"> <a href="#" onclick="Plugin(f)">Search for Biblio</a>
 		    [% IF ( CAN_user_editcatalogue ) %] 
-		       [% IF ( modify ) %]
+		       [% IF ( modname ) %]
 		       | <a href="#" onclick="addbiblioPopup([% bibnum %]); return false;">Edit biblio</a>
 		       [% ELSE %]
 		       | <a href="#" onclick="addbiblioPopup(); return false;">Create Biblio</a>
@@ -1107,10 +1107,10 @@ $(document).ready(function() {
     <ol>
         <li>
            <label for="acqui_date"> First issue publication date:</label>
-                [% UNLESS ( modify ) %]<img src="[% themelang %]/lib/calendar/cal.gif" id="acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />[% END %]
-                <input type="text" name="firstacquidate" value="[% firstacquidate %]"  size="13" maxlength="10" id="acqui_date" [% IF ( modify ) %]disabled="disabled"[% END %] style="border-width: 0px;"  />
+                [% UNLESS ( modname ) %]<img src="[% themelang %]/lib/calendar/cal.gif" id="acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />[% END %]
+                <input type="text" name="firstacquidate" value="[% firstacquidate %]"  size="13" maxlength="10" id="acqui_date" [% IF ( modname ) %]disabled="disabled"[% END %] style="border-width: 0px;"  />
         </li>
-           [% IF ( modify ) %]<li><label for="next_acqui_date"> Next issue publication date:</label>
+           [% IF ( modname ) %]<li><label for="next_acqui_date"> Next issue publication date:</label>
                 <img src="[% themelang %]/lib/calendar/cal.gif" id="next_acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
                 <input type="text" name="nextacquidate" value="[% nextacquidate %]" size="13" maxlength="10" id="next_acqui_date" style="border-width: 0px;"  />
                 </li>[% END %]
@@ -1118,9 +1118,9 @@ $(document).ready(function() {
         <li><!-- both scripts for calendar must follow the input field --> 
                 <script type="text/javascript">
                     Calendar.setup({
-                        inputField      :   "[% IF ( modify ) %]next_[% END %]acqui_date",
+                        inputField      :   "[% IF ( modname ) %]next_[% END %]acqui_date",
                         ifFormat       :   "[% DHTMLcalendar_dateformat %]",
-                        button         :   "[% IF ( modify ) %]next_[% END %]acqui_button",
+                        button         :   "[% IF ( modname ) %]next_[% END %]acqui_button",
                         align          :   "Tl",
                         onUpdate        :    function(cal) { 
                                                              irregular_issues.weeks = getWeeksArray(cal.date);
@@ -1134,9 +1134,9 @@ $(document).ready(function() {
                                                         } 
                         });
                     Calendar.setup({
-                        inputField      :   "[% IF ( modify ) %]next_[% END %]acqui_date",
+                        inputField      :   "[% IF ( modname ) %]next_[% END %]acqui_date",
                         ifFormat       :   "[% DHTMLcalendar_dateformat %]",
-                        button         :   "[% IF ( modify ) %]next_[% END %]acqui_date",
+                        button         :   "[% IF ( modname ) %]next_[% END %]acqui_date",
                         align          :   "Tl",
                         onUpdate        :    function(cal) { irregular_issues.weeks = getWeeksArray(cal.date);
                                                             irregular_issues.firstissue = cal.date;
@@ -1404,7 +1404,7 @@ $(document).ready(function() {
                 </tr>
                 <tr>
                     <td>
-                        [% IF ( modify ) %]
+                        [% IF ( modname ) %]
                             Last value
                         [% ELSE %]
                             Begins with
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt
index 7cf3df6..abe8b95 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt
@@ -207,12 +207,12 @@ td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
 	</tr>
 	[% FOREACH tagloo IN tagloop %]
 	<tr>
-	    <td class="count">[% offset + loop.count %]
+	    <td class="count">[% offset + __counter__ %]
 	    </td>
 	    <td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" [% IF ( approved == 0 ) %] class="pending"[% END %] /></span>
 	    </td>
-	    [% IF ( tagloo.approved == -1 ) %]<td class="red">rejected
-		[% ELSIF ( tagloo.approved == 1 ) %]<td class="green"><img alt="OK" src="/intranet-tmpl/prog/img/approve.gif" />
+	    [% IF ( approved == -1 ) %]<td class="red">rejected
+		[% ELSIF ( approved == 1 ) %]<td class="green"><img alt="OK" src="/intranet-tmpl/prog/img/approve.gif" />
 		[% ELSE %]<td class="pending">
 		[% END %]
 	    </td>
@@ -239,7 +239,7 @@ td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
 			<input class="rej" type="submit" title="[% tagloo.term %]" value="Reject" name="reject" />
 			</span>
 	    </td>
-	    [% UNLESS ( filter_approved_pending ) %]<td>&nbsp;</td>[% END %]
+	    [% UNLESS ( tagloo.filter_approved_pending ) %]<td>&nbsp;</td>[% END %]
 		[% END %]
 	    <td>[% tagloo.date_approved %]
 	    </td>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt
index af2a239..21013f5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt
@@ -12,7 +12,6 @@
 // Prepare array of all column headers, incrementing each index by
 // two to accomodate control and title columns
 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
-console.log(allColumns);
 for( x=0; x<allColumns.length; x++ ){
   allColumns[x] = Number(allColumns[x]) + 2;
 }
@@ -77,7 +76,7 @@ for( x=0; x<allColumns.length; x++ ){
 
 	<p id="selections"><strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span>
 		[% FOREACH item_header_loo IN item_header_loop %]
-		<span class="selected"><input id="checkheader[% loop.count %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count %]">[% item_header_loo.header_value %]</label> </span>
+		<span class="selected"><input id="checkheader[% item_header_loo.__counter %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count %]">[% item_header_loo.header_value %]</label> </span>
 		[% END %]
 	</p>
 
@@ -92,7 +91,7 @@ for( x=0; x<allColumns.length; x++ ){
 			</tr>
 		    </thead>
 		    <tbody>
-		    [% FOREACH item_loo IN item_loop %] <tr> [% IF ( show ) %][% IF ( item_loo.nomod ) %] <td class="error">Cannot Edit</td>[% ELSE %]<td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" /></td>[% END %][% END %]
+		    [% FOREACH item_loo IN item_loop %] <tr> [% IF ( item_loo.show ) %][% IF ( item_loo.nomod ) %] <td class="error">Cannot Edit</td>[% ELSE %]<td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" /></td>[% END %][% END %]
 		    <td><label for="row[% item_loo.itemnumber %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">[% item_loo.title %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author %][% END %]</label></td>
 			[% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field |html %]</td> 
 					[% END %] </tr>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt
index 67cd6e0..461b6bc 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt
@@ -12,7 +12,6 @@
 // Prepare array of all column headers, incrementing each index by
 // two to accomodate control and title columns
 var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% loop.count %]'[% UNLESS ( loop.last ) %],[% END %][% END %]);
-console.log(allColumns);
 for( x=0; x<allColumns.length; x++ ){
   allColumns[x] = Number(allColumns[x]) + 2;
 }
@@ -72,7 +71,7 @@ for( x=0; x<allColumns.length; x++ ){
 
 <p id="selections"><strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span> 
         [% FOREACH item_header_loo IN item_header_loop %]
-        <span class="selected"><input id="checkheader[% loop.count %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count %]">[% item_header_loo.header_value %]</label> </span>
+        <span class="selected"><input id="checkheader[% item_header_loo.__counter %]" type="checkbox" checked="checked" /> <label for="checkheader[% loop.count %]">[% item_header_loo.header_value %]</label> </span>
         [% END %]
 </p>
         <table id="itemst">
@@ -86,7 +85,7 @@ for( x=0; x<allColumns.length; x++ ){
     </tr>
       </thead>
       <tbody>
-            [% FOREACH item_loo IN item_loop %] <tr> [% IF ( show ) %][% IF ( item_loo.nomod ) %] <td class="error">Cannot Edit</td>[% ELSE %]<td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" /></td>[% END %][% ELSE %]<td>&nbsp;</td>[% END %]
+            [% FOREACH item_loo IN item_loop %] <tr> [% IF ( item_loo.show ) %][% IF ( item_loo.nomod ) %] <td class="error">Cannot Edit</td>[% ELSE %]<td><input type="checkbox" name="itemnumber" value="[% item_loo.itemnumber %]" id="row[% item_loo.itemnumber %]" checked="checked" /></td>[% END %][% ELSE %]<td>&nbsp;</td>[% END %]
                 <td><label for="row[% item_loo.itemnumber %]"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item_loo.biblionumber %]">[% item_loo.title %]</a>[% IF ( item_loo.author ) %], by [% item_loo.author %][% END %]</label></td>
                 [% FOREACH item_valu IN item_loo.item_value %] <td>[% item_valu.field |html %]</td> 
         [% END %] </tr>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt
index ac867fe..a8bf8b6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt
@@ -38,10 +38,7 @@
 			$("#holtype").attr("class","key exception").html(_("Holiday exception"));
 		} else if(holidayType == 'weekday') {
 			$("#showOperationDelLabel").html(_('Delete this holiday.'));
-			$("#holtype").attr("class","key repeatableweekly").html(_("Holiday repeating weekly"));
-		} else if(holidayType == 'daymonth') {
-			$("#showOperationDelLabel").html(_('Delete this holiday.'));
-			$("#holtype").attr("class","key repeatableyearly").html(_("Holiday repeating yearly"));
+			$("#holtype").attr("class","key repeatableday").html(_("Repeatable holiday"));
 		} else {
 			$("#showOperationDelLabel").html(_('Delete this holiday.'));
 			$("#holtype").attr("class","key holiday").html(_("Unique holiday"));
@@ -110,8 +107,7 @@
 .normalday { background-color :  #EDEDED; color :  Black; border : 1px solid #BCBCBC; }
 .exception { background-color :  #b3d4ff; color :  Black; border : 1px solid #BCBCBC; }
 .holiday {  background-color :  #ffaeae; color :  Black;  border : 1px solid #BCBCBC; }
-.repeatableweekly {  background-color :  #FFFF99; color :  Black;  border : 1px solid #BCBCBC; }
-.repeatableyearly {  background-color :  #FFCC66; color :  Black;  border : 1px solid #BCBCBC; }
+.repeatableday {  background-color :  #FFFF99; color :  Black;  border : 1px solid #BCBCBC; }
 .information { z-index : 1; background-color :  #DCD2F1; width : 300px; display : none; border : 1px solid #000000; color :  #000000; font-size :  8pt; font-weight :  bold; background-color :  #FFD700; cursor :  pointer; padding : 2px; }
 .panel { z-index : 1; display : none; border : 3px solid #CCC; padding : 3px; margin-top: .3em;  background-color: #FEFEFE; } fieldset.brief { border : 0; margin-top: 0; }
 #showHoliday { margin : .5em 0; } h1 select { width: 20em; } div.yui-b fieldset.brief ol { font-size:100%; } div.yui-b fieldset.brief li, div.yui-b fieldset.brief li.radio  { padding:0.2em 0; } .help { margin:.3em 0;border:1px solid #EEE;padding:.3em .7em; font-size : 90%; } #holidayweeklyrepeatable, #holidaysyearlyrepeatable, #holidaysunique, #holidayexceptions { font-size : 90%; margin-bottom : 1em;} .calendar td, .calendar th, .calendar .button, .calendar tbody .day { padding : .7em; font-size: 110%; } .calendar { width: auto; border : 0; }
@@ -292,10 +288,8 @@
 		var dateString = year + '/' + month + '/' + day;
 		if (exception_holidays[dateString] != null) {
 			return 'exception';
-		} else if ( week_days[weekDay] != null ){
-			return 'repeatableweekly';
-		} else if ( day_month_holidays[dayMonth] != null ) {
-			return 'repeatableyearly';
+		} else if ((week_days[weekDay] != null) || (day_month_holidays[dayMonth] != null)) {
+			return 'repeatableday';
 		} else if (holidays[dateString] != null) {
 			return 'holiday';
 		} else {
@@ -353,8 +347,7 @@
 	<p>
 		<span class="key normalday">Working day</span>
 		<span class="key holiday">Unique holiday</span>
-		<span class="key repeatableweekly">Holiday repeating weekly</span>
-		<span class="key repeatableyearly">Holiday repeating yearly</span>
+		<span class="key repeatableday">Repeatable holiday</span>
 		<span class="key exception">Holiday exception</span>
 	</p>
 </div>
@@ -387,9 +380,9 @@
 <table id="holidayweeklyrepeatable">
 <thead>
 <tr>
-  <th class="repeatableweekly">Day of Week</th>
-  <th class="repeatableweekly">Title</th>
-  <th class="repeatableweekly">Description</th>
+  <th class="repeatableday">Day of Week</th>
+  <th class="repeatableday">Title</th>
+  <th class="repeatableday">Description</th>
 </tr>
 </thead>
 <tbody>
@@ -414,12 +407,12 @@
 <thead>
 <tr>
   [% IF ( dateformat == 'metric' ) %]
-  <th class="repeatableyearly">Day/Month</th>
+  <th class="repeatableday">Day/Month</th>
   [% ELSE %]
-  <th class="repeatableyearly">Month/Day</th>
+  <th class="repeatableday">Month/Day</th>
   [% END %]
-  <th class="repeatableyearly">Title</th>
-  <th class="repeatableyearly">Description</th>
+  <th class="repeatableday">Title</th>
+  <th class="repeatableday">Description</th>
 </tr>
 </thead>
 <tbody>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
index 313701b..19242ed 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt
@@ -82,11 +82,11 @@ Edit News Item[% ELSE %]Add News Item[% END %][% ELSE %]News[% END %]</div>
             </li>
             <li>
                 <label for="title">Title</label>
-                <input id="title" size="30" type="text" name="title" value="[% new_detail.title %]" />
+                <input id="title" size="30" type="text" name="title" value="[% title %]" />
             </li>
             <li>
                 <label for="timestamp">Publication date</label>
-                <input id="timestamp" type="text" name="timestamp" size="15" value="[% new_detail.timestamp %]" />
+                <input id="timestamp" type="text" name="timestamp" size="15" value="[% timestamp %]" />
                 <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="timestampButton" style="cursor: pointer;" />
                 <script type="text/javascript">
                     Calendar.setup(
@@ -101,7 +101,7 @@ Edit News Item[% ELSE %]Add News Item[% END %][% ELSE %]News[% END %]</div>
             </li>
             <li>
                 <label for="expirationdate">Expiration date</label>
-                <input id="expirationdate" type="text" name="expirationdate" size="15" value="[% new_detail.expirationdate %]" />
+                <input id="expirationdate" type="text" name="expirationdate" size="15" value="[% expirationdate %]" />
                 <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show Calendar" border="0" id="openCalendar" style="cursor: pointer;" />
                 <script type="text/javascript">
                     Calendar.setup(
@@ -116,14 +116,14 @@ Edit News Item[% ELSE %]Add News Item[% END %][% ELSE %]News[% END %]</div>
             </li>
             <li>
                 <label for="number">Appear in position </label>
-                [% IF ( new_detail.number ) %]
-                    <input id="number" size="3" name="number" type="text" checked="checked" value="[% new_detail.number %]" />
+                [% IF ( number ) %]
+                    <input id="number" size="3" name="number" type="text" checked="checked" value="[% number %]" />
                 [% ELSE %]
                     <input id="number" size="3" name="number" type="text" />
                 [% END %]
             </li>
             <li><label for="new">News</label>
-            <textarea name="new" id="new"  cols="75" rows="10">[% new_detail.new %]</textarea></li>
+            <textarea name="new" id="new"  cols="75" rows="10">[% new %]</textarea></li>
             </ol>
 			</fieldset>
   
@@ -172,10 +172,10 @@ Edit News Item[% ELSE %]Add News Item[% END %][% ELSE %]News[% END %]</div>
                             <td>
                                 <input type="checkbox" name="ids" value="[% opac_new.idnew %]" />
                             </td>
-                            <td>[% IF ( opac_new.lang == 'koha' ) %]
+                            <td>[% IF ( lang == 'koha' ) %]
 			            Librarian interface
                                  [% ELSE %]
-                                    [% IF ( opac_new.lang == 'slip' ) %]
+                                    [% IF ( lang == 'slip' ) %]
 				        Slip
                                     [% ELSE %]
                                         OPAC
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
index b5083ae..526f8c9 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt
@@ -268,7 +268,7 @@ Page
       [% IF ( page.current_page ) %]
       <span class="current">[% page.page_number %]</span>
       [% ELSE %]
-      <a class="nav" href="[% page.script_name %]?import_batch_id=[% import_batch_id %]&amp;offset=[% page.offset %]">[% page.page_number %]</a>
+      <a class="nav" href="[% page.script_name %]?import_batch_id=[% page.import_batch_id %]&amp;offset=[% page.offset %]">[% page.page_number %]</a>
       [% END %]
     [% END %]
 </div>
@@ -308,7 +308,7 @@ Page
       [% IF ( page.current_page ) %]
       <span class="current">[% page.page_number %]</span>
       [% ELSE %]
-      <a class="nav" href="[% page.script_name %]?import_batch_id=[% import_batch_id %]&amp;offset=[% page.offset %]">[% page.page_number %]</a>
+      <a class="nav" href="[% page.script_name %]?import_batch_id=[% page.import_batch_id %]&amp;offset=[% page.offset %]">[% page.page_number %]</a>
       [% END %]
     [% END %]
 </div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt
index c3ad0c9..75d4b79 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/overduerules.tt
@@ -30,7 +30,7 @@ $(document).ready(function() {
         <h1>Defining [% IF ( branch ) %]overdue actions for [% branch %][% ELSE %]default overdue actions[% END %]</h1>
         <div class="help">
             <p>Delay is the number of days after an checkout is due before an action is triggered. </p>
-            <p>If you want Koha to trigger an action (send a letter or restrict a member), a delay value is required.</p>
+            <p>If you want Koha to trigger an action (send a letter or debar member), a delay value is required.</p>
             <p>Columns must be filled left to right: if the first column is blank, other columns will be ignored. </p>
         </div>
             <form method="post" action="/cgi-bin/koha/tools/overduerules.pl" id="selectlibrary">
@@ -56,7 +56,7 @@ $(document).ready(function() {
                     <li>Delay [% ERRORDELAY %] for [% BORERR %] patron category has some unexpected characters. There should be only numerical characters. </li>
                 [% END %]
                 [% IF ( ERRORUSELESSDELAY ) %]
-                    <li>No letter or restriction action specified for delay [% ERRORUSELESSDELAY %] for [% BORERR %] patron category.  If a delay is supplied, either a letter, restrict action, or both should be specified.</li>
+                    <li>No letter or debar action specified for delay [% ERRORUSELESSDELAY %] for [% BORERR %] patron category.  If a delay is supplied, either a letter, debar action, or both should be specified.</li>
                 [% END %]
                 [% IF ( ERRORORDER ) %]
                     <li>The first notice's delay should be less than the second, which should be less than the third for the <strong>[% BORERR %]</strong> patron category </li>
@@ -79,7 +79,7 @@ $(document).ready(function() {
 	</ul>
 
 <div id="first"><table>
-					<tr><th>&nbsp;</th><th scope="col">Delay</th><th scope="col">First Letter</th><th scope="col">Restrict</th></tr>
+					<tr><th>&nbsp;</th><th scope="col">Delay</th><th scope="col">First Letter</th><th scope="col">Debar</th></tr>
                     [% FOREACH tabl IN table %]
                      [% UNLESS ( loop.odd ) %]
                                 <tr class="highlight">
@@ -119,7 +119,7 @@ $(document).ready(function() {
 </div>
 
 <div id="second"><table>
-					<tr><th>&nbsp;</th><th scope="col">Delay</th><th scope="col">Second Letter</th><th scope="col">Restrict</th></tr>
+					<tr><th>&nbsp;</th><th scope="col">Delay</th><th scope="col">Second Letter</th><th scope="col">Debar</th></tr>
                     [% FOREACH tabl IN table %]
                      [% UNLESS ( loop.odd ) %]
                                 <tr class="highlight">
@@ -159,7 +159,7 @@ $(document).ready(function() {
 </div>
 
 <div id="third"><table>
-					<tr><th>&nbsp;</th><th scope="col">Delay</th><th scope="col">Third Letter</th><th scope="col">Restrict</th></tr>
+					<tr><th>&nbsp;</th><th scope="col">Delay</th><th scope="col">Third Letter</th><th scope="col">Debar</th></tr>
                     [% FOREACH tabl IN table %]
                      [% UNLESS ( loop.odd ) %]
                                 <tr class="highlight">
diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
index b8a531f..aa295c9 100644
--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css
+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
@@ -1873,10 +1873,6 @@ a#MARCview, a#MARCviewPop, a#ISBDview, a#Normalview, a#Fullhistory, a#Briefhisto
 #comments .yours {
 	background-color : #effed5;
 }
-.commentline .avatar {
-	float : right;
-	padding-left : .5em;
-}
 #comments #addcomment {
 	margin : 0 -1em -1em -1em;
 	padding : .3em 1em;
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc
index d05583f..fcfe120 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc
@@ -1,32 +1,32 @@
-[% IF ( item.datedue ) %]
+[% IF ( datedue ) %]
     [% IF ( OPACShowCheckoutName ) %]
-        Checked out to [% item.cardnumber %] [% item.firstname %] [% item.surname %]
+        Checked out to [% cardnumber %] [% firstname %] [% surname %]
     [% ELSE %]
         Checked out
     [% END %]
-[% ELSIF ( item.transfertwhen ) %]
-    In transit from [% item.transfertfrom %]
-    to [% item.transfertto %] since [% item.transfertwhen %]
-[% ELSIF ( item.waiting ) %]
+[% ELSIF ( transfertwhen ) %]
+    In transit from [% transfertfrom %]
+    to [% transfertto %] since [% transfertwhen %]
+[% ELSIF ( waiting ) %]
     On hold
-[% ELSIF ( item.wthdrawn ) %]
+[% ELSIF ( wthdrawn ) %]
     Item withdrawn
-[% ELSIF ( item.itemlost ) %]
-    [% IF ( item.lostimageurl ) %]
-        <img src="[% item.lostimageurl %]" alt="[% item.lostimagelabel %]" title="[% item.lostimagelabel %]">
+[% ELSIF ( itemlost ) %]
+    [% IF ( lostimageurl ) %]
+        <img src="[% lostimageurl %]" alt="[% lostimagelabel %]" title="[% lostimagelabel %]">
     [% ELSE %]
         Item lost
     [% END %]
-[% ELSIF ( item.itemnotforloan ) %]
-    [% IF ( item.notforloanvalue ) %]
-        [% item.notforloanvalue %] [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
+[% ELSIF ( itemnotforloan ) %]
+    [% IF ( notforloanvalue ) %]
+        [% notforloanvalue %] [% IF ( restrictedopac ) %]<span class="restricted">([% restrictedopac %])</span>[% END %]
     [% ELSE %]
-        Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
+        Not for loan [% IF ( restrictedopac ) %]<span class="restricted">([% restrictedopac %])</span>[% END %]
     [% END %]
-[% ELSIF ( item.notforloan_per_itemtype ) %]
-    Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
-[% ELSIF ( item.damaged ) %]
+[% ELSIF ( notforloan_per_itemtype ) %]
+    Not for loan [% IF ( restrictedopac ) %]<span class="restricted">([% restrictedopac %])</span>[% END %]
+[% ELSIF ( damaged ) %]
     Item damaged
 [% ELSE %]
-    Available [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]
+    Available [% IF ( restrictedopac ) %]<span class="restricted">([% restrictedopac %])</span>[% END %]
 [% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc
index 3507880..97e7165 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc
@@ -3,7 +3,7 @@
 <div id="search-facets">
 <h4>Refine your search</h4>
 <ul>
-	<li>Availability<ul><li>[% IF ( available ) %]Showing only <strong>available</strong> items. <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi_not_availablity %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]">Show all items</a>[% ELSE %]Limit to <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;limit=available">currently available items.</a>[% END %]</li></ul>
+	<li>Availability<ul><li>[% IF ( available ) %]Showing only <strong>available</strong> items. <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi %][% limit_cgi_not_availablity %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]">Show all items</a>[% ELSE %]Limit to <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;limit=available">currently available items.</a>[% END %]</li></ul>
 	[% IF ( related ) %] <li>(related searches: [% FOREACH relate IN related %][% relate.related_search %][% END %])</li>[% END %]
 	</li>
 	
@@ -14,12 +14,19 @@
 [% IF ( facets_loo.type_label_Topics ) %]Topics[% END %]
 [% IF ( facets_loo.type_label_Places ) %]Places[% END %]
 [% IF ( facets_loo.type_label_Series ) %]Series[% END %]
-[% UNLESS ( singleBranchMode ) %]
+[% UNLESS ( facets_loo.singleBranchMode ) %]
 [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %]
 [% END %]
 <ul>
-        [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;limit=[% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value |html %]">[% facet.facet_label_value %]</a> [% IF ( facet.displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %][% IF ( facets_loo.expandable ) %]
-        <li class="showmore"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;offset=[% facets_loo.offset %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
+        [% FOREACH facet IN facets_loo.facets %]
+        <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi %][% limit_cgi |html %]
+        [% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;
+        limit=[% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value |html %]">
+        
+        [% IF facet.facet_label_value != "*" %]
+        [% facet.facet_label_value %] [% END %]</a> [% IF ( facet.displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %][% IF ( facets_loo.expandable ) %]
+        
+        <li class="showmore"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;offset=[% facets_loo.offset %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
 [% END %]
 </ul></li>
 [% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt
index f9984a7..35fffc8 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tt
@@ -62,7 +62,7 @@
         	[% END %]
 	[% END %]
 [% END %]
-        <li><a class="print" href="#" onclick="window.print();">Print</a></li>
+        <li><a class="print" href="javascript:window.print();">Print</a></li>
 [% IF ( virtualshelves ) %]
    [% IF ( opacuserlogin ) %] [% IF ( loggedinusername ) %]
         <li><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% biblionumber %]'); return false;">
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt
index 284154e..68b0148 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tt
@@ -217,7 +217,7 @@ $(document).ready(function(){
             [% END %]
     [% END %]
 [% END %]
-        <li><a class="print" href="#" onclick="window.print();">
+        <li><a class="print" href="/cgi-bin/koha/opac-detailprint.pl?biblionumber=[% biblionumber %]" onclick="Dopop('opac-detailprint.pl?biblionumber=[% biblionumber %]'); return false;">
             Print
         </a></li>
 [% IF ( virtualshelves ) %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tt
index f6479f9..dab4fda 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-addbybiblionumber.tt
@@ -66,7 +66,7 @@
 		<option value="1">Private</option>
 		<option value="2">Public</option>
 		</select></li></ol></fieldset>
-		[% FOREACH biblio IN biblios %] <input type="hidden" name="biblionumber" value="[% biblio.biblionumber | html%]" />[% END %]
+		[% FOREACH biblio IN biblios %] <input type="hidden" name="biblionumber" value="[% biblio.biblionumber %]" />[% END %]
 		<fieldset class="action"><input type="submit" value="Save" class="submit" /> <a class="close cancel" href="#">Cancel</a></fieldset>
 		</form>
 	[% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt
index 216ce8e..e882bb8 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt
@@ -6,7 +6,7 @@
 <body id="advsearch"><div id="doc3" class="yui-t7">
 <div id="bd">
 [% INCLUDE 'masthead.inc' %]
-<div id="yui-main">
+
 <form action="/cgi-bin/koha/opac-search.pl" method="get">
     <div class="yui-g">
 [% IF ( if_expanded_options_actually_worked ) %]
@@ -286,7 +286,7 @@
 
 <!-- /SEARCH BUTTONS --></div></div>
 </form>
-</div>
+
 <script type="text/javascript" language="javascript">
     /* This function allows to display a new field to search.
     */
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt
index 203cf7f..b8c597f 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-authoritiessearchresultlist.tt
@@ -51,7 +51,7 @@
 					<td>[% resul.summary %]</td>
 
 						<td>
-					[% authtypetext %]
+					[% resul.authtypetext %]
 						</td>
 					[% UNLESS ( resul.isEDITORS ) %]
 						<td>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
index 3430cbb..15d5e90 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
@@ -72,7 +72,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
     [% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %][% END %]
 
     [% IF ( GoogleJackets ) %]<div style="block" title="[% biblionumber |url %]" class="[% normalized_isbn %]" id="gbs-thumbnail-preview"></div>[% END %]
-    [% IF ( BakerTaylorEnabled ) %][% IF ( normalized_isbn ) %][% IF ( OPACurlOpenInNewWindow ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% normalized_isbn %]" target="_blank"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% normalized_isbn %]" /></a>[% ELSE %]<a href="https://[% BakerTaylorBookstoreURL |html %][% normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% normalized_isbn %]" /></a>[% END %][% END %][% END %]
+    [% IF ( BakerTaylorEnabled ) %][% IF ( normalized_isbn ) %][% IF ( OPACurlOpenInNewWindow ) %]<a href="https://[% BakerTaylorBookstoreurl |html %][% normalized_isbn %]" target="_blank"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageurl |html %][% normalized_isbn %]" /></a>[% ELSE %]<a href="https://[% BakerTaylorBookstoreurl |html %][% normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageurl |html %][% normalized_isbn %]" /></a>[% END %][% END %][% END %]
     </div>
 
     <abbr class="unapi-id" title="koha:biblionumber:[% biblionumber %]"><!-- unAPI --></abbr>
@@ -182,14 +182,14 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
         [% END %]
     </span>[% END %]
 
-    [% IF ( MARCURLS ) %]
+    [% IF ( MARCurlS ) %]
     <div class="results_summary"><span class="label">Online Resources:</span>
-    <ul>    [% FOREACH MARCurl IN MARCURLS %]
+    <ul>    [% FOREACH MARCurl IN MARCurlS %]
         <li>[% IF ( MARCurl.part ) %][% MARCurl.part %]
             <br />[% END %] 
         <!-- here you might do a tmpl_if name="toc" and use greybox or equivalent for table of contents -->
         
-        [% IF ( MARCurl.OPACurlOpenInNewWindow ) %]<a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]" target="_blank">[% ELSE %]<a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]">[% END %]
+        [% IF ( MARCurl.OPACurlOpenInNewWindow ) %]<a href="[% MARCurl.MARCurl %]" title="[% MARCurl.MARCurl %]" target="_blank">[% ELSE %]<a href="[% MARCurl.MARCurl %]" title="[% MARCurl.MARCurl %]">[% END %]
         
         [% MARCurl.linktext %]</a>
             [% IF ( MARCurl.notes ) %]<ul>[% FOREACH note IN MARCurl.notes %]<li>[% note.note %]</li>[% END %]</ul>[% END %]</li>
@@ -403,6 +403,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 		<th>Date Due</th>
 	    </tr></thead>
 	    <tbody>[% FOREACH ITEM_RESULT IN ITEM_RESULTS %]
+	    [% IF (ITEM_RESULT.ccode.substr(0,3) == homebranch) %]
 	    <tr>[% IF ( item_level_itypes ) %]<td>[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %]<img src="[% ITEM_RESULT.imageurl %]" title="[% ITEM_RESULT.description %]" alt="[% ITEM_RESULT.description %]" />[% END %][% END %] [% ITEM_RESULT.description %]</td>[% END %]
 		<td>[% UNLESS ( singleBranchMode ) %][% IF ( ITEM_RESULT.branchurl ) %]<a href="[% ITEM_RESULT.branchurl %]">[% ITEM_RESULT.branchname %]</a>[% ELSE %][% ITEM_RESULT.branchname %][% END %][% END %] <span class="shelvingloc">[% ITEM_RESULT.location_description %]</span> </td>
 		[% IF ( itemdata_ccode ) %]<td>[% ITEM_RESULT.ccode %]</td>[% END %]
@@ -410,13 +411,14 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 		[% IF ( itemdata_enumchron ) %]<td>[% ITEM_RESULT.enumchron %]</td>[% END %]
 		[% IF ( itemdata_uri ) %]<td><a href="[% ITEM_RESULT.uri %]">[% ITEM_RESULT.uri %]</a></td>[% END %]
 		[% IF ( itemdata_copynumber ) %]<td>[% ITEM_RESULT.copynumber %]</td>[% END %]
-		<td>[% INCLUDE 'item-status.inc' item = ITEM_RESULT %]</td>
+		<td>[% INCLUDE 'item-status.inc' %]</td>
 		[% IF ( itemdata_itemnotes ) %]<td>[% ITEM_RESULT.itemnotes %]</td>[% END %]
 		<td>[% ITEM_RESULT.datedue %]</td>
 		[% IF ( ITEM_RESULT.type ) %]
 		<td><a href="/cgi-bin/koha/maint/catmaintain.pl?type=fixitemtype&amp;bi=[% ITEM_RESULT.biblioitemnumber %]&amp;item=[% ITEM_RESULT.itemtype %]">Fix Itemtype</a></td>
 		[% END %]
 	    </tr>
+	    [% END %]
 	    [% END %]</tbody>
 	</table>
     [% END %]
@@ -667,9 +669,6 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
         [% FOREACH review IN reviews %]
             [% IF ( review.your_comment ) %]
             <div class="commentline yours" id="c[% review.reviewid %]">
-                [% IF ( review.avatarurl ) %]
-            <img class="avatar" src="[% review.avatarurl %]" height="80" width="80"/>
-                [% END %]
             <h5>
                 Your Comment
             </h5>
@@ -681,9 +680,6 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
             [% ELSE %]
             <div class="commentline">
             [% IF ( ShowReviewer ) %]
-                [% IF ( review.avatarurl ) %]
-            <img class="avatar" src="[% review.avatarurl %]" height="80" width="80"/>
-                [% END %]
             <h5>
                 Comment by
                 [% review.title %]
@@ -814,7 +810,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
         	[% END %]
 	[% END %]
 [% END %]
-        <li><a class="print" href="#" onclick="window.print();">Print</a></li>
+        <li><a class="print" href="javascript:window.print();">Print</a></li>
 [% IF ( virtualshelves ) %]
     [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %]
         <li><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% biblionumber %]'); return false;">
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-downloadcart.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-downloadcart.tt
index 8d22c4d..45d5de7 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-downloadcart.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-downloadcart.tt
@@ -19,7 +19,7 @@
 	</select></li></ol>
 </fieldset>
 <fieldset class="action">
-	<input type="hidden" name="bib_list" value="[% bib_list | html %]" />
+	<input type="hidden" name="bib_list" value="[% bib_list %]" />
 	<input type="submit" name="save" value="Go" />
 </fieldset>
     </form>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-downloadshelf.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-downloadshelf.tt
index b984f5d..0b2124f 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-downloadshelf.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-downloadshelf.tt
@@ -7,38 +7,29 @@
 </script>
 </head>
 <body id="opac-downloadlist" style="padding:1em;">
-<div id="userdownloadshelf" class="container">
-[% UNLESS ( invalidlist ) %]
-	[% IF ( format ) %]
-	    <p>Your download should begin automatically.</p>
-	[% ELSE %]
-	<form method="post" action="/cgi-bin/koha/opac-downloadshelf.pl">
-	<fieldset class="rows">
-		<ol><li><label for="format">Download list:</label>
-	        <select name="format" id="format">
-		    <option value="">-- Choose Format --</option>
-		    <option value="iso2709">iso2709</option>
-		    <option value="ris">RIS</option>
-		    <option value="bibtex">BibTex</option>
-		    [% FOREACH csv_profile IN csv_profiles %]
-		    <option value="[% csv_profile.export_format_id %]">CSV - [% csv_profile.profile %]</option>
-		    [% END %]
+<div id="userdownloadshelf" class="container">[% IF ( format ) %]
+    <p>Your download should begin automatically.</p>
+[% ELSE %]
+<form method="post" action="/cgi-bin/koha/opac-downloadshelf.pl">
+<fieldset class="rows">
+	<ol><li><label for="format">Download list:</label>
+        <select name="format" id="format">
+	    <option value="">-- Choose Format --</option>
+	    <option value="iso2709">iso2709</option>
+	    <option value="ris">RIS</option>
+	    <option value="bibtex">BibTex</option>
+	    [% FOREACH csv_profile IN csv_profiles %]
+	    <option value="[% csv_profile.export_format_id %]">CSV - [% csv_profile.profile %]</option>
+	    [% END %]
 
-		</select></li></ol>
-	</fieldset>
-	<fieldset class="action">	<input type="hidden" name="shelfid" value="[% shelfid | html %]" />
-		<input type="submit" name="save" value="Go" /></fieldset>
-	    </form>
+	</select></li></ol>
+</fieldset>
+<fieldset class="action">	<input type="hidden" name="shelfid" value="[% shelfid %]" />
+	<input type="submit" name="save" value="Go" /></fieldset>
+    </form>
 
-	    <p><a class="button close" href="/cgi-bin/koha/opac-shelves.pl">Back to lists</a></p>
+    <p><a class="button close" href="/cgi-bin/koha/opac-shelves.pl">Back to lists</a></p>
 
-	[% END %]
-[% ELSE %]
-	<div class="dialog alert">
-		<p>You do not have permission to download this list.</p>
-	</div>
-	<p><a class="button close" href="/cgi-bin/koha/opac-shelves.pl">Back to lists</a></p>
-[% END %]
-</div>
+[% END %]</div>
 </body>
 </html>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tt
index 5a13119..e7e2821 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tt
@@ -42,7 +42,7 @@
 <img src="http://www.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn %]/SC.GIF&amp;client=[% SEARCH_RESULT.SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% SEARCH_RESULT.normalized_upc %]&amp;oclc=[% SEARCH_RESULT.normalized_oclc %]" alt="" />
 [% END %][% END %][% END %][% END %]
 
-[% IF ( BakerTaylorEnabled ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% SEARCH_RESULT.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% SEARCH_RESULT.normalized_isbn %]" /></a>[% END %][% END %]
+[% IF ( BakerTaylorEnabled ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<a href="https://[% SEARCH_RESULT.BakerTaylorBookstoreurl |html %][% SEARCH_RESULT.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% SEARCH_RESULT.BakerTaylorImageurl |html %][% SEARCH_RESULT.normalized_isbn %]" /></a>[% END %][% END %]
 	   <p>[% IF ( SEARCH_RESULT.author ) %]By [% SEARCH_RESULT.author |html %]. [% END %]
 	   [% IF ( SEARCH_RESULT.place ) %][% SEARCH_RESULT.place |html %] [% END %][% IF ( SEARCH_RESULT.publishercode ) %][% SEARCH_RESULT.publishercode |html %][% END %][% IF ( SEARCH_RESULT.publicationyear ) %] [% SEARCH_RESULT.publicationyear |html %]
                     [% ELSE %][% IF ( SEARCH_RESULT.copyrightdate ) %] [% SEARCH_RESULT.copyrightdate |html %][% END %][% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt
index de34e02..ec880d3 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-privacy.tt
@@ -1,7 +1,7 @@
 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha Online[% END %] Catalog &rsaquo; Privacy management for [% firstname %] [% surname %]
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
-<body id="opac-privacy">
+<body>
 <div id="doc3" class="yui-t1">
    <div id="bd">
 [% INCLUDE 'masthead.inc' %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt
index 70aac88..05b50dd 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tt
@@ -67,7 +67,7 @@ You have never borrowed anything from this library.
 
     [% IF ( GoogleJackets ) %][% IF ( READING_RECOR.normalized_isbn ) %]<div style="block" title="[% READING_RECOR.biblionumber |url %]" class="[% READING_RECOR.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
 
-    [% IF ( BakerTaylorEnabled ) %][% IF ( READING_RECOR.normalized_isbn ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% READING_RECOR.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% READING_RECOR.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
+    [% IF ( BakerTaylorEnabled ) %][% IF ( READING_RECOR.normalized_isbn ) %]<a href="https://[% READING_RECOR.BakerTaylorBookstoreurl |html %][% READING_RECOR.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% READING_RECOR.BakerTaylorImageurl |html %][% READING_RECOR.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
 
 	[% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %]
 	<img src="https://secure.syndetics.com/index.aspx?isbn=[% READING_RECOR.normalized_isbn %]/SC.GIF&amp;client=[% READING_RECOR.SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% READING_RECOR.normalized_upc %]&amp;oclc=[% READING_RECOR.normalized_oclc %]" alt="" class="thumbnail" />
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
index 25e9a3a..bc46b28 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
@@ -152,7 +152,6 @@
  });
 // ]]>
 </script>
-<style type="text/css">td ul { padding : 0; } td li { white-space: nowrap; font-size: 90%; list-style-type:none; padding : .3em 0; }</style>
 </head>
 
 <body id="opac-holds">
@@ -330,7 +329,7 @@
               Calendar.setup(
               {
                 inputField : "reserve_date_[% bibitemloo.biblionumber %]",
-                ifFormat : "[% DHTMLcalendar_dateformat %]",
+                ifFormat : "[% bibitemloo.DHTMLcalendar_dateformat %]",
                 button : "CalendarReserveDate[% bibitemloo.biblionumber %]",
                 disableFunc : validate[% bibitemloo.biblionumber %],
                 dateStatusFunc : validate[% bibitemloo.biblionumber %]
@@ -338,8 +337,6 @@
               );
               //]]>
               </script>
-      <p style="margin:.3em 2em;">
-      <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('reserve_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear Date</a></p>
                 </td>[% END %]
 
 		    [% END %]
@@ -362,7 +359,7 @@
       Calendar.setup(
         {
           inputField : "expiration_date_[% bibitemloo.biblionumber %]",
-          ifFormat : "[% DHTMLcalendar_dateformat %]",
+          ifFormat : "[% bibitemloo.DHTMLcalendar_dateformat %]",
           button : "CalendarExpirationDate_[% bibitemloo.biblionumber %]",
           disableFunc : validate1,
           dateStatusFunc : validate1
@@ -374,13 +371,11 @@
       <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('expiration_date_[% bibitemloo.biblionumber %]').value='';return false;">Clear Date</a></p>
     </td>[% END %]
 
-                    [% IF ( bibitemloo.holdable ) %]
-		    <!-- HOLD ABLE -->
-		    [% IF ( OPACItemHolds ) %]
-		    <!-- ITEM HOLDS -->
+                    [% IF ( bibitemloo.holdable ) %][% IF ( OPACItemHolds ) %]
                                           <td class="place_on_type" style="display:none">
-                                            <ul>
-                                                <li>
+                                            <table>
+                                              <tr>
+                                                <td>
                                                   [% UNLESS ( bibitemloo.holdable ) %]
                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
                                                            id="reqany_[% bibitemloo.biblionumber %]"
@@ -397,8 +392,10 @@
                                                     />
                                                   [% END %]
                                                   <label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label>
-                                                </li>
-                                                <li>
+                                                </td>
+                                              </tr>
+                                              <tr>
+                                                <td>
                                                   [% UNLESS ( bibitemloo.holdable ) %]
                                                     <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
                                                            id="reqspecific_[% bibitemloo.biblionumber %]"
@@ -414,8 +411,9 @@
                                                     />
                                                   [% END %]
                                                   <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label>
-                                                </li>
-                                            </ul>
+                                                </td>
+                                              </tr>
+                                            </table>
                                           </td>
                                         [% END %][% END %]
 
@@ -442,8 +440,9 @@
                   [% IF ( OPACItemHolds ) %]
                   [% IF ( bibitemloo.holdable ) %]
                     <tr class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
-                      <td>&nbsp;</td>
-                      <td colspan="[% itemtable_colspan %]">
+                      <td colspan="1">
+                      </td>
+                      <td colspan="[% bibitemloo.itemtable_colspan %]">
                         <table>
                           <caption>Select a specific copy:</caption>
                           <tr>
@@ -452,7 +451,7 @@
                               <th>Item Type</th>
                             [% END %]
                             <th>Barcode</th>
-                            [% UNLESS ( singleBranchMode ) %]
+                            [% UNLESS ( bibitemloo.singleBranchMode ) %]
                               <th>Home Library</th>
                               <th>Last Location</th>
                             [% END %]
@@ -467,7 +466,7 @@
                             <tr class="[% itemLoo.backgroundcolor %]">
                               <td>
                                 [% IF ( itemLoo.available ) %]
-                                  <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]"
+                                  <input type="radio" class="checkitem checkitem_[% itemLoo.biblionumber %]" name="checkitem_[% itemLoo.biblionumber %]"
                                          value="[% itemLoo.itemnumber %]" />
                                 [% ELSE %]
                                   <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" />
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
index 2047a1b..e08e31b 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
@@ -437,18 +437,18 @@ $(document).ready(function(){
 
 				<span class="results_summary">
                 <span class="label">Availability:</span>
-                    [% IF ( SEARCH_RESULT.available_items_loop.0 ) %]
+                    [% IF ( SEARCH_RESULT.available_items_loop ) %]
                     <span class="available"><strong>Copies available:</strong>
                     [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %]
                     [% UNLESS ( available_items_loo.hideatopac ) %]
-                    [% IF ( singleBranchMode ) %]
+                    [% IF ( available_items_loo.singleBranchMode ) %]
                         [% available_items_loo.location %]
                     [% ELSE %]
                         [% available_items_loo.branchname %]
                     [% END %]
 
                     [% IF ( OPACItemsResultsDisplay ) %]
-					    [% UNLESS ( singleBranchMode ) %][% available_items_loo.location %][% END %]
+					    [% UNLESS ( available_items_loo.singleBranchMode ) %][% available_items_loo.location %][% END %]
                         [% IF ( available_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/opac-search.pl?q=callnum:[% available_items_loo.itemcallnumber |url %]">[% available_items_loo.itemcallnumber %]</a>][% END %]
                     [% END %]
                     ([% available_items_loo.count %]),
@@ -499,7 +499,7 @@ $(document).ready(function(){
                                        [% ELSIF ( loop.first ) %]<span class="tagstatus" id="login4tags">Log in to add tags.</span>
                                     [% END %]
                                 [% END %]
-                                    [% IF ( SEARCH_RESULT.TagLoop.size ) %]
+                                    [% IF ( SEARCH_RESULT.TagLoop ) %]
                                     </div>[% END %]
                                 [% END %]
                                 [% END %][% END %]
@@ -536,7 +536,7 @@ $(document).ready(function(){
 
                 [% IF ( GoogleJackets ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<div style="block" title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
                 </a>
-                [% IF ( BakerTaylorEnabled ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% SEARCH_RESULT.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% SEARCH_RESULT.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
+                [% IF ( BakerTaylorEnabled ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<a href="https://[% SEARCH_RESULT.BakerTaylorBookstoreurl |html %][% SEARCH_RESULT.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% SEARCH_RESULT.BakerTaylorImageurl |html %][% SEARCH_RESULT.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
 				</td>
                 </tr>
                 [% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-review.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-review.tt
index 3e69614..338f174 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-review.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-review.tt
@@ -11,7 +11,7 @@
 			[% IF ( cgi_debug ) %]alert(_('injecting OLD comment: ')+comment);[% END %]
 			parent.opener.$('#c[% reviewid %] p').prev("small").prev("h5").html("Your Edited Comment (preview, pending approval)");
 			parent.opener.$('#c[% reviewid %] p').html(comment);
-			parent.opener.$('#c[% reviewid %] p').append("<a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=[% biblionumber | uri %]&amp;reviewid=[% reviewid | uri%]\');\">Edit<\/a>");
+			parent.opener.$('#c[% reviewid %] p').append(" <a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=[% biblionumber %]&amp;reviewid=[% reviewid %]\');\">Edit<\/a>");
 			[% END %]
 			return 1;
 		};
@@ -21,7 +21,7 @@
 			parent.opener.$('#newcomment').html(
 				"<h5>Your Comment (preview, pending approval)<\/h5>" +
 				"<p>"+comment+"<\/p>" +
-				"<a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=[% biblionumber |uri%]\');\">Edit<\/a><\/p>"
+				"<a href=\"#comment\" onclick=\"Dopop(\'/cgi-bin/koha/opac-review.pl?biblionumber=[% biblionumber %]\');\">Edit<\/a><\/p>"
 			);
 			parent.opener.$("#addcomment").prev("p").remove();
 			parent.opener.$("#addcomment").remove();
@@ -66,7 +66,7 @@
 	</div>
 [% END %]
 <form id="reviewf" action="/cgi-bin/koha/opac-review.pl[% IF ( cgi_debug ) %]?debug=1[% END %]" method="post">
-    <input type="hidden" name="biblionumber" value="[% biblionumber | html%]" />
+    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
 	<fieldset class="brief">
 	<legend>Comments on <i>[% title |html %] [% subtitle %]</i>[% IF ( author ) %]by [% author %][% END %]</legend>
             <ol><li><textarea id="review" name="review" cols="60" rows="8">[% review %]</textarea></li></ol>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelfform.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelfform.tt
index 1085ae0..88b084e 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelfform.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendshelfform.tt
@@ -20,30 +20,25 @@
     [% END %]
     
 [% ELSE %]
-    [% IF ( invalidlist ) %]
-        <div class="dialog alert">
-        <p>You do not have permission to send this list.</p>
-        </div>
-        <p><a class="button close" href="/cgi-bin/koha/opac-shelves.pl">Back to lists</a></p>
-    [% ELSE %]
-        <form action="[% url %]" method="post" id="sendshelfform">
 
-        <fieldset class="rows">
-        <legend>Sending your list</legend>
-        <ol>   <li>
-                <label for="email">Email Address:</label>
-                <input type="text" id="email" name="email" size="43" class="focus" />
-            </li>
-            <li>
-                    <label for="comment">Comment:</label>
-                    <textarea id="comment" name="comment" rows="4" cols="40"></textarea>
-            </li>
-            <li>
-                <input type="hidden" name="shelfid" value="[% shelfid %]" />
-            </li></ol></fieldset>
-               <fieldset class="action"> <input type="submit" value="Send" /> <a class="cancel close" href="#">Cancel</a> </fieldset>
-        </form>
-    [% END %]
+<form action="[% url %]" method="post" id="sendshelfform">
+
+<fieldset class="rows"> 
+<legend>Sending your list</legend>
+<ol>   <li>
+        <label for="email">Email Address:</label>
+        <input type="text" id="email" name="email" size="43" class="focus" />
+    </li>
+    <li>
+            <label for="comment">Comment:</label>
+            <textarea id="comment" name="comment" rows="4" cols="40"></textarea>
+    </li>
+    <li>
+        <input type="hidden" name="shelfid" value="[% shelfid %]" />
+    </li></ol></fieldset>
+       <fieldset class="action"> <input type="submit" value="Send" /> <a class="cancel close" href="#">Cancel</a> </fieldset>
+</form>
+
 [% END %]</div>
 </body>
 </html>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-serial-issues.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-serial-issues.tt
index 5d45b53..8d6b94b 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-serial-issues.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-serial-issues.tt
@@ -12,9 +12,9 @@
 <div id="userserialissues" class="container">
 <h2>Issues for a subscription</h2>
 <div id="views">
-	<span class="view"><a id="Normalview" href="opac-detail.pl?biblionumber=[% biblionumber | html %]" class="button">Normal View</a></span>
+	<span class="view"><a id="Normalview" href="opac-detail.pl?biblionumber=[% biblionumber %]" class="button">Normal View</a></span>
 		<span class="view"><span id="Briefhistory">Brief history</span></span>
-	<span class="view"><a id="Fullhistory" href="opac-serial-issues.pl?selectview=full&amp;biblionumber=[% biblionumber | html%]" class="button">Full History</a></span>
+	<span class="view"><a id="Fullhistory" href="opac-serial-issues.pl?selectview=full&amp;biblionumber=[% biblionumber %]" class="button">Full History</a></span>
 </div>
 <form method="post" name="f">
 [% FOREACH subscription_LOO IN subscription_LOOP %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
index 9220367..93f9c16 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt
@@ -343,7 +343,7 @@ $(function() {
 
                 [% IF ( GoogleJackets ) %][% IF ( itemsloo.normalized_isbn ) %]<div style="block" title="[% itemsloo.biblionumber |url %]" class="[% itemsloo.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
                 </a>
-                [% IF ( BakerTaylorEnabled ) %][% IF ( itemsloo.normalized_isbn ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% itemsloo.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% itemsloo.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
+                [% IF ( BakerTaylorEnabled ) %][% IF ( itemsloo.normalized_isbn ) %]<a href="https://[% itemsloo.BakerTaylorBookstoreurl |html %][% itemsloo.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% itemsloo.BakerTaylorImageurl |html %][% itemsloo.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
         </td>
                       </tr>
                   [% END %]<!-- /itemsloop -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt
index 2c6e179..6d53953 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews-rss.tt
@@ -18,7 +18,7 @@
 <img src="http://www.syndetics.com/index.aspx?isbn=[% review.normalized_isbn %]/SC.GIF&amp;client=[% review.SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% review.normalized_upc %]&amp;oclc=[% review.normalized_oclc %]" alt="" />
 [% END %][% END %][% END %][% END %]
 
-[% IF ( BakerTaylorEnabled ) %][% IF ( review.normalized_isbn ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% review.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% review.normalized_isbn %]" /></a>[% END %][% END %]
+[% IF ( BakerTaylorEnabled ) %][% IF ( review.normalized_isbn ) %]<a href="https://[% review.BakerTaylorBookstoreurl |html %][% review.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% review.BakerTaylorImageurl |html %][% review.normalized_isbn %]" /></a>[% END %][% END %]
 	   [% IF ( review.author ) %]<p>By [% review.author |html %].</p> [% END %]
 	   <p>[% IF ( review.place ) %][% review.place |html %] [% END %][% IF ( review.publishercode ) %][% review.publishercode |html %][% END %][% IF ( review.publicationyear ) %] [% review.publicationyear |html %]
                     [% ELSE %][% IF ( review.copyrightdate ) %] [% review.copyrightdate |html %][% END %][% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt
index a50d825..e64fcae 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt
@@ -46,11 +46,7 @@ $(document).ready(function(){
     [% END %]
     [% IF ( review.copyrightdate ) %]<span class="results_summary"><span class="label">Date:</span>[% review.copyrightdate %]</span>[% END %]</p>
 
-            <p class="commentline[% IF ( review.your_comment ) %] yours[% END %]">
-            [% IF ( review.avatarurl ) %]
-                <img class="avatar" src="[% review.avatarurl %]" height="40" width="40"/>
-            [% END %]
-            [% review.review |html %]
+            <p class="commentline[% IF ( review.your_comment ) %] yours[% END %]">[% review.review |html %]
             <span style="font-size:87%;font-color:#CCC;">Added [% review.datereviewed %] [% IF ( review.your_comment ) %] by <strong>you</strong>[% ELSE %]
             [% IF ( ShowReviewer ) %] by
             [% review.firstname %] [% review.surname %][% END %][% END %]</span></p>
@@ -75,7 +71,7 @@ $(document).ready(function(){
 
         [% IF ( GoogleJackets ) %][% IF ( review.normalized_isbn ) %]<div style="block" title="[% review.biblionumber |url %]" class="[% review.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
         </a>
-        [% IF ( BakerTaylorEnabled ) %][% IF ( review.normalized_isbn ) %]<a href="https://[% review.BakerTaylorBookstoreURL |html %][% review.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% review.BakerTaylorImageURL |html %][% review.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
+        [% IF ( BakerTaylorEnabled ) %][% IF ( review.normalized_isbn ) %]<a href="https://[% review.BakerTaylorBookstoreurl |html %][% review.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% review.BakerTaylorImageurl |html %][% review.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span>[% END %][% END %]
         </td>
     </tr>
     [% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
index 92bd44d..26c8670 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt
@@ -4,7 +4,6 @@
     [% BORROWER_INF.firstname %] [% BORROWER_INF.surname %]
 [% END %]
 [% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.metadata.min.js"></script>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
 <script type="text/JavaScript" language="JavaScript">
 //<![CDATA[
@@ -17,19 +16,60 @@ $.tablesorter.addParser({
 });
             $(function() {
             $('#opac-user-views > ul').tabs();
-            $.tablesorter.defaults.widgets = ['zebra'];
-            [% IF ( dateformat == 'metric' ) %]$.tablesorter.defaults.dateFormat = ['uk'];[% END %]
-			$("#holdst").tablesorter({
-				sortList: [[0,0]]
+			$("#holdst").tablesorter({[% IF ( dateformat == 'metric' ) %]
+		dateFormat: 'uk',[% END %]
+				widgets : ['zebra'],
+				sortList: [[0,0]],
+		        headers: { 0: { sorter: 'articles' },5: { sorter: false }
+				}
 			}); 
-			$("#checkoutst").tablesorter({
-                [% IF ( JacketImages ) %]sortList: [[2,0]][% ELSE %]sortList: [[1,0]][% END %]
-            }); 
-			$("#overduest").tablesorter();
+			$("#checkoutst").tablesorter({[% IF ( dateformat == 'metric' ) %]
+		dateFormat: 'uk',[% END %]
+				widgets : ['zebra'],
+				[% IF ( JacketImages ) %]
+					sortList: [[3,0]],
+						[% IF ( item_level_itypes ) %]
+							headers: { 0: { sorter: false }, 1: { sorter: 'articles' },4: { sorter: false },5: { sorter: false },6: { sorter: false }}
+						[% ELSE %]
+							headers: { 0: { sorter: false }, 1: { sorter: 'articles' },5: { sorter: false },6: { sorter: false },7: { sorter: false }}
+						[% END %]
+				[% ELSE %]
+						[% IF ( item_level_itypes ) %]
+							sortList: [[2,0]],
+							headers: { 0: { sorter: 'articles' },3: { sorter: false },4: { sorter: false },5: { sorter: false }}
+						[% ELSE %]
+							sortList: [[3,0]],
+							headers: { 0: { sorter: 'articles' },4: { sorter: false },5: { sorter: false },6: { sorter: false }}
+					[% END %]
+				[% END %]
+			}); 
+			$("#overduest").tablesorter({[% IF ( dateformat == 'metric' ) %]
+		dateFormat: 'uk',[% END %]
+				widgets : ['zebra'],
+				[% IF ( JacketImages ) %]
+					sortList: [[1,0]],
+						[% IF ( item_level_itypes ) %]
+							headers: { 0: { sorter: false }, 1: { sorter: 'articles' },4: { sorter: false },5: { sorter: false }}
+						[% ELSE %]
+							headers: { 0: { sorter: false }, 1: { sorter: 'articles' },5: { sorter: false },6: { sorter: false }}
+						[% END %]
+				[% ELSE %]
+						[% IF ( item_level_itypes ) %]
+							sortList: [[0,0]],
+							headers: { 0: { sorter: 'articles' },3: { sorter: false }}
+						[% ELSE %]
+							sortList: [[0,0]],
+							headers: { 0: { sorter: 'articles' },1: { sorter: false },3: { sorter: false }}
+					[% END %]
+				[% END %]
+			});
 [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
             });
 //]]>
 </script>
+[% IF (redirect) %]
+<script>location.href='/cgi-bin/koha/opac-main.pl'</script>
+[% END %]
 </head>
 <body id="opac-user">
 <div id="doc3" class="yui-t1">
@@ -131,7 +171,7 @@ $.tablesorter.addParser({
         <table id="waitingt">
             <caption>Holds Waiting</caption>
            <thead> <tr>
-                <th colspan="2" class="{sorter:'articles'}">Title</th>
+                <th colspan="2">Title</th>
                 <th>Hold date</th>
                 <th>Pick Up Library</th>
             </tr></thead>
@@ -161,20 +201,20 @@ $.tablesorter.addParser({
         <table id="checkoutst">
         <caption>[% issues_count %] Item(s) Checked Out</caption>
        <thead><tr>
-		[% IF ( JacketImages ) %]<th class="{sorter: false}">&nbsp;</th>[% END %]
-        <th class="{sorter:'articles'}">Title</th>
-        <th>Due</th>
+		[% IF ( JacketImages ) %]<th>&nbsp;</th>[% END %]
+        <th>Title</th>
 		[% UNLESS ( item_level_itypes ) %]<th>Item Type</th> [% END %]
         [% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
         <th>Call No.</th>
+        <th>Due</th>
         [% IF ( OpacRenewalAllowed ) %]
-        [% UNLESS ( patron_flagged ) %]<th class="{sorter: false}">Renew</th>[% END %]
+        [% UNLESS ( patron_flagged ) %]<th>Renew</th>[% END %]
         [% END %]
 [% IF ( OPACFinesTab ) %]
         <th>Fines</th>
 [% END %]
         [% IF ( OPACMySummaryHTML ) %]
-        <th class="{sorter: false}">Links</th>
+        <th>Links</th>
         [% END %]
         </tr></thead>
         <tbody>
@@ -195,7 +235,7 @@ $.tablesorter.addParser({
 
 [% IF ( GoogleJackets ) %][% IF ( ISSUE.normalized_isbn ) %]<div style="display:block;" title="Click to view in Google Books" class="[% ISSUE.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>[% ELSE %]<a href="http://books.google.com/books?q=[% ISSUE.title |url %]"><span class="no-image">No cover image available</span></a>[% END %][% END %]
 
-[% IF ( BakerTaylorEnabled ) %][% IF ( ISSUE.normalized_isbn ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% ISSUE.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% ISSUE.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_isbn! -->[% END %][% END %]
+[% IF ( BakerTaylorEnabled ) %][% IF ( ISSUE.normalized_isbn ) %]<a href="https://[% ISSUE.BakerTaylorBookstoreurl |html %][% ISSUE.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% ISSUE.BakerTaylorImageurl |html %][% ISSUE.normalized_isbn %]" /></a>[% ELSE %]<span class="no-image">No cover image available</span><!-- BakerTaylor needs normalized_isbn! -->[% END %][% END %]
 
 [% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( using_https ) %]
 <img src="https://secure.syndetics.com/index.aspx?isbn=[% ISSUE.normalized_isbn %]/SC.GIF&amp;client=[% ISSUE.SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% ISSUE.normalized_upc %]&amp;oclc=[% ISSUE.normalized_oclc %]" alt="" class="thumbnail" />
@@ -207,14 +247,14 @@ $.tablesorter.addParser({
                 <td><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% ISSUE.biblionumber %]">[% ISSUE.title |html %]</a><span class="item-details">
                         [% ISSUE.author %]
                     </span></td>
+                [% UNLESS ( item_level_itypes ) %]<td>[% IF ( ISSUE.imageurl ) %]<img src="[% ISSUE.imageurl %]" title="[% ISSUE.description %]" alt="[% ISSUE.description %]" />[% END %] [% ISSUE.description %]</td>[% END %]
+                [% IF ( show_barcode ) %]<td>[% ISSUE.barcode %]</td>[% END %]
+                <td>[% ISSUE.itemcallnumber %]</td>
                 [% IF ( ISSUE.overdue ) %]
                     <td class="overdue">[% ISSUE.date_due %]</td>
                 [% ELSE %]
                     <td>[% ISSUE.date_due %]</td>
                 [% END %]
-                [% UNLESS ( item_level_itypes ) %]<td>[% IF ( ISSUE.imageurl ) %]<img src="[% ISSUE.imageurl %]" title="[% ISSUE.description %]" alt="[% ISSUE.description %]" />[% END %] [% ISSUE.description %]</td>[% END %]
-                [% IF ( show_barcode ) %]<td>[% ISSUE.barcode %]</td>[% END %]
-                <td>[% ISSUE.itemcallnumber %]</td>
                 [% IF ( OpacRenewalAllowed ) %]
                     [% UNLESS ( ISSUE.patron_flagged ) %]
                     <td>[% IF ( ISSUE.status ) %]<input type="checkbox" name="item" value="[% ISSUE.itemnumber %]"/><a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber %]&amp;borrowernumber=[% ISSUE.borrowernumber %]">Renew</a> <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
@@ -260,14 +300,14 @@ $.tablesorter.addParser({
 <caption>Overdues <span class="count">([% overdues_count %] total)</span></caption>
 <!-- OVERDUES TABLE ROWS -->
 <thead><tr>
-[% IF ( JacketImages ) %]<th class="{sorter: false}">&nbsp;</th>[% END %]
-<th class="{sorter:'articles'}">Title</th>
+[% IF ( JacketImages ) %]<th>&nbsp;</th>[% END %]
+<th>Title</th>
 [% UNLESS ( item_level_itypes ) %]<th>Item Type</th> [% END %]
 [% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
 <th>Call No.</th>
 <th>Due</th>
 [% IF ( OpacRenewalAllowed ) %]
-                    [% UNLESS ( patron_flagged ) %]<th class="{sorter: false}">Renew</th>[% END %][% END %]
+                    [% UNLESS ( patron_flagged ) %]<th>Renew</th>[% END %][% END %]
 [% IF ( OPACFinesTab ) %]
 <th>Fines</th>
 [% END %]
@@ -281,7 +321,7 @@ $.tablesorter.addParser({
 
 [% IF ( GoogleJackets ) %][% IF ( OVERDUE.normalized_isbn ) %]<div style="display:block;" title="Click to view in Google Books" class="[% OVERDUE.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>[% ELSE %]<a href="http://books.google.com/books?q=[% OVERDUE.title |url %]"><span class="no-image">No cover image available</span></a>[% END %][% END %]
 
-[% IF ( BakerTaylorEnabled ) %][% IF ( OVERDUE.normalized_isbn ) %]<a href="https://[% BakerTaylorBookstoreURL |html %][% OVERDUE.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% OVERDUE.normalized_isbn %]" /></a>[% ELSE %]<!-- BakerTaylor needs normalized_isbn! --><span class="no-image">No cover image available</span>[% END %][% END %]
+[% IF ( BakerTaylorEnabled ) %][% IF ( OVERDUE.normalized_isbn ) %]<a href="https://[% OVERDUE.BakerTaylorBookstoreurl |html %][% OVERDUE.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% OVERDUE.BakerTaylorImageurl |html %][% OVERDUE.normalized_isbn %]" /></a>[% ELSE %]<!-- BakerTaylor needs normalized_isbn! --><span class="no-image">No cover image available</span>[% END %][% END %]
 
 [% IF ( SyndeticsCoverImages ) %]
 [% IF ( using_https ) %]
@@ -323,7 +363,7 @@ $.tablesorter.addParser({
         <caption>Holds <span class="count">([% reserves_count %] total)</span></caption>
             <!-- RESERVES TABLE ROWS -->
             <thead><tr>
-                <th class="{sorter:'articles'}">Title</th>
+                <th>Title</th>
                 <th>Placed On</th>
 		<th>Expires On</th>
                 <th>Pick Up Location</th>
@@ -331,7 +371,7 @@ $.tablesorter.addParser({
 			<th>Priority</th>
 		[% END %]
                 <th>Status</th>
-		<th class="{sorter: false}">Modify</th>
+		<th>Modify</th>
             </tr></thead>
 			<tbody>
             [% FOREACH RESERVE IN RESERVES %]
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tt
index cb09184..6c4f0c3 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tt
@@ -51,7 +51,7 @@ Card Number:</th><td>[% cardnumber %]</td></tr>
 <caption>Identity Details</caption>
 <tr><th scope="row">DoB:</th><td> [% IF ( dateofbirth ) %][% dateofbirth %][% ELSE %]&nbsp;[% END %]</td></tr>
 
-<tr><th scope="row">Gender:</th><td>[% IF ( sex ) %][% sex %][% ELSE %]&nbsp;[% END %]</td></tr></table>
+<tr><th scope="row">Sex:</th><td>[% IF ( sex ) %][% sex %][% ELSE %]&nbsp;[% END %]</td></tr></table>
 
 [% IF ( contactname ) %]
 <table>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
index 9a68851..12fb53c 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
@@ -66,7 +66,7 @@
 <fieldset class="brief">
 <ol>
 <li><label for="dob">Date of Birth: </label> <input id="dob" type="text" size="10" value="[% BORROWER_INF.dateofbirth %]" name="dateofbirth" /></li>
-<li><label for="sex">Gender: </label> <select name="sex" id="sex"><option></option>
+<li><label for="sex">Sex: </label> <select name="sex" id="sex"><option></option>
 [% IF ( BORROWER_INF.sex == 'F' ) %]<option value="F" selected="selected">Female</option>[% ELSE %]<option value="F">Female</option>[% END %]
 [% IF ( BORROWER_INF.sex == 'M' ) %]<option value="M" selected="selected">Male</option>[% ELSE %]<option value="M">Male</option>[% END %]
 </select></li>
@@ -126,7 +126,7 @@
 <legend>Personal Information</legend>
 <ol>
 <li><span class="label">Date of Birth:</span> [% BORROWER_INF.dateofbirth %]</li>
-<li><span class="label">Gender:</span>
+<li><span class="label">Sex:</span>
 [% IF ( sex == 'F' ) %]Female[% END %]
 [% IF ( sex == 'M' ) %]Male[% END %]
 </li>
diff --git a/kohaversion.pl b/kohaversion.pl
index 00bdbec..c3b86a9 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.05.00.004';
+    our $VERSION = '3.05.00.001';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
diff --git a/labels/label-create-xml.pl b/labels/label-create-xml.pl
index dd83f1d..a6c5808 100755
--- a/labels/label-create-xml.pl
+++ b/labels/label-create-xml.pl
@@ -62,10 +62,9 @@ foreach my $item (@$items) {
                                     format_string       => $layout->get_attr('format_string'),
                                       );
     my $format_string = $layout->get_attr('format_string');
-    my @data_fields = map { $_ eq 'callnumber' ? 'itemcallnumber' : $_ } # see bug 5653 
-                      split(/, /, $format_string);
+    my @data_fields = split(/, /, $format_string);
     my $csv_data = $label->csv_data();
-    for (my $i = 0; $i <= (scalar(@data_fields) - 1); $i++) {
+    for (my $i = 0; $i < (scalar(@data_fields) - 1); $i++) {
         push(@{$xml_data->{'label'}[$item_count]->{$data_fields[$i]}}, $$csv_data[$i]);
     }
     $item_count++;
diff --git a/labels/label-edit-batch.pl b/labels/label-edit-batch.pl
index 29d2dd3..8f89597 100755
--- a/labels/label-edit-batch.pl
+++ b/labels/label-edit-batch.pl
@@ -61,7 +61,7 @@ my @label_ids = $cgi->param('label_id') if $cgi->param('label_id');
 my @item_numbers = $cgi->param('item_number') if $cgi->param('item_number');
 my $barcode = $cgi->param('barcode') if $cgi->param('barcode');
 
-my $branch_code = get_branch_code_from_name($template->{VARS}->{'LoginBranchname'});
+my $branch_code = get_branch_code_from_name($template->param('LoginBranchname'));
 
 if ($op eq 'remove') {
     $batch = C4::Labels::Batch->retrieve(batch_id => $batch_id);
diff --git a/labels/label-edit-layout.pl b/labels/label-edit-layout.pl
index 6a70212..470092d 100755
--- a/labels/label-edit-layout.pl
+++ b/labels/label-edit-layout.pl
@@ -130,7 +130,7 @@ elsif  ($op eq 'save') {
                     font_size       => $cgi->param('font_size') || 3,
                     callnum_split   => ($cgi->param('callnum_split') ? 1 : 0),
                     text_justify    => $cgi->param('text_justify') || 'L',
-                    format_string   => $cgi->param('format_string') || 'title, author, isbn, issn, itemtype, barcode, itemcallnumber',
+                    format_string   => $cgi->param('format_string') || 'title, author, isbn, issn, itemtype, barcode, callnumber',
     );
     if ($layout_id) {   # if a label_id was passed in, this is an update to an existing layout
         $layout = C4::Labels::Layout->retrieve(layout_id => $layout_id);
diff --git a/labels/label-manage.pl b/labels/label-manage.pl
index 70302e8..197c8d4 100755
--- a/labels/label-manage.pl
+++ b/labels/label-manage.pl
@@ -74,7 +74,7 @@ my $op = $cgi->param('op') || 'none';
 my $element_id = $cgi->param('element_id') || undef;
 my $error = $cgi->param('error') || 0;
 
-my $branch_code = ($label_element eq 'batch' ? get_branch_code_from_name($template->{VARS}->{'LoginBranchname'}) : '');
+my $branch_code = ($label_element eq 'batch' ? get_branch_code_from_name($template->param('LoginBranchname')) : '');
 
 if ($op eq 'delete') {
     if          ($label_element eq 'layout')    {$error = C4::Labels::Layout::delete(layout_id => $element_id);}
diff --git a/mainpage.pl b/mainpage.pl
index 6a0c1af..dfeb6fc 100755
--- a/mainpage.pl
+++ b/mainpage.pl
@@ -24,6 +24,9 @@ use C4::Auth;
 use C4::AuthoritiesMarc;
 use C4::Koha;
 use C4::NewsChannels;
+use Data::Dumper::Simple;
+
+
 my $query     = new CGI;
 my $authtypes = getauthtypes;
 my @authtypesloop;
@@ -65,3 +68,6 @@ $template->param(
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
+
+
+
diff --git a/members/mancredit.pl b/members/mancredit.pl
index ae41b57..7d57fa5 100755
--- a/members/mancredit.pl
+++ b/members/mancredit.pl
@@ -45,10 +45,7 @@ my $add=$input->param('add');
 if ($add){
     if(checkauth($input)) {
         my $barcode = $input->param('barcode');
-        my $itemnum;
-        if ($barcode) {
-            $itemnum = GetItemnumberFromBarcode($barcode);
-        }
+        my $itemnum = GetItemnumberFromBarcode($barcode) if $barcode;
         my $desc    = $input->param('desc');
         my $note    = $input->param('note');
         my $amount  = $input->param('amount') || 0;
diff --git a/members/maninvoice.pl b/members/maninvoice.pl
index 9e8d429..f804e52 100755
--- a/members/maninvoice.pl
+++ b/members/maninvoice.pl
@@ -45,10 +45,7 @@ if ($add){
     if(checkauth($input)) {
         #  print $input->header;
         my $barcode=$input->param('barcode');
-        my $itemnum;
-        if ($barcode) {
-            $itemnum = GetItemnumberFromBarcode($barcode);
-        }
+        my $itemnum = GetItemnumberFromBarcode($barcode) if $barcode;
         my $desc=$input->param('desc');
         my $amount=$input->param('amount');
         my $type=$input->param('type');
diff --git a/members/member.pl b/members/member.pl
index 2be45bc..0d4e1c0 100755
--- a/members/member.pl
+++ b/members/member.pl
@@ -32,7 +32,7 @@ use C4::Members;
 use C4::Branch;
 use C4::Category;
 use File::Basename;
-
+use Data::Dumper::Simple;
 my $input = new CGI;
 my $quicksearch = $input->param('quicksearch');
 my $startfrom = $input->param('startfrom')||1;
@@ -52,7 +52,10 @@ my $patron = $input->Vars;
 foreach (keys %$patron){
 	delete $$patron{$_} unless($$patron{$_});
 }
-my @categories=C4::Category->all;
+
+
+my @categories =C4::Category->all;
+
 
 my $branches = GetBranches;
 my @branchloop;
@@ -67,14 +70,16 @@ foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
 }
 
 my %categories_dislay;
-
 foreach my $category (@categories){
+	
+	
 	my $hash={
 			category_description=>$$category{description},
 			category_type=>$$category{category_type}
 			 };
 	$categories_dislay{$$category{categorycode}} = $hash;
-}
+	
+	}
 $template->param( 
         "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1",
             );
@@ -118,6 +123,7 @@ if ($results) {
 my @resultsdata;
 $to=($count>$to?$to:$count);
 my $index=$from;
+       
 foreach my $borrower(@$results[$from..$to-1]){
   #find out stats
   my ($od,$issue,$fines)=GetMemberIssuesAndFines($$borrower{'borrowernumber'});
@@ -133,8 +139,20 @@ foreach my $borrower(@$results[$from..$to-1]){
     odissue => "$od/$issue",
     fines =>  sprintf("%.2f",$fines),
     );
+  
+           if (C4::Context->preference("searchMyLibraryOnly")  )
+           {
+  if (%row->{branchcode} eq C4::Branch->mybranch())
+  {
   push(@resultsdata, \%row);
-}
+   }               
+ }                
+ else {
+  push(@resultsdata, \%row);	
+ }
+               }
+           
+
 
 if ($$patron{categorycode}){
 	foreach my $category (grep{$_->{categorycode} eq $$patron{categorycode}}@categories){
@@ -155,6 +173,7 @@ my $base_url =
 
 my @letters = map { {letter => $_} } ( 'A' .. 'Z');
 
+
 $template->param(
     letters => \@letters,
     paginationbar => pagination_bar(
@@ -177,3 +196,4 @@ $template->param(
             );
 
 output_html_with_http_headers $input, $cookie, $template->output;
+
diff --git a/members/memberentry.pl b/members/memberentry.pl
index f6ca2c1..d7c5c96 100755
--- a/members/memberentry.pl
+++ b/members/memberentry.pl
@@ -40,6 +40,7 @@ use C4::Log;
 use C4::Letters;
 use C4::Branch; # GetBranches
 use C4::Form::MessagingPreferences;
+use Data::Dumper::Simple;
 
 use vars qw($debug);
 
@@ -105,17 +106,14 @@ $template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' );
 $template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 );
 ( $borrower_data = GetMember( 'borrowernumber' => $borrowernumber ) ) if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' );
 my $categorycode  = $input->param('categorycode') || $borrower_data->{'categorycode'};
-my $category_type = $input->param('category_type') || '';
-if ($category_type){
-    $template->{VARS}->{'type_only'} = 1;
-}
+my $category_type = $input->param('category_type');
 my $new_c_type = $category_type; #if we have input param, then we've already chosen the cat_type.
 unless ($category_type or !($categorycode)){
     my $borrowercategory = GetBorrowercategory($categorycode);
     $category_type    = $borrowercategory->{'category_type'};
     my $category_name = $borrowercategory->{'description'}; 
     $template->param("categoryname"=>$category_name);
- }
+}
 $category_type="A" unless $category_type; # FIXME we should display a error message instead of a 500 error !
 
 # if a add or modify is requested => check validity of data.
@@ -183,28 +181,24 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' )
 }
 
 #############test for member being unique #############
-if ( ( $op eq 'insert' ) and !$nodouble ) {
-    my $category_type_send;
-    if ( $category_type eq 'I' ) {
-        $category_type_send = $category_type;
-    }
-    my $check_category;    # recover the category code of the doublon suspect borrowers
-     #   ($result,$categorycode) = checkuniquemember($collectivity,$surname,$firstname,$dateofbirth)
-    ( $check_member, $check_category ) = checkuniquemember(
-        $category_type_send,
-        ( $newdata{surname}     ? $newdata{surname}     : $data{surname} ),
-        ( $newdata{firstname}   ? $newdata{firstname}   : $data{firstname} ),
-        ( $newdata{dateofbirth} ? $newdata{dateofbirth} : $data{dateofbirth} )
-    );
-    if ( !$check_member ) {
-        $nodouble = 1;
-    }
-
-    #   recover the category type if the borrowers is a doublon
+if (($op eq 'insert') and !$nodouble){
+        my $category_type_send=$category_type if ($category_type eq 'I'); 
+        my $check_category; # recover the category code of the doublon suspect borrowers
+			#   ($result,$categorycode) = checkuniquemember($collectivity,$surname,$firstname,$dateofbirth)
+        ($check_member,$check_category) = checkuniquemember(
+			$category_type_send, 
+			($newdata{surname}     ? $newdata{surname}     : $data{surname}    ),
+			($newdata{firstname}   ? $newdata{firstname}   : $data{firstname}  ),
+			($newdata{dateofbirth} ? $newdata{dateofbirth} : $data{dateofbirth})
+		);
+        if(!$check_member){
+            $nodouble = 1;
+        }
+  #   recover the category type if the borrowers is a doublon
     if ($check_category) {
-        my $tmpborrowercategory = GetBorrowercategory($check_category);
-        $check_categorytype = $tmpborrowercategory->{'category_type'};
-    }
+      my $tmpborrowercategory=GetBorrowercategory($check_category);
+      $check_categorytype=$tmpborrowercategory->{'category_type'};
+    }   
 }
 
   #recover all data from guarantor address phone ,fax... 
@@ -240,22 +234,19 @@ if ( (defined $newdata{'userid'}) && ($newdata{'userid'} eq '')){
 $debug and warn join "\t", map {"$_: $newdata{$_}"} qw(dateofbirth dateenrolled dateexpiry);
 my $extended_patron_attributes = ();
 if ($op eq 'save' || $op eq 'insert'){
-    # If the cardnumber is blank, treat it as null.
-    $newdata{'cardnumber'} = undef if $newdata{'cardnumber'} =~ /^\s*$/;
-
-    if (checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ 
-        push @errors, 'ERROR_cardnumber';
-    } 
-    my $dateofbirthmandatory = (scalar grep {$_ eq "dateofbirth"} @field_check) ? 1 : 0;
-    if ($newdata{dateofbirth} && $dateofbirthmandatory) {
-        my $age = GetAge($newdata{dateofbirth});
-        my $borrowercategory=GetBorrowercategory($newdata{'categorycode'});   
-        my ($low,$high) = ($borrowercategory->{'dateofbirthrequired'}, $borrowercategory->{'upperagelimit'});
-        if (($high && ($age > $high)) or ($age < $low)) {
-            push @errors, 'ERROR_age_limitations';
-            $template->param('ERROR_age_limitations' => "$low to $high");
-        }
+  if (checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ 
+    push @errors, 'ERROR_cardnumber';
+  } 
+  my $dateofbirthmandatory = (scalar grep {$_ eq "dateofbirth"} @field_check) ? 1 : 0;
+  if ($newdata{dateofbirth} && $dateofbirthmandatory) {
+    my $age = GetAge($newdata{dateofbirth});
+    my $borrowercategory=GetBorrowercategory($newdata{'categorycode'});   
+	my ($low,$high) = ($borrowercategory->{'dateofbirthrequired'}, $borrowercategory->{'upperagelimit'});
+    if (($high && ($age > $high)) or ($age < $low)) {
+      push @errors, 'ERROR_age_limitations';
+	  $template->param('ERROR_age_limitations' => "$low to $high");
     }
+  }
   
     if($newdata{surname} && C4::Context->preference('uppercasesurnames')) {
         $newdata{'surname'} = uc($newdata{'surname'});
@@ -344,7 +335,7 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
             C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
         }
         if (C4::Context->preference('EnhancedMessagingPreferences') and $input->param('setting_messaging_prefs')) {
-            C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template, 1, $newdata{'categorycode'});
+            C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template);
         }
 	} elsif ($op eq 'save'){ 
 		if ($NoUpdateLogin) {
@@ -403,6 +394,7 @@ if ( $op eq "duplicate" ) {
     $template->param( step_1 => 1, step_2 => 1, step_3 => 1, step_4 => 1, step_5 => 1, step_6 => 1 ) unless $step;
 }
 
+# my $cardnumber=$data{'cardnumber'};
 $data{'cardnumber'}=fixup_cardnumber($data{'cardnumber'}) if $op eq 'add';
 if(!defined($data{'sex'})){
     $template->param( none => 1);
@@ -431,9 +423,18 @@ if ($ethnicitycategoriescount>=0) {
 
 my @typeloop;
 my $no_categories = 1;
-my $no_add;
+my ($action,$no_add);
+my $ownbranch = C4::Branch->mybranch();
+
 foreach (qw(C A S P I X)) {
-    my $action="WHERE category_type=?";
+        
+           if ( C4::Context->preference("searchMyLibraryOnly")  )
+           {
+            $action="WHERE category_type=? and categorycode like '$ownbranch%'";
+          }
+          else {
+                $action="WHERE category_type=?";  
+          }
 	($categories,$labels)=GetborCatFromCatType($_,$action);
     if(scalar(@$categories) > 0){ $no_categories = 0; }
 	my @categoryloop;
@@ -549,8 +550,19 @@ my $onlymine=(C4::Context->preference('IndependantBranches') &&
 my $branches=GetBranches($onlymine);
 my $default;
 my $CGIbranch;
+my $ownbranch = C4::Branch->mybranch();
+
 for my $branch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
+           if ( C4::Context->preference("searchMyLibraryOnly")  )
+           { 
+                   if ($branch eq $ownbranch)
+                   {
     push @select_branch,$branch;
+                   }
+    }
+    else {
+                push @select_branch,$branch;
+    }
     $select_branches{$branch} = $branches->{$branch}->{'branchname'};
     $default = C4::Context->userenv->{'branch'} if (C4::Context->userenv && C4::Context->userenv->{'branch'});
 }
@@ -763,10 +775,21 @@ sub patron_attributes_form {
                     $newentry->{use_dropdown} = 1;
                     $newentry->{auth_val_loop} = GetAuthorisedValues($attr_type->authorised_value_category(), $attr->{value});
                 }
+                
+                
+                
                 $i++;
                 $newentry->{form_id} = "patron_attr_$i";
-                #use Data::Dumper; die Dumper($entry) if  $entry->{use_dropdown};
-                push @attribute_loop, $newentry;
+               
+
+               
+                		push @attribute_loop, $newentry;
+                
+              
+              #  push @attribute_loop, $newentry;
+                #use Data::Dumper; die Dumper($newentry->{auth_val_loop}[9]->{lib}) if  $newentry->{use_dropdown};
+               # die (substr($newentry->{auth_val_loop}[0]->{lib},0,3));
+                
             }
         } else {
             $i++;
@@ -777,12 +800,14 @@ sub patron_attributes_form {
             }
             $newentry->{form_id} = "patron_attr_$i";
             push @attribute_loop, $newentry;
+            
         }
     }
     $template->param(patron_attributes => \@attribute_loop);
 
 }
 
+
 # Local Variables:
 # tab-width: 8
 # End:
diff --git a/members/members-home.pl b/members/members-home.pl
index 830800e..3c417d0 100755
--- a/members/members-home.pl
+++ b/members/members-home.pl
@@ -26,13 +26,12 @@ use C4::Context;
 use C4::Members;
 use C4::Branch;
 use C4::Category;
+use Data::Dumper::Simple;
 
 my $query = new CGI;
 my $branch = $query->param('branchcode');
 my $template_name;
 
-$branch = q{} unless defined $branch;
-
 my ($template, $loggedinuser, $cookie)
     = get_template_and_user({template_name => "members/member.tmpl",
                  query => $query,
@@ -44,12 +43,13 @@ my ($template, $loggedinuser, $cookie)
 
 my $branches = GetBranches;
 my @branchloop;
-foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) {
-    push @branchloop, {
-        value      => $_,
-        selected   => ($branches->{$_}->{branchcode} eq $branch),
+foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
+  my $selected = 1 if $branches->{$_}->{branchcode} eq $branch;
+  my %row = ( value => $_,
+        selected => $selected,
         branchname => $branches->{$_}->{branchname},
-    };
+      );
+  push @branchloop, \%row;
 }
 
 my @categories;
@@ -63,7 +63,14 @@ else {
     $template->param(branchloop=>\@branchloop);
 }
 
- at categories=C4::Category->all;
+	if (C4::Context->preference("searchMyLibraryOnly"))
+	{
+ at categories=C4::Category->bybranch();
+	}
+	else {
+		@categories=C4::Category->all;
+	}
+
 if(scalar(@categories) < 1){ 
     $no_categories = 1; 
 }
@@ -84,3 +91,4 @@ my @letters = map { {letter => $_} } ( 'A' .. 'Z');
 $template->param( letters => \@letters );
 
 output_html_with_http_headers $query, $cookie, $template->output;
+
diff --git a/members/moremember.pl b/members/moremember.pl
index b766f2f..2d79dda 100755
--- a/members/moremember.pl
+++ b/members/moremember.pl
@@ -31,7 +31,7 @@
  needs html removed and to use the C4::Output more, but its tricky
 
 =cut
-
+ 
 use strict;
 #use warnings; FIXME - Bug 2505
 use CGI;
diff --git a/misc/admin/koha-preferences b/misc/admin/koha-preferences
index 6728609..a9e33f4 100755
--- a/misc/admin/koha-preferences
+++ b/misc/admin/koha-preferences
@@ -125,8 +125,6 @@ sub SetPreferences {
 
         _set_preference( $row->{'variable'}, $preferences{$row->{'variable'}} );
     }
-
-    C4::Context->clear_syspref_cache();
 }
 
 sub _fetch_preference {
diff --git a/misc/bin/koha-pazpar2-ctl.sh b/misc/bin/koha-pazpar2-ctl.sh
index bcedfea..c894702 100755
--- a/misc/bin/koha-pazpar2-ctl.sh
+++ b/misc/bin/koha-pazpar2-ctl.sh
@@ -1,29 +1,4 @@
 #!/bin/bash
-
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-### BEGIN INIT INFO
-# Provides:          koha-pazpar-daemon
-# Required-Start:    $syslog $remote_fs
-# Required-Stop:     $syslog $remote_fs
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: PazPar2 server daemon for Koha
-### END INIT INFO
-
 USER=__KOHA_USER__
 GROUP=__KOHA_GROUP__
 DBNAME=__DB_NAME__
diff --git a/misc/bin/koha-zebra-ctl.sh b/misc/bin/koha-zebra-ctl.sh
index 397eb19..01e4fad 100755
--- a/misc/bin/koha-zebra-ctl.sh
+++ b/misc/bin/koha-zebra-ctl.sh
@@ -1,29 +1,4 @@
 #!/bin/bash
-
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-### BEGIN INIT INFO
-# Provides:          koha-zebra-daemon
-# Required-Start:    $syslog $remote_fs
-# Required-Stop:     $syslog $remote_fs
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Zebra server daemon for Koha indexing
-### END INIT INFO
-
 USER=__KOHA_USER__
 GROUP=__KOHA_GROUP__
 DBNAME=__DB_NAME__
diff --git a/misc/cronjobs/advance_notices.pl b/misc/cronjobs/advance_notices.pl
index a573e96..6a408e4 100755
--- a/misc/cronjobs/advance_notices.pl
+++ b/misc/cronjobs/advance_notices.pl
@@ -63,12 +63,14 @@ my $confirm;                                                        # -c: Confir
 my $nomail;                                                         # -n: No mail. Will not send any emails.
 my $mindays     = 0;                                                # -m: Maximum number of days in advance to send notices
 my $maxdays     = 30;                                               # -e: the End of the time period
+my $fromaddress = C4::Context->preference('KohaAdminEmailAddress'); # -f: From address for the emails
 my $verbose     = 0;                                                # -v: verbose
 my $itemscontent = join(',',qw( issuedate title barcode author ));
 
 GetOptions( 'c'              => \$confirm,
             'n'              => \$nomail,
             'm:i'            => \$maxdays,
+            'f:s'            => \$fromaddress,
             'v'              => \$verbose,
             'itemscontent=s' => \$itemscontent,
        );
@@ -81,6 +83,7 @@ See the comments in the script for directions on changing the script.
 This script has the following parameters :
 	-c Confirm and remove this help & warning
         -m maximum number of days in advance to send advance notices.
+        -f from address for the emails. Defaults to KohaAdminEmailAddress system preference
 	-n send No mail. Instead, all mail messages are printed on screen. Usefull for testing purposes.
         -v verbose
         -i csv list of fields that get substituted into templates in places
@@ -132,28 +135,22 @@ SELECT biblio.*, items.*, issues.*
     AND (TO_DAYS(date_due)-TO_DAYS(NOW()) = ?)
 END_SQL
 
-my $admin_adress = C4::Context->preference('KohaAdminEmailAddress');
-
 UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
     warn 'examining ' . $upcoming->{'itemnumber'} . ' upcoming due items' if $verbose;
     # warn( Data::Dumper->Dump( [ $upcoming ], [ 'overdue' ] ) );
 
-    my $from_address = $upcoming->{branchemail} || $admin_adress;
-
     my $letter;
     my $borrower_preferences;
     if ( 0 == $upcoming->{'days_until_due'} ) {
         # This item is due today. Send an 'item due' message.
         $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
-                                                                                   message_name   => 'item_due' } );
+                                                                                   message_name   => 'item due' } );
         # warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
-        next unless $borrower_preferences;
+        next DUEITEM unless $borrower_preferences;
         
         if ( $borrower_preferences->{'wants_digest'} ) {
             # cache this one to process after we've run through all of the items.
-            my $digest = $due_digest->{$upcoming->{'borrowernumber'}} ||= {};
-            $digest->{email} ||= $from_address;
-            $digest->{count}++;
+            $due_digest->{$upcoming->{'borrowernumber'}}++;
         } else {
             my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} );
             my $letter_type = 'DUE';
@@ -175,16 +172,14 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
         }
     } else {
         $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $upcoming->{'borrowernumber'},
-                                                                                   message_name   => 'advance_notice' } );
+                                                                                   message_name   => 'advance notice' } );
         # warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
         next UPCOMINGITEM unless $borrower_preferences && exists $borrower_preferences->{'days_in_advance'};
         next UPCOMINGITEM unless $borrower_preferences->{'days_in_advance'} == $upcoming->{'days_until_due'};
 
         if ( $borrower_preferences->{'wants_digest'} ) {
             # cache this one to process after we've run through all of the items.
-            my $digest = $upcoming_digest->{$upcoming->{'borrowernumber'}} ||= {};
-            $digest->{email} ||= $from_address;
-            $digest->{count}++;
+            $upcoming_digest->{$upcoming->{'borrowernumber'}}++;
         } else {
             my $biblio = C4::Biblio::GetBiblioFromItemNumber( $upcoming->{'itemnumber'} );
             my $letter_type = 'PREDUE';
@@ -216,7 +211,6 @@ UPCOMINGITEM: foreach my $upcoming ( @$upcoming_dues ) {
         foreach my $transport ( @{$borrower_preferences->{'transports'}} ) {
             C4::Letters::EnqueueLetter( { letter                 => $letter,
                                           borrowernumber         => $upcoming->{'borrowernumber'},
-                                          from_address           => $from_address,
                                           message_transport_type => $transport } );
         }
       }
@@ -237,12 +231,9 @@ SELECT biblio.*, items.*, issues.*
     AND (TO_DAYS(date_due)-TO_DAYS(NOW()) = ?)
 END_SQL
 
-PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) {
-    my $count = $digest->{count};
-    my $from_address = $digest->{email};
-
+PATRON: while ( my ( $borrowernumber, $count ) = each %$upcoming_digest ) {
     my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber,
-                                                                                  message_name   => 'advance_notice' } );
+                                                                                  message_name   => 'advance notice' } );
     # warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
     next PATRON unless $borrower_preferences; # how could this happen?
 
@@ -250,7 +241,6 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) {
     my $letter_type = 'PREDUEDGST';
     my $letter = C4::Letters::getletter( 'circulation', $letter_type );
     die "no letter of type '$letter_type' found. Please see sample_notices.sql" unless $letter;
-
     $sth->execute($borrowernumber,$borrower_preferences->{'days_in_advance'});
     my $titles = "";
     while ( my $item_info = $sth->fetchrow_hashref()) {
@@ -271,19 +261,15 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$upcoming_digest ) {
       foreach my $transport ( @{$borrower_preferences->{'transports'}} ) {
         C4::Letters::EnqueueLetter( { letter                 => $letter,
                                       borrowernumber         => $borrowernumber,
-                                      from_address           => $from_address,
                                       message_transport_type => $transport } );
       }
     }
 }
 
 # Now, run through all the people that want digests and send them
-PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) {
-    my $count = $digest->{count};
-    my $from_address = $digest->{email};
-
+PATRON: while ( my ( $borrowernumber, $count ) = each %$due_digest ) {
     my $borrower_preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrowernumber,
-                                                                                  message_name   => 'item_due' } );
+                                                                                  message_name   => 'item due' } );
     # warn( Data::Dumper->Dump( [ $borrower_preferences ], [ 'borrower_preferences' ] ) );
     next PATRON unless $borrower_preferences; # how could this happen?
 
@@ -311,7 +297,6 @@ PATRON: while ( my ( $borrowernumber, $digest ) = each %$due_digest ) {
       foreach my $transport ( @{$borrower_preferences->{'transports'}} ) {
         C4::Letters::EnqueueLetter( { letter                 => $letter,
                                       borrowernumber         => $borrowernumber,
-                                      from_address           => $from_address,
                                       message_transport_type => $transport } );
       }
     }
diff --git a/misc/cronjobs/crontab.example b/misc/cronjobs/crontab.example
index 3c5030d..e153959 100644
--- a/misc/cronjobs/crontab.example
+++ b/misc/cronjobs/crontab.example
@@ -1,81 +1,12 @@
-# Koha Example Crontab File
-# Author: Joe Atzberger <atz at liblime.com>
-#
-# This is an example of a crontab file for Debian.  It may not work 
-# in other versions of crontab, like on Solaris 8 or BSD, for example.
-# 
-# While similar in structure, 
-# this is NOT an example for cron (as root).  Cron takes an extra
-# argument per line to designate the user to run as.  You could 
-# reasonably extrapolate the needed info from here though.
-#
-# WARNING: These jobs will do things like charge fines, send
-# potentially VERY MANY emails to patrons and even debar offending
-# users.  DO NOT RUN OR SCHEDULE these jobs without being sure you
-# really intend to.  Make sure the relevant message templates are
-# configured to your liking before scheduling messages to be sent.
-#
-# ENVIRONMENT:
-# First, establish Koha's two important ENV variables.
-
 PERL5LIB=/usr/share/koha/lib
 KOHA_CONF=/etc/koha/koha-conf.xml
-
-# Some additional variables to save you typing
-KOHA_CRON_PATH = /usr/share/koha/bin/cronjobs
-#
-# MULTIPLE KOHA SUPPORT:
-# You can still run jobs for this user's additional koha installs, 
-# by manipulating those variables in the command.
-#
-# For example, on the same codebase:
-# */10 * * * *    KOHA_CONF=/etc/koha/koha-conf.xml /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
-#
-# For example, on a separate codebase:
-# */10 * * * *    KOHA_CONF=/etc/koha/koha-conf.xml PERL5LIB=/home/koha/kohaclone /home/koha/kohaclone/misc/migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
-# 
-# ADDITIONAL INFO:
-# See the perldoc of individual scripts to determine what other options
-# are available.  Check the man page for crontab to understand the 
-# schedule syntax for your system.  
-#
-# NOTE: Don't forget to keep the empty line at the bottom. 
-# Cron/crontab will choke without it.
-#
-# SCHEDULED JOBS:
-# m h  dom mon dow   command
-
-# OVERDUE NOTICES
+KOHA_CRON_PATH = /home/peter/kohaclone/bin/cronjobs
 0    1 * * *  $KOHA_CRON_PATH/overdue_notices.pl -t
-
-# FINES
 5    1 * * *  $KOHA_CRON_PATH/fines.pl
-
-# ADVANCE NOTICES
 10   1 * * *  $KOHA_CRON_PATH/advance_notices.pl -c
-
-# PROCESS LONG OVERDUES
-# updates item status from available to longoverdue for items long overdue
-# 19 1 * * *  $KOHA_CRON_PATH/longoverdue.pl --lost 90=1 --confirm
-
-# SEND EMAILS
 15   * * * *  $KOHA_CRON_PATH/process_message_queue.pl
-
-# Hourly holds queue updated
 52   * * * *  $KOHA_CRON_PATH/holds/build_holds_queue.pl >/dev/null 2>&1
-
-# Cancel expired holds
 0 1 * * *  $KOHA_CRON_PATH/holds/cancel_expired_holds.pl >/dev/null 2>&1
-
-# ZEBRA INDEX UPDATES with -z option, incremental index updates throughout the day
-# for both authorities and bibs
-*/10 * * * *  $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
-
-# services_throttle -- resets the xISBN service
+*/2 * * * *  $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
 59 23 * * *  $KOHA_CRON_PATH/services_throttle.pl > /dev/null 2>&1
-
-# clean up databases nightly.  Be sure not to run this with --sessions during a time when the system is in use!
 16 1 * * * $KOHA_CRON_PATH/cleanup_database.pl --sessions --zebraqueue 10
-
-# delete old purchase suggestions weekly. Replace XX with a number to define the age of suggestions to delete.
- at weekly	$KOHA_CRON_PATH/purge_suggestions.pl --days XX > /dev/null 2>&1
diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl
index e605451..bc97ecb 100755
--- a/misc/cronjobs/overdue_notices.pl
+++ b/misc/cronjobs/overdue_notices.pl
@@ -644,9 +644,6 @@ sub parse_letter { # FIXME: this code should probably be moved to C4::Letters:pa
         return unless exists $params->{$required};
     }
 
-   my $todaysdate = C4::Dates->new()->output("syspref");
-   $params->{'letter'}->{title}   =~ s/<<today>>/$todaysdate/g;
-   $params->{'letter'}->{content} =~ s/<<today>>/$todaysdate/g;
 
     if ( $params->{'substitute'} ) {
         while ( my ( $key, $replacedby ) = each %{ $params->{'substitute'} } ) {
diff --git a/misc/maintenance/remove_items_from_biblioitems.pl b/misc/maintenance/remove_items_from_biblioitems.pl
index 9f30db0..0778b29 100755
--- a/misc/maintenance/remove_items_from_biblioitems.pl
+++ b/misc/maintenance/remove_items_from_biblioitems.pl
@@ -20,17 +20,15 @@
 
 use strict;
 use warnings;
-$|=1;
 
 use C4::Context;
 use C4::Biblio;
 use Getopt::Long;
 
-my ($wherestring, $run, $silent, $want_help);
+my ($wherestring, $run, $want_help);
 my $result = GetOptions(
     'where:s'      => \$wherestring,
     '--run'        => \$run,
-    '--silent'     => \$silent,
     'help|h'       => \$want_help,
 );
 
@@ -40,15 +38,11 @@ if ( not $result or not $run or $want_help ) {
 }
 
 my $dbh = C4::Context->dbh;
-my $count = 0;
 my $querysth =  qq{SELECT biblionumber from biblioitems };
 $querysth    .= " WHERE $wherestring " if ($wherestring);
 my $query = $dbh->prepare($querysth);
 $query->execute;
 while (my $biblionumber = $query->fetchrow){
-    $count++;
-    print "." unless $silent;
-    print "\r$count" unless ($silent or ($count % 100)); 
     my $record = GetMarcBiblio($biblionumber);
     
     if ($record) {
@@ -59,8 +53,6 @@ while (my $biblionumber = $query->fetchrow){
     }
 }
 
-print "\n\n$count records processed.\n" unless $silent;
-
 sub print_usage {
     print <<_USAGE_;
 $0: removes items from selected biblios
@@ -74,7 +66,6 @@ should be run using rebuild_zebra.pl -b -r.
 Parameters:
     -where                  use this to limit modifications to selected biblios
     --run                   perform the update
-    --silent                run silently
     --help or -h            show this message
 _USAGE_
 }
diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl
index dadf43f..5be01cf 100755
--- a/misc/migration_tools/rebuild_zebra.pl
+++ b/misc/migration_tools/rebuild_zebra.pl
@@ -191,7 +191,7 @@ sub index_records {
     my ($record_type, $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $server_dir) = @_;
 
     my $num_records_exported = 0;
-    my $records_deleted;
+    my $num_records_deleted = 0;
     my $need_reset = check_zebra_dirs($server_dir);
     if ($need_reset) {
     	print "$0: found broken zebra server directories: forcing a rebuild\n";
@@ -212,12 +212,12 @@ sub index_records {
         if ($process_zebraqueue) {
             my $entries = select_zebraqueue_records($record_type, 'deleted');
             mkdir "$directory/del_$record_type" unless (-d "$directory/del_$record_type");
-            $records_deleted = generate_deleted_marc_records($record_type, $entries, "$directory/del_$record_type", $as_xml);
+            $num_records_deleted = generate_deleted_marc_records($record_type, $entries, "$directory/del_$record_type", $as_xml);
             mark_zebraqueue_batch_done($entries);
             $entries = select_zebraqueue_records($record_type, 'updated');
             mkdir "$directory/upd_$record_type" unless (-d "$directory/upd_$record_type");
             $num_records_exported = export_marc_records_from_list($record_type, 
-                                                                  $entries, "$directory/upd_$record_type", $as_xml, $noxml, $records_deleted);
+                                                                  $entries, "$directory/upd_$record_type", $as_xml, $noxml);
             mark_zebraqueue_batch_done($entries);
         } else {
             my $sth = select_all_records($record_type);
@@ -239,7 +239,7 @@ sub index_records {
 	my $record_fmt = ($as_xml) ? 'marcxml' : 'iso2709' ;
     if ($process_zebraqueue) {
         do_indexing($record_type, 'delete', "$directory/del_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt) 
-            if %$records_deleted;
+            if $num_records_deleted;
         do_indexing($record_type, 'update', "$directory/upd_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt)
             if $num_records_exported;
     } else {
@@ -320,7 +320,7 @@ sub export_marc_records_from_sth {
                           ? GetXmlBiblio( $record_number )
                           : GetAuthorityXML( $record_number );
             if ($record_type eq 'biblio'){
-                my @items = GetItemsInfo($record_number);
+                my @items = GetItemsInfo($record_number, 'intra');
                 if (@items){
                     my $record = MARC::Record->new;
                     my @itemsrecord;
@@ -351,13 +351,8 @@ sub export_marc_records_from_sth {
             # strung together with no single root element.  zebraidx doesn't seem
             # to care, though, at least if you're using the GRS-1 filter.  It does
             # care if you're using the DOM filter, which requires valid XML file(s).
-            eval {
-                print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
-                $num_exported++;
-            };
-            if ($@) {
-              warn "Error exporting record $record_number ($record_type) ".($noxml ? "not XML" : "XML");
-            }
+            print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc();
+            $num_exported++;
         }
     }
     print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
@@ -366,14 +361,12 @@ sub export_marc_records_from_sth {
 }
 
 sub export_marc_records_from_list {
-    my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_;
+    my ($record_type, $entries, $directory, $as_xml, $noxml) = @_;
 
     my $num_exported = 0;
     open (OUT, ">:utf8 ", "$directory/exported_records") or die $!;
     my $i = 0;
-
-    # Skip any deleted records. We check for this anyway, but this reduces error spam
-    my %found = %$records_deleted;
+    my %found = ();
     foreach my $record_number ( map { $_->{biblio_auth_number} }
                                 grep { !$found{ $_->{biblio_auth_number} }++ }
                                 @$entries ) {
@@ -398,7 +391,7 @@ sub export_marc_records_from_list {
 sub generate_deleted_marc_records {
     my ($record_type, $entries, $directory, $as_xml) = @_;
 
-    my $records_deleted = {};
+    my $num_exported = 0;
     open (OUT, ">:utf8 ", "$directory/exported_records") or die $!;
     my $i = 0;
     foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) {
@@ -416,12 +409,11 @@ sub generate_deleted_marc_records {
         }
 
         print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc();
-
-        $records_deleted->{$record_number} = 1;
+        $num_exported++;
     }
-    print "\nRecords exported: $i\n" if ( $verbose_logging );
+    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
     close OUT;
-    return $records_deleted;
+    return $num_exported;
     
 
 }
@@ -457,19 +449,15 @@ sub get_raw_marc_record {
             $fetch_sth->execute($record_number);
             if (my ($blob) = $fetch_sth->fetchrow_array) {
                 $marc = MARC::Record->new_from_usmarc($blob);
-                unless ($marc) {
-                    warn "error creating MARC::Record from $blob";
-                }
+                $fetch_sth->finish();
+            } else {
+                return; # failure to find a bib is not a problem -
+                        # a delete could have been done before
+                        # trying to process a record update
             }
-            # failure to find a bib is not a problem -
-            # a delete could have been done before
-            # trying to process a record update
-
-            $fetch_sth->finish();
-            return unless $marc;
         } else {
             eval { $marc = GetMarcBiblio($record_number); };
-            if ($@ || !$marc) {
+            if ($@) {
                 # here we do warn since catching an exception
                 # means that the bib was found but failed
                 # to be parsed
diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl
index d862a97..46ceceb 100755
--- a/misc/translator/tmpl_process3.pl
+++ b/misc/translator/tmpl_process3.pl
@@ -274,21 +274,6 @@ if (defined $href) {
 #       $charset_in = $candidate;
 #   }
 #     }
-
-    # BUG6464: check consistency of PO messages
-    #  - count number of '%s' in msgid and msgstr
-    for my $msg ( values %$href ) {
-        my $id_count  = split(/%s/, $msg->{msgid}) - 1;
-        my $str_count = split(/%s/, $msg->{msgstr}) - 1;
-        next if $id_count == $str_count ||
-                $msg->{msgstr} eq '""' ||
-                grep { /fuzzy/ } @{$msg->{_flags}};
-        warn_normal
-            "unconsistent %s count: ($id_count/$str_count):\n" .
-            "  line:   " . $msg->{loaded_line_number} . "\n" .
-            "  msgid:  " . $msg->{msgid} . "\n" .
-            "  msgstr: " . $msg->{msgstr} . "\n", undef;
-    }
 }
 
 # set our charset in to UTF-8
diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl
index c80d41c..b50947d 100755
--- a/opac/opac-ISBDdetail.pl
+++ b/opac/opac-ISBDdetail.pl
@@ -85,10 +85,7 @@ my $upc = GetNormalizedUPC($record,$marcflavour);
 my $ean = GetNormalizedEAN($record,$marcflavour);
 my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
 my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
-my $content_identifier_exists;
-if ( $isbn or $ean or $oclc or $upc ) {
-    $content_identifier_exists = 1;
-}
+my $content_identifier_exists = 1 if ($isbn or $ean or $oclc or $upc);
 $template->param(
     normalized_upc => $upc,
     normalized_ean => $ean,
@@ -127,7 +124,7 @@ $template->param(
 
 my $norequests = 1;
 my $res = GetISBDView($biblionumber, "opac");
-my @items = GetItemsInfo( $biblionumber );
+my @items = &GetItemsInfo($biblionumber, 'opac');
 
 my $itemtypes = GetItemTypes();
 for my $itm (@items) {
diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl
index 7544902..8e492aa 100755
--- a/opac/opac-MARCdetail.pl
+++ b/opac/opac-MARCdetail.pl
@@ -61,7 +61,7 @@ my $biblionumber = $query->param('biblionumber');
 my $itemtype     = &GetFrameworkCode($biblionumber);
 my $tagslib      = &GetMarcStructure( 0, $itemtype );
 my $biblio = GetBiblioData($biblionumber);
-my $record = GetMarcBiblio($biblionumber, 1);
+my $record = GetMarcBiblio($biblionumber);
 if ( ! $record ) {
     print $query->redirect("/cgi-bin/koha/errors/404.pl");
     exit;
diff --git a/opac/opac-authorities-home.pl b/opac/opac-authorities-home.pl
index acff077..a87030e 100755
--- a/opac/opac-authorities-home.pl
+++ b/opac/opac-authorities-home.pl
@@ -41,20 +41,18 @@ $startfrom = 0 if ( !defined $startfrom );
 my ( $template, $loggedinuser, $cookie );
 my $resultsperpage;
 
-my $authtypes     = getauthtypes();
-my @authtypesloop = ();
-foreach my $thisauthtype (
-    sort {
-        $authtypes->{$a}->{'authtypetext'}
-          cmp $authtypes->{$b}->{'authtypetext'}
-    }
-    keys %{$authtypes}
-  ) {
-    push @authtypesloop,
-      { value        => $thisauthtype,
-        selected     => $thisauthtype eq $authtypecode,
-        authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
-      };
+my $authtypes = getauthtypes;
+my @authtypesloop;
+foreach my $thisauthtype ( sort { $authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'} }
+    keys %$authtypes )
+{
+    my $selected = 1 if $thisauthtype eq $authtypecode;
+    my %row = (
+        value        => $thisauthtype,
+        selected     => $selected,
+        authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
+    );
+    push @authtypesloop, \%row;
 }
 
 if ( $op eq "do_search" ) {
diff --git a/opac/opac-authoritiesdetail.pl b/opac/opac-authoritiesdetail.pl
index 6610dfd..27ca8cc 100755
--- a/opac/opac-authoritiesdetail.pl
+++ b/opac/opac-authoritiesdetail.pl
@@ -170,14 +170,16 @@ foreach my $field (@fields) {
 }
 $template->param( "Tab0XX" => \@loop_data );
 
-my $authtypes     = getauthtypes();
-my @authtypesloop = ();
-foreach my $thisauthtype ( keys %{$authtypes} ) {
-    push @authtypesloop,
-      { value        => $thisauthtype,
-        selected     => $thisauthtype eq $authtypecode,
+my $authtypes = getauthtypes;
+my @authtypesloop;
+foreach my $thisauthtype ( keys %$authtypes ) {
+    my $selected = 1 if $thisauthtype eq $authtypecode;
+    my %row = (
+        value        => $thisauthtype,
+        selected     => $selected,
         authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
-      };
+    );
+    push @authtypesloop, \%row;
 }
 
 $template->param(
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index e18e046..520804c 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -85,7 +85,7 @@ if (C4::Context->preference("OPACXSLTDetailsDisplay") ) {
 
 $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); 
 # change back when ive fixed request.pl
-my @all_items = GetItemsInfo( $biblionumber );
+my @all_items = &GetItemsInfo( $biblionumber, 'opac' );
 my @items;
 
 # Getting items to be hidden
@@ -177,6 +177,7 @@ for my $itm (@items) {
     $itm->{datedue}      = format_date($itm->{datedue});
     $itm->{datelastseen} = format_date($itm->{datelastseen});
 
+
     # get collection code description, too
     if ( my $ccode = $itm->{'ccode'} ) {
         $itm->{'ccode'} = $collections->{$ccode} if ( defined($collections) && exists( $collections->{$ccode} ) );
@@ -281,10 +282,7 @@ my $upc = GetNormalizedUPC($record,$marcflavour);
 my $ean = GetNormalizedEAN($record,$marcflavour);
 my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
 my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
-my $content_identifier_exists;
-if ( $isbn or $ean or $oclc or $upc ) {
-    $content_identifier_exists = 1;
-}
+my $content_identifier_exists = 1 if ($isbn or $ean or $oclc or $upc);
 $template->param(
 	normalized_upc => $upc,
 	normalized_ean => $ean,
@@ -298,12 +296,6 @@ $template->param(
     ocoins => GetCOinSBiblio($biblionumber),
 );
 
-my $libravatar_enabled = 0;
-eval 'use Libravatar::URL';
-if (!$@ and C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
-    $libravatar_enabled = 1;
-}
-
 my $reviews = getreviews( $biblionumber, 1 );
 my $loggedincommenter;
 foreach ( @$reviews ) {
@@ -312,9 +304,6 @@ foreach ( @$reviews ) {
     $_->{title}     = $borrowerData->{'title'};
     $_->{surname}   = $borrowerData->{'surname'};
     $_->{firstname} = $borrowerData->{'firstname'};
-    if ($libravatar_enabled and $borrowerData->{'email'}) {
-        $_->{avatarurl} = libravatar_url(email => $borrowerData->{'email'}, https => $ENV{HTTPS});
-    }
     $_->{userid}    = $borrowerData->{'userid'};
     $_->{cardnumber}    = $borrowerData->{'cardnumber'};
     $_->{datereviewed} = format_date($_->{datereviewed});
@@ -593,5 +582,6 @@ my $defaulttab =
     @serialcollections > 0 
         ? 'serialcollection' : 'subscription';
 $template->param('defaulttab' => $defaulttab);
+$template->param('homebranch'=>C4::Branch->mybranch(), );
 
 output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/opac/opac-downloadshelf.pl b/opac/opac-downloadshelf.pl
index 1057a16..ee9b0b1 100755
--- a/opac/opac-downloadshelf.pl
+++ b/opac/opac-downloadshelf.pl
@@ -48,59 +48,52 @@ my $shelfid = $query->param('shelfid');
 my $format  = $query->param('format');
 my $dbh     = C4::Context->dbh;
 
-if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $shelfid, 'view' ) ) {
-
-    if ($shelfid && $format) {
+if ($shelfid && $format) {
+
+    my @shelf               = GetShelf($shelfid);
+    my ($items, $totitems)  = GetShelfContents($shelfid);
+    my $marcflavour         = C4::Context->preference('marcflavour');
+    my $output;
+
+   # CSV 
+    if ($format =~ /^\d+$/) {
+        my @biblios;
+        foreach (@$items) {
+            push @biblios, $_->{biblionumber};
+        }
+        $output = marc2csv(\@biblios, $format);
+            
+    # Other formats
+    } else {
+        foreach my $biblio (@$items) {
+            my $biblionumber = $biblio->{biblionumber};
 
-        my @shelf               = GetShelf($shelfid);
-        my ($items, $totitems)  = GetShelfContents($shelfid);
-        my $marcflavour         = C4::Context->preference('marcflavour');
-        my $output;
+            my $record = GetMarcBiblio($biblionumber, 1);
+            next unless $record;
 
-       # CSV
-        if ($format =~ /^\d+$/) {
-            my @biblios;
-            foreach (@$items) {
-                push @biblios, $_->{biblionumber};
+            if ($format eq 'iso2709') {
+                $output .= $record->as_usmarc();
             }
-            $output = marc2csv(\@biblios, $format);
-                
-        # Other formats
-        } else {
-            foreach my $biblio (@$items) {
-                my $biblionumber = $biblio->{biblionumber};
-
-                my $record = GetMarcBiblio($biblionumber, 1);
-                next unless $record;
-
-                if ($format eq 'iso2709') {
-                    $output .= $record->as_usmarc();
-                }
-                elsif ($format eq 'ris' ) {
-                    $output .= marc2ris($record);
-                }
-                elsif ($format eq 'bibtex') {
-                    $output .= marc2bibtex($record, $biblionumber);
-                }
+            elsif ($format eq 'ris' ) {
+                $output .= marc2ris($record);
+            }
+            elsif ($format eq 'bibtex') {
+                $output .= marc2bibtex($record, $biblionumber);
             }
         }
+    }
 
-        # If it was a CSV export we change the format after the export so the file extension is fine
-        $format = "csv" if ($format =~ m/^\d+$/);
-
-        print $query->header(
-    	-type => 'application/octet-stream',
-    	-'Content-Transfer-Encoding' => 'binary',
-    	-attachment=>"shelf.$format");
-        print $output;
+    # If it was a CSV export we change the format after the export so the file extension is fine
+    $format = "csv" if ($format =~ m/^\d+$/);
 
-    } else {
-        $template->param(csv_profiles => GetCsvProfilesLoop());
-        $template->param(shelfid => $shelfid); 
-        output_html_with_http_headers $query, $cookie, $template->output;
-    }
+    print $query->header(
+	-type => 'application/octet-stream',
+	-'Content-Transfer-Encoding' => 'binary',
+	-attachment=>"shelf.$format");
+    print $output;
 
 } else {
-    $template->param(invalidlist => 1); 
+    $template->param(csv_profiles => GetCsvProfilesLoop());
+    $template->param(shelfid => $shelfid); 
     output_html_with_http_headers $query, $cookie, $template->output;
-}
\ No newline at end of file
+}
diff --git a/opac/opac-main.pl b/opac/opac-main.pl
index 177d812..aeba92b 100755
--- a/opac/opac-main.pl
+++ b/opac/opac-main.pl
@@ -19,6 +19,7 @@
 use strict;
 use warnings;
 use CGI;
+use CGI::Session;
 use C4::Auth;    # get_template_and_user
 use C4::Output;
 use C4::VirtualShelves;
@@ -27,9 +28,13 @@ use C4::Members;         # GetMember
 use C4::NewsChannels;    # get_opac_news
 use C4::Acquisition;     # GetRecentAcqui
 use C4::Languages qw(getTranslatedLanguages accept_language);
+use Data::Dumper::Simple;
+
+
+my $input  = new CGI;
+my $dbh    = C4::Context->dbh;
+my $branch; # = C4::Context->userenv->{branch};
 
-my $input = new CGI;
-my $dbh   = C4::Context->dbh;
 
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     {
@@ -47,6 +52,8 @@ $template->param(
 );
 
 
+
+
 my $borrower = GetMember( borrowernumber=>$borrowernumber );
 $template->param(
     textmessaging        => $borrower->{textmessaging},
@@ -95,4 +102,28 @@ if (C4::Context->preference('GoogleIndicTransliteration')) {
         $template->param('GoogleIndicTransliteration' => 1);
 }
 
+
+if (defined $input->param("library"))
+{
+    C4::Context->userenv->{branch} = $input->param("library");
+    $template->param(branch=>C4::Context->userenv->{branch});
+     my $session = C4::Auth::get_session("");
+                   C4::Context->set_userenv($session->param('branch',$input->param("library")));
+  
+}
+
+my $xx;
+if ($template->{VARS}{loggedinusername} eq '')
+{
+   
+      print $input->redirect("/index.htm");  
+}
+
+
 output_html_with_http_headers $input, $cookie, $template->output;
+
+
+
+
+
+
diff --git a/opac/opac-renew.pl b/opac/opac-renew.pl
index dd3dcf2..68abed0 100755
--- a/opac/opac-renew.pl
+++ b/opac/opac-renew.pl
@@ -3,7 +3,7 @@
 #written 18/1/2000 by chris at katipo.co.nz
 # adapted for use in the hlt opac by finlay at katipo.co.nz 29/11/2002
 # script to renew items from the web
-# Parts Copyright 2010,2011 Catalyst IT
+# Parts Copyright 2010 Catalyst IT
 
 # This file is part of Koha.
 #
@@ -27,8 +27,7 @@ use warnings;
 use CGI;
 use C4::Circulation;
 use C4::Auth;
-use C4::Items;
-use C4::Members;
+
 my $query = new CGI;
 
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
@@ -49,27 +48,7 @@ my $errorstring='';
 for my $itemnumber ( @items ) {
     my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
     if ( $status == 1 && $opacrenew == 1 ) {
-	my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
-	my $branchcode;
-	if ($renewalbranch eq 'itemhomebranch'){
-	    my $item = GetItem($itemnumber);
-	    $branchcode=$item->{'homebranch'};
-	}
-	elsif ($renewalbranch eq 'patronhomebranch'){
-	    my $borrower = GetMemberDetails($borrowernumber);
-	    $branchcode = $borrower->{'branchcode'};
-	}
-	elsif ($renewalbranch eq 'checkoutbranch'){
-	    my $issue = GetOpenIssue($itemnumber);
-	    $branchcode = $issue->{'branchcode'};
-	}
-	elsif ($renewalbranch eq 'NULL'){
-	    $branchcode='';
-	}
-	else {
-	    $branchcode='OPACRenew'
-	}
-        AddRenewal( $borrowernumber, $itemnumber, $branchcode);
+        AddRenewal( $borrowernumber, $itemnumber );
     }
     else {
 	$errorstring .= $error ."|";
diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
index a92a976..d50480a 100755
--- a/opac/opac-reserve.pl
+++ b/opac/opac-reserve.pl
@@ -477,11 +477,11 @@ if ( $numBibsAvailable == 0 || !$anyholdable) {
     $template->param( none_available => 1 );
 }
 
-my $itemTableColspan = 7;
-if (! $template->{VARS}->{'OPACItemHolds'}) {
+my $itemTableColspan = 5;
+if (!$template->param('OPACItemHolds')) {
     $itemTableColspan--;
 }
-if (! $template->{VARS}->{'singleBranchMode'}) {
+if ($template->param('singleBranchMode')) {
     $itemTableColspan--;
 }
 $template->param(itemtable_colspan => $itemTableColspan);
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index cd34610..43a62ea 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -39,6 +39,7 @@ use C4::Branch; # GetBranches
 use POSIX qw(ceil floor strftime);
 use URI::Escape;
 use Storable qw(thaw freeze);
+use Data::Dumper::Simple;
 
 
 my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
@@ -46,6 +47,7 @@ my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
 # FIXME: no_undef_params needs to be tested
 use CGI qw('-no_undef_params');
 my $cgi = new CGI;
+my @newresults1;
 
 BEGIN {
 	if (C4::Context->preference('BakerTaylorEnabled')) {
@@ -207,19 +209,15 @@ if ( $template_type && $template_type eq 'advsearch' ) {
     $template->param(outer_sup_servers_loop => $secondary_servers_loop,);
 
     # set the default sorting
-    if (   C4::Context->preference('OPACdefaultSortField')
-        && C4::Context->preference('OPACdefaultSortOrder') ) {
-        my $default_sort_by =
-            C4::Context->preference('OPACdefaultSortField') . '_'
-          . C4::Context->preference('OPACdefaultSortOrder');
-        $template->param( $default_sort_by => 1 );
-    }
+    my $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') 
+        if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
+    $template->param($default_sort_by => 1);
 
     # determine what to display next to the search boxes (ie, boolean option
     # shouldn't appear on the first one, scan indexes should, adding a new
     # box should only appear on the last, etc.
     my @search_boxes_array;
-    my $search_boxes_count = 3; # begin whith 3 boxes
+    my $search_boxes_count = C4::Context->preference("OPACAdvSearchInputCount") || 3;
     for (my $i=1;$i<=$search_boxes_count;$i++) {
         # if it's the first one, don't display boolean option, but show scan indexes
         if ($i==1) {
@@ -277,13 +275,8 @@ $tag = $params->{tag} if $params->{tag};
 # sort by is used to sort the query
 # in theory can have more than one but generally there's just one
 my @sort_by;
-my $default_sort_by;
-if (   C4::Context->preference('OPACdefaultSortField')
-    && C4::Context->preference('OPACdefaultSortOrder') ) {
-    $default_sort_by =
-        C4::Context->preference('OPACdefaultSortField') . '_'
-      . C4::Context->preference('OPACdefaultSortOrder');
-}
+my $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') 
+    if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
 
 @sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
 $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
@@ -440,7 +433,6 @@ if ($facets) {
     foreach my $f (@$facets) {
         $f->{facets} = [ sort { uc($a->{facet_title_value}) cmp uc($b->{facet_title_value}) } @{ $f->{facets} } ];
     }
-    @$facets = sort {$a->{expand} cmp $b->{expand}} @$facets;
 }
 
 # use Data::Dumper; print STDERR "-" x 25, "\n", Dumper($results_hashref);
@@ -472,6 +464,7 @@ for (my $i=0;$i<@servers;$i++) {
             @newresults = searchResults('opac', $query_desc, $hits, $results_per_page, $offset, $scan,
                                         @{$results_hashref->{$server}->{"RECORDS"}},, C4::Context->preference('hidelostitems'));
         }
+        @newresults1 = @newresults;
 		my $tag_quantity;
 		if (C4::Context->preference('TagsEnabled') and
 			$tag_quantity = C4::Context->preference('TagsShowOnList')) {
@@ -577,13 +570,8 @@ for (my $i=0;$i<@servers;$i++) {
             my $pages = ceil($hits / $results_per_page);
             # default page number
             my $current_page_number = 1;
-            if ($offset) {
-                $current_page_number = ( $offset / $results_per_page + 1 );
-            }
-            my $previous_page_offset;
-            if ( $offset >= $results_per_page ) {
-                $previous_page_offset = $offset - $results_per_page;
-            }
+            $current_page_number = ($offset / $results_per_page + 1) if $offset;
+            my $previous_page_offset = $offset - $results_per_page unless ($offset - $results_per_page <0);
             my $next_page_offset = $offset + $results_per_page;
             # If we're within the first 10 pages, keep it simple
             #warn "current page:".$current_page_number;
@@ -597,14 +585,11 @@ for (my $i=0;$i<@servers;$i++) {
                     my $this_offset = (($i*$results_per_page)-$results_per_page);
                     # the page number for this page
                     my $this_page_number = $i;
+                    # it should only be highlighted if it's the current page
+                    my $highlight = 1 if ($this_page_number == $current_page_number);
                     # put it in the array
-                    push @page_numbers,
-                      { offset    => $this_offset,
-                        pg        => $this_page_number,
-                        highlight => $this_page_number == $current_page_number,
-                        sort_by   => join ' ', @sort_by
-                      };
-
+                    push @page_numbers, { offset => $this_offset, pg => $this_page_number, highlight => $highlight, sort_by => join " ", at sort_by };
+                                
                 }
                         
             }
@@ -613,13 +598,9 @@ for (my $i=0;$i<@servers;$i++) {
                 for ($i=$current_page_number; $i<=($current_page_number + 20 );$i++) {
                     my $this_offset = ((($i-9)*$results_per_page)-$results_per_page);
                     my $this_page_number = $i-9;
-                    if ( $this_page_number <= $pages ) {
-                        push @page_numbers,
-                          { offset    => $this_offset,
-                            pg        => $this_page_number,
-                            highlight => $this_page_number == $current_page_number,
-                            sort_by => join ' ', @sort_by
-                          };
+                    my $highlight = 1 if ($this_page_number == $current_page_number);
+                    if ($this_page_number <= $pages) {
+                        push @page_numbers, { offset => $this_offset, pg => $this_page_number, highlight => $highlight, sort_by => join " ", at sort_by };
                     }
                 }
                         
@@ -696,3 +677,9 @@ if (C4::Context->preference('GoogleIndicTransliteration')) {
 }
 
 output_with_http_headers $cgi, $cookie, $template->output, $content_type;
+
+
+
+
+			
+			
\ No newline at end of file
diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl
index df1b4c5..0042c42 100755
--- a/opac/opac-sendbasket.pl
+++ b/opac/opac-sendbasket.pl
@@ -81,7 +81,7 @@ if ( $email_add ) {
         my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
         my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
 
-        my @items = GetItemsInfo( $biblionumber );
+        my @items = &GetItemsInfo( $biblionumber, 'opac' );
 
         my $hasauthors = 0;
         if($dat->{'author'} || @$marcauthorsarray) {
diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl
index b571e07..6a376c4 100755
--- a/opac/opac-sendshelf.pl
+++ b/opac/opac-sendshelf.pl
@@ -51,8 +51,6 @@ my $email   = $query->param('email');
 
 my $dbh          = C4::Context->dbh;
 
-if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $shelfid, 'view' ) ) {
-
 if ( $email ) {
     my $email_from = C4::Context->preference('KohaAdminEmailAddress');
     my $comment    = $query->param('comment');
@@ -88,7 +86,7 @@ if ( $email ) {
         my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
         my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
 
-        my @items = GetItemsInfo( $biblionumber );
+        my @items = &GetItemsInfo( $biblionumber, 'opac' );
 
         $dat->{MARCNOTES}      = $marcnotesarray;
         $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
@@ -179,10 +177,3 @@ END_OF_BODY
                     );
     output_html_with_http_headers $query, $cookie, $template->output;
 }
-
-} else {
-    $template->param( invalidlist => 1,
-                      url     => "/cgi-bin/koha/opac-sendshelf.pl",
-    );
-    output_html_with_http_headers $query, $cookie, $template->output;
-}
\ No newline at end of file
diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl
index 3a74270..f1e0b53 100755
--- a/opac/opac-showreviews.pl
+++ b/opac/opac-showreviews.pl
@@ -65,12 +65,6 @@ if($format eq "rss"){
         );
 }
 
-my $libravatar_enabled = 0;
-eval 'use Libravatar::URL';
-if (!$@ and C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
-    $libravatar_enabled = 1;
-}
-
 my $reviews = getallreviews(1,$offset,$results_per_page);
 my $marcflavour      = C4::Context->preference("marcflavour");
 my $hits = numberofreviews();
@@ -98,10 +92,6 @@ for my $result (@$reviews){
 	$result->{timestamp} = $bib->{'timestamp'};
 	$result->{firstname} = $borr->{'firstname'};
 	$result->{surname} = $borr->{'surname'};
-        if ($libravatar_enabled and $borr->{'email'}) {
-            $result->{avatarurl} = libravatar_url(email => $borr->{'email'}, size => 40, https => $ENV{HTTPS});
-        }
-
     if ($result->{borrowernumber} eq $borrowernumber) {
 		$result->{your_comment} = 1;
 	}
diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl
index 6899215..80e7c35 100755
--- a/opac/opac-topissues.pl
+++ b/opac/opac-topissues.pl
@@ -127,11 +127,13 @@ $template->param( branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'}
 my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
 $itemtypes = GetItemTypes;
 my @itemtypesloop;
+my $selected=1;
 if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
         foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
+        my $selected = 1 if $thisitemtype eq $itemtype;
         my %row =( value => $thisitemtype,
                    description => $itemtypes->{$thisitemtype}->{'description'},
-                   selected    => $thisitemtype eq $itemtype,
+                   selected => $selected,
             );
         push @itemtypesloop, \%row;
         }
@@ -140,7 +142,7 @@ if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
         for my $thisitemtype (@$advsearchtypes) {
                 my $selected = 1 if $thisitemtype->{authorised_value} eq $itemtype;
                 my %row =( value => $thisitemtype->{authorised_value},
-                selected    => $thisitemtype eq $itemtype,
+                selected => $selected,
                 description => $thisitemtype->{'lib'},
             );
                 push @itemtypesloop, \%row;
diff --git a/opac/opac-user.pl b/opac/opac-user.pl
index 2c31ce7..5a5355f 100755
--- a/opac/opac-user.pl
+++ b/opac/opac-user.pl
@@ -35,6 +35,7 @@ use C4::Items;
 use C4::Dates qw/format_date/;
 use C4::Letters;
 use C4::Branch; # GetBranches
+use Data::Dumper::Simple;
 
 use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
 
@@ -64,6 +65,8 @@ my $patronupdate = $query->param('patronupdate');
 # get borrower information ....
 my ( $borr ) = GetMemberDetails( $borrowernumber );
 
+
+
 for (qw(dateenrolled dateexpiry dateofbirth)) {
     ($borr->{$_}) and $borr->{$_} = format_date($borr->{$_});
 }
@@ -193,17 +196,13 @@ $template->param( show_barcode => 1 ) if $show_barcode;
 # load the branches
 my $branches = GetBranches();
 my @branch_loop;
-for my $branch_hash ( sort keys %{$branches} ) {
-    my $selected;
-    if ( C4::Context->preference('SearchMyLibraryFirst') ) {
-        $selected =
-          ( C4::Context->userenv
-              && ( $branch_hash eq C4::Context->userenv->{branch} ) );
-    }
+for my $branch_hash (sort keys %$branches ) {
+    my $selected=(C4::Context->userenv && ($branch_hash eq C4::Context->userenv->{branch})) if (C4::Context->preference('SearchMyLibraryFirst'));
     push @branch_loop,
-      { value      => "branch: $branch_hash",
+      {
+        value      => "branch: $branch_hash",
         branchname => $branches->{$branch_hash}->{'branchname'},
-        selected   => $selected,
+        selected => $selected
       };
 }
 $template->param( branchloop => \@branch_loop );
@@ -327,5 +326,16 @@ $template->param(
     dateformat    => C4::Context->preference("dateformat"),
 );
 
+
+
+
+if ($borr->{userid} eq $borr->{branchcode})
+{
+    $template->param(redirect=>1);
+    #print $query->redirect('/cgi-bin/koha/opac-main.pl');    
+}
+
+
 output_html_with_http_headers $query, $cookie, $template->output;
 
+
diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl
index 2488f67..b36ff64 100755
--- a/opac/sco/sco-main.pl
+++ b/opac/sco/sco-main.pl
@@ -92,7 +92,7 @@ my $issuer   = GetMemberDetails($issuerid);
 my $item     = GetItem(undef,$barcode);
 if (C4::Context->preference('SelfCheckoutByLogin') && !$patronid) {
     my $dbh = C4::Context->dbh;
-    my ($resval, $patronid) = checkpw($dbh, $patronlogin, $patronpw);
+    my $resval, $patronid = checkpw($dbh, $patronlogin, $patronpw);
 }
 my $borrower = GetMemberDetails(undef,$patronid);
 
diff --git a/patroncards/edit-batch.pl b/patroncards/edit-batch.pl
index 50bbbf4..449e82a 100755
--- a/patroncards/edit-batch.pl
+++ b/patroncards/edit-batch.pl
@@ -60,7 +60,7 @@ my @item_numbers = $cgi->param('item_number') if $cgi->param('item_number');
 my @borrower_numbers = $cgi->param('borrower_number') if $cgi->param('borrower_number');
 my $errstr = $cgi->param('error') || '';
 
-my $branch_code = get_branch_code_from_name($template->{VARS}->{'LoginBranchname'});
+my $branch_code = get_branch_code_from_name($template->param('LoginBranchname'));
 
 if ($op eq 'remove') {
     $batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id);
diff --git a/patroncards/manage.pl b/patroncards/manage.pl
index 71e1b82..2a449ba 100755
--- a/patroncards/manage.pl
+++ b/patroncards/manage.pl
@@ -73,7 +73,7 @@ my $display_columns = { layout =>   [  # db column       => {col label
 };
 
 my $errstr = ($cgi->param('error') ? $cgi->param('error') : '');
-my $branch_code = ($card_element eq 'batch' ? get_branch_code_from_name($template->{VARS}->{'LoginBranchname'}) : '');
+my $branch_code = ($card_element eq 'batch' ? get_branch_code_from_name($template->param('LoginBranchname')) : '');
 
 if ($op eq 'delete') {
     my $err = 0;
diff --git a/reports/acquisitions_stats.pl b/reports/acquisitions_stats.pl
index 8220148..26e85d5 100755
--- a/reports/acquisitions_stats.pl
+++ b/reports/acquisitions_stats.pl
@@ -134,7 +134,13 @@ else {
         -multiple => 0
     );
 
-    $req = $dbh->prepare("SELECT DISTINCTROW itemtype,description FROM itemtypes ORDER BY description");
+     if (C4::Context->preference("searchMyLibraryOnly"))
+     {
+      $req = $dbh->prepare("SELECT DISTINCTROW itemtype,description FROM itemtypes WHERE itemtype LIKE '" . C4::Branch->mybranch() . "%' ORDER BY description");
+      }
+      else {
+             $req = $dbh->prepare("SELECT DISTINCTROW itemtype,description FROM itemtypes ORDER BY description");
+           }
     $req->execute;
     undef @select;
     undef %select;
@@ -153,7 +159,14 @@ else {
         -multiple => 0
     );
 
+    if (C4::Context->preference("searchMyLibraryOnly"))
+     {
+        $req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets WHERE budget_code LIKE '" . C4::Branch->mybranch() . "%' ORDER BY budget_name"); 
+     }
+     else {
     $req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets ORDER BY budget_name");
+           }
+           
     $req->execute;
     undef @select;
     undef %select;
diff --git a/reports/bor_issues_top.pl b/reports/bor_issues_top.pl
index 95fc287..f45664f 100755
--- a/reports/bor_issues_top.pl
+++ b/reports/bor_issues_top.pl
@@ -137,7 +137,17 @@ foreach (sort keys %$labels) {
 	my %row =(value => $_,
               description => $labels->{$_},
              );
-    push @borcatloop, \%row;
+         
+             if (C4::Context->preference("searchMyLibraryOnly") && not C4::Branch->mybranch() eq 'NO_LIBRARY_SET')
+             {
+	       if (substr($labels->{$_},0,3) eq C4::Branch->mybranch())
+	       {
+               push @borcatloop, \%row;
+               }
+             }
+             else {
+                    push @borcatloop, \%row;
+		     }
 }
     
 $template->param(
diff --git a/reports/borrowers_out.pl b/reports/borrowers_out.pl
index 0a135e1..3dfde49 100755
--- a/reports/borrowers_out.pl
+++ b/reports/borrowers_out.pl
@@ -124,11 +124,23 @@ if ($do_it) {
     
     my ($codes,$labels) = GetborCatFromCatType(undef,undef);
     my @borcatloop;
-    foreach my $thisborcat (sort keys %$labels) {
-            my %row =(value => $thisborcat,
-                                    description => $labels->{$thisborcat},
+    foreach  (sort keys %$labels) {
+            my %row =(value => $_,
+                                    description => $labels->{$_},
                             );
-            push @borcatloop, \%row;
+         
+         
+                    if (C4::Context->preference("searchMyLibraryOnly") && not C4::Branch->mybranch() eq 'NO_LIBRARY_SET')
+             {
+	       if (substr($labels->{$_},0,3) eq C4::Branch->mybranch())
+	       {
+               push @borcatloop, \%row;
+               }
+             }
+             else {
+                    push @borcatloop, \%row;
+		     }
+         
     }
     $template->param(
                     CGIextChoice => $CGIextChoice,
diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl
index c17a326..950330b 100755
--- a/reports/borrowers_stats.pl
+++ b/reports/borrowers_stats.pl
@@ -147,7 +147,16 @@ if ($do_it) {
 output_html_with_http_headers $input, $cookie, $template->output;
 
 sub catcode_aref() {
-	my $req = C4::Context->dbh->prepare("SELECT categorycode, description FROM categories ORDER BY description");
+	my $req;
+	
+	     if ( C4::Context->preference("searchMyLibraryOnly") && not C4::Branch->mybranch() eq 'NO_LIBRARY_SET' )
+             {
+             	 $req = C4::Context->dbh->prepare("SELECT categorycode, description FROM categories WHERE categorycode LIKE '" . C4::Branch->mybranch() . "%' ORDER BY description");
+             }	
+             else {
+	         $req = C4::Context->dbh->prepare("SELECT categorycode, description FROM categories ORDER BY description");
+                }
+                
 	$req->execute;
 	return $req->fetchall_arrayref({});
 }
diff --git a/reports/cat_issues_top.pl b/reports/cat_issues_top.pl
index 606106d..12f630a 100755
--- a/reports/cat_issues_top.pl
+++ b/reports/cat_issues_top.pl
@@ -140,11 +140,22 @@ if ($do_it) {
     #borcat
     my ($codes,$labels) = GetborCatFromCatType(undef,undef);
     my @borcatloop;
-    foreach my $thisborcat (sort {$labels->{$a} cmp $labels->{$b}} keys %$labels) {
-            my %row =(value => $thisborcat,
-                      description => $labels->{$thisborcat},
+    foreach  (sort {$labels->{$a} cmp $labels->{$b}} keys %$labels) {
+            my %row =(value => $_,
+                      description => $labels->{$_},
                             );
-            push @borcatloop, \%row;
+                            
+            if (C4::Context->preference("searchMyLibraryOnly") && not C4::Branch->mybranch() eq 'NO_LIBRARY_SET')
+             {
+	       if (substr($labels->{$_},0,3) eq C4::Branch->mybranch())
+	       {
+               push @borcatloop, \%row;
+               }
+             }
+             else {
+                    push @borcatloop, \%row;
+		     }
+            
     }
     
     #Day
diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl
index 11dff4d..4c68f5d 100755
--- a/reports/catalogue_stats.pl
+++ b/reports/catalogue_stats.pl
@@ -142,7 +142,15 @@ if ($do_it) {
     my $hascote = 1;
     my $highcote = 5;
 
+     if ( C4::Context->preference("searchMyLibraryOnly") && not C4::Branch->mybranch() eq 'NO_LIBRARY_SET' )
+          {
+          $req = $dbh->prepare("select itemtype, description from itemtypes WHERE itemtype LIKE '" . C4::Branch->mybranch() . "%' order by description");	
+          }
+          else {
+          	
 	$req = $dbh->prepare("select itemtype, description from itemtypes order by description");
+                }
+                
 	$req->execute;
 	my $CGIitemtype = $req->fetchall_arrayref({});
 
diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl
index f5667a2..600ac29 100755
--- a/reports/guided_reports.pl
+++ b/reports/guided_reports.pl
@@ -21,7 +21,6 @@ use strict;
 #use warnings; FIXME - Bug 2505
 use CGI;
 use Text::CSV;
-use URI::Escape;
 use C4::Reports::Guided;
 use C4::Auth qw/:DEFAULT get_session/;
 use C4::Output;
@@ -522,9 +521,6 @@ elsif ($phase eq 'Run this report'){
 
         my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0);
         my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report&amp;phase=Run%20this%20report";
-        if (@sql_params) {
-            $url = join('&amp;sql_params=', $url, map { URI::Escape::uri_escape($_) } @sql_params);
-        }
         $template->param(
             'results' => \@rows,
             'sql'     => $sql,
@@ -625,7 +621,7 @@ sub header_cell_loop {
 }
 
 foreach (1..6) {
-     $template->{VARS}->{'build' . $_} and $template->{VARS}->{'buildx' . $_} and last;
+    $template->param('build' . $_) and $template->param(buildx => $_) and last;
 }
 $template->param(   'referer' => $input->referer(),
                     'DHTMLcalendar_dateformat' => C4::Dates->DHTMLcalendar(),
diff --git a/reports/issues_avg_stats.pl b/reports/issues_avg_stats.pl
index c6a3859..a74b885 100755
--- a/reports/issues_avg_stats.pl
+++ b/reports/issues_avg_stats.pl
@@ -119,7 +119,15 @@ if ($do_it) {
     my %labels;
     my %select;
     my $req;
+    
+           if ( C4::Context->preference("searchMyLibraryOnly") && not C4::Branch->mybranch() eq 'NO_LIBRARY_SET' )
+          {
+             $req = $dbh->prepare("select distinctrow categorycode,description from categories where categorycode like '" . C4::Branch->mybranch() . "%' order by description"); 
+          }
+          else {
     $req = $dbh->prepare("select distinctrow categorycode,description from categories order by description");
+            }
+            
     $req->execute;
     my @select;
     push @select,"";
@@ -135,7 +143,13 @@ if ($do_it) {
                 -size     => 1,
                 -multiple => 0 );
     
-    $req = $dbh->prepare( "select distinctrow itemtype,description from itemtypes order by description");
+              if ( C4::Context->preference("searchMyLibraryOnly") && not C4::Branch->mybranch() eq 'NO_LIBRARY_SET' )
+              {
+               $req = $dbh->prepare( "select distinctrow itemtype,description from itemtypes where itemtype like '" . C4::Branch->mybranch() . "%' order by description");
+              }
+              else {
+                    $req = $dbh->prepare( "select distinctrow itemtype,description from itemtypes order by description");
+                }
     $req->execute;
     undef @select;
     undef %select;
@@ -554,23 +568,8 @@ sub calculate {
     # and the number matches the number of columns
         my $colcount=0;
         foreach my $col ( @loopcol ) {
-            my $value;
-            if ($table{$row}->{
-                    (        ( $col->{coltitle} eq 'NULL' )
-                          or ( $col->{coltitle} eq q{} )
-                      ) ? 'zzEMPTY' : $col->{coltitle}
-                }
-              ) {
-                $value = $table{$row}->{
-                    (        ( $col->{coltitle} eq 'NULL' )
-                          or ( $col->{coltitle} eq q{} )
-                      ) ? 'zzEMPTY' : $col->{coltitle}
-                  } / $wgttable{$row}->{
-                    (        ( $col->{coltitle} eq 'NULL' )
-                          or ( $col->{coltitle} eq q{} )
-                      ) ? 'zzEMPTY' : $col->{coltitle}
-                  };
-            }
+            my $value =$table{$row}->{(($col->{coltitle} eq "NULL")or ($col->{coltitle} eq ""))?"zzEMPTY":$col->{coltitle}} / $wgttable{$row}->{(($col->{coltitle} eq "NULL")or ($col->{coltitle} eq ""))?"zzEMPTY":$col->{coltitle}} if ($table{$row}->{(($col->{coltitle} eq "NULL")or ($col->{coltitle} eq ""))?"zzEMPTY":$col->{coltitle}});
+
             $table{$row}->{(($col->{coltitle} eq "NULL")or ($col->{coltitle} eq ""))?"zzEMPTY":$col->{coltitle}} = $value;
             $table{$row}->{totalrow}+=$value;
             #warn "row : $row col:$col  $cnttable{$row}->{(($col->{coltitle} eq \"NULL\")or ($col->{coltitle} eq \"\"))?\"zzEMPTY\":$col->{coltitle}}";
@@ -578,16 +577,12 @@ sub calculate {
             push @loopcell, {value => ($value)?sprintf("%.2f",$value):0  } ;
         }
         #warn "row : $row colcount:$colcount";
-        my $total;
-        if ( $colcount > 0 ) {
-            $total = $table{$row}->{totalrow} / $colcount;
-        }
-        push @looprow,
-          { 'rowtitle' => ( $row eq "zzEMPTY" ) ? "NULL" : $row,
-            'loopcell' => \@loopcell,
-            'hilighted' => ( $hilighted > 0 ),
-            'totalrow'  => ($total) ? sprintf( "%.2f", $total ) : 0
-          };
+        my $total = $table{$row}->{totalrow}/$colcount if ($colcount>0);
+        push @looprow,{ 'rowtitle' => ($row eq "zzEMPTY")?"NULL":$row,
+                        'loopcell' => \@loopcell,
+                        'hilighted' => ($hilighted >0),
+                        'totalrow' => ($total)?sprintf("%.2f",$total):0
+                    };
         $hilighted = -$hilighted;
     }
 # 	
@@ -622,3 +617,6 @@ sub calculate {
 }
 
 1;
+
+
+
diff --git a/reports/reservereport.pl b/reports/reservereport.pl
index 42a1d20..67f384c 100755
--- a/reports/reservereport.pl
+++ b/reports/reservereport.pl
@@ -96,7 +96,7 @@ for ( my $i = 0 ; $i < $count ; $i++ ) {
 	 # FIXME still need to shift the text to the template so its translateable
 	 if ( $data->[$i]) {
 	     # find if its on issue
-	     my @items = GetItemsInfo( $line{biblionumber} );
+	     my @items = GetItemsInfo($line{'biblionumber'}, 'intra' );
 	     my $onissue = 0;
 	     foreach my $item (@items) {
 		 if ( $item->{'datedue'} eq 'Reserved' ) {
diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl
index 19d76be..bc3fc74 100755
--- a/reserve/placerequest.pl
+++ b/reserve/placerequest.pl
@@ -44,14 +44,14 @@ my @bibitems=$input->param('biblioitem');
 #       and probably remove the reserveconstraint table as well, I never could fill anything in this table.
 my @reqbib=$input->param('reqbib'); 
 my $biblionumber=$input->param('biblionumber');
-my $borrowernumber=$input->param('borrowernumber');
+my $borrower=$input->param('member');
 my $notes=$input->param('notes');
 my $branch=$input->param('pickup');
 my $startdate=$input->param('reserve_date') || '';
 my @rank=$input->param('rank-request');
 my $type=$input->param('type');
 my $title=$input->param('title');
-my $borrower=GetMember('borrowernumber'=>$borrowernumber);
+my $borrowernumber=GetMember('cardnumber'=>$borrower);
 my $checkitem=$input->param('checkitem');
 my $expirationdate = $input->param('expiration_date');
 
@@ -81,7 +81,7 @@ if ($checkitem ne ''){
     }
 }
 
-if ($type eq 'str8' && $borrower){
+if ($type eq 'str8' && $borrowernumber ne ''){
 
     foreach my $biblionumber (keys %bibinfos) {
         my $count=@bibitems;
@@ -100,18 +100,18 @@ if ($type eq 'str8' && $borrower){
 
         if ($multi_hold) {
             my $bibinfo = $bibinfos{$biblionumber};
-            AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',[$biblionumber],
+            AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',[$biblionumber],
                        $bibinfo->{rank},$startdate,$expirationdate,$notes,$bibinfo->{title},$checkitem,$found);
         } else {
             if ($input->param('request') eq 'any'){
                 # place a request on 1st available
-                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem,$found);
+                AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem,$found);
             } elsif ($reqbib[0] ne ''){
                 # FIXME : elsif probably never reached, (see top of the script)
                 # place a request on a given item
-                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'o',\@reqbib,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem, $found);
+                AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'o',\@reqbib,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem, $found);
             } else {
-                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem, $found);
+                AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$startdate,$expirationdate,$notes,$title,$checkitem, $found);
             }
         }
     }
@@ -124,10 +124,8 @@ if ($type eq 'str8' && $borrower){
     } else {
         print $input->redirect("request.pl?biblionumber=$biblionumber");
     }
-} elsif ($borrower eq ''){
+} elsif ($borrowernumber eq ''){
 	print $input->header();
-	print "Invalid borrower number please try again";
-# Not sure that Dump() does HTML escaping. Use firebug or something to trace
-# instead.
-#	print $input->Dump;
+	print "Invalid card number please try again";
+	print $input->Dump;
 }
diff --git a/reserve/request.pl b/reserve/request.pl
index 79ff6b5..0b3bebc 100755
--- a/reserve/request.pl
+++ b/reserve/request.pl
@@ -85,7 +85,7 @@ my $CGIbranch = CGI::scrolling_list(
 my $findborrower = $input->param('findborrower');
 $findborrower = '' unless defined $findborrower;
 $findborrower =~ s|,| |g;
-my $borrowernumber_hold = $input->param('borrowernumber') || '';
+my $cardnumber = $input->param('cardnumber') || '';
 my $borrowerslist;
 my $messageborrower;
 my $warnings;
@@ -117,19 +117,21 @@ if ($findborrower) {
 
     my @borrowers = @$borrowers;
 
-    if ( !@borrowers ) {
+    if ( $#borrowers == -1 ) {
+        $input->param( 'findborrower', '' );
         $messageborrower = "'$findborrower'";
     }
-    elsif ( @borrowers == 1 ) {
-        $borrowernumber_hold = $borrowers[0]->{'borrowernumber'};
+    elsif ( $#borrowers == 0 ) {
+        $input->param( 'cardnumber', $borrowers[0]->{'cardnumber'} );
+        $cardnumber = $borrowers[0]->{'cardnumber'};
     }
     else {
         $borrowerslist = \@borrowers;
     }
 }
 
-if ($borrowernumber_hold) {
-    my $borrowerinfo = GetMemberDetails( $borrowernumber_hold );
+if ($cardnumber) {
+    my $borrowerinfo = GetMemberDetails( 0, $cardnumber );
     my $diffbranch;
     my @getreservloop;
     my $count_reserv = 0;
@@ -141,7 +143,7 @@ if ($borrowernumber_hold) {
     my $number_reserves =
       GetReserveCount( $borrowerinfo->{'borrowernumber'} );
 
-    if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) {
+    if ( C4::Context->preference('maxreserves') && $number_reserves >= C4::Context->preference('maxreserves') ) {
 		$warnings = 1;
         $maxreserves = 1;
     }
@@ -162,25 +164,24 @@ if ($borrowernumber_hold) {
     }
 
     $template->param(
-                borrowernumber      => $borrowerinfo->{'borrowernumber'},
-                borrowersurname     => $borrowerinfo->{'surname'},
-                borrowerfirstname   => $borrowerinfo->{'firstname'},
-                borrowerstreetaddress   => $borrowerinfo->{'address'},
-                borrowercity        => $borrowerinfo->{'city'},
-                borrowerphone       => $borrowerinfo->{'phone'},
-                borrowermobile      => $borrowerinfo->{'mobile'},
-                borrowerfax         => $borrowerinfo->{'fax'},
-                borrowerphonepro    => $borrowerinfo->{'phonepro'},
-                borroweremail       => $borrowerinfo->{'email'},
-                borroweremailpro    => $borrowerinfo->{'emailpro'},
-                borrowercategory    => $borrowerinfo->{'category'},
-                borrowerreservs     => $count_reserv,
-                cardnumber          => $borrowerinfo->{'cardnumber'},
-                maxreserves         => $maxreserves,
-                expiry              => $expiry,
-                diffbranch          => $diffbranch,
-				messages            => $messages,
-				warnings            => $warnings
+                borrowernumber => $borrowerinfo->{'borrowernumber'},
+                borrowersurname   => $borrowerinfo->{'surname'},
+                borrowerfirstname => $borrowerinfo->{'firstname'},
+                borrowerstreetaddress => $borrowerinfo->{'address'},
+                borrowercity => $borrowerinfo->{'city'},
+                borrowerphone => $borrowerinfo->{'phone'},
+                borrowermobile => $borrowerinfo->{'mobile'},
+                borrowerfax => $borrowerinfo->{'fax'},
+                borrowerphonepro => $borrowerinfo->{'phonepro'},
+                borroweremail => $borrowerinfo->{'email'},
+                borroweremailpro => $borrowerinfo->{'emailpro'},
+                borrowercategory => $borrowerinfo->{'category'},
+                borrowerreservs   => $count_reserv,
+                maxreserves       => $maxreserves,
+                expiry            => $expiry,
+                diffbranch        => $diffbranch,
+				messages => $messages,
+				warnings => $warnings
     );
 }
 
@@ -199,18 +200,18 @@ if ($borrowerslist) {
         } @{$borrowerslist}
       )
     {
-        push @values, $borrower->{borrowernumber};
+        push @values, $borrower->{cardnumber};
 
-        $labels{ $borrower->{borrowernumber} } = sprintf(
+        $labels{ $borrower->{cardnumber} } = sprintf(
             '%s, %s ... (%s - %s) ... %s',
-            $borrower->{surname} ||'',    $borrower->{firstname} || '',
-            $borrower->{cardnumber} || '', $borrower->{categorycode} || '',
-            $borrower->{address} || '',
+            $borrower->{surname},    $borrower->{firstname},
+            $borrower->{cardnumber}, $borrower->{categorycode},
+            $borrower->{address},
         );
     }
 
     $CGIselectborrower = CGI::scrolling_list(
-        -name     => 'borrowernumber',
+        -name     => 'cardnumber',
         -values   => \@values,
         -labels   => \%labels,
         -size     => 7,
@@ -219,7 +220,7 @@ if ($borrowerslist) {
 }
 
 # FIXME launch another time GetMemberDetails perhaps until
-my $borrowerinfo = GetMemberDetails( $borrowernumber_hold );
+my $borrowerinfo = GetMemberDetails( 0, $cardnumber );
 
 my @biblionumbers = ();
 my $biblionumbers = $input->param('biblionumbers');
@@ -237,7 +238,7 @@ foreach my $biblionumber (@biblionumbers) {
 
     my $dat          = GetBiblioData($biblionumber);
 
-    unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) {
+    if ( not CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) {
  		$warnings = 1;
         $maxreserves = 1;
     }
@@ -428,14 +429,11 @@ foreach my $biblionumber (@biblionumbers) {
             $item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
             
             if ( $branchitemrule->{'holdallowed'} == 0 ||
-                 ( $branchitemrule->{'holdallowed'} == 1 && 
-                     $borrowerinfo->{'branchcode'} ne $item->{'homebranch'} ) ) {
+                 ( $branchitemrule->{'holdallowed'} == 1 && $borrowerinfo->{'branchcode'} ne $item->{'homebranch'} ) ) {
                 $policy_holdallowed = 0;
             }
             
-            if (IsAvailableForItemLevelRequest($itemnumber) and 
-            	not $item->{cantreserve} and 
-            	CanItemBeReserved($borrowerinfo->{borrowernumber}, $itemnumber) ) {
+            if (IsAvailableForItemLevelRequest($itemnumber) and not $item->{cantreserve} and CanItemBeReserved($borrowerinfo->{borrowernumber}, $itemnumber) ) {
                 if ( $policy_holdallowed ) {
                     $item->{available} = 1;
                     $num_available++;
@@ -566,6 +564,7 @@ foreach my $biblionumber (@biblionumbers) {
                      date              => $date,
                      biblionumber      => $biblionumber,
                      findborrower      => $findborrower,
+                     cardnumber        => $cardnumber,
                      title             => $dat->{title},
                      author            => $dat->{author},
                      holdsview => 1,
diff --git a/serials/routing-preview.pl b/serials/routing-preview.pl
index 64849b5..5d57c13 100755
--- a/serials/routing-preview.pl
+++ b/serials/routing-preview.pl
@@ -65,7 +65,7 @@ if($ok){
     # get biblio information....
     my $biblio = $subs->{'biblionumber'};
 	my ($count2, at bibitems) = GetBiblioItemByBiblioNumber($biblio);
-	my @itemresults = GetItemsInfo( $subs->{biblionumber} );
+	my @itemresults = GetItemsInfo($subs->{'biblionumber'}, 'intra');
 	my $branch = $itemresults[0]->{'holdingbranch'};
 	my $branchname = GetBranchName($branch);
 
diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl
index db7620c..fbf9ad5 100755
--- a/serials/serials-edit.pl
+++ b/serials/serials-edit.pl
@@ -176,7 +176,6 @@ foreach my $subscriptionid (@subscriptionids) {
             $cell->{serialsadditems} = 1;
         }
         $cell->{'subscriptionid'} = $subscriptionid;
-        $cell->{biblionumber} = $serialdatalist[0]->{'biblionumber'};
         $cell->{'itemid'}         = 'NNEW';
         $cell->{'serialid'}       = 'NEW';
         $cell->{'issuesatonce'}   = 1;
diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl
index 9acee7b..7fcccdf 100755
--- a/serials/subscription-add.pl
+++ b/serials/subscription-add.pl
@@ -43,7 +43,7 @@ my @budgets;
 
 # Permission needed if it is a modification : edit_subscription
 # Permission needed otherwise (nothing or dup) : create_subscription
-my $permission = ($op eq "modify") ? "edit_subscription" : "create_subscription";
+my $permission = ($op eq "mod") ? "edit_subscription" : "create_subscription";
 
 my ($template, $loggedinuser, $cookie)
 = get_template_and_user({template_name => "serials/subscription-add.tmpl",
@@ -66,12 +66,12 @@ my $subs;
 my $firstissuedate;
 my $nextexpected;
 
-if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') {
+if ($op eq 'mod' || $op eq 'dup' || $op eq 'modsubscription') {
 
     my $subscriptionid = $query->param('subscriptionid');
     $subs = GetSubscription($subscriptionid);
 ## FIXME : Check rights to edit if mod. Could/Should display an error message.
-    if ($subs->{'cannotedit'} && $op eq 'modify'){
+    if ($subs->{'cannotedit'} && $op eq 'mod'){
       carp "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
       print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
     }
@@ -91,7 +91,7 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') {
     letter_loop($subs->{'letter'}, $template);
     $nextexpected = GetNextExpected($subscriptionid);
     $nextexpected->{'isfirstissue'} = $nextexpected->{planneddate}->output('iso') eq $firstissuedate ;
-    $subs->{nextacquidate} = $nextexpected->{planneddate}->output()  if($op eq 'modify');
+    $subs->{nextacquidate} = $nextexpected->{planneddate}->output()  if($op eq 'mod');
     unless($op eq 'modsubscription') {
 		foreach my $length_unit qw(numberlength weeklength monthlength){
 			if ($subs->{$length_unit}){
@@ -107,7 +107,7 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') {
                     $op => 1,
                     "subtype_$sub_on" => 1,
                     sublength =>$sub_length,
-                    history => ($op eq 'modify'),
+                    history => ($op eq 'mod'),
                     "periodicity".$subs->{'periodicity'} => 1,
                     "numberpattern".$subs->{'numberpattern'} => 1,
                     firstacquiyear => substr($firstissuedate,0,4),
@@ -160,7 +160,7 @@ if ($op eq 'addsubscription') {
         }
     $template->param(subtype => \@sub_type_data);
 
-    letter_loop( '', $template ) if ($op ne 'modsubscription' && $op ne 'dup' && $op ne 'modify');
+    letter_loop( '', $template ) if ($op ne 'modsubscription' && $op ne 'dup' && $op ne 'mod');
 
     my $new_biblionumber = $query->param('biblionumber_for_new_subscription');
     if (defined $new_biblionumber) {
diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl
index d00b632..aa8fad0 100755
--- a/suggestion/suggestion.pl
+++ b/suggestion/suggestion.pl
@@ -288,16 +288,10 @@ my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG",$$suggestion_ref{'patron
 $template->param(patron_reason_loop=>$patron_reason_loop);
 
 #Budgets management
-my $budgets = [];
-if ($branchfilter) {
-    my $searchbudgets = { budget_branchcode => $branchfilter };
-    $budgets = GetBudgets($searchbudgets);
-} else {
-    $budgets = GetBudgets(undef);
-}
+my $searchbudgets={ budget_branchcode=>$branchfilter} if $branchfilter;
+my $budgets = GetBudgets($searchbudgets);
 
-foreach my $budget ( @{$budgets} ) {
-## Please see file perltidy.ERR
+foreach my $budget (@$budgets){
     $budget->{'selected'}=1 if ($$suggestion_ref{'budgetid'} && $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'})
 };
 
diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t
index dd827f0..6012f5f 100755
--- a/t/db_dependent/Biblio.t
+++ b/t/db_dependent/Biblio.t
@@ -5,7 +5,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 9;
+use Test::More tests => 6;
 use MARC::Record;
 use C4::Biblio;
 
@@ -34,40 +34,6 @@ my $itemdata = &GetBiblioItemData($biblioitemnumber);
 is($itemdata->{title},$title,'First test of GetBiblioItemData to get same result of previous two GetBiblioData tests.');
 is($itemdata->{isbn},$isbn,'Second test checking it returns the correct isbn.');
 
-my $success = 0;
-$field = MARC::Field->new(
-        655, ' ', ' ',
-        'a' => 'Auction catalogs',
-        '9' => '1'
-        );
-eval {
-    $marc_record->append_fields($field);
-    $success = ModBiblio($marc_record,$biblionumber,'');
-} or do {
-    diag($@);
-    $success = 0;
-};
-ok($success, "ModBiblio handles authority-linked 655");
-
-eval {
-    $field->delete_subfields('a');
-    $marc_record->append_fields($field);
-    $success = ModBiblio($marc_record,$biblionumber,'');
-} or do {
-    diag($@);
-    $success = 0;
-};
-ok($success, "ModBiblio handles 655 with authority link but no heading");
-
-eval {
-    $field->delete_subfields('9');
-    $marc_record->append_fields($field);
-    $success = ModBiblio($marc_record,$biblionumber,'');
-} or do {
-    diag($@);
-    $success = 0;
-};
-ok($success, "ModBiblio handles 655 with no subfields");
 
 # clean up after ourselves
 DelBiblio($biblionumber);
diff --git a/tools/export.pl b/tools/export.pl
index 4a09868..d858f44 100755
--- a/tools/export.pl
+++ b/tools/export.pl
@@ -184,17 +184,16 @@ else {
        push @itemtypesloop, \%row;
     }
     my @branchloop;
-    for my $thisbranch (
-        sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} }
-        keys %{$branches}
-      ) {
-        push @branchloop,
-          { value      => $thisbranch,
-            selected   => $thisbranch eq $branch,
+	for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
+        my $selected = 1 if $thisbranch eq $branch;
+        my %row = (
+            value => $thisbranch,
+            selected => $selected,
             branchname => $branches->{$thisbranch}->{'branchname'},
-          };
+       );
+       push @branchloop, \%row;
     }
-
+    
     $template->param(
         branchloop   => \@branchloop,
         itemtypeloop => \@itemtypesloop,
diff --git a/tools/holidays.pl b/tools/holidays.pl
index 90ef56a..eb3bc9c 100755
--- a/tools/holidays.pl
+++ b/tools/holidays.pl
@@ -65,20 +65,18 @@ if ( $onlymine ) {
     $branch = C4::Context->userenv->{'branch'};
 }
 my $branchname = GetBranchName($branch);
-my $branches   = GetBranches($onlymine);
+my $branches = GetBranches($onlymine);
 my @branchloop;
-for my $thisbranch (
-    sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} }
-    keys %{$branches} ) {
-    push @branchloop,
-      { value      => $thisbranch,
-        selected   => $thisbranch eq $branch,
-        branchname => $branches->{$thisbranch}->{'branchname'},
-      };
+for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
+    my $selected = 1 if $thisbranch eq $branch;
+    my %row =(value => $thisbranch,
+                selected => $selected,
+                branchname => $branches->{$thisbranch}->{'branchname'},
+            );
+    push @branchloop, \%row;
 }
-
 # branches calculated - put branch codes in a single string so they can be passed in a form
-my $branchcodes = join '|', keys %{$branches};
+my $branchcodes = join("|", keys %$branches);
 
 # Get all the holidays
 
diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl
index 74a5889..6141998 100755
--- a/tools/import_borrowers.pl
+++ b/tools/import_borrowers.pl
@@ -66,7 +66,7 @@ my $columnkeystpl = [ map { {'key' => $_} }  grep {$_ ne 'borrowernumber' && $_
 
 my $input = CGI->new();
 our $csv  = Text::CSV->new({binary => 1});  # binary needed for non-ASCII Unicode
-#push @feedback, {feedback=>1, name=>'backend', value=>$csv->backend, backend=>$csv->backend}; #XXX
+# push @feedback, {feedback=>1, name=>'backend', value=>$csv->backend, backend=>$csv->backend};
 
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
         template_name   => "tools/import_borrowers.tmpl",
@@ -193,9 +193,6 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
         }
         if ($extended) {
             my $attr_str = $borrower{patron_attributes};
-            $attr_str =~ s/\xe2\x80\x9c/"/g; # fixup double quotes in case we are passed smart quotes
-            $attr_str =~ s/\xe2\x80\x9d/"/g;
-            push @feedback, {feedback=>1, name=>'attribute string', value=>$attr_str, filename=>$uploadborrowers};
             delete $borrower{patron_attributes};    # not really a field in borrowers, so we don't want to pass it to ModMember.
             $patron_attributes = extended_attributes_code_value_arrayref($attr_str); 
         }
@@ -249,8 +246,6 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
             }
             unless (ModMember(%borrower)) {
                 $invalid++;
-                # untill we have better error trapping, we have no way of knowing why ModMember errored out...
-                push @errors, {unknown_error => 1};
                 $template->param('lastinvalid'=>$borrower{'surname'}.' / '.$borrowernumber);
                 next LINE;
             }
@@ -259,7 +254,7 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
                     my $old_attributes = GetBorrowerAttributes($borrowernumber);
                     $patron_attributes = extended_attributes_merge($old_attributes, $patron_attributes);  #TODO: expose repeatable options in template
                 }
-                push @errors, {unknown_error => 1} unless SetBorrowerAttributes($borrower{'borrowernumber'}, $patron_attributes);
+                SetBorrowerAttributes($borrower{'borrowernumber'}, $patron_attributes);
             }
             $overwritten++;
             $template->param('lastoverwritten'=>$borrower{'surname'}.' / '.$borrowernumber);
@@ -281,7 +276,6 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
                 $template->param('lastimported'=>$borrower{'surname'}.' / '.$borrowernumber);
             } else {
                 $invalid++;
-                push @errors, {unknown_error => 1};
                 $template->param('lastinvalid'=>$borrower{'surname'}.' / AddMember');
             }
         }
diff --git a/tools/inventory.pl b/tools/inventory.pl
index 5e7b198..cc7e8a7 100755
--- a/tools/inventory.pl
+++ b/tools/inventory.pl
@@ -77,8 +77,6 @@ my @authorised_value_list;
 my $authorisedvalue_categories = '';
 
 my $frameworks = getframeworks();
-$frameworks->{''} = {frameworkcode => ''}; # Add the default framework
-
 for my $fwk (keys %$frameworks){
   my $fwkcode = $frameworks->{$fwk}->{'frameworkcode'};
   my $authcode = GetAuthValCode('items.location', $fwkcode);
@@ -196,7 +194,7 @@ if ( ! ($uploadbarcodes && length($uploadbarcodes)>0 ) || ( $input->param('compa
     if ( defined $input->param('compareinv2barcd') && ( ( $input->param('compareinv2barcd') eq 'on' ) && ( scalar @brcditems != scalar @$res ) ) && length($uploadbarcodes) > 0 ){
         if ( scalar @brcditems > scalar @$res ){
             for my $brcditem (@brcditems) {
-                if (! grep( $_->{barcode} =~ /$brcditem->{barcode}/ , @$res) ){
+                if (! grep(/$brcditem->{barcode}/, @$res) ){
                     $brcditem->{notfoundkoha} = 1;
                     push @$res, $brcditem;
                 }
@@ -204,7 +202,7 @@ if ( ! ($uploadbarcodes && length($uploadbarcodes)>0 ) || ( $input->param('compa
         } else {
             my @notfound;
             for my $item (@$res) {
-                if ( ! grep( $_->{barcode} =~ /$item->{barcode}/ , @brcditems) ){
+                if ( ! grep(/$item->{barcode}/, @brcditems) ){
                     $item->{notfoundbarcode} = 1;
                     push @notfound, $item;
                 }
diff --git a/tools/koha-news.pl b/tools/koha-news.pl
index afc5268..2451934 100755
--- a/tools/koha-news.pl
+++ b/tools/koha-news.pl
@@ -79,7 +79,7 @@ if ( $op eq 'add_form' ) {
             op => 'edit',
             id => $new_detail->{'idnew'}
         );
-        $template->{VARS}->{'new_detail'} = $new_detail;
+        $template->param($new_detail);
     }
     else {
         $template->param( op => 'add' );
diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl
index bfb233e..f4c75d8 100755
--- a/tools/picture-upload.pl
+++ b/tools/picture-upload.pl
@@ -78,10 +78,7 @@ my ( $total, $handled, @counts, $tempfile, $tfh );
 if ( ($op eq 'Upload') && $uploadfile ) {       # Case is important in these operational values as the template must use case to be visually pleasing!
     my $dirname = File::Temp::tempdir( CLEANUP => 1);
     $debug and warn "dirname = $dirname";
-    my $filesuffix;
-    if ( $uploadfilename =~ m/(\..+)$/i ) {
-        my $filesuffix = $1;
-    }
+    my $filesuffix = $1 if $uploadfilename =~ m/(\..+)$/i;
     ( $tfh, $tempfile ) = File::Temp::tempfile( SUFFIX => $filesuffix, UNLINK => 1 );
     $debug and warn "tempfile = $tempfile";
     my ( @directories, $errors );
@@ -257,11 +254,8 @@ sub handle_file {
 					undef $srcimage;    # This object can get big...
 				}
 				$debug and warn "Image is of mimetype $mimetype";
-                my $dberror;
-                if ($mimetype) {
-                    $dberror = PutPatronImage( $cardnumber, $mimetype, $imgfile );
-                }
-                if ( !$dberror && $mimetype ) { # Errors from here on are fatal only to the import of a particular image, so don't bail, just note the error and keep going
+				my $dberror = PutPatronImage($cardnumber,$mimetype, $imgfile) if $mimetype;
+				if ( !$dberror && $mimetype ) { # Errors from here on are fatal only to the import of a particular image, so don't bail, just note the error and keep going
 					$count{count}++;
 					push @{ $count{filenames} }, { source => $filename, cardnumber => $cardnumber };
 				} elsif ( $dberror ) {
diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl
index 16ada89..d902398 100755
--- a/virtualshelves/sendshelf.pl
+++ b/virtualshelves/sendshelf.pl
@@ -85,7 +85,7 @@ if ( $email ) {
         my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
         my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
 
-        my @items = GetItemsInfo( $biblionumber );
+        my @items = &GetItemsInfo( $biblionumber, 'opac' );
 
         $dat->{MARCNOTES}      = $marcnotesarray;
         $dat->{MARCSUBJCTS}    = $marcsubjctsarray;
-- 
1.7.4.1



More information about the Koha-patches mailing list