/** * Create a new QuickBooks_Object_Class object * * @param array $arr */ public function __construct($arr = array()) { parent::__construct($arr); // These things occur because it's a repeatable element who name doesn't do the *Add, *Mod, *Ret thing, trash these $unsets = array('RelatedUnit Name', 'RelatedUnit Abbreviation', 'RelatedUnit ConversionRatio', 'DefaultUnit UnitUsedFor', 'DefaultUnit Unit'); foreach ($unsets as $unset) { if (isset($this->_object[$unset])) { unset($this->_object[$unset]); } } }
/** * Convert this object to a valid qbXML request * * @param string $request The type of request to convert this to (examples: CustomerAddRq, CustomerModRq, CustomerQueryRq) * @param string $version * @param string $locale * @param string $root * @return string */ public function asQBXML($request, $version = null, $locale = null, $root = null) { $this->_cleanup(); return parent::asQBXML($request, $version, $locale, $root); }
<AppliedToTxnRet> <TxnID>4EBB-1360044733</TxnID> <TxnType>Invoice</TxnType> <TxnDate>2013-02-04</TxnDate> <BalanceRemaining>0.00</BalanceRemaining> <Amount>100.00</Amount> <LinkedTxn> <TxnID>4EBE-1360045371</TxnID> <TxnType>ReceivePayment</TxnType> <TxnDate>2013-02-04</TxnDate> <RefNumber>100</RefNumber> <LinkType>AMTTYPE</LinkType> <Amount>-100.00</Amount> </LinkedTxn> </AppliedToTxnRet> <AppliedToTxnRet> <TxnID>4EC8-1360116030</TxnID> <TxnType>Invoice</TxnType> <TxnDate>2013-02-05</TxnDate> <RefNumber>22</RefNumber> <BalanceRemaining>0.00</BalanceRemaining> <Amount>199.77</Amount> </AppliedToTxnRet> </ReceivePaymentRet>'; $Object = QuickBooks_QBXML_Object::fromQBXML($qbxml, QUICKBOOKS_QUERY_RECEIVEPAYMENT); //print out the object print_r($Object); $list = $Object->listAppliedToTxns(); foreach ($list as $AppliedToTxn) { print_r($AppliedToTxn); }
/** * * * @param boolean $todo_for_empty_elements A constant, one of: QUICKBOOKS_XML_XML_COMPRESS, QUICKBOOKS_XML_XML_DROP, QUICKBOOKS_XML_XML_PRESERVE * @param string $indent * @param string $root * @return string */ public function asQBXML($request, $todo_for_empty_elements = QUICKBOOKS_OBJECT_XML_DROP, $indent = "\t", $root = null) { $this->_cleanup(); return parent::asQBXML($request, $todo_for_empty_elements, $indent, $root); }
/** * * * @param boolean $todo_for_empty_elements A constant, one of: QUICKBOOKS_XML_XML_COMPRESS, QUICKBOOKS_XML_XML_DROP, QUICKBOOKS_XML_XML_PRESERVE * @param string $indent * @param string $root * @return string */ public function asQBXML($request, $todo_for_empty_elements = QuickBooks_QBXML_Object::XML_DROP, $indent = "\t", $root = null, $parent = null) { $this->_cleanup(); return parent::asQBXML($request, $todo_for_empty_elements, $indent, $root); }
/** * Convert this object to a valid qbXML request * * @param string $request The type of request to convert this to (ARRefundCreditCardAddRq, or ARRefundCreditCardQuery) * @param boolean $todo_for_empty_elements A constant, one of: QUICKBOOKS_XML_XML_COMPRESS, QUICKBOOKS_XML_XML_DROP, QUICKBOOKS_XML_XML_PRESERVE * @param string $indent * @param string $root * @return string */ public function asQBXML($request, $todo_for_empty_elements = NULL, $indent = "\t", $root = null) { $this->_cleanup(); return parent::asQBXML($request, $todo_for_empty_elements, $indent, $root); }
/** * Create a new QuickBooks_Object_JournalEntry_JournalDebitLine object * * @param array $arr */ public function __construct($arr = array()) { parent::__construct($arr); }
public function asXML($root = null, $parent = null, $object = null) { if (is_null($object)) { $object = $this->_object; } switch ($root) { case QUICKBOOKS_ADD_BILLPAYMENTCHECK: /* if (isset($this->_object['AppliedToTxn'])) { $this->_object['AppliedToTxnAdd'] = $this->_object['AppliedToTxn']; } */ if ($this->exists('AppliedToTxnAdd')) { foreach ($object['AppliedToTxnAdd'] as $key => $obj) { $obj->setOverride('AppliedToTxnAdd'); } } break; case QUICKBOOKS_MOD_BILLPAYMENTCHECK: // finish me! break; } return parent::asXML($root, $parent, $object); }
/** * Convert a qbXML string to a QuickBooks_Object_* object instance * * @param string $qbxml * @param string $action_or_object * @return QuickBooks_Object */ public static function fromQBXML($qbxml, $action_or_object = null) { $errnum = null; $errmsg = null; $Parser = new QuickBooks_XML_Parser($qbxml); if ($Doc = $Parser->parse($errnum, $errmsg)) { $XML = $Doc->getRoot(); return QuickBooks_QBXML_Object::fromXML($XML, $action_or_object); } return false; }
public function asXML($root = null, $parent = null, $object = null) { if (is_null($object)) { $object = $this->_object; } switch ($root) { case QUICKBOOKS_ADD_RECEIVEPAYMENT: if ($this->exists('AppliedToTxnAdd')) { foreach ($object['AppliedToTxnAdd'] as $key => $obj) { $obj->setOverride('AppliedToTxnAdd'); } } break; case QUICKBOOKS_MOD_RECEIVEPAYMENT: if ($this->exists('AppliedToTxnMod')) { foreach ($object['AppliedToTxnMod'] as $key => $obj) { $obj->setOverride('AppliedToTxnMod'); } } break; } return parent::asXML($root, $parent, $object); }
public function asXML($root = null, $parent = null, $object = null) { if (is_null($object)) { $object = $this->_object; } switch ($root) { case QUICKBOOKS_ADD_BILL: if (!empty($object['ItemLineAdd'])) { foreach ($object['ItemLineAdd'] as $key => $obj) { $obj->setOverride('ItemLineAdd'); } } if (!empty($object['ExpenseLineAdd'])) { foreach ($object['ExpenseLineAdd'] as $key => $obj) { $obj->setOverride('ExpenseLineAdd'); } } break; case QUICKBOOKS_MOD_BILL: if (!empty($object['ItemLineMod'])) { foreach ($object['ItemLineMod'] as $key => $obj) { $obj->setOverride('ItemLineMod'); } } if (!empty($object['ExpenseLineMod'])) { foreach ($object['ExpenseLineMod'] as $key => $obj) { $obj->setOverride('ExpenseLineMod'); } } break; } return parent::asXML($root, $parent, $object); }
/** * Convert this object to a valid qbXML request * * @param string $request The type of request to convert this to (examples: CustomerAddRq, CustomerModRq, CustomerQueryRq) * @param boolean $todo_for_empty_elements A constant, one of: QUICKBOOKS_XML_XML_COMPRESS, QUICKBOOKS_XML_XML_DROP, QUICKBOOKS_XML_XML_PRESERVE * @param string $indent * @param string $root * @return string */ public function asQBXML($request, $version = null, $locale = null, $root = null) { return parent::asQBXML($request, $version, $locale, $root); }
// Print it... print_r($Object); // ... and some qbXML for good measure! print('[' . $Object->object() . ']: ' . $Object->asQBXML(QUICKBOOKS_ADD_SALESTAXGROUPITEM)); */ // Does it work for service items? $qbxml = '<ItemServiceRet> <ListID>280001-1265079883</ListID> <TimeCreated>2010-02-01T22:04:43-05:00</TimeCreated> <TimeModified>2010-02-01T22:04:43-05:00</TimeModified> <EditSequence>1265079883</EditSequence> <Name>Crazy Horse</Name> <FullName>Crazy Horse</FullName> <IsActive>true</IsActive> <Sublevel>0</Sublevel> <SalesTaxCodeRef> <ListID>10000-1211065841</ListID> <FullName>Tax</FullName> </SalesTaxCodeRef> <SalesOrPurchase> <Price>0.00</Price> <AccountRef> <ListID>440000-1265079854</ListID> <FullName>Consulting Income</FullName> </AccountRef> </SalesOrPurchase> </ItemServiceRet>'; $Object = QuickBooks_QBXML_Object::fromQBXML($qbxml, QUICKBOOKS_QUERY_ITEM); print '[' . $Object->object() . ']: ' . $Object->asQBXML(QUICKBOOKS_ADD_SERVICEITEM);
public function asXML($root = null, $parent = null, $object = null) { switch ($parent) { case QUICKBOOKS_ADD_SALESRECEIPT: $root = 'SalesReceiptLineAdd'; $parent = null; break; case QUICKBOOKS_MOD_SALESRECEIPT: $root = 'SalesReceiptLineMod'; $parent = null; break; } return parent::asXML($root, $parent, $object); }