[lms-en] Re: Question

Krzysztof Drewicz hunter at mimuw.edu.pl
Tue May 31 21:49:27 CEST 2005


Tara Johnson napisał(a):

>Sounds good.  Can you tell me what the new features will be?
>
>3) Ability to create email templates (new client welcome letter, etc.)
>that can be sent from from customer detail or from the messaging
>screen
>
>  
>


Ad. 3) There is always " bin/lms-notify --template-file=any_file.txt".

It could be easily changed around line 166:

my $dbq = $dbase->prepare("SELECT customers.id AS id, pin, 
UPPER(lastname) AS lastname, name, email, phone1, SUM((type * -2 + 7) * 
cash.value) AS balance FROM customers LEFT JOIN cash ON customers.id = 
cash.customerid WHERE deleted = 0 GROUP BY customers.id, pin, lastname, 
name, email, phone1 HAVING SUM((type * -2 + 7) * cash.value) < $limit");

Here we say "compute user's balance" and if it is bellow $limit (for 
accounting-related person it would be the other way around if it's above 
$limit) we go further:
Read his/hers name and template file.

If line 166 will be changed to something like:

my $currtime = strftime("%s",localtime());
my $dbq = $dbase->prepare("SELECT customers.id AS id, pin, 
UPPER(lastname) AS lastname, name, email, phone1, SUM((type * -2 + 7) * 
cash.value) AS balance FROM customers LEFT JOIN cash ON customers.id = 
cash.customerid WHERE deleted = 0 GROUP BY customers.id, pin, lastname, 
name, email, phone1 HAVING cdate<=$currtime and cdate >$currtime-86400");

86400=69*60*24

Running it every 24h will do the trick, and send any_file.txt to "new" 
users.

kd.

-- 
Krzysztof Drewicz









More information about the lms-en mailing list