本文整理汇总了PHP中Intacct\Xml\XMLWriter类的典型用法代码示例。如果您正苦于以下问题:PHP XMLWriter类的具体用法?PHP XMLWriter怎么用?PHP XMLWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XMLWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeXml
/**
* Write the function block XML
*
* @param XMLWriter $xml
* @throw InvalidArgumentException
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('function');
$xml->writeAttribute('controlid', $this->getControlId());
$xml->startElement('update_supdoc');
if (!$this->getAttachmentsId()) {
throw new InvalidArgumentException('Attachments ID is required for update');
}
$xml->writeElement('supdocid', $this->getAttachmentsId(), true);
$xml->writeElement('supdocname', $this->getAttachmentsName());
$xml->writeElement('supdocfoldername', $this->getAttachmentFolderName());
$xml->writeElement('supdocdescription', $this->getDescription());
if (count($this->getFiles()) > 0) {
$xml->startElement('attachments');
foreach ($this->getFiles() as $file) {
if ($file instanceof AttachmentInterface) {
$file->writeXml($xml);
}
}
$xml->endElement();
//attachments
}
$xml->endElement();
//update_supdoc
$xml->endElement();
//function
}
示例2: writeXml
/**
* Write the function block XML
*
* @param XMLWriter $xml
* @throw InvalidArgumentException
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('function');
$xml->writeAttribute('controlid', $this->getControlId());
$xml->startElement('create_supdoc');
// Attachments ID is not required if auto-numbering is configured in module
$xml->writeElement('supdocid', $this->getAttachmentsId(), true);
// System sets value to 'Unnamed' if left null
$xml->writeElement('supdocname', $this->getAttachmentsName(), true);
if (!$this->getAttachmentFolderName()) {
// System does not pick up user preferences for default folder
// Nor does it pick up user's related employee default folder
throw new InvalidArgumentException('Attachment Folder Name is required for create');
}
$xml->writeElement('supdocfoldername', $this->getAttachmentFolderName(), true);
$xml->writeElement('supdocdescription', $this->getDescription());
if (count($this->getFiles()) > 0) {
$xml->startElement('attachments');
foreach ($this->getFiles() as $file) {
if ($file instanceof AttachmentInterface) {
$file->writeXml($xml);
}
}
$xml->endElement();
//attachments
}
$xml->endElement();
//create_supdoc
$xml->endElement();
//function
}
示例3: writeXml
/**
* Write the authentication block XML
*
* @param XMLWriter $xml
*/
public function writeXml(&$xml)
{
$xml->startElement('authentication');
$xml->writeElement('sessionid', $this->sessionId, true);
$xml->endElement();
//authentication
}
示例4: writeXml
/**
* Write the function block XML
*
* @param XMLWriter $xml
* @throw InvalidArgumentException
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('function');
$xml->writeAttribute('controlid', $this->getControlId());
$xml->startElement('create_aradjustmentbatch');
if (!$this->getTitle()) {
throw new InvalidArgumentException('Title is required for create');
}
$xml->writeElement('batchtitle', $this->getTitle(), true);
if (!$this->getGlPostingDate()) {
throw new InvalidArgumentException('GL Posting Date is required for create');
}
$xml->startElement('datecreated');
$xml->writeDateSplitElements($this->getGlPostingDate(), true);
$xml->endElement();
//datecreated
/*if (count($this->getApAdjustments()) > 0) {
foreach ($this->getApAdjustments() as $apAdjustment) {
$bill->writeXml($xml);
}
}*/
$xml->endElement();
//create_aradjustmentbatch
$xml->endElement();
//function
}
示例5: writeXml
/**
* Write the parameter block XML
*
* @param XMLWriter $xml
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('parameter');
$xml->writeElement('name', $this->getName(), true);
$xml->writeElement('value', $this->getValue(), true);
$xml->endElement();
//parameter
}
示例6: writeXml
/**
* Write the function block XML
*
* @param XMLWriter $xml
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('function');
$xml->writeAttribute('controlid', $this->getControlId());
$xml->writeElement('getAPISession', null, true);
$xml->endElement();
//function
}
示例7: writeXml
/**
* Write the arpaymentitem block XML
*
* @param XMLWriter $xml
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('arpaymentitem');
$xml->writeElement('invoicekey', $this->getApplyToRecordId(), true);
$xml->writeElement('amount', $this->getAmountToApply(), true);
$xml->endElement();
//arpaymentitem
}
示例8: writeXmlImplicitCustomFields
/**
* @param XMLWriter $xml
*/
protected function writeXmlImplicitCustomFields(XMLWriter &$xml)
{
if (count($this->customFields) > 0) {
foreach ($this->customFields as $customFieldName => $customFieldValue) {
$xml->writeElement($customFieldName, $customFieldValue, true);
}
}
}
示例9: writeXml
/**
* Write the sortfield block XML
*
* @param XMLWriter $xml
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('sortfield');
$xml->writeAttribute('order', $this->getOrderBy());
$xml->text($this->getFieldName());
$xml->endElement();
//sortfield
}
示例10: testNotEnoughFilters
/**
* @covers Intacct\Functions\Common\GetList\LogicalFilter::writeXml
* @expectedException InvalidArgumentException
* @expectedExceptionMessage Logical Filters count must be 2 or more
*/
public function testNotEnoughFilters()
{
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->setIndentString(' ');
$xml->startDocument();
$filter = new LogicalFilter();
$filter->writeXml($xml);
}
示例11: testParamOverrides
/**
* @covers Intacct\Functions\AccountsReceivable\ArAdjustmentLineCreate::writeXml
*/
public function testParamOverrides()
{
$expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<lineitem>
<accountlabel>TestBill Account1</accountlabel>
<offsetglaccountno>93590253</offsetglaccountno>
<amount>76343.43</amount>
<memo>Just another memo</memo>
<locationid>Location1</locationid>
<departmentid>Department1</departmentid>
<key>Key1</key>
<totalpaid>23484.93</totalpaid>
<totaldue>0</totaldue>
<customfields>
<customfield>
<customfieldname>customfield1</customfieldname>
<customfieldvalue>customvalue1</customfieldvalue>
</customfield>
</customfields>
<projectid>Project1</projectid>
<customerid>Customer1</customerid>
<vendorid>Vendor1</vendorid>
<employeeid>Employee1</employeeid>
<itemid>Item1</itemid>
<classid>Class1</classid>
<warehouseid>Warehouse1</warehouseid>
</lineitem>
EOF;
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->setIndentString(' ');
$xml->startDocument();
$line = new ArAdjustmentLineCreate();
$line->setAccountLabel('TestBill Account1');
$line->setOffsetGLAccountNumber('93590253');
$line->setTransactionAmount(76343.42999999999);
$line->setMemo('Just another memo');
$line->setKey('Key1');
$line->setTotalPaid(23484.93);
$line->setTotalDue(0.0);
$line->setLocationId('Location1');
$line->setDepartmentId('Department1');
$line->setProjectId('Project1');
$line->setCustomerId('Customer1');
$line->setVendorId('Vendor1');
$line->setEmployeeId('Employee1');
$line->setItemId('Item1');
$line->setClassId('Class1');
$line->setWarehouseId('Warehouse1');
$line->setCustomFields(['customfield1' => 'customvalue1']);
$line->writeXml($xml);
$this->assertXmlStringEqualsXmlString($expected, $xml->flush());
}
示例12: testParamOverrides
/**
* @covers Intacct\Functions\Projects\TimesheetEntryCreate::writeXml
*/
public function testParamOverrides()
{
$expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<TIMESHEETENTRY>
<ENTRYDATE>06/30/2016</ENTRYDATE>
<QTY>1.75</QTY>
<DESCRIPTION>desc</DESCRIPTION>
<NOTES>my note</NOTES>
<TASKKEY>1234</TASKKEY>
<TIMETYPE>Salary</TIMETYPE>
<BILLABLE>true</BILLABLE>
<EXTBILLRATE>200</EXTBILLRATE>
<EXTCOSTRATE>175</EXTCOSTRATE>
<DEPARTMENTID>ADM</DEPARTMENTID>
<LOCATIONID>100</LOCATIONID>
<PROJECTID>P100</PROJECTID>
<CUSTOMERID>C100</CUSTOMERID>
<VENDORID>V100</VENDORID>
<ITEMID>I100</ITEMID>
<CLASSID>C200</CLASSID>
<CONTRACTID>C300</CONTRACTID>
<WAREHOUSEID>W100</WAREHOUSEID>
<customfield1>customvalue1</customfield1>
</TIMESHEETENTRY>
EOF;
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->setIndentString(' ');
$xml->startDocument();
$line = new TimesheetEntryCreate();
$line->setEntryDate(new DateType('2016-06-30'));
$line->setQuantity(1.75);
$line->setDescription('desc');
$line->setNotes('my note');
$line->setTaskRecordNo(1234);
$line->setTimeTypeName('Salary');
$line->setBillable(true);
$line->setOverrideBillingRate(200.0);
$line->setOverrideLaborCostRate(175.0);
$line->setDepartmentId('ADM');
$line->setLocationId('100');
$line->setProjectId('P100');
$line->setCustomerId('C100');
$line->setVendorId('V100');
$line->setItemId('I100');
$line->setClassId('C200');
$line->setContractId('C300');
$line->setWarehouseId('W100');
$line->setCustomFields(['customfield1' => 'customvalue1']);
$line->writeXml($xml);
$this->assertXmlStringEqualsXmlString($expected, $xml->flush());
}
示例13: testNoView
/**
* @covers Intacct\Functions\Common\ReadView::__construct
* @expectedException InvalidArgumentException
* @expectedExceptionMessage View Name is required for read view
*/
public function testNoView()
{
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->setIndentString(' ');
$xml->startDocument();
$readView = new ReadView('unittest');
//$readView->setViewName('TestBill Date Runtime');
$readView->writeXml($xml);
}
示例14: writeXml
/**
* Write the update block XML
*
* @param XMLWriter $xml
* @throw InvalidArgumentException
*/
public function writeXml(XMLWriter &$xml)
{
$xml->startElement('function');
$xml->writeAttribute('controlid', $this->getControlId());
$xml->startElement('update');
foreach ($this->getRecords() as $record) {
$record->writeXml($xml);
}
$xml->endElement();
//update
$xml->endElement();
//function
}
示例15: testParamOverrides
/**
* @covers Intacct\Functions\CashManagement\ChargeCardTransactionLineUpdate::writeXml
*/
public function testParamOverrides()
{
$expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<updateccpayitem line_num="3">
<accountlabel>TestBill Account1</accountlabel>
<description>Just another memo</description>
<paymentamount>76343.43</paymentamount>
<departmentid>Department1</departmentid>
<locationid>Location1</locationid>
<customerid>Customer1</customerid>
<vendorid>Vendor1</vendorid>
<employeeid>Employee1</employeeid>
<projectid>Project1</projectid>
<itemid>Item1</itemid>
<classid>Class1</classid>
<contractid>Contract1</contractid>
<warehouseid>Warehouse1</warehouseid>
<customfields>
<customfield>
<customfieldname>customfield1</customfieldname>
<customfieldvalue>customvalue1</customfieldvalue>
</customfield>
</customfields>
</updateccpayitem>
EOF;
$xml = new XMLWriter();
$xml->openMemory();
$xml->setIndent(true);
$xml->setIndentString(' ');
$xml->startDocument();
$line = new ChargeCardTransactionLineUpdate();
$line->setLineNo(3);
$line->setAccountLabel('TestBill Account1');
$line->setTransactionAmount(76343.42999999999);
$line->setMemo('Just another memo');
$line->setLocationId('Location1');
$line->setDepartmentId('Department1');
$line->setProjectId('Project1');
$line->setCustomerId('Customer1');
$line->setVendorId('Vendor1');
$line->setEmployeeId('Employee1');
$line->setItemId('Item1');
$line->setClassId('Class1');
$line->setContractId('Contract1');
$line->setWarehouseId('Warehouse1');
$line->setCustomFields(['customfield1' => 'customvalue1']);
$line->writeXml($xml);
$this->assertXmlStringEqualsXmlString($expected, $xml->flush());
}