Existing sql
+[% current_sql %]+
Updated sql
+[% updated_sql %]+ [% ELSE %] + Something went wrong. + [% END %] +
diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index ac5633a121..717d44f1fd 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -854,7 +854,6 @@ sub get_sql { sub get_results { my ( $report_id ) = @_; my $dbh = C4::Context->dbh; - warn $report_id; return $dbh->selectall_arrayref(q| SELECT id, report, date_run FROM saved_reports @@ -988,6 +987,26 @@ sub _get_display_value { return $original_value; } + +=head3 convert_sql + +my $updated_sql = C4::Reports::Guided::convert_sql( $sql ); + +Convert a sql query using biblioitems.marcxml to use the new +biblio_metadata.metadata field instead + +=cut + +sub convert_sql { + my ( $sql ) = @_; + my $updated_sql = $sql; + if ( $sql =~ m|biblioitems| and $sql =~ m|marcxml| ) { + $updated_sql =~ s|biblioitems|biblio_metadata|; + $updated_sql =~ s|marcxml|metadata|; + } + return $updated_sql; +} + 1; __END__ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/convert_report.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/convert_report.tt new file mode 100644 index 0000000000..de77876850 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/convert_report.tt @@ -0,0 +1,19 @@ +[% INCLUDE 'doc-head-open.inc' %] +
[% current_sql %]+
[% updated_sql %]+ [% ELSE %] + Something went wrong. + [% END %] +