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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc (-7 lines)
Lines 1-10 Link Here
1
<script type="text/javascript">//<![CDATA[
2
    $(document).ready(function() {
3
        var path = location.pathname.substring(1);
4
        $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold');
5
    });
6
//]]>
7
</script>
8
<div id="navmenu">
1
<div id="navmenu">
9
    <div id="navmenulist">
2
    <div id="navmenulist">
10
        <h5>Acquisitions</h5>
3
        <h5>Acquisitions</h5>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (+1 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration</title>
4
<title>Koha &rsaquo; Administration</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-144 / +142 lines)
Lines 1-6 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE Price %]
2
[% USE Price %]
3
3
[% SET footerjs = 1 %]
4
[%- BLOCK action_menu %]
4
[%- BLOCK action_menu %]
5
    <div class="dropdown">
5
    <div class="dropdown">
6
        <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
6
        <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
Lines 33-184 Link Here
33
[% END -%]
33
[% END -%]
34
34
35
[% INCLUDE 'doc-head-open.inc' %]
35
[% INCLUDE 'doc-head-open.inc' %]
36
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
37
[% INCLUDE 'doc-head-close.inc' %]
36
[% INCLUDE 'doc-head-close.inc' %]
38
[% INCLUDE 'calendar.inc' %]
37
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
39
[% INCLUDE 'datatables.inc' %]
40
[% IF close_form %]
38
[% IF close_form %]
41
    <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
39
    <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
42
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
43
[% END %]
40
[% END %]
44
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
45
<script type="text/javascript">
46
// #################################################################################
47
// Javascript
48
// #################################################################################
49
    function CheckDuplicateForm(f){
50
            var ok=1;
51
            var _alertString="";
52
            var alertString="";
53
            if(!(isNotNull(f.budget_period_startdate,1))){
54
              _alertString += "\n- " + _("Start date missing");
55
            }
56
            if (!(isNotNull(f.budget_period_enddate,1))){
57
              _alertString += "\n- " + _("End date missing");
58
            }
59
            if( f.budget_period_startdate > f.budget_period_enddate ) {
60
              _alertString += "\n- " + _("Start date must be before end date");
61
            }
62
            if (!(isNotNull(f.budget_period_description,1))){
63
              _alertString += "\n- " + _("Budget description missing");
64
            }
65
66
            if(_alertString.length==0){
67
              f.submit();
68
            } else {
69
              alertString += _("Form not submitted because of the following problem(s)");
70
              alertString += "\n-----------------------------------------\n";
71
              alertString += _alertString;
72
              alert(alertString);
73
            }
74
    }
75
    function Check(f) {
76
            var ok=1;
77
            var _alertString="";
78
            var alertString2;
79
80
            if (!(isNotNull(f.budget_period_startdate,1))) {
81
                    _alertString += "\n- " + _("Start date missing");
82
            }
83
84
            if (!(isNotNull(f.budget_period_enddate,1))) {
85
                    _alertString += "\n- " + _("End date missing");
86
            }
87
88
            if ( f.budget_period_startdate >   f.budget_period_enddate )  {
89
                    _alertString += "\n- " + _("Start date must be before end date");
90
            }
91
92
            if (!(isNotNull(f.budget_period_description,1))) {
93
                    _alertString += "\n- " + _("Description missing");
94
            }
95
96
            if (!(isNum(f.budget_period_total))) {
97
                    _alertString += "\n- " + _("Amount must be a valid number, or empty");
98
            }
99
100
/*
101
			checkBudgetTotal(f) {
102
			}
103
*/
104
105
            if (_alertString.length==0) {
106
                    f.submit();
107
            } else {
108
                    alertString2  = _("Form not submitted because of the following problem(s)");
109
                    alertString2 += "\n------------------------------------------------------------------------------------\n";
110
                    alertString2 += _alertString;
111
                    alert(alertString2);
112
            }
113
    }
114
115
    $(document).ready(function() {
116
        var tabs = $('#budgetsTabs').tabs();
117
        [% IF ( tab ) %]
118
            tabs.tabs("option", "active", [% tab %]);
119
        [% END %]
120
        $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
121
            "aoColumnDefs": [
122
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
123
                { "sType": "title-string", "aTargets" : [ "title-string" ] }
124
            ],
125
            "sPaginationType": "four_button",
126
            'bAutoWidth': false
127
        } ) );
128
129
        [% IF close_form %]
130
          $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
131
            sDom: "t"
132
          }));
133
          $("#move_form").submit(function(){
134
            var budget_from = "[% budget_period_description %]";
135
            var budget_to = $("#to_budget_period_id").find("option:selected").html();
136
            var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
137
            alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
138
            return confirm ( alert_message );
139
          });
140
        [% END %]
141
        [% IF closed %]
142
          var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
143
            // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
144
            "fnDrawCallback": function ( oSettings ) {
145
                if ( oSettings.aiDisplay.length == 0 )
146
                {
147
                    return;
148
                }
149
150
                var nTrs = $('#closed_report tbody tr');
151
                var iColspan = nTrs[1].getElementsByTagName('td').length;
152
                var sLastGroup = "";
153
                for ( var i=0 ; i<nTrs.length ; i++ )
154
                {
155
                    var iDisplayIndex = oSettings._iDisplayStart + i;
156
                    var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
157
                    if ( sGroup != sLastGroup )
158
                    {
159
                        var nGroup = document.createElement( 'tr' );
160
                        var nCell = document.createElement( 'td' );
161
                        nCell.colSpan = iColspan;
162
                        nCell.className = "group";
163
                        nCell.innerHTML = sGroup;
164
                        nGroup.appendChild( nCell );
165
                        nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
166
                        sLastGroup = sGroup;
167
                    }
168
                }
169
            },
170
            "aoColumnDefs": [
171
                { "bVisible": false, "aTargets": [ 0, 1 ] },
172
                { "bSortable": false, "aTargets": ["_all"] }
173
            ],
174
            'bSort': true,
175
            'aaSortingFixed': [[ 1, 'asc' ]],
176
            "bAutoWidth": false,
177
            "sPaginationType": "full_numbers"
178
          }));
179
        [% END %]
180
    });
181
</script>
182
41
183
<title>
42
<title>
184
    Koha &rsaquo; Administration &rsaquo; Budgets
43
    Koha &rsaquo; Administration &rsaquo; Budgets
Lines 625-631 Link Here
625
  </div>
484
  </div>
626
[% END %]
485
[% END %]
627
486
628
629
</div>
487
</div>
630
</div>
488
</div>
631
<div class="yui-b">
489
<div class="yui-b">
Lines 633-636 Link Here
633
</div>
491
</div>
634
</div>
492
</div>
635
493
494
[% MACRO jsinclude BLOCK %]
495
    [% INCLUDE 'calendar.inc' %]
496
    [% INCLUDE 'datatables.inc' %]
497
    [% IF close_form %]
498
        <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
499
    [% END %]
500
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
501
    <script type="text/javascript">
502
    // #################################################################################
503
    // Javascript
504
    // #################################################################################
505
        function CheckDuplicateForm(f){
506
            var ok=1;
507
            var _alertString="";
508
            var alertString="";
509
            if(!(isNotNull(f.budget_period_startdate,1))){
510
              _alertString += "\n- " + _("Start date missing");
511
            }
512
            if (!(isNotNull(f.budget_period_enddate,1))){
513
              _alertString += "\n- " + _("End date missing");
514
            }
515
            if( f.budget_period_startdate > f.budget_period_enddate ) {
516
              _alertString += "\n- " + _("Start date must be before end date");
517
            }
518
            if (!(isNotNull(f.budget_period_description,1))){
519
              _alertString += "\n- " + _("Budget description missing");
520
            }
521
522
            if(_alertString.length==0){
523
              f.submit();
524
            } else {
525
              alertString += _("Form not submitted because of the following problem(s)");
526
              alertString += "\n-----------------------------------------\n";
527
              alertString += _alertString;
528
              alert(alertString);
529
            }
530
        }
531
        function Check(f) {
532
            var ok=1;
533
            var _alertString="";
534
            var alertString2;
535
536
            if (!(isNotNull(f.budget_period_startdate,1))) {
537
                    _alertString += "\n- " + _("Start date missing");
538
            }
539
540
            if (!(isNotNull(f.budget_period_enddate,1))) {
541
                    _alertString += "\n- " + _("End date missing");
542
            }
543
544
            if ( f.budget_period_startdate >   f.budget_period_enddate )  {
545
                    _alertString += "\n- " + _("Start date must be before end date");
546
            }
547
548
            if (!(isNotNull(f.budget_period_description,1))) {
549
                    _alertString += "\n- " + _("Description missing");
550
            }
551
552
            if (!(isNum(f.budget_period_total))) {
553
                    _alertString += "\n- " + _("Amount must be a valid number, or empty");
554
            }
555
556
            if (_alertString.length==0) {
557
                    f.submit();
558
            } else {
559
                    alertString2  = _("Form not submitted because of the following problem(s)");
560
                    alertString2 += "\n------------------------------------------------------------------------------------\n";
561
                    alertString2 += _alertString;
562
                    alert(alertString2);
563
            }
564
        }
565
566
        $(document).ready(function() {
567
            var tabs = $('#budgetsTabs').tabs();
568
            [% IF ( tab ) %]
569
                tabs.tabs("option", "active", [% tab %]);
570
            [% END %]
571
            $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
572
                "aoColumnDefs": [
573
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
574
                    { "sType": "title-string", "aTargets" : [ "title-string" ] }
575
                ],
576
                "sPaginationType": "four_button",
577
                'bAutoWidth': false
578
            } ) );
579
580
            [% IF close_form %]
581
              $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
582
                sDom: "t"
583
              }));
584
              $("#move_form").submit(function(){
585
                var budget_from = "[% budget_period_description %]";
586
                var budget_to = $("#to_budget_period_id").find("option:selected").html();
587
                var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
588
                alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
589
                return confirm ( alert_message );
590
              });
591
            [% END %]
592
            [% IF closed %]
593
              var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
594
                // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
595
                "fnDrawCallback": function ( oSettings ) {
596
                    if ( oSettings.aiDisplay.length == 0 )
597
                    {
598
                        return;
599
                    }
600
601
                    var nTrs = $('#closed_report tbody tr');
602
                    var iColspan = nTrs[1].getElementsByTagName('td').length;
603
                    var sLastGroup = "";
604
                    for ( var i=0 ; i<nTrs.length ; i++ )
605
                    {
606
                        var iDisplayIndex = oSettings._iDisplayStart + i;
607
                        var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
608
                        if ( sGroup != sLastGroup )
609
                        {
610
                            var nGroup = document.createElement( 'tr' );
611
                            var nCell = document.createElement( 'td' );
612
                            nCell.colSpan = iColspan;
613
                            nCell.className = "group";
614
                            nCell.innerHTML = sGroup;
615
                            nGroup.appendChild( nCell );
616
                            nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
617
                            sLastGroup = sGroup;
618
                        }
619
                    }
620
                },
621
                "aoColumnDefs": [
622
                    { "bVisible": false, "aTargets": [ 0, 1 ] },
623
                    { "bSortable": false, "aTargets": ["_all"] }
624
                ],
625
                'bSort': true,
626
                'aaSortingFixed': [[ 1, 'asc' ]],
627
                "bAutoWidth": false,
628
                "sPaginationType": "full_numbers"
629
              }));
630
            [% END %]
631
        });
632
    </script>
633
[% END %]
636
[% INCLUDE 'intranet-bottom.inc' %]
634
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt (-258 / +258 lines)
Lines 1-268 Link Here
1
[% USE AuthorisedValues %]
1
[% USE AuthorisedValues %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% USE Price %]
3
[% USE Price %]
4
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Administration &rsaquo; Funds[% IF op == 'add_form' %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
6
<title>Koha &rsaquo; Administration &rsaquo; Funds[% IF op == 'add_form' %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
7
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
8
<link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
6
[% INCLUDE 'doc-head-close.inc' %]
9
[% INCLUDE 'doc-head-close.inc' %]
7
<script type="text/javascript">
8
//<![CDATA[
9
var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n";
10
var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n";
11
var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n";
12
//]]>
13
</script>
14
15
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
16
[% IF op == 'add_form' %]
17
<script type="text/javascript">
18
//<![CDATA[
19
20
    function userPopup() {
21
        window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add",
22
            'PatronPopup',
23
            'width=740,height=450,location=yes,toolbar=no,'
24
            + 'scrollbars=yes,resize=yes'
25
        );
26
    }
27
28
    function ownerPopup() {
29
        window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select",
30
            'PatronPopup',
31
            'width=740,height=450,location=yes,toolbar=no,'
32
            + 'scrollbars=yes,resize=yes'
33
        );
34
    }
35
36
    function select_user(borrowernumber, borrower) {
37
        ownerRemove();
38
        var borrowername = borrower.firstname + ' ' + borrower.surname
39
        if (borrowernumber) {
40
            var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
41
                + '?borrowernumber=' + borrowernumber + '">'
42
                + borrowername + '</a>';
43
            $('#budget_owner_name').html(ownerlink);
44
            $('#budget_owner_id').val(borrowernumber);
45
        }
46
    }
47
48
    function ownerRemove() {
49
        $('#budget_owner_name').empty();
50
        $('#budget_owner_id').val('');
51
    }
52
53
    function add_user(borrowernumber, borrowername) {
54
        var ids = $("#budget_users_id").val().split(':');
55
        if(borrowernumber && ids.indexOf(borrowernumber) == -1) {
56
            var li = '<li id="user_' + borrowernumber + '">'
57
                + '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='
58
                + borrowernumber + '">' + borrowername + '</a> '
59
                + ' &bull; <a data-borrowernumber=" + borrowernumber +" class="del_user" href="#"><i class="fa fa-trash"></i> Remove</a> '
60
                + '</li>';
61
            $("#budget_users").prepend(li);
62
            ids.push(borrowernumber);
63
            $("#budget_users_id").val(ids.join(':'));
64
        } else {
65
            return -1;
66
        }
67
        return 0;
68
    }
69
70
    function del_user(borrowernumber) {
71
        var ids = $("#budget_users_id").val().split(':');
72
        if (borrowernumber) {
73
            var idx = ids.indexOf(borrowernumber+'');
74
            if (idx != -1) {
75
                ids.splice(idx, 1);
76
                $("#budget_users_id").val(ids.join(':'));
77
                $("li#user_" + borrowernumber).remove();
78
            }
79
        }
80
    }
81
82
    function Check(f) {
83
        var ok=1;
84
        var _alertString="";
85
        var alertString2;
86
87
        if (!(isNotNull(f.budget_code,1))) {
88
            _alertString += _("- Budget code cannot be blank") + "\n";
89
        }
90
91
        if (!(isNotNull(f.budget_name,1))) {
92
            _alertString += _("- Budget name cannot be blank") + "\n";
93
        }
94
95
        if (!(isNotNull(f.budget_amount,1))) {
96
            _alertString += _("- Budget amount cannot be blank") + "\n";
97
        }
98
99
        var budgetId;
100
        if   (typeof(f.budget_id ) != "undefined")  {
101
            budgetId = f.budget_id.value
102
        }
103
104
        var newBudgetParent;
105
106
//  hack to test if selected parent_id in scrolling-list...
107
//  if value == 'undef' its got a selected_parent :/
108
        if(f.budget_parent_id){
109
            var chkAdd   =  f.budget_parent_id.value ;
110
            if  (     typeof(chkAdd ) != "undefined") {
111
                newBudgetParent  =  f.budget_parent_id.value
112
            } else {
113
                newBudgetParent  =  f.budget_parent_id.item(0).value
114
            }
115
116
            if   (budgetId  > 0)  {  ; //its a mod ...
117
                // if parent == curent-budget, fail...
118
                if ( newBudgetParent  ==  budgetId     ) {
119
                        _alertString += _("- Budget parent is current budget") + "\n";
120
                }
121
122
                else if (newBudgetParent) {
123
                    var result = checkBudgetParent(  budgetId , newBudgetParent   );
124
                    if (result) {
125
                        _alertString += result;
126
                    }
127
                }
128
            }
129
        }
130
131
         // else do lookup
132
        var budgetTotal = Math.abs(f.budget_amount.value);
133
        var result =   budgetExceedsParent  (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
134
        if (result) {
135
            _alertString += result;
136
        }
137
138
        if (_alertString.length==0) {
139
            document.Aform.submit();
140
        } else {
141
            alertString2 = _("Form not submitted because of the following problem(s)");
142
            alertString2 += "\n------------------------------------------------------------------------------------\n\n";
143
            alertString2 += _alertString;
144
            alert(alertString2);
145
        }
146
    }
147
    $(document).ready(function(){
148
        $("#remove_owner").on("click",function(e){
149
            e.preventDefault();
150
            ownerRemove();
151
        });
152
        $("#edit_owner").on("click",function(e){
153
            e.preventDefault();
154
            ownerPopup();
155
        });
156
        $("body").on("click",".del_user",function(e){
157
            e.preventDefault();
158
            var borrowernumber = $(this).data("borrowernumber");
159
            del_user(borrowernumber);
160
        });
161
        $("#add_user_button").on("click",function(e){
162
            e.preventDefault();
163
            userPopup();
164
        });
165
        $("#edit_fund").on("submit",function(e){
166
            e.preventDefault();
167
            Check(this);
168
        });
169
    });
170
//]]>
171
</script>
172
[% ELSIF op == 'list' %]
173
    <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
174
    [% INCLUDE 'datatables.inc' %]
175
    <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
176
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
177
178
<script type="text/javascript">
179
//<![CDATA[
180
    //
181
    $(document).ready(function() {
182
183
184
        var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
185
            "fnDrawCallback": function ( oSettings ) {
186
                if ( oSettings.aiDisplay.length == 0 )
187
                {
188
                    return;
189
                }
190
191
                var nTrs = $('#budgeth tbody tr');
192
                var iColspan = nTrs[0].getElementsByTagName('td').length;
193
                var sLastGroup = "";
194
                for ( var i=0 ; i<nTrs.length ; i++ )
195
                {
196
                    var iDisplayIndex = oSettings._iDisplayStart + i;
197
                    var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
198
                    if ( sGroup != sLastGroup )
199
                    {
200
                        var nGroup = document.createElement( 'tr' );
201
                        var nCell = document.createElement( 'td' );
202
                        nCell.colSpan = iColspan;
203
                        nCell.className = "group";
204
                        nCell.innerHTML = sGroup;
205
                        nGroup.appendChild( nCell );
206
                        nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
207
                        sLastGroup = sGroup;
208
                    }
209
                }
210
            },
211
            "footerCallback": function ( row, data, start, end, display ) {
212
                var api = this.api(), data;
213
                footer_column_sum( api, [ 4, 6, 8, 10 ], 2 );
214
            },
215
            "aoColumnDefs": [
216
                { "bVisible": false, "aTargets": [ 0, 1 ] },
217
                { "bSortable": false, "aTargets": ["_all"] }
218
            ],
219
            'dom': '<"top pager"ilpf>tr<"bottom pager"ip>',
220
            'bSort': true,
221
            'aaSortingFixed': [[ 1, 'asc' ]],
222
            'bPaginate': false,
223
            "bAutoWidth": false
224
        }));
225
226
        $(oTable).treetable({
227
            expandable: true
228
        });
229
        $(oTable).treetable('expandAll');
230
        $("#expand_all").click(function(e){
231
            e.preventDefault();
232
            $(oTable).treetable('expandAll');
233
        });
234
        $("#collapse_all").click(function(e){
235
            e.preventDefault();
236
            $(oTable).treetable('collapseAll');
237
        });
238
239
        [% UNLESS budget_period_id %]
240
          $("#hide_inactive").click(function(e){
241
            e.preventDefault();
242
            oTable.fnFilter( 1, 0 ); // Show only active=1
243
          });
244
          $("#show_inactive").click(function(e){
245
            e.preventDefault();
246
            oTable.fnFilter( '', 0 );
247
          });
248
          $("#hide_inactive").click();
249
        [% END %]
250
        oTable.fnAddFilters("filter", 750);
251
252
        $("#filterbutton").click(function() {
253
            $("#fundfilters").slideToggle(0);
254
        });
255
256
        $(".deletefund-disabled").tooltip().on("click", function(e){
257
            e.preventDefault();
258
            alert(_("This fund has children. It cannot be deleted."));
259
        });
260
    });
261
//]]>
262
</script>
263
[% END %]
264
265
</head>
10
</head>
11
266
<body id="admin_aqbudgets" class="admin">
12
<body id="admin_aqbudgets" class="admin">
267
[% INCLUDE 'header.inc' %]
13
[% INCLUDE 'header.inc' %]
268
[% INCLUDE 'budgets-admin-search.inc' %]
14
[% INCLUDE 'budgets-admin-search.inc' %]
Lines 693-696 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
693
[% INCLUDE 'acquisitions-menu.inc' %]
439
[% INCLUDE 'acquisitions-menu.inc' %]
694
</div>
440
</div>
695
</div>
441
</div>
442
[% MACRO jsinclude BLOCK %]
443
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
444
    <script type="text/javascript">
445
        var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n";
446
        var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n";
447
        var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n";
448
    </script>
449
450
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
451
    [% IF op == 'add_form' %]
452
        <script type="text/javascript">
453
        //<![CDATA[
454
455
            function userPopup() {
456
                window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add",
457
                    'PatronPopup',
458
                    'width=740,height=450,location=yes,toolbar=no,'
459
                    + 'scrollbars=yes,resize=yes'
460
                );
461
            }
462
463
            function ownerPopup() {
464
                window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select",
465
                    'PatronPopup',
466
                    'width=740,height=450,location=yes,toolbar=no,'
467
                    + 'scrollbars=yes,resize=yes'
468
                );
469
            }
470
471
            function select_user(borrowernumber, borrower) {
472
                ownerRemove();
473
                var borrowername = borrower.firstname + ' ' + borrower.surname
474
                if (borrowernumber) {
475
                    var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
476
                        + '?borrowernumber=' + borrowernumber + '">'
477
                        + borrowername + '</a>';
478
                    $('#budget_owner_name').html(ownerlink);
479
                    $('#budget_owner_id').val(borrowernumber);
480
                }
481
            }
482
483
            function ownerRemove() {
484
                $('#budget_owner_name').empty();
485
                $('#budget_owner_id').val('');
486
            }
487
488
            function add_user(borrowernumber, borrowername) {
489
                var ids = $("#budget_users_id").val().split(':');
490
                if(borrowernumber && ids.indexOf(borrowernumber) == -1) {
491
                    var li = '<li id="user_' + borrowernumber + '">'
492
                        + '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='
493
                        + borrowernumber + '">' + borrowername + '</a> '
494
                        + ' &bull; <a data-borrowernumber=" + borrowernumber +" class="del_user" href="#"><i class="fa fa-trash"></i> Remove</a> '
495
                        + '</li>';
496
                    $("#budget_users").prepend(li);
497
                    ids.push(borrowernumber);
498
                    $("#budget_users_id").val(ids.join(':'));
499
                } else {
500
                    return -1;
501
                }
502
                return 0;
503
            }
504
505
            function del_user(borrowernumber) {
506
                var ids = $("#budget_users_id").val().split(':');
507
                if (borrowernumber) {
508
                    var idx = ids.indexOf(borrowernumber+'');
509
                    if (idx != -1) {
510
                        ids.splice(idx, 1);
511
                        $("#budget_users_id").val(ids.join(':'));
512
                        $("li#user_" + borrowernumber).remove();
513
                    }
514
                }
515
            }
516
517
            function Check(f) {
518
                var ok=1;
519
                var _alertString="";
520
                var alertString2;
521
522
                if (!(isNotNull(f.budget_code,1))) {
523
                    _alertString += _("- Budget code cannot be blank") + "\n";
524
                }
525
526
                if (!(isNotNull(f.budget_name,1))) {
527
                    _alertString += _("- Budget name cannot be blank") + "\n";
528
                }
529
530
                if (!(isNotNull(f.budget_amount,1))) {
531
                    _alertString += _("- Budget amount cannot be blank") + "\n";
532
                }
533
534
                var budgetId;
535
                if   (typeof(f.budget_id ) != "undefined")  {
536
                    budgetId = f.budget_id.value
537
                }
538
539
                var newBudgetParent;
540
541
        //  hack to test if selected parent_id in scrolling-list...
542
        //  if value == 'undef' its got a selected_parent :/
543
                if(f.budget_parent_id){
544
                    var chkAdd   =  f.budget_parent_id.value ;
545
                    if  (     typeof(chkAdd ) != "undefined") {
546
                        newBudgetParent  =  f.budget_parent_id.value
547
                    } else {
548
                        newBudgetParent  =  f.budget_parent_id.item(0).value
549
                    }
550
551
                    if   (budgetId  > 0)  {  ; //its a mod ...
552
                        // if parent == curent-budget, fail...
553
                        if ( newBudgetParent  ==  budgetId     ) {
554
                                _alertString += _("- Budget parent is current budget") + "\n";
555
                        }
556
557
                        else if (newBudgetParent) {
558
                            var result = checkBudgetParent(  budgetId , newBudgetParent   );
559
                            if (result) {
560
                                _alertString += result;
561
                            }
562
                        }
563
                    }
564
                }
565
566
                 // else do lookup
567
                var budgetTotal = Math.abs(f.budget_amount.value);
568
                var result =   budgetExceedsParent  (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
569
                if (result) {
570
                    _alertString += result;
571
                }
572
573
                if (_alertString.length==0) {
574
                    document.Aform.submit();
575
                } else {
576
                    alertString2 = _("Form not submitted because of the following problem(s)");
577
                    alertString2 += "\n------------------------------------------------------------------------------------\n\n";
578
                    alertString2 += _alertString;
579
                    alert(alertString2);
580
                }
581
            }
582
            $(document).ready(function(){
583
                $("#remove_owner").on("click",function(e){
584
                    e.preventDefault();
585
                    ownerRemove();
586
                });
587
                $("#edit_owner").on("click",function(e){
588
                    e.preventDefault();
589
                    ownerPopup();
590
                });
591
                $("body").on("click",".del_user",function(e){
592
                    e.preventDefault();
593
                    var borrowernumber = $(this).data("borrowernumber");
594
                    del_user(borrowernumber);
595
                });
596
                $("#add_user_button").on("click",function(e){
597
                    e.preventDefault();
598
                    userPopup();
599
                });
600
                $("#edit_fund").on("submit",function(e){
601
                    e.preventDefault();
602
                    Check(this);
603
                });
604
            });
605
        //]]>
606
        </script>
607
    [% ELSIF op == 'list' %]
608
        [% INCLUDE 'datatables.inc' %]
609
        <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
610
611
        <script type="text/javascript">
612
        //<![CDATA[
613
            //
614
            $(document).ready(function() {
615
                var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
616
                    "fnDrawCallback": function ( oSettings ) {
617
                        if ( oSettings.aiDisplay.length == 0 )
618
                        {
619
                            return;
620
                        }
621
622
                        var nTrs = $('#budgeth tbody tr');
623
                        var iColspan = nTrs[0].getElementsByTagName('td').length;
624
                        var sLastGroup = "";
625
                        for ( var i=0 ; i<nTrs.length ; i++ )
626
                        {
627
                            var iDisplayIndex = oSettings._iDisplayStart + i;
628
                            var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
629
                            if ( sGroup != sLastGroup )
630
                            {
631
                                var nGroup = document.createElement( 'tr' );
632
                                var nCell = document.createElement( 'td' );
633
                                nCell.colSpan = iColspan;
634
                                nCell.className = "group";
635
                                nCell.innerHTML = sGroup;
636
                                nGroup.appendChild( nCell );
637
                                nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
638
                                sLastGroup = sGroup;
639
                            }
640
                        }
641
                    },
642
                    "footerCallback": function ( row, data, start, end, display ) {
643
                        var api = this.api(), data;
644
                        footer_column_sum( api, [ 4, 6, 8, 10 ], 2 );
645
                    },
646
                    "aoColumnDefs": [
647
                        { "bVisible": false, "aTargets": [ 0, 1 ] },
648
                        { "bSortable": false, "aTargets": ["_all"] }
649
                    ],
650
                    'dom': '<"top pager"ilpf>tr<"bottom pager"ip>',
651
                    'bSort': true,
652
                    'aaSortingFixed': [[ 1, 'asc' ]],
653
                    'bPaginate': false,
654
                    "bAutoWidth": false
655
                }));
656
657
                $(oTable).treetable({
658
                    expandable: true
659
                });
660
                $(oTable).treetable('expandAll');
661
                $("#expand_all").click(function(e){
662
                    e.preventDefault();
663
                    $(oTable).treetable('expandAll');
664
                });
665
                $("#collapse_all").click(function(e){
666
                    e.preventDefault();
667
                    $(oTable).treetable('collapseAll');
668
                });
669
670
                [% UNLESS budget_period_id %]
671
                  $("#hide_inactive").click(function(e){
672
                    e.preventDefault();
673
                    oTable.fnFilter( 1, 0 ); // Show only active=1
674
                  });
675
                  $("#show_inactive").click(function(e){
676
                    e.preventDefault();
677
                    oTable.fnFilter( '', 0 );
678
                  });
679
                  $("#hide_inactive").click();
680
                [% END %]
681
                oTable.fnAddFilters("filter", 750);
682
683
                $("#filterbutton").click(function() {
684
                    $("#fundfilters").slideToggle(0);
685
                });
686
687
                $(".deletefund-disabled").tooltip().on("click", function(e){
688
                    e.preventDefault();
689
                    alert(_("This fund has children. It cannot be deleted."));
690
                });
691
            });
692
        //]]>
693
        </script>
694
    [% END %]
695
[% END %]
696
[% INCLUDE 'intranet-bottom.inc' %]
696
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt (-41 / +45 lines)
Lines 1-4 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Acquisitions &rsaquo; Contracts &rsaquo;
4
<title>Koha &rsaquo; Acquisitions &rsaquo; Contracts &rsaquo;
4
[% IF ( add_form ) %]
5
[% IF ( add_form ) %]
Lines 10-57 Link Here
10
[% IF ( delete_confirm ) %]Confirm deletion of contract '[% contractnumber %]'[% END %]
11
[% IF ( delete_confirm ) %]Confirm deletion of contract '[% contractnumber %]'[% END %]
11
[% IF ( delete_confirmed ) %]Contract deleted[% END %]</title>
12
[% IF ( delete_confirmed ) %]Contract deleted[% END %]</title>
12
[% INCLUDE 'doc-head-close.inc' %]
13
[% INCLUDE 'doc-head-close.inc' %]
13
[% INCLUDE 'calendar.inc' %]
14
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
15
<script type="text/javascript">
16
//<![CDATA[
17
// to check if the data are correctly entered.
18
function Check(ff) {
19
    var ok=0;
20
    var _alertString=_("Form not submitted because of the following problem(s)");
21
    _alertString +="\n-------------------------------------------------------------------\n\n";
22
    if (!(isNotNull(ff.contractname,0))){
23
        ok=1;
24
        _alertString += _("- Name missing") + "\n";
25
    }
26
    var startDate = Date_from_syspref($("#from").val());
27
    var endDate   = Date_from_syspref($("#to").val());
28
    if (!parseInt(startDate.getTime())) {
29
        ok=1;
30
        _alertString += _("- Start date missing or invalid.") + "\n";
31
    }
32
    if (!parseInt(endDate.getTime())) {
33
        ok=1;
34
        _alertString += _("- End date missing or invalid.") + "\n";
35
    }
36
    
37
    if (startDate > endDate) {
38
        ok=1;
39
        _alertString += _("Wrong date! start date cannot be after end date.") + "\n";
40
    }
41
    if (endDate < (new Date)) {
42
        ok=1;
43
        _alertString += _("End date before today, Invalid end date!") + "\n";
44
    }
45
    if (ok) { // if there is a problem
46
        alert(_alertString);
47
    return false;
48
}
49
// if all is good
50
    ff.submit();
51
}
52
//]]>
53
</script>
54
</head>
14
</head>
15
55
<body id="acq_aqcontract" class="acq">
16
<body id="acq_aqcontract" class="acq">
56
[% INCLUDE 'header.inc' %]
17
[% INCLUDE 'header.inc' %]
57
[% INCLUDE 'contracts-admin-search.inc' %]
18
[% INCLUDE 'contracts-admin-search.inc' %]
Lines 213-216 function Check(ff) { Link Here
213
[% INCLUDE 'vendor-menu.inc' %]
174
[% INCLUDE 'vendor-menu.inc' %]
214
</div>
175
</div>
215
</div>
176
</div>
177
[% MACRO jsinclude BLOCK %]
178
    [% INCLUDE 'calendar.inc' %]
179
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
180
    <script type="text/javascript">
181
    //<![CDATA[
182
    // to check if the data are correctly entered.
183
    function Check(ff) {
184
        var ok=0;
185
        var _alertString=_("Form not submitted because of the following problem(s)");
186
        _alertString +="\n-------------------------------------------------------------------\n\n";
187
        if (!(isNotNull(ff.contractname,0))){
188
            ok=1;
189
            _alertString += _("- Name missing") + "\n";
190
        }
191
        var startDate = Date_from_syspref($("#from").val());
192
        var endDate   = Date_from_syspref($("#to").val());
193
        if (!parseInt(startDate.getTime())) {
194
            ok=1;
195
            _alertString += _("- Start date missing or invalid.") + "\n";
196
        }
197
        if (!parseInt(endDate.getTime())) {
198
            ok=1;
199
            _alertString += _("- End date missing or invalid.") + "\n";
200
        }
201
202
        if (startDate > endDate) {
203
            ok=1;
204
            _alertString += _("Wrong date! start date cannot be after end date.") + "\n";
205
        }
206
        if (endDate < (new Date)) {
207
            ok=1;
208
            _alertString += _("End date before today, Invalid end date!") + "\n";
209
        }
210
        if (ok) { // if there is a problem
211
            alert(_alertString);
212
        return false;
213
    }
214
    // if all is good
215
        ff.submit();
216
    }
217
    //]]>
218
    </script>
219
[% END %]
216
[% INCLUDE 'intranet-bottom.inc' %]
220
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt (-55 / +59 lines)
Lines 1-64 Link Here
1
[% USE Price %]
1
[% USE Price %]
2
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration &rsaquo; Budgets &rsaquo; Funds &rsaquo; Planning for [% budget_period_description %] by [% authcat %]</title>
4
<title>Koha &rsaquo; Administration &rsaquo; Budgets &rsaquo; Funds &rsaquo; Planning for [% budget_period_description %] by [% authcat %]</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'doc-head-close.inc' %]
5
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
6
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
7
<script type="text/javascript">
8
//<![CDATA[
9
    function Check(f) {
10
            var ok=1;
11
            var _alertString="";
12
            var alertString2;
13
            var arr = document.getElementsByName('est_total')
14
15
            for ( var i=0, len=arr.length; i<len; ++i ){
16
                    var tot = arr[i].innerHTML;
17
18
                    if (tot == 'NaN') {
19
                        _alertString += "\n- " + _("One or more cell values is non-numeric");
20
                    }
21
            }
22
23
            if (_alertString.length==0) {
24
25
                var op  = document.createElement('input');
26
                op.setAttribute("type","hidden");
27
                op.setAttribute("name","op");
28
                op.setAttribute("value","save");   //ohh the pain...
29
30
                document.Aform.appendChild(op);
31
                document.Aform.submit()
32
33
            } else {
34
                    alertString2  = _("Form not submitted because of the following problem(s)");
35
                    alertString2 += "\n------------------------------------------------------------------------------------\n";
36
                    alertString2 += _alertString;
37
                    alert(alertString2);
38
            }
39
    }
40
    $(document).ready(function() {
41
        $("#selections input").on("change",function(e){
42
            var num = $(this).attr("id");
43
            if(num == 'showall'){
44
                showAllColumns();
45
                e.stopPropagation();
46
            } else if(num == 'hideall'){
47
                hideAllColumns();
48
                e.stopPropagation();
49
            } else {
50
                if($(this).prop("checked")){
51
                    showColumn(num);
52
                } else {
53
                    hideColumn(num);
54
                }
55
            }
56
        });
57
    });
58
//]]>
59
</script>
60
<style type="text/css">td.locked { background-image: url('[% interface %]/[% theme %]/img/locked.png'); padding-left : 20px; background-repeat: no-repeat; background-position: 5px 5px; } a.control { font-size:85%;text-decoration:none; }</style>
6
<style type="text/css">td.locked { background-image: url('[% interface %]/[% theme %]/img/locked.png'); padding-left : 20px; background-repeat: no-repeat; background-position: 5px 5px; } a.control { font-size:85%;text-decoration:none; }</style>
61
</head>
7
</head>
8
62
<body id="admin_aqplan" class="admin">
9
<body id="admin_aqplan" class="admin">
63
[% INCLUDE 'header.inc' %]
10
[% INCLUDE 'header.inc' %]
64
[% INCLUDE 'budgets-admin-search.inc' %]
11
[% INCLUDE 'budgets-admin-search.inc' %]
Lines 321-324 Link Here
321
[% INCLUDE 'acquisitions-menu.inc' %]
268
[% INCLUDE 'acquisitions-menu.inc' %]
322
</div>
269
</div>
323
</div>
270
</div>
271
[% MACRO jsinclude BLOCK %]
272
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
273
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
274
    <script type="text/javascript">
275
    //<![CDATA[
276
        function Check(f) {
277
                var ok=1;
278
                var _alertString="";
279
                var alertString2;
280
                var arr = document.getElementsByName('est_total')
281
282
                for ( var i=0, len=arr.length; i<len; ++i ){
283
                        var tot = arr[i].innerHTML;
284
285
                        if (tot == 'NaN') {
286
                            _alertString += "\n- " + _("One or more cell values is non-numeric");
287
                        }
288
                }
289
290
                if (_alertString.length==0) {
291
292
                    var op  = document.createElement('input');
293
                    op.setAttribute("type","hidden");
294
                    op.setAttribute("name","op");
295
                    op.setAttribute("value","save");   //ohh the pain...
296
297
                    document.Aform.appendChild(op);
298
                    document.Aform.submit()
299
300
                } else {
301
                        alertString2  = _("Form not submitted because of the following problem(s)");
302
                        alertString2 += "\n------------------------------------------------------------------------------------\n";
303
                        alertString2 += _alertString;
304
                        alert(alertString2);
305
                }
306
        }
307
        $(document).ready(function() {
308
            $("#selections input").on("change",function(e){
309
                var num = $(this).attr("id");
310
                if(num == 'showall'){
311
                    showAllColumns();
312
                    e.stopPropagation();
313
                } else if(num == 'hideall'){
314
                    hideAllColumns();
315
                    e.stopPropagation();
316
                } else {
317
                    if($(this).prop("checked")){
318
                        showColumn(num);
319
                    } else {
320
                        hideColumn(num);
321
                    }
322
                }
323
            });
324
        });
325
    //]]>
326
    </script>
327
[% END %]
324
[% INCLUDE 'intranet-bottom.inc' %]
328
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/acq.js (-1 / +5 lines)
Lines 374-376 function hideAllColumns(){ Link Here
374
    $("#plan td:nth-child(2),#plan th:nth-child(2)").nextUntil("th:nth-child("+(allCols-1)+"),td:nth-child("+(allCols-1)+")").hide(); // hide all but the last two columns
374
    $("#plan td:nth-child(2),#plan th:nth-child(2)").nextUntil("th:nth-child("+(allCols-1)+"),td:nth-child("+(allCols-1)+")").hide(); // hide all but the last two columns
375
    $("#hideall").prop("checked", true).parent().addClass("selected");
375
    $("#hideall").prop("checked", true).parent().addClass("selected");
376
}
376
}
377
- 
377
378
$(document).ready(function() {
379
    var path = location.pathname.substring(1);
380
    $('#navmenulist a[href$="/' + path + '"]').css('font-weight','bold');
381
});

Return to bug 19592