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

(-)a/koha-tmpl/intranet-tmpl/prog/js/letter.js (-2 / +29 lines)
Lines 4-10 Link Here
4
var modal_loading = "<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> "+ __('Loading...') +"</div>";
4
var modal_loading = "<div id=\"loading\"><img src=\"" + interface + "/" + theme + "/img/spinner-small.gif\" alt=\"\" /> "+ __('Loading...') +"</div>";
5
5
6
var editing = 0;
6
var editing = 0;
7
if( add_form == 1 && code !== '' ){
7
if( add_form == 1 && code !== '' || copy_form == 1 && code !== ''){
8
    editing = 1;
8
    editing = 1;
9
}
9
}
10
10
Lines 30-35 function checkCodes( new_lettercode, new_branchcode ){ Link Here
30
    });
30
    });
31
}
31
}
32
32
33
function confirmOverwrite( new_lettercode, new_branchcode ){
34
    var letter_exists;
35
    $.ajax({
36
        data: { code: new_lettercode, branchcode: new_branchcode },
37
        type: 'GET',
38
        url: '/cgi-bin/koha/svc/letters/get/',
39
        async: !1,
40
        success: function (data) {
41
            if ( data.letters.length > 0 ) {
42
                letter_exists = 1;
43
            }
44
        }
45
    });
46
    if(letter_exists){
47
        return confirm(__("A letter with the code '%s' already exists for '%s'. Overwrite this letter?").format(new_lettercode, new_branchcode));
48
    }
49
}
50
33
var Sticky;
51
var Sticky;
34
52
35
$(document).ready(function() {
53
$(document).ready(function() {
Lines 103-108 $(document).ready(function() { Link Here
103
            // Test if code already exists in DB
121
            // Test if code already exists in DB
104
            if( editing == 1 ){ // This is an edit operation
122
            if( editing == 1 ){ // This is an edit operation
105
                // We don't need to check for an existing Code
123
                // We don't need to check for an existing Code
124
                // However if we're copying, provide confirm
125
                // pop up of overwriting existing notice or slip
126
                if(copy_form == 1){
127
                    var new_lettercode = $("#code").val();
128
                    var new_branchcode = $("#branch").val();
129
                    var confirm = confirmOverwrite( new_lettercode, new_branchcode );
130
                    if( confirm && confirm === false){
131
                        return false;
132
                    }
133
                }
106
            } else {
134
            } else {
107
                var new_lettercode = $("#code").val();
135
                var new_lettercode = $("#code").val();
108
                var new_branchcode = $("#branch").val();
136
                var new_branchcode = $("#branch").val();
109
- 

Return to bug 24616