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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-79 / +25 lines)
Lines 37-110 Link Here
37
[% END %]
37
[% END %]
38
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
38
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
39
<script type="text/javascript">
39
<script type="text/javascript">
40
// #################################################################################
41
// Javascript
42
// #################################################################################
43
    function CheckDuplicateForm(f){
44
            var ok=1;
45
            var _alertString="";
46
            var alertString="";
47
            if(!(isNotNull(f.budget_period_startdate,1))){
48
              _alertString += "\n- " + _("Start date missing");
49
            }
50
            if (!(isNotNull(f.budget_period_enddate,1))){
51
              _alertString += "\n- " + _("End date missing");
52
            }
53
            if( f.budget_period_startdate > f.budget_period_enddate ) {
54
              _alertString += "\n- " + _("Start date must be before end date");
55
            }
56
            if (!(isNotNull(f.budget_period_description,1))){
57
              _alertString += "\n- " + _("Budget description missing");
58
            }
59
60
            if(_alertString.length==0){
61
              f.submit();
62
            } else {
63
              alertString += _("Form not submitted because of the following problem(s)");
64
              alertString += "\n-----------------------------------------\n";
65
              alertString += _alertString;
66
              alert(alertString);
67
            }
68
    }
69
    function Check(f) {
70
            var ok=1;
71
            var _alertString="";
72
            var alertString2;
73
74
            if (!(isNotNull(f.budget_period_startdate,1))) {
75
                    _alertString += "\n- " + _("Start date missing");
76
            }
77
78
            if (!(isNotNull(f.budget_period_enddate,1))) {
79
                    _alertString += "\n- " + _("End date missing");
80
            }
81
82
            if ( f.budget_period_startdate >   f.budget_period_enddate )  {
83
                    _alertString += "\n- " + _("Start date must be before end date");
84
            }
85
86
            if (!(isNotNull(f.budget_period_description,1))) {
87
                    _alertString += "\n- " + _("Description missing");
88
            }
89
90
            if (!(isNum(f.budget_period_total))) {
91
                    _alertString += "\n- " + _("Amount must be a valid number, or empty");
92
            }
93
94
/*
95
			checkBudgetTotal(f) {
96
			}
97
*/
98
99
            if (_alertString.length==0) {
100
                    f.submit();
101
            } else {
102
                    alertString2  = _("Form not submitted because of the following problem(s)");
103
                    alertString2 += "\n------------------------------------------------------------------------------------\n";
104
                    alertString2 += _alertString;
105
                    alert(alertString2);
106
            }
107
    }
108
40
109
    $(document).ready(function() {
41
    $(document).ready(function() {
110
        var tabs = $('#budgetsTabs').tabs();
42
        var tabs = $('#budgetsTabs').tabs();
Lines 171-176 Link Here
171
            "sPaginationType": "full_numbers"
103
            "sPaginationType": "full_numbers"
172
          }));
104
          }));
173
        [% END %]
105
        [% END %]
106
        $("#add_modify_budget").validate({
107
            rules: {
108
                budget_period_startdate: "required",
109
                budget_period_enddate: "required",
110
                budget_period_description: "required",
111
                budget_period_total: {
112
                    number: true
113
                }
114
            }
115
        });
174
    });
116
    });
175
</script>
117
</script>
176
118
Lines 252-264 Link Here
252
<div id="yui-main">
194
<div id="yui-main">
253
<div class="yui-b">
195
<div class="yui-b">
254
196
255
[% UNLESS close_form OR closed%]
197
[% UNLESS close_form OR closed OR duplicate_form %]
256
  [% INCLUDE 'budgets-admin-toolbar.inc' %]
198
  [% INCLUDE 'budgets-admin-toolbar.inc' %]
257
[% END %]
199
[% END %]
258
200
259
[% IF ( duplicate_form ) %]
201
[% IF ( duplicate_form ) %]
260
<h3>Duplicate budget</h3>
202
<h3>Duplicate budget</h3>
261
<form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
203
<form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
262
    <fieldset class="rows">
204
    <fieldset class="rows">
263
    <input type="hidden" name="op" value="duplicate_budget" />
205
    <input type="hidden" name="op" value="duplicate_budget" />
264
    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
206
    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
Lines 268-285 Link Here
268
    <li>
210
    <li>
269
    <label class="required" for="from">Start date: </label>
211
    <label class="required" for="from">Start date: </label>
270
    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
212
    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
271
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
213
            <span class="required">Required</span>
214
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
272
    </li>
215
    </li>
273
    <li>
216
    <li>
274
217
275
    <label class="required" for="to">End date: </label>
218
    <label class="required" for="to">End date: </label>
276
    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
219
    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
277
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
220
            <span class="required">Required</span>
221
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
278
    </li>
222
    </li>
279
223
280
    <li>
224
    <li>
281
    <label class="required" for="budget_period_description">Description</label>
225
    <label class="required" for="budget_period_description">Description</label>
282
    <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description %]" />
226
    <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description %]" />
227
        <span class="required">Required</span>
283
    </li>
228
    </li>
284
229
285
    <li>
230
    <li>
Lines 308-314 Link Here
308
    </fieldset>
253
    </fieldset>
309
254
310
    <fieldset class="action">
255
    <fieldset class="action">
311
        <input type="button" value="Save Changes"  onclick="CheckDuplicateForm(this.form)" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Cancel</a>
256
        <input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Cancel</a>
312
    </fieldset>
257
    </fieldset>
313
258
314
</form>
259
</form>
Lines 323-329 Link Here
323
    [% ELSE %]
268
    [% ELSE %]
324
        <h3>Add budget</h3>
269
        <h3>Add budget</h3>
325
	[% END %]
270
	[% END %]
326
<form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
271
<form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
327
    <fieldset class="rows">
272
    <fieldset class="rows">
328
    <!-- ################################################################################# -->
273
    <!-- ################################################################################# -->
329
    <!-- display information about the budget period that must be added or modified -->
274
    <!-- display information about the budget period that must be added or modified -->
Lines 334-346 Link Here
334
    <li>
279
    <li>
335
    <label class="required" for="from">Start date: </label>
280
    <label class="required" for="from">Start date: </label>
336
    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
281
    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
337
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
282
            <span class="required">Required</span>
283
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
338
    </li>
284
    </li>
339
    <li>
285
    <li>
340
286
341
    <label class="required" for="to">End date: </label>
287
    <label class="required" for="to">End date: </label>
342
    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
288
    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
343
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
289
            <span class="required">Required</span>
290
                <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
344
    </li>
291
    </li>
345
292
346
    <li>
293
    <li>
Lines 349-354 Link Here
349
        <label class="required" for="budget_period_description">Description: </label>
296
        <label class="required" for="budget_period_description">Description: </label>
350
        <input type="text" id="budget_period_description" name="budget_period_description"
297
        <input type="text" id="budget_period_description" name="budget_period_description"
351
        size="48" maxlength="80" value="[% budget_period_description %]" />
298
        size="48" maxlength="80" value="[% budget_period_description %]" />
299
            <span class="required">Required</span>
352
    </li>
300
    </li>
353
301
354
    <li>
302
    <li>
Lines 378-385 Link Here
378
    <fieldset class="action">
326
    <fieldset class="action">
379
        <!-- "save changes" button -->
327
        <!-- "save changes" button -->
380
        <!-- ###################################### -->
328
        <!-- ###################################### -->
381
        <input type="button" value="Save"  onclick="Check(this.form)" />
329
        <input type="submit" value="Save" />
382
        <!--             <input type="submit" value="Save Changes"  />  -->
383
        [% IF ( budget_period_id ) %]
330
        [% IF ( budget_period_id ) %]
384
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>
331
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>
385
        [% ELSE %]
332
        [% ELSE %]
386
- 

Return to bug 16754