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

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



Revision: 3147
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3147&view=rev
Author:   einhverfr
Date:     2011-05-21 21:02:16 +0000 (Sat, 21 May 2011)

Log Message:
-----------
Storing system email info, refactoring defaults to be more customizable

Modified Paths:
--------------
    trunk/LedgerSMB/AM.pm
    trunk/UI/am-defaults.html
    trunk/bin/am.pl

Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm	2011-05-21 20:32:42 UTC (rev 3146)
+++ trunk/LedgerSMB/AM.pm	2011-05-21 21:02:16 UTC (rev 3147)
@@ -1624,7 +1624,7 @@
 
 }
 
-=item AM->save_defaults($myconfig, $form);
+=item AM->save_defaults($myconfig, $form, ..hidden..);
 
 Sets the values in the defaults table to values derived from $form.  glnumber,
 sinumber, vinumber, sonumber, ponumber, sqnumber, rfqnumber, partnumber,
@@ -1637,11 +1637,14 @@
 
 Stores the templates directory for a specific company on defaults table.
 
..hidden.. identifies the list of values to be stored in defaults.  If not 
+provided, a default list is used.
+
 =cut
 
 sub save_defaults {
 
-    my ( $self, $myconfig, $form ) = @_;
+    my ( $self, $myconfig, $form, $defaults) = @_;
 
     for (qw(IC IC_income IC_expense FX_gain FX_loss)) {
         ( $form->{$_} ) = split /--/, $form->{$_};
@@ -1671,14 +1674,15 @@
         fxgain_accno_id    => 'FX_gain',
         fxloss_accno_id    => 'FX_loss'
     );
-    for (
-        qw(inventory_accno_id income_accno_id expense_accno_id
-        fxgain_accno_id fxloss_accno_id glnumber sinumber vinumber
-        sonumber ponumber sqnumber rfqnumber partnumber employeenumber
-        customernumber vendornumber projectnumber yearend curr
-        weightunit businessnumber default_country check_prefix password_duration templates)
-
-      )
+    if (..hidden..){
+       $defaults = qw(inventory_accno_id income_accno_id expense_accno_id
+                      fxgain_accno_id fxloss_accno_id glnumber sinumber vinumber
+                      sonumber ponumber sqnumber rfqnumber partnumber 
+                      employeenumber customernumber vendornumber projectnumber 
+                      yearend curr weightunit businessnumber default_country 
+                      check_prefix password_duration templates)
+    }
+    for (@$defaults)
     {
         my $val = $form->{$_};
         if ( $translation{$_} ) {

Modified: trunk/UI/am-defaults.html
===================================================================
--- trunk/UI/am-defaults.html	2011-05-21 20:32:42 UTC (rev 3146)
+++ trunk/UI/am-defaults.html	2011-05-21 21:02:16 UTC (rev 3147)
@@ -95,6 +95,14 @@
   <tr>
     <td>
       <table>
+      <?lsmb FOREACH textbox IN default_textboxes ?>
+      <tr><th align="right" nowrap="nowrap"><?lsmb textbox.label ?></th>
+          <td><input name="<?lsmb textbox.name ?>" size="40" 
+                     value="<?lsmb form.${textbox.name} ?>" />
+          </td>
+      </tr>
+      <?lsmb END # FOR textbox ?>
+        <!-- From here, defaults in list in am.pl
 	<tr>
           <th align="right" nowrap="nowrap"><?lsmb text('GL Reference Number') ?></th>
 	  <td><input name="glnumber" size="40" value="<?lsmb form.glnumber ?>" /></td>
@@ -150,7 +158,7 @@
 	<tr>
           <th align="right" nowrap="nowrap"><?lsmb text('Password Duration') ?></th>
 	  <td><input name="password_duration" size="40" value="<?lsmb form.password_duration ?>" /></td>
-	</tr>
+	</tr> -->
       </table>
     </td>
   </tr>

Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2011-05-21 20:32:42 UTC (rev 3146)
+++ trunk/bin/am.pl	2011-05-21 21:02:16 UTC (rev 3147)
@@ -49,6 +49,31 @@
 sub save   { &{"save_$form->{type}"} }
 sub delete { &{"delete_$form->{type}"} }
 
+my @default_textboxes = (
+   { name => 'glnumber', label => $locale->text('GL Reference Number') },
+   { name => 'sinumber', 
+      label => $locale->text('Sales Invoice/AR Transaction Number'), },
+   { name => 'sonumber', label => $locale->text('Sales Order Number') },
+   { name => 'vinumber' , 
+    label => $locale->text('Vendor Invoice/AP Transaction Number')},
+   { name => 'sqnumber', label => $locale->text('Sales Quotation Number') },
+   { name => 'rfqnumber', label => $locale->text('RFQ Number') },
+   { name => 'partnumber', label => $locale->text('Part Number') },
+   { name => 'projectnumber', label => $locale->text('Job/Project Number') },
+   { name => 'employeenumber', label => $locale->text('Employee Number') },
+   { name => 'customernumber', label => $locale->text('Customer Number') },
+   { name => 'vendornumber', label => $locale->text('Vendor Number') },
+   { name => 'check_prefix', label => $locale->text('Check Prefix') },
+   { name => 'password_duration', label => $locale->text('Password Duration') },
+   { name => 'default_email_to', label => $locale->text('Default Email To') },
+   { name => 'default_email_cc', label => $locale->text('Default Email CC') },
+   { name => 'default_email_bcc', label => $locale->text('Default Email BCC') },
+);
+
+my @default_others = qq(businessnumber weightunit 
+                        IC IC_income IC_expense 
+                        FX_gain FX_loss default_country templates curr);
+
 sub save_as_new {
 
     delete $form->{id};
@@ -1439,6 +1464,7 @@
         form => $form,
 	hiddens => \%hiddens,
 	selects => \%selects,
+        default_textboxes => ..hidden..,
     });
 }
 
@@ -1693,8 +1719,13 @@
 }
 
 sub save_defaults {
-
-    if ( AM->save_defaults( \%myconfig, \%$form ) ) {
+    my @defaults;
+    for (@default_textboxes){
+       push @defaults, $_->{name};
+    } 
+    push @defaults, @default_others;
+    push @defaults;
+    if ( AM->save_defaults( \%myconfig, \%$form, ..hidden..) ) {
         $form->redirect( $locale->text('Defaults saved!') );
     }
     else {


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