scalar cgi param
authorIvan Kohler <ivan@freeside.biz>
Sun, 25 Sep 2016 21:49:38 +0000 (14:49 -0700)
committerIvan Kohler <ivan@freeside.biz>
Sun, 25 Sep 2016 21:49:38 +0000 (14:49 -0700)
21 files changed:
httemplate/edit/cust_main.cgi
httemplate/edit/part_pkg.cgi
httemplate/edit/process/access_user.html
httemplate/edit/process/elements/ApplicationCommon.html
httemplate/edit/process/elements/svc_Common.html
httemplate/edit/process/part_event.html
httemplate/edit/process/sched_item.html
httemplate/edit/process/svc_acct.cgi
httemplate/edit/quick-charge.html
httemplate/elements/select-time-from_to.html
httemplate/elements/select.html
httemplate/graph/signupdate.cgi
httemplate/misc/change_pkg_date.html
httemplate/misc/email-customer-statement.html
httemplate/misc/process/link.cgi
httemplate/misc/process/payment.cgi
httemplate/misc/process/timeworked.html
httemplate/misc/unhold_pkg.html
httemplate/search/cust_msg.html
httemplate/search/log.html
httemplate/view/cust_bill-barcode.cgi

index 3ba1e85..e58441d 100755 (executable)
@@ -237,7 +237,8 @@ if ( $cgi->param('error') ) {
     unless $curuser->access_right($custnum ? 'Edit customer' : 'New customer');
 
   @invoicing_list = split( /\s*,\s*/, $cgi->param('invoicing_list') );
     unless $curuser->access_right($custnum ? 'Edit customer' : 'New customer');
 
   @invoicing_list = split( /\s*,\s*/, $cgi->param('invoicing_list') );
-  $cust_main->setfield('paid' => $cgi->param('paid')) if $cgi->param('paid');
+  $cust_main->setfield( 'paid' => scalar($cgi->param('paid')) )
+    if $cgi->param('paid');
   $ss = $cust_main->ss;           # don't mask an entered value on errors
   $stateid = $cust_main->stateid; # don't mask an entered value on errors
 
   $ss = $cust_main->ss;           # don't mask an entered value on errors
   $stateid = $cust_main->stateid; # don't mask an entered value on errors
 
index e08f0e1..2c36216 100755 (executable)
@@ -653,7 +653,7 @@ my $clone_callback = sub {
 
   if ( $cgi->param('pkgnum') ) {
 
 
   if ( $cgi->param('pkgnum') ) {
 
-    my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cgi->param('pkgnum') } );
+    my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => scalar($cgi->param('pkgnum')) } );
     $object->agentnum( $cust_pkg->cust_main->agentnum );
 
     $opt->{action} = 'Custom';
     $object->agentnum( $cust_pkg->cust_main->agentnum );
 
     $opt->{action} = 'Custom';
@@ -710,7 +710,7 @@ my $usageprice_error_callback = sub {
                && $cgi->param("usagepricepart$1_price") )
         {
           new FS::part_pkg_usageprice {
                && $cgi->param("usagepricepart$1_price") )
         {
           new FS::part_pkg_usageprice {
-            'usagepricepart' => $cgi->param("usagepricepart$1"),
+            'usagepricepart' => scalar($cgi->param("usagepricepart$1")),
             'pkgpart'        => $object->pkgpart,
             'price'          => scalar($cgi->param("usagepricepart$1_price")),
             #'currency
             'pkgpart'        => $object->pkgpart,
             'price'          => scalar($cgi->param("usagepricepart$1_price")),
             #'currency
index bbe4268..54d2b03 100644 (file)
@@ -29,7 +29,7 @@ if ( FS::Conf->new->exists('disable_acl_changes') ) {
 sub precheck_callback {
   my $cgi = shift;
 
 sub precheck_callback {
   my $cgi = shift;
 
-  my $o = FS::access_user->new({username => $cgi->param('username')});
+  my $o = FS::access_user->new({username => scalar($cgi->param('username'))});
   if( $o->is_system_user and !$cgi->param('usernum') ) {
     $cgi->param('username','');
     return "username '".$o->username."' reserved for system account."
   if( $o->is_system_user and !$cgi->param('usernum') ) {
     $cgi->param('username','');
     return "username '".$o->username."' reserved for system account."
index ea2462a..097a45d 100644 (file)
@@ -69,9 +69,9 @@ my $dbh = dbh;
 my $new;
 #  $new = new FS::cust_refund ( {
 #    'reason'  => 'Refunding payment', #enter reason in UI
 my $new;
 #  $new = new FS::cust_refund ( {
 #    'reason'  => 'Refunding payment', #enter reason in UI
-#    'refund'  => $cgi->param('amount'),
+#    'refund'  => scalar($cgi->param('amount')),
 #    'payby'   => 'BILL',
 #    'payby'   => 'BILL',
-#    #'_date'   => $cgi->param('_date'),
+#    #'_date'   => scalar($cgi->param('_date')),
 #    'payinfo' => 'Cash', #enter payinfo in UI
 #    'paynum' => $paynum,
 #  } );
 #    'payinfo' => 'Cash', #enter payinfo in UI
 #    'paynum' => $paynum,
 #  } );
index ca336a1..504ded0 100644 (file)
@@ -26,7 +26,7 @@ my $args_callback = sub {
     or die "svcpart required";
   if ( $part_svc->has_router ) {
     my $router = FS::router->new({
     or die "svcpart required";
   if ( $part_svc->has_router ) {
     my $router = FS::router->new({
-      map { $_ => $cgi->param("router_$_") }
+      map { $_ => scalar($cgi->param("router_$_")) }
       qw( routernum routername blocknum )
     });
    if ($router->blocknum and length($router->routername) == 0) {
       qw( routernum routername blocknum )
     });
    if ($router->blocknum and length($router->routername) == 0) {
index 0293af8..6c6249c 100644 (file)
@@ -81,7 +81,7 @@
     'precheck_callback' => sub {
       my $cgi = shift;
       my $action = $cgi->param('action') or return;
     'precheck_callback' => sub {
       my $cgi = shift;
       my $action = $cgi->param('action') or return;
-      my %actionfields = map { $_ =~ /^$action\.(.*)/; $1 => $cgi->param($_) }
+      my %actionfields = map { $_ =~ /^$action\.(.*)/; $1 => scalar($cgi->param($_)) }
                          grep { /^$action\./ } $cgi->param;
       if ( exists($actionfields{'reasonnum'}) and 
            length($actionfields{'reasonnum'}) == 0 ) {
                          grep { /^$action\./ } $cgi->param;
       if ( exists($actionfields{'reasonnum'}) and 
            length($actionfields{'reasonnum'}) == 0 ) {
        next unless $cgi->param($1) eq 'balance_age';
 
        my $errstr = FS::part_event::Condition::balance_age->
        next unless $cgi->param($1) eq 'balance_age';
 
        my $errstr = FS::part_event::Condition::balance_age->
-         check_options( { age       => $cgi->param($param),
-                          age_units => $cgi->param("${param}_units") } );
+         check_options( { age       => scalar($cgi->param($param)),
+                          age_units => scalar($cgi->param("${param}_units")),
+                         }
+                       );
 
        return $errstr if $errstr;
       }
 
        return $errstr if $errstr;
       }
index 7731a35..335f813 100644 (file)
@@ -21,8 +21,8 @@ foreach my $wday (0..6) {
     push @sched_avail, new FS::sched_avail {
       'itemnum' => $itemnum,
       'wday'    => $wday,
     push @sched_avail, new FS::sched_avail {
       'itemnum' => $itemnum,
       'wday'    => $wday,
-      'stime'   => $cgi->param("sched_avail$wday".'_stime'),
-      'etime'   => $cgi->param("sched_avail$wday".'_etime'),
+      'stime'   => scalar($cgi->param("sched_avail$wday".'_stime')),
+      'etime'   => scalar($cgi->param("sched_avail$wday".'_etime')),
     };
   }
 }
     };
   }
 }
index d81eaec..12e84cc 100755 (executable)
@@ -64,7 +64,7 @@ my $error = '';
 my $part_svc = $svcnum ? 
                 $old->part_svc : 
                 qsearchs( 'part_svc', 
 my $part_svc = $svcnum ? 
                 $old->part_svc : 
                 qsearchs( 'part_svc', 
-                  { 'svcpart' => $cgi->param('svcpart') }
+                  { 'svcpart' => scalar($cgi->param('svcpart')) }
                 );
 
 # google captcha auth
                 );
 
 # google captcha auth
@@ -117,7 +117,7 @@ if ( ! $error ) {
 
   if ( $part_svc->has_router ) {
     my $router = FS::router->new({
 
   if ( $part_svc->has_router ) {
     my $router = FS::router->new({
-      map { $_ => $cgi->param("router_$_") }
+      map { $_ => scalar($cgi->param("router_$_")) }
       qw( routernum routername blocknum )
     });
     if (length($router->routername) == 0) {
       qw( routernum routername blocknum )
     });
     if (length($router->routername) == 0) {
index a9e57b6..6da5f12 100644 (file)
@@ -321,15 +321,15 @@ function bill_now_changed (what) {
   <TD><INPUT TYPE="checkbox" NAME="setuptax" VALUE="Y" <% $cgi->param('setuptax') ? 'CHECKED' : '' %>></TD>
 </TR>
 
   <TD><INPUT TYPE="checkbox" NAME="setuptax" VALUE="Y" <% $cgi->param('setuptax') ? 'CHECKED' : '' %>></TD>
 </TR>
 
-<& /elements/tr-select-taxclass.html, 'curr_value' => $cgi->param('taxclass')  &>
+<& /elements/tr-select-taxclass.html, 'curr_value' => scalar($cgi->param('taxclass')) &>
 
 <& /elements/tr-select-taxproduct.html,
 
 <& /elements/tr-select-taxproduct.html,
-  'label' => emt('Tax product'),
-  'curr_value' => $cgi->param('taxproductnum')
+  'label'      => emt('Tax product'),
+  'curr_value' => scalar($cgi->param('taxproductnum')),
 &>
 
 <& /elements/tr-select-taxoverride.html,
 &>
 
 <& /elements/tr-select-taxoverride.html,
-  'curr_value' => $cgi->param('tax_override')
+  'curr_value' => scalar($cgi->param('tax_override')),
 &>
 
 % } # if !$cust_pkg
 &>
 
 % } # if !$cust_pkg
index 9d49b7a..e417313 100644 (file)
@@ -2,14 +2,14 @@
      %opt,
      'field'            => $opt{'prefix'}. 'stime',
      'selected_default' => 480, #8am... configure?
      %opt,
      'field'            => $opt{'prefix'}. 'stime',
      'selected_default' => 480, #8am... configure?
-     'curr_value'       => $cgi->param($opt{'prefix'}.'stime'),
+     'curr_value'       => scalar($cgi->param($opt{'prefix'}.'stime')),
 &>
  - 
 <& select-time.html,
      %opt,
      'field'            => $opt{'prefix'}. 'etime',
      'selected_default' => 1080, #6pm.. configure?
 &>
  - 
 <& select-time.html,
      %opt,
      'field'            => $opt{'prefix'}. 'etime',
      'selected_default' => 1080, #6pm.. configure?
-     'curr_value'       => $cgi->param($opt{'prefix'}.'etime'),
+     'curr_value'       => scalar($cgi->param($opt{'prefix'}.'etime')),
 &>
 <%init>
   my %opt = @_;
 &>
 <%init>
   my %opt = @_;
index 4460207..689566e 100644 (file)
@@ -10,7 +10,7 @@
                      'AR' => 'Arkansas',
                    },
     options     => [ 'AL', 'AK', 'AR' ],
                      'AR' => 'Arkansas',
                    },
     options     => [ 'AL', 'AK', 'AR' ],
-    curr_value  => $cgi->param('myfield'),
+    curr_value  => scalar( $cgi->param('myfield') ),
 
   # recommended    
     id          => 'myid',    # DOM id
 
   # recommended    
     id          => 'myid',    # DOM id
index 8261257..823ddb8 100644 (file)
@@ -34,13 +34,13 @@ $where{'agentnum'} = $agentnum if $agentnum;
 $where{'usernum'}   = $usernum if $usernum;
 
 my $sdate = DateTime->new(
 $where{'usernum'}   = $usernum if $usernum;
 
 my $sdate = DateTime->new(
-    year       => $cgi->param('start_year'),
-    month      => $cgi->param('start_month'),
+    year       => scalar($cgi->param('start_year')),
+    month      => scalar($cgi->param('start_month')),
 )->epoch();
 
 my $edate = DateTime->new(
 )->epoch();
 
 my $edate = DateTime->new(
-    year       => $cgi->param('end_year'),
-    month      => $cgi->param('end_month')
+    year       => scalar($cgi->param('end_year')),
+    month      => scalar($cgi->param('end_month')),
 )->add( months => 1 )->epoch();
 
 my $where = (%where ? ' AND ' : ' WHERE ');
 )->add( months => 1 )->epoch();
 
 my $where = (%where ? ' AND ' : ' WHERE ');
index 642a5b8..dabb90d 100755 (executable)
@@ -43,7 +43,7 @@
 <label for="when_date"> <% emt('On this date:') %> </label>
 <& /elements/input-date-field.html,
   { name  => 'date_value',
 <label for="when_date"> <% emt('On this date:') %> </label>
 <& /elements/input-date-field.html,
   { name  => 'date_value',
-    value => $cgi->param('date_value') || $cust_pkg->get($field),
+    value => ( scalar($cgi->param('date_value')) || $cust_pkg->get($field) ),
   }
 &>
 </LI>
   }
 &>
 </LI>
index 39c99e5..7ed380b 100644 (file)
@@ -25,9 +25,9 @@ my $alternate_form = sub {
         my $label = ucfirst($_);
         $label =~ s/_/ /;
         include('/elements/tr-input-date-field.html',{
         my $label = ucfirst($_);
         $label =~ s/_/ /;
         include('/elements/tr-input-date-field.html',{
-          'name' => $_,
-          'value' => $cgi->param($_) || '',
-          'label' => $label,
+          'name'   => $_,
+          'value'  => ( scalar($cgi->param($_)) || '' ),
+          'label'  => $label,
           'noinit' => $noinit++
         });
       }
           'noinit' => $noinit++
         });
       }
index 77546f3..a3f9f3e 100755 (executable)
@@ -30,7 +30,7 @@ unless ( $svcnum ) {
   my $svcdb = $part_svc->getfield('svcdb');
   $cgi->param('link_field') =~ /^(\w+)$/;
   my $link_field = $1;
   my $svcdb = $part_svc->getfield('svcdb');
   $cgi->param('link_field') =~ /^(\w+)$/;
   my $link_field = $1;
-  my %search = ( $link_field => $cgi->param('link_value') );
+  my %search = ( $link_field => scalar($cgi->param('link_value')) );
   if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) {
     $search{$1} = $cgi->param('link_value2');
   }
   if ( $cgi->param('link_field2') =~ /^(\w+)$/ ) {
     $search{$1} = $cgi->param('link_value2');
   }
index 7768f92..852becb 100644 (file)
@@ -170,7 +170,7 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
     my %saveopt;
     if ( $payby eq 'CARD' ) {
       my $bill_location = FS::cust_location->new;
     my %saveopt;
     if ( $payby eq 'CARD' ) {
       my $bill_location = FS::cust_location->new;
-      $bill_location->set( $_ => $cgi->param($_) )
+      $bill_location->set( $_ => scalar($cgi->param($_)) )
         foreach @{$payby2fields{$payby}};
       $saveopt{'bill_location'} = $bill_location;
       $saveopt{'paycvv'} = $paycvv; # save_cust_payby contains conf logic for when to use this
         foreach @{$payby2fields{$payby}};
       $saveopt{'bill_location'} = $bill_location;
       $saveopt{'paycvv'} = $paycvv; # save_cust_payby contains conf logic for when to use this
index 01752e1..aaccf05 100644 (file)
@@ -18,7 +18,7 @@ foreach my $transaction (
   map { /^transactionid(\d+)$/; $1; } grep /^transactionid\d+$/, $cgi->param
 ) {
   my $s = "multiplier${transaction}_";
   map { /^transactionid(\d+)$/; $1; } grep /^transactionid\d+$/, $cgi->param
 ) {
   my $s = "multiplier${transaction}_";
-  my %multipliers = map { /^$s(\d+)$/; $1 => $cgi->param("$s$1"); }
+  my %multipliers = map { /^$s(\d+)$/; $1 => scalar($cgi->param("$s$1")); }
                       grep /^$s\d+$/, $cgi->param;
   my $msum = 0;
   foreach(values %multipliers) {$msum += $_};
                       grep /^$s\d+$/, $cgi->param;
   my $msum = 0;
   foreach(values %multipliers) {$msum += $_};
index 0c110b4..d7044cf 100755 (executable)
@@ -42,7 +42,7 @@
 <label for="when_date"> <% emt('On this date:') %> </label>
 <& /elements/input-date-field.html,
   { name  => 'start_date',
 <label for="when_date"> <% emt('On this date:') %> </label>
 <& /elements/input-date-field.html,
   { name  => 'start_date',
-    value => $cgi->param('start_date'),
+    value => scalar($cgi->param('start_date')),
   }
 &>
 </LI>
   }
 &>
 </LI>
index 2bfbd7c..33e1815 100644 (file)
@@ -126,17 +126,17 @@ my $html_init = qq!<FORM ACTION="$p/search/cust_msg.html" METHOD="GET">
 <TABLE cellspacing="10">!.
 '<TR><TD>From '.
 include('/elements/input-date-field.html',
 <TABLE cellspacing="10">!.
 '<TR><TD>From '.
 include('/elements/input-date-field.html',
-  { 'name'  => 'beginning', 'value' => $cgi->param('beginning') }
+  { 'name'  => 'beginning', 'value' => scalar($cgi->param('beginning')) }
 ).
 '</TD><TD> To '.
 include('/elements/input-date-field.html',
 ).
 '</TD><TD> To '.
 include('/elements/input-date-field.html',
-  { 'name'  => 'ending', 'value' => ($cgi->param('ending') || ''), 
+  { 'name'  => 'ending', 'value' => (scalar($cgi->param('ending')) || ''), 
     'noinit' => 1, }
 ).
 '</TD><TD> Status '.
 include('/elements/select.html',
   'field' => 'status',
     'noinit' => 1, }
 ).
 '</TD><TD> Status '.
 include('/elements/select.html',
   'field' => 'status',
-  'curr_value' => $cgi->param('status') || '',
+  'curr_value' => scalar($cgi->param('status')) || '',
   'options' => [ '', 'failed', 'sent', ],
   'labels' => { ''        => '(any)', 
                 'failed'  => 'failed',
   'options' => [ '', 'failed', 'sent', ],
   'labels' => { ''        => '(any)', 
                 'failed'  => 'failed',
@@ -145,7 +145,7 @@ include('/elements/select.html',
 '</TD><TD> Type '.
 include('/elements/select.html',
   'field' => 'msgtype',
 '</TD><TD> Type '.
 include('/elements/select.html',
   'field' => 'msgtype',
-  'curr_value' => $cgi->param('msgtype') || '',
+  'curr_value' => scalar($cgi->param('msgtype')) || '',
   'options' => [ '', 'invoice', 'receipt', 'admin', 'report' ],
   'labels'  => { ''         => '(any)',
                  'invoice'  => 'Invoices',
   'options' => [ '', 'invoice', 'receipt', 'admin', 'report' ],
   'labels'  => { ''         => '(any)',
                  'invoice'  => 'Invoices',
index 5b330f8..535b2ca 100644 (file)
@@ -65,14 +65,14 @@ a:visited {text-decoration: none}
 <TR>
   <TD>From 
     <& /elements/input-date-field.html, {
 <TR>
   <TD>From 
     <& /elements/input-date-field.html, {
-      name => 'beginning',
-      value => $cgi->param('beginning'),
+      name   => 'beginning',
+      value  => scalar($cgi->param('beginning')),
     } &>
   </TD>
   <TD>To 
     <& /elements/input-date-field.html, {
     } &>
   </TD>
   <TD>To 
     <& /elements/input-date-field.html, {
-      name => 'ending',
-      value => $cgi->param('ending') || '',
+      name   => 'ending',
+      value  => scalar($cgi->param('ending')) || '' ),
       noinit => 1,
     } &>
   </TD>
       noinit => 1,
     } &>
   </TD>
@@ -80,17 +80,17 @@ a:visited {text-decoration: none}
 <TR>
   <TD>Level
     <& /elements/select.html,
 <TR>
   <TD>Level
     <& /elements/select.html,
-      field => 'min_level',
-      options => [ &FS::Log::levelnums ],
-      labels => { &FS::Log::levelmap },
-      curr_value => $cgi->param('min_level'),
+      field      => 'min_level',
+      options    => [ &FS::Log::levelnums ],
+      labels     => { &FS::Log::levelmap },
+      curr_value => scalar($cgi->param('min_level')),
     &>
      to
     <& /elements/select.html,
     &>
      to
     <& /elements/select.html,
-      field => 'max_level',
-      options => [ &FS::Log::levelnums ],
-      labels => { &FS::Log::levelmap },
-      curr_value => $cgi->param('max_level'),
+      field      => 'max_level',
+      options    => [ &FS::Log::levelnums ],
+      labels     => { &FS::Log::levelmap },
+      curr_value => scalar($cgi->param('max_level')),
     &>
   </TD>
   <TD>
     &>
   </TD>
   <TD>
index dd8f8b8..b55c285 100755 (executable)
@@ -8,7 +8,7 @@ my $conf = new FS::Conf;
 
 die 'invalid query' unless $cgi->param('invnum');
 
 
 die 'invalid query' unless $cgi->param('invnum');
 
-my $cust_bill = qsearchs('cust_bill', { 'invnum' => $cgi->param('invnum') } )
+my $cust_bill = qsearchs('cust_bill', { 'invnum' => scalar($cgi->param('invnum')) } )
 or die 'unknown invnum';
 
 my $png = $cust_bill->invoice_barcode(0);
 or die 'unknown invnum';
 
 my $png = $cust_bill->invoice_barcode(0);