summaryrefslogtreecommitdiff
path: root/FS/FS/Record.pm
diff options
context:
space:
mode:
authorivan <ivan>2002-02-20 01:03:10 +0000
committerivan <ivan>2002-02-20 01:03:10 +0000
commit8f42b751aebda2e7dce2c363bed6f1e15b411b1d (patch)
tree942c30415b1e1683dec03dd62dcc24d575f7de46 /FS/FS/Record.pm
parent47bc56487b4aebf3e415767a053dc049fe4a28d4 (diff)
use Net::SSH::ssh_cmd for all job queueing rather than local duplicated ssh subs
queue daemon updates: retry & remove links work, bubble up error message to webinterface, link to svcnum & have job listings on view/svc_* pages, closes: Bug#280 s/option/optionname/ schema change, dumb mysql, closes: Bug#334
Diffstat (limited to 'FS/FS/Record.pm')
-rw-r--r--FS/FS/Record.pm34
1 files changed, 31 insertions, 3 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 755cef8..020d14d 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -59,13 +59,13 @@ FS::Record - Database record objects
$hashref = $record->hashref;
$error = $record->insert;
- #$error = $record->add; #depriciated
+ #$error = $record->add; #deprecated
$error = $record->delete;
- #$error = $record->del; #depriciated
+ #$error = $record->del; #deprecated
$error = $new_record->replace($old_record);
- #$error = $new_record->rep($old_record); #depriciated
+ #$error = $new_record->rep($old_record); #deprecated
$value = $record->unique('column');
@@ -974,6 +974,34 @@ sub ut_enum {
return "Illegal (enum) field $field: ". $self->getfield($field);
}
+=item ut_foreign_key COLUMN FOREIGN_TABLE FOREIGN_COLUMN
+
+Check/untaint a foreign column key. Call a regular ut_ method (like ut_number)
+on the column first.
+
+=cut
+
+sub ut_foreign_key {
+ my( $self, $field, $table, $foreign ) = @_;
+ qsearchs($table, { $foreign => $self->getfield($field) })
+ or return "Can't find $field ". $self->getfield($field).
+ " in $table.$foreign";
+ '';
+}
+
+=item ut_foreign_keyn COLUMN FOREIGN_TABLE FOREIGN_COLUMN
+
+Like ut_foreign_key, except the null value is also allowed.
+
+=cut
+
+sub ut_foreign_keyn {
+ my( $self, $field, $table, $foreign ) = @_;
+ $self->getfield($field)
+ ? $self->ut_foreign_key($field, $table, $foreign)
+ : '';
+}
+
=item fields [ TABLE ]
This can be used as both a subroutine and a method call. It returns a list