From b9882bee823f393f2071c790c1d73407c7d8ea51 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 31 Oct 2007 14:30:43 +0000 Subject: [PATCH] Umstellung der Vorlagen in templates/webpages/am von HTML::Template auf Template. --- bin/mozilla/am.pl | 90 ++------ bin/mozilla/amtemplates.pl | 38 ++-- locale/de/am | 2 - templates/webpages/am/edit_accounts_de.html | 141 ++++++------- .../webpages/am/edit_accounts_master.html | 141 ++++++------- templates/webpages/am/edit_templates_de.html | 47 +++-- .../webpages/am/edit_templates_master.html | 47 +++-- templates/webpages/am/edit_units_de.html | 80 +++---- templates/webpages/am/edit_units_master.html | 80 +++---- .../webpages/am/list_account_details_de.html | 196 ++++++------------ .../am/list_account_details_master.html | 196 ++++++------------ 11 files changed, 426 insertions(+), 632 deletions(-) diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index d11f16113..ac973cff9 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -339,7 +339,7 @@ sub account_header { }; # Ausgabe des Templates - print($form->parse_html_template('am/edit_accounts', $parameters_ref)); + print($form->parse_html_template2('am/edit_accounts', $parameters_ref)); $lxdebug->leave_sub(); @@ -398,18 +398,10 @@ sub save_account { sub list_account { $lxdebug->enter_sub(); - CA->all_accounts(\%myconfig, \%$form); - - $form->{title} = $locale->text('Chart of Accounts'); - - # construct callback - $callback = - "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}"; - + $form->{callback} = build_std_url('action=list_account'); + my $link_edit_account = build_std_url('action=edit_account', 'callback'); - - # escape callback - $callback = $form->escape($callback); + CA->all_accounts(\%myconfig, \%$form); foreach $ca (@{ $form->{CA} }) { @@ -423,19 +415,11 @@ sub list_account { $ca->{debit} = $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2); } $ca->{heading} = ( $ca->{charttype} eq 'H' ) ? 1:''; - $ca->{link_edit_account} = - qq|$form->{script}?action=edit_account&id=$ca->{id}| - .qq|&login=$form->{login}| - .qq|&password=$form->{password}&callback=$callback|; + $ca->{link_edit_account} = $link_edit_account . '&id=' . E($ca->{id}); } # Ajax - my $list_account_details_url = - "$form->{script}?login=$form->{login}" - ."&password=$form->{password}&action=list_account_details&"; - - - my $pjx = new CGI::Ajax('list_account_details' => $list_account_details_url); + my $pjx = new CGI::Ajax('list_account_details' => build_std_url('action=list_account_details')); # Eneable AJAX debuging #$pjx->DEBUG(1); @@ -444,6 +428,7 @@ sub list_account { push(@ { $form->{AJAX} }, $pjx); $form->{stylesheets} = "list_accounts.css"; + $form->{title} = $locale->text('Chart of Accounts'); $form->header; @@ -461,23 +446,12 @@ sub list_account { sub list_account_details { -# Ajax Funktion aus list_account_details +# Ajax Funktion aus list_account_details $lxdebug->enter_sub(); my $chart_id = $form->{args}; - - CA->all_accounts(\%myconfig, \%$form, $chart_id); - - $form->{title} = $locale->text('Chart of Accounts'); - - # construct callback - $callback = - "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}"; - $form->header; - - # escape callback - $callback = $form->escape($callback); + CA->all_accounts(\%myconfig, \%$form, $chart_id); foreach $ca (@{ $form->{CA} }) { @@ -494,11 +468,11 @@ sub list_account_details { } my @links = split( q{:}, $ca->{link}); - + $ca->{link} = q{}; - + foreach my $link (@links){ - $link = ( $link eq 'AR') ? $locale->text('Account Link AR') + $link = ( $link eq 'AR') ? $locale->text('Account Link AR') : ( $link eq 'AP') ? $locale->text('Account Link AP') : ( $link eq 'IC') ? $locale->text('Account Link IC') : ( $link eq 'AR_amount' ) ? $locale->text('Account Link AR_amount') @@ -515,16 +489,8 @@ sub list_account_details { : ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice') # : ( $link eq 'CT_tax' ) ? $locale->text('Account Link CT_tax') : $locale->text('Unknown Link') . ': ' . $link; - $ca->{link} .= ($link ne '') ? "[$link] ":''; } - - $ca->{startdate} =~ s/,/
/og; - $ca->{tk_ustva} =~ s/,/
/og; - $ca->{taxkey} =~ s/,/
/og; - $ca->{taxaccount} =~ s/,/
/og; - $ca->{taxdescription} =~ s/,/
/og; - $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):$locale->text('Off'); $ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A') : ($ca->{category} eq 'E') ? $locale->text('Account Category E') @@ -534,29 +500,13 @@ sub list_account_details { : ($ca->{category} eq 'C') ? $locale->text('Account Category C') : ($ca->{category} eq 'G') ? $locale->text('Account Category G') : $locale->text('Unknown Category') . ': ' . $ca->{category}; - - $ca->{link_edit_account} = - qq|$form->{script}?action=edit_account&id=$ca->{id}| - .qq|&login=$form->{login}| - .qq|&password=$form->{password}&callback=$callback|; } + $form->{title} = $locale->text('Chart of Accounts'); + $form->header(); + print $form->parse_html_template2('am/list_account_details'); - - my $parameters_ref = { - - - # hidden_variables => $_hidden_variables_ref, - }; - - # Ausgabe des Templates - #my $q = CGI->new(); - my $result = $form->parse_html_template('am/list_account_details', $parameters_ref); - - print $result; -# print "chart_id:$chart_id, form->chartid:$form->{chart_id}, rest=$rest"; - $lxdebug->leave_sub(); } @@ -2609,11 +2559,11 @@ sub edit_units { $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units")); $form->header(); - print($form->parse_html_template("am/edit_units", - { "UNITS" => \@unit_list, - "NEW_BASE_UNIT_DDBOX" => $ddbox, - "LANGUAGES" => \@languages, - "updownlink" => $updownlink })); + print($form->parse_html_template2("am/edit_units", + { "UNITS" => \@unit_list, + "NEW_BASE_UNIT_DDBOX" => $ddbox, + "LANGUAGES" => \@languages, + "updownlink" => $updownlink })); $lxdebug->leave_sub(); } diff --git a/bin/mozilla/amtemplates.pl b/bin/mozilla/amtemplates.pl index 73e7e9b82..61877259a 100644 --- a/bin/mozilla/amtemplates.pl +++ b/bin/mozilla/amtemplates.pl @@ -145,8 +145,7 @@ sub display_template_form { push(@values, { "value" => $file, - "label" => ref($setup) ? $setup->{"translation"} : $setup, - "default" => $file eq $form->{"formname"} }); + "label" => ref($setup) ? $setup->{"translation"} : $setup }); } # "zahlungserinnerung" => $locale->text('Payment Reminder'), @@ -155,54 +154,45 @@ sub display_template_form { next if !$ref->{"template"}; push(@values, - { "value" => $ref->{"template"}, - "label" => $locale->text('Payment Reminder') . ": " . $ref->{"dunning_description"}, - "default" => $ref->{"template"} eq $form->{"formname"} }); + { "value" => $ref->{"template"}, + "label" => $locale->text('Payment Reminder') . ": " . $ref->{"dunning_description"} }); } @values = sort({ $a->{"label"} cmp $b->{"label"} } @values); - $options{"FORMNAME"} = [ @values ]; + $options{FORMNAME} = [ @values ]; # # Setup "language" selection # - @values = ( { "value" => "", "label" => "", "default" => 0 } ); + @values = (); foreach my $item (@{ $form->{"ALL_LANGUAGES"} }) { next unless ($item->{"template_code"}); - my $key = "$item->{id}--$item->{template_code}"; - push(@values, - { "value" => $key, - "label" => $item->{"description"}, - "default" => $key eq $form->{"language"} }); + { "value" => "$item->{id}--$item->{template_code}", + "label" => $item->{"description"} }); } - $options{"LANGUAGE"} = [ @values ]; - $options{"SHOW_LANGUAGE"} = scalar(@values) > 1; - - @values = ( { "value" => "", "label" => "", "default" => 0 } ); + $options{LANGUAGE} = [ @values ]; # # Setup "printer" selection # + @values = (); + foreach my $item (@{ $form->{"ALL_PRINTERS"} }) { next unless ($item->{"template_code"}); - my $key = "$item->{id}--$item->{template_code}"; - push(@values, - { "value" => $key, - "label" => $item->{"printer_description"}, - "default" => $key eq $form->{"printer"} }); + { "value" => "$item->{id}--$item->{template_code}", + "label" => $item->{"printer_description"} }); } - $options{"PRINTER"} = [ @values ]; - $options{"SHOW_PRINTER"} = scalar(@values) > 1; + $options{PRINTER} = [ @values ]; } else { push(@hidden, qw(formname language printer)); @@ -231,7 +221,7 @@ sub display_template_form { $options{"HIDDEN"} = [ map(+{ "name" => $_, "value" => $form->{$_} }, @hidden) ]; $form->header; - print($form->parse_html_template("am/edit_templates", \%options)); + print($form->parse_html_template2("am/edit_templates", \%options)); $lxdebug->leave_sub(); } diff --git a/locale/de/am b/locale/de/am index 876d6966d..0d3936765 100644 --- a/locale/de/am +++ b/locale/de/am @@ -161,8 +161,6 @@ $self->{texts} = { 'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.', 'None' => 'Kein', 'Number Format' => 'Zahlenformat', - 'Off' => 'Aus', - 'On' => 'An', 'OpenDocument/OASIS' => 'OpenDocument/OASIS', 'PAYMENT POSTED' => 'Rechung gebucht', 'PDF' => 'PDF', diff --git a/templates/webpages/am/edit_accounts_de.html b/templates/webpages/am/edit_accounts_de.html index 12a61d09d..08829fcca 100644 --- a/templates/webpages/am/edit_accounts_de.html +++ b/templates/webpages/am/edit_accounts_de.html @@ -1,4 +1,4 @@ - -
+ - + - - - - - - - + + + + + + + - +
[% title %]
@@ -40,16 +40,15 @@ window.onload = function() { - + + - + @@ -58,25 +57,24 @@ window.onload = function() { - + - - + +
Kontoart + [% select_category %]
- +[% IF ChartTypeIsAccount %]
Buchungskonto in - > +  Verkauf - > +  Einkauf - > +  Inventar
@@ -92,46 +90,46 @@ window.onload = function() { >  + [% HTML.escape(AR_amount) %]>  Erlöskonto
- >  +   Zahlungseingang
- >  +   Steuer - >  +   Aufwand/Anlagen
- >  +   Zahlungsausgang
- >  +   Steuer - >  +   Erlöskonto
- >  +   Aufwandskonto
- >  +   Steuer >  + [% HTML.escape(IC_income) %]>  Erlöskonto
- >  +   Aufwandskonto
>  + [% HTML.escape(IC_taxservice) %]>  Steuer @@ -144,39 +142,39 @@ window.onload = function() { - +[% IF account_exists %] - +[% FOREACH tk = ACCOUNT_TAXKEYS %] - - - - - - + + + - - - - - + [% ELSE %] + + + + - + [% END %] - - +[% END %] +[% ELSE %] - +[% END %]
Steuerschlüssel Gültig ab UStVA Löschen ?
+  

Einstellungen sind nach dem Speichern des Kontos verfügbar...

@@ -185,30 +183,27 @@ window.onload = function() { - + - + - + - + - + - - + +
Einnahmen-/Überschussrechnung
BWA
Bilanz
Datevexportchecked="checked" >
Folgekonto Gültig ab
-
+[% END %]
- diff --git a/templates/webpages/am/edit_accounts_master.html b/templates/webpages/am/edit_accounts_master.html index 2ddf5536d..d2eab9da0 100644 --- a/templates/webpages/am/edit_accounts_master.html +++ b/templates/webpages/am/edit_accounts_master.html @@ -1,4 +1,4 @@ - - + - + - - - - - - - + + + + + + + - +
[% title %]
@@ -40,16 +40,15 @@ window.onload = function() { - + + - + @@ -58,25 +57,24 @@ window.onload = function() { - + - - + +
Account Type + [% select_category %]
- +[% IF ChartTypeIsAccount %]
Is this a summary account to record - > +  AR - > +  AP - > +  Inventory
@@ -92,46 +90,46 @@ window.onload = function() { >  + [% HTML.escape(AR_amount) %]>  Revenue
- >  +   Receipt
- >  +   Tax - >  +   Expense/Asset
- >  +   Payment
- >  +   Tax - >  +   Revenue
- >  +   Expense
- >  +   Tax >  + [% HTML.escape(IC_income) %]>  Revenue
- >  +   Expense
>  + [% HTML.escape(IC_taxservice) %]>  Tax @@ -144,38 +142,38 @@ window.onload = function() { - +[% IF account_exists %] - +[% FOREACH tk = ACCOUNT_TAXKEYS %] - - - - - - + + + - - - - - + [% ELSE %] + + + + - + [% END %] - - +[% END %] +[% ELSE %] - +[% END %]
Taxkey valid from pos_ustva delete ?
+  

Save account first to insert taxkeys

@@ -184,30 +182,27 @@ window.onload = function() { - + - + - + - + - + - - + +
EUER
BWA
Bilanz
Datevautomatikchecked="checked" >
Folgekonto Valid from
-
+[% END %]
- diff --git a/templates/webpages/am/edit_templates_de.html b/templates/webpages/am/edit_templates_de.html index ca0e62f40..2ffcbe836 100644 --- a/templates/webpages/am/edit_templates_de.html +++ b/templates/webpages/am/edit_templates_de.html @@ -1,31 +1,33 @@ - +[% USE HTML %] -
+
[% title %]
- + [% FOREACH var = HIDDEN %][% END %] - + [% IF SHOW_EDIT_OPTIONS %]

Druckvorlage - + [% IF LANGUAGE.size %] Sprache - + [% END %] - + [% IF PRINTER.size %] Drucker - + [% END %] @@ -34,40 +36,41 @@


-
+ [% END %] - + [% IF SHOW_CONTENT %]

- Datei bearbeitenDatei anzeigen + [% IF CAN_EDIT %]Datei bearbeiten[% ELSE %]Datei anzeigen[% END %] [% HTML.escape(display_filename) %]

- -

+ [% IF CAN_EDIT %] +

+

- + [% ELSE %]

-

+

[% HTML.escape(content) %]

- + [% IF SHOW_SECOND_EDIT_BUTTON %]

-
+ [% END %] -
+ [% END %] -
+ [% END %]
diff --git a/templates/webpages/am/edit_templates_master.html b/templates/webpages/am/edit_templates_master.html index 3a166ec3a..fcf223c9e 100644 --- a/templates/webpages/am/edit_templates_master.html +++ b/templates/webpages/am/edit_templates_master.html @@ -1,31 +1,33 @@ - +[% USE HTML %] -
+
[% title %]
- + [% FOREACH var = HIDDEN %][% END %] - + [% IF SHOW_EDIT_OPTIONS %]

Template - + [% IF LANGUAGE.size %] Language - + [% END %] - + [% IF PRINTER.size %] Printer - + [% END %] @@ -34,40 +36,41 @@


-
+ [% END %] - + [% IF SHOW_CONTENT %]

- Edit fileDisplay file + [% IF CAN_EDIT %]Edit file[% ELSE %]Display file[% END %] [% HTML.escape(display_filename) %]

- -

+ [% IF CAN_EDIT %] +

+

- + [% ELSE %]

-

+

[% HTML.escape(content) %]

- + [% IF SHOW_SECOND_EDIT_BUTTON %]

-
+ [% END %] -
+ [% END %] -
+ [% END %]
diff --git a/templates/webpages/am/edit_units_de.html b/templates/webpages/am/edit_units_de.html index ca8d4e721..096bfa2d2 100644 --- a/templates/webpages/am/edit_units_de.html +++ b/templates/webpages/am/edit_units_de.html @@ -1,22 +1,22 @@ - +[% USE HTML %] - -

+ [% IF saved_message %] +

[% saved_message %]


-
+ [% END %] -
+ - - + + - + - +
[% title %]
@@ -47,7 +47,7 @@ Basiseinheit @@ -56,14 +56,14 @@ - + [% FOREACH language = LANGUAGES %] - - + [% language.description %] + Plural - + - + [% END %] @@ -98,51 +98,51 @@ Einheit Basiseinheit Faktor - - - + [% FOREACH language = LANGUAGES %] + [% language.description %] + [% END %] - + [% FOREACH row = UNITS %] - hochrunter - + [% IF loop.first %][% ELSE %]hoch[% END %][% IF loop.last %][% ELSE %]runter[% END %] + [% IF row.in_use %] - - + + - - --- - --- + [% HTML.escape(row.name) %] + [% IF row.base_unit %][% HTML.escape(row.base_unit) %][% ELSE %]---[% END %] + [% IF row.base_unit %][% HTML.escape(row.factor) %][% ELSE %]---[% END %] - + [% ELSE %] - + - - + + - + [% FOREACH option = row.BASE_UNIT_DDBOX %][% END %] - - + + [% END %] - + [% FOREACH language = row.UNITLANGUAGES %] S: - + P: - + - + [% END %] - - + [% IF loop.last %][% END %] + [% END %] diff --git a/templates/webpages/am/edit_units_master.html b/templates/webpages/am/edit_units_master.html index a65b6904a..971eb28d7 100644 --- a/templates/webpages/am/edit_units_master.html +++ b/templates/webpages/am/edit_units_master.html @@ -1,22 +1,22 @@ - +[% USE HTML %] - -

+ [% IF saved_message %] +

[% saved_message %]


-
+ [% END %] - + - - + + - + - +
[% title %]
@@ -47,7 +47,7 @@ Base unit @@ -56,14 +56,14 @@ - + [% FOREACH language = LANGUAGES %] - - + [% language.description %] + Plural - + - + [% END %] @@ -98,51 +98,51 @@ Unit Base unit Factor - - - + [% FOREACH language = LANGUAGES %] + [% language.description %] + [% END %] - + [% FOREACH row = UNITS %] - <translate>up</translate><translate>down</translate> - + [% IF loop.first %][% ELSE %]<translate>up</translate>[% END %][% IF loop.last %][% ELSE %]<translate>down</translate>[% END %] + [% IF row.in_use %] - - + + - - --- - --- + [% HTML.escape(row.name) %] + [% IF row.base_unit %][% HTML.escape(row.base_unit) %][% ELSE %]---[% END %] + [% IF row.base_unit %][% HTML.escape(row.factor) %][% ELSE %]---[% END %] - + [% ELSE %] - + - - + + - + [% FOREACH option = row.BASE_UNIT_DDBOX %][% END %] - - + + [% END %] - + [% FOREACH language = row.UNITLANGUAGES %] singular first char: - + plural first char: - + - + [% END %] - - + [% IF loop.last %][% END %] + [% END %] diff --git a/templates/webpages/am/list_account_details_de.html b/templates/webpages/am/list_account_details_de.html index e9e2109c8..9caeece34 100644 --- a/templates/webpages/am/list_account_details_de.html +++ b/templates/webpages/am/list_account_details_de.html @@ -1,133 +1,63 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
- - - - - - -
Steuerautomatik
SteuerschlüsselAutomatikkontoSteuerUSTVA Kennz.Gültig ab
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Berichte
BWABilanzE/ÜRDatevexport
- -
+[% USE HTML %] [% FOREACH row = CA %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[% IF row.id %][% HTML.escape(row.id) %][% ELSE %]-[% END %][% HTML.escape(row.category) %] 
+ [% IF row.link %][% HTML.escape(row.link) %][% ELSE %]-[% END %] +
Steuerautomatik
SteuerschlüsselAutomatikkontoSteuerUSTVA Kennz.Gültig ab
[% IF row.taxkey %][% HTML.escape(row.taxkey).replace(',', '
') %][% ELSE %]-[% END %]
[% IF row.taxaccount %][% HTML.escape(row.taxaccount).replace(',', '
') %][% ELSE %]-[% END %]
[% IF row.taxdescription %][% HTML.escape(row.taxdescription).replace(',', '
') %][% ELSE %]-[% END %]
[% IF row.tk_ustva %][% HTML.escape(row.tk_ustva).replace(',', '
') %][% ELSE %]-[% END %]
[% IF row.startdate %][% HTML.escape(row.startdate).replace(',', '
') %][% ELSE %]-[% END %]
Berichte
BWABilanzE/ÜRDatevexport
[% IF row.pos_bwa %][% HTML.escape(row.pos_bwa) %][% ELSE %]-[% END %][% IF row.pos_bilanz %][% HTML.escape(row.pos_bilanz) %][% ELSE %]-[% END %][% IF row.pos_eur %][% HTML.escape(row.pos_eur) %][% ELSE %]-[% END %][% IF row.datevautomatik %]An[% ELSE %]Aus[% END %]
+ +[% END %] diff --git a/templates/webpages/am/list_account_details_master.html b/templates/webpages/am/list_account_details_master.html index c19d4d137..a83a82eab 100644 --- a/templates/webpages/am/list_account_details_master.html +++ b/templates/webpages/am/list_account_details_master.html @@ -1,133 +1,63 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
- - - - - - -
Taxlink_coa
Taxkey_coaTaxaccount_coaTaxdescription_coaPosustva_coaStartdate_coa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Report Positions
pos_bwapos_bilanzpos_eurDatevautomatik
- -
\ No newline at end of file +[% USE HTML %] [% FOREACH row = CA %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[% IF row.id %][% HTML.escape(row.id) %][% ELSE %]-[% END %][% HTML.escape(row.category) %] 
+ [% IF row.link %][% HTML.escape(row.link) %][% ELSE %]-[% END %] +
Taxlink_coa
Taxkey_coaTaxaccount_coaTaxdescription_coaPosustva_coaStartdate_coa
[% IF row.taxkey %][% HTML.escape(row.taxkey).replace(',', '
') %][% ELSE %]-[% END %]
[% IF row.taxaccount %][% HTML.escape(row.taxaccount).replace(',', '
') %][% ELSE %]-[% END %]
[% IF row.taxdescription %][% HTML.escape(row.taxdescription).replace(',', '
') %][% ELSE %]-[% END %]
[% IF row.tk_ustva %][% HTML.escape(row.tk_ustva).replace(',', '
') %][% ELSE %]-[% END %]
[% IF row.startdate %][% HTML.escape(row.startdate).replace(',', '
') %][% ELSE %]-[% END %]
Report Positions
pos_bwapos_bilanzpos_eurDatevautomatik
[% IF row.pos_bwa %][% HTML.escape(row.pos_bwa) %][% ELSE %]-[% END %][% IF row.pos_bilanz %][% HTML.escape(row.pos_bilanz) %][% ELSE %]-[% END %][% IF row.pos_eur %][% HTML.escape(row.pos_eur) %][% ELSE %]-[% END %][% IF row.datevautomatik %]On[% ELSE %]Off[% END %]
+ +[% END %] -- 2.20.1