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

(-)a/circ/reserveratios.pl (-11 / +10 lines)
Lines 151-159 $sth->execute(@query_params); Link Here
151
151
152
my @reservedata;
152
my @reservedata;
153
while ( my $data = $sth->fetchrow_hashref ) {
153
while ( my $data = $sth->fetchrow_hashref ) {
154
    my $thisratio = $data->{reservecount} / $data->{itemcount};
154
    my $thisratio     = $data->{reservecount} / $data->{itemcount};
155
    my $copies_to_buy = ceil($data->{reservecount}/$ratio - $data->{itemcount});
155
    my $copies_to_buy = ceil( $data->{reservecount} / $ratio - $data->{itemcount} );
156
    $thisratio >= $ratio or next;  # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
156
    $thisratio >= $ratio or next;    # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause
157
    push(
157
    push(
158
        @reservedata,
158
        @reservedata,
159
        {
159
        {
Lines 169-187 while ( my $data = $sth->fetchrow_hashref ) { Link Here
169
            itemnum            => $data->{itemnumber},
169
            itemnum            => $data->{itemnumber},
170
            biblionumber       => $data->{biblionumber},
170
            biblionumber       => $data->{biblionumber},
171
            holdingbranch      => $data->{holdingbranch},
171
            holdingbranch      => $data->{holdingbranch},
172
            homebranch_list    => [split('\|', $data->{homebranch_list})],
172
            homebranch_list    => [ split( '\|', $data->{homebranch_list} ) ],
173
            holdingbranch_list => [split('\|', $data->{holdingbranch_list})],
173
            holdingbranch_list => [ split( '\|', $data->{holdingbranch_list} ) ],
174
            branch             => $data->{branch},
174
            branch             => $data->{branch},
175
            itemcallnumber     => $data->{itemcallnumber},
175
            itemcallnumber     => $data->{itemcallnumber},
176
            location           => [split('\|', $data->{l_location})],
176
            location           => [ split( '\|', $data->{l_location} ) ],
177
            itype              => [split('\|', $data->{l_itype})],
177
            itype              => [ split( '\|', $data->{l_itype} ) ],
178
            ccode              => [split('\|', $data->{l_ccode})],
178
            ccode              => [ split( '\|', $data->{l_ccode} ) ],
179
            reservecount       => $data->{reservecount},
179
            reservecount       => $data->{reservecount},
180
            itemcount          => $data->{itemcount},
180
            itemcount          => $data->{itemcount},
181
            copies_to_buy      => sprintf( "%d", $copies_to_buy ),
181
            copies_to_buy      => sprintf( "%d", $copies_to_buy ),
182
            thisratio => sprintf( "%.2f", $thisratio ),
182
            thisratio          => sprintf( "%.2f", $thisratio ),
183
            thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0,
183
            thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0,
184
            listcall           => [split('\|', $data->{listcall})]
184
            listcall           => [ split( '\|', $data->{listcall} ) ]
185
        }
185
        }
186
    );
186
    );
187
}
187
}
188
- 

Return to bug 34938