Ejemplo n.º 1
0
 /**
  * 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
 }
Ejemplo n.º 2
0
 /**
  * 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
 }
 /**
  * Write the authentication block XML
  *
  * @param XMLWriter $xml
  */
 public function writeXml(&$xml)
 {
     $xml->startElement('authentication');
     $xml->writeElement('sessionid', $this->sessionId, true);
     $xml->endElement();
     //authentication
 }
 /**
  * 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
 }
 /**
  * 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
 }
Ejemplo n.º 6
0
 /**
  * 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
 }
Ejemplo n.º 7
0
 /**
  * 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
 }
Ejemplo n.º 8
0
 /**
  * @param XMLWriter $xml
  */
 protected function writeXmlImplicitCustomFields(XMLWriter &$xml)
 {
     if (count($this->customFields) > 0) {
         foreach ($this->customFields as $customFieldName => $customFieldValue) {
             $xml->writeElement($customFieldName, $customFieldValue, true);
         }
     }
 }
Ejemplo n.º 9
0
 /**
  * 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
 }
Ejemplo n.º 10
0
 /**
  * @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);
 }
    /**
     * @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());
    }
    /**
     * @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());
    }
Ejemplo n.º 13
0
 /**
  * @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);
 }
Ejemplo n.º 14
0
 /**
  * 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
 }
    /**
     * @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());
    }
Ejemplo n.º 16
0
 /**
  * @covers Intacct\Functions\GeneralLedger\AccountCreate::writeXml
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Title is required for create
  */
 public function testRequiredTitle()
 {
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->setIndent(true);
     $xml->setIndentString('    ');
     $xml->startDocument();
     $account = new AccountCreate('unittest');
     $account->setAccountNo('1010');
     //$account->setTitle('hello world');
     $account->setAccountType('balancesheet');
     $account->setNormalBalance('debit');
     $account->setClosingType('non-closing account');
     $account->writeXml($xml);
 }
Ejemplo n.º 17
0
 /**
  * Write the function block XML
  *
  * @param XMLWriter $xml
  */
 public function writeXml(XMLWriter &$xml)
 {
     $xml->startElement('csnentity');
     if (!$this->getEntityId()) {
         throw new InvalidArgumentException('Entity ID is required to consolidate an entity');
     }
     $xml->writeElement('entityid', $this->getEntityId(), true);
     // Rates support up to 10 decimal places
     $bsRate = is_float($this->getEndingSpotRate()) ? number_format($this->getEndingSpotRate(), 10) : $this->getEndingSpotRate();
     $waRate = is_float($this->getWeightedAverageRate()) ? number_format($this->getWeightedAverageRate(), 10) : $this->getWeightedAverageRate();
     $xml->writeElement('bsrate', $bsRate);
     $xml->writeElement('warate', $waRate);
     $xml->endElement();
     //csnentity
 }
    /**
     * @covers Intacct\Functions\InventoryControl\TransactionSubtotalCreate::writeXml
     */
    public function testParamsOverrides()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<subtotal>
    <description>Subtotal Description</description>
    <total>4202</total>
    <percentval>9.2</percentval>
    <locationid>2355</locationid>
    <departmentid>RCVNG</departmentid>
    <projectid>FOW</projectid>
    <customerid>CUST5893</customerid>
    <vendorid>VEN53222</vendorid>
    <employeeid>EM5925</employeeid>
    <classid>CLS322</classid>
    <itemid>I5266235</itemid>
    <contractid>C23662</contractid>
    <customfields>
        <customfield>
            <customfieldname>customfield1</customfieldname>
            <customfieldvalue>customvalue1</customfieldvalue>
        </customfield>
    </customfields>
</subtotal>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $subtotal = new TransactionSubtotalCreate();
        $subtotal->setDescription('Subtotal Description');
        $subtotal->setTotal(4202);
        $subtotal->setPercentageValue(9.199999999999999);
        $subtotal->setLocationId('2355');
        $subtotal->setDepartmentId('RCVNG');
        $subtotal->setProjectId('FOW');
        $subtotal->setCustomerId('CUST5893');
        $subtotal->setVendorId('VEN53222');
        $subtotal->setEmployeeId('EM5925');
        $subtotal->setClassId('CLS322');
        $subtotal->setItemId('I5266235');
        $subtotal->setContractId('C23662');
        $subtotal->setCustomFields(['customfield1' => 'customvalue1']);
        $subtotal->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
Ejemplo n.º 19
0
 /**
  * Write the function block XML
  *
  * @param XMLWriter $xml
  */
 public function writeXml(XMLWriter &$xml)
 {
     $xml->startElement('function');
     $xml->writeAttribute('controlid', $this->getControlId());
     $xml->startElement('getObjectTrail');
     $xml->writeElement('object', $this->getObjectName(), true);
     $xml->writeElement('objectKey', $this->getObjectKey(), true);
     $xml->endElement();
     //getObjectTrail
     $xml->endElement();
     //function
 }
Ejemplo n.º 20
0
 /**
  * Write the inspect block XML
  *
  * @param XMLWriter $xml
  */
 public function writeXml(XMLWriter &$xml)
 {
     $xml->startElement('function');
     $xml->writeAttribute('controlid', $this->getControlId());
     $xml->startElement('inspect');
     $xml->writeAttribute('detail', $this->writeXmlShowDetail());
     $xml->writeElement('object', $this->getObjectName(), true);
     $xml->endElement();
     //inspect
     $xml->endElement();
     //function
 }
Ejemplo n.º 21
0
 /**
  * Write the operation block XML
  *
  * @param XMLWriter $xml
  */
 public function writeXml(&$xml)
 {
     $xml->startElement('authentication');
     $xml->startElement('login');
     $xml->writeElement('userid', $this->userId, true);
     $xml->writeElement('companyid', $this->companyId, true);
     $xml->writeElement('password', $this->password, true);
     $xml->endElement();
     //login
     $xml->endElement();
     //authentication
 }
 /**
  * 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_supdocfolder');
     if (!$this->getFolderName()) {
         throw new InvalidArgumentException('Attachments Folder Name is required for update');
     }
     $xml->writeElement('supdocfoldername', $this->getFolderName(), true);
     $xml->writeElement('supdocfolderdescription', $this->getDescription());
     $xml->writeElement('supdocparentfoldername', $this->getParentFolderName());
     $xml->endElement();
     //update_supdocfolder
     $xml->endElement();
     //function
 }
    /**
     * @covers Intacct\Functions\GlobalConsolidations\ConsolidationCreate::writeXml
     */
    public function testFull()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<function controlid="unittest">
    <consolidate>
        <bookid>USD Books</bookid>
        <reportingperiodname>Month Ended June 2016</reportingperiodname>
        <offline>true</offline>
        <updatesucceedingperiods>false</updatesucceedingperiods>
        <changesonly>true</changesonly>
        <email>noreply@intacct.com</email>
        <entities>
            <csnentity>
                <entityid>VT</entityid>
                <bsrate>0.0000483500</bsrate>
                <warate>0.0000485851</warate>
            </csnentity>
        </entities>
    </consolidate>
</function>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $rate = new ConsolidationCreate('unittest');
        $rate->setReportingBookId('USD Books');
        $rate->setReportingPeriodName('Month Ended June 2016');
        $rate->setProcessOffline(true);
        $rate->setChangesOnly(true);
        $rate->setUpdateSucceedingPeriods(false);
        $rate->setNotificationEmail('*****@*****.**');
        $entity1 = new ConsolidationEntity();
        $entity1->setEntityId('VT');
        $entity1->setEndingSpotRate(4.835E-5);
        $entity1->setWeightedAverageRate(4.85851E-5);
        $rate->setEntities([$entity1]);
        $rate->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
 /**
  * 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('approve_appaymentrequest');
     if (!$this->getRecordNo()) {
         throw new InvalidArgumentException('Record No is required for approve');
     }
     $xml->startElement('appaymentkeys');
     $xml->writeElement('appaymentkey', $this->getRecordNo(), true);
     $xml->endElement();
     //appaymentkeys
     $xml->endElement();
     //approve_appaymentrequest
     $xml->endElement();
     //function
 }
Ejemplo n.º 25
0
    /**
     * @covers Intacct\Functions\Common\ReadByQuery::__construct
     * @covers Intacct\Functions\Common\ReadByQuery::writeXml
     */
    public function testParamOverrides()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<function controlid="unittest">
    <readByQuery>
        <object>CLASS</object>
        <query/>
        <fields>RECORDNO</fields>
        <pagesize>100</pagesize>
        <returnFormat>xml</returnFormat>
        <docparid>255252235</docparid>
    </readByQuery>
</function>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $readByQuery = new ReadByQuery('unittest');
        $readByQuery->setObjectName('CLASS');
        $readByQuery->setPageSize(100);
        $readByQuery->setReturnFormat('xml');
        $readByQuery->setFields(['RECORDNO']);
        $readByQuery->setDocParId('255252235');
        $readByQuery->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
    /**
     * @covers Intacct\Functions\InventoryControl\TransactionItemDetail::writeXml
     *
     */
    public function testParamsOverrides()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<itemdetail>
    <quantity>15325</quantity>
    <serialno>S2355235</serialno>
    <aisle>55</aisle>
    <row>1</row>
    <bin>12</bin>
</itemdetail>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $itemDetail = new TransactionItemDetail();
        $itemDetail->setQuantity(15325);
        $itemDetail->setSerialNumber('S2355235');
        $itemDetail->setAisle('55');
        $itemDetail->setRow('1');
        $itemDetail->setBin('12');
        $itemDetail->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
    /**
     * @covers Intacct\Functions\GlobalConsolidations\WeightedAverageRateRead::writeXml
     */
    public function testDefaultParams()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<function controlid="unittest">
    <getWARate>
        <fromCurrency>USD</fromCurrency>
        <toCurrency>CAD</toCurrency>
        <fromDate>2016-06-01</fromDate>
        <toDate>2016-06-30</toDate>
    </getWARate>
</function>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $rate = new WeightedAverageRateRead('unittest');
        $rate->setFromCurrency('USD');
        $rate->setToCurrency('CAD');
        $rate->setFromDate(new DateType('2016-06-01'));
        $rate->setToDate(new DateType('2016-06-30'));
        $rate->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
Ejemplo n.º 28
0
    /**
     * @covers Intacct\Functions\DataDeliveryService\DdsJobCreate::writeXml
     */
    public function testParamsOverrides()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<function controlid="unittest">
    <runDdsJob>
        <object>GLACCOUNT</object>
        <cloudDelivery>My Cloud Bucket</cloudDelivery>
        <jobType>change</jobType>
        <timeStamp>2002-09-24T06:00:00</timeStamp>
        <fileConfiguration>
            <delimiter>,</delimiter>
            <enclosure>"</enclosure>
            <includeHeaders>true</includeHeaders>
            <fileFormat>unix</fileFormat>
            <splitSize>10000</splitSize>
            <compress>false</compress>
        </fileConfiguration>
    </runDdsJob>
</function>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $runJob = new DdsJobCreate('unittest');
        $runJob->setObjectName('GLACCOUNT');
        $runJob->setCloudDeliveryName('My Cloud Bucket');
        $runJob->setJobType('change');
        $runJob->setTimestamp(new DateTime('2002-09-24 06:00'));
        $runJob->setDelimiter(',');
        $runJob->setEnclosure('"');
        $runJob->setIncludeHeaders(true);
        $runJob->setFileFormat('unix');
        $runJob->setSplitSize(10000);
        $runJob->setCompressed(false);
        $runJob->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
Ejemplo n.º 29
0
    /**
     * @covers Intacct\Functions\Common\ReadByName::writeXml
     */
    public function testParamOverrides()
    {
        $expected = <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<function controlid="unittest">
    <readByName>
        <object>GLENTRY</object>
        <keys>987</keys>
        <fields>TRX_AMOUNT,RECORDNO,BATCHNO</fields>
        <returnFormat>xml</returnFormat>
        <docparid>Sales Invoice</docparid>
    </readByName>
</function>
EOF;
        $xml = new XMLWriter();
        $xml->openMemory();
        $xml->setIndent(true);
        $xml->setIndentString('    ');
        $xml->startDocument();
        $readByName = new ReadByName('unittest');
        $readByName->setObjectName('GLENTRY');
        $readByName->setNames(['987']);
        $readByName->setFields(['TRX_AMOUNT', 'RECORDNO', 'BATCHNO']);
        $readByName->setDocParId('Sales Invoice');
        $readByName->setReturnFormat('xml');
        $readByName->writeXml($xml);
        $this->assertXmlStringEqualsXmlString($expected, $xml->flush());
    }
Ejemplo n.º 30
0
 /**
  * Write the getUserPermissions block XML
  *
  * @param XMLWriter $xml
  */
 public function writeXml(XMLWriter &$xml)
 {
     $xml->startElement('function');
     $xml->writeAttribute('controlid', $this->getControlId());
     $xml->startElement('getUserPermissions');
     $xml->writeElement('userId', $this->getUserId(), true);
     $xml->endElement();
     //getUserPermissions
     $xml->endElement();
     //function
 }