@@ -, +, @@ -OPACShowPlaceItemLevelHold or -ShowPlaceItemLevelHold --- C4/Items.pm | 44 ++++++++++++---------- catalogue/detail.pl | 6 +++ installer/data/mysql/sysprefs.sql | 2 + .../en/modules/admin/preferences/cataloguing.pref | 7 ++++ .../prog/en/modules/admin/preferences/opac.pref | 7 ++++ .../prog/en/modules/catalogue/detail.tt | 8 ++++ .../prog/en/modules/reserve/request.tt | 17 +++++++-- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 27 ++++++++----- .../opac-tmpl/prog/en/modules/opac-reserve.tt | 16 +++++--- opac/opac-detail.pl | 39 ++++++++----------- opac/opac-reserve.pl | 14 +++++-- reserve/request.pl | 22 ++++++++++- t/db_dependent/Items.t | 21 +++++++---- 13 files changed, 158 insertions(+), 72 deletions(-) --- a/C4/Items.pm +++ a/C4/Items.pm @@ -1219,7 +1219,8 @@ $filter->{fromDate} = '01/01/2013'; #Filters only serial issues by the serialite $filter->{toDate} = '31/12/2014'; #Filters only serial issues by the serialitems.publisheddate #The ending date in C4::Context->preference('dateformat') format $filter->{limit} = 15; #Limits the returning set to this many items - +$filter->{itemnumber} = 165; #Returns the item with this itemnumber + Filters are expected to be validated! If a filter is not defined, that filter is not present in the $filter-HASH =cut @@ -1227,20 +1228,20 @@ Filters are expected to be validated! If a filter is not defined, that filter is sub GetItemsInfo { my ( $biblionumber, $filter ) = @_; my $dbh = C4::Context->dbh; - + #Prepare the filter my $filterEnumchron = 0; my $enumchronSQLRegexp; if (defined $filter && ref $filter eq 'HASH') { - + #Items enumchron can be filtered by volume or number or both. - #Because the format of enumchron + #Because the format of enumchron #For performance reasons regexp's need to be as simple as possible. ## It is entirely possible to search with just volume or just number or just issue. ## We don't know which filters are used so it is safer and more efficient to just ## prepare the enumeration parsing SQL every time. $enumchronSQLRegexp = C4::Context->preference('NumberingFormulaParsingRegexp'); - + if (exists $filter->{volume}) { $filterEnumchron = 1; $enumchronSQLRegexp =~ s/volume/$filter->{volume}/; @@ -1261,14 +1262,14 @@ sub GetItemsInfo { } else { $enumchronSQLRegexp =~ s/issue/[0-9]*/; - } + } } #If we know that this item is a serial, we can better optimize our big SQL. # This is especially useful when we want to filter based on the publication date. # SELECTing a huge blob of serials just to remove unnecessary ones will be really sloooow. my $search = C4::SQLHelper::SearchInTable("biblio",{biblionumber => $biblionumber}, undef, undef, ['serial'], undef, "exact"); my $serial = $search->[0]->{serial}; - + # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance. #Because it is uncertain how many parameters the SQL query needs, we need to build the parameters dynamically # This is because we cannot predict what filters our users use. @@ -1294,8 +1295,8 @@ sub GetItemsInfo { holding.branchname, holding.opac_info as branch_opac_info "; if ($serial) { - $query .= ", - serial.serialseq, + $query .= ", + serial.serialseq, serial.publisheddate "; } $query .= " @@ -1306,15 +1307,15 @@ sub GetItemsInfo { LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber LEFT JOIN itemtypes ON itemtypes.itemtype = " . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); - + if ($serial) { - $query .= " - LEFT JOIN serialitems ON serialitems.itemnumber = items.itemnumber - LEFT JOIN serial ON serialitems.serialid = serial.serialid "; + $query .= " + LEFT JOIN serialitems ON serialitems.itemnumber = items.itemnumber + LEFT JOIN serial ON serialitems.serialid = serial.serialid "; } - + $query .= " WHERE items.biblionumber = ? "; - + if (exists $filter->{branch}) { $query .= " AND items.holdingbranch = ?"; push @$queryParams, $filter->{branch}; @@ -1341,13 +1342,18 @@ sub GetItemsInfo { } push @$queryParams, $filter->{toDate}; } - + if (exists $filter->{itemnumber}) { + push @$queryParams, $filter->{itemnumber}; + $query .= " AND items.itemnumber = ?"; + } + + $query .= "ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; if (exists $filter->{limit}) { push @$queryParams, $filter->{limit}; $query .= " LIMIT ?"; } - + my $sth = $dbh->prepare($query); $sth->execute(@$queryParams); my $i = 0; @@ -1359,7 +1365,7 @@ sub GetItemsInfo { WHERE itemnumber = ?" ); - + while ( my $data = $sth->fetchrow_hashref ) { my $datedue = ''; $isth->execute( $data->{'itemnumber'} ); @@ -1372,7 +1378,7 @@ sub GetItemsInfo { $datedue = $idata->{'date_due'}; if (C4::Context->preference("IndependentBranches")){ my $userenv = C4::Context->userenv; - if ( ($userenv) && ( $userenv->{flags} % 2 != 1 ) ) { + if ( ($userenv) && ( $userenv->{flags} % 2 != 1 ) ) { $data->{'NOTSAMEBRANCH'} = 1 if ($idata->{'bcode'} ne $userenv->{branch}); } } --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -143,6 +143,10 @@ my $dat = &GetBiblioData($biblionumber); my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber); my @subscriptions = GetSubscriptions( $dat->{title}, $dat->{issn}, undef, $biblionumber ); my @subs; +if (scalar(@subscriptions)) { + $template->param('isSerial',1); +} + foreach my $subscription (@subscriptions) { my %cell; @@ -412,4 +416,6 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref my ( $holdcount, $holds ) = C4::Reserves::GetReservesFromBiblionumber($biblionumber,1); $template->param( holdcount => $holdcount, holds => $holds ); +$template->param('ShowPlaceItemLevelHold', C4::Context->preference('ShowPlaceItemLevelHold')); + output_html_with_http_headers $query, $cookie, $template->output; --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -270,6 +270,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacShowLibrariesPulldownMobile','1',NULL,'Show the libraries pulldown on the mobile version of the OPAC.','YesNo'), ('OpacShowRecentComments','0',NULL,'If ON a link to recent comments will appear in the OPAC masthead','YesNo'), ('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo'), +('OPACShowPlaceItemLevelHold','0',NULL,'Allow placing a item-level hold from the detailed biblio view.','YesNo'), ('opacsmallimage','','','Enter a complete URL to an image to replace the default Koha logo','free'), ('OpacStarRatings','all','disable|all|details',NULL,'Choice'), ('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'), @@ -341,6 +342,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ShowPatronImageInWebBasedSelfCheck','0','','If ON, displays patron image when a patron uses web-based self-checkout','YesNo'), ('ShowReviewer','full','none|full|first|surname|firstandinitial|username','Choose how a commenter\'s identity is presented alongside comments in the OPAC','Choice'), ('ShowReviewerPhoto','1','','If ON, photo of reviewer will be shown beside comments in OPAC','YesNo'), +('ShowPlaceItemLevelHold','0',NULL,'Allow placing a item-level hold from the detailed biblio view.','YesNo'), ('singleBranchMode','0',NULL,'Operate in Single-branch mode, hide branch selection in the OPAC','YesNo'), ('SlipCSS','',NULL,'Slips CSS url.','free'), ('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -18,6 +18,13 @@ Cataloging: yes: Display no: "Don't Display" - easy ways to create analytical record relationships + - + - pref: ShowPlaceItemLevelHold + default: 0 + choices: + yes: "Allow" + no : "Don't allow" + - placing a item-level hold from the detailed biblio view. This is always enabled for serials because serials need only item-level holds. Spine Labels: - - When using the quick spine label printer, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -131,6 +131,13 @@ OPAC: no: "Don't show" - the item's barcode on the holdings tab. - + - pref: OPACShowPlaceItemLevelHold + default: 0 + choices: + yes: "Allow" + no : "Don't allow" + - placing a item-level hold from the detailed biblio view. This is always enabled for serials because serials need only item-level holds. + - - pref: OpacHighlightedWords choices: yes: Highlight --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -422,6 +422,7 @@ function verify_images() { [% IF ( hostrecords ) %]
- [% IF noBranchItems %] + [% IF userBranchNotDefined %] Limiting items to the most recent received last year. [% ELSE %] Showing only the most recent items from your branch. @@ -1550,6 +1551,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {