Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d74d1045

Von Jan Büren vor 2 Tagen hinzugefügt

  • ID d74d104508cf98f48250f3b2234ea0594dace29c
  • Vorgänger fd0c9d0b

zugferd-import-mail: TODOS etwas zuviel copy vom Controller Code ...

Ferner gibt es auch null Unit-Tests, welche die ZUGFeRD Datenstruktur checken

Unterschiede anzeigen:

SL/DB/Helper/ZUGFeRD.pm
801 801
    version            => '1.0',
802 802
  };
803 803
}
804

  
804
# TODO simplify and less incorrect magic. This is only used for automatic imports.
805
# => if no template is found die and don't guess values which the user will never verify visually!
805 806
sub import_zugferd_data {
806 807
  my ($self, $zugferd_parser) = @_;
807 808
  validate_pos(@_,
......
837 838

  
838 839
  # Check IBAN specified on bill matches the one we've got in
839 840
  # the database for this vendor.
841
  # TODO normalize
840 842
  if ($iban) {
841 843
    $intnotes .= "\nIBAN: ";
842 844
    $intnotes .= $iban ne $vendor->iban ?
......
845 847
  }
846 848

  
847 849
  # Use invoice creation date as due date if there's no due date
850
  # NO, check payment settings in template
848 851
  $metadata{'duedate'} = $metadata{'transdate'} unless defined $metadata{'duedate'};
849 852

  
850 853
  # parse dates to kivi if set/valid
......
858 861
                                    day   => $3)->to_kivitendo;
859 862
    }
860 863
  }
861

  
864
  # indention?
862 865
  my $currency = SL::DB::Manager::Currency->find_by(
863 866
    name => $metadata{'currency'},
864 867
    );
865

  
868
  # no pls use template settings
866 869
  my $default_ap_amount_chart = SL::DB::Manager::Chart->find_by(
867 870
    id => $::instance_conf->get_expense_accno_id
868 871
  );
869 872
  # Fallback if there's no default AP amount chart configured
873
  # evil fallback will be executed fully automatic. pls don't do this at home
870 874
  $default_ap_amount_chart ||= SL::DB::Manager::Chart->find_by(charttype => 'A');
871 875

  
872 876
  my $active_taxkey = $default_ap_amount_chart->get_active_taxkey;
......
879 883
  die t8(
880 884
    "No tax found for chart #1", $default_ap_amount_chart->displayable_name
881 885
  ) unless scalar @{$taxes};
882

  
886
  # before wrongly guessing stuff, just load template or die .. move upwards!
883 887
  my %template_params;
884 888
  my $template_ap = SL::DB::Manager::RecordTemplate->get_first(where => [vendor_id => $vendor->id]);
885 889
  if ($template_ap) {
......
906 910
  }
907 911

  
908 912
  my $today = DateTime->today_local;
913
  # good idea, but duedate will always be metadata{duedate} see above
909 914
  my $duedate =
910 915
      $metadata{duedate} ?
911 916
        $metadata{duedate}

Auch abrufbar als: Unified diff