This enhancement will permit to set a default tax rate for item types.
Created attachment 31863 [details] [review] Bug 12993: Add a default tax rate on item types This enhancement permits to set a default tax rate for item types. If a default tax rate is defined for an item type, the tax rate will be automatically selected when the librarian choose the type of the item to order. Test plan: 0/ Execute the updatedb entry. 1/ Define a default tax rate for some item types. 2/ Create an order and verify the tax rate is selected after you have chosen the item type. Note that the item type is only displayed if defined at the biblio level.
I've applied the patch against master 3.17.00.025 I've set some values in the gist system pref. Then, editing an itemtype, I could select a tax rate value in the drop down list of "Tax rate" field, but, after saving changes, the tax rate value was not recorded to the itemtype in the DB. The patch is lacking in adding the "gstrate" field to the itemtypes DB-table. [The patch gives no updatedatabase.pl' diffs (at least).] So I pass the patch to "Failed QA" status.
Created attachment 32018 [details] [review] Bug 12993: Add a default tax rate on item types - DB changes This patch adds a new DB field: itemtypes.gstrate
Sorry Paola, I forgot to attach the DB changes patch.
Thanks, Jonathan. I've tested adding orders from existing record and from subscription, and it's OK. But from suggestion it is not OK: the document type of a suggestion has recently become mandatory, and so this is an error. So I pass the patch to "Failed QA" status. [Some problems could be from staged file, too. But perhaps the tool "Stage MARC records for import" might have an error in recognizing the document type of the input record biblio (942$c subfield). The tool should do it (see the "Match type" column in the table at the bottom of "Manage staged MARC records", on tols/manage-marc-import.pl?import_batch_id, after having "uploaded" and "Staged for import". If the tool has this error, no test here for 12933.] Ordering "From an external source" doesn't assign the document type of the source to the order: the user has to use cataloguing to assign the 942$c subfield, so he should exit from ordering' path. So no test here. And ordering "From a new (empty) record" is the same.
(In reply to Paola Rossi from comment #5) This works only on the neworderempty.pl script. So if you order from a suggestion, suscription, new record, existing record. It looks to work for all of these cases. I tried for a suggestion and if I change the value of the itemtype dropdown-list, the vat value is updated.
Hi, Jonathan. My results didn't match your observations in comment 6, so I've made some further tests. I've applied the patches. On ADMIN in "Item Types" I set "Tax rate" of Book to 5% On ADMIN I set the system pref gist to: 0.10|0|0.05|0.23 [As ADMIN says: "First is the default."] The vendor was configured 0-0, and his tax rate was set to 23%. [I kept the system pref "AcqCreateItem" to default value "placing an order".] The patches worked perfectly well in these 4 cases: A) ordering from an existing record: On a BK biblio record I _immediately_ saw 5% in the tax rate of the "Accounting details" in the "New order" page (RIGHT just as required, I think). And, on a biblio record with none itemtype, I _immediately_ saw 23% there (RIGHT, I also think) B) ordering from a subscription C) ordering from a staged file: the neworderempty.pl script is used by way of the link "Add order", at the right of the uploaded-and-staged-file's titles, in the tag "Select to import" under "Add orders from (name of my file)" D) ordering from titles with highest hold ratios. Ordering from a BK suggestion [or from an empty record] I've seen 23% in the tax rate of the order: it's the vendor' tax rate, instead of the expected tax rate 5% of the BK' itemtype (ERROR). Where have I been wrong, please? Did I forget anything? I beg your pardon, but I should pass the patch to "Failed QA" status for now. [Perhaps is there anything missing in the patches? there is nothing about neworderempty.pl, I see] I've a lot of doubts. Note that a suggestion has no corresponding biblio record in the DB until it has been ordered. So I ask myself how the neworderempty.pl script can find an "itemtype at the biblio level" ordering from a suggestion. [Anyway, I didn't find a way in koha to create a suggestion together with a biblio record: neither from ACQ nor from OPAC]. I'm in doubt: are we into the test for 12993 or not? Moreover, the order had shown the suggestion' price very well in "Accounting details"! If we're into the 12993 test, couldn't the suggestion's itemtype have been read by the same way? It's not a biblio level' itemtype, as you required, but it seems to me being no other way to have an itemtype for a BK suggestion. In case, I invite you to let me know the steps of your test on suggestion, please. ------------------------------------------------------------
(In reply to Paola Rossi from comment #7) > Ordering from a BK suggestion [or from an empty record] I've seen 23% in the > tax rate of the order: it's the vendor' tax rate, instead of the expected > tax rate 5% of the BK' itemtype (ERROR). I think this is due to the fact that suggestion's itemtype is not being selected automatically. I'll provide a patch for that.
Created attachment 32284 [details] [review] Bug 12993: Select automatically itemtype on neworderempty.pl
Could you test it again ? Note that it works only when syspref item-level_itypes is OFF ("Use the item type of the biblio record").
I've applied the 3 patches against master 3.17.00.027 . Now ordering "from suggestion" and ordering "from a new (empty) record" let me see and set the type of the document! Thanks, Julian. On ADMIN in "Item Types" I've set: "Tax rate" of Book to 5% "Tax rate" of Serial to 7% "Tax rate" has been kept "none" elsewhere. On ADMIN I set the syspref "gist" to: "0.10|0|0.05|0.07|0.23" [As ADMIN says: "First is the default."] I set the syspref "item-level_itypes" to "biblio record", as you've kindly indicated. The vendor was configured 0-0, and his tax rate was set to 23%. [I kept the syspref "AcqCreateItem" to default value "placing an order".] 1) I was ordering music from a suggestion [or a new empty record]. On the page of neworderempty.pl the item-type default has been set to Book. So the default value is set to 5%, as on ADMIN (RIGHT). So I changed the type to music, but the 5% has been kept (ERROR): it happened because the music's biblio level item-type was set to none on ADMIN. If I changed the type to serial, and then to music, the music's tax rate was another one, 7% (ERROR). In spite of 5% or 7%, the value I expected was 23%, the vendor's default tax rate, as if I ordered "from existing" music. 2) I ordered "from an external source", so using "neworderempty.pl". The shown tax rate was 23%, the vendor's default tax rate (RIGHT, I think). No item type's dropdown list was available here for the document. Perhaps could item type's dropdown list be added, like in the suggestion's case or in the empty record's case? For 1) I pass the patches to "Failed QA" status.
(In reply to Paola Rossi from comment #11) > For 1) I pass the patches to "Failed QA" status. Paola, thanks for testing. What you described is the expected behavior.
Created attachment 33305 [details] [review] 31863: Bug 12993: Add a default tax rate on item types I've applied the patch against master 3.17.00.046 HEAD 11425. On ADMIN the syspref "item-level_itypes" has been set to "biblio record". Everything is OK ordering from a suggestion, suscription, new record, existing record, as required. So I pass the patch to "Signed Off" status.
Created attachment 33306 [details] [review] 32018: Bug 12993: Add a default tax rate on item types - DB changes
Created attachment 33307 [details] [review] Bug 12993: Select automatically itemtype on neworderempty.pl
Note for later: Add bug number to datebase update message
Created attachment 34797 [details] [review] Bug 12993: Add a default tax rate on item types - DB changes This patch adds a new DB field: itemtypes.gstrate Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
(In reply to Katrin Fischer from comment #16) > Note for later: Add bug number to datebase update message Done.
QA Comment: Tax rate: no default This is a confusing term. Would something like manual be better? Or a word that expresses that it is a different/deviating rate than those in the table (read: preference)? If you have item-level_itypes==biblio, the selection seems to work. If you have item-level_itypes==item, the situation is confusing. The first rate of the pref is selected (fine). But I save my first item, I would expect that it would update my tax rate (at least the first time). It does not. I understand that if you add another item of another type, you cannot make a choice. You could choose for defaulting to the rate of the first item. When I set AcqCreateItem <> ordering, the situation is still different. You have no items/item types. So no defaults. My conclusion is that adding this rate to the item type page in Administration promises much, but does not bring that much. Note that the item type page does not tell you that filling the tax rate is only useful when you item-level_itypes==biblio and AcqCreateItem == ordering. Perhaps you should tell that or only show them in that case? I am moving this report to FQA for this functional perspective. This still needs some attention imo before pushing it to master.
(In reply to M. de Rooy from comment #19) > Tax rate: no default > This is a confusing term. Would something like manual be better? Or a word > that expresses that it is a different/deviating rate than those in the table > (read: preference)? Please add how this would work given the context.
Created attachment 35394 [details] [review] Bug 12993: (qa-follow-up) Display the column only when it is useful As mention by comment 19, the default tax rate defined for item types is only useful when the items are created on ordering and the item type is defined at the biblio level.
(In reply to M. de Rooy from comment #19) Hi Marcel, Yes you are right, this development only works if the item types are defined at the biblio level and if the items are created on ordering. The last patch removes the column in other cases.
Sorry, did not apply: Applying: Bug 12993: Add a default tax rate on item types Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt Auto-merging admin/itemtypes.pl Applying: Bug 12993: Select automatically itemtype on neworderempty.pl Applying: Bug 12993: Add a default tax rate on item types - DB changes Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging installer/data/mysql/updatedatabase.pl CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl Auto-merging installer/data/mysql/kohastructure.sql Failed to merge in the changes. Patch failed at 0001 Bug 12993: Add a default tax rate on item types - DB changes
Created attachment 39566 [details] [review] Bug 12993: Add a default tax rate on item types This enhancement permits to set a default tax rate for item types. If a default tax rate is defined for an item type, the tax rate will be automatically selected when the librarian choose the type of the item to order. Test plan: 0/ Execute the updatedb entry. 1/ Define a default tax rate for some item types. 2/ Create an order and verify the tax rate is selected after you have chosen the item type. Note that the item type is only displayed if defined at the biblio level. Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Created attachment 39567 [details] [review] Bug 12993: Select automatically itemtype on neworderempty.pl Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Created attachment 39568 [details] [review] Attachment to Bug 12993 - Add a default tax rate on item types Bug 12993: Add a default tax rate on item types - DB changes This patch adds a new DB field: itemtypes.gstrate Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Created attachment 39569 [details] [review] Bug 12993: (qa-follow-up) Display the column only when it is useful As mention by comment 19, the default tax rate defined for item types is only useful when the items are created on ordering and the item type is defined at the biblio level.
If I go to koha/admin/itemtypes.pl I get: Software error: Template process failed: file error - parse error - /home/putti/kohaclone/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt line 197: unexpected token (eq) [% IF Koha.Preference('AcqCreateItem') eq 'ordering' and Koha.Preference('item-level_itypes') eq '0' %] at /home/putti/kohaclone/C4/Templates.pm line 121.
The 3 occurrences of + [% IF Koha.Preference('AcqCreateItem') eq 'ordering' and Koha.Preference('item-level_itypes') eq '0' %] should be s/eq/==
Created attachment 45538 [details] [review] Bug 12993: Add a default tax rate on item types This enhancement permits to set a default tax rate for item types. If a default tax rate is defined for an item type, the tax rate will be automatically selected when the librarian choose the type of the item to order. Test plan: 0/ Execute the updatedb entry. 1/ Define a default tax rate for some item types. 2/ Create an order and verify the tax rate is selected after you have chosen the item type. Note that the item type is only displayed if defined at the biblio level. Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Created attachment 45539 [details] [review] Bug 12993: Select automatically itemtype on neworderempty.pl Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Created attachment 45540 [details] [review] Bug 12993: Add a default tax rate on item types - DB changes This patch adds a new DB field: itemtypes.gstrate Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Created attachment 45541 [details] [review] Bug 12993: (qa-follow-up) Display the column only when it is useful As mention by comment 19, the default tax rate defined for item types is only useful when the items are created on ordering and the item type is defined at the biblio level.
Created attachment 45542 [details] [review] Bug 12993: Fix operator errors in itemtypes.tt
Created attachment 45543 [details] [review] Bug 12993: Add gstrate in itemtypes form and table
Could you please rebase?