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

(-)a/C4/Input.pm (-53 lines)
Lines 52-58 number or ISBN is valid. Link Here
52
@ISA = qw(Exporter);
52
@ISA = qw(Exporter);
53
@EXPORT = qw(
53
@EXPORT = qw(
54
	&checkdigit
54
	&checkdigit
55
	&buildCGIsort
56
);
55
);
57
56
58
=item checkdigit
57
=item checkdigit
Lines 109-166 sub checkdigit ($;$) { Link Here
109
	return 0;
108
	return 0;
110
} # sub checkdigit
109
} # sub checkdigit
111
110
112
=item buildCGISort
113
114
  $CGIScrollingList = &buildCGISort($name string, $input_name string);
115
116
Returns the scrolling list with name $input_name, built on authorised Values named $name.
117
Returns NULL if no authorised values found
118
119
=cut
120
121
sub buildCGIsort {
122
    my ( $name, $input_name, $data ) = @_;
123
    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
124
125
    my $dbh=C4::Context->dbh;
126
    my $query = qq{
127
        SELECT *
128
        FROM authorised_values
129
    };
130
    $query .= qq{
131
          LEFT JOIN authorised_values_branches ON ( id = av_id )
132
    } if $branch_limit;
133
    $query .= qq{
134
        WHERE category = ?
135
    };
136
    $query .= qq{ AND ( branchcode = ? OR branchcode IS NULL )} if $branch_limit;
137
    $query .= qq{ GROUP BY lib ORDER BY lib};
138
139
    my $sth=$dbh->prepare($query);
140
    $sth->execute( $name, $branch_limit ? $branch_limit : () );
141
    my $CGISort;
142
    if ($sth->rows>0){
143
        my @values;
144
        my %labels;
145
146
        for (my $i =0;$i<$sth->rows;$i++){
147
            my $results = $sth->fetchrow_hashref;
148
            push @values, $results->{authorised_value};
149
            $labels{$results->{authorised_value}}=$results->{lib};
150
        }
151
        $CGISort= CGI::scrolling_list(
152
                    -name => $input_name,
153
                    -id =>   $input_name,
154
                    -values => \@values,
155
                    -labels => \%labels,
156
                    -default=> $data,
157
                    -size => 1,
158
                    -multiple => 0);
159
    }
160
    $sth->finish;
161
    return $CGISort;
162
}
163
164
END { }       # module clean-up code here (global destructor)
111
END { }       # module clean-up code here (global destructor)
165
112
166
1;
113
1;
(-)a/admin/aqplan.pl (-1 lines)
Lines 225-231 HideCols($authcat, @hide_cols); Link Here
225
}
225
}
226
# ------------------------------------------------------------
226
# ------------------------------------------------------------
227
if ( $authcat =~ m/^Asort/ ) {
227
if ( $authcat =~ m/^Asort/ ) {
228
    # ----------- copied from C4::Input::buildCGIsort()
229
   my $query = qq{ SELECT * FROM authorised_values WHERE category=? order by lib };
228
   my $query = qq{ SELECT * FROM authorised_values WHERE category=? order by lib };
230
    my $sth   = $dbh->prepare($query);
229
    my $sth   = $dbh->prepare($query);
231
    $sth->execute($authcat  );
230
    $sth->execute($authcat  );
(-)a/members/memberentry.pl (-11 / +1 lines)
Lines 621-636 if($no_categories){ Link Here
621
$template->param(no_add => $no_add);
621
$template->param(no_add => $no_add);
622
# --------------------------------------------------------------------------------------------------------
622
# --------------------------------------------------------------------------------------------------------
623
623
624
my $CGIsort = buildCGIsort("Bsort1","sort1",$data{'sort1'});
624
$template->param( sort1 => $data{'sort1'});
625
if ($CGIsort) {
626
    $template->param(CGIsort1 => $CGIsort);
627
}
628
$template->param( sort1 => $data{'sort1'});		# shouldn't this be in an "else" statement like the 2nd one?
629
630
$CGIsort = buildCGIsort("Bsort2","sort2",$data{'sort2'});
631
if ($CGIsort) {
632
    $template->param(CGIsort2 => $CGIsort);
633
}
634
$template->param( sort2 => $data{'sort2'});
625
$template->param( sort2 => $data{'sort2'});
635
626
636
if ($nok) {
627
if ($nok) {
637
- 

Return to bug 766