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

(-)a/circ/reserveratios.pl (-3 / +3 lines)
Lines 157-164 $sth->execute(@query_params); Link Here
157
my @reservedata;
157
my @reservedata;
158
while ( my $data = $sth->fetchrow_hashref ) {
158
while ( my $data = $sth->fetchrow_hashref ) {
159
    my $thisratio = $data->{reservecount} / $data->{itemcount};
159
    my $thisratio = $data->{reservecount} / $data->{itemcount};
160
    my $ratiocalc = ceil($data->{reservecount}/$ratio - $data->{itemcount});
160
    my $copies_to_buy = ceil($data->{reservecount}/$ratio - $data->{itemcount});
161
    $ratiocalc >= 1 or next;  # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
161
    $thisratio >= $ratio or next;  # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
162
    push(
162
    push(
163
        @reservedata,
163
        @reservedata,
164
        {
164
        {
Lines 182-188 while ( my $data = $sth->fetchrow_hashref ) { Link Here
182
            itype              => [split('\|', $data->{l_itype})],
182
            itype              => [split('\|', $data->{l_itype})],
183
            reservecount       => $data->{reservecount},
183
            reservecount       => $data->{reservecount},
184
            itemcount          => $data->{itemcount},
184
            itemcount          => $data->{itemcount},
185
            ratiocalc          => sprintf( "%.0d", $ratiocalc ),
185
            copies_to_buy      => sprintf( "%d", $copies_to_buy ),
186
            thisratio => sprintf( "%.2f", $thisratio ),
186
            thisratio => sprintf( "%.2f", $thisratio ),
187
            thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0,
187
            thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0,
188
            listcall           => [split('\|', $data->{listcall})]
188
            listcall           => [split('\|', $data->{listcall})]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt (-5 / +4 lines)
Lines 98-107 Link Here
98
            <td class="actions">
98
            <td class="actions">
99
                <p>
99
                <p>
100
                    [% IF ( reserveloo.thisratio_atleast1 ) %]
100
                    [% IF ( reserveloo.thisratio_atleast1 ) %]
101
                        [% IF ( CAN_user_acquisition && basketno && booksellerid ) %]<!-- [% reserveloo.ratiocalc | html %] -->
101
                        [% IF ( CAN_user_acquisition && basketno && booksellerid ) %]<!-- [% reserveloo.copies_to_buy | html %] -->
102
                            <a href="/cgi-bin/koha/acqui/neworderempty.pl?biblionumber=[% reserveloo.biblionumber | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;basketno=[% basketno | uri %]&amp;rr_quantity_to_order=[% reserveloo.ratiocalc | uri %]" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> [% reserveloo.ratiocalc | html %] to order</a>
102
                            <a href="/cgi-bin/koha/acqui/neworderempty.pl?biblionumber=[% reserveloo.biblionumber | uri %]&amp;booksellerid=[% booksellerid | uri %]&amp;basketno=[% basketno | uri %]&amp;rr_quantity_to_order=[% reserveloo.copies_to_buy | uri %]" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> [% reserveloo.copies_to_buy | html %] to order</a>
103
                        [% ELSE %]
103
                        [% ELSE %]
104
                            <strong>[% reserveloo.ratiocalc | html %] to order</strong>
104
                            <strong>[% reserveloo.copies_to_buy | html %] to order</strong>
105
                        [% END %]
105
                        [% END %]
106
                        [% IF ( reserveloo.pendingorders ) %]<br><strong>[% reserveloo.pendingorders | html %] pending</strong>[% END %]
106
                        [% IF ( reserveloo.pendingorders ) %]<br><strong>[% reserveloo.pendingorders | html %] pending</strong>[% END %]
107
                    [% ELSE %]
107
                    [% ELSE %]
Lines 128-134 Link Here
128
<h4>Refine results:</h4>
128
<h4>Refine results:</h4>
129
<ol>
129
<ol>
130
    <li>
130
    <li>
131
        <label for="ratio">Hold ratio:</label>
131
        <label for="ratio">Hold ratio (greater than or equal to):</label>
132
        <input type="text" size="5" id="ratio" name="ratio" value="[% ratio | html %]" />
132
        <input type="text" size="5" id="ratio" name="ratio" value="[% ratio | html %]" />
133
    </li>
133
    </li>
134
134
135
- 

Return to bug 25760