}
# get translations
- $form->{language_values} = "";
$query = qq|SELECT language_id, translation, longdescription
FROM translation
WHERE parts_id = ?|;
- my $trq = prepare_execute_query($form, $dbh, $query, conv_i($form->{id}));
- while (my $tr = $trq->fetchrow_hashref("NAME_lc")) {
- $form->{language_values} .= "---+++---" . join('--++--', @{$tr}{qw(language_id translation longdescription)});
- }
- $trq->finish;
+ $form->{translations} = selectall_hashref_query($form, $dbh, $query, conv_i($form->{id}));
# is it an orphan
my @referencing_tables = qw(invoice orderitems inventory);
# delete translation records
do_query($form, $dbh, qq|DELETE FROM translation WHERE parts_id = ?|, conv_i($form->{id}));
- if ($form->{language_values} ne "") {
- foreach my $item (split(/---\+\+\+---/, $form->{language_values})) {
- my ($language_id, $translation, $longdescription) = split(/--\+\+--/, $item);
- if ($translation ne "") {
- $query = qq|INSERT into translation (parts_id, language_id, translation, longdescription)
- VALUES ( ?, ?, ?, ? )|;
- @values = (conv_i($form->{id}), conv_i($language_id), $translation, $longdescription);
- do_query($form, $dbh, $query, @values);
- }
+ my @translations = grep { $_->{language_id} && $_->{translation} } @{ $form->{translations} || [] };
+ if (@translations) {
+ $query = qq|INSERT into translation (parts_id, language_id, translation, longdescription)
+ VALUES ( ?, ?, ?, ? )|;
+ $sth = $dbh->prepare($query);
+
+ foreach my $translation (@translations) {
+ do_statement($form, $sth, $query, conv_i($form->{id}), conv_i($translation->{language_id}), $translation->{translation}, $translation->{longdescription});
}
+
+ $sth->finish();
}
# delete price records
$form->{bin_id} ||= $default_bin_id || $form->{WAREHOUSES}->[$max -1]->{BINS}->[0]->{id};
}
+ $form->{LANGUAGES} = SL::DB::Manager::Language->get_all_sorted;
+ $form->{translations_map} = { map { ($_->{language_id} => $_) } @{ $form->{translations} || [] } };
IC->retrieve_buchungsgruppen(\%myconfig, $form);
@{ $form->{BUCHUNGSGRUPPEN} } = grep { $_->{id} eq $form->{buchungsgruppen_id} || ($form->{id} && $form->{orphaned}) || !$form->{id} } @{ $form->{BUCHUNGSGRUPPEN} };
$lxdebug->leave_sub();
}
-sub parts_language_selection {
- $lxdebug->enter_sub();
-
- $auth->assert('part_service_assembly_edit');
-
- my $languages = IC->retrieve_languages(\%myconfig, $form);
-
- if ($form->{language_values} ne "") {
- foreach my $item (split(/---\+\+\+---/, $form->{language_values})) {
- my ($language_id, $translation, $longdescription) = split(/--\+\+--/, $item);
-
- foreach my $language (@{ $languages }) {
- next unless ($language->{id} == $language_id);
-
- $language->{translation} = $translation;
- $language->{longdescription} = $longdescription;
-
- $language->{translation_area} = ($language->{translation_rows} = $form->numtextrows($language->{translation}, 40)) > 1;
- $language->{longdescription_rows} = max 4, $form->numtextrows($language->{longdescription}, 40);
-
- last;
- }
- }
- }
-
- my @header_sort = qw(name longdescription);
- my %header_title = ( "name" => $locale->text("Name"),
- "longdescription" => $locale->text("Long Description"),
- );
-
- my @header =
- map(+{ "column_title" => $header_title{$_},
- "column" => $_,
- },
- @header_sort);
-
- $form->{"title"} = $locale->text("Language Values");
- $form->header();
- print $form->parse_html_template("ic/parts_language_selection", { "HEADER" => \@header,
- "LANGUAGES" => $languages, });
-
- $lxdebug->leave_sub();
-}
-
sub ajax_autocomplete {
$main::lxdebug->enter_sub();
+++ /dev/null
-function parts_language_selection_window(input_name) {
- var parm = centerParms(600,500) + ",width=600,height=500,status=yes,scrollbars=yes";
- var name = document.getElementsByName(input_name)[0].value;
- url = "ic.pl?" +
- "INPUT_ENCODING=UTF-8&" +
- "action=parts_language_selection&" +
- "id=" + encodeURIComponent(document.ic.id.value) + "&" +
- "language_values=" + encodeURIComponent(document.ic.language_values.value) + "&" +
- "name=" + encodeURIComponent(name) + "&" +
- "input_name=" + encodeURIComponent(input_name) + "&"
- window.open(url, "_new_generic", parm);
-}
'Language' => 'Sprache',
'Language (database ID)' => 'Sprache (Datenbank-ID)',
'Language (name)' => 'Sprache (Name)',
- 'Language Values' => 'Sprachübersetzungen',
'Language deleted!' => 'Sprache gelöscht!',
'Language missing!' => 'Sprache fehlt!',
'Language saved!' => 'Sprache gespeichert!',
'Please enter the taxnumber in the client configuration.' => 'Bitte geben Sie in der Mandantenkonfiguration die Steuernummer an.',
'Please enter values' => 'Bitte Werte eingeben',
'Please insert object dimensions below.' => 'Bitte geben Sie die Abmessungen unten ein',
- 'Please insert your language values below' => 'Bitte die Übersetzungen unten eintragen',
'Please insert your longdescription below' => 'Bitte den Langtext eingeben',
'Please install the below listed modules or ask your system administrator to.' => 'Bitte installieren Sie die unten aufgeführten Module, oder bitten Sie Ihren Administrator darum.',
'Please log in to the administration panel.' => 'Bitte melden Sie sich im Administrationsbereich an.',
'Service Number missing!' => 'Dienstleistungsnummer fehlt!',
'Service, assembly or part' => 'Dienstleistung, Erzeugnis oder Ware',
'Services' => 'Dienstleistungen',
- 'Set Language Values' => 'Spracheinstellungen',
'Set eMail text' => 'E-Mail Text eingeben',
'Settings' => 'Einstellungen',
'Setup Menu' => 'Menü-Variante',
'Transfer qty' => 'Umlagermenge',
'Transfer successful' => 'Lagervorgang erfolgreich',
'Translation' => 'Übersetzung',
+ 'Translations' => 'Übersetzungen',
'Trial Balance' => 'Summen- und Saldenliste',
'Trial balance between %s and %s' => 'Summen- und Saldenlisten vom %s bis zum %s',
'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
[%- USE L %][% USE LxERP %][% USE HTML %][%- USE JavaScript -%]
<script type="text/javascript" src="js/common.js"></script>
- <script type="text/javascript" src="js/parts_language_selection.js"></script>
<script type="text/javascript">
<!--
var warehouses = [
[%- USE LxERP %]
[%- USE JavaScript -%]
<script type="text/javascript" src="js/common.js"></script>
- <script type="text/javascript" src="js/parts_language_selection.js"></script>
<script type="text/javascript">
<!--
warehouses = new Array();
[%- USE LxERP %]
[%- USE JavaScript %]
<script type="text/javascript" src="js/common.js"></script>
- <script type="text/javascript" src="js/parts_language_selection.js"></script>
<script type="text/javascript">
<!--
warehouses = new Array();
</table>
</div>
+[%- IF LANGUAGES.size %]
+ [% PROCESS 'ic/tabs/_edit_translations.html' %]
+[%- END %]
+
[%- IF id %]
<div id="sales_price_information">
[% PROCESS ic/sales_price_information.html id=id %]
[%- USE T8 %]
[%- USE HTML %]
-[%- USE LxERP %]
+[%- USE LxERP %][%- USE L -%]
[% PROCESS 'common/select_warehouse_bin.html' %]
<p><div class="listtop">[% title %] [% HTML.escape(partnumber) %] [% HTML.escape(description) %]</div></p>
<input name="taxaccounts" type="hidden" value="[% HTML.escape(taxaccounts) %]">
<input name="rowcount" type="hidden" value="[% HTML.escape(rowcount) %]">
<input name="eur" type="hidden" value="[% HTML.escape(eur) %]">
- <input name="language_values" type="hidden" value="[% HTML.escape(language_values) %]">
<input name="original_partnumber" type="hidden" value="[% HTML.escape(original_partnumber) %]">
<input name="currow" type="hidden" value="[% HTML.escape(currow) %]">
<div class="tabwidget">
<ul>
<li><a href="#master_data">[% 'Basic Data' | $T8 %]</a></li>
+[% IF LANGUAGES.size %]
+ <li><a href="#translations_tab">[% 'Translations' | $T8 %]</a></li>
+[% END %]
[%- IF id %]
<li><a href="#sales_price_information">[% 'Price information' | $T8 %]</a></li>
[%- END %]
</td>
</tr>
- <tr>
- <td>
- <button type="button" onclick="parts_language_selection_window('language_values')">[% 'Set Language Values' | $T8 %]</button>
- </td>
- </tr>
-
<tr height="5"></tr>
<tr>
+++ /dev/null
-[%- USE T8 %]
-[%- USE HTML %]
- <form name="Form">
-
- <input type="hidden" name="input_name" value="[% HTML.escape(input_name) %]">
-
- <div class="listtop">[% title %]</div>
-
- <p>[% 'Please insert your language values below' | $T8 %]</p>
-
- <p>
- <table>
- <tr class="listheading">
- <th class="listheading"> </th>
- [%- FOREACH col = HEADER %]
- <th nowrap class="listheading">[% col.column_title %]</th>
- [%- END %]
- </tr>
-
- [%- FOREACH row = LANGUAGES %]
- <tr class="listrow[% loop.count % 2 %]">
- <td><input type="hidden" id="id_[% loop.count %]" name="id_[% loop.count %]" value="[% HTML.escape(row.id) %]">[% HTML.escape(row.description) %]</td>
- <td>
- [%- IF row.translation_area %]
- <textarea id="translation_[% loop.count %]" name="translation_[% loop.count %]" rows="[% HTML.escape(row.translation_rows) %]" cols=40 wrap="soft">[% HTML.escape(row.translation) %]</textarea>
- [%- ELSE %]
- <input id="translation_[% loop.count %]" name="translation_[% loop.count %]" value="[% HTML.escape(row.translation) %]">
- [%- END %]
- </td>
- <td><textarea id="longdescription_[% loop.count %]" name="longdescription_[% loop.count %]" rows="[% HTML.escape(row.longdescription_rows) %]" cols=40 wrap="soft">[% HTML.escape(row.longdescription) %]</textarea></td>
- </tr>
-
- [%- IF loop.last %]
- <input type="hidden" id="rowcount" name="rowcount" value="[% loop.count %]">
- [%- END %]
- [%- END %]
- </table>
- </p>
-
- <p>
- <button type="button" onclick="languages_updated()">[% 'Close' | $T8 %]</button>
- </p>
-
- </form>
-
- <script type="text/javascript">
- <!--
- function languages_updated() {
- var languages = "";
- for (var i = 1; i <= (document.getElementsByName("rowcount")[0].value); i++) {
- var id = "id_" + i ;
- var translation = "translation_" + i ;
- var longdescription = "longdescription_" + i;
-
- languages = languages +
- "---+++---" + document.getElementsByName( id )[0].value +
- "--++--" + document.getElementsByName( translation )[0].value +
- "--++--" + document.getElementsByName( longdescription )[0].value;
- }
-
- window.opener.document.getElementsByName(document.Form.input_name.value)[0].value = languages;
-
- self.close();
- }
- //-->
- </script>
-
--- /dev/null
+[%- USE HTML %][%- USE L -%][%- USE P -%][%- USE LxERP -%]
+
+<div id="translations_tab">
+ <table>
+ <tr class="listheading">
+ <th>[% LxERP.t8("Language") %]</th>
+ <th>[% LxERP.t8("Description") %]</th>
+ <th>[% LxERP.t8("Long Description") %]</th>
+ </tr>
+
+ [%- FOREACH language = LANGUAGES %]
+ [% SET language_id = language.id
+ translation = translations_map.$language_id %]
+ [% L.hidden_tag('translations[+].language_id', language.id) %]
+ <tr class="listrow" valign="top">
+ <td>[% HTML.escape(language.description) %]</td>
+ <td>[% L.input_tag("translations[].translation", translation.translation) %]</td>
+ <td>[% L.textarea_tag("translations[].longdescription", translation.longdescription, id="translations_longdescription_" _ language_id, style="width: 500px; height: 100px") %]</td>
+ </tr>
+ [%- END %]
+ </table>
+</div>