projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Volltext-Suche: changelog
[kivitendo-erp.git]
/
SL
/
Common.pm
diff --git
a/SL/Common.pm
b/SL/Common.pm
index
f6a7267
..
126a30e
100644
(file)
--- a/
SL/Common.pm
+++ b/
SL/Common.pm
@@
-25,6
+25,7
@@
use Encode qw(decode);
use SL::DBUtils;
use SL::DB;
use SL::DBUtils;
use SL::DB;
+use SL::HTML::Util;
sub unique_id {
my ($a, $b) = gettimeofday();
sub unique_id {
my ($a, $b) = gettimeofday();
@@
-67,14
+68,14
@@
sub retrieve_parts {
}
if ($form->{no_assemblies}) {
}
if ($form->{no_assemblies}) {
- $filter .= qq| AND (NOT
COALESCE(assembly, FALSE)
)|;
+ $filter .= qq| AND (NOT
part_type = 'assembly'
)|;
}
if ($form->{assemblies}) {
}
if ($form->{assemblies}) {
- $filter .= qq| AND
assembly=TRUE
|;
+ $filter .= qq| AND
part_type = 'assembly'
|;
}
if ($form->{no_services}) {
}
if ($form->{no_services}) {
- $filter .= qq| AND
(inventory_accno_id is not NULL or assembly=TRUE
)|;
+ $filter .= qq| AND
NOT (part_type = 'service' OR part_type = 'assembly'
)|;
}
substr($filter, 1, 3) = "WHERE" if ($filter);
}
substr($filter, 1, 3) = "WHERE" if ($filter);
@@
-342,6
+343,11
@@
sub get_vc_details {
$query = qq|SELECT * FROM shipto WHERE (trans_id = ?)|;
$form->{SHIPTO} = selectall_hashref_query($form, $dbh, $query, $vc_id);
$query = qq|SELECT * FROM shipto WHERE (trans_id = ?)|;
$form->{SHIPTO} = selectall_hashref_query($form, $dbh, $query, $vc_id);
+ if ($vc eq 'customer') {
+ $query = qq|SELECT * FROM additional_billing_addresses WHERE (customer_id = ?)|;
+ $form->{ADDITIONAL_BILLING_ADDRESSES} = selectall_hashref_query($form, $dbh, $query, $vc_id);
+ }
+
$query = qq|SELECT * FROM contacts WHERE (cp_cv_id = ?)|;
$form->{CONTACTS} = selectall_hashref_query($form, $dbh, $query, $vc_id);
$query = qq|SELECT * FROM contacts WHERE (cp_cv_id = ?)|;
$form->{CONTACTS} = selectall_hashref_query($form, $dbh, $query, $vc_id);
@@
-382,6
+388,8
@@
sub save_email_status {
my ($self, $myconfig, $form) = @_;
my ($self, $myconfig, $form) = @_;
+ return unless ($::instance_conf->get_email_journal);
+
my ($table, $query, $dbh);
if ($form->{script} eq 'oe.pl') {
my ($table, $query, $dbh);
if ($form->{script} eq 'oe.pl') {
@@
-418,7
+426,7
@@
sub save_email_status {
. $main::locale->text('To (email)') . ": $form->{email}\n"
. "${cc}${bcc}"
. $main::locale->text('Subject') . ": $form->{subject}\n\n"
. $main::locale->text('To (email)') . ": $form->{email}\n"
. "${cc}${bcc}"
. $main::locale->text('Subject') . ": $form->{subject}\n\n"
- . $main::locale->text('Message') . ":
$form->{message}"
;
+ . $main::locale->text('Message') . ":
" . SL::HTML::Util->strip($form->{message})
;
$intnotes =~ s|\r||g;
$intnotes =~ s|\r||g;
@@
-539,16
+547,16
@@
sub copy_file_to_webdav_folder {
foreach my $item (qw(tmpdir tmpfile type)){
next if $form->{$item};
$::lxdebug->message(LXDebug::WARN(), 'Missing parameter:' . $item);
foreach my $item (qw(tmpdir tmpfile type)){
next if $form->{$item};
$::lxdebug->message(LXDebug::WARN(), 'Missing parameter:' . $item);
- $::form->error($::locale->text("Missing parameter for WebDAV file copy"));
+ $::lxdebug->leave_sub();
+ return $::locale->text("Missing parameter for WebDAV file copy");
}
my ($webdav_folder, $document_name) = get_webdav_folder($form);
if (! $webdav_folder){
}
my ($webdav_folder, $document_name) = get_webdav_folder($form);
if (! $webdav_folder){
- $::lxdebug->leave_sub();
$::lxdebug->message(LXDebug::WARN(), 'Cannot check correct WebDAV folder');
$::lxdebug->message(LXDebug::WARN(), 'Cannot check correct WebDAV folder');
- $::
form->error($::locale->text("Cannot check correct WebDAV folder")
);
- return
undef;
+ $::
lxdebug->leave_sub(
);
+ return
$::locale->text("Cannot check correct WebDAV folder")
}
$complete_path = File::Spec->catfile($form->{cwd}, $webdav_folder);
}
$complete_path = File::Spec->catfile($form->{cwd}, $webdav_folder);
@@
-562,7
+570,11
@@
sub copy_file_to_webdav_folder {
chdir($current_dir);
}
chdir($current_dir);
}
- opendir my $dh, $complete_path or die "Could not open $complete_path: $!";
+ my $dh;
+ if (!opendir $dh, $complete_path) {
+ $::lxdebug->leave_sub();
+ return "Could not open $complete_path: $!";
+ }
my ($newest_name, $newest_time);
while ( defined( my $file = readdir( $dh ) ) ) {
my ($newest_name, $newest_time);
while ( defined( my $file = readdir( $dh ) ) ) {
@@
-584,15
+596,19
@@
sub copy_file_to_webdav_folder {
return;
}
return;
}
+ $form->{attachment_filename} ||= $form->generate_attachment_filename;
+
my $timestamp = get_current_formatted_time();
my $timestamp = get_current_formatted_time();
- my $new_file = File::Spec->catfile($form->{cwd}, $webdav_folder, $form->
generate_attachment_filename()
);
+ my $new_file = File::Spec->catfile($form->{cwd}, $webdav_folder, $form->
{attachment_filename}
);
$new_file =~ s{(.*)\.}{$1$timestamp\.};
if (!File::Copy::copy($current_file, $new_file)) {
$::lxdebug->message(LXDebug::WARN(), "Copy file from $current_file to $new_file failed: $ERRNO");
$new_file =~ s{(.*)\.}{$1$timestamp\.};
if (!File::Copy::copy($current_file, $new_file)) {
$::lxdebug->message(LXDebug::WARN(), "Copy file from $current_file to $new_file failed: $ERRNO");
- $::form->error($::locale->text("Copy file from #1 to #2 failed: #3", $current_file, $new_file, $ERRNO));
+ $::lxdebug->leave_sub();
+ return $::locale->text("Copy file from #1 to #2 failed: #3", $current_file, $new_file, $ERRNO);
}
}
+ return;
$::lxdebug->leave_sub();
}
$::lxdebug->leave_sub();
}
@@
-632,6
+648,11
@@
C<full> (replace consecutive line feed/carriage return characters in
the middle by a single space and remove tailing line feed/carriage
return characters).
the middle by a single space and remove tailing line feed/carriage
return characters).
+=item C<save_email_status>
+
+Adds sending information to internal notes.
+Does nothing if the client config email_journal is enabled.
+
=back
=head1 BUGS
=back
=head1 BUGS