X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=459e1b9446ef40f03b7c6807360c497df5b9540a;hb=f65faf202a24a1f1316f45e3695d3d9390dc0793;hp=e29ca4c005c92e6a03d046df12a5521e10c94724;hpb=15682dc47316fcc2deab66730045cd38afec001f;p=kivitendo-erp.git
diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl
index e29ca4c00..459e1b944 100644
--- a/bin/mozilla/is.pl
+++ b/bin/mozilla/is.pl
@@ -37,6 +37,7 @@ use Data::Dumper;
require "$form->{path}/io.pl";
require "$form->{path}/arap.pl";
+require "bin/mozilla/drafts.pl";
1;
@@ -44,7 +45,9 @@ require "$form->{path}/arap.pl";
sub add {
$lxdebug->enter_sub();
-
+
+ return $lxdebug->leave_sub() if (load_draft_maybe());
+
if ($form->{type} eq "credit_note") {
$form->{title} = $locale->text('Add Credit Note');
@@ -77,7 +80,10 @@ sub add {
sub edit {
$lxdebug->enter_sub();
-
+ # show history button
+ $form->{javascript} = qq||;
+ #/show hhistory button
+
if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR")
{
$form->error("Access Denied");
@@ -115,6 +121,7 @@ sub invoice_links {
if ($form->{all_customer}) {
unless ($form->{customer_id}) {
$form->{customer_id} = $form->{all_customer}->[0]->{id};
+ $form->{salesman_id} = $form->{all_customer}->[0]->{salesman_id};
}
}
@@ -165,13 +172,13 @@ sub invoice_links {
chomp $curr[0];
$form->{defaultcurrency} = $curr[0];
- map { $form->{selectcurrency} .= "\n" } @curr;
$form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
if (@{ $form->{all_customer} }) {
$form->{customer} = "$form->{customer}--$form->{customer_id}";
- map { $form->{selectcustomer} .= "\n" }
(@{ $form->{all_customer} });
}
@@ -182,7 +189,7 @@ sub invoice_links {
map {
$form->{selectdepartment} .=
- "\n"
} (@{ $form->{all_departments} });
}
@@ -191,7 +198,7 @@ sub invoice_links {
# sales staff
if ($form->{all_employees}) {
$form->{selectemployee} = "";
- map { $form->{selectemployee} .= "\n" }
(@{ $form->{all_employees} });
}
@@ -201,7 +208,8 @@ sub invoice_links {
foreach $key (keys %{ $form->{AR_links} }) {
foreach $ref (@{ $form->{AR_links}{$key} }) {
- $form->{"select$key"} .= "\n";
}
if ($key eq "AR_paid") {
@@ -342,29 +350,38 @@ sub form_header {
} else {
$form->{selecttaxzone} =~ s/ selected//g;
if ($form->{taxzone_id} ne "") {
- $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/;
+ $form->{selecttaxzone} =~ s/value=\"$form->{taxzone_id}\"/value=\"$form->{taxzone_id}\" selected/;
}
}
$taxzone = qq|
- | . $locale->text('Steuersatz') . qq| |
- |
-
+ | . $locale->text('Steuersatz') . qq| |
+ |
+
|;
- $form->get_lists("contacts" => "ALL_CONTACTS",
- "shipto" => "ALL_SHIPTO");
+ my @old_project_ids = ($form->{"globalproject_id"});
+ map({ push(@old_project_ids, $form->{"project_id_$_"})
+ if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
- my (%labels, @values);
+ $form->get_lists("contacts" => "ALL_CONTACTS",
+ "shipto" => "ALL_SHIPTO",
+ "projects" => { "key" => "ALL_PROJECTS",
+ "all" => 0,
+ "old_id" => \@old_project_ids },
+ "employees" => "ALL_SALESMEN");
+
+ my %labels;
+ my @values = (undef);
foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
push(@values, $item->{"cp_id"});
$labels{$item->{"cp_id"}} = $item->{"cp_name"} .
($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
}
my $contact =
- $cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
- '-labels' => \%labels, '-default' => $form->{"cp_id"});
+ NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
+ '-labels' => \%labels, '-default' => $form->{"cp_id"}));
%labels = ();
@values = ("");
@@ -377,10 +394,37 @@ sub form_header {
my $shipto = qq|
| . $locale->text('Shipping Address') . qq| |
| .
- $cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
- '-labels' => \%labels, '-default' => $form->{"shipto_id"})
+ NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
+ '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
. qq| | |;
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+ push(@values, $item->{"id"});
+ $labels{$item->{"id"}} = $item->{"projectnumber"};
+ }
+ my $globalprojectnumber =
+ NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
+ '-labels' => \%labels,
+ '-default' => $form->{"globalproject_id"}));
+
+ %labels = ();
+ @values = ("");
+ foreach my $item (@{ $form->{ALL_SALESMEN} }) {
+ push(@values, $item->{id});
+ $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
+ }
+
+ $salesman =
+ qq|
+ | . $locale->text('Salesman') . qq| |
+ | .
+ NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
+ '-values' => \@values, '-labels' => \%labels))
+ . qq| |
+
|;
+
# set option selected
foreach $item (qw(AR customer currency department employee)) {
$form->{"select$item"} =~ s/ selected//;
@@ -390,6 +434,9 @@ sub form_header {
#quote customer Bug 133
$form->{selectcustomer} = $form->quote($form->{selectcustomer});
+
+ #substitute \n and \r to \s (bug 543)
+ $form->{selectcustomer} =~ s/[\n\r]/ /g;
if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
$creditwarning = 1;
@@ -409,30 +456,33 @@ sub form_header {
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{forex}) {
$exchangerate .=
- qq||
+ qq| | |
. $locale->text('Exchangerate')
- . qq| | $form->{exchangerate}{exchangerate}> | |;
+ . qq|$form->{exchangerate} | |;
} else {
$exchangerate .=
- qq||
+ qq| | |
. $locale->text('Exchangerate')
- . qq| | {exchangerate}> | |;
+ . qq| | |;
}
}
$exchangerate .= qq|
-{forex}>
+
|;
$customer =
($form->{selectcustomer})
- ? qq|\n|
- : qq||;
+ ? qq|\n|
+ : qq||;
$department = qq|
| . $locale->text('Department') . qq| |
-
-
+ |
+
|
| if $form->{selectdepartment};
@@ -442,9 +492,9 @@ sub form_header {
if ($form->{business}) {
$business = qq|
- | . $locale->text('Business') . qq| |
+ | . $locale->text('Business') . qq| |
$form->{business} |
- | . $locale->text('Trade Discount') . qq| |
+ | . $locale->text('Trade Discount') . qq| |
|
. $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
. qq| % |
@@ -455,12 +505,12 @@ sub form_header {
if ($form->{max_dunning_level}) {
$dunning = qq|
-
+ |
- | . $locale->text('Max. Dunning Level') . qq|: |
+ | . $locale->text('Max. Dunning Level') . qq|: |
$form->{max_dunning_level} |
- | . $locale->text('Dunning Amount') . qq|: |
+ | . $locale->text('Dunning Amount') . qq|: |
|
. $form->format_amount(\%myconfig, $form->{dunning_amount},2)
. qq| |
@@ -481,11 +531,10 @@ sub form_header {
# with JavaScript Calendar
$button1 = qq|
- {invdate}> |
- text('button') . qq|> |
- |;
-
+ |
+ | |;
+
#write Trigger
$jsscript =
Form->write_trigger(\%myconfig, "1",
@@ -495,28 +544,28 @@ sub form_header {
# without JavaScript Calendar
$button1 =
- qq|{invdate}> | |;
+ qq| | |;
$button2 =
- qq|{duedate}> | |;
+ qq| | |;
}
} else {
if ($form->{jsscript}) {
# with JavaScript Calendar
$button1 = qq|
- {invdate}> |
- text('button') . qq|> |
+ |
+ |
|;
$button2 = qq|
- {duedate}> |
- text('button') . qq|> |
+ |
+ |
|;
$button3 = qq|
- {deliverydate}> |
- text('button') . qq|> |
+ |
+ |
|;
#write Trigger
@@ -531,7 +580,7 @@ sub form_header {
# without JavaScript Calendar
$button1 =
- qq|{invdate}> | |;
+ qq| | |;
$button2 =
qq|{duedate}> | |;
}
@@ -556,7 +605,9 @@ sub form_header {
$form->write_trigger(\%myconfig, 2,
"orddate", "BL", "trigger_orddate",
"quodate", "BL", "trigger_quodate");
-
+ # show history button js
+ $form->{javascript} .= qq||;
+ #/show history button js
$form->header;
print qq|
@@ -566,69 +617,45 @@ sub form_header {
- |
-
|;
@@ -1564,10 +1607,37 @@ sub credit_note {
sub yes {
$lxdebug->enter_sub();
-
- $form->redirect($locale->text('Invoice deleted!'))
- if (IS->delete_invoice(\%myconfig, \%$form, $spool));
+ if (IS->delete_invoice(\%myconfig, \%$form, $spool)) {
+ # saving the history
+ if(!exists $form->{addition}) {
+ $form->{addition} = "DELETED";
+ $form->save_history($form->dbconnect(\%myconfig));
+ }
+ # /saving the history
+ $form->redirect($locale->text('Invoice deleted!'));
+ }
$form->error($locale->text('Cannot delete invoice!'));
$lxdebug->leave_sub();
}
+
+sub e_mail {
+ $lxdebug->enter_sub();
+
+ if (!$form->{id}) {
+ $print_post = 1;
+
+ my $saved_form = save_form();
+
+ post();
+
+ my %saved_vars;
+ map({ $saved_vars{$_} = $form->{$_}; } qw(id invnumber));
+ restore_form($saved_form);
+ map({ $form->{$_} = $saved_vars{$_}; } qw(id invnumber));
+ }
+
+ edit_e_mail();
+
+ $lxdebug->leave_sub();
+}