| Index
» Projekty
» phpMyEdit
» Fórum
» Notify option, but using if |
 |
yibo00
Založený: 23.03.2005
Príspevky: 5
Zaslal: 2005-03-23 07:29
Návrat hore
Odpovedať s citátom
|
I have the notify feature working with its default settings sending to one or more people. My wish is instead send to one or more person based on a particular entry during add or update etc.
Quick example:
I want all LA customer record update or inserts to go to one email address and all NY customer record update or inserts to go to another email etc...
This is all based on a dropdown field for customers. Can anything be done to make this work?
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2005-03-24 15:42
Návrat hore
Odpovedať s citátom
|
just create an after trigger which will have code copied form phpMyEdit core class, plus and extra if().
|
yibo00
Založený: 23.03.2005
Príspevky: 5
Zaslal: 2005-03-25 04:17
Návrat hore
Odpovedať s citátom
|
Michal,
I've tried this, but can't seem to get the variable passed to the PME core.
in the trigger file i tried this. I know the Customer variable is present, but some reason the email is not being sent. The mail setup is correct as I can send mail in other functions and using pme's default notify settings.
if ($newvals['Customer']=='ADPS'){
$opts[’notify’][’from’] ='janed@test.com';
$opts[’notify’][’insert’] ='chuckd@test.com';
$opts[’notify’][’update’] ='chukd@test.com';
} elseif ($newvals['Customer']=='NYPD'){
$opts[’notify’][’from’] ='janed@test.com';
$opts[’notify’][’insert’] ='johnd@test.com';
$opts[’notify’][’update’] ='johnd@test.com';
} else {
return false;
}
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2005-03-25 09:50
Návrat hore
Odpovedať s citátom
|
the internal representation is a little different, it's not $opts but
$this->notify['update']
|
yibo00
Založený: 23.03.2005
Príspevky: 5
Zaslal: 2005-03-25 18:45
Návrat hore
Odpovedať s citátom
|
Michal,
Does this look right?
PME call file
I didn't set any of the notify settings in this file i.e,
$opts['notify']['from']
$opts['notify']['update']
All i set was the trigger call.
$opts['triggers']['update']['after'] = 'email.TUA.php';
Heres the email.TUA.php
<?
//echo $newvals['Customer'];
if ($newvals['Customer'] == "NY"){
$this->notify['from'] = 'admin@test.com';
$this->notify['update'] = 'jane@test.com';
}
elseif ($newvals['Customer'] == "LA"){
$this->notify['from'] = 'admin@test.com';
$this->notify['update'] = 'john@test.com';
}
else {
//echo "Nothings happening!";
}
?>
At this point i'm getting the customer value, but no email. Any ideas. Thanks for your help.
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2005-04-04 21:46
Návrat hore
Odpovedať s citátom
|
does it work if you make it a before trigger ?
|
yibo00
Založený: 23.03.2005
Príspevky: 5
Zaslal: 2005-04-05 02:49
Návrat hore
Odpovedať s citátom
|
Either way (Before or After)it seems to get the value of customer, but still does not send to PME core to send email.
|
hsicard
Založený: 22.10.2003
Príspevky: 17
Zaslal: 2006-10-02 15:42
Návrat hore
Odpovedať s citátom
|
Hello yibo!
I have the exact same needs... Did you find a way to achieve this?
Thanks.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|