In 'neworderempty' and 'addorederis2709', changing fund will call the ajax function 'fetchSortDropbox' (acq.js). If fund selected has a defined authorized value for statistic field 'sort1', a combo-box is displayed for this field (idem for sort2). Bug is that when switching from a found with authorized value to one without authorized value, statistic field is an empty combo-box instead of a free text input. Also, permission on fetch_sort_dropbox.pl was 'edit_catalogue'. I set it to 'order_manage', the same has 'neworderempty.pl' and 'addorederis2709.pl'. I added a behavior : when statistic field is already a free text input and fund selected is without authorized value, the field is not modified to preserve its value.
Created attachment 11575 [details] [review] Proposed patch Proposed patch. Now fetchSortDropbox() replaces entire existing statistic field (select or input) by a select or an input. So fetch_sort_dropbox.pl returns an entire select or input. Test plan : ----------- Create a fund with authorized values for statistics : "foundwith". Create a fund without authorized values for statistics : "foundwithout". In a acquisition basket : For both order creation/edition : "from a new (empty) record" and "from a staged file" : Create a new order. => statistic fields will be free text boxes. Select "foundwith" fund. => statistic fields turns to combo-boxes. Select "foundwithout" fund. => statistic fields turns to free text boxes. Enter a value in statistic fields. Save the order. Modify it. => the statistic values are well saved. Select "foundwith" fund. Select values for statistic fields. Save the order. Modify it. => the statistic values are well saved.
Created attachment 11602 [details] [review] [SIGNED-OFF] Bug 8629: update of statistics fields on fund selection in order creation/edition Signed-off-by: Marc Veron <veron@veron.ch> Followed test plan in comment #1 Behaves as described in the test plan. Useful feature!
(In reply to comment #2) > Created attachment 11602 [details] [review] > [SIGNED-OFF] Bug 8629: update of statistics fields on fund selection in > order creation/edition > > Signed-off-by: Marc Veron <veron@veron.ch> > > Followed test plan in comment #1 > Behaves as described in the test plan. > Useful feature! patch looks good, passing QA... $ koha-qa.pl -c testing 1 commit(s) (applied to commit 60790d0) * 2ffc88c Bug 8629: update of statistics fields on fund selection in order acqui/addorderiso2709.pl acqui/fetch_sort_dropbox.pl acqui/neworderempty.pl koha-tmpl/intranet-tmpl/prog/en/js/acq.js koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt * acqui/addorderiso2709.pl OK * acqui/fetch_sort_dropbox.pl OK * acqui/neworderempty.pl OK * koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt OK * koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt OK
Patch pushed to master
Pushed to 3.8.x will be in 3.8.6