/** * Function to get the value of the entity * @param integer $value * @return string $retval */ public static function get_value($value) { $retval = ''; if ((int) $value > 0) { $object = new Potentials(); $retrun_fields = $object->popup_selection_return_field; $retrun_field_list = explode(",", $retrun_fields); $object->query("select " . $retrun_fields . " from potentials where idpotentials = ?", array($value)); if ($object->getNumRows() > 0) { $object->next(); $cnt_return_fields = 0; foreach ($retrun_field_list as $retrun_fields) { if ($cnt_return_fields > 0) { $retval .= ' '; } $retval .= $object->{$retrun_fields}; $cnt_return_fields++; } } } return $retval; }
/** * function to get the complete conversion information * @param integer $idleads * @return array if data found else false */ public function get_conversion_matrix($idleads) { $qry = "select * from `leads_conversion_matrix` where `idleads` = ?"; $this->query($qry, array($idleads)); if ($this->getNumRows() > 0) { $this->next(); if ((int) $this->idpotentials > 0) { $do_potentials = new Potentials(); $q_p = "\n\t\t\t\tselect `potential_name` \n\t\t\t\tfrom `" . $do_potentials->getTable() . "` \n\t\t\t\twhere `idpotentials` = ?"; $do_potentials->query($q_p, array($this->idpotentials)); if ($do_potentials->getNumRows() > 0) { $do_potentials->next(); $return_array["potential"] = array("idpotentials" => (int) $this->idpotentials, "potential_name" => $do_potentials->potential_name); } } if ((int) $this->idorganization > 0) { $do_organization = new Organization(); $q_o = "\n\t\t\t\tselect `organization_name` \n\t\t\t\tfrom `" . $do_organization->getTable() . "` \n\t\t\t\twhere `idorganization` = ?"; $do_organization->query($q_o, array($this->idorganization)); if ($do_organization->getNumRows() > 0) { $do_organization->next(); $return_array["organization"] = array("idorganization" => (int) $this->idorganization, "organization_name" => $do_organization->organization_name); } } if ((int) $this->idcontacts > 0) { $do_contacts = new Contacts(); $q_c = "\n\t\t\t\tselect `firstname`,`lastname` \n\t\t\t\tfrom `" . $do_contacts->getTable() . "` where `idcontacts` = ?"; $do_contacts->query($q_c, array($this->idcontacts)); if ($do_contacts->getNumRows() > 0) { $do_contacts->next(); $return_array["contact"] = array("idcontacts" => (int) $this->idcontacts, "contact_name" => $do_contacts->firstname . ' ' . $do_contacts->lastname); } } $do_user = new User(); $do_user->getId((int) $this->iduser); $return_array["user"] = array("user_name" => $do_user->user_name, "fullname" => $do_user->firstname . ' ' . $do_user->lastname); $return_array["conversion_date"] = array("conversion_date" => i18nDate::i18n_long_date(TimeZoneUtil::convert_to_user_timezone($this->conversion_date, true), true)); return $return_array; } else { return false; } }