use SL::MoreCommon;
use SL::DB::Default;
use SL::DB::TaxZone;
+use SL::DB::MakeModel;
use SL::DB;
+use SL::Presenter::Part qw(type_abbreviation classification_abbreviation);
use List::Util qw(min);
use strict;
# safety check datev export
if ($::instance_conf->get_datev_check_on_purchase_invoice) {
- # if we need department for kostenstelle in DATEV check
- $form->{department} = SL::DB::Manager::Department->find_by(id => $form->{department_id})->description if $form->{department_id};
- my $transdate = $::form->{invdate} ? DateTime->from_lxoffice($::form->{invdate}) : undef;
- $transdate ||= DateTime->today;
my $datev = SL::DATEV->new(
- exporttype => DATEV_ET_BUCHUNGEN,
- format => DATEV_FORMAT_KNE,
dbh => $dbh,
trans_id => $form->{id},
);
- $datev->export;
+ $datev->generate_datev_data;
if ($datev->errors) {
die join "\n", $::locale->text('DATEV check returned errors:'), $datev->errors;
if (($::form->{"partnumber_$i"} ne '') && ($ref->{ean} eq $::form->{"partnumber_$i"})) {
push @{ $ref->{matches} ||= [] }, $::locale->text('EAN') . ': ' . $ref->{ean};
}
- $ref->{type_and_classific} = $::request->presenter->type_abbreviation($ref->{part_type}).
- $::request->presenter->classification_abbreviation($ref->{classification_id});
+ $ref->{type_and_classific} = type_abbreviation($ref->{part_type}) .
+ classification_abbreviation($ref->{classification_id});
if (! $ref->{used_for_purchase} ) {
$has_wrong_pclass = PCLASS_NOTFORPURCHASE;
chop $ref->{taxaccounts};
$ref->{onhand} *= 1;
-
push @{ $form->{item_list} }, $ref;
}
'trans_id' => $form->{vendor_id});
map { $form->{"vc_cvar_$_->{name}"} = $_->{value} } @{ $custom_variables };
+ if ($form->{cp_id}) {
+ $custom_variables = CVar->get_custom_variables(dbh => $dbh,
+ module => 'Contacts',
+ trans_id => $form->{cp_id});
+ $form->{"cp_cvar_$_->{name}"} = $_->{value} for @{ $custom_variables };
+ }
+
$form->{cp_greeting} = GenericTranslations->get('dbh' => $dbh,
'translation_type' => 'greetings::' . ($form->{cp_gender} eq 'f' ? 'female' : 'male'),
'allow_fallback' => 1);