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


PHP Contact::delete方法代码示例

本文整理汇总了PHP中Contact::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Contact::delete方法的具体用法?PHP Contact::delete怎么用?PHP Contact::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contact的用法示例。


在下文中一共展示了Contact::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAllOpenIDs

 /**
  * allOpenIDs() method - get all OpenIDs for the given contact
  */
 function testAllOpenIDs()
 {
     $contactId = Contact::createIndividual();
     // create first openid
     $params = array('contact_id' => $contactId, 'location_type_id' => 1, 'endpoint_url' => $openid['endpoint_url'], 'claimed_id' => $openid['claimed_id'], 'display_id' => $openid['display_id'], 'is_primary' => 1, 'allowed_to_login' => 1);
     require_once 'CRM/Core/BAO/OpenID.php';
     $openObjectOne = CRM_Core_BAO_OpenID::add($params);
     $openIdOne_id = $openObjectOne->id;
     $this->assertDBCompareValues('CRM_Core_DAO_OpenID', array('id' => $openIdOne_id), $openid);
     // create second openid
     $params = array('contact_id' => $contactId, 'location_type_id' => 1, 'endpoint_url' => $openid_two['endpoint_url'], 'claimed_id' => $openid_two['claimed_id'], 'display_id' => $openid_two['display_id']);
     $openObjectTwo = CRM_Core_BAO_OpenID::add($params);
     $openIdTwo_id = $openObjectTwo->id;
     $this->assertDBCompareValues('CRM_Core_DAO_OpenID', array('id' => $openIdTwo_id), $openid_two);
     // obtain all openids for the contact
     $openIds = CRM_Core_BAO_OpenID::allOpenIDs($contactId);
     // check number of openids for the contact
     $this->assertEquals(count($openIds), 2, 'Checking number of returned OpenIDs.');
     // check first openid values
     $this->assertAttributesEquals($openid, $openIds[$openIdOne_id]);
     $this->assertEquals(1, $openIds[$openIdOne_id]['is_primary'], 'Confirm is_primary field value.');
     $this->assertEquals(1, $openIds[$openIdOne_id]['allowed_to_login'], 'Confirm allowed_to_login field value.');
     // check second openid values
     $this->assertAttributesEquals($openid_two, $openIds[$openIdTwo_id]);
     $this->assertEquals(0, $openIds[$openIdTwo_id]['is_primary'], 'Confirm is_primary field value for second openid.');
     $this->assertEquals(0, $openIds[$openIdTwo_id]['allowed_to_login'], 'Confirm allowed_to_login field value for second openid.');
     Contact::delete($contactId);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:31,代码来源:OpenIDTest.php

示例2: delete

 function delete($id)
 {
     if ($id) {
         $rs = new Contact($id);
         $rs->delete();
         set_notify('success', lang('delete_data_complete'));
     }
     redirect($_SERVER['HTTP_REFERER']);
 }
开发者ID:unisexx,项目名称:imac,代码行数:9,代码来源:contacts.php

示例3: deleteDupeContacts

 public function deleteDupeContacts()
 {
     // delete all created contacts
     foreach ($this->_contactIds as $contactId) {
         Contact::delete($contactId);
     }
     // delete dupe group
     $params = array('id' => $this->_groupId, 'version' => 3);
     civicrm_api('group', 'delete', $params);
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:10,代码来源:MergerTest.php

示例4: testAllEmails

 /**
  * AllEmails() method - get all emails for our contact, with primary email first
  */
 public function testAllEmails()
 {
     $contactParams = array('first_name' => 'Alan', 'last_name' => 'Smith', 'email-1' => 'alan.smith1@example.com', 'email-2' => 'alan.smith2@example.com', 'email-3' => 'alan.smith3@example.com');
     $contactId = Contact::createIndividual($contactParams);
     $emails = CRM_Core_BAO_Email::allEmails($contactId);
     $this->assertEquals(count($emails), 3, 'Checking number of returned emails.');
     $firstEmailValue = array_slice($emails, 0, 1);
     $this->assertEquals('alan.smith1@example.com', $firstEmailValue[0]['email'], 'Confirm primary email address value.');
     $this->assertEquals(1, $firstEmailValue[0]['is_primary'], 'Confirm first email address is primary.');
     Contact::delete($contactId);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:14,代码来源:EmailTest.php

示例5: testAllIMs

 /**
  * AllIMs() method - get all IMs for our contact, with primary IM first
  */
 public function testAllIMs()
 {
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn, $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/im_test.xml'));
     $contactId = 69;
     $IMs = CRM_Core_BAO_IM::allIMs($contactId);
     $this->assertEquals(count($IMs), 3, 'Checking number of returned IMs.');
     $firstIMValue = array_slice($IMs, 0, 1);
     $this->assertEquals('alan1.smith1', $firstIMValue[0]['name'], 'Confirm primary IM value.');
     $this->assertEquals(1, $firstIMValue[0]['is_primary'], 'Confirm first IM is primary.');
     Contact::delete($contactId);
 }
开发者ID:sdekok,项目名称:civicrm-core,代码行数:15,代码来源:IMTest.php

示例6: testAllPhones

 /**
  * AllPhones() method - get all Phones for our contact, with primary Phone first
  */
 public function testAllPhones()
 {
     $contactParams = array('first_name' => 'Alan', 'last_name' => 'Smith', 'phone-1' => '(415) 222-1011 x 221', 'phone-2' => '(415) 222-5432');
     $contactId = Contact::createIndividual($contactParams);
     $Phones = CRM_Core_BAO_Phone::allPhones($contactId);
     $this->assertEquals(count($Phones), 2, 'Checking number of returned Phones.');
     $firstPhoneValue = array_slice($Phones, 0, 1);
     // Since we're not passing in a location type to createIndividual above, CRM_Contact_BAO_Contact::createProfileContact uses default location
     // type for first phone and sets that to primary.
     $this->assertEquals('(415) 222-1011 x 221', $firstPhoneValue[0]['phone'], "Confirm primary Phone value ( {$firstPhoneValue[0]['phone']} ).");
     $this->assertEquals(1, $firstPhoneValue[0]['is_primary'], 'Confirm first Phone is primary.');
     Contact::delete($contactId);
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:16,代码来源:PhoneTest.php

示例7: delete

 /**
  * Delete contact
  *
  * @param   int     $id Contact ID
  * @return  array
  * 
  * @url	DELETE contact/{id}
  */
 function delete($id)
 {
     if (!DolibarrApiAccess::$user->rights->contact->supprimer) {
         throw new RestException(401);
     }
     $result = $this->contact->fetch($id);
     if (!$result) {
         throw new RestException(404, 'Contact not found');
     }
     if (!DolibarrApi::_checkAccessToResource('contact', $this->contact->id, 'socpeople&societe')) {
         throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
     }
     return $this->contact->delete($id);
 }
开发者ID:Samara94,项目名称:dolibarr,代码行数:22,代码来源:api_contact.class.php

示例8: testCustomGroupMultipleOldFormate

 public function testCustomGroupMultipleOldFormate()
 {
     $params = array();
     $contactID = Contact::createIndividual();
     $customGroup = Custom::createGroup($params, 'Individual', TRUE);
     $fields = array('groupId' => $customGroup->id, 'dataType' => 'String', 'htmlType' => 'Text');
     $customField = Custom::createField($params, $fields);
     $params = array('entityID' => $contactID, "custom_{$customField->id}" => 'First String');
     $error = CRM_Core_BAO_CustomValueTable::setValues($params);
     $newParams = array('entityID' => $contactID, "custom_{$customField->id}" => 1);
     $result = CRM_Core_BAO_CustomValueTable::getValues($newParams);
     $this->assertEquals($params["custom_{$customField->id}"], $result["custom_{$customField->id}_1"]);
     $this->assertEquals($params['entityID'], $result['entityID']);
     Custom::deleteField($customField);
     Custom::deleteGroup($customGroup);
     Contact::delete($contactID);
 }
开发者ID:sdekok,项目名称:civicrm-core,代码行数:17,代码来源:CustomValueTableMultipleTest.php

示例9: testStaleMembership

 /**
  * Renew stale membership.
  */
 public function testStaleMembership()
 {
     $statusId = 3;
     $contactId = Contact::createIndividual();
     $joinDate = $startDate = date("Ymd", strtotime(date("Ymd") . " -1 year -15 days"));
     $endDate = date("Ymd", strtotime($joinDate . " +1 year -1 day"));
     $params = array('contact_id' => $contactId, 'membership_type_id' => $this->_membershipTypeID, 'join_date' => $joinDate, 'start_date' => $startDate, 'end_date' => $endDate, 'source' => 'Payment', 'status_id' => $statusId);
     $ids = array();
     $membership = CRM_Member_BAO_Membership::create($params, $ids);
     $membershipId = $this->assertDBNotNull('CRM_Member_BAO_Membership', $contactId, 'id', 'contact_id', 'Database check for created membership.');
     $this->assertEquals($membership->status_id, $statusId, 'Verify correct status id is calculated.');
     $this->assertEquals($membership->membership_type_id, $this->_membershipTypeID, 'Verify correct membership type id.');
     //verify all dates.
     $dates = array('startDate' => 'start_date', 'joinDate' => 'join_date', 'endDate' => 'end_date');
     foreach ($dates as $date => $dbDate) {
         $this->assertEquals($membership->{$dbDate}, ${$date}, "Verify correct {$date} is present.");
     }
     $this->assertDBNotNull('CRM_Member_BAO_MembershipLog', $membership->id, 'id', 'membership_id', 'Database checked on membershiplog record.');
     // this is a test and we dont want qfKey generation / validation
     // easier to suppress it, than change core code
     $config = CRM_Core_Config::singleton();
     $config->keyDisable = TRUE;
     $membershipRenewal = new CRM_Core_Form();
     $membershipRenewal->controller = new CRM_Core_Controller();
     list($MembershipRenew) = CRM_Member_BAO_Membership::renewMembership($contactId, $this->_membershipTypeID, FALSE, $membershipRenewal, NULL, NULL, NULL, 1, NULL, NULL, NULL, FALSE, NULL);
     $this->assertDBNotNull('CRM_Member_BAO_MembershipLog', $MembershipRenew->id, 'id', 'membership_id', 'Database checked on membershiplog record.');
     $this->membershipDelete($membershipId);
     Contact::delete($contactId);
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:32,代码来源:MembershipTest.php

示例10: testfixEventLevel

 /**
  * FixEventLevel() method (Setting ',' values), resolveDefaults(assinging value to array) method
  */
 public function testfixEventLevel()
 {
     $paramsSet['title'] = 'Price Set';
     $paramsSet['name'] = CRM_Utils_String::titleToVar('Price Set');
     $paramsSet['is_active'] = FALSE;
     $paramsSet['extends'] = 1;
     $priceset = CRM_Price_BAO_PriceSet::create($paramsSet);
     //Checking for priceset added in the table.
     $this->assertDBCompareValue('CRM_Price_BAO_PriceSet', $priceset->id, 'title', 'id', $paramsSet['title'], 'Check DB for created priceset');
     $paramsField = array('label' => 'Price Field', 'name' => CRM_Utils_String::titleToVar('Price Field'), 'html_type' => 'Text', 'price' => 10, 'option_label' => array('1' => 'Price Field'), 'option_value' => array('1' => 10), 'option_name' => array('1' => 10), 'option_weight' => array('1' => 1), 'is_display_amounts' => 1, 'weight' => 1, 'options_per_line' => 1, 'is_active' => array('1' => 1), 'price_set_id' => $priceset->id, 'is_enter_qty' => 1);
     $ids = array();
     $pricefield = CRM_Price_BAO_PriceField::create($paramsField, $ids);
     //Checking for priceset added in the table.
     $this->assertDBCompareValue('CRM_Price_BAO_PriceField', $pricefield->id, 'label', 'id', $paramsField['label'], 'Check DB for created pricefield');
     $eventId = $this->_eventId;
     $participantParams = array('send_receipt' => 1, 'is_test' => 0, 'is_pay_later' => 0, 'event_id' => $eventId, 'register_date' => date('Y-m-d') . " 00:00:00", 'role_id' => 1, 'status_id' => 1, 'source' => 'Event_' . $eventId, 'contact_id' => $this->_contactId, 'note' => 'Note added for Event_' . $eventId, 'fee_level' => 'Price_Field - 55');
     $participant = CRM_Event_BAO_Participant::add($participantParams);
     //Checking for participant added in the table.
     $this->assertDBCompareValue('CRM_Event_BAO_Participant', $this->_contactId, 'id', 'contact_id', $participant->id, 'Check DB for created participant');
     $values = array();
     $ids = array();
     $params = array('id' => $participant->id);
     CRM_Event_BAO_Participant::getValues($params, $values, $ids);
     $this->assertNotEquals(count($values), 0, 'Checking for empty array.');
     CRM_Event_BAO_Participant::resolveDefaults($values[$participant->id]);
     if ($values[$participant->id]['fee_level']) {
         CRM_Event_BAO_Participant::fixEventLevel($values[$participant->id]['fee_level']);
     }
     $deletePricefield = CRM_Price_BAO_PriceField::deleteField($pricefield->id);
     $this->assertDBNull('CRM_Price_BAO_PriceField', $pricefield->id, 'name', 'id', 'Check DB for non-existence of Price Field.');
     $deletePriceset = CRM_Price_BAO_PriceSet::deleteSet($priceset->id);
     $this->assertDBNull('CRM_Price_BAO_PriceSet', $priceset->id, 'title', 'id', 'Check DB for non-existence of Price Set.');
     Participant::delete($participant->id);
     Contact::delete($this->_contactId);
     Event::delete($eventId);
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:39,代码来源:ParticipantTest.php

示例11: testGetActiveGroups

 function testGetActiveGroups()
 {
     $contactId = Contact::createIndividual();
     $customGrouptitle = 'Test Custom Group';
     $groupParams = array('title' => $customGrouptitle, 'name' => 'test_custom_group', 'style' => 'Tab', 'extends' => 'Individual', 'weight' => 10, 'is_active' => 1);
     $customGroup = Custom::createGroup($groupParams);
     require_once 'CRM/Core/BAO/CustomGroup.php';
     $activeGroup = CRM_Core_BAO_CustomGroup::getActiveGroups('Individual', 'civicrm/contact/view/cd', $contactId);
     foreach ($activeGroup as $key => $value) {
         if ($value['id'] == $customGroup->id) {
             $this->assertEquals($value['path'], 'civicrm/contact/view/cd');
             $this->assertEquals($value['title'], $customGrouptitle);
             $query = 'reset=1&gid=' . $customGroup->id . '&cid=' . $contactId;
             $this->assertEquals($value['query'], $query);
         }
     }
     Custom::deleteGroup($customGroup);
     Contact::delete($contactId);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:19,代码来源:CustomGroupTest.php

示例12: testDelete

 /**
  * @covers Moneybird\Contact::delete
  */
 public function testDelete()
 {
     $this->object->delete($this->service);
     $this->setExpectedException('Moneybird\\NotFoundException');
     $this->service->getById(self::$contactId);
 }
开发者ID:ruudk,项目名称:moneybird_php_api,代码行数:9,代码来源:ContactTest.php

示例13: sprintf

    $contact->check($_GET["id"], READ);
    $contact->generateVcard();
} else {
    if (isset($_POST["add"])) {
        $contact->check(-1, CREATE, $_POST);
        if ($newID = $contact->add($_POST)) {
            Event::log($newID, "contacts", 4, "financial", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
            if ($_SESSION['glpibackcreated']) {
                Html::redirect($contact->getFormURL() . "?id=" . $newID);
            }
        }
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
            $contact->check($_POST["id"], DELETE);
            if ($contact->delete($_POST)) {
                Event::log($_POST["id"], "contacts", 4, "financial", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
            }
            $contact->redirectToList();
        } else {
            if (isset($_POST["restore"])) {
                $contact->check($_POST["id"], DELETE);
                if ($contact->restore($_POST)) {
                    Event::log($_POST["id"], "contacts", 4, "financial", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
                }
                $contact->redirectToList();
            } else {
                if (isset($_POST["purge"])) {
                    $contact->check($_POST["id"], PURGE);
                    if ($contact->delete($_POST, 1)) {
                        Event::log($_POST["id"], "contacts", 4, "financial", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
开发者ID:jose-martins,项目名称:glpi,代码行数:31,代码来源:contact.form.php

示例14: testcheckDuplicateIds

 /**
  * Check duplicate contribution id 
  * during the contribution import
  * checkDuplicateIds();
  */
 function testcheckDuplicateIds()
 {
     $contactId = Contact::createIndividual();
     $ids = array('contribution' => null);
     $param = array('contact_id' => $contactId, 'currency' => 'USD', 'contribution_type_id' => 1, 'contribution_status_id' => 1, 'payment_instrument_id' => 1, 'source' => 'STUDENT', 'receive_date' => '20080522000000', 'receipt_date' => '20080522000000', 'id' => null, 'non_deductible_amount' => 0.0, 'total_amount' => 300.0, 'fee_amount' => 5, 'net_amount' => 295, 'trxn_id' => '22ereerwww323', 'invoice_id' => '22ed39c9e9ee621ce0eafe6da70', 'thankyou_date' => '20080522');
     require_once 'CRM/Contribute/BAO/Contribution.php';
     $contribution = CRM_Contribute_BAO_Contribution::create($param, $ids);
     $this->assertEquals($param['trxn_id'], $contribution->trxn_id, 'Check for transcation id creation.');
     $this->assertEquals($contactId, $contribution->contact_id, 'Check for contact id  creation.');
     $data = array('id' => $contribution->id, 'trxn_id' => $contribution->trxn_id, 'invoice_id' => $contribution->invoice_id);
     $contributionID = CRM_Contribute_BAO_Contribution::checkDuplicateIds($data);
     $this->assertEquals($contributionID, $contribution->id, 'Check for duplicate transcation id .');
     Contact::delete($contactId);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:19,代码来源:ContributionTest.php

示例15: delete

	/**
     *    Delete third party in database
     *    @param      id      id de la societe a supprimer
     */
    function delete()
    {
    	$result = parent::delete();

    	return $result;
    }
开发者ID:remyyounes,项目名称:dolibarr,代码行数:10,代码来源:dao_contact_default.class.php


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