X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=80f05084be3ee47923acc7892b19d768e5ba2cab;hb=db68b6fd72b9f0d7d8be953746c0e7d6154f5eaf;hp=fcaf0b2a5691949519f8ef9991e45f69405b968b;hpb=e07e9534d0c611913e31bc620c65e46701e5f000;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index fcaf0b2a5..80f05084b 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1110,7 +1110,7 @@ sub list_business { |; $discount = - $form->format_amount(\%myconfig, $ref->{discount} * 100, 1, " "); + $form->format_amount(\%myconfig, $ref->{discount} * 100); $description = ($ref->{salesman}) ? "$ref->{description}" @@ -1216,6 +1216,7 @@ sub save_business { $lxdebug->enter_sub(); $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!')); @@ -2091,7 +2092,6 @@ sub delete_printer { $lxdebug->leave_sub(); } - sub add_payment { $lxdebug->enter_sub(); @@ -2416,209 +2416,6 @@ sub swap_payment_terms { $lxdebug->leave_sub(); } -sub add_sic { - $lxdebug->enter_sub(); - - $form->{title} = "Add"; - - $form->{callback} = - "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}" - unless $form->{callback}; - - &sic_header; - &form_footer; - - $lxdebug->leave_sub(); -} - -sub edit_sic { - $lxdebug->enter_sub(); - - $form->{title} = "Edit"; - - AM->get_sic(\%myconfig, \%$form); - - &sic_header; - - $form->{orphaned} = 1; - &form_footer; - - $lxdebug->leave_sub(); -} - -sub list_sic { - $lxdebug->enter_sub(); - - AM->sic(\%myconfig, \%$form); - - $form->{callback} = - "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"; - - $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Standard Industrial Codes'); - - @column_index = qw(code description); - - $column_header{code} = - qq|| . $locale->text('Code') . qq||; - $column_header{description} = - qq|| . $locale->text('Description') . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - if ($ref->{sictype} eq 'H') { - print qq| - -|; - $column_data{code} = - qq||; - $column_data{description} = qq||; - - } else { - print qq| - -|; - - $column_data{code} = - qq||; - $column_data{description} = qq||; - - } - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}$ref->{description}
{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}$ref->{description}
-

- -
-
{script}> - - - - - -{path}> -{login}> -{password}> - - - -
- - - -|; - - $lxdebug->leave_sub(); -} - -sub sic_header { - $lxdebug->enter_sub(); - - $form->{title} = $locale->text("$form->{title} SIC"); - - # $locale->text('Add SIC') - # $locale->text('Edit SIC') - - $form->{code} =~ s/\"/"/g; - $form->{description} =~ s/\"/"/g; - - $checked = ($form->{sictype} eq 'H') ? "checked" : ""; - - $form->header; - - print qq| - - -
{script}> - - -{code}> - - - - - - - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('Code') . qq|{code}>
| - . $locale->text('Heading') . qq|
| . $locale->text('Description') . qq|

-|; - - $lxdebug->leave_sub(); -} - -sub save_sic { - $lxdebug->enter_sub(); - - $form->isblank("code", $locale->text('Code missing!')); - $form->isblank("description", $locale->text('Description missing!')); - AM->save_sic(\%myconfig, \%$form); - $form->redirect($locale->text('SIC saved!')); - - $lxdebug->leave_sub(); -} - -sub delete_sic { - $lxdebug->enter_sub(); - - AM->delete_sic(\%myconfig, \%$form); - $form->redirect($locale->text('SIC deleted!')); - - $lxdebug->leave_sub(); -} - sub display_stylesheet { $lxdebug->enter_sub(); @@ -2828,9 +2625,13 @@ sub config { } } - opendir CSS, "css/."; - @all = grep /.*\.css$/, readdir CSS; - closedir CSS; +# opendir CSS, "css/."; +# @all = grep /.*\.css$/, readdir CSS; +# closedir CSS; + +# css dir has styles that are not intended as general layouts. +# reverting to hardcoded list + @all = qw(lx-office-erp.css Win2000.css); foreach $item (@all) { if ($item eq $myconfig{stylesheet}) { @@ -3132,26 +2933,6 @@ sub save_preferences { $lxdebug->leave_sub(); } -sub backup { - $lxdebug->enter_sub(); - - if ($form->{media} eq 'email') { - $form->error($locale->text('No email address for') . " $myconfig{name}") - unless ($myconfig{email}); - - $form->{OUT} = "$sendmail"; - - } - - AM->backup(\%myconfig, \%$form, $userspath); - - if ($form->{media} eq 'email') { - $form->redirect($locale->text('Backup sent to') . qq| $myconfig{email}|); - } - - $lxdebug->leave_sub(); -} - sub audit_control { $lxdebug->enter_sub(); @@ -3421,6 +3202,100 @@ sub save_unit { $lxdebug->leave_sub(); } +sub show_history_search { + $lxdebug->enter_sub(); + + $form->{title} = $locale->text("History Search"); + $form->header(); + + print $form->parse_html_template("/common/search_history"); + + $lxdebug->leave_sub(); +} + +sub show_am_history { + $lxdebug->enter_sub(); + my %search = ( "Artikelnummer" => "parts", + "Kundennummer" => "customer", + "Lieferantennummer" => "vendor", + "Projektnummer" => "project", + "Buchungsnummer" => "oe", + "Eingangsrechnungnummer" => "ap", + "Ausgangsrechnungnummer" => "ar" + ); + my %searchNo = ( "Artikelnummer" => "partnumber", + "Kundennummer" => "customernumber", + "Lieferantennummer" => "vendornumber", + "Projektnummer" => "projectnummer", + "Buchungsnummer" => "ordnumber", + "Eingangsrechnungnummer" => "invnumber", + "Ausgangsrechnungnummer" => "invnumber" + ); + + my $restriction; + my $tempNo = 0; + foreach(split(/\,/, $form->{einschraenkungen})) { + if($tempNo == 0) { + $restriction .= " AND addition = '" . $_ . "'"; + $tempNo = 1; + } + else { + $restriction .= " OR addition = '" . $_ . "'"; + } + } + + $restriction .= (($form->{transdate} ne "" && $form->{reqdate} ne "") + ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|' AND st.itime::date <= '| . $form->{reqdate} . qq|'| + : (($form->{transdate} ne "" && $form->{reqdate} eq "") + ? qq| AND st.itime::date >= '| . $form->{transdate} . qq|'| + : ($form->{transdate} eq "" && $form->{reqdate} ne "") + ? qq| AND st.itime::date <= '| . $form->{reqdate} . qq|'| + : "" + ) + ); + + my $dbh = $form->dbconnect(\%myconfig); + + $restriction .= ($form->{mitarbeiter} eq "" ? "" + : ($form->{mitarbeiter} =~ /^[0-9]*$/ + ? " AND employee_id = " . $form->{mitarbeiter} + : " AND employee_id = " . &get_employee_id($form->{mitarbeiter}, $dbh))); + + my $query = qq|SELECT id FROM $search{$form->{what2search}} + WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}' + |; + + my $sth = $dbh->prepare($query); + + $sth->execute() || $form->dberror($query); + + $form->{title} = $locale->text("History Search"); + $form->header(); + + while(my $hash_ref = $sth->fetchrow_hashref()){ + print $form->parse_html_template("/common/show_history", + {"DATEN" => $form->get_history($dbh,$hash_ref->{id},$restriction), + "SUCCESS" => ($form->get_history($dbh,$hash_ref->{id},$restriction) != 0), + "NONEWWINDOW" => "1" + } + ); + } + $dbh->disconnect(); + + $lxdebug->leave_sub(); +} + +sub get_employee_id { + $lxdebug->enter_sub(); + my $query = qq|SELECT id FROM employee WHERE name = '| . $_[0] . qq|'|; + my $sth = $_[1]->prepare($query); + $sth->execute() || $form->dberror($query); + my $return = $sth->fetch(); + $sth->finish(); + return ${$return}[0]; + $lxdebug->leave_sub(); +} + sub swap_units { $lxdebug->enter_sub(); @@ -3432,4 +3307,4 @@ sub swap_units { edit_units(); $lxdebug->leave_sub(); -} +} \ No newline at end of file