package OE;
use SL::AM;
+use SL::Common;
use SL::DBUtils;
sub transactions {
$form->get_employee($dbh);
}
- $form->{contact_id} = $form->{cp_id};
- $form->{contact_id} *= 1;
$form->{payment_id} *= 1;
$form->{language_id} *= 1;
$form->{shipto_id} *= 1;
delivery_vendor_id = $form->{delivery_vendor_id},
delivery_customer_id = $form->{delivery_customer_id},
employee_id = $form->{employee_id},
- cp_id = $form->{contact_id}
+ cp_id = | . conv_i($form->{cp_id}, 'NULL') . qq|
WHERE id = $form->{id}|;
$dbh->do($query) || $form->dberror($query);
$form->{ordtotal} = $amount;
- if ($form->{webdav}) {
- &webdav_folder($myconfig, $form);
- }
-
# add shipto
$form->{name} = $form->{ $form->{vc} };
$form->{name} =~ s/--$form->{"$form->{vc}_id"}//;
my $rc = $dbh->commit;
$dbh->disconnect;
+ Common::webdav_folder($form) if ($main::webdav);
+
$main::lxdebug->leave_sub();
return $rc;
my ($self, $myconfig, $form) = @_;
- for my $i (1 .. $form->{rowcount}) {
-
- map {
- $form->{"${_}_$i"} =
- $form->parse_amount($myconfig, $form->{"${_}_$i"})
- } qw(qty ship);
- if ($delete_oe_id) {
- $form->{"orderitems_id_$i"} = "";
- }
-
- if ($form->{"qty_$i"}) {
-
- # set values to 0 if nothing entered
- $form->{"discount_$i"} =
- $form->parse_amount($myconfig, $form->{"discount_$i"});
-
- $form->{"sellprice_$i"} =
- $form->parse_amount($myconfig, $form->{"sellprice_$i"});
- }
- }
-
# get ids from $form
map { push @ids, $form->{"ordnumber_$_"} if $form->{"ordnumber_$_"} }
(1 .. $form->{rowcount});
$form->get_exchangerate($dbh, $form->{currency}, $form->{transdate},
($form->{vc} eq 'customer') ? "buy" : "sell");
- if ($form->{webdav}) {
- &webdav_folder($myconfig, $form);
- }
+ Common::webdav_folder($form) if ($main::webdav);
# get tax zones
$query = qq|SELECT id, description
return $rc;
}
-sub webdav_folder {
- $main::lxdebug->enter_sub();
-
- my ($myconfig, $form) = @_;
-
-SWITCH: {
- $path = "webdav/angebote/" . $form->{quonumber}, last SWITCH
- if ($form->{type} eq "sales_quotation");
- $path = "webdav/bestellungen/" . $form->{ordnumber}, last SWITCH
- if ($form->{type} eq "sales_order");
- $path = "webdav/anfragen/" . $form->{quonumber}, last SWITCH
- if ($form->{type} eq "request_quotation");
- $path = "webdav/lieferantenbestellungen/" . $form->{ordnumber}, last SWITCH
- if ($form->{type} eq "purchase_order");
- }
-
- if (!-d $path) {
- mkdir($path, 0770) or die "can't make directory $!\n";
- } else {
- if ($form->{id}) {
- @files = <$path/*>;
- foreach $file (@files) {
- $file =~ /\/([^\/]*)$/;
- $fname = $1;
- $ENV{'SCRIPT_NAME'} =~ /\/([^\/]*)\//;
- $lxerp = $1;
- $link = "http://" . $ENV{'SERVER_NAME'} . "/" . $lxerp . "/" . $file;
- $form->{WEBDAV}{$fname} = $link;
- }
- }
- }
-
- $main::lxdebug->leave_sub();
-}
1;