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

(-)a/circ/reserveratios.pl (-6 / +3 lines)
Lines 148-159 $template->param(sql => $strsth); Link Here
148
my $sth = $dbh->prepare($strsth);
148
my $sth = $dbh->prepare($strsth);
149
$sth->execute(@query_params);
149
$sth->execute(@query_params);
150
150
151
my $ratio_atleast1 = ($ratio >= 1) ? 1 : 0;
152
my @reservedata;
151
my @reservedata;
153
while ( my $data = $sth->fetchrow_hashref ) {
152
while ( my $data = $sth->fetchrow_hashref ) {
154
    my $thisratio = $data->{reservecount} / $data->{itemcount};
153
    my $thisratio = $data->{reservecount} / $data->{itemcount};
155
    my $ratiocalc = ($thisratio / $ratio);
154
    my $ratiocalc = $data->{reservecount}/$ratio - $data->{itemcount};
156
    ($thisratio / $ratio) >= 1 or next;  # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
155
    $ratiocalc >= 1 or next;  # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
157
    my $record = GetMarcBiblio({ biblionumber => $data->{biblionumber} });
156
    my $record = GetMarcBiblio({ biblionumber => $data->{biblionumber} });
158
    $data->{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($data->{biblionumber}));
157
    $data->{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($data->{biblionumber}));
159
    push(
158
    push(
Lines 176-182 while ( my $data = $sth->fetchrow_hashref ) { Link Here
176
            itype              => [split('\|', $data->{l_itype})],
175
            itype              => [split('\|', $data->{l_itype})],
177
            reservecount       => $data->{reservecount},
176
            reservecount       => $data->{reservecount},
178
            itemcount          => $data->{itemcount},
177
            itemcount          => $data->{itemcount},
179
            ratiocalc          => sprintf( "%.0d", $ratio_atleast1 ? ( $thisratio / $ratio ) : $thisratio ),
178
            ratiocalc          => sprintf( "%.0d", $ratiocalc ),
180
            thisratio => sprintf( "%.2f", $thisratio ),
179
            thisratio => sprintf( "%.2f", $thisratio ),
181
            thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0,
180
            thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0,
182
            listcall           => [split('\|', $data->{listcall})]
181
            listcall           => [split('\|', $data->{listcall})]
Lines 190-196 for my $rd ( @reservedata ) { Link Here
190
}
189
}
191
190
192
$template->param(
191
$template->param(
193
    ratio_atleast1  => $ratio_atleast1,
194
    todaysdate      => $todaysdate,
192
    todaysdate      => $todaysdate,
195
    from            => $startdate,
193
    from            => $startdate,
196
    to              => $enddate,
194
    to              => $enddate,
197
- 

Return to bug 15422