From 6891db8c9287fa670e5f6961c8ad3f2e3097fc3c Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sun, 18 Aug 2013 19:58:17 -0700 Subject: continue sales person work: customer and package selection, commissions, reporting. RT#23402 --- httemplate/edit/cust_pkg_salesnum.html | 49 ++++++++++++++++++++++++++ httemplate/edit/process/cust_pkg_salesnum.html | 33 +++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100755 httemplate/edit/cust_pkg_salesnum.html create mode 100644 httemplate/edit/process/cust_pkg_salesnum.html (limited to 'httemplate/edit') diff --git a/httemplate/edit/cust_pkg_salesnum.html b/httemplate/edit/cust_pkg_salesnum.html new file mode 100755 index 000000000..dba2a905e --- /dev/null +++ b/httemplate/edit/cust_pkg_salesnum.html @@ -0,0 +1,49 @@ +<& /elements/header-popup.html, "Change Sales Person" &> +<& /elements/error.html &> + +
+ +<& /elements/table-grid.html, 'bgcolor' => '#cccccc', 'cellpadding' => 2 &> + + + Current package  + + <% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><% $part_pkg->pkg |h %> - <% $part_pkg->comment |h %> + + + +<& /elements/tr-select-sales.html, + #'field' => 'salesnum', + 'curr_value' => $cust_pkg->salesnum, + 'th' => 1, +&> + + + +
+ + +
+ + + +<%init> + +#some false laziness w/misc/change_pkg.cgi + +my $conf = new FS::Conf; + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Change customer package'); + +my $pkgnum = scalar($cgi->param('pkgnum')); +$pkgnum =~ /^(\d+)$/ or die "illegal pkgnum $pkgnum"; +$pkgnum = $1; + +my $cust_pkg = FS::cust_pkg->by_key($pkgnum) or die "unknown pkgnum $pkgnum"; + +my $part_pkg = $cust_pkg->part_pkg; + + diff --git a/httemplate/edit/process/cust_pkg_salesnum.html b/httemplate/edit/process/cust_pkg_salesnum.html new file mode 100644 index 000000000..aab37416a --- /dev/null +++ b/httemplate/edit/process/cust_pkg_salesnum.html @@ -0,0 +1,33 @@ +% if ($error) { +% $cgi->param('error', $error); +% $cgi->redirect(popurl(3). 'edit/cust_pkg_salesnum.html?'. $cgi->query_string ); +% } else { + + <& /elements/header-popup.html, "Sales Person changed" &> + + + + +% } +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Change customer package'); + +my $cust_pkg = qsearchs({ + 'table' => 'cust_pkg', + 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', + 'hashref' => { 'pkgnum' => scalar($cgi->param('pkgnum')), }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, +}); +die 'unknown pkgnum' unless $cust_pkg; + +$cgi->param('salesnum') =~ /^(\d*)$/; +my $salesnum = $1; +my $error = $cust_pkg->set_salesnum($1); + + -- cgit v1.2.1