X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/c046c42244acda83029d00cb06ff636063765fb2..b12e8d1411cb7af3a1a9b6f7637692f0758b4741:/bin/mozilla/am.pl diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index d8eb1a217..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"; } } @@ -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}> - @@ -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||; } @@ -2092,7 +2110,6 @@ sub delete_printer { $lxdebug->leave_sub(); } - sub add_payment { $lxdebug->enter_sub(); @@ -2214,7 +2231,7 @@ sub list_payment { $column_data{up} = qq|| . qq|| . - qq|| . + qq|| . qq||; } else { $column_data{up} = qq| |; @@ -2227,7 +2244,7 @@ sub list_payment { $column_data{down} = qq|| . qq|| . - qq|| . + qq|| . qq||; } @@ -2417,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(); +} + +sub display_template_form { + $lxdebug->enter_sub(); -$form->{body} + $form->{formname} =~ s|.*/||; + my $format = $form->{format} eq "html" ? "html" : "tex"; -{script}> + my $title = $form->{type} eq "stylesheet" ? $locale->text("Edit the stylesheet") : $locale->text("Edit templates"); + $form->{title} = $title; -{file}> - + my $edit_options; -{path}> -{login}> -{password}> + my @hidden = qw(login path password type format); - + if (($form->{type} ne "stylesheet") && !$form->{edit}) { + $edit_options = ""; - + my %formname_setup = + ( + "balance_sheet" => { "translation" => $locale->text('Balance Sheet'), "html" => 1 }, + "bin_list" => $locale->text('Bin List'), + "bwa" => { "translation" => $locale->text('BWA'), "html" => 1 }, + "check" => { "translation" => $locale->text('Check'), "html" => 1 }, + "credit_note" => $locale->text('Credit Note'), + "income_statement" => { "translation" => $locale->text('Income Statement'), "html" => 1 }, + "invoice" => $locale->text('Invoice'), + "packing_list" => $locale->text('Packing List'), + "pick_list" => $locale->text('Pick List'), + "proforma" => $locale->text('Proforma Invoice'), + "purchase_order" => $locale->text('Purchase Order'), + "receipt" => { "translation" => $locale->text('Receipt'), "tex" => 1 }, + "request_quotation" => $locale->text('RFQ'), + "sales_order" => $locale->text('Confirmation'), + "sales_quotation" => $locale->text('Quotation'), + "statement" => $locale->text('Statement'), + "storno_invoice" => $locale->text('Storno Invoice'), + "storno_packing_list" => $locale->text('Storno Packing List'), + "ustva-2004" => { "translation" => $locale->text("USTVA 2004"), "tex" => 1 }, + "ustva-2005" => { "translation" => $locale->text("USTVA 2005"), "tex" => 1 }, + "ustva-2006" => { "translation" => $locale->text("USTVA 2006"), "tex" => 1 }, + "ustva-2007" => { "translation" => $locale->text("USTVA 2007"), "tex" => 1 }, + "ustva" => $locale->text("USTVA"), + "zahlungserinnerung" => $locale->text('Payment Reminder'), + ); - -
\n$form->{body}\n
"; -