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.
Created attachment 18472 [details] [review] 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.
@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'; }
(In reply to comment #2) > @invoices should be checked only if AcqWarnOnDuplicateInvoice is set, > otherwise it is an unnecessary db read. Great catch, thanks!
Created attachment 18618 [details] [review] 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.
Created attachment 18635 [details] [review] 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. Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Hi Srdjan, please keep the test plans in the commit messages, thx!
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.
Pushed to master. Thanks, Jared!
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
Created attachment 20130 [details] my two invoices with the same number - even with pref set to warn
(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.
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.
(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.
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
Any other ideas? Is this specific to just me?
Check this out: http://screencast.com/t/vEWbzykXgc
Same for me. Something must have changed meanwhile.