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

(-)a/C4/Search/History.pm (-19 / +26 lines)
Lines 162-198 sub get { Link Here
162
    }
162
    }
163
163
164
    my $query = q{
164
    my $query = q{
165
        SELECT *
165
        SELECT sh.* , s.a_session
166
        FROM search_history
166
        FROM search_history sh
167
        LEFT JOIN sessions s ON (sh.sessionid = s.id)
167
        WHERE 1
168
        WHERE 1
168
    };
169
    };
169
170
170
    $query .= q{ AND id IN ( } . join( q{,}, (q{?}) x @$id ) . q{ )}
171
    my @bind_params;
171
        if @$id;
172
172
173
    $query .= q{
173
    if (@$id) {
174
        AND userid = ?
174
        $query .= q{ AND sh.id IN ( } . join( q{,}, (q{?}) x @$id ) . q{ )};
175
    } if $userid;
175
        push @bind_params, @$id;
176
    }
177
178
    if ($userid) {
179
        $query .= q{ AND sh.userid = ? };
180
        push @bind_params, $userid;
181
    }
176
182
177
    if ($sessionid) {
183
    if ($sessionid) {
178
        $query .=
184
        if (defined $previous) {
179
          $previous
185
            $query .=
180
          ? q{ AND sessionid != ?}
186
              $previous
181
          : q{ AND sessionid = ?};
187
              ? q{ AND sh.sessionid != ?}
188
              : q{ AND sh.sessionid = ?};
189
            push @bind_params, $sessionid;
190
        }
182
    }
191
    }
183
192
184
    $query .= q{ AND type = ?}
193
    if ($type) {
185
      if $type;
194
        $query .= q{ AND sh.type = ?};
195
        push @bind_params, $type;
196
    }
186
197
187
    my $dbh = C4::Context->dbh;
198
    my $dbh = C4::Context->dbh;
188
    my $sth = $dbh->prepare($query);
199
    my $sth = $dbh->prepare($query);
189
    $sth->execute(
200
    $sth->execute(@bind_params);
190
        ( @$id ? ( @$id ) : () ),
191
        ( $userid ? $userid : () ),
192
        ( $sessionid ? $sessionid : () ),
193
        ( $type      ? $type      : () )
194
    );
195
    return $sth->fetchall_arrayref( {} );
201
    return $sth->fetchall_arrayref( {} );
202
196
}
203
}
197
204
198
sub get_from_session {
205
sub get_from_session {
(-)a/catalogue/search-history.pl (-37 / +55 lines)
Lines 20-27 Link Here
20
20
21
use Modern::Perl;
21
use Modern::Perl;
22
use CGI qw ( -utf8 );
22
use CGI qw ( -utf8 );
23
use URI::Escape;
23
24
24
use C4::Auth;
25
use C4::Auth;
26
use C4::Languages;
27
use C4::Search;
25
use C4::Search::History;
28
use C4::Search::History;
26
use C4::Output;
29
use C4::Output;
27
30
Lines 37-97 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
37
40
38
my $type = $cgi->param('type');
41
my $type = $cgi->param('type');
39
my $action = $cgi->param('action') || q{list};
42
my $action = $cgi->param('action') || q{list};
40
my $previous = $cgi->param('previous');
41
43
42
# Deleting search history
44
if ( $action eq 'search' ) {
43
if ( $action eq 'delete' ) {
45
    # Start a new search
44
    my $sessionid = defined $previous
46
45
        ? $cgi->cookie("CGISESSID")
47
    my @ids = $cgi->multi_param('id');
46
        : q{};
48
    my @nots = $cgi->multi_param('not');
49
    my $searches = C4::Search::History::get({
50
        userid => $loggedinuser,
51
        id => \@ids,
52
    });
53
    my @ccl_queries;
54
    foreach my $search (@$searches) {
55
        my $scgi = new CGI($search->{query_cgi});
56
        my @operators = map uri_unescape($_), $scgi->multi_param('op');
57
        my @indexes = map uri_unescape($_), $scgi->multi_param('idx');
58
        my @operands = map uri_unescape($_), $scgi->multi_param('q');
59
        my @limits = map uri_unescape($_), $scgi->multi_param('limit');
60
        my @sort_by = $scgi->param('sort_by');
61
        my $scan = $scgi->param('scan');
62
        my $lang = C4::Languages::getlanguage($cgi);
63
        my ( $error, $query ) =
64
          buildQuery( \@operators, \@operands, \@indexes, \@limits, \@sort_by,
65
            $scan, $lang );
66
67
        if (grep {$_ == $search->{id}} @nots) {
68
            $query = "allrecords,alwaysmatches='' not ($query)";
69
        }
70
71
        push @ccl_queries, $query;
72
    }
73
    my $join = ($cgi->param('join') eq 'or') ? 'or' : 'and';
74
    my $query = 'ccl=(' . join(") $join (", @ccl_queries) . ')';
75
    print $cgi->redirect("/cgi-bin/koha/catalogue/search.pl?q=$query");
76
    exit;
77
} elsif ( $action eq 'delete' ) {
47
    C4::Search::History::delete(
78
    C4::Search::History::delete(
48
        {
79
        {
49
            userid => $loggedinuser,
80
            userid => $loggedinuser,
50
            id     => [ $cgi->param('id') ],
81
            id     => [ $cgi->multi_param('id') ],
51
        }
82
        }
52
    );
83
    );
53
    # Redirecting to this same url so the user won't see the search history link in the header
84
    # Redirecting to this same url so the user won't see the search history link in the header
54
    print $cgi->redirect('/cgi-bin/koha/catalogue/search-history.pl');
85
    print $cgi->redirect('/cgi-bin/koha/catalogue/search-history.pl');
55
86
    exit;
56
# Showing search history
57
} else {
87
} else {
58
    my $current_searches = C4::Search::History::get({
88
    # Showing search history
89
    my $searches = C4::Search::History::get({
59
        userid => $loggedinuser,
90
        userid => $loggedinuser,
60
        sessionid => $cgi->cookie("CGISESSID")
91
        sessionid => $cgi->cookie("CGISESSID")
61
    });
92
    });
62
    my @current_biblio_searches = map {
93
    foreach my $row (@$searches) {
63
        $_->{type} eq 'biblio' ? $_ : ()
94
        if ($row->{a_session}) {
64
    } @$current_searches;
95
            $row->{session} = YAML::Load($row->{a_session});
65
96
            $row->{session}->{session_ctime} = $row->{session}->{_SESSION_CTIME};
66
    my @current_authority_searches = map {
97
            $row->{session}->{session_id} = $row->{session}->{_SESSION_ID};
67
        $_->{type} eq 'authority' ? $_ : ()
98
        }
68
    } @$current_searches;
99
    }
69
100
    my @biblio_searches = map {
70
    my $previous_searches = C4::Search::History::get({
71
        userid => $loggedinuser,
72
        sessionid => $cgi->cookie("CGISESSID"),
73
        previous => 1
74
    });
75
76
    my @previous_biblio_searches = map {
77
        $_->{type} eq 'biblio' ? $_ : ()
101
        $_->{type} eq 'biblio' ? $_ : ()
78
    } @$previous_searches;
102
    } @$searches;
79
103
80
    my @previous_authority_searches = map {
104
    my @authority_searches = map {
81
        $_->{type} eq 'authority' ? $_ : ()
105
        $_->{type} eq 'authority' ? $_ : ()
82
    } @$previous_searches;
106
    } @$searches;
83
107
84
    $template->param(
108
    $template->param(
85
        current_biblio_searches => \@current_biblio_searches,
109
        biblio_searches => \@biblio_searches,
86
        current_authority_searches => \@current_authority_searches,
110
        authority_searches => \@authority_searches,
87
        previous_biblio_searches => \@previous_biblio_searches,
111
        sessionid => $cgi->cookie("CGISESSID"),
88
        previous_authority_searches => \@previous_authority_searches,
89
90
    );
112
    );
91
}
113
}
92
114
93
94
$template->param(
95
);
96
97
output_html_with_http_headers $cgi, $cookie, $template->output;
115
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt (-155 / +131 lines)
Lines 1-9 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
[% USE Koha %]
4
[% USE Koha %]
6
[% USE KohaDates %]
5
[% USE KohaDates %]
6
[% USE date %]
7
8
[% BLOCK search_history_table %]
9
  <form action="/cgi-bin/koha/catalogue/search-history.pl" method="get">
10
    [%# Search from multiple lines is only enabled for biblios %]
11
    [% IF type == 'biblio' %]
12
    <div>
13
      <a href="#" class="action_search">Start a new search</a>
14
      <span class='search_options'>
15
        <span>New search:</span>
16
        <select name='join'>
17
          <option value="or" selected="selected">match any of selected searches</option>
18
          <option value="and">match all of selected searches</option>
19
        </select>
20
        <button type="submit">Go</button>
21
        <a href="#" class="action_search_cancel">Cancel</a>
22
      </span>
23
    </div>
24
    [% END %]
25
    <div class="selections-toolbar">
26
      <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
27
      <span class="sep">|</span>
28
      <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
29
      <span class="sep">|</span>
30
      <span class="links">
31
        <span class="selections">Select searches to: </span>
32
        <a href="#" class="action_delete disabled">Delete</a>
33
      </span>
34
    </div>
35
    <input type="hidden" name="action" value="delete" />
36
    <table class="historyt">
37
      <thead>
38
        <tr>
39
          <th></th>
40
          <th class="not">Not</th>
41
          <th>Session date</th>
42
          <th>Date</th>
43
          <th>Search</th>
44
          <th>Results</th>
45
        </tr>
46
      </thead>
47
      <tbody>
48
      [% FOREACH s IN searches %]
49
        <tr>
50
          <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
51
          <td class="not">
52
            <select name="not">
53
              <option value=""></option>
54
              <option value="[% s.id %]" title="Search for the opposite of the criteria on this row">NOT</option>
55
            </select>
56
          </td>
57
          <td>
58
            [% IF s.session %]
59
              [% session_ctime = date.format(s.session.session_ctime, '%Y-%m-%d %H:%M:%S') %]
60
              <span title="[% session_ctime %]">
61
                [% IF s.session.session_id == sessionid %]
62
                  <strong title="Current session">
63
                [% END %]
64
                [% session_ctime | $KohaDates %]
65
                [% IF s.session.session_id == sessionid %]
66
                  </strong>
67
                [% END %]
68
              </span>
69
            [% ELSE %]
70
              <span title="">Unknown</span>
71
            [% END %]
72
          </td>
73
          <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
74
          [% IF type == 'biblio' %]
75
            [% search_url = '/cgi-bin/koha/catalogue/search.pl' %]
76
          [% ELSE %]
77
            [% search_url = '/cgi-bin/koha/authorities/authorities-home.pl' %]
78
          [% END %]
79
          <td><a href="[% search_url %]?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
80
          <td>[% s.total %]</td>
81
        </tr>
82
      [% END %]
83
      </tbody>
84
    </table>
85
  </form>
86
[% END %]
87
88
[% INCLUDE 'doc-head-open.inc' %]
7
<title>Koha &rsaquo; Catalog &rsaquo; Search history</title>
89
<title>Koha &rsaquo; Catalog &rsaquo; Search history</title>
8
[% INCLUDE 'doc-head-close.inc' %]
90
[% INCLUDE 'doc-head-close.inc' %]
9
[% Asset.css("css/datatables.css") | $raw %]
91
[% Asset.css("css/datatables.css") | $raw %]
Lines 29-189 Link Here
29
          <li><a href="#authority_tab">Authority</a></li>
111
          <li><a href="#authority_tab">Authority</a></li>
30
        </ul>
112
        </ul>
31
        <div id="biblio_tab">
113
        <div id="biblio_tab">
32
          [% IF ( current_biblio_searches ) %]
114
          [% IF ( biblio_searches ) %]
33
            <h2>Current session</h2>
115
            [% INCLUDE search_history_table
34
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
116
              searches = biblio_searches
35
              <div class="selections-toolbar">
117
              type = 'biblio' %]
36
                <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
118
          [% ELSE %]
37
                <span class="sep">|</span>
38
                <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
39
                <span class="sep">|</span>
40
                <span class="links">
41
                  <span class="selections">Select searches to: </span>
42
                  <a href="#" class="action_delete disabled">Delete</a>
43
                </span>
44
              </div>
45
              <input type="hidden" name="action" value="delete" />
46
              <table class="historyt">
47
                <thead>
48
                  <tr>
49
                    <th></th>
50
                    <th>Date</th>
51
                    <th>Search</th>
52
                    <th>Results</th>
53
                  </tr>
54
                </thead>
55
                <tbody>
56
                [% FOREACH s IN current_biblio_searches %]
57
                  <tr>
58
                    <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
59
                    <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
60
                    <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | html %]">[% s.query_desc | html %]</a></td>
61
                    <td>[% s.total | html %]</td>
62
                  </tr>
63
                [% END %]
64
                </tbody>
65
              </table>
66
            </form>
67
          [% END %]
68
69
          [% IF ( previous_biblio_searches ) %]
70
            <h2>Previous sessions</h2>
71
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
72
              <div class="selections-toolbar">
73
                <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
74
                <span class="sep">|</span>
75
                <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
76
                <span class="sep">|</span>
77
                <span class="links">
78
                  <span class="selections">Select searches to: </span>
79
                  <a href="#" class="action_delete disabled">Delete</a>
80
                </span>
81
              </div>
82
              <input type="hidden" name="action" value="delete" />
83
              <table class="historyt">
84
                <thead>
85
                  <tr>
86
                    <th></th>
87
                    <th>Date</th>
88
                    <th>Search</th>
89
                    <th>Results</th>
90
                  </tr>
91
                </thead>
92
                <tbody>
93
                [% FOREACH s IN previous_biblio_searches %]
94
                  <tr>
95
                    <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
96
                    <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
97
                    <td><a href="/cgi-bin/koha/catalogue/search.pl?[% s.query_cgi | html %]">[% s.query_desc | html %]</a></td>
98
                    <td>[% s.total | html %]</td>
99
                  </tr>
100
                [% END %]
101
                </tbody>
102
              </table>
103
            </form>
104
          [% END %]
105
106
          [% IF !current_biblio_searches && !previous_biblio_searches %]
107
            <p>Your catalog search history is empty.</p>
119
            <p>Your catalog search history is empty.</p>
108
          [% END %]
120
          [% END %]
109
        </div>
121
        </div>
110
122
111
        <div id="authority_tab">
123
        <div id="authority_tab">
112
          [% IF ( current_authority_searches ) %]
124
          [% IF ( authority_searches ) %]
113
            <h2>Current session</h2>
125
            [% INCLUDE search_history_table
114
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
126
              searches = authority_searches
115
              <div class="selections-toolbar">
127
              type = 'authority' %]
116
                <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
128
          [% ELSE %]
117
                <span class="sep">|</span>
118
                <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
119
                <span class="sep">|</span>
120
                <span class="links">
121
                  <span class="selections">Select searches to: </span>
122
                  <a href="#" class="action_delete disabled">Delete</a>
123
                </span>
124
              </div>
125
              <input type="hidden" name="action" value="delete" />
126
              <table class="historyt">
127
                <thead>
128
                  <tr>
129
                    <th></th>
130
                    <th>Date</th>
131
                    <th>Search</th>
132
                    <th>Results</th>
133
                  </tr>
134
                </thead>
135
                <tbody>
136
                [% FOREACH s IN current_authority_searches %]
137
                  <tr>
138
                    <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
139
                    <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
140
                    <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | html %]">[% s.query_desc | html %]</a></td>
141
                    <td>[% s.total | html %]</td>
142
                  </tr>
143
                [% END %]
144
                </tbody>
145
              </table>
146
            </form>
147
          [% END %]
148
149
          [% IF ( previous_authority_searches ) %]
150
            <h2>Previous sessions</h2>
151
            <form action="/cgi-bin/koha/catalogue/search-history.pl" method="post">
152
              <div class="selections-toolbar">
153
                <a class="CheckAll" href="#"><i class="fa fa-check"></i> Select all visible rows</a>
154
                <span class="sep">|</span>
155
                <a class="CheckNone" href="#"><i class="fa fa-remove"></i> Clear selection on visible rows</a>
156
                <span class="sep">|</span>
157
                <span class="links">
158
                  <span class="selections">Select searches to: </span>
159
                  <a href="#" class="action_delete disabled">Delete</a>
160
                </span>
161
              </div>
162
              <input type="hidden" name="action" value="delete" />
163
              <table class="historyt">
164
                <thead>
165
                  <tr>
166
                    <th></th>
167
                    <th>Date</th>
168
                    <th>Search</th>
169
                    <th>Results</th>
170
                  </tr>
171
                </thead>
172
                <tbody>
173
                [% FOREACH s IN previous_authority_searches %]
174
                  <tr>
175
                    <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
176
                    <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
177
                    <td><a href="/cgi-bin/koha/authorities/authorities-home.pl?[% s.query_cgi | html %]">[% s.query_desc | html %]</a></td>
178
                    <td>[% s.total | html %]</td>
179
                  </tr>
180
                [% END %]
181
                </tbody>
182
              </table>
183
            </form>
184
          [% END %]
185
186
          [% IF !current_authority_searches && !previous_authority_searches %]
187
            <p>Your authority search history is empty.</p>
129
            <p>Your authority search history is empty.</p>
188
          [% END %]
130
          [% END %]
189
        </div> [% # /authority_tab %]
131
        </div> [% # /authority_tab %]
Lines 200-209 Link Here
200
        // We show table ordered by descending dates by default
142
        // We show table ordered by descending dates by default
201
        // (so that the more recent query is shown first)
143
        // (so that the more recent query is shown first)
202
        $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
144
        $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
203
            "aaSorting": [[ 1, "desc" ]],
145
            "aaSorting": [[ 3, "desc" ]],
204
            "aoColumnDefs": [
146
            "aoColumnDefs": [
205
                { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
147
                { "aTargets": [ 0, 1 ], "bSortable": false, "bSearchable": false },
206
                { "aTargets": [ 1 ], "sType": "title-string" },
148
                { "aTargets": [ 2, 3 ], "sType": "title-string" },
149
                { "aTargets": [ 1 ], "bVisible": false }
207
            ],
150
            ],
208
            "sPaginationType": "full_numbers"
151
            "sPaginationType": "full_numbers"
209
        }));
152
        }));
Lines 222-228 Link Here
222
            var new_form = $('<form>')
165
            var new_form = $('<form>')
223
                .attr('action', form.attr('action'))
166
                .attr('action', form.attr('action'))
224
                .attr('method', form.attr('method'));
167
                .attr('method', form.attr('method'));
225
            form.find('input[type="hidden"]')
168
            form.find('input[type="hidden"],select')
226
                .add(table.$('input:checkbox:checked'))
169
                .add(table.$('input:checkbox:checked'))
227
                .each(function() {
170
                .each(function() {
228
                    var input = $('<input type="hidden">')
171
                    var input = $('<input type="hidden">')
Lines 269-279 Link Here
269
            }
212
            }
270
213
271
            if ( confirm(msg) ) {
214
            if ( confirm(msg) ) {
215
                form.find('input[name="action"]').val('delete');
272
                form.submit();
216
                form.submit();
273
            }
217
            }
274
            return false;
218
            return false;
275
        });
219
        });
276
220
221
        $(".action_search").click(function() {
222
          var $form = $(this).parents('form');
223
          var table = $form.find('table').dataTable();
224
          var $checked = table.$('input:checkbox:checked');
225
          $(this).hide();
226
          $('.search_options').show();
227
          table.fnSetColumnVis(1, true);
228
          return false;
229
        });
230
231
        $('.search_options button[type="submit"]').click(function() {
232
          var $form = $(this).parents('form');
233
          var table = $form.find('table').dataTable();
234
          var $checked = table.$('input:checkbox:checked');
235
          if ($checked.length) {
236
            $form.find('input[name="action"]').val('search');
237
            $form.submit();
238
          } else {
239
            alert(_("You have to select searches first"));
240
          }
241
          return false;
242
        });
243
244
        $('.action_search_cancel').click(function() {
245
          var form = $(this).parents('form').first();
246
          var table = form.find('table').dataTable();
247
          $('.action_search').show();
248
          $('.search_options').hide();
249
          table.fnSetColumnVis(1, false);
250
          return false;
251
        }).click();
252
277
        $('#tabs form').each(function() {
253
        $('#tabs form').each(function() {
278
            enableCheckboxActions($(this));
254
            enableCheckboxActions($(this));
279
        });
255
        });
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt (-181 / +160 lines)
Lines 2-7 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE KohaDates %]
4
[% USE KohaDates %]
5
[% USE date %]
6
7
[% BLOCK search_history_table %]
8
  <form action="/cgi-bin/koha/opac-search-history.pl" method="get">
9
    <div>
10
      [% IF type == 'biblio' %]
11
        <a href="#" class="action_search">Start a new search</a>
12
        <span class='search_options form-inline'>
13
          <span>New search:</span>
14
          <select name='join'>
15
            <option value="or" selected="selected">match any of selected searches</option>
16
            <option value="and">match all of selected searches</option>
17
          </select>
18
          <button type="submit">Go</button>
19
          <a href="#" class="action_search_cancel">Cancel</a>
20
        </span>
21
        &nbsp;
22
      [% END %]
23
    </div>
24
    <div class="selections-toolbar toolbar">
25
      <a class="CheckAll" href="#">Select all</a>
26
      <a class="CheckNone" href="#">Clear all</a>
27
      <span class="sep">|</span>
28
      <span class="links">
29
        <span class="selections">Select searches to: </span>
30
        <a href="#" class="removeitems disabled">Delete</a>
31
      </span>
32
    </div>
33
    <input type="hidden" name="action" value="delete" />
34
    <table class="historyt table table-bordered table-striped">
35
      <thead>
36
        <tr>
37
          <th></th>
38
          <th class="not">Not</th>
39
          [% IF hide_session_column %]
40
            <th class="hide">Session date</th>
41
          [% ELSE %]
42
            <th>Session date</th>
43
          [% END %]
44
          <th>Date</th>
45
          <th>Search</th>
46
          <th>Results</th>
47
        </tr>
48
      </thead>
49
      <tbody>
50
      [% FOREACH s IN searches %]
51
        <tr>
52
          <td><input type="checkbox" name="id" value="[% s.id %]" /></td>
53
          <td class="not">
54
            <select name="not">
55
              <option value=""></option>
56
              <option value="[% s.id %]" title="Search for the opposite of the criteria on this row">NOT</option>
57
            </select>
58
          </td>
59
          [% IF hide_session_column %]
60
            <td class="hide">
61
          [% ELSE %]
62
            <td>
63
          [% END %]
64
            [% IF s.session %]
65
              [% session_ctime = date.format(s.session.session_ctime, '%Y-%m-%d %H:%M:%S') %]
66
              <span title="[% session_ctime %]">
67
                [% IF s.session.session_id == sessionid %]
68
                  <strong title="Current session">
69
                [% END %]
70
                [% session_ctime | $KohaDates %]
71
                [% IF s.session.session_id == sessionid %]
72
                  </strong>
73
                [% END %]
74
              </span>
75
            [% ELSE %]
76
              <span title="">Unknown</span>
77
            [% END %]
78
          </td>
79
          <td><span title="[% s.time %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
80
          [% IF type == 'biblio' %]
81
            [% search_url = '/cgi-bin/koha/opac-search.pl' %]
82
          [% ELSIF type == 'authority' %]
83
            [% search_url = '/cgi-bin/koha/opac-authorities-home.pl' %]
84
          [% END %]
85
          <td>
86
            [% IF type == 'biblio' %]
87
              <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html |url %][% limit_cgi |html | url %]&amp;[% s.query_cgi |html %]&amp;count=[% countrss |html %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink">
88
                <img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/>
89
              </a>
90
            [% END %]
91
            <a href="[% search_url %]?[% s.query_cgi |html %]">[% s.query_desc |html %]</a></td>
92
          <td>[% s.total %]</td>
93
        </tr>
94
      [% END %]
95
      </tbody>
96
    </table>
97
    <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
98
  </form>
99
[% END %]
100
5
[% INCLUDE 'doc-head-open.inc' %]
101
[% INCLUDE 'doc-head-open.inc' %]
6
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your search history</title>
102
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your search history</title>
7
[% INCLUDE 'doc-head-close.inc' %]
103
[% INCLUDE 'doc-head-close.inc' %]
Lines 34-219 Link Here
34
                <div class="span12">
130
                <div class="span12">
35
            [% END %]
131
            [% END %]
36
                <div id="searchhistory" class="maincontent">
132
                <div id="searchhistory" class="maincontent">
37
                    <h1>Search history</h1>
133
                  <h1>Search history</h1>
38
                    [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
134
                  [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
39
                        <div id="tabs" class="toptabs">
135
                    <div id="tabs" class="toptabs">
40
                            <ul>
136
                      <ul>
41
                                <li><a href="#biblio_tab">Catalog</a></li>
137
                        <li><a href="#biblio_tab">Catalog</a></li>
42
                                <li><a href="#authority_tab">Authority</a></li>
138
                        <li><a href="#authority_tab">Authority</a></li>
43
                            </ul>
139
                      </ul>
140
                  [% END %]
141
                  <div id="biblio_tab">
142
                    [% IF ( biblio_searches ) %]
143
                      [% INCLUDE search_history_table
144
                        searches = biblio_searches
145
                        type = 'biblio' %]
146
                    [% ELSE %]
147
                      <p>Your catalog search history is empty.</p>
44
                    [% END %]
148
                    [% END %]
45
                        <div id="biblio_tab">
149
                  </div>
46
                            <div id="current_biblio">
47
                                [% IF ( current_biblio_searches ) %]
48
                                    <h2>Current session</h2>
49
                                    <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
50
                                        <div class="selections-toolbar toolbar">
51
                                            <a class="CheckAll" href="#">Select all</a>
52
                                            <a class="CheckNone" href="#">Clear all</a>
53
                                            <span class="sep">|</span>
54
                                            <span class="links">
55
                                                <span class="selections">Select searches to: </span>
56
                                                <a href="#" class="removeitems disabled">Delete</a>
57
                                            </span>
58
                                        </div>
59
                                        <input type="hidden" name="action" value="delete" />
60
                                        <table class="historyt table table-bordered table-striped">
61
                                            <thead>
62
                                                <tr>
63
                                                    <th></th>
64
                                                    <th>Date</th>
65
                                                    <th>Search</th>
66
                                                    <th>Results</th>
67
                                                </tr>
68
                                            </thead>
69
                                            <tbody>
70
                                                [% FOREACH s IN current_biblio_searches %]
71
                                                    <tr>
72
                                                        <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
73
                                                        <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
74
                                                        <td><a href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html |url %][% limit_cgi |html | url %]&amp;[% s.query_cgi | html %]&amp;count=[% countrss | html %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | html %]">[% s.query_desc | html %]</a></td>
75
                                                        <td>[% s.total | html %]</td>
76
                                                    </tr>
77
                                                [% END %]
78
                                            </tbody>
79
                                        </table>
80
                                        <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
81
                                    </form>
82
                                [% END # IF ( current_biblio_searches ) %]
83
                            </div> <!-- / #current_biblio -->
84
85
                            <div id="previous_biblio">
86
                                [% IF ( previous_biblio_searches ) %]
87
                                    <h2>Previous sessions</h2>
88
                                    <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
89
                                        <div class="selections-toolbar toolbar">
90
                                            <a class="CheckAll" href="#">Select all</a>
91
                                            <a class="CheckNone" href="#">Clear all</a>
92
                                            <span class="sep">|</span>
93
                                            <span class="links">
94
                                                <span class="selections">Select searches to: </span>
95
                                                <a href="#" class="removeitems disabled">Delete</a>
96
                                            </span>
97
                                        </div>
98
99
                                        <input type="hidden" name="action" value="delete" />
100
                                        <table class="historyt table table-bordered table-striped">
101
                                            <thead>
102
                                                <tr>
103
                                                    <th></th>
104
                                                    <th>Date</th>
105
                                                    <th>Search</th>
106
                                                    <th>Results</th>
107
                                                </tr>
108
                                            </thead>
109
                                            <tbody>
110
                                            [% FOREACH s IN previous_biblio_searches %]
111
                                                <tr>
112
                                                    <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
113
                                                    <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
114
                                                    <td><a href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html |url %][% limit_cgi |html | url %]&amp;[% s.query_cgi | html %]&amp;count=[% countrss | html %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | html %]">[% s.query_desc | html %]</a></td>
115
                                                    <td>[% s.total | html %]</td>
116
                                                </tr>
117
                                            [% END %]
118
                                            </tbody>
119
                                        </table>
120
                                        <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
121
                                    </form>
122
                                [% END # IF ( previous_biblio_searches ) %]
123
                            </div> <!-- / #previous_biblio -->
124
125
                            [% IF !current_biblio_searches && !previous_biblio_searches %]
126
                                <p>Your catalog search history is empty.</p>
127
                            [% END %]
128
                        </div> <!-- / #biblio_tab -->
129
150
130
                        [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
151
                  [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]
131
                            <div id="authority_tab">
152
                    <div id="authority_tab">
132
                                [% IF ( current_authority_searches ) %]
153
                      [% IF ( authority_searches ) %]
133
                                    <h2>Current session</h2>
154
                        [% INCLUDE search_history_table
134
                                    <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
155
                          searches = authority_searches
135
                                        <div class="selections-toolbar toolbar">
156
                          type = 'authority' %]
136
                                            <a class="CheckAll" href="#">Select all</a>
157
                      [% ELSE %]
137
                                            <a class="CheckNone" href="#">Clear all</a>
158
                        <p>Your authority search history is empty.</p>
138
                                            <span class="sep">|</span>
159
                      [% END %]
139
                                            <span class="links">
160
                    </div>
140
                                                <span class="selections">Select searches to: </span>
161
                  [% END %]
141
                                                <a href="#" class="removeitems disabled">Delete</a>
162
                </div> <!-- / #search_history -->
142
                                            </span>
163
        </div> <!-- / .span10/12 -->
143
                                        </div>
164
    </div> <!-- / .row-fluid -->
144
                                        <input type="hidden" name="action" value="delete" />
165
</div> <!-- / .container-fluid -->
145
                                        <table class="historyt table table-bordered table-striped">
146
                                            <thead>
147
                                                <tr>
148
                                                    <th></th>
149
                                                    <th>Date</th>
150
                                                    <th>Search</th>
151
                                                    <th>Results</th>
152
                                                </tr>
153
                                            </thead>
154
                                            <tbody>
155
                                                [% FOREACH s IN current_authority_searches %]
156
                                                    <tr>
157
                                                        <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
158
                                                        <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
159
                                                        <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | html %]">[% s.query_desc | html %]</a></td>
160
                                                        <td>[% s.total | html %]</td>
161
                                                    </tr>
162
                                                [% END %]
163
                                            </tbody>
164
                                        </table>
165
                                        <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
166
                                    </form>
167
                                [% END # / IF ( current_authority_searches ) %]
168
169
                                [% IF ( previous_authority_searches ) %]
170
                                    <h2>Previous sessions</h2>
171
                                    <form action="/cgi-bin/koha/opac-search-history.pl" method="post">
172
                                        <div class="selections-toolbar toolbar">
173
                                            <a class="CheckAll" href="#">Select all</a>
174
                                            <a class="CheckNone" href="#">Clear all</a>
175
                                            <span class="sep">|</span>
176
                                            <span class="links">
177
                                                <span class="selections">Select searches to: </span>
178
                                                <a href="#" class="removeitems disabled">Delete</a>
179
                                            </span>
180
                                        </div>
181
                                        <input type="hidden" name="action" value="delete" />
182
                                        <table class="historyt table table-bordered table-striped">
183
                                            <thead>
184
                                                <tr>
185
                                                    <th></th>
186
                                                    <th>Date</th>
187
                                                    <th>Search</th>
188
                                                    <th>Results</th>
189
                                                </tr>
190
                                            </thead>
191
                                            <tbody>
192
                                                [% FOREACH s IN previous_authority_searches %]
193
                                                    <tr>
194
                                                        <td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
195
                                                        <td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 | html %]</span></td>
196
                                                        <td><a href="/cgi-bin/koha/opac-authorities-home.pl?[% s.query_cgi | html %]">[% s.query_desc | html %]</a></td>
197
                                                        <td>[% s.total | html %]</td>
198
                                                    </tr>
199
                                                [% END %]
200
                                            </tbody>
201
                                        </table>
202
                                        <input type="submit" class="btn btn-danger remove-selected" value="Remove selected searches">
203
                                    </form>
204
                                [% END # / IF ( previous_authority_searches )%]
205
206
                                [% IF !current_authority_searches && !previous_authority_searches %]
207
                                    <p>Your authority search history is empty.</p>
208
                                [% END %]
209
                            </div> <!-- / #authority_tab -->
210
                        [% END # / IF Koha.Preference( 'OpacAuthorities' ) %]
211
                    </div> <!-- / #tabs -->
212
                </div> <!-- / #searchhistory -->
213
            </div> <!-- / .span10/12 -->
214
        </div> <!-- / .row-fluid -->
215
    </div> <!-- / .container-fluid -->
216
</div> <!-- / #main -->
217
166
218
[% INCLUDE 'opac-bottom.inc' %]
167
[% INCLUDE 'opac-bottom.inc' %]
219
[% BLOCK jsinclude %]
168
[% BLOCK jsinclude %]
Lines 226-235 Link Here
226
        // We show table ordered by descending dates by default
175
        // We show table ordered by descending dates by default
227
        // (so that the more recent query is shown first)
176
        // (so that the more recent query is shown first)
228
        $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
177
        $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, {
229
            "order": [[ 1, "desc" ]],
178
            "order": [[ 3, "desc" ]],
230
            "columnDefs": [
179
            "columnDefs": [
231
                { "targets": [ 0 ], "sortable": false, "searchable": false },
180
                { "targets": [ 0, 1 ], "sortable": false, "searchable": false },
232
                { "targets": [ 1 ], "type": "title-string" },
181
                { "targets": [ 2, 3 ], "type": "title-string" },
233
            ]
182
            ]
234
        }));
183
        }));
235
184
Lines 265-270 Link Here
265
            }
214
            }
266
            return false;
215
            return false;
267
        });
216
        });
217
        $(".action_search").click(function() {
218
          var $form = $(this).parents('form');
219
          $(this).hide();
220
          $('.search_options').show();
221
          $('.not').show();
222
          return false;
223
        });
224
225
        $('.search_options button[type="submit"]').click(function() {
226
          var $form = $(this).parents('form');
227
          var $checked = $form.find('input:checkbox:checked');
228
          if ($checked.length ) {
229
            $form.find('input[name="action"]').val('search');
230
            $form.submit();
231
          } else {
232
            alert(_("You have to select searches first"));
233
          }
234
          return false;
235
        });
236
237
        $('.action_search_cancel').click(function() {
238
          $('.action_search').show();
239
          $('.search_options').hide();
240
          $('.not').hide();
241
          return false;
242
        }).click();
243
244
        $('form').each(function() {
245
          enableCheckboxActions(this);
246
        });
268
    });
247
    });
269
248
270
    function enableCheckboxActions(form){
249
    function enableCheckboxActions(form){
(-)a/opac/opac-search-history.pl (-80 / +93 lines)
Lines 22-31 use Modern::Perl; Link Here
22
use C4::Auth qw(:DEFAULT get_session);
22
use C4::Auth qw(:DEFAULT get_session);
23
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
use C4::Context;
24
use C4::Context;
25
use C4::Languages;
25
use C4::Output;
26
use C4::Output;
26
use C4::Log;
27
use C4::Log;
27
use C4::Items;
28
use C4::Items;
28
use C4::Debug;
29
use C4::Debug;
30
use C4::Search;
29
use C4::Search::History;
31
use C4::Search::History;
30
32
31
use URI::Escape;
33
use URI::Escape;
Lines 50-114 unless ( C4::Context->preference("EnableOpacSearchHistory") ) { Link Here
50
    exit;
52
    exit;
51
}
53
}
52
54
53
my $type = $cgi->param('type');
54
my $action = $cgi->param('action') || q{};
55
my $action = $cgi->param('action') || q{};
55
my $previous = $cgi->param('previous');
56
56
57
# If the user is not logged in, we deal with the session
57
if ( $action eq 'search' ) {
58
unless ( $loggedinuser ) {
58
    # Start a new search
59
    # Deleting search history
60
    if ( $action eq 'delete') {
61
        # Deleting session's search history
62
        my @id = $cgi->multi_param('id');
63
        my $all = not scalar( @id );
64
65
        my $type = $cgi->param('type');
66
        my @searches = ();
67
        unless ( $all ) {
68
            @searches = C4::Search::History::get_from_session({ cgi => $cgi });
69
            if ( $type ) {
70
                @searches = map { $_->{type} ne $type ? $_ : () } @searches;
71
            }
72
            if ( @id ) {
73
                @searches = map { my $search = $_; ( grep {/^$search->{id}$/} @id ) ? () : $_ } @searches;
74
            }
75
        }
76
        C4::Search::History::set_to_session({ cgi => $cgi, search_history => \@searches });
77
59
78
        # Redirecting to this same url so the user won't see the search history link in the header
60
    my @ids = $cgi->multi_param('id');
79
        print $cgi->redirect(-uri => '/cgi-bin/koha/opac-search-history.pl');
61
    my @nots = $cgi->multi_param('not');
80
    # Showing search history
62
    my @searches;
63
    if ($loggedinuser) {
64
        @searches = @{ C4::Search::History::get({
65
            userid => $loggedinuser,
66
            id => \@ids,
67
        }) };
81
    } else {
68
    } else {
82
        # Getting the searches from session
69
        @searches = C4::Search::History::get_from_session({ cgi => $cgi });
83
        my @current_searches = C4::Search::History::get_from_session({
70
        if ( @ids ) {
84
            cgi => $cgi,
71
            @searches = map {
85
        });
72
                my $search = $_;
86
73
                ( grep {/^$search->{id}$/} @ids ) ? $_ : ()
87
        my @current_biblio_searches = map {
74
            } @searches;
88
            $_->{type} eq 'biblio' ? $_ : ()
75
        }
89
        } @current_searches;
90
91
        my @current_authority_searches = map {
92
            $_->{type} eq 'authority' ? $_ : ()
93
        } @current_searches;
94
95
        $template->param(
96
            current_biblio_searches => \@current_biblio_searches,
97
            current_authority_searches => \@current_authority_searches,
98
        );
99
    }
76
    }
100
} else {
77
    my @ccl_queries;
101
    # And if the user is logged in, we deal with the database
78
    foreach my $search (@searches) {
102
    my $dbh = C4::Context->dbh;
79
        my $scgi = new CGI($search->{query_cgi});
80
        my @operators = map uri_unescape($_), $scgi->multi_param('op');
81
        my @indexes = map uri_unescape($_), $scgi->multi_param('idx');
82
        my @operands = map uri_unescape($_), $scgi->multi_param('q');
83
        my @limits = map uri_unescape($_), $scgi->multi_param('limit');
84
        my @sort_by = $scgi->multi_param('sort_by');
85
        my $scan = $scgi->param('scan');
86
        my $lang = C4::Languages::getlanguage($cgi);
87
        my ( $error, $query ) =
88
          buildQuery( \@operators, \@operands, \@indexes, \@limits, \@sort_by,
89
            $scan, $lang );
90
91
        if (grep {$_ == $search->{id}} @nots) {
92
            $query = "allrecords,alwaysmatches='' not ($query)";
93
        }
103
94
95
        push @ccl_queries, $query;
96
    }
97
    my $join = ($cgi->param('join') eq 'or') ? 'or' : 'and';
98
    my $query = 'ccl=(' . join(") $join (", @ccl_queries) . ')';
99
    print $cgi->redirect("/cgi-bin/koha/opac-search.pl?q=$query");
100
    exit;
101
} elsif ( $action eq 'delete' ) {
104
    # Deleting search history
102
    # Deleting search history
105
    if ( $action eq 'delete' ) {
103
    my @id = $cgi->multi_param('id');
106
        my @id = $cgi->multi_param('id');
104
    if ($loggedinuser) {
107
        if ( @id ) {
105
        if ( @id ) {
108
            C4::Search::History::delete(
106
            C4::Search::History::delete(
109
                {
107
                {
110
                    userid => $loggedinuser,
108
                    userid => $loggedinuser,
111
                    id     => [ $cgi->param('id') ],
109
                    id     => \@id,
112
                }
110
                }
113
            );
111
            );
114
        } else {
112
        } else {
Lines 118-162 unless ( $loggedinuser ) { Link Here
118
                }
116
                }
119
            );
117
            );
120
        }
118
        }
121
        # Redirecting to this same url so the user won't see the search history link in the header
122
        print $cgi->redirect(-uri => '/cgi-bin/koha/opac-search-history.pl');
123
124
    # Showing search history
125
    } else {
119
    } else {
126
        my $current_searches = C4::Search::History::get({
120
        # Deleting session's search history
121
        my $type = $cgi->param('type');
122
        my @searches = ();
123
        if ( scalar @id ) {
124
            @searches = C4::Search::History::get_from_session({ cgi => $cgi });
125
            if ( $type ) {
126
                @searches = map { $_->{type} ne $type ? $_ : () } @searches;
127
            }
128
            if ( @id ) {
129
                @searches = map { my $search = $_; ( grep {/^$search->{id}$/} @id ) ? () : $_ } @searches;
130
            }
131
        }
132
        C4::Search::History::set_to_session({ cgi => $cgi, search_history => \@searches });
133
    }
134
    # Redirecting to this same url so the user won't see the search history link in the header
135
    print $cgi->redirect(-uri => '/cgi-bin/koha/opac-search-history.pl');
136
    exit;
137
} else {
138
    # Showing search history
139
    my @searches;
140
    if ($loggedinuser) {
141
        @searches = @{ C4::Search::History::get({
127
            userid => $loggedinuser,
142
            userid => $loggedinuser,
128
            sessionid => $cgi->cookie("CGISESSID")
143
            sessionid => $cgi->cookie("CGISESSID")
144
        }) };
145
        foreach my $row (@searches) {
146
            if ($row->{a_session}) {
147
                $row->{session} = YAML::Load($row->{a_session});
148
                $row->{session}->{session_ctime} = $row->{session}->{_SESSION_CTIME};
149
                $row->{session}->{session_id} = $row->{session}->{_SESSION_ID};
150
            }
151
        }
152
    } else {
153
        # Getting the searches from session
154
        @searches = C4::Search::History::get_from_session({
155
            cgi => $cgi,
129
        });
156
        });
130
        my @current_biblio_searches = map {
157
        $template->param(hide_session_column => 1);
131
            $_->{type} eq 'biblio' ? $_ : ()
158
    }
132
        } @$current_searches;
133
134
        my @current_authority_searches = map {
135
            $_->{type} eq 'authority' ? $_ : ()
136
        } @$current_searches;
137
138
        my $previous_searches = C4::Search::History::get({
139
            userid => $loggedinuser,
140
            sessionid => $cgi->cookie("CGISESSID"),
141
            previous => 1
142
        });
143
159
144
        my @previous_biblio_searches = map {
145
            $_->{type} eq 'biblio' ? $_ : ()
146
        } @$previous_searches;
147
160
148
        my @previous_authority_searches = map {
161
    my @biblio_searches = map {
149
            $_->{type} eq 'authority' ? $_ : ()
162
        $_->{type} eq 'biblio' ? $_ : ()
150
        } @$previous_searches;
163
    } @searches;
151
164
152
        $template->param(
165
    my @authority_searches = map {
153
            current_biblio_searches => \@current_biblio_searches,
166
        $_->{type} eq 'authority' ? $_ : ()
154
            current_authority_searches => \@current_authority_searches,
167
    } @searches;
155
            previous_biblio_searches => \@previous_biblio_searches,
156
            previous_authority_searches => \@previous_authority_searches,
157
168
158
        );
169
    $template->param(
159
    }
170
        biblio_searches => \@biblio_searches,
171
        authority_searches => \@authority_searches,
172
        sessionid => $cgi->cookie('CGISESSID'),
173
    );
160
}
174
}
161
175
162
$template->param(searchhistoryview => 1);
176
$template->param(searchhistoryview => 1);
163
- 

Return to bug 12460