print MARC::File::XML::footer();
print "\n";
} elsif ( $format eq 'csv' ) {
- unless ( $csv_profile_id ) {
- # FIXME export_format.profile should be a unique key
- my $csv_profiles = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') });
- die "The ExportWithCsvProfile system preference is not defined or does not match a valid csv profile" unless $csv_profiles->count;
- $csv_profile_id = $csv_profiles->next->export_format_id;
- }
+ die 'There is no valid csv profile defined for this export'
+ unless Koha::CsvProfiles->find( $csv_profile_id );
print marc2csv( $record_ids, $csv_profile_id, $itemnumbers );
}
=item csv_profile_id
- If the format is csv, a csv_profile_id can be provide to overwrite the default value (syspref ExportWithCsvProfile).
+ If the format is csv, you have to define a csv_profile_id.
=cut
use CGI::Session;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::AuthorisedValues;
+use Koha::CsvProfiles;
use Koha::Patron;
use Koha::Patron::Debarments qw(GetDebarments);
use Koha::DateUtils;
my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
$template->param( picture => 1 ) if $patron_image;
+if ( C4::Context->preference("ExportCircHistory") ) {
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search ]);
+}
+
my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count;
$template->param(
debt_confirmed => $debt_confirmed,
[% END %]
</fieldset>
- [% IF ( exports_enabled ) %]
+ [% IF Koha.Preference('ExportCircHistory') %]
<fieldset>
<label for="issues-table-output-format"><b>Export checkouts using format:</b></label>
<select name="issues-table-output-format" id="issues-table-output-format">
<option value="iso2709_995">ISO2709 with items</option>
<option value="iso2709">ISO2709 without items</option>
- [% IF Koha.Preference('ExportWithCsvProfile') %]
+ [% IF csv_profiles.size %]
<option value="csv">CSV</option>
[% END %]
</select>
+ [% IF csv_profiles.size %]
+ <select name="csv_profile_id">
+ [% FOREACH csv_profile IN csv_profiles %]
+ <option value="[% csv_profile.export_format_id %]">[% csv_profile.profile %]</option>
+ [% END %]
+ </select>
+ [% END %]
<label for="export_remove_fields">Don't export fields:</label> <input type="text" id="export_remove_fields" name="export_remove_fields" value="[% Koha.Preference('ExportRemoveFields') %]" title="Use for iso2709 exports" />
<input type="hidden" name="op" value="export" />
<input type="hidden" id="output_format" name="output_format" value="iso2709" />
[% USE ColumnsSettings %]
[% USE ItemTypes %]
[% USE Price %]
-[% IF Koha.Preference('ExportRemoveFields') OR Koha.Preference('ExportWithCsvProfile') %]
- [% SET exports_enabled = 1 %]
-[% END %]
[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
[% SET destination = "circ" %]
var theme = "[% theme %]";
var borrowernumber = "[% borrowernumber %]";
var branchcode = "[% branch %]";
-var exports_enabled = "[% exports_enabled %]";
+var exports_enabled = "[% Koha.Preference('ExportCircHistory') %]";
var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 %];
var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 %];
var script = "circulation";
<p>If you checked out an item for on site use you will see that highlighted in red in the checkout summary.</p>
-<p>If you have set your ExportWithCsvProfile preference, you will also see the option to export the patron's current checkout information using a CSV Profile or ISO2709 (MARC21) format.</p>
+<p>If you have set your ExportCircHistory preference, you will also see the option to export the patron's current checkout information using a CSV Profile or ISO2709 (MARC21) format.</p>
<p>Also at the bottom of the page is the list of items the patron has on hold</p>
[% USE KohaDates %]
[% USE AuthorisedValues %]
[% USE ColumnsSettings %]
-[% IF Koha.Preference('ExportRemoveFields') OR Koha.Preference('ExportWithCsvProfile') %]
- [% SET exports_enabled = 1 %]
-[% END %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons ›
[% IF ( unknowuser ) %]
var theme = "[% theme %]";
var borrowernumber = "[% borrowernumber %]";
var branchcode = "[% Branches.GetLoggedInBranchcode() %]";
-var exports_enabled = "[% exports_enabled %]";
+var exports_enabled = "[% Koha.Preference('ExportCircHistory') %]";
var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 %]
var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 %];
var script = "moremember";
}
});
+ $("#output_format > option:first-child").attr("selected", "selected");
+ $("select[name='csv_profile']").hide();
+ $(document).on("change", '#output_format', function(){
+ if ( $(this).val() == 'csv' ) {
+ $("select[name='csv_profile']").show();
+ } else {
+ $("select[name='csv_profile']").hide();
+ }
+ });
+
// Clicking the table cell checks the checkbox inside it
$(document).on("click", 'td', function(e){
if(e.target.tagName.toLowerCase() == 'td'){
use List::MoreUtils qw/uniq/;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::AuthorisedValues;
+use Koha::CsvProfiles;
use Koha::Patron::Debarments qw(GetDebarments);
use Koha::Patron::Images;
use Module::Load;
$template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
}
+if ( C4::Context->preference("ExportCircHistory") ) {
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search ]);
+}
+
# in template <TMPL_IF name="I"> => instutitional (A for Adult, C for children)
$template->param( $data->{'categorycode'} => 1 );
$template->param(
pod2usage(q|CSV output is only available for biblio records|);
}
+if ( $output_format eq 'csv' and not $csv_profile_id ) {
+ pod2usage(q|Define a csv profile to export in CSV|);
+}
if ( $timestamp and $record_type ne 'bibs' ) {
pod2usage(q|--timestamp can only be used with biblios|);
}
}
else {
- unless ( $csv_profile_id ) {
- # FIXME export_format.profile should be a unique key
- my $default_csv_profiles = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') });
- $csv_profile_id = $default_csv_profiles->count ? $default_csv_profiles->next->export_format_id : undef;
- }
Koha::Exporter::Record::export(
{ record_type => $record_type,
record_ids => \@record_ids,
=item B<--csv_profile_id>
--csv_profile_id=ID Generate a CSV file with the given CSV profile id (see tools/csv-profiles.pl)
- Unless provided, the one defined in the system preference 'ExportWithCsvProfile' will be used.
This can only be used to export biblio records.
=item B<--deleted_barcodes>
);
my $csv_profile_id = $query->param('csv_profile_id');
- unless ( $csv_profile_id ) {
- # FIXME export_format.profile should be a unique key
- my $default_csv_profiles = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') });
- $csv_profile_id = $default_csv_profiles->count ? $default_csv_profiles->next->export_format_id : undef;
- }
-
Koha::Exporter::Record::export(
{ record_type => $record_type,
record_ids => \@record_ids,