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 112-121 Link Here
112
            <td class="actions">
112
            <td class="actions">
113
                <p>
113
                <p>
114
                    [% IF ( reserveloo.thisratio_atleast1 ) %]
114
                    [% IF ( reserveloo.thisratio_atleast1 ) %]
115
                        [% IF ( CAN_user_acquisition && basketno && booksellerid ) %]<!-- [% reserveloo.ratiocalc | html %] -->
115
                        [% IF ( CAN_user_acquisition && basketno && booksellerid ) %]<!-- [% reserveloo.copies_to_buy | html %] -->
116
                            <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>
116
                            <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>
117
                        [% ELSE %]
117
                        [% ELSE %]
118
                            <strong>[% reserveloo.ratiocalc | html %] to order</strong>
118
                            <strong>[% reserveloo.copies_to_buy | html %] to order</strong>
119
                        [% END %]
119
                        [% END %]
120
                        [% IF ( reserveloo.pendingorders ) %]<br><strong>[% reserveloo.pendingorders | html %] pending</strong>[% END %]
120
                        [% IF ( reserveloo.pendingorders ) %]<br><strong>[% reserveloo.pendingorders | html %] pending</strong>[% END %]
121
                    [% ELSE %]
121
                    [% ELSE %]
Lines 142-148 Link Here
142
<h4>Refine results:</h4>
142
<h4>Refine results:</h4>
143
<ol>
143
<ol>
144
    <li>
144
    <li>
145
        <label for="ratio">Hold ratio:</label>
145
        <label for="ratio">Hold ratio (greater than or equal to):</label>
146
        <input type="text" size="5" id="ratio" name="ratio" value="[% ratio | html %]" />
146
        <input type="text" size="5" id="ratio" name="ratio" value="[% ratio | html %]" />
147
    </li>
147
    </li>
148
148
149
- 

Return to bug 25760