@@ -, +, @@
issues
---
.../intranet-tmpl/prog/en/modules/tools/signs.tt | 60 ++++++++++++----------
opac/opac-signs.pl | 7 +--
tools/signs.pl | 23 +++++----
3 files changed, 50 insertions(+), 40 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/signs.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/signs.tt
@@ -1,31 +1,10 @@
[% USE Koha %]
+[% USE Asset %]
+[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
Koha › Tools › Digital signs
[% INCLUDE 'doc-head-close.inc' %]
-
-[% INCLUDE 'datatables.inc' %]
-
+[% Asset.css("css/datatables.css") %]
[% INCLUDE 'header.inc' %]
@@ -92,9 +71,9 @@
[% UNLESS ( reports ) %]
[% END %]
@@ -464,6 +443,35 @@
[% INCLUDE 'tools-menu.inc' %]
+
+[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'datatables.inc' %]
+
+[% END %]
+
[% INCLUDE 'intranet-bottom.inc' %]
[% BLOCK display_records %]
--- a/opac/opac-signs.pl
+++ a/opac/opac-signs.pl
@@ -26,6 +26,7 @@ use C4::Context;
use C4::Koha;
use C4::Items;
use Koha::AuthorisedValues;
+use Koha::Reports;
use Koha::Signs;
use Koha::SignStreams;
use Koha::SignsToStreams;
@@ -55,11 +56,11 @@ if ( C4::Context->preference('OPACDigitalSigns') ) {
my %record_cache = ();
foreach my $s ( @signstostreams ) {
my $stream = Koha::SignStreams->find( $s->sign_stream_id );
- my $sql = get_saved_report($stream->saved_sql_id);
+ my $sql = Koha::Reports->find($stream->saved_sql_id);
my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $s->sign_to_stream_id });
# Generate SQL with added params
- my $newsql = $sql->{'savedsql'};
+ my $newsql = $sql->savedsql;
foreach my $param ( split /&/, $params->params ) {
my ( $key, $value ) = split /=|<|>/, $param; # The < and > in the split are just to prevent software errors, the sign in the query must be changed in the report itself
$newsql =~ s/$key/$value/g;
@@ -74,7 +75,7 @@ if ( C4::Context->preference('OPACDigitalSigns') ) {
my @processed_records;
foreach my $rec ( @{$records} ) {
unless (defined $record_cache{$rec->{'biblionumber'}}) {
- my $marc = GetMarcBiblio( $rec->{'biblionumber'} );
+ my $marc = GetMarcBiblio({ biblionumber => $rec->{'biblionumber'} });
if ( ! $marc ) {
next;
}
--- a/tools/signs.pl
+++ a/tools/signs.pl
@@ -36,6 +36,7 @@ use Koha::Signs;
use Koha::SignStream;
use Koha::SignStreams;
use Koha::SignsToStreams;
+use Koha::Reports;
use CGI;
use C4::Auth;
@@ -70,7 +71,7 @@ if ( $op eq 'add_stream' ) {
$template->param(
'op' => 'stream_form',
- 'reports' => get_saved_reports( { group => 'SIG' } ),
+ 'reports' => get_saved_reports( { group => 'SIGN' } ),
);
} elsif ( $op eq 'edit_stream' && $sign_stream_id ne '') {
@@ -80,7 +81,7 @@ if ( $op eq 'add_stream' ) {
$template->param(
'op' => 'stream_form',
'stream' => $stream,
- 'reports' => get_saved_reports( { group => 'SIG' } ),
+ 'reports' => get_saved_reports( { group => 'SIGN' } ),
'script_name' => $script_name
);
@@ -97,8 +98,8 @@ if ( $op eq 'add_stream' ) {
} elsif ( $op eq 'view_stream' && $sign_stream_id ne '' ) {
my $stream = Koha::SignStreams->find( $sign_stream_id );
- my $report = get_saved_report($stream->saved_sql_id);
- my $sql = $report->{'savedsql'};
+ my $report = Koha::Reports->find($stream->saved_sql_id);
+ my $sql = $report->savedsql;
my ( $records, $error ) = execute_query( $sql, 0, 999999 );
if ( $records && not $error ) {
$records = $records->fetchall_arrayref({});
@@ -181,10 +182,10 @@ if ( $op eq 'add_stream' ) {
foreach my $s ( @signstostreams ) {
my $stream = Koha::SignStreams->find( $s->sign_stream_id );
- my $sql = get_saved_report($stream->saved_sql_id);
+ my $sql = Koha::Reports->find($stream->saved_sql_id);
my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $s->sign_to_stream_id });
# Generate SQL with added params
- my $newsql = $sql->{'savedsql'};
+ my $newsql = $sql->savedsql;
foreach my $param ( split /&/, $params->params ) {
my ( $key, $value ) = split /=|<|>/, $param; # The < and > in the split are just to prevent software errors, the sign in the query must be changed in the report itself
$newsql =~ s/$key/$value/g;
@@ -246,8 +247,8 @@ if ( $op eq 'add_stream' ) {
# Check if the SQL associated with the stream needs parameters
my $stream = Koha::SignStreams->find( $sign_stream_id );
- my $sql = get_saved_report($stream->saved_sql_id);
- if ( $sql->{'savedsql'} =~ m/WHERE/ ) {
+ my $sql = Koha::Reports->find($stream->saved_sql_id);
+ if ( $sql->savedsql =~ m/WHERE/ ) {
print $cgi->redirect( $script_name . '?op=get_params&sign_to_stream_id=' . $sign_to_stream->sign_to_stream_id . '&sign_stream_id=' . $sign_stream_id . '&sign_id=' . $sign_id );
} else {
print $cgi->redirect( $script_name . '?op=edit_streams&sign_id=' . $sign_id );
@@ -256,10 +257,10 @@ if ( $op eq 'add_stream' ) {
} elsif ( $op eq 'get_params' && $sign_to_stream_id ne '' && $sign_stream_id ne '' && $sign_id ne '' ) {
my $stream = Koha::SignStreams->find( $sign_stream_id );
- my $sql = get_saved_report($stream->saved_sql_id);
+ my $sql = Koha::Reports->find($stream->saved_sql_id);
my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $sign_to_stream_id });
# Generate SQL with added params
- my $newsql = $sql->{'savedsql'};
+ my $newsql = $sql->savedsql;
foreach my $param ( split /&/, $params->params ) {
my ( $key, $value ) = split /=|<|>/, $param; # The < and > in the split are just to prevent software errors, the sign in the query must be changed in the report itself
$newsql =~ s/$key/$value/g;
@@ -302,7 +303,7 @@ if ( $op eq 'add_stream' ) {
$template->param(
'streams' => \@streams,
'signs' => \@signs,
- 'reports' => get_saved_reports( { group => 'SIG' } ),
+ 'reports' => get_saved_reports( { group => 'SIGN' } ),
'OPACBaseURL' => C4::Context->preference( 'OPACBaseURL' ) || '',
'else' => 1
);
--