From 47e2331bd0b233185f8ca9924d141a8b38a82ad5 Mon Sep 17 00:00:00 2001
From: Jonathan Druart
Date: Mon, 3 Nov 2014 17:23:22 +0100
Subject: [PATCH] Bug 13190: Reintroduce the checkouts export feature
Bug 11703 breaks the checkouts export feature.
To reproduce: Fill the ExportWithCsvProfile pref and go on the
circ/circulation.pl page. The export column appears, but not the export
button.
Test plan:
Go on the checkout list (circ/circulation.pl and members/moremember.pl)
and verify the export column and the export button appears.
If you click on the button, a file should be generated.
Signed-off-by: Kyle M Hall
Signed-off-by: Katrin Fischer
Signed-off-by: Tomas Cohen Arazi
---
C4/Record.pm | 3 +-
circ/circulation.pl | 2 -
.../prog/en/js/pages/circulation.js | 11 +-
.../prog/en/modules/circ/circulation.tt | 119 +++++++++++-------
.../prog/en/modules/members/moremember.tt | 15 ++-
tools/export.pl | 2 +-
6 files changed, 91 insertions(+), 61 deletions(-)
diff --git a/C4/Record.pm b/C4/Record.pm
index ed386a3cb6..16d3f54410 100644
--- a/C4/Record.pm
+++ b/C4/Record.pm
@@ -366,6 +366,7 @@ C<$itemnumbers> - a list of itemnumbers to export
sub marc2csv {
my ($biblios, $id, $itemnumbers) = @_;
+ $itemnumbers ||= [];
my $output;
my $csv = Text::CSV::Encoded->new();
@@ -380,7 +381,7 @@ sub marc2csv {
eval $preprocess if ($preprocess);
my $firstpass = 1;
- if ( $itemnumbers ) {
+ if ( @$itemnumbers ) {
for my $itemnumber ( @$itemnumbers) {
my $biblionumber = GetBiblionumberFromItemnumber $itemnumber;
$output .= marcrecord2csv( $biblionumber, $id, $firstpass, $csv, $fieldprocessing, [$itemnumber] );
diff --git a/circ/circulation.pl b/circ/circulation.pl
index 2cf88b8734..bd7f821395 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -621,8 +621,6 @@ $template->param(
SpecifyDueDate => $duedatespec_allow,
CircAutocompl => C4::Context->preference("CircAutocompl"),
AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
- export_remove_fields => C4::Context->preference("ExportRemoveFields"),
- export_with_csv_profile => C4::Context->preference("ExportWithCsvProfile"),
canned_bor_notes_loop => $canned_notes,
debarments => GetDebarments({ borrowernumber => $borrowernumber }),
todaysdate => dt_from_string()->set(hour => 23)->set(minute => 59),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js
index 8ab4d17e5f..cea3e88265 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js
+++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js
@@ -41,15 +41,10 @@ $(document).ready(function() {
minute: 59
});
$("#export_submit").on("click",function(){
- var export_format = $("#export_formats").val();
- export_checkouts(export_format);
+ var output_format = $("#output_format").val();
+ export_checkouts(output_format);
return false;
});
-
- toggle_onsite_checkout();
- $("#onsite_checkout").click(function(){
- toggle_onsite_checkout();
- });
});
function export_checkouts(format) {
@@ -74,7 +69,7 @@ function export_checkouts(format) {
$("#dont_export_item").val(1);
}
- document.getElementById("export_format").value = format;
+ document.getElementById("output_format").value = format;
document.issues.submit();
}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index 7421979215..94ef2575b8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -1,7 +1,7 @@
[% USE Koha %]
[% USE Branches %]
[% USE KohaDates %]
-[% IF ( export_remove_fields OR export_with_csv_profile ) %]
+[% IF Koha.Preference('ExportRemoveFields') OR Koha.Preference('ExportWithCsvProfile') %]
[% SET exports_enabled = 1 %]
[% END %]
[% USE AuthorisedValues %]
@@ -45,17 +45,6 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
[% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %]
[% UNLESS ( borrowernumber ) %][% UNLESS ( selectborrower ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
-$(document).ready(function() {
- [% IF !( CircAutoPrintQuickSlip == 'clear' ) %]
- // listen submit to trigger qslip on empty checkout
- $('#mainform').bind('submit',function() {
- if ($('#barcode').val() == '') {
- return printx_window( '[% CircAutoPrintQuickSlip %]' );
- }
- });
- [% END %]
-});
-
// On-site checkout
function toggle_onsite_checkout(){
if ( $("#onsite_checkout").attr('checked') ) {
@@ -70,6 +59,21 @@ function toggle_onsite_checkout(){
}
}
+$(document).ready(function() {
+ [% IF !( CircAutoPrintQuickSlip == 'clear' ) %]
+ // listen submit to trigger qslip on empty checkout
+ $('#mainform').bind('submit',function() {
+ if ($('#barcode').val() == '') {
+ return printx_window( '[% CircAutoPrintQuickSlip %]' );
+ }
+ });
+ [% END %]
+ toggle_onsite_checkout();
+ $("#onsite_checkout").click(function(){
+ toggle_onsite_checkout();
+ });
+});
+
//]]>
@@ -770,41 +774,66 @@ No patron matched [% message %]
-
-
-
-
-
- Due date
- Due date
- Title
- Item type
- Checked out on
- Checked out from
- Call no
- Charge
- Price
- Renew select all | none
- Check in select all | none
- Export select all | none
-
-
- [% INCLUDE 'checkouts-table-footer.inc' %]
-
-
- Always show checkouts immediately
-
-
-
- [% IF ( CAN_user_circulate_override_renewals ) %]
- [% IF ( AllowRenewalLimitOverride ) %]
- Override renewal limit:
-
+
+
+
[% ELSE %]
Patron has nothing checked out.
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
index 24408cab05..2a3b8186c6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -1,5 +1,8 @@
[% USE Koha %]
[% USE KohaDates %]
+[% IF Koha.Preference('ExportRemoveFields') OR Koha.Preference('ExportWithCsvProfile') %]
+ [% SET exports_enabled = 1 %]
+[% END %]
[% INCLUDE 'doc-head-open.inc' %]
Koha › Patrons ›
[% IF ( unknowuser ) %]
@@ -17,6 +20,7 @@
[% INCLUDE 'timepicker.inc' %]
+