use strict;
-our (%myconfig, $form);
-
sub post_transaction {
$main::lxdebug->enter_sub();
my ($self, $form) = @_;
- my ($exchangerate, $key, $akey, $i, $j, $k, $index, $taxamount, $totaltax, $taxrate, $diff, $totalwithholding, $withholdingrate,
+ my ($exchangerate, $akey, $j, $k, $index, $taxamount, $totaltax, $taxrate, $diff, $totalwithholding, $withholdingrate,
$totalamount, $taxincluded, $tax);
# forex
$form->{forex} = $form->{exchangerate};
$exchangerate = $form->{exchangerate} ? $form->{exchangerate} : 1;
- foreach $key (keys %{ $form->{AR_links} }) {
+ foreach my $key (keys %{ $form->{AR_links} }) {
# if there is a value we have an old entry
$j = 0;
$k = 0;
- for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
+ next unless $form->{acc_trans}{$key};
+
+ for my $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
if ($key eq "AR_paid") {
$j++;
$form->{"AR_paid_$j"} = $form->{acc_trans}{$key}->[$i-1]->{accno};
if ($form->{taxincluded} && $form->{taxrate} && $totalamount) {
# add tax to amounts and invtotal
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
$taxamount = ($totaltax + $totalwithholding) * $form->{"amount_$i"} / $totalamount;
$tax = $form->round_amount($taxamount, 2);
$diff += ($taxamount - $tax);
qq| AND ac.chart_id = ? | .
qq| AND ac.trans_id = a.id | .
qq| AND a.vendor_id = v.id | .
- qq| AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL)| .
+ qq| AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL)|;
push(@values,
@where_values, @department_values, @project_values, $id,
@where_values, @department_values, @project_values, $id,
package SL::ReportGenerator;
-#use strict;
-
+use Data::Dumper;
use Encode;
use IO::Wrap;
use List::Util qw(max);
next;
}
- my $col = $row->{$col_name};
+ my $col = $row->{$col_name} || { data => [] };
$col->{CELL_ROWS} = [ ];
foreach my $i (0 .. scalar(@{ $col->{data} }) - 1) {
push @{ $col->{CELL_ROWS} }, {
#$stichtag =~ /([\d]\d)(\d\d)$/
#$stichtag = "$1.$2.$yy"
#$stichtag=$1;
- our $description; # most probably not existant.
- our $tage_bis; # most probably not existant.
- our $ical; # most probably not existant.
+ our $description; # most probably not existent.
+ our $tage_bis; # most probably not existent.
+ our $ical; # most probably not existent.
$main::lxdebug->leave_sub();
return ($stichtag, $description, $tage_bis, $ical);
#
#######################################################################
-#use strict;
+use strict;
BEGIN {
unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML).
require "bin/mozilla/common.pl";
+use strict;
+
sub analyze_filter {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{jsscript} = 1;
$form->{title} = $locale->text('General ledger corrections');
$form->header();
print $form->parse_html_template('acctranscorrections/analyze_filter');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub analyze {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text('General ledger corrections');
if (!scalar @problems) {
$form->show_generic_information($locale->text('No problems were recognized.'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
'callback' => $callback,
});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub assistant {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text('Assistant for general ledger corrections');
$form->show_generic_information($locale->text('The assistant could not find anything wrong with #1. Maybe the problem has been solved in the meantime.',
"$module $form->{trans_reference}"));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
$form->show_generic_error($locale->text('Unknown problem type.'));
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub assistant_for_ap_ar_wrong_taxkeys {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text('Assistant for general ledger corrections');
$form->header();
print $form->parse_html_template('acctranscorrections/assistant_for_ap_ar_wrong_taxkeys');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub fix_ap_ar_wrong_taxkeys {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my $analyzer = AccTransCorrections->new();
$analyzer->fix_ap_ar_wrong_taxkeys();
$form->header();
print $form->parse_html_template('acctranscorrections/fix_ap_ar_wrong_taxkeys');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub assistant_for_invoice_inventory_with_taxkeys {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text('Assistant for general ledger corrections');
$form->header();
print $form->parse_html_template('acctranscorrections/assistant_for_invoice_inventory_with_taxkeys');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub fix_invoice_inventory_with_taxkeys {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my $analyzer = AccTransCorrections->new();
$analyzer->fix_invoice_inventory_with_taxkeys();
$form->header();
print $form->parse_html_template('acctranscorrections/fix_invoice_inventory_with_taxkeys');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub assistant_for_wrong_taxes {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my $problem = shift;
$form->header();
print $form->parse_html_template('acctranscorrections/assistant_for_wrong_taxes', { 'problem' => $problem, });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub assistant_for_wrong_taxkeys {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my $problem = shift;
$form->header();
print $form->parse_html_template('acctranscorrections/assistant_for_wrong_taxkeys', { 'problem' => $problem, });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub fix_wrong_taxkeys {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my $fixes = ref $form->{fixes} eq 'ARRAY' ? $form->{fixes} : [];
$form->header();
print $form->parse_html_template('acctranscorrections/fix_wrong_taxkeys');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_transaction {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text('Delete transaction');
$form->header();
print $form->parse_html_template('acctranscorrections/delete_transaction');
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub redirect {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
$form->redirect('Missing callbcak');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub dispatcher {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
foreach my $action (qw(fix_wrong_taxkeys delete_transaction)) {
if ($form->{"action_${action}"}) {
call_sub($action);
#
#======================================================================
-$menufile = "menu.ini";
+my $menufile = "menu.ini";
use DBI;
use CGI;
require "bin/mozilla/common.pl";
require "bin/mozilla/admin_groups.pl";
-our $cgi = new CGI('');
-
-$form = new Form;
-
-$locale = new Locale $language, "admin";
+use strict;
+our $cgi = new CGI('');
+our $form = new Form;
+our $locale = new Locale $main::language, "admin";
our $auth = SL::Auth->new();
+
if ($auth->session_tables_present()) {
$auth->expire_sessions();
$auth->restore_session();
$form->{favicon} = "favicon.ico";
if ($form->{action}) {
- if ($auth->authenticate_root($form->{rpw}, 0) != Auth::OK) {
+ if ($auth->authenticate_root($form->{rpw}, 0) != $auth->OK()) {
$form->{error_message} = $locale->text('Incorrect Password!');
adminlogin();
exit;
call_sub($locale->findsub($form->{action}));
-} elsif ($auth->authenticate_root($form->{rpw}, 0) == Auth::OK) {
+} elsif ($auth->authenticate_root($form->{rpw}, 0) == $auth->OK()) {
$auth->create_or_refresh_session() if ($auth->session_tables_present());
# end
sub adminlogin {
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = qq|Lx-Office ERP $form->{version} | . $locale->text('Administration');
}
sub logout {
- $auth->destroy_session();
+ $main::auth->destroy_session();
adminlogin();
}
sub check_auth_db_and_tables {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
my %params;
- map { $params{"db_${_}"} = $auth->{DB_config}->{$_} } keys %{ $auth->{DB_config} };
+ map { $params{"db_${_}"} = $main::auth->{DB_config}->{$_} } keys %{ $auth->{DB_config} };
- if (!$auth->check_database()) {
+ if (!$main::auth->check_database()) {
$form->{title} = $locale->text('Authentification database creation');
$form->header();
print $form->parse_html_template('admin/check_auth_database', \%params);
exit 0;
}
- if (!$auth->check_tables()) {
+ if (!$main::auth->check_tables()) {
$form->{title} = $locale->text('Authentification tables creation');
$form->header();
print $form->parse_html_template('admin/check_auth_tables', \%params);
exit 0;
}
- if (-f $memberfile) {
+ if (-f $main::memberfile) {
my $memberdir = "";
- if ($memberfile =~ m|^.*/|) {
+ if ($main::memberfile =~ m|^.*/|) {
$memberdir = $&;
}
$form->{title} = $locale->text('User data migration');
$form->header();
- print $form->parse_html_template('admin/user_migration', { 'memberfile' => $memberfile,
+ print $form->parse_html_template('admin/user_migration', { 'memberfile' => $main::memberfile,
'backupdir' => $backupdir });
exit 0
}
sub create_auth_db {
- $auth->create_database('superuser' => $form->{db_superuser},
+ my $form = $main::form;
+
+ $main::auth->create_database('superuser' => $form->{db_superuser},
'superuser_password' => $form->{db_superuser_password},
'template' => $form->{db_template});
login();
}
sub create_auth_tables {
- $auth->create_tables();
- $auth->set_session_value('rpw', $form->{rpw});
- $auth->create_or_refresh_session();
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->create_tables();
+ $main::auth->set_session_value('rpw', $form->{rpw});
+ $main::auth->create_or_refresh_session();
- if (!-f $memberfile) {
+ if (!-f $main::memberfile) {
# New installation -- create a standard group with full access
+ my %members;
my $group = {
'name' => $locale->text('Full Access'),
'description' => $locale->text('Full access to all functions'),
'members' => [ map { $_->{id} } values %members ],
};
- $auth->save_group($group);
+ $main::auth->save_group($group);
}
login();
}
sub migrate_users {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my $memberdir = "";
- if ($memberfile =~ m|^.*/|) {
+ if ($main::memberfile =~ m|^.*/|) {
$memberdir = $&;
}
$form->error(sprintf($locale->text('The directory "%s" could not be created:\n%s'), $backupdir, $!));
}
- copy $memberfile, "users/member-file-migration/members";
+ copy $main::memberfile, "users/member-file-migration/members";
- my $in = IO::File->new($memberfile, "r");
+ my $in = IO::File->new($main::memberfile, "r");
$form->error($locale->text('Could not open the old memberfile.')) if (!$in);
map { $_->{dbpasswd} = unpack 'u', $_->{dbpasswd} } values %members;
while (my ($login, $params) = each %members) {
- $auth->save_user($login, %{ $params });
- $auth->change_password($login, $params->{password}, 1);
+ $main::auth->save_user($login, %{ $params });
+ $main::auth->change_password($login, $params->{password}, 1);
my $conf_file = "${memberdir}${login}.conf";
}
}
- unlink $memberfile;
+ unlink $main::memberfile;
my @member_list = sort { lc $a->{login} cmp lc $b->{login} } values %members;
$form->header();
print $form->parse_html_template('admin/user_migration_done', { 'MEMBERS' => \@member_list });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_standard_group_ask {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{title} = $locale->text('Create a standard group');
$form->header();
}
sub create_standard_group {
- my %members = $auth->read_all_users();
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ my %members = $main::auth->read_all_users();
- my $groups = $auth->read_groups();
+ my $groups = $main::auth->read_groups();
foreach my $group (values %{$groups}) {
if (($form->{group_id} != $group->{id})
'members' => [ map { $_->{id} } values %members ],
};
- $auth->save_group($group);
+ $main::auth->save_group($group);
user_migration_complete(1);
}
sub user_migration_complete {
my $standard_group_created = shift;
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{title} = $locale->text('User migration complete');
$form->header();
}
sub list_users {
- my %members = $auth->read_all_users();
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ my %members = $main::auth->read_all_users();
delete $members{"root login"};
map { $_->{templates} =~ s|.*/||; } values %members;
$form->{title} = "Lx-Office ERP " . $locale->text('Administration');
- $form->{LOCKED} = -e "$userspath/nologin";
+ $form->{LOCKED} = -e "$main::userspath/nologin";
$form->{MEMBERS} = [ @members{sort { lc $a cmp lc $b } keys %members} ];
$form->header();
sub add_user {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{title} =
"Lx-Office ERP "
. $locale->text('Administration') . " / "
}
sub edit_user {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{title} =
"Lx-Office ERP "
sub edit_user_form {
my ($myconfig) = @_;
+ my $form = $main::form;
+ my $locale = $main::locale;
+
my @valid_dateformats = qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd);
$form->{ALL_DATEFORMATS} = [ map { { "format" => $_, "selected" => $_ eq $myconfig->{dateformat} } } @valid_dateformats ];
- my @valid_numberformats = qw(1,000.00 1000.00 1.000,00 1000,00);
+ my @valid_numberformats = ('1,000.00', '1000.00', '1.000,00', '1000,00');
$form->{ALL_NUMBERFORMATS} = [ map { { "format" => $_, "selected" => $_ eq $myconfig->{numberformat} } } @valid_numberformats ];
- %countrycodes = User->country_codes;
+ my %countrycodes = User->country_codes;
$form->{ALL_COUNTRYCODES} = [];
- foreach $countrycode (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
+ foreach my $countrycode (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
push @{ $form->{ALL_COUNTRYCODES} }, { "value" => $countrycode,
"name" => $countrycodes{$countrycode},
"selected" => $countrycode eq $myconfig->{countrycode} };
}
# is there a templates basedir
- if (!-d "$templates") {
- $form->error(sprintf($locale->text("The directory %s does not exist."), $templates));
+ if (!-d "$main::templates") {
+ $form->error(sprintf($locale->text("The directory %s does not exist."), $main::templates));
}
- opendir TEMPLATEDIR, "$templates/." or $form->error("$templates : $ERRNO");
+ opendir TEMPLATEDIR, "$main::templates/." or $form->error("$main::templates : $ERRNO");
my @all = readdir(TEMPLATEDIR);
- my @alldir = sort grep { -d "$templates/$_" && !/^\.\.?$/ } @all;
- my @allhtml = sort grep { -f "$templates/$_" && /\.html$/ } @all;
+ my @alldir = sort grep { -d "$main::templates/$_" && !/^\.\.?$/ } @all;
+ my @allhtml = sort grep { -f "$main::templates/$_" && /\.html$/ } @all;
closedir TEMPLATEDIR;
@alldir = grep !/\.(html|tex|sty|odt|xml|txb)$/, @alldir;
$form->{ALL_TEMPLATES} = [ map { { "name", => $_, "selected" => $_ eq $myconfig->{templates} } } @alldir ];
- $lastitem = $allhtml[0];
+ my $lastitem = $allhtml[0];
$lastitem =~ s/-.*//g;
$form->{ALL_MASTER_TEMPLATES} = [ { "name" => $lastitem, "selected" => $lastitem eq "German" } ];
- foreach $item (@allhtml) {
+ foreach my $item (@allhtml) {
$item =~ s/-.*//g;
next if ($item eq $lastitem);
my $groups = [];
if ($form->{edit}) {
- my $user_id = $auth->get_user_id($form->{login});
- my $all_groups = $auth->read_groups();
+ my $user_id = $main::auth->get_user_id($form->{login});
+ my $all_groups = $main::auth->read_groups();
foreach my $group (values %{ $all_groups }) {
push @{ $groups }, $group if (grep { $user_id == $_ } @{ $group->{members} });
$groups = [ sort { lc $a->{name} cmp lc $b->{name} } @{ $groups } ];
}
- $form->{CAN_CHANGE_PASSWORD} = $auth->can_change_password();
+ $form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password();
$form->header();
print $form->parse_html_template("admin/edit_user", { 'GROUPS' => $groups });
}
sub save_user {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{dbdriver} = 'Pg';
# no spaces allowed in login name
# check for duplicates
if (!$form->{edit}) {
- my %members = $auth->read_all_users();
+ my %members = $main::auth->read_all_users();
if ($members{$form->{login}}) {
$form->show_generic_error($locale->text('Another user with the login #1 does already exist.', $form->{login}), 'back_button' => 1);
}
}
# is there a basedir
- if (!-d "$templates") {
- $form->error(sprintf($locale->text("The directory %s does not exist."), $templates));
+ if (!-d "$main::templates") {
+ $form->error(sprintf($locale->text("The directory %s does not exist."), $main::templates));
}
# add base directory to $form->{templates}
$form->{templates} =~ s|.*/||;
- $form->{templates} = "$templates/$form->{templates}";
+ $form->{templates} = "$main::templates/$form->{templates}";
- $myconfig = new User($form->{login});
+ my $myconfig = new User($form->{login});
$form->isblank("dbname", $locale->text('Dataset missing!'));
$form->isblank("dbuser", $locale->text('Database User missing!'));
- foreach $item (keys %{$form}) {
+ foreach my $item (keys %{$form}) {
$myconfig->{$item} = $form->{$item};
}
$myconfig->save_member();
- if ($auth->can_change_password()
+ if ($main::auth->can_change_password()
&& defined $form->{new_password}
&& ($form->{new_password} ne '********')) {
- $auth->change_password($form->{login}, $form->{new_password});
+ $main::auth->change_password($form->{login}, $form->{new_password});
}
- if ($webdav) {
- @webdavdirs =
+ my ($login, $password, $newfile);
+ if ($main::webdav) {
+ my @webdavdirs =
qw(angebote bestellungen rechnungen anfragen lieferantenbestellungen einkaufsrechnungen);
- foreach $directory (@webdavdirs) {
- $file = "webdav/" . $directory . "/webdav-user";
+ foreach my $directory (@webdavdirs) {
+ my $file = "webdav/" . $directory . "/webdav-user";
if ($form->{$directory}) {
if (open(HTACCESS, "$file")) {
while (<HTACCESS>) {
}
$form->{templates} =~ s|.*/||;
- $form->{templates} = "${templates}/$form->{templates}";
+ $form->{templates} = "$main::templates/$form->{templates}";
$form->{mastertemplates} =~ s|.*/||;
# create user template directory and copy master files
umask(007);
# copy templates to the directory
- opendir TEMPLATEDIR, "$templates/." or $form - error("$templates : $ERRNO");
- @templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|odt|xml|txb)$/,
+ opendir TEMPLATEDIR, "$main::templates/." or $form->error("$main::templates : $ERRNO");
+ my @templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|odt|xml|txb)$/,
readdir TEMPLATEDIR;
closedir TEMPLATEDIR;
- foreach $file (@templates) {
- open(TEMP, "$templates/$file")
- or $form->error("$templates/$file : $ERRNO");
+ foreach my $file (@templates) {
+ open(TEMP, "$main::templates/$file")
+ or $form->error("$main::templates/$file : $ERRNO");
$file =~ s/\Q$form->{mastertemplates}\E-//;
open(NEW, ">$form->{templates}/$file")
or $form->error("$form->{templates}/$file : $ERRNO");
- while ($line = <TEMP>) {
+ while (my $line = <TEMP>) {
print NEW $line;
}
close(TEMP);
# Add new user to his groups.
if (ref $form->{new_user_group_ids} eq 'ARRAY') {
- my $all_groups = $auth->read_groups();
- my %user = $auth->read_user($form->{login});
+ my $all_groups = $main::auth->read_groups();
+ my %user = $main::auth->read_user($form->{login});
foreach my $group_id (@{ $form->{new_user_group_ids} }) {
my $group = $all_groups->{$group_id};
next if !$group;
push @{ $group->{members} }, $user{id};
- $auth->save_group($group);
+ $main::auth->save_group($group);
}
}
}
sub save_user_as_new {
+ my $form = $main::form;
+
$form->{login} = $form->{new_user_login};
delete @{$form}{qw(edit new_user_login)};
}
sub delete_user {
- my %members = $auth->read_all_users();
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ my %members = $main::auth->read_all_users();
my $templates = $members{$form->{login}}->{templates};
- $auth->delete_user($form->{login});
+ $main::auth->delete_user($form->{login});
if ($templates) {
my $templates_in_use = 0;
- foreach $login (keys %members) {
+ foreach my $login (keys %members) {
next if $form->{login} eq $login;
next if $members{$login}->{templates} ne $templates;
$templates_in_use = 1;
sub get_value {
my $line = shift;
+ my $form = $main::form;
+
my ($null, $value) = split(/=/, $line, 2);
# remove comments
}
sub pg_database_administration {
+ my $form = $main::form;
$form->{dbdriver} = 'Pg';
dbselect_source();
}
sub dbselect_source {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{dbport} = '5432';
$form->{dbuser} = 'postgres';
$form->{dbdefault} = 'template1';
}
sub test_db_connection {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{dbdriver} = 'Pg';
User::dbconnect_vars($form, $form->{dbname});
}
sub continue {
- call_sub($form->{"nextsub"});
-}
-
-sub back {
- call_sub($form->{"back_nextsub"});
+ call_sub($main::form->{"nextsub"});
}
sub update_dataset {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{title} =
"Lx-Office ERP "
. $locale->text('Database Administration') . " / "
}
sub dbupdate {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{stylesheet} = "lx-office-erp.css";
$form->{title} = $locale->text("Dataset upgrade");
$form->header();
}
sub create_dataset {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{dbsources} = join " ", map { "[${_}]" } sort User->dbsources($form);
$form->{CHARTS} = [];
- opendir SQLDIR, "sql/." or $form - error($ERRNO);
- foreach $item (sort grep /-chart\.sql\z/, readdir SQLDIR) {
+ opendir SQLDIR, "sql/." or $form->error($ERRNO);
+ foreach my $item (sort grep /-chart\.sql\z/, readdir SQLDIR) {
next if ($item eq 'Default-chart.sql');
$item =~ s/-chart\.sql//;
push @{ $form->{CHARTS} }, { "name" => $item,
}
closedir SQLDIR;
- my $default_charset = $dbcharset;
+ my $default_charset = $main::dbcharset;
$default_charset ||= Common::DEFAULT_CHARSET;
my $cluster_encoding = User->dbclusterencoding($form);
if ($cluster_encoding && ($cluster_encoding =~ m/^(?:UTF-?8|UNICODE)$/i)) {
- if ($dbcharset !~ m/^UTF-?8$/i) {
+ if ($main::dbcharset !~ m/^UTF-?8$/i) {
$form->show_generic_error($locale->text('The selected PostgreSQL installation uses UTF-8 as its encoding. ' .
'Therefore you have to configure Lx-Office to use UTF-8 as well.'),
'back_button' => 1);
}
sub dbcreate {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->isblank("db", $locale->text('Dataset missing!'));
User->dbcreate(\%$form);
}
sub delete_dataset {
- @dbsources = User->dbsources_unused($form);
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ my @dbsources = User->dbsources_unused($form);
$form->error($locale->text('Nothing to delete!')) unless @dbsources;
$form->{title} =
}
sub dbdelete {
+ my $form = $main::form;
+ my $locale = $main::locale;
if (!$form->{db}) {
$form->error($locale->text('No Dataset selected!'));
}
sub backup_dataset {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{title} =
"Lx-Office ERP "
. $locale->text('Database Administration') . " / "
. $locale->text('Backup Dataset');
- if ("$pg_dump_exe" eq "DISABLED") {
+ if ("$main::pg_dump_exe" eq "DISABLED") {
$form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.'));
}
}
sub backup_dataset_start {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{title} =
"Lx-Office ERP "
. $locale->text('Database Administration') . " / "
. $locale->text('Backup Dataset');
- $pg_dump_exe ||= "pg_dump";
+ $main::pg_dump_exe ||= "pg_dump";
- if ("$pg_dump_exe" eq "DISABLED") {
+ if ("$main::pg_dump_exe" eq "DISABLED") {
$form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.'));
}
push @args, ("-p", $form->{dbport}) if ($form->{dbport});
push @args, $form->{dbname};
- my $cmd = "${pg_dump_exe} " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args);
+ my $cmd = "$main::pg_dump_exe " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args);
my $name = "dataset_backup_$form->{dbname}_" . strftime("%Y%m%d", localtime()) . ".tar";
if ($form->{destination} ne "email") {
map { $mail->{$_} = $form->{$_} } qw(from to cc subject message);
- $mail->{charset} = $dbcharset ? $dbcharset : Common::DEFAULT_CHARSET;
+ $mail->{charset} = $main::dbcharset ? $main::dbcharset : Common::DEFAULT_CHARSET;
$mail->{attachments} = [ { "filename" => $tmp, "name" => $name } ];
$mail->send();
}
sub restore_dataset {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{title} =
"Lx-Office ERP "
. $locale->text('Database Administration') . " / "
. $locale->text('Restore Dataset');
- if ("$pg_restore_exe" eq "DISABLED") {
+ if ("$main::pg_restore_exe" eq "DISABLED") {
$form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.'));
}
- my $default_charset = $dbcharset;
+ my $default_charset = $main::dbcharset;
$default_charset ||= Common::DEFAULT_CHARSET;
$form->{DBENCODINGS} = [];
}
sub restore_dataset_start {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$form->{title} =
"Lx-Office ERP "
. $locale->text('Database Administration') . " / "
. $locale->text('Restore Dataset');
- $pg_restore_exe ||= "pg_restore";
+ $main::pg_restore_exe ||= "pg_restore";
- if ("$pg_restore_exe" eq "DISABLED") {
+ if ("$main::pg_restore_exe" eq "DISABLED") {
$form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.'));
}
push @args, ("-p", $form->{dbport}) if ($form->{dbport});
push @args, $tmp;
- my $cmd = "${pg_restore_exe} " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args);
+ my $cmd = "$main::pg_restore_exe " . join(" ", map { s/\\/\\\\/g; s/\"/\\\"/g; $_ } @args);
my $in = IO::File->new("$cmd 2>&1 |");
$form->error($locale->text('The pg_restore process could not be started.'));
}
- $AUTOFLUSH = 1;
+ $English::AUTOFLUSH = 1;
$form->header();
print $form->parse_html_template("admin/restore_dataset_start_header");
}
sub unlock_system {
+ my $form = $main::form;
+ my $locale = $main::locale;
- unlink "$userspath/nologin";
+ unlink "$main::userspath/nologin";
$form->{callback} = "admin.pl?action=list_users";
}
sub lock_system {
+ my $form = $main::form;
+ my $locale = $main::locale;
- open(FH, ">$userspath/nologin")
+ open(FH, ">$main::userspath/nologin")
or $form->error($locale->text('Cannot create Lock!'));
close(FH);
}
sub yes {
- call_sub($form->{yes_nextsub});
+ call_sub($main::form->{yes_nextsub});
}
sub no {
- call_sub($form->{no_nextsub});
+ call_sub($main::form->{no_nextsub});
}
sub add {
- call_sub($form->{add_nextsub});
+ call_sub($main::form->{add_nextsub});
}
sub edit {
+ my $form = $main::form;
+
$form->{edit_nextsub} ||= 'edit_user';
call_sub($form->{edit_nextsub});
}
sub delete {
+ my $form = $main::form;
+
$form->{delete_nextsub} ||= 'delete_user';
call_sub($form->{delete_nextsub});
}
sub save {
+ my $form = $main::form;
+
$form->{save_nextsub} ||= 'save_user';
call_sub($form->{save_nextsub});
}
sub back {
- call_sub($form->{back_nextsub});
+ call_sub($main::form->{back_nextsub});
}
sub dispatcher {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
foreach my $action (qw(create_standard_group dont_create_standard_group
save_user delete_user save_user_as_new)) {
if ($form->{"action_${action}"}) {
use List::MoreUtils qw(uniq);
+use strict;
+
sub edit_groups {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- my @groups = sort { lc $a->{name} cmp lc $b->{name} } values %{ $auth->read_groups() };
+ my @groups = sort { lc $a->{name} cmp lc $b->{name} } values %{ $main::auth->read_groups() };
$form->header();
print $form->parse_html_template("admin/edit_groups", { 'GROUPS' => \@groups,
'num_groups' => scalar @groups });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_group {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
delete $form->{group_id};
$form->{message} = $locale->text("The group has been added.");
save_group();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_group {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->isblank('name', $locale->text('The group name is missing.'));
- my $groups = $auth->read_groups();
+ my $groups = $main::auth->read_groups();
foreach my $group (values %{$groups}) {
if (($form->{group_id} != $group->{id})
my $is_new = !$form->{group_id};
- $auth->save_group($group);
+ $main::auth->save_group($group);
$form->{message} ||= $locale->text('The group has been saved.');
edit_group();
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_group {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- my $groups = $auth->read_groups();
+ my $groups = $main::auth->read_groups();
if (!$form->{group_id} || !$groups->{$form->{group_id}}) {
$form->show_generic_error($locale->text("No group has been selected, or the group does not exist anymore."));
}
- $group = $groups->{$form->{group_id}};
+ my $group = $groups->{$form->{group_id}};
- my %all_users = $auth->read_all_users();
+ my %all_users = $main::auth->read_all_users();
my %users_by_id = map { $_->{id} => $_ } values %all_users;
my @members = uniq sort { lc $a->{login} cmp lc $b->{login} } @users_by_id{ @{ $group->{members} } };
"name" => $group->{name},
"description" => $group->{description} });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_group {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- my $groups = $auth->read_groups();
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ my $groups = $main::auth->read_groups();
if (!$form->{group_id} || !$groups->{$form->{group_id}}) {
$form->show_generic_error($locale->text("No group has been selected, or the group does not exist anymore."));
}
if ($form->{confirmed}) {
- $auth->delete_group($form->{"group_id"});
+ $main::auth->delete_group($form->{"group_id"});
$form->{message} = $locale->text("The group has been deleted.");
edit_groups();
print $form->parse_html_template("admin/delete_group_confirm", $groups->{$form->{group_id}});
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_to_group {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->isblank('user_id_not_in_group', $locale->text('No user has been selected.'));
- my $groups = $auth->read_groups();
+ my $groups = $main::auth->read_groups();
if (!$form->{group_id} || !$groups->{$form->{group_id}}) {
$form->show_generic_error($locale->text('No group has been selected, or the group does not exist anymore.'));
}
- $group = $groups->{$form->{group_id}};
+ my $group = $groups->{$form->{group_id}};
$group->{members} = [ uniq @{ $group->{members} }, $form->{user_id_not_in_group} ];
- $auth->save_group($group);
+ $main::auth->save_group($group);
$form->{message} = $locale->text('The user has been added to this group.');
edit_group();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub remove_from_group {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->isblank('user_id_in_group', $locale->text('No user has been selected.'));
- my $groups = $auth->read_groups();
+ my $groups = $main::auth->read_groups();
if (!$form->{group_id} || !$groups->{$form->{group_id}}) {
$form->show_generic_error($locale->text('No group has been selected, or the group does not exist anymore.'));
}
- $group = $groups->{$form->{group_id}};
+ my $group = $groups->{$form->{group_id}};
$group->{members} = [ uniq grep { $_ ne $form->{user_id_in_group} } @{ $group->{members} } ];
- $auth->save_group($group);
+ $main::auth->save_group($group);
$form->{message} = $locale->text('The user has been removed from this group.');
edit_group();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_group_membership {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- my %users = $auth->read_all_users();
- my $groups = $auth->read_groups();
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ my %users = $main::auth->read_all_users();
+ my $groups = $main::auth->read_groups();
$groups = [ sort { lc $a->{name} cmp lc $b->{name} } values %{ $groups } ];
my @headings = map { { 'title' => $_ } } map { $_->{name} } @{ $groups };
$form->header();
print $form->parse_html_template('admin/edit_group_membership', { 'HEADINGS' => \@headings, 'USERS' => \@rows });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_group_membership {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- my %users = $auth->read_all_users();
- my $groups = $auth->read_groups();
+ my %users = $main::auth->read_all_users();
+ my $groups = $main::auth->read_groups();
foreach my $group (values %{ $groups }) {
$group->{members} = [ ];
push @{ $group->{members} }, $user->{id} if ($form->{"u_$user->{id}_g_$group->{id}"});
}
- $auth->save_group($group);
+ $main::auth->save_group($group);
}
$form->{message} = $locale->text('The group memberships have been saved.');
edit_groups();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
1;
use Data::Dumper;
-1;
-
require "bin/mozilla/common.pl";
+use strict;
+
+1;
+
# end of main
-sub add { call_sub("add_$form->{type}"); }
-sub delete { call_sub("delete_$form->{type}"); }
-sub save { call_sub("save_$form->{type}"); }
-sub edit { call_sub("edit_$form->{type}"); }
-sub continue { call_sub($form->{"nextsub"}); }
-sub save_as_new { call_sub("save_as_new_$form->{type}"); }
+sub add { call_sub("add_$main::form->{type}"); }
+sub delete { call_sub("delete_$main::form->{type}"); }
+sub save { call_sub("save_$main::form->{type}"); }
+sub edit { call_sub("edit_$main::form->{type}"); }
+sub continue { call_sub($main::form->{"nextsub"}); }
+sub save_as_new { call_sub("save_as_new_$main::form->{type}"); }
sub add_account {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Add";
$form->{charttype} = "A";
&account_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_account {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Edit";
AM->get_account(\%myconfig, \%$form);
&account_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub account_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
if ( $form->{action} eq 'edit_account') {
$form->{account_exists} = '1';
}
# Fill in empty row for new Taxkey
- $newtaxkey_ref = {
+ my $newtaxkey_ref = {
id => '',
chart_id => '',
accno => '',
}
# Newaccount Folgekonto
- if (@{ $form->{NEWACCOUNT} }) {
+ if (@{ $form->{NEWACCOUNT} || [] }) {
if (!$form->{new_chart_valid}) {
$form->{selectnewaccount} = qq|<option value=""> |. $locale->text('None') .q|</option>|;
}
- foreach $item (@{ $form->{NEWACCOUNT} }) {
+ foreach my $item (@{ $form->{NEWACCOUNT} }) {
if ($item->{id} == $form->{new_chart_id}) {
$form->{selectnewaccount} .=
qq|<option value="$item->{id}" selected>$item->{accno}--$item->{description}</option>|;
}
}
- $select_eur = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
- %eur = (1 => "Umsatzerlöse",
+ my $select_eur = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
+ my %eur = (
+ 1 => "Umsatzerlöse",
2 => "sonstige Erlöse",
3 => "Privatanteile",
4 => "Zinserträge",
29 => "Zinsaufwand",
30 => "Ausserordentlicher Aufwand",
31 => "Betriebliche Steuern");
- foreach $item (sort({ $a <=> $b } keys(%eur))) {
- my $text = H(SL::Iconv::convert("ISO-8859-15", $dbcharset, $eur{$item}));
+ foreach my $item (sort({ $a <=> $b } keys(%eur))) {
+ my $text = H(SL::Iconv::convert("ISO-8859-15", $main::dbcharset, $eur{$item}));
if ($item == $form->{pos_eur}) {
$select_eur .= qq|<option value=$item selected>|. sprintf("%.2d", $item) .qq|. $text</option>\n|;
} else {
}
- $select_bwa = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
+ my $select_bwa = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
- %bwapos = (1 => 'Umsatzerlöse',
+ my %bwapos = (
+ 1 => 'Umsatzerlöse',
2 => 'Best.Verdg.FE/UE',
3 => 'Aktiv.Eigenleistung',
4 => 'Mat./Wareneinkauf',
33 => 'Sonst.neutr.Ertrag',
34 => 'Verr.kalk.Kosten',
35 => 'Steuern Eink.u.Ertr.');
- foreach $item (sort({ $a <=> $b } keys %bwapos)) {
- my $text = H(SL::Iconv::convert("ISO-8859-15", $dbcharset, $bwapos{$item}));
+ foreach my $item (sort({ $a <=> $b } keys %bwapos)) {
+ my $text = H(SL::Iconv::convert("ISO-8859-15", $main::dbcharset, $bwapos{$item}));
if ($item == $form->{pos_bwa}) {
$select_bwa .= qq|<option value="$item" selected>|. sprintf("%.2d", $item) .qq|. $text\n|;
} else {
}
# Wieder hinzugefügt zu evaluationszwecken (us) 09.03.2007
- $select_bilanz = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
- foreach $item ((1, 2, 3, 4)) {
+ my $select_bilanz = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
+ foreach my $item ((1, 2, 3, 4)) {
if ($item == $form->{pos_bilanz}) {
$select_bilanz .= qq|<option value=$item selected>|. sprintf("%.2d", $item) .qq|.\n|;
} else {
# preselections category
- $select_category = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
+ my $select_category = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
- %category = (
+ my %category = (
'A' => $locale->text('Asset'),
'L' => $locale->text('Liability'),
'Q' => $locale->text('Equity'),
'E' => $locale->text('Expense'),
'C' => $locale->text('Costs'),
);
- foreach $item ( sort({ $a <=> $b } keys %category) ) {
+ foreach my $item ( sort({ $a <=> $b } keys %category) ) {
if ($item eq $form->{category}) {
$select_category .= qq|<option value="$item" selected="selected">$category{$item} (|. sprintf("%s", $item) .qq|)\n|;
} else {
'H' => $locale->text('Header'),
);
- foreach $item ( sort({ $a <=> $b } keys %charttype) ) {
+ foreach my $item ( sort({ $a <=> $b } keys %charttype) ) {
if ($item eq $form->{charttype}) {
$select_charttype .= qq|<option value="$item" selected="selected">$charttype{$item}\n|;
ChartTypeIsAccount => $ChartTypeIsAccount,
select_category => $select_category,
select_charttype => $select_charttype,
- newaccount => $newaccount,
- checked => $checked,
select_bwa => $select_bwa,
select_bilanz => $select_bilanz,
select_eur => $select_eur,
print($form->parse_html_template('am/edit_accounts', $parameters_ref));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
print qq|
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_account {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->isblank("accno", $locale->text('Account Number missing!'));
$form->isblank("description", $locale->text('Account Description missing!'));
if (AM->save_account(\%myconfig, \%$form));
$form->error($locale->text('Cannot save account!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_as_new_account {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("accno", $locale->text('Account Number missing!'));
$form->isblank("description", $locale->text('Account Description missing!'));
if (AM->save_account(\%myconfig, \%$form));
$form->error($locale->text('Cannot save account!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_account {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->{callback} = build_std_url('action=list_account');
my $link_edit_account = build_std_url('action=edit_account', 'callback');
CA->all_accounts(\%myconfig, \%$form);
- foreach $ca (@{ $form->{CA} }) {
+ foreach my $ca (@{ $form->{CA} }) {
$ca->{debit} = "";
$ca->{credit} = "";
# Ausgabe des Templates
print($form->parse_html_template('am/list_accounts', $parameters_ref));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_account_details {
# Ajax Funktion aus list_account_details
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
my $chart_id = $form->{args};
CA->all_accounts(\%myconfig, \%$form, $chart_id);
- foreach $ca (@{ $form->{CA} }) {
+ foreach my $ca (@{ $form->{CA} }) {
$ca->{debit} = " ";
$ca->{credit} = " ";
print $form->parse_html_template('am/list_account_details');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_account {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = $locale->text('Delete Account');
- foreach $id (
+ foreach my $id (
qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
) {
if ($form->{id} == $form->{$id}) {
if (AM->delete_account(\%myconfig, \%$form));
$form->error($locale->text('Cannot delete account!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_department {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+
+ $main::auth->assert('config');
$form->{title} = "Add";
$form->{role} = "P";
&department_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_department {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Edit";
&department_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_department {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
AM->departments(\%myconfig, \%$form);
$form->{callback} = "am.pl?action=list_department";
- $callback = $form->escape($form->{callback});
+ my $callback = $form->escape($form->{callback});
$form->{title} = $locale->text('Departments');
- @column_index = qw(description cost profit);
-
+ my @column_index = qw(description cost profit);
+ my %column_header;
$column_header{description} =
qq|<th class=listheading width=90%>|
. $locale->text('Description')
</tr>
|;
- foreach $ref (@{ $form->{ALL} }) {
+ my ($i, %column_data);
+ foreach my $ref (@{ $form->{ALL} }) {
$i++;
$i %= 2;
<tr valign=top class=listrow$i>
|;
- $costcenter = ($ref->{role} eq "C") ? "X" : "";
- $profitcenter = ($ref->{role} eq "P") ? "X" : "";
+ my $costcenter = ($ref->{role} eq "C") ? "X" : "";
+ my $profitcenter = ($ref->{role} eq "P") ? "X" : "";
$column_data{description} =
qq|<td><a href="am.pl?action=edit_department&id=$ref->{id}&callback=$callback">$ref->{description}</td>|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub department_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->{title} = $locale->text("$form->{title} Department");
$form->{description} =~ s/\"/"/g;
+ my ($rows, $description);
if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
$description =
qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
qq|<input name=description size=60 value="$form->{description}">|;
}
- $costcenter = "checked" if $form->{role} eq "C";
- $profitcenter = "checked" if $form->{role} eq "P";
+ my $costcenter = "checked" if $form->{role} eq "C";
+ my $profitcenter = "checked" if $form->{role} eq "P";
$form->header;
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_department {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("description", $locale->text('Description missing!'));
AM->save_department(\%myconfig, \%$form);
$form->redirect($locale->text('Department saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_department {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->delete_department(\%myconfig, \%$form);
$form->redirect($locale->text('Department deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_lead {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+
+ $main::auth->assert('config');
$form->{title} = "Add";
&lead_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_lead {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Edit";
$form->{orphaned} = 1;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_lead {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->lead(\%myconfig, \%$form);
$form->{callback} = "am.pl?action=list_lead";
- $callback = $form->escape($form->{callback});
+ my $callback = $form->escape($form->{callback});
$form->{title} = $locale->text('Lead');
- @column_index = qw(description cost profit);
-
+ my @column_index = qw(description cost profit);
+ my %column_header;
$column_header{description} =
qq|<th class=listheading width=100%>|
. $locale->text('Description')
</tr>
|;
- foreach $ref (@{ $form->{ALL} }) {
+ my ($i, %column_data);
+ foreach my $ref (@{ $form->{ALL} }) {
$i++;
$i %= 2;
<tr valign=top class=listrow$i>
|;
- $lead = $ref->{lead};
+# $lead = $ref->{lead};
$column_data{description} = qq|<td><a href="am.pl?action=edit_lead&id=$ref->{id}&callback=$callback">$ref->{lead}</td>|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub lead_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = $locale->text("$form->{title} Lead");
$form->{description} =~ s/\"/"/g;
- $description =
+ my $description =
qq|<input name=description size=50 value="$form->{lead}">|;
$form->header;
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_lead {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("description", $locale->text('Description missing!'));
AM->save_lead(\%myconfig, \%$form);
$form->redirect($locale->text('lead saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_lead {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
AM->delete_lead(\%myconfig, \%$form);
$form->redirect($locale->text('lead deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_business {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Add";
&business_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_business {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{title} = "Edit";
$form->{orphaned} = 1;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_business {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->business(\%myconfig, \%$form);
$form->{callback} = "am.pl?action=list_business";
- $callback = $form->escape($form->{callback});
+ my $callback = $form->escape($form->{callback});
$form->{title} = $locale->text('Type of Business');
- @column_index = qw(description discount customernumberinit);
-
+ my @column_index = qw(description discount customernumberinit);
+ my %column_header;
$column_header{description} =
qq|<th class=listheading width=60%>|
. $locale->text('Description')
</tr>
|;
- foreach $ref (@{ $form->{ALL} }) {
+ my ($i, %column_data);
+ foreach my $ref (@{ $form->{ALL} }) {
$i++;
$i %= 2;
<tr valign=top class=listrow$i>
|;
- $discount =
- $form->format_amount(\%myconfig, $ref->{discount} * 100);
- $description =
- $ref->{description};
+ my $discount = $form->format_amount(\%myconfig, $ref->{discount} * 100);
+ my $description = $ref->{description};
$column_data{description} = qq|<td><a href="am.pl?action=edit_business&id=$ref->{id}&callback=$callback">$description</td>|;
$column_data{discount} = qq|<td align=right>$discount</td>|;
$column_data{customernumberinit} =
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub business_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = $locale->text("$form->{title} Business");
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_business {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->isblank("description", $locale->text('Description missing!'));
$form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
AM->save_business(\%myconfig, \%$form);
$form->redirect($locale->text('Business saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_business {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->delete_business(\%myconfig, \%$form);
$form->redirect($locale->text('Business deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_language {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Add";
&language_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_language {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('config');
$form->{title} = "Edit";
$form->{orphaned} = 1;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_language {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->language(\%myconfig, \%$form);
$form->{callback} = "am.pl?action=list_language";
- $callback = $form->escape($form->{callback});
+ my $callback = $form->escape($form->{callback});
$form->{title} = $locale->text('Languages');
- @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
-
+ my @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates);
+ my %column_header;
$column_header{description} =
qq|<th class=listheading width=60%>|
. $locale->text('Description')
</tr>
|;
- foreach $ref (@{ $form->{ALL} }) {
+ my ($i, %column_data);
+ foreach my $ref (@{ $form->{ALL} }) {
$i++;
$i %= 2;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub language_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->{title} = $locale->text("$form->{title} Language");
my $numberformat =
qq|<option value="">| . $locale->text("use program settings") .
qq|</option>|;
- foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
+ foreach my $item (('1,000.00', '1000.00', '1.000,00', '1000,00')) {
$numberformat .=
($item eq $form->{output_numberformat})
? "<option selected>$item"
my $dateformat =
qq|<option value="">| . $locale->text("use program settings") .
qq|</option>|;
- foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
+ foreach my $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
$dateformat .=
($item eq $form->{output_dateformat})
? "<option selected>$item"
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_language {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("description", $locale->text('Language missing!'));
$form->isblank("template_code", $locale->text('Template Code missing!'));
AM->save_language(\%myconfig, \%$form);
$form->redirect($locale->text('Language saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_language {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
AM->delete_language(\%myconfig, \%$form);
$form->redirect($locale->text('Language deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_buchungsgruppe {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
# $locale->text("Add Buchungsgruppe")
# $locale->text("Edit Buchungsgruppe")
&buchungsgruppe_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_buchungsgruppe {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('config');
$form->{title} = "Edit";
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_buchungsgruppe {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->buchungsgruppe(\%myconfig, \%$form);
$form->{callback} = "am.pl?action=list_buchungsgruppe";
- $callback = $form->escape($form->{callback});
+ my $callback = $form->escape($form->{callback});
$form->{title} = $locale->text('Buchungsgruppen');
- @column_index = qw(up down description inventory_accno
+ my @column_index = qw(up down description inventory_accno
income_accno_0 expense_accno_0
income_accno_1 expense_accno_1
income_accno_2 expense_accno_2
income_accno_3 expense_accno_3 );
-
+ my %column_header;
$column_header{up} =
qq|<th class="listheading" width="16">|
. qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
my $swap_link = qq|am.pl?action=swap_buchungsgruppen&|;
my $row = 0;
- foreach $ref (@{ $form->{ALL} }) {
+ my ($i, %column_data);
+ foreach my $ref (@{ $form->{ALL} }) {
$i++;
$i %= 2;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub buchungsgruppe_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->{title} = $locale->text("$form->{title} Buchungsgruppe");
"IC_cogs" => $acc_expense,
);
- foreach $key (keys(%acc_type_map)) {
- foreach $ref (@{ $form->{IC_links}{$key} }) {
+ foreach my $key (keys(%acc_type_map)) {
+ foreach my $ref (@{ $form->{IC_links}{$key} }) {
$acc_type_map{$key}->{$ref->{"id"}} = $ref;
}
}
$form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_0}\E/ value=$form->{expense_accno_id_0} selected/;
}
- if (!$eur) {
+ my $linkaccounts;
+ if (!$main::eur) {
$linkaccounts = qq|
<tr>
<th align=right>| . $locale->text('Inventory') . qq|</th>
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_buchungsgruppe {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("description", $locale->text('Description missing!'));
AM->save_buchungsgruppe(\%myconfig, \%$form);
$form->redirect($locale->text('Accounting Group saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_buchungsgruppe {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->delete_buchungsgruppe(\%myconfig, \%$form);
$form->redirect($locale->text('Accounting Group deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub swap_buchungsgruppen {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('config');
AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen");
list_buchungsgruppe();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_printer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Add";
&printer_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_printer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Edit";
$form->{orphaned} = 1;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_printer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
AM->printer(\%myconfig, \%$form);
$form->{callback} = "am.pl?action=list_printer";
- $callback = $form->escape($form->{callback});
+ my $callback = $form->escape($form->{callback});
$form->{title} = $locale->text('Printer');
- @column_index = qw(printer_description printer_command template_code);
-
+ my @column_index = qw(printer_description printer_command template_code);
+ my %column_header;
$column_header{printer_description} =
qq|<th class=listheading width=60%>|
. $locale->text('Printer Description')
</tr>
|;
- foreach $ref (@{ $form->{ALL} }) {
+ my ($i, %column_data);
+ foreach my $ref (@{ $form->{ALL} }) {
$i++;
$i %= 2;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub printer_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->{title} = $locale->text("$form->{title} Printer");
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_printer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("printer_description", $locale->text('Description missing!'));
$form->isblank("printer_command", $locale->text('Printer Command missing!'));
AM->save_printer(\%myconfig, \%$form);
$form->redirect($locale->text('Printer saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_printer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
AM->delete_printer(\%myconfig, \%$form);
$form->redirect($locale->text('Printer deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_payment {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Add";
&payment_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_payment {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = "Edit";
$form->{orphaned} = 1;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_payment {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
AM->payment(\%myconfig, \%$form);
$form->{callback} = build_std_url("action=list_payment");
- $callback = $form->escape($form->{callback});
+ my $callback = $form->escape($form->{callback});
$form->{title} = $locale->text('Payment Terms');
- @column_index = qw(up down description description_long terms_netto
+ my @column_index = qw(up down description description_long terms_netto
terms_skonto percent_skonto);
-
+ my %column_header;
$column_header{up} =
qq|<th class="listheading" align="center" valign="center" width="16">|
. qq|<img src="image/up.png" alt="| . $locale->text("up") . qq|">|
my $swap_link = build_std_url("action=swap_payment_terms");
my $row = 0;
- foreach $ref (@{ $form->{ALL} }) {
+ my ($i, %column_data);
+ foreach my $ref (@{ $form->{ALL} }) {
$i++;
$i %= 2;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub payment_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = $locale->text("$form->{title} Payment Terms");
. qq|</li>
</ul>|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_payment {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->isblank("description", $locale->text('Description missing!'));
$form->{"percent_skonto"} =
AM->save_payment(\%myconfig, \%$form);
$form->redirect($locale->text('Payment Terms saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_payment {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->delete_payment(\%myconfig, \%$form);
$form->redirect($locale->text('Payment terms deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub swap_payment_terms {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->swap_sortkeys(\%myconfig, $form, "payment_terms");
list_payment();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_defaults {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
# get defaults for account numbers and last numbers
AM->defaultaccounts(\%myconfig, \%$form);
map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} };
- foreach $key (keys %{ $form->{IC} }) {
- foreach $accno (sort keys %{ $form->{IC}->{$key} }) {
+ foreach my $key (keys %{ $form->{IC} }) {
+ foreach my $accno (sort keys %{ $form->{IC}->{$key} }) {
my $array = "ACCNOS_" . uc($key);
$form->{$array} ||= [];
$form->header();
print $form->parse_html_template('am/edit_defaults');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_defaults {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
AM->save_defaults();
$form->redirect($locale->text('Defaults saved.'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub _build_cfg_options {
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
my $idx = shift;
my $array = uc($idx) . 'S';
}
sub config {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
_build_cfg_options('dateformat', qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd));
- _build_cfg_options('numberformat', qw(1,000.00 1000.00 1.000,00 1000,00));
+ _build_cfg_options('numberformat', ('1,000.00', '1000.00', '1.000,00', '1000,00'));
- @formats = ();
- if ($opendocument_templates && $openofficeorg_writer_bin &&
- $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
+ my @formats = ();
+ if ($main::opendocument_templates && $main::openofficeorg_writer_bin &&
+ $main::xvfb_bin && (-x $main::openofficeorg_writer_bin) && (-x $main::xvfb_bin)) {
push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
"value" => "opendocument_pdf" });
}
- if ($latex_templates) {
+ if ($main::latex_templates) {
push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
}
push(@formats, { "name" => "HTML", "value" => "html" });
- if ($latex_templates) {
+ if ($main::latex_templates) {
push(@formats, { "name" => $locale->text("Postscript"),
"value" => "postscript" });
}
- if ($opendocument_templates) {
+ if ($main::opendocument_templates) {
push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
"value" => "opendocument" });
}
$myconfig{"template_format"} = "pdf";
}
$form->{TEMPLATE_FORMATS} = [];
- foreach $item (@formats) {
+ foreach my $item (@formats) {
push @{ $form->{TEMPLATE_FORMATS} }, {
'name' => $item->{name},
'value' => $item->{value},
};
}
- %countrycodes = User->country_codes;
+ my %countrycodes = User->country_codes;
$form->{COUNTRYCODES} = [];
- foreach $countrycode (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
+ foreach my $countrycode (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
push @{ $form->{COUNTRYCODES} }, {
'name' => $countrycodes{$countrycode},
'value' => $countrycode,
}
$form->{STYLESHEETS} = [];
- foreach $item (qw(lx-office-erp.css Win2000.css)) {
+ foreach my $item (qw(lx-office-erp.css Win2000.css)) {
push @{ $form->{STYLESHEETS} }, {
'name' => $item,
'value' => $item,
}
$myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
- $form->{CAN_CHANGE_PASSWORD} = $auth->can_change_password();
+ $form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password();
$form->{todo_cfg} = { TODO->get_user_config('login' => $form->{login}) };
$form->{title} = $locale->text('Edit Preferences for #1', $form->{login});
$form->header();
print $form->parse_html_template('am/config');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_preferences {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{stylesheet} = $form->{usestylesheet};
$form->redirect($locale->text('Preferences saved!')) if (AM->save_preferences(\%myconfig, \%$form, 0));
$form->error($locale->text('Cannot save preferences!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub audit_control {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = $locale->text('Audit Control');
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub doclose {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->closebooks(\%myconfig, \%$form);
$form->redirect($locale->text('Books are open'));
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_units {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $units = AM->retrieve_units(\%myconfig, $form, "resolved_");
+ $main::auth->assert('config');
+
+ my $units = AM->retrieve_units(\%myconfig, $form, "resolved_");
AM->units_in_use(\%myconfig, $form, $units);
map({ $units->{$_}->{"BASE_UNIT_DDBOX"} = AM->unit_select_data($units, $units->{$_}->{"base_unit"}, 1); } keys(%{$units}));
- @languages = AM->language(\%myconfig, $form, 1);
+ my @languages = AM->language(\%myconfig, $form, 1);
- @unit_list = sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } values(%{$units}));
+ my @unit_list = sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } values(%{$units}));
my $i = 1;
foreach (@unit_list) {
}
$units = AM->retrieve_units(\%myconfig, $form);
- $ddbox = AM->unit_select_data($units, undef, 1);
+ my $ddbox = AM->unit_select_data($units, undef, 1);
my $updownlink = build_std_url("action=swap_units");
"LANGUAGES" => \@languages,
"updownlink" => $updownlink }));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_unit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("new_name", $locale->text("The name is missing."));
- $units = AM->retrieve_units(\%myconfig, $form);
- $all_units = AM->retrieve_units(\%myconfig, $form);
+ my $units = AM->retrieve_units(\%myconfig, $form);
+ my $all_units = AM->retrieve_units(\%myconfig, $form);
$form->show_generic_error($locale->text("A unit with this name does already exist.")) if ($all_units->{$form->{"new_name"}});
my ($base_unit, $factor);
edit_units();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub set_unit_languages {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('config');
+ $main::auth->assert('config');
my ($unit, $languages, $idx) = @_;
});
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_unit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
- $old_units = AM->retrieve_units(\%myconfig, $form, "resolved_");
+ my $old_units = AM->retrieve_units(\%myconfig, $form, "resolved_");
AM->units_in_use(\%myconfig, $form, $old_units);
- @languages = AM->language(\%myconfig, $form, 1);
+ my @languages = AM->language(\%myconfig, $form, 1);
- $new_units = {};
- @delete_units = ();
- foreach $i (1..($form->{"rowcount"} * 1)) {
- $old_unit = $old_units->{$form->{"old_name_$i"}};
+ my $new_units = {};
+ my @delete_units = ();
+ foreach my $i (1..($form->{"rowcount"} * 1)) {
+ my $old_unit = $old_units->{$form->{"old_name_$i"}};
if (!$old_unit) {
$form->show_generic_error(sprintf($locale->text("The unit in row %d has been deleted in the meantime."), $i));
}
set_unit_languages($new_units->{$form->{"old_name_$i"}}, \@languages, $i);
}
- foreach $unit (values(%{$new_units})) {
+ foreach my $unit (values(%{$new_units})) {
next unless ($unit->{"old_name"});
if ($unit->{"base_unit"}) {
$form->show_generic_error(sprintf($locale->text("The base unit does not exist or it is about to be deleted in row %d."), $unit->{"row"}))
}
}
- foreach $unit (values(%{$new_units})) {
+ foreach my $unit (values(%{$new_units})) {
next if ($unit->{"unchanged_unit"});
map({ $_->{"seen"} = 0; } values(%{$new_units}));
- $new_unit = $unit;
+ my $new_unit = $unit;
while ($new_unit->{"base_unit"}) {
$new_unit->{"seen"} = 1;
$new_unit = $new_units->{$new_unit->{"base_unit"}};
edit_units();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub show_history_search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = $locale->text("History Search");
$form->header();
print $form->parse_html_template("common/search_history");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub show_am_history {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
my $callback = build_std_url(qw(action einschraenkungen fromdate todate mitarbeiter searchid what2search));
$form->{order} ||= 'h.itime--1';
});
$dbh->disconnect();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub swap_units {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
my $dir = $form->{"dir"} eq "down" ? "down" : "up";
AM->swap_units(\%myconfig, $form, $dir, $form->{"name"});
edit_units();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_tax {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->{title} = $locale->text('Add');
# Ausgabe des Templates
print($form->parse_html_template('am/edit_tax', $parameters_ref));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_tax {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = $locale->text('Edit');
# Ausgabe des Templates
print($form->parse_html_template('am/edit_tax', $parameters_ref));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_tax {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->taxes(\%myconfig, \%$form);
$form->header();
+ my $parameters_ref = {
+ };
+
# Ausgabe des Templates
print($form->parse_html_template('am/list_tax', $parameters_ref));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub _get_taxaccount_selection{
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('config');
AM->get_tax_accounts(\%myconfig, \%$form);
map { $_->{selected} = $form->{chart_id} == $_->{id} } @{ $form->{ACCOUNTS} };
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_tax {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("rate", $locale->text('Taxrate missing!'));
$form->isblank("taxdescription", $locale->text('Taxdescription missing!'));
AM->save_tax(\%myconfig, \%$form);
$form->redirect($locale->text('Tax saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_tax {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->delete_tax(\%myconfig, \%$form);
$form->redirect($locale->text('Tax deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_price_factor {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->{title} = $locale->text('Add Price Factor');
$form->{callback} ||= build_std_url('action=add_price_factor');
$form->header();
print $form->parse_html_template('am/edit_price_factor');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_price_factor {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = $locale->text('Edit Price Factor');
$form->{callback} ||= build_std_url('action=add_price_factor');
$form->header();
print $form->parse_html_template('am/edit_price_factor');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_price_factors {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
AM->get_all_price_factors(\%myconfig, \%$form);
$form->header();
print $form->parse_html_template('am/list_price_factors');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_price_factor {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("description", $locale->text('Description missing!'));
$form->isblank("factor", $locale->text('Factor missing!'));
$form->redirect($locale->text('Price factor saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_price_factor {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
AM->delete_price_factor(\%myconfig, \%$form);
$form->redirect($locale->text('Price factor deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub swap_price_factors {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->swap_sortkeys(\%myconfig, $form, 'price_factors');
list_price_factors();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_warehouse {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{title} = $locale->text('Add Warehouse');
$form->{callback} ||= build_std_url('action=add_warehouse');
$form->header();
print $form->parse_html_template('am/edit_warehouse');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_warehouse {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
AM->get_warehouse(\%myconfig, $form);
$form->header();
print $form->parse_html_template('am/edit_warehouse');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_warehouses {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->get_all_warehouses(\%myconfig, $form);
$form->header();
print $form->parse_html_template('am/list_warehouses');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_warehouse {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank("description", $locale->text('Description missing!'));
$form->redirect($locale->text('Warehouse saved.'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub swap_warehouses {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('config');
AM->swap_sortkeys(\%myconfig, $form, 'warehouse');
list_warehouses();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_warehouse {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
if (!$form->{confirmed}) {
$form->{title} = $locale->text('Confirmation');
$form->error($locale->text('The warehouse could not be deleted because it has already been used.'));
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_bin {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
AM->save_bins(\%myconfig, $form);
$form->redirect($locale->text('Bins saved.'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
use Data::Dumper;
use List::MoreUtils qw(any);
-1;
-
require "bin/mozilla/common.pl";
+use strict;
+
+1;
+
# end of main
+my $locale = $main::locale;
our %translations = ('text' => $locale->text('Free-form text'),
'textfield' => $locale->text('Text field'),
'number' => $locale->text('Number'),
}
sub list_cvar_configs {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{module} = $form->{module} || $form->{cvar_module} || 'CT';
$form->{module} = 'CT' unless _is_valid_module($form->{module});
$main::lxdebug->dump(0, "modules", \@modules);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_cvar_config {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{module} = $form->{module} || $form->{cvar_module} || 'CT';
$form->{edit} = 0;
display_cvar_config_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_cvar_config {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+
+ $main::auth->assert('config');
my $config = CVar->get_config('id' => $form->{id});
$form->{edit} = 1;
display_cvar_config_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->isblank('name', $locale->text('The name is missing.'));
$form->isblank('description', $locale->text('The description is missing.'));
list_cvar_configs();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
CVar->delete_config('id' => $form->{id});
list_cvar_configs();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_cvar_config_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
my @types = map { { 'type' => $_, 'type_tr' => $translations{$_} } } @types;
print $form->parse_html_template("amcvar/display_cvar_config_form", { TYPES => \@types,
MODULES => \@modules });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub swap_cvar_configs {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
AM->swap_sortkeys(\%myconfig, $form, 'custom_variable_configs');
list_cvar_configs();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub dispatcher {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
foreach my $action (qw(list_cvar_configs add_cvar_config)) {
if ($form->{"action_${action}"}) {
call_sub($action);
use Data::Dumper;
+use strict;
+
1;
require "bin/mozilla/common.pl";
# end of main
sub display {
- call_sub($form->{display_nextsub});
+ call_sub($main::form->{display_nextsub});
}
sub save {
- call_sub($form->{save_nextsub});
+ call_sub($main::form->{save_nextsub});
}
sub edit {
- call_sub($form->{edit_nextsub});
+ call_sub($main::form->{edit_nextsub});
}
sub display_template {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{edit} = 0;
display_template_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit_template {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{edit} = 1;
display_template_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_template {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('config');
$form->isblank("formname", $locale->text("You're not editing a file.")) unless ($form->{type} eq "stylesheet");
$form->{edit} = 0;
display_template_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_template_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
$form->{"formname"} =~ s|.*/||;
my $format = $form->{"format"} eq "html" ? "html" : "tex";
$form->header;
print($form->parse_html_template("am/edit_templates", \%options));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
1;
require "bin/mozilla/drafts.pl";
require "bin/mozilla/reportgenerator.pl";
+use strict;
+
1;
# end of main
# $locale->text('Dec')
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
- return $lxdebug->leave_sub() if (load_draft_maybe());
+ return $main::lxdebug->leave_sub() if (load_draft_maybe());
$form->{title} = "Add";
$form->{transdate} = $form->{initial_transdate};
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
$form->{title} = "Edit";
&create_links;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ my $form = $main::form;
+
+ $main::auth->assert('general_ledger');
&form_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_links {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
$form->create_links("AP", \%myconfig, "vendor");
- $taxincluded = $form->{taxincluded};
- $duedate = $form->{duedate};
+ my $taxincluded = $form->{taxincluded};
+ my $duedate = $form->{duedate};
IR->get_vendor(\%myconfig, \%$form);
$form->{taxincluded} = $taxincluded;
$form->{notes} = $form->{intnotes} unless $form->{notes};
# currencies
- @curr = split(/:/, $form->{currencies});
+ my @curr = split(/:/, $form->{currencies});
chomp $curr[0];
$form->{defaultcurrency} = $curr[0];
($form->datetonum($form->{transdate}, \%myconfig) <=
$form->datetonum($form->{closedto}, \%myconfig));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
- $title = $form->{title};
+ $main::auth->assert('general_ledger');
+
+ my $title = $form->{title};
$form->{title} = $locale->text("$title Accounts Payables Transaction");
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
#/show hhistory button
# set option selected
- foreach $item (qw(vendor currency department)) {
+ foreach my $item (qw(vendor currency department)) {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~
s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
- $readonly = ($form->{id}) ? "readonly" : "";
+ my $readonly = ($form->{id}) ? "readonly" : "";
$form->{radier} = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
$readonly = ($form->{radier}) ? "" : $readonly;
$form->{creditremaining} =
$form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
- $exchangerate = qq|
+ my $exchangerate = qq|
<input type=hidden name=forex value=$form->{forex}>
|;
if ($form->{currency} ne $form->{defaultcurrency}) {
}
}
- $taxincluded = "";
+ my $taxincluded = "";
$taxincluded = qq|
<tr>
</tr>
|;
+ my $rows;
if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) {
$rows = 2;
}
- $notes =
+ my $notes =
qq|<textarea name=notes rows=$rows cols=50 wrap=soft $readonly>$form->{notes}</textarea>|;
- $department = qq|
+ my $department = qq|
<tr>
<th align="right" nowrap>| . $locale->text('Department') . qq|</th>
<td colspan=3><select name=department>$form->{selectdepartment}</select>
</tr>
| if $form->{selectdepartment};
- $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
+ my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
- $vendor =
+ my $vendor =
($form->{selectvendor})
- ? qq|<select name="vendor"
-onchange="document.getElementById('update_button').click();">$form->{
-selectvendor } </select>|
+ ? qq|<select name="vendor" onchange="document.getElementById('update_button').click();">$form->{selectvendor} </select>|
: qq|<input name=vendor value="$form->{vendor}" size=35>|;
my @old_project_ids = ();
# use JavaScript Calendar or not
$form->{jsscript} = 1;
- $jsscript = "";
+ my $jsscript = "";
+ my ($button1, $button2);
if ($form->{jsscript}) {
# with JavaScript Calendar
$form->{javascript} .= qq|<script type="text/javascript" src="js/follow_up.js"></script>|;
$form->header;
- $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ my $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
$onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
<body onLoad="$onload">
</tr>
|;
- $amount = $locale->text('Amount');
- $project = $locale->text('Project');
+ my $amount = $locale->text('Amount');
+ my $project = $locale->text('Project');
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
# format amounts
$form->{"amount_$i"} =
$selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"});
- $selectAP_amount =
+ my $selectAP_amount =
NTI($cgi->popup_menu('-name' => "AP_amount_$i",
'-id' => "AP_amount_$i",
'-style' => 'width:400px',
. $cgi->hidden('-name' => "previous_AP_amount_$i",
'-default' => $selected_accno_full);
- $tax = qq|<td>| .
+ my $tax = qq|<td>| .
NTI($cgi->popup_menu('-name' => "taxchart_$i",
'-id' => "taxchart_$i",
'-style' => 'width:200px',
$project = "";
}
- $taxlabel =
+ my $taxlabel =
($form->{taxincluded})
? $locale->text('Tax Included')
: $locale->text('Tax');
$form->{invtotal_unformatted} = $form->{invtotal};
$form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
- $APselected =
+ my $APselected =
NTI($cgi->popup_menu('-name' => "APselected", '-id' => "APselected",
'-style' => 'width:400px',
'-values' => \@AP_values, '-labels' => \%AP_labels,
</tr>
|;
+ my @column_index;
if ($form->{currency} eq $form->{defaultcurrency}) {
@column_index = qw(datepaid source memo paid AP_paid paid_project_id);
} else {
@column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id);
}
+ my %column_data;
$column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
$column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
$column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
my $totalpaid = 0;
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
print "
<tr>
";
- $selectAP_paid =
+ my $selectAP_paid =
NTI($cgi->popup_menu('-name' => "AP_paid_$i",
'-id' => "AP_paid_$i",
'-values' => \@AP_paid_values,
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
my $follow_ups_block;
if ($form->{id}) {
qq|</label><br>|);
}
- $transdate = $form->datetonum($form->{transdate}, \%myconfig);
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
print qq|<input class="submit" type="submit" name="action" id="update_button" value="| . $locale->text('Update') . qq|">|;
|;
}
# ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
+ our $total_paid;
print qq| <input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|"> |
if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap', $form->{id}) && (($total_paid == 0) || ($total_paid eq "")));
</html>
";
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub mark_as_paid {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
&mark_as_paid_common(\%myconfig,"ap");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('general_ledger');
my $display = shift;
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(exchangerate creditlimit creditremaining);
- @flds = qw(amount AP_amount projectnumber oldprojectnumber project_id taxchart);
- $count = 0;
- for $i (1 .. $form->{rowcount}) {
+ my @flds = qw(amount AP_amount projectnumber oldprojectnumber project_id taxchart);
+ my $count = 0;
+ my (@a, $j, $totaltax);
+ for my $i (1 .. $form->{rowcount}) {
$form->{"amount_$i"} =
$form->parse_amount(\%myconfig, $form->{"amount_$i"});
$form->{"tax_$i"} = $form->parse_amount(\%myconfig, $form->{"tax_$i"});
if ($form->{"amount_$i"}) {
push @a, {};
$j = $#a;
- ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
+ my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
if ($taxkey > 1) {
if ($form->{taxincluded}) {
$form->{"tax_$i"} = $form->{"amount_$i"} / ($rate + 1) * $rate;
$form->{invtotal} =
($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
- for $i (1 .. $form->{paidaccounts}) {
+ my $totalpaid;
+ for my $i (1 .. $form->{paidaccounts}) {
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
map {
$form->{"${_}_$i"} =
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post_payment {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
- for $i (1 .. $form->{paidaccounts}) {
+ our $invdate;
+ for my $i (1 .. $form->{paidaccounts}) {
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
- $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
+ my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
$form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
$form->error($locale->text('Cannot post payment!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('general_ledger');
# check if there is a vendor, invoice and due date
$form->isblank("transdate", $locale->text("Invoice Date missing!"));
$form->isblank("duedate", $locale->text("Due Date missing!"));
$form->isblank("vendor", $locale->text('Vendor missing!'));
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
- $transdate = $form->datetonum($form->{transdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
$form->error($locale->text('Cannot post transaction for a closed period!')) if ($form->date_closed($form->{"transdate"}, \%myconfig));
my $zero_amount_posting = 1;
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
if ($form->parse_amount(\%myconfig, $form->{"amount_$i"})) {
$zero_amount_posting = 0;
last;
if ($form->{currency} ne $form->{defaultcurrency});
delete($form->{AP});
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
- $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
+ my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
$form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
}
# if old vendor ne vendor redo form
- ($vendor) = split /--/, $form->{vendor};
+ my ($vendor) = split /--/, $form->{vendor};
if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") {
&update;
exit;
}
- ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected};
- ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
- ($payablesaccno, $payablestaxkey) = split /--/, $form->{APselected};
+ my ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected};
+ my ($taxkey, $NULL) = split /--/, $form->{taxchartselected};
+ my ($payablesaccno, $payablestaxkey) = split /--/, $form->{APselected};
$form->{AP}{amount_1} = $debitaccno;
$form->{AP}{payables} = $payablesaccno;
$form->{taxkey} = $taxkey;
}
$form->error($locale->text('Cannot post transaction!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post_as_new {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
$form->{postasnew} = 1;
# saving the history
# /saving the history
&post;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub use_as_template {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
$form->{paidaccounts} = 1;
$form->{invdate} = $form->current_date(\%myconfig);
&update;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('general_ledger');
$form->{title} = $locale->text('Confirm!');
<form method=post action=$form->{script}>
|;
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub yes {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
- if (AP->delete_transaction(\%myconfig, \%$form, $spool)) {
+ if (AP->delete_transaction(\%myconfig, \%$form, $main::spool)) {
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
}
$form->error($locale->text('Cannot delete transaction!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger | vendor_invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
+
+ $main::auth->assert('general_ledger | vendor_invoice_edit');
# setup vendor selection
$form->all_vc(\%myconfig, "vendor", "AP");
+ my $vendor;
if (@{ $form->{all_vendor} }) {
map { $vendor .= "<option>$_->{name}--$_->{id}\n" }
@{ $form->{all_vendor} };
} (@{ $form->{all_departments} });
}
- $department = qq|
+ my $department = qq|
<tr>
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
<td colspan=3><select name=department>$form->{selectdepartment}</select></td>
# use JavaScript Calendar or not
$form->{jsscript} = 1;
- $jsscript = "";
+ my $jsscript = "";
+ my ($button1, $button2);
if ($form->{jsscript}) {
# with JavaScript Calendar
'-labels' => \%labels));
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->header;
- $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
+ my $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
$onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
<body onLoad="$onload">
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_subtotal_row {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
map { $totals->{$_} = 0 } @{ $subtotal_columns };
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $row;
}
sub ap_transactions {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger | vendor_invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('general_ledger | vendor_invoice_edit');
($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor});
$form->{callback} = $href .= "&sort=$form->{sort}";
# escape callback for href
- $callback = $form->escape($href);
+ my $callback = $form->escape($href);
my @subtotal_columns = qw(netamount amount paid due);
my $idx = 0;
- foreach $ap (@{ $form->{AP} }) {
+ foreach my $ap (@{ $form->{AP} }) {
$ap->{tax} = $ap->{amount} - $ap->{netamount};
$ap->{due} = $ap->{amount} - $ap->{paid};
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub storno {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
if (IS->has_storno(\%myconfig, $form, 'ap')) {
$form->{title} = $locale->text("Cancel Accounts Payables Transaction");
$form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
use SL::PE;
use SL::ReportGenerator;
-# use strict;
-#use warnings;
-
-# imports
-our ($cgi, $form, $lxdebug, $locale, %myconfig);
-
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/drafts.pl";
require "bin/mozilla/reportgenerator.pl";
-1;
-
-# end of main
+use strict;
+#use warnings;
# this is for our long dates
# $locale->text('January')
# $locale->text('Nov')
# $locale->text('Dec')
+my $totalpaid;
+
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
- return $lxdebug->leave_sub() if (load_draft_maybe());
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ return $main::lxdebug->leave_sub() if (load_draft_maybe());
# saving the history
if(!exists $form->{addition} && ($form->{id} ne "")) {
&create_links;
$form->{transdate} = $form->{initial_transdate};
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
# show history button
$form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
&create_links;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
&form_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_links {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
my ($duedate, $taxincluded, @curr);
($form->datetonum($form->{transdate}, \%myconfig) <=
$form->datetonum($form->{closedto}, \%myconfig));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
my ($title, $readonly, $exchangerate, $rows);
my ($taxincluded, $notes, $department, $customer, $employee, $amount, $project);
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
my ($transdate, $closedto);
# ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it
print qq| <input class=submit type=submit name=action value="| . $locale->text('Storno') . qq|"> |
- if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar') && (($total_paid == 0) || ($total_paid eq "")));
+ if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ar') && !IS->is_storno(\%myconfig, $form, 'ar') && (($totalpaid == 0) || ($totalpaid eq "")));
if ($form->{id}) {
if ($form->{radier}) {
</html>
";
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub mark_as_paid {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
&mark_as_paid_common(\%myconfig,"ar");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
my $display = shift;
- my ($totaltax, $exchangerate, $totalpaid);
+ my ($totaltax, $exchangerate);
$form->{invtotal} = 0;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
#
# ToDO: fix $closedto and $invdate
#
sub post_payment {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->redirect($locale->text('Payment posted!')) if (AR->post_payment(\%myconfig, \%$form));
$form->error($locale->text('Cannot post payment!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub _post {
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
# inline post
post(1);
}
sub post {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
my ($inline) = @_;
$form->{AR}{receivables} = $form->{ARselected};
$form->{storno} = 0;
- $lxdebug->message(0, $form->{amount});
+ $main::lxdebug->message(0, $form->{amount});
$form->{id} = 0 if $form->{postasnew};
$form->error($locale->text('Cannot post transaction!')) unless AR->post_transaction(\%myconfig, \%$form);
$form->redirect($locale->text('Transaction posted!')) unless $inline;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post_as_new {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{postasnew} = 1;
# saving the history
# /saving the history
&post;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub use_as_template {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
$form->{paidaccounts} = 1;
$form->{invdate} = $form->current_date(\%myconfig);
&update;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text('Confirm!');
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub yes {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
if (AR->delete_transaction(\%myconfig, \%$form)) {
# saving the history
}
$form->error($locale->text('Cannot delete transaction!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger | invoice_edit');
- $auth->assert('general_ledger | invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
my ($customer, $department);
my ($jsscript, $button1, $button2, $onload);
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_subtotal_row {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
map { $totals->{$_} = 0 } @{ $subtotal_columns };
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $row;
}
sub ar_transactions {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger | invoice_edit');
- $auth->assert('general_ledger | invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
my ($callback, $href, @columns);
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub storno {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
# don't cancel cancelled transactions
if (IS->has_storno(\%myconfig, $form, 'ar')) {
$form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
+
+1;
use SL::Projects;
+use strict;
+
# any custom scripts for this one
if (-f "bin/mozilla/custom_arap.pl") {
eval { require "bin/mozilla/custom_arap.pl"; };
}
-if (-f "bin/mozilla/$form->{login}_arap.pl") {
- eval { require "bin/mozilla/$form->{login}_arap.pl"; };
+if (-f "bin/mozilla/$main::form->{login}_arap.pl") {
+ eval { require "bin/mozilla/$main::form->{login}_arap.pl"; };
}
1;
# end of main
sub check_name {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
+ $main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash |' .
'purchase_delivery_order_edit | sales_delivery_order_edit');
# name is not on file
# $locale->text('Customer not on file or locked!')
# $locale->text('Vendor not on file or locked!')
- $msg = ucfirst $name . " not on file or locked!";
+ my $msg = ucfirst $name . " not on file or locked!";
$form->error($locale->text($msg));
}
}
}
$form->language_payment(\%myconfig);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $i;
}
# $locale->text('Vendor not on file!')
sub select_name {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash');
my ($table) = @_;
- @column_index = qw(ndx name address);
+ my @column_index = qw(ndx name address);
- $label = ucfirst $table;
+ my $label = ucfirst $table;
+ my %column_data;
$column_data{ndx} = qq|<th> </th>|;
$column_data{name} =
qq|<th class=listheading>| . $locale->text($label) . qq|</th>|;
# list items with radio button on a form
$form->header;
- $title = $locale->text('Select from one of the names below');
+ my $title = $locale->text('Select from one of the names below');
print qq|
<body>
|;
my $i = 0;
- foreach $ref (@{ $form->{name_list} }) {
- $checked = ($i++) ? "" : "checked";
+ my $j;
+ foreach my $ref (@{ $form->{name_list} }) {
+ my $checked = ($i++) ? "" : "checked";
$ref->{name} =~ s/\"/"/g;
map { delete $form->{$_} } qw(action name_list header);
# save all other form variables
- foreach $key (keys %${form}) {
+ foreach my $key (keys %${form}) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub name_selected {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
+ $main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash');
# replace the variable with the one checked
# index for new item
- $i = $form->{ndx};
+ my $i = $form->{ndx};
$form->{ $form->{vc} } = $form->{"new_name_$i"};
$form->{"$form->{vc}_id"} = $form->{"new_id_$i"};
&update(1);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub check_project {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
my $nextsub = shift || 'update';
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
my $suffix = $i ? "_$i" : "";
my $prefix = $i ? "" : "global";
$form->{"${prefix}project_id${suffix}"} = "" unless $form->{"${prefix}projectnumber$suffix"};
# get new project
$form->{projectnumber} = $form->{"${prefix}projectnumber${suffix}"};
my %params = map { $_ => $form->{$_} } qw(projectnumber description active);
+ my $rows;
if (($rows = Projects->search_projects(%params)) > 1) {
# check form->{project_list} how many there are
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub select_project {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
- $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
+ $main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
my ($is_global, $nextsub) = @_;
- @column_index = qw(ndx projectnumber description);
+ my @column_index = qw(ndx projectnumber description);
+ my %column_data;
$column_data{ndx} = qq|<th> </th>|;
$column_data{projectnumber} = qq|<th>| . $locale->text('Number') . qq|</th>|;
$column_data{description} =
# list items with radio button on a form
$form->header;
- $title = $locale->text('Select from one of the projects below');
+ my $title = $locale->text('Select from one of the projects below');
print qq|
<body>
|;
my $i = 0;
- foreach $ref (@{ $form->{project_list} }) {
- $checked = ($i++) ? "" : "checked";
+ my $j;
+ foreach my $ref (@{ $form->{project_list} }) {
+ my $checked = ($i++) ? "" : "checked";
$ref->{name} =~ s/\"/"/g;
map { delete $form->{$_} } qw(action project_list header update);
# save all other form variables
- foreach $key (keys %${form}) {
+ foreach my $key (keys %${form}) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input name=$key type=hidden value="$form->{$key}">\n|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub project_selected {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
+ $main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report');
# replace the variable with the one checked
# index for new item
- $i = $form->{ndx};
+ my $i = $form->{ndx};
my $prefix = $form->{"is_global"} ? "global" : "";
my $suffix = $form->{"is_global"} ? "" : "_$form->{rownumber}";
call_sub($nextsub);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
-sub continue { call_sub($form->{"nextsub"}); }
+sub continue { call_sub($main::form->{"nextsub"}); }
require "bin/mozilla/common.pl";
+use strict;
+
# end of main
sub assert_bp_access {
+ my $form = $main::form;
+
my %access_map = (
'invoice' => 'invoice_edit',
'sales_order' => 'sales_order_edit',
);
if ($form->{type} && $access_map{$form->{type}}) {
- $auth->assert($access_map{$form->{type}});
+ $main::auth->assert($access_map{$form->{type}});
} elsif ($form->{type} eq 'packing_list') {
- $lxdebug->message(0, "1");
- if (!$auth->assert('sales_order_edit', 1)) {
- $lxdebug->message(0, "2");
- $auth->assert('invoice_edit') ;
+ $main::lxdebug->message(0, "1");
+ if (!$main::auth->assert('sales_order_edit', 1)) {
+ $main::lxdebug->message(0, "2");
+ $main::auth->assert('invoice_edit') ;
}
- $lxdebug->message(0, "3");
+ $main::lxdebug->message(0, "3");
} else {
- $auth->assert('DOES_NOT_EXIST');
+ $main::auth->assert('DOES_NOT_EXIST');
}
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ my ($name, $account, $onload);
assert_bp_access();
# $locale->text('Customer')
# $locale->text('Vendor')
- %label = (
+ my %label = (
invoice =>
{ title => 'Sales Invoices', name => 'Customer', l_invnumber => 'Y' },
packing_list =>
$account .= qq|
<td colspan=3><select name=account>
|;
- foreach $ref (@{ $form->{accounts} }) {
+ foreach my $ref (@{ $form->{accounts} }) {
$account .= qq|
<option>$ref->{accno}--$ref->{description}
|;
# use JavaScript Calendar or not
$form->{jsscript} = 1;
- $jsscript = "";
+ my $jsscript = "";
+ my ($button1, $button2);
if ($form->{jsscript}) {
# with JavaScript Calendar
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub remove {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
assert_bp_access();
- $selected = 0;
+ my $selected = 0;
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
if ($form->{"checked_$i"}) {
$selected = 1;
last;
map { delete $form->{$_} } qw(action header);
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
}
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub yes {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
assert_bp_access();
$form->{callback} .= "&header=1" if $form->{callback};
$form->redirect($locale->text('Removed spoolfiles!'))
- if (BP->delete_spool(\%myconfig, \%$form, $spool));
+ if (BP->delete_spool(\%myconfig, \%$form, $main::spool));
$form->error($locale->text('Cannot remove files!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
assert_bp_access();
$form->{callback} .= "&header=1";
}
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
if ($form->{"checked_$i"}) {
$form->info($locale->text('Printing ... '));
- if (BP->print_spool(\%myconfig, \%$form, $spool, "| $selected_printer")) {
+ if (BP->print_spool(\%myconfig, \%$form, $main::spool, "| $selected_printer")) {
print $locale->text('done');
$form->redirect($locale->text('Marked entries printed!'));
}
$form->error('Nothing selected!');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_spool {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
assert_bp_access();
BP->get_spoolfiles(\%myconfig, \%$form);
- $title = $form->escape($form->{title});
- $href = "bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title";
+ my $title = $form->escape($form->{title});
+ my $href = "bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title";
$title = $form->escape($form->{title}, 1);
- $callback =
+ my $callback =
"bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title";
+ my $option;
if ($form->{ $form->{vc} }) {
$callback .= "&$form->{vc}=" . $form->escape($form->{ $form->{vc} }, 1);
. $locale->date(\%myconfig, $form->{transdateto}, 1);
}
- $name = ucfirst $form->{vc};
+ my $name = ucfirst $form->{vc};
- @columns = (transdate);
+ my @columns = qw(transdate);
if ($form->{type} =~ /(invoice|packing_list|check|receipt)/) {
push @columns, "invnumber";
}
push @columns, "quonumber";
}
- push @columns, (name, spoolfile);
- @column_index = $form->sort_columns(@columns);
+ push @columns, qw(name spoolfile);
+ my @column_index = $form->sort_columns(@columns);
unshift @column_index, "checked";
+ my %column_header;
+ my %column_data;
+
$column_header{checked} = "<th class=listheading> </th>";
$column_header{transdate} =
"<th><a class=listheading href=$href&sort=transdate>"
# escape callback for href
$callback = $form->escape($callback);
- $i = 0;
+ my $i = 0;
+ my $j = 0;
+ my $spoolfile;
- foreach $ref (@{ $form->{SPOOL} }) {
+ foreach my $ref (@{ $form->{SPOOL} }) {
$i++;
if ($ref->{invoice}) {
$ref->{module} = ($ref->{module} eq 'ar') ? "is" : "ir";
}
- $module = "$ref->{module}.pl";
+ my $module = "$ref->{module}.pl";
$column_data{transdate} = "<td>$ref->{transdate} </td>";
"<td><a href=$module?action=edit&id=$ref->{id}&type=$form->{type}&callback=$callback>$ref->{quonumber}</a></td>";
$column_data{name} = "<td>$ref->{name}</td>";
$column_data{spoolfile} =
- qq|<td><a href=$spool/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
+ qq|<td><a href=$main::spool/$ref->{spoolfile}>$ref->{spoolfile}</a></td>
<input type=hidden name="spoolfile_$i" value=$ref->{spoolfile}>
|;
}
sub select_all {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
assert_bp_access();
map { $form->{"checked_$_"} = 1 } (1 .. $form->{rowcount});
&list_spool;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
-sub continue { call_sub($form->{"nextsub"}); }
+sub continue { call_sub($main::form->{"nextsub"}); }
require "bin/mozilla/reportgenerator.pl";
+use strict;
+
1;
# end of main
# $locale->text('Dec')
sub chart_of_accounts {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('report');
+ $main::auth->assert('report');
$form->{title} = $locale->text('Chart of Accounts');
- if ($eur) {
+ if ($main::eur) {
$form->{method} = "cash";
}
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('report');
+ $main::auth->assert('report');
$form->{title} = $locale->text('List Transactions');
$form->{title} .= " - " . $locale->text('Account') . " $form->{accno}";
- $year = (localtime)[5] + 1900;
+ my $year = (localtime)[5] + 1900;
# get departments
$form->all_departments(\%myconfig);
} (@{ $form->{all_departments} });
}
- $department = qq|
+ my $department = qq|
<tr>
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
<td colspan=3><select name=department>$form->{selectdepartment}</select></td>
</tr>
| if $form->{selectdepartment};
- $accrual = ($eur) ? "" : "checked";
- $cash = ($eur) ? "checked" : "";
+ my $accrual = ($main::eur) ? "" : "checked";
+ my $cash = ($main::eur) ? "checked" : "";
- $name_1 = "fromdate";
- $id_1 = "fromdate";
- $value_1 = "$form->{fromdate}";
- $trigger_1 = "trigger1";
- $name_2 = "todate";
- $id_2 = "todate";
- $value_2 = "";
- $trigger_2 = "trigger2";
+ my $name_1 = "fromdate";
+ my $id_1 = "fromdate";
+ my $value_1 = "$form->{fromdate}";
+ my $trigger_1 = "trigger1";
+ my $name_2 = "todate";
+ my $id_2 = "todate";
+ my $value_2 = "";
+ my $trigger_2 = "trigger2";
+ my ($button1, $button1_2, $button2, $button2_2, $jsscript);
# with JavaScript Calendar
if ($form->{jsscript}) {
}
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->header;
- $onload = qq|focus()|;
+ my $onload = qq|focus()|;
$onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
$onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
<input type=hidden name=accno value=$form->{accno}>
<input type=hidden name=description value="$form->{description}">
<input type=hidden name=sort value=transdate>
-<input type=hidden name=eur value=$eur>
+<input type=hidden name=eur value=$main::eur>
<input type=hidden name=accounttype value=$form->{accounttype}>
<table border=0 width=100%>
</tr>
|;
+ our $checked;
print qq|
<tr>
<td align=right>
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub format_debit_credit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my $dc = shift;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
my $formatted_dc = $form->format_amount(\%myconfig, abs($dc), 2) . ' ';
$formatted_dc .= ($dc > 0) ? $locale->text('Credit (one letter abbreviation)') : $locale->text('Debit (one letter abbreviation)');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $formatted_dc;
}
sub list_transactions {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('report');
+ $main::auth->assert('report');
$form->{title} = $locale->text('Account') . " $form->{accno} - $form->{description}";
$form->{fromdate} = "1.2.$form->{year}";
#this works from 1901 to 2099, 1900 and 2100 fail.
- $leap = ($form->{year} % 4 == 0) ? "29" : "28";
+ my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
$form->{todate} = "$leap.2.$form->{year}";
last SWITCH;
};
my %column_alignment = map { $_ => 'right' } qw(debit credit);
- @custom_headers = ();
+ my @custom_headers = ();
# Zeile 1:
push @custom_headers, [
{ 'text' => 'Letzte Buchung', },
$report->set_sort_indicator($form->{sort}, 1);
- $column_defs->{balance}->{visible} = 1;
+ $column_defs{balance}->{visible} = 1;
my $ml = ($form->{category} =~ /(A|E)/) ? -1 : 1;
$report->add_separator();
- my $row = {
+ $row = {
'transdate' => {
'data' => "",
'class' => 'listtotal',
$report->add_data($row);
my $saldo_new = format_debit_credit($form->{saldo_new});
- my $row = {
+ $row = {
'transdate' => {
'data' => "",
'class' => 'listtotal',
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_subtotal_row {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
my ($totals, $columns, $column_alignment, $class) = @_;
map { $totals->{$_} = 0 } qw(debit credit);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $row;
}
use SL::Form;
use SL::MoreCommon;
+use strict;
+
sub build_std_url {
- $lxdebug->enter_sub(2);
+ $main::lxdebug->enter_sub(2);
+
+ my $form = $main::form;
my $script = $form->{script};
my $url = "${script}?" . join('&', @parts);
- $lxdebug->leave_sub(2);
+ $main::lxdebug->leave_sub(2);
return $url;
}
# -------------------------------------------------------------------------
sub select_part {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($callback_sub, @parts) = @_;
+ my $form = $main::form;
+ my $locale = $main::locale;
+
my $remap_parts_id = 0;
if (defined($parts[0]->{parts_id}) && !defined($parts[0]->{id})) {
$remap_parts_id = 1;
"remap_parts_id" => $remap_parts_id,
"remap_partnumber" => $remap_partnumber });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub select_part_internal {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my ($new_item, $callback_sub);
delete $new_item->{number};
}
- my $callback_sub = $form->{callback_sub};
+ $callback_sub = $form->{callback_sub};
restore_form($form->{old_form});
call_sub($callback_sub, $new_item);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub part_selection_internal {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $order_by = "description";
+ my $order_by = "description";
$order_by = $form->{"order_by"} if (defined($form->{"order_by"}));
- $order_dir = 1;
+ my $order_dir = 1;
$order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"}));
my %options;
map { $form->{$_} = $options{$_} if ($options{$_}) } qw(no_services no_assemblies assemblies click_button);
- $parts = Common->retrieve_parts(\%myconfig, $form, $order_by, $order_dir);
+ my $parts = Common->retrieve_parts(\%myconfig, $form, $order_by, $order_dir);
+ my $onload;
if (0 == scalar(@{$parts})) {
$form->show_generic_information($locale->text("No part was found matching the search parameters."));
"PARTS" => $parts,
"onload" => $onload });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub delivery_customer_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $order_by = "name";
+ my $order_by = "name";
$order_by = $form->{"order_by"} if (defined($form->{"order_by"}));
- $order_dir = 1;
+ my $order_dir = 1;
$order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"}));
- $delivery = Common->retrieve_delivery_customer(\%myconfig, $form, $order_by, $order_dir);
+ my $delivery = Common->retrieve_delivery_customer(\%myconfig, $form, $order_by, $order_dir);
map({ $delivery->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$delivery}));
+
+ my $onload;
if (0 == scalar(@{$delivery})) {
$form->show_generic_information($locale->text("No Customer was found matching the search parameters."));
} elsif (1 == scalar(@{$delivery})) {
"DELIVERY" => $delivery,
"onload" => $onload });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub vendor_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $order_by = "name";
+ my $order_by = "name";
$order_by = $form->{"order_by"} if (defined($form->{"order_by"}));
- $order_dir = 1;
+ my $order_dir = 1;
$order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"}));
- $vendor = Common->retrieve_vendor(\%myconfig, $form, $order_by, $order_dir);
+ my $vendor = Common->retrieve_vendor(\%myconfig, $form, $order_by, $order_dir);
map({ $vendor->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$vendor}));
+
+ my $onload;
if (0 == scalar(@{$vendor})) {
$form->show_generic_information($locale->text("No Vendor was found matching the search parameters."));
} elsif (1 == scalar(@{$vendor})) {
"VENDOR" => $vendor,
"onload" => $onload });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub calculate_qty {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{formel} =~ s/\r\n//g;
my ($variable_string, $formel) = split /###/,$form->{formel};
+ my @variable;
+ my $onload; # note! this sub is mostly called over a javascript invocation, and it's unlikey that onload is set.
- foreach $item (split m/;/, $variable_string) {
+ foreach my $item (split m/;/, $variable_string) {
next unless $item =~ m/^ \s* (\w+) \s* = \s* (\w+) \s* (\w+) \s* $/x;
push @variable, {
description => $1,
"VARIABLES" => \@variable,
"onload" => $onload });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub set_longdescription {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text("Enter longdescription");
$form->header();
print $form->parse_html_template("generic/set_longdescription");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub H {
- return $locale->quote_special_chars('HTML', $_[0]);
+ return $main::locale->quote_special_chars('HTML', $_[0]);
}
sub Q {
- return $locale->quote_special_chars('URL@HTML', $_[0]);
+ return $main::locale->quote_special_chars('URL@HTML', $_[0]);
}
sub E {
- return $form->escape($_[0]);
+ return $main::form->escape($_[0]);
}
sub NTI {
}
sub format_dates {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($dateformat, $longformat, @indices) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
$dateformat = $myconfig{"dateformat"} unless ($dateformat);
foreach my $idx (@indices) {
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub reformat_numbers {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($numberformat, $places, @indices) = @_;
- return $lxdebug->leave_sub()
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ return $main::lxdebug->leave_sub()
if (!$numberformat || ($numberformat eq $myconfig{"numberformat"}));
foreach my $idx (@indices) {
$myconfig{"numberformat"} = $saved_numberformat;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub show_history {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
my $dbh = $form->dbconnect(\%myconfig);
my ($sort, $sortby) = split(/\-\-/, $form->{order});
$sort =~ s/.*\.(.*)/$1/;
} );
$dbh->disconnect();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub call_sub {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my $name = shift;
+ my $form = $main::form;
+ my $locale = $main::locale;
+
if (!$name) {
$form->error($locale->text("Trying to call a sub without a name"));
}
$form->error(sprintf($locale->text("Attempt to call an undefined sub named '%s'"), $name));
}
- &{ $name }(@_);
+ {
+ no strict "refs";
+ &{ $name }(@_);
+ }
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub show_vc_details {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{vc} = $form->{vc} eq "customer" ? "customer" : "vendor";
$form->isblank("vc_id",
$form->header();
print $form->parse_html_template("common/show_vc_details", { "is_customer" => $form->{vc} eq "customer" });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub retrieve_partunits {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my @part_ids = grep { $_ } map { $form->{"id_${_}"} } (1..$form->{rowcount});
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# -------------------------------------------------------------------------
sub mark_as_paid_common {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($myconfig, $db_name) = @_;
+ my $form = $main::form;
+ my $locale = $main::locale;
+
if($form->{mark_as_paid}) {
my $dbh ||= $form->get_standard_dbh($myconfig);
my $query = qq|UPDATE $db_name SET paid = amount WHERE id = ?|;
} else {
my $referer = $ENV{HTTP_REFERER};
+ my $script;
+ my $callback;
if ($referer =~ /action/) {
$referer =~ /^(.*)\?action\=[^\&]*(\&.*)$/;
$script = $1;
print qq|</body></html>|;
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub cov_selection_internal {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $order_by = "name";
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ my $order_by = "name";
$order_by = $form->{"order_by"} if (defined($form->{"order_by"}));
- $order_dir = 1;
+ my $order_dir = 1;
$order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"}));
my $type = $form->{"is_vendor"} ? $locale->text("vendor") : $locale->text("customer");
- $covs = Common->retrieve_customers_or_vendors(\%myconfig, $form, $order_by, $order_dir, $form->{"is_vendor"}, $form->{"allow_both"});
+ my $covs = Common->retrieve_customers_or_vendors(\%myconfig, $form, $order_by, $order_dir, $form->{"is_vendor"}, $form->{"allow_both"});
map({ $covs->[$_]->{"selected"} = $_ ? 0 : 1; } (0..$#{$covs}));
+
+ my $onload;
if (0 == scalar(@{$covs})) {
$form->show_generic_information(sprintf($locale->text("No %s was found matching the search parameters."), $type));
} elsif (1 == scalar(@{$covs})) {
"COVS" => $covs,
"onload" => $onload }));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# Functions to call add routines beneath different reports
sub sales_invoice {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{script} = 'is.pl';
- $script = "is";
+ my $script = "is";
$form->{type} = "invoice";
$locale = new Locale "$myconfig{countrycode}", "$script";
require "bin/mozilla/$form->{script}";
&add;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub ar_transaction {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{script} = 'ar.pl';
- $script = "ar";
+ my $script = "ar";
$locale = new Locale "$myconfig{countrycode}", "$script";
require "bin/mozilla/$form->{script}";
&add;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub vendor_invoice {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{script} = 'ir.pl';
- $script = "ir";
+ my $script = "ir";
$form->{type} = "invoice";
$locale = new Locale "$myconfig{countrycode}", "$script";
require "bin/mozilla/$form->{script}";
&add;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub ap_transaction {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{script} = 'ap.pl';
- $script = "ap";
+ my $script = "ap";
$locale = new Locale "$myconfig{countrycode}", "$script";
require "bin/mozilla/$form->{script}";
&add;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub gl_transaction {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{script} = 'gl.pl';
- $script = "gl";
+ my $script = "gl";
$locale = new Locale "$myconfig{countrycode}", "$script";
require "bin/mozilla/$form->{script}";
&add;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
1;
require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
+use strict;
1;
# end of main
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
- $auth->assert('customer_vendor_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{title} = "Add";
$form->{callback} = "$form->{script}?action=add&db=$form->{db}" unless $form->{callback};
&form_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
- $auth->assert('customer_vendor_edit');
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{IS_CUSTOMER} = $form->{db} eq 'customer';
$form->header();
print $form->parse_html_template('ct/search');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_names {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit');
+ $main::auth->assert('customer_vendor_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{IS_CUSTOMER} = $form->{db} eq 'customer';
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
- $auth->assert('customer_vendor_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
# show history button
$form->{javascript} = qq|<script type=text/javascript src=js/show_history.js></script>|;
&form_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit');
+ $main::auth->assert('customer_vendor_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->get_lists("employees" => "ALL_EMPLOYEES",
"taxzones" => "ALL_TAXZONES");
$form->header;
print $form->parse_html_template('ct/form_header');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
- $auth->assert('customer_vendor_edit');
+ my $form = $main::form;
print $form->parse_html_template('ct/form_footer', { is_orphaned => $form->{status} eq 'orphaned',
is_customer => $form->{db} eq 'customer' });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add_transaction {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit & ' .
+ $main::auth->assert('customer_vendor_edit & ' .
'(general_ledger | invoice_edit | vendor_invoice_edit | ' .
' request_quotation_edit | sales_quotation_edit | sales_order_edit | purchase_order_edit)');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
# # saving the history
# if(!exists $form->{addition}) {
# $form->{addition} = "ADD TRANSACTION";
}
$form->{callback} = $form->escape($form->{callback}, 1);
- $name = $form->escape("$form->{name}", 1);
+ my $name = $form->escape("$form->{name}", 1);
$form->{callback} =
"$form->{script}?action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&callback=$form->{callback}";
$form->redirect;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_and_ap_transaction {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit & general_ledger');
- $auth->assert('customer_vendor_edit & general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{script} = "ap.pl";
# saving the history
}
# /saving the history
&add_transaction;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_and_ar_transaction {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit & general_ledger');
+ $main::auth->assert('customer_vendor_edit & general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{script} = "ar.pl";
# saving the history
}
# /saving the history
&add_transaction;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_and_invoice {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
if ($form->{db} eq 'customer') {
- $auth->assert('customer_vendor_edit & invoice_edit');
+ $main::auth->assert('customer_vendor_edit & invoice_edit');
} else {
- $auth->assert('customer_vendor_edit & vendor_invoice_edit');
+ $main::auth->assert('customer_vendor_edit & vendor_invoice_edit');
}
$form->{script} = ($form->{db} eq 'customer') ? "is.pl" : "ir.pl";
}
# /saving the history
&add_transaction;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_and_rfq {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit & request_quotation_edit');
+ $main::auth->assert('customer_vendor_edit & request_quotation_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{script} = "oe.pl";
$form->{type} = "request_quotation";
}
# /saving the history
&add_transaction;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_and_quotation {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit & sales_quotation_edit');
- $auth->assert('customer_vendor_edit & sales_quotation_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{script} = "oe.pl";
$form->{type} = "sales_quotation";
}
# /saving the history
&add_transaction;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_and_order {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
if ($form->{db} eq 'customer') {
- $auth->assert('customer_vendor_edit & sales_order_edit');
+ $main::auth->assert('customer_vendor_edit & sales_order_edit');
} else {
- $auth->assert('customer_vendor_edit & purchase_order_edit');
+ $main::auth->assert('customer_vendor_edit & purchase_order_edit');
}
$form->{script} = "oe.pl";
}
# /saving the history
&add_transaction;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_and_close {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
- $auth->assert('customer_vendor_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $msg = ucfirst $form->{db};
- $imsg .= " saved!";
+ my $msg = ucfirst $form->{db};
+ $msg .= " saved!";
$form->isblank("name", $locale->text("Name missing!"));
+ my $rc;
if ($form->{"db"} eq "customer") {
$rc = CT->save_customer(\%myconfig, \%$form);
} else {
# /saving the history
$form->redirect($locale->text($msg));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit');
+ $main::auth->assert('customer_vendor_edit');
- $msg = ucfirst $form->{db};
- $imsg .= " saved!";
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ my $msg = ucfirst $form->{db};
+ $msg .= " saved!";
$form->isblank("name", $locale->text("Name missing!"));
# /saving the history
&edit;
exit;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
- $auth->assert('customer_vendor_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
CT->delete(\%myconfig, \%$form);
- $msg = ucfirst $form->{db};
+ my $msg = ucfirst $form->{db};
$msg .= " deleted!";
# saving the history
if(!exists $form->{addition}) {
$msg = "Cannot delete $form->{db}";
$form->error($locale->text($msg));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit');
+ $main::auth->assert('customer_vendor_edit');
+
+ my $form = $main::form;
&form_header();
&form_footer();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
- $auth->assert('customer_vendor_edit');
+ my $form = $main::form;
&display();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub get_contact {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit');
+ $main::auth->assert('customer_vendor_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
CT->get_contact(\%myconfig, \%$form);
print $form->ajax_response_header(), join '__pjx__', map $form->{"cp_$_"},
qw(name title givenname phone1 phone2 email abteilung fax mobile1 mobile2 satphone satfax project privatphone privatemail birthday used gender);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub get_shipto {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('customer_vendor_edit');
- $auth->assert('customer_vendor_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
CT->get_shipto(\%myconfig, \%$form);
print $form->ajax_response_header(), join '__pjx__', map $form->{"shipto$_"},
qw(name department_1 department_2 street zipcode city country contact phone fax email used);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub get_delivery {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit');
+ $main::auth->assert('customer_vendor_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
CT->get_delivery(\%myconfig, \%$form );
$form->{IS_CUSTOMER} = $form->{db} eq 'customer';
print $form->ajax_response_header(), $form->parse_html_template('ct/get_delivery');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_shipto {
$main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit');
+ $main::auth->assert('customer_vendor_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
CT->get_shipto(\%myconfig, \%$form);
sub delete_contact {
$main::lxdebug->enter_sub();
- $auth->assert('customer_vendor_edit');
+ $main::auth->assert('customer_vendor_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
CT->get_contact(\%myconfig, \%$form);
$main::lxdebug->leave_sub();
}
-sub continue { call_sub($form->{nextsub}); }
+sub continue { call_sub($main::form->{nextsub}); }
use SL::Common;
use SL::DATEV;
+use strict;
+
1;
# end of main
require "bin/mozilla/common.pl";
-sub continue { call_sub($form->{"nextsub"}); }
+sub continue { call_sub($main::form->{"nextsub"}); }
sub export {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('datev_export');
+ $main::auth->assert('datev_export');
$form->{title} = $locale->text("DATEX - Export Assistent");
</body>
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub export2 {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('datev_export');
+ my $form = $main::form;
+
+ $main::auth->assert('datev_export');
if ($form->{exporttype} == 0) {
&export_bewegungsdaten();
} else {
&export_stammdaten();
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub export_bewegungsdaten {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('datev_export');
+ $main::auth->assert('datev_export');
$form->{title} = $locale->text("DATEX - Export Assistent");
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub export_stammdaten {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('datev_export');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('datev_export');
$form->{title} = $locale->text("DATEX - Export Assistent");
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub export3 {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('datev_export');
+ $main::auth->assert('datev_export');
DATEV::clean_temporary_directories();
print("</body></html>");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub download {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- $auth->assert('datev_export');
+ $main::auth->assert('datev_export');
my $tmp_name = Common->tmpname();
my $zip_name = strftime("lx-office-datev-export-%Y%m%d.zip", localtime(time()));
DATEV::clean_temporary_directories();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
require "bin/mozilla/reportgenerator.pl";
require "bin/mozilla/io.pl";
+use strict;
+
1;
sub edit_config {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
DN->get_config(\%myconfig, \%$form);
$form->get_lists('charts' => { 'key' => 'ALL_CHARTS',
$form->header();
print $form->parse_html_template("dunning/edit_config");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('dunning_edit');
+ $main::auth->assert('dunning_edit');
# setup customer selection
$form->all_vc(\%myconfig, "customer", "AR");
print $form->parse_html_template("dunning/add");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub show_invoices {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('dunning_edit');
+ 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');
$form->header();
print $form->parse_html_template("dunning/show_invoices");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('config');
+ $main::auth->assert('config');
for my $i (1 .. $form->{rowcount}) {
if ($form->{"dunning_description_$i"} ne "") {
# /saving the history
$form->redirect($locale->text('Dunning Process Config saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_dunning {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('dunning_edit');
+ $main::auth->assert('dunning_edit');
my $active=1;
my @rows = ();
foreach my $level (values %{ $levels }) {
next unless scalar @{ $level };
- DN->save_dunning(\%myconfig, $form, $level, $userspath, $spool);
+ DN->save_dunning(\%myconfig, $form, $level, $main::userspath, $main::spool);
}
}
"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);
+ DN->save_dunning(\%myconfig, $form, $level, $main::userspath, $main::spool);
}
}
$form->redirect($locale->text('Dunning Process started for selected invoices!'));
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub set_email {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('dunning_edit');
+ 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"));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('dunning_edit');
+ $main::auth->assert('dunning_edit');
$form->get_lists("customers" => "ALL_CUSTOMERS",
"departments" => "ALL_DEPARTMENTS");
print $form->parse_html_template("dunning/search");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub show_dunning {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
- $auth->assert('dunning_edit');
+ $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);
my $i = 0;
- foreach $ref (@{ $form->{DUNNINGS} }) {
+ foreach my $ref (@{ $form->{DUNNINGS} }) {
$i++;
if ($previous_dunning_id != $ref->{dunning_id}) {
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print_dunning {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('dunning_edit');
+ my $form = $main::form;
+
+ $main::auth->assert('dunning_edit');
$form->{rowcount} = 1;
$form->{selected_1} = 1;
print_multiple();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print_multiple {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('dunning_edit');
+ $main::auth->assert('dunning_edit');
$form->{title} = $locale->text('Print dunnings');
$form->redirect($locale->text('Could not print dunning.'));
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub continue {
- call_sub($form->{nextsub});
+ call_sub($main::form->{nextsub});
}
# end of main
-# #=====================================================================
+#=====================================================================
# LX-Office ERP
# Copyright (C) 2004
# Based on SQL-Ledger Version 2.1.9
require "bin/mozilla/io.pl";
require "bin/mozilla/reportgenerator.pl";
+use strict;
+
+my $print_post;
+
1;
# end of main
sub check_do_access {
- $auth->assert($form->{type} . '_edit');
+ $main::auth->assert($main::form->{type} . '_edit');
}
sub set_headings {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
my ($action) = @_;
+ my $form = $main::form;
+ my $locale = $main::locale;
+
if ($form->{type} eq 'purchase_delivery_order') {
$form->{vc} = 'vendor';
$form->{title} = $action eq "edit" ? $locale->text('Edit Purchase Delivery Order') : $locale->text('Add Purchase Delivery Order');
$form->{heading} = $locale->text('Delivery Order');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+
set_headings("add");
$form->{callback} = build_std_url('action=add', 'type', 'vc') unless ($form->{callback});
prepare_order();
display_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+
# show history button
$form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
#/show hhistory button
# reset rowcount
undef $form->{rowcount};
add();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
# }
} elsif (!$form->{id}) {
add();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
+ my ($language_id, $printer_id);
if ($form->{print_and_save}) {
$form->{action} = "dispatcher";
$form->{action_print} = "1";
display_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub order_links {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
# get customer/vendor
$form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
# retrieve order/quotation
- $form->{webdav} = $webdav;
+ $form->{webdav} = $main::webdav;
$form->{jsscript} = 1;
my $editing = $form->{id};
$form->{employee} = "$form->{employee}--$form->{employee_id}";
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub prepare_order {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
$form->{formname} = $form->{type} unless $form->{formname};
my $i = 0;
- foreach $ref (@{ $form->{form_details} }) {
+ foreach my $ref (@{ $form->{form_details} }) {
$form->{rowcount} = ++$i;
map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
} else {
$form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"});
}
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
+ my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
$dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
+ my $decimalplaces = ($dec > 2) ? $dec : 2;
# copy reqdate from deliverydate for invoice -> order conversion
$form->{"reqdate_$i"} = $form->{"deliverydate_$i"} unless $form->{"reqdate_$i"};
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
$form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
$form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
$form->{jsscript} = 1;
#write Trigger
- $jsscript = Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", "reqdate", "BL", "trigger2");
+ my $jsscript = Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", "reqdate", "BL", "trigger2");
my @old_project_ids = ($form->{"globalproject_id"});
map({ push(@old_project_ids, $form->{"project_id_$_"})
print $form->parse_html_template('do/form_header');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+
$form->{PRINT_OPTIONS} = print_options('inline' => 1);
print $form->parse_html_template('do/form_footer');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update_delivery_order {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
set_headings($form->{"id"} ? "edit" : "add");
$form->{update} = 1;
+ my $payment_id;
$payment_id = $form->{payment_id} if $form->{payment_id};
check_name($form->{vc});
$form->{payment_id} = $payment_id if $form->{payment_id} eq "";
# for pricegroups
- $i = $form->{rowcount};
+ my $i = $form->{rowcount};
if ( ($form->{"partnumber_$i"} eq "")
&& ($form->{"description_$i"} eq "")
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
$form->{vc} = $form->{type} eq 'purchase_delivery_order' ? 'vendor' : 'customer';
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
print $form->parse_html_template('do/search');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub orders {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
- ($form->{ $form->{vc} }, $form->{"${form->{vc}}_id"}) = split(/--/, $form->{ $form->{vc} });
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
+
+ ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} });
report_generator_set_default_sort('transdate', 1);
push @options, $locale->text('Vendor') . " : $form->{vendor}";
}
if ($form->{department}) {
- ($department) = split /--/, $form->{department};
+ my ($department) = split /--/, $form->{department};
push @options, $locale->text('Department') . " : $department";
}
if ($form->{donumber}) {
$form->{callback} = $href .= "&sort=$form->{sort}";
# escape callback for href
- $callback = $form->escape($href);
+ my $callback = $form->escape($href);
my $edit_url = build_std_url('action=edit', 'type', 'vc');
my $edit_order_url = build_std_url('script=oe.pl', 'type=' . ($form->{type} eq 'sales_delivery_order' ? 'sales_order' : 'purchase_order'), 'action=edit');
my $idx = 1;
- foreach $dord (@{ $form->{DO} }) {
+ foreach my $dord (@{ $form->{DO} }) {
$dord->{open} = $dord->{closed} ? $locale->text('No') : $locale->text('Yes');
$dord->{delivered} = $dord->{delivered} ? $locale->text('Yes') : $locale->text('No');
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->isblank("transdate", $locale->text('Delivery Order Date missing!'));
$form->{donumber} =~ s/^\s*//g;
$form->{donumber} =~ s/\s*$//g;
- $msg = ucfirst $form->{vc};
+ my $msg = ucfirst $form->{vc};
$form->isblank($form->{vc}, $locale->text($msg . " missing!"));
# $locale->text('Customer missing!');
update();
exit;
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+ my $locale = $main::locale;
+
map { delete $form->{$_} } qw(action header login password);
my @variables = map { { 'key' => $_, 'value' => $form->{$_} } } grep { '' eq ref $form->{$_} } keys %{ $form };
print $form->parse_html_template('do/delete', { 'VARIABLES' => \@variables });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_delivery_order {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
if (DO->delete()) {
# saving the history
if(!exists $form->{addition}) {
$form->error($locale->text('Cannot delete delivery order!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub invoice {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
check_do_access();
- $auth->assert($form->{type} eq 'purchase_delivery_order' ? 'vendor_invoice_edit' : 'invoice_edit');
+ $main::auth->assert($form->{type} eq 'purchase_delivery_order' ? 'vendor_invoice_edit' : 'invoice_edit');
$form->{convert_from_do_ids} = $form->{id};
$form->{deliverydate} = $form->{transdate};
delete @{$form}{qw(id closed delivered)};
+ my ($script, $buysell);
if ($form->{type} eq 'purchase_delivery_order') {
$form->{title} = $locale->text('Add Vendor Invoice');
$form->{script} = 'ir.pl';
$buysell = 'buy';
}
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice basefactor);
}
prepare_invoice();
# format amounts
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
$form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"});
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
+ my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
$dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
+ my $decimalplaces = ($dec > 2) ? $dec : 2;
# copy delivery date from reqdate for order -> invoice conversion
$form->{"deliverydate_$i"} = $form->{"reqdate_$i"}
display_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub invoice_multi {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
check_do_access();
- $auth->assert($form->{type} eq 'sales_delivery_order' ? 'invoice_edit' : 'vendor_invoice_edit');
+ $main::auth->assert($form->{type} eq 'sales_delivery_order' ? 'invoice_edit' : 'vendor_invoice_edit');
my @do_ids = map { $form->{"trans_id_$_"} } grep { $form->{"multi_id_$_"} } (1..$form->{rowcount});
$form->{closed} = 0;
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
- my $buysell;
+ my ($script, $buysell);
if ($source_type eq 'purchase_delivery_order') {
$form->{title} = $locale->text('Add Vendor Invoice');
$form->{script} = 'ir.pl';
prepare_invoice();
display_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_as_new {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+
$form->{saveasnew} = 1;
$form->{closed} = 0;
$form->{delivered} = 0;
save();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub e_mail {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_do_access();
+ my $form = $main::form;
+
$form->{print_and_save} = 1;
$print_post = 1;
edit_e_mail();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub calculate_stock_in_out {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my $i = shift;
if (!$form->{"id_${i}"}) {
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return '';
}
- AM->retrieve_all_units();
+ my $all_units = AM->retrieve_all_units();
my $in_out = $form->{type} =~ /^sales/ ? 'out' : 'in';
my $sinfo = DO->unpack_stock_information('packed' => $form->{"stock_${in_out}_${i}"});
'max_places' => 2);
$content .= qq| <input type="button" onclick="open_stock_in_out_window('${in_out}', $i);" value="?">|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $content;
}
sub get_basic_bin_wh_info {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my $stock_info = shift;
+ my $form = $main::form;
+
foreach my $sinfo (@{ $stock_info }) {
next unless ($sinfo->{bin_id});
map { $sinfo->{"${_}_description"} = $sinfo->{"${_}description"} = $bin_info->{"${_}_description"} } qw(bin warehouse);
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub stock_in_out_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
if ($form->{in_out} eq 'out') {
stock_out_form();
stock_in_form();
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub redo_stock_info {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my %params = @_;
+ my $form = $main::form;
+
my @non_empty = grep { $_->{qty} } @{ $params{stock_info} };
if ($params{add_empty_row}) {
@{ $params{stock_info} } = @non_empty;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update_stock_in {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
my $stock_info = [];
display_stock_in_form($stock_info);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub stock_in_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my $stock_info = DO->unpack_stock_information('packed' => $form->{stock});
display_stock_in_form($stock_info);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_stock_in_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my $stock_info = shift;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
$form->{title} = $locale->text('Stock');
my $part_info = IC->get_basic_part_info('id' => $form->{parts_id});
'STOCK_INFO' => $stock_info,
'PART_INFO' => $part_info, });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub set_stock_in {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
my $stock_info = [];
$form->header();
print $form->parse_html_template('do/set_stock_in_out');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub stock_out_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{title} = $locale->text('Release From Stock');
'WHCONTENTS' => $form->{delivered} ? $stock_info : \@contents,
'PART_INFO' => $part_info, });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub set_stock_out {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
my $stock_info = [];
print $form->parse_html_template('do/set_stock_in_out');
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_in {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
if (DO->is_marked_as_delivered('id' => $form->{id})) {
$form->show_generic_error($locale->text('The parts for this delivery order have already been transferred in.'), 'back_button' => 1);
push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
update();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
exit 0;
}
save();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_out {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
if (DO->is_marked_as_delivered('id' => $form->{id})) {
$form->show_generic_error($locale->text('The parts for this delivery order have already been transferred out.'), 'back_button' => 1);
$request->{ok} = $request->{sum_base_qty} <= $inv->{qty};
}
- foreach $request (values %request_map) {
+ foreach my $request (values %request_map) {
next if ($request->{ok});
my $pinfo = $part_info_map{$request->{parts_id}};
push @{ $form->{ERRORS} }, $locale->text('The delivery order has not been marked as delivered. The warehouse contents have not changed.');
update();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
exit 0;
}
save();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub mark_closed {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
DO->close_orders('ids' => [ $form->{id} ]);
update();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub yes {
- call_sub($form->{yes_nextsub});
+ call_sub($main::form->{yes_nextsub});
}
sub no {
- call_sub($form->{no_nextsub});
+ call_sub($main::form->{no_nextsub});
}
sub update {
- call_sub($form->{update_nextsub} || $form->{nextsub} || 'update_delivery_order');
+ call_sub($main::form->{update_nextsub} || $main::form->{nextsub} || 'update_delivery_order');
}
sub dispatcher {
+ my $form = $main::form;
+ my $locale = $main::locale;
+
foreach my $action (qw(update ship_to print e_mail save transfer_out transfer_in mark_closed save_as_new invoice delete)) {
if ($form->{"action_${action}"}) {
call_sub($action);
require "bin/mozilla/common.pl";
+use strict;
+
sub save_draft {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
if (!$form->{draft_id} && !$form->{draft_description}) {
restore_form($form->{SAVED_FORM}, 1) if ($form->{SAVED_FORM});
$form->header();
print($form->parse_html_template("drafts/save_new"));
- return $lxdebug->leave_sub();
+ return $main::lxdebug->leave_sub();
}
my ($draft_id, $draft_description) = ($form->{draft_id}, $form->{draft_description});
update();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub remove_draft {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
Drafts->remove(\%myconfig, $form, $form->{draft_id}) if ($form->{draft_id});
delete @{$form}{qw(draft_id draft_description)};
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub load_draft_maybe {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $lxdebug->leave_sub() and return 0 if ($form->{DONT_LOAD_DRAFT});
+ $main::lxdebug->leave_sub() and return 0 if ($form->{DONT_LOAD_DRAFT});
my ($draft_nextsub) = @_;
my @drafts = Drafts->list(\%myconfig, $form);
- $lxdebug->leave_sub() and return 0 unless (@drafts);
+ $main::lxdebug->leave_sub() and return 0 unless (@drafts);
$draft_nextsub = "add" unless ($draft_nextsub);
"SAVED_FORM" => $saved_form,
"draft_nextsub" => $draft_nextsub }));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return 1;
}
sub dont_load_draft {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my $draft_nextsub = $form->{draft_nextsub} || "add";
call_sub($draft_nextsub);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub load_draft {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
my ($old_form, $id, $description) = Drafts->load(\%myconfig, $form, $form->{id});
$old_form = YAML::Load($old_form);
my %dont_save_vars = map { $_ => 1 } @Drafts::dont_save;
- my @restore_vars = grep { !$skip_vars{$_} } keys %{ $old_form };
+ my @restore_vars = grep { !$dont_save_vars{$_} } keys %{ $old_form };
@{$form}{@restore_vars} = @{$old_form}{@restore_vars};
update();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_drafts {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
my @ids;
foreach (keys %{$form}) {
add();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub draft_action_dispatcher {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
if ($form->{draft_action} eq $locale->text("Skip")) {
dont_load_draft();
delete_drafts();
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
1;
require "bin/mozilla/reportgenerator.pl";
+use strict;
+
sub _collect_links {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my $dest = shift;
+ my $form = $main::form;
+
$dest->{LINKS} = [];
foreach my $i (1 .. $form->{trans_rowcount}) {
push @{ $dest->{LINKS} }, { map { +"trans_$_" => $form->{"trans_${_}_$i"} } qw(id type info) };
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
_collect_links($form);
display_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my $ref = FU->retrieve('id' => $form->{id});
display_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
$form->get_lists("employees" => "EMPLOYEES");
$form->header();
print $form->parse_html_template('fu/add_edit');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_follow_up {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->isblank('created_for_user', $locale->text('You must chose a user.'));
$form->isblank('follow_up_date', $locale->text('The follow-up date is missing.'));
report();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub finish {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
if ($form->{id}) {
my $ref = FU->retrieve('id' => $form->{id});
report();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
if ($form->{id}) {
my $ref = FU->retrieve('id' => $form->{id});
report();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->get_lists("employees" => "EMPLOYEES");
$form->header();
print $form->parse_html_template('fu/search');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
my @report_params = qw(created_for subject body reference follow_up_date_from follow_up_date_to itime_from itime_to due_only all_users done not_done);
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub report_for_todo_list {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my @report_params = qw(created_for subject body reference follow_up_date_from follow_up_date_to itime_from itime_to due_only all_users done not_done);
'edit_url' => $edit_url, });
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $content;
}
sub edit_access_rights {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my $access = FU->retrieve_access_rights();
$form->header();
print $form->parse_html_template('fu/edit_access_rights');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_access_rights {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my %access;
$form->{SAVED_MESSAGE} = $locale->text('The access rights have been saved.');
edit_access_rights();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- call_sub($form->{nextsub});
+ call_sub($main::form->{nextsub});
}
sub continue {
- call_sub($form->{nextsub});
+ call_sub($main::form->{nextsub});
}
sub save {
- if ($form->{save_nextsub}) {
- call_sub($form->{save_nextsub});
+ if ($main::form->{save_nextsub}) {
+ call_sub($main::form->{save_nextsub});
} else {
save_follow_up();
}
}
sub dispatcher {
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+
foreach my $action (qw(finish save delete)) {
if ($form->{"action_${action}"}) {
call_sub($action);
use SL::Form;
use SL::GenericTranslations;
+use strict;
+
sub edit_greetings {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('config');
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->get_lists('languages' => 'LANGUAGES');
$form->header();
print $form->parse_html_template('generictranslations/edit_greetings');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_greetings {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('config');
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->get_lists('languages' => 'LANGUAGES');
edit_greetings();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
1;
require "bin/mozilla/drafts.pl";
require "bin/mozilla/reportgenerator.pl";
-1;
-
-# end of main
+use strict;
# this is for our long dates
# $locale->text('January')
# $locale->text('Nov')
# $locale->text('Dec')
+my $tax;
+my $debitlock = 0;
+my $creditlock = 0;
+
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- return $lxdebug->leave_sub() if (load_draft_maybe());
+ return $main::lxdebug->leave_sub() if (load_draft_maybe());
$form->{title} = "Add";
$form->{show_details} = $myconfig{show_form_details} unless defined $form->{show_details};
&display_form(1);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub prepare_transaction {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
GL->transaction(\%myconfig, \%$form);
my $i = 1;
my $tax = 0;
my $taxaccno = "";
- foreach $ref (@{ $form->{GL} }) {
- $j = $i - 1;
+ foreach my $ref (@{ $form->{GL} }) {
+ my $j = $i - 1;
if ($tax && ($ref->{accno} eq $taxaccno)) {
$form->{"tax_$j"} = abs($ref->{amount});
$form->{"taxchart_$j"} = $ref->{id} . "--" . $ref->{taxrate};
($form->datetonum($form->{transdate}, \%myconfig) <=
$form->datetonum($form->{closedto}, \%myconfig));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
prepare_transaction();
display_rows();
form_footer();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
$form->{title} = $locale->text('Journal');
} (@{ $form->{all_departments} });
}
- $department = qq|
+ my $department = qq|
<tr>
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
<td colspan=3><select name=department>$form->{selectdepartment}</select></td>
# use JavaScript Calendar or not
$form->{jsscript} = 1;
- $jsscript = "";
+ my $jsscript = "";
+ my ($button1, $button2, $onload);
if ($form->{jsscript}) {
# with JavaScript Calendar
</body>
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_subtotal_row {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
map { $totals->{$_} = 0 } @{ $subtotal_columns };
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $row;
}
sub generate_report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
report_generator_set_default_sort('transdate', 1);
my %totals = map { $_ => 0 } @totals_columns;
my $idx = 0;
- foreach $ref (@{ $form->{GL} }) {
+ foreach my $ref (@{ $form->{GL} }) {
my %rows;
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{oldtransdate} = $form->{transdate};
my $credittax = 0;
my $debitcount = 0;
my $creditcount = 0;
- $debitlock = 0;
- $creditlock = 0;
+ my ($debitcredit, $amount);
my @flds =
qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
($form->{"debit_$i"} == 0)
? $form->{"credit_$i"}
: $form->{"debit_$i"};
- $j = $#a;
+ my $j = $#a;
if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) {
$form->{"taxchart_$i"} = "0--0.00";
$form->{"tax_$i"} = 0;
}
- ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
+ my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
if ($taxkey > 1) {
if ($debitcredit) {
$debittax = 1;
}
}
- for $i (1 .. $count) {
- $j = $i - 1;
+ for my $i (1 .. $count) {
+ my $j = $i - 1;
for (@flds) { $form->{"${_}_$i"} = $a[$j]->{$_} }
}
- for $i ($count + 1 .. $form->{rowcount}) {
+ for my $i ($count + 1 .. $form->{rowcount}) {
for (@flds) { delete $form->{"${_}_$i"} }
}
$form->{rowcount} = $count + 1;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_form {
my ($init) = @_;
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
&form_header($init);
# }
&display_rows($init);
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_rows {
my ($init) = @_;
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $cgi = $main::cgi;
$form->{debit_1} = 0 if !$form->{"debit_1"};
$form->{totaldebit} = 0;
my %charts = ();
my $taxchart_init;
foreach my $item (@{ $form->{ALL_CHARTS} }) {
- if ($item->{charttype} eq 'H'){ #falls überschrift
+ if ($item->{charttype} eq 'H'){ #falls überschrift
next; #überspringen (Bug 1150)
}
my $key = $item->{accno} . "--" . $item->{tax_id};
$taxcharts{$item->{id}} = $item;
}
- for $i (1 .. $form->{rowcount}) {
+ my ($source, $memo, $source_hidden, $memo_hidden);
+ for my $i (1 .. $form->{rowcount}) {
if ($form->{show_details}) {
$source = qq|
<td><input name="source_$i" value="$form->{"source_$i"}" size="16"></td>|;
$selected_accno = '' if ($init);
$selected_taxchart ||= $taxchart_init;
- $accno = qq|<td>| .
+ my $accno = qq|<td>| .
NTI($cgi->popup_menu('-name' => "accno_$i",
'-id' => "accno_$i",
'-onChange' => "setTaxkey($i)",
'-default' => $selected_taxchart))
. qq|</td>|;
+ my ($fx_transaction, $checked);
if ($init) {
if ($form->{transfer}) {
$fx_transaction = qq|
if ($i < $form->{rowcount}) {
if ($form->{transfer}) {
$checked = ($form->{"fx_transaction_$i"}) ? "1" : "";
- $x = ($checked) ? "x" : "";
+ my $x = ($checked) ? "x" : "";
$fx_transaction = qq|
<td><input type=hidden name="fx_transaction_$i" value="$checked">$x</td>
|;
$form->hide_form(qw(rowcount selectaccno));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_header {
my ($init) = @_;
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
my @old_project_ids = ();
map({ push(@old_project_ids, $form->{"project_id_$_"})
GL->get_chart_balances('charts' => $form->{ALL_CHARTS});
- $title = $form->{title};
+ my $title = $form->{title};
$form->{title} = $locale->text("$title General Ledger Transaction");
- $readonly = ($form->{id}) ? "readonly" : "";
+ my $readonly = ($form->{id}) ? "readonly" : "";
- $show_details_checked = "checked" if $form->{show_details};
+ my $show_details_checked = "checked" if $form->{show_details};
- $ob_transaction_checked = "checked" if $form->{ob_transaction};
- $cb_transaction_checked = "checked" if $form->{cb_transaction};
+ my $ob_transaction_checked = "checked" if $form->{ob_transaction};
+ my $cb_transaction_checked = "checked" if $form->{cb_transaction};
# $locale->text('Add General Ledger Transaction')
# $locale->text('Edit General Ledger Transaction')
$form->{selectdepartment} =~
s/option>\Q$form->{department}\E/option selected>$form->{department}/;
- if (($rows = $form->numtextrows($form->{description}, 50)) > 1) {
+ my $description;
+ if ((my $rows = $form->numtextrows($form->{description}, 50)) > 1) {
$description =
qq|<textarea name=description rows=$rows cols=50 wrap=soft $readonly >$form->{description}</textarea>|;
} else {
qq|<input name=description size=50 value="$form->{description}" $readonly>|;
}
- $taxincluded = ($form->{taxincluded}) ? "checked" : "";
+ my $taxincluded = ($form->{taxincluded}) ? "checked" : "";
if ($init) {
$taxincluded = "checked";
}
+ my $department;
$department = qq|
<tr>
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
# use JavaScript Calendar or not
$form->{jsscript} = 1;
- $jsscript = "";
+ my $jsscript = "";
+ my ($button1, $button2);
if ($form->{jsscript}) {
# with JavaScript Calendar
$jsscript
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
my $follow_ups_block;
if ($form->{id}) {
}
}
- ($dec) = ($form->{totaldebit} =~ /\.(\d+)/);
+ my ($dec) = ($form->{totaldebit} =~ /\.(\d+)/);
$dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
- $radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
+ my $decimalplaces = ($dec > 2) ? $dec : 2;
+ my $radieren = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
map {
$form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, 2, " ")
<br>
|;
- $transdate = $form->datetonum($form->{transdate}, \%myconfig);
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
if ($form->{id}) {
</body>
</html>
";
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->header;
delete $form->{header};
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
}
. $locale->text('Yes') . qq|">
</form>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub yes {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
if (GL->delete_transaction(\%myconfig, \%$form)){
# saving the history
if(!exists $form->{addition} && $form->{id} ne "") {
$form->redirect($locale->text('Transaction deleted!'))
}
$form->error($locale->text('Cannot delete transaction!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post_transaction {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
# check if there is something in reference and date
$form->isblank("reference", $locale->text('Reference missing!'));
$form->isblank("transdate", $locale->text('Transaction Date missing!'));
$form->isblank("description", $locale->text('Description missing!'));
- $transdate = $form->datetonum($form->{transdate}, \%myconfig);
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $transdate = $form->datetonum($form->{transdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
my @a = ();
my $count = 0;
my $credittax = 0;
my $debitcount = 0;
my $creditcount = 0;
- $creditlock = 0;
- $debitlock = 0;
+ my $debitcredit;
my @flds = qw(accno debit credit projectnumber fx_transaction source memo tax taxchart);
if (!$debitcredit && $debittax) {
$form->{"taxchart_$i"} = "0--0.00";
}
- $amount = ($form->{"debit_$i"} == 0)
+ my $amount = ($form->{"debit_$i"} == 0)
? $form->{"credit_$i"}
: $form->{"debit_$i"};
- $j = $#a;
+ my $j = $#a;
if (($debitcredit && $credittax) || (!$debitcredit && $debittax)) {
$form->{"taxchart_$i"} = "0--0.00";
$form->{"tax_$i"} = 0;
}
- ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
+ my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"});
if ($taxkey > 1) {
if ($debitcredit) {
$debittax = 1;
$count++;
}
- for $i (1 .. $count) {
- $j = $i - 1;
+ for my $i (1 .. $count) {
+ my $j = $i - 1;
for (@flds) { $form->{"${_}_$i"} = $a[$j]->{$_} }
}
- for $i ($count + 1 .. $form->{rowcount}) {
+ for my $i ($count + 1 .. $form->{rowcount}) {
for (@flds) { delete $form->{"${_}_$i"} }
}
- for $i (1 .. $form->{rowcount}) {
- $dr = $form->{"debit_$i"};
- $cr = $form->{"credit_$i"};
+ my ($debit, $credit, $taxtotal);
+ for my $i (1 .. $form->{rowcount}) {
+ my $dr = $form->{"debit_$i"};
+ my $cr = $form->{"credit_$i"};
$tax = $form->{"tax_$i"};
if ($dr && $cr) {
$form->error($locale->text('Cannot post transaction with a debit and credit entry for the same account!'));
$form->error($locale->text('Empty transaction!'));
}
- if (($errno = GL->post_transaction(\%myconfig, \%$form)) <= -1) {
+ if ((my $errno = GL->post_transaction(\%myconfig, \%$form)) <= -1) {
$errno *= -1;
+ my @err;
$err[1] = $locale->text('Cannot have a value in both Debit and Credit!');
$err[2] = $locale->text('Debit and credit out of balance!');
$err[3] = $locale->text('Cannot post a transaction without a value!');
}
# /saving the history
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text("$form->{title} General Ledger Transaction");
$form->{storno} = 0;
$form->{callback} = build_std_url("action=add", "show_details");
$form->redirect($form->{callback});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post_as_new {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
$form->{id} = 0;
&add;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub storno {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
# don't cancel cancelled transactions
if (IS->has_storno(\%myconfig, $form, 'gl')) {
$form->redirect(sprintf $locale->text("Transaction %d cancelled."), $form->{storno_id});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub continue {
- call_sub($form->{nextsub});
+ call_sub($main::form->{nextsub});
}
+
+1;
#use SL::PE;
-# use strict;
+use strict;
#use warnings;
# global imports
use SL::InstallationCheck;
+use strict;
+
sub verify_installation {
my $script = $0;
$script =~ s|.*/||;
- return unless ($form{"action"} && ($script eq "login.pl"));
+ my $form = $main::form;
+
+ return unless ($form->{"action"} && ($script eq "login.pl"));
SL::InstallationCheck::check_for_conditional_dependencies();
return if (scalar(@missing_modules) == 0);
use SL::Locale;
- my $locale = new Locale($language, "installationcheck");
+ my $locale = new Locale($main::language, "installationcheck");
print(qq|content-type: text/html
require "bin/mozilla/common.pl";
+use strict;
+
# any custom scripts for this one
if (-f "bin/mozilla/custom_invoice_io.pl") {
eval { require "bin/mozilla/custom_ivvoice_io.pl"; };
}
-if (-f "bin/mozilla/$form->{login}_invoice_io.pl") {
- eval { require "bin/mozilla/$form->{login}_invoice_io.pl"; };
+if (-f "bin/mozilla/$main::form->{login}_invoice_io.pl") {
+ eval { require "bin/mozilla/$main::form->{login}_invoice_io.pl"; };
}
1;
# neue Optik im Rechnungsformular #
########################################
#sub display_row {
-# $lxdebug->enter_sub();
+# $main::lxdebug->enter_sub();
# my $numrows = shift;
#
# my $is_sales =
# # for last row
# $column_data{sellprice_pg} = qq|<td align="right"> </td>|;
# }
-#
+#
# $column_data{sellprice} =
# qq|<td><input name="sellprice_$i" size="10" onBlur=\"check_right_number_format(this)\" value="|
# . $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
# $form->{marge_percent} = ($form->{sellprice_total} - $form->{lastcost_total}) / $form->{sellprice_total} * 100;
# }
#
-# $lxdebug->leave_sub();
+# $main::lxdebug->leave_sub();
#}
sub set_pricegroup {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
my $rowcount = shift;
- for $j (1 .. $rowcount) {
- my $pricegroup_old = $form->{"pricegroup_old_$i"};
+ for my $j (1 .. $rowcount) {
+ my $pricegroup_old = $form->{"pricegroup_old_$j"};
if ($form->{PRICES}{$j}) {
- $len = 0;
- $prices = '<option value="--">' . $locale->text("none (pricegroup)") . '</option>';
- $price = 0;
- foreach $item (@{ $form->{PRICES}{$j} }) {
+ my $len = 0;
+ my $prices = '<option value="--">' . $locale->text("none (pricegroup)") . '</option>';
+ my $price = 0;
+ foreach my $item (@{ $form->{PRICES}{$j} }) {
#$price = $form->round_amount($myconfig, $item->{price}, 5);
#$price = $form->format_amount($myconfig, $item->{price}, 2);
- $price = $item->{price};
- $pricegroup_id = $item->{pricegroup_id};
- $pricegroup = $item->{pricegroup};
+ my $price = $item->{price};
+ my $pricegroup_id = $item->{pricegroup_id};
+ my $pricegroup = $item->{pricegroup};
# build drop down list for pricegroups
$prices .=
$form->{"prices_$j"} = $prices;
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('part_service_assembly_edit | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('part_service_assembly_edit | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | '.
'purchase_delivery_order_edit | sales_delivery_order_edit');
exit;
}
- Common::webdav_folder($form) if ($webdav);
+ Common::webdav_folder($form) if ($main::webdav);
# if ( $form->{print_and_post}
# && $form->{second_run}
# }
&form_header;
- $numrows = ++$form->{rowcount};
- $subroutine = "display_row";
+ {
+ no strict 'refs';
- if ($form->{item} eq 'part') {
+ my $numrows = ++$form->{rowcount};
+ my $subroutine = "display_row";
- #set preisgruppenanzahl
- $numrows = $form->{price_rows};
- $subroutine = "price_row";
+ if ($form->{item} eq 'part') {
- &{$subroutine}($numrows);
+ #set preisgruppenanzahl
+ $numrows = $form->{price_rows};
+ $subroutine = "price_row";
- $numrows = ++$form->{makemodel_rows};
- $subroutine = "makemodel_row";
- }
- if ($form->{item} eq 'assembly') {
- $numrows = $form->{price_rows};
- $subroutine = "price_row";
+ &{$subroutine}($numrows);
- &{$subroutine}($numrows);
+ $numrows = ++$form->{makemodel_rows};
+ $subroutine = "makemodel_row";
+ }
+ if ($form->{item} eq 'assembly') {
+ $numrows = $form->{price_rows};
+ $subroutine = "price_row";
- $numrows = ++$form->{makemodel_rows};
- $subroutine = "makemodel_row";
+ &{$subroutine}($numrows);
- # create makemodel rows
- &{$subroutine}($numrows);
+ $numrows = ++$form->{makemodel_rows};
+ $subroutine = "makemodel_row";
- $numrows = ++$form->{assembly_rows};
- $subroutine = "assembly_row";
- }
- if ($form->{item} eq 'service') {
- $numrows = $form->{price_rows};
- $subroutine = "price_row";
+ # create makemodel rows
+ &{$subroutine}($numrows);
- &{$subroutine}($numrows);
+ $numrows = ++$form->{assembly_rows};
+ $subroutine = "assembly_row";
+ }
+ if ($form->{item} eq 'service') {
+ $numrows = $form->{price_rows};
+ $subroutine = "price_row";
- $numrows = 0;
- }
+ &{$subroutine}($numrows);
- # create rows
- &{$subroutine}($numrows) if $numrows;
+ $numrows = 0;
+ }
+
+ # create rows
+ &{$subroutine}($numrows) if $numrows;
+ }
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
require "bin/mozilla/common.pl";
+use strict;
+
# any custom scripts for this one
if (-f "bin/mozilla/custom_io.pl") {
eval { require "bin/mozilla/custom_io.pl"; };
# neue Optik im Rechnungsformular #
########################################
sub display_row {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
_check_io_auth();
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
+
my $numrows = shift;
my ($readonly, $stock_in_out, $stock_in_out_title);
# translations, unused commented out
# $runningnumber = $locale->text('No.');
- $deliverydate = $locale->text('Delivery Date');
- $serialnumber = $locale->text('Serial No.');
- $projectnumber = $locale->text('Project');
+# my $deliverydate = $locale->text('Delivery Date');
+ my $serialnumber = $locale->text('Serial No.');
+ my $projectnumber = $locale->text('Project');
# $partsgroup = $locale->text('Group');
- $reqdate = $locale->text('Reqdate');
- $deliverydate = $locale->text('Required by');
+ my $reqdate = $locale->text('Reqdate');
+ my $deliverydate = $locale->text('Required by');
# special alignings
my %align = map { $_ => 'right' } qw(qty ship right sellprice_pg discount linetotal stock_in_out);
_update_custom_variables();
# rows
- for $i (1 .. $numrows) {
+
+ my @ROWS;
+ for my $i (1 .. $numrows) {
my %column_data = ();
# undo formatting
# / unit ending
$form->{"sellprice_$i"} =~ /\.(\d+)/;
- $decimalplaces = max 2, length $1;
+ my $decimalplaces = max 2, length $1;
- $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || 1;
- $discount = $form->round_amount($form->{"qty_$i"} * $form->{"sellprice_$i"} * $form->{"discount_$i"} / 100 / $price_factor, 2);
- $linetotal = $form->round_amount($form->{"qty_$i"} * $form->{"sellprice_$i"} * (100 - $form->{"discount_$i"}) / 100 / $price_factor, 2);
+ my $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || 1;
+ my $discount = $form->round_amount($form->{"qty_$i"} * $form->{"sellprice_$i"} * $form->{"discount_$i"} / 100 / $price_factor, 2);
+ my $linetotal = $form->round_amount($form->{"qty_$i"} * $form->{"sellprice_$i"} * (100 - $form->{"discount_$i"}) / 100 / $price_factor, 2);
+ my $rows = $form->numtextrows($form->{"description_$i"}, 30, 6);
$column_data{runningnumber} = $cgi->textfield(-name => "runningnumber_$i", -size => 5, -value => $i); # HuT
$column_data{partnumber} = $cgi->textfield(-name => "partnumber_$i", -size => 12, -value => $form->{"partnumber_$i"});
- $column_data{description} = ((($rows = $form->numtextrows($form->{"description_$i"}, 30, 6)) > 1) # if description is too large, use a textbox instead
+ $column_data{description} = (($rows > 1) # if description is too large, use a textbox instead
? $cgi->textarea( -name => "description_$i", -default => $form->{"description_$i"}, -rows => $rows, -columns => 30)
: $cgi->textfield(-name => "description_$i", -size => 30, -value => $form->{"description_$i"}))
. $cgi->button(-value => $locale->text('L'), -onClick => "set_longdescription_window('longdescription_$i')");
$form->{marge_percent} = ($form->{sellprice_total} - $form->{lastcost_total}) / $form->{sellprice_total} * 100;
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
##################################################
# build html-code for pricegroups in variable $form->{prices_$j}
sub set_pricegroup {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
_check_io_auth();
my $rowcount = shift;
- for $j (1 .. $rowcount) {
+ for my $j (1 .. $rowcount) {
next unless $form->{PRICES}{$j};
# build drop down list for pricegroups
my $option_tmpl = qq|<option value="%s--%s" %s>%s</option>|;
$form->{"prices_$j"} = join '', map { sprintf $option_tmpl, @$_{qw(price pricegroup_id selected pricegroup)} }
(+{ pricegroup => $locale->text("none (pricegroup)") }, @{ $form->{PRICES}{$j} });
- foreach $item (@{ $form->{PRICES}{$j} }) {
+ foreach my $item (@{ $form->{PRICES}{$j} }) {
# set new selectedpricegroup_id and prices for "Preis"
$form->{"pricegroup_old_$j"} = $item->{pricegroup_id} if $item->{selected} && $item->{pricegroup_id};
$form->{"sellprice_$j"} = $item->{price} if $item->{selected} && $item->{pricegroup_id};
$form->{"price_new_$j"} = $form->{"sellprice_$j"} if $item->{selected} || !$item->{pricegroup_id};
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub select_item {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
+
# diese variable kommt schon in der methode display_row vor, kann man die besser wiederverwenden? @mb fragen. ich check das jetzt erstmal so ein
my $is_purchase = (first { $_ eq $form->{type} } qw(request_quotation purchase_order purchase_delivery_order)) || ($form->{script} eq 'ir.pl');
_check_io_auth();
- @column_index = qw(ndx partnumber description rop onhand unit sellprice);
-
+ my @column_index = qw(ndx partnumber description rop onhand unit sellprice);
+ my %column_data;
$column_data{ndx} = qq|<th> </th>|;
$column_data{partnumber} =
qq|<th class="listheading">| . $locale->text('Number') . qq|</th>|;
# list items with radio button on a form
$form->header;
- $title = $locale->text('Select from one of the items below');
- $colspan = $#column_index + 1;
+ my $title = $locale->text('Select from one of the items below');
+ my $colspan = $#column_index + 1;
print qq|
<body>
qw(bin listprice inventory_accno income_accno expense_accno unit weight
assembly taxaccounts partsgroup formel longdescription not_discountable
part_payment_id partnotes id lastcost price_factor_id price_factor);
- push @new_fields, "lizenzen" if ($lizenzen);
+ push @new_fields, "lizenzen" if ($main::lizenzen);
push @new_fields, grep { m/^ic_cvar_/ } keys %{ $form->{item_list}->[0] };
my $i = 0;
- foreach $ref (@{ $form->{item_list} }) {
- $checked = ($i++) ? "" : "checked";
+ my $j;
+ foreach my $ref (@{ $form->{item_list} }) {
+ my $checked = ($i++) ? "" : "checked";
- if ($lizenzen) {
+ if ($main::lizenzen) {
if ($ref->{inventory_accno} > 0) {
$ref->{"lizenzen"} = qq|<option></option>|;
- foreach $item (@{ $form->{LIZENZEN}{ $ref->{"id"} } }) {
+ foreach my $item (@{ $form->{LIZENZEN}{ $ref->{"id"} } }) {
$ref->{"lizenzen"} .=
qq|<option value=\"$item->{"id"}\">$item->{"licensenumber"}</option>|;
}
map { delete $form->{$_} } qw(action item_list header);
# save all other form variables
- foreach $key (keys %${form}) {
+ foreach my $key (keys %${form}) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input name="$key" type="hidden" value="$form->{$key}">\n|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub item_selected {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
_check_io_auth();
# replace the last row with the checked row
- $i = $form->{rowcount};
+ my $i = $form->{rowcount};
$i = $form->{assembly_rows} if ($form->{item} eq 'assembly');
# index for new item
- $j = $form->{ndx};
+ my $j = $form->{ndx};
#sk
#($form->{"sellprice_$i"},$form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"};
#$form->{"sellprice_$i"} = $form->{"sellprice_$i"};
# if there was a price entered, override it
- $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
+ my $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
my @new_fields =
qw(id partnumber description sellprice listprice inventory_accno
$form->{payment_id} = $form->{"part_payment_id_$i"};
}
- if ($lizenzen) {
+ if ($main::lizenzen) {
map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } qw(lizenzen);
}
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
+ my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
$dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
+ my $decimalplaces = ($dec > 2) ? $dec : 2;
if ($sellprice) {
$form->{"sellprice_$i"} = $sellprice;
$form->{"discount_$i"} = 0;
}
- $amount =
+ my $amount =
$form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
$form->{"qty_$i"};
map { $form->{"${_}_base"} += $amount }
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub new_item {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
_check_io_auth();
# save all form variables except action in a previousform variable
my $previousform = join '&', map { my $value = $form->{$_}; $value =~ s/&/%26/; "$_=$value" } grep { !/action/ } keys %$form;
+ my @HIDDENS;
push @HIDDENS, { 'name' => 'previousform', 'value' => $form->escape($previousform, 1) };
push @HIDDENS, map +{ 'name' => $_, 'value' => $form->{$_} }, qw(rowcount vc);
push @HIDDENS, map +{ 'name' => $_, 'value' => $form->{"${_}_$form->{rowcount}"} }, qw(partnumber description unit);
$form->header();
print $form->parse_html_template("generic/new_item", { HIDDENS => [ sort { $a->{name} cmp $b->{name} } @HIDDENS ] } );
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub check_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
_check_io_auth();
map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
$count++;
- if ($lizenzen) {
+ if ($main::lizenzen) {
if ($form->{"licensenumber_$i"} == -1) {
&new_license($i);
exit;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub invoicetotal {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
_check_io_auth();
if !$form->{taxincluded};
$form->{oldtotalpaid} = 0;
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
$form->{oldtotalpaid} += $form->{"paid_$i"};
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
# return total
return ($form->{oldinvtotal} - $form->{oldtotalpaid});
}
sub validate_items {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
_check_io_auth();
exit;
}
- for $i (1 .. $form->{rowcount} - 1) {
+ for my $i (1 .. $form->{rowcount} - 1) {
$form->isblank("partnumber_$i",
$locale->text('Number missing in Row') . " $i");
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub order {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
_check_io_auth();
$form->{old_salesman_id} = $form->{salesman_id};
map { delete $form->{$_} } qw(id printed emailed queued);
+ my $buysell;
if ($form->{script} eq 'ir.pl' || $form->{type} eq 'request_quotation') {
$form->{title} = $locale->text('Add Purchase Order');
$form->{vc} = 'vendor';
my $script = $form->{"script"};
$script =~ s|.*/||;
$script =~ s|.pl$||;
- $locale = new Locale($language, $script);
+ $locale = new Locale($main::language, $script);
map { $form->{"select$_"} = "" } ($form->{vc}, "currency");
- $currency = $form->{currency};
+ my $currency = $form->{currency};
&order_links;
$form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, $buysell);
$form->{exchangerate} = $form->{forex} || '';
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"})
if ($form->{"${_}_${i}"}) }
qw(ship qty sellprice listprice basefactor discount));
&prepare_order;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub quotation {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
_check_io_auth();
}
map { delete $form->{$_} } qw(id printed emailed queued);
+ my $buysell;
if ($form->{script} eq 'ir.pl' || $form->{type} eq 'purchase_order') {
$form->{title} = $locale->text('Add Request for Quotation');
$form->{vc} = 'vendor';
map { $form->{"select$_"} = "" } ($form->{vc}, "currency");
- $currency = $form->{currency};
+ my $currency = $form->{currency};
&order_links;
$form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, $buysell);
$form->{exchangerate} = $form->{forex} || '';
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
$form->{"${_}_${i}"})
if ($form->{"${_}_${i}"}) }
&prepare_order;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub request_for_quotation {
}
sub edit_e_mail {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
_check_io_auth();
$form->{"email"} = $form->{"cp_email"};
}
- $title = $locale->text('E-mail') . " " . $form->get_formname_translation();
+ my $title = $locale->text('E-mail') . " " . $form->get_formname_translation();
$form->{oldmedia} = $form->{media};
$form->{media} = "email";
HIDDEN => [ map +{ name => $_, value => $form->{$_} }, @hidden_keys ],
SHOW_BCC => $myconfig{role} eq 'admin' });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub send_email {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
_check_io_auth();
$form->{callback} = $callback;
$form->redirect();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# generate the printing options displayed at the bottom of oe and is forms.
#
# the inline options is untested, but intended to be used later in metatemplating
sub print_options {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
_check_io_auth();
# names 3 parameters and returns a hashref, for use in templates
sub opthash { +{ value => shift, selected => shift, oname => shift } }
- (@FORMNAME, @FORMNAME, @LANGUAGE_ID, @FORMAT, @SENDMODE, @MEDIA, @PRINTER_ID, @SELECTS) = ();
+ my (@FORMNAME, @LANGUAGE_ID, @FORMAT, @SENDMODE, @MEDIA, @PRINTER_ID, @SELECTS) = ();
# note: "||"-selection is only correct for values where "0" is _not_ a correct entry
$form->{sendmode} = "attachment";
push @MEDIA, grep $_,
opthash("screen", $form->{OP}{screen}, $locale->text('Screen')),
- (scalar @{ $form->{printers} } && $latex_templates) ?
+ (scalar @{ $form->{printers} } && $main::latex_templates) ?
opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef,
- ($latex_templates && !$options{no_queue}) ?
+ ($main::latex_templates && !$options{no_queue}) ?
opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef
if ($form->{media} ne 'email');
push @FORMAT, grep $_,
- ($opendocument_templates && $openofficeorg_writer_bin && $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)
+ ($main::opendocument_templates && $main::openofficeorg_writer_bin && $main::xvfb_bin
+ && (-x $main::openofficeorg_writer_bin) && (-x $main::xvfb_bin)
&& !$options{no_opendocument_pdf}) ?
opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef,
- ($latex_templates) ?
+ ($main::latex_templates) ?
opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef,
- ($latex_templates && !$options{no_postscript}) ?
+ ($main::latex_templates && !$options{no_postscript}) ?
opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef,
(!$options{no_html}) ?
opthash("html", $form->{DF}{html}, "HTML") : undef,
- ($opendocument_templates && !$options{no_opendocument}) ?
+ ($main::opendocument_templates && !$options{no_opendocument}) ?
opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef;
push @LANGUAGE_ID,
map { opthash($_->{id}, ($_->{id} eq $form->{printer_id} ? 'selected' : ''), $_->{printer_description}) } +{}, @{ $form->{printers} }
if ((ref $form->{printers} eq 'ARRAY') && scalar @{ $form->{printers } });
- @SELECTS = map { sname => lc $_, DATA => \@$_, show => !$options{"hide_" . lc($_)} && scalar @$_ }, qw(FORMNAME LANGUAGE_ID FORMAT SENDMODE MEDIA PRINTER_ID);
+ @SELECTS = map {
+ sname => $_->[1],
+ DATA => $_->[0],
+ show => !$options{"hide_" . $_->[1]} && scalar @{ $_->[0] }
+ },
+ [ \@FORMNAME, 'formname', ],
+ [ \@LANGUAGE_ID, 'language_id', ],
+ [ \@FORMAT, 'format', ],
+ [ \@SENDMODE, 'sendmode', ],
+ [ \@MEDIA, 'media', ],
+ [ \@PRINTER_ID, 'printer_id', ];
my %dont_display_groupitems = (
'dunning' => 1,
);
- %template_vars = (
- display_copies => scalar @{ $form->{printers} } && $latex_templates && $form->{media} ne 'email',
+ my %template_vars = (
+ display_copies => scalar @{ $form->{printers} } && $main::latex_templates && $form->{media} ne 'email',
display_remove_draft => (!$form->{id} && $form->{draft_id}),
display_groupitems => !$dont_display_groupitems{$form->{type}},
groupitems_checked => $form->{groupitems} ? "checked" : '',
my $print_options = $form->parse_html_template("generic/print_options", { SELECTS => \@SELECTS, %template_vars } );
if ($options{inline}) {
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $print_options;
}
print $print_options;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
_check_io_auth();
if ($form->{print_nextsub}) {
call_sub($form->{print_nextsub});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
# if this goes to the printer pass through
+ my $old_form;
if ($form->{media} eq 'printer' || $form->{media} eq 'queue') {
$form->error($locale->text('Select postscript or PDF!'))
if ($form->{format} !~ /(postscript|pdf)/);
&print_form($old_form);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
_check_io_auth();
my ($old_form) = @_;
- $inv = "inv";
- $due = "due";
- $numberfld = "invnumber";
+ my $inv = "inv";
+ my $due = "due";
+ my $numberfld = "invnumber";
+ my $order;
- $display_form =
+ my $display_form =
($form->{display_form}) ? $form->{display_form} : "display_form";
# $form->{"notes"} will be overridden by the customer's/vendor's "notes" field. So save it here.
my ($saved_email, $saved_cc, $saved_bcc) =
($form->{"email"}, $form->{"cc"}, $form->{"bcc"});
- $language_saved = $form->{language_id};
- $payment_id_saved = $form->{payment_id};
- $salesman_id_saved = $form->{salesman_id};
- $cp_id_saved = $form->{cp_id};
+ my $language_saved = $form->{language_id};
+ my $payment_id_saved = $form->{payment_id};
+ my $salesman_id_saved = $form->{salesman_id};
+ my $cp_id_saved = $form->{cp_id};
call_sub("$form->{vc}_details") if ($form->{vc});
$form->get_shipto(\%myconfig);
}
- @a = qw(name street zipcode city country contact);
+ my @a = qw(name street zipcode city country contact);
- $shipto = 1;
+ my $shipto = 1;
# if there is no shipto fill it in from billto
- foreach $item (@a) {
+ foreach my $item (@a) {
if ($form->{"shipto$item"}) {
$shipto = 0;
last;
$form->{printed} .= " $form->{formname}";
$form->{printed} =~ s/^ //;
}
- $printed = $form->{printed};
+ my $printed = $form->{printed};
if ($form->{media} eq 'email') {
$form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
$form->{emailed} .= " $form->{formname}";
$form->{emailed} =~ s/^ //;
}
- $emailed = $form->{emailed};
+ my $emailed = $form->{emailed};
if ($form->{media} eq 'queue') {
- %queued = map { s|.*/|| } split / /, $form->{queued};
+ my %queued = map { s|.*/|| } split / /, $form->{queued};
+ my $filename;
if ($filename = $queued{ $form->{formname} }) {
$form->{queued} =~ s/\Q$form->{formname} $filename\E//;
- unlink "$spool/$filename";
+ unlink "$main::spool/$filename";
$filename =~ s/\..*$//g;
} else {
$filename = time;
}
$filename .= ($form->{postscript}) ? '.ps' : '.pdf';
- $form->{OUT} = ">$spool/$filename";
+ $form->{OUT} = ">$main::spool/$filename";
# add type
$form->{queued} .= " $form->{formname} $filename";
$form->{queued} =~ s/^ //;
}
- $queued = $form->{queued};
+ my $queued = $form->{queued};
# saving the history
if(!exists $form->{addition}) {
}
# /saving the history
- $form->parse_template(\%myconfig, $userspath);
+ $form->parse_template(\%myconfig, $main::userspath);
$form->{callback} = "";
if ($form->{media} eq 'email') {
$form->{message} = $locale->text('sent') unless $form->{message};
}
- $message = $form->{message};
+ my $message = $form->{message};
# if we got back here restore the previous form
if ($form->{media} =~ /(printer|email|queue)/) {
$form->update_status(\%myconfig)
if ($form->{media} eq 'queue' && $form->{id});
- return $lxdebug->leave_sub() if ($old_form eq "return");
+ return $main::lxdebug->leave_sub() if ($old_form eq "return");
if ($old_form) {
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(exchangerate creditlimit creditremaining);
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
map {
$form->{"${_}_$i"} =
$form->parse_amount(\%myconfig, $form->{"${_}_$i"})
exit;
}
- $msg =
+ my $msg =
($form->{media} eq 'printer')
? $locale->text('sent to printer')
: $locale->text('emailed to') . " $form->{email}";
exit;
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub customer_details {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
IS->customer_details(\%myconfig, \%$form, @_);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub vendor_details {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
IR->vendor_details(\%myconfig, \%$form, @_);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post_as_new {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
_check_io_auth();
&post;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub ship_to {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
_check_io_auth();
$form->{print_and_post} = 0;
}
- $title = $form->{title};
+ my $title = $form->{title};
$form->{title} = $locale->text('Ship to');
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
# get details for name
call_sub("$form->{vc}_details", @addr_vars);
- $number =
+ my $number =
($form->{vc} eq 'customer')
? $locale->text('Customer Number')
: $locale->text('Vendor Number');
# build up html code for prices_$i
set_pricegroup($form->{rowcount});
- $nextsub = ($form->{display_form}) ? $form->{display_form} : "display_form";
+ my $nextsub = ($form->{display_form}) ? $form->{display_form} : "display_form";
$form->{rowcount}--;
map({ delete $form->{$_} } (@shipto_vars, qw(header)));
$form->{title} = $title;
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub new_license {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
_check_io_auth();
# delete action
delete $form->{action};
- $customer = $form->{customer};
+ my $customer = $form->{customer};
map { $form->{"old_$_"} = $form->{"${_}_$row"} } qw(partnumber description);
# save all other form variables in a previousform variable
$form->{row} = $row;
- foreach $key (keys %$form) {
+ my $previousform;
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
# escape ampersands
$form->{script} = "licenses.pl";
+ our $name;
+
map { $form->{$_} = $form->{"old_$_"} } qw(partnumber description);
map { $form->{$_} = $form->escape($form->{$_}, 1) }
qw(partnumber description);
qq|$form->{script}?action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&customer=$customer&partnumber=$form->{partnumber}&description=$form->{description}&previousform="$previousform"&initial=1|;
$form->redirect;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub relink_accounts {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
_check_io_auth();
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub set_duedate {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
_check_io_auth();
print $form->ajax_response_header() . $duedate;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub _update_part_information {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my %part_information = IC->get_basic_part_info('id' => [ grep { $_ } map { $form->{"id_${_}"} } (1..$form->{rowcount}) ],
'vendor_id' => $form->{vendor_id});
$form->{"partunit_${i}"} = $info->{unit};
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub _update_ship {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
if (!$form->{ordnumber} || !$form->{id}) {
map { $form->{"ship_$_"} = 0 } (1..$form->{rowcount});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
- AM->retrieve_all_units();
+ my $all_units = AM->retrieve_all_units();
my %ship = DO->get_shipped_qty('type' => ($form->{type} eq 'purchase_order') ? 'purchase' : 'sales',
'oe_id' => $form->{id},);
$ship_entry->{qty} = 0;
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub _update_custom_variables {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
$form->{CVAR_CONFIGS} ||= { };
$form->{CVAR_CONFIGS}->{IC} = CVar->get_configs(module => 'IC');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub _render_custom_variables_inputs {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my %params = @_;
if (!$form->{CVAR_CONFIGS}->{IC}) {
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
};
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
require "bin/mozilla/common.pl";
require "bin/mozilla/drafts.pl";
+use strict;
+
1;
# end of main
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
- return $lxdebug->leave_sub() if (load_draft_maybe());
+ return $main::lxdebug->leave_sub() if (load_draft_maybe());
$form->{title} = $locale->text('Add Vendor Invoice');
&prepare_invoice;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('vendor_invoice_edit');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('vendor_invoice_edit');
# show history button
$form->{javascript} = qq|<script type=text/javascript src=js/show_history.js></script>|;
&prepare_invoice;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub invoice_links {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
# create links
- $form->{webdav} = $webdav;
+ $form->{webdav} = $main::webdav;
$form->{jsscript} = 1;
$form->create_links("AP", \%myconfig, "vendor");
#quote all_vendor Bug 133
- foreach $ref (@{ $form->{all_vendor} }) {
+ foreach my $ref (@{ $form->{all_vendor} }) {
$ref->{name} = $form->quote($ref->{name});
}
$form->{vendor_id} = $form->{all_vendor}->[0]->{id};
}
}
+
+ my ($payment_id, $language_id, $taxzone_id);
if ($form->{payment_id}) {
$payment_id = $form->{payment_id};
}
$taxzone_id = $form->{taxzone_id};
}
- $cp_id = $form->{cp_id};
+ my $cp_id = $form->{cp_id};
IR->get_vendor(\%myconfig, \%$form);
IR->retrieve_invoice(\%myconfig, \%$form);
$form->{cp_id} = $cp_id;
$form->{taxzone_id} = $taxzone_id;
}
+ my @curr = split(/:/, $form->{currencies}); #seems to be missing
map { $form->{selectcurrency} .= "<option>$_\n" } @curr;
$form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
# forex
$form->{forex} = $form->{exchangerate};
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
+ my $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
- foreach $key (keys %{ $form->{AP_links} }) {
+ foreach my $key (keys %{ $form->{AP_links} }) {
- foreach $ref (@{ $form->{AP_links}{$key} }) {
+ foreach my $ref (@{ $form->{AP_links}{$key} }) {
$form->{"select$key"} .= "<option>$ref->{accno}--$ref->{description}\n";
}
+ next unless $form->{acc_trans}{$key};
+
if ($key eq "AP_paid") {
- for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
+ for my $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
$form->{"AP_paid_$i"} =
"$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
($form->datetonum($form->{invdate}, \%myconfig) <=
$form->datetonum($form->{closedto}, \%myconfig));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub prepare_invoice {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
if ($form->{id}) {
map { $form->{$_} =~ s/\"/"/g } qw(invnumber ordnumber quonumber);
my $i = 0;
- foreach $ref (@{ $form->{invoice_details} }) {
+ foreach my $ref (@{ $form->{invoice_details} }) {
$i++;
map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
+ my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
$dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
+ my $decimalplaces = ($dec > 2) ? $dec : 2;
$form->{"sellprice_$i"} =
$form->format_amount(\%myconfig, $form->{"sellprice_$i"},
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('vendor_invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
+
+ $main::auth->assert('vendor_invoice_edit');
push @{ $form->{AJAX} }, CGI::Ajax->new('set_duedate_vendor' => "$form->{script}?action=set_duedate_vendor");
# set option selected
- foreach $item (qw(AP vendor currency department)) {
+ foreach my $item (qw(AP vendor currency department)) {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
$form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
$form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
- $exchangerate = "";
+ my $exchangerate = "";
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{forex}) {
$exchangerate .= qq| <th align=right nowrap>| . $locale->text('Exchangerate') . qq|</th>
%labels = ();
@values = ();
- my $i = 0;
foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
push(@values, $item->{"id"});
$labels{$item->{"id"}} = $item->{"name"};
%labels = ();
@values = ();
- my $i = 0;
foreach my $item (@{ $form->{"ALL_VENDORS"} }) {
push(@values, $item->{name}.qq|--|.$item->{"id"});
$labels{$item->{name}.qq|--|.$item->{"id"}} = $item->{"name"};
$labels{$item->{"id"}} = $item->{"description"};
}
+ my $taxzone;
if (!$form->{"id"}) {
$taxzone = qq|
<tr>
</tr>|;
}
- $department = qq|
+ my $department = qq|
<tr>
<th align="right" nowrap>| . $locale->text('Department') . qq|</th>
<td colspan="3"><select name="department" style="width: 250px">$form->{selectdepartment}</select>
</td>
</tr>\n| if $form->{selectdepartment};
- $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
+ my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
# use JavaScript Calendar or not
$form->{jsscript} = 1;
- $jsscript = "";
+ my $jsscript = "";
- $button1 = qq|
+ my $button1 = qq|
<td nowrap>
<input name=invdate id=invdate size=11 title="$myconfig{dateformat}" value="$form->{invdate}" onBlur=\"check_right_date_format(this)\"
onChange="if (this.value) set_duedate_vendor(['invdate__' + this.value, 'old_duedate__' + document.getElementsByName('duedate')[0].value, 'vendor_id__' + document.getElementsByName('vendor_id')[0].value],['duedate'])">
</td>\n|;
#, 'old_duedate__'' + document.getElementsByName('duedate')[0].value, 'vendor_id__' + document.getElementsByName('vendor_id')[0].value],['duedate'])">
- $button2 = qq|
+ my $button2 = qq|
<td width="13" nowrap>
<input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\">
<input type=button name=duedate id="trigger2" value=| . $locale->text('button') . qq|>
$jsscript .= $form->write_trigger(\%myconfig, 2, "orddate", "BL", "trigger_orddate", "quodate", "BL", "trigger_quodate");
$form->header;
- $onload = qq|focus()|;
+ my $onload = qq|focus()|;
$onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
$onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
$jsscript
-<input type=hidden name=webdav value=$webdav>
+<input type=hidden name=webdav value=$main::webdav>
|;
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
print qq|
<input type=hidden name="${item}_rate" value=$form->{"${item}_rate"}>
<input type=hidden name="${item}_description" value="$form->{"${item}_description"}">
|;
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
$form->{invtotal} = $form->{invsubtotal};
+ my ($rows, $introws);
if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
$rows = 2;
}
$introws = 2;
}
$rows = ($rows > $introws) ? $rows : $introws;
- $notes =
+ my $notes =
qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
- $intnotes =
+ my $intnotes =
qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
$form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
- $taxincluded = "";
+ my $taxincluded = "";
if ($form->{taxaccounts}) {
$taxincluded = qq|
<input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
|;
}
+ my ($tax, $subtotal);
if (!$form->{taxincluded}) {
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
$form->{invtotal} += $form->{"${item}_total"} =
$form->round_amount(
}
if ($form->{taxincluded}) {
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
$form->{"${item}_total"} =
$form->round_amount(
}
}
+ our $colspan;
print qq|
<tr>
<td colspan=$colspan>
</td>
</tr>
|;
- if ($webdav) {
+ my $webdav_list;
+ if ($main::webdav) {
$webdav_list = qq|
<tr>
<td><hr size=3 noshade></td>
<td align=left width=30%><b>Dateiname</b></td>
<td align=left width=70%><b>Webdavlink</b></td>
|;
- foreach $file (@{ $form->{WEBDAV} }) {
+ foreach my $file (@{ $form->{WEBDAV} }) {
$webdav_list .= qq|
<tr>
<td align="left">$file->{name}</td>
</tr>
|;
+ my @column_index;
if ($form->{currency} eq $form->{defaultcurrency}) {
@column_index = qw(datepaid source memo paid AP_paid);
} else {
@column_index = qw(datepaid source memo paid exchangerate AP_paid);
}
+ my %column_data;
$column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
$column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
$column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
my $totalpaid = 0;
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
print qq|
<tr>
$form->{"exchangerate_$i"} =
$form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
- $exchangerate = qq| |;
+ my $exchangerate = qq| |;
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{"forex_$i"}) {
$exchangerate =
<br>
|;
- $invdate = $form->datetonum($form->{invdate}, \%myconfig);
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
print qq|<input class=submit type=submit name=action id=update_button value="|
. $locale->text('Update') . qq|">
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub mark_as_paid {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
&mark_as_paid_common(\%myconfig,"ap");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining);
- &check_name(vendor);
+ &check_name('vendor');
$form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'sell');
$form->{exchangerate} = $form->{forex} if $form->{forex};
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
next unless $form->{"paid_$i"};
map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate);
$form->{"forex_$i"} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'sell');
$form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"};
}
- $i = $form->{rowcount};
- $exchangerate = ($form->{exchangerate} * 1) || 1;
+ my $i = $form->{rowcount};
+ my $exchangerate = ($form->{exchangerate} * 1) || 1;
if ( ($form->{"partnumber_$i"} eq "")
&& ($form->{"description_$i"} eq "")
} else {
# override sellprice if there is one entered
- $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
+ my $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
# ergaenzung fuer bug 736 Lieferanten-Rabatt auch in Einkaufsrechnungen vorbelegen jb
- $form->{"discount_$i"} = $form->format_amount(\%myconfig,
+ $form->{"discount_$i"} = $form->format_amount(\%myconfig,
$form->{vendor_discount} * 100 );
map { $form->{item_list}[$i]{$_} =~ s/\"/"/g } qw(partnumber description unit);
map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] };
$form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor};
($sellprice || $form->{"sellprice_$i"}) =~ /\.(\d+)/;
- $decimalplaces = max 2, length $1;
+ my $dec_qty = length $1;
+ my $decimalplaces = max 2, $dec_qty;
if ($sellprice) {
$form->{"sellprice_$i"} = $sellprice;
$form->{"sellprice_$i"} /= $exchangerate;
}
- $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
+ my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
$form->{creditremaining} -= $amount;
$form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
}
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub storno {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
if ($form->{storno}) {
$form->error($locale->text('Cannot storno storno invoice!'));
$form->{rowcount}++;
$form->{employee_id} = $employee_id;
post();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub use_as_template {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('vendor_invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('vendor_invoice_edit');
map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
$form->{paidaccounts} = 1;
$form->{invdate} = $form->current_date(\%myconfig);
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post_payment {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"}) {
- $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
+ my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
$form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig));
if ($form->{currency} ne $form->{defaultcurrency}) {
- $form->{"exchangerate_$i"} = $form->{exchangerate}
- if ($invdate == $datepaid);
- $form->isblank("exchangerate_$i",
- $locale->text('Exchangerate for payment missing!'));
+# $form->{"exchangerate_$i"} = $form->{exchangerate} if ($invdate == $datepaid); # invdate isn't set here
+ $form->isblank("exchangerate_$i", $locale->text('Exchangerate for payment missing!'));
}
}
}
$form->error($locale->text('Cannot post payment!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->{invnumber} =~ s/\s*$//g;
# if the vendor changed get new values
- if (&check_name(vendor)) {
+ if (&check_name('vendor')) {
&update;
exit;
}
&validate_items;
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
- $invdate = $form->datetonum($form->{invdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
+ my $i = $form->{rowcount};
$form->error($locale->text('Cannot post invoice for a closed period!'))
if ($form->date_closed($form->{"datepaid_$i"}, \%myconfig));
for $i (1 .. $form->{paidaccounts}) {
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
- $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
+ my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
$form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
}
$form->error($locale->text('Cannot post invoice!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('vendor_invoice_edit');
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::auth->assert('vendor_invoice_edit');
$form->header;
print qq|
# delete action variable
map { delete $form->{$_} } qw(action header);
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
</form>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub yes {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('vendor_invoice_edit');
+ $main::auth->assert('vendor_invoice_edit');
if (IR->delete_invoice(\%myconfig, \%$form)) {
# saving the history
}
$form->error($locale->text('Cannot delete invoice!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub set_duedate_vendor {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
print $form->ajax_response_header(), IR->get_duedate('vendor_id' => $form->{vendor_id},
'invdate' => $form->{invdate},
'default' => $form->{old_duedate});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
require "bin/mozilla/arap.pl";
require "bin/mozilla/drafts.pl";
+use strict;
+
+my $edit;
+my $payment;
+my $print_post;
+
1;
# end of main
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('invoice_edit');
+ my $form = $main::form;
+ my $locale = $main::locale;
- return $lxdebug->leave_sub() if (load_draft_maybe());
+ $main::auth->assert('invoice_edit');
+
+ return $main::lxdebug->leave_sub() if (load_draft_maybe());
if ($form->{type} eq "credit_note") {
$form->{title} = $locale->text('Add Credit Note');
$form->{callback} = "$form->{script}?action=add&type=$form->{type}" unless $form->{callback};
- $form{jsscript} = "date";
+ $form->{jsscript} = "date";
&invoice_links;
&prepare_invoice;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
# show history button
$form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
#/show hhistory button
$edit = 1;
+ my ($language_id, $printer_id);
if ($form->{print_and_post}) {
$form->{action} = "print";
$form->{resubmit} = 1;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub invoice_links {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('invoice_edit');
$form->{vc} = 'customer';
# create links
- $form->{webdav} = $webdav;
- $form->{lizenzen} = $lizenzen;
+ $form->{webdav} = $main::webdav;
+ $form->{lizenzen} = $main::lizenzen;
$form->create_links("AR", \%myconfig, "customer");
}
}
+ my $payment_id;
if ($form->{payment_id}) {
$payment_id = $form->{payment_id};
}
+ my $language_id;
if ($form->{language_id}) {
$language_id = $form->{language_id};
}
+ my $taxzone_id;
if ($form->{taxzone_id}) {
$taxzone_id = $form->{taxzone_id};
}
+ my $id;
if ($form->{id}) {
$id = $form->{id};
}
+ my $shipto_id;
if ($form->{shipto_id}) {
$shipto_id = $form->{shipto_id};
}
- $cp_id = $form->{cp_id};
+ my $cp_id = $form->{cp_id};
IS->get_customer(\%myconfig, \%$form);
#quote all_customer Bug 133
- foreach $ref (@{ $form->{all_customer} }) {
+ foreach my $ref (@{ $form->{all_customer} }) {
$ref->{name} = $form->quote($ref->{name});
}
if ($id) {
# forex
$form->{forex} = $form->{exchangerate};
- $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
+ my $exchangerate = ($form->{exchangerate}) ? $form->{exchangerate} : 1;
- foreach $key (keys %{ $form->{AR_links} }) {
- foreach $ref (@{ $form->{AR_links}{$key} }) {
+ foreach my $key (keys %{ $form->{AR_links} }) {
+ foreach my $ref (@{ $form->{AR_links}{$key} }) {
$form->{"select$key"} .=
"<option>$ref->{accno}--$ref->{description}</option>\n";
}
if ($key eq "AR_paid") {
- for $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
+ next unless $form->{acc_trans}{$key};
+ for my $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
$form->{"AR_paid_$i"} =
"$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
($form->datetonum($form->{invdate}, \%myconfig) <=
$form->datetonum($form->{closedto}, \%myconfig));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub prepare_invoice {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
if ($form->{type} eq "credit_note") {
$form->{type} = "credit_note";
my $i = 0;
- foreach $ref (@{ $form->{invoice_details} }) {
+ foreach my $ref (@{ $form->{invoice_details} }) {
$i++;
map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
$form->{"discount_$i"} =
$form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
+ my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
$dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
+ my $decimalplaces = ($dec > 2) ? $dec : 2;
$form->{"sellprice_$i"} =
$form->format_amount(\%myconfig, $form->{"sellprice_$i"},
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
$form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
$form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
$form->{radier} = ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
$payment = qq|<option value=""></option>|;
- foreach $item (@{ $form->{payment_terms} }) {
+ foreach my $item (@{ $form->{payment_terms} }) {
if ($form->{payment_id} eq $item->{id}) {
$payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
} else {
$labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
}
- $salesman =
+ my $salesman =
qq|<tr> <th align="right">| . $locale->text('Salesman') . qq|</th>
<td>| . NTI($cgi->popup_menu('-name' => 'salesman_id', '-values' => \@values, '-labels' => \%labels,
'-default' => $form->{salesman_id} ? $form->{salesman_id} : $form->{employee_id})) . qq|
$labels{$item->{"id"}} = $item->{"description"};
}
+ my $taxzone;
if (!$form->{"id"}) {
$taxzone = qq|
<tr>
}
# set option selected
- foreach $item (qw(AR customer currency department employee)) {
+ foreach my $item (qw(AR customer currency department employee)) {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
- $creditwarning = (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) ? 1 : 0;
+ my $creditwarning = (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) ? 1 : 0;
$form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate});
$form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
$form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
- $exchangerate = "";
+ my $exchangerate = "";
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{forex}) {
$exchangerate .= qq|<th align="right">| . $locale->text('Exchangerate') . qq|</th>
}
$exchangerate .= qq|\n<input type="hidden" name="forex" value="$form->{forex}">\n|;
- $department = qq|
+ my $department = qq|
<tr>
<th align="right" nowrap>| . $locale->text('Department') . qq|</th>
<td colspan="3"><select name="department" style="width: 250px">$form->{selectdepartment}</select>
</tr>
| if $form->{selectdepartment};
- $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
+ my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
+ my $business;
if ($form->{business}) {
$business = qq|
<tr>
|;
}
+ my $dunning;
if ($form->{max_dunning_level}) {
$dunning = qq|
<tr>
# use JavaScript Calendar or not
$form->{jsscript} = 1;
- $jsscript = "";
+ my $jsscript = "";
+ my ($button1, $button2, $button3);
if ($form->{type} eq "credit_note") {
$button1 = qq|
<td nowrap><input name="invdate" id="invdate" size="11" title="$myconfig{dateformat}" value="$form->{invdate}" onBlur=\"check_right_date_format(this)\">
#write Trigger
$jsscript =
Form->write_trigger(\%myconfig, "3",
- "invdate", "BL", "trigger1",
+ "invdate", "BL", "trigger1",
"duedate", "BL", "trigger2",
"deliverydate", "BL", "trigger3");
}
- $credittext = $locale->text('Credit Limit exceeded!!!');
+ my $credittext = $locale->text('Credit Limit exceeded!!!');
my $follow_up_vc = $form->{customer};
$follow_up_vc =~ s/--\d*\s*$//;
my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)";
- $onload = ($form->{resubmit} && ($form->{format} eq "html")) ? qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()|
+ my $onload = ($form->{resubmit} && ($form->{format} eq "html")) ? qq|window.open('about:blank','Beleg'); document.invoice.target = 'Beleg';document.invoice.submit()|
: ($form->{resubmit}) ? qq|document.invoice.submit()|
: ($creditwarning) ? qq|alert('$credittext')|
: "focus()";
$form->hide_form(qw(id action type media format queued printed emailed title vc discount
creditlimit creditremaining tradediscount business closedto locked shipped storno storno_id
max_dunning_level dunning_amount
- shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax
+ shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax
shiptoemail shiptodepartment_1 shiptodepartment_2 message email subject cc bcc taxaccounts cursor_fokus
convert_from_do_ids convert_from_oe_ids),
map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts} );
-
+
print qq|<p>$form->{saved_message}</p>| if $form->{saved_message};
print qq|
<input type="hidden" name="follow_up_trans_info_1" value="| . H($follow_up_trans_info) . qq|">
<input type="hidden" name="follow_up_rowcount" value="1">
-<input type="hidden" name="lizenzen" value="$lizenzen">
+<input type="hidden" name="lizenzen" value="$main::lizenzen">
<div class="listtop" width="100%">$form->{title}</div>
print qq| <tr>
<th align="right" nowrap>| . $locale->text('Credit Note Number') . qq|</th>
<td> |.
- $cgi->textfield("-name" => "invnumber", "-size" => 11, "-value" => $form->{invnumber}) .
+ $cgi->textfield("-name" => "invnumber", "-size" => 11, "-value" => $form->{invnumber}) .
qq| </td>
</tr>
<tr>
print qq| <tr>
<th align="right" nowrap>| . $locale->text('Invoice Number') . qq|</th>
<td> |.
- $cgi->textfield("-name" => "invnumber", "-size" => 11, "-value" => $form->{invnumber}) .
+ $cgi->textfield("-name" => "invnumber", "-size" => 11, "-value" => $form->{invnumber}) .
qq| </td>
</tr>
<tr>
<tr>
<th align="right" nowrap>| . $locale->text('Delivery Order Number') . qq|</th>
<td> |.
- $cgi->textfield("-name" => "donumber", "-size" => 11, "-value" => $form->{donumber}) .
+ $cgi->textfield("-name" => "donumber", "-size" => 11, "-value" => $form->{donumber}) .
qq| </td>
</tr>
<tr>
print qq| <tr>
<th align="right" nowrap>| . $locale->text('Order Number') . qq|</th>
<td> |.
- $cgi->textfield("-name" => "ordnumber", "-size" => 11, "-value" => $form->{ordnumber}) .
+ $cgi->textfield("-name" => "ordnumber", "-size" => 11, "-value" => $form->{ordnumber}) .
qq| </td>
</tr>
<tr>
<tr>
<th align="right" nowrap>| . $locale->text('Quotation Number') . qq|</th>
<td> |.
- $cgi->textfield("-name" => "quonumber", "-size" => 11, "-value" => $form->{quonumber}) .
+ $cgi->textfield("-name" => "quonumber", "-size" => 11, "-value" => $form->{quonumber}) .
qq| </td>
</tr>
<tr>
<tr>
<th align="right" nowrap>| . $locale->text('Customer Order Number') . qq|</th>
<td> |.
- $cgi->textfield("-name" => "cusordnumber", "-size" => 11, "-value" => $form->{cusordnumber}) .
+ $cgi->textfield("-name" => "cusordnumber", "-size" => 11, "-value" => $form->{cusordnumber}) .
qq| </td>
</tr>
<tr>
<tr>
<td>
</td>
- </tr>
+ </tr>
$jsscript
|;
- print qq|<input type="hidden" name="webdav" value="$webdav">|;
+ print qq|<input type="hidden" name="webdav" value="$main::webdav">|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
$form->{invtotal} = $form->{invsubtotal};
+ my ($rows, $introws);
if (($rows = $form->numtextrows($form->{notes}, 26, 8)) < 2) {
$rows = 2;
}
$introws = 2;
}
$rows = ($rows > $introws) ? $rows : $introws;
- $notes =
+ my $notes =
qq|<textarea name="notes" rows="$rows" cols="26" wrap="soft">$form->{notes}</textarea>|;
- $intnotes =
+ my $intnotes =
qq|<textarea name="intnotes" rows="$rows" cols="35" wrap="soft">$form->{intnotes}</textarea>|;
$form->{taxincluded} = ($form->{taxincluded} ? "checked" : "");
- $taxincluded = "";
+ my $taxincluded = "";
if ($form->{taxaccounts}) {
$taxincluded = qq|
<input name="taxincluded" class="checkbox" type="checkbox" $form->{taxincluded}> <b>|
. $locale->text('Tax Included') . qq|</b><br><br>|;
}
+ my ($tax, $subtotal);
if (!$form->{taxincluded}) {
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
$form->{"${item}_total"} =
$form->round_amount(
}
if ($form->{taxincluded}) {
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
$form->{"${item}_total"} =
$form->round_amount(
</td>
</tr>
|;
- if ($webdav) {
+ my $webdav_list;
+ if ($main::webdav) {
$webdav_list = qq|
<tr>
<td><hr size="3" noshade></td>
<td align="left" width="30%"><b>Dateiname</b></td>
<td align="left" width="70%"><b>Webdavlink</b></td>
|;
- foreach $file (@{ $form->{WEBDAV} }) {
+ foreach my $file (@{ $form->{WEBDAV} }) {
$webdav_list .= qq|
<tr>
<td align="left">$file->{name}</td>
|;
}
+ my @column_index;
if ($form->{currency} eq $form->{defaultcurrency}) {
@column_index = qw(datepaid source memo paid AR_paid);
} else {
@column_index = qw(datepaid source memo paid exchangerate AR_paid);
}
+ my %column_data;
$column_data{datepaid} = "<th>" . $locale->text('Date') . "</th>";
$column_data{paid} = "<th>" . $locale->text('Amount') . "</th>";
$column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
my $totalpaid = 0;
$form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
print "
<tr>\n";
if ($form->{"exchangerate_$i"} == 0) {
$form->{"exchangerate_$i"} = "";
}
- $exchangerate = qq| |;
+ my $exchangerate = qq| |;
if ($form->{currency} ne $form->{defaultcurrency}) {
if ($form->{"forex_$i"}) {
$exchangerate = qq|<input type="hidden" name="exchangerate_$i" value="$form->{"exchangerate_$i"}">$form->{"exchangerate_$i"}|;
</table>
|;
- $invdate = $form->datetonum($form->{invdate}, \%myconfig);
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
if ($form->{id}) {
my $show_storno = !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ar") && (($totalpaid == 0) || ($totalpaid eq ""));
. qq|"> |;
}
# /button for saving history
-
- # mark_as_paid button
- if($form->{id} ne "") {
- print qq|<input type="submit" class="submit" name="action" value="|
+
+ # mark_as_paid button
+ if($form->{id} ne "") {
+ print qq|<input type="submit" class="submit" name="action" value="|
. $locale->text('mark as paid') . qq|">|;
}
# /mark_as_paid button
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub mark_as_paid {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
- &mark_as_paid_common(\%myconfig,"ar");
+ &mark_as_paid_common(\%myconfig,"ar");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('invoice_edit');
my ($recursive_call) = shift;
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining) unless $recursive_call;
$form->{print_and_post} = 0 if $form->{second_run};
- $taxincluded = "checked" if $form->{taxincluded};
+ my $taxincluded = "checked" if $form->{taxincluded};
$form->{update} = 1;
- &check_name(customer);
+ &check_name("customer");
$form->{taxincluded} ||= $taxincluded;
$form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{invdate}, 'buy');
$form->{exchangerate} = $form->{forex} if $form->{forex};
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
next unless $form->{"paid_$i"};
map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(paid exchangerate);
$form->{"forex_$i"} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{"datepaid_$i"}, 'buy');
$form->{"exchangerate_$i"} = $form->{"forex_$i"} if $form->{"forex_$i"};
}
- $i = $form->{rowcount};
- $exchangerate = $form->{exchangerate} || 1;
+ my $i = $form->{rowcount};
+ my $exchangerate = $form->{exchangerate} || 1;
# if last row empty, check the form otherwise retrieve new item
if ( ($form->{"partnumber_$i"} eq "")
IS->retrieve_item(\%myconfig, \%$form);
- $rows = scalar @{ $form->{item_list} };
+ my $rows = scalar @{ $form->{item_list} };
$form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{customer_discount} * 100);
} else {
- $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
+ my $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
map { $form->{item_list}[$i]{$_} =~ s/\"/"/g } qw(partnumber description unit);
map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] };
-
+
$form->{payment_id} = $form->{"part_payment_id_$i"} if $form->{"part_payment_id_$i"} ne "";
$form->{"discount_$i"} = 0 if $form->{"not_discountable_$i"};
$form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor};
($sellprice || $form->{"sellprice_$i"}) =~ /\.(\d+)/;
- $decimalplaces = max 2, length $1;
+ my $decimalplaces = max 2, length $1;
if ($sellprice) {
$form->{"sellprice_$i"} = $sellprice;
$form->{"listprice_$i"} /= $exchangerate;
- $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
+ my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
map { $form->{"${_}_base"} = 0 } split / /, $form->{taxaccounts};
map { $form->{"${_}_base"} += $amount } split / /, $form->{"taxaccounts_$i"};
map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{"taxaccounts_$i"} if !$form->{taxincluded};
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
- if ($lizenzen) {
+ if ($main::lizenzen) {
if ($form->{"inventory_accno_$i"} ne "") {
$form->{"lizenzen_$i"} = qq|<option></option>|;
- foreach $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) {
+ foreach my $item (@{ $form->{LIZENZEN}{ $form->{"id_$i"} } }) {
$form->{"lizenzen_$i"} .= qq|<option value="$item->{"id"}">$item->{"licensenumber"}</option>|;
}
$form->{"lizenzen_$i"} .= qq|<option value=-1>Neue Lizenz</option>|;
}
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post_payment {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('invoice_edit');
- $auth->assert('invoice_edit');
+ our $invdate;
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
if ($form->{"paid_$i"}) {
- $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
+ my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
$form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
$form->error($locale->text('Cannot post payment!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub post {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('invoice_edit');
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
$form->isblank("invdate", $locale->text('Invoice Date missing!'));
$form->{invnumber} =~ s/\s*$//g;
# if oldcustomer ne customer redo form
- if (&check_name(customer)) {
+ if (&check_name('customer')) {
&update;
exit;
}
&validate_items;
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
- $invdate = $form->datetonum($form->{invdate}, \%myconfig);
+ my $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+ my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
$form->error($locale->text('Cannot post invoice for a closed period!'))
if ($invdate <= $closedto);
$form->isblank("exchangerate", $locale->text('Exchangerate missing!'))
if ($form->{currency} ne $form->{defaultcurrency});
- for $i (1 .. $form->{paidaccounts}) {
+ for my $i (1 .. $form->{paidaccounts}) {
if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) {
- $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
+ my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
$form->isblank("datepaid_$i", $locale->text('Payment date missing!'));
$form->redirect( $form->{label} . " $form->{invnumber} " . $locale->text('posted!'))
unless $print_post;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print_and_post {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
- $old_form = new Form;
+ my $old_form = new Form;
$print_post = 1;
$form->{print_and_post} = 1;
&post();
&edit();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub use_as_template {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
$form->{paidaccounts} = 1;
$form->{invdate} = $form->current_date(\%myconfig);
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub storno {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('invoice_edit');
if ($form->{storno}) {
$form->error($locale->text('Cannot storno storno invoice!'));
$form->{rowcount}++;
post();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub preview {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
$form->{preview} = 1;
- $old_form = new Form;
+ my $old_form = new Form;
for (keys %$form) { $old_form->{$_} = $form->{$_} }
&print_form($old_form);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
if ($form->{second_run}) {
$form->{print_and_post} = 0;
# delete action variable
map { delete $form->{$_} } qw(action header);
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
</form>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub credit_note {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('invoice_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('invoice_edit');
$form->{transdate} = $form->{invdate} = $form->current_date(\%myconfig);
$form->{duedate} =
$form->{title} = $locale->text('Add Credit Note');
$form->{script} = 'is.pl';
- $script = "is";
- $buysell = 'buy';
+ our $script = "is";
+ our $buysell = 'buy';
# bo creates the id, reset it
$form->{type} = "credit_note";
- map { $form->{"select$_"} = "" } ($form->{vc}, currency);
+ map { $form->{"select$_"} = "" } ($form->{vc}, 'currency');
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(creditlimit creditremaining);
- $currency = $form->{currency};
+ my $currency = $form->{currency};
&invoice_links;
$form->{currency} = $currency;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub yes {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
- if (IS->delete_invoice(\%myconfig, \%$form, $spool)) {
+ if (IS->delete_invoice(\%myconfig, \%$form, $main::spool)) {
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
}
$form->error($locale->text('Cannot delete invoice!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub e_mail {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
- $auth->assert('invoice_edit');
+ $main::auth->assert('invoice_edit');
if (!$form->{id}) {
$print_post = 1;
edit_e_mail();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
use CGI::Carp qw(fatalsToBrowser);
+use strict;
+
+my $form = $main::form;
+my $locale = $main::locale;
+
$form->header;
-$paramstring = $ENV{"QUERY_STRING"};
-@felder = split "&", $paramstring;
+my $paramstring = $ENV{"QUERY_STRING"};
+my @felder = split "&", $paramstring;
+my ($name, $wert);
foreach (@felder) {
($name, $wert) = split "=", $_;
$wert =~ tr/+/ /;
- $$name = $wert;
+ $name = $wert;
}
-$login =
+my $login =
"[" . $form->{login}
. " - <a href=\"login.pl?action=logout\" target=\"_top\">"
. $locale->text('Logout')
"April", "Mai", "Juni", "Juli",
"August", "September", "Oktober", "November",
"Dezember");
-$datum =
+my $datum =
$Wochentage[$Wochentag] . ", der "
. $Monatstag . "."
. $Monat . "."
require "bin/mozilla/common.pl";
+use strict;
+
sub quot {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
$_[0] =~ s/\"/\"/g;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $_[0];
}
sub form_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
- $auth->assert('license_edit');
+ my $form = $main::form;
$form->{jsscript} = 1;
$form->header();
qq|<body>
<form method=post action=$form->{script}>|);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
- $auth->assert('license_edit');
+ my $form = $main::form;
my @items = qw(old_callback previousform);
push(@items, @{ $form->{"hidden"} });
</body>
</html>
|);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub set_std_hidden {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+
$form->{"hidden"} = ["comment", "validuntil", "quantity", @_];
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print_part_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('license_edit');
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my $locale = $main::locale;
form_header();
set_std_hidden("business");
</tr>
|);
- $j = 1;
- for ($i = 1; $i <= scalar(@{ $form->{"parts"} }); $i++) {
- %p = %{ $form->{"parts"}->[$i - 1] };
+ my $j = 1;
+ for (my $i = 1; $i <= scalar(@{ $form->{"parts"} }); $i++) {
+ my %p = %{ $form->{"parts"}->[$i - 1] };
+ my $checked;
if ($i == 1) {
$checked = "checked";
} else {
<input type=submit name=action value=| . $locale->text('Continue') . qq|>|);
form_footer();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print_customer_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
- $auth->assert('license_edit');
+ my $form = $main::form;
+ my $locale = $main::locale;
form_header();
set_std_hidden("parts_id", "partnumber", "description");
print(qq|<tr><td colspan=6><hr size=3 noshade></td></tr>|);
- $j = 1;
- for ($i = 1; $i <= scalar(@{ $form->{"all_customers"} }); $i++) {
- %c = %{ $form->{"all_customers"}->[$i - 1] };
+ my $j = 1;
+ for (my $i = 1; $i <= scalar(@{ $form->{"all_customers"} }); $i++) {
+ my %c = %{ $form->{"all_customers"}->[$i - 1] };
+ my $checked;
if ($i == 1) {
$checked = "checked";
} else {
<input type=submit name=action value=| . $locale->text('Continue') . qq|>|);
form_footer();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print_license_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('license_edit');
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
print(
qq|
if (!defined($form->{"customer_id"})) {
$form->{"customer_id"} = $_->{"id"};
}
- $selected = ($_->{"id"} * 1) == $form->{"customer_id"} ? "selected" : "";
+ my $selected = ($_->{"id"} * 1) == $form->{"customer_id"} ? "selected" : "";
print(qq|<option $selected> $_->{"name"}--$_->{"id"}</option>|);
}
print(qq|</select></td>|);
$form->write_trigger(\%myconfig, 1, "validuntil", "BL",
"trigger_validuntil"));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
- $auth->assert('license_edit');
+ my $form = $main::form;
+ my $locale = $main::locale;
- if (!$lizenzen) {
+ if (!$main::lizenzen) {
$form->error(
$locale->text(
'The licensing module has been deactivated in lx-erp.conf.')
$form->{"initial"} = 1;
do_add();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub do_add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('license_edit');
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{"hidden"} = ["parts_id"];
form_header();
if ($form->{"ndx"}) {
- $ndx = $form->{"ndx"};
+ my $ndx = $form->{"ndx"};
foreach (keys(%{$form})) {
next unless (/^new_.*_${ndx}$/);
s/^new_//;
if ($form->{"customer_name"}) {
LICENSES->get_customers(\%myconfig, $form);
if (scalar(@{ $form->{"all_customers"} }) == 1) {
- %c = %{ $form->{"all_customers"}->[0] };
+ my %c = %{ $form->{"all_customers"}->[0] };
$form->{"customer_id"} = $c{"id"};
$form->{"customer_name"} = $c{"name"};
} elsif (scalar(@{ $form->{"all_customers"} }) == 0) {
print_license_form($form->{"parts_id"} && $form->{"customer_id"});
form_footer();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
- $auth->assert('license_edit');
+ my $form = $main::form;
do_add();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub continue {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+
call_sub($form->{"nextsub"});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('license_edit');
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
($form->{customername}, $form->{customer_id}) = split /--/,
$form->{customer};
$form->error($locale->text('Please enter a license key.'));
}
- $rc = LICENSES->save_license(\%myconfig, \%$form);
+ my $rc = LICENSES->save_license(\%myconfig, \%$form);
# load previous variables
if ($form->{previousform}) {
# save the new form variables before splitting previousform
+ my %newform;
map { $newform{$_} = $form->{$_} } keys %$form;
- $previousform = $form->unescape($form->{previousform});
+ my $previousform = $form->unescape($form->{previousform});
# don't trample on previous variables
map { delete $form->{$_} } keys %newform;
# now take it apart and restore original values
- foreach $item (split /&/, $previousform) {
- ($key, $value) = split /=/, $item, 2;
+ foreach my $item (split /&/, $previousform) {
+ my ($key, $value) = split /=/, $item, 2;
$value =~ s/%26/&/g;
$form->{$key} = $value;
}
delete $form->{action};
# restore original callback
- $callback = $form->unescape($form->{callback});
+ my $callback = $form->unescape($form->{callback});
$form->{callback} = $form->unescape($form->{old_callback});
delete $form->{old_callback};
# put callback together
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
# do single escape for Apache 2.0
- $value = $form->escape($form->{$key}, 1);
+ my $value = $form->escape($form->{$key}, 1);
$callback .= qq|&$key=$value|;
}
$form->{callback} = $callback;
form_footer();
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
- $auth->assert('license_edit');
+ my $form = $main::form;
+ my $locale = $main::locale;
- if (!$lizenzen) {
+ if (!$main::lizenzen) {
$form->error(
$locale->text(
'The licensing module has been deactivated in lx-erp.conf.')
|);
form_footer();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub do_search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('license_edit');
+ $main::auth->assert('license_edit');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
LICENSES->search(\%myconfig, $form);
- $callback = "";
+ my $callback = "";
map { $callback .= "\&${_}=" . $form->escape($form->{$_}, 1) }
qw(db partnumber description customer_name all expiring_in show_expired);
- $details = $form->{"script"} . "?action=details" . $callback . "\&id=";
- $invdetails = "is.pl?action=edit" . $callback . "\&id=";
+ my $details = $form->{"script"} . "?action=details" . $callback . "\&id=";
+ my $invdetails = "is.pl?action=edit" . $callback . "\&id=";
$callback = $form->{"script"} . "?action=do_search" . $callback;
$form->{"sortby"} = "validuntil" unless ($form->{"sortby"});
$form->{"sortasc"} *= 1;
+ my %columns;
foreach (("partnumber", "description", "name", "validuntil", "invnumber")) {
$columns{$_} = $callback . "\&sortby=${_}\&sortasc=";
if ($form->{"sortby"} eq $_) {
</tr>
|);
- $j = 1;
- for ($i = 0; $i < scalar(@{ $form->{"licenses"} }); $i++) {
- $ref = $form->{"licenses"}->[$i];
+ my $j = 1;
+ for (my $i = 0; $i < scalar(@{ $form->{"licenses"} }); $i++) {
+ my $ref = $form->{"licenses"}->[$i];
print(
qq|
<tr class=listrow$j>
|);
form_footer();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub details {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('license_edit');
- $auth->assert('license_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
LICENSES->get_license(\%myconfig, $form);
map(
|);
form_footer();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
1;
require "bin/mozilla/common.pl";
require "bin/mozilla/todo.pl";
+use strict;
+
# This is required because the am.pl in the root directory
# is not scanned by locales.pl:
# $form->parse_html_template('login/password_error')
-$form = new Form;
+our $form = new Form;
if (! -f 'config/authentication.pl') {
show_error('login/authentication_pl_missing');
}
-$locale = new Locale $language, "login";
+our $locale = new Locale $main::language, "login";
our $auth = SL::Auth->new();
if (!$auth->session_tables_present()) {
show_error('login/auth_db_unreachable');
}
$auth->expire_sessions();
-my $session_result = $auth->restore_session();
+my $session_result = $main::auth->restore_session();
# customization
if (-f "bin/mozilla/custom_$form->{script}") {
1;
sub login_screen {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($msg) = @_;
if (-f "css/lx-office-erp.css") {
print $form->parse_html_template('login/login_screen');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub login {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
unless ($form->{login}) {
login_screen($locale->text('You did not enter a name!'));
exit;
}
- $user = new User $form->{login};
+ my $user = new User $form->{login};
# if we get an error back, bale out
+ my $result;
if (($result = $user->login($form)) <= -1) {
exit if $result == -2;
login_screen($locale->text('Incorrect username or password!'));
# made it this far, execute the menu
$form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display', "callback=" . $form->escape($form->{callback}));
- $auth->set_cookie_environment_variable();
+ $main::auth->set_cookie_environment_variable();
$form->redirect();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub logout {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->destroy_session();
+ $main::auth->destroy_session();
# remove the callback to display the message
$form->{callback} = "login.pl?action=";
$form->redirect($locale->text('You are logged out!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub company_logo {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $locale = new Locale $myconfig{countrycode}, "login" if ($language ne $myconfig{countrycode});
+ my %myconfig = %main::myconfig;
+ $locale = new Locale $myconfig{countrycode}, "login" if ($main::language ne $myconfig{countrycode});
$form->{todo_list} = create_todo_list('login_screen' => 1) if (!$form->{no_todo_list});
print $form->parse_html_template('login/company_logo');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub show_error {
my $template = shift;
- $locale = Locale->new($language, 'all');
- $myconfig{countrycode} = $language;
+ my %myconfig = %main::myconfig;
+ $locale = Locale->new($main::language, 'all');
+ $myconfig{countrycode} = $main::language;
$form->{stylesheet} = 'css/lx-office-erp.css';
$form->header();
# 2004-12-14 - New Optik - Marco Welter <mawe@linux-studio.de>
#######################################################################
-$menufile = "menu.ini";
+my $menufile = "menu.ini";
use SL::Menu;
use Data::Dumper;
use URI;
+use strict;
+
+my $framesize = ($ENV{HTTP_USER_AGENT} =~ /links/i) ? "240" : "190";
+my $mainlevel;
+
1;
# end of main
-$framesize = ($ENV{HTTP_USER_AGENT} =~ /links/i) ? "240" : "190";
-
sub display {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my $callback = $form->unescape($form->{callback});
$callback = URI->new($callback)->rel($callback) if $callback;
</HTML>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub acc_menu {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+
$mainlevel = $form->{level};
$mainlevel =~ s/\Q$mainlevel\E--//g;
my $menu = new Menu "$menufile";
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub section_menu {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($menu, $level) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ my $zeige;
+
# build tiered menus
my @menuorder = $menu->access_control(\%myconfig, $level);
while (@menuorder) {
- $item = shift @menuorder;
- $label = $item;
- $ml = $item;
+ my $item = shift @menuorder;
+ my $label = $item;
+ my $ml = $item;
$label =~ s/\Q$level\E--//g;
$ml =~ s/--.*//;
if ($ml eq $mainlevel) { $zeige = 1; }
else { $zeige = 0; }
my $spacer = " " x (($item =~ s/--/--/g) * 1);
$label =~ s/.*--//g;
- $label_icon = $label . ".gif";
- $mlab = $label;
+ my $label_icon = $label . ".gif";
+ my $mlab = $label;
$label = $locale->text($label);
# multi line hack, sschoeling jul06
# if a label is too long, try to split it at whitespaces, then join it to chunks of less
# than 20 chars and store it in an array.
# use this array later instead of the -ed label
- @chunks = ();
+ my @chunks = ();
my ($i,$l) = (-1, 20);
map {
if (($l += length $_) < 20) {
}
}
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# 2007-10-14 - XMLified - Holger Will <holger@treebuilder.de>
#######################################################################
-$menufile = "menu.ini";
+my $menufile = "menu.ini";
use SL::Menu;
use CGI::Carp qw(fatalsToBrowser);
use Encode;
use URI;
+
+use strict;
+
+my $locale;
+
1;
# end of main
sub display {
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
$locale = Locale->new($myconfig{countrycode}, "menu");
- my $charset = $dbcharset || 'ISO-8859-1';
+ my $charset = $main::dbcharset || 'ISO-8859-1';
my $callback = $form->unescape($form->{callback});
$callback = URI->new($callback)->rel($callback) if $callback;
$callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/;
sub acc_menu {
- $mainlevel = $form->{level};
+ my $form = $main::form;
+
+ my $mainlevel = $form->{level};
$mainlevel =~ s/$mainlevel--//g;
my $menu = new Menu "$menufile";
my ($menu, $parent, $depth) = @_;
my $html;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
die if ($depth * 1 > 5);
my @menuorder;
# 2004-12-14 - Holger Lindemann
#######################################################################
-$menufile = "menu.ini";
+my $menufile = "menu.ini";
use SL::Menu;
use CGI::Carp qw(fatalsToBrowser);
+use strict;
+
+my $locale;
+
1;
# end of main
sub display {
+
+ my $form = $main::form;
+
$form->{callback} = $form->unescape($form->{callback});
$form->{callback} ||= "login.pl?action=company_logo";
sub clock_line {
- $fensterlink="menujs.pl?action=display";
- $fenster = "["."<a href=\"$fensterlink\" target=\"_blank\">neues Fenster</a>]";
+ my $form = $main::form;
- $login = "[Nutzer "
+ my $fensterlink="menujs.pl?action=display";
+ my $fenster = "["."<a href=\"$fensterlink\" target=\"_blank\">neues Fenster</a>]";
+
+ my $login = "[Nutzer "
. $form->{login}
. " - <a href=\"login.pl?action=logout\" target=\"_top\">"
. $locale->text('Logout')
"April", "Mai", "Juni", "Juli",
"August", "September", "Oktober", "November",
"Dezember");
- $datum =
+ my $datum =
$Wochentage[$Wochentag] . ", der "
. $Monatstag . "."
. $Monat . "."
. $Jahr . " - ";
#$zeit="<div id='Uhr'>".$Stunden.":".$Minuten.":".$Sekunden."</div>";
- $zeit = "<div id='Uhr'>" . $Stunden . ":" . $Minuten . "</div>";
+ my $zeit = "<div id='Uhr'>" . $Stunden . ":" . $Minuten . "</div>";
print qq|
<script type="text/javascript">
<!--
}
sub acc_menu {
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
$locale = Locale->new($myconfig{countrycode}, "menu");
- $mainlevel = $form->{level};
+ my $mainlevel = $form->{level};
$mainlevel =~ s/$mainlevel--//g;
my $menu = new Menu "$menufile";
sub section_menu {
my ($menu, $level) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
# build tiered menus
my @menuorder = $menu->access_control(\%myconfig, $level);
- $main = 0;
+ my $main = 0;
#$pm=0;
- $shlp=0;
+ my $shlp=0;
+ my (%mlz, $sm, $z, $pm, $mm);
while (@menuorder) {
- $item = shift @menuorder;
- $label = $item;
- $ml = $item;
+ my $item = shift @menuorder;
+ my $label = $item;
+ my $ml = $item;
$label =~ s/$level--//g;
$ml =~ s/--.*//;
$label = $locale->text($label);
if ($menu->{$item}{module}) {
#Untermenüpunkte
- $target = $menu->{$item}{target};
- $uri = $menu->menuitem_js(\%myconfig, \%$form, $item, $level);
+ my $target = $menu->{$item}{target};
+ my $uri = $menu->menuitem_js(\%myconfig, \%$form, $item, $level);
print
qq|menu[$pm][$sm] = new Item('$label', '$uri', '$target', defLength, 0, 0);\n|;
%mlz = ($ml, $pm, "s$ml", 1);
$shlp = $sm;
$sm = 1;
- $breit = 15 + length($label) * 6;
+ my $breit = 15 + length($label) * 6;
print
qq|menu[0][$mm] = new Item(' $label', '#', '', $breit, 10, $pm); \n|;
print qq|menu[$pm] = new Array();\n|;
use SL::Menu;
+use strict;
+
+my $locale;
+
1;
# end of main
sub display {
+ my $form = $main::form;
+
$form->header();
# $form->{force_ul_width} = $ENV{HTTP_USER_AGENT} =~ m/MSIE\s+6\./;
}
sub clock_line {
+ my $form = $main::form;
+
my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
$Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
= localtime(time);
}
sub acc_menu {
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$locale = Locale->new($myconfig{countrycode}, "menu");
my $mainlevel = $form->{level};
$mainlevel =~ s/\Q$mainlevel\E--//g;
my $menu = Menu->new('menu.ini');
- $AUTOFLUSH = 1;
+ $English::AUTOFLUSH = 1;
my $all_items = [];
create_menu($menu, $all_items);
my ($menu, $all_items, $parent, $depth) = @_;
my $html;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
die if ($depth * 1 > 5);
my @menuorder = $menu->access_control(\%myconfig, $parent);
#
#######################################################################
-$menufile = "menu.ini";
use SL::Menu;
use URI;
+use strict;
+
+my $menufile = "menu.ini";
+my $locale;
+
1;
# end of main
sub display {
+ my $form = $main::form;
+
$form->header(qq|<link rel="stylesheet" href="css/menuv3.css?id=" type="text/css">|);
$form->{date} = clock_line();
}
sub acc_menu {
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
$locale = Locale->new($myconfig{countrycode}, "menu");
- $mainlevel = $form->{level};
+ my $mainlevel = $form->{level};
$mainlevel =~ s/\Q$mainlevel\E--//g;
my $menu = new Menu "$menufile";
sub print_menu {
my ($menu, $parent, $depth) = @_;
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
my $html;
die if ($depth * 1 > 5);
#
#######################################################################
-$menufile = "menu.ini";
use SL::Menu;
use URI;
+use strict;
+
+my $menufile = "menu.ini";
+my $locale;
+
1;
# end of main
sub display {
+ my $form = $main::form;
+
$form->header(qq|<link rel="stylesheet" href="css/menuv4.css?id=" type="text/css">|);
$form->{date} = clock_line();
}
sub clock_line {
+ my $form = $main::form;
+
my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
$Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
= localtime(time);
}
sub acc_menu {
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
$locale = Locale->new($myconfig{countrycode}, "menu");
- $mainlevel = $form->{level};
+ my $mainlevel = $form->{level};
$mainlevel =~ s/\Q$mainlevel\E--//g;
my $menu = new Menu "$menufile";
sub print_menu {
my ($menu, $parent, $depth) = @_;
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
my $html;
die if ($depth * 1 > 5);
require "bin/mozilla/arap.pl";
require "bin/mozilla/reportgenerator.pl";
+use strict;
+
+my $print_post;
+my %TMPL_VAR;
+
1;
# end of main
};
sub check_oe_access {
+ my $form = $main::form;
+
my $right = $oe_access_map->{$form->{type}};
$right ||= 'DOES_NOT_EXIST';
- $auth->assert($right);
+ $main::auth->assert($right);
}
sub set_headings {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
check_oe_access();
$form->{vc} = 'customer';
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
check_oe_access();
&prepare_order;
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
check_oe_access();
# editing without stuff to edit? try adding it first
if ($form->{rowcount} && !$form->{print_and_save}) {
+ my $id;
map { $id++ if $form->{"multi_id_$_"} } (1 .. $form->{rowcount});
if (!$id) {
# reset rowcount
undef $form->{rowcount};
&add;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
} elsif (!$form->{id}) {
&add;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
+ my ($language_id, $printer_id);
if ($form->{print_and_save}) {
$form->{action} = "print";
$form->{resubmit} = 1;
&order_links;
$form->{rowcount} = 0;
- foreach $ref (@{ $form->{form_details} }) {
+ foreach my $ref (@{ $form->{form_details} }) {
$form->{rowcount}++;
map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{$ref};
}
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub order_links {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
check_oe_access();
$form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
# retrieve order/quotation
- $form->{webdav} = $webdav;
+ $form->{webdav} = $main::webdav;
$form->{jsscript} = 1;
my $editing = $form->{id};
$form->{"old$form->{vc}"} .= qq|--$form->{"$form->{vc}_id"}|
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub prepare_order {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
check_oe_access();
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my @custom_hiddens;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
+
check_oe_access();
# Container for template variables. Unfortunately this has to be visible in form_footer too, so not my.
push @custom_hiddens, "select$form->{vc}";
# currencies and exchangerate
- @values = map { $_ } @{ $form->{ALL_CURRENCIES} };
- %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
+ my @values = map { $_ } @{ $form->{ALL_CURRENCIES} };
+ my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
$form->{currency} = $form->{defaultcurrency} unless $form->{currency};
$TMPL_VAR{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency};
$TMPL_VAR{currencies} = NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
push @custom_hiddens, "exchangerate" if $form->{forex};
# credit remaining
- $creditwarning = (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) ? 1 : 0;
+ my $creditwarning = (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) ? 1 : 0;
$TMPL_VAR{is_credit_remaining_negativ} = ($form->{creditremaining} =~ /-/) ? "0" : "1";
# business
push @custom_hiddens, "customer_klass" if $form->{vc} eq 'customer';
- $credittext = $locale->text('Credit Limit exceeded!!!');
+ my $credittext = $locale->text('Credit Limit exceeded!!!');
my $follow_up_vc = $form->{ $form->{vc} eq 'customer' ? 'customer' : 'vendor' };
$follow_up_vc =~ s/--\d*\s*$//;
}
}
- $onload = ($form->{resubmit} && ($form->{format} eq "html")) ? "window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()"
+ my $onload = ($form->{resubmit} && ($form->{format} eq "html")) ? "window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()"
: ($form->{resubmit}) ? "document.oe.submit()"
: ($creditwarning) ? "alert('$credittext')"
: "";
print $form->parse_html_template("oe/form_header", { %TMPL_VAR });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
check_oe_access();
$form->{invtotal} = $form->{invsubtotal};
- $rows = max 2, $form->numtextrows($form->{notes}, 25, 8);
- $introws = max 2, $form->numtextrows($form->{intnotes}, 35, 8);
+ my $rows = max 2, $form->numtextrows($form->{notes}, 25, 8);
+ my $introws = max 2, $form->numtextrows($form->{intnotes}, 35, 8);
$rows = max $rows, $introws;
$TMPL_VAR{notes} = qq|<textarea name=notes rows=$rows cols=25 wrap=soft>| . H($form->{notes}) . qq|</textarea>|;
if (!$form->{taxincluded}) {
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
$form->{invtotal} += $form->{"${item}_total"} = $form->round_amount( $form->{"${item}_base"} * $form->{"${item}_rate"}, 2);
$form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
# $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); # template does this
} else {
- foreach $item (split / /, $form->{taxaccounts}) {
+ foreach my $item (split / /, $form->{taxaccounts}) {
if ($form->{"${item}_base"}) {
$form->{"${item}_total"} = $form->round_amount( ($form->{"${item}_base"} * $form->{"${item}_rate"} / (1 + $form->{"${item}_rate"})), 2);
$form->{"${item}_netto"} = $form->round_amount( ($form->{"${item}_base"} - $form->{"${item}_total"}), 2);
print $form->parse_html_template("oe/form_footer", {
%TMPL_VAR,
- webdav => $webdav,
+ webdav => $main::webdav,
print_options => print_options(inline => 1),
label_edit => $locale->text("Edit the $form->{type}"),
label_workflow => $locale->text("Workflow $form->{type}"),
});
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($recursive_call) = shift;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
check_oe_access();
# $main::lxdebug->message(0, Dumper($form));
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate) unless $recursive_call;
$form->{update} = 1;
- $payment_id = $form->{payment_id} if $form->{payment_id};
+ my $payment_id = $form->{payment_id} if $form->{payment_id};
&check_name($form->{vc});
$form->{payment_id} = $payment_id if $form->{payment_id} eq "";
- $buysell = 'buy';
+ my $buysell = 'buy';
$buysell = 'sell' if ($form->{vc} eq 'vendor');
$form->{forex} = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, $buysell);
$form->{exchangerate} = $form->{forex} if $form->{forex};
- $exchangerate = $form->{exchangerate} || 1;
+ my $exchangerate = $form->{exchangerate} || 1;
##################### process items ######################################
# for pricegroups
- $i = $form->{rowcount};
+ my $i = $form->{rowcount};
if ( ($form->{"partnumber_$i"} eq "")
&& ($form->{"description_$i"} eq "")
&& ($form->{"partsgroup_$i"} eq "")) {
} else {
- $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
+ my $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"});
# hier werden parts (Artikeleigenschaften) aus item_list (retrieve_item aus IS.pm)
# (item wahrscheinlich synonym für parts) entsprechend in die form geschrieben ...
$form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor};
($sellprice || $form->{"sellprice_$i"}) =~ /\.(\d+)/;
- $decimalplaces = max 2, length $1;
+ my $dec_qty = length $1;
+ my $decimalplaces = max 2, $dec_qty;
if ($sellprice) {
$form->{"sellprice_$i"} = $sellprice;
$form->{"sellprice_$i"} /= $exchangerate; # if there is an exchange rate adjust sellprice
}
- $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
+ my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100);
map { $form->{"${_}_base"} = 0 } split / /, $form->{taxaccounts};
map { $form->{"${_}_base"} += $amount } split / /, $form->{"taxaccounts_$i"};
map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{taxaccounts} if !$form->{taxincluded};
##################### process items ######################################
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
check_oe_access();
print $form->parse_html_template('oe/search', { %myconfig });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_subtotal_row {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
map { $totals->{$_} = 0 } @{ $subtotal_columns };
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $row;
}
sub orders {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
check_oe_access();
- $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
+ my $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber";
($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} });
$form->{callback} = $href .= "&sort=$form->{sort}";
# escape callback for href
- $callback = $form->escape($href);
+ my $callback = $form->escape($href);
my @subtotal_columns = qw(netamount amount marge_total marge_percent);
my $edit_url = build_std_url('action=edit', 'type', 'vc');
- foreach $oe (@{ $form->{OE} }) {
+ foreach my $oe (@{ $form->{OE} }) {
map { $oe->{$_} *= $oe->{exchangerate} } @subtotal_columns;
$oe->{tax} = $oe->{amount} - $oe->{netamount};
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub check_delivered_flag {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
check_oe_access();
if (($form->{type} ne 'sales_order') && ($form->{type} ne 'purchase_order')) {
- return $lxdebug->leave_sub();
+ return $main::lxdebug->leave_sub();
}
my $all_delivered = 0;
$form->{delivered} = 1 if $all_delivered;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_and_close {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
check_oe_access();
$form->{$idx} =~ s/^\s*//g;
$form->{$idx} =~ s/\s*$//g;
- $msg = ucfirst $form->{vc};
+ my $msg = ucfirst $form->{vc};
$form->isblank($form->{vc}, $locale->text($msg . " missing!"));
# $locale->text('Customer missing!');
&validate_items;
+ my $payment_id;
if($form->{payment_id}) {
$payment_id = $form->{payment_id};
}
$form->{id} = 0 if $form->{saveasnew};
+ my ($numberfld, $ordnumber, $err);
# this is for the internal notes section for the [email] Subject
if ($form->{type} =~ /_order$/) {
if ($form->{type} eq 'sales_order') {
$form->redirect($form->{label} . " $form->{$ordnumber} " .
$locale->text('saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
check_oe_access();
$form->{$idx} =~ s/^\s*//g;
$form->{$idx} =~ s/\s*$//g;
- $msg = ucfirst $form->{vc};
+ my $msg = ucfirst $form->{vc};
$form->isblank($form->{vc}, $locale->text($msg . " missing!"));
# $locale->text('Customer missing!');
&validate_items;
+ my $payment_id;
if($form->{payment_id}) {
$payment_id = $form->{payment_id};
}
$form->{id} = 0 if $form->{saveasnew};
+ my ($numberfld, $ordnumber, $err);
+
# this is for the internal notes section for the [email] Subject
if ($form->{type} =~ /_order$/) {
if ($form->{type} eq 'sales_order') {
edit();
exit;
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
check_oe_access();
$form->header;
+ my ($msg, $ordnumber);
if ($form->{type} =~ /_order$/) {
$msg = $locale->text('Are you sure you want to delete Order Number');
$ordnumber = 'ordnumber';
# delete action variable
map { delete $form->{$_} } qw(action header);
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete_order_quotation {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
check_oe_access();
+ my ($msg, $err);
if ($form->{type} =~ /_order$/) {
$msg = $locale->text('Order deleted!');
$err = $locale->text('Cannot delete order!');
$msg = $locale->text('Quotation deleted!');
$err = $locale->text('Cannot delete quotation!');
}
- if (OE->delete(\%myconfig, \%$form, $spool)){
+ if (OE->delete(\%myconfig, \%$form, $main::spool)){
# saving the history
if(!exists $form->{addition}) {
$form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
}
$form->error($err);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub invoice {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
check_oe_access();
- $auth->assert($form->{type} eq 'purchase_order' || $form->{type} eq 'request_quotation' ? 'vendor_invoice_edit' : 'invoice_edit');
+ $main::auth->assert($form->{type} eq 'purchase_order' || $form->{type} eq 'request_quotation' ? 'vendor_invoice_edit' : 'invoice_edit');
$form->{old_salesman_id} = $form->{salesman_id};
$form->get_employee();
$form->{quodate} = $form->{transdate};
}
- $payment_id = $form->{payment_id} if $form->{payment_id};
+ my $payment_id = $form->{payment_id} if $form->{payment_id};
# if the name changed get new values
if (&check_name($form->{vc})) {
$form->{cp_id} *= 1;
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
for (qw(ship qty sellprice listprice basefactor)) {
$form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"};
}
}
+ my ($buysell, $orddate, $exchangerate);
if ( $form->{type} =~ /_order/
&& $form->{currency} ne $form->{defaultcurrency}) {
&create_backorder;
}
+ my ($script);
if ( $form->{type} eq 'purchase_order'
|| $form->{type} eq 'request_quotation') {
$form->{title} = $locale->text('Add Vendor Invoice');
map { $form->{"select$_"} = "" } ($form->{vc}, "currency");
- $currency = $form->{currency};
+ my $currency = $form->{currency};
&invoice_links;
$form->{currency} = $currency;
&prepare_invoice;
# format amounts
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
$form->{"discount_$i"} =
$form->format_amount(\%myconfig, $form->{"discount_$i"});
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
+ my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
$dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
+ my $decimalplaces = ($dec > 2) ? $dec : 2;
# copy delivery date from reqdate for order -> invoice conversion
$form->{"deliverydate_$i"} = $form->{"reqdate_$i"}
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub backorder_exchangerate {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
check_oe_access();
# delete action variable
map { delete $form->{$_} } qw(action header exchangerate);
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_exchangerate {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->isblank("exchangerate", $locale->text('Exchangerate missing!'));
$form->{exchangerate} =
&invoice;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_backorder {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->{shipped} = 1;
# figure out if we need to create a backorder
# items aren't saved if qty != 0
- for $i (1 .. $form->{rowcount}) {
- $totalqty += $qty = $form->{"qty_$i"};
- $totalship += $ship = $form->{"ship_$i"};
+ my ($totalqty, $totalship);
+ for my $i (1 .. $form->{rowcount}) {
+ my $qty = $form->{"qty_$i"};
+ my $ship = $form->{"ship_$i"};
+ $totalqty += $qty;
+ $totalship += $ship;
$form->{"qty_$i"} = $qty - $ship;
}
return;
}
- @flds = (
+ my @flds = (
qw(partnumber description qty ship unit sellprice discount id inventory_accno bin income_accno expense_accno listprice assembly taxaccounts partsgroup)
);
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
map {
$form->{"${_}_$i"} =
$form->format_amount(\%myconfig, $form->{"${_}_$i"})
OE->save(\%myconfig, \%$form);
# rebuild rows for invoice
- @a = ();
- $count = 0;
+ my @a = ();
+ my $count = 0;
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
$form->{"qty_$i"} = $form->{"ship_$i"};
if ($form->{"qty_$i"}) {
push @a, {};
- $j = $#a;
+ my $j = $#a;
map { $a[$j]->{$_} = $form->{"${_}_$i"} } @flds;
$count++;
}
$form->redo_rows(\@flds, \@a, $count, $form->{rowcount});
$form->{rowcount} = $count;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_as_new {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
check_oe_access();
&save;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub check_for_direct_delivery_yes {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
check_oe_access();
map { s/^CFDD_//; $form->{$_} = $form->{"CFDD_${_}"} } grep /^CFDD_/, keys %{ $form };
$form->{shipto} = 1;
purchase_order();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub check_for_direct_delivery_no {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
check_oe_access();
delete @{$form}{grep /^shipto/, keys %{ $form }};
purchase_order();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub check_for_direct_delivery {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
check_oe_access();
if ($form->{direct_delivery_checked}
|| (!$form->{shiptoname} && !$form->{shiptostreet} && !$form->{shipto_id})) {
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
$form->header();
print $form->parse_html_template("oe/check_for_direct_delivery");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
exit 0;
}
sub purchase_order {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
check_oe_access();
- $auth->assert('purchase_order_edit');
+ $main::auth->assert('purchase_order_edit');
if ($form->{type} eq 'sales_order') {
check_for_direct_delivery();
&poso;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub sales_order {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
check_oe_access();
- $auth->assert('sales_order_edit');
+ $main::auth->assert('sales_order_edit');
if ($form->{type} eq "purchase_order") {
delete($form->{ordnumber});
&poso;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub poso {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
check_oe_access();
- $auth->assert('purchase_order_edit | sales_order_edit');
+ $main::auth->assert('purchase_order_edit | sales_order_edit');
$form->{transdate} = $form->current_date(\%myconfig);
delete $form->{duedate};
map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered
ordnumber);
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor discount);
}
# prepare_order assumes that the discount is in db-notation (0.05) and not user-notation (5)
# and therefore multiplies the values by 100 in the case of reading from db or making an order from several quotation, so we convert this back into percent-notation for the user interface by multiplying with 0.01
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
$form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 0.01);
};
# format amounts
- for $i (1 .. $form->{rowcount} - 1) {
+ for my $i (1 .. $form->{rowcount} - 1) {
map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description unit);
}
&update;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delivery_order {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
if ($form->{type} =~ /^sales/) {
- $auth->assert('sales_delivery_order_edit');
+ $main::auth->assert('sales_delivery_order_edit');
$form->{vc} = 'customer';
$form->{type} = 'sales_delivery_order';
} else {
- $auth->assert('purchase_delivery_order_edit');
+ $main::auth->assert('purchase_delivery_order_edit');
$form->{vc} = 'vendor';
$form->{type} = 'purchase_delivery_order';
# reset
delete @{$form}{qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal closed delivered)};
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor discount);
}
update();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub e_mail {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
check_oe_access();
edit_e_mail();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub yes {
- call_sub($form->{yes_nextsub});
+ call_sub($main::form->{yes_nextsub});
}
sub no {
- call_sub($form->{no_nextsub});
+ call_sub($main::form->{no_nextsub});
}
######################################################################################################
# IO ENTKOPPLUNG
# ###############################################################################################
sub display_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
check_oe_access();
$form->language_payment(\%myconfig);
- Common::webdav_folder($form) if ($webdav);
+ Common::webdav_folder($form) if ($main::webdav);
&form_header;
&form_footer;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub report_for_todo_list {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my $quotations = OE->transactions_for_todo_list();
my $content;
'edit_url' => $edit_url });
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $content;
}
require "bin/mozilla/common.pl";
+use strict;
+
1;
# end of main
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('config');
- $auth->assert('config');
+ my $form = $main::form;
$form->{title} = "Add";
call_sub("form_$form->{type}_header");
call_sub("form_$form->{type}_footer");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ $main::auth->assert('config');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
# show history button
$form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
call_sub("form_$form->{type}_header");
call_sub("form_$form->{type}_footer");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('config');
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
+ my ($report, $sort, $number);
if ($form->{type} eq 'partsgroup') {
$report = "partsgroup_report";
$sort = 'partsgroup';
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ $main::auth->assert('config');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
if ($form->{type} eq 'partsgroup') {
$form->isblank("partsgroup", $locale->text('Group missing!'));
$form->{addition} = "SAVED";
$form->save_history($form->dbconnect(\%myconfig));
}
- # /saving the history
+ # /saving the history
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ $main::auth->assert('config');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
PE->delete_tuple(\%myconfig, \%$form);
$form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
-sub continue { call_sub($form->{"nextsub"}); }
+sub continue { call_sub($main::form->{"nextsub"}); }
sub partsgroup_report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('config');
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- map { $form->{$_} = $form->unescape($form->{$_}) } (partsgroup);
+ map { $form->{$_} = $form->unescape($form->{$_}) } qw(partsgroup);
PE->partsgroups(\%myconfig, \%$form);
- $callback =
+ my $callback =
"$form->{script}?action=partsgroup_report&type=$form->{type}&status=$form->{status}";
+ my ($option);
if ($form->{status} eq 'all') {
$option = $locale->text('All');
}
$option .= "\n<br>" . $locale->text('Group') . " : $form->{partsgroup}";
}
- @column_index = $form->sort_columns(qw(partsgroup));
-
+ my @column_index = $form->sort_columns(qw(partsgroup));
+ my %column_header;
$column_header{partsgroup} =
qq|<th class=listheading width=90%>| . $locale->text('Group') . qq|</th>|;
# escape callback for href
$callback = $form->escape($callback);
- foreach $ref (@{ $form->{item_list} }) {
+ my ($i, %column_data);
+ foreach my $ref (@{ $form->{item_list} }) {
$i++;
$i %= 2;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_partsgroup_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('config');
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text("$form->{title} Group");
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_partsgroup_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('config');
+ $main::auth->assert('config');
+
+ my $form = $main::form;
+ my $locale = $main::locale;
print qq|
# button for saving history
print qq|
<input type=button onclick=set_history_window(|
- . $form->{id}
+ . $form->{id}
. qq|); name=history id=history value=|
- . $locale->text('history')
+ . $locale->text('history')
. qq|>|;
# /button for saving history
print qq|
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
#################################
# get pricesgroups and build up html-code
#
sub pricegroup_report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('config');
- $auth->assert('config');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- map { $form->{$_} = $form->unescape($form->{$_}) } (pricegroup);
+ map { $form->{$_} = $form->unescape($form->{$_}) } qw(pricegroup);
PE->pricegroups(\%myconfig, \%$form);
- $callback =
+ my $callback =
"$form->{script}?action=pricegroup_report&type=$form->{type}&status=$form->{status}";
+ my $option;
if ($form->{status} eq 'all') {
$option = $locale->text('All');
}
"\n<br>" . $locale->text('Pricegroup') . " : $form->{pricegroup}";
}
- @column_index = $form->sort_columns(qw(pricegroup));
-
+ my @column_index = $form->sort_columns(qw(pricegroup));
+ my %column_header;
$column_header{pricegroup} =
qq|<th class=listheading width=90%>|
. $locale->text('Pricegroup')
# escape callback for href
$callback = $form->escape($callback);
- foreach $ref (@{ $form->{item_list} }) {
+ my ($i, %column_data);
+ foreach my $ref (@{ $form->{item_list} }) {
$i++;
$i %= 2;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
#######################
#build up pricegroup_header
#
sub form_pricegroup_header {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('config');
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
# $locale->text('Add Pricegroup')
# $locale->text('Edit Pricegroup')
</table>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
######################
#build up pricegroup_footer
#
sub form_pricegroup_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('config');
- $auth->assert('config');
+ my $form = $main::form;
+ my $locale = $main::locale;
print qq|
# button for saving history
print qq|
<input type=button onclick=set_history_window(|
- . $form->{id}
+ . $form->{id}
. qq|); name=history id=history value=|
- . $locale->text('history')
+ . $locale->text('history')
. qq|>|;
# /button for saving history
print qq|
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
+use strict;
+
sub add {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('project_edit');
- $auth->assert('project_edit');
+ my $form = $main::form;
+ my $locale = $main::locale;
# construct callback
$form->{callback} = build_std_url('action') unless $form->{callback};
display_project_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub edit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('project_edit');
- $auth->assert('project_edit');
+ my $form = $main::form;
+ my $locale = $main::locale;
# show history button
$form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
display_project_form();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub search {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('project_edit');
+ $main::auth->assert('project_edit');
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{title} = $locale->text('Projects');
$form->header();
print $form->parse_html_template('projects/search');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub project_report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('project_edit');
- $auth->assert('project_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{sort} ||= 'projectnumber';
my $filter = $form->{filter} || { };
my $edit_url = build_std_url('action=edit&type=project');
my $callback = $form->escape($href) . '&sort=' . E($form->{sort});
- foreach $project (@{ $form->{project_list} }) {
+ foreach my $project (@{ $form->{project_list} }) {
$project->{active} = $project->{active} ? $locale->text('Yes') : $locale->text('No');
my $row = { map { $_ => { 'data' => $project->{$_} } } keys %{ $project } };
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_project_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('project_edit');
+ $main::auth->assert('project_edit');
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{project} ||= { };
$form->header();
print $form->parse_html_template('projects/project_form');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('project_edit');
- $auth->assert('project_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->isblank("project.projectnumber", $locale->text('Project Number missing!'));
$form->redirect($locale->text('Project saved!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub save_as_new {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
delete $form->{project}->{id} if ($form->{project});
save();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub delete {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('project_edit');
- $auth->assert('project_edit');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
my $project = $form->{project} || { };
Projects->delete_project('id' => $project->{id});
$form->redirect($locale->text('Project deleted!'));
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub continue {
- call_sub($form->{nextsub});
+ call_sub($main::form->{nextsub});
}
require "bin/mozilla/common.pl";
+use strict;
+
1;
# end of main
sub reconciliation {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('cash');
+ $main::auth->assert('cash');
RC->paymentaccounts(\%myconfig, \%$form);
- $selection = "";
+ my $selection = "";
map { $selection .= "<option>$_->{accno}--$_->{description}\n" }
@{ $form->{PR} };
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->{"jsscript"} = 1;
$form->header;
- $onload = qq|focus()|;
+ my $onload = qq|focus()|;
$onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
print qq|
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
-sub continue { call_sub($form->{"nextsub"}); }
+sub continue { call_sub($main::form->{"nextsub"}); }
sub get_payments {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('cash');
+ $main::auth->assert('cash');
($form->{accno}, $form->{account}) = split /--/, $form->{accno};
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub display_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('cash');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- @column_index = qw(cleared transdate source name credit debit balance);
+ $main::auth->assert('cash');
+ my @column_index = qw(cleared transdate source name credit debit balance);
+ my %column_header;
$column_header{cleared} = "<th> </th>";
$column_header{source} =
"<th class=listheading>" . $locale->text('Source') . "</a></th>";
$column_header{balance} =
"<th class=listheading>" . $locale->text('Balance') . "</a></th>";
+ my $option;
if ($form->{fromdate}) {
$option .= "\n<br>" if ($option);
$option .=
</tr>
|;
- $ml = ($form->{category} eq 'A') ? -1 : 1;
+ my $ml = ($form->{category} eq 'A') ? -1 : 1;
$form->{beginningbalance} *= $ml;
- $clearedbalance = $balance = $form->{beginningbalance};
- $i = 0;
- $id = 0;
+ my $balance = $form->{beginningbalance};
+ my $clearedbalance = $balance;
+ my $i = 0;
+ my $id = 0;
+ my %column_data;
map { $column_data{$_} = "<td> </td>" }
qw(cleared transdate source name debit credit);
$column_data{balance} =
"<td align=right>"
. $form->format_amount(\%myconfig, $balance, 2, 0) . "</td>";
- $j = 0;
+ my $j = 0;
print qq|
<tr class=listrow$j>
|;
</tr>
|;
- foreach $ref (@{ $form->{PR} }) {
+ my $cleared;
+ my $totaldebits;
+ my $totalcredits;
+ my $fx_transaction;
+ my $fx;
+ foreach my $ref (@{ $form->{PR} }) {
$balance += $ref->{amount} * $ml;
$cleared += $ref->{amount} * $ml if $ref->{cleared};
$form->{statementbalance} =
$form->parse_amount(\%myconfig, $form->{statementbalance});
- $difference =
+ my $difference =
$form->format_amount(\%myconfig,
$form->{statementbalance} - $clearedbalance - $cleared,
2, 0);
$clearedbalance = $form->format_amount(\%myconfig, $clearedbalance, 2, 0);
+ my $exchdiff;
if ($fx) {
$fx = $form->format_amount(\%myconfig, $fx, 2, 0);
$exchdiff = qq|
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub update {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('cash');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+
+ $main::auth->assert('cash');
RC->payment_transactions(\%myconfig, \%$form);
- foreach $ref (@{ $form->{PR} }) {
+ my $i;
+ foreach my $ref (@{ $form->{PR} }) {
if (!$ref->{fx_transaction}) {
$i++;
$ref->{cleared} = ($form->{"cleared_$i"}) ? "checked" : "";
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub select_all {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
- $auth->assert('cash');
+ $main::auth->assert('cash');
RC->payment_transactions(\%myconfig, \%$form);
&display_form;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub done {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- $auth->assert('cash');
+ $main::auth->assert('cash');
$form->{callback} = "$form->{script}?action=reconciliation";
RC->reconcile(\%myconfig, \%$form);
$form->redirect;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
use SL::MoreCommon;
use SL::ReportGenerator;
+use strict;
+
sub report_generator_set_default_sort {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my $default_sortorder = shift;
my $default_sortdir = shift;
$form->{sortdir} = $default_sortdir unless (defined $form->{sortdir});
$form->{sortdir} = $form->{sortdir} ? 1 : 0;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub report_generator_export_as_pdf {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
if ($form->{report_generator_pdf_options_set}) {
my $saved_form = save_form();
report_generator_do('HTML');
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
print $form->parse_html_template('report_generator/pdf_export_options', { 'HIDDEN' => \@form_values,
'ALLOW_FONT_SELECTION' => $allow_font_selection, });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub report_generator_export_as_csv {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
if ($form->{report_generator_csv_options_set}) {
report_generator_do('CSV');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return;
}
$form->header();
print $form->parse_html_template('report_generator/csv_export_options', { 'HIDDEN' => \@form_values });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub report_generator_back {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
report_generator_do('HTML');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub report_generator_do {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my $format = shift;
+ my $form = $main::form;
+ my $locale = $main::locale;
+
my $nextsub = $form->{report_generator_nextsub};
if (!$nextsub) {
$form->error($locale->text('report_generator_nextsub is not defined.'));
call_sub($nextsub);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub report_generator_dispatcher {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
my $nextsub = $form->{report_generator_dispatch_to};
if (!$nextsub) {
call_sub($nextsub);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
1;
require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
-1;
-
-# end of main
+# note: this file was particularly hard to strictify.
+# alot of the vars are passed carelessly between invocations
+# should there be any missing vars, declare them globally
+use strict;
# this is for our long dates
# $locale->text('January')
'balance_sheet' => 'report',
};
+# subs use these pretty freely, so declare them here
+our (%column_data, @column_index);
+our ($subtotalnetamount, $subtotaltax, $subtotal);
+
sub check_rp_access {
+ my $form = $main::form;
+
my $right = $rp_access_map->{$form->{report}};
$right ||= 'DOES_NOT_EXIST';
- $auth->assert($right);
+ $main::auth->assert($right);
}
sub report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
check_rp_access();
- %title = ('balance_sheet' => 'Balance Sheet',
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ my %title = (
+ 'balance_sheet' => 'Balance Sheet',
'income_statement' => 'Income Statement',
'trial_balance' => 'Trial Balance',
'ar_aging' => 'AR Aging',
'receipts' => 'Receipts',
'payments' => 'Payments',
'projects' => 'Project Transactions',
- 'bwa' => 'Betriebswirtschaftliche Auswertung',);
+ 'bwa' => 'Betriebswirtschaftliche Auswertung',
+ );
$form->{title} = $locale->text($title{ $form->{report} });
- $accrual = ($eur) ? "" : "checked";
- $cash = ($eur) ? "checked" : "";
+ my $accrual = ($main::eur) ? "" : "checked";
+ my $cash = ($main::eur) ? "checked" : "";
- $year = (localtime)[5] + 1900;
+ my $year = (localtime)[5] + 1900;
# get departments
$form->all_departments(\%myconfig);
map { $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}\n" } @{ $form->{all_departments} };
}
- $department = qq|
+ my $department = qq|
<tr>
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
<td colspan=3><select name=department>$form->{selectdepartment}</select></td>
}
my $projectnumber =
- NTI($cgi->popup_menu('-name' => "project_id",
- '-values' => \@project_values,
- '-labels' => \%project_labels));
+ NTI($main::cgi->popup_menu('-name' => "project_id",
+ '-values' => \@project_values,
+ '-labels' => \%project_labels));
# use JavaScript Calendar or not
$form->{jsscript} = 1;
- $jsscript = "";
+ my $jsscript = "";
+ my ( $name_1, $id_1, $value_1, $trigger_1, $name_2, $id_2, $value_2, $trigger_2, );
if ($form->{report} eq "balance_sheet") {
$name_1 = "asofdate";
$id_1 = "asofdate";
$trigger_2 = "trigger2";
}
+ my ($button1, $button1_2, $button2, $button2_2);
+ my $checked;
+
# with JavaScript Calendar
if ($form->{jsscript}) {
if ($name_1 eq "") {
}
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->header;
- $onload = qq|focus()|;
+ my $onload = qq|focus()|;
$onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
$onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
print qq|
|;
$checked = "checked";
- foreach $ref (@{ $form->{taxaccounts} }) {
+ foreach my $ref (@{ $form->{taxaccounts} }) {
print
qq|<input name=accno class=radio type=radio value=$ref->{accno} $checked> $ref->{description}
}
+ my ($label, $nextsub, $vc);
if (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) {
if ($form->{report} eq 'ar_aging') {
$label = $locale->text('Customer');
# above action can be removed if there is more than one input field
+ my ($selection, $paymentaccounts);
if ($form->{report} =~ /(receipts|payments)$/) {
$form->{db} = ($form->{report} =~ /payments$/) ? "ap" : "ar";
RP->paymentaccounts(\%myconfig, \%$form);
$selection = "<option>\n";
- foreach $ref (@{ $form->{PR} }) {
+ foreach my $ref (@{ $form->{PR} }) {
$paymentaccounts .= "$ref->{accno} ";
$selection .= "<option>$ref->{accno}--$ref->{description}\n";
}
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
-sub continue { call_sub($form->{"nextsub"}); }
+sub continue { call_sub($main::form->{"nextsub"}); }
sub get_project {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('report');
+ $main::auth->assert('report');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
my $nextsub = shift;
$form->{project_id} = $form->{project_id_1};
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_income_statement {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('report');
- $auth->assert('report');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{padding} = " ";
$form->{bold} = "<b>";
$form->{fromdate} = "1.2.$form->{year}";
#this works from 1901 to 2099, 1900 and 2100 fail.
- $leap = ($form->{year} % 4 == 0) ? "29" : "28";
+ my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
$form->{todate} = "$leap.2.$form->{year}";
last SWITCH;
};
$form->{todate} = $form->current_date(\%myconfig);
}
- $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
- $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
+ my $longtodate = $locale->date(\%myconfig, $form->{todate}, 1);
+ my $shorttodate = $locale->date(\%myconfig, $form->{todate}, 0);
- $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
- $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
+ my $longfromdate = $locale->date(\%myconfig, $form->{fromdate}, 1);
+ my $shortfromdate = $locale->date(\%myconfig, $form->{fromdate}, 0);
$form->{this_period} = "$shortfromdate\n$shorttodate";
$form->{period} =
}
if ($form->{comparefromdate} || $form->{comparetodate}) {
- $longcomparefromdate =
- $locale->date(\%myconfig, $form->{comparefromdate}, 1);
- $shortcomparefromdate =
- $locale->date(\%myconfig, $form->{comparefromdate}, 0);
+ my $longcomparefromdate = $locale->date(\%myconfig, $form->{comparefromdate}, 1);
+ my $shortcomparefromdate = $locale->date(\%myconfig, $form->{comparefromdate}, 0);
- $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
- $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
+ my $longcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 1);
+ my $shortcomparetodate = $locale->date(\%myconfig, $form->{comparetodate}, 0);
$form->{last_period} = "$shortcomparefromdate\n$shortcomparetodate";
$form->{period} .=
}
# setup variables for the form
- @a = qw(company address businessnumber);
+ my @a = qw(company address businessnumber);
map { $form->{$_} = $myconfig{$_} } @a;
$form->{templates} = $myconfig{templates};
$form->parse_template;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_balance_sheet {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('report');
+ $main::auth->assert('report');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{decimalplaces} = $form->{decimalplaces} * 1 || 2;
$form->{padding} = " ";
($form->{department}) = split /--/, $form->{department};
# define Current Earnings account
- $padding = ($form->{l_heading}) ? $form->{padding} : "";
+ my $padding = ($form->{l_heading}) ? $form->{padding} : "";
push(@{ $form->{equity_account} }, $padding . $locale->text('Current Earnings'));
$form->{this_period} = $locale->date(\%myconfig, $form->{asofdate}, 0);
print $form->parse_html_template('rp/balance_sheet', $data);
# $form->parse_template();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_projects {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('report');
- $auth->assert('report');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- &get_project(generate_projects);
+ &get_project("generate_projects");
$form->{projectnumber} = $form->{projectnumber_1};
$form->{nextsub} = "generate_projects";
list_accounts('generate_projects');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# Antonio Gallardo
# added headers and subtotals
#
sub generate_trial_balance {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('report');
+ $main::auth->assert('report');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
if ($form->{reporttype} eq "custom") {
$form->{fromdate} = "1.2.$form->{year}";
#this works from 1901 to 2099, 1900 and 2100 fail.
- $leap = ($form->{year} % 4 == 0) ? "29" : "28";
+ my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
$form->{todate} = "$leap.2.$form->{year}";
last SWITCH;
};
RP->trial_balance(\%myconfig, \%$form, 'beginning_balances' => 1);
- $form->{rowcount} = scalar @{ $form->{TB} };
+ $form->{rowcount} = scalar @{ $form->{TB} || [] };
$form->{title} = sprintf($locale->text('Trial balance between %s and %s'), $form->{fromdate}, $form->{todate});
my @columns = (
$form->{callback} = $href .= "&sort=$form->{sort}";
# escape callback for href
- $callback = $form->escape($href);
+ my $callback = $form->escape($href);
my @subtotal_columns = qw(soll_eb haben_eb soll haben soll_kumuliert haben_kumuliert soll_saldo haben_saldo);
my $edit_url = build_std_url('action=edit', 'type', 'vc');
- foreach $accno (@{ $form->{TB} }) {
+ my $idx;
+ foreach my $accno (@{ $form->{TB} }) {
$accno->{soll} = $accno->{debit};
$accno->{haben} = $accno->{credit};
};
}
-
- $row->{$ordnumber}->{link} = $edit_url . "&id=" . E($oe->{id}) . "&callback=${callback}";
$row->{accno}->{link} = build_std_url('script=ca.pl', 'action=list_transactions', 'accno=' . E($accno->{accno}), 'description=' . E($accno->{description}), 'fromdate=' . E($form->{fromdate}), 'todate=' . E($form->{todate}), 'method=' . E($form->{method}));
my $row_set = [ $row ];
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_subtotal_row {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($totals, $columns, $column_alignment, $subtotal_columns, $class) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } };
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } @{ $subtotal_columns };
map { $totals->{$_} = 0 } @{ $subtotal_columns };
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $row;
}
sub create_list_accounts_subtotal_row {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($subtotals, $columns, $fields, $class) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => 'right' } } @{ $columns } };
map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $subtotals->{$_}, 2) } @{ $fields };
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $row;
}
sub list_accounts {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($action) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
my @options;
if ($form->{department}) {
my ($department) = split /--/, $form->{department};
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_ar_aging {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
# split customer
($form->{customer}) = split(/--/, $form->{customer});
RP->aging(\%myconfig, \%$form);
aging();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_ap_aging {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
# split vendor
($form->{vendor}) = split(/--/, $form->{vendor});
RP->aging(\%myconfig, \%$form);
aging();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub create_aging_subtotal_row {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($subtotals, $columns, $periods, $class) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => 'right' } } @{ $columns } };
foreach (@{ $periods }) {
$subtotals->{$_} = 0;
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $row;
}
sub aging {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+ my $cgi = $main::cgi;
my $report = SL::ReportGenerator->new(\%myconfig, $form);
push @options, $locale->text('for Period') . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1);
}
- my $attachment_basename = $form->{ct} eq 'customer' ? $locale->text('ar_aging_list') : $locale->text('ap_aging_list');
+ $attachment_basename = $form->{ct} eq 'customer' ? $locale->text('ar_aging_list') : $locale->text('ap_aging_list');
$report->set_options('top_info_text' => join("\n", @options),
'output_format' => 'HTML',
my %subtotals = map { $_ => 0 } @periods;
my %totals = map { $_ => 0 } @periods;
- foreach $ref (@{ $form->{AG} }) {
+ foreach my $ref (@{ $form->{AG} }) {
if ($row_idx && ($previous_ctid != $ref->{ctid})) {
$report->add_data(create_aging_subtotal_row(\%subtotals, \@columns, \@periods, 'listsubtotal'));
}
$report->add_data(create_aging_subtotal_row(\%totals, \@columns, \@periods, 'listtotal'));
if ($form->{arap} eq 'ar') {
- $raw_top_info_text = $form->parse_html_template('rp/aging_ar_top');
- $raw_bottom_info_text = $form->parse_html_template('rp/aging_ar_bottom', { 'row_idx' => $row_idx,
+ my $raw_top_info_text = $form->parse_html_template('rp/aging_ar_top');
+ my $raw_bottom_info_text = $form->parse_html_template('rp/aging_ar_bottom', { 'row_idx' => $row_idx,
'PRINT_OPTIONS' => print_options(inline => 1), });
$report->set_options('raw_top_info_text' => $raw_top_info_text,
'raw_bottom_info_text' => $raw_bottom_info_text);
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub select_all {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
RP->aging(\%myconfig, \%$form);
&aging;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub e_mail {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
# get name and email addresses
- for $i (1 .. $form->{rowcount}) {
+ my $selected = 0;
+ for my $i (1 .. $form->{rowcount}) {
if ($form->{"statement_$i"}) {
$form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
RP->get_customer(\%myconfig, \%$form);
$form->error($locale->text('Nothing selected!')) unless $selected;
+ my $bcc = '';
if ($myconfig{role} eq 'admin') {
$bcc = qq|
<th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
|;
}
- $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
+ my $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
$form->{media} = "email";
qw(action email cc bcc subject message type sendmode format header);
# save all other variables
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
$form->{$key} =~ s/\"/"/g;
print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub send_email {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{subject} = $locale->text('Statement') . qq| - $form->{todate}|
unless $form->{subject};
$form->redirect($locale->text('Statement sent to') . " $form->{$form->{ct}}");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
if ($form->{media} eq 'printer') {
$form->error($locale->text('Select postscript or PDF!'))
if ($form->{format} !~ /(postscript|pdf)/);
}
- for $i (1 .. $form->{rowcount}) {
+ my $selected = 0;
+ for my $i (1 .. $form->{rowcount}) {
if ($form->{"statement_$i"}) {
$form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
$selected = 1;
$form->redirect($locale->text('Statements sent to printer!'))
if ($form->{media} eq 'printer');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print_form {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('general_ledger');
+ $main::auth->assert('general_ledger');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{statementdate} = $locale->date(\%myconfig, $form->{todate}, 1);
# Save $form->{email} because it will be overwritten.
$form->{EMAIL_RECIPIENT} = $form->{email};
- $i = 0;
+ my $i = 0;
+ my $ctid;
while (@{ $form->{AG} }) {
- $ref = shift @{ $form->{AG} };
+ my $ref = shift @{ $form->{AG} };
if ($ctid != $ref->{ctid}) {
if ($form->{"statement_$i"}) {
- @a =
- (name, street, zipcode, city, country, contact, email,
+ my @a =
+ ("name", "street", "zipcode", "city", "country", "contact", "email",
"$form->{ct}phone", "$form->{ct}fax");
map { $form->{$_} = $ref->{$_} } @a;
map { $form->{$_} = () } qw(invnumber invdate duedate);
$form->{total} = 0;
- foreach $item (qw(c0 c30 c60 c90)) {
+ foreach my $item (qw(c0 c30 c60 c90)) {
$form->{$item} = ();
$form->{"${item}total"} = 0;
}
map {
$form->{"${_}total"} =
$form->format_amount(\%myconfig, $form->{"${_}total"}, 2)
- } (c0, c30, c60, c90, "");
+ } ('c0', 'c30', 'c60', 'c90', "");
$form->{attachment_filename} = $locale->quote_special_chars('filenames', $locale->text("Statement") . "_$form->{todate}.$attachment_suffix");
$form->{attachment_filename} =~ s/\s+/_/g;
- $form->parse_template(\%myconfig, $userspath);
+ $form->parse_template(\%myconfig, $main::userspath);
}
}
$form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub statement_details {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('general_ledger');
- $auth->assert('general_ledger');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
my ($ref) = @_;
push @{ $form->{invdate} }, $ref->{transdate};
push @{ $form->{duedate} }, $ref->{duedate};
- foreach $item (qw(c0 c30 c60 c90)) {
+ foreach my $item (qw(c0 c30 c60 c90)) {
if ($ref->{exchangerate} * 1) {
$ref->{$item} =
$form->round_amount($ref->{$item} / $ref->{exchangerate}, 2);
$form->format_amount(\%myconfig, $ref->{$item}, 2);
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_tax_report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('report');
+ $main::auth->assert('report');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
RP->tax_report(\%myconfig, \%$form);
- $descvar = "$form->{accno}_description";
- $description = $form->escape($form->{$descvar});
- $ratevar = "$form->{accno}_rate";
+ my $descvar = "$form->{accno}_description";
+ my $description = $form->escape($form->{$descvar});
+ my $ratevar = "$form->{accno}_rate";
+ our $taxrate; # most likely error
- $department = $form->escape($form->{department});
+ my $department = $form->escape($form->{department});
# construct href
- $href =
+ my $href =
"$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
# construct callback
$description = $form->escape($form->{$descvar}, 1);
$department = $form->escape($form->{department}, 1);
- $callback =
+ my $callback =
"$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
- $title = $form->escape($form->{title});
+ my $title = $form->escape($form->{title});
$href .= "&title=$title";
$title = $form->escape($form->{title}, 1);
$callback .= "&title=$title";
$form->{title} = qq|$form->{title} $form->{"$form->{accno}_description"} |;
- @columns =
+ my @columns =
$form->sort_columns(qw(id transdate invnumber name netamount tax amount));
- foreach $item (@columns) {
+ foreach my $item (@columns) {
if ($form->{"l_$item"} eq "Y") {
push @column_index, $item;
$href .= "&l_subtotal=Y";
}
+ my $option;
if ($form->{department}) {
($department) = split /--/, $form->{department};
$option = $locale->text('Department') . " : $department";
}
+ my ($fromdate, $todate);
# if there are any dates
if ($form->{fromdate} || $form->{todate}) {
if ($form->{fromdate}) {
$locale->date(\%myconfig, $form->current_date(\%myconfig), 1);
}
+ my ($name, $invoice, $arap);
if ($form->{db} eq 'ar') {
$name = $locale->text('Customer');
$invoice = 'is.pl';
$option .= "<br>" if $option;
$option .= "$form->{period}";
+ my %column_header;
$column_header{id} = qq|<th><a class=listheading href=$href&sort=id>| . $locale->text('ID') . qq|</th>|;
$column_header{invnumber} = qq|<th><a class=listheading href=$href&sort=invnumber>| . $locale->text('Invoice') . qq|</th>|;
$column_header{transdate} = qq|<th><a class=listheading href=$href&sort=transdate>| . $locale->text('Date') . qq|</th>|;
<table width=100%>
<tr>
- <th class=listtop colspan=$colspan>$form->{title}</th>
+ <th class=listtop>$form->{title}</th>
</tr>
<tr height="5"></tr>
<tr>
# add sort and escape callback
$callback = $form->escape($callback . "&sort=$form->{sort}");
+ my $sameitem;
if (@{ $form->{TR} }) {
$sameitem = $form->{TR}->[0]->{ $form->{sort} };
}
- foreach $ref (@{ $form->{TR} }) {
+ my ($totalnetamount, $totaltax);
+ my ($i);
+ foreach my $ref (@{ $form->{TR} }) {
- $module = ($ref->{invoice}) ? $invoice : $arap;
+ my $module = ($ref->{invoice}) ? $invoice : $arap;
if ($form->{l_subtotal} eq 'Y') {
if ($sameitem ne $ref->{ $form->{sort} }) {
<tr class=listtotal>
|;
- $total =
- $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " ");
- $totalnetamount =
- $form->format_amount(\%myconfig, $totalnetamount, 2, " ");
- $totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " ");
+ my $total = $form->format_amount(\%myconfig, $totalnetamount + $totaltax, 2, " ");
+ $totalnetamount = $form->format_amount(\%myconfig, $totalnetamount, 2, " ");
+ $totaltax = $form->format_amount(\%myconfig, $totaltax, 2, " ");
- $column_data{netamount} =
- qq|<th class=listtotal align=right>$totalnetamount</th>|;
+ $column_data{netamount} = qq|<th class=listtotal align=right>$totalnetamount</th>|;
$column_data{tax} = qq|<th class=listtotal align=right>$totaltax</th>|;
$column_data{amount} = qq|<th class=listtotal align=right>$total</th>|;
</html>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub tax_subtotal {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
map { $column_data{$_} = "<td> </td>" } @column_index;
- $subtotalnetamount =
- $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ");
- $subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " ");
- $subtotal =
- $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax,
- 2, " ");
+ $subtotalnetamount = $form->format_amount(\%myconfig, $subtotalnetamount, 2, " ");
+ $subtotaltax = $form->format_amount(\%myconfig, $subtotaltax, 2, " ");
+ $subtotal = $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax, 2, " ");
- $column_data{netamount} =
- "<th class=listsubtotal align=right>$subtotalnetamount</th>";
- $column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
- $column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>";
+ $column_data{netamount} = "<th class=listsubtotal align=right>$subtotalnetamount</th>";
+ $column_data{tax} = "<th class=listsubtotal align=right>$subtotaltax</th>";
+ $column_data{amount} = "<th class=listsubtotal align=right>$subtotal</th>";
$subtotalnetamount = 0;
$subtotaltax = 0;
</tr>
|;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub list_payments {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('cash');
- $auth->assert('cash');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
if ($form->{account}) {
($form->{paymentaccounts}) = split /--/, $form->{account};
}
+
+ my $option;
if ($form->{department}) {
- ($department, $form->{department_id}) = split /--/, $form->{department};
+ (my $department, $form->{department_id}) = split /--/, $form->{department};
$option = $locale->text('Department') . " : $department";
}
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub print_options {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my ($dont_print) = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
$form->{sendmode} = "attachment";
$form->{"format"} =
$form->{OP}{ $form->{media} } = "selected";
$form->{SM}{ $form->{sendmode} } = "selected";
- $type = qq|
+ my ($media);
+ my $type = qq|
<option value=statement $form->{PD}{statement}>|
. $locale->text('Statement');
} else {
$media = qq|
<option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
- if ($myconfig{printer} && $latex_templates) {
+ if ($myconfig{printer} && $main::latex_templates) {
$media .= qq|
<option value=printer $form->{OP}{printer}>|
. $locale->text('Printer');
}
}
- if ($latex_templates) {
+ my $format;
+ if ($main::latex_templates) {
$format .= qq|
<option value=html $form->{DF}{html}>| . $locale->text('HTML')
. qq| <option value=pdf $form->{DF}{pdf}>| . $locale->text('PDF')
<td><select name=media>$media</select></td>
|;
- if ($myconfig{printer} && $latex_templates && $form->{media} ne 'email') {
+ if ($myconfig{printer} && $main::latex_templates && $form->{media} ne 'email') {
$output .= qq|
<td>| . $locale->text('Copies') . qq|
<input name=copies size=2 value=$form->{copies}></td>
print $output unless $dont_print;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $output;
}
sub generate_bwa {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('report');
+ $main::auth->assert('report');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{padding} = " ";
$form->{bold} = "<b>";
$form->{fromdate} = "1.2.$form->{year}";
#this works from 1901 to 2099, 1900 and 2100 fail.
- $leap = ($form->{year} % 4 == 0) ? "29" : "28";
+ my $leap = ($form->{year} % 4 == 0) ? "29" : "28";
$form->{todate} = "$leap.2.$form->{year}";
$form->{comparefromdate} = "1.01.$form->{year}";
$form->{comparetodate} = "$leap.02.$form->{year}";
};
}
} else {
- ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
+ my ($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{fromdate});
$form->{fromdate} = "${dd}.${mm}.${yy}";
($yy, $mm, $dd) = $locale->parse_date(\%myconfig, $form->{todate});
$form->{todate} = "${dd}.${mm}.${yy}";
my %germandate = ("dateformat" => "dd.mm.yyyy");
- $longtodate = $locale->date(\%germandate, $form->{todate}, 1);
- $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
+ my $longtodate = $locale->date(\%germandate, $form->{todate}, 1);
+ my $shorttodate = $locale->date(\%germandate, $form->{todate}, 0);
- $longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1);
- $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
+ my $longfromdate = $locale->date(\%germandate, $form->{fromdate}, 1);
+ my $shortfromdate = $locale->date(\%germandate, $form->{fromdate}, 0);
$form->{this_period} = "$shortfromdate\n$shorttodate";
$form->{period} =
}
# setup variables for the form
- @a = qw(company address businessnumber);
+ my @a = qw(company address businessnumber);
map { $form->{$_} = $myconfig{$_} } @a;
$form->{templates} = $myconfig{templates};
$form->parse_template;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
+1;
use SL::TODO;
+use strict;
+
sub create_todo_list {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
my %params = @_;
my $postfix = '_login' if ($params{login_screen});
my %todo_cfg = TODO->get_user_config('login' => $form->{login});
if ($params{login_screen} && !$todo_cfg{show_after_login}) {
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return '';
}
@todo_items = grep { $_ } @todo_items;
$todo_list = join("", @todo_items);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $todo_list;
}
sub show_todo_list {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
$form->{todo_list} = create_todo_list();
$form->{title} = $locale->text('TODO list');
$form->header();
print $form->parse_html_template('todo/show_todo_list');
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub todo_list_follow_ups {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
require "bin/mozilla/fu.pl";
my $content = report_for_todo_list();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $content;
}
sub todo_list_overdue_sales_quotations {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
require "bin/mozilla/oe.pl";
my $content = report_for_todo_list();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $content;
}
require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
+use strict;
+
# parserhappy(R):
# contents of the "transfer_type" table:
# --------------------------------------------------------------------
sub transfer_warehouse_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('warehouse_management');
+ $main::auth->assert('warehouse_management');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
$form->header();
print $content;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_parts_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_management');
- $auth->assert('warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
transfer_or_removal_prepare_contents('direction' => 'transfer');
$form->header();
print $form->parse_html_template("wh/transfer_parts_selection");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_or_removal_prepare_contents {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('warehouse_management');
+ $main::auth->assert('warehouse_management');
my %args = @_;
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
$form->{CONTENTS} = \@contents;
$form->{TRANSFER_TYPES} = $transfer_types;
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_parts {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('warehouse_management');
+ $main::auth->assert('warehouse_management');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES', 'bins' => 'BINS' });
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub transfer_stock_update_part {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{trans_type} = 'stock';
$form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
transfer_warehouse_selection();
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub transfer_assembly_update_part {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{trans_type} = 'assembly';
$form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
# hier die oben benannte idee
# my $maxcreate = Common->check_assembly_max_create(assembly_id => $form->{parts_id}, dbh => $my_dbh);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
+
sub transfer_stock_part_selected {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
my $part = shift;
+ my $form = $main::form;
+
@{$form}{qw(parts_id partnumber description ean)} = @{$part}{qw(id partnumber description ean)};
transfer_stock_get_partunit();
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_stock_get_partunit {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
if ($form->{parts_id}) {
my $part_info = IC->get_basic_part_info('id' => $form->{parts_id});
$form->{partunit} = $part_info->{unit};
}
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# vorüberlegung jb 22.2.2009
# Laut Absprache in KW11 09 übernimmt mb hier den rest im April ... jb 18.3.09
sub create_assembly {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
if ($form->{qty} <= 0) {
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub transfer_stock {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{qty} = $form->parse_amount(\%myconfig, $form->{qty});
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub removal_parts_selection {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_management');
- $auth->assert('warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
transfer_or_removal_prepare_contents('direction' => 'out');
$form->header();
print $form->parse_html_template("wh/removal_parts_selection");
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub remove_parts {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_management');
- $auth->assert('warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
transfer_warehouse_selection();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub journal {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('warehouse_management');
+ $main::auth->assert('warehouse_management');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
$form->header();
print $form->parse_html_template("wh/journal_filter", { "UNITS" => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)) });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_journal {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $auth->assert('warehouse_management');
+ $main::auth->assert('warehouse_management');
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{title} = $locale->text("WHJournal");
$form->{sort} ||= 'date';
$filter{qty_op} = WH->convert_qty_op($form->{qty_op});
if ($filter{qty_op}) {
- $form->isblank(qty, $locale->text('Quantity missing.'));
- $form->isblank(qty_unit, $locale->text('Unit missing.'));
+ $form->isblank("qty", $locale->text('Quantity missing.'));
+ $form->isblank("qty_unit", $locale->text('Unit missing.'));
$filter{qty} = $form->{qty};
$filter{qty_unit} = $form->{qty_unit};
'purchase_invoice' => { script => 'ir', title => $locale->text('Purchase Invoice') },
);
- foreach $entry (@contents) {
+ foreach my $entry (@contents) {
$entry->{qty} = $form->format_amount_units('amount' => $entry->{qty},
'part_unit' => $entry->{partunit},
'conv_units' => 'convertible');
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_contents | warehouse_management');
- $auth->assert('warehouse_contents | warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->get_lists('warehouses' => { 'key' => 'WAREHOUSES',
'bins' => 'BINS', });
"WAREHOUSES" => $form->{WAREHOUSES},
"UNITS" => AM->unit_select_data(AM->retrieve_units(\%myconfig, $form)) });
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub generate_report {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ $main::auth->assert('warehouse_contents | warehouse_management');
- $auth->assert('warehouse_contents | warehouse_management');
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
$form->{title} = $locale->text("Report about wareouse contents");
$form->{sort} ||= 'partnumber';
$filter{qty_op} = WH->convert_qty_op($form->{qty_op});
if ($filter{qty_op}) {
- $form->isblank(qty, $locale->text('Quantity missing.'));
- $form->isblank(qty_unit, $locale->text('Unit missing.'));
+ $form->isblank("qty", $locale->text('Quantity missing.'));
+ $form->isblank("qty_unit", $locale->text('Unit missing.'));
$filter{qty} = $form->{qty};
$filter{qty_unit} = $form->{qty_unit};
my $total_stock_value = 0;
- foreach $entry (@contents) {
+ foreach my $entry (@contents) {
map { $subtotals{$_} += $entry->{$_} } @subtotals_columns;
$total_stock_value += $entry->{stock_value} * 1;
'conv_units' => 'convertible');
$entry->{stock_value} = $form->format_amount(\%myconfig, $entry->{stock_value} * 1, 2);
- $row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ];
+ my $row_set = [ { map { $_ => { 'data' => $entry->{$_}, 'align' => $column_alignment{$_} } } @columns } ];
if (($form->{subtotal} eq 'Y')
&& (($idx == (scalar @contents - 1))
$report->generate_with_headers();
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
# --------------------------------------------------------------------
# --------------------------------------------------------------------
sub show_no_warehouses_error {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
my $msg = $locale->text('No warehouse has been created yet or the quantity of the bins is not configured yet.') . ' ';
- if ($auth->check_right($form->{login}, 'config')) {
+ if ($main::auth->check_right($form->{login}, 'config')) {
$msg .= $locale->text('You can create warehouses and bins via the menu "System -> Warehouses".');
} else {
$msg .= $locale->text('Please ask your administrator to create warehouses and bins.');
$form->show_generic_error($msg);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub get_warehouse_idx {
my ($warehouse_id) = @_;
+ my $form = $main::form;
+
for (my $i = 0; $i < scalar @{$form->{WAREHOUSES}}; $i++) {
return $i if ($form->{WAREHOUSES}->[$i]->{id} == $warehouse_id);
}
sub get_bin_idx {
my ($warehouse_index, $bin_id) = @_;
+ my $form = $main::form;
+
my $warehouse = $form->{WAREHOUSES}->[$warehouse_index];
return -1 if (!$warehouse);
$main::lxdebug->enter_sub();
my %params = @_;
+ my $form = $main::form;
+
# change callback
$form->{old_callback} = $form->escape($form->{callback}, 1);
$form->{callback} = $form->escape("$form->{script}?action=$params{action}", 1);
# save all form variables except action in a previousform variable
my $previousform = join '&', map { my $value = $form->{$_}; $value =~ s/&/%26/; "$_=$value" } grep { !/action/ } keys %$form;
+ my @HIDDENS = ();
# push @HIDDENS, { 'name' => 'previousform', 'value' => $form->escape($previousform, 1) };
push @HIDDENS, map +{ 'name' => $_, 'value' => $form->{$_} }, qw(partnumber description unit vc sellprice ean);
}
sub update {
+ my $form = $main::form;
call_sub($form->{update_nextsub} || $form->{nextsub});
}
sub continue {
+ my $form = $main::form;
call_sub($form->{continue_nextsub} || $form->{nextsub});
}
sub stock {
+ my $form = $main::form;
call_sub($form->{stock_nextsub} || $form->{nextsub});
}
--------------------------------------------------------------------------
-1. Es werden keine "echten" TAB-Zeichen sondern Leerzeichen verwendet.
+1. Es werden keine echten iTabs sondern Leerzeichen verwendet.
2. Die Einrückung beträgt zwei Leerzeichen.
Beispiel:
- sub debug {
- print(STDERR "Debugging.\n");
+ foreach my $row (@data) {
+ if ($flag) {
+ # do something with $row
+ }
+
+ if ($use_modules) {
+ $row->{modules} = MODULE->retrieve(
+ id => $row->{id},
+ date => $use_now ? localtime() : $row->{time},
+ );
+ }
+
+ $report->add($row);
}
+
3. Öffnende geschweifte Klammern befinden sich auf der gleichen Zeile wie
der letzte Befehl.
Beispiele:
do {
...
- } while ($a > 0);
+ } until ($a > 0);
6. Parameter von Funktionsaufrufen müssen mit runden Klammern versehen
- werden. Davon nicht betroffen sind interne perl Funktionen.
+ werden. Davon nicht betroffen sind interne perl Funktionen,
+ und grep ähnliche Operatoren.
Beispiel:
Flagmaske, für die die Meldung angezeigt wird, wobei "0" immer angezeigt
wird. Sollte Meldungen sollten nicht eingecheckt werden, und werden in den
meisten Fällen auch vom Repository zurückgewiesen.
+
+14. Alle neuen Module müssen use strict verwenden.
+
+ $form, $auth, $locale, $lxdebug, %myconfig sowie der Inhalt der lx-erp.conf
+ werden derzeit aus dem main package importiert. Alle anderen Konstrukte
+ sollten lexikalisch lokal gehalten werden.
#!/usr/bin/perl
#
+use strict;
+
BEGIN {
unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML).
push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version.
}
use SL::LXDebug;
-$lxdebug = LXDebug->new();
+our $lxdebug = LXDebug->new();
use SL::Auth;
use SL::Form;
eval { require "config/lx-erp.conf"; };
eval { require "config/lx-erp-local.conf"; } if (-f "config/lx-erp-local.conf");
-$form = new Form;
+our $form = new Form;
our $auth = SL::Auth->new();
if (!$auth->session_tables_present()) {
our %myconfig = $auth->read_user($form->{login});
-$locale = new Locale "$myconfig{countrycode}", "kopf";
+our $locale = new Locale "$myconfig{countrycode}", "kopf";
delete $form->{password};
#
#######################################################################
+use strict;
+
BEGIN {
unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML).
push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version.
}
# setup defaults, DO NOT CHANGE
-$userspath = "users";
-$templates = "templates";
-$memberfile = "users/members";
-$sendmail = "| /usr/sbin/sendmail -t";
+$main::userspath = "users";
+$main::templates = "templates";
+$main::memberfile = "users/members";
+$main::sendmail = "| /usr/sbin/sendmail -t";
########## end ###########################################
$| = 1;
use SL::LXDebug;
-$lxdebug = LXDebug->new();
+$main::lxdebug = LXDebug->new();
eval { require "config/lx-erp.conf"; };
eval { require "config/lx-erp-local.conf"; } if -f "config/lx-erp-local.conf";
$_ = $ARGV[0];
}
-%form = split /[&=]/;
+my %form = split /[&=]/;
# fix for apache 2.0 bug
map { $form{$_} =~ s/\\$// } keys %form;
# name of this script
$0 =~ tr/\\/\//;
-$pos = rindex $0, '/';
-$script = substr($0, $pos + 1);
+my $pos = rindex $0, '/';
+my $script = substr($0, $pos + 1);
-$form->{login} =~ s|.*/||;
+$form{login} =~ s|.*/||;
-if (-e "$userspath/nologin" && $script ne 'admin.pl') {
+if (-e "$main::userspath/nologin" && $script ne 'admin.pl') {
print "content-type: text/plain
Login disabled!\n";
if ($file_line1 =~ m#\s-$flags#) {
ok(1,"$file uses standard perl location and -$flags");
} else {
+ TODO: {
+ local $TODO = q(warning isn't supported globally);
ok(0,"$file is MISSING -$flags --WARNING");
+ }
}
} else {
ok(0,"$file uses non-standard perl location");
}
}
-TODO: {
-local $TODO = 'strict is not implemented thoroughly yet';
foreach my $file (@testitems) {
my $found_use_strict = 0;
$file =~ s/\s.*$//; # nuke everything after the first space (#comment)
ok(0,"$file DOES NOT use strict --WARNING");
}
}
-}
exit 0;