Lieferbedingungen übersetzbar gemacht.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 6 Dec 2013 13:54:45 +0000 (14:54 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 6 Dec 2013 13:54:45 +0000 (14:54 +0100)
SL/Controller/DeliveryTerm.pm
SL/DB/DeliveryTerm.pm
SL/DO.pm
SL/IS.pm
SL/OE.pm
templates/webpages/delivery_term/form.html

index 3c4d44a..4810d21 100644 (file)
@@ -5,15 +5,17 @@ use strict;
 use parent qw(SL::Controller::Base);
 
 use SL::DB::DeliveryTerm;
+use SL::DB::Language;
 use SL::Helper::Flash;
 
 use Rose::Object::MakeMethods::Generic
 (
- scalar => [ qw(delivery_term) ],
+ scalar => [ qw(delivery_term languages) ],
 );
 
 __PACKAGE__->run_before('check_auth');
 __PACKAGE__->run_before('load_delivery_term', only => [ qw(edit update destroy) ]);
+__PACKAGE__->run_before('load_languages',     only => [ qw(new list edit create update) ]);
 
 
 #
@@ -113,4 +115,9 @@ sub load_delivery_term {
   $self->{delivery_term} = SL::DB::DeliveryTerm->new(id => $::form->{id})->load;
 }
 
+sub load_languages {
+  my ($self) = @_;
+  $self->{languages} = SL::DB::Manager::Language->get_all_sorted;
+}
+
 1;
index c315e9b..68c5d92 100644 (file)
@@ -8,6 +8,7 @@ use strict;
 use SL::DB::MetaSetup::DeliveryTerm;
 use SL::DB::Manager::DeliveryTerm;
 use SL::DB::Helper::ActsAsList;
+use SL::DB::Helper::TranslatedAttributes;
 
 
 sub validate {
index cec2e9b..d83c49b 100644 (file)
--- a/SL/DO.pm
+++ b/SL/DO.pm
@@ -895,6 +895,7 @@ sub order_details {
   $h_bin_wh->finish();
 
   $form->{delivery_term} = SL::DB::Manager::DeliveryTerm->find_by(id => $form->{delivery_term_id} || undef);
+  $form->{delivery_term}->description_long($form->{delivery_term}->translated_attribute('description_long', $form->{language_id})) if $form->{delivery_term} && $form->{language_id};
 
   $form->{username} = $myconfig->{name};
 
index b9c3e0a..23b6f80 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -430,6 +430,7 @@ sub invoice_details {
   $form->set_payment_options($myconfig, $form->{invdate});
 
   $form->{delivery_term} = SL::DB::Manager::DeliveryTerm->find_by(id => $form->{delivery_term_id} || undef);
+  $form->{delivery_term}->description_long($form->{delivery_term}->translated_attribute('description_long', $form->{language_id})) if $form->{delivery_term} && $form->{language_id};
 
   $form->{username} = $myconfig->{name};
 
index 2d12472..0e5c05b 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -1336,6 +1336,7 @@ sub order_details {
   $dbh->disconnect;
 
   $form->{delivery_term} = SL::DB::Manager::DeliveryTerm->find_by(id => $form->{delivery_term_id} || undef);
+  $form->{delivery_term}->description_long($form->{delivery_term}->translated_attribute('description_long', $form->{language_id})) if $form->{delivery_term} && $form->{language_id};
 
   $main::lxdebug->leave_sub();
 }
index 7ac5393..92d98c2 100755 (executable)
     </td>
    </tr>
 
+   [%- FOREACH language = SELF.languages %]
+    <tr>
+     <td>[%- HTML.escape(language.description) %] ([%- LxERP.t8('Translation') %])</td>
+     <td>
+      <input name="translation_[% language.id %]" value="[%- HTML.escape(SELF.delivery_term.translated_attribute('description_long', language, 1)) %]" size="60">
+     </td>
+    </tr>
+   [%- END %]
+
   <p>
    <input type="hidden" name="id" value="[% SELF.delivery_term.id %]">
    <input type="hidden" name="action" value="DeliveryTerm/dispatch">