本文整理汇总了PHP中Addressbook_Controller_Contact::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Addressbook_Controller_Contact::create方法的具体用法?PHP Addressbook_Controller_Contact::create怎么用?PHP Addressbook_Controller_Contact::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Addressbook_Controller_Contact
的用法示例。
在下文中一共展示了Addressbook_Controller_Contact::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addContact
/**
* adds a contact
*
* @return Addressbook_Model_Contact
*/
protected function _addContact()
{
$contact = $this->objects['initialContact'];
$contact->notes = new Tinebase_Record_RecordSet('Tinebase_Model_Note', array($this->objects['note']));
$contact = $this->_instance->create($contact);
$this->objects['contact'] = $contact;
$this->assertEquals($this->objects['initialContact']->adr_one_locality, $contact->adr_one_locality);
return $contact;
}
示例2: _createSupplier
/**
*
* @return array
*/
protected function _createSupplier()
{
$container = Tinebase_Container::getInstance()->getSharedContainer(Tinebase_Core::getUser()->getId(), 'Addressbook_Model_Contact', 'WRITE');
$containerContracts = Tinebase_Container::getInstance()->getSharedContainer(Tinebase_Core::getUser()->getId(), 'Sales_Model_Contract', 'WRITE');
$container = $container->getFirstRecord();
$contact1 = $this->_contactController->create(new Addressbook_Model_Contact(array('n_given' => 'Yiting', 'n_family' => 'Huang', 'container_id' => $container->getId())));
$contact2 = $this->_contactController->create(new Addressbook_Model_Contact(array('n_given' => 'Hans Friedrich', 'n_family' => 'Ochs', 'container_id' => $container->getId())));
$customerData = array('name' => 'Worldwide Electronics International', 'cpextern_id' => $contact1->getId(), 'cpintern_id' => $contact2->getId(), 'number' => 4294967, 'iban' => 'CN09234098324098234598', 'bic' => '0239580429570923432444', 'url' => 'http://wwei.cn', 'vatid' => '239rc9mwqe9c2q', 'credit_term' => '30', 'currency' => 'EUR', 'curreny_trans_rate' => 7.034, 'discount' => 12.5, 'adr_prefix1' => 'no prefix 1', 'adr_prefix2' => 'no prefix 2', 'adr_street' => 'Mao st. 2000', 'adr_postalcode' => '1', 'adr_locality' => 'Shanghai', 'adr_region' => 'Shanghai', 'adr_countryname' => 'China', 'adr_pobox' => '7777777');
return $this->_json->saveSupplier($customerData);
}
示例3: testUseNotes
/**
* test useNotes
*/
public function testUseNotes()
{
$contact = $this->objects['initialContact'];
$contact1 = clone $contact;
$contact1->notes = array(new Tinebase_Record_RecordSet('Tinebase_Model_Note', array($this->objects['note'])));
$contact->notes = array(new Tinebase_Record_RecordSet('Tinebase_Model_Note', array($this->objects['note'])));
$newcontact1 = $this->_instance->create($contact1);
$this->_instance->delete($newcontact1);
$this->_instance->useNotes(false);
$this->objects['contact'] = $this->_instance->create($contact);
$compStr = 'Array
(
[0] => Array
(
[note_type_id] => 1
[note] => phpunit test note
[record_backend] => Sql
[id] =>
)
)';
$this->assertTrue($newcontact1->has('notes'));
$this->assertEquals($compStr, $newcontact1->notes[0]->note);
$this->setExpectedException('Tinebase_Exception_NotFound');
$this->objects['contact']->notes[0]->note = 'note';
}
示例4: _createContact
/**
* creates a contact and the image, if given
*/
protected function _createContact($data, $imageData)
{
$record = new Addressbook_Model_Contact($data);
$be = new Addressbook_Backend_Sql();
$imageData = base64_decode($imageData);
try {
$record = $this->_controller->create($record);
if ($imageData) {
// @todo We should not use copyrighted/random pictures for demo data
//$be->_saveImage($record->getId(), $imageData);
}
} catch (Exception $e) {
echo 'Skipping: ' . $data['n_given'] . ' ' . $data['n_family'] . ($data['org_name'] ? ' (' . $data['org_name'] . ') ' : '') . $e->getMessage() . PHP_EOL;
}
}
示例5: _createContacts
protected function _createContacts($count = 20)
{
// addresses
$csvFile = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'tine20' . DIRECTORY_SEPARATOR . 'Addressbook' . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR . 'DemoData' . DIRECTORY_SEPARATOR . 'out1000.csv';
if (!file_exists($csvFile)) {
throw new Tinebase_Exception_NotFound('File does not exist: ' . $csvFile);
}
$fhcsv = fopen($csvFile, 'r');
$i = 0;
$indexes = fgetcsv($fhcsv);
$this->_contactController = Addressbook_Controller_Contact::getInstance();
$addresses = array();
while ($row = fgetcsv($fhcsv)) {
if ($i >= $count) {
break;
}
foreach ($row as $index => $field) {
if ($indexes[$index] == 'gender') {
if ($field == 'male') {
$isMan = true;
$addresses[$i]['salutation'] = 'MR';
} else {
$isMan = false;
$addresses[$i]['salutation'] = 'MRS';
}
} else {
$addresses[$i][$indexes[$index]] = $field;
}
}
$i++;
}
fclose($fhcsv);
$container = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => 'TEST SALES INVOICES', 'type' => Tinebase_Model_Container::TYPE_SHARED, 'owner_id' => Tinebase_Core::getUser(), 'backend' => 'SQL', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Addressbook')->getId(), 'model' => 'Addressbook_Model_Contact', 'color' => '#000000')), NULL, TRUE);
$this->_sharedContractsContainerId = $container->getId();
$this->_contactRecords = new Tinebase_Record_RecordSet('Addressbook_Model_Contact');
foreach ($addresses as $address) {
$data = array_merge($address, array('container_id' => $this->_sharedContractsContainerId));
$this->_contactRecords->addRecord($this->_contactController->create(new Addressbook_Model_Contact($data, TRUE), FALSE));
}
}