[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5111] trunk



Revision: 5111
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5111&view=rev
Author:   einhverfr
Date:     2012-08-17 10:19:36 +0000 (Fri, 17 Aug 2012)
Log Message:
-----------
Adding Starlet readme
Adding more payroll code
Correcting login issues under starlet due to bad headers returned

Modified Paths:
--------------
    trunk/LedgerSMB/Auth.pm
    trunk/LedgerSMB/Scripts/payroll.pm

Added Paths:
-----------
    trunk/LedgerSMB/Report/Payroll/
    trunk/LedgerSMB/Report/Payroll/Income_Types.pm
    trunk/README.Starlet

Modified: trunk/LedgerSMB/Auth.pm
===================================================================
--- trunk/LedgerSMB/Auth.pm	2012-08-16 11:58:00 UTC (rev 5110)
+++ trunk/LedgerSMB/Auth.pm	2012-08-17 10:19:36 UTC (rev 5111)
@@ -62,6 +62,9 @@
 package LedgerSMB::Auth;
 
 use LedgerSMB::Sysconfig;
+use CGI::Simple;
+use strict;
+use warnings;
 
 if ( !${LedgerSMB::Sysconfig::auth} ) {
     ${LedgerSMB::Sysconfig::auth} = 'DB';
@@ -71,6 +74,7 @@
 
 sub http_error {
     my ($errcode, $msg_plus) = @_;
+    my $cgi = CGI::Simple->new();
 
     my $err = {
 	'500' => {status  => '500 Internal Server Error', 
@@ -98,25 +102,19 @@
            $err->{'401'}->{others}->{'WWW-Authenticate'}
                 = "Basic realm=\"LedgerSMB-$msg_plus\"";
         }
+        print $cgi->header(
+           -type               => 'text/text',
+           -status             => $err->{'401'}->{status},
+           "-WWW-Authenticate" => $err->{'401'}->{others}->{'WWW-Authenticate'}
+        );
+    } else {
+        print $cgi->header(
+           -type   => 'text/text',
+           -status => $err->{$errcode}->{status},
+        );
     }
-    my $status;
-    if ($err->{$errcode}->{status}){
-        $status = $err->{$errcode}->{status};
-    } elsif ($errcode) {
-        $status = $errcode;
-   } else {
-	print STDERR "Tried to generate http error without code!\n";
-        http_error('500');
-    }
-    print "Status: $status\n";
-    for my $h (keys %{$err->{$errcode}->{others}}){
-         print "$h: $err->{$errcode}->{others}->{$h}\n";
-    }
-    print "Content-Type: text/plain\n\n";
-    print "Status: $status\n$err->{$errcode}->{message}\n";
-    exit; 
-    
-
+    print $err->{$errcode}->{message};
+    return;
 }
 
 =head1 COPYRIGHT

Added: trunk/LedgerSMB/Report/Payroll/Income_Types.pm
===================================================================
Modified: trunk/LedgerSMB/Scripts/payroll.pm
===================================================================
--- trunk/LedgerSMB/Scripts/payroll.pm	2012-08-16 11:58:00 UTC (rev 5110)
+++ trunk/LedgerSMB/Scripts/payroll.pm	2012-08-17 10:19:36 UTC (rev 5111)
@@ -24,14 +24,14 @@
 
 =over
 
-=item new_income_type
+=item show_income_type
 
 Displays the form for entering a new income type.  Update returns to this form
 with different inputs.
 
 =cut
 
-sub new_income_type {
+sub show_income_type {
     my ($request) = @_;
     @{$request->{countries}} = $request->call_procedure(
        procname => 'location_list_country'
@@ -60,26 +60,55 @@
     my ($request) = @_;
     my $itype = LedgerSMB::Payroll::Income_Type->new(%$request);
     $itype->save;
-    new_income_type($request);
+    show_income_type($request);
 }
 
-=item show_income_type
+=item get_income_type
 
 Gets an income type and shows it
 
 =cut
 
-sub show_income_type {
+sub get_income_type {
     my ($request) = @_;
     my $itype = LedgerSMB::Payroll::Income_Type->get($request->{id});
-    new_income_type($itype);
+    show_income_type($itype);
 }
 
 
 =item search_income_type
 
+Displays the income type search screen
+
+=cut
+
+sub search_income_type {
+    my ($request) = @_;
+    @{$request->{countries}} = $request->call_procedure(
+       procname => 'location_list_country'
+    );
+
+    my $template = LedgerSMB::Template->new(
+        user     => $request->{_user},
+        locale   => $request->{_locale},
+        path     => 'UI/payroll',
+        template => 'income_type',
+        format   => 'HTML'
+    )->render($request);
+}
+
 =item income_type_results
 
+Displays income type search results
+
+=cut
+
+sub income_type_results {
+    my ($request) = @_;
+    use LedgerSMB::Report::Payroll::Income_Types;
+    LedgerSMB::Report::Payroll::Income_Types->new(%$request)->render($request);
+}
+
 =back
 
 =head2 Deduction Types

Added: trunk/README.Starlet
===================================================================
--- trunk/README.Starlet	                        (rev 0)
+++ trunk/README.Starlet	2012-08-17 10:19:36 UTC (rev 5111)
@@ -0,0 +1,33 @@
+README for running LedgerSMB on Starlet
+
+Starlet is a light-weight, high-performance Plack web application server written
+in Perl.  Starlet allows you to run LedgerSMB caching important modules in
+memory, in compiled form, so it has a much lower latency.
+
+There are a few very important factors to consider when choosing Starlet.  The
+first is that Plack is a much less forgiving environment than is CGI.  A bug may
+merely raise log warnings in Apache/CGI but may cause a part of the application
+to stop working in Plack.   In both cases, the behavior may be a big.  Under
+Plack it may become more serious however.  As of the current writing, Plack is
+expected to require some additional support and support for LedgerSMB under it
+should be considered EXPERIMENTAL.  Those who value stability over performance
+are advised to hold off for a few minor releases while we get the more obvious
+problems fixed.
+
+The second important detail is that at the current writing there are portions of
+the code which are known to cause corruption over time under Plack.  These
+portions are all inherited from SQL-Ledger, and will be rewritten as we get
+around to it.  However at present for reliable performance under Starlet it is
+necessary to set --max-reqs-per-child=1 when starting Starlet.  Starman is not
+fully tested yet,
+
+A final important point is that running on port 80 requires root access.  If you
+run on port 80, Starlet will run as root, which means that the software will
+have full read-write access to the file system.  You are better off running on a
+port like 8080 and using limited permissions.  However in all cases it is
+vitally important that there is no database user with the same name which can
+log in without supplying a password.  if there is, you may find yourself
+allowing access regardless of the username and password supplied.  As always the
+pg_hba.conf should require a password on the port/interface used, and you really
+shouldn't run under a user with the same name as a database role that can log in
+anyway as an additional precaution.

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.