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

(-)a/opac/opac-ISBDdetail.pl (-1 / +4 lines)
Lines 85-91 my $upc = GetNormalizedUPC($record,$marcflavour); Link Here
85
my $ean = GetNormalizedEAN($record,$marcflavour);
85
my $ean = GetNormalizedEAN($record,$marcflavour);
86
my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
86
my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
87
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
87
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
88
my $content_identifier_exists = 1 if ($isbn or $ean or $oclc or $upc);
88
my $content_identifier_exists;
89
if ( $isbn or $ean or $oclc or $upc ) {
90
    $content_identifier_exists = 1;
91
}
89
$template->param(
92
$template->param(
90
    normalized_upc => $upc,
93
    normalized_upc => $upc,
91
    normalized_ean => $ean,
94
    normalized_ean => $ean,
(-)a/opac/opac-authorities-home.pl (-12 / +14 lines)
Lines 41-58 $startfrom = 0 if ( !defined $startfrom ); Link Here
41
my ( $template, $loggedinuser, $cookie );
41
my ( $template, $loggedinuser, $cookie );
42
my $resultsperpage;
42
my $resultsperpage;
43
43
44
my $authtypes = getauthtypes;
44
my $authtypes     = getauthtypes();
45
my @authtypesloop;
45
my @authtypesloop = ();
46
foreach my $thisauthtype ( sort { $authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'} }
46
foreach my $thisauthtype (
47
    keys %$authtypes )
47
    sort {
48
{
48
        $authtypes->{$a}->{'authtypetext'}
49
    my $selected = 1 if $thisauthtype eq $authtypecode;
49
          cmp $authtypes->{$b}->{'authtypetext'}
50
    my %row = (
50
    }
51
        value        => $thisauthtype,
51
    keys %{$authtypes}
52
        selected     => $selected,
52
  ) {
53
        authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
53
    push @authtypesloop,
54
    );
54
      { value        => $thisauthtype,
55
    push @authtypesloop, \%row;
55
        selected     => $thisauthtype eq $authtypecode,
56
        authtypetext => $authtypes->{$thisauthtype}->{'authtypetext'},
57
      };
56
}
58
}
57
59
58
if ( $op eq "do_search" ) {
60
if ( $op eq "do_search" ) {
(-)a/opac/opac-authoritiesdetail.pl (-9 / +7 lines)
Lines 170-185 foreach my $field (@fields) { Link Here
170
}
170
}
171
$template->param( "Tab0XX" => \@loop_data );
171
$template->param( "Tab0XX" => \@loop_data );
172
172
173
my $authtypes = getauthtypes;
173
my $authtypes     = getauthtypes();
174
my @authtypesloop;
174
my @authtypesloop = ();
175
foreach my $thisauthtype ( keys %$authtypes ) {
175
foreach my $thisauthtype ( keys %{$authtypes} ) {
176
    my $selected = 1 if $thisauthtype eq $authtypecode;
176
    push @authtypesloop,
177
    my %row = (
177
      { value        => $thisauthtype,
178
        value        => $thisauthtype,
178
        selected     => $thisauthtype eq $authtypecode,
179
        selected     => $selected,
180
        authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
179
        authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
181
    );
180
      };
182
    push @authtypesloop, \%row;
183
}
181
}
184
182
185
$template->param(
183
$template->param(
(-)a/opac/opac-detail.pl (-1 / +4 lines)
Lines 281-287 my $upc = GetNormalizedUPC($record,$marcflavour); Link Here
281
my $ean = GetNormalizedEAN($record,$marcflavour);
281
my $ean = GetNormalizedEAN($record,$marcflavour);
282
my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
282
my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
283
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
283
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
284
my $content_identifier_exists = 1 if ($isbn or $ean or $oclc or $upc);
284
my $content_identifier_exists;
285
if ( $isbn or $ean or $oclc or $upc ) {
286
    $content_identifier_exists = 1;
287
}
285
$template->param(
288
$template->param(
286
	normalized_upc => $upc,
289
	normalized_upc => $upc,
287
	normalized_ean => $ean,
290
	normalized_ean => $ean,
(-)a/opac/opac-search.pl (-14 / +35 lines)
Lines 207-215 if ( $template_type && $template_type eq 'advsearch' ) { Link Here
207
    $template->param(outer_sup_servers_loop => $secondary_servers_loop,);
207
    $template->param(outer_sup_servers_loop => $secondary_servers_loop,);
208
208
209
    # set the default sorting
209
    # set the default sorting
210
    my $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') 
210
    if (   C4::Context->preference('OPACdefaultSortField')
211
        if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
211
        && C4::Context->preference('OPACdefaultSortOrder') ) {
212
    $template->param($default_sort_by => 1);
212
        my $default_sort_by =
213
            C4::Context->preference('OPACdefaultSortField') . '_'
214
          . C4::Context->preference('OPACdefaultSortOrder');
215
        $template->param( $default_sort_by => 1 );
216
    }
213
217
214
    # determine what to display next to the search boxes (ie, boolean option
218
    # determine what to display next to the search boxes (ie, boolean option
215
    # shouldn't appear on the first one, scan indexes should, adding a new
219
    # shouldn't appear on the first one, scan indexes should, adding a new
Lines 273-280 $tag = $params->{tag} if $params->{tag}; Link Here
273
# sort by is used to sort the query
277
# sort by is used to sort the query
274
# in theory can have more than one but generally there's just one
278
# in theory can have more than one but generally there's just one
275
my @sort_by;
279
my @sort_by;
276
my $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') 
280
my $default_sort_by;
277
    if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
281
if (   C4::Context->preference('OPACdefaultSortField')
282
    && C4::Context->preference('OPACdefaultSortOrder') ) {
283
    $default_sort_by =
284
        C4::Context->preference('OPACdefaultSortField') . '_'
285
      . C4::Context->preference('OPACdefaultSortOrder');
286
}
278
287
279
@sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
288
@sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
280
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
289
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
Lines 568-575 for (my $i=0;$i<@servers;$i++) { Link Here
568
            my $pages = ceil($hits / $results_per_page);
577
            my $pages = ceil($hits / $results_per_page);
569
            # default page number
578
            # default page number
570
            my $current_page_number = 1;
579
            my $current_page_number = 1;
571
            $current_page_number = ($offset / $results_per_page + 1) if $offset;
580
            if ($offset) {
572
            my $previous_page_offset = $offset - $results_per_page unless ($offset - $results_per_page <0);
581
                $current_page_number = ( $offset / $results_per_page + 1 );
582
            }
583
            my $previous_page_offset;
584
            if ( $offset >= $results_per_page ) {
585
                $previous_page_offset = $offset - $results_per_page;
586
            }
573
            my $next_page_offset = $offset + $results_per_page;
587
            my $next_page_offset = $offset + $results_per_page;
574
            # If we're within the first 10 pages, keep it simple
588
            # If we're within the first 10 pages, keep it simple
575
            #warn "current page:".$current_page_number;
589
            #warn "current page:".$current_page_number;
Lines 583-593 for (my $i=0;$i<@servers;$i++) { Link Here
583
                    my $this_offset = (($i*$results_per_page)-$results_per_page);
597
                    my $this_offset = (($i*$results_per_page)-$results_per_page);
584
                    # the page number for this page
598
                    # the page number for this page
585
                    my $this_page_number = $i;
599
                    my $this_page_number = $i;
586
                    # it should only be highlighted if it's the current page
587
                    my $highlight = 1 if ($this_page_number == $current_page_number);
588
                    # put it in the array
600
                    # put it in the array
589
                    push @page_numbers, { offset => $this_offset, pg => $this_page_number, highlight => $highlight, sort_by => join " ",@sort_by };
601
                    push @page_numbers,
590
                                
602
                      { offset    => $this_offset,
603
                        pg        => $this_page_number,
604
                        highlight => $this_page_number == $current_page_number,
605
                        sort_by   => join ' ', @sort_by
606
                      };
607
591
                }
608
                }
592
                        
609
                        
593
            }
610
            }
Lines 596-604 for (my $i=0;$i<@servers;$i++) { Link Here
596
                for ($i=$current_page_number; $i<=($current_page_number + 20 );$i++) {
613
                for ($i=$current_page_number; $i<=($current_page_number + 20 );$i++) {
597
                    my $this_offset = ((($i-9)*$results_per_page)-$results_per_page);
614
                    my $this_offset = ((($i-9)*$results_per_page)-$results_per_page);
598
                    my $this_page_number = $i-9;
615
                    my $this_page_number = $i-9;
599
                    my $highlight = 1 if ($this_page_number == $current_page_number);
616
                    if ( $this_page_number <= $pages ) {
600
                    if ($this_page_number <= $pages) {
617
                        push @page_numbers,
601
                        push @page_numbers, { offset => $this_offset, pg => $this_page_number, highlight => $highlight, sort_by => join " ",@sort_by };
618
                          { offset    => $this_offset,
619
                            pg        => $this_page_number,
620
                            highlight => $this_page_number == $current_page_number,
621
                            sort_by => join ' ', @sort_by
622
                          };
602
                    }
623
                    }
603
                }
624
                }
604
                        
625
                        
(-)a/opac/opac-topissues.pl (-4 / +2 lines)
Lines 127-139 $template->param( branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'} Link Here
127
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
127
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
128
$itemtypes = GetItemTypes;
128
$itemtypes = GetItemTypes;
129
my @itemtypesloop;
129
my @itemtypesloop;
130
my $selected=1;
131
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
130
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
132
        foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
131
        foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
133
        my $selected = 1 if $thisitemtype eq $itemtype;
134
        my %row =( value => $thisitemtype,
132
        my %row =( value => $thisitemtype,
135
                   description => $itemtypes->{$thisitemtype}->{'description'},
133
                   description => $itemtypes->{$thisitemtype}->{'description'},
136
                   selected => $selected,
134
                   selected    => $thisitemtype eq $itemtype,
137
            );
135
            );
138
        push @itemtypesloop, \%row;
136
        push @itemtypesloop, \%row;
139
        }
137
        }
Lines 142-148 if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { Link Here
142
        for my $thisitemtype (@$advsearchtypes) {
140
        for my $thisitemtype (@$advsearchtypes) {
143
                my $selected = 1 if $thisitemtype->{authorised_value} eq $itemtype;
141
                my $selected = 1 if $thisitemtype->{authorised_value} eq $itemtype;
144
                my %row =( value => $thisitemtype->{authorised_value},
142
                my %row =( value => $thisitemtype->{authorised_value},
145
                selected => $selected,
143
                selected    => $thisitemtype eq $itemtype,
146
                description => $thisitemtype->{'lib'},
144
                description => $thisitemtype->{'lib'},
147
            );
145
            );
148
                push @itemtypesloop, \%row;
146
                push @itemtypesloop, \%row;
(-)a/opac/opac-user.pl (-6 / +9 lines)
Lines 193-205 $template->param( show_barcode => 1 ) if $show_barcode; Link Here
193
# load the branches
193
# load the branches
194
my $branches = GetBranches();
194
my $branches = GetBranches();
195
my @branch_loop;
195
my @branch_loop;
196
for my $branch_hash (sort keys %$branches ) {
196
for my $branch_hash ( sort keys %{$branches} ) {
197
    my $selected=(C4::Context->userenv && ($branch_hash eq C4::Context->userenv->{branch})) if (C4::Context->preference('SearchMyLibraryFirst'));
197
    my $selected;
198
    if ( C4::Context->preference('SearchMyLibraryFirst') ) {
199
        $selected =
200
          ( C4::Context->userenv
201
              && ( $branch_hash eq C4::Context->userenv->{branch} ) );
202
    }
198
    push @branch_loop,
203
    push @branch_loop,
199
      {
204
      { value      => "branch: $branch_hash",
200
        value      => "branch: $branch_hash",
201
        branchname => $branches->{$branch_hash}->{'branchname'},
205
        branchname => $branches->{$branch_hash}->{'branchname'},
202
        selected => $selected
206
        selected   => $selected,
203
      };
207
      };
204
}
208
}
205
$template->param( branchloop => \@branch_loop );
209
$template->param( branchloop => \@branch_loop );
206
- 

Return to bug 5453