X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=254a23bf3ba977a2e939e1265897a03f2e7b3b7b;hb=71196b75e9beb984ead25c605ab91443269de88d;hp=99ff0cd29eda0560f8da9f9ac1982595af22e572;hpb=e6f429e42da71c71b6416727216302a87a254fde;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 99ff0cd29..254a23bf3 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -120,19 +120,19 @@ sub edit { # editing without stuff to edit? try adding it first if ($form->{rowcount}) { - map { $id++ if $form->{"id_$_"} } (1 .. $form->{rowcount}); + map { $id++ if $form->{"multi_id_$_"} } (1 .. $form->{rowcount}); if (!$id) { # reset rowcount undef $form->{rowcount}; &add; + $lxdebug->leave_sub(); return; } - } else { - if (!$form->{id}) { - &add; - return; - } + } elsif (!$form->{id}) { + &add; + $lxdebug->leave_sub(); + return; } if ($form->{print_and_save}) { @@ -167,6 +167,8 @@ sub order_links { # set jscalendar $form->{jscalendar} = $jscalendar; + my $editing = $form->{id}; + OE->retrieve(\%myconfig, \%$form); if ($form->{payment_id}) { @@ -179,6 +181,8 @@ sub order_links { $taxzone_id = $form->{taxzone_id}; } + $salesman_id = $form->{salesman_id} if ($editing); + # if multiple rowcounts (== collective order) then check if the # there were more than one customer (in that case OE::retrieve removes @@ -236,7 +240,7 @@ sub order_links { if ($taxzone_id) { $form->{taxzone_id} = $taxzone_id; } - $form->{intnotes} = $intnotes; + $form->{intnotes} = $intnotes if $intnotes; ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} }; $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|; @@ -282,6 +286,8 @@ sub order_links { # forex $form->{forex} = $form->{exchangerate}; + $form->{salesman_id} = $salesman_id if ($editing); + $lxdebug->leave_sub(); } @@ -418,7 +424,8 @@ sub form_header { "shipto" => "ALL_SHIPTO", "projects" => { "key" => "ALL_PROJECTS", "all" => 0, - "old_id" => \@old_project_ids }); + "old_id" => \@old_project_ids }, + "employees" => "ALL_SALESMEN"); my (%labels, @values); foreach my $item (@{ $form->{"ALL_CONTACTS"} }) { @@ -456,6 +463,25 @@ sub form_header { '-labels' => \%labels, '-default' => $form->{"globalproject_id"})); + $salesman = ""; + if ($form->{type} =~ /^sales_/) { + %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| + |; + } + $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); @@ -665,7 +691,7 @@ sub form_header { $employee = qq| {customer_klass}> - | . $locale->text('Salesperson') . qq| + | . $locale->text('Employee') . qq| @@ -698,7 +724,9 @@ sub form_header { } $form->{"javascript"} .= qq||; - + # show history button js + $form->{javascript} .= qq||; + #/show history button js $form->header; print qq| @@ -801,6 +829,7 @@ print qq| $openclosed $employee + $salesman $ordnumber @@ -892,7 +921,7 @@ sub form_footer { $tax .= qq| + . $form->{"${item}_rate"} * 100 .qq|% |; @@ -932,7 +961,7 @@ sub form_footer { $tax .= qq| + . $form->{"${item}_rate"} * 100 .qq|% @@ -1050,6 +1079,12 @@ sub form_footer { if (($form->{id})) { print qq| + +
| . $locale->text("Workflow $form->{type}") . qq|
@@ -1107,6 +1142,8 @@ sub form_footer { |; } + $form->hide_form("saved_xyznumber"); + print qq| {rowcount}> @@ -1116,17 +1153,7 @@ sub form_footer { {path}> {login}> {password}> -|; -# button for saving history -print qq| - {id} - . qq|); name=history id=history value=| - . $locale->text('history') - . qq|>|; -# /button for saving history - -qq| + @@ -1297,7 +1324,7 @@ sub search { $form->{vc} = 'customer'; $ordlabel = $locale->text('Order Number'); $ordnumber = 'ordnumber'; - $employee = $locale->text('Salesperson'); + $employee = $locale->text('Employee'); } if ($form->{type} eq 'sales_quotation') { @@ -1576,11 +1603,10 @@ sub orders { if ($form->{vc} eq 'customer') { if ($form->{type} eq 'sales_order') { $form->{title} = $locale->text('Sales Orders'); - $employee = $locale->text('Salesperson'); } else { $form->{title} = $locale->text('Quotations'); - $employee = $locale->text('Employee'); } + $employee = $locale->text('Employee'); $name = $locale->text('Customer'); } @@ -1727,7 +1753,7 @@ sub orders { $subtotalamount += $oe->{amount}; $column_data{ids} = - qq||; + qq||; $column_data{id} = ""; $column_data{transdate} = ""; $column_data{reqdate} = ""; @@ -2112,11 +2138,9 @@ sub invoice { # these checks only apply if the items don't bring their own ordnumbers/transdates. # The if clause ensures that by searching for empty ordnumber_#/transdate_# fields. $form->isblank("ordnumber", $locale->text('Order Number missing!')) - if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) } - ->{''}); + if (+{ map { $form->{"ordnumber_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''}); $form->isblank("transdate", $locale->text('Order Date missing!')) - if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) } - ->{''}); + if (+{ map { $form->{"transdate_$_"}, 1 } (1 .. $form->{rowcount} - 1) }->{''}); # also copy deliverydate from the order $form->{deliverydate} = $form->{reqdate} if $form->{reqdate}; @@ -2421,7 +2445,15 @@ sub save_as_new { $form->{saveasnew} = 1; $form->{closed} = 0; - map { delete $form->{$_} } qw(printed emailed queued ordnumber quonumber); + map { delete $form->{$_} } qw(printed emailed queued); + + # Let Lx-Office assign a new order number if the user hasn't changed the + # previous one. If it has been changed manually then use it as-is. + my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber"; + if ($form->{saved_xyznumber} && + ($form->{saved_xyznumber} eq $form->{$idx})) { + delete($form->{$idx}); + } &save; @@ -2503,3 +2535,26 @@ sub poso { $lxdebug->leave_sub(); } +sub e_mail { + $lxdebug->enter_sub(); + + $form->{saveasnew} = 1; + $form->{closed} = 0; + $form->{print_and_save} = 1; + map { delete $form->{$_} } qw(printed emailed queued); + + # Let Lx-Office assign a new order number if the user hasn't changed the + # previous one. If it has been changed manually then use it as-is. + my $idx = $form->{type} =~ /_quotation$/ ? "quonumber" : "ordnumber"; + if ($form->{saved_xyznumber} && + ($form->{saved_xyznumber} eq $form->{$idx})) { + delete($form->{$idx}); + } + + &save; + + &edit_e_mail; + + $lxdebug->leave_sub(); +} +
| . $locale->text('Project Number') . qq|
$form->{"${item}_description"} | - . $form->{"${item}_rate"} * 100 .qq|% $form->{"${item}_total"}
Enthaltene $form->{"${item}_description"} | - . $form->{"${item}_rate"} * 100 .qq|% $form->{"${item}_total"}
$oe->{id}$oe->{transdate} $oe->{reqdate}