X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fdn.pl;h=6c3492b983ed66260d4a624c69aa36d67a31f901;hb=71e8211613ad1bfb473f33588521d70c27be1de3;hp=51e046c8693a135fb16216d5b6a7f89576f1b37e;hpb=57bf9c89a037036fcf433de39643778854defe51;p=kivitendo-erp.git diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 51e046c86..6c3492b98 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -102,7 +102,7 @@ sub add { $form->{SHOW_CUSTOMER_SELECTION} = $form->{all_customer} && scalar @{ $form->{all_customer} }; $form->{SHOW_DUNNING_LEVEL_SELECTION} = $form->{DUNNING} && scalar @{ $form->{DUNNING} }; - $form->{SHOW_DEPARTMENT_SELECTION} = $form->{all_departments} && scalar @{ $form->{all_departments} }; + $form->{SHOW_DEPARTMENT_SELECTION} = $form->{all_departments} && scalar @{ $form->{all_departments} || [] }; $form->{title} = $locale->text('Start Dunning Process'); $form->{jsscript} = 1; @@ -132,7 +132,7 @@ sub show_invoices { if ($row->{next_dunning_config_id}) { map { $_->{SELECTED} = $_->{id} == $row->{next_dunning_config_id} } @{ $row->{DUNNING_CONFIG } }; } - map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount fee interest); + map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount open_amount fee interest); } $form->get_lists('printers' => 'printers', @@ -176,9 +176,9 @@ sub save { DN->save_config(\%myconfig, \%$form); # saving the history if(!exists $form->{addition} && $form->{id} ne "") { - $form->{snumbers} = qq|dunning_id_| . $form->{"dunning_id"}; + $form->{snumbers} = qq|dunning_id_| . $form->{"dunning_id"}; $form->{addition} = "SAVED FOR DUNNING"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history $form->redirect($locale->text('Dunning Process Config saved!')); @@ -222,7 +222,7 @@ sub save_dunning { foreach my $level (values %{ $levels }) { next unless scalar @{ $level }; - DN->save_dunning(\%myconfig, $form, $level, $main::userspath, $main::spool); + DN->save_dunning(\%myconfig, $form, $level); } } @@ -235,7 +235,7 @@ sub save_dunning { "customer_id" => $form->{"customer_id_$i"}, "next_dunning_config_id" => $form->{"next_dunning_config_id_$i"}, "email" => $form->{"email_$i"}, } ]; - DN->save_dunning(\%myconfig, $form, $level, $main::userspath, $main::spool); + DN->save_dunning(\%myconfig, $form, $level); } } @@ -245,9 +245,9 @@ sub save_dunning { # saving the history if(!exists $form->{addition} && $form->{id} ne "") { - $form->{snumbers} = qq|dunning_id_| . $form->{"dunning_id"}; + $form->{snumbers} = qq|dunning_id_| . $form->{"dunning_id"}; $form->{addition} = "DUNNING STARTED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history @@ -284,7 +284,8 @@ sub search { $main::auth->assert('dunning_edit'); $form->get_lists("customers" => "ALL_CUSTOMERS", - "departments" => "ALL_DEPARTMENTS"); + "departments" => "ALL_DEPARTMENTS", + "salesmen" => "ALL_SALESMEN"); DN->get_config(\%myconfig, \%$form); @@ -295,6 +296,7 @@ sub search { $form->{jsscript} = 1; $form->{title} = $locale->text('Dunnings'); $form->{fokus} = "search.customer"; + $form->{salesman_labels} = sub { $_[0]->{"name"} || $_[0]->{"login"} }; $form->header(); @@ -314,12 +316,12 @@ sub show_dunning { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; - my $cgi = $main::cgi; + my $cgi = $::request->{cgi}; $main::auth->assert('dunning_edit'); my @filter_field_list = qw(customer_id customer dunning_level department_id invnumber ordnumber - transdatefrom transdateto dunningfrom dunningto notes showold); + transdatefrom transdateto dunningfrom dunningto notes showold l_salesman salesman_id); report_generator_set_default_sort('customername', 1); @@ -358,23 +360,24 @@ sub show_dunning { 'dunning_duedate' => { 'text' => $locale->text('Dunning Duedate') }, 'fee' => { 'text' => $locale->text('Total Fees') }, 'interest' => { 'text' => $locale->text('Interest') }, + 'salesman' => { 'text' => $locale->text('Salesperson'), 'visible' => $form->{l_salesman} ? 1 : 0 }, ); $report->set_columns(%column_defs); $report->set_column_order(qw(checkbox dunning_description customername invnumber transdate - duedate amount dunning_date dunning_duedate fee interest)); + duedate amount dunning_date dunning_duedate fee interest salesman)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); - my $edit_url = build_std_url('script=is.pl', 'action=edit', 'callback') . '&id='; + my $edit_url = sub { build_std_url('script=' . ($_[0]->{invoice} ? 'is' : 'ar') . '.pl', 'action=edit', 'callback') . '&id=' . $::form->escape($_[0]->{id}) }; my $print_url = build_std_url('action=print_dunning', 'format=pdf', 'media=screen') . '&dunning_id='; my $sort_url = build_std_url('action=show_dunning', grep { $form->{$_} } @filter_field_list); - foreach my $name (qw(dunning_description customername invnumber transdate duedate dunning_date dunning_duedate)) { + foreach my $name (qw(dunning_description customername invnumber transdate duedate dunning_date dunning_duedate salesman)) { my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; $column_defs{$name}->{link} = $sort_url . "&sort=$name&sortdir=$sortdir"; } - my %alignment = map { $_ => 'right' } qw(transdate duedate amount dunning_date dunning_duedate fee interest); + my %alignment = map { $_ => 'right' } qw(transdate duedate amount dunning_date dunning_duedate fee interest salesman); my ($current_dunning_rows, $previous_dunning_id, $first_row_for_dunning); @@ -400,8 +403,9 @@ sub show_dunning { 'align' => $alignment{$column}, - 'link' => ($column eq 'invnumber' ? $edit_url . E($ref->{id}) : - $column eq 'dunning_description' ? $print_url . E($ref->{dunning_id}) : ''), + 'link' => ( $column eq 'invnumber' ? $edit_url->($ref) + : $column eq 'dunning_description' ? $print_url . E($ref->{dunning_id}) + : ''), }; }