2 no warnings
'redefine';
9 sub plugin_javascript
{
10 my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
11 my $function_name = "328" . ( int( rand(100000) ) + 1 );
13 <script type=\"text/javascript\">
16 function Clic$function_name(i) {
17 q = document.getElementById('$field_number');
18 window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=cn_browser.pl&popup&q=\"+q.value,\"cnbrowser\",\"width=500,height=400,toolbar=false,scrollbars=yes\");
25 return ( $function_name, $res );
31 my $params = $cgi->Vars;
32 my $results_per_page = 30;
33 my $current_page = $cgi->param('page') || 1;
35 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
36 { template_name
=> "cataloguing/value_builder/cn_browser.tt",
40 flagsrequired
=> { catalogue
=> 1 },
46 my $dbh = C4
::Context
->dbh;
50 my $real_limit = $results_per_page / 2;
59 if ( $q = $cgi->param('q') ) {
62 if ( $cgi->param('lt') ) {
63 $lt = $cgi->param('lt');
66 if ( $cgi->param('gt') ) {
67 $gt = $cgi->param('gt');
71 #Don't show half the results of show lt or gt
72 $real_limit = $results_per_page if $search ne $q;
73 $cn_sort = GetClassSort
( undef, undef, $search );
74 my $cn_sort_q = GetClassSort
( undef, undef, $q );
77 if ( $search ne $gt ) {
80 #Results before the cn_sort
81 $query = "SELECT b.title, itemcallnumber, biblionumber, barcode, cn_sort, branchname, author
83 JOIN biblio AS b USING (biblionumber)
84 LEFT OUTER JOIN branches ON (branches.branchcode = homebranch)
86 AND itemcallnumber != ''
87 ORDER BY cn_sort DESC, itemnumber
89 $sth = $dbh->prepare($query);
90 $sth->execute($cn_sort);
91 while ( my $data = $sth->fetchrow_hashref ) {
92 if ( $data->{itemcallnumber
} eq $q ) {
93 $data->{background
} = 'red';
95 } elsif ( ( GetClassSort
( undef, undef, $data->{itemcallnumber
} ) lt $cn_sort_q ) && !$green && !$red ) {
97 unshift @cn, { 'background' => 'green' };
104 $rows_lt = $sth->rows;
107 if ( $search ne $lt ) {
110 #Results after the cn_sort
111 $query = "SELECT b.title, itemcallnumber, biblionumber, i.cn_sort, branchname, author
113 JOIN biblio AS b USING (biblionumber)
114 LEFT OUTER JOIN branches ON (branches.branchcode = homebranch)
115 WHERE i.cn_sort >= '$cn_sort'
116 AND itemcallnumber != ''
117 ORDER BY cn_sort, itemnumber
119 $sth = $dbh->prepare($query);
122 while ( my $data = $sth->fetchrow_hashref ) {
123 if ( $data->{itemcallnumber
} eq $q ) {
124 $data->{background
} = 'red';
126 } elsif ( ( GetClassSort
( undef, undef, $data->{itemcallnumber
} ) gt $cn_sort_q ) && !$green && !$red && !$globalGreen ) {
127 push @cn, { 'background' => 'green' };
132 $rows_gt = $sth->rows;
134 if ( !$green && !$red && !$globalGreen ) {
135 push @cn, { 'background' => 'green' };
141 $template->param( 'q' => $q );
142 $template->param( 'cn_loop' => \
@cn ) if $#cn != -1;
143 $template->param( 'popup' => defined( $cgi->param('popup') ) );
145 output_html_with_http_headers
$cgi, $cookie, $template->output;