X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/9d679693eeb06baf737355f5c07ea7abf33e7dbb..b12e8d1411cb7af3a1a9b6f7637692f0758b4741:/bin/mozilla/am.pl diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 652b3ed18..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(); +} -$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
"; - -