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

(-)a/cataloguing/value_builder/cn_browser.pl (-17 / +5 lines)
Lines 105-111 sub plugin { Link Here
105
        ORDER BY cn_sort DESC, itemnumber
105
        ORDER BY cn_sort DESC, itemnumber
106
        LIMIT $real_limit;";
106
        LIMIT $real_limit;";
107
        $sth       = $dbh->prepare($query);
107
        $sth       = $dbh->prepare($query);
108
        # die $query;
109
        $sth->execute();
108
        $sth->execute();
110
        while ( my $data = $sth->fetchrow_hashref ) {
109
        while ( my $data = $sth->fetchrow_hashref ) {
111
            if ($data->{itemcallnumber} eq $q) {
110
            if ($data->{itemcallnumber} eq $q) {
Lines 136-142 sub plugin { Link Here
136
        ORDER BY cn_sort, itemnumber
135
        ORDER BY cn_sort, itemnumber
137
        LIMIT $real_limit";
136
        LIMIT $real_limit";
138
        $sth       = $dbh->prepare($query);
137
        $sth       = $dbh->prepare($query);
139
        # die $query;
140
        $sth->execute();
138
        $sth->execute();
141
        while ( my $data = $sth->fetchrow_hashref ) {
139
        while ( my $data = $sth->fetchrow_hashref ) {
142
            if ($data->{itemcallnumber} eq $q) {
140
            if ($data->{itemcallnumber} eq $q) {
Lines 144-157 sub plugin { Link Here
144
                $red = 1;
142
                $red = 1;
145
            }
143
            }
146
            elsif (($data->{cn_sort} gt $cn_sort_q) && !$green && !$red) {
144
            elsif (($data->{cn_sort} gt $cn_sort_q) && !$green && !$red) {
147
                if ($#cn != -1) {
145
                push @cn, {'background' => 'green'};
148
                    push @cn, {'background' => 'green'};
149
                }
150
                $green = 1;
146
                $green = 1;
151
            }
147
            }
152
            push @cn, $data;
148
            push @cn, $data;
153
        }
149
        }
154
        $rows_gt = $sth->rows;
150
        $rows_gt = $sth->rows;
151
        if ($rows_gt == 0 && !$green && !$red){
152
           push @cn, {'background' => 'green'};
153
        }
154
155
        $sth->finish;
155
        $sth->finish;
156
    }
156
    }
157
157
Lines 159-175 sub plugin { Link Here
159
    $template->param('cn_loop' => \@cn) if $#cn != -1;
159
    $template->param('cn_loop' => \@cn) if $#cn != -1;
160
    $template->param('popup' => defined($cgi->param('popup')));
160
    $template->param('popup' => defined($cgi->param('popup')));
161
161
162
    # die Dumper @cn;
163
164
    #die $rows_lt . '-' . $rows_gt . '-' . $real_limit;
165
166
    my $url = "cn_browser.pl?q=$q";
167
    my $first_result = $cn[0]->{itemcallnumber};
168
    my $last_result = $cn[-1]->{itemcallnumber};
169
    $template->param('first_result' => $first_result) if $rows_lt >= $real_limit;
170
    $template->param('last_result' => $last_result) if $rows_gt >= $real_limit;
171
    $template->param('url' => $url);
172
173
162
174
    output_html_with_http_headers $cgi, $cookie, $template->output;
163
    output_html_with_http_headers $cgi, $cookie, $template->output;
175
}
164
}
176
- 

Return to bug 13364