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

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



Revision: 5056
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5056&view=rev
Author:   einhverfr
Date:     2012-07-29 10:20:35 +0000 (Sun, 29 Jul 2012)
Log Message:
-----------
New default screen, organized in sections, allowing audit control screen to be removed

Modified Paths:
--------------
    trunk/LedgerSMB/Scripts/configuration.pm
    trunk/UI/am-defaults.html

Modified: trunk/LedgerSMB/Scripts/configuration.pm
===================================================================
--- trunk/LedgerSMB/Scripts/configuration.pm	2012-07-28 13:11:57 UTC (rev 5055)
+++ trunk/LedgerSMB/Scripts/configuration.pm	2012-07-29 10:20:35 UTC (rev 5056)
@@ -15,49 +15,100 @@
 
 my $locale = $LedgerSMB::App_State::Locale;
 
-our @default_textboxes = (
-   { name => 'glnumber', label => $locale->text('GL Reference Number') },
-   { name => 'sinumber', 
+our @default_settings = (
+   { title => $locale->text('Company Information'),
+     items => [
+       { name => 'company_name', label => $locale->text('Company Name') },
+       { name => 'company_address', label => $locale->text('Company Address') },
+       { name => 'company_phone', label => $locale->text('Company Phone') },
+       { name => 'company_fax', label => $locale->text('Company Fax') },
+       { name => 'businessnumber', label => $locale->text('Business Number') },
+       { 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') },
+       { name => 'default_email_from', 
+        label => $locale->text('Default Email From') },
+       { name => 'company_sales_tax_id', 
+        label =>  $locale->text('Company Sales Tax ID') },
+       { name => 'company_license_number',
+        label =>  $locale->text('Company License Number') },
+       { name => 'curr', 
+        label => $locale->text('Currencies (colon-separated)')},
+       { name => 'weightunit', label => $locale->text('Weight Unit') },
+       { name => 'default_country',
+        label => $locale->text('Default Country'),
+         type => 'SELECT_ONE', },
+       { name => 'default_language',
+        label => $locale->text('Default Language'),
+         type => 'SELECT_ONE', },
+       { name => 'templates',
+         type => 'SELECT_ONE',
+        label => $locale->text('Template Set'), },
+     ] },
+   { title => $locale->text('Security Settings'),
+     items => [
+       { name => 'password_duration',
+        label => $locale->text('Password Duration') },
+       { name => 'session_timeout',
+        label => $locale->text('Session Timeout'), },
+       { name => 'auto_logout',
+        label => $locale->text('Automatically Logout'),
+         type => 'YES_NO', },
+       { name => 'separate_duties',
+        label => $locale->text('Separate Duties'),
+         type => 'YES_NO', },
+     ] },
+ { title => $locale->text('Default Accounts'),
+   items => [
+       { name => 'inventory_accno_id',
+         type => 'SELECT_ONE',
+        label => $locale->text('Inventory'), },
+       { name => 'income_accno_id',
+         type => 'SELECT_ONE',
+        label => $locale->text('Income'), },
+       { name => 'expense_accno_id',
+         type => 'SELECT_ONE',
+        label => $locale->text('Cost of Goods Sold'), },
+       { name => 'fxgain_accno_id',
+         type => 'SELECT_ONE',
+        label => $locale->text('Foreign Exchange Gain') },
+       { name => 'fxloss_accno_id',
+         type => 'SELECT_ONE',
+        label => $locale->text('Foreign Exchange Loss') },
+   ] },
+ { title => $locale->text('Next in Sequence'),
+   items => [
+     { name => 'glnumber', label => $locale->text('GL Reference Number') },
+     { name => 'sinumber', 
       label => $locale->text('Sales Invoice/AR Transaction Number'), },
-   { name => 'vclimit', label => $locale->text('Max per dropdown') },
-   { 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') },
-   { name => 'default_email_from', 
-     label => $locale->text('Default Email From') },
-   { name => 'company_name', label => $locale->text('Company Name') },
-   { name => 'company_address', label => $locale->text('Company Address') },
-   { name => 'company_phone', label => $locale->text('Company Phone') },
-   { name => 'company_fax', label => $locale->text('Company Fax') },
-   { name => 'company_sales_tax_id', 
-                             label =>  $locale->text('Company Sales Tax ID') },
-   { name => 'company_license_number',
-                           label =>  $locale->text('Company License Number') },
-   { name => 'check_max_invoices',
-                           label =>  $locale->text('Max Invoices per Check Stub') },
-   { name => 'decimal_places',
-                           label =>  $locale->text('Decimal Places for Money') },
+     { name => 'vclimit', label => $locale->text('Max per dropdown') },
+     { 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') },
+   ] },
+   { title => $locale->text('Misc Settings'),
+     items => [  
+       { name => 'check_prefix', label => $locale->text('Check Prefix') },
+       { name => 'check_max_invoices',
+        label =>  $locale->text('Max Invoices per Check Stub') },
+       { name => 'decimal_places',
+        label =>  $locale->text('Decimal Places for Money') },
+       { name => 'template_immages',
+        label => $locale->text('Images in Templates'),
+         type => 'YES_NO', },
+     ] },
 );
 
-our @default_others = qw(businessnumber weightunit separate_duties default_language
-                        inventory_accno_id income_accno_id expense_accno_id 
-                        fxgain_accno_id fxloss_accno_id default_country 
-                        templates curr template_images);
-
-
-
 =head1 METHODS/ACTIONS
 
 =over
@@ -71,9 +122,11 @@
 sub defaults_screen{
     my ($request) = @_;
     my $setting_handle = LedgerSMB::Setting->new({base => $request});
-    my @defaults = @default_others;
-    for my $tb (@default_textboxes){
-        push @defaults, $tb->{name};
+    my @defaults;
+    for my $dg (@default_settings){
+        for my $tb (@{$dg->{items}}){
+            push @defaults, $tb->{name};
+        }
     }
     for my $skey (@defaults){
         $request->{$skey} = $setting_handle->get($skey);
@@ -131,7 +184,7 @@
         form => $request,
 	# hiddens => \%hiddens,
 	selects => \%selects,
-        default_textboxes => ..hidden..,
+        default_settings => ..hidden..,
     });
 }
 
@@ -144,9 +197,11 @@
 sub save_defaults {
     my ($request) = @_;
     my $setting_handle = LedgerSMB::Setting->new({base => $request});
-    my @defaults = @default_others;
-    for my $tb (@default_textboxes){
-        push @defaults, $tb->{name};
+    my @defaults;
+    for my $dg (@default_settings){
+        for my $tb (@{$dg->{items}}){
+            push @defaults, $tb->{name};
+        }
     }
     for my $skey (@defaults){
         $request->{$skey} =~ s/--.*$// if $skey =~ /accno_id/;

Modified: trunk/UI/am-defaults.html
===================================================================
--- trunk/UI/am-defaults.html	2012-07-28 13:11:57 UTC (rev 5055)
+++ trunk/UI/am-defaults.html	2012-07-29 10:20:35 UTC (rev 5056)
@@ -17,170 +17,52 @@
 		 
 <body>
 <form method="post" action="<?lsmb form.script ?>">
-<table width="100%">
-  <tr><th class="listtop"><?lsmb text('System Defaults') ?></th></tr>
+<table width="100%"><col width="25%" align="right"><col><col>
+  <tr><th colspan="2" class="listtop"><?lsmb text('System Defaults') ?></th>
+  <?lsmb FOREACH GROUP IN default_settings ?>
+  <tr><th colspan="2" class="listheading"><?lsmb GROUP.title ?></th></tr>
+    <?lsmb FOREACH ITEM IN GROUP.items ?>
   <tr>
-    <td>
-      <table>
-	<tr>
-          <th align="right"><?lsmb text('Business Number') ?></th>
-          <td><input name="businessnumber" size="25" value="<?lsmb form.businessnumber ?>" /></td>
-	</tr>
-	<tr>
-	  <th align="right"><?lsmb text('Weight Unit') ?></th>
-	  <td><input name="weightunit" size="5" value="<?lsmb form.weightunit ?>" /></td>
-	</tr>
-	<tr>
-	  <th align="right"><?lsmb text('Separate Duties') ?></th>
-	  <td><input name="separate_duties" size="5" value="<?lsmb form.separate_duties ?>" /></td>
-	</tr>
-	<tr>
-	  <th align="right"><?lsmb text('Images in Templates') ?></th>
-	  <td><input name="template_images" size="5" value="<?lsmb form.template_images ?>" /></td>
-	</tr>
-        <tr>
-         <th align="right"><?lsmb text('default_language') ?></th>
-	  <td>
-           <?lsmb PROCESS select element_data=selects.default_language ?>
-         </td>
-	</tr>
-      </table>
+    <th align="right"><?lsmb ITEM.label ?></th>
+       <td>
+       <?lsmb 
+       IF ITEM.type == 'YES_NO';
+           IF form.${ITEM.name};
+              YES="CHECKED";
+              NO=undef;
+           ELSE;
+              NO="CHECKED";
+              YES=undef;
+           END;
+           PROCESS input element_data = {
+              name = ITEM.name
+              type = 'radio'
+             label = text('Yes')
+             value = 1
+           checked = YES
+           };
+           PROCESS input element_data = {
+              name = ITEM.name
+              type = 'radio'
+             label = text('No')
+             value = 0
+           checked = NO
+           };
+       ELSIF ITEM.type == 'SELECT_ONE';
+           PROCESS select element_data= selects.${ITEM.name};
+       ELSE;
+           PROCESS input element_data = {
+                   name = ITEM.name
+                   type = 'text'
+                  value = form.${ITEM.name}
+           }; 
+        END; ?>
     </td>
   </tr>
-  <tr>
-    <th class="listheading"><?lsmb text('Last Numbers & Default Accounts') ?></th>
-  </tr>
-  <tr>
-    <td>
-      <table>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Inventory') ?></th>
-	  <td>
-<?lsmb PROCESS select element_data=selects.inventory_accno_id ?>
-          </td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Income') ?></th>
-	  <td>
-<?lsmb PROCESS select element_data=selects.income_accno_id ?>
-         </td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Expense') ?></th>
-	  <td>
-<?lsmb PROCESS select element_data=selects.expense_accno_id ?>
-         </td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Foreign Exchange Gain') ?></th>
-	  <td>
-<?lsmb PROCESS select element_data=selects.fxgain_accno_id ?>
-         </td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Foreign Exchange Loss') ?></th>
-	  <td>
-<?lsmb PROCESS select element_data=selects.fxloss_accno_id ?>
-         </td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Default Country') ?></th>
-	  <td>
-<?lsmb selects.default_country.options.unshift({}) ?>
-<?lsmb PROCESS select element_data=selects.default_country ?>
-         </td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Templates directory') ?></th>
-	  <td>
-<?lsmb PROCESS select element_data=selects.templates ?>
-         </td>
-	</tr>
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <th align="left"><?lsmb text('Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies') ?></th>
-  </tr>
-  <tr>
-    <td>
-      <input name="curr" size="40" value="<?lsmb form.curr ?>" />
-    </td>
-  </tr>
-  <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>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Sales Invoice/AR Transaction Number') ?></th>
-	  <td><input name="sinumber" size="40" value="<?lsmb form.sinumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Sales Order Number') ?></th>
-	  <td><input name="sonumber" size="40" value="<?lsmb form.sonumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Vendor Invoice/AP Transaction Number') ?></th>
-	  <td><input name="vinumber" size="40" value="<?lsmb form.vinumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Purchase Order Number') ?></th>
-	  <td><input name="ponumber" size="40" value="<?lsmb form.ponumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Sales Quotation Number') ?></th>
-	  <td><input name="sqnumber" size="40" value="<?lsmb form.sqnumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('RFQ Number') ?></th>
-	  <td><input name="rfqnumber" size="40" value="<?lsmb form.rfqnumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Part Number') ?></th>
-	  <td><input name="partnumber" size="40" value="<?lsmb form.partnumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Job/Project Number') ?></th>
-	  <td><input name="projectnumber" size="40" value="<?lsmb form.projectnumber ?>" /></td>
-        </tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Employee Number') ?></th>
-	  <td><input name="employeenumber" size="40" value="<?lsmb form.employeenumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Customer Number') ?></th>
-	  <td><input name="customernumber" size="40" value="<?lsmb form.customernumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Vendor Number') ?></th>
-	  <td><input name="vendornumber" size="40" value="<?lsmb form.vendornumber ?>" /></td>
-	</tr>
-	<tr>
-          <th align="right" nowrap="nowrap"><?lsmb text('Check Prefix') ?></th>
-	  <td><input name="check_prefix" size="40" value="<?lsmb form.check_prefix ?>" /></td>
-	</tr>
-	<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> -->
-      </table>
-    </td>
-  </tr>
-  <tr>
-    <td><hr size="3" noshade="noshade" /></td>
-  </tr>
+    <?lsmb END # FOREACH ITEM ?>
+  <?lsmb END # FOREACH GROUP ?> 
 </table>
+<hr size="3" noshade="noshade" />
 
 <?lsmb FOREACH hidden IN hiddens.keys;
 	PROCESS input element_data={

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