Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ca601f74

Von Bernd Bleßmann vor mehr als 1 Jahr hinzugefügt

  • ID ca601f7472acf21d37b3317110e6266e884d822f
  • Vorgänger 09f4b19f
  • Nachfolger 9a47a2b9

Angebots-Eingang: Controller

Unterschiede anzeigen:

SL/Controller/Order.pm
return $self->js->render();
}
my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been deleted')
: $self->type eq sales_order_type() ? $::locale->text('The order confirmation has been deleted')
: $self->type eq purchase_order_type() ? $::locale->text('The order has been deleted')
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been deleted')
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been deleted')
my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been deleted')
: $self->type eq sales_order_type() ? $::locale->text('The order confirmation has been deleted')
: $self->type eq purchase_order_type() ? $::locale->text('The order has been deleted')
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been deleted')
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been deleted')
: $self->type eq purchase_quotation_intake_type() ? $::locale->text('The quotation intake has been deleted')
: '';
flash_later('info', $text);
......
return $self->js->render();
}
my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been saved')
: $self->type eq sales_order_type() ? $::locale->text('The order confirmation has been saved')
: $self->type eq purchase_order_type() ? $::locale->text('The order has been saved')
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been saved')
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been saved')
my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been saved')
: $self->type eq sales_order_type() ? $::locale->text('The order confirmation has been saved')
: $self->type eq purchase_order_type() ? $::locale->text('The order has been saved')
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been saved')
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been saved')
: $self->type eq purchase_quotation_intake_type() ? $::locale->text('The quotation intake has been saved')
: '';
flash_later('info', $text);
......
#
sub init_valid_types {
[ sales_order_intake_type(), sales_order_type(), purchase_order_type(), sales_quotation_type(), request_quotation_type() ];
[ sales_order_intake_type(), sales_order_type(), purchase_order_type(), sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type() ];
}
sub init_type {
......
sub init_cv {
my ($self) = @_;
my $cv = (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), sales_quotation_type())) ? 'customer'
: (any { $self->type eq $_ } (purchase_order_type(), request_quotation_type())) ? 'vendor'
my $cv = (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), sales_quotation_type())) ? 'customer'
: (any { $self->type eq $_ } (purchase_order_type(), request_quotation_type(), purchase_quotation_intake_type())) ? 'vendor'
: die "Not a valid type for order";
return $cv;
......
my ($self) = @_;
my $right_for = { map { $_ => $_.'_edit' . ' | ' . $_.'_view' } @{$self->valid_types} };
$right_for->{ sales_order_intake_type() } = 'sales_order_edit | sales_order_view';
$right_for->{ sales_order_intake_type() } = 'sales_order_edit | sales_order_view';
$right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit | request_quotation_view';
my $right = $right_for->{ $self->type };
$right ||= 'DOES_NOT_EXIST';
......
my ($self) = @_;
my $right_for = { map { $_ => $_.'_edit' } @{$self->valid_types} };
$right_for->{ sales_order_intake_type() } = 'sales_order_edit';
$right_for->{ sales_order_intake_type() } = 'sales_order_edit';
$right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit';
my $right = $right_for->{ $self->type };
$right ||= 'DOES_NOT_EXIST';
......
my $order;
$order = SL::DB::Order->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
$order ||= SL::DB::Order->new(orderitems => [],
quotation => (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type())),
intake => (any { $self->type eq $_ } (sales_order_intake_type())),
quotation => (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type())),
intake => (any { $self->type eq $_ } (sales_order_intake_type(), purchase_quotation_intake_type())),
currency_id => $::instance_conf->get_currency_id(),);
my $cv_id_method = $self->cv . '_id';
......
sub setup_edit_action_bar {
my ($self, %params) = @_;
my $deletion_allowed = (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type()))
my $deletion_allowed = (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type(), purchase_quotation_intake_type()))
|| (($self->type eq sales_order_type()) && $::instance_conf->get_sales_order_show_delete)
|| (($self->type eq sales_order_intake_type()) && $::instance_conf->get_sales_order_show_delete)
|| (($self->type eq purchase_order_type()) && $::instance_conf->get_purchase_order_show_delete);
......
my $right_for = { map { $_ => $_.'_edit' } @{$self->valid_types} };
$right_for->{ sales_order_intake_type() } = 'sales_order_edit';
$right_for->{ purchase_quotation_intake_type() } = 'request_quotation_edit';
my $right = $right_for->{ $self->type };
$right ||= 'DOES_NOT_EXIST';
my $may_edit_create = $::auth->assert($right, 'may fail');
......
t8('Save and Quotation'),
call => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_quotation_type()), '#order_form' ],
checks => [ @req_trans_cost_art, @req_cusordnumber ],
only_if => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type())),
only_if => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type(), purchase_quotation_intake_type())),
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
],
action => [
......
only_if => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), sales_quotation_type(), purchase_order_type())),
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
],
action => [
t8('Save and Purchase Quotation Intake'),
call => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => purchase_quotation_intake_type()), '#order_form' ],
only_if => (any { $self->type eq $_ } (request_quotation_type())),
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
],
action => [
t8('Save and Sales Order Intake'),
call => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_order_intake_type()), '#order_form' ],
......
t8('Save and Sales Order Confirmation'),
call => [ 'kivi.submit_ajax_form', $self->url_for(action => "save_and_order_workflow", to_type => sales_order_type()), '#order_form' ],
checks => [ @req_trans_cost_art ],
only_if => (any { $self->type eq $_ } (sales_quotation_type(), sales_order_intake_type(), request_quotation_type(), purchase_order_type())),
only_if => (any { $self->type eq $_ } (sales_quotation_type(), sales_order_intake_type(), request_quotation_type(), purchase_order_type(), purchase_quotation_intake_type())),
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
],
action => [
t8('Save and Purchase Order'),
call => [ 'kivi.Order.purchase_check_for_direct_delivery', { to_type => purchase_order_type() } ],
checks => [ @req_trans_cost_art, @req_cusordnumber ],
only_if => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type())),
only_if => (any { $self->type eq $_ } (sales_order_intake_type(), sales_order_type(), request_quotation_type(), purchase_quotation_intake_type())),
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
],
action => [
......
@req_trans_cost_art, @req_cusordnumber,
],
disabled => !$may_edit_create ? t8('You do not have the permissions to access this function.') : undef,
not_if => (any { $self->type eq $_ } (sales_order_intake_type())),
not_if => (any { $self->type eq $_ } (sales_order_intake_type(), purchase_quotation_intake_type())),
],
action => [
($has_invoice_for_advance_payment ? t8('Save and Further Invoice for Advance Payment') : t8('Save and Invoice for Advance Payment')),
......
# $::locale->text("Add Purchase Order");
# $::locale->text("Add Quotation");
# $::locale->text("Add Request for Quotation");
# $::locale->text("Add Purchase Quotation Intake");
# $::locale->text("Edit Sales Order Intake");
# $::locale->text("Edit Sales Order");
# $::locale->text("Edit Purchase Order");
# $::locale->text("Edit Quotation");
# $::locale->text("Edit Request for Quotation");
# $::locale->text("Edit Purchase Quotation Intake");
$action = ucfirst(lc($action));
return $self->type eq sales_order_intake_type() ? $::locale->text("$action Sales Order Intake")
: $self->type eq sales_order_type() ? $::locale->text("$action Sales Order")
: $self->type eq purchase_order_type() ? $::locale->text("$action Purchase Order")
: $self->type eq sales_quotation_type() ? $::locale->text("$action Quotation")
: $self->type eq request_quotation_type() ? $::locale->text("$action Request for Quotation")
return $self->type eq sales_order_intake_type() ? $::locale->text("$action Sales Order Intake")
: $self->type eq sales_order_type() ? $::locale->text("$action Sales Order")
: $self->type eq purchase_order_type() ? $::locale->text("$action Purchase Order")
: $self->type eq sales_quotation_type() ? $::locale->text("$action Quotation")
: $self->type eq request_quotation_type() ? $::locale->text("$action Request for Quotation")
: $self->type eq purchase_quotation_intake_type() ? $::locale->text("$action Purchase Quotation Intake")
: '';
}
......
'request_quotation';
}
sub purchase_quotation_intake_type {
'purchase_quotation_intake';
}
sub nr_key {
return $_[0]->type eq sales_order_intake_type() ? 'ordnumber'
: $_[0]->type eq sales_order_type() ? 'ordnumber'
: $_[0]->type eq purchase_order_type() ? 'ordnumber'
: $_[0]->type eq sales_quotation_type() ? 'quonumber'
: $_[0]->type eq request_quotation_type() ? 'quonumber'
return $_[0]->type eq sales_order_intake_type() ? 'ordnumber'
: $_[0]->type eq sales_order_type() ? 'ordnumber'
: $_[0]->type eq purchase_order_type() ? 'ordnumber'
: $_[0]->type eq sales_quotation_type() ? 'quonumber'
: $_[0]->type eq request_quotation_type() ? 'quonumber'
: $_[0]->type eq purchase_quotation_intake_type() ? 'quonumber'
: '';
}
......
return $self->js->render();
}
my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been saved')
: $self->type eq sales_order_type() ? $::locale->text('The order confirmation has been saved')
: $self->type eq purchase_order_type() ? $::locale->text('The order has been saved')
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been saved')
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been saved')
my $text = $self->type eq sales_order_intake_type() ? $::locale->text('The order intake has been saved')
: $self->type eq sales_order_type() ? $::locale->text('The order confirmation has been saved')
: $self->type eq purchase_order_type() ? $::locale->text('The order has been saved')
: $self->type eq sales_quotation_type() ? $::locale->text('The quotation has been saved')
: $self->type eq request_quotation_type() ? $::locale->text('The rfq has been saved')
: $self->type eq purchase_quotation_intake_type() ? $::locale->text('The quotation intake has been saved')
: '';
flash_later('info', $text);
SL/DB/Order.pm
sub type {
my $self = shift;
return 'sales_order_intake' if $self->customer_id && $self->intake;
return 'sales_order' if $self->customer_id && ! $self->quotation;
return 'purchase_order' if $self->vendor_id && ! $self->quotation;
return 'sales_quotation' if $self->customer_id && $self->quotation;
return 'request_quotation' if $self->vendor_id && $self->quotation;
return 'sales_order_intake' if $self->customer_id && $self->intake;
return 'sales_order' if $self->customer_id && ! $self->quotation;
return 'purchase_order' if $self->vendor_id && ! $self->quotation;
return 'sales_quotation' if $self->customer_id && $self->quotation;
return 'request_quotation' if $self->vendor_id && $self->quotation && ! $self->intake;
return 'purchase_quotation_intake' if $self->vendor_id && $self->quotation && $self->intake;
return;
}
js/kivi.Order.js
var number_info = '';
if ($('#type').val() == 'sales_order_intake' || $('#type').val() == 'sales_order' || $('#type').val() == 'purchase_order') {
number_info = $('#order_ordnumber').val();
} else if ($('#type').val() == 'sales_quotation' || $('#type').val() == 'request_quotation') {
} else if ($('#type').val() == 'sales_quotation' || $('#type').val() == 'request_quotation' || $('#type').val() == 'purchase_quotation_intake') {
number_info = $('#order_quonumber').val();
}
var name_info = '';
if ($('#type').val() == 'sales_order_intake' || $('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation') {
name_info = $('#order_customer_id_name').val();
} else if ($('#type').val() == 'purchase_order' || $('#type').val() == 'request_quotation') {
} else if ($('#type').val() == 'purchase_order' || $('#type').val() == 'request_quotation' || $('#type').val() == 'purchase_quotation_intake') {
name_info = $('#order_vendor_id_name').val();
}
menus/user/90-purchase-quotation-intake.yaml
- parent: ap
id: ap_add_purchase_quotation_intake_experimental
name: Add Purchase Quotation Intake
icon: rfq_add
order: 150
access: request_quotation_edit & client/feature_experimental_order
params:
action: Order/add
type: purchase_quotation_intake
- parent: ap_reports
id: ap_reports_purchase_quotation_intakes
name: Purchase Quotation Intakes
icon: rfq_report
order: 150
access: request_quotation_edit | request_quotation_view
module: oe.pl
params:
action: search
type: purchase_quotation_intake
templates/design40_webpages/order/tabs/_price_sources_dialog.html
[% IF (FORM.type == "sales_order" || FORM.type == "sales_order_intake" || FORM.type == "sales_quotation") %]
[% SET price_editable = AUTH.assert('sales_edit_prices', 1) %]
[% END %]
[% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation") %]
[% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation" || FORM.type == "purchase_quotation_intake") %]
[% SET price_editable = AUTH.assert('purchase_edit_prices', 1) %]
[% END %]
[% SET exfactor = price_source.record.exchangerate ? 1 / price_source.record.exchangerate : 1 %]
templates/design40_webpages/order/tabs/_row.html
[% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation") %]
[% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('sales_edit_prices', 1) %]
[% END %]
[% IF (SELF.type == "purchase_order" || SELF.type == "request_quotation") %]
[% IF (SELF.type == "purchase_order" || SELF.type == "request_quotation" || SELF.type == "purchase_quotation_intake") %]
[% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('purchase_edit_prices', 1) %]
[% END %]
<td>
templates/design40_webpages/order/tabs/basic_data.html
</td>
</tr>
[% END %]
[% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation") %]
[% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation" || SELF.type == "purchase_quotation_intake") %]
[% SET quo_nr_txt = 'Quotation Number' %]
[% ELSE %]
[% SET quo_nr_txt = 'RFQ Number' %]
......
[% END %]
[% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "purchase_order") %]
[% SET transdate_txt = 'Order Date' %]
[% ELSIF SELF.type == "sales_quotation" %]
[% ELSIF (SELF.type == "sales_quotation" || SELF.type == "purchase_quotation_intake") %]
[% SET transdate_txt = 'Quotation Date' %]
[% ELSE %]
[% SET transdate_txt = 'RFQ Date' %]
......
[% PROCESS order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id) %]
[% END %]
<tfoot>
[% IF (SELF.type == "sales_quotation") || (SELF.type == "request_quotation") %]
[% IF (SELF.type == "sales_quotation") || (SELF.type == "request_quotation") || (SELF.type == "purchase_quotation_intake") %]
[% SET add_col = 0 %]
[% ELSE %]
[% SET add_col = 1 %]
templates/webpages/order/tabs/_price_sources_dialog.html
[% IF (FORM.type == "sales_order" || FORM.type == "sales_order_intake" || FORM.type == "sales_quotation") %]
[% SET price_editable = AUTH.assert('sales_edit_prices', 1) %]
[% END %]
[% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation") %]
[% IF (FORM.type == "purchase_order" || FORM.type == "request_quotation" || FORM.type == "purchase_quotation_intake") %]
[% SET price_editable = AUTH.assert('purchase_edit_prices', 1) %]
[% END %]
[% SET exfactor = price_source.record.exchangerate ? 1 / price_source.record.exchangerate : 1 %]
templates/webpages/order/tabs/_row.html
[% IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation") %]
[% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('sales_edit_prices', 1) %]
[% END %]
[% IF (SELF.type == "purchase_order" || SELF.type == "request_quotation") %]
[% IF (SELF.type == "purchase_order" || SELF.type == "request_quotation" || SELF.type == "purchase_quotation_intake") %]
[% SET RIGHT_TO_EDIT_PRICES = AUTH.assert('purchase_edit_prices', 1) %]
[% END %]
<td>
templates/webpages/order/tabs/basic_data.html
</tr>
[%- END -%]
[%- IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation") -%]
[%- IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "sales_quotation" || SELF.type == "purchase_quotation_intake") -%]
[%- SET quo_nr_txt = 'Quotation Number' -%]
[%- ELSE -%]
[%- SET quo_nr_txt = 'RFQ Number' -%]
......
[%- IF (SELF.type == "sales_order_intake" || SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
[%- SET transdate_txt = 'Order Date' -%]
[%- ELSIF SELF.type == "sales_quotation" -%]
[%- ELSIF (SELF.type == "sales_quotation" || SELF.type == "purchase_quotation_intake") -%]
[%- SET transdate_txt = 'Quotation Date' -%]
[%- ELSE -%]
[%- SET transdate_txt = 'RFQ Date' -%]

Auch abrufbar als: Unified diff