unclosable => @orders ? $basket->{is_standing} : 1,
has_budgets => $has_budgets,
duplinbatch => $duplinbatch,
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'export_basket' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'export_basket' }) ],
);
}
$template->param(
BIBLIO_RESULTS => $resultsarray,
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
bib_list => $bib_list,
);
print $output;
} else {
- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
$template->param(bib_list => $bib_list);
output_html_with_http_headers $query, $cookie, $template->output;
}
-UPDATE export_format SET type = 'late_issues' WHERE type ='sql';
+ALTER TABLE export_format ADD used_for varchar(255) DEFAULT 'export_records' AFTER type;
+
+UPDATE export_format SET used_for = 'late_issues' WHERE type = 'sql';
+UPDATE export_format SET used_for = 'export_records' WHERE type = 'marc';
`subfield_separator` varchar(2) NOT NULL,
`encoding` varchar(255) NOT NULL,
`type` varchar(255) DEFAULT 'marc',
+ `used_for` varchar(255) DEFAULT 'export_records',
PRIMARY KEY (`export_format_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Used for CSV export';
[% END %]
[% BLOCK type_description %]
- [% IF type_code == 'marc' %] MARC for export records
- [% ELSIF type_code == 'late_issues' %] SQL for late serial issues claims
- [% ELSIF type_code == 'export_basket' %] SQL for basket export in acquisition
- [% ELSE %] Uknown type
+ [% IF type_code == 'marc' %] MARC
+ [% ELSIF type_code == 'sql' %] SQL
+ [% ELSE %] Unknown type
+ [% END %]
+[% END %]
+
+[% BLOCK used_for_description %]
+ [% IF used_for_code == 'export_records' %] Export records
+ [% ELSIF used_for_code == 'late_issues' %] Late serial issues claims
+ [% ELSIF used_for_code == 'export_basket' %] Basket export in acquisition
+ [% ELSE %] Unknown usage
[% END %]
[% END %]
<li>
<label for="type" class="required">Profile type: </label>
<select id="type" name="type">
- [% FOREACH type IN [ 'marc' 'late_issues' 'export_basket'] %]
+ [% FOREACH type IN [ 'marc' 'sql'] %]
[% IF csv_profile.type == type %]
<option value="[% type %]" selected="selected">[% PROCESS type_description type_code = type %]</option>
[% ELSE %]
</select>
<span class="required">Required</span>
</li>
+ <li class="sql_specific">
+ <label for="used_for_sql">Usage: </label>
+ <select id="used_for_sql" name="used_for_sql">
+ [% FOREACH used_for IN [ 'late_issues' 'export_basket' ] %]
+ [% IF csv_profile.used_for == used_for %]
+ <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
+ [% ELSE %]
+ <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ <li class="marc_specific">
+ <label for="used_for_marc">Usage: </label>
+ <select id="used_for_marc" name="used_for_marc">
+ [% FOREACH used_for IN [ 'export_records' ] %]
+ [% IF csv_profile.used_for == used_for %]
+ <option value="[% used_for %]" selected="selected">[% PROCESS used_for_description used_for_code = used_for %]</option>
+ [% ELSE %]
+ <option value="[% used_for %]">[% PROCESS used_for_description used_for_code = used_for %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
<li>
<label for="description">Profile description: </label>
<textarea cols="50" rows="2" name="description" id="description">[% csv_profile.description %]</textarea>
<h2>CSV profiles</h2>
- [% IF csv_profiles%]
+ [% IF csv_profiles %]
<table id="table_csv_profiles">
<thead>
<th>CSV profile ID</th>
<th>Content</th>
<th>CSV separator</th>
<th>CSV type</th>
+ <th>Usage</th>
<th> </th>
<th> </th>
</thead>
<td>[% csv_profile.content %]</td>
<td>[% csv_profile.csv_separator %]</td>
<td>[% PROCESS type_description type_code = csv_profile.type %]</td>
+ <td>[% PROCESS used_for_description used_for_code = csv_profile.used_for %]</td>
<td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=add_form&export_format_id=[% csv_profile.export_format_id %]">Edit</a></td>
<td><a href="/cgi-bin/koha/tools/csv-profiles.pl?op=delete_confirm&export_format_id=[% csv_profile.export_format_id %]">Delete</a></td>
</tr>
print $output;
} else {
- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
$template->param(bib_list => $bib_list);
output_html_with_http_headers $query, $cookie, $template->output;
}
} else {
$template->param(fullpage => 1);
}
- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
$template->param( shelf => $shelf );
output_html_with_http_headers $query, $cookie, $template->output;
}
supplierid => $supplierid,
claimletter => $claimletter,
additional_fields_for_subscription => $additional_fields,
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'late_issues' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'sql', used_for => 'late_issues' }) ],
letters => $letters,
(uc(C4::Context->preference("marcflavour"))) => 1
);
my $new_csv_profile_1 = Koha::CsvProfile->new({
profile => 'my_csv_profile_name_for_test_1',
description => 'my_csv_profile_description_for_test_1',
- type => 'late_issues'
+ type => 'sql',
+ used_for => 'late_issues'
})->store;
my $new_csv_profile_2 = Koha::CsvProfile->new({
profile => 'my_csv_profile_name_for_test_2',
description => 'my_csv_profile_description_for_test_2',
- type => 'marc',
+ type => 'marc'
})->store;
like( $new_csv_profile_1->export_format_id, qr|^\d+$|, 'Adding a new csv_profile should have set the export_format_id');
my $profile = $input->param("profile");
my $description = $input->param("description");
my $type = $input->param("type");
+ my $used_for =
+ $type eq "marc"
+ ? $input->param("used_for_marc")
+ : $input->param("used_for_sql");
my $content =
$type eq "marc"
? $input->param("marc_content")
$csv_profile->subfield_separator($subfield_separator);
$csv_profile->encoding($encoding);
$csv_profile->type($type);
+ $csv_profile->used_for($used_for);
eval { $csv_profile->store; };
if ($@) {
subfield_separator => $subfield_separator,
encoding => $encoding,
type => $type,
+ used_for => $used_for,
}
);
eval { $csv_profile->store; };
itemtypes => $itemtypes,
authority_types => $authority_types,
export_remove_fields => C4::Context->preference("ExportRemoveFields"),
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
messages => \@messages,
);
}
}
else {
- $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ]);
$template->param(shelfid => $shelfid);
}
$template->param( messages => \@messages );
messages => \@messages,
category => $category,
print => scalar $query->param('print') || 0,
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
);
output_html_with_http_headers $query, $cookie, $template->output;