When editing a basket group the selected options for delivery address don't match what's saved in the database. To reproduce: 1) Create a new basket group, set delivery place to "-" 2) Add a delivery address in the text box. 3) Save. 4) Edit basket group - delivery place is set to my current branch instead of "-" Comment from Fridolyn on this behaviour (bug 7996): Creating a new basketgroup and editing one uses the same page and operation : acqui/basketgroup.pl?op=add&booksellerid=x&basketgroupid=x So when you edit an existing basketgroup, selected branches are librarian branch.
There should definitly be a syspref for choosing if we want to take the branch of the user, or the branch of the basket! Mathieu
I see the current behaviour as a bug. If I select a specific value and save that, Koha should respect that and on edit show what has been selected before and saved to the database.
Actually the code confirms it's a feature: # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data The following code could do the trick, but not sure if it's needed % git diff diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 9c57f69..b3fa964 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -254,12 +254,12 @@ if ( $op eq "add" ) { $freedeliveryplace = $basketgroup->{freedeliveryplace}; $template->param( closedbg => ($basketgroup ->{'closed'}) ? 1 : 0); } else { + # determine default billing and delivery places depending on librarian homebranch + my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) ); + $billingplace = $borrower->{'branchcode'}; + $deliveryplace = $borrower->{'branchcode'}; $template->param( closedbg => 0); } - # determine default billing and delivery places depending on librarian homebranch and existing basketgroup data - my $borrower = GetMember( ( 'borrowernumber' => $loggedinuser ) ); - $billingplace = $billingplace || $borrower->{'branchcode'}; - $deliveryplace = $deliveryplace || $borrower->{'branchcode'}; my $branches = C4::Branch::GetBranchesLoop( $billingplace ); $template->param( billingplaceloop => $branches ); On the other hand I agree the behavior is odd :)
Hi Jonathan, I'd agree to 'feature' if it only preselected before saving it the first time - but it should display what is saved in the database when you open it again later - even if I have left the field empty on purpose.
Otherwise... we should not offer the empty option in the first place! :)
Created attachment 95622 [details] [review] Bug 9993: On editing basket group delivery place resets to logged in branch Bug 9993: On editing basket group delivery place resets to logged in branch This patch modifies basketgroups.pl so that existing data about a basket group's billing and delivery place are correctly pre-selected in the edit form. These fields shouldn't reset to the logged-in user's home branch just because they have an empty value. To test, apply the patch and go to Acquisitions -> Vendor -> Basket groups. When adding or editing a basket group the pre-selected value for "Billing place" and "Delivery place" should be correct: - When creating a new basket group: The logged-in user's library should be pre-selected. - When editing a basket group which has a library defined for either the billing or delivery places, the correct library should be pre-selected. - When editing a basket group which has no library defined for either the billing or delivery place there should be no library pre-selected (the "--" option should be pre-selected).
Hi Owen, something seems to have gone wrong with the patch file - can you have a look please?
Created attachment 95821 [details] [review] Bug 9993: On editing basket group delivery place resets to logged in branch This patch modifies basketgroups.pl so that existing data about a basket group's billing and delivery place are correctly preselected in the edit form. These fields shouldn't reset to the logged-in user's home branch just because they have an empty value. To test, apply the patch and go to Acquisitions -> Vendor -> Basket groups. When adding or editing a basket group the pre-selected value for "Billing place" and "Delivery place" should be correct: - When creating a new basket group: The logged-in user's library should be pre-selected. - When editing a basket group which has a library defined for either the billing or delivery places, the correct library should be pre-selected. - When editing a basket group which has no library defined for either the billing or delivery place there should be no library pre-selected (the "--" option should be pre-selected).
Created attachment 98269 [details] [review] Bug 9993: On editing basket group delivery place resets to logged in branch This patch modifies basketgroups.pl so that existing data about a basket group's billing and delivery place are correctly preselected in the edit form. These fields shouldn't reset to the logged-in user's home branch just because they have an empty value. To test, apply the patch and go to Acquisitions -> Vendor -> Basket groups. When adding or editing a basket group the pre-selected value for "Billing place" and "Delivery place" should be correct: - When creating a new basket group: The logged-in user's library should be pre-selected. - When editing a basket group which has a library defined for either the billing or delivery places, the correct library should be pre-selected. - When editing a basket group which has no library defined for either the billing or delivery place there should be no library pre-selected (the "--" option should be pre-selected). Signed-off-by: David Nind <david@davidnind.com>
Created attachment 98364 [details] [review] Bug 9993: On editing basket group delivery place resets to logged in branch This patch modifies basketgroups.pl so that existing data about a basket group's billing and delivery place are correctly preselected in the edit form. These fields shouldn't reset to the logged-in user's home branch just because they have an empty value. To test, apply the patch and go to Acquisitions -> Vendor -> Basket groups. When adding or editing a basket group the pre-selected value for "Billing place" and "Delivery place" should be correct: - When creating a new basket group: The logged-in user's library should be pre-selected. - When editing a basket group which has a library defined for either the billing or delivery places, the correct library should be pre-selected. - When editing a basket group which has no library defined for either the billing or delivery place there should be no library pre-selected (the "--" option should be pre-selected). Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Reported this in 2013 - so happy to see it fixed!
Nice work everyone! Pushed to master for 20.05
Pushed to 19.11.x branch for 19.11.03
backported to 19.05.x for 19.05.08
Backported to 18.11.x for 18.11.14