X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FCustomerVendor.pm;h=98b668e3ec7951b1c4477b8295f6b427880d9c7c;hb=fdbdd0b1dbcae7c3b86a9ab532cb3377a4fcfd90;hp=d12fc6edf677efed0e10c41c8d4f238a3242bd6d;hpb=e0f5deeae4cdcf3faf3bc68a202f20ec6cd9af2e;p=kivitendo-erp.git diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index d12fc6edf..98b668e3e 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -101,6 +101,7 @@ sub action_add { $self->_pre_render(); $self->{cv}->assign_attributes(hourly_rate => $::instance_conf->get_customer_hourly_rate) if $self->{cv}->is_customer; + $self->render( 'customer_vendor/form', title => ($self->is_vendor() ? $::locale->text('Add Vendor') : $::locale->text('Add Customer')), @@ -901,11 +902,14 @@ sub _pre_render { $self->{all_salesmen} = SL::DB::Manager::Employee->get_all(query => [ or => [ id => $self->{cv}->salesman_id, deleted => 0 ] ]); } - $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all(); + $self->{all_payment_terms} = SL::DB::Manager::PaymentTerm->get_all_sorted(where => [ or => [ id => $self->{cv}->payment_id, + obsolete => 0 ] ]); $self->{all_delivery_terms} = SL::DB::Manager::DeliveryTerm->get_all(); - $self->{all_pricegroups} = SL::DB::Manager::Pricegroup->get_all(); + if ($self->{cv}->is_customer) { + $self->{all_pricegroups} = SL::DB::Manager::Pricegroup->get_all_sorted(query => [ or => [ id => $self->{cv}->pricegroup_id, obsolete => 0 ] ]); + } $query = 'SELECT DISTINCT(cp_abteilung) AS department @@ -937,6 +941,81 @@ sub _pre_render { $::request->{layout}->add_javascripts('autocomplete_customer.js'); $::request->{layout}->add_javascripts('kivi.CustomerVendor.js'); + $::request->{layout}->add_javascripts('kivi.File.js'); + + $self->_setup_form_action_bar; +} + +sub _setup_form_action_bar { + my ($self) = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + combobox => [ + action => [ + t8('Save'), + submit => [ '#form', { action_save => 1 } ], + checks => [ 'check_taxzone_and_ustid' ], + ], + action => [ + t8('Save and Close'), + submit => [ '#form', { action_save_and_close => 1 } ], + checks => [ 'check_taxzone_and_ustid' ], + ], + ], # end of combobox "Save" + + combobox => [ + action => [ t8('Workflow') ], + (action => [ + t8('Save and AP Transaction'), + submit => [ '#form', { action_save_and_ap_transaction => 1 } ], + checks => [ 'check_taxzone_and_ustid' ], + ]) x !!$self->is_vendor, + (action => [ + t8('Save and AR Transaction'), + submit => [ '#form', { action_save_and_ar_transaction => 1 } ], + checks => [ 'check_taxzone_and_ustid' ], + ]) x !$self->is_vendor, + action => [ + t8('Save and Invoice'), + submit => [ '#form', { action_save_and_invoice => 1 } ], + checks => [ 'check_taxzone_and_ustid' ], + ], + action => [ + t8('Save and Order'), + submit => [ '#form', { action_save_and_order => 1 } ], + checks => [ 'check_taxzone_and_ustid' ], + ], + (action => [ + t8('Save and RFQ'), + submit => [ '#form', { action_save_and_rfq => 1 } ], + checks => [ 'check_taxzone_and_ustid' ], + ]) x !!$self->is_vendor, + (action => [ + t8('Save and Quotation'), + submit => [ '#form', { action_save_and_quotation => 1 } ], + checks => [ 'check_taxzone_and_ustid' ], + ]) x !$self->is_vendor, + ], # end of combobox "Workflow" + + action => [ + t8('Delete'), + submit => [ '#form', { action_delete => 1 } ], + confirm => t8('Do you really want to delete this object?'), + disabled => !$self->{cv}->id ? t8('This object has not been saved yet.') + : !$self->is_orphaned ? t8('This object has already been used.') + : undef, + ], + + 'separator', + + action => [ + t8('History'), + call => [ 'kivi.CustomerVendor.showHistoryWindow', $self->{cv}->id ], + disabled => !$self->{cv}->id ? t8('This object has not been saved yet.') : undef, + ], + ); + } } sub _prepare_cvar_configs_for_ajaj {