"mailto" with ChronoConnectivity

fmejia 16 Mar, 2009
Thank's to Bob's help I got a ChronoForm that will retrieve information from the database and put in on an email using "mailto":

This is how I have it now: A simple ChronoForm with a "submit" button and a text box, in the textbox I enter a search value (DPS#) and under the section called "On Submit code - after sending email" I have the code shown below which on submit will give me a "click here" option that creates the email using "mailto" with the information I have in my database.


<?php
    $db =& JFactory::getDBO();
    $query = "SELECT a.*,b.* FROM `#__tracker` a, `#__agents` b WHERE a.Agentname=b.name and a.DPS =".$db->quote(JRequest::getString('dps', '', 'post'));

    $db->setQuery($query);
    $data = $db->loadObject();
                 $dps = $data->DPS;
                 $OTRactions  = $data->OTRactions;
                 $Agentname  = $data->Agentname;
                 $KickbackReason = $data->KickbackReason;
                 $DPStype = $data->DPStype;
                 $Agentname = $data->Agentname;
                 $manager_email = $data->manager_email;
                 $agent_mail = $data->agent_mail;
                 $poc_email = $data->poc_email;

      $body = "Automated $OTRactions DPS $dps due to the following reason: $KickbackReason";
      $subject = "DPS KICKBACK: $DPStype $dps issued by $Agentname";
      $mailto = "mailto: $agent_mail?cc=$manager_email; $poc_email&subject=$subject&body=$body";
      echo "<a href='$mailto' >Click here</a>";
    ?>



In the other hand the above mentioned email should only be sent to some records in my table that comply with certain criteria, in that matter, I also have a list created with ChronoConnectivity of the records that "comply" with the mentioned criteria.

What I would like to do is to have a page with the list of records that comply with the condition and either next to each record or below the list, have the code that I pasted above that creates the email. Is that possible with CC? if it is, can you assist me with it?
Max_admin 17 Mar, 2009
Hi,

you may add the code above to the HTML area of a chronoform and add a link to the form at the footer section of CC

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
fmejia 17 Mar, 2009
Hello Max, I was able to make it work just the way I wanted it ... embedded in the list... I include the code here for future users that may want the same:

Where:
<?php
$user = JFactory::getUser()
?>
WHERE
OTRactions = "kickback"


Header:
<font face="Century Gothic" size="4" color="#000080"><b>Talisma Tracker for Resolution<br>
<u>Send Kickbacks</u></b><br>
<br>
<br>
</font>

<table style="text-align: left; width: 100%; font-family: Calibri; font-size: 10pt; color: #000000" border="0" cellpadding="2" cellspacing="0">
<tr>
<td style="font-weight: bold; width: 8%;border-right-style:solid; border-right-width:1px; border-bottom-style:solid; border-bottom-width:1px">DPS#</td>
<td style="font-weight: bold; width: 14%;border-right-style:solid; border-right-width:1px; border-bottom-style:solid; border-bottom-width:1px">Date / Time</td>
<td style="font-weight: bold; width: 10%;border-left-style:solid; border-left-width:1px; border-right-style:solid; border-right-width:1px; border-bottom-style:solid; border-bottom-width:1px">Case#</td>
<td style="font-weight: bold; width: 11%; border-left-style:solid; border-left-width:1px; border-right-style:solid; border-right-width:1px; border-bottom-style:solid; border-bottom-width:1px">Tag / Order</td>
<td style="font-weight: bold; width: 10%;border-left-style:solid; border-left-width:1px; border-right-style:solid; border-right-width:1px; border-bottom-style:solid; border-bottom-width:1px">Session ID</td>
<td style="font-weight: bold; width: 15%;border-left-style:solid; border-left-width:1px; border-right-style:solid; border-right-width:1px; border-bottom-style:solid; border-bottom-width:1px">Dispatcher</td>
<td style="font-weight: bold; width: 16%;border-left-style:solid; border-left-width:1px; border-bottom-style:solid; border-bottom-width:1px">Agent Name</td>
</tr>


Body:

<tr<?php if ($i % 2) echo ' style="background-color: #EBEBEB;"';?>>

<td style="width: 8%;border-right-style:solid; border-right-width:1px; border-top-style:solid; border-top-width:1px">

<?php
    $db =& JFactory::getDBO();
$query = "SELECT a.*,b.* FROM #__tracker a, #__agents b WHERE a.Agentname=b.name and a.DPS = '".$row->DPS."'";

    $db->setQuery($query);
    $data = $db->loadObject();
                 $dps = $data->DPS;
                 $OTRactions  = $data->OTRactions;
                 $Agentname  = $data->Agentname;
                 $KickbackReason = $data->KickbackReason;
                 $Comments = $data->Comments;
                 $DPStype = $data->DPStype;
                 $Agentname = $data->Agentname;
                 $manager_email = $data->manager_email;
                 $agent_mail = $data->agent_mail;
                 $poc_email = $data->poc_email;

$body = "Automated $OTRactions DPS $dps due to the following reason: %0D%0D$KickbackReason%0D%0D$Comments";

        $subject = "KICKBACK: $DPStype $dps issued by $Agentname";
        $mailto = "mailto: $agent_mail?cc=$manager_email; $poc_email&subject=$subject&body=$body";
        echo "<a href='$mailto' title='$KickbackReason'>{DPS}</a>";
    ?>
</td>

<td style="width: 14%;border-right-style:solid; border-right-width:1px; border-top-style:solid; border-top-width:1px">{time_date}</td>
<td style="width: 10%;border-left-style:solid; border-left-width:1px; border-right-style:solid; border-right-width:1px; border-top-style:solid; border-top-width:1px">{Case}</td>
<td style="width: 11%;border-left-style:solid; border-left-width:1px; border-right-style:solid; border-right-width:1px; border-top-style:solid; border-top-width:1px">{TagOrder}</td>
<td style="width: 10%;border-left-style:solid; border-left-width:1px; border-right-style:solid; border-right-width:1px; border-top-style:solid; border-top-width:1px">{SessionID}</td>
<td style="width: 15%;border-left-style:solid; border-left-width:1px; border-right-style:solid; border-right-width:1px; border-top-style:solid; border-top-width:1px">{Dispatcher}</td>
<td style="width: 16%;border-left-style:solid; border-left-width:1px; border-top-style:solid; border-top-width:1px">{Agentname}</td>
<?php $i++ ?>
</tr>



Footer:
</table>
<?php $i++ ?>

<br>
<br>

        <script type="text/javascript">
        window.addEvent('domready', function() {
           var limit_select = $('limit').options;
           if ( !limit_select ) return;
           for ( var i = 0; i < limit_select.length; i++ ) {
                if ( limit_select[i].value == 0 ) {
                   limit_select[i].value = 250;
                   limit_select[i].innerHTML = '250';
                }
           }
        });
        </script>
    <div align="left">{pagination}</div>
    <br />


Thank you for your great assistance.. πŸ˜€
Max_admin 17 Mar, 2009
great, thank you for posting it!πŸ™‚

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 17 Mar, 2009
Hi fmejia,

Well done - nice solution.

Bob
fmejia 01 Apr, 2009
Good day guys is me againπŸ™‚ now I am having another issue with the ChronoConnectivity table posted in this thread if my data specifically on a field called "kickbackreason" contains this symbol ' (single quote) in words like didn't, don't, won't etc... it will only show the data before that single quote... can you assist me fixing this?

basically is how can I make this instruction to bring all the information including the info after the quote:
$KickbackReason = $data->KickbackReason;
This topic is locked and no more replies can be posted.