$form->{id} = "";
}
+ if (!$form->{id} || $form->{id} eq "") {
+ $query = qq|SELECT nextval('id')|;
+ ($form->{"id"}) = selectrow_query($form, $dbh, $query);
+ $query = qq|INSERT INTO chart (id, accno) VALUES (?, ?)|;
+ do_query($form, $dbh, $query, $form->{"id"}, $form->{"accno"});
+ }
+
my @values;
if ($form->{id}) {
$form->{id},
);
- }
- elsif ($form->{id} && !$form->{new_chart_valid}) {
-
- $query = qq|
- UPDATE chart
- SET new_chart_id = ?,
- valid_from = ?
- WHERE id = ?
- |;
-
- @values = (
- conv_i($form->{new_chart_id}),
- conv_date($form->{valid_from}),
- $form->{id}
- );
- }
- else {
-
- $query = qq|
- INSERT INTO chart (
- accno,
- description,
- charttype,
- category,
- link,
- pos_bwa,
- pos_bilanz,
- pos_eur,
- new_chart_id,
- valid_from,
- datevautomatik )
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
- |;
-
- @values = (
- $form->{accno},
- $form->{description},
- $form->{charttype},
- $form->{category}, $form->{link},
- conv_i($form->{pos_bwa}),
- conv_i($form->{pos_bilanz}), conv_i($form->{pos_eur}),
- conv_i($form->{new_chart_id}),
- conv_date($form->{valid_from}),
- ($form->{datevautomatik} eq 'T') ? 'true':'false',
- );
-
}
do_query($form, $dbh, $query, @values);
# Loop control
# Check if the account already exists, else cancel
+
+ print(STDERR "Keine Taxkeys weil ID =: $form->{id}\n");
+
last READTAXKEYS if ( $form->{'id'} == 0);
# check if there is a startdate
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_account {
$lxdebug->enter_sub();
. $locale->text('Delete') . qq|">|;
}
+ if ($form->{id} && $form->{type} eq "account") {
+ print qq|
+ <input class=submit type=submit name=action value="|
+ . $locale->text('Save as new') . qq|">|;
+ }
+
print qq|
</form>
$lxdebug->leave_sub();
}
+sub save_as_new_account {
+ $lxdebug->enter_sub();
+
+ $auth->assert('config');
+
+ $form->isblank("accno", $locale->text('Account Number missing!'));
+ $form->isblank("description", $locale->text('Account Description missing!'));
+
+ if ($form->{charttype} eq 'A'){
+ $form->isblank("category", $locale->text('Account Type missing!'));
+ }
+
+ for my $taxkey (0 .. 9) {
+ if ($form->{"taxkey_id_$taxkey"}) {
+ $form->{"taxkey_id_$taxkey"} = "NEW";
+ }
+ }
+
+ $form->{id} = 0;
+ if ($form->{"original_accno"} &&
+ ($form->{"accno"} eq $form->{"original_accno"})) {
+ $form->error($locale->text('Account Number already used!'));
+ }
+ $form->redirect($locale->text('Account saved!'))
+ if (AM->save_account(\%myconfig, \%$form));
+ $form->error($locale->text('Cannot save account!'));
+
+ $lxdebug->leave_sub();
+}
+
sub list_account {
$lxdebug->enter_sub();
'Account Link IC_taxpart' => 'Warenliste Steuer',
'Account Link IC_taxservice' => 'Dienstleistungen Steuer',
'Account Number' => 'Kontonummer',
+ 'Account Number already used!' => 'Kontonummer ist bereits in Benutzung!',
'Account Number missing!' => 'Kontonummer fehlt!',
'Account Nummer' => 'Kontonummer',
'Account Type' => 'Kontoart',
'Account Link IC_sale' => 'Warenliste Erlöskonto',
'Account Link IC_taxpart' => 'Warenliste Steuer',
'Account Link IC_taxservice' => 'Dienstleistungen Steuer',
+ 'Account Number already used!' => 'Kontonummer ist bereits in Benutzung!',
'Account Number missing!' => 'Kontonummer fehlt!',
'Account Type missing!' => 'Kontoart fehlt!',
'Account deleted!' => 'Konto gelöscht!',
'SAVED FOR DUNNING' => 'Gespeichert',
'SCREENED' => 'Angezeigt',
'Save' => 'Speichern',
+ 'Save as new' => 'als neu speichern',
'Screen' => 'Bildschirm',
'Select a Customer' => 'Endkunde auswählen',
'Select a customer' => 'Einen Kunden auswählen',
'retrieve_partunits' => 'retrieve_partunits',
'save' => 'save',
'save_account' => 'save_account',
+ 'save_as_new' => 'save_as_new',
+ 'save_as_new_account' => 'save_as_new_account',
'save_bin' => 'save_bin',
'save_buchungsgruppe' => 'save_buchungsgruppe',
'save_business' => 'save_business',
'kontodaten_bearbeiten' => 'edit_account',
'neue_ware' => 'new_part',
'speichern' => 'save',
+ 'als_neu_speichern' => 'save_as_new',
};
1;
<input type="hidden" name="type" value="account">
<input type="hidden" name="orphaned" value="[% HTML.escape(orphaned) %]">
<input type="hidden" name="new_chart_valid" value="[% HTML.escape(new_chart_valid) %]">
+<input type="hidden" name="original_accno" value="[% HTML.escape(accno) %]">
<input type="hidden" name="inventory_accno_id" value="[% HTML.escape(inventory_accno_id) %]">
<input type="hidden" name="income_accno_id" value="[% HTML.escape(income_accno_id) %]">
<input type="hidden" name="expense_accno_id" value="[% HTML.escape(expense_accno_id) %]">
<input type="hidden" name="type" value="account">
<input type="hidden" name="orphaned" value="[% HTML.escape(orphaned) %]">
<input type="hidden" name="new_chart_valid" value="[% HTML.escape(new_chart_valid) %]">
+<input type="hidden" name="original_accno" value="[% HTML.escape(accno) %]">
<input type="hidden" name="inventory_accno_id" value="[% HTML.escape(inventory_accno_id) %]">
<input type="hidden" name="income_accno_id" value="[% HTML.escape(income_accno_id) %]">
<input type="hidden" name="expense_accno_id" value="[% HTML.escape(expense_accno_id) %]">