1;
-
-
-require "$form->{path}/common.pl";
+require "bin/mozilla/common.pl";
# end of main
-sub add { &{"add_$form->{type}"} }
-sub delete { &{"delete_$form->{type}"} }
-
-sub display {
- if ($form->{display_nextsub}) {
- &{ $form->{display_nextsub} }();
- } else {
- &{ $form->{nextsub} }();
- }
-}
-
-sub save {
- if ($form->{save_nextsub}) {
- &{ $form->{save_nextsub} }();
- } else {
- &{ $form->{nextsub} }();
- }
-}
-
-sub edit {
- if ($form->{edit_nextsub}) {
- &{ $form->{edit_nextsub} }();
- } else {
- &{ "edit_$form->{type}" }();
- }
-}
+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 add_account {
$lxdebug->enter_sub();
AM->get_account(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&account_header;
<input name=callback type=hidden value="$form->{callback}">
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
# construct callback
$callback =
- "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}";
$form->header;
$ca->{link_edit_account} =
qq|$form->{script}?action=edit_account&id=$ca->{id}|
- .qq|&path=$form->{path}&login=$form->{login}|
+ .qq|&login=$form->{login}|
.qq|&password=$form->{password}&callback=$callback|;
}
$form->{role} = "P";
$form->{callback} =
- "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_department&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&department_header;
AM->departments(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_department&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_department&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
$profitcenter = ($ref->{role} eq "P") ? "X" : "";
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_department&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
+ qq|<td><a href=$form->{script}?action=edit_department&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
$column_data{cost} = qq|<td align=center>$costcenter</td>|;
$column_data{profit} = qq|<td align=center>$profitcenter</td>|;
<input type=hidden name=type value=department>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_lead&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&lead_header;
AM->lead(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_lead&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_lead&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
$lead = $ref->{lead};
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_lead&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{lead}</td>|;
+ qq|<td><a href=$form->{script}?action=edit_lead&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{lead}</td>|;
map { print "$column_data{$_}\n" } @column_index;
<input type=hidden name=type value=lead>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_business&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&business_header;
AM->business(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_business&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_business&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
$description =
$ref->{description};
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_business&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$description</td>|;
+ qq|<td><a href=$form->{script}?action=edit_business&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$description</td>|;
$column_data{discount} = qq|<td align=right>$discount</td>|;
$column_data{customernumberinit} =
qq|<td align=right>$ref->{customernumberinit}</td>|;
<input type=hidden name=type value=business>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_language&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&language_header;
AM->language(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_language&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_language&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_language&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
+ qq|<td><a href=$form->{script}?action=edit_language&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
$column_data{template_code} = qq|<td align=right>$ref->{template_code}</td>|;
$column_data{article_code} =
qq|<td align=right>$ref->{article_code}</td>|;
<input type=hidden name=type value=language>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_buchungsgruppe&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
AM->get_buchungsgruppe(\%myconfig, \%$form);
$form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"};
AM->buchungsgruppe(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_buchungsgruppe&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|;
map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" }
- qw(login password path));
+ qw(login password));
my $row = 0;
foreach $ref (@{ $form->{ALL} }) {
}
$column_data{description} =
- qq|<td><a href=$form->{script}?action=edit_buchungsgruppe&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
+ qq|<td><a href=$form->{script}?action=edit_buchungsgruppe&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}</td>|;
$column_data{inventory_accno} = qq|<td align=right>$ref->{inventory_accno}</td>|;
$column_data{income_accno_0} =
qq|<td align=right>$ref->{income_accno_0}</td>|;
<input type=hidden name=type value=buchungsgruppe>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_printer&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
&printer_header;
AM->printer(\%myconfig, \%$form);
$form->{callback} =
- "$form->{script}?action=list_printer&path=$form->{path}&login=$form->{login}&password=$form->{password}";
+ "$form->{script}?action=list_printer&login=$form->{login}&password=$form->{password}";
$callback = $form->escape($form->{callback});
$column_data{printer_description} =
- qq|<td><a href=$form->{script}?action=edit_printer&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{printer_description}</td>|;
+ qq|<td><a href=$form->{script}?action=edit_printer&id=$ref->{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{printer_description}</td>|;
$column_data{printer_command} = qq|<td align=right>$ref->{printer_command}</td>|;
$column_data{template_code} =
qq|<td align=right>$ref->{template_code}</td>|;
<input type=hidden name=type value=printer>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$form->{title} = "Add";
$form->{callback} =
- "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add_payment&login=$form->{login}&password=$form->{password}"
unless $form->{callback};
$form->{terms_netto} = 0;
<input type=hidden name=type value=payment>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$lxdebug->leave_sub();
}
-sub display_template {
- $lxdebug->enter_sub();
-
- $form->{edit} = 0;
- display_template_form();
-
- $lxdebug->leave_sub();
-}
-
-sub edit_template {
- $lxdebug->enter_sub();
-
- $form->{edit} = 1;
- display_template_form();
-
- $lxdebug->leave_sub();
-}
-
-sub save_template {
- $lxdebug->enter_sub();
-
- $form->isblank("formname", $locale->text("You're not editing a file.")) unless ($form->{type} eq "stylesheet");
-
- my ($filename) = AM->prepare_template_filename(\%myconfig, $form);
- if (my $error = AM->save_template($filename, $form->{content})) {
- $form->error(sprintf($locale->text("Saving the file '%s' failed. OS error message: %s"), $filename, $error));
- }
-
- $form->{edit} = 0;
- display_template_form();
-
- $lxdebug->leave_sub();
-}
-
-sub display_template_form {
- $lxdebug->enter_sub();
-
- $form->{formname} =~ s|.*/||;
- my $format = $form->{format} eq "html" ? "html" : "tex";
-
- my $title = $form->{type} eq "stylesheet" ? $locale->text("Edit the stylesheet") : $locale->text("Edit templates");
- $form->{title} = $title;
-
- my $edit_options;
-
- my @hidden = qw(login path password type format);
-
- if (($form->{type} ne "stylesheet") && !$form->{edit}) {
- $edit_options = "<p>";
-
- my %formname_setup =
- (
- "balance_sheet" => { "translation" => $locale->text('Balance Sheet'), "html" => 1 },
- "bin_list" => $locale->text('Bin List'),
- "bwa" => { "translation" => $locale->text('BWA'), "html" => 1 },
- "check" => { "translation" => $locale->text('Check'), "html" => 1 },
- "credit_note" => $locale->text('Credit Note'),
- "income_statement" => { "translation" => $locale->text('Income Statement'), "html" => 1 },
- "invoice" => $locale->text('Invoice'),
- "packing_list" => $locale->text('Packing List'),
- "pick_list" => $locale->text('Pick List'),
- "proforma" => $locale->text('Proforma Invoice'),
- "purchase_order" => $locale->text('Purchase Order'),
- "receipt" => { "translation" => $locale->text('Receipt'), "tex" => 1 },
- "request_quotation" => $locale->text('RFQ'),
- "sales_order" => $locale->text('Confirmation'),
- "sales_quotation" => $locale->text('Quotation'),
- "statement" => $locale->text('Statement'),
- "storno_invoice" => $locale->text('Storno Invoice'),
- "storno_packing_list" => $locale->text('Storno Packing List'),
- "ustva-2004" => { "translation" => $locale->text("USTVA 2004"), "tex" => 1 },
- "ustva-2005" => { "translation" => $locale->text("USTVA 2005"), "tex" => 1 },
- "ustva-2006" => { "translation" => $locale->text("USTVA 2006"), "tex" => 1 },
- "ustva-2007" => { "translation" => $locale->text("USTVA 2007"), "tex" => 1 },
- "ustva" => $locale->text("USTVA"),
- "zahlungserinnerung" => $locale->text('Payment Reminder'),
- );
-
- my (@values, %labels, $file, $setup);
-
- while (($file, $setup) = each(%formname_setup)) {
- next unless (!ref($setup) || $setup->{$format});
-
- push(@values, $file);
- $labels{$file} = ref($setup) ? $setup->{translation} : $setup;
- }
- @values = sort({ $labels{$a} cmp $labels{$b} } @values);
-
- $edit_options .=
- $locale->text("Template") . " " .
- NTI($cgi->popup_menu("-name" => "formname", "-default" => $form->{formname},
- "-values" => \@values, "-labels" => \%labels));
-
- $form->get_lists("printers" => "ALL_PRINTERS",
- "languages" => "ALL_LANGUAGES");
-
- @values = ("");
- %labels = ();
-
- foreach my $item (@{ $form->{ALL_LANGUAGES} }) {
- next unless ($item->{template_code});
- my $key = "$item->{id}--$item->{template_code}";
- push(@values, $key);
- $labels{$key} = $item->{description};
- }
-
- if (1 != scalar(@values)) {
- $edit_options .=
- " " . $locale->text("Language") . " " .
- NTI($cgi->popup_menu("-name" => "language", "-default" => $form->{language},
- "-values" => \@values, "-labels" => \%labels));
- }
-
- @values = ("");
- %labels = ();
-
- foreach my $item (@{ $form->{ALL_PRINTERS} }) {
- next unless ($item->{template_code});
- my $key = "$item->{id}--$item->{template_code}";
- push(@values, $key);
- $labels{$key} = $item->{printer_description};
- }
-
- if (1 != scalar(@values)) {
- $edit_options .=
- " " . $locale->text("Printer") . " " .
- NTI($cgi->popup_menu("-name" => "printer", "-default" => $form->{printer},
- "-values" => \@values, "-labels" => \%labels));
- }
-
- $edit_options .= qq|
-
- <input type="hidden" name="display_nextsub" value="display_template">
-
- <input name="action" type="submit" class="submit" value="|
- . $locale->text('Display') . qq|">
-
- </p>
-
- <hr>
-|;
-
- } else {
- push(@hidden, qw(formname language printer));
- }
-
- if ($form->{formname} || ($form->{type} eq "stylesheet")) {
- my ($filename, $display_filename) = AM->prepare_template_filename(\%myconfig, $form);
- my ($content, $lines) = AM->load_template($filename);
-
- $body = qq|
-|;
-
- if ($form->{edit}) {
- $form->{fokus} = "Form.content";
- $body = qq|\n<p><div class="listtop">| . $locale->text('Edit file') . " '" . H($display_filename) . qq|'</div></p>\n<p>|
- . NTI($cgi->textarea("-name" => "content",
- "-id" => "content",
- "-default" => $content,
- "-columns" => 100,
- "-rows" => 25))
- . qq|</p>
-
- <p>
- <input type="hidden" name="save_nextsub" value="save_template">
-
- <input type="submit" name="action" value="| . $locale->text('Save') . qq|">
- </p>
-|;
-
- } else {
- $content = "\n\n" unless ($content);
-
- $body = qq|
- <p><div class="listtop">| . $locale->text('Display file') . " '" . H($display_filename) . qq|'</div></p>
-
- <input type="hidden" name="edit_nextsub" value="edit_template">
-
- <p><input name="action" type="submit" class="submit" value="| . $locale->text('Edit') . qq|"></p>
-
- <p>
- <pre class="filecontent">| . H($content) . qq|</pre>
- </p>
-|;
-
- if ($lines > 25) {
- $body .= qq|
- <input name="action" type="submit" class="submit" value="|
- . $locale->text('Edit') . qq|">
-|;
- }
- }
- }
-
- $form->header;
-
- print qq|
-<body>
-
-<div class="listheading">$title</div>
-
-<form method="post" name="Form" action="am.pl">
-
-|;
- $form->hide_form(@hidden);
-
- print qq|
-$edit_options
-
-$body
-
-</form>
-
-</body>
-</html>
-|;
-
- $lxdebug->leave_sub();
-}
-
sub config {
$lxdebug->enter_sub();
</tr>
</table>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
<form method=post action=$form->{script}>
-<input type=hidden name=path value=$form->{path}>
<input type=hidden name=login value=$form->{login}>
<input type=hidden name=password value=$form->{password}>
$lxdebug->leave_sub();
}
-sub continue {
- $lxdebug->enter_sub();
-
- &{ $form->{nextsub} };
-
- $lxdebug->leave_sub();
-}
-
sub edit_units {
$lxdebug->enter_sub();
);
my $dbh = $form->dbconnect(\%myconfig);
-
+ my $searchSNumber = $searchNo{$form->{'what2search'}} . qq|_| . $form->{'searchid'};
$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);
+ my $query = qq|SELECT trans_id AS id FROM history_erp WHERE sNumbers = '$searchSNumber' |;
+
+ my $sth = $dbh->prepare($query);
$sth->execute() || $form->dberror($query);
+ if($sth->fetch() <= 0) {
+ $sth->finish();
+ my $query = qq|SELECT id FROM $search{$form->{what2search}}
+ WHERE $searchNo{$form->{'what2search'}} ILIKE '$form->{"searchid"}'
+ |;
+ }
+ $sth->execute() || $form->dberror($query);
$form->{title} = $locale->text("History Search");
$form->header();
-
+ my $daten = "";
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"
- }
- );
- }
+ $daten = $form->get_history($dbh,$hash_ref->{id},$restriction);
+ }
$dbh->disconnect();
-
+ print $form->parse_html_template("/common/show_history",
+ {"DATEN" => $daten,
+ "SUCCESS" => ($daten != 0 ? 1 : 0),
+ "NONEWWINDOW" => 1
+ });
$lxdebug->leave_sub();
}