Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lieferschein Speichern u. schliessen "Als geschlossen markieren" #359

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions SL/Controller/DeliveryOrder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ __PACKAGE__->run_before('check_auth',
__PACKAGE__->run_before('check_auth_for_edit',
except => [ qw(
update_stock_information edit
price_popup stock_in_out_dialog load_second_rows
stock_in_out_dialog load_second_rows
) ]);

__PACKAGE__->run_before('get_unalterable_data',
Expand Down Expand Up @@ -223,6 +223,15 @@ sub action_delete {
sub action_save {
my ($self) = @_;

if ( $self->order->delivered ) {
$self->js->flash('error', t8('This record has already been delivered.'));
return $self->js->render();
}
if ( $self->order->closed ) {
$self->js->flash('error', t8('This record has already been closed.'));
return $self->js->render();
}

$self->save();

flash_later('info', $self->type_data->text("saved"));
Expand Down Expand Up @@ -271,6 +280,20 @@ sub action_save_as_new {
$self->action_save();
}

# close a already saved order (potentially already delivered)
sub action_close_order {
my ($self) = @_;

$self->order->update_attributes(
closed => 1
);

$self->js
->flash("info", t8("The record has been closed."))
->html('#data-status-line', delivery_order_status_line($self->order))
->render
}

# print the order
#
# This is called if "print" is pressed in the print dialog.
Expand Down Expand Up @@ -1178,7 +1201,7 @@ sub action_transfer_stock {
t8('The parts for this order have already been transferred'))
->run('kivi.ActionBar.setEnabled', '#undo_transfer_action',
t8('The parts for this order have already been transferred'))
->replaceWith('#data-status-line', delivery_order_status_line($self->order))
->html('#data-status-line', delivery_order_status_line($self->order))
->render;
}

Expand Down Expand Up @@ -1946,9 +1969,9 @@ sub setup_edit_action_bar {
warn_on_duplicates => $::instance_conf->get_order_warn_duplicate_parts,
warn_on_reqdate => $::instance_conf->get_order_warn_no_deliverydate,
}],
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
: $self->order->delivered ? t8('This record has already been delivered.')
: undef,
: undef,
],
action => [
t8('Save and Close'),
Expand All @@ -1961,8 +1984,18 @@ sub setup_edit_action_bar {
{ name => 'back_to_caller', value => 1 },
],
}],
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
: $self->order->delivered ? t8('This record has already been delivered.')
: undef,
],
action => [
t8('Mark as closed'),
id => 'close_order',
call => [ 'kivi.DeliveryOrder.close_order' ],
confirm => t8('This will remove the delivery order from showing as open even if contents are not delivered. Proceed?'),
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.')
: !$self->order->id ? t8('This object has not been saved yet.')
: $self->order->closed ? t8('This record has already been closed.')
: undef,
],
action => [
Expand Down
14 changes: 14 additions & 0 deletions js/kivi.DeliveryOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ namespace('kivi.DeliveryOrder', function(ns) {
$.post("controller.pl", data, kivi.eval_json_result);
};

ns.close_order = function() {
let data = [];
let id = $("#id").val();

if (!id) {
alert(kivi.t8('This object has not been saved yet.'));
return;
}

data.push({ name: 'id', value: id });
data.push({ name: 'action', value: 'DeliveryOrder/close_order' });
$.post("controller.pl", data, kivi.eval_json_result);
}

ns.show_print_options = function(params) {
if (!ns.check_cv()) return;

Expand Down
1 change: 1 addition & 0 deletions js/locale/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ namespace("kivi").setupLocale({
"There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?":"Einige der Lagerbewegungen sind nicht vollständig und Lagerbewegungen können nachträglich nicht mehr verändert werden. Möchten Sie wirklich fortfahren?",
"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.",
"This field must not be empty.":"Dieses Feld darf nicht leer sein.",
"This object has not been saved yet.":"Das Objekt wurde noch nicht gespeichert.",
"This sales order has an active configuration for periodic invoices. If you save then all subsequently created invoices will contain those changes as well, but not those that have already been created. Do you want to continue?":"Dieser Auftrag besitzt eine aktive Konfiguration für wiederkehrende Rechnungen. Wenn Sie jetzt speichern, so werden alle zukünftig hieraus erzeugten Rechnungen die Änderungen enthalten, nicht aber die bereits erzeugten Rechnungen. Möchten Sie speichern?",
"This vendor has already a booking with this invoice number, do you really want to add the same invoice number again?":"Es gibt für diesen Lieferant schon einen Beleg mit dieser Rechnungsnummer. Möchten Sie wirklich eine weitere Buchung mit derselben Rechnungsnummer hinzufügen?",
"Thu":"Do",
Expand Down
1 change: 1 addition & 0 deletions js/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ namespace("kivi").setupLocale({
"There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?":"",
"There is one or more sections for which no part has been assigned yet; therefore creating the new record is not possible yet.":"",
"This field must not be empty.":"",
"This object has not been saved yet.":"",
"This sales order has an active configuration for periodic invoices. If you save then all subsequently created invoices will contain those changes as well, but not those that have already been created. Do you want to continue?":"",
"This vendor has already a booking with this invoice number, do you really want to add the same invoice number again?":"",
"Thu":"",
Expand Down
1 change: 1 addition & 0 deletions locale/de/all
Original file line number Diff line number Diff line change
Expand Up @@ -4247,6 +4247,7 @@ $ ./scripts/installation_check.pl',
'The reclamation reason has been deleted.' => 'Der Reklamationsgrund wurde gelöscht.',
'The reclamation reason has been saved.' => 'Der Reklamationsgrund wurde gespeichert.',
'The reclamation reason is in use and cannot be deleted.' => 'Der Reklamationsgrund ist in Benutzung und kann nicht gelöscht werden.',
'The record has been closed.' => 'Dieser Beleg wurde geschlossen.',
'The record template \'#1\' has been loaded.' => 'Die Belegvorlage »#1« wurde geladen.',
'The record template \'#1\' has been saved.' => 'Die Belegvorlage »#1« wurde gespeichert.',
'The report doesn\'t contain entries.' => 'Der Bericht enthält keine Einträge.',
Expand Down
1 change: 1 addition & 0 deletions locale/en/all
Original file line number Diff line number Diff line change
Expand Up @@ -4245,6 +4245,7 @@ $self->{texts} = {
'The reclamation reason has been deleted.' => '',
'The reclamation reason has been saved.' => '',
'The reclamation reason is in use and cannot be deleted.' => '',
'The record has been closed.' => '',
'The record template \'#1\' has been loaded.' => '',
'The record template \'#1\' has been saved.' => '',
'The report doesn\'t contain entries.' => '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,15 @@
<caption>[% 'Handling, Numbers & Dates' | $T8 %]</caption>
<colgroup> <col class="wi-mediumsmall"><col class="wi-normal"> </colgroup>
<tbody>

<tr>
<th>[% 'Status' | $T8 %]</th>
<td id="data-status-line"><span class="data wi-normal">[% SELF.order.presenter.status_line %]</span></td>
</tr>
<td rowspan="2">
<span id="data-status-line" class="data wi-normal" style="overflow:visible;height:auto">
[% SELF.order.presenter.status_line || '&nbsp;' %]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sollte hier nicht besser der style ins css (für diese Status-Zeile oder als Klasse)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erstellen wir für ein Element eine Klasse? Ich finde die Sichtbarkeit im html eigentlich gut. Gibt es im Projekt da Vorgaben oder Regeln?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich dachte mir, der style kommt evtl. öfter vor und könnte dann wiederverwendet werden. Ansonten evtl. mal mit rebootl besprechen.

</span>
</td>
</tr><tr></tr>

<tr>
<th>[% 'Employee' | $T8 %]</th>
Expand Down