RSS

(root)/bugzilla/trunk : 7324 : Bugzilla/Search.pm

To get this branch, use:
bzr branch /bugzilla/trunk

« back to all changes in this revision

Viewing changes to Bugzilla/Search.pm

Max Kanat-Alexander
2010-07-10 03:22:16
Revision ID: mkanat@bugzilla.org-20100710102216-9btjci6f3mll1tmd
Bug 577803 - Make multi_select_fields into an accessor in Search.pm
r=mkanat, a=mkanat

Show diffs side-by-side

added added

removed removed

57
57
 
58
58
use Storable qw(dclone);
59
59
 
 
60
#############
 
61
# Constants #
 
62
#############
 
63
 
60
64
# If you specify a search type in the boolean charts, this describes
61
65
# which operator maps to which internal function here.
62
66
use constant OPERATORS => {
426
430
    return $columns;
427
431
}
428
432
 
 
433
######################
 
434
# Internal Accessors #
 
435
######################
 
436
 
 
437
sub _multi_select_fields {
 
438
    my ($self) = @_;
 
439
    $self->{multi_select_fields} ||= Bugzilla->fields({
 
440
        type => [FIELD_TYPE_MULTI_SELECT, FIELD_TYPE_BUG_URLS]});
 
441
    return $self->{multi_select_fields};
 
442
}
 
443
 
 
444
###############
 
445
# Constructor #
 
446
###############
 
447
 
429
448
# Create a new Search
430
449
# Note that the param argument may be modified by Bugzilla::Search
431
450
sub new {
462
481
    my %special_order_join = %{SPECIAL_ORDER_JOIN()};
463
482
 
464
483
    my $select_fields = Bugzilla->fields({ type => FIELD_TYPE_SINGLE_SELECT });
465
 
    
466
 
    my $multi_select_fields = Bugzilla->fields({
467
 
        type => [FIELD_TYPE_MULTI_SELECT, FIELD_TYPE_BUG_URLS]});
468
484
    foreach my $field (@$select_fields) {
469
485
        next if $field->is_abnormal;
470
486
        my $name = $field->name;
520
536
        push(@supptables, "LEFT JOIN longdescs AS ldtime " .
521
537
                          "ON ldtime.bug_id = bugs.bug_id");
522
538
    }
523
 
    foreach my $field (@$multi_select_fields) {
 
539
    foreach my $field (@{ $self->_multi_select_fields }) {
524
540
        my $field_name = $field->name;
525
541
        next if !grep($_ eq $field_name, @fields);
526
542
        push(@supptables, "LEFT JOIN bug_$field_name AS map_bug_$field_name"
996
1012
                    operator   => $operator,
997
1013
                    value      => $value,
998
1014
                    quoted     => $quoted,
999
 
                    multi_fields => $multi_select_fields,
1000
1015
                    joins        => \@supptables,
1001
1016
                    where        => \@wherepart,
1002
1017
                    having       => \@having,
1122
1137
        my @skip_group_by = (EMPTY_COLUMN, 
1123
1138
            qw(bug_id actual_time percentage_complete flagtypes.name
1124
1139
               keywords));
1125
 
        push(@skip_group_by, map { $_->name } @$multi_select_fields);
 
1140
        push(@skip_group_by, map { $_->name } @{ $self->_multi_select_fields });
1126
1141
 
1127
1142
        next if grep { $_ eq $field } @skip_group_by;
1128
1143
        my $col = COLUMNS->{$field}->{name};
1174
1189
    my $override = OPERATOR_FIELD_OVERRIDE->{$actual_field};
1175
1190
    if (!$override) {
1176
1191
        # Multi-select fields get special handling.
1177
 
        if (grep { $_->name eq $actual_field } @{ $args->{multi_fields} }) {
 
1192
        if (grep { $_->name eq $actual_field } @{ $self->_multi_select_fields }) {
1178
1193
            $override = OPERATOR_FIELD_OVERRIDE->{_multi_select};
1179
1194
        }
1180
1195
        # And so do attachment fields, if they don't have a specific

Loggerhead 1.18.1 is a web-based interface for Bazaar branches