Created attachment 5264 [details] [review] [PATCH] Fix multiple bugs and refactor the code to fix the alert of the total exceeding the budget in neworderempty The javascript function totalExceedsBudget never returns anything. Refactored it to use jQuery for the ajax stuff and to make it work. Only 1 line changed in a tmpl, so should be easy to adapt for 3.4. Steps to reproduce : Create a new order in a basket. Set a total higher than the total of the selected budget. You will see an ajax request, but no error. This patch fixes the return, make it work for ie6 by using jQuery and prints correctly the total of the budget in the error.
Working on a patch that works on 3.6 and that change the feauture to use non blocking alerts.
Created attachment 6058 [details] [review] Working patch for 3.6 Here's a new patch based on 3.6 and that shows a confirm() instead of an alert so that users can choose to save even if they exceed the budget.
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/acqui/neworderempty.tt CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt Failed to merge in the changes. Patch failed at 0001 Patch for bug 6832 to fix the ajax validation of exceed budget in new orders, reworked for 3.6.
Created attachment 6895 [details] [review] Patch for bug 6832 to fix the ajax validation of exceed budget in new orders, reworked for 3.6.
Hi Maxime, I tried testing this, my settings are: - Create items on order - Used a fund on 3 level of the budget hierarchy - Put in a price way over the limit for that fund - No alert showed up and I could save the order without any message Do you have an idea what went wrong here? I would really like to see that fixed!
Created attachment 10631 [details] [review] new patch tested on 3.8.2
Problem is still in 3.8.2, so here's a new patch for that version. Sponsored by the Koha-CCSR community.
Created attachment 11209 [details] [review] [SIGNED-OFF] Fix l'alerte ajax dans la création d'achat lorsque le montant dépasse celui du budget. http://bugs.koha-community.org/show_bug.cgi?id=6832 Signed-off-by: Marc Veron <veron@veron.ch> Tested on master. Create a new order in a basket and changed existing order as well with total higher than the total of the selected budget. Patch behaves as expected.
The proposed patch does not apply : fatal: cannot convert from UTF-8utf-8 to UTF-8 Please resubmit this patch well formated. On the way, replace the french commit message ;-)
Hi Jonathan, this patch will apply if you change the patch file and remove one line: Content-Type: text/plain; charset="utf-8"
Created attachment 11425 [details] [review] Fix Validation of total higher as budget in neworderempty I downloaded the patch, removed the line following Katrins advice, changed Maximes French text to English and uploaded the patch. Hope this works. Marc
Did a short test with new patch. Works as expected. I sign off again.
QA Comments: It seems the patch does not work as expected. I think your ajax script must to return $budget->{budget_amount} - C4::Budgets::GetBudgetSpent($budget->{id}) (or GetBudgetOrdered ?).
Hum... In fact, it is the current behaviour in master ! Do you confirm it is what we want ?
(In reply to comment #13) > QA Comments: > > It seems the patch does not work as expected. > I think your ajax script must to return $budget->{budget_amount} - > C4::Budgets::GetBudgetSpent($budget->{id}) (or GetBudgetOrdered ?). My patch doesn't change the behavior of acqui/check_budget_total.pl at all, so i'm really not sure what you are talking about. Could you explain in more details ?
(In reply to comment #15) > (In reply to comment #13) > > QA Comments: > > > > It seems the patch does not work as expected. > > I think your ajax script must to return $budget->{budget_amount} - > > C4::Budgets::GetBudgetSpent($budget->{id}) (or GetBudgetOrdered ?). > > My patch doesn't change the behavior of acqui/check_budget_total.pl at all, > so i'm really not sure what you are talking about. Could you explain in more > details ? changing status to 'in discussion'...
(In reply to comment #15) > (In reply to comment #13) > > QA Comments: > > > > It seems the patch does not work as expected. > > I think your ajax script must to return $budget->{budget_amount} - > > C4::Budgets::GetBudgetSpent($budget->{id}) (or GetBudgetOrdered ?). > > My patch doesn't change the behavior of acqui/check_budget_total.pl at all, > so i'm really not sure what you are talking about. Could you explain in more > details ? The ajax script returns $budget->{'budget_amount'}. In the tt/js code an alert appears if the total for the current order is > the amount of the selected budget. Suppose a budget A is created with 100€ and 90€ are already spent then we have a "base-level remaining" equal to 10€. If I create, for example, an order with this budget and a total cost = 40, the script does not display the alert. But the order amount is > to the amount remaining. Then I think the alert should not take into account the total budget allocated but the base-level remaining.
Bugzilla – Bug 9822 fix the problem *** This bug has been marked as a duplicate of bug 9822 ***