Bug 11665: An ability to place orders directly from hold ratios list
This enhancement introduces a possibility to place orders
from hold ratios list:
- new option "Add order to basket" -> "From titles w/ highest hold ratios";
(user gets redirected from acqusition to "hold ratios" list in circulation)
- "N to order" in "Items needed" column now becomes a link - when clicked,
user gets redirected back to acquisition, directly to order form for
a choosen title (suggested quantity "N to order" is being preserved)
- in the "Items needed" column, there is an additional indication if
there are any pending (not yet received) orders for a given title
This solution is not exactly ideal.. most important drawback: to use
it librarian needs both acquisition & circulation priviledges; if not
having both - new options will not show / wouldn't be active. But it
requires relatively small amount of changes in the code.
To test:
- apply patch,
- test new functions (try to place some orders using an newly added
option, examine resulting order records etc.)
- check modified hold ratios list for possible problems (for user
with only circulation priviledges, additional information regarding
pending orders should be still visible, but not the link
to order form)
- ensure the two following existing options for adding orders to basket
("From an existing record", "From a new (empty) record") a still working
properly.
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Minor edit in signoff: Changed "w/" to "with"
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
This works nicely in my tests, neat new addition.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
e7c2a2031f
commit
0519c428ef
|
|
@ -360,6 +360,14 @@ my @gst_values = map {
|
|||
option => $_ + 0.0
|
||||
}, split( '\|', C4::Context->preference("gist") );
|
||||
|
||||
my $quantity = $data->{'quantity'};
|
||||
{
|
||||
defined($quantity) && last;
|
||||
my $rr_quantity_to_order = $input->param('rr_quantity_to_order');
|
||||
(defined($rr_quantity_to_order) && $rr_quantity_to_order) || last;
|
||||
$quantity = $rr_quantity_to_order;
|
||||
}
|
||||
|
||||
$template->param(
|
||||
existing => $biblionumber,
|
||||
ordernumber => $ordernumber,
|
||||
|
|
@ -404,8 +412,8 @@ $template->param(
|
|||
ean => $data->{'ean'},
|
||||
seriestitle => $data->{'seriestitle'},
|
||||
itemtypeloop => \@itemtypes,
|
||||
quantity => $data->{'quantity'},
|
||||
quantityrec => $data->{'quantity'},
|
||||
quantity => $quantity,
|
||||
quantityrec => $quantity,
|
||||
rrp => $data->{'rrp'},
|
||||
gst_values => \@gst_values,
|
||||
gstrate => $data->{gstrate} ? $data->{gstrate}+0.0 : $bookseller->{gstrate} ? $bookseller->{gstrate}+0.0 : 0,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ use C4::Auth;
|
|||
use C4::Dates qw/format_date format_date_in_iso/;
|
||||
use C4::Debug;
|
||||
use C4::Biblio qw/GetMarcBiblio GetRecordValue GetFrameworkCode/;
|
||||
use C4::Acquisition qw/GetOrdersByBiblionumber/;
|
||||
|
||||
my $input = new CGI;
|
||||
my $startdate = $input->param('from');
|
||||
|
|
@ -47,6 +48,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
}
|
||||
);
|
||||
|
||||
my $booksellerid = $input->param('booksellerid') // '';
|
||||
my $basketno = $input->param('basketno') // '';
|
||||
if ($booksellerid && $basketno) {
|
||||
$template->param( booksellerid => $booksellerid, basketno => $basketno );
|
||||
}
|
||||
|
||||
my ( $year, $month, $day ) = Today();
|
||||
my $todaysdate = sprintf("%-04.4d-%-02.2d-%02.2d", $year, $month, $day);
|
||||
# Find yesterday for the default shelf pull start and end dates
|
||||
|
|
@ -159,6 +166,15 @@ while ( my $data = $sth->fetchrow_hashref ) {
|
|||
);
|
||||
}
|
||||
|
||||
{
|
||||
for my $rd ( @reservedata ) {
|
||||
$rd->{biblionumber} || next;
|
||||
my $pcnt = CountPendingOrdersByBiblionumber( $rd->{biblionumber} );
|
||||
$pcnt || next;
|
||||
$rd->{pendingorders} = $pcnt;
|
||||
}
|
||||
}
|
||||
|
||||
$template->param(
|
||||
ratio_atleast1 => $ratio_atleast1,
|
||||
todaysdate => format_date($todaysdate),
|
||||
|
|
@ -169,3 +185,17 @@ $template->param(
|
|||
);
|
||||
|
||||
output_html_with_http_headers $input, $cookie, $template->output;
|
||||
|
||||
sub CountPendingOrdersByBiblionumber {
|
||||
my $biblionumber = shift;
|
||||
my @orders = GetOrdersByBiblionumber( $biblionumber );
|
||||
scalar(@orders) || return(0);
|
||||
my $cnt=0; for my $order ( @orders ) {
|
||||
defined($order->{datecancellationprinted}) && $order->{datecancellationprinted} && next;
|
||||
my $onum = $order->{quantity} // 0;
|
||||
my $rnum = $order->{quantityreceived} // 0;
|
||||
$rnum >= $onum && next;
|
||||
$cnt+=$onum; $cnt-=$rnum;
|
||||
}
|
||||
$cnt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<li><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]">From a new (empty) record</a></li>
|
||||
<li><a href="/cgi-bin/koha/acqui/z3950_search.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]">From an external source</a></li>
|
||||
<li><a href="/cgi-bin/koha/acqui/addorderiso2709.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]"> From a staged file</a></li>
|
||||
[% IF ( CAN_user_circulate ) %]<li><a href="/cgi-bin/koha/circ/reserveratios.pl?booksellerid=[% booksellerid %]&basketno=[% basketno %]">From titles with highest hold ratios</a></li>[% END %]
|
||||
</ul>
|
||||
[% ELSE %]
|
||||
<div class="dialog alert">
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@
|
|||
<td><p>[% reserveloo.location %]</p></td>
|
||||
<td><p>[% reserveloo.itype %]</p></td>
|
||||
<td><p>[% reserveloo.listcall %]</p></td>
|
||||
<td>[% IF ( reserveloo.thisratio_atleast1 ) %]<p><b>[% reserveloo.ratiocalc %] to order</b></p>[% END %]</td>
|
||||
<td>[% IF ( reserveloo.thisratio_atleast1 ) %]<p>[% IF ( CAN_user_acquisition && basketno && booksellerid ) %]<!-- [% reserveloo.ratiocalc %] --><a href="/cgi-bin/koha/acqui/neworderempty.pl?biblionumber=[% reserveloo.biblionumber %]&booksellerid=[% booksellerid %]&basketno=[% basketno %]&rr_quantity_to_order=[% reserveloo.ratiocalc %]">[% END %]<b>[% reserveloo.ratiocalc %] to order</b>[% IF ( CAN_user_acquisition && basketno && booksellerid ) %]</a>[% END %]
|
||||
[% IF ( reserveloo.pendingorders ) %]<br><b>[% reserveloo.pendingorders %] pending</b>[% END %]</p>[% END %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
|
|
@ -117,6 +118,10 @@
|
|||
|
||||
<fieldset class="action"><input type="submit" value="Go" class="submit"/></fieldset>
|
||||
</fieldset>
|
||||
[% IF ( CAN_user_acquisition && basketno && booksellerid ) %]
|
||||
<input type="hidden" name="booksellerid" value="[% booksellerid %]" />
|
||||
<input type="hidden" name="basketno" value="[% basketno %]" />
|
||||
[% END %]
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue