2013-08-05 09:29:54 +00:00
|
|
|
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
|
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
|
2013-07-16 07:29:23 +00:00
|
|
|
import webnotes
|
|
|
|
from webnotes.utils import extract_email_id
|
|
|
|
|
|
|
|
def execute():
|
|
|
|
email_lead = {}
|
|
|
|
for name, email in webnotes.conn.sql("""select name, email_id from `tabLead`
|
|
|
|
where ifnull(email_id, '')!='' order by creation asc"""):
|
|
|
|
email = extract_email_id(email)
|
|
|
|
if email:
|
|
|
|
if email not in email_lead:
|
|
|
|
email_lead[email] = name
|
|
|
|
else:
|
2013-07-16 09:45:02 +00:00
|
|
|
webnotes.rename_doc("Lead", name, email_lead[email], force=True, merge=True)
|