+function initExportButton() {
+ var exportmenu = [
+ { text: _("ISO2709 with items"), onclick: {fn: function(){export_submit("iso2709_995")}} },
+ { text: _("ISO2709 without items"), onclick: {fn: function(){export_submit("iso2709")}} },
+ { text: _("CSV"), onclick: {fn: function(){export_submit("csv")}} },
+ ];
+ new YAHOO.widget.Button({
+ type: "menu",
+ label: _("Export checkouts"),
+ name: "exportmenubutton",
+ menu: exportmenu,
+ container: "exportmenuc"
+ });
+}
+
+function export_submit(format) {
+ if ($("input:checkbox[name='biblionumbers'][checked]").length < 1){
+ alert(_("You must select a checkout to export"));
+ return;
+ }
+
+ $("input:checkbox[name='biblionumbers']").each( function(){
+ var input_item = $(this).siblings("input:checkbox");
+ if ( $(this).is(":checked") ) {
+ $(input_item).attr("checked", "checked");
+ } else {
+ $(input_item).attr("checked", "");
+ }
+ } );
+
+ if (format == 'iso2709_995') {
+ format = 'iso2709';
+ $("#dont_export_item").val(0);
+ } else if (format == 'iso2709') {
+ $("#dont_export_item").val(1);
+ } else {
+ [% UNLESS ( export_with_csv_profile ) %]
+ alert(_("You must define a csv profile for export (in tools>CSV export profiles) and fill the ExportWithCsvProfile system preference"));
+ return false;
+ [% END %]
+ }
+ document.issues.action="/cgi-bin/koha/tools/export.pl";
+ document.getElementById("export_format").value = format;
+ document.issues.submit();
+
+ /* Reset form action to its initial value */
+ document.issues.action="/cgi-bin/koha/reserve/renewscript.pl";
+
+};
+