Gossamer Forum
Home : Products : DBMan : Customization :

problem external text

Quote Reply
problem external text
i'm using external text file mod to create a db of email messages to send confirmation when user adds a record to other databases. i have the user notify hack in the sub html_add_success and it includes the following:

my ($key, $my_message);
$key = 'register_confirmation';
$my_message = &get_email_text($key);
...
print MAIL "$my_message\n\n";
...

then i have:
sub get_email_text {
my ($type) = @_;
my ($output, $found, @lines, $line, @data, $data);
open (DB, "<messages.db") || &cgierr("unable to open message file. Reason: $!\n");
@lines = <DB>;
close DB;
my $found = 0;
foreach $line (@lines) { # Go through each pass and see if we match..
next if ($line =~ /^$/); # Skip blank lines.
next if ($line =~ /^#/); # Skip Comment lines.
# need to split decode
@data = &split_decode($line);
# then match to email type and database (fields 2 and 3) #set found to key 7/8/2008

if (($data[2] eq $db_match_name) && ($data[3] eq $type)) { $found = $data[0]; last; }
} # end foreach line
if (!$found) { return; }
else {
$found =~ s/<?.B>//g;
if (-e "$HOME/www/private/messages/$found.txt") {
open (TEXT, "<$HOME/www/private/messages/$found.txt") or &cgierr("error in displaying record. unable to open text file $save_text_dir/$found.txt\nReason: $!");
@text = <TEXT>;
close TEXT;
$output = join "",@text;
}
}
# $output .= $found;######## for testing
return $output;
}

all this is working fine for one database. but another database is not printing the external text. the testing line commented above indicated that it found a match because the email included the correct record number. i have looked at the external text files and cannot figure out why one of them isn't printing in the email. earlier today, the missing external text printed for the wrong db but that seems to be corrected now since i set $found = $data[0] and used that for the filename. any ideas what my problem is??? thanks!
Quote Reply
Re: [delicia] problem external text In reply to
still having problems and hope someone can help! the same html_add_success sub is being called for both databases. one sends the external text message fine and the other doesn't. in the external message db, i can view and modify both messages with no problem. the testing lines listed the correct matching info so the get_email_text routine should have opened and read in the external file but still doesn't return one of them. can anyone tell me what to look for?
Quote Reply
Re: [delicia] problem external text In reply to
finally figured it out after testing successfully in a third database. i failed to define $HOME in the problem database cfg.