Revision 834abeb4
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
bin/mozilla/ap.pl | ||
---|---|---|
910 | 910 |
$form->{what_done} = "invoice"; |
911 | 911 |
$form->save_history; |
912 | 912 |
} |
913 |
# save zugferd file |
|
914 |
my $file_name = delete $form->{zugferd_session_file}; |
|
915 |
if ($file_name) { |
|
916 |
my $file = SL::SessionFile->new($file_name, mode => '<'); |
|
917 |
if (!$file->fh) { |
|
918 |
SL::Helper::Flash::flash_later('error', |
|
919 |
t8('Could not open ZUGFeRD file for reading: #1', $@)); |
|
920 |
} else { |
|
921 |
|
|
922 |
# copy file to webdav folder |
|
923 |
if ($form->{invnumber} && $::instance_conf->get_webdav_documents) { |
|
924 |
my $webdav = SL::Webdav->new( |
|
925 |
type => 'accounts_payable', |
|
926 |
number => $form->{invnumber}, |
|
927 |
); |
|
928 |
my $webdav_file = SL::Webdav::File->new( |
|
929 |
webdav => $webdav, |
|
930 |
filename => $file_name, |
|
931 |
); |
|
932 |
eval { |
|
933 |
$webdav_file->store(file => $file->file_name()); |
|
934 |
1; |
|
935 |
} or do { |
|
936 |
$form->{zugferd_session_file} = $file_name; |
|
937 |
SL::Helper::Flash::flash_later('error', |
|
938 |
t8('Storing the ZUGFeRD file to the WebDAV folder failed: #1', $@)); |
|
939 |
}; |
|
940 |
} |
|
941 |
if ($form->{id} && $::instance_conf->get_doc_storage) { |
|
942 |
eval { |
|
943 |
SL::File->save( |
|
944 |
object_id => $form->{id}, |
|
945 |
object_type => 'purchase_invoice', |
|
946 |
mime_type => 'application/pdf', |
|
947 |
source => 'uploaded', |
|
948 |
file_type => 'document', |
|
949 |
file_name => $file_name, |
|
950 |
file_path => $file->file_name(), |
|
951 |
); |
|
952 |
1; |
|
953 |
} or do { |
|
954 |
$form->{zugferd_session_file} = $file_name; |
|
955 |
SL::Helper::Flash::flash_later('error', |
|
956 |
t8('Storing the ZUGFeRD file in the storage backend failed: #1', $@)); |
|
957 |
}; |
|
958 |
} |
|
959 |
} |
|
960 |
} |
|
913 | 961 |
|
914 | 962 |
if (!$inline) { |
915 | 963 |
my $msg = $locale->text("AP transaction '#1' posted (ID: #2)", $form->{invnumber}, $form->{id}); |
Auch abrufbar als: Unified diff
ZUGFeRD: speicher ZUGFeRD-Datei zur erstellten Kreditorenbuchung