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) ]);
#
$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;
use SL::DB::MetaSetup::DeliveryTerm;
use SL::DB::Manager::DeliveryTerm;
use SL::DB::Helper::ActsAsList;
+use SL::DB::Helper::TranslatedAttributes;
sub validate {
$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};
$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};
$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();
}
</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">