X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/9d1e95b0eb88a54c083815ffd2db30227c2acf4a..b12e8d1411cb7af3a1a9b6f7637692f0758b4741:/bin/mozilla/am.pl diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index d175ead80..e34957f94 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -47,10 +47,32 @@ require "$form->{path}/common.pl"; # end of main sub add { &{"add_$form->{type}"} } -sub edit { &{"edit_$form->{type}"} } -sub save { &{"save_$form->{type}"} } sub delete { &{"delete_$form->{type}"} } +sub display { + if ($form->{display_nextsub}) { + &{ $form->{display_nextsub} }(); + } else { + &{ $form->{nextsub} }(); + } +} + +sub save { + if ($form->{save_nextsub}) { + &{ $form->{save_nextsub} }(); + } else { + &{ $form->{nextsub} }(); + } +} + +sub edit { + if ($form->{edit_nextsub}) { + &{ $form->{edit_nextsub} }(); + } else { + &{ "edit_$form->{type}" }(); + } +} + sub add_account { $lxdebug->enter_sub(); @@ -96,13 +118,16 @@ sub account_header { $form->{description} =~ s/\"/"/g; if (@{ $form->{TAXKEY} }) { - foreach $item (@{ $form->{TAXKEY} }) { + foreach my $item (@{ $form->{TAXKEY} }) { + + $item->{rate} = $item->{rate} * 100 . '%'; + if ($item->{tax} == $form->{tax}) { $form->{selecttaxkey} .= - "{tax} selected>$item->{taxdescription}\n"; + "{tax} selected>$item->{taxdescription} ($item->{rate})\n"; } else { $form->{selecttaxkey} .= - "{tax}>$item->{taxdescription}\n"; + "{tax}>$item->{taxdescription} ($item->{rate})\n"; } } @@ -112,7 +137,7 @@ sub account_header { | . $locale->text('Steuersatz') . qq| $form->{selecttaxkey} - | . $locale->text('Gültig ab') . qq| + | . $locale->text('Gültig ab') . qq| |; @@ -139,7 +164,7 @@ sub account_header { | . $locale->text('Folgekonto') . qq| $form->{selectnewaccount} - | . $locale->text('Gültig ab') . qq| + | . $locale->text('Gültig ab') . qq| @@ -212,29 +237,29 @@ sub account_header { |; $form->{selecteur} = "\n"; - %eur = (1 => "Umsatzerlöse", - 2 => "sonstige Erlöse", + %eur = (1 => "Umsatzerlöse", + 2 => "sonstige Erlöse", 3 => "Privatanteile", - 4 => "Zinserträge", - 5 => "Ausserordentliche Erträge", + 4 => "Zinserträge", + 5 => "Ausserordentliche Erträge", 6 => "Vereinnahmte Umsatzst.", 7 => "Umsatzsteuererstattungen", - 8 => "Wareneingänge", - 9 => "Löhne und Gehälter", + 8 => "Wareneingänge", + 9 => "Löhne und Gehälter", 10 => "Gesetzl. sozialer Aufw.", 11 => "Mieten", 12 => "Gas, Strom, Wasser", 13 => "Instandhaltung", - 14 => "Steuern, Versich., Beiträge", + 14 => "Steuern, Versich., Beiträge", 15 => "Kfz-Steuern", 16 => "Kfz-Versicherungen", 17 => "Sonst. Fahrtkosten", 18 => "Werbe- und Reisekosten", 19 => "Instandhaltung u. Werkzeuge", - 20 => "Fachzeitschriften, Bücher", - 21 => "Miete für Einrichtungen", + 20 => "Fachzeitschriften, Bücher", + 21 => "Miete für Einrichtungen", 22 => "Rechts- und Beratungskosten", - 23 => "Bürobedarf, Porto, Telefon", + 23 => "Bürobedarf, Porto, Telefon", 24 => "Sonstige Aufwendungen", 25 => "Abschreibungen auf Anlagever.", 26 => "Abschreibungen auf GWG", @@ -261,25 +286,25 @@ sub account_header { $form->{selectbwa} = "\n"; - %bwapos = (1 => 'Umsatzerlöse', + %bwapos = (1 => 'Umsatzerlöse', 2 => 'Best.Verdg.FE/UE', 3 => 'Aktiv.Eigenleistung', 4 => 'Mat./Wareneinkauf', - 5 => 'So.betr.Erlöse', + 5 => 'So.betr.Erlöse', 10 => 'Personalkosten', 11 => 'Raumkosten', 12 => 'Betriebl.Steuern', - 13 => 'Vers./Beiträge', + 13 => 'Vers./Beiträge', 14 => 'Kfz.Kosten o.St.', 15 => 'Werbe-Reisek.', 16 => 'Kosten Warenabgabe', 17 => 'Abschreibungen', 18 => 'Rep./instandhlt.', - 19 => 'Ãbrige Steuern', + 19 => 'Übrige Steuern', 20 => 'Sonst.Kosten', 30 => 'Zinsauwand', 31 => 'Sonst.neutr.Aufw.', - 32 => 'Zinserträge', + 32 => 'Zinserträge', 33 => 'Sonst.neutr.Ertrag', 34 => 'Verr.kalk.Kosten', 35 => 'Steuern Eink.u.Ertr.'); @@ -1112,9 +1137,7 @@ sub list_business { $discount = $form->format_amount(\%myconfig, $ref->{discount} * 100); $description = - ($ref->{salesman}) - ? "$ref->{description}" - : "$ref->{description}"; + $ref->{description}; $column_data{description} = qq|{script}?action=edit_business&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$description|; $column_data{discount} = qq|$discount|; @@ -1164,7 +1187,6 @@ sub business_header { $lxdebug->enter_sub(); $form->{title} = $locale->text("$form->{title} Business"); - $form->{salesman} = "checked" if $form->{salesman}; # $locale->text('Add Business') # $locale->text('Edit Business') @@ -1200,10 +1222,6 @@ sub business_header { | . $locale->text('Customernumberinit') . qq| {customernumberinit}> - - | . $locale->text('Salesman') . qq| - {salesman}> - @@ -1575,7 +1593,7 @@ sub list_buchungsgruppe { . qq||; $column_header{income_accno_0} = qq|| - . $locale->text('Erlöse Inland') + . $locale->text('Erlöse Inland') . qq||; $column_header{expense_accno_0} = qq|| @@ -1583,7 +1601,7 @@ sub list_buchungsgruppe { . qq||; $column_header{income_accno_1} = qq|| - . $locale->text('Erlöse EU m. UStId') + . $locale->text('Erlöse EU m. UStId') . qq||; $column_header{expense_accno_1} = qq|| @@ -1591,7 +1609,7 @@ sub list_buchungsgruppe { . qq||; $column_header{income_accno_2} = qq|| - . $locale->text('Erlöse EU o. UStId') + . $locale->text('Erlöse EU o. UStId') . qq||; $column_header{expense_accno_2} = qq|| @@ -1599,7 +1617,7 @@ sub list_buchungsgruppe { . qq||; $column_header{income_accno_3} = qq|| - . $locale->text('Erlöse Ausland') + . $locale->text('Erlöse Ausland') . qq||; $column_header{expense_accno_3} = qq|| @@ -1646,7 +1664,7 @@ sub list_buchungsgruppe { $column_data{up} = qq|| . qq|| . - qq|| . + qq|| . qq||; } else { $column_data{up} = qq| |; @@ -1659,7 +1677,7 @@ sub list_buchungsgruppe { $column_data{down} = qq|| . qq|| . - qq|| . + qq|| . qq||; } @@ -1725,7 +1743,7 @@ sub buchungsgruppe_header { $form->{title} = $locale->text("$form->{title} Buchungsgruppe"); - # $locale->text('Buchungsgruppe hinzufügen') + # $locale->text('Buchungsgruppe hinzufügen') # $locale->text('Buchungsgruppe bearbeiten') my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {}); @@ -1776,7 +1794,7 @@ sub buchungsgruppe_header { $linkaccounts .= qq| - | . $locale->text('Erlöse Inland') . qq| + | . $locale->text('Erlöse Inland') . qq| $form->{selectIC_income} @@ -1790,7 +1808,7 @@ sub buchungsgruppe_header { $form->{selectIC_expense} =~ s/ value=$form->{expense_accno_id_1}/ value=$form->{expense_accno_id_1} selected/; } $linkaccounts .= qq| - | . $locale->text('Erlöse EU m. UStId') . qq| + | . $locale->text('Erlöse EU m. UStId') . qq| $form->{selectIC_income} @@ -1806,7 +1824,7 @@ sub buchungsgruppe_header { } $linkaccounts .= qq| - | . $locale->text('Erlöse EU o. UStId') . qq| + | . $locale->text('Erlöse EU o. UStId') . qq| $form->{selectIC_income} @@ -1822,7 +1840,7 @@ sub buchungsgruppe_header { } $linkaccounts .= qq| - | . $locale->text('Erlöse Ausland') . qq| + | . $locale->text('Erlöse Ausland') . qq| $form->{selectIC_income} @@ -1875,7 +1893,7 @@ sub delete_buchungsgruppe { $lxdebug->enter_sub(); AM->delete_buchungsgruppe(\%myconfig, \%$form); - $form->redirect($locale->text('Buchungsgruppe gelöscht!')); + $form->redirect($locale->text('Buchungsgruppe gelöscht!')); $lxdebug->leave_sub(); } @@ -2213,7 +2231,7 @@ sub list_payment { $column_data{up} = qq|| . qq|| . - qq|| . + qq|| . qq||; } else { $column_data{up} = qq| |; @@ -2226,7 +2244,7 @@ sub list_payment { $column_data{down} = qq|| . qq|| . - qq|| . + qq|| . qq||; } @@ -2416,97 +2434,218 @@ sub swap_payment_terms { $lxdebug->leave_sub(); } -sub display_stylesheet { +sub display_template { $lxdebug->enter_sub(); - $form->{file} = "css/$myconfig{stylesheet}"; - &display_form; + $form->{edit} = 0; + display_template_form(); $lxdebug->leave_sub(); } -sub display_form { +sub edit_template { $lxdebug->enter_sub(); - $form->{file} =~ s/^(.:)*?\/|\.\.\///g; - $form->{file} =~ s/^\/*//g; - $form->{file} =~ s/$userspath//; + $form->{edit} = 1; + display_template_form(); - $form->error("$!: $form->{file}") unless -f $form->{file}; + $lxdebug->leave_sub(); +} - AM->load_template(\%$form); +sub save_template { + $lxdebug->enter_sub(); - $form->{title} = $form->{file}; + $form->isblank("formname", $locale->text("You're not editing a file.")) unless ($form->{type} eq "stylesheet"); - # if it is anything but html - if ($form->{file} !~ /\.html$/) { - $form->{body} = "\n$form->{body}\n"; + my ($filename) = AM->prepare_template_filename(\%myconfig, $form); + if (my $error = AM->save_template($filename, $form->{content})) { + $form->error(sprintf($locale->text("Saving the file '%s' failed. OS error message: %s"), $filename, $error)); } - $form->header; + $form->{edit} = 0; + display_template_form(); - print qq| - + $lxdebug->leave_sub(); +} -$form->{body} +sub display_template_form { + $lxdebug->enter_sub(); -{script}> + $form->{formname} =~ s|.*/||; + my $format = $form->{format} eq "html" ? "html" : "tex"; -{file}> - + my $title = $form->{type} eq "stylesheet" ? $locale->text("Edit the stylesheet") : $locale->text("Edit templates"); + $form->{title} = $title; -{path}> -{login}> -{password}> + my $edit_options; - + my @hidden = qw(login path password type format); - + if (($form->{type} ne "stylesheet") && !$form->{edit}) { + $edit_options = ""; - -
\n$form->{body}\n
"; - -