This subroutine returned the csv profiles for a given type.
This could be done easily with the new Koha::CsvProfiles->search method.
Test plan:
To do at the OPAC and staff interface!
1/ Export a list using a CSV profile
2/ Export your CART using a CSV profile
Note that only MARC profiles should be available.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested on staff/opac & cart/list
Small problem on filename extension fixed in followup.
No errors
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
&GetCsvProfiles
&GetCsvProfile
&GetCsvProfileId
- &GetCsvProfilesLoop
&GetMarcFieldsForCsv
);
}
-# Returns informations aboout csv profiles suitable for html templates
-sub GetCsvProfilesLoop {
- my ( $type ) = @_;
- # List of existing profiles
- my $dbh = C4::Context->dbh;
- my $sth;
- my $query = "SELECT export_format_id, profile FROM export_format";
- if ( $type ) {
- $query .= " WHERE type = ?";
- }
-
- $sth = $dbh->prepare($query);
- $sth->execute( $type ? $type : () );
- return $sth->fetchall_arrayref({});
-
-}
-
-
1;
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Koha;
use C4::Biblio;
use C4::Items;
use C4::Auth;
use C4::Output;
-use C4::Csv;
+
+use Koha::CsvProfiles;
my $query = new CGI;
$template->param(
BIBLIO_RESULTS => $resultsarray,
- csv_profiles => GetCsvProfilesLoop('marc'),
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
bib_list => $bib_list,
);
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
use Encode qw(encode);
use C4::Record;
use C4::Ris;
use C4::Csv;
+
+use Koha::CsvProfiles;
+
use utf8;
my $query = new CGI;
print $output;
} else {
- $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
$template->param(bib_list => $bib_list);
output_html_with_http_headers $query, $cookie, $template->output;
}
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
use Encode qw(encode);
use C4::Record;
use C4::Ris;
use C4::Csv;
+
+use Koha::CsvProfiles;
+
use utf8;
my $query = new CGI;
print $output;
} else {
- $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
$template->param(bib_list => $bib_list);
output_html_with_http_headers $query, $cookie, $template->output;
}
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
use Encode qw(encode);
use C4::Ris;
use C4::Csv;
+use Koha::CsvProfiles;
use Koha::Virtualshelves;
use utf8;
} else {
$template->param(fullpage => 1);
}
- $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
$template->param( shelf => $shelf );
output_html_with_http_headers $query, $cookie, $template->output;
}
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
use Encode qw(encode);
use C4::Ris;
use C4::Csv;
+use Koha::CsvProfiles;
use Koha::Virtualshelves;
use utf8;
$format = "csv" if ($format =~ m/^\d+$/);
}
else {
- $template->param(csv_profiles => GetCsvProfilesLoop('marc'));
+ $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
$template->param(shelfid => $shelfid);
}
$template->param( messages => \@messages );
use C4::Members;
use C4::Output;
use C4::XSLT;
+
+use Koha::CsvProfiles;
use Koha::Virtualshelves;
my $query = new CGI;
messages => \@messages,
category => $category,
print => scalar $query->param('print') || 0,
- csv_profiles => GetCsvProfilesLoop('marc'),
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
);
output_html_with_http_headers $query, $cookie, $template->output;