View | Details | Raw Unified | Return to bug 9984
Collapse All | Expand All

(-)a/circ/reserveratios.pl (-23 / +5 lines)
Lines 32-38 use C4::Debug; Link Here
32
use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/;
32
use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/;
33
33
34
my $input = new CGI;
34
my $input = new CGI;
35
my $order     = $input->param('order') || '';
36
my $startdate = $input->param('from');
35
my $startdate = $input->param('from');
37
my $enddate   = $input->param('to');
36
my $enddate   = $input->param('to');
38
my $ratio     = $input->param('ratio');
37
my $ratio     = $input->param('ratio');
Lines 72-78 if ($ratio <= 0) { Link Here
72
}
71
}
73
72
74
my $dbh    = C4::Context->dbh;
73
my $dbh    = C4::Context->dbh;
75
my ($sqlorderby, $sqldatewhere) = ("","");
74
my $sqldatewhere = "";
76
$debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate);
75
$debug and warn format_date_in_iso($startdate) . "\n" . format_date_in_iso($enddate);
77
my @query_params = ();
76
my @query_params = ();
78
if ($startdate) {
77
if ($startdate) {
Lines 84-106 if ($enddate) { Link Here
84
    push @query_params, format_date_in_iso($enddate);
83
    push @query_params, format_date_in_iso($enddate);
85
}
84
}
86
85
87
if ($order eq "biblio") {
88
	$sqlorderby = " ORDER BY biblio.title, holdingbranch, listcall, l_location ";
89
} elsif ($order eq "callnumber") {
90
    $sqlorderby = " ORDER BY listcall, holdingbranch, l_location ";
91
} elsif ($order eq "itemcount") {
92
    $sqlorderby = " ORDER BY itemcount, reservecount ";
93
} elsif ($order eq "itype") {
94
    $sqlorderby = " ORDER BY l_itype, holdingbranch, listcall ";
95
} elsif ($order eq "location") {
96
    $sqlorderby = " ORDER BY l_location, holdingbranch, listcall ";
97
} elsif ($order eq "reservecount") {
98
    $sqlorderby = " ORDER BY reservecount DESC ";
99
} elsif ($order eq "branch") {
100
    $sqlorderby = " ORDER BY holdingbranch, l_location, listcall ";
101
} else {
102
	$sqlorderby = " ORDER BY reservecount DESC ";
103
}
104
my $strsth =
86
my $strsth =
105
"SELECT reservedate,
87
"SELECT reservedate,
106
        reserves.borrowernumber as borrowernumber,
88
        reserves.borrowernumber as borrowernumber,
Lines 126-142 my $strsth = Link Here
126
 FROM  reserves
108
 FROM  reserves
127
 LEFT JOIN items ON items.biblionumber=reserves.biblionumber 
109
 LEFT JOIN items ON items.biblionumber=reserves.biblionumber 
128
 LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber
110
 LEFT JOIN biblio ON reserves.biblionumber=biblio.biblionumber
129
 WHERE 
111
 WHERE
130
notforloan = 0 AND damaged = 0 AND itemlost = 0 AND wthdrawn = 0
112
 notforloan = 0 AND damaged = 0 AND itemlost = 0 AND wthdrawn = 0
131
 $sqldatewhere
113
 $sqldatewhere
132
";
114
";
133
115
134
if (C4::Context->preference('IndependantBranches')){
116
if (C4::Context->preference('IndependantBranches')){
135
	$strsth .= " AND items.holdingbranch=? ";
117
    $strsth .= " AND items.holdingbranch=? ";
136
    push @query_params, C4::Context->userenv->{'branch'};
118
    push @query_params, C4::Context->userenv->{'branch'};
137
}
119
}
138
120
139
$strsth .= " GROUP BY reserves.biblionumber " . $sqlorderby;
121
$strsth .= " GROUP BY reserves.biblionumber ORDER BY reservecount DESC";
140
122
141
$template->param(sql => $strsth);
123
$template->param(sql => $strsth);
142
my $sth = $dbh->prepare($strsth);
124
my $sth = $dbh->prepare($strsth);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt (-42 / +27 lines)
Lines 8-19 Link Here
8
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
8
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
9
<script type="text/javascript">
9
<script type="text/javascript">
10
//<![CDATA[
10
//<![CDATA[
11
	 $(document).ready(function() {
11
     $(document).ready(function() {
12
	 	$("th a").hide();
12
        $(".ratiolimit").click(function () {
13
	 	$(".ratiolimit").click(function () {
14
            $("#ratio").val($(this).html());
13
            $("#ratio").val($(this).html());
15
        });
14
        });
16
	 	$(".ratiolimit").hover(
15
        $(".ratiolimit").hover(
17
            function () { $(this).toggleClass("ulined") },
16
            function () { $(this).toggleClass("ulined") },
18
            function () { $(this).toggleClass("ulined") }
17
            function () { $(this).toggleClass("ulined") }
19
        );
18
        );
Lines 25-31 Link Here
25
            "iDisplayLength": 20,
24
            "iDisplayLength": 20,
26
            "sPaginationType": "four_button"
25
            "sPaginationType": "four_button"
27
        }));
26
        }));
28
	 });
27
     });
29
//]]>
28
//]]>
30
</script>
29
</script>
31
<style type="text/css">
30
<style type="text/css">
Lines 41-90 Link Here
41
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Hold ratios</div>
40
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Hold ratios</div>
42
41
43
<div id="doc3" class="yui-t2">
42
<div id="doc3" class="yui-t2">
44
   
45
   <div id="bd">
43
   <div id="bd">
46
	<div id="yui-main">
44
    <div id="yui-main">
47
	<div class="yui-b">
45
    <div class="yui-b">
48
<h1>Hold ratios to calculate items needed</h1>
46
<h1>Hold ratios to calculate items needed</h1>
49
   <h3>Calculated on [% todaysdate %]. From [% from %]
47
   <h3>Calculated on [% todaysdate %]. From [% from %]
50
	to [% to %]</h3>
48
    to [% to %]</h3>
51
<p>These items have a hold ratio &ge; [% ratio %].</p>
49
<p>These items have a hold ratio &ge; [% ratio %].</p>
52
<div class="sql">[% sql %]</div>
50
<div class="sql">[% sql %]</div>
53
51
54
[% IF ( reserveloop ) %]
52
[% IF ( reserveloop ) %]
55
    <table id="holdst">
53
    <table id="holdst">
56
<thead>    <tr>
54
      <thead>
57
        <th>Holds
58
        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=reservecount&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
59
        </th>
60
        <th>Items
61
        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=itemcount&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
62
        </th>
63
        <th>Hold ratio</th>
64
        <th>Title
65
        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=biblio&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
66
        </th>
67
        <th>Holding libraries
68
        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=branch&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
69
        </th>
70
        <th>Location
71
        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=location&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
72
        </th>
73
        <th>Itype
74
        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=itype&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
75
        </th>
76
        <th>Call numbers
77
        <a href="/cgi-bin/koha/circ/reserveratios.pl?ratio=[% ratio %]&amp;order=callnumber&amp;from=[% from %]&amp;to=[% to %]">Sort</a>
78
        </th>
79
        <th>Items needed
80
        </th>
81
    </tr></thead>
82
    
83
    <tbody>[% FOREACH reserveloo IN reserveloop %]
84
        <tr>
55
        <tr>
85
           	<td><p>[% reserveloo.reservecount %]</p></td>
56
          <th>Holds</th>
86
           	<td><p>[% reserveloo.itemcount %]</p></td>
57
          <th>Items</th>
87
           	<td><p class="ratiolimit">[% reserveloo.thisratio %]</p></td>
58
          <th>Hold ratio</th>
59
          <th>Title</th>
60
          <th>Holding libraries</th>
61
          <th>Location</th>
62
          <th>Itype</th>
63
          <th>Call numbers</th>
64
          <th>Items needed</th>
65
        </tr>
66
      </thead>
67
      <tbody>
68
      [% FOREACH reserveloo IN reserveloop %]
69
        <tr>
70
            <td><p>[% reserveloo.reservecount %]</p></td>
71
            <td><p>[% reserveloo.itemcount %]</p></td>
72
            <td><p class="ratiolimit">[% reserveloo.thisratio %]</p></td>
88
            <td> [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %][% reserveloo.title |html %] [% IF ( reserveloo.subtitle ) %][% FOREACH subtitl IN reserveloo.subtitle %][% subtitl.subfield %][% END %][% END %]</a>[% IF ( reserveloo.author ) %] by [% reserveloo.author %][% END %]
73
            <td> [% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %][% reserveloo.title |html %] [% IF ( reserveloo.subtitle ) %][% FOREACH subtitl IN reserveloo.subtitle %][% subtitl.subfield %][% END %][% END %]</a>[% IF ( reserveloo.author ) %] by [% reserveloo.author %][% END %]
89
            </td>
74
            </td>
90
            <td><p>[% reserveloo.listbranch %]</p></td>
75
            <td><p>[% reserveloo.listbranch %]</p></td>
Lines 93-99 Link Here
93
            <td><p>[% reserveloo.listcall %]</p></td>
78
            <td><p>[% reserveloo.listcall %]</p></td>
94
            <td>[% IF ( reserveloo.thisratio_atleast1 ) %]<p><b>[% reserveloo.ratiocalc %] to order</b></p>[% END %]</td>
79
            <td>[% IF ( reserveloo.thisratio_atleast1 ) %]<p><b>[% reserveloo.ratiocalc %] to order</b></p>[% END %]</td>
95
        </tr>
80
        </tr>
96
    [% END %]</tbody>
81
      [% END %]
82
      </tbody>
97
    </table>
83
    </table>
98
    [% ELSE %]
84
    [% ELSE %]
99
        <b>No items found.</b>
85
        <b>No items found.</b>
100
- 

Return to bug 9984