本文整理汇总了PHP中Addressbook_Controller_Contact类的典型用法代码示例。如果您正苦于以下问题:PHP Addressbook_Controller_Contact类的具体用法?PHP Addressbook_Controller_Contact怎么用?PHP Addressbook_Controller_Contact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Addressbook_Controller_Contact类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: normalizeBankAccounts
public static function normalizeBankAccounts()
{
$limit = 400;
\org\sopen\dev\DebugLogger::openLogFileAppend(CSopen::instance()->getConfigPath() . '/logs/sepa-integrate.log');
try {
$dFilter = new Addressbook_Model_ContactFilter(array(array('field' => 'query', 'operator' => 'contains', 'value' => '')), 'AND');
/*$dFilter = new Addressbook_Model_ContactFilter(array(array(
'field' => 'contact_id',
'operator' => 'in',
'value' => array('100222', '100223') )), 'AND');
*/
$contactIds = Addressbook_Controller_Contact::getInstance()->search($dFilter, null, false, true);
\org\sopen\dev\DebugLogger::log('Count adress ids: ' . count($contactIds));
$count = 0;
foreach ($contactIds as $contactId) {
/*if($count++ > $limit){
break;
}*/
$contact = Addressbook_Controller_Contact::getInstance()->get($contactId);
self::doSepa($contact);
//$bankAccountCollection = Billing_Controller_Debitor::getInstance()->getBankAccountCollectionForDebitor($debitor);
}
} catch (Exception $e) {
\org\sopen\dev\DebugLogger::log('global error: ' . $e->__toString());
}
}
示例2: testSyncOfContacts
/**
* test sync of existing contacts folder
*/
public function testSyncOfContacts()
{
$container = $this->_getPersonalContainer('Addressbook');
$this->_syncFolder();
$this->_requestInitialSynckey($container);
// now do the first sync
$sync = $this->_sync($container);
$syncDoc = $sync->getResponse();
// we make sure that there are always > 0 contacts in this container
if ($syncDoc === null) {
$contact = new Addressbook_Model_Contact(array('n_family' => 'lala', 'container_id' => $container->getId()));
Addressbook_Controller_Contact::getInstance()->create($contact);
$sync = $this->_sync($container);
$syncDoc = $sync->getResponse();
}
#$syncDoc->formatOutput = true; echo $syncDoc->saveXML();
$xpath = new DomXPath($syncDoc);
$xpath->registerNamespace('AirSync', 'uri:AirSync');
$nodes = $xpath->query('//AirSync:Sync/AirSync:Collections/AirSync:Collection/AirSync:Class');
$this->assertEquals(1, $nodes->length, $syncDoc->saveXML());
$this->assertEquals('Contacts', $nodes->item(0)->nodeValue, $syncDoc->saveXML());
$nodes = $xpath->query('//AirSync:Sync/AirSync:Collections/AirSync:Collection/AirSync:SyncKey');
$this->assertEquals(1, $nodes->length, $syncDoc->saveXML());
$this->assertEquals(2, $nodes->item(0)->nodeValue, $syncDoc->saveXML());
$nodes = $xpath->query('//AirSync:Sync/AirSync:Collections/AirSync:Collection/AirSync:Status');
$this->assertEquals(1, $nodes->length, $syncDoc->saveXML());
$this->assertEquals(Syncroton_Command_Sync::STATUS_SUCCESS, $nodes->item(0)->nodeValue, $syncDoc->saveXML());
$nodes = $xpath->query('//AirSync:Sync/AirSync:Collections/AirSync:Collection/AirSync:Commands');
$this->assertEquals(1, $nodes->length, $syncDoc->saveXML());
$this->assertEquals("uri:Contacts", $syncDoc->lookupNamespaceURI('Contacts'), $syncDoc->saveXML());
}
示例3: appendDependentRecords
protected function appendDependentRecords($record)
{
if ($record->__get('debitor_id')) {
$this->appendForeignRecordToRecord($record, 'debitor_id', 'debitor_id', 'id', new Billing_Backend_Debitor());
$debitor = $record->__get('debitor_id');
try {
if (is_object($debitor)) {
$contactId = $debitor->__get('contact_id');
} else {
$contactId = $debitor->contact_id;
}
$contact = Addressbook_Controller_Contact::getInstance()->get($contactId);
if (is_object($debitor)) {
$debitor->__set('contact_id', $contact->toArray());
} else {
$debitor->contact_id = $contact->toArray();
}
} catch (Exception $e) {
}
$record->__set('debitor_id', $debitor);
}
if ($record->__get('job_id')) {
$this->appendForeignRecordToRecord($record, 'job_id', 'job_id', 'id', new Billing_Backend_Job());
}
if ($record->__get('price_group_id')) {
$this->appendForeignRecordToRecord($record, 'price_group_id', 'price_group_id', 'id', new Billing_Backend_PriceGroup());
}
if ($record->__get('payment_method_id')) {
$this->appendForeignRecordToRecord($record, 'payment_method_id', 'payment_method_id', 'id', new Billing_Backend_PaymentMethod());
}
}
示例4: appendDependentRecords
protected function appendDependentRecords($record)
{
if ($record->__get('open_item_id')) {
$this->appendForeignRecordToRecord($record, 'open_item_id', 'open_item_id', 'id', new Billing_Backend_OpenItem());
}
if ($record->__get('monition_receipt_id')) {
$this->appendForeignRecordToRecord($record, 'monition_receipt_id', 'monition_receipt_id', 'id', new Billing_Backend_Receipt());
}
if ($record->__get('debitor_id')) {
$this->appendForeignRecordToRecord($record, 'debitor_id', 'debitor_id', 'id', new Billing_Backend_Debitor());
$debitor = $record->__get('debitor_id');
try {
if (is_object($debitor)) {
$contactId = $debitor->__get('contact_id');
} else {
$contactId = $debitor->contact_id;
}
$contact = Addressbook_Controller_Contact::getInstance()->get($contactId);
if (is_object($debitor)) {
$debitor->__set('contact_id', $contact->toArray());
} else {
$debitor->contact_id = $contact->toArray();
}
} catch (Exception $e) {
}
$record->__set('debitor_id', $debitor);
}
}
示例5: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
$this->_contactController = Addressbook_Controller_Contact::getInstance();
$this->_contractController = Sales_Controller_Contract::getInstance();
$this->_json = new Sales_Frontend_Json();
}
示例6: getInstance
/**
* the singleton pattern
*
* @return Addressbook_Controller_Contact
*/
public static function getInstance()
{
if (self::$_instance === NULL) {
self::$_instance = new Addressbook_Controller_Contact();
}
return self::$_instance;
}
示例7: _resolveMemberroles
/**
* resolve memberroles
*
* @param $records
*/
protected function _resolveMemberroles($records)
{
$listRoles = Addressbook_Controller_ListRole::getInstance()->getAll();
$contactIds = array();
foreach ($records as $record) {
if (isset($record->memberroles)) {
$contactIds = array_merge($contactIds, $record->memberroles->contact_id);
}
}
if (count($contactIds) > 0) {
$contacts = Addressbook_Controller_Contact::getInstance()->getMultiple($contactIds);
}
foreach ($records as $list) {
if (isset($record->memberroles)) {
foreach ($list->memberroles as $memberrole) {
$contact = $contacts->getById($memberrole->contact_id);
if ($contact) {
$memberrole->contact_id = $contact;
}
$listRole = $listRoles->getById($memberrole->list_role_id);
if ($listRole) {
$memberrole->list_role_id = $listRole;
}
}
}
}
}
示例8: update_0
/**
* update to 9.1
*
* @return void
*/
public function update_0()
{
// we need at least addressbook version 9,7
if (version_compare($this->getApplicationVersion('Addressbook'), '9.8') < 0) {
return;
}
$setupUser = $this->_getSetupFromConfigOrCreateOnTheFly();
if ($setupUser) {
Tinebase_Core::set(Tinebase_Core::USER, $setupUser);
$filter = new Phone_Model_CallFilter(array(array('field' => 'start', 'operator' => 'after', 'value' => date('Y-m-d H:i:s', time() - 3600 * 24 * 30 * 3))), 'AND', array('ignoreAcl' => true));
$addressbookController = Addressbook_Controller_Contact::getInstance();
$phoneController = Phone_Controller_Call::getInstance();
$calls = $phoneController->search($filter);
foreach ($calls as $_record) {
// resolve telephone number to contacts if possible
$telNumber = Addressbook_Model_Contact::normalizeTelephoneNoCountry($phoneController->resolveInternalNumber($_record->destination));
if (null === $telNumber) {
continue;
}
$filter = new Addressbook_Model_ContactFilter(array(array('field' => 'telephone_normalized', 'operator' => 'equals', 'value' => $telNumber)));
$contacts = $addressbookController->search($filter);
$relations = array();
foreach ($contacts as $contact) {
$relations[] = array('related_model' => 'Addressbook_Model_Contact', 'related_id' => $contact->getId(), 'related_degree' => Tinebase_Model_Relation::DEGREE_SIBLING, 'related_backend' => Tinebase_Model_Relation::DEFAULT_RECORD_BACKEND, 'type' => 'CALLER');
}
if (count($relations) > 0) {
$_record->relations = $relations;
$phoneController->update($_record);
}
}
}
$this->setApplicationVersion('Phone', '9.1');
}
示例9: printDocs
public function printDocs()
{
// print payments which are debit returns and have flag print inquiry
$resultData = array();
$filters = array(array('field' => 'is_return_debit', 'operator' => 'equals', 'value' => '1'), array('field' => 'print_inquiry', 'operator' => 'equals', 'value' => '1'), array('field' => 'inquiry_print_date', 'operator' => 'isnull', 'value' => ''));
$objFilter = new Billing_Model_PaymentFilter($filters, 'AND');
$paymentIds = Billing_Controller_Payment::getInstance()->search($objFilter, null, null, true);
foreach ($paymentIds as $paymentId) {
$payment = Billing_Controller_Payment::getInstance()->get($paymentId);
// get base payment
$basePayment = $payment->getForeignRecordBreakNull('return_debit_base_payment_id', Billing_Controller_Payment::getInstance());
if ($basePayment) {
$batchJobDta = $basePayment->getForeignRecordBreakNull('batch_job_dta_id', Billing_Controller_BatchJobDta::getInstance());
if ($batchJobDta) {
$bankAccount = Billing_Api_BankAccount::getFromBatchJobDta($batchJobDta);
$debitor = $payment->getForeignRecord('debitor_id', Billing_Controller_Debitor::getInstance());
$contact = $debitor->getForeignRecord('contact_id', Addressbook_Controller_Contact::getInstance());
$data = array();
$dummyTextBlocks = null;
$data = array_merge($data, Addressbook_Custom_Template::getContactData(array('contact' => $contact, 'user' => Tinebase_Core::get(Tinebase_Core::USER), 'userContact' => Addressbook_Controller_Contact::getInstance()->getContactByUserId(Tinebase_Core::get(Tinebase_Core::USER)->getId())), $dummyTextBlocks));
$data = array_merge($data, array('bank_name' => $bankAccount->getBank(), 'account_name' => $bankAccount->getName(), 'account_nr' => $bankAccount->getNumber(), 'bank_code' => $bankAccount->getBankCode()));
$resultData[$contact->__get('n_fileas')] = $data;
$payment->__set('inquiry_print_date', new Zend_Date());
Billing_Controller_Payment::getInstance()->update($payment);
}
}
}
$outputFileName = 'Ruecklastschrift-Nachforschung-' . strftime('%d-%m-%Y %H-%M-%S') . '.pdf';
$templateId = Tinebase_Core::getPreference('Billing')->getValue(Billing_Preference::TEMPLATE_DEBIT_RETURN_INQUIRY);
ksort($resultData);
Billing_Controller_PrintJobRecordData::getInstance()->export($resultData, $templateId, $outputFileName);
}
示例10: appendDependentRecords
protected function appendDependentRecords($record)
{
if ($record->__get('debitor_id')) {
$this->appendForeignRecordToRecord($record, 'debitor_id', 'debitor_id', 'id', new Billing_Backend_Debitor());
$debitor = $record->__get('debitor_id');
try {
if (is_object($debitor)) {
$contactId = $debitor->__get('contact_id');
} else {
$contactId = $debitor->contact_id;
}
$contact = Addressbook_Controller_Contact::getInstance()->get($contactId);
if (is_object($debitor)) {
$debitor->__set('contact_id', $contact->toArray());
} else {
$debitor->contact_id = $contact->toArray();
}
} catch (Exception $e) {
}
$record->__set('debitor_id', $debitor);
}
if ($record->__get('op_id')) {
$this->appendForeignRecordToRecord($record, 'op_id', 'op_id', 'id', new Billing_Backend_OpenItem());
}
if ($record->__get('account_system_id')) {
$this->appendForeignRecordToRecord($record, 'account_system_id', 'account_system_id', 'id', new Billing_Backend_AccountSystem());
}
if ($record->__get('account_system_id_haben')) {
$this->appendForeignRecordToRecord($record, 'account_system_id_haben', 'account_system_id_haben', 'id', new Billing_Backend_AccountSystem());
}
if ($record->__get('return_debit_base_payment_id')) {
$this->appendForeignRecordToRecord($record, 'return_debit_base_payment_id', 'return_debit_base_payment_id', 'id', new Billing_Backend_Payment());
}
}
示例11: tearDown
/**
* tear down tests
*
*/
public function tearDown()
{
parent::tearDown();
foreach ($this->_testEmailContacts as $email) {
$contactIdsToDelete = Addressbook_Controller_Contact::getInstance()->search(new Addressbook_Model_ContactFilter(array(array('field' => 'containerType', 'operator' => 'equals', 'value' => 'all'), array('field' => 'email', 'operator' => 'equals', 'value' => $email))), null, false, true);
Addressbook_Controller_Contact::getInstance()->delete($contactIdsToDelete);
}
}
示例12: _resolveRecord
/**
* resolves a record
*
* @param string $value
* @return array|string
*/
protected function _resolveRecord($value)
{
if ($value === Addressbook_Model_Contact::CURRENTCONTACT) {
$contact = Addressbook_Controller_Contact::getInstance()->getContactByUserId(Tinebase_Core::getUser()->getId(), TRUE)->toArray();
} else {
$contact = parent::_resolveRecord($value);
}
return $contact;
}
示例13: testAddAccount
/**
* try to add an account
*
*/
public function testAddAccount()
{
$account = Admin_Controller_User::getInstance()->create($this->objects['initialAccount'], 'lars', 'lars');
$this->assertTrue(!empty($account->accountId));
//$this->assertTrue($this->objects['initialAccount']->accountId != $account->accountId);
$this->assertEquals($this->objects['initialAccount']->accountLoginName, $account->accountLoginName);
$contact = Addressbook_Controller_Contact::getInstance()->getContactByUserId($account->accountId);
$this->assertTrue(!empty($contact->creation_time));
}
示例14: testGetTranslatedValue
/**
* testGetTranslatedValue
*
* @see 0008600: Fix fatal error in Calendar/Model/Event.php
*/
public function testGetTranslatedValue()
{
$event = new Calendar_Model_Event(array('dtstart' => new Tinebase_DateTime('2011-11-23 14:25:00'), 'dtend' => new Tinebase_DateTime('2011-11-23 15:25:00'), 'summary' => 'test event', 'organizer' => Tinebase_Core::getUser()->contact_id));
$translation = Tinebase_Translation::getTranslation('Calendar');
$timezone = Tinebase_Core::getPreference()->getValueForUser(Tinebase_Preference::TIMEZONE, Tinebase_Core::getUser()->getId());
$fileas = Calendar_Model_Event::getTranslatedValue('organizer', $event->organizer, $translation, $timezone);
$userContact = Addressbook_Controller_Contact::getInstance()->getContactByUserId(Tinebase_Core::getUser()->getId());
$this->assertEquals($userContact->n_fileas, $fileas);
}
示例15: testUpdateList
/**
* try to update a list
*/
public function testUpdateList()
{
$list = $this->testAddList();
$list->members = array($this->objects['contact2']);
$list = $this->_instance->update($list);
$this->assertEquals(1, count($list->members));
$contactId = $list->members[0];
$contact = Addressbook_Controller_Contact::getInstance()->get($contactId);
$this->assertEquals($this->objects['contact2']->adr_one_locality, $contact->adr_one_locality);
}