X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=2891634f005c312023173d28fedeb389a2fb82a4;hb=4e27e828de91b6f1252f3353f06edea72f13a0c1;hp=6b94e2c9a9e37cef3012d6d917072c88594a61f2;hpb=8423c7b21bc3b4b2db7d0ffef756919619336e97;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 6b94e2c9a..2891634f0 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -77,7 +77,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"); @@ -244,11 +247,9 @@ sub prepare_invoice { if ($form->{type} eq "credit_note") { $form->{type} = "credit_note"; $form->{formname} = "credit_note"; - $form->{media} = "screen"; } else { $form->{type} = "invoice"; $form->{formname} = "invoice"; - $form->{media} = "screen"; } if ($form->{id}) { @@ -355,34 +356,51 @@ sub form_header { |; - - if (@{ $form->{SHIPTO} }) { - $form->{selectshipto} = ""; - foreach $item (@{ $form->{SHIPTO} }) { - if ($item->{shipto_id} == $form->{shipto_id}) { - $form->{selectshipto} .= - ""; - } else { - $form->{selectshipto} .= - ""; - } - - } - } else { - $form->{selectshipto} = $form->unquote($form->{selectshipto}); - $form->{selectshipto} =~ s/ selected//g; - if ($form->{shipto_id} ne "") { - $form->{selectshipto} =~ s/value=$form->{shipto_id}/value=$form->{shipto_id} selected/; - } + my @old_project_ids = ($form->{"globalproject_id"}); + map({ push(@old_project_ids, $form->{"project_id_$_"}) + if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"})); + + $form->get_lists("contacts" => "ALL_CONTACTS", + "shipto" => "ALL_SHIPTO", + "projects" => { "key" => "ALL_PROJECTS", + "all" => 0, + "old_id" => \@old_project_ids }); + + my (%labels, @values); + 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 = + NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, + '-labels' => \%labels, '-default' => $form->{"cp_id"})); + + %labels = (); + @values = (""); + foreach my $item (@{ $form->{"ALL_SHIPTO"} }) { + push(@values, $item->{"shipto_id"}); + $labels{$item->{"shipto_id"}} = + $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"}; } - $shipto = qq| + my $shipto = qq| | . $locale->text('Shipping Address') . qq| - |; - $form->{selectshipto} = $form->quote($form->{selectshipto}); - $shipto .= qq| |; - - + | . + 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"})); # set option selected foreach $item (qw(AR customer currency department employee)) { @@ -394,35 +412,12 @@ sub form_header { #quote customer Bug 133 $form->{selectcustomer} = $form->quote($form->{selectcustomer}); - #build contacts - if ($form->{all_contacts}) { - - $form->{selectcontact} = ""; - foreach $item (@{ $form->{all_contacts} }) { - my $department = ($item->{cp_abteilung}) ? "--$item->{cp_abteilung}" : ""; - if ($form->{cp_id} == $item->{cp_id}) { - $form->{selectcontact} .= - ""; - } else { - $form->{selectcontact} .= ""; - } - } - } else { - $form->{selectcontact} =~ s/ selected//g; - if ($form->{cp_id} ne "") { - $form->{selectcontact} =~ s/value=$form->{cp_id}/value=$form->{cp_id} selected/; - } - } - - if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) { $creditwarning = 1; } else { $creditwarning = 0; } - #else {$form->{all_contacts} = 0;} - $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); @@ -454,12 +449,6 @@ sub form_header { ? qq|\n| : qq||; - #sk - $contact = - ($form->{selectcontact}) - ? qq|\n| - : qq||; - $department = qq| | . $locale->text('Department') . qq| @@ -584,6 +573,13 @@ sub form_header { $form->{"javascript"} .= qq||; + $jsscript .= + $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| @@ -750,14 +746,28 @@ print qq| | . $locale->text('Order Number') . qq| + + | . $locale->text('Order Date') . qq| + + + | . $locale->text('Quotation Number') . qq| + + | . $locale->text('Quotation Date') . qq| + + + | . $locale->text('Customer Order Number') . qq| + + | . $locale->text('Project Number') . qq| + $globalprojectnumber + @@ -843,7 +853,8 @@ sub form_footer { $tax .= qq| - $form->{"${item}_description"} + $form->{"${item}_description"} | + . $form->{"${item}_rate"} * 100 .qq|% $form->{"${item}_total"} |; @@ -882,7 +893,8 @@ sub form_footer { $tax .= qq| - Enthaltene $form->{"${item}_description"} + Enthaltene $form->{"${item}_description"} | + . $form->{"${item}_rate"} * 100 .qq|% $form->{"${item}_total"} @@ -914,7 +926,7 @@ sub form_footer { $notes $intnotes - $payment @@ -1142,6 +1154,18 @@ if ($form->{type} eq "credit_note") { } } + # button for saving history + if($form->{id} ne "") { + print qq| + |; + } + # /button for saving history + + print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) . qq| @@ -1176,8 +1200,6 @@ sub update { &check_name(customer); - &check_project; - $form->{exchangerate} = $exchangerate if ( $form->{forex} = ( @@ -1328,6 +1350,7 @@ sub update { } $lxdebug->leave_sub(); } + sub post_payment { $lxdebug->enter_sub(); for $i (1 .. $form->{paidaccounts}) { @@ -1422,10 +1445,30 @@ sub post { if (!(IS->post_invoice(\%myconfig, \%$form))) { $form->error($locale->text('Cannot post invoice!')); } + # saving the history + if(!exists $form->{addition}) { + $form->{addition} = "PRINTED AND POSTED"; + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + } else { - $form->redirect( - $form->{label} . " $form->{invnumber} " . $locale->text('posted!')) - if (IS->post_invoice(\%myconfig, \%$form)); + if (IS->post_invoice(\%myconfig, \%$form)){ + # saving the history + if(!exists $form->{addition}) { + if($form->{storno}) { + $form->{addition} = "STORNO"; + } + else { + $form->{addition} = "POSTED"; + } + $form->save_history($form->dbconnect(\%myconfig)); + } + # /saving the history + + $form->redirect( + $form->{label} . " $form->{invnumber} " . $locale->text('posted!')); + } $form->error($locale->text('Cannot post invoice!')); } @@ -1581,9 +1624,15 @@ 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();