summaryrefslogtreecommitdiff
path: root/FS/FS/part_svc.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-07-06 11:53:13 -0700
committerMark Wells <mark@freeside.biz>2016-07-06 12:49:58 -0700
commit441c559ada887bfb2f047b1b5061f277969453e6 (patch)
tree6e0e98c52ce319f41f536490650b1e8ed5debee1 /FS/FS/part_svc.pm
parentf8970936c24e6c8b21d9178ff8ae12d4182ddd76 (diff)
service label localization, internals and UI, #71347
Diffstat (limited to 'FS/FS/part_svc.pm')
-rw-r--r--FS/FS/part_svc.pm27
1 files changed, 26 insertions, 1 deletions
diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm
index 621a554..dcc7843 100644
--- a/FS/FS/part_svc.pm
+++ b/FS/FS/part_svc.pm
@@ -1,5 +1,5 @@
package FS::part_svc;
-use base qw(FS::Record);
+use base qw(FS::o2m_Common FS::Record);
use strict;
use vars qw( $DEBUG );
@@ -11,6 +11,7 @@ use FS::part_export;
use FS::export_svc;
use FS::cust_svc;
use FS::part_svc_class;
+use FS::part_svc_msgcat;
FS::UID->install_callback(sub {
# preload the cache and make sure all modules load
@@ -621,6 +622,24 @@ sub svc_x {
map { $_->svc_x } $self->cust_svc;
}
+=item svc_locale LOCALE
+
+Returns a customer-viewable service definition label in the chosen LOCALE.
+If there is no entry for that locale or if LOCALE is empty, returns
+part_svc.svc.
+
+=cut
+
+sub svc_locale {
+ my( $self, $locale ) = @_;
+ return $self->svc unless $locale;
+ my $part_svc_msgcat = qsearchs('part_svc_msgcat', {
+ svcpart => $self->svcpart,
+ locale => $locale
+ }) or return $self->svc;
+ $part_svc_msgcat->svc;
+}
+
=back
=head1 CLASS METHODS
@@ -883,6 +902,12 @@ sub process {
$param->{'svcpart'} = $new->getfield('svcpart');
}
+ $error ||= $new->process_o2m(
+ 'table' => 'part_svc_msgcat',
+ 'params' => $param,
+ 'fields' => [ 'locale', 'svc' ],
+ );
+
die "$error\n" if $error;
}