projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
option to limit the set of characters in random passwords, #40792
[freeside.git]
/
FS
/
FS
/
cust_main_Mixin.pm
diff --git
a/FS/FS/cust_main_Mixin.pm
b/FS/FS/cust_main_Mixin.pm
index
3d05f84
..
de13847
100644
(file)
--- a/
FS/FS/cust_main_Mixin.pm
+++ b/
FS/FS/cust_main_Mixin.pm
@@
-313,8
+313,6
@@
in HASHREF. Valid parameters are:
=item status
=item status
-=item payby
-
=back
=cut
=back
=cut
@@
-339,15
+337,6
@@
sub cust_search_sql {
push @search, $class->$method();
}
push @search, $class->$method();
}
- #payby
- my @payby = ref($param->{'payby'})
- ? @{ $param->{'payby'} }
- : split(',', $param->{'payby'});
- @payby = grep /^([A-Z]{4})$/, @payby;
- if ( @payby ) {
- push @search, 'cust_main.payby IN ('. join(',', map "'$_'", @payby). ')';
- }
-
#here is the agent virtualization
push @search,
$FS::CurrentUser::CurrentUser->agentnums_sql( 'table' => 'cust_main' );
#here is the agent virtualization
push @search,
$FS::CurrentUser::CurrentUser->agentnums_sql( 'table' => 'cust_main' );
@@
-426,6
+415,18
@@
sub email_search_result {
if ( $msgnum ) {
$msg_template = qsearchs('msg_template', { msgnum => $msgnum } )
or die "msgnum $msgnum not found\n";
if ( $msgnum ) {
$msg_template = qsearchs('msg_template', { msgnum => $msgnum } )
or die "msgnum $msgnum not found\n";
+ } else {
+ $msg_template = FS::msg_template->new({
+ from_addr => $from,
+ msgname => $subject, # maybe a timestamp also?
+ disabled => 'D', # 'D'raft
+ # msgclass, maybe
+ });
+ $error = $msg_template->insert(
+ subject => $subject,
+ body => $html_body,
+ );
+ return "$error (when creating draft template)" if $error;
}
my $sql_query = $class->search($param->{'search'});
}
my $sql_query = $class->search($param->{'search'});
@@
-446,7
+447,7
@@
sub email_search_result {
my %sent_to = ();
if ( !$msg_template ) {
my %sent_to = ();
if ( !$msg_template ) {
- # XXX create on the fly
+ die "email_search_result now requires a msg_template";
}
#eventually order+limit magic to reduce memory use?
}
#eventually order+limit magic to reduce memory use?
@@
-516,6
+517,14
@@
sub email_search_result {
}
} # foreach $obj
}
} # foreach $obj
+ # if the message template was created as "draft", change its status to
+ # "completed"
+ if ($msg_template->disabled eq 'D') {
+ $msg_template->set('disabled' => 'C');
+ my $error = $msg_template->replace;
+ warn "$error (setting draft message template status)" if $error;
+ }
+
if(@retry_jobs) {
# fail the job, but with a status message that makes it clear
# something was sent.
if(@retry_jobs) {
# fail the job, but with a status message that makes it clear
# something was sent.
@@
-537,9
+546,6
@@
sub process_email_search_result {
$param->{'search'} = thaw(decode_base64($param->{'search'}))
or die "process_email_search_result requires search params.\n";
$param->{'search'} = thaw(decode_base64($param->{'search'}))
or die "process_email_search_result requires search params.\n";
-# $param->{'payby'} = [ split(/\0/, $param->{'payby'}) ]
-# unless ref($param->{'payby'});
-
my $table = $param->{'table'}
or die "process_email_search_result requires table.\n";
my $table = $param->{'table'}
or die "process_email_search_result requires table.\n";