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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-24 / +29 lines)
Lines 15-37 Link Here
15
    browser.show();
15
    browser.show();
16
16
17
$(document).ready(function(){
17
$(document).ready(function(){
18
19
    // Remove the onclick event defined in browser.js,
20
    // otherwise the deletion confirmation will not work correctly
21
    $('a[href*="biblionumber="]').off('click');
22
18
    [% IF (popup) %]
23
    [% IF (popup) %]
19
        [% IF (opisadd) %]
24
        [% IF (opisadd) %]
20
            window.close();
25
            window.close();
21
        [% END %]
26
        [% END %]
22
    [% END %]
27
    [% END %]
23
            $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
28
            $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
24
		/* Inline edit/delete links */
29
            /* Inline edit/delete links */
25
		var biblionumber = $("input[name='biblionumber']").attr("value");
30
            var biblionumber = $("input[name='biblionumber']").attr("value");
26
        $("tr.editable td").click(function(event){
31
            $("tr.editable").each(function(){
27
			var $tgt = $(event.target);
32
                $(this).find("td:not(:first)").on('click', function(){
28
			if($tgt.is("a")||$tgt.is(":first-child")||$tgt.is(":nth-child(2)")){ return true; } else {
33
                    var rowid = $(this).parent().attr("id");
29
			var rowid = $(this).parent().attr("id");
34
                    num_rowid = rowid.replace("row","");
30
			num_rowid = rowid.replace("row","");
35
                    $(".linktools").remove();
31
			$(".linktools").remove();
36
                    var edit_link = $('<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber='+num_rowid+'&searchid=[% searchid %]#edititem">' + _("Edit item") + '</a>');
32
			$(this).append("<span class=\"linktools\"><a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=edititem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber="+num_rowid+"#edititem\">" + _("Edit item") + "</a> <a href=\"/cgi-bin/koha/cataloguing/additem.pl?op=delitem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber="+num_rowid+"\" onclick=\"confirm_deletion([% biblionumber %],"+num_rowid+"); return false;\">" + _("Delete item") + "</a></span>");
37
                    var delete_link = $('<a href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber='+num_rowid+'&searchid=[% searchid %]">' + _("Delete item") + '</a></span>');
33
		}
38
                    $(delete_link).on('click', function(e) {
34
		});
39
                        return confirm_deletion();
40
                    });
41
                    var tools_node = $('<span class="linktools"></span>');
42
                    $(tools_node).append(edit_link);
43
                    $(tools_node).append(delete_link);
44
                    $(this).append(tools_node);
45
                });
46
            });
35
47
36
    var itemst = $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
48
    var itemst = $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
37
        "aoColumnDefs": [
49
        "aoColumnDefs": [
Lines 79-94 function Dopop(link,i) { Link Here
79
    newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes');
91
    newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes');
80
}
92
}
81
93
82
function confirm_deletion(biblionumber,itemnumber) {
94
function confirm_deletion() {
83
	var original = $("#row"+itemnumber).attr("class");
95
    return confirm(_("Are you sure you want to delete this item?"));
84
	$("#row"+itemnumber).attr("class","confirm");
85
    var is_confirmed = confirm(_("Are you sure you want to delete this item?"));
86
    if (is_confirmed) {
87
    window.location = "additem.pl?op=delitem&biblionumber="+biblionumber+"&itemnumber="+itemnumber;
88
	} else {
89
	$("#row"+itemnumber).attr("class","");
90
    }
91
}
96
}
97
92
//]]>
98
//]]>
93
</script>
99
</script>
94
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
100
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
Lines 155-167 function confirm_deletion(biblionumber,itemnumber) { Link Here
155
                    [% ELSE %]
161
                    [% ELSE %]
156
                      <td>
162
                      <td>
157
                        [% IF ( item_loo.hostitemflag ) %]
163
                        [% IF ( item_loo.hostitemflag ) %]
158
                          <a href="additem.pl?op=edititem&amp;biblionumber=[% item_loo.hostbiblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a> &nbsp; <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&amp;biblionumber=[% biblionumber %]&amp;hostitemnumber=[% item_loo.itemnumber %]">Delink</a>
164
                          <a href="additem.pl?op=edititem&amp;biblionumber=[% item_loo.hostbiblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a> &nbsp; <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&amp;biblionumber=[% biblionumber %]&amp;hostitemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]">Delink</a>
159
                        [% ELSE %]
165
                        [% ELSE %]
160
                          <a href="additem.pl?op=edititem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]#edititem">Edit</a>
166
                          <a href="additem.pl?op=edititem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]#edititem">Edit</a>
161
                          [% IF ( item_loo.countanalytics ) %]
167
                          [% IF ( item_loo.countanalytics ) %]
162
                            <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a>
168
                            <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a>
163
                          [% ELSE %]
169
                          [% ELSE %]
164
                            <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]" onclick="confirm_deletion([% biblionumber %],[% item_loo.itemnumber %]); return false;">Delete</a>
170
                            <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]" onclick="return confirm_deletion();">Delete</a>
165
                          [% END %]
171
                          [% END %]
166
                        [% END %]
172
                        [% END %]
167
                      </td>
173
                      </td>
168
- 

Return to bug 13943