Bug 21467: Allow several receipts for a given subscription
When a new order is created from a subscription the quantity is set to 1 and cannot be modified. The idea was to order 1 subscription. This behavior leads to a limitation: it is not possible to mark a receipt as partially received. However it is how it works in real life, the vendors send invoices throughout the year. The number of items can also be changed. The idea is be to rethink the "quantity" value for an order created from a subscription and use it to track the number of invoices already paid. FIXME: This approach will not cohabit with standing orders. This patch is a first draft to get feedback on the idea. FIXME: What about cancelled orders? Test plan: - Create a new order from a subscription - Enter the number of items you think you will receive for this subscription (for instance 1 per month: 12) - Close the basket - Receive 3 items (a trimester) and create a specific invoice for this receipt. Note that the price are per unit. If you want to receive items with different prices you should make split the receipt - Receive more items. This time you will notice that the previous order will be displayed on the "order receive" under a new block "Receipt history for this subscription" - Note that the "Quantity to receive" has been decrease by the number of items you previously received - Also you can notice that this "Quantity to receive" can be modified. Indeed it can happen that the number of items to receive changed during the year - Go to the detail of the subscription and notice that the orders have been grouped by "parent ordernumber" - Continue to receive items until all have been received Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
414aa0aef6
commit
40267be085
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -197,6 +197,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,
|
||||
|
|
|
|||
|
|
@ -303,14 +303,16 @@
|
|||
<input type="hidden" name="quantity" value="[% quantity | html %]" />[% quantity | html %]
|
||||
[% ELSE %]
|
||||
<label class="required" for="quantity">Quantity: </label>
|
||||
[% IF (AcqCreateItemOrdering) %]
|
||||
[% IF subscriptionid || basket.is_standing %]
|
||||
[% IF subscriptionid %]
|
||||
<input type="text" size="20" id="quantity" name="quantity" value="1" onchange="updateCosts();" />
|
||||
[% ELSIF AcqCreateItemOrdering %]
|
||||
[% IF basket.is_standing %]
|
||||
<input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
|
||||
[% ELSE %]
|
||||
<input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" />
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% IF subscriptionid || basket.is_standing %]
|
||||
[% IF basket.is_standing %]
|
||||
<input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
|
||||
[% ELSE %]
|
||||
<input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec | html %]" onchange="updateCosts();" />
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -54,7 +54,62 @@
|
|||
</fieldset>
|
||||
[% END %]
|
||||
|
||||
[% IF (AcqCreateItemReceiving) %]
|
||||
[% IF subscriptionid and orders.count %]
|
||||
<fieldset class="rows">
|
||||
<legend>Receipt history for this subscription</legend>
|
||||
<table id="orders">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Invoice</th>
|
||||
<th>Order number</th>
|
||||
<th class="title-string">Creation date</th>
|
||||
<th class="title-string">Receive date</th>
|
||||
<th>Quantity received</th>
|
||||
<th class="title-string">Status</th>
|
||||
<th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th>
|
||||
<th>Internal note</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% FOR order IN orders %]
|
||||
<tr>
|
||||
<td>
|
||||
[% IF order.invoice %]
|
||||
[% IF CAN_user_acquisition %]
|
||||
<a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid | html %]" title="Invoice detail page">
|
||||
[% order.invoice.invoicenumber | html %]</a>
|
||||
[% ELSE %]
|
||||
[% order.invoice.invoicenumber | html %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
</td>
|
||||
<td>[% order.ordernumber | html %]</td>
|
||||
<td><span title="[% order.basket.creationdate | uri %]">[% order.basket.creationdate | $KohaDates%]</span></td>
|
||||
<td>[% IF order.datereceived %]<span title="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates %]</span>[% END %]</td>
|
||||
<td>[% order.quantityreceived | html %]</td>
|
||||
<td>
|
||||
[% SWITCH order.orderstatus %]
|
||||
[%# FIXME We should only see/display Complete here, right? %]
|
||||
[% CASE 'new' %]<span title="status_1">New</span>
|
||||
[% CASE 'ordered' %]<span title="status_2">Ordered</span>
|
||||
[% CASE 'partial' %]<span title="status_3">Partial</span>
|
||||
[% CASE 'complete' %]<span title="status_4">Complete</span>
|
||||
[% CASE 'cancelled' %]<span title="status_5">Cancelled</span>
|
||||
[% END %]
|
||||
</td>
|
||||
<td>
|
||||
[% 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 %]
|
||||
</td>
|
||||
<td>[% order.order_internalnote | html %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
[% ELSIF (AcqCreateItemReceiving) %]
|
||||
<div id="items_list" style="display:none">
|
||||
<p><b>Items list</b></p>
|
||||
<div style="width:100%;overflow:auto;">
|
||||
|
|
@ -181,19 +236,18 @@
|
|||
</span>
|
||||
</li>
|
||||
<li><label for="quantity_to_receive">Quantity to receive: </label><span class="label">
|
||||
[% IF ( edit and not subscriptionid) %]
|
||||
[% IF edit or subscriptionid %]
|
||||
<input type="text" id="quantity_to_receive" name="quantity" value="[% quantity | html %]" />
|
||||
[% ELSE%]
|
||||
<input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity | html %]" />
|
||||
[% END %]
|
||||
</span></li>
|
||||
<li><label for="quantity">Quantity received: </label>
|
||||
[% IF (AcqCreateItemReceiving) %]
|
||||
[% IF ( subscriptionid ) %]
|
||||
<input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="1" />
|
||||
[% ELSE %]
|
||||
[% IF subscriptionid %]
|
||||
<input type="text" size="20" name="quantityrec" id="quantity" value="[% quantity | html %]" />
|
||||
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
|
||||
[% ELSIF AcqCreateItemReceiving %]
|
||||
<input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" />
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% IF ( quantityreceived ) %]
|
||||
[% IF ( edit ) %]
|
||||
|
|
@ -208,18 +262,14 @@
|
|||
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
|
||||
[% END %]
|
||||
[% ELSE %]
|
||||
[% IF ( subscriptionid ) %]
|
||||
<input type="text" readonly="readonly" id="quantity" size="20" name="quantityrec" value="1" />
|
||||
[% ELSE %]
|
||||
<input type="text" id="quantity" size="20" name="quantityrec" value="1" />
|
||||
[% END %]
|
||||
<input type="text" id="quantity" size="20" name="quantityrec" value="1" />
|
||||
<input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" />
|
||||
[% END %]
|
||||
<div id="qtyrecerror" style="display:none">
|
||||
<p class="error">Warning, you have entered more items than expected.
|
||||
Items will not be created.</p>
|
||||
</div>
|
||||
[% END %][%# IF (AcqCreateItemReceiving) %]
|
||||
[% END %][%# IF (subscriptionid) ELSIF (AcqCreateItemReceiving) %]
|
||||
</li>
|
||||
|
||||
[% IF ( gst_values ) %]
|
||||
|
|
@ -242,7 +292,7 @@
|
|||
<li><label for="rrp">Retail price: </label>[% rrp | $Price %] <span class="hint">(adjusted for [% cur_active | html %], [% IF (listincgst == 1) %]tax inclusive[% ELSE %]tax exclusive[% END %])</span></li>
|
||||
<li>
|
||||
<label for="replacementprice">Replacement price:</label>
|
||||
<input type="text" size="20" name="replacementprice" id="replacementprice" value="[% replacementprice | $Price %]" />
|
||||
<input type="text" size="20" name="replacementprice" id="replacementprice" value="[% replacementprice | $Price | html %]" />
|
||||
</li>
|
||||
<li><label for="ecost">Budgeted cost: </label>[% ecost | $Price %] <span class="hint">[% IF (listincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]</span></li>
|
||||
<li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue