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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-bib-search.tt (-21 / +34 lines)
Lines 14-41 Link Here
14
<form name="f" action="/cgi-bin/koha/serials/subscription-bib-search.pl" method="get">
14
<form name="f" action="/cgi-bin/koha/serials/subscription-bib-search.pl" method="get">
15
    <input type="hidden" name="op" value="do_search" />
15
    <input type="hidden" name="op" value="do_search" />
16
    <input type="hidden" name="type" value="intranet" />
16
    <input type="hidden" name="type" value="intranet" />
17
	<fieldset class="rows">
17
    <fieldset class="brief">
18
	<ol>
18
    <ol>
19
    <li><label for="q">Keyword: </label>
19
        <li>
20
    <input type="text" id="q"  name="q" /></li>
20
            <label for="q">Keyword: </label>
21
    
21
            <input type="text" id="q"  name="q" />
22
    <!-- ITEMTYPE LIMITS -->
23
        <li><label for="itemtypelimit">Limit type to: </label>
24
        <select name="itemtypelimit" id="itemtypelimit">
25
	    <option value="">All</option>
26
        [% FOREACH itemtypeloo IN itemtypeloop %]
27
            <option value="[% itemtypeloo.code %]">
28
                [% itemtypeloo.description |html %]
29
            </option>
30
        [% END %]
31
        </select>
32
        </li>
22
        </li>
33
    <!-- /ITEMTYPE LIMITS -->
23
        <li>
34
	</ol>
24
            <label for="itemtypelimit">Limit item type to: </label>
35
</fieldset>
25
            <select name="itemtypelimit" id="itemtypelimit">
36
<fieldset class="action"><input type="submit" value="Search" /></fieldset>
26
                <option value="">All</option>
37
27
                [%- FOREACH itemtypeloo IN itemtypeloop %]
38
28
                <option value="[% itemtypeloo.code %]">
29
                    [% itemtypeloo.description |html %]
30
                </option>
31
                [%- END %]
32
            </select>
33
        </li>
34
        [%- IF ccodeloop %]
35
        <li>
36
            <label for="ccodelimit">Limit collection code to: </label>
37
            <select name="ccodelimit" id="ccodelimit">
38
                <option value="">All</option>
39
                [%- FOREACH ccodeloo IN ccodeloop %]
40
                <option value="[% ccodeloo.code %]">
41
                    [% ccodeloo.description |html %]
42
                </option>
43
                [%- END %]
44
            </select>
45
        </li>
46
        [%- END %]
47
    </ol>
48
    </fieldset>
49
    <fieldset class="action">
50
        <input type="submit" value="Search" />
51
    </fieldset>
39
</form>
52
</form>
40
53
41
</div>
54
</div>
(-)a/serials/subscription-bib-search.pl (-48 / +19 lines)
Lines 70-76 $startfrom=0 unless $startfrom; Link Here
70
my ($template, $loggedinuser, $cookie);
70
my ($template, $loggedinuser, $cookie);
71
my $resultsperpage;
71
my $resultsperpage;
72
72
73
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
74
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
73
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
75
74
76
my $query = $input->param('q');
75
my $query = $input->param('q');
Lines 87-109 if ($op eq "do_search" && $query) { Link Here
87
        }
86
        }
88
    );
87
    );
89
88
90
    # add the itemtype limit if applicable
89
    # add the limits if applicable
91
    my $itemtypelimit = $input->param('itemtypelimit');
90
    my $itemtypelimit = $input->param('itemtypelimit');
92
    if ( $itemtypelimit ) {
91
    my $ccodelimit = $input->param('ccodelimit');
93
        my $QParser;
92
    my $op = C4::Context->preference('UseQueryParser') ? '&&' : 'and';
94
        $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
93
    $query .= " $op $itype_or_itemtype:$itemtypelimit" if $itemtypelimit;
95
        my $op;
94
    $query .= " $op ccode:$ccodelimit" if $ccodelimit;
96
        if ($QParser) {
97
            $op = '&&';
98
        } else {
99
            $op = 'and';
100
        }
101
        if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
102
            $query .= " $op $itype_or_itemtype:$itemtypelimit";
103
        } else {
104
            $query .= " $op $advanced_search_types:$itemtypelimit";
105
        }
106
    }
107
    $debug && warn $query;
95
    $debug && warn $query;
108
    $resultsperpage= $input->param('resultsperpage');
96
    $resultsperpage= $input->param('resultsperpage');
109
    $resultsperpage = 20 if(!defined $resultsperpage);
97
    $resultsperpage = 20 if(!defined $resultsperpage);
Lines 200-249 else { Link Here
200
                flagsrequired => {catalogue => 1, serials => '*'},
188
                flagsrequired => {catalogue => 1, serials => '*'},
201
                debug => 1,
189
                debug => 1,
202
                });
190
                });
191
203
    # load the itemtypes
192
    # load the itemtypes
204
    my $itemtypes = GetItemTypes;
193
    my $itemtypes = GetItemTypes();
205
    my @itemtypesloop;
194
    my @itemtypesloop;
206
    if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
207
	# load the itemtypes
208
	my $itemtypes = GetItemTypes;
209
	my $selected=1;
210
	my $cnt;
211
	foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
195
	foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
212
	    my %row =(
196
	    my %row =(
213
			code => $thisitemtype,
197
			code => $thisitemtype,
214
			selected => $selected,
215
			description => $itemtypes->{$thisitemtype}->{'description'},
198
			description => $itemtypes->{$thisitemtype}->{'description'},
216
		    );
199
		    );
217
	    $selected = 0 if ($selected) ;
218
	    push @itemtypesloop, \%row;
200
	    push @itemtypesloop, \%row;
219
	}
201
	}
220
202
221
203
    # load Collection Codes
222
    } else {
204
	my $authvalues = GetAuthorisedValues('CCODE');
223
	my $advsearchtypes = GetAuthorisedValues($advanced_search_types);
205
	my @ccodesloop;
224
	my $cnt;
206
	for my $thisauthvalue (sort {$a->{'lib'} cmp $b->{'lib'}} @$authvalues) {
225
	my $selected=1;
226
	for my $thisitemtype (sort {$a->{'lib'} cmp $b->{'lib'}} @$advsearchtypes) {
227
	    my %row =(
207
	    my %row =(
228
		    number=>$cnt++,
208
		    code => $thisauthvalue->{'authorised_value'},
229
		    ccl => $advanced_search_types,
209
		    description => $thisauthvalue->{'lib'},
230
		    code => $thisitemtype->{authorised_value},
231
		    selected => $selected,
232
		    description => $thisitemtype->{'lib'},
233
		    count5 => $cnt % 4,
234
		    imageurl=> getitemtypeimagelocation( 'intranet', $thisitemtype->{'imageurl'} ),
235
		);
210
		);
236
	    push @itemtypesloop, \%row;
211
	    push @ccodesloop, \%row;
237
	}
212
	}
238
    }
239
240
213
241
    if ($op eq "do_search") {
214
    $template->param(
242
       $template->param("no_query" => 1);
215
        itemtypeloop => \@itemtypesloop,
243
    } else {
216
        ccodeloop    => \@ccodesloop,
244
       $template->param("no_query" => 0);
217
        no_query     => $op eq "do_search" ? 1 : 0,
245
    }
218
    );
246
    $template->param(itemtypeloop => \@itemtypesloop);
247
}
219
}
248
# Print the page
220
# Print the page
249
output_html_with_http_headers $input, $cookie, $template->output;
221
output_html_with_http_headers $input, $cookie, $template->output;
250
- 

Return to bug 11091