Our users really would like to have a default value for fund and item type when entering a new order instead of selecting them over and over again. The proposed patch needs one syspref containing default codes for such fields.
Created attachment 13460 [details] [review] 9088 Patch
Created attachment 13461 [details] [review] 9088 Dbrev
I applied this patch. Before the patch, when doing a new order, I have to select the item type and fund. After the patch, I set the AcqNewOrderEmptyDefaults system preference to fund=BOOKS. When I did a new order, I found that the BOOKS fund was correctly filled in by default and can still be changed if necessary using the dropdown menu of funds. However, I can't get it to work for an item type. I set AcqCreateItem to create an item when placing an order. I tried placing itemtype=BOOK in the AcqNewOrderEmptyDefaults system preference, but the y - Koha item type box is still blank by default, which means I have to choose the item type from the dropdown menu.
(In reply to comment #3) > However, I can't get it to work for an item type. I set AcqCreateItem to > create an item when placing an order. I tried placing itemtype=BOOK in the > AcqNewOrderEmptyDefaults system preference, but the y - Koha item type box > is still blank by default, which means I have to choose the item type from > the dropdown menu. Thanks for testing. I see what you mean. Note that the itemtype is filled in under Catalog details, but indeed it is not under Item. This behavior is only when AcqCreateItem=placing an order. If you set AcqCreateItem to receiving or cataloging, you will have no problems. As I see it now, the behavior under "placing an order" is another bug. Without this patch, if you enter an itemtype under Catalog details, it is ignored in the item section below it. This makes the field Itemtype under Catalog details actually useless. While searching Bugzilla, I also found a related report for "placing an order" with default values. That is bug 8307. Possibly, we can bring the functionality of these two reports together somehow.
Created attachment 14957 [details] [review] 9088 Default values for fund and item type on neworderempty form Adds a syspref AcqNewOrderEmptyDefaults containing default codes for item type and fund code. The neworderempty form checks these values for a new empty record.
Created attachment 14958 [details] [review] 9088: Default values for fund and item type on neworderempty form (dbrev) Adds pref to database for install and upgrade.
I think I'm ending up with the same questions as Melia. I see that the fund pre-select works, but I don't see how this ties in with default item type. I think what this bug really needs is a thorough test plan, otherwise we're just guessing.
Created attachment 26790 [details] [review] Bug 9088: neworderempty should preselect the only fund If there is only one fund in the select combo (and the fund is mandatory), neworderempty should just select it already. If there are more choices, behavior does not change. This patch implements this change in the template itself. Test plan: With more funds, check if neworderempty does not preselect a fund (at least when adding a line; when you modify, you should see what you had chosen). With one fund, check if it is already selected (add or modify). Toggle the setting of AcqCreateItem and check again.
I decided to simplify the approach on this report. There is no preference anymore. And we ignore itemtype now. It is just: If there is only one fund, select it rightaway.
Just wondering - couldn't you set the default itemtype in the acq framework? I think I have set that up for some libraries in the past.
(In reply to Katrin Fischer from comment #10) > Just wondering - couldn't you set the default itemtype in the acq framework? > I think I have set that up for some libraries in the past. Probably. But this report now focuses on the fund. Thanks.
Created attachment 27067 [details] [review] [SIGNED OFF] Bug 9088: neworderempty should preselect the only fund If there is only one fund in the select combo (and the fund is mandatory), neworderempty should just select it already. If there are more choices, behavior does not change. This patch implements this change in the template itself. Test plan: With more funds, check if neworderempty does not preselect a fund (at least when adding a line; when you modify, you should see what you had chosen). With one fund, check if it is already selected (add or modify). Toggle the setting of AcqCreateItem and check again. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> NOTE: I don't think AcqCreateItem affects this. However, I did toggle AcqCreateItem to 'receiving an order' from 'placing an order'. Tested before and after patch with 1 fund Tested after patch with 2 funds. Tiny patch, does what it says. Defaults fund dropdown if there is only one fund.
Hi Marcel, this doesn't seem to work for me. I have older inactive budgets, could this make the difference? The pull down correctly only shows one entry unless you tick the 'show all'.
(In reply to Katrin Fischer from comment #13) > Hi Marcel, this doesn't seem to work for me. I have older inactive budgets, > could this make the difference? The pull down correctly only shows one entry > unless you tick the 'show all'. Yes, this makes a difference. I can adjust the patch somewhat to account for that. But looking at it, I wonder: Suppose you have three funds (F1 is active, F2 and F3 are inactive). And an order is saved with F2. If you click Modify, what should you want neworderempty to do? Select F1, since it is the only active fund now? Or select F2, but mark it as inactive? And if it shows F2, should it also show F3 now right away and preselect Show all?
Hi Marcel, > Yes, this makes a difference. I can adjust the patch somewhat to account for > that. > But looking at it, I wonder: Suppose you have three funds (F1 is active, F2 > and F3 are inactive). And an order is saved with F2. > If you click Modify, what should you want neworderempty to do? Select F1, > since it is the only active fund now? Or select F2, but mark it as inactive? > And if it shows F2, should it also show F3 now right away and preselect Show > all? Hm, die we uncover another bug here? It seems one of those days... I think when modifying an existing order, it should always preselect what's in the database, even if the fund has been marked inactive since or was inactive when selected. If we need to preselect 'show all' in order to make that work, I guess we need to do that.
(In reply to Katrin Fischer from comment #15) > Hm, die we uncover another bug here? It seems one of those days... > > I think when modifying an existing order, it should always preselect what's > in the database, even if the fund has been marked inactive since or was > inactive when selected. If we need to preselect 'show all' in order to make > that work, I guess we need to do that. I was thinking in the same direction. New patch forthcoming (need to adjust a few lines more..) No need to preselect Show all btw.
Created attachment 27188 [details] [review] Bug 9088: Neworderempty should preselect the only active fund This patch makes the following changes to the template: [1] If you add an order line, and you have one active fund (and zero or more inactive funds), the only active fund is preselected. [2] If you modify an order line while its fund is inactive, it now shows the label (inactive) behind the fund name. (Note that other inactive funds may come up when clicking 'Show all' as they did before.) [3] Corrected some indentation in this template part. Test plan: [1] Add an order line while having one active fund. Is it selected? [2] Add an order line while having two or more active funds. No fund should be preselected. [3] Modify an order line with an active fund. Is it still selected? [4] Modify an order line with an inactive fund F2 (while having one active fund F1; note that this test explicitly wants F1 to be before F2). Check if F2 is selected and is labeled inactive. [5] (Bonus points:) Modify an order line that refers to a deleted fund. If you edit this order, the fund combo should say: Select a fund. (Note: if you delete a fund, the budget_id in aqorders remains.)
Created attachment 27191 [details] [review] Bug 9088: Neworderempty should preselect the only active fund This patch makes the following changes to the template: [1] If you add an order line, and you have one active fund (and zero or more inactive funds), the only active fund is preselected. [2] If you modify an order line while its fund is inactive, it now shows the label (inactive) behind the fund name. (Note that other inactive funds may come up when clicking 'Show all' as they did before.) [3] Corrected some indentation in this template part. Test plan: [1] Add an order line while having one active fund. Is it selected? [2] Add an order line while having two or more active funds. No fund should be preselected. [3] Modify an order line with an active fund. Is it still selected? [4] Modify an order line with an inactive fund F2 (while having one active fund F1; note that this test explicitly wants F1 to be before F2). Check if F2 is selected and is labeled inactive. [5] (Bonus points:) Modify an order line that refers to a deleted fund. If you edit this order, the fund combo should say: Select a fund. (Note: if you delete a fund, the budget_id in aqorders remains.)
Couldn't resist adjusting indentation in the commit message too :)
Comment on attachment 27191 [details] [review] Bug 9088: Neworderempty should preselect the only active fund Review of attachment 27191 [details] [review]: ----------------------------------------------------------------- ::: koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ +425,5 @@ > + [% FOREACH budget_loo IN budget_loop %] > + <option value="[% budget_loo.b_id %]" > + [% IF budget_loo.b_sel %] > + [% active_count = 0 #select no other fund %] > + selected="selected" Sorry, but this violates HTML1 in the coding guidelines. http://wiki.koha-community.org/wiki/Coding_Guidelines#HTML1:_Template_Toolkit_markup_inside_HTML
Sorry, but guidelines should be followed. :(
(In reply to M. Tompsett from comment #21) > Sorry, but guidelines should be followed. :( At least in this case. Have to repeat the option tag now a few times in the if-then-else of the new patch. Slightly less readable. (Also stumbled about the selected attribute; too bad you can't say selected="" when you do not want to select..)
Created attachment 27712 [details] [review] Bug 9088: Neworderempty should preselect the only active fund This patch makes the following changes to the template: [1] If you add an order line, and you have one active fund (and zero or more inactive funds), the only active fund is preselected. [2] If you modify an order line while its fund is inactive, it now shows the label (inactive) behind the fund name. (Note that other inactive funds may come up when clicking 'Show all' as they did before.) [3] Corrected some indentation in this template part. Test plan: [1] Add an order line while having one active fund. Is it selected? [2] Add an order line while having two or more active funds. No fund should be preselected. [3] Modify an order line with an active fund. Is it still selected? [4] Modify an order line with an inactive fund F2 (while having one active fund F1; note that this test explicitly wants F1 to be before F2). Check if F2 is selected and is labeled inactive. [5] (Bonus points:) Modify an order line that refers to a deleted fund. If you edit this order, the fund combo should say: Select a fund. (Note: if you delete a fund, the budget_id in aqorders remains.)
Created attachment 28043 [details] [review] Bug 9088: Neworderempty should preselect the only active fund This patch makes the following changes to the template: [1] If you add an order line, and you have one active fund (and zero or more inactive funds), the only active fund is preselected. [2] If you modify an order line while its fund is inactive, it now shows the label (inactive) behind the fund name. (Note that other inactive funds may come up when clicking 'Show all' as they did before.) [3] Corrected some indentation in this template part. Test plan: [1] Add an order line while having one active fund. Is it selected? [2] Add an order line while having two or more active funds. No fund should be preselected. [3] Modify an order line with an active fund. Is it still selected? [4] Modify an order line with an inactive fund F2 (while having one active fund F1; note that this test explicitly wants F1 to be before F2). Check if F2 is selected and is labeled inactive. [5] (Bonus points:) Modify an order line that refers to a deleted fund. If you edit this order, the fund combo should say: Select a fund. (Note: if you delete a fund, the budget_id in aqorders remains.)
I test against master 3.15.00.051 I test against all the three options of the AcqCreateItem, : placing an order receiving an order cataloging the record All is OK. I pass the patch to "Signed Off" status.
Created attachment 28142 [details] [review] Bug 9088: Neworderempty should preselect the only active fund This patch makes the following changes to the template: [1] If you add an order line, and you have one active fund (and zero or more inactive funds), the only active fund is preselected. [2] If you modify an order line while its fund is inactive, it now shows the label (inactive) behind the fund name. (Note that other inactive funds may come up when clicking 'Show all' as they did before.) [3] Corrected some indentation in this template part. Test plan: [1] Add an order line while having one active fund. Is it selected? [2] Add an order line while having two or more active funds. No fund should be preselected. [3] Modify an order line with an active fund. Is it still selected? [4] Modify an order line with an inactive fund F2 (while having one active fund F1; note that this test explicitly wants F1 to be before F2). Check if F2 is selected and is labeled inactive. [5] (Bonus points:) Modify an order line that refers to a deleted fund. If you edit this order, the fund combo should say: Select a fund. (Note: if you delete a fund, the budget_id in aqorders remains.) Signed-off-by: Paola Rossi <paola.rossi@cineca.it> I test against master 3.15.00.051 I test against all the three options of the AcqCreateItem: placing an order receiving an order cataloging the record All is OK.
(In reply to Paola Rossi from comment #25) > I test against master 3.15.00.051 > > I test against all the three options of the AcqCreateItem, : > placing an order > receiving an order > cataloging the record > > All is OK. > > I pass the patch to "Signed Off" status. Thanks, Paola. I added your signoff line to the patch.
Created attachment 28291 [details] [review] [PASSED QA] Bug 9088: Neworderempty should preselect the only active fund This patch makes the following changes to the template: [1] If you add an order line, and you have one active fund (and zero or more inactive funds), the only active fund is preselected. [2] If you modify an order line while its fund is inactive, it now shows the label (inactive) behind the fund name. (Note that other inactive funds may come up when clicking 'Show all' as they did before.) [3] Corrected some indentation in this template part. Test plan: [1] Add an order line while having one active fund. Is it selected? [2] Add an order line while having two or more active funds. No fund should be preselected. [3] Modify an order line with an active fund. Is it still selected? [4] Modify an order line with an inactive fund F2 (while having one active fund F1; note that this test explicitly wants F1 to be before F2). Check if F2 is selected and is labeled inactive. [5] (Bonus points:) Modify an order line that refers to a deleted fund. If you edit this order, the fund combo should say: Select a fund. (Note: if you delete a fund, the budget_id in aqorders remains.) Signed-off-by: Paola Rossi <paola.rossi@cineca.it> I test against master 3.15.00.051 I test against all the three options of the AcqCreateItem: placing an order receiving an order cataloging the record All is OK. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Pushed to master. Thanks, Marcel!