|
Lines 26-31
use C4::Auth;
Link Here
|
| 26 |
use C4::ClassSource; |
26 |
use C4::ClassSource; |
| 27 |
use C4::Output; |
27 |
use C4::Output; |
| 28 |
|
28 |
|
|
|
29 |
use Koha::ClassSources; |
| 30 |
|
| 29 |
my $builder = sub { |
31 |
my $builder = sub { |
| 30 |
my ( $params ) = @_; |
32 |
my ( $params ) = @_; |
| 31 |
my $function_name = $params->{id}; |
33 |
my $function_name = $params->{id}; |
|
Lines 59-66
my $launcher = sub {
Link Here
|
| 59 |
} |
61 |
} |
| 60 |
); |
62 |
); |
| 61 |
|
63 |
|
| 62 |
my $cn_sort; |
|
|
| 63 |
|
| 64 |
my $dbh = C4::Context->dbh; |
64 |
my $dbh = C4::Context->dbh; |
| 65 |
my $sth; |
65 |
my $sth; |
| 66 |
my @cn; |
66 |
my @cn; |
|
Lines 86-102
my $launcher = sub {
Link Here
|
| 86 |
$search = $gt; |
86 |
$search = $gt; |
| 87 |
} |
87 |
} |
| 88 |
|
88 |
|
|
|
89 |
my $cn_source = $cgi->param('cn_source') || C4::Context->preference("DefaultClassificationSource"); |
| 90 |
my @class_sources = Koha::ClassSources->search({ used => 1}); |
| 91 |
|
| 89 |
#Don't show half the results of show lt or gt |
92 |
#Don't show half the results of show lt or gt |
| 90 |
$real_limit = $results_per_page if $search ne $q; |
93 |
$real_limit = $results_per_page if $search ne $q; |
| 91 |
$cn_sort = GetClassSort( undef, undef, $search ); |
94 |
my $cn_sort = GetClassSort( $cn_source, undef, $search ); |
| 92 |
my $cn_sort_q = GetClassSort( undef, undef, $q ); |
|
|
| 93 |
|
95 |
|
| 94 |
my $red = 0; |
96 |
my $red = 0; |
| 95 |
if ( $search ne $gt ) { |
97 |
if ( $search ne $gt ) { |
| 96 |
my $green = 0; |
98 |
my $green = 0; |
| 97 |
|
99 |
|
| 98 |
#Results before the cn_sort |
100 |
#Results before the cn_sort |
| 99 |
$query = "SELECT b.title, itemcallnumber, biblionumber, barcode, cn_sort, branchname, author |
101 |
$query = "SELECT b.title, b.subtitle, itemcallnumber, biblionumber, barcode, cn_sort, branchname, author |
| 100 |
FROM items AS i |
102 |
FROM items AS i |
| 101 |
JOIN biblio AS b USING (biblionumber) |
103 |
JOIN biblio AS b USING (biblionumber) |
| 102 |
LEFT OUTER JOIN branches ON (branches.branchcode = homebranch) |
104 |
LEFT OUTER JOIN branches ON (branches.branchcode = homebranch) |
|
Lines 110-116
my $launcher = sub {
Link Here
|
| 110 |
if ( $data->{itemcallnumber} eq $q ) { |
112 |
if ( $data->{itemcallnumber} eq $q ) { |
| 111 |
$data->{background} = 'red'; |
113 |
$data->{background} = 'red'; |
| 112 |
$red = 1; |
114 |
$red = 1; |
| 113 |
} elsif ( ( GetClassSort( undef, undef, $data->{itemcallnumber} ) lt $cn_sort_q ) && !$green && !$red ) { |
115 |
} elsif ( $data->{cn_sort} lt $cn_sort && !$green && !$red ) { |
| 114 |
if ( $#cn != -1 ) { |
116 |
if ( $#cn != -1 ) { |
| 115 |
unshift @cn, { 'background' => 'green' }; |
117 |
unshift @cn, { 'background' => 'green' }; |
| 116 |
$globalGreen = 1; |
118 |
$globalGreen = 1; |
|
Lines 126-132
my $launcher = sub {
Link Here
|
| 126 |
my $green = 0; |
128 |
my $green = 0; |
| 127 |
|
129 |
|
| 128 |
#Results after the cn_sort |
130 |
#Results after the cn_sort |
| 129 |
$query = "SELECT b.title, itemcallnumber, biblionumber, i.cn_sort, branchname, author |
131 |
$query = "SELECT b.title, b.subtitle, itemcallnumber, biblionumber, barcode, cn_sort, branchname, author |
| 130 |
FROM items AS i |
132 |
FROM items AS i |
| 131 |
JOIN biblio AS b USING (biblionumber) |
133 |
JOIN biblio AS b USING (biblionumber) |
| 132 |
LEFT OUTER JOIN branches ON (branches.branchcode = homebranch) |
134 |
LEFT OUTER JOIN branches ON (branches.branchcode = homebranch) |
|
Lines 141-147
my $launcher = sub {
Link Here
|
| 141 |
if ( $data->{itemcallnumber} eq $q ) { |
143 |
if ( $data->{itemcallnumber} eq $q ) { |
| 142 |
$data->{background} = 'red'; |
144 |
$data->{background} = 'red'; |
| 143 |
$red = 1; |
145 |
$red = 1; |
| 144 |
} elsif ( ( GetClassSort( undef, undef, $data->{itemcallnumber} ) gt $cn_sort_q ) && !$green && !$red && !$globalGreen ) { |
146 |
} elsif ( $data->{cn_sort} gt $cn_sort && !$green && !$red && !$globalGreen ) { |
| 145 |
push @cn, { 'background' => 'green' }; |
147 |
push @cn, { 'background' => 'green' }; |
| 146 |
$green = 1; |
148 |
$green = 1; |
| 147 |
} |
149 |
} |
|
Lines 159-164
my $launcher = sub {
Link Here
|
| 159 |
$template->param( 'q' => $q ); |
161 |
$template->param( 'q' => $q ); |
| 160 |
$template->param( 'cn_loop' => \@cn ) if $#cn != -1; |
162 |
$template->param( 'cn_loop' => \@cn ) if $#cn != -1; |
| 161 |
$template->param( 'popup' => defined( $cgi->param('popup') ) ); |
163 |
$template->param( 'popup' => defined( $cgi->param('popup') ) ); |
|
|
164 |
$template->param( 'cn_source' => $cn_source ) if $cn_source; |
| 165 |
$template->param( 'class_sources' => \@class_sources ); |
| 166 |
|
| 162 |
|
167 |
|
| 163 |
output_html_with_http_headers $cgi, $cookie, $template->output; |
168 |
output_html_with_http_headers $cgi, $cookie, $template->output; |
| 164 |
}; |
169 |
}; |