Bug 10366 - Alert librarian if an invoice number is duplicated
Summary: Alert librarian if an invoice number is duplicated
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Target Milestone: ---
Assignee: Jared Camins-Esakov
QA Contact: Katrin Fischer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 10736
  Show dependency treegraph
 
Reported: 2013-05-29 01:10 UTC by Jared Camins-Esakov
Modified: 2014-12-07 20:02 UTC (History)
4 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 10366: Alert librarian if an invoice number is duplicated (8.55 KB, patch)
2013-05-29 14:01 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 10366: Alert librarian if an invoice number is duplicated (8.55 KB, patch)
2013-06-03 11:45 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 10366: Alert librarian if an invoice number is duplicated (7.83 KB, patch)
2013-06-04 02:11 UTC, Srdjan Jankovic
Details | Diff | Splinter Review
[PASSED QA] Bug 10366: Alert librarian if an invoice number is duplicated (9.13 KB, patch)
2013-06-16 11:44 UTC, Katrin Fischer
Details | Diff | Splinter Review
my two invoices with the same number - even with pref set to warn (16.12 KB, image/png)
2013-08-06 13:55 UTC, Nicole C. Engard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2013-05-29 01:10:02 UTC
Some vendors ship materials from the same invoice in multiple packages. In those cases, it would be good to notify the librarian when they enter a duplicate invoice number, so that they can continue receiving on the previously-created invoice, rather than creating an invoice with a duplicate number.
Comment 1 Jared Camins-Esakov 2013-05-29 14:01:46 UTC Comment hidden (obsolete)
Comment 2 Srdjan Jankovic 2013-06-03 04:04:27 UTC
@invoices should be checked only if AcqWarnOnDuplicateInvoice is set, otherwise it is an unnecessary db read.
Can you please amend to something like
my $duplicate_invoices;
if ( C4::Context->preference('AcqWarnOnDuplicateInvoice') ) {
    if ( GetInvoices(...) ) {
        $duplicate_invoices = 1;
    }
}
if ($duplicate_invoices) {
    ...
} else {
    $op = 'confirm';
}
Comment 3 Jared Camins-Esakov 2013-06-03 11:43:48 UTC
(In reply to comment #2)
> @invoices should be checked only if AcqWarnOnDuplicateInvoice is set,
> otherwise it is an unnecessary db read.

Great catch, thanks!
Comment 4 Jared Camins-Esakov 2013-06-03 11:45:49 UTC Comment hidden (obsolete)
Comment 5 Srdjan Jankovic 2013-06-04 02:11:40 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2013-06-16 11:33:31 UTC
Hi Srdjan, please keep the test plans in the commit messages, thx!
Comment 7 Katrin Fischer 2013-06-16 11:44:17 UTC
Created attachment 19037 [details] [review]
[PASSED QA] Bug 10366: Alert librarian if an invoice number is duplicated

Some vendors ship materials from the same invoice in multiple packages.
In those cases, it would be good to notify the librarian when they enter
a duplicate invoice number, so that they can continue receiving on the
previously-created invoice, rather than creating an invoice with a
duplicate number.

To test:
1) Apply patch and run database update.
2) Make sure that you have created at least one invoice on
   acqui/parcels.pl and take note of the invoice number.
3) Try to create an invoice with the same invoice number.
4) Note that without changing your configuration this works exactly
   the same as before.
5) Turn on the AcqWarnOnDuplicateInvoice system preference.
6) Try to create a new invoice with the same number as the one you
   noted earlier.
7) Make sure you get a warning about a duplicate invoice.
8) Choose to receive on the existing invoice.
9) Confirm that you are receiving on said existing invoice.
10) Start the receiving process over, and this time choose "Create new
    invoice anyway."
11) Confirm that you are now receiving on a new invoice.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

I have followed the test plan, but also checked some more things:
- Checking the duplicate check works when you have the entered
  invoice number in your database multiple times already.
- Checking that no duplicate message is shown if you enter the
  invoice number and it's already been used for an invoice from
  another vendor.

Looks all good. I think the only thing we could argue about here
is if this could be activated by default for new installations.
Comment 8 Galen Charlton 2013-07-06 17:14:43 UTC
Pushed to master.  Thanks, Jared!
Comment 9 Nicole C. Engard 2013-08-06 13:52:41 UTC
I just tested this today so I could get a screenshot of the warning for the manual and was not warned. I did set the preference to 'Warn' and then clicked receive and entered in an invoice number that was already used in the system ... no warning. When will the warning appear?

Nicole
Comment 10 Nicole C. Engard 2013-08-06 13:55:48 UTC
Created attachment 20130 [details]
my two invoices with the same number - even with pref set to warn
Comment 11 Jared Camins-Esakov 2013-08-06 14:07:55 UTC
(In reply to Nicole C. Engard from comment #9)
> I just tested this today so I could get a screenshot of the warning for the
> manual and was not warned. I did set the preference to 'Warn' and then
> clicked receive and entered in an invoice number that was already used in
> the system ... no warning. When will the warning appear?

Could you paste the results of the query "SELECT * FROM systempreferences WHERE variable = 'AcqWarnOnDuplicateInvoice';"? The syspref display appears to be glitchy, since when I tried this on master it did not work until I turned AcqWarnOnDuplicateInvoice off and back on.
Comment 12 Nicole C. Engard 2013-08-06 14:48:34 UTC
Okay so I only turned it on once and here's the results:


mysql> SELECT * FROM systempreferences WHERE variable = 'AcqWarnOnDuplicateInvoice' \G
*************************** 1. row ***************************
   variable: AcqWarnOnDuplicateInvoice
      value: 1
    options: 
explanation: Warn librarians when they try to create a duplicate invoice
       type: YesNo
1 row in set (0.00 sec)


I can try to turn it off and on again but if that's the problem we might want to check the db update to make sure it's doing the right thing.
Comment 13 Jared Camins-Esakov 2013-08-06 14:50:41 UTC
(In reply to Nicole C. Engard from comment #12)
> Okay so I only turned it on once and here's the results:
> 
> 
> mysql> SELECT * FROM systempreferences WHERE variable =
> 'AcqWarnOnDuplicateInvoice' \G
> *************************** 1. row ***************************
>    variable: AcqWarnOnDuplicateInvoice
>       value: 1
>     options: 
> explanation: Warn librarians when they try to create a duplicate invoice
>        type: YesNo
> 1 row in set (0.00 sec)
> 
> 
> I can try to turn it off and on again but if that's the problem we might
> want to check the db update to make sure it's doing the right thing.

What's weird is that looks the same as what I have now that it's working. Let me know if the toggle fixes it.
Comment 14 Nicole C. Engard 2013-08-06 15:14:01 UTC
Nope ... no warning. So, here's what I'm doing:

1. search for invoices so I can find a number
2. copy an invoice number
3. click a vendor on the invoice search results
4. click receive shipment on that vendor detail page
5. enter the invoice number i copied
6. leave shipping blank
7. submit and get no warning
Comment 15 Nicole C. Engard 2013-08-15 13:47:53 UTC
Any other ideas? Is this specific to just me?
Comment 16 Nicole C. Engard 2013-08-15 14:28:26 UTC
Check this out: http://screencast.com/t/vEWbzykXgc
Comment 17 Srdjan Jankovic 2013-08-16 01:34:10 UTC
Same for me. Something must have changed meanwhile.