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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-22 / +22 lines)
Lines 21-37 $(document).ready(function(){ Link Here
21
        [% END %]
21
        [% END %]
22
    [% END %]
22
    [% END %]
23
            $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
23
            $("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
24
		/* Inline edit/delete links */
24
            /* Inline edit/delete links */
25
		var biblionumber = $("input[name='biblionumber']").attr("value");
25
            var biblionumber = $("input[name='biblionumber']").attr("value");
26
        $("tr.editable td").click(function(event){
26
            $("tr.editable").each(function(){
27
			var $tgt = $(event.target);
27
                $(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 {
28
                    var rowid = $(this).parent().attr("id");
29
			var rowid = $(this).parent().attr("id");
29
                    num_rowid = rowid.replace("row","");
30
			num_rowid = rowid.replace("row","");
30
                    $(".linktools").remove();
31
			$(".linktools").remove();
31
                    var edit_link = $('<a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber='+num_rowid+'#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>");
32
                    var delete_link = $('<a href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&frameworkcode=[% frameworkcode %]&biblionumber=[% biblionumber %]&itemnumber='+num_rowid+'">' + _("Delete item") + '</a></span>');
33
		}
33
                    $(delete_link).on('click', function(e) {
34
		});
34
                        return confirm_deletion();
35
                    });
36
                    var tools_node = $('<span class="linktools"></span>');
37
                    $(tools_node).append(edit_link);
38
                    $(tools_node).append(delete_link);
39
                    $(this).append(tools_node);
40
                });
41
            });
35
42
36
    var itemst = $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
43
    var itemst = $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
37
        "aoColumnDefs": [
44
        "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');
86
    newin=window.open(link+"&result="+defaultvalue,"valuebuilder",'width=500,height=400,toolbar=false,scrollbars=yes');
80
}
87
}
81
88
82
function confirm_deletion(biblionumber,itemnumber) {
89
function confirm_deletion() {
83
	var original = $("#row"+itemnumber).attr("class");
90
    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
}
91
}
92
92
//]]>
93
//]]>
93
</script>
94
</script>
94
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
95
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
Lines 161-167 function confirm_deletion(biblionumber,itemnumber) { Link Here
161
                          [% IF ( item_loo.countanalytics ) %]
162
                          [% IF ( item_loo.countanalytics ) %]
162
                            <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a>
163
                            <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a>
163
                          [% ELSE %]
164
                          [% 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>
165
                            <a class="delete" href="/cgi-bin/koha/mainpage.pl" onclick="return confirm_deletion();">Delete</a>
165
                          [% END %]
166
                          [% END %]
166
                        [% END %]
167
                        [% END %]
167
                      </td>
168
                      </td>
168
- 

Return to bug 13943