my ($self, $form) = @_;
- my $employee = SL::DB::Manager::Employee->find_by(login => $form->{login});
+ my $employee = SL::DB::Manager::Employee->find_by(login => $::myconfig{login});
$employee->update_attributes(name => $form->{name});
- my $user = SL::DB::Manager::AuthUser->find_by(login => $form->{login});
+ my $user = SL::DB::Manager::AuthUser->find_by(login => $::myconfig{login});
$user->update_attributes(
config_values => {
%{ $user->config_values },
qq|INSERT INTO ap (id, invnumber, employee_id,currency_id, taxzone_id) | .
qq|VALUES (?, ?, (SELECT e.id FROM employee e WHERE e.login = ?),
(SELECT id FROM currencies WHERE name = ?), (SELECT taxzone_id FROM vendor WHERE id = ?) )|;
- do_query($form, $dbh, $query, $form->{id}, $form->{invnumber}, $form->{login}, $form->{currency}, $form->{vendor_id});
+ do_query($form, $dbh, $query, $form->{id}, $form->{invnumber}, $::myconfig{login}, $form->{currency}, $form->{vendor_id});
}
if (!$main::auth->assert('sales_all_edit', 1)) {
# only show own invoices
$where .= " AND a.employee_id = (select id from employee where login= ?)";
- push (@values, $form->{login});
+ push (@values, $::myconfig{login});
} else {
if ($form->{employee_id}) {
$where .= " AND a.employee_id = ?";
# Gilt nicht für Lieferanten
if ($cv eq 'customer' && !$main::auth->assert('customer_vendor_all_edit', 1)) {
$where .= qq| AND ct.salesman_id = (select em.id from employee em where em.login = ?)|;
- push(@values, $form->{login});
+ push(@values, $::myconfig{login});
}
my ($cvar_where, @cvar_values) = CVar->build_filter_query('module' => 'CT',
my $msg = t8('No warehouse has been created yet or the quantity of the bins is not configured yet.') . ' ';
- if ($::auth->check_right($::form->{login}, 'config')) { # TODO wut?
+ if ($::auth->check_right($::myconfig{login}, 'config')) { # TODO wut?
$msg .= t8('You can create warehouses and bins via the menu "System -> Warehouses".');
} else {
$msg .= t8('Please ask your administrator to create warehouses and bins.');
}
sub current {
- return undef unless $::form && $::form->{login};
- return shift->find_by(login => $::form->{login});
+ return undef unless $::myconfig{login};
+ return shift->find_by(login => $::myconfig{login});
}
sub update_entries_for_authorized_users {
$dunning_id, # duedate
$curr, # default currency
sprintf($main::locale->text('Automatically created invoice for fee and interest for dunning %s'), $dunning_id), # notes
- $form->{login}); # employee_id
+ $::myconfig{login}); # employee_id
do_query($form, $dbh, $query, @values);
$query =
map { $form->{$_} = $ref->{$_} } keys %{ $ref };
$query = qq|SELECT * FROM employee WHERE login = ?|;
- $ref = selectfirst_hashref_query($form, $dbh, $query, $form->{login});
+ $ref = selectfirst_hashref_query($form, $dbh, $query, $::myconfig{login});
map { $form->{"employee_${_}"} = $ref->{$_} } keys %{ $ref };
$query = qq|SELECT * FROM acc_trans WHERE trans_id = ? ORDER BY acc_trans_id ASC|;
}
if (!$main::auth->assert('sales_all_edit', 1)) {
push @where, qq|dord.employee_id = (select id from employee where login= ?)|;
- push @values, $form->{login};
+ push @values, $::myconfig{login};
}
foreach my $item (qw(donumber ordnumber cusordnumber transaction_description)) {
qq| (SELECT id FROM employee WHERE login = ?) | .
qq|WHERE id = ?|;
- do_query($form, $dbh, $query, $draft_description, $dumped, $form->{login}, $draft_id);
+ do_query($form, $dbh, $query, $draft_description, $dumped, $::myconfig{login}, $draft_id);
$dbh->commit();
$query = qq|INSERT INTO follow_ups (created_by, done, note_id, follow_up_date, created_for_user, id)
VALUES ((SELECT id FROM employee WHERE login = ?), ?, ?, ?, ?, ?)|;
- push @values, $form->{login};
+ push @values, $::myconfig{login};
} else {
$query = qq|UPDATE follow_ups SET done = ?, note_id = ?, follow_up_date = ?, created_for_user = ? WHERE id = ?|;
my $dbh = $form->get_standard_dbh($myconfig);
my ($query, @values);
- my ($employee_id) = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $form->{login});
+ my ($employee_id) = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $::myconfig{login});
$query = qq|SELECT fu.*, n.subject, n.body, n.created_by
FROM follow_ups fu
LEFT JOIN notes n ON (fu.note_id = n.id)
my $dbh = $form->get_standard_dbh($myconfig);
my ($query, $where, $where_user);
- my ($employee_id) = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $form->{login});
+ my ($employee_id) = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $::myconfig{login});
my @values = ();
my @values_user = ();
my $dbh = $form->get_standard_dbh($myconfig);
- my ($id) = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $form->{login});
+ my ($id) = selectrow_query($form, $dbh, qq|SELECT id FROM employee WHERE login = ?|, $::myconfig{login});
do_query($form, $dbh, qq|DELETE FROM follow_up_access WHERE what = ?|, $id);
my $dbh = $form->get_standard_dbh($myconfig);
- my $sth = prepare_execute_query($form, $dbh, qq|SELECT who FROM follow_up_access WHERE what = (SELECT id FROM employee WHERE login = ?)|, $form->{login});
+ my $sth = prepare_execute_query($form, $dbh, qq|SELECT who FROM follow_up_access WHERE what = (SELECT id FROM employee WHERE login = ?)|, $::myconfig{login});
my $access = {};
while (my $ref = $sth->fetchrow_hashref()) {
$query =
qq|INSERT INTO gl (id, employee_id) | .
qq|VALUES (?, (SELECT id FROM employee WHERE login = ?))|;
- @values = ($form->{id}, $form->{login});
+ @values = ($form->{id}, $::myconfig{login});
do_query($form, $dbh, $query, @values);
}
push @{$cur_ary}, $token;
} else {
- push @{$cur_ary}, $auth->check_right($form->{login}, $token, 1);
+ push @{$cur_ary}, $auth->check_right($::myconfig{login}, $token, 1);
}
}
($params{id}) = selectrow_query($form, $dbh, qq|SELECT nextval('note_id')|);
$query = qq|INSERT INTO notes (created_by, trans_id, trans_module, subject, body, id)
VALUES ((SELECT id FROM employee WHERE login = ?), ?, ?, ?, ?, ?)|;
- push @values, $form->{login}, conv_i($params{trans_id}), $params{trans_module};
+ push @values, $::myconfig{login}, conv_i($params{trans_id}), $params{trans_module};
} else {
$query = qq|UPDATE notes SET subject = ?, body = ? WHERE id = ?|;
if (!$main::auth->assert('sales_all_edit', 1)) {
$query .= " AND o.employee_id = (select id from employee where login= ?)";
- push @values, $form->{login};
+ push @values, $::myconfig{login};
}
if ($form->{employee_id}) {
$query .= " AND o.employee_id = ?";
my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig);
my $query = qq|SELECT id FROM employee WHERE login = ?|;
- my ($e_id) = selectrow_query($form, $dbh, $query, $form->{login});
+ my ($e_id) = selectrow_query($form, $dbh, $query, $::myconfig{login});
$query =
qq|SELECT oe.id, oe.transdate, oe.reqdate, oe.quonumber, oe.transaction_description, oe.amount,
$form->error("Missing Parameter: @_") if !$userspath || !$filename;
- $filename = "$form->{login}_$filename";
+ $filename = "$::myconfig{login}_$filename";
$filename =~ s|.*/||;
$filename = "$userspath/$filename";
open my $FACONF, "<", $filename or do {# Annon Sub
# limits by employees (Bearbeiter), not salesmen!
if (!$main::auth->assert('sales_all_edit', 1)) {
$where .= " AND ar.employee_id = (select id from employee where login= ?)";
- push (@values, $form->{login});
+ push (@values, $::myconfig{login});
}
# Stornierte Rechnungen und Stornorechnungen in invoice rausfiltern
require SL::DB::Employee;
require SL::DB::Inventory;
- my $employee = SL::DB::Manager::Employee->find_by(login => $::form->{login});
+ my $employee = SL::DB::Manager::Employee->find_by(login => $::myconfig{login});
my ($now) = selectrow_query($::form, $::form->get_standard_dbh, qq|SELECT current_date|);
my @directions = (undef, qw(out in transfer));
$myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
$form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password();
- $form->{todo_cfg} = { TODO->get_user_config('login' => $form->{login}) };
+ $form->{todo_cfg} = { TODO->get_user_config('login' => $::myconfig{login}) };
- $form->{title} = $locale->text('Edit Preferences for #1', $form->{login});
+ $form->{title} = $locale->text('Edit Preferences for #1', $::myconfig{login});
$form->header();
$form->{stylesheet} = $form->{usestylesheet};
- TODO->save_user_config('login' => $form->{login}, %{ $form->{todo_cfg} || { } });
+ TODO->save_user_config('login' => $::myconfig{login}, %{ $form->{todo_cfg} || { } });
if (AM->save_preferences($form)) {
if ($::auth->can_change_password()
$form->error($::locale->text('The settings were saved, but the password was not changed.') . ' ' . join(' ', $verifier->errors($result)));
}
- $::auth->change_password($form->{login}, $form->{new_password});
+ $::auth->change_password($::myconfig{login}, $form->{new_password});
}
$form->redirect($locale->text('Preferences saved!'));
if (-f "bin/mozilla/custom_arap.pl") {
eval { require "bin/mozilla/custom_arap.pl"; };
}
-if (-f "bin/mozilla/$main::form->{login}_arap.pl") {
- eval { require "bin/mozilla/$main::form->{login}_arap.pl"; };
+if (-f "bin/mozilla/$::myconfig{login}_arap.pl") {
+ eval { require "bin/mozilla/$::myconfig{login}_arap.pl"; };
}
1;
my %params = (
'due_only' => 1,
'not_done' => 1,
- 'created_for_login' => $form->{login},
+ 'created_for_login' => $::myconfig{login},
);
my $follow_ups = FU->follow_ups(%params);
# payment_terms => $form->{payment_terms},
# all_partsgroup => $form->{all_partsgroup}});
- $form->{show_edit_buttons} = $main::auth->check_right($form->{login}, 'part_service_assembly_edit');
+ $form->{show_edit_buttons} = $main::auth->check_right($::myconfig{login}, 'part_service_assembly_edit');
print $form->parse_html_template('ic/form_header');
$lxdebug->leave_sub();
if (-f "bin/mozilla/custom_invoice_io.pl") {
eval { require "bin/mozilla/custom_invoice_io.pl"; };
}
-if (-f "bin/mozilla/$main::form->{login}_invoice_io.pl") {
- eval { require "bin/mozilla/$main::form->{login}_invoice_io.pl"; };
+if (-f "bin/mozilla/$::myconfig{login}_invoice_io.pl") {
+ eval { require "bin/mozilla/$::myconfig{login}_invoice_io.pl"; };
}
1;
if (-f "bin/mozilla/custom_io.pl") {
eval { require "bin/mozilla/custom_io.pl"; };
}
-if (-f "bin/mozilla/$::form->{login}_io.pl") {
- eval { require "bin/mozilla/$::form->{login}_io.pl"; };
+if (-f "bin/mozilla/$::myconfig{login}_io.pl") {
+ eval { require "bin/mozilla/$::myconfig{login}_io.pl"; };
}
1;
$main::lxdebug->enter_sub();
my %myconfig = %main::myconfig;
- $form->{todo_list} = create_todo_list('login_screen' => 1) if (!$form->{no_todo_list}) and ($main::auth->check_right($form->{login}, 'productivity'));
+ $form->{todo_list} = create_todo_list('login_screen' => 1) if (!$form->{no_todo_list}) and ($main::auth->check_right($::myconfig{login}, 'productivity'));
$form->{stylesheet} = $myconfig{stylesheet};
$form->{title} = $::locale->text('kivitendo');
$bank_transfer->{chart_id} = $bank_account->{chart_id};
}
- my $id = SL::SEPA->create_export('employee' => $form->{login},
+ my $id = SL::SEPA->create_export('employee' => $::myconfig{login},
'bank_transfers' => \@bank_transfers,
'vc' => $vc);
my %params = @_;
my $postfix = $params{login_screen} ? '_login' : '';
- my %todo_cfg = TODO->get_user_config('login' => $form->{login});
+ my %todo_cfg = TODO->get_user_config('login' => $::myconfig{login});
if ($params{login_screen} && !$todo_cfg{show_after_login}) {
$main::lxdebug->leave_sub();
$::auth->assert('advance_turnover_tax_return');
- my $filename = "$::form->{login}_$::form->{filename}";
+ my $filename = "$::myconfig{login}_$::form->{filename}";
$filename =~ s|.*/||;
#zuerst die steuernummer aus den part, parts_X_Y und delimiter herstellen
# Anm. jb 18.3. vielleicht auch nur meine unwissenheit in perl-datenstrukturen
my %TRANSFER = (
'transfer_type' => 'assembly',
- 'login' => $form->{login},
+ 'login' => $::myconfig{login},
'dst_warehouse_id' => $form->{warehouse_id},
'dst_bin_id' => $form->{bin_id},
'chargenumber' => $form->{chargenumber},
my $msg = $locale->text('No warehouse has been created yet or the quantity of the bins is not configured yet.') . ' ';
- if ($main::auth->check_right($form->{login}, 'config')) {
+ if ($main::auth->check_right($::myconfig{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.');