Bug 20318: Merge invoices can lead to an merged invoice without Invoice number
authorChristophe Croullebois <christophe.croullebois@biblibre.com>
Wed, 14 Mar 2018 14:28:28 +0000 (14:28 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 22 May 2018 09:53:01 +0000 (11:53 +0200)
When you want to merge invoices you have a page with a non editable
field 'Invoice number:' it shows the content of the first invoice to be
merged.
But if you validate by clicking the 'merge' button you arrive on the
next page which says that 'Invoice has been modified' and if you quit
this page without saving you have now a merged invoice without Invoice
number.
This tiny patch just prevents this issue to occur.

Test plan :

1° go to the acqui/invoices.pl page and search invoices to merge.
You must have at least 2 invoices on the same vendor
2° check boxes to select invoices to merge and click on 'merge selected
invoices' button
3° next page you see the non editable field 'Invoice number:'
4° click on the 'merge' button
5° next page you see 'Invoice has been modified'
6° leave this page i.e click on the left link 'Invoices'
7° search invoices you'll see the merged invoice without invoice number.

Apply the patch, replay the steps 1 to 3
4° on this page you can enter your invoice number and click on the
'merge' button.
If you leave this field empty and click merge, a message informs you
that it is required and you can not merge.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Conflicts:
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt

(cherry picked from commit 3838dd83753a94adb32ab1b6facee7e700e20066)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt

index 20d5edb..9755488 100644 (file)
@@ -66,8 +66,7 @@ $(document).ready(function() {
                 $(row).click(function () {
                     $('#merge_table tbody tr').removeClass('active');
                     $(this).addClass('active');
-                    $('#merge_invoicenumber').text(invoice.invoicenumber);
-                    $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid'], function (idx, prop) {
+                    $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid', 'invoicenumber'], function (idx, prop) {
                         $('#merge_' + prop).val(invoice[prop]);
                     });
                     if (invoice.closedate) {
@@ -183,7 +182,10 @@ $(document).ready(function() {
                         <tbody>
                         </tbody>
                     </table></li>
-                    <li><label for="merge_invoicenumber">Invoice number:</label><span id="merge_invoicenumber"></span></li>
+                    <li><label for="merge_invoicenumber">Invoice number:</label>
+                            <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" />
+                            <span class="required">Required</span>
+                            </li>
                     <li><label for="merge_shipmentdate">Shipment date:</label>
                             <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>