projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a175f7b
)
svc_pbx.title uniqueness (kludgy) and force to alphanumeric+space and 19 char max...
author
ivan
<ivan>
Tue, 26 Jan 2010 08:35:43 +0000
(08:35 +0000)
committer
ivan
<ivan>
Tue, 26 Jan 2010 08:35:43 +0000
(08:35 +0000)
FS/FS/part_export/thirdlane.pm
patch
|
blob
|
history
FS/FS/svc_pbx.pm
patch
|
blob
|
history
diff --git
a/FS/FS/part_export/thirdlane.pm
b/FS/FS/part_export/thirdlane.pm
index
cbcf98a
..
196177e
100644
(file)
--- a/
FS/FS/part_export/thirdlane.pm
+++ b/
FS/FS/part_export/thirdlane.pm
@@
-41,6
+41,12
@@
sub _export_insert {
if ( $svc_x->isa('FS::svc_pbx') ) {
if ( $svc_x->isa('FS::svc_pbx') ) {
+ return 'Name must be 19 characters or less (thirdlane restriction?)'
+ if length($svc_x->title) > 19;
+
+ return 'Name must consist of alphanumerics and spaces only (thirdlane restriction?)'
+ unless $svc_x->title =~ /^[\w\s]+$/;
+
my $tenant = {
'tenant' => $svc_x->title,
'maxusers' => $svc_x->max_extensions,
my $tenant = {
'tenant' => $svc_x->title,
'maxusers' => $svc_x->max_extensions,
diff --git
a/FS/FS/svc_pbx.pm
b/FS/FS/svc_pbx.pm
index
8263bdf
..
37c7bb7
100644
(file)
--- a/
FS/FS/svc_pbx.pm
+++ b/
FS/FS/svc_pbx.pm
@@
-2,7
+2,7
@@
package FS::svc_pbx;
use strict;
use base qw( FS::svc_External_Common );
use strict;
use base qw( FS::svc_External_Common );
-
#use FS::Record qw( qsearch qsearchs
);
+
use FS::Record qw( qsearchs ); # qsearch
);
use FS::cust_svc;
=head1 NAME
use FS::cust_svc;
=head1 NAME
@@
-214,6
+214,21
@@
sub check {
$self->SUPER::check;
}
$self->SUPER::check;
}
+#XXX this is a way-too simplistic implementation
+# at the very least, title should be unique across exports that need that or
+# controlled by a conf setting or something
+sub _check_duplicate {
+ my $self = shift;
+
+ $self->lock_table;
+
+ if ( qsearchs( 'svc_pbx', { 'title' => $self->title } ) ) {
+ return "Name in use";
+ } else {
+ return '';
+ }
+}
+
=back
=head1 BUGS
=back
=head1 BUGS