X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fsvc_dsl.html;h=489c869169bfa3c6a7f170be9e26f835c9d4e79e;hb=1fc8addc56f8daf12397da568eb1ac1b27fd3984;hp=627329a003d862ec055850ac0688405166e5184c;hpb=b5c4237a34aef94976bc343c8d9e138664fc3984;p=freeside.git diff --git a/httemplate/edit/process/svc_dsl.html b/httemplate/edit/process/svc_dsl.html index 627329a00..489c86916 100644 --- a/httemplate/edit/process/svc_dsl.html +++ b/httemplate/edit/process/svc_dsl.html @@ -1,5 +1,6 @@ <% include( 'elements/svc_Common.html', 'table' => 'svc_dsl', + 'precheck_callback' => $precheck_callback, ) %> <%init> @@ -7,4 +8,31 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific? +my $precheck_callback = sub { + my $cgi = shift; + my $svcnum = $cgi->param('svcnum'); + my $error = ''; + my $old; + my $part_svc; + + if ( $svcnum ) { + $old = FS::svc_dsl->by_key($svcnum); + $part_svc = $old->part_svc; + } else { + my $svcpart = $cgi->param('svcpart') or die "svcpart required"; + $part_svc = FS::part_svc->by_key($svcpart); + } + my $psc = $part_svc->part_svc_column('password'); + if ( $psc->columnflag eq 'F' ) { + # enforce it here and skip password validation + $cgi->param('password', $psc->columnvalue); + } else { + my $newpass = $cgi->param('password'); + if ( $old and $newpass ne $old->password ) { + $error ||= $old->is_password_allowed($newpass); + } + } + $error; +}; +