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

(-)a/koha-tmpl/intranet-tmpl/prog/en/js/members.js (-1 / +134 lines)
Lines 143-152 function Dopop(link) { Link Here
143
}
143
}
144
144
145
function Dopopguarantor(link) {
145
function Dopopguarantor(link) {
146
147
    var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top');
146
    var newin=window.open(link,'popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top');
148
}
147
}
149
148
149
function clear_entry(node) {
150
    var original = $(node).parent();
151
    $("textarea", original).attr('value', '');
152
    $("select", original).attr('value', '');
153
}
154
155
function clone_entry(node) {
156
    var original = $(node).parent();
157
    var clone = original.clone();
158
159
    var newId = 50 + parseInt(Math.random() * 100000);
160
    $("input,select,textarea", clone).attr('id', function() {
161
        return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId);
162
    });
163
    $("input,select,textarea", clone).attr('name', function() {
164
        return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId);
165
    });
166
    $("label", clone).attr('for', function() {
167
        return $(this).attr("for").replace(/patron_attr_\d+/, 'patron_attr_' + newId);
168
    });
169
    $("input#patron_attr_" + newId, clone).attr('value','');
170
    $("select#patron_attr_" + newId, clone).attr('value','');
171
    $(original).after(clone);
172
    return false;
173
}
174
175
function update_category_code(category_code) {
176
    if ( $(category_code).is("select") ) {
177
        category_code = $("#categorycode_entry").find("option:selected").val();
178
    }
179
    var mytables = $(".attributes_table");
180
    $(mytables).find("li").hide();
181
    $(mytables).find(" li[data-category_code='"+category_code+"']").show();
182
    $(mytables).find(" li[data-category_code='']").show();
183
}
184
185
function select_user(borrowernumber, borrower) {
186
    var form = $('#entryform').get(0);
187
    if (form.guarantorid.value) {
188
        $("#contact-details").find('a').remove();
189
        $("#contactname, #contactfirstname").parent().find('span').remove();
190
    }
191
192
    var id = borrower.borrowernumber;
193
    form.guarantorid.value = id;
194
    $('#contact-details')
195
        .show()
196
        .find('span')
197
        .after('<a target="blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + id + '">' + id + '</a>');
198
199
    $(form.contactname)
200
        .val(borrower.surname)
201
        .before('<span>' + borrower.surname + '</span>').get(0).type = 'hidden';
202
    $(form.contactfirstname)
203
        .val(borrower.firstname)
204
        .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
205
206
    form.streetnumber.value = borrower.streetnumber;
207
    form.address.value = borrower.address;
208
    form.address2.value = borrower.address2;
209
    form.city.value = borrower.city;
210
    form.state.value = borrower.state;
211
    form.zipcode.value = borrower.zipcode;
212
    form.country.value = borrower.country;
213
    form.branchcode.value = borrower.branchcode;
214
215
    form.guarantorsearch.value = LABEL_CHANGE;
216
217
    return 0;
218
}
219
150
$(document).ready(function(){
220
$(document).ready(function(){
151
    if($("#yesdebarred").is(":checked")){
221
    if($("#yesdebarred").is(":checked")){
152
        $("#debarreduntil").show();
222
        $("#debarreduntil").show();
Lines 165-168 $(document).ready(function(){ Link Here
165
    $(mandatory_fields).each(function(){
235
    $(mandatory_fields).each(function(){
166
        $("[name='"+this+"']").attr('required', 'required');
236
        $("[name='"+this+"']").attr('required', 'required');
167
    });
237
    });
238
239
    $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
240
241
    $("#guarantordelete").click(function() {
242
        $("#contact-details").hide().find('a').remove();
243
        $("#guarantorid, #contactname, #contactfirstname").each(function () { this.value = ""; });
244
        $("#contactname, #contactfirstname")
245
            .each(function () { this.type = 'text'; })
246
            .parent().find('span').remove();
247
        $("#guarantorsearch").val(LABEL_SET_TO_PATRON);
248
    });
249
250
    $("#select_city").change(function(){
251
        var myRegEx=new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/);
252
        document.form.select_city.value.match(myRegEx);
253
        document.form.zipcode.value=RegExp.$1;
254
        document.form.city.value=RegExp.$2;
255
        document.form.state.value=RegExp.$3;
256
        document.form.country.value=RegExp.$4;
257
    });
258
259
    $("#dateofbirth").datepicker({ maxDate: "-1D", yearRange: "c-120:" });
260
261
    $("#entryform").validate({
262
        rules: {
263
            email: {
264
                email: true
265
            },
266
            emailpro: {
267
                email: true
268
            },
269
            B_email: {
270
                email: true
271
            }
272
        },
273
        submitHandler: function(form) {
274
            $("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting');
275
            if (form.beenSubmitted)
276
                return false;
277
            else
278
                form.beenSubmitted = true;
279
                form.submit();
280
            }
281
    });
282
283
    var mrform = $("#manual_restriction_form");
284
    var mrlink = $("#add_manual_restriction");
285
    mrform.hide();
286
    mrlink.on("click",function(e){
287
        $(this).hide();
288
        mrform.show();
289
        e.preventDefault();
290
    });
291
292
    $("#cancel_manual_restriction").on("click",function(e){
293
        $('#debarred_expiration').val('');
294
        $('#add_debarment').val(0);
295
        $('#debarred_comment').val('');
296
        mrlink.show();
297
        mrform.hide();
298
        e.preventDefault();
299
    });
300
168
});
301
});
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-130 / +2 lines)
Lines 7-29 Link Here
7
<script type="text/javascript">
7
<script type="text/javascript">
8
//<![CDATA[
8
//<![CDATA[
9
    $(document).ready(function() {
9
    $(document).ready(function() {
10
        $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
11
        $("#guarantordelete").click(function() {
12
            $("#contact-details").hide().find('a').remove();
13
            $("#guarantorid, #contactname, #contactfirstname").each(function () { this.value = "" });
14
            $("#contactname, #contactfirstname")
15
                .each(function () { this.type = 'text' })
16
                .parent().find('span').remove();
17
            $("#guarantorsearch").val(_("Set to patron"));
18
        });
19
        $("#select_city").change(function(){
20
            var myRegEx=new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/);
21
            document.form.select_city.value.match(myRegEx);
22
            document.form.zipcode.value=RegExp.$1;
23
            document.form.city.value=RegExp.$2;
24
            document.form.state.value=RegExp.$3;
25
            document.form.country.value=RegExp.$4;
26
        });
27
10
28
        [% IF categorycode %]
11
        [% IF categorycode %]
29
            update_category_code( "[% categorycode %]" );
12
            update_category_code( "[% categorycode %]" );
Lines 33-152 Link Here
33
                update_category_code( category_code );
16
                update_category_code( category_code );
34
            }
17
            }
35
        [% END %]
18
        [% END %]
36
        $("#dateofbirth").datepicker({ maxDate: "-1D", yearRange: "c-120:" });
37
        $("#entryform").validate({
38
            rules: {
39
                email: {
40
                    email: true
41
                },
42
                emailpro: {
43
                    email: true
44
                },
45
                B_email: {
46
                    email: true
47
                }
48
            },
49
            submitHandler: function(form) {
50
                $("body, form input[type='submit'], form button[type='submit'], form a").addClass('waiting');
51
                if (form.beenSubmitted)
52
                    return false;
53
                else
54
                    form.beenSubmitted = true;
55
                    form.submit();
56
                }
57
        });
58
59
        var mrform = $("#manual_restriction_form");
60
        var mrlink = $("#add_manual_restriction");
61
        mrform.hide();
62
        mrlink.on("click",function(e){
63
            $(this).hide();
64
            mrform.show();
65
            e.preventDefault();
66
        });
67
        $("#cancel_manual_restriction").on("click",function(e){
68
            $('#debarred_expiration').val('');
69
            $('#add_debarment').val(0);
70
            $('#debarred_comment').val('');
71
            mrlink.show();
72
            mrform.hide();
73
            e.preventDefault();
74
        });
75
    });
19
    });
76
20
77
    function clear_entry(node) {
78
        var original = $(node).parent();
79
        $("textarea", original).attr('value', '');
80
        $("select", original).attr('value', '');
81
    }
82
83
    function clone_entry(node) {
84
        var original = $(node).parent();
85
        var clone = original.clone();
86
87
        var newId = 50 + parseInt(Math.random() * 100000);
88
        $("input,select,textarea", clone).attr('id', function() {
89
            return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId);
90
        });
91
        $("input,select,textarea", clone).attr('name', function() {
92
            return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId);
93
        });
94
        $("label", clone).attr('for', function() {
95
            return $(this).attr("for").replace(/patron_attr_\d+/, 'patron_attr_' + newId);
96
        });
97
        $("input#patron_attr_" + newId, clone).attr('value','');
98
        $("select#patron_attr_" + newId, clone).attr('value','');
99
        $(original).after(clone);
100
        return false;
101
    }
102
103
    function update_category_code(category_code) {
104
        if ( $(category_code).is("select") ) {
105
            category_code = $("#categorycode_entry").find("option:selected").val();
106
        }
107
        var mytables = $(".attributes_table");
108
        $(mytables).find("li").hide();
109
        $(mytables).find(" li[data-category_code='"+category_code+"']").show();
110
        $(mytables).find(" li[data-category_code='']").show();
111
    }
112
113
    function select_user(borrowernumber, borrower) {
114
        var form = $('#entryform').get(0);
115
        if (form.guarantorid.value) {
116
            $("#contact-details").find('a').remove();
117
            $("#contactname, #contactfirstname").parent().find('span').remove();
118
        }
119
120
        var id = borrower.borrowernumber;
121
        form.guarantorid.value = id;
122
        $('#contact-details')
123
            .show()
124
            .find('span')
125
            .after('<a target="blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + id + '">' + id + '</a>');
126
127
        $(form.contactname)
128
            .val(borrower.surname)
129
            .before('<span>' + borrower.surname + '</span>').get(0).type = 'hidden';
130
        $(form.contactfirstname)
131
            .val(borrower.firstname)
132
            .before('<span>' + borrower.firstname + '</span>').get(0).type = 'hidden';
133
134
        form.streetnumber.value = borrower.streetnumber;
135
        form.address.value = borrower.address;
136
        form.address2.value = borrower.address2;
137
        form.city.value = borrower.city;
138
        form.state.value = borrower.state;
139
        form.zipcode.value = borrower.zipcode;
140
        form.country.value = borrower.country;
141
        form.branchcode.value = borrower.branchcode;
142
143
        form.guarantorsearch.value = _("Change");
144
145
        return 0;
146
    }
147
148
149
150
        var MSG_SEPARATOR = _("Separator must be / in field %s");
21
        var MSG_SEPARATOR = _("Separator must be / in field %s");
151
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
22
        var MSG_INCORRECT_DAY = _("Invalid day entered in field %s");
152
        var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s");
23
        var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s");
Lines 157-162 Link Here
157
        var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron");
28
        var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron");
158
        var MSG_PASSWORD_MISMATCH = _("The passwords entered do not match");
29
        var MSG_PASSWORD_MISMATCH = _("The passwords entered do not match");
159
        var MSG_PASSWORD_CONTAINS_TRAILING_SPACES = _("Password contains leading and/or trailing spaces.");
30
        var MSG_PASSWORD_CONTAINS_TRAILING_SPACES = _("Password contains leading and/or trailing spaces.");
31
        var LABEL_CHANGE = _("Change");
32
        var LABEL_SET_TO_PATRON = _("Set to patron");
160
//]]>
33
//]]>
161
</script>
34
</script>
162
<script type="text/javascript" src="[% themelang %]/js/members.js"></script>
35
<script type="text/javascript" src="[% themelang %]/js/members.js"></script>
163
- 

Return to bug 15692