Example #1
0
	def validate(self):
		self._prev = frappe._dict({
			"contact_date": frappe.db.get_value("Lead", self.name, "contact_date") if \
				(not cint(self.get("__islocal"))) else None,
			"contact_by": frappe.db.get_value("Lead", self.name, "contact_by") if \
				(not cint(self.get("__islocal"))) else None,
		})

		self.set_status()
		self.check_email_id_is_unique()

		if self.email_id:
			if not self.flags.ignore_email_validation:
				validate_email_add(self.email_id, True)

			if self.email_id == self.lead_owner:
				frappe.throw(_("Lead Owner cannot be same as the Lead"))

			if self.email_id == self.contact_by:
				frappe.throw(_("Next Contact By cannot be same as the Lead Email Address"))

			if self.is_new() or not self.image:
				self.image = has_gravatar(self.email_id)

		if self.contact_date and getdate(self.contact_date) < getdate(nowdate()):
			frappe.throw(_("Next Contact Date cannot be in the past"))
Example #2
0
    def validate(self):
        self._prev = frappe._dict(
            {
                "contact_date": frappe.db.get_value("Lead", self.name, "contact_date")
                if (not cint(self.get("__islocal")))
                else None,
                "contact_by": frappe.db.get_value("Lead", self.name, "contact_by")
                if (not cint(self.get("__islocal")))
                else None,
            }
        )

        self.set_status()
        self.check_email_id_is_unique()

        if self.source == "Campaign" and not self.campaign_name and session["user"] != "Guest":
            frappe.throw(_("Campaign Name is required"))

        if self.email_id:
            if not self.flags.ignore_email_validation:
                validate_email_add(self.email_id, True)

            if self.email_id == self.lead_owner:
                # Lead Owner cannot be same as the Lead
                self.lead_owner = None

            self.image = has_gravatar(self.email_id)
Example #3
0
	def validate(self):
		self.set_status()
		self.validate_primary_contact()
		self.set_user()
		if self.email_id:
			self.image = has_gravatar(self.email_id)
		if not self.customer or self.customer.strip() == "":
			self.customer_name = ""
Example #4
0
	def validate(self):
		if self.email_id:
			self.email_id = self.email_id.strip()
		self.set_user()
		if self.email_id and not self.image:
			self.image = has_gravatar(self.email_id)

		deduplicate_dynamic_links(self)
Example #5
0
	def update_gravatar(self):
		if not self.user_image:
			self.user_image = has_gravatar(self.name)
Example #6
0
def update_gravatar(name):
	gravatar = has_gravatar(name)
	if gravatar:
		frappe.db.set_value('User', name, 'user_image', gravatar)
Example #7
0
 def validate(self):
     self.set_status()
     self.validate_primary_contact()
     self.set_user()
     if self.email_id:
         self.image = has_gravatar(self.email_id)
Example #8
0
def update_gravatar(name):
    gravatar = has_gravatar(name)
    if gravatar:
        frappe.db.set_value('User', name, 'user_image', gravatar)
Example #9
0
    def validate(self):
        self.set_user()
        if self.email_id and not self.image:
            self.image = has_gravatar(self.email_id)

        deduplicate_dynamic_links(self)
Example #10
0
	def update_gravatar(self):
		if not self.user_image:
			self.user_image = has_gravatar(self.name)