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

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



Revision: 4075
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4075&view=rev
Author:   tshvr
Date:     2011-11-25 11:44:40 +0000 (Fri, 25 Nov 2011)
Log Message:
-----------
language_code,default_language,defaults

Modified Paths:
--------------
    branches/1.3/LedgerSMB/AM.pm
    branches/1.3/LedgerSMB/DBObject/Company.pm
    branches/1.3/LedgerSMB/ScriptLib/Company.pm
    branches/1.3/UI/Contact/contact.html
    branches/1.3/UI/am-defaults.html
    branches/1.3/bin/am.pl

Modified: branches/1.3/LedgerSMB/AM.pm
===================================================================
--- branches/1.3/LedgerSMB/AM.pm	2011-11-25 11:27:47 UTC (rev 4074)
+++ branches/1.3/LedgerSMB/AM.pm	2011-11-25 11:44:40 UTC (rev 4075)
@@ -2217,6 +2217,16 @@
         push @{$form->{countries}}, $ref;
     }
     $sth->finish;
+    #HV do not know if i can use 'sub language' here which fills $form->{ALL}
+    $query = "select code,description from language order by code";
+    $sth = $dbh->prepare($query);
+    $sth->execute;
+    $form->{languages} = [];
+    while ($ref = $sth->fetchrow_hashref('NAME_lc')) {
+        push @{$form->{languages}}, $ref;
+    }
+    $sth->finish;
+
     $self->defaultaccounts( undef, $form );
     $dbh->commit;
     my $dirname = "./templates";

Modified: branches/1.3/LedgerSMB/DBObject/Company.pm
===================================================================
--- branches/1.3/LedgerSMB/DBObject/Company.pm	2011-11-25 11:27:47 UTC (rev 4074)
+++ branches/1.3/LedgerSMB/DBObject/Company.pm	2011-11-25 11:44:40 UTC (rev 4075)
@@ -410,6 +410,13 @@
     for my $ref (@{$self->{cash_acc_list}}){
         $ref->{text} = "$ref->{accno}--$ref->{description}";
     }
+
+    @{$self->{language_code_list}} = 
+         $self->exec_method(funcname => 'person__list_languages');
+
+    for my $ref (@{$self->{language_code_list}}){
+        $ref->{text} = "$ref->{code}--$ref->{description}";
+    }
     
     @{$self->{discount_acc_list}} =
          $self->exec_method(funcname => 'chart_list_discount');
@@ -437,10 +444,14 @@
 
     @{$self->{contact_class_list}} = 
          $self->exec_method(funcname => 'entity_list_contact_class');
-    my $country_setting = LedgerSMB::Setting->new({base => $self, copy => 'base'});
-    $country_setting->{key} = 'default_country';
-    $country_setting->get;
-    $self->{default_country} = $country_setting->{value};
+    #HV was $country_setting , given it a more general name, not only for country
+    my $setting_module = LedgerSMB::Setting->new({base => $self, copy => 'base'});
+    $setting_module->{key} = 'default_country';
+    $setting_module->get;
+    $self->{default_country} = $setting_module->{value};
+    $setting_module->{key} = 'default_language';
+    $setting_module->get;
+    $self->{default_language} = $setting_module->{value};
 }
 
 =item save_contact

Modified: branches/1.3/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- branches/1.3/LedgerSMB/ScriptLib/Company.pm	2011-11-25 11:27:47 UTC (rev 4074)
+++ branches/1.3/LedgerSMB/ScriptLib/Company.pm	2011-11-25 11:44:40 UTC (rev 4075)
@@ -637,6 +637,7 @@
     my ($request) = @_;
     my $company = new_company($request);
     if (_close_form($company)){
+        #$logger->debug("\$company = " . Data::Dumper::Dumper($company));
         $company->save();
     }
     _render_main_screen($company);
@@ -748,6 +749,12 @@
          value => 3},
     ];
     $company->{threshold} = $company->format_amount(amount => $company->{threshold});
+    if(! $company->{language_code})
+    {
+     #$logger->debug("company->language code not set!");
+     $company->{language_code}=$company->{default_language}
+    }
+    #$logger->debug("\$company = " . Data::Dumper::Dumper($company));
 
     my $template = LedgerSMB::Template->new( 
 	user => $company->{_user}, 

Modified: branches/1.3/UI/Contact/contact.html
===================================================================
--- branches/1.3/UI/Contact/contact.html	2011-11-25 11:27:47 UTC (rev 4074)
+++ branches/1.3/UI/Contact/contact.html	2011-11-25 11:44:40 UTC (rev 4075)
@@ -429,7 +429,7 @@
 		type= "text",
 		name = "meta_number",
 		value = meta_number,
-		size = "20"
+		size = "10"
 	}  # " ?></td>
 	<td><?lsmb PROCESS input element_data = {
 		label = text("Description"),
@@ -438,13 +438,22 @@
 		value = description,
 		size = "20"
 	} ?></td>
+        <td> <?lsmb INCLUDE select element_data = {
+		label = text("language_code")
+		name = "language_code"
+                default_values = [language_code],
+                options = language_code_list
+		text_attr = "text"
+		value_attr = "code"
+                } ?>
+        </td>
 	</tr>
 	<tr class="pay_to_row">
 	<td colspan = "2">
 	<?lsmb PROCESS input element_data = {
 		label = text('Pay To') #'
 		type = "text"
-		sixe = "50"
+		size = "50"
 		name = "pay_to_name"
 		value = pay_to_name
 		class = "name"

Modified: branches/1.3/UI/am-defaults.html
===================================================================
--- branches/1.3/UI/am-defaults.html	2011-11-25 11:27:47 UTC (rev 4074)
+++ branches/1.3/UI/am-defaults.html	2011-11-25 11:44:40 UTC (rev 4075)
@@ -33,7 +33,13 @@
 	<tr>
 	  <th align="right"><?lsmb text('Separate Duties') ?></th>
 	  <td><input name="separate_duties" size="5" value="<?lsmb form.separate_duties ?>" /></td>
-	</tr
+	</tr>
+        <tr>
+         <th align="right"><?lsmb text('default_language') ?></th>
+	  <td>
+           <?lsmb PROCESS select element_data=selects.default_language ?>
+         </td>
+	</tr>
       </table>
     </td>
   </tr>

Modified: branches/1.3/bin/am.pl
===================================================================
--- branches/1.3/bin/am.pl	2011-11-25 11:27:47 UTC (rev 4074)
+++ branches/1.3/bin/am.pl	2011-11-25 11:44:40 UTC (rev 4075)
@@ -77,7 +77,7 @@
    { name => 'company_fax', label => $locale->text('Company Fax') },
 );
 
-my @default_others = qw(businessnumber weightunit separate_duties
+my @default_others = qw(businessnumber weightunit separate_duties default_language
                         IC IC_income IC_expense 
                         FX_gain FX_loss default_country templates curr);
 
@@ -1443,6 +1443,12 @@
 			     text_attr => 'name',
 			     value_attr => 'id',
 		},
+	'default_language' => {name   => 'default_language', 
+			     options => $form->{languages},
+			     default_values => [$form->{'default_language'}],
+			     text_attr => 'description',
+			     value_attr => 'code',
+		},
 	'templates'       => {name => 'templates', options => []}	
         );
     foreach $key ( keys %{ $form->{accno} } ) {

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