$self->_pre_render();
$self->render(
'order/form',
- title => $self->type eq _sales_order_type() ? $::locale->text('Add Sales Order')
- : $self->type eq _purchase_order_type() ? $::locale->text('Add Purchase Order')
+ title => $self->type eq _sales_order_type() ? $::locale->text('Add Sales Order')
+ : $self->type eq _purchase_order_type() ? $::locale->text('Add Purchase Order')
+ : $self->type eq _sales_quotation_type() ? $::locale->text('Add Quotation')
+ : $self->type eq _request_quotation_type() ? $::locale->text('Add Request for Quotation')
: '',
%{$self->{template_args}}
);
$self->_pre_render();
$self->render(
'order/form',
- title => $self->type eq _sales_order_type() ? $::locale->text('Edit Sales Order')
- : $self->type eq _purchase_order_type() ? $::locale->text('Edit Purchase Order')
+ title => $self->type eq _sales_order_type() ? $::locale->text('Edit Sales Order')
+ : $self->type eq _purchase_order_type() ? $::locale->text('Edit Purchase Order')
+ : $self->type eq _sales_quotation_type() ? $::locale->text('Edit Quotation')
+ : $self->type eq _request_quotation_type() ? $::locale->text('Edit Request for Quotation')
: '',
%{$self->{template_args}}
);
return $self->js->render();
}
- flash_later('info', $::locale->text('The order has been deleted'));
+ my $text = $self->type eq _sales_order_type() ? $::locale->text('The order 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')
+ : '';
+ flash_later('info', $text);
+
my @redirect_params = (
action => 'add',
type => $self->type,
return $self->js->render();
}
- flash_later('info', $::locale->text('The order has been saved'));
+ my $text = $self->type eq _sales_order_type() ? $::locale->text('The order 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')
+ : '';
+ flash_later('info', $text);
+
my @redirect_params = (
action => 'edit',
type => $self->type,
$self->js->flash('error', $_) foreach @{ $errors };
return $self->js->render();
}
- flash_later('info', $::locale->text('The order has been saved'));
+
+ my $text = $self->type eq _sales_order_type() ? $::locale->text('The order 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')
+ : '';
+ flash_later('info', $text);
my @redirect_params = (
controller => 'oe.pl',
$self->js->flash('error', $_) foreach @{ $errors };
return $self->js->render();
}
- flash_later('info', $::locale->text('The order has been saved'));
+
+ my $text = $self->type eq _sales_order_type() ? $::locale->text('The order 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')
+ : '';
+ flash_later('info', $text);
my @redirect_params = (
controller => 'oe.pl',
#
sub init_valid_types {
- [ _sales_order_type(), _purchase_order_type() ];
+ [ _sales_order_type(), _purchase_order_type(), _sales_quotation_type(), _request_quotation_type() ];
}
sub init_type {
sub init_cv {
my ($self) = @_;
- my $cv = $self->type eq _sales_order_type() ? 'customer'
- : $self->type eq _purchase_order_type() ? 'vendor'
+ my $cv = (any { $self->type eq $_ } (_sales_order_type(), _sales_quotation_type())) ? 'customer'
+ : (any { $self->type eq $_ } (_purchase_order_type(), _request_quotation_type())) ? 'vendor'
: die "Not a valid type for order";
return $cv;
# order here solves this problem.
my $order;
$order = SL::DB::Manager::Order->find_by(id => $::form->{id}) if $::form->{id};
- $order ||= SL::DB::Order->new(orderitems => []);
+ $order ||= SL::DB::Order->new(orderitems => [],
+ quotation => (any { $self->type eq $_ } (_sales_quotation_type(), _request_quotation_type())));
my $form_orderitems = delete $::form->{order}->{orderitems};
my $form_periodic_invoices_config = delete $::form->{order}->{periodic_invoices_config};
$self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all_sorted();
$self->{current_employee_id} = SL::DB::Manager::Employee->current->id;
$self->{periodic_invoices_status} = $self->_get_periodic_invoices_status($self->order->periodic_invoices_config);
+ $self->{order_probabilities} = [ map { { title => ($_ * 10) . '%', id => $_ * 10 } } (0..10) ];
my $print_form = Form->new('');
$print_form->{type} = $self->type;
sub _setup_edit_action_bar {
my ($self, %params) = @_;
- my $deletion_allowed = (($self->cv eq 'customer') && $::instance_conf->get_sales_order_show_delete)
- || (($self->cv eq 'vendor') && $::instance_conf->get_purchase_order_show_delete);
+ my $deletion_allowed = (any { $self->type eq $_ } (_sales_quotation_type(), _request_quotation_type()))
+ || (($self->type eq _sales_order_type()) && $::instance_conf->get_sales_order_show_delete)
+ || (($self->type eq _purchase_order_type()) && $::instance_conf->get_purchase_order_show_delete);
for my $bar ($::request->layout->get('actionbar')) {
$bar->add(
t8('Save and Delivery Order'),
call => [ 'kivi.Order.save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ],
checks => [ 'kivi.Order.check_save_active_periodic_invoices' ],
+ only_if => (any { $self->type eq $_ } (_sales_order_type(), _purchase_order_type()))
],
action => [
t8('Save and Invoice'),
'purchase_order';
}
+sub _sales_quotation_type {
+ 'sales_quotation';
+}
+
+sub _request_quotation_type {
+ 'request_quotation';
+}
+
1;
__END__