[Koha-cvs] koha C4SearchMarc.pm koha-tmpl/intranet-tmpl/de... [rel_2_2]
Henri-Damien LAURENT
laurenthdl at alinto.com
Tue Jun 13 11:36:52 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Henri-Damien LAURENT <hdl> 06/06/13 09:36:52
Modified files:
C4 : SearchMarc.pm
koha-tmpl/intranet-tmpl/default/en/search.marc: result.tmpl
koha-tmpl/opac-tmpl/css/en: opac-searchresults.tmpl
Log message:
simplifying search results so that when multiple items depends on one location and holdingbranch, it is displayed on one line with item counts.
If item count is one AND item is on loan or notforloan, information is displayed.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/SearchMarc.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.36.2.28&r2=1.36.2.29
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/default/en/search.marc/result.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.21.2.6&r2=1.21.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/css/en/opac-searchresults.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.20.2.12&r2=1.20.2.13
Patches:
Index: C4/SearchMarc.pm
===================================================================
RCS file: /sources/koha/koha/C4/SearchMarc.pm,v
retrieving revision 1.36.2.28
retrieving revision 1.36.2.29
diff -u -b -r1.36.2.28 -r1.36.2.29
--- C4/SearchMarc.pm 22 Apr 2006 14:57:46 -0000 1.36.2.28
+++ C4/SearchMarc.pm 13 Jun 2006 09:36:51 -0000 1.36.2.29
@@ -407,12 +407,24 @@
my $oldline;
my ($oldbibid, $oldauthor, $oldtitle);
my $sth_itemCN;
- if (C4::Context->preference('hidelostitems')) {
- $sth_itemCN = $dbh->prepare("select items.* from items where biblionumber=? and (itemlost = 0 or itemlost is NULL) order by homebranch");
+ if (C4::Context->preference('hidelostitem')) {
+ $sth_itemCN = $dbh->prepare("
+ SELECT items.holdingbranch, items.location, items.itemcallnumber, count(*) AS cnt
+ FROM items
+ WHERE biblionumber=? AND (itemlost = 0 OR itemlost IS NULL)
+ ORDER BY homebranch");
} else {
- $sth_itemCN = $dbh->prepare("select items.* from items where biblionumber=? order by homebranch");
- }
- my $sth_issue = $dbh->prepare("select date_due,returndate from issues where itemnumber=?");
+ $sth_itemCN = $dbh->prepare("
+ SELECT items.holdingbranch, items.location, items.itemcallnumber, count(*) AS cnt, items.itemnumber, items.notforloan
+ FROM items
+ WHERE biblionumber=?
+ GROUP BY items.holdingbranch, items.location, items.itemcallnumber
+ ORDER BY homebranch");
+ }
+ my $sth_issue = $dbh->prepare("
+ SELECT date_due,returndate
+ FROM issues
+ WHERE itemnumber=?");
# parse all biblios between start & end.
while (($counter <= $#result) && ($counter <= ($offset + $length))) {
# search & parse all items & note itemcallnumber
@@ -440,6 +452,13 @@
# then all other fields in the main array
# search if item is on loan
+ # store this item
+ my %lineCN;
+ $lineCN{holdingbranch} = $item->{holdingbranch};
+ $lineCN{itemcallnumber} = $item->{itemcallnumber};
+ $lineCN{location} = $item->{location};
+ $lineCN{cnt} = $item->{cnt} unless ($item->{cnt}==1);
+ if ($item->{cnt}==1){
my $date_due;
$sth_issue->execute($item->{itemnumber});
while (my $loan = $sth_issue->fetchrow_hashref) {
@@ -447,17 +466,13 @@
$date_due = $loan->{date_due};
}
}
- # store this item
- my %lineCN;
- $lineCN{holdingbranch} = $item->{holdingbranch};
- $lineCN{itemcallnumber} = $item->{itemcallnumber};
- $lineCN{location} = $item->{location};
- $lineCN{date_due} = format_date($date_due);
- $lineCN{notforloan} = $notforloanstatus{$line->{notforloan}} if ($line->{notforloan}); # setting not forloan if itemtype is not for loan
+ $lineCN{date_due} = format_date($date_due) ;
$lineCN{notforloan} = $notforloanstatus{$item->{notforloan}} if ($item->{notforloan}); # setting not forloan it this item is not for loan
$notforloan=0 unless ($item->{notforloan} or $item->{wthdrawn} or $item->{itemlost});
+ }
+ $lineCN{notforloan} = $notforloanstatus{$line->{notforloan}} if ($line->{notforloan} and not $lineCN{notforloan}); # setting not forloan if itemtype is not for loan
push @CNresults,\%lineCN;
- $totalitems++;
+ $totalitems+=$item->{cnt};
}
# save the biblio in the final array, with item and item issue status
my %newline;
@@ -490,6 +505,7 @@
return (\@finalresult, $nbresults);
}
+
# Creates the SQL Request
sub create_request {
Index: koha-tmpl/intranet-tmpl/default/en/search.marc/result.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/default/en/search.marc/result.tmpl,v
retrieving revision 1.21.2.6
retrieving revision 1.21.2.7
diff -u -b -r1.21.2.6 -r1.21.2.7
--- koha-tmpl/intranet-tmpl/default/en/search.marc/result.tmpl 7 Mar 2006 12:14:26 -0000 1.21.2.6
+++ koha-tmpl/intranet-tmpl/default/en/search.marc/result.tmpl 13 Jun 2006 09:36:52 -0000 1.21.2.7
@@ -56,6 +56,9 @@
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="itemcallnumber" -->
(<!-- TMPL_VAR NAME="itemcallnumber" -->)
+ <!-- TMPL_IF name="cnt" -->
+ x <!-- TMPL_VAR name="cnt" -->
+ <!--/TMPL_IF-->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- TMPL_IF name="notforloan" -->
Index: koha-tmpl/opac-tmpl/css/en/opac-searchresults.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/opac-tmpl/css/en/opac-searchresults.tmpl,v
retrieving revision 1.20.2.12
retrieving revision 1.20.2.13
diff -u -b -r1.20.2.12 -r1.20.2.13
--- koha-tmpl/opac-tmpl/css/en/opac-searchresults.tmpl 27 Feb 2006 13:54:50 -0000 1.20.2.12
+++ koha-tmpl/opac-tmpl/css/en/opac-searchresults.tmpl 13 Jun 2006 09:36:52 -0000 1.20.2.13
@@ -93,6 +93,7 @@
<!-- TMPL_LOOP name="CN" -->
<p>
<!-- TMPL_VAR name="holdingbranch" --> <!-- TMPL_VAR name="location" -->
+ <!-- TMPL_IF name="cnt" -->(<!-- TMPL_VAR name="cnt" -->)<!--/TMPL_IF-->
<!-- TMPL_IF name="date_due" -->
<i>(On Loan until <!-- TMPL_VAR name="date_due" -->)</i>
<!-- TMPL_ELSE -->
More information about the Koha-cvs
mailing list