e2e9916348
Add support for processing incoming Edifact Quotes, Invoices and order responses and generating and transmission of Edifact Orders. Basic workflow is that an incoming quote generates an aquisition basket in Koha, with each line corresponding to an order record The user can then generate an edifact order from this (or another) basket, which is transferred to the vendor's site The supplier generates an invoice on despatch and this will result in corresponding invoices being generated in Koha The orderlines on the invoice are receipted automatically. We also support order response messages. This may include simple order acknowledgements, supplier reports/amendments on availability. Cancellation messages cause the koha order to be cancelled, other messages are recorded against the order Which messages are to be supported/processed is specifiable on a vendor by vendor basis via the admin screens You can also specify auto order i.e. to generate orders from quotes without user intervention - This reflects existing workflows where most work is done on the suppliers website then generating a dummy quote Received messages are stored in the edifact_messages table and the original can be viewed via the online Database changes are in installer/data/mysql/atomicchanges/edifact.sql Note new perl dependencies: Net::SFTP:Foreign Text::Unidecode Signed-off-by: Paul Johnson <p.johnson@staffs.ac.uk> Signed-off-by: Sally Healey <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
41 lines
777 B
Perl
Executable file
41 lines
777 B
Perl
Executable file
#!/usr/bin/perl
|
|
use strict;
|
|
use warnings;
|
|
|
|
use C4::Context;
|
|
|
|
# this script will remove those older than 5 days
|
|
my $tmpdir = '/tmp';
|
|
#
|
|
opendir( my $dh, $tmpdir) || die "Cannot open $tmpdir : $!";
|
|
|
|
my @files_in_tmp = grep { /\.CE[IQ]$/ && -f "$tmpdir/$_" } readdir($dh);
|
|
closedir $dh;
|
|
|
|
|
|
my $dbh = C4::Context->dbh;
|
|
|
|
my $query =<<'ENDSQL';
|
|
select filename from edifact_messages
|
|
where message_type IN ('QUOTE','INVOICE')
|
|
and datediff( CURDATE(), transfer_date ) > 5
|
|
ENDSQL
|
|
|
|
my $ingested;
|
|
|
|
@{$ingested} = $dbh->selectcol_arrayref($query);
|
|
|
|
my %ingested_hash = map { $_ => 1 } @{$ingested};
|
|
|
|
my @delete_list;
|
|
|
|
foreach (@files_in_tmp) {
|
|
if ( exists $ingested_hash{$_} ) {
|
|
push @delete_list, $_;
|
|
}
|
|
}
|
|
|
|
if ( @delete_list ) {
|
|
chdir $tmpdir;
|
|
unlink @delete_list;
|
|
}
|