From 0ee5b38b1c5f787f02fd7617d3e747dc7c6b51bf Mon Sep 17 00:00:00 2001 From: Mark Gavillet Date: Wed, 6 Apr 2011 14:16:15 +0200 Subject: [PATCH 01/32] Bug: 5547 - corrected insert to database Inserting a new category failed because only 10 bind variables were present and 11 were required. Signed-off-by: Katrin Fischer Signed-off-by: Chris Cormack --- admin/categorie.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/categorie.pl b/admin/categorie.pl index d0211fdb03..576d7caa94 100755 --- a/admin/categorie.pl +++ b/admin/categorie.pl @@ -133,7 +133,7 @@ if ($op eq 'add_form') { $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','categorycode')); $sth->finish; } else { - my $sth=$dbh->prepare("INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?,?)"); + my $sth=$dbh->prepare("INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?,?,?)"); $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type')); $sth->finish; } From 2a489184c088f0b023285069706f8ff614e4704e Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Fri, 8 Apr 2011 08:43:06 +1200 Subject: [PATCH 02/32] New developer to the history --- docs/history.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/history.txt b/docs/history.txt index cf63f87171..482d4d6d44 100644 --- a/docs/history.txt +++ b/docs/history.txt @@ -538,3 +538,4 @@ March 17 2011 Julian Maurice becomes the 136th developer to have a patch pushed March 17 2011 Sophie Meynieux becomes the 137th developer to have a patch pushed March 22 2011 Koha 3.2.6 released March 31 2011 Doug Dearden becomes the 138th developer to have a patch pushed +April 8 2011 Mark Gavillet becomes the 139th developer to have a patch pushed From 2950fc5596542ff181f05f766f32855089f96528 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Thu, 7 Apr 2011 14:59:53 +0200 Subject: [PATCH 03/32] Bug #6110 - fix Callnumber index mistake Signed-off-by: Paul Poulain Signed-off-by: Chris Cormack --- etc/zebradb/marc_defs/unimarc/biblios/record.abs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/zebradb/marc_defs/unimarc/biblios/record.abs b/etc/zebradb/marc_defs/unimarc/biblios/record.abs index f474f45f7a..c5d8ec5ebb 100644 --- a/etc/zebradb/marc_defs/unimarc/biblios/record.abs +++ b/etc/zebradb/marc_defs/unimarc/biblios/record.abs @@ -331,7 +331,7 @@ melm 995$e location,item melm 995$f barcode,item melm 995$h ccode,item melm 995$j LC-card-number:s,item -melm 995$k Call-Number,Local-Classification,lcn,Call-Number:p,Local-Classification:p,lcn:p,item +melm 995$k Call-Number,Local-classification,lcn,Call-Number:p,Local-classification:p,lcn:p,item,Local-classification:s melm 995$n onloan:d,onloan:n,onloan:s,onloan:w,item melm 995$u Note,Note:p,item melm 995 item # just to index every subfield From e5ff05857e5b99ab19210bc272086f253ea9404b Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Thu, 7 Apr 2011 17:15:53 +0200 Subject: [PATCH 04/32] Bug 6106: add item not respecting framework in acq The PrepareItemrecordDisplay sub builds an item framework for later use in ACQ Some cases were missing : item subfield connected to a plugin, hidden subfield, long size subfield. Signed-off-by: Katrin Fischer Signed-off-by: Chris Cormack --- C4/Biblio.pm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index a0e06f67cc..135dd91630 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2397,6 +2397,40 @@ sub PrepareItemrecordDisplay { -tabindex => '', -multiple => 0, ); + } elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { + # opening plugin + my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; + if (do $plugin) { + my $temp; + my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); + my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); + $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? + my $index_subfield = int(rand(1000000)); + $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; + $subfield_data{marc_value} = qq[ + ... + $javascript]; + } else { + warn "Plugin Failed: $plugin"; + $subfield_data{marc_value} = qq(); # supply default input form + } + } + elsif ( $tag eq '' ) { # it's an hidden field + $subfield_data{marc_value} = qq(); + } + elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? + $subfield_data{marc_value} = qq(); + } + elsif ( length($defaultvalue) > 100 + or (C4::Context->preference("marcflavour") eq "UNIMARC" and + 300 <= $tag && $tag < 400 && $subfield eq 'a' ) + or (C4::Context->preference("marcflavour") eq "MARC21" and + 500 <= $tag && $tag < 600 ) + ) { + # oversize field (textarea) + $subfield_data{marc_value} = qq(\n"); } else { $subfield_data{marc_value} = ""; } From 22dc04e24c9af810672ee8f6e313316f3bcc9a59 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Thu, 7 Apr 2011 11:59:22 +0200 Subject: [PATCH 05/32] Bug #6082 - On aqbudgets.pl bug on the Statistic's combobox Signed-off-by: Katrin Fischer Signed-off-by: Chris Cormack --- C4/Koha.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 0836669c71..95244bd91e 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1051,7 +1051,7 @@ sub GetAuthorisedValueCategories { my $sth = $dbh->prepare("SELECT DISTINCT category FROM authorised_values ORDER BY category"); $sth->execute; my @results; - while (my $category = $sth->fetchrow_array) { + while (defined (my $category = $sth->fetchrow_array) ) { push @results, $category; } return \@results; From 0cf2eccfe926f77753a2b948e2babf077e2975d3 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Thu, 7 Apr 2011 16:25:27 +0200 Subject: [PATCH 06/32] Bug 5529 Absence or Presence of lists not being reliably returned C4::VirtualShelves::GetRecentShelves contained some rather confused code The contents of the requested list are returned in an arrayref which was in its turn being wrapped needlessly in an array As a result the returned array always consisted of a single element irrespective of the number of lists. Made the routine return the arrayref, which can now be tested directly Unfortunately rather than fixing this we had previously coded around it assuming it to be a "design" decision. Have amended other calls of the subroutine resulting in some hopefully less obscure code Fixed logic error in the results template which displayed new list within a test for the presence of lists Removed the offset parameter from the sql in the routine as it was hardcoded to 0 i.e. the default value Signed-off-by: fdurand Signed-off-by: Chris Cormack --- C4/Auth.pm | 44 +++++++++---------- C4/VirtualShelves.pm | 44 +++++++++++-------- C4/VirtualShelves/Page.pm | 12 ++--- catalogue/search.pl | 15 +++---- .../prog/en/modules/catalogue/results.tmpl | 2 +- virtualshelves/addbybiblionumber.pl | 4 +- 6 files changed, 62 insertions(+), 59 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 35c083889d..7a0c13ea29 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -164,19 +164,19 @@ sub get_template_and_user { $template->param( loggedinusername => $user ); $template->param( sessionID => $sessionID ); - my ($total, $pubshelves, $barshelves) = C4::Context->get_shelves_userenv(); - if (defined($pubshelves)) { - $template->param( pubshelves => scalar (@$pubshelves), - pubshelvesloop => $pubshelves, - ); - $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@$pubshelves)); - } - if (defined($barshelves)) { - $template->param( barshelves => scalar (@$barshelves), - barshelvesloop => $barshelves, - ); - $template->param( bartotal => $total->{'bartotal'}, ) if ($total->{'bartotal'} > scalar (@$barshelves)); - } + my ($total, $pubshelves, $barshelves) = C4::Context->get_shelves_userenv(); + if (defined($pubshelves)) { + $template->param( pubshelves => scalar @{$pubshelves}, + pubshelvesloop => $pubshelves, + ); + $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar @{$pubshelves}); + } + if (defined($barshelves)) { + $template->param( barshelves => scalar @{$barshelves}, + barshelvesloop => $barshelves, + ); + $template->param( bartotal => $total->{'bartotal'}, ) if ($total->{'bartotal'} > scalar @{$barshelves}); + } $borrowernumber = getborrowernumber($user) if defined($user); @@ -297,11 +297,11 @@ sub get_template_and_user { $template->param( sessionID => $sessionID ); my ($total, $pubshelves) = C4::Context->get_shelves_userenv(); # an anonymous user has no 'barshelves'... - if (defined(($pubshelves))) { - $template->param( pubshelves => scalar (@$pubshelves), + if (defined $pubshelves) { + $template->param( pubshelves => scalar @{$pubshelves}, pubshelvesloop => $pubshelves, ); - $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@$pubshelves)); + $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar @{$pubshelves}); } } @@ -852,12 +852,12 @@ sub checkauth { $total->{'bartotal'} = $totshelves; ($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef); $total->{'pubtotal'} = $totshelves; - $session->param('barshelves', $barshelves->[0]); - $session->param('pubshelves', $pubshelves->[0]); + $session->param('barshelves', $barshelves); + $session->param('pubshelves', $pubshelves); $session->param('totshelves', $total); - C4::Context::set_shelves_userenv('bar',$barshelves->[0]); - C4::Context::set_shelves_userenv('pub',$pubshelves->[0]); + C4::Context::set_shelves_userenv('bar',$barshelves); + C4::Context::set_shelves_userenv('pub',$pubshelves); C4::Context::set_shelves_userenv('tot',$total); } else { @@ -877,9 +877,9 @@ sub checkauth { my ($total, $totshelves, $pubshelves); ($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef); $total->{'pubtotal'} = $totshelves; - $session->param('pubshelves', $pubshelves->[0]); + $session->param('pubshelves', $pubshelves); $session->param('totshelves', $total); - C4::Context::set_shelves_userenv('pub',$pubshelves->[0]); + C4::Context::set_shelves_userenv('pub',$pubshelves); C4::Context::set_shelves_userenv('tot',$total); # setting a couple of other session vars... diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 72571490ec..5bddadbbdd 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -186,9 +186,9 @@ sub GetShelvesSummary ($$$$) { =head2 GetRecentShelves - ($shelflist) = GetRecentShelves(1, $limit, $owner) + ($shelflist, $total) = GetRecentShelves(1, $limit, $owner) -This function returns a references to an array of hashrefs containing specified shelves sorted +This function returns a reference to an array of hashrefs containing specified shelves sorted by the date the shelf was last modified in descending order limited to the number of records specified by C<$row_count>. If calling with C<$mincategory> other than 1, use undef as C<$owner>. @@ -197,19 +197,25 @@ the submitted parameters. =cut -sub GetRecentShelves ($$$) { - my ($mincategory, $row_count, $owner) = @_; - my (@shelflist); - my $total = _shelf_count($owner, $mincategory); - my @params = ($owner, $mincategory, 0, $row_count); #FIXME: offset is hardcoded here, but could be passed in for enhancements - shift @params if (not defined $owner); - my $query = "SELECT * FROM virtualshelves"; - $query .= ((defined $owner) ? " WHERE owner = ? AND category = ?" : " WHERE category >= ? "); - $query .= " ORDER BY lastmodified DESC LIMIT ?, ?"; - my $sth = $dbh->prepare($query); - $sth->execute(@params); - @shelflist = $sth->fetchall_arrayref({}); - return ( \@shelflist, $total ); +sub GetRecentShelves { + my ($mincategory, $row_count, $owner) = @_; + my $total = _shelf_count($owner, $mincategory); + my @params; + my $selection; + if (defined $owner) { + @params = ($owner, $mincategory, $row_count); + $selection = ' WHERE owner = ? AND category = ?'; + } else { + @params = ( $mincategory, $row_count); + $selection = ' WHERE category >= ? '; + } + my $query = 'SELECT * FROM virtualshelves'; + $query .= $selection; + $query .= ' ORDER BY lastmodified DESC LIMIT ?'; + my $sth = $dbh->prepare($query); + $sth->execute(@params); + my $shelflist = $sth->fetchall_arrayref({}); + return ( $shelflist, $total ); } =head2 GetAllShelves @@ -563,13 +569,13 @@ sub RefreshShelvesSummary ($$$) { $total->{'pubtotal'} = $totshelves; # Update the current session with the latest shelves... - $session->param('barshelves', $barshelves->[0]); - $session->param('pubshelves', $pubshelves->[0]); + $session->param('barshelves', $barshelves); + $session->param('pubshelves', $pubshelves); $session->param('totshelves', $total); # likewise the userenv... - C4::Context->set_shelves_userenv('bar',$barshelves->[0]); - C4::Context->set_shelves_userenv('pub',$pubshelves->[0]); + C4::Context->set_shelves_userenv('bar',$barshelves); + C4::Context->set_shelves_userenv('pub',$pubshelves); C4::Context::set_shelves_userenv('tot',$total); return ($total, $pubshelves, $barshelves); diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index bbe89e83b1..df7054e57d 100644 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -393,18 +393,18 @@ sub shelfpage ($$$$$) { if ( defined $barshelves ) { $template->param( - barshelves => scalar( @{ $barshelves->[0] } ), - barshelvesloop => $barshelves->[0], + barshelves => scalar( @{ $barshelves } ), + barshelvesloop => $barshelves, ); - $template->param( bartotal => $total->{'bartotal'}, ) if ( $total->{'bartotal'} > scalar( @{ $barshelves->[0] } ) ); + $template->param( bartotal => $total->{'bartotal'}, ) if ( $total->{'bartotal'} > scalar( @{ $barshelves } ) ); } if ( defined $pubshelves ) { $template->param( - pubshelves => scalar( @{ $pubshelves->[0] } ), - pubshelvesloop => $pubshelves->[0], + pubshelves => scalar( @{ $pubshelves } ), + pubshelvesloop => $pubshelves, ); - $template->param( pubtotal => $total->{'pubtotal'}, ) if ( $total->{'pubtotal'} > scalar( @{ $pubshelves->[0] } ) ); + $template->param( pubtotal => $total->{'pubtotal'}, ) if ( $total->{'pubtotal'} > scalar( @{ $pubshelves } ) ); } output_html_with_http_headers $query, $cookie, $template->output; diff --git a/catalogue/search.pl b/catalogue/search.pl index 85bccdf4e8..acd9f4cc3e 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -673,17 +673,14 @@ my $row_count = 10; # FIXME:This probably should be a syspref my ($pubshelves, $total) = GetRecentShelves(2, $row_count, undef); my ($barshelves, $total) = GetRecentShelves(1, $row_count, $borrowernumber); -my @pubshelves = @{$pubshelves}; -my @barshelves = @{$barshelves}; - -if (@pubshelves) { - $template->param( addpubshelves => scalar (@pubshelves)); - $template->param( addpubshelvesloop => @pubshelves); +if (@{$pubshelves}) { + $template->param( addpubshelves => scalar @{$pubshelves}); + $template->param( addpubshelvesloop => $pubshelves); } -if (@barshelves) { - $template->param( addbarshelves => scalar (@barshelves)); - $template->param( addbarshelvesloop => @barshelves); +if (@{$barshelves}) { + $template->param( addbarshelves => scalar @{$barshelves}); + $template->param( addbarshelvesloop => $barshelves); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl index 8f3cc19013..e3fa191c6c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl @@ -65,8 +65,8 @@ $(".addtocart").show(); param1 += ""+"