.. ================================================== .. FOR YOUR INFORMATION .. -------------------------------------------------- .. -*- coding: utf-8 -*- with BOM. .. include:: ../Includes.txt .. _developer-manual: Developer Manual ================ Target group: **Developers** | With the plugin the 1CRM portal user can manage its 1CRM data, | but the 1CRM portal user creation with the plugin is not possible. | If you want to create 1CRM portal user entity in your 1CRM system, | place the following code in your application: | :: // set email for portal user and contact object: $email = "email of portal user object and contact object"; // create 1CRM portal user object: $iahUser = t3lib_div::makeInstance ("Tx_V4IahLibrary_Domain_Model_IahUser"); $iahUser->setField ("first_name", "portal user's name"); $iahUser->setField ("last_name", "portal user's last name"); $iahUser->setField ("user_name", "_p_" . $email); $iahUser->setField ("portal_only", 1); $iahUser->setField ("status", "Active"); $password = "portal user's password"; $iahUser->setField ("user_hash", md5($password)); $iahUserRepository = t3lib_div::makeInstance ("Tx_V4IahLibrary_Domain_Repository_IahUserRepository"); $iahUserRepository->add ($iahUser); // create 1CRM company object: $iahAccount = t3lib_div::makeInstance ("Tx_V4IahLibrary_Domain_Model_IahAccount"); $iahAccount->setField ("name", "company's name"); $iahAccount->setField ("billing_address_street", "company's address"); $iahAccount->setField ("billing_address_city", "company's city"); $iahAccount->setField ("billing_address_postalcode", "company's zip code"); $iahAccountRepository = t3lib_div::makeInstance ("Tx_V4IahLibrary_Domain_Repository_IahAccountRepository"); $iahAccountRepository->add ($iahAccount); // create 1CM contact object: $iahContact = t3lib_div::makeInstance ("Tx_V4IahLibrary_Domain_Model_IahContact"); $iahContact->setField ("first_name", "contact's first name"); $iahContact->setField ("last_name", "contact's last name"); $iahContact->setField ("email1", "contact's email"); $iahContact->setField ("phone_work", "contact's work phone"); $iahContact->setField ("primary_address_street", "contact's address"); $iahContact->setField ("primary_address_city", "contact's city"); $iahContact->setField ("primary_address_postalcode", "contact's zip code"); $iahContact->setField ("portal_name", "_p_" . $email); $iahContact->setField ("portal_active", 1); $iahContact->setField ("primary_account_id", $iahAccount->getFieldValue ("id")); $iahContactRepository = t3lib_div::makeInstance ("Tx_V4IahLibrary_Domain_Repository_IahContactRepository"); $iahContactRepository->add ($iahContact);