Closed Bug 372531 Opened 17 years ago Closed 17 years ago

"match" should be a generic function in Bugzilla::Object

Categories

(Bugzilla :: Bugzilla-General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.2

People

(Reporter: mkanat, Assigned: mkanat)

Details

Attachments

(1 file, 1 obsolete file)

The current Bugzilla::Field::match function would be useful for all of our objects, I think. At the very least, I had a use for it in some customizations I did, and so I've already done this, I just have to pull out the patch and attach it.
Attached patch v1 (obsolete) — Splinter Review
This is the initial version, as I implemented it. However, it includes the ability for match() to match NULL and NOT NULL, which we don't need yet, so we shouldn't include that upstream.
Assignee: general → mkanat
Status: NEW → ASSIGNED
Comment on attachment 257179 [details] [diff] [review]
v1

Actually, I'll need the NOT NULL and NULL stuff soon for the "fields that control other fields." If you want me to take it out and submit another patch, though, I'd also be happy to do that.
Attachment #257179 - Flags: review?(LpSolit)
Comment on attachment 257179 [details] [diff] [review]
v1

>Index: Bugzilla/Object.pm

>+    my @join;
>+    foreach my $join_def (@{$class->MATCH_JOIN}) {
>+        my %def = %$join_def;
>+        my ($f_table, $from, $to) = @def{qw(table from to)};
>+        push(@join, "LEFT JOIN $f_table ON $table.$from = $f_table.$to");
>+    }
>+    my $join_sql = join("\n", @join);

Per our discussion on IRC, this should go away.
Attachment #257179 - Flags: review?(LpSolit) → review-
Attached patch v2Splinter Review
Okay, removed that code and added POD.
Attachment #257179 - Attachment is obsolete: true
Attachment #261574 - Flags: review?(LpSolit)
Comment on attachment 261574 [details] [diff] [review]
v2

>Index: Bugzilla/Object.pm

>+        if ($value eq NOT_NULL) {

Next time, please do some minimal tests first. :)

Bareword "NOT_NULL" not allowed while "strict subs" in use at Bugzilla/Object.pm line 153, <DATA> line 225.
Bareword "IS_NULL" not allowed while "strict subs" in use at Bugzilla/Object.pm line 153, <DATA> line 225.

You have to |use Bugzilla::Constants| in Object.pm in order to use NOT_NULL and IS_NULL.


r=LpSolit with this line added.
Attachment #261574 - Flags: review?(LpSolit) → review+
Flags: approval+
Ah, thanks for catching that. :-) I copied this code out of NASA code, and I must have just missed that block.

Checking in Bugzilla/Constants.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Constants.pm,v  <--  Constants.pm
new revision: 1.70; previous revision: 1.69
done
Checking in Bugzilla/Field.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Field.pm,v  <--  Field.pm
new revision: 1.26; previous revision: 1.25
done
Checking in Bugzilla/Object.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Object.pm,v  <--  Object.pm
new revision: 1.15; previous revision: 1.14
done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: