当前位置: 首页>>代码示例>>PHP>>正文


PHP Organization::getInsertId方法代码示例

本文整理汇总了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;
         }
     }
 }
开发者ID:sQcrm,项目名称:sqcrm,代码行数:31,代码来源:PotentialsImport.class.php

示例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;
         }
     }
 }
开发者ID:sQcrm,项目名称:sqcrm,代码行数:65,代码来源:ContactsImport.class.php


注:本文中的Organization::getInsertId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。