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

SF.net SVN: ledger-smb:[5032] branches/1.3



Revision: 5032
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5032&view=rev
Author:   einhverfr
Date:     2012-07-24 03:26:34 +0000 (Tue, 24 Jul 2012)
Log Message:
-----------
Better error handling when pos.conf.pl has not been set up yet

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/bin/gl.pl
    branches/1.3/bin/pos.pl
    branches/1.3/bin/ps.pl

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2012-07-24 03:08:02 UTC (rev 5031)
+++ branches/1.3/Changelog	2012-07-24 03:26:34 UTC (rev 5032)
@@ -11,6 +11,7 @@
 * Recon screen now groups journal entries by transaction (Chris T, h/t Nick P)
 * Fixed empty string working as empty source for cash recon (Chris T)
 * Saving a part now returns to editing the same part (Chris T, h/t Brian W)
+* If pos.conf.pl is not found, now returns an intelligible error (Chris T)
 
 Changelog for 1.3.20
 * Fixes for es_AR translation, duplicate keys removed (Andres B)

Modified: branches/1.3/bin/gl.pl
===================================================================
--- branches/1.3/bin/gl.pl	2012-07-24 03:08:02 UTC (rev 5031)
+++ branches/1.3/bin/gl.pl	2012-07-24 03:26:34 UTC (rev 5032)
@@ -86,7 +86,9 @@
 
 sub pos_adjust {
     $form->{rowcount} = 3;
-    require "pos.conf.pl";
+    eval {require "pos.conf.pl"} || $form->error($locale->text(
+      "Could not open pos.conf.pl in [_1] line [_2]: [_3]", 
+       __FILE__, __LINE__, $!));
     $form->{accno_1} = $pos_config{'close_cash_accno'};
     $form->{accno_2} = $pos_config{'coa_prefix'};
     $form->{accno_3} = $pos_config{'coa_prefix'};

Modified: branches/1.3/bin/pos.pl
===================================================================
--- branches/1.3/bin/pos.pl	2012-07-24 03:08:02 UTC (rev 5031)
+++ branches/1.3/bin/pos.pl	2012-07-24 03:26:34 UTC (rev 5032)
@@ -51,7 +51,9 @@
 # end
 
 sub open_drawer{
-   require "pos.conf.pl";
+    eval {require "pos.conf.pl"} || $form->error($locale->text(
+      "Could not open pos.conf.pl in [_1] line [_2]: [_3]", 
+       __FILE__, __LINE__, $!));
    open (PRINTER, "|-", ${'LedgerSMB::Sysconfig::printer'}{Printer});
    print PRINTER $pos_config{'rp_cash_open'};
    close PRINTER;

Modified: branches/1.3/bin/ps.pl
===================================================================
--- branches/1.3/bin/ps.pl	2012-07-24 03:08:02 UTC (rev 5031)
+++ branches/1.3/bin/ps.pl	2012-07-24 03:26:34 UTC (rev 5032)
@@ -50,7 +50,9 @@
 require "bin/is.pl";
 require "bin/rp.pl";
 require "bin/pos.pl";
-require "pos.conf.pl";
+eval {require "pos.conf.pl"} || $form->error($locale->text(
+      "Could not open pos.conf.pl in [_1] line [_2]: [_3]", 
+       __FILE__, __LINE__, $!));
 
 # customizations
 if ( -f "bin/custom/pos.pl" ) {
@@ -78,7 +80,9 @@
     my $curren = $pos_config{'curren'};
 
     $form->{title} = $locale->text( "Closing Till For [_1]", $form->{login} );
-    require "pos.conf.pl";
+    eval {require "pos.conf.pl"} || $form->error($locale->text(
+      "Could not open pos.conf.pl in [_1] line [_2]: [_3]", 
+       __FILE__, __LINE__, $!));
     IS->getposlines( \%myconfig, \%$form );
     $form->header;
     print qq|
@@ -217,7 +221,9 @@
 
 sub close_till {
     use LedgerSMB::GL;
-    require 'pos.conf.pl';
+    eval {require "pos.conf.pl"} || $form->error($locale->text(
+      "Could not open pos.conf.pl in [_1] line [_2]: [_3]", 
+       __FILE__, __LINE__, $!));
     IS->clear_till( \%myconfig, \%$form );
     my $amount     = 0;
     my $expected   = 0;

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