Bug 6832

Summary: Validation of total > budget in neworderempty
Product: Koha Reporter: Maxime Pelletier <pelletiermaxime>
Component: AcquisitionsAssignee: Maxime Pelletier <pelletiermaxime>
Status: RESOLVED DUPLICATE QA Contact: Bugs List <koha-bugs>
Severity: major    
Priority: P2 CC: chris, jonathan.druart, mtj, simith.doliveira, veron
Version: 3.8   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: [PATCH] Fix multiple bugs and refactor the code to fix the alert of the total exceeding the budget in neworderempty
Working patch for 3.6
Patch for bug 6832 to fix the ajax validation of exceed budget in new orders, reworked for 3.6.
new patch tested on 3.8.2
[SIGNED-OFF] Fix l'alerte ajax dans la création d'achat lorsque le montant dépasse celui du budget.
Fix Validation of total higher as budget in neworderempty

Description Maxime Pelletier 2011-09-01 19:55:36 UTC Comment hidden (obsolete)
Comment 1 Maxime Pelletier 2011-10-25 19:14:36 UTC
Working on a patch that works on 3.6 and that change the feauture to use non blocking alerts.
Comment 2 Maxime Pelletier 2011-10-25 19:28:15 UTC Comment hidden (obsolete)
Comment 3 Chris Cormack 2011-12-19 07:04:38 UTC
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.
Comment 4 Chris Cormack 2011-12-20 22:09:27 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2011-12-31 07:23:51 UTC
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!
Comment 6 Maxime Pelletier 2012-07-03 21:25:48 UTC Comment hidden (obsolete)
Comment 7 Maxime Pelletier 2012-07-03 21:26:47 UTC
Problem is still in 3.8.2, so here's a new patch for that version.
Sponsored by the Koha-CCSR community.
Comment 8 Marc Véron 2012-07-30 18:37:53 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2012-08-01 09:50:17 UTC
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 ;-)
Comment 10 Katrin Fischer 2012-08-01 09:55:43 UTC
Hi Jonathan, 
this patch will apply if you change the patch file and remove one line:
Content-Type: text/plain; charset="utf-8"
Comment 11 Marc Véron 2012-08-07 16:32:41 UTC
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
Comment 12 Marc Véron 2012-08-07 16:54:28 UTC
Did a short test with new patch. Works as expected. 
I sign off again.
Comment 13 Jonathan Druart 2012-08-09 08:31:38 UTC
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 ?).
Comment 14 Jonathan Druart 2012-08-09 08:32:14 UTC
Hum... In fact, it is the current behaviour in master !
Do you confirm it is what we want ?
Comment 15 Maxime Pelletier 2012-08-09 17:52:39 UTC
(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 ?
Comment 16 Mason James 2012-08-10 04:10:52 UTC
(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'...
Comment 17 Jonathan Druart 2012-08-10 08:19:28 UTC
(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.
Comment 18 simith.doliveira 2015-01-13 17:19:18 UTC
Bugzilla – Bug 9822 fix the problem

*** This bug has been marked as a duplicate of bug 9822 ***