Commit graph

651 commits

Author SHA1 Message Date
Galen Charlton
b8340153c4 Bug 7180: (follow-up) fix warnings
This patch fixes some warnings (not introduced by the main
patches) regarding fetching the number of bibs in a batch
and fetching the list of batches.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 21:06:50 +00:00
Jonathan Druart
8c1112eb1e Bug 10875: ensure adding order from a staged file does not display inactive funds by default
When adding an order from a staged file, a link
"show all funds" is now added on the top of the
page. All inactive funds are hidden by default.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works as described.
- Loading the page, a fund needs to be selected. Before
  the patch the first fund was preselected.
- Checking the checkbox, inactive funds show up, but
  are not visible otherwise.
- If the fund is selected from the MARC file, the
  correct fund will be selected, even if it's inactive.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 20:47:25 +00:00
Galen Charlton
e4e058decf Bug 7180: (follow-up) require an authenticated session to use the AJAX authval dropbox
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 20:46:58 +00:00
Jonathan Druart
953c9d511b Bug 7180: (follow-up) reset statistic values on reloading the page
On the "Default accounting details", if a dropdown list was created for
a statistic value, on reloading the page it still exist. It should not
given the fund value is reset.

The CGIsort variable is useless and can be remove: the dropdown list
is generated using the ajax call.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 20:46:51 +00:00
Jonathan Druart
5d69ebdc4c Bug 7180: (follow-up) fix various issues
* fix calculation of discount
* add CSS for unselected rows
* fix Javascript error
* correct capitalization
* use “Statistic” instead of “Planning value”
* improve description of system preference

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:56:59 +00:00
Jonathan Druart
061ab30ac1 Bug 7180: (follow-up) remove disused script fetch_sort_dropbox.pl
Test plan:
  git grep fetch_sort_dropbox
should return no result.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:54:42 +00:00
Jonathan Druart
271b48bfd3 Bug 7180: (followup) fix case where discount was divided by 100 twice.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:54:13 +00:00
Jonathan Druart
3e211aa2a8 Bug 7180: (follow-up) remove useless rrp variable
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:53:56 +00:00
Jonathan Druart
a6affb44e2 Bug 7180: QA followup
- fix unit tests (use a transaction).
- add 3 tabs on the page in order to be more understandable.
- fix a warn in logs

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:52:06 +00:00
Jonathan Druart
511113ce89 Bug 7180: (follow-up) update license version
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:50:22 +00:00
Jonathan Druart
9eee2b5088 Bug 7180: make neworderempty code use getAuthValueDropbox.
The js function fetchSortDropbox has been deleted in previous patch.
The new function is getAuthValueDropbox.

Test plan:
- link authorized values to some funds
- open an existing order and verify value are correctly filled in the
  sort1 and sort2 values
- create a new order and verify behavior is the same as before

Note: This patch generates 2 ajax queries (max) if the budget is linked
to 2 av categories for sort1 and sort2. This could be improved using a
template plugin for values display on load.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:49:20 +00:00
Jonathan Druart
b9619a485e Bug 7180: (follow-up) change syspref description
- the blank line is now useless
- add an example for the syspref value

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:48:19 +00:00
Jonathan Druart
59bd868c98 Bug 7180: QA followup
Ergonomic improvements:
- Remove the green color the selected record.
- Use fieldset.rows (and legend).
- Use the required css class for quantity inputs.
- Replace "budget" with "fund".
- fix the "undefined" string
- Add a "show MARC" link
- replace "no_match" with a text.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:46:04 +00:00
Jonathan Druart
2f2d7b9368 Bug 7180: Order from staged file improvements
This patch adds:
- 1 syspref MarcFieldsToOrder
- 1 Ajax script acqui/ajax-getauthvaluedropbox.pl
- 1 routine C4::Budgets::GetBudgetByCode

Before this patch you were not able to order 1 or all the records from
your staged file. You were allowed to specify some information ("Import
All" and "Accounting details" areas) for the order.

With this patch, the previous behaviour still exists.
But now you can *select* which records you want to ordered.
For these ones you can specify independently quantity,
price, budget, sort1 and sort2.

The cherry on the cake is that you can pre-fill these fields  with
values from the MARC record.

Test plan:
1. Fill the new syspref MarcFieldsToOrder with something like:
==BEGIN==
price: 947$c
quantity: 969$h
budget_code: 922$a
rrp: 010$d
discount: 969$d
sort1: 923$a
sort2: 924$a

==END==
The empty line at the end is mandatory!
The budget (corresponding to your budget_code) can be filled with
authorized value categories (statistic 1 and 2).
The sort1 and sort2 values can be filled with the an authorized value
(of the category previously selected)

2. Choose randomly one or more biblio(s) and fill fields with what is
   relevant.

3. Export the biblio and import it (with the "Stage MARC records for
   import" tool).

4. Go on a basket and add an order from a staged file. Select your
   staged file.

5. Well. Now you can see your biblio (or biblios if your had exported
   more than one). For each one, fields should be pre-filled with the
   biblio values. The budget should be selected on the budget
   corresponding to the budget_code (in the field 922$a) and the
   "planning values" too (with fields 923$a and 924$a).
   You can modify these values (or not) and choose a default value for
   budget and planning values (in the "Accounting details" area).

6. Save and check the prices values. Modify the order and check that
   budget and sort* are good

Prices are calculated following some parameters:
if there is no price => listprice = 0
else =>
  - the gstrate value for your order is the gstrate value of the bookseller
  - discount = if filled : the discount value / 100
               else: the discount value of the bookseller
  - if the bookseller includes tax( List item price includes tax: Yes )
        if a discount exists:
            ecost = price
            rrp   = ecost / ( 1 - discount )
        else: # a discount does not exist
            ecost = price * ( 1 - discount )
            rrp   = price
    else # the bookseller does not include tax
        if a discount exists:
            ecost = price / ( 1 + gstrate )
            rrp   = ecost / ( 1 - discount )
        else: # a discount does not exist
            rrp   = price / ( 1 + gstrate )
            ecost = rrp * ( 1 - discount )
  - in all cases:
        listprice = rrp / currency rate
        unitprice = ecost
        total = ecost * quantity

7. Retry with different parameters

8. Check the 'Import all' action still works

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:41:30 +00:00
Jonathan Druart
454bef0b79 Bug 10613: (follow-up) fix QA issues
This patch fixes the following QA issue:

 FAIL    acqui/invoice.pl
   FAIL      valid
        Useless use of private variable in void context

Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Patch passes all tests and QA script. Specifically checked
the t/db_depenedent/Acq* tests.

A test plan could be:
0) Add a value in the gist pref (0.1 or 0.25 or something else easy).
1)
  a) Create a supplier "10613 0 0" with
    List item price includes tax: No
    Invoice item price includes tax: No
    Tax: 10%
  b) Create a supplier "10613 0 1" with
    List item price includes tax: No
    Invoice item price includes tax: Yes
    Tax: 10%
  c) Create a supplier "10613 1 0" with
    List item price includes tax: Yes
    Invoice item price includes tax: No
    Tax: 10%
  d) Create a supplier "10613 1 1" with
    List item price includes tax: Yes
    Invoice item price includes tax: Yes
    Tax: 10%
2) Create a basket for each supplier
  a) 00 List price: 10.00 (11.00 with 10% taxes)
  b) 01 List price: 10.00 (11.00 with 10% taxes)
  c) 10 List price: 10.00 (9.09 without taxes)
  d) 11 List price: 10.00 (9.09 without taxes)
  Note: Information on the basket page is shown correctly.
  If you look at the list of ordered items for the fund,
  the list price is used.
3) Create 1+ order(s) with 1+ item(s) for each basket with
   a discount and a gst value.
4) Close the baskets
5) Receive the items
   Left actual price as suggested:
   a) 00 Actual cost: 10.00
   b) 01 Actual cost: 11.00
   c) 10 Actual cost:  9.09
   d) 11 Actual cost: 10.00
   Calculations on the invoice page now all appear to be correct.
   Note: When you take a look at the 'ordered' list for the fund,
   the actual price is used as entered.
6) Go on acqui/invoice.pl?invoiceid=XX acqui/basket.pl?basketno=YY for
   each basket/invoice, click on the "Show all details" checkbox
   and verify that the values are all correct.

Calculations are exactly the same for tax registered yes and no.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:24:38 +00:00
Jonathan Druart
0b67272199 Bug 10613: (follow-up) fix typo supplierid vs booksellerid
GetInvoiceDetails returns a hashref with a key named booksellerid, not
supplierid.
The bookseller was not retrieved from the DB and the listincgst value
was always false.

Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:23:33 +00:00
Jonathan Druart
b99df4f762 Bug 10613: calculate the GST rate correctly on the invoice page.
Test plan:
Defined a GST rate on creating an order, receive it and check that all
prices are correctly calculated.
/!\ Behavior change function of supplier parameters (Include/Don't
include tax for list prices and invoice prices)

Notes: patch tested with Bug 11755 applied first; confirmed that:
- price calculations are correct for all combinations of
  listincgst/invoiceincgst settings in the vendor record
- unitprice (aka "Actual cost") is taken into account on the
  invoice page instead of rrp/ecost, like it should.

Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:22:30 +00:00
Galen Charlton
13fe2e013d Bug 11665: (follow-up) simplify code
This patch replaces some of the logic with more direct
Boolean expressions.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:13:44 +00:00
Jacek Ablewicz
0519c428ef Bug 11665: An ability to place orders directly from hold ratios list
This enhancement introduces a possibility to place orders
from hold ratios list:

- new option "Add order to basket" -> "From titles w/ highest hold ratios";
(user gets redirected from acqusition to "hold ratios" list in circulation)

- "N to order" in "Items needed" column now becomes a link - when clicked,
user gets redirected back to acquisition, directly to order form for
a choosen title (suggested quantity "N to order" is being preserved)

- in the "Items needed" column, there is an additional indication if
there are any pending (not yet received) orders for a given title

This solution is not exactly ideal.. most important drawback: to use
it librarian needs both acquisition & circulation priviledges; if not
having both - new options will not show / wouldn't be active. But it
requires relatively small amount of changes in the code.

To test:
- apply patch,
- test new functions (try to place some orders using an newly added
option, examine resulting order records etc.)
- check modified hold ratios list for possible problems (for user
with only circulation priviledges, additional information regarding
pending orders should be still visible, but not the link
to order form)
- ensure the two following existing options for adding orders to basket
("From an existing record", "From a new (empty) record") a still working
properly.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Minor edit in signoff: Changed "w/" to "with"

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
This works nicely in my tests, neat new addition.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 19:13:39 +00:00
7fba4e3ef8 Bug 12089: Remove use of dt_add_type_uk_date() - Acquisitions
This patch removes instances of dt_add_type_uk_date() from acquisitions
templates and updates sorting configurations according to current
guidelines.

In cases where a formatted date was passed from a Perl script, the
script has been modified to pass an unformatted date.

Several instances of the no longer valid align attribute have been
removed from <td> tags in favor of an existing "data" class which is
suitable for display of currency values.

To test, view the following pages in Acquisitions. Columns containing
dates should sort correctly regardless of dateformat system preference
setting. Columns containing bibliographic titles should ignore articles
when sorting.

- Add to an order from a staged file: The table of staged files should
  sort correctly. After clicking "add orders" for one of the staged
  files, the table of titles in that staged file should also be sorted
  correctly.

- Add to an order from a subscription. The table of subscription search
  results should sort correctly.

- Orders search results should sort correctly.

- Late orders should sort correctly.

- Search for a vendor. Click on the vendor name to view the vendor
  detail page. The table of contracts on this page should sort
  correctly.

- From the Acquisitions home page click a number in the "spent" column
  of the table of available funds. The table of orders should sort
  correctly.

- From the Acquisitions home page click a number in the "ordered" column
  of the table of available funds. The table of orders should sort
  correctly.

- From a vendor detail page, click the "Receive shipments" button. On
  the receive shipments page the table of shipments should be sorted
  correctly.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-28 18:41:28 +00:00
234823c6af Bug 11856: Add publication year and edition to French acq PDF template
Follow up to the patch for the English templates - repeat tests
with OrderPDFFormat set to pdfformat::layout3pagesfr.

Additional change:
Translates 'published by' to 'publie par'

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-28 17:20:14 +00:00
ce38ae1d21 Bug 11856: Add publication year and edition to German acq PDF template
Follow up to the patch for the English templates - repeat tests
with OrderPDFFormat set to pdfformat::layout2pagesde.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-28 17:20:00 +00:00
43e4161260 Bug 11856: Add publication year and edition to English acq PDF templates
To test:
- Switch OrderPdfFormat to pdfformat::layout3pages
- Create one or more  baskets with a few orders, make sure you
  are adding some records that contain a publication year and/or
  edition statement
- Close the basket
- Create a basket group
- Print the PDF and check that edition and publication year
  show up and bibliographic information is printed correctly
- Switch OrderPdfFormat to pdfformat::layout2pages
- Repeat PDF print

This patch also changes the formatting a bit and differentiates between
UNIMARC and MARC21. For MARC21 no additional punctuation is needed as
those are cataloged with the information. Only spaces are added for MARC21,
while UNIMARC is kept they way it was before.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-28 17:19:31 +00:00
Galen Charlton
b91efb3b66 Bug 12111: (follow-up) ensure that vendor note is not editable during order receiving
This patch removes the ability of finishreceive.pl to change the vendor
note of an order.  It also uses a normal span rather than a disabled
textarea to display the vendor note on the receiving page, to emphasize
that it cannot be changed.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-28 15:37:43 +00:00
Julian Maurice
65748d05b5 Bug 11551: Allow to search on parent ordernumber in histsearch.pl
It is now possible to search on the order number on the order search
page.

Also searching on parent_ordernumber is possible, allowing one to
search to search children for a given order number.

Test plan:
1/ create a basket and 1 order with at least 2 items.
2/ receive partialy the order (receive only 1 item).
3/ note that a new ordernumber is created for item not received.
4/ go on the order search form and search for the original ordernumber
without checking the new checkbox "Display children too." => only 1
order (the parent) is displayed.
5/ now check the checkbox and search again => the parent order is
displayed but children too.

Signed-off-by: remy juliette <juliette.levast@iepg.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works nicely, passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 04:23:09 +00:00
Galen Charlton
9f3e1c4947 Bug 9416: (follow-up) teach ordering from staged files about the notes fields
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 16:05:17 +00:00
Galen Charlton
58b5b384f6 Bug 9416: (follow-up) reconcile with work done on bug 11699
This patch teaches the ordering receiving process how to
set vendor and internal order notes.

One observation: I'm not sure it's entirely useful to set
a note to communicate to the vendor during receiving --
how is it to be sent to them, and why?

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 15:55:38 +00:00
Mathieu Saby
138f14c2b9 Bug 9416: (follow-up) fix neworderempty and templates
This followup answer QA remarks :
- neworderempty.pl updated so that the 2 new variables are passed
  to the template
- modordernotes.tt fixed to make the translation easier
- in CSV headers, to make clear that no change are made for the moment,
  rename "note" to "internal note"

Additionnaly, "Publisher code" was wrong in the csv headers. I changed
it to "Publisher" (the field in database is publishercode, but the
content is a real publisher name, not a code)

I did not change "Note:" in modordernotes.tt, because it is just under
a h1 tag which specifies the type of note the librarian is editing.

Test plan :
- edit an existing order, and try to change/add/delete the vendor note,
  and the internal note. Check the changes are properly saved
- export a basket and a basketgroup in CSV. Check the columns headers
  are "Publisher" and "Vendor note"

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixed some tabs. Passes QA script and tests.

Tested:
- add notes when creating an order
- edit notes modifying an order line
- edit notes using the links on the basket summary
- check basket CSV export
- close basket
- check basket group CSV export
- edit notes on order receive page using the links
- edit notes on receive

Note: Translatability of templates could be improved by a follow-up.
It's better not to divide up sentences with if/else structures.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 15:55:37 +00:00
Mathieu Saby
36074fba65 Bug 9416: add new order vendor note field
Currently, there is a single note field in each order. It would be
useful to have 2 notes fields:

- one for the staff (ex: "catalog this book as soon as possible")
- one for the vendor (ex: "urgent", "only the 2d volume"...), which
  could later be printed in basketgroup pdf for example

This patch adds a new note made for vendor in each order. The existing
note is renamed "internal note".

The behavior of the 2 notes are the same

Changes in database structure:
- new column aqorders.order_vendornote
- column aqorders.notes renamed aqorders.order_internalnote

To test :
[1] Make a complete acquisiton process (creating the order > looking at
    the basket > looking the order > receiving); and try to use the 2
    notes (internal note / vendor note)
[2] Check the changes made on one page (eg detail of the order) are
    saved and visible on an other page (eg receipt page)

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 15:55:36 +00:00
Jonathan Druart
36fc9a3e64 Bug 11699: change ModReceiveOrder to used named parameters
Test plan:
prove t/db_dependent/Acquisition.t
prove t/db_dependent/Acquisition/Invoices.t
prove t/db_dependent/Acquisition/OrderFromSubscription.t

all should return green.

NOTE: Any error messages are the same between master and this
      patch, and are unrelated to the added/revised tests.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 15:08:21 +00:00
Jonathan Druart
ab1a74897e Bug 11699: fixed saving notes entered when receiving orders
Revised test plan:
1/ Create an order with 2 items
2/ Receive 1 item and enter a note for the order
3/ Verify the note is not saved
    The note should be visible on the Mod Order Details screen,
    but it isn't there.
4/ Apply patch
5/ Receive the second item and enter a note for the order
6/ Verify the note is correctly saved
    The note is visible on the Mod Order Details screen.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works as described. The note now saves correctly and also remains when
you undo a receipt.

Note: it would be nice to show the note on the receive page as well.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 14:59:17 +00:00
Jacek Ablewicz
f3cb186de5 Bug 11680: (follow-up) fix unexpected tax rate changes on edit
Follow-up to fix similar issue on vendor edit.

If the tax rates in Acquisitions -> gist system preference
are entered with trailing zeroes, given vendor tax rate value
may not be correctly handled on vendor edit.

Test plan for this follow-up:

1) insert some tax rates with trailing zeroes in gist
system preference (e.g: '0|0.080|0.12|0.20|0.23')
2) add some vendors, choosing 8.0% 12.0% 20.0% 23.0%
as gst rate
3) try to modify them
4) note that vendors with 12.0% and 23.0% tax rates are
preserving previously choosen rates on edit, while
the ones with 8.0% and 20.0% do not (they are defaulting
to the first defined tax rate)
5) apply the patch
6) repeat 2) and 3)
7) all tax rates configured in system prefrence shall now
behave properly while editing vendors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 22:14:21 +00:00
Jacek Ablewicz
471215dc46 Bug 11680: fix case where tax rate changes unexpectedly on editing an order
If the tax rates in Acquisitions -> gist system preference are entered
with trailing zeroes, given order tax rate value may not be correctly
handled on order edit.

To test:

1) insert some tax rates with trailing zeroes in gist
system preference (e.g: '0|0.080|0.12|0.20|0.23')
2) place some new orders, choosing 8.0% 12.0% 20.0% 23.0%
as gst rate
3) try to modify them
4) note that orders with 12.0% and 23.0% tax rates are
preserving previously choosen rates on edit, while
the ones with 8.0% and 20.0% do not (they are defaulting
to the first defined tax rate)
5) apply the patch
6) repeat 2) and 3)
7) all tax rates configured in system prefrence shall now
behave properly while editing orders

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
All tests pass

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Confirmed the problem and that this patch fixes it.
Problem also exists for editing the default tax rate of a vendor.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 22:13:48 +00:00
Jacek Ablewicz
1b0c02376e Bug 11914: fix two issues when creating an order from a suggestion
When order is being created from purchase suggestion:
- Budget/fund stored in suggestion record (if any) is not retained
on order page, system always defaults to 'Select a fund' even if some
fund was already chosen for a suggestion on the earlier stage.
- If there was a price given to, and stored within suggestion record,
initial prices calculations on order page are not working properly
('Replacement cost', 'Budgeted cost' and 'Total' show as 0.00 or blank).
As a workaround - to force correct price recalculation - user needs
to manually alter and then re-alter some price-related fields (e.g.,
quantity or vendor price).

This patch fixes both issues.

Test plan:
1) create a suggestion: choose some buget, enter something in 'Price'
and 'Quantity' fields,
2) try to make an order from this suggestion, to confirm/replicate
aforementioned problems,
3) apply patch,
4) make an order from previously created suggestion again, observe
that both issues are now resolved.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-18 21:59:14 +00:00
ae030272a4 Bug 7267: Add account number to German PDF template
To test:
- Switch system preference OrderPdfFormat to pdfformat::layout2pagesde
- Create one or more baskets with some orders each.
- Add all baskets to one basket group
- Print the basket group
- Check the account number from your vendor shows up with the other
  vendor details

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 15:06:07 +00:00
62151ced35 Bug 7267: Add account number to English PDF templates
To test:
- Switch system preference OrderPdfFormat to pdfformat::layout2pages
- Create one or more baskets with some orders each.
- Add all baskets to one basket group
- Print the basket group
- Check the account number from your vendor shows up with the other
  vendor details
- Repeat with pdfformat::layout3pages

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 15:05:55 +00:00
a4841aae08 Bug 7267: Add account number to French PDF template
To test:
- Switch system preference OrderPdfFormat to pdfformat::layout3pagesfr
- Create one or more baskets with some orders each.
- Add all baskets to one basket group
- Print the basket group
- Check the account number from your vendor shows up with the other
  vendor details

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 15:05:42 +00:00
ffeb666994 Bug 11828: Add German translation of layout2pages PDF template
To test:
- Switch system preference OrderPdfFormat to pdfformat::layout2pagesde
- Create one or more baskets with some orders each.
- Add all baskets to one basket group
- Print the basket group
- Check everything is translated into German and the formatting/layout
  looks ok

Followed test plan and compared English with German printout.
German version is OK.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 14:58:47 +00:00
21e6518d32 Bug 11366: make "no group" option in acq basket group drop-down translatable
in Acq baskets, there's a pull-down for basket groups. One of the
entries in that pull-down is "No group", which is untranslatable.
This string is hard-coded in Perl.

This patch removes the string from Perl to set it has first option
in select. To allow it to be default value, the option "Add new group"
is moved to last position.

Test plan :
- Go to a closed aquisition basket in no basket group :
  cgi-bin/koha/acqui/basket.pl?basketno=x
=> You see "No group" selected in combobox "Basket group"
- Cick on this combobox
=> You see "No group", then existing basket groups and then "Add new
   group"
- Select a basket group and click on "change basket group"
=> You see the basket group name in combobox
Use translation, for example fr-FR
- go to src/misc/translator
- run : perl translate update fr-FR
=> You find in PO file :
  #: intranet-tmpl/prog/en/modules/acqui/basket.tt:365
  #, fuzzy, c-format
  msgid "No group"
  msgstr "Nom de groupe"
- remove ", fuzzy" and correct translation : "Pas de groupe"
- run : perl translate install fr-FR
- Go to translated aquisition basket page
=> You see translated option in combobox

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-13 14:43:01 +00:00
Galen Charlton
cd21ac7542 Bug 11820: remove dead code in basket group management
There was some code in acqui/basketgroup.pl that was apparently
intended to let one create a basket group for no (or an unknown)
vendor.  However, this code was never reached, as there is nothing
in the templates that invokes basketgroup.pl with 'add' as the
operation that doesn't also pass the vendor ID along.

This patch removes that dead code.

To test:

[1] Create a new basket group for a vendor and verify that it is
    created correctly.
[2] Edit an existing basket group, including moving baskets in and
    and out of, and verify that it works.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
No regressions found, passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-12 14:27:39 +00:00
Jonathan Druart
fe520d5b14 Bug 11170: make the pending order list only display orders to receive
The order status ordered is set when the basket is closed.
The parcel page should only display status "ordered" and "partial".

Test plan:
- create a basket.
- create an order.
- verify the order is not listed on the parcel page (i.e. you cannot
  receive it).
- close the basket.
- verify the order is listed on the parcel page.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-11 15:09:56 +00:00
daf2ebc4f5 Bug 11096: support the retrieval of large MARCXML records
This patch makes Koha <-> Zebra use MARCXML for the serialization when
using DOM, and USMARC for GRS-1.

* The following functions are modified to set the Zebra record syntax
according to the current sysprefs and configuration:

- C4::Context->Zconn
- C4::Context-_new_Zconn

* A new function 'new_record_from_zebra' is introduced, which checks the
context we are in, and creates the MARC::Record object using the right
constructor.

The following packages get touched to make use of the new function:
- C4::Search
- C4::AuthoritiesMarc

and the same happens to the UI scripts that make use of them (both in
the OPAC and STAFF interfaces).

* Calls to the unsafe ZOOM::Record->render()[1] method are removed.

Due to this last change the code for building facets was rewritten. And
for performance on the facets creation I pushed higher version
dependencies for MARC::File::XML and MARC::Record (we rely on
MARC::Field->as_string).

* Calls to MARC::Record->new_from_xml and MARC::Record->new_from_usmarc
are wrapped with eval for catching problems [2].

* As of bug 3087, UNIMARC uses the 'unimarc' record syntax. this case is
  correctly handled.
* As of bug 7818 misc/migration_tools/rebuild_zebra.pl behaves like:

- bib_index_mode (defaults to 'grs1' if not specified)
- auth_index_mode (defaults to 'dom')

here we do exactly the same.

To test:
 - prove t/db_dependent/Search.t should pass.
 - Searching should remain functional.
 - Indexing and searching for a big record should work (that's what the
   unit tests do).
 - Test an index scan search (on the staff interface):
    Search > More options > Check "Scan indexes".
 - Enable 'itemBarcodeFallbackSearch' and try to circulate any word, it
   shouldn't break.
 - Searching for a biblio in a new subscription shouldn't break.
 - Running bulkmarcimport.pl shouldn't break.
 - And so on... for the rest of the .pl files.

[1] http://search.cpan.org/~mirk/Net-Z3950-ZOOM/lib/ZOOM.pod#render()
[2] a record that cannot be parsed by MARC::Record is simply skipped (bug 10684)

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-28 19:50:09 +00:00
Jonathan Druart
7a2dec05ed Bug 11471: Display the currency for baskets in a basketgroup
On editing a basketgroup, the currency for baskets in a basketgroup is
always '0'.

With this patch, the currency is correctly displayed.

TEST PLAN
=========
 1) Log into staff client
 2) Acquisitions
 3) Click 'Search' in the 'Manage orders' box
 4) Click '+ New basket' because a vendor name
 5) Type 'Test Basket' into basket name
 6) Click 'Save'
 7) Click 'Add to basket'
 8) Click 'From an external source'
 9) Type 'Green Eggs and Ham' into the Title text box
10) Click 'Search'
11) Click 'Order' on any one of the results
12) Click 'Add Item' in the 'Item' box
13) Select a Fund from the dropdown in the
     'Accounting details' box
14) Click 'Save'
15) Click 'Close the basket'
16) Click 'Yes, close (Y)' without checking attach to a
     basket group
17) Click the 'Basket groups' tab
18) Click '+ New basket group'
19) Notice the listing in the 'Ungrouped baskets'.
20) Drag and drop the entry into the 'Baskets in this group'
     text area
21) Click 'Save'
22) Click 'Edit'
23) Notice it displays incorrectly. (e.g. Total: 0 0)
24) Apply the patch (git bz apply 11471)
25) Refresh the page
26) Notice it displays the currency correctly. (e.g. Total: 0 USD)
    NOTE: If there is a space issue, see Bug 9654.
          This can be applied separately from that bug.
27) Run the Koha QA Tool: (~/qa-test-tools/koha-qa.pl -v 2 -c 1)

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-02-21 19:41:07 +00:00
Jonathan Druart
8b685c1e80 Bug 9823: Refactor return from GetReservesFromBiblionumber
The return from GetReservesFromBiblionumber contains an unnecessary
extra variable. In scalar context an array returns its element count.
Maintaining a separate count can lead to unforeseen bugs
and imposes ugly constructions on the subroutine's users.

Remove the useless count variable from the return

This patch also changes the parameters: now the routine takes a hashref.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Placed biblio holds, future holds and item holds. Works as expected.
Tested Holds.t and Reserves.t. Pass.
Tested /cgi-bin/koha/ilsdi.pl?service=GetRecords&id=999 with two holds on
one item. Fine.
C4/SIP/ILS/Item.pm: Looked for "whatever" and "arrayref" and could not find
them anymore. Looks good.
Handled a few unneeded calls in QA follow-up.
Left only one point to-do for serials/routing-preview.pl. See Bugzilla.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-30 16:19:55 +00:00
Jonathan Druart
795421a643 Bug 11141: retain pending order filters during receiving.
On receiving orders, the librarian has to filter again the pending
orders list.

This patch stores the filters in a cookie in order to apply them when
the librarian finish a receive and come back on the pending orders list.

Test plan:
1/ choose a vendor with several baskets and orders.
2/ start to receive an item.
3/ on the pending orders page, add some relevant filters.
4/ receive an item.
5/ you are back on the pending orders page and filters are directly
applied.

Signed-off-by: Nicolas Bravais <nicolas.bravais@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Tested with receiving and cancelling the receive process the
filters are kept.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-23 16:03:49 +00:00
Mathieu Saby
59c0a0e02b Bug 11056: Delete dead code in basketgroup.pl
In basketgroup.pl, some code is supposed to be executed if
$op = "validate".  But this value is no longer assigned to
the $op variable since 2009.

This patch suppressed dead code, along with parseinputbaskets
and parseinputbasketgroups subs, which are obsolete.

No functional changes expected

Regression test :
* Check basketgroup are shown as before the patch, and can be closed
 and reopened.
* Check you can add or remove a basket from a basketgroup, and change
  information about it (like delivery place)
* Check you can create a basketgroup when you close a basket.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
The following commands return nothing:
- grep validate acqui/basketgroup.tt
- grep -R basketgroup.pl -C 2 | grep validate
- git grep parseinputbaskets
- git grep parseinputbasketgroups
- git grep basketgroup.pl | grep validate

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-17 21:17:58 +00:00
Jonathan Druart
4bd730d4c2 Bug 11018: allow adding order from a reverted MARC batch
Weird behavior:
When an import is undone into catalog, the status is set to "reverted".
But if you open the add orders from iso2709, the status is automatically
set to "imported" and does not appear in the list.
So it is not possible to import a reverted batch.

[RM note: since a reverted batch is nonetheless a staged batch, and
could be reused, allowing orders to be placed by taking bibs
from a reverted batch is not as odd as it might sound.  It *can* look
odd for a staged or reverted batch to contain records that are
imported, but that's a long-standing oddity.]

Test plan:
- verify you reproduce the weird behavior
- apply this patch
- import a file and the batch into the catalog
- verify (in the your mysql/MariaDB cli) the status is "imported"
- verify it does not appears in the add orders from iso2809 page
- undo the import
- verify (in the your mysql/MariaDB cli) the status is "reverted"
- verify it appears in the add orders from iso2809 page and the status
  is always "reverted"
- finish the order

Signed-off-by: Pierre Angot <tredok.pierre@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-17 05:32:42 +00:00
Samuel Crosby
d4daf32d1d Bug 9654: add space between amount and currency symbol in basket group display
Changed:
    $total .= $bookseller->{invoiceprice} // 0;
Into:
    $total .= " " . ($bookseller->{invoiceprice} // 0);
in order to add a space between the total and currency in
the basket group.

Revised test plan:
 1) Log into staff client
 2) Acquisitions
 3) Click 'Search' in the 'Manage orders' box.
 4) Click '+ New basket' beside a vendor name.
 5) Type 'Bug 9654 Test 1' into basket name.
 6) Click 'Save'
 7) Click 'Add to basket'
 8) Click 'From an external source'
 9) Type 'Green Eggs and Ham' into the Title text box.
10) Click 'Search'
11) Click 'Order' on any one of the results.
12) Click 'Add Item' in the 'Item' box.
13) Select a Fund from the dropdown in the
     'Accounting details' box.
14) Click 'Save'
15) Click 'Close this basket'
16) Click 'Yes, close (Y)' without checking the attach to a
     basket group.
17) Click the 'Basket groups' tab.
18) Click '+ New basket group'
19) Notice the listing in 'Ungrouped baskets' lacks a space
     between the number and the currency. (e.g. Total: 0USD)
20) Apply patch (git bz apply 9654)
21) Refresh the page
22) Notice there is now a space. (e.g. Total: 0 USD)
23) Run the Koha QA Tool: (~/qa-test-tools/koha-qa.pl -v 2 -c 1)

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-02 15:46:42 +00:00
fb4025b67b Bug 10277 - Add C4::Context->IsSuperLibrarian()
The method of checking the logged in user for superlibrarian privileges
is obtuse ( $userenv && $userenv->{flags} % 2 != 1 ) to say the least.
The codebase is littered with these lines, with no explanation given. It
would be much better if we had one subroutine that returned a boolean
value to tell us if the logged in user is a superlibrarian or not.

Test Plan:
1) Apply this patch
2) Verify superlibrarian behavior remains unchanged

Signed-off-by: Joel Sasse <jsasse@plumcreeklibrary.net>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comments on second patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 15:47:23 +00:00
Jacek Ablewicz
95e2754af6 Bug 9948: fix creation/updating of items when partially receiving an order
Problem summary: when doing partial receives for the given order -
1) if AcqCreateItem is set to 'ordering', various item data (price,
dateaccessioned, replacementprice, replacementpricedate) are getting
erroneously updated on the wrong (yet to be received == not the ones
being currently received) item records
2) if AcqCreateItem is set to 'receiving', newly received
item records are being created without the aforementioned fields
set to the proper values

This (trivial) patch should deal with both cases, hopefully without
breaking enything else.

To test:
- apply the patch,
- create some orders with 2+ quantity
- test partial & non-partial receives for those orders
- ensure the received item records are getting modified
(for AcqCreateItem set to 'ordering') and/or created (for AcqCreateItem
set to 'receiving') correctly for both partial and non-partial receives
- receiving orders with quantity = 1 / receiving orders in non-partial
mode should be still working fine for 1) & 2) scenarios (i.e.,
AcqCreateItem set to 'ordering' / AcqCreateItem set to 'receiving')

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>

Works as I'd expect now! Awesome patch.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Also: t/db_dependent/Acquisition/
      t/db_dependent/Acquisition.t

Created 2 orders with 3 items each for both settings
of AcqCreateItem (on receive, on order) with the patches
applied. No regressions found.

Closed baskets and received shipments for each, with
AcqCreateItem set according to how the order was created.

First recreated the problem without the patches, reloaded
database and confirmed that the patch fixes it.

No problems found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-23 16:02:32 +00:00