View | Details | Raw Unified | Return to bug 6832
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js (-23 / +13 lines)
Lines 752-781 for (i=1;i<=2;i++) { Link Here
752
752
753
//USED BY NEWORDEREMPTY.PL
753
//USED BY NEWORDEREMPTY.PL
754
function totalExceedsBudget(budgetId, total) {
754
function totalExceedsBudget(budgetId, total) {
755
755
    budgetTotal = 0;
756
    var xmlhttp = null;
756
    $.ajax({
757
    xmlhttp = new XMLHttpRequest();
757
        url: "/cgi-bin/koha/acqui/check_budget_total.pl",
758
    if ( typeof xmlhttp.overrideMimeType != 'undefined') {
758
        async:false,
759
        xmlhttp.overrideMimeType('text/xml');
759
        method: "post",
760
    }
760
        data: {budget_id : budgetId, total : total},
761
761
        success: function(actTotal) {
762
    var url = '../acqui/check_budget_total.pl?budget_id=' + budgetId + "&total=" + total;
762
            actTotal = Math.abs(actTotal);
763
    xmlhttp.open('GET', url, false);
763
            exceeds = (actTotal < Math.abs(total))
764
    xmlhttp.send(null);
764
            if (exceeds)
765
765
                budgetTotal = actTotal;
766
    xmlhttp.onreadystatechange = function() {
767
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
768
769
            actTotal = eval ( xmlhttp.responseText );
770
771
            if (  Math.abs(actTotal) < Math.abs(total)  ) {
772
            // if budget is to low :(
773
                return true ;
774
            } else {
775
                return false;
776
            }
777
        }
766
        }
778
    }
767
    });
768
    return budgetTotal;
779
}
769
}
780
770
781
771
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl (-2 / +1 lines)
Lines 34-40 function Check(ff) { Link Here
34
                    _alertString += "\n- " + _("Total must be a number");
34
                    _alertString += "\n- " + _("Total must be a number");
35
    }
35
    }
36
36
37
    if (totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
37
    if (actTotal = totalExceedsBudget(ff.budget_id.value, ff.total.value  )  ) {
38
        ok=1;
38
        ok=1;
39
        _alertString += "\n- " + _("Order total (") + ff.total.value +
39
        _alertString += "\n- " + _("Order total (") + ff.total.value +
40
            _(") exceeds budget available (") + actTotal+")";
40
            _(") exceeds budget available (") + actTotal+")";
41
- 

Return to bug 6832