View | Details | Raw Unified | Return to bug 8628
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/signs.tt (-26 / +34 lines)
Lines 1-31 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% USE Asset %]
3
[% SET footerjs = 1 %]
2
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Tools &rsaquo; Digital signs</title>
5
<title>Koha &rsaquo; Tools &rsaquo; Digital signs</title>
4
[% INCLUDE 'doc-head-close.inc' %]
6
[% INCLUDE 'doc-head-close.inc' %]
5
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7
[% Asset.css("css/datatables.css") %]
6
[% INCLUDE 'datatables.inc' %]
7
<script type="text/javascript">
8
//<![CDATA[
9
    $(document).ready(function() {
10
        $("#table_signs").dataTable($.extend(true, {}, dataTablesDefaults, {
11
            "aoColumnDefs": [
12
                { "aTargets": [ -1 ], "bSearchable": false, "bSortable": false },
13
            ],
14
            "sPaginationType": "four_button"
15
        }));
16
        $("#table_streams").dataTable($.extend(true, {}, dataTablesDefaults, {
17
            "aoColumnDefs": [
18
                { "aTargets": [ -1 ], "bSearchable": false, "bSortable": false },
19
            ],
20
            "sPaginationType": "four_button"
21
        }));
22
23
        $(".detach").on("click", function(){
24
            return confirmDelete(_("Are you sure you want to detach this stream from this sign?"));
25
        });
26
    });
27
//]]>
28
</script>
29
</head>
8
</head>
30
<body id="tools_signs" class="tools">
9
<body id="tools_signs" class="tools">
31
[% INCLUDE 'header.inc' %]
10
[% INCLUDE 'header.inc' %]
Lines 92-100 Link Here
92
  [% UNLESS ( reports ) %]
71
  [% UNLESS ( reports ) %]
93
  <div class="dialog alert">
72
  <div class="dialog alert">
94
    <h3>No reports found</h3>
73
    <h3>No reports found</h3>
95
    <p>No reports with group code "SIG" were found. Please <a
74
    <p>No reports with group code "SIGN" were found. Please <a
96
    href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create+report+from+SQL&submit=Create+report+from+SQL">create
75
    href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create+report+from+SQL&submit=Create+report+from+SQL">create
97
    a new report</a> with group code "SIG" and try again.</p>
76
    a new report</a> with group code "SIGN" and try again.</p>
98
  </div>
77
  </div>
99
  [% END %]
78
  [% END %]
100
79
Lines 464-469 Link Here
464
[% INCLUDE 'tools-menu.inc' %]
443
[% INCLUDE 'tools-menu.inc' %]
465
</div>
444
</div>
466
</div>
445
</div>
446
447
[% MACRO jsinclude BLOCK %]
448
    [% INCLUDE 'datatables.inc' %]
449
    <script type="text/javascript">
450
    //<![CDATA[
451
        $(document).ready(function() {
452
            $("#table_signs").dataTable($.extend(true, {}, dataTablesDefaults, {
453
                "autoWidth": false,
454
                "aoColumnDefs": [
455
                    { "aTargets": [ -1 ], "bSearchable": false, "bSortable": false },
456
                ],
457
                "sPaginationType": "four_button"
458
            }));
459
            $("#table_streams").dataTable($.extend(true, {}, dataTablesDefaults, {
460
                "autoWidth": false,
461
                "aoColumnDefs": [
462
                    { "aTargets": [ -1 ], "bSearchable": false, "bSortable": false },
463
                ],
464
                "sPaginationType": "four_button"
465
            }));
466
467
            $(".detach").on("click", function(){
468
                return confirmDelete(_("Are you sure you want to detach this stream from this sign?"));
469
            });
470
        });
471
    //]]>
472
    </script>
473
[% END %]
474
467
[% INCLUDE 'intranet-bottom.inc' %]
475
[% INCLUDE 'intranet-bottom.inc' %]
468
476
469
[% BLOCK display_records %]
477
[% BLOCK display_records %]
(-)a/opac/opac-signs.pl (-3 / +4 lines)
Lines 26-31 use C4::Context; Link Here
26
use C4::Koha;
26
use C4::Koha;
27
use C4::Items;
27
use C4::Items;
28
use Koha::AuthorisedValues;
28
use Koha::AuthorisedValues;
29
use Koha::Reports;
29
use Koha::Signs;
30
use Koha::Signs;
30
use Koha::SignStreams;
31
use Koha::SignStreams;
31
use Koha::SignsToStreams;
32
use Koha::SignsToStreams;
Lines 55-65 if ( C4::Context->preference('OPACDigitalSigns') ) { Link Here
55
        my %record_cache = ();
56
        my %record_cache = ();
56
        foreach my $s ( @signstostreams ) {
57
        foreach my $s ( @signstostreams ) {
57
            my $stream = Koha::SignStreams->find( $s->sign_stream_id );
58
            my $stream = Koha::SignStreams->find( $s->sign_stream_id );
58
            my $sql = get_saved_report($stream->saved_sql_id);
59
            my $sql = Koha::Reports->find($stream->saved_sql_id);
59
            my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $s->sign_to_stream_id });
60
            my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $s->sign_to_stream_id });
60
61
61
            # Generate SQL with added params
62
            # Generate SQL with added params
62
            my $newsql = $sql->{'savedsql'};
63
            my $newsql = $sql->savedsql;
63
            foreach my $param ( split /&/, $params->params ) {
64
            foreach my $param ( split /&/, $params->params ) {
64
                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
65
                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
65
                $newsql =~ s/$key/$value/g;
66
                $newsql =~ s/$key/$value/g;
Lines 74-80 if ( C4::Context->preference('OPACDigitalSigns') ) { Link Here
74
            my @processed_records;
75
            my @processed_records;
75
            foreach my $rec ( @{$records} ) {
76
            foreach my $rec ( @{$records} ) {
76
                unless (defined $record_cache{$rec->{'biblionumber'}}) {
77
                unless (defined $record_cache{$rec->{'biblionumber'}}) {
77
                    my $marc = GetMarcBiblio( $rec->{'biblionumber'} );
78
                    my $marc = GetMarcBiblio({ biblionumber => $rec->{'biblionumber'} });
78
                    if ( ! $marc ) {
79
                    if ( ! $marc ) {
79
                        next;
80
                        next;
80
                    }
81
                    }
(-)a/tools/signs.pl (-12 / +12 lines)
Lines 36-41 use Koha::Signs; Link Here
36
use Koha::SignStream;
36
use Koha::SignStream;
37
use Koha::SignStreams;
37
use Koha::SignStreams;
38
use Koha::SignsToStreams;
38
use Koha::SignsToStreams;
39
use Koha::Reports;
39
40
40
use CGI;
41
use CGI;
41
use C4::Auth;
42
use C4::Auth;
Lines 70-76 if ( $op eq 'add_stream' ) { Link Here
70
71
71
    $template->param(
72
    $template->param(
72
        'op'      => 'stream_form',
73
        'op'      => 'stream_form',
73
        'reports' => get_saved_reports( { group => 'SIG' } ),
74
        'reports' => get_saved_reports( { group => 'SIGN' } ),
74
    );
75
    );
75
76
76
} elsif ( $op eq 'edit_stream' && $sign_stream_id ne '') {
77
} elsif ( $op eq 'edit_stream' && $sign_stream_id ne '') {
Lines 80-86 if ( $op eq 'add_stream' ) { Link Here
80
    $template->param(
81
    $template->param(
81
      'op'          => 'stream_form',
82
      'op'          => 'stream_form',
82
      'stream'      => $stream,
83
      'stream'      => $stream,
83
      'reports'     => get_saved_reports( { group => 'SIG' } ),
84
      'reports'     => get_saved_reports( { group => 'SIGN' } ),
84
      'script_name' => $script_name
85
      'script_name' => $script_name
85
    );
86
    );
86
87
Lines 97-104 if ( $op eq 'add_stream' ) { Link Here
97
98
98
} elsif ( $op eq 'view_stream' && $sign_stream_id ne '' ) {
99
} elsif ( $op eq 'view_stream' && $sign_stream_id ne '' ) {
99
    my $stream = Koha::SignStreams->find( $sign_stream_id );
100
    my $stream = Koha::SignStreams->find( $sign_stream_id );
100
    my $report = get_saved_report($stream->saved_sql_id);
101
    my $report = Koha::Reports->find($stream->saved_sql_id);
101
    my $sql = $report->{'savedsql'};
102
    my $sql = $report->savedsql;
102
    my ( $records, $error ) = execute_query( $sql, 0, 999999 );
103
    my ( $records, $error ) = execute_query( $sql, 0, 999999 );
103
    if ( $records && not $error ) {
104
    if ( $records && not $error ) {
104
        $records = $records->fetchall_arrayref({});
105
        $records = $records->fetchall_arrayref({});
Lines 181-190 if ( $op eq 'add_stream' ) { Link Here
181
182
182
    foreach my $s ( @signstostreams ) {
183
    foreach my $s ( @signstostreams ) {
183
        my $stream = Koha::SignStreams->find( $s->sign_stream_id );
184
        my $stream = Koha::SignStreams->find( $s->sign_stream_id );
184
        my $sql = get_saved_report($stream->saved_sql_id);
185
        my $sql = Koha::Reports->find($stream->saved_sql_id);
185
        my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $s->sign_to_stream_id });
186
        my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $s->sign_to_stream_id });
186
        # Generate SQL with added params
187
        # Generate SQL with added params
187
        my $newsql = $sql->{'savedsql'};
188
        my $newsql = $sql->savedsql;
188
        foreach my $param ( split /&/, $params->params ) {
189
        foreach my $param ( split /&/, $params->params ) {
189
            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
190
            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
190
            $newsql =~ s/$key/$value/g;
191
            $newsql =~ s/$key/$value/g;
Lines 246-253 if ( $op eq 'add_stream' ) { Link Here
246
247
247
    # Check if the SQL associated with the stream needs parameters
248
    # Check if the SQL associated with the stream needs parameters
248
    my $stream = Koha::SignStreams->find( $sign_stream_id );
249
    my $stream = Koha::SignStreams->find( $sign_stream_id );
249
    my $sql = get_saved_report($stream->saved_sql_id);
250
    my $sql = Koha::Reports->find($stream->saved_sql_id);
250
    if ( $sql->{'savedsql'} =~ m/WHERE/ ) {
251
    if ( $sql->savedsql =~ m/WHERE/ ) {
251
        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 );
252
        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 );
252
    } else {
253
    } else {
253
        print $cgi->redirect( $script_name . '?op=edit_streams&sign_id=' . $sign_id );
254
        print $cgi->redirect( $script_name . '?op=edit_streams&sign_id=' . $sign_id );
Lines 256-265 if ( $op eq 'add_stream' ) { Link Here
256
} elsif ( $op eq 'get_params' && $sign_to_stream_id ne '' && $sign_stream_id ne '' && $sign_id ne '' ) {
257
} elsif ( $op eq 'get_params' && $sign_to_stream_id ne '' && $sign_stream_id ne '' && $sign_id ne '' ) {
257
258
258
    my $stream = Koha::SignStreams->find( $sign_stream_id );
259
    my $stream = Koha::SignStreams->find( $sign_stream_id );
259
    my $sql = get_saved_report($stream->saved_sql_id);
260
    my $sql = Koha::Reports->find($stream->saved_sql_id);
260
    my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $sign_to_stream_id });
261
    my $params = Koha::SignsToStreams->find({ sign_to_stream_id => $sign_to_stream_id });
261
    # Generate SQL with added params
262
    # Generate SQL with added params
262
    my $newsql = $sql->{'savedsql'};
263
    my $newsql = $sql->savedsql;
263
    foreach my $param ( split /&/, $params->params ) {
264
    foreach my $param ( split /&/, $params->params ) {
264
        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
265
        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
265
        $newsql =~ s/$key/$value/g;
266
        $newsql =~ s/$key/$value/g;
Lines 302-308 if ( $op eq 'add_stream' ) { Link Here
302
    $template->param(
303
    $template->param(
303
        'streams'     => \@streams,
304
        'streams'     => \@streams,
304
        'signs'       => \@signs,
305
        'signs'       => \@signs,
305
        'reports'     => get_saved_reports( { group => 'SIG' } ),
306
        'reports'     => get_saved_reports( { group => 'SIGN' } ),
306
        'OPACBaseURL' => C4::Context->preference( 'OPACBaseURL' ) || '',
307
        'OPACBaseURL' => C4::Context->preference( 'OPACBaseURL' ) || '',
307
        'else'        => 1
308
        'else'        => 1
308
    );
309
    );
309
- 

Return to bug 8628