Bugzilla – Attachment 81394 Details for
Bug 21467
Allow several receipts for a given subscription
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21467: Allow several receipts for a given subscription
Bug-21467-Allow-several-receipts-for-a-given-subsc.patch (text/plain), 13.46 KB, created by
Jonathan Druart
on 2018-10-28 11:47:48 UTC
(
hide
)
Description:
Bug 21467: Allow several receipts for a given subscription
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-10-28 11:47:48 UTC
Size:
13.46 KB
patch
obsolete
>From d1315c4233b9a2472340154c48fdc4ad0e00a581 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 1 Oct 2018 19:41:17 -0300 >Subject: [PATCH] Bug 21467: Allow several receipts for a given subscription >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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> >--- > 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(-) > >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index c72da15393..f910dc8e07 100755 >--- a/acqui/finishreceive.pl >+++ b/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, >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 91c6e35d67..41fda545fa 100755 >--- a/acqui/orderreceive.pl >+++ b/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, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index 8fa11617dc..4a4ba1744e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -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 >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index 7cfe2e89ce..b60c9406ae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -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 ) %] >@@ -239,12 +289,12 @@ > <input type="hidden" name="tax_rate" value="0" /> > [% END %] > >- <li><label for="rrp">Retail price: </label>[% rrp | $Price %]</li> >+ <li><label for="rrp">Retail price: </label>[% rrp | $Price | html %]</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 %]</li> >+ <li><label for="ecost">Budgeted cost: </label>[% ecost | $Price | html %]</li> > <li> > <label for="unitprice">Actual cost:</label> > <input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 | html %]" /> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21467
:
79801
|
79802
|
79834
|
79835
|
79836
|
79837
|
79838
|
80546
|
80706
|
80707
|
80717
|
80718
|
80719
|
80720
|
80721
|
80722
|
80723
|
80724
|
81394
|
81395
|
81396
|
81397
|
81398
|
81399
|
81400
|
81430
|
81797
|
81798
|
81799
|
81800
|
81801
|
81802
|
81803
|
81804
|
81805
|
81806
|
81807
|
81808
|
81809
|
81810
|
81811
|
82117
|
82122
|
82123
|
82124
|
82125
|
82126
|
82127
|
82128
|
82129
|
82130
|
82131
|
82132