本文整理汇总了PHP中Organization::getInsertId方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::getInsertId方法的具体用法?PHP Organization::getInsertId怎么用?PHP Organization::getInsertId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Organization
的用法示例。
在下文中一共展示了Organization::getInsertId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: map_related_to_organization
/**
* function to map the ralated to (organization) for potentials while importing
* checks if the organization exists else will add a new one
* @param string $organization_name
* @return integer idorganization
*/
public function map_related_to_organization($organization_name)
{
if (strlen($organization_name) > 2) {
$organization_name = trim($organization_name);
$do_organization = new Organization();
$qry = "\n\t\t\tselect `idorganization` \n\t\t\tfrom `organization` \n\t\t\twhere \n\t\t\t`organization_name` = ?\n\t\t\tAND `deleted` = 0 \n\t\t\tAND `iduser` = " . $_SESSION["do_user"]->iduser;
$do_organization->query($qry, array($organization_name));
if ($do_organization->getNumRows() > 0) {
$do_organization->next();
return $do_organization->idorganization;
} else {
$do_organization->insert("organization", array("organization_name" => CommonUtils::purify_input($organization_name), "iduser" => $_SESSION["do_user"]->iduser));
$idorganization = $do_organization->getInsertId();
//adding the added_on
$q_upd = "\n\t\t\t\tupdate `organization`\n\t\t\t\tset `added_on` = '" . date("Y-m-d H:i:s") . "'\n\t\t\t\twhere `idorganization` = " . $idorganization;
$do_organization->query($q_upd);
$do_organization->insert("organization_custom_fld", array("idorganization" => $idorganization));
$do_organization->insert("organization_address", array("idorganization" => $idorganization));
$do_data_history = new DataHistory();
$do_data_history->add_history($idorganization, 6, 'add');
$do_data_history->free();
return $idorganization;
}
}
}
示例2: map_contact_organization
/**
* function to map organization to contact while importing
* checks if the organization already exists else add a new one
* @param string $organization_name
* @param object $import_object
* @param array $data
* @return integer idorganization
*/
public function map_contact_organization($organization_name, $import_object, $data)
{
$qry = "\n\t\tselect idorganization \n\t\tfrom organization \n\t\twhere organization_name = ?\n\t\tAND deleted = 0\n\t\tAND iduser =" . $_SESSION["do_user"]->iduser;
$stmt = $this->getDbConnection()->executeQuery($qry, array(trim($organization_name)));
if ($stmt->rowCount() > 0) {
$rs = $stmt->fetch();
return $rs["idorganization"];
} else {
if (strlen($organization_name) > 2) {
$mapped_fields = $import_object->get_mapped_fields();
$do_organization = new Organization();
$do_organization->insert("organization", array("organization_name" => CommonUtils::purify_input($organization_name), "iduser" => $_SESSION["do_user"]->iduser));
$idorganization = $do_organization->getInsertId();
$q_upd = "\n\t\t\t\tupdate `organization`\n\t\t\t\tset `added_on` = ?\n\t\t\t\twhere `idorganization` = ?";
$do_organization->query($q_upd, array(date("Y-m-d H:i:s"), $idorganization));
$do_organization->insert("organization_custom_fld", array("idorganization" => $idorganization));
$mapped_fields = $import_object->get_mapped_fields();
if (array_search("cnt_mail_street", $mapped_fields) !== false) {
$org_bill_address = $data[array_search("cnt_mail_street", $mapped_fields)];
} else {
$org_bill_address = '';
}
if (array_search("cnt_mail_pobox", $mapped_fields) !== false) {
$org_bill_pobox = $data[array_search("cnt_mail_pobox", $mapped_fields)];
} else {
$org_bill_pobox = '';
}
if (array_search("cnt_mailing_city", $mapped_fields) !== false) {
$org_bill_city = $data[array_search("cnt_mailing_city", $mapped_fields)];
} else {
$org_bill_city = '';
}
if (array_search("cnt_mailing_state", $mapped_fields) !== false) {
$org_bill_state = $data[array_search("cnt_mailing_state", $mapped_fields)];
} else {
$org_bill_state = '';
}
if (array_search("cnt_mailing_postalcode", $mapped_fields) !== false) {
$org_bill_postalcode = $data[array_search("cnt_mailing_postalcode", $mapped_fields)];
} else {
$org_bill_postalcode = '';
}
if (array_search("cnt_mailing_country", $mapped_fields) !== false) {
$org_bill_country = $data[array_search("cnt_mailing_country", $mapped_fields)];
} else {
$org_bill_country = '';
}
$do_organization->insert("organization_address", array("idorganization" => $idorganization, "org_bill_address" => CommonUtils::purify_input($org_bill_address), "org_bill_pobox" => CommonUtils::purify_input($org_bill_pobox), "org_bill_city" => CommonUtils::purify_input($org_bill_city), "org_bill_state" => CommonUtils::purify_input($org_bill_state), "org_bill_postalcode" => CommonUtils::purify_input($org_bill_postalcode), "org_bill_country" => CommonUtils::purify_input($org_bill_country)));
$do_data_history = new DataHistory();
$do_data_history->add_history($idorganization, 6, 'add');
$do_data_history->free();
return $idorganization;
} else {
return 0;
}
}
}