--- /dev/null
+package SL::Controller::Draft;
+
+use strict;
+
+use parent qw(SL::Controller::Base);
+
+use SL::Helper::Flash qw(flash);
+use SL::Locale::String qw(t8);
+use SL::Request;
+use SL::DB::Draft;
+use SL::DBUtils qw(selectall_hashref_query);
+use YAML;
+use List::Util qw(max);
+
+use Rose::Object::MakeMethods::Generic (
+ scalar => [ qw() ],
+ 'scalar --get_set_init' => [ qw(module submodule draft) ],
+);
+
+__PACKAGE__->run_before('check_auth');
+
+my %allowed_modules = map { $_ => "bin/mozilla/$_.pl" } qw(is ir ar ap);
+
+#
+# actions
+#
+
+sub action_draft_dialog {
+ my ($self) = @_;
+ $self->js
+ ->dialog->open({
+ html => $self->dialog_html,
+ id => 'save_draft',
+ dialog => {
+ title => t8('Drafts'),
+ },
+ })
+ ->render;
+}
+
+sub action_save {
+ my ($self) = @_;
+
+ my $id = $::form->{id};
+ my $description = $::form->{description} or die 'need description';
+ my $form = $self->_build_form;
+
+ my $draft = SL::DB::Manager::Draft->find_by_or_create(id => $id);
+
+ $draft->id($self->module . '-' . $self->submodule . '-' . Common::unique_id()) unless $draft->id;
+
+ $draft->assign_attributes(
+ module => $self->module,
+ submodule => $self->submodule,
+ description => $description,
+ form => YAML::Dump($form),
+ employee_id => SL::DB::Manager::Employee->current->id,
+ );
+
+ $self->draft($draft);
+
+ if (!$draft->save) {
+ flash('error', t8('There was an error saving the draft'));
+ $self->js
+ ->html('#save_draft', $self->dialog_html)
+ ->render;
+ } else {
+ $self->js
+ ->flash('info', t8("Draft saved."))
+ ->dialog->close('#save_draft')
+ ->render;
+ }
+}
+
+sub action_load {
+ my ($self) = @_;
+
+ if (!$allowed_modules{ $self->draft->module }) {
+ $::form->error(t8('Unknown module: #1', $self->draft->module));
+ } else {
+ package main;
+ require $allowed_modules{ $self->draft->module };
+ }
+
+ my $new_form = YAML::Load($self->draft->form);
+ $::form->{$_} = $new_form->{$_} for keys %$new_form;
+ $::form->{"draft_$_"} = $self->draft->$_ for qw(id description);
+
+ $::form->{script} = $self->draft->module . '.pl';
+ ::update();
+}
+
+sub action_delete {
+ my ($self) = @_;
+
+ $self->module($self->draft->module);
+ $self->submodule($self->draft->submodule);
+
+ if (!$self->draft->delete) {
+ flash('error', t8('There was an error deleting the draft'));
+ $self->js
+ ->html('#save_draft', $self->dialog_html)
+ ->render;
+ } else {
+ flash('info', t8('Draft deleted'));
+
+ $self->js
+ ->html('#save_draft', $self->dialog_html)
+ ->render;
+ }
+}
+
+#
+# helpers
+#
+
+sub _build_form {
+ my $last_index = max map { /form\[(\d+)\]/ ? $1 : 0 } keys %$::form;
+ my $new_form = {};
+
+ for my $i (0..$last_index) {
+ SL::Request::_store_value($new_form, $::form->{"form[$i][name]"}, $::form->{"form[$i][value]"});
+ }
+
+ return $new_form;
+}
+
+sub draft_list {
+ my ($self) = @_;
+
+ my $result = selectall_hashref_query($::form, $::form->get_standard_dbh, <<SQL, $self->module, $self->submodule);
+ SELECT d.*, date(d.itime) AS date, e.name AS employee_name
+ FROM drafts d
+ LEFT JOIN employee e ON d.employee_id = e.id
+ WHERE (d.module = ?) AND (d.submodule = ?)
+ ORDER BY d.itime
+SQL
+}
+
+sub dialog_html {
+ my ($self) = @_;
+
+ $self->render('drafts/form', { layout => 0, output => 0 },
+ drafts_list => $self->draft_list
+ )
+}
+
+sub init_module {
+ $::form->{module} or die 'need module';
+}
+
+sub init_submodule {
+ $::form->{submodule} or die 'need submodule';
+}
+
+sub init_draft {
+ SL::DB::Manager::Draft->find_by(id => $::form->{id}) or die t8('Could not load this draft');
+}
+
+sub check_auth {
+ $::auth->assert('vendor_invoice_edit | invoice_edit | general_ledger');
+}
+
+1;
+
+__END__
+
+=encoding utf-8
+
+=head1 NAME
+
+SL::Controller::Draft
+
+=head1 DESCRIPTION
+
+Encapsulates the old draft mechanism. Use and improvement are discuraged as
+long as the storage is not upgrade safe.
+
+=head1 TODO
+
+ - optional popup on entry
+
+=head1 AUTHOR
+
+Sven Schöling E<lt>s.schoeling@linet-services.deE<gt>
+
+=cut
+++ /dev/null
-#======================================================================
-# LX-Office ERP
-#
-#======================================================================
-#
-# Saving and loading drafts
-#
-#======================================================================
-
-package Drafts;
-
-use YAML;
-
-use SL::Common;
-use SL::DBUtils;
-
-use strict;
-
-sub get_module {
- $main::lxdebug->enter_sub();
-
- my ($self, $form) = @_;
-
- my ($module, $submodule);
-
- $module = $form->{"script"};
- $module =~ s/\.pl$//;
- if (grep({ $module eq $_ } qw(is ir ar ap))) {
- $submodule = "invoice";
- } else {
- $submodule = "unknown";
- }
-
- $main::lxdebug->leave_sub();
-
- return ($module, $submodule);
-}
-
-my @dont_save = qw(login password action);
-
-sub dont_save {
- return @dont_save;
-}
-
-sub save {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form, $draft_id, $draft_description) = @_;
-
- my ($dbh, $sth, $query, %saved, $dumped);
-
- $dbh = $form->get_standard_dbh;
- $dbh->begin_work;
-
- my ($module, $submodule) = $self->get_module($form);
-
- $query = "SELECT COUNT(*) FROM drafts WHERE id = ?";
- my ($res) = selectrow_query($form, $dbh, $query, $draft_id);
-
- if (!$res) {
- $draft_id = $module . "-" . $submodule . "-" . Common::unique_id();
- $query = "INSERT INTO drafts (id, module, submodule) VALUES (?, ?, ?)";
- do_query($form, $dbh, $query, $draft_id, $module, $submodule);
- }
-
- map({ $saved{$_} = $form->{$_};
- delete($form->{$_}); } @dont_save);
-
- $dumped = YAML::Dump($form);
- map({ $form->{$_} = $saved{$_}; } @dont_save);
-
- $query =
- qq|UPDATE drafts SET description = ?, form = ?, employee_id = | .
- qq| (SELECT id FROM employee WHERE login = ?) | .
- qq|WHERE id = ?|;
-
- do_query($form, $dbh, $query, $draft_description, $dumped, $::myconfig{login}, $draft_id);
-
- $dbh->commit();
-
- $form->{draft_id} = $draft_id;
- $form->{draft_description} = $draft_description;
-
- $main::lxdebug->leave_sub();
-}
-
-sub load {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form, $draft_id) = @_;
-
- my ($dbh, $sth, $query, @values);
-
- $dbh = $form->get_standard_dbh;
-
- $query = qq|SELECT id, description, form FROM drafts WHERE id = ?|;
-
- $sth = prepare_execute_query($form, $dbh, $query, $draft_id);
-
- if (my $ref = $sth->fetchrow_hashref()) {
- @values = ($ref->{form}, $ref->{id}, $ref->{description});
- }
- $sth->finish();
-
- $main::lxdebug->leave_sub();
-
- return @values;
-}
-
-sub remove {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form, @draft_ids) = @_;
-
- return $main::lxdebug->leave_sub() unless (@draft_ids);
-
- my ($dbh, $sth, $query);
-
- $dbh = $form->get_standard_dbh;
-
- $query = qq|DELETE FROM drafts WHERE id IN (| . join(", ", map { "?" } @draft_ids) . qq|)|;
- do_query($form, $dbh, $query, @draft_ids);
-
- $dbh->commit;
-
- $main::lxdebug->leave_sub();
-}
-
-sub list {
- $::lxdebug->enter_sub;
-
- my $self = shift;
- my $myconfig = shift || \%::myconfig;
- my $form = shift || $::form;
- my $dbh = $form->get_standard_dbh;
-
- my @list = selectall_hashref_query($form, $dbh, <<SQL, $self->get_module($form));
- SELECT d.id, d.description, d.itime::timestamp(0) AS itime,
- e.name AS employee_name
- FROM drafts d
- LEFT JOIN employee e ON d.employee_id = e.id
- WHERE (d.module = ?) AND (d.submodule = ?)
- ORDER BY d.itime
-SQL
-
- $::lxdebug->leave_sub;
-
- return @list;
-}
-
-1;
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
-require "bin/mozilla/drafts.pl";
require "bin/mozilla/reportgenerator.pl";
use strict;
$main::auth->assert('general_ledger');
- return $main::lxdebug->leave_sub() if (load_draft_maybe());
-
$form->{title} = "Add";
- $form->{callback} = "ap.pl?action=add&DONT_LOAD_DRAFT=1" unless $form->{callback};
+ $form->{callback} = "ap.pl?action=add" unless $form->{callback};
AP->get_transdate(\%myconfig, $form);
$form->{initial_transdate} = $form->{transdate};
$form->{javascript} .= qq|<script type="text/javascript" src="js/common.js"></script>|;
$form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
$form->{javascript} .= qq|<script type="text/javascript" src="js/follow_up.js"></script>|;
+ $form->{javascript} .= qq|<script type="text/javascript" src="js/kivi.Draft.js"></script>|;
$form->header();
$form->save_history;
}
# /saving the history
- remove_draft() if $form->{remove_draft};
# Dieser Text wird niemals ausgegeben: Probleme beim redirect?
$form->redirect($locale->text('Transaction posted!')) unless $inline;
} else {
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
-require "bin/mozilla/drafts.pl";
require "bin/mozilla/reportgenerator.pl";
use strict;
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 "")) {
$form->{snumbers} = qq|invnumber_| . $form->{invnumber};
# /saving the history
$form->{title} = "Add";
- $form->{callback} = "ar.pl?action=add&DONT_LOAD_DRAFT=1" unless $form->{callback};
+ $form->{callback} = "ar.pl?action=add" unless $form->{callback};
AR->get_transdate(\%myconfig, $form);
$form->{initial_transdate} = $form->{transdate};
$form->{javascript} .=
qq|<script type="text/javascript" src="js/show_vc_details.js"></script>| .
- qq|<script type="text/javascript" src="js/follow_up.js"></script>|;
+ qq|<script type="text/javascript" src="js/follow_up.js"></script>| .
+ qq|<script type="text/javascript" src="js/kivi.Draft.js"></script>|;
# $amount = $locale->text('Amount');
# $project = $locale->text('Project');
$form->save_history;
}
# /saving the history
- remove_draft() if $form->{remove_draft};
$form->redirect($locale->text('Transaction posted!')) unless $inline;
+++ /dev/null
-#======================================================================
-# LX-Office ERP
-#
-#======================================================================
-#
-# Saving and loading drafts
-#
-#======================================================================
-
-use YAML;
-
-use SL::Drafts;
-
-require "bin/mozilla/common.pl";
-
-use strict;
-
-sub save_draft {
- $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});
- delete $form->{SAVED_FORM};
-
- $form->{SAVED_FORM} = save_form(qw(login password));
- $form->{remove_draft} = 1;
-
- $form->header();
- print($form->parse_html_template("drafts/save_new"));
-
- return $main::lxdebug->leave_sub();
- }
-
- my ($draft_id, $draft_description) = ($form->{draft_id}, $form->{draft_description});
-
- restore_form($form->{SAVED_FORM}, 1);
- delete $form->{SAVED_FORM};
-
- Drafts->save(\%myconfig, $form, $draft_id, $draft_description);
-
- $form->{saved_message} = $locale->text("Draft saved.");
-
- update();
-
- $main::lxdebug->leave_sub();
-}
-
-sub remove_draft {
- $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)};
-
- $main::lxdebug->leave_sub();
-}
-
-sub load_draft_maybe {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- $main::lxdebug->leave_sub() and return 0 if ($form->{DONT_LOAD_DRAFT});
-
- my ($draft_nextsub) = @_;
-
- my @drafts = Drafts->list(\%myconfig, $form);
-
- $main::lxdebug->leave_sub() and return 0 unless (@drafts);
-
- $draft_nextsub = "add" unless ($draft_nextsub);
-
- delete $form->{action};
- my $saved_form = save_form(qw(login password));
-
- $form->header();
- print($form->parse_html_template("drafts/load",
- { "DRAFTS" => \@drafts,
- "SAVED_FORM" => $saved_form,
- "draft_nextsub" => $draft_nextsub }));
-
- $main::lxdebug->leave_sub();
-
- return 1;
-}
-
-sub dont_load_draft {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
-
- my $draft_nextsub = $form->{draft_nextsub} || "add";
-
- restore_form($form->{SAVED_FORM}, 1);
- delete $form->{SAVED_FORM};
-
- $form->{DONT_LOAD_DRAFT} = 1;
-
- call_sub($draft_nextsub);
-
- $main::lxdebug->leave_sub();
-}
-
-sub load_draft {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- # check and store certain form parameters that might have been passed as get, so we can later overwrite the values from the draft
- # the overwrite happens at the end of this function
- my @valid_overwrite_vars = qw(remove_draft amount_1 invnumber ordnumber transdate duedate notes datepaid_1 paid_1 callback AP_paid_1 currency); # reference description
- my $overwrite_hash;
- # my @valid_fields;
- foreach ( @valid_overwrite_vars ) {
- $overwrite_hash->{$_} = $form->{$_} if exists $form->{$_}; # variant 1
- # push(@valid_fields, $_) if exists $form->{$_}; # variant 2
- };
-
- my ($old_form, $id, $description) = Drafts->load(\%myconfig, $form, $form->{id});
-
- if ($old_form) {
- $old_form = YAML::Load($old_form);
-
- my %dont_save_vars = map { $_ => 1 } Drafts->dont_save;
- my @restore_vars = grep { !$dont_save_vars{$_} } keys %{ $old_form };
-
- @{$form}{@restore_vars} = @{$old_form}{@restore_vars};
-
- $form->{draft_id} = $id;
- $form->{draft_description} = $description;
- $form->{remove_draft} = 'checked';
- }
- # Ich vergesse bei Rechnungsentwürfe das Rechnungsdatum zu ändern. Dadurch entstehen
- # ungültige Belege. Vielleicht geht es anderen ähnlich jan 19.2.2011
- $form->{invdate} = $form->current_date(\%myconfig); # Aktuelles Rechnungsdatum ...
- $form->{duedate} = $form->current_date(\%myconfig); # Aktuelles Fälligkeitsdatum ...
-
- if ( $overwrite_hash ) {
- foreach ( keys %$overwrite_hash ) {
- $form->{$_} = $overwrite_hash->{$_}; # variante 1
- };
- };
- # @{$form}{@valid_fields} = @{$overwrite_hash}{@valid_fields}; # variante 2
-
- update();
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_drafts {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- my @ids;
- foreach (keys %{$form}) {
- push @ids, $1 if (/^checked_(.*)/ && $form->{$_});
- }
- Drafts->remove(\%myconfig, $form, @ids) if (@ids);
-
- restore_form($form->{SAVED_FORM}, 1);
- delete $form->{SAVED_FORM};
-
- add();
-
- $main::lxdebug->leave_sub();
-}
-
-sub draft_action_dispatcher {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my $locale = $main::locale;
-
- if ($form->{draft_action} eq $locale->text("Skip")) {
- dont_load_draft();
-
- } elsif ($form->{draft_action} eq $locale->text("Delete drafts")) {
- delete_drafts();
- }
-
- $main::lxdebug->leave_sub();
-}
-
-1;
require "bin/mozilla/io.pl";
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
-require "bin/mozilla/drafts.pl";
use strict;
$::form->show_generic_error($::locale->text("You do not have the permissions to access this function."));
}
- return $main::lxdebug->leave_sub() if (load_draft_maybe());
-
$form->{show_details} = $::myconfig{show_form_details};
$form->{title} = $locale->text('Record Vendor Invoice');
$TMPL_VAR{payment_terms_obj} = get_payment_terms_for_invoice();
$form->{duedate} = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{due_due})->to_kivitendo if $TMPL_VAR{payment_terms_obj};
- $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part client_js));
+ $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part client_js));
$form->header();
$form->save_history;
}
# /saving the history
- remove_draft() if $form->{remove_draft};
$form->redirect( $locale->text('Invoice')
. " $form->{invnumber} "
. $locale->text('posted!'));
require "bin/mozilla/io.pl";
require "bin/mozilla/arap.pl";
-require "bin/mozilla/drafts.pl";
use strict;
$main::auth->assert('invoice_edit');
- return $main::lxdebug->leave_sub() if (load_draft_maybe());
-
$form->{show_details} = $::myconfig{show_form_details};
if ($form->{type} eq "credit_note") {
), @custom_hiddens,
map { $_.'_rate', $_.'_description', $_.'_taxnumber' } split / /, $form->{taxaccounts}];
- $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part client_js));
+ $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.Draft kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part client_js));
$TMPL_VAR{payment_terms_obj} = get_payment_terms_for_invoice();
$form->{duedate} = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{duedate})->to_kivitendo if $TMPL_VAR{payment_terms_obj};
}
}
- remove_draft() if $form->{remove_draft};
-
if(!exists $form->{addition}) {
$form->{snumbers} = 'invnumber' .'_'. $form->{invnumber}; # ($form->{type} eq 'credit_note' ? 'cnnumber' : 'invnumber') .'_'. $form->{invnumber};
$form->{what_done} = 'invoice';
sub dispatcher {
for my $action (qw(
print update ship_to e_mail storno post_payment use_as_new credit_note
- delete post order preview post_and_e_mail print_and_post save_draft
+ delete post order preview post_and_e_mail print_and_post
mark_as_paid
)) {
if ($::form->{"action_$action"}) {
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
-require "bin/mozilla/drafts.pl";
require "bin/mozilla/reportgenerator.pl";
use strict;
--- /dev/null
+namespace('kivi.Draft', function(ns) {
+ 'use strict';
+
+ ns.popup = function(module, submodule, id, description) {
+ $.get('controller.pl', {
+ action: 'Draft/draft_dialog.js',
+ module: module,
+ submodule: submodule,
+ id: id,
+ description: description
+ }, kivi.eval_json_result)
+ }
+
+ ns.save = function(module, submodule) {
+ $.post('controller.pl', {
+ action: 'Draft/save.js',
+ module: module,
+ submodule: submodule,
+ form: $('form').serializeArray(),
+ id: $('#new_draft_id').val(),
+ description: $('#new_draft_description').val()
+ }, kivi.eval_json_result)
+ }
+
+ ns.delete = function(id) {
+ if (!confirm(kivi.t8('Do you really want to delete this draft?'))) return;
+
+ $.post('controller.pl', {
+ action: 'Draft/delete.js',
+ id: id
+ }, kivi.eval_json_result)
+
+ }
+});
"Delete text block":"Textblock löschen",
"Do you really want do continue?":"Wollen Sie wirklich fortfahren?",
"Do you really want to cancel?":"Wollen Sie wirklich abbrechen?",
+"Do you really want to delete this draft?":"Wollen Sie diesen Entwurf wirklich löschen?",
"Do you really want to revert to this version?":"Wollen Sie wirklich auf diese Version zurücksetzen?",
"Do you really want to save?":"Wollen Sie wirklich speichern?",
"Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"Soll die Kontonummer \"#1\" zu \"#2\" und den Name \"#3\" zu \"#4\" geändert werden?",
'Could not load employee' => 'Konnte Benutzer nicht laden',
'Could not load this business' => 'Konnte diesen Kunden-/Lieferantentyp nicht laden',
'Could not load this customer' => 'Konnte diesen Kunden nicht laden',
+ 'Could not load this draft' => 'Dieser Entwurf konnte nicht geladen werden',
'Could not load this vendor' => 'Konnte diesen Lieferanten nicht laden',
'Could not print dunning.' => 'Die Mahnungen konnten nicht gedruckt werden.',
'Could not reconcile chosen elements!' => 'Die gewählten Elemente konnten nicht ausgeglichen werden!',
'Do you really want to delete AR transaction #1?' => 'Wollen Sie wirklich die Debitorenbuchung #1 löschen?',
'Do you really want to delete GL transaction #1?' => 'Wollen Sie wirklich die Dialogbuchung #1 löschen?',
'Do you really want to delete the selected links?' => 'Wollen Sie wirklich die ausgewählten Verknüpfungen löschen?',
+ 'Do you really want to delete this draft?' => 'Wollen Sie diesen Entwurf wirklich löschen?',
'Do you really want to delete this invoice?' => 'Wollen Sie diese Rechnung wirklich löschen?',
'Do you really want to delete this object?' => 'Wollen Sie dieses Objekt wirklich löschen?',
'Do you really want to delete this warehouse?' => 'Wollen Sie dieses Lager wirklich löschen?',
'Download SEPA XML export file' => 'SEPA-XML-Exportdatei herunterladen',
'Download picture' => 'Bild herunterladen',
'Download sample file' => 'Beispieldatei herunterladen',
+ 'Draft deleted' => 'Entwurf gelöscht',
'Draft for this Letter saved!' => 'Briefentwurf gespeichert!',
'Draft from:' => 'Entwurf vom:',
'Draft saved.' => 'Entwurf gespeichert.',
'Draft suggestions' => 'Entwurfsvorschläge',
+ 'Drafts' => 'Entwürfe',
'Drawing' => 'Zeichnung',
'Dropdown Limit' => 'Auswahllistenbegrenzung',
'Due' => 'Fällig',
'Enabled Quick Searched' => 'Aktivierte Schnellsuchen',
'Enabled modules' => 'Aktivierte Module',
'End date' => 'Enddatum',
- 'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.',
'Enter longdescription' => 'Langtext eingeben',
'Enter the requested execution date or leave empty for the quickest possible execution:' => 'Geben Sie das jeweils gewünschte Ausführungsdatum an, oder lassen Sie das Feld leer für die schnellstmögliche Ausführung:',
'Entries for which automatic conversion failed:' => 'Einträge, für die die automatische Umstellung fehlschlug:',
'List of database upgrades to be applied:' => 'Liste der noch einzuspielenden Datenbankupgrades:',
'List of tax zones' => 'Liste der Steuerzonen',
'List open SEPA exports' => 'Noch nicht ausgeführte SEPA-Exporte anzeigen',
+ 'Load an existing draft' => 'Einen bestehenden Entwurf laden',
'Load draft' => 'Entwurf laden',
'Load letter draft' => 'Briefentwurf laden',
'Load profile' => 'Profil laden',
'Save and close' => 'Speichern und schließen',
'Save and execute' => 'Speichern und ausführen',
'Save and keep open' => 'Speichern und geöffnet lassen',
+ 'Save as a new draft.' => 'Als neuen Entwurf speichern',
'Save as new' => 'als neu speichern',
'Save document in WebDAV repository' => 'Dokument in WebDAV-Ablage speichern',
'Save draft' => 'Entwurf speichern',
'There is not enough available of \'#1\' at warehouse \'#2\', bin \'#3\', #4, for the transfer of #5.' => 'Von \'#1\' ist in Lager \'#2\', Lagerplatz \'#3\', #4 nicht genügend eingelagert, um insgesamt #5 auszulagern.',
'There is not enough left of \'#1\' in bin \'#2\' for the removal of #3.' => 'In Lagerplatz \'#2\' ist nicht genug von \'#1\' vorhanden, um #3 zu entnehmen.',
'There is one or more sections for which no part has been assigned yet; therefore creating the new record is not possible yet.' => 'Es gibt einen oder mehrere Abschnitte ohne Artikelzuweisung; daher kann der neue Beleg noch nicht erstellt werden.',
+ 'There was an error deleting the draft' => 'Beim Löschen des Entwurfs ist ein Fehler aufgetretetn',
'There was an error executing the background job.' => 'Bei der Ausführung des Hintergrund-Jobs trat ein Fehler auf.',
'There was an error parsing the csv file: #1 in line #2: #3' => 'Es gab einen Fehler beim Parsen der CSV Datei: "#1" in der Zeile "#2": "#3"',
+ 'There was an error saving the draft' => 'Beim Speichern des Entwurfs ist ein Fehler aufgetretetn',
'There was an error saving the letter' => 'Ein Fehler ist aufgetreten. Der Brief konnte nicht gespeichert werden.',
'There was an error saving the letter draft' => 'Ein Fehler ist aufgetreten. Der Briefentwurf konnte nicht gespeichert werden.',
'There you can let kivitendo create the basic tables for you, even in an already existing database.' => 'Dort können Sie kivitendo diese grundlegenden Tabellen erstellen lassen, selbst in einer bereits existierenden Datenbank.',
'Unknown Category' => 'Unbekannte Kategorie',
'Unknown Link' => 'Unbekannte Verknüpfung',
'Unknown dependency \'%s\'.' => 'Unbekannte Abhängigkeit \'%s\'.',
+ 'Unknown module: #1' => 'Unbekanntes Modul #1',
'Unknown problem type.' => 'Unbekannter Problem-Typ',
'Unlock System' => 'System entsperren',
'Unsuccessfully executed:\n' => 'Erfolglos ausgeführt:',
'Update quotation/order' => 'Auftrag/Angebot aktualisieren',
'Update sales order #1' => 'Kundenauftrag #1 aktualisieren',
'Update sales quotation #1' => 'Angebot #1 aktualisieren',
+ 'Update this draft.' => 'Aktuellen Entwurf speichern',
'Update with section' => 'Mit Abschnitt aktualisieren',
'Updated' => 'Erneuert am',
'Updating existing entry in database' => 'Existierenden Eintrag in Datenbank aktualisieren',
'Warehouses' => 'Lager',
'Warn before saving orders with duplicate parts (new controller only)' => 'Beim Speichern warnen, wenn doppelte Artikel in einem Auftrag sind',
'Warning' => 'Warnung',
+ 'Warning! Loading a draft will discard unsaved data!' => 'Achtung! Beim Laden eines Entwurfs werden ungespeicherte Daten verworfen!',
'WebDAV' => 'WebDAV',
'WebDAV link' => 'WebDAV-Link',
'WebDAV save documents' => 'Belege in WebDAV-Ablage speichern',
<input type=hidden name=draft_id value="[% draft_id %]">
<input type=hidden name=draft_description value="[% draft_description | html %]">
-[%- IF ( !id && draft_id ) %]
- [% L.checkbox_tag('remove_draft', checked=remove_draft, label=LxERP.t8('Remove draft when posting')) %]
- <br>
-[%- END %]
-
<br>
<input class="submit" type="submit" name="action" id="update_button" value="[% 'Update' | $T8 %]">
[%- ELSIF show_post_draft %]
<input class=submit type=submit name=action value="[% 'Post' | $T8 %]">
- <input type="submit" name="action" value="[% 'Save draft' | $T8 %]" class="submit">
+ [% L.button_tag('kivi.Draft.popup("ap", "invoice", "' _ draft_id _ '", "' _ draft_description _ '")', LxERP.t8('Drafts')) %]
[%- END %]
[%- IF id %]
[% USE LxERP %]
[% USE T8 %]
+[% USE L %]
[% IF ( follow_up_length && follow_up_due_length ) %]
[% LxERP.t8('There are #1 unfinished follow-ups of which #2 are due.', follow_up_length , follow_up_due_length) %]
<br>
- [% IF ( !id && draft_id ) %]
- <input type="checkbox" name="remove_draft" id="remove_draft" value="1" [% IF ( remove_draft ) %]checked[% END %]>
- <label for="remove_draft">[% 'Remove draft when posting' | $T8 %]</label>
- [% END %]
-
- <br>
-
<input class="submit" type="submit" name="action" id="update_button" value="[% 'Update' | $T8 %]">
[% IF ( show_storno_button ) %]
[% ELSE %]
[% IF ( !is_closed ) %]
<input class="submit" type="submit" name="action" value="[% 'Post' | $T8 %]">
- <input class="submit" type="submit" name="action" value="[% 'Save draft' | $T8 %]">
+ [% L.button_tag('kivi.Draft.popup("ar", "invoice", "' _ draft_id _ '", "' _ draft_description _ '")', LxERP.t8('Drafts')) %]
[% END %]
[% END %]
--- /dev/null
+[%- USE T8 %]
+[%- USE L %]
+[%- USE LxERP %]
+[%- USE HTML %]
+
+[% PROCESS 'common/flash.html' %]
+
+[%- IF FORM.id %]
+<h3>[% 'Update this draft.' | $T8 %]</h3>
+[%- ELSE %]
+<h3>[% 'Save as a new draft.' | $T8 %]</h3>
+[%- END %]
+
+[% L.hidden_tag('', FORM.id, id='new_draft_id') %]
+[% 'Description' | $T8 %]: <input id='new_draft_description' value='[% FORM.description | html %]'>
+[% L.button_tag('kivi.Draft.save("' _ HTML.escape(SELF.module) _ '", "' _ HTML.escape(SELF.submodule) _ '")', LxERP.t8('Save draft')) %]
+
+[%- IF drafts_list.size %]
+<h3>[% 'Load an existing draft' | $T8 %]</h3>
+
+<p>[% 'Warning! Loading a draft will discard unsaved data!' | $T8 %]</p>
+
+<table>
+ <tr class="listheading">
+ <th>[% 'Date' | $T8 %]</th>
+ <th>[% 'Description' | $T8 %]</th>
+ <th>[% 'Employee' | $T8 %]</th>
+ </tr>
+
+[% FOREACH row = drafts_list %]
+ <tr class="listrow">
+ <td>[% row.date | html %]</td>
+ <td>
+ [%- IF row.id == FORM.id %]
+ <b>[% row.description | html %]</b>
+ [%- ELSE %]
+ [% L.link(SELF.url_for(action='load',id=row.id), row.description) %]
+ [%- END %]
+ </td>
+ <td>[% row.employee_name | html %]</td>
+ <td>[% L.html_tag('span', LxERP.t8('Delete'), class='cursor-pointer interact', onclick="kivi.Draft.delete('" _ row.id _ "')") %]</a></td>
+ </tr>
+[% END %]
+</table>
+[%- END %]
+
+++ /dev/null
-[%- USE T8 %]
-[%- USE HTML %]
-<h1>[% 'Save draft' | $T8 %]</h1>
-
- <form action="[% HTML.escape(script) %]" method="post">
-
- <input type="hidden" name="SAVED_FORM" value="[% HTML.escape(SAVED_FORM) %]">
-
- <table width="100%">
- <tr>
- <td>[% 'Enter a description for this new draft.' | $T8 %]</td>
- </tr>
-
- <tr>
- <td>
- [% 'Description' | $T8 %]:
- <input name="draft_description">
- </td>
- </tr>
-
- <tr>
- <td>
- <input type="submit" class="submit" name="action" value="[% 'Save draft' | $T8 %]">
- </td>
- </tr>
- </table>
-
- </form>
[% UNLESS locked %]
<input class="submit" type="submit" name="action" value="[% 'Post' | $T8 %]">
[%- END %]
- <input class="submit" type="submit" name="action" value="[% 'Save Draft' | $T8 %]">
+ [% L.button_tag('kivi.Draft.popup("ir", "invoice", "' _ draft_id _ '", "' _ draft_description _ '")', LxERP.t8('Drafts')) %]
[% END # id %]
[% IF id %]
<hr size="3" noshade>
<p>[% print_options %]</p>
+
+<div id='form_action_bar'>
<input type="hidden" name="action" value="dispatcher">
[% IF id %]
<input class="submit" type="submit" name="action_post_and_e_mail" value="[% 'Post and E-mail' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
<input class="submit" type="submit" name="action_print_and_post" value="[% 'Print and Post' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
<input class="submit" type="submit" name="action_post" value="[% 'Post' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
- <input class="submit" type="submit" name="action_save_draft" value="[% 'Save Draft' | $T8 %]">
+ [% L.button_tag('kivi.Draft.popup("is", "invoice", "' _ draft_id _ '", "' _ draft_description _ '")', LxERP.t8('Drafts')) %]
[%- END %]
[% END # id %]
[% IF callback %]
<a href="[% callback %]">[% 'back' | $T8 %]</a>
[% END %]
+</div>
<input type="hidden" name="rowcount" value="[% rowcount %]">
<input type="hidden" name="callback" value="[% callback | html %]">