X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_svc.pm;h=60889c6affaa501a9812a2cde474f93b9be2ee37;hb=2b8cc0f23f764bd53994ca3763b9c61756c96766;hp=884e3ad803fcf16d06d05e928db99da9f898698f;hpb=5b77b3d0c9aa2d0fa15ca5284d7e34ed68f4ee12;p=freeside.git diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index 884e3ad80..60889c6af 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -1,5 +1,6 @@ package FS::part_svc; +use base qw(FS::o2m_Common FS::Record); use strict; use vars qw( @ISA $DEBUG ); use Tie::IxHash; @@ -10,8 +11,7 @@ use FS::part_export; use FS::export_svc; use FS::cust_svc; use FS::part_svc_class; - -@ISA = qw(FS::Record); +use FS::part_svc_msgcat; $DEBUG = 0; @@ -617,6 +617,30 @@ 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; +} + +# 3.x stub +sub part_svc_msgcat { + my $self = shift; + qsearch('part_svc_msgcat', { 'svcpart' => $self->svcpart }); +} + =back =head1 CLASS METHODS @@ -874,6 +898,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; }