X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FCT.pm;h=ab5d70ef4650b0d36ab3d68a2aac6e07eeff77f2;hb=9659649d435c0436ce14048e56b03879ac641429;hp=e97905ae8c5fdb08a321f0b2b32ad213cdb7df22;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/SL/CT.pm b/SL/CT.pm index e97905ae8..ab5d70ef4 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -221,16 +221,22 @@ sub save_customer { my ($self, $myconfig, $form) = @_; + # set pricegroup to default + if ($form->{klass}) { } + else { $form->{klass} = 0; } + # connect to database my $dbh = $form->dbconnect($myconfig); ##LINET - map({ $form->{"cp_${_}"} = $form->{"selected_cp_${_}"} - if ($form->{"selected_cp_${_}"}); + map({ + $form->{"cp_${_}"} = $form->{"selected_cp_${_}"} + if ($form->{"selected_cp_${_}"}); } qw(title greeting)); + # # escape ' map { $form->{$_} =~ s/\'/\'\'/g } - qw(customernumber name street zipcode city country homepage contact notes cp_title cp_greeting language); + qw(customernumber name street zipcode city country homepage contact notes cp_title cp_greeting language pricegroup); ##/LINET # assign value discount, terms, creditlimit $form->{discount} = $form->parse_amount($myconfig, $form->{discount}); @@ -313,8 +319,9 @@ sub save_customer { ustid = '$form->{ustid}', username = '$form->{username}', salesman_id = '$form->{salesman_id}', - user_password = '$form->{user_password}', - c_vendor_id = '$form->{c_vendor_id}' + user_password = | . $dbh->quote($form->{user_password}) . qq|, + c_vendor_id = '$form->{c_vendor_id}', + klass = '$form->{klass}' WHERE id = $form->{id}|; $dbh->do($query) || $form->dberror($query); @@ -349,9 +356,10 @@ sub save_customer { # add shipto $form->add_shipto($dbh, $form->{id}); - $dbh->disconnect; + $rc = $dbh->disconnect; $main::lxdebug->leave_sub(); + return $rc; } sub save_vendor { @@ -362,8 +370,9 @@ sub save_vendor { # connect to database my $dbh = $form->dbconnect($myconfig); ##LINET - map({ $form->{"cp_${_}"} = $form->{"selected_cp_${_}"} - if ($form->{"selected_cp_${_}"}); + map({ + $form->{"cp_${_}"} = $form->{"selected_cp_${_}"} + if ($form->{"selected_cp_${_}"}); } qw(title greeting)); # escape ' @@ -391,7 +400,9 @@ sub save_vendor { } else { my $uid = time; $uid .= $form->{login}; - + my $uid = rand() . time; + $uid .= $form->{login}; + $uid = substr($uid, 2, 75); $query = qq|INSERT INTO vendor (name) VALUES ('$uid')|; $dbh->do($query) || $form->dberror($query); @@ -479,9 +490,10 @@ sub save_vendor { # add shipto $form->add_shipto($dbh, $form->{id}); - $dbh->disconnect; + $rc = $dbh->disconnect; $main::lxdebug->leave_sub(); + return $rc; } sub delete {