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

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



Revision: 3543
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3543&view=rev
Author:   einhverfr
Date:     2011-07-16 23:42:44 +0000 (Sat, 16 Jul 2011)

Log Message:
-----------
Company name, address, phone number, etc. now works in printed orders, transactions, etc.

Modified Paths:
--------------
    trunk/LedgerSMB/Company_Config.pm
    trunk/bin/am.pl
    trunk/bin/arapprn.pl
    trunk/bin/io.pl

Modified: trunk/LedgerSMB/Company_Config.pm
===================================================================
--- trunk/LedgerSMB/Company_Config.pm	2011-07-16 22:34:15 UTC (rev 3542)
+++ trunk/LedgerSMB/Company_Config.pm	2011-07-16 23:42:44 UTC (rev 3543)
@@ -36,7 +36,8 @@
                           default_email_from default_email_to
                           default_email_bcc  default_email_cc
                           separate_duties company_name company_email
-                          company_phone company_fax);
+                          company_phone company_fax businessnumber
+                          company_address);
 
 our $VERSION = 1.0;
 our $settings = {};

Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2011-07-16 22:34:15 UTC (rev 3542)
+++ trunk/bin/am.pl	2011-07-16 23:42:44 UTC (rev 3543)
@@ -71,7 +71,7 @@
    { name => 'default_email_from', 
      label => $locale->text('Default Email From') },
    { name => 'company_name', label => $locale->text('Company Name') },
-   { name => 'company_email', label => $locale->text('Company Email') },
+   { name => 'company_address', label => $locale->text('Company Address') },
    { name => 'company_phone', label => $locale->text('Company Phone') },
    { name => 'company_fax', label => $locale->text('Company Fax') },
 );

Modified: trunk/bin/arapprn.pl
===================================================================
--- trunk/bin/arapprn.pl	2011-07-16 22:34:15 UTC (rev 3542)
+++ trunk/bin/arapprn.pl	2011-07-16 23:42:44 UTC (rev 3543)
@@ -41,6 +41,7 @@
 
 use Error qw(:try);
 use LedgerSMB::Template;
+use LedgerSMB::Company_Config;
 
 # any custom scripts for this one
 if ( -f "bin/custom/arapprn.pl" ) {
@@ -56,6 +57,15 @@
 
 sub print {
 
+    my $csettings = $LedgerSMB::Company_Config::settings;
+    $form->{company} = $csettings->{company_name};
+    $form->{businessnumber} = $csettings->{businessnumber};
+    $form->{email} = $csettings->{company_email};
+    $form->{address} = $csettings->{company_address};
+    $form->{tel} = $csettings->{company_phone};
+    $form->{fax} = $csettings->{company_fax};
+
+
     if ( $form->{media} !~ /screen/ ) {
         $form->error( $locale->text('Select postscript or PDF!') )
           if $form->{format} !~ /(postscript|pdf)/;
@@ -211,16 +221,6 @@
     $form->{notes} =~ s/^\s+//g;
     push @a, "notes";
 
-    for (qw(company address tel fax businessnumber)) {
-        $form->{$_} = $myconfig{$_};
-    }
-    $form->{address} =~ s/\\n/\n/g;
-
-    push @a,
-      qw(company address tel fax businessnumber text_amount text_decimal);
-
-    $form->format_string(@a);
-
     $form->{templates} = "$myconfig{templates}";
     $form->{IN} =
       ( $form->{formname} eq 'transaction' )
@@ -470,16 +470,9 @@
 
     @a = ( "invnumber", "transdate", "duedate", "notes" );
 
-    for (qw(company address tel fax businessnumber)) {
-        $form->{$_} = $myconfig{$_};
-    }
-    $form->{address} =~ s/\\n/\n/g;
-
     push @a,
       qw(company address tel fax businessnumber text_amount text_decimal);
 
-    $form->format_string(@a);
-
     $form->{invdate} = $form->{transdate};
 
     $form->{templates} = "$myconfig{templates}";

Modified: trunk/bin/io.pl
===================================================================
--- trunk/bin/io.pl	2011-07-16 22:34:15 UTC (rev 3542)
+++ trunk/bin/io.pl	2011-07-16 23:42:44 UTC (rev 3543)
@@ -42,6 +42,7 @@
 use LedgerSMB::Tax;
 use LedgerSMB::Template;
 use LedgerSMB::Sysconfig;
+use LedgerSMB::Company_Config;
 
 # any custom scripts for this one
 if ( -f "bin/custom/io.pl" ) {
@@ -1448,6 +1449,15 @@
 }
 sub print {
 
+    my $csettings = $LedgerSMB::Company_Config::settings;
+    $form->{company} = $csettings->{company_name};
+    $form->{businessnumber} = $csettings->{businessnumber};
+    $form->{email} = $csettings->{company_email};
+    $form->{address} = $csettings->{company_address};
+    $form->{tel} = $csettings->{company_phone};
+    $form->{fax} = $csettings->{company_fax};
+
+
     # if this goes to the printer pass through
     if ( $form->{media} !~ /(screen|email)/ ) {
         $form->error( $locale->text('Select txt, postscript or PDF!') )
@@ -1653,9 +1663,8 @@
         if (   $form->{formname} eq 'purchase_order'
             || $form->{formname} eq 'request_quotation' )
         {
-            $form->{shiptoname}     = $myconfig{company};
-            $form->{shiptoaddress1} = $myconfig{address};
-            $form->{shiptoaddress1} =~ s/\\n/\n/g;
+            $form->{shiptoname}     = $form->{company};
+            $form->{shiptoaddress1} = $form->{address};
         }
         else {
             if ( $form->{formname} !~ /bin_list/ ) {
@@ -1670,15 +1679,10 @@
 
     push @vars, ( "${inv}number", "${inv}date", "${due}date" );
 
-    for (qw(company address tel fax businessnumber)) {
-        $form->{$_} = $myconfig{$_};
-    }
     $form->{address} =~ s/\\n/\n/g;
 
     for (qw(name email)) { $form->{"user$_"} = $myconfig{$_} }
 
-    push @vars, qw(company address tel fax businessnumber username useremail);
-
     for (qw(notes intnotes)) { $form->{$_} =~ s/^\s+//g }
 
     # before we format replace <%var%>
@@ -1686,7 +1690,6 @@
         $form->{$_} =~ s/<%(.*?)%>/$form->{$1}/g;
     }
 
-    $form->format_string(@vars);
 
     $form->{templates} = "$myconfig{templates}";
     $form->{IN}        = "$form->{formname}.$form->{format}";


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