@@ -, +, @@ - Create a new order from a subscription - Enter the number of items you think you will receive for this - Close the basket - Receive 3 items (a trimester) and create a specific invoice for this - Receive more items. This time you will notice that the previous order - Note that the "Quantity to receive" has been decrease by the number of - Also you can notice that this "Quantity to receive" can be modified. - Go to the detail of the subscription and notice that the orders have - Continue to receive items until all have been received --- acqui/finishreceive.pl | 7 +- acqui/orderreceive.pl | 12 ++++ .../prog/en/modules/acqui/neworderempty.tt | 10 +-- .../prog/en/modules/acqui/orderreceive.tt | 82 +++++++++++++++++----- 4 files changed, 90 insertions(+), 21 deletions(-) --- a/acqui/finishreceive.pl +++ a/acqui/finishreceive.pl @@ -61,7 +61,8 @@ my $new_ordernumber = $ordernumber; $unitprice = Koha::Number::Price->new( $unitprice )->unformat(); $replacementprice = Koha::Number::Price->new( $replacementprice )->unformat(); -my $basket = Koha::Acquisition::Orders->find( $ordernumber )->basket; +my $order_obj = Koha::Acquisition::Orders->find( $ordernumber ); +my $basket = $order_obj->basket; #need old receivedate if we update the order, parcel.pl only shows the right parcel this way FIXME if ($quantityrec > $origquantityrec ) { @@ -100,6 +101,10 @@ if ($quantityrec > $origquantityrec ) { # save the quantity received. if ( $quantityrec > 0 ) { + if ( $order_obj->subscriptionid ) { + # Quantity can only be modified if linked to a subscription + $order->{quantity} = $quantity; # quantityrec will be deduced from this value in ModReceiveOrder + } ( $datereceived, $new_ordernumber ) = ModReceiveOrder( { biblionumber => $biblionumber, --- a/acqui/orderreceive.pl +++ a/acqui/orderreceive.pl @@ -194,6 +194,18 @@ my @gst_values = map { option => $_ + 0.0 }, split( '\|', C4::Context->preference("gist") ); +if ( $order->{subscriptionid} ) { + # Order from a subscription, we will display an history of what has been received + my $orders = Koha::Acquisition::Orders->search( + { + subscriptionid => $order->{subscriptionid}, + parent_ordernumber => $order->{ordernumber}, + ordernumber => { '!=' => $order->{ordernumber} } + } + ); + $template->param( orders => $orders ); +} + $template->param( AcqCreateItem => $AcqCreateItem, count => 1, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -303,14 +303,16 @@ [% quantity | html %] [% ELSE %] - [% IF (AcqCreateItemOrdering) %] - [% IF subscriptionid || basket.is_standing %] + [% IF subscriptionid %] + + [% ELSIF AcqCreateItemOrdering %] + [% IF basket.is_standing %] [% ELSE %] [% END %] [% ELSE %] - [% IF subscriptionid || basket.is_standing %] + [% IF basket.is_standing %] [% ELSE %] @@ -622,7 +624,7 @@ }); //We apply the fonction only for modify option - [% IF ( quantityrec ) %] + [% IF ( quantityrec and not subscriptionid ) %] [% IF ( acqcreate ) %] $('#quantity').blur(function(){ // if user decreases the quantity --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -54,7 +54,62 @@ [% END %] - [% IF (AcqCreateItemReceiving) %] + [% IF subscriptionid and orders.count %] +
+ Receipt history for this subscription + + + + + + + + + + + + + + + [% FOR order IN orders %] + + + + + + + + + + + [% END %] + +
InvoiceOrder numberCreation dateReceive dateQuantity receivedStatusSpentInternal note
+ [% IF order.invoice %] + [% IF CAN_user_acquisition %] + + [% order.invoice.invoicenumber | html %] + [% ELSE %] + [% order.invoice.invoicenumber | html %] + [% END %] + [% END %] + [% order.ordernumber | html %][% order.basket.creationdate | $KohaDates%][% IF order.datereceived %][% order.datereceived | $KohaDates %][% END %][% order.quantityreceived | html %] + [% SWITCH order.orderstatus %] + [%# FIXME We should only see/display Complete here, right? %] + [% CASE 'new' %]New + [% CASE 'ordered' %]Ordered + [% CASE 'partial' %]Partial + [% CASE 'complete' %]Complete + [% CASE 'cancelled' %]Cancelled + [% END %] + + [% IF order.datereceived %][%# FIXME Should only be true, right? %] + [%# FIXME What if unitprice has not been filled? %] + [% order.unitprice_tax_excluded | $Price | html %] / [% order.unitprice_tax_included | $Price | html %] + [% END %] + [% order.order_internalnote | html %]
+
+ [% ELSIF (AcqCreateItemReceiving) %]