projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Dokumentation
[kivitendo-erp.git]
/
bin
/
mozilla
/
dn.pl
diff --git
a/bin/mozilla/dn.pl
b/bin/mozilla/dn.pl
index
ad16f0e
..
132286f
100644
(file)
--- a/
bin/mozilla/dn.pl
+++ b/
bin/mozilla/dn.pl
@@
-39,14
+39,21
@@
use SL::DN;
use SL::ReportGenerator;
require "bin/mozilla/common.pl";
use SL::ReportGenerator;
require "bin/mozilla/common.pl";
-require "bin/mozilla/report
_
generator.pl";
+require "bin/mozilla/reportgenerator.pl";
require "bin/mozilla/io.pl";
require "bin/mozilla/io.pl";
-require "bin/mozilla/arap.pl";
+
+use strict;
1;
sub edit_config {
1;
sub edit_config {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
DN->get_config(\%myconfig, \%$form);
$form->get_lists('charts' => { 'key' => 'ALL_CHARTS',
DN->get_config(\%myconfig, \%$form);
$form->get_lists('charts' => { 'key' => 'ALL_CHARTS',
@@
-70,19
+77,23
@@
sub edit_config {
}
}
}
}
- $form->{title} = $locale->text('Edit Dunning Process Config');
- $form->{callback} ||= build_std_url("action=edit_config");
- $form->{rowcount} = 1 + scalar @{ $form->{DUNNING} };
- $form->{rowcount_odd} = $form->{rowcount} % 2;
+ $form->{title} = $locale->text('Edit Dunning Process Config');
+ $form->{callback} ||= build_std_url("action=edit_config");
$form->header();
print $form->parse_html_template("dunning/edit_config");
$form->header();
print $form->parse_html_template("dunning/edit_config");
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub add {
}
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('dunning_edit');
# setup customer selection
$form->all_vc(\%myconfig, "customer", "AR");
# setup customer selection
$form->all_vc(\%myconfig, "customer", "AR");
@@
-91,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_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;
$form->{title} = $locale->text('Start Dunning Process');
$form->{jsscript} = 1;
@@
-100,11
+111,17
@@
sub add {
print $form->parse_html_template("dunning/add");
print $form->parse_html_template("dunning/add");
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub show_invoices {
}
sub show_invoices {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('dunning_edit');
DN->get_invoices(\%myconfig, \%$form);
$form->{title} = $locale->text('Start Dunning Process');
DN->get_invoices(\%myconfig, \%$form);
$form->{title} = $locale->text('Start Dunning Process');
@@
-115,7
+132,7
@@
sub show_invoices {
if ($row->{next_dunning_config_id}) {
map { $_->{SELECTED} = $_->{id} == $row->{next_dunning_config_id} } @{ $row->{DUNNING_CONFIG } };
}
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',
}
$form->get_lists('printers' => 'printers',
@@
-124,22
+141,28
@@
sub show_invoices {
$form->{type} = 'dunning';
$form->{rowcount} = scalar @{ $form->{DUNNINGS} };
$form->{jsscript} = 1;
$form->{type} = 'dunning';
$form->{rowcount} = scalar @{ $form->{DUNNINGS} };
$form->{jsscript} = 1;
- $form->{callback} ||= build_std_url("action=show_invoices", qw(
login password
customer invnumber ordnumber groupinvoices minamount dunning_level notes));
+ $form->{callback} ||= build_std_url("action=show_invoices", qw(customer invnumber ordnumber groupinvoices minamount dunning_level notes));
- $form->{PRINT_OPTIONS} = print_options(
{
'inline' => 1,
-
'no_queue' => 1,
-
'no_postscript' => 1,
-
'no_html' => 1,
-
'no_opendocument' => 1, }
);
+ $form->{PRINT_OPTIONS} = print_options('inline' => 1,
+ 'no_queue' => 1,
+ 'no_postscript' => 1,
+ 'no_html' => 1,
+
'no_opendocument' => 1,
);
$form->header();
print $form->parse_html_template("dunning/show_invoices");
$form->header();
print $form->parse_html_template("dunning/show_invoices");
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub save {
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
for my $i (1 .. $form->{rowcount}) {
if ($form->{"dunning_description_$i"} ne "") {
for my $i (1 .. $form->{rowcount}) {
if ($form->{"dunning_description_$i"} ne "") {
@@
-153,18
+176,24
@@
sub save {
DN->save_config(\%myconfig, \%$form);
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
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->{addition} = "SAVED FOR DUNNING";
-
$form->save_history($form->dbconnect(\%myconfig))
;
+
$form->save_history
;
}
# /saving the history
$form->redirect($locale->text('Dunning Process Config saved!'));
}
# /saving the history
$form->redirect($locale->text('Dunning Process Config saved!'));
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub save_dunning {
}
sub save_dunning {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('dunning_edit');
my $active=1;
my @rows = ();
my $active=1;
my @rows = ();
@@
-193,7
+222,7
@@
sub save_dunning {
foreach my $level (values %{ $levels }) {
next unless scalar @{ $level };
foreach my $level (values %{ $levels }) {
next unless scalar @{ $level };
- DN->save_dunning(\%myconfig, $form, $level
, $userspath, $spool, $sendmail
);
+ DN->save_dunning(\%myconfig, $form, $level);
}
}
}
}
@@
-206,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"}, } ];
"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
, $userspath, $spool, $sendmail
);
+ DN->save_dunning(\%myconfig, $form, $level);
}
}
}
}
@@
-216,9
+245,9
@@
sub save_dunning {
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
# 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->{addition} = "DUNNING STARTED";
-
$form->save_history($form->dbconnect(\%myconfig))
;
+
$form->save_history
;
}
# /saving the history
}
# /saving the history
@@
-227,24
+256,36
@@
sub save_dunning {
$form->redirect($locale->text('Dunning Process started for selected invoices!'));
}
$form->redirect($locale->text('Dunning Process started for selected invoices!'));
}
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub set_email {
}
sub set_email {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('dunning_edit');
$form->{"title"} = $locale->text("Set eMail text");
$form->header();
print($form->parse_html_template("dunning/set_email"));
$form->{"title"} = $locale->text("Set eMail text");
$form->header();
print($form->parse_html_template("dunning/set_email"));
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub search {
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('dunning_edit');
$form->get_lists("customers" => "ALL_CUSTOMERS",
$form->get_lists("customers" => "ALL_CUSTOMERS",
- "departments" => "ALL_DEPARTMENTS");
+ "departments" => "ALL_DEPARTMENTS",
+ "salesmen" => "ALL_SALESMEN");
DN->get_config(\%myconfig, \%$form);
DN->get_config(\%myconfig, \%$form);
@@
-253,8
+294,9
@@
sub search {
$form->{SHOW_DUNNING_LEVELS} = scalar @{ $form->{DUNNING} };
$form->{jsscript} = 1;
$form->{SHOW_DUNNING_LEVELS} = scalar @{ $form->{DUNNING} };
$form->{jsscript} = 1;
- $form->{title} = $locale->text('
Search Dunning
');
+ $form->{title} = $locale->text('
Dunnings
');
$form->{fokus} = "search.customer";
$form->{fokus} = "search.customer";
+ $form->{salesman_labels} = sub { $_[0]->{"name"} || $_[0]->{"login"} };
$form->header();
$form->header();
@@
-264,15
+306,24
@@
sub search {
print $form->parse_html_template("dunning/search");
print $form->parse_html_template("dunning/search");
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub show_dunning {
}
sub show_dunning {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $::request->{cgi};
+
+ $main::auth->assert('dunning_edit');
my @filter_field_list = qw(customer_id customer dunning_level department_id invnumber ordnumber
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);
DN->get_dunning(\%myconfig, \%$form);
DN->get_dunning(\%myconfig, \%$form);
@@
-284,20
+335,20
@@
sub show_dunning {
'languages' => 'languages');
$form->{type} = 'dunning';
'languages' => 'languages');
$form->{type} = 'dunning';
- $form->{PRINT_OPTIONS} = print_options(
{
'inline' => 1,
-
'no_queue' => 1,
-
'no_postscript' => 1,
-
'no_html' => 1,
-
'no_opendocument' => 1, }
);
+ $form->{PRINT_OPTIONS} = print_options('inline' => 1,
+ 'no_queue' => 1,
+ 'no_postscript' => 1,
+ 'no_html' => 1,
+
'no_opendocument' => 1,
);
$form->{title} = $locale->text('Dunning overview');
my $report = SL::ReportGenerator->new(\%myconfig, $form);
$report->set_options('std_column_visibility' => 1,
'title' => $form->{title});
$form->{title} = $locale->text('Dunning overview');
my $report = SL::ReportGenerator->new(\%myconfig, $form);
$report->set_options('std_column_visibility' => 1,
'title' => $form->{title});
- $report->set_export_options('show_dunning', @filter_field_list);
+ $report->set_export_options('show_dunning', @filter_field_list
, qw(sort sortdir)
);
-
$report->set_columns
(
+
my %column_defs =
(
'checkbox' => { 'text' => '', 'visible' => 'HTML' },
'dunning_description' => { 'text' => $locale->text('Dunning Level') },
'customername' => { 'text' => $locale->text('Customername') },
'checkbox' => { 'text' => '', 'visible' => 'HTML' },
'dunning_description' => { 'text' => $locale->text('Dunning Level') },
'customername' => { 'text' => $locale->text('Customername') },
@@
-309,15
+360,24
@@
sub show_dunning {
'dunning_duedate' => { 'text' => $locale->text('Dunning Duedate') },
'fee' => { 'text' => $locale->text('Total Fees') },
'interest' => { 'text' => $locale->text('Interest') },
'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
$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 $print_url = build_std_url('action=print_dunning', 'format=pdf', 'media=screen') . '&dunning_id=';
my $edit_url = build_std_url('script=is.pl', 'action=edit', 'callback') . '&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 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);
my ($current_dunning_rows, $previous_dunning_id, $first_row_for_dunning);
@@
-327,7
+387,7
@@
sub show_dunning {
my $i = 0;
my $i = 0;
- foreach $ref (@{ $form->{DUNNINGS} }) {
+ foreach
my
$ref (@{ $form->{DUNNINGS} }) {
$i++;
if ($previous_dunning_id != $ref->{dunning_id}) {
$i++;
if ($previous_dunning_id != $ref->{dunning_id}) {
@@
-348,7
+408,7
@@
sub show_dunning {
};
}
};
}
- $row->{checkbox} = {
+ $row->{checkbox} =
!$first_row_for_dunning ? { } :
{
'raw_data' => $cgi->hidden('-name' => "dunning_id_$i", '-value' => $ref->{dunning_id})
. $cgi->checkbox('-name' => "selected_$i", '-value' => 1, '-label' => ''),
'valign' => 'center',
'raw_data' => $cgi->hidden('-name' => "dunning_id_$i", '-value' => $ref->{dunning_id})
. $cgi->checkbox('-name' => "selected_$i", '-value' => 1, '-label' => ''),
'valign' => 'center',
@@
-366,19
+426,23
@@
sub show_dunning {
$report->set_options('raw_top_info_text' => $form->parse_html_template('dunning/show_dunning_top'),
'raw_bottom_info_text' => $form->parse_html_template('dunning/show_dunning_bottom'),
'output_format' => 'HTML',
$report->set_options('raw_top_info_text' => $form->parse_html_template('dunning/show_dunning_top'),
'raw_bottom_info_text' => $form->parse_html_template('dunning/show_dunning_bottom'),
'output_format' => 'HTML',
- 'attachment_basename' =>
strftime('dunning_report
_%Y%m%d', localtime time),
+ 'attachment_basename' =>
$locale->text('dunning_list') . strftime('
_%Y%m%d', localtime time),
);
$report->set_options_from_form();
$report->generate_with_headers();
);
$report->set_options_from_form();
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub print_dunning {
}
sub print_dunning {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+
+ $main::auth->assert('dunning_edit');
$form->{rowcount} = 1;
$form->{selected_1} = 1;
$form->{rowcount} = 1;
$form->{selected_1} = 1;
@@
-386,11
+450,17
@@
sub print_dunning {
print_multiple();
print_multiple();
- $lxdebug->leave_sub();
+ $
main::
lxdebug->leave_sub();
}
sub print_multiple {
}
sub print_multiple {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('dunning_edit');
$form->{title} = $locale->text('Print dunnings');
$form->{title} = $locale->text('Print dunnings');
@@
-420,7
+490,11
@@
sub print_multiple {
$form->redirect($locale->text('Could not print dunning.'));
}
$form->redirect($locale->text('Could not print dunning.'));
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
+}
+
+sub continue {
+ call_sub($main::form->{nextsub});
}
# end of main
}
# end of main