summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/edit/elements/svc_Common.html37
-rw-r--r--httemplate/edit/process/quick-cust_pkg.cgi25
-rw-r--r--httemplate/edit/svc_dsl.cgi140
-rw-r--r--httemplate/elements/popup_link-cust_main.html6
-rw-r--r--httemplate/misc/order_pkg.html86
-rw-r--r--httemplate/view/cust_main/order_pkg_link.html11
-rw-r--r--httemplate/view/qual.cgi7
7 files changed, 215 insertions, 97 deletions
diff --git a/httemplate/edit/elements/svc_Common.html b/httemplate/edit/elements/svc_Common.html
index 2e27f851d..aa7699555 100644
--- a/httemplate/edit/elements/svc_Common.html
+++ b/httemplate/edit/elements/svc_Common.html
@@ -14,6 +14,13 @@
label_fixup($part_svc, $opt);
$svc_x->setfield('svcpart', $svcpart);
+
+ if ( my $cb = $opt{'svc_error_callback'} ) {
+ my $cust_pkg = $pkgnum
+ ? qsearchs('cust_pkg', {pkgnum=>$pkgnum})
+ : ''; #?
+ &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt);
+ }
},
'edit_callback' => sub {
@@ -29,13 +36,13 @@
die "No part_svc entry!" unless $part_svc;
label_fixup($part_svc, $opt);
-
- if ( my $cb = $opt{'svc_edit_callback'} ) {
+
+ if ( my $cb = $opt{'svc_edit_callback'} ) {
my $cust_pkg = $pkgnum
? qsearchs('cust_pkg', {pkgnum=>$pkgnum})
: ''; #?
- &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt);
- }
+ &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt);
+ }
},
'new_hashref_callback' => sub {
@@ -48,23 +55,23 @@
},
'new_callback' => sub {
- my( $cgi, $svc_x, $fields, $opt ) = @_;
+ my( $cgi, $svc_x, $fields, $opt ) = @_;
- $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
- die "No part_svc entry!" unless $part_svc;
+ $part_svc = qsearchs( 'part_svc', { svcpart=>$svcpart });
+ die "No part_svc entry!" unless $part_svc;
- label_fixup($part_svc, $opt);
+ label_fixup($part_svc, $opt);
- #$svcnum='';
+ #$svcnum='';
- if ( my $cb = $opt{'svc_new_callback'} ) {
+ if ( my $cb = $opt{'svc_new_callback'} ) {
my $cust_pkg = $pkgnum
- ? qsearchs('cust_pkg', {pkgnum=>$pkgnum})
- : ''; #?
- &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt);
- }
+ ? qsearchs('cust_pkg', {pkgnum=>$pkgnum})
+ : ''; #?
+ &{ $cb }( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt);
+ }
- $svc_x->set_default_and_fixed;
+ $svc_x->set_default_and_fixed;
},
diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi
index 704d256e6..a6449b880 100644
--- a/httemplate/edit/process/quick-cust_pkg.cgi
+++ b/httemplate/edit/process/quick-cust_pkg.cgi
@@ -11,11 +11,9 @@
%
% # for going right to a provision service after ordering a package
% if ( $svcpart ) {
-% my $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } );
-% if ( $part_svc ) {
-% $redir_url = popurl(3)."edit/".$part_svc->svcdb.".cgi?"
-% ."pkgnum=".$cust_pkg->pkgnum.";svcpart=$svcpart";
-% }
+% $redir_url = popurl(3)."edit/".$part_svc->svcdb.".cgi?".
+% "pkgnum=".$cust_pkg->pkgnum. ";svcpart=$svcpart";
+% $redir_url .= ";qualnum=$qualnum" if $qualnum;
% }
<% header('Package ordered') %>
<SCRIPT TYPE="text/javascript">
@@ -61,13 +59,22 @@ $cgi->param('discountnum') =~ /^(\-?\d*)$/
my $discountnum = $1;
# for going right to a provision service after ordering a package
-my $svcpart;
+my( $svcpart, $part_svc ) = ( '', '' );
if ( $cgi->param('svcpart') ) {
- $cgi->param('svcpart') =~ /^(\-?\d*)$/
- or die 'illegal svcpart '. $cgi->param('svcpart');
- $svcpart = $1;
+ $cgi->param('svcpart') =~ /^(\-?\d*)$/
+ or die 'illegal svcpart '. $cgi->param('svcpart');
+ $svcpart = $1;
+ $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } )
+ or die "unknown svcpart $svcpart";
}
+my $qualnum = '';
+if ( $cgi->param('qualnum') ) {
+ $cgi->param('qualnum') =~ /^(\d+)$/ or die 'illegal qualnum';
+ $qualnum = $1;
+}
+
+
my $cust_pkg = new FS::cust_pkg {
'custnum' => $custnum,
'pkgpart' => $pkgpart,
diff --git a/httemplate/edit/svc_dsl.cgi b/httemplate/edit/svc_dsl.cgi
index 7ecf906f0..5896f18ae 100644
--- a/httemplate/edit/svc_dsl.cgi
+++ b/httemplate/edit/svc_dsl.cgi
@@ -3,6 +3,7 @@
'fields' => \@fields,
'svc_new_callback' => $new_cb,
'svc_edit_callback' => $edit_cb,
+ 'svc_error_callback' => $error_cb,
'html_foot' => $html_foot,
)
%>
@@ -61,32 +62,58 @@ my $edit_cb = sub {
my $new_cb = sub {
my( $cgi,$svc_x, $part_svc,$cust_pkg, $fields1,$opt) = @_;
my @exports = $part_svc->part_export_dsl_pull;
- die "more than one DSL-pulling export attached to svcpart ".$part_svc->svcpart
- if ( scalar(@exports) > 1 );
+ die "more than one DSL-pulling export for svcpart ".$part_svc->svcpart
+ if ( scalar(@exports) > 1 );
+
+ my $cust_main = $cust_pkg->cust_main;
+
+ @fields = (
+ { field => 'first',
+ value => $cust_main->ship_first ? $cust_main->ship_first
+ : $cust_main->first,
+ },
+ { field => 'last',
+ value => $cust_main->ship_last ? $cust_main->ship_last
+ : $cust_main->last,
+ },
+ { field => 'company',
+ value => $cust_pkg->cust_main->ship_company,
+ value => $cust_main->ship_company ? $cust_main->ship_company
+ : $cust_main->company,
+ },
+ );
+
+ my $vendor_qual_id = '';
+ my $qual = '';
+ if ( $cgi->param('qualnum') ) {
+
+ $qual =
+ qsearchs('qual', { 'qualnum' => scalar($cgi->param('qualnum')) } )
+ or die 'unknown qualnum';
+
+ $vendor_qual_id = $qual->vendor_qual_id;
+
+ push @fields, { 'field' => 'qualnum',
+ 'type' => 'hidden',
+ 'value' => $qual->qualnum,
+ },
+ { 'field' => 'phonenum',
+ 'type' => 'fixed',
+ 'value' => $qual->phonenum,
+ };
+
+ } else {
+
+ my $phonenum = $cust_main->ship_daytime ? $cust_main->ship_daytime
+ : $cust_main->daytime;
+ $phonenum =~ s/[^0-9]//g;
+
+ push @fields,
+ { field => 'phonenum',
+ value => $phonenum,
+ };
- my $cust_main = $cust_pkg->cust_main;
- my $defsvctn = $cust_main->ship_daytime ? $cust_main->ship_daytime
- : $cust_main->daytime;
- $defsvctn =~ s/[^0-9]//g;
-
- @fields = (
- { field => 'first',
- value => $cust_main->ship_first ? $cust_main->ship_first
- : $cust_main->first,
- },
- { field => 'last',
- value => $cust_main->ship_last ? $cust_main->ship_last
- : $cust_main->last,
- },
- { field => 'company',
- value => $cust_pkg->cust_main->ship_company,
- value => $cust_main->ship_company ? $cust_main->ship_company
- : $cust_main->company,
- },
- { field => 'phonenum',
- value => $defsvctn,
- },
- );
+ }
if ( scalar(@exports) == 1 ) {
my $export = @exports[0];
@@ -104,30 +131,52 @@ my $new_cb = sub {
.$qual->qualnum;
}
- splice @fields, -1, 0,
- { field => 'loop_type',
- type => 'select',
- options => [ '', '0' ],
- labels => { '' => 'Line-share', '0', => 'Standalone' },
- onchange => 'ikano_loop_type_changed',
- },
- ;
+ if ( $vendor_qual_id ) {
+ splice @fields, -1, 0,
+ { field => 'loop_type',
+ type => 'fixed',
+ value => ( $qual->phonenum ? '' : '0' ),
+ formatted_value => ( $qual->phonenum ? 'Line-share'
+ : 'Standalone' ),
+ };
+ } else {
+ splice @fields, -1, 0,
+ { field => 'loop_type',
+ type => 'select',
+ options => [ '', '0' ],
+ labels => { '' => 'Line-share', '0', => 'Standalone' },
+ onchange => 'ikano_loop_type_changed',
+ };
+ }
push @fields,
'password',
{ field => 'isp_chg', type => 'checkbox', value=>'Y', },
'isp_prev',
- { field => 'vendor_qual_id',
- type => 'select',
- options => \@prequalids,
- labels => \%prequal_labels,
+ ;
+
+ if ( $vendor_qual_id ) {
+ push @fields,
+ { field => 'vendor_qual_id',
+ type => 'fixed',
+ value => $vendor_qual_id,
+ };
+ } else {
+ push @fields,
+ { field => 'vendor_qual_id',
+ type => 'select',
+ options => \@prequalids,
+ labels => \%prequal_labels,
onchange => 'ikano_vendor_qual_id_changed',
- },
+ };
+ }
+
+ push @fields,
{ field => 'vendor_order_type',
- type => 'hidden',
+ type => 'hidden',
value => 'NEW' },
{ field => 'desired_due_date',
- type => 'fixed',
+ type => 'fixed',
formatted_value =>
time2str($date_format,$ddd),
value => $ddd,
@@ -140,4 +189,15 @@ my $new_cb = sub {
push @fields, qw( rate_band circuitnum vpi vci );
}
};
+
+my $error_cb = sub {
+ my( $cgi ) = @_;
+ #my( $cgi,$svc_x, $part_svc,$cust_pkg, $fields,$opt) = @_;
+ if ( $cgi->param('svcnum') ) {
+ &{ $edit_cb }( @_ );
+ } else {
+ &{ $new_cb }( @_ );
+ }
+};
+
</%init>
diff --git a/httemplate/elements/popup_link-cust_main.html b/httemplate/elements/popup_link-cust_main.html
index 78e50e782..db53ad480 100644
--- a/httemplate/elements/popup_link-cust_main.html
+++ b/httemplate/elements/popup_link-cust_main.html
@@ -39,8 +39,8 @@ $params->{'action'} .=
( $params->{'action'} =~ /\?/ ? ';' : '?' ).
'custnum='. $params->{'cust_main'}->custnum;
-$params->{'action'} .= ';pkgpart='.$params->{'pkgpart'} if $params->{'pkgpart'};
-$params->{'action'} .= ';locationnum='.$params->{'locationnum'} if $params->{'locationnum'};
-$params->{'action'} .= ';svcpart='.$params->{'svcpart'} if $params->{'svcpart'};
+$params->{'action'} .= ";$_=".$params->{$_}
+ foreach grep $params->{$_},
+ qw( lock_pkgpart lock_locationnum qualnum svcpart );
</%init>
diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html
index dcbc01636..17c56055e 100644
--- a/httemplate/misc/order_pkg.html
+++ b/httemplate/misc/order_pkg.html
@@ -28,18 +28,27 @@
<FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/quick-cust_pkg.cgi" METHOD="POST">
<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main->custnum %>">
+<INPUT TYPE="hidden" NAME="qualnum" VALUE="<% scalar($cgi->param('qualnum')) |h %>">
% if ( $svcpart ) {
<INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
% }
<% ntable("#cccccc", 2) %>
-<% include('/elements/tr-select-cust-part_pkg.html',
- 'curr_value' => $pkgpart,
- 'classnum' => -1,
- 'cust_main' => $cust_main,
- 'onchange' => 'enable_order_pkg',
- )
-%>
+% if ( $part_pkg ) {
+ <INPUT TYPE="hidden" NAME="pkgpart" VALUE="<% $part_pkg->pkgpart %>">
+ <TR>
+ <TH ALIGN="right">Package</TH>
+ <TD COLSPAN=6><% $part_pkg->pkg_comment |h %></TD>
+ </TR>
+% } else {
+ <% include('/elements/tr-select-cust-part_pkg.html',
+ 'curr_value' => $pkgpart,
+ 'classnum' => -1,
+ 'cust_main' => $cust_main,
+ 'onchange' => 'enable_order_pkg',
+ )
+ %>
+% }
<TR>
<TH ALIGN="right">Start date </TD>
@@ -81,11 +90,22 @@
%>
% }
-<% include('/elements/tr-select-cust_location.html',
- 'cgi' => $cgi,
- 'cust_main' => $cust_main,
- )
-%>
+% if ( $cgi->param('lock_locationnum') ) {
+
+ <INPUT TYPE = "hidden"
+ NAME = "locationnum"
+ VALUE = "<% scalar($cgi->param('lock_locationnum')) |h %>"
+ >
+
+% } else {
+
+ <% include('/elements/tr-select-cust_location.html',
+ 'cgi' => $cgi,
+ 'cust_main' => $cust_main,
+ )
+ %>
+
+% }
<TR>
<TH ALIGN="right">Contract end date </TD>
@@ -101,16 +121,28 @@
</TABLE>
-<% include( '/elements/standardize_locations.html',
- 'form' => "OrderPkgForm",
- 'onlyship' => 1,
- 'no_company' => 1,
- 'callback' => 'document.OrderPkgForm.submit();',
- )
-%>
+% unless ( $cgi->param('lock_locationnum') ) {
+
+ <% include( '/elements/standardize_locations.html',
+ 'form' => "OrderPkgForm",
+ 'onlyship' => 1,
+ 'no_company' => 1,
+ 'callback' => 'document.OrderPkgForm.submit();',
+ )
+ %>
+
+% }
<BR>
-<INPUT NAME="submitButton" TYPE="button" VALUE="Order Package" onClick = "this.disabled=true; standardize_locations();" <% $pkgpart ? '' : 'DISABLED' %>>
+% my $onclick = $cgi->param('lock_locationnum')
+% ? 'document.OrderPkgForm.submit()'
+% : 'standardize_locations()';
+<INPUT NAME="submitButton"
+ TYPE="button"
+ VALUE="Order Package"
+ onClick = "this.disabled=true; <% $onclick %>;"
+ <% $pkgpart ? '' : 'DISABLED' %>
+>
</FORM>
</BODY>
@@ -133,7 +165,17 @@ my $cust_main = qsearchs({
'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
});
-my $pkgpart = scalar($cgi->param('pkgpart'));
+my $part_pkg = '';
+if ( $cgi->param('lock_pkgpart') ) {
+ $part_pkg = qsearchs({
+ 'table' => 'part_pkg',
+ 'hashref' => { 'pkgpart' => scalar($cgi->param('lock_pkgpart')) },
+ 'extra_sql' => ' AND '. FS::part_pkg->agent_pkgs_sql( $cust_main->agent ),
+ })
+ or die "unknown pkgpart ". $cgi->param('lock_pkgpart');
+}
+
+my $pkgpart = $part_pkg ? $part_pkg->pkgpart : scalar($cgi->param('pkgpart'));
my $format = $date_format. ' %T %z (%Z)'; #false laziness w/REAL_cust_pkg.cgi?
my $start_date = '';
@@ -142,6 +184,6 @@ if( ! $conf->exists('order_pkg-no_start_date') ) {
$start_date = $start_date ? time2str($format, $start_date) : '';
}
-my $svcpart = $cgi->param('svcpart');
+my $svcpart = scalar($cgi->param('svcpart'));
</%init>
diff --git a/httemplate/view/cust_main/order_pkg_link.html b/httemplate/view/cust_main/order_pkg_link.html
index 2e8b1dac1..ba731ae11 100644
--- a/httemplate/view/cust_main/order_pkg_link.html
+++ b/httemplate/view/cust_main/order_pkg_link.html
@@ -6,7 +6,7 @@
'cust_main' => $cust_main,
'closetext' => 'Close',
'width' => 763,
- 'height' => 538,
+ 'height' => $height,
%optional,
)
%>
@@ -14,9 +14,10 @@
my($cust_main, %opt) = @_;
-my %optional = ();
-$optional{'pkgpart'} = $opt{'pkgpart'} if $opt{'pkgpart'};
-$optional{'locationnum'} = $opt{'locationnum'} if $opt{'locationnum'};
-$optional{'svcpart'} = $opt{'svcpart'} if $opt{'svcpart'};
+my %optional = map { $_ => $opt{$_} }
+ grep $opt{$_},
+ qw( lock_pkgpart lock_locationnum qualnum svcpart );
+
+my $height = $opt{'lock_locationnum'} ? 296 : 538;
</%init>
diff --git a/httemplate/view/qual.cgi b/httemplate/view/qual.cgi
index 6998b8541..5c15ec0c3 100644
--- a/httemplate/view/qual.cgi
+++ b/httemplate/view/qual.cgi
@@ -46,9 +46,10 @@
% if($cust_or_prospect->custnum) {
-% my %opt = ( 'label' => $pkglist->{$pkgpart},
-% 'pkgpart' => $pkgpart,
-% 'locationnum' => $location{'locationnum'},
+% my %opt = ( 'label' => $pkglist->{$pkgpart},
+% 'lock_pkgpart' => $pkgpart,
+% 'lock_locationnum' => $location{'locationnum'},
+% 'qualnum' => $qual->qualnum,
% );
% if ( $export->exporttype eq 'ikano' ) {
% my $pkg_svc = qsearchs('pkg_svc', { 'pkgpart' => $pkgpart,