[freeside-commits] freeside/httemplate/edit/process access_group.html, 1.3, 1.4 invoice_logo.html, NONE, 1.1 invoice_template.html, NONE, 1.1 part_event.html, NONE, 1.1 quick-cust_pkg.cgi, 1.9, 1.10

Ivan,,, ivan at wavetail.420.am
Wed Aug 1 15:25:08 PDT 2007


Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail:/tmp/cvs-serv23435/httemplate/edit/process

Modified Files:
	access_group.html quick-cust_pkg.cgi 
Added Files:
	invoice_logo.html invoice_template.html part_event.html 
Log Message:
event refactor, landing on HEAD!

--- NEW FILE: invoice_template.html ---
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my $conf = new FS::Conf;

my $confname = $cgi->param('confname');
my $value = $cgi->param('value');

$conf->set($confname, $value);

$cgi->redirect(popurl(3). 'browse/invoice_template.html');

</%init> 

--- NEW FILE: invoice_logo.html ---
<%init>

my $curuser =  $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('Configuration');

my $conf = new FS::Conf;

$cgi->param('type') =~ /^(png|eps)$/ or die "illegal type";
my $type = $1;

$cgi->param('name') =~ /^([^\.\/]*)$/ or die "illegal name";
my $tname = my $name = $1;
$tname = "_$tname" if length($tname);

$cgi->param('preview_session') =~ /^(\w*)$/ or die "illegal preview_session";
my $session = $1;
my $data = decode_base64( $curuser->option("logo_preview$session") );

$conf->set("logo$name.$type", $data);

$cgi->redirect(popurl(3). "edit/invoice_logo.html?type=$type;name=$name;msg=Logo%20changed");

</%init>


--- NEW FILE: part_event.html ---
<% include( 'elements/process.html',
    #'debug'          => 1,
    'table'          => 'part_event',
    'viewall_dir'    => 'browse',
    'process_m2name' =>
      {
        'link_table'    => 'part_event_condition',
        'num_col'       => 'eventpart',
        'name_col'      => 'conditionname',
        'names_list'    => [ FS::part_event_condition->all_conditionnames() ],
        'param_style'   => 'name_colN values',
        'args_callback' => sub { # FS/FS/m2name_Common.pm
          my( $object, $prefix, $params, $listref ) = @_;
          #warn "$object $prefix $params $listref\n";

          my $cond = $object->conditionname;

          my %option_fields = $object->option_fields;

          push @$listref, map {
                                my $field = $_;

                                my $cgi_field = "$prefix$cond.$field";

                                my $value = $params->{$cgi_field};

                                my $info = $option_fields{$_};
                                $info = { label=>$info, type=>'text' }
                                  unless ref($info);

                                if ( $info->{'type'} =~
                                       /^(select|checkbox)-?multiple$/
                                     or $info->{'type'} =~ /^select/
                                        && $info->{'multiple'}
                                   )
                                {
                                  #special processing for compound fields
                                  $value = { map { $_ => 1 }
                                                 split(/\0/, $value)
                                           };
                                } elsif ( $info->{'type'} eq 'freq' ) {
                                  $value .= $params->{$cgi_field.'_units'};
                                }

                                #warn "value of $cgi_field is $value\n";

                                ( $field => $value );
                              }
                              keys %option_fields;
        },
      },

    'args_callback' => sub {

      my( $cgi, $object ) = @_;

      my $prefix = $object->action.'.';

      map { my $option = $_;
            #my $value = scalar( $cgi->param( "$prefix$option" ) );
            my $value = join(',', $cgi->param( "$prefix$option" ) );

            if ( $option eq 'reasonnum' && $value == -1 ) {
              $value = {
                'typenum' => scalar( $cgi->param( "new$prefix${option}T" ) ),
                'reason'  => scalar( $cgi->param( "new$prefix${option}"  ) ),
              };
            }

            ( $option => $value );
          }
          @{ $object->option_fields_listref };

    },

    'agent_virt'       => 1,
    'agent_null_right' => 'Edit global billing events',
)
%>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Edit billing events')
      || $FS::CurrentUser::CurrentUser->access_right('Edit global billing events');

</%init>

Index: access_group.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/access_group.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- access_group.html	23 Aug 2006 22:25:37 -0000	1.3
+++ access_group.html	1 Aug 2007 22:25:05 -0000	1.4
@@ -10,6 +10,7 @@
                      'num_col'      => 'rightobjnum',
                      'name_col'     => 'rightname',
                      'names_list'   => [ FS::AccessRight->rights() ],
+                     'param_style'  => 'link_table.value checkboxes',
                },
            )
 %>

Index: quick-cust_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/quick-cust_pkg.cgi,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- quick-cust_pkg.cgi	23 Aug 2006 22:25:37 -0000	1.9
+++ quick-cust_pkg.cgi	1 Aug 2007 22:25:05 -0000	1.10
@@ -1,5 +1,3 @@
-%
-%
 %#untaint custnum
 %$cgi->param('custnum') =~ /^(\d+)$/
 %  or die 'illegal custnum '. $cgi->param('custnum');
@@ -9,19 +7,21 @@
 %my $pkgpart = $1;
 %
 %my @cust_pkg = ();
-%my $error = FS::cust_pkg::order($custnum, [ $pkgpart ], [], \@cust_pkg, );
+%my $error = FS::cust_pkg::order($custnum, [ $pkgpart ], [], \@cust_pkg, [ $cgi->param('refnum') ] );
 %
 %if ($error) {
-%
-
-<!-- mason kludge -->
-%
-%  eidiot($error);
+%  $cgi->param('error', $error);
+%  print $cgi->redirect(popurl(2). 'misc/order_pkg.html?'. $cgi->query_string );
 %} else {
-%  print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum".
-%                       "#cust_pkg". $cust_pkg[0]->pkgnum );
-%}
-%
-%
+%  my $frag = "cust_pkg". $cust_pkg[0]->pkgnum;
+<% header('Package ordered') %>
+  <SCRIPT TYPE="text/javascript">
+    // XXX fancy ajax rebuild table at some point, but a page reload will do for now
 
+    // XXX chop off trailing #target and replace... ?
+    window.top.location = '<% popurl(3). "view/cust_main.cgi?keywords=$custnum;fragment=$frag#$frag" %>';
+
+  </SCRIPT>
 
+  </BODY></HTML>
+%}



More information about the freeside-commits mailing list