Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Customer referance in email Subject
06-08-2018, 08:48 AM,
#1
Customer referance in email Subject
Hello,
I'm trying to add Customer Order Ref to the e-mail Subject line for email invoices.
I don't see e-mail Subject in EmailCustTrans.php. In wich file is creation of the Subject line, so that I can analyze this file.
I was thinking to add the following sql to get the Customer Order Re for the invoice to e-mail.:

$SQL = "SELECT customerref
FROM salesorders
LEFT JOIN debtortrans
ON salesorders.orderno=debtortrans.order_
WHERE debtortrans.transno='" .$_GET['FromTransNo'] . "'";

Thank you
Reply
06-08-2018, 11:15 AM, (This post was last modified: 06-08-2018, 02:31 PM by TurboPT.)
#2
RE: Customer referance in email Subject
A query might not be needed (maybe), but here's some more info:

Within the EmailCustTrans.php, after submit, goes to one of two files depending on the System Parameters setting to "Invoice Orientation:"

See lines 17-27 in the EmailCustTrans file, and follow the flow from there.
If other questions should arise, please post another reply.
Reply
06-10-2018, 12:53 AM, (This post was last modified: 06-10-2018, 01:50 AM by TurboPT.)
#3
RE: Customer referance in email Subject
Thank you TurboPT!!
I tested the following solution and it is in production now:

Solution: copy bellow lines to PrintCustTrans.php webERP version 4.14.1, line to replaced 492:

original:
PHP Code:
$mail->SetSubject($InvOrCredit ' ' $FromTransNo); 
new:
PHP Code:
/* Get Customer Order reference no. from salesorders and add it to the email Subject line - start */
        
$sql "SELECT customerref
            FROM salesorders
            LEFT JOIN debtortrans
            ON salesorders.orderno=debtortrans.order_
            WHERE debtortrans.transno='" 
.$_GET['FromTransNo'] . "'";
        
$result=DB_query($sql);
        if (
DB_num_rows($result)==1) {
            
$myrow DB_fetch_array($result);
            
$POnum $myrow['customerref'];
        }
        else { 
$POnum '';
        }
        if (
stripos$POnum'P') !== false || $POnum == '') {
        
$mail->SetSubject($InvOrCredit ' ' $FromTransNo ' ' $POnum );
        }
        else {
        
$mail->SetSubject($InvOrCredit ' ' $FromTransNo ' PO: ' $POnum );
        }

/* Get Customer Order reference no. from salesorders and add it to the email Subject line  - end */ 
Reply
06-10-2018, 02:04 AM, (This post was last modified: 06-10-2018, 02:32 AM by TurboPT.)
#4
RE: Customer referance in email Subject
Assuming that you need that PO information for invoices, know that the customerref field is already part of the query at line 82 in the 4.14.1 version of the PrintCustTrans file, so you should be able to [re]use the data from that query instead?

However, the customerref field is not in the credit notes query at line 159. Assuming that you would want the same info for credit notes, it shouldn't be too much to add salesorders as a LEFT JOIN since the debtortrans table is already in this query to get the customerref info. Then the field would be available for both situations. Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)