Subversion Repositories SmartDukaan

Rev

Rev 4499 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4499 Rev 4586
Line 5... Line 5...
5
import in.shop2020.purchase.PurchaseOrder;
5
import in.shop2020.purchase.PurchaseOrder;
6
import in.shop2020.thrift.clients.PurchaseClient;
6
import in.shop2020.thrift.clients.PurchaseClient;
7
import in.shop2020.utils.GmailUtils;
7
import in.shop2020.utils.GmailUtils;
8
 
8
 
9
import java.util.ArrayList;
9
import java.util.ArrayList;
-
 
10
import java.util.Arrays;
10
import java.util.List;
11
import java.util.List;
11
 
12
 
12
import org.slf4j.Logger;
13
import org.slf4j.Logger;
13
import org.slf4j.LoggerFactory;
14
import org.slf4j.LoggerFactory;
14
 
15
 
Line 54... Line 55...
54
        try {
55
        try {
55
            PurchaseClient purchaseClient = new PurchaseClient();
56
            PurchaseClient purchaseClient = new PurchaseClient();
56
            in.shop2020.purchase.PurchaseService.Client client = purchaseClient.getClient();
57
            in.shop2020.purchase.PurchaseService.Client client = purchaseClient.getClient();
57
            in.shop2020.purchase.PurchaseOrder purchaseOrder = client.getPurchaseOrder(purchaseOrderId);
58
            in.shop2020.purchase.PurchaseOrder purchaseOrder = client.getPurchaseOrder(purchaseOrderId);
58
            in.shop2020.purchase.Supplier supplier = client.getSupplier(purchaseOrder.getSupplierId());
59
            in.shop2020.purchase.Supplier supplier = client.getSupplier(purchaseOrder.getSupplierId());
59
            
60
 
60
            String filename = PoSheetGenerator.generatePdfSheet(purchaseOrder, supplier);
61
            String filename = PoSheetGenerator.generatePdfSheet(purchaseOrder, supplier);
-
 
62
            List<String> emailIds = new ArrayList<String>(Arrays.asList(supplier.getContactEmail().split(";")));
61
         // FIXME Hardcoding need to be removed.
63
            emailIds.add(supplier.getHeadEmail());
62
            String[] sendTo = { supplier.getContactEmail(), supplier.getHeadEmail(), "nishu_nath786@yahoo.co.in" };
64
            String[] sendTo = emailIds.toArray(new String[0]);
63
            String emailSubjectTxt = "Purchase Order No. " + purchaseOrder.getPoNumber();
65
            String emailSubjectTxt = "Purchase Order No. " + purchaseOrder.getPoNumber();
64
            String emailMsgTxt = "Dear Sir/Madam\n\nCould you please fulfill the attached Purchase Order?\n\nThanks and Regards\nAnand Sinha";
66
            String emailMsgTxt = "Dear Sir/Madam,\n\nCould you please fulfill the attached Purchase Order?\n\nThanks and Regards,\nSandeep Sachdeva";
65
            String emailFromAddress = "cnc.center@shop2020.in";
67
            String emailFromAddress = "cnc.center@shop2020.in";
66
            String password = "5h0p2o2o";
68
            String password = "5h0p2o2o";
67
            GmailUtils mailer = new GmailUtils();
69
            GmailUtils mailer = new GmailUtils();
68
            mailer.sendSSLMessage(sendTo, emailSubjectTxt, emailMsgTxt, emailFromAddress, password, filename);
70
            mailer.sendSSLMessage(sendTo, emailSubjectTxt, emailMsgTxt, emailFromAddress, password, filename);
69
        } catch (Exception e) {
71
        } catch (Exception e) {