/quickbooks/QuickBooks/QBXML/Object/InventoryAdjustment.php

https://bitbucket.org/211enterprises/laracing · PHP · 590 lines · 143 code · 38 blank · 409 comment · 4 complexity · 093085b0fd8e698feb1926b1a3719e7b MD5 · raw file

  1. <?php
  2. /**
  3. * QuickBooks InventoryAdjustment object container
  4. *
  5. * @todo Verify the get/set methods on this one... it was copied from InventoryItem
  6. *
  7. * @author Harley Laue <harley.laue@gmail.com>
  8. * @license LICENSE.txt
  9. *
  10. * @package QuickBooks
  11. * @subpackage Object
  12. */
  13. /**
  14. * QuickBooks object base class
  15. */
  16. QuickBooks_Loader::load('/QuickBooks/QBXML/Object.php');
  17. /**
  18. * InventoryAdjustmentLine lines for InventoryAdjustments
  19. */
  20. QuickBooks_Loader::load('/QuickBooks/QBXML/Object/InventoryAdjustment/InventoryAdjustmentLine.php');
  21. /**
  22. * Quickbooks InventoryAdjustment definition
  23. */
  24. class QuickBooks_QBXML_Object_InventoryAdjustment extends QuickBooks_QBXML_Object
  25. {
  26. /**
  27. * Create a new QuickBooks InventoryAdjustment object
  28. *
  29. * @param array $arr
  30. */
  31. public function __construct($arr = array())
  32. {
  33. parent::__construct($arr);
  34. }
  35. /**
  36. * Gets the Account ListID
  37. */
  38. public function getAccountListID()
  39. {
  40. return $this->get('AccountRef ListID');
  41. }
  42. /**
  43. * Set the Account ListID
  44. *
  45. * @param string ListID
  46. * @return boolean
  47. */
  48. public function setAccountListID($value)
  49. {
  50. return $this->set('AccountRef ListID', $value);
  51. }
  52. /**
  53. * Gets the Account Name
  54. */
  55. public function getAccountName()
  56. {
  57. return $this->get('AccountRef FullName');
  58. }
  59. /**
  60. * Set the account Name
  61. *
  62. * @param string name
  63. * @return boolean
  64. */
  65. public function setAccountName($value)
  66. {
  67. return $this->set('AccountRef FullName', $value);
  68. }
  69. /**
  70. * Gets the transaction date
  71. */
  72. public function getTxnDate()
  73. {
  74. return $this->get('TxnDate');
  75. }
  76. /**
  77. * Set the transaction date
  78. *
  79. * @param string
  80. * @return boolean
  81. */
  82. public function setTxnDate($value)
  83. {
  84. return $this->set('TxnDate', $value);
  85. }
  86. /**
  87. * Gets the RefNumber
  88. */
  89. public function getRefNumber()
  90. {
  91. return $this->get('RefNumber');
  92. }
  93. /**
  94. * Set the RefNumber
  95. *
  96. * @return boolean
  97. */
  98. public function setRefNumber($value)
  99. {
  100. return $this->set('RefNumber', $value);
  101. }
  102. /**
  103. * Gets the Memo
  104. */
  105. public function getMemo()
  106. {
  107. return $this->get('Memo');
  108. }
  109. /**
  110. * Set the Memo
  111. *
  112. * @param string
  113. * @return boolean
  114. */
  115. public function setMemo($value)
  116. {
  117. return $this->set('Memo', $value);
  118. }
  119. /**
  120. * Gets the Customer ListID
  121. */
  122. public function getCustomerListID()
  123. {
  124. return $this->get('CustomerRef ListID');
  125. }
  126. /**
  127. * Set the Customer ListID
  128. *
  129. * @param string $ListID
  130. * @return boolean
  131. */
  132. public function setCustomerListID($ListID)
  133. {
  134. return $this->set('CustomerRef ListID', $ListID);
  135. }
  136. /**
  137. * Gets the Customer Name
  138. */
  139. public function getCustomerName()
  140. {
  141. return $this->get('CustomerRef FullName');
  142. }
  143. /**
  144. * Set the Customer Name
  145. *
  146. * @param string $name
  147. * @return boolean
  148. */
  149. public function setCustomerName($name)
  150. {
  151. return $this->set('CustomerRef FullName', $name);
  152. }
  153. /**
  154. * Gets the Class ListID
  155. */
  156. public function getClassListID()
  157. {
  158. return $this->get('ClassRef ListID');
  159. }
  160. /**
  161. * Set the class ListID
  162. *
  163. * @param string $ListID
  164. * @return boolean
  165. */
  166. public function setClassListID($ListID)
  167. {
  168. return $this->set('ClassRef ListID', $ListID);
  169. }
  170. /**
  171. * Gets the Class Name
  172. */
  173. public function getClassName()
  174. {
  175. return $this->get('ClassRef FullName');
  176. }
  177. /**
  178. * Set the class name
  179. *
  180. * @param string $name
  181. * @return boolean
  182. */
  183. public function setClassName($name)
  184. {
  185. return $this->set('ClassRef Name', $name);
  186. }
  187. public function addInventoryAdjustmentLine($obj)
  188. {
  189. return $this->addListItem('InventoryAdjustmentLine', $obj);
  190. }
  191. /**
  192. * Gets the InventoryAdjustmentLine at @param $i
  193. *
  194. * @param $i a number between 0 and added Lines-1
  195. */
  196. public function getInventoryAdjustmentLine($i)
  197. {
  198. return $this->getListItem('InventoryAdjustmentLine', $i);
  199. }
  200. /**
  201. * Gets a list of all InventoryAdjustment Lines
  202. */
  203. public function getInventoryAdjustmentLines()
  204. {
  205. return $this->getList('InventoryAdjustmentLine');
  206. }
  207. /********* Query ************/
  208. /*
  209. public function getTxnID()
  210. {
  211. return $this->get('TxnID');
  212. }
  213. public function setTxnID($TxnID)
  214. {
  215. return $this->set('TxnID', $TxnID);
  216. }
  217. public function getRefNumberCaseSensitive()
  218. {
  219. return $this->get('RefNumberCaseSensitive');
  220. }
  221. public function setRefNumberCaseSensitive($value)
  222. {
  223. return $this->set('RefNumberCaseSensitive', $value);
  224. }
  225. public function getMaxReturned()
  226. {
  227. return $this->get('MaxReturned');
  228. }
  229. public function setMaxReturned($max)
  230. {
  231. return $this->set('MaxReturned', $max);
  232. }
  233. public function getFromModifiedDate()
  234. {
  235. return $this->get('ModifiedDateRangeFilter FromModifiedDate');
  236. }
  237. public function setFromModifiedDate($date)
  238. {
  239. return $this->set('ModifiedDateRangeFilter FromModifiedDate', $date);
  240. }
  241. public function getToModifiedDate()
  242. {
  243. return $this->get('ModifiedDateRangeFilter ToModifiedDate');
  244. }
  245. public function setToModifiedDate($date)
  246. {
  247. return $this->set('ModifiedDateRangeFilter ToModifiedDate', $date);
  248. }
  249. public function getFromTxnDate()
  250. {
  251. return $this->get('TxnDateRangeFilter FromTxnDate');
  252. }
  253. public function setFromTxnDate($date)
  254. {
  255. return $this->set('TxnDateRangeFilter FromTxnDate', $date);
  256. }
  257. public function getToTxnDate()
  258. {
  259. return $this->get('TxnDateRangeFilter ToTxnDate');
  260. }
  261. public function setToTxnDate($date)
  262. {
  263. return $this->set('TxnDateRangeFilter ToTxnDate', $date);
  264. }
  265. public function getDateMacro()
  266. {
  267. return $this->get('TxnDateRangeFilter DateMacro');
  268. }
  269. public function setDateMacro($macro)
  270. {
  271. return $this->set('TxnDateRangeFilter DateMacro', $macro);
  272. }
  273. public function getEntityListID()
  274. {
  275. return $this->get('EntityFilter ListID');
  276. }
  277. public function setEntityListID($listid)
  278. {
  279. return $this->set('EntityFilter ListID', $listid);
  280. }
  281. public function getEntityFullName()
  282. {
  283. return $this->get('EntityFilter FullName');
  284. }
  285. public function setEntityFullName($name)
  286. {
  287. return $this->set('EntityFilter FullName', $name);
  288. }
  289. public function getEntityListIDWithChildren()
  290. {
  291. return $this->get('EntityFilter ListIDWithChildren');
  292. }
  293. public function setEntityListIDWithChildren($listid)
  294. {
  295. return $this->set('EntityFilter ListIDWithChildren', $listid);
  296. }
  297. public function getEntityFullNameWithChildren()
  298. {
  299. return $this->get('EntityFilter FullNameWithChildren');
  300. }
  301. public function setEntityFullNameWithChildren($name)
  302. {
  303. return $this->set('EntityFilter FullNameWithChildren', $name);
  304. }
  305. public function getFilterAccountListID()
  306. {
  307. return $this->get('AccountFilter ListID');
  308. }
  309. public function setFilterAccountListID($listid)
  310. {
  311. return $this->set('AccountFilter ListID', $listid);
  312. }
  313. public function getFilterAccountFullName()
  314. {
  315. return $this->get('AccountFilter FullName');
  316. }
  317. public function setFilterAccountFullName($name)
  318. {
  319. return $this->set('AccountFilter FullName', $name);
  320. }
  321. public function getFilterAccountListIDWithChildren()
  322. {
  323. return $this->get('AccountFilter ListIDWithChildren');
  324. }
  325. public function setFilterAccountListIDWithChildren($listid)
  326. {
  327. return $this->set('AccountFilter ListIDWithChildren', $listid);
  328. }
  329. public function getFilterAccountFullNameWithChildren()
  330. {
  331. return $this->get('AccountFilter FullNameWithChildren');
  332. }
  333. public function setFilterAccountFullNameWithChildren($name)
  334. {
  335. return $this->set('AccountFilter FullNameWithChildren', $name);
  336. }
  337. public function getFilterItemListID()
  338. {
  339. return $this->get('ItemFilter ListID');
  340. }
  341. public function setFilterItemListID($listid)
  342. {
  343. return $this->set('ItemFilter ListID', $listid);
  344. }
  345. public function getFilterItemName()
  346. {
  347. return $this->get('ItemFilter FullName');
  348. }
  349. public function setFilterItemName($name)
  350. {
  351. return $this->set('ItemFilter FullName', $name);
  352. }
  353. public function getFilterItemListIDWithChildren()
  354. {
  355. return $this->get('ItemFilter ListIDWithChildren');
  356. }
  357. public function setFilterItemListIDWithChildren($listid)
  358. {
  359. return $this->set('ItemFilter ListIDWithChildren', $listid);
  360. }
  361. public function getFilterItemFullNameWithChildren()
  362. {
  363. return $this->get('ItemFilter FullNameWithChildren');
  364. }
  365. public function setFilterItemFullNameWithChildren($name)
  366. {
  367. return $this->set('ItemFilter FullNameWithChildren', $name);
  368. }
  369. public function getFilterRefNumberMatchCriterion()
  370. {
  371. return $this->get('RefNumberFilter MatchCriterion');
  372. }
  373. public function setFilterRefNumberMatchCriterion($refnumber)
  374. {
  375. return $this->set('RefNumberFilter MatchCriterion', $refnumber);
  376. }
  377. public function getFilterRefNumberRefNumber()
  378. {
  379. return $this->get('RefNumberFilter RefNumber');
  380. }
  381. public function setFilterRefNumberRefNumber($refnumber)
  382. {
  383. return $this->set('RefNumberFilter RefNumber', $refnumber);
  384. }
  385. public function getFilterRefNumberRangeFromRefNumber()
  386. {
  387. return $this->get('RefNumberRangeFilter FromRefNumber');
  388. }
  389. public function setFilterRefNumberRangeFromRefNumber($refnumber)
  390. {
  391. return $this->set('RefNumberRangeFilter FromRefNumber', $refnumber);
  392. }
  393. public function getFilterRefNumberRangeToRefNumber()
  394. {
  395. return $this->get('RefNumberRangeFilter ToRefNumber');
  396. }
  397. public function setFilterRefNumberRangeToRefNumber($refnumber)
  398. {
  399. return $this->set('RefNumberRangeFilter ToRefNumber', $refnumber);
  400. }
  401. */
  402. // Are these needed or useful to include?
  403. /*
  404. public function getIncludeLineItems()
  405. {
  406. return $this->get('IncludeLineItems');
  407. }
  408. public function setIncludeLineItems($)
  409. {
  410. return $this->set('IncludeLineItems', $);
  411. }
  412. public function getIncludeRetElement()
  413. {
  414. return $this->get('IncludeRetElement');
  415. }
  416. public function setIncludeRetElement($)
  417. {
  418. return $this->set('IncludeRetElement', $);
  419. }
  420. public function getOwnerID()
  421. {
  422. return $this->get('OwnerID');
  423. }
  424. public function setOwnerID($)
  425. {
  426. return $this->set('OwnerID', $);
  427. }
  428. */
  429. /**
  430. *
  431. *
  432. * @return boolean
  433. */
  434. protected function _cleanup()
  435. {
  436. return true;
  437. }
  438. public function asList($request)
  439. {
  440. switch ($request)
  441. {
  442. case QUICKBOOKS_ADD_INVENTORYADJUSTMENT . 'Rq':
  443. if (isset($this->_object['InventoryAdjustmentLine']))
  444. {
  445. $this->_object['InventoryAdjustmentLineAdd'] = $this->_object['InventoryAdjustmentLine'];
  446. }
  447. break;
  448. }
  449. return parent::asList($request);
  450. }
  451. /**
  452. *
  453. */
  454. public function asArray($request, $nest = true)
  455. {
  456. $this->_cleanup();
  457. return parent::asArray($request, $nest);
  458. }
  459. public function asXML($root = null, $parent = null, $object = null)
  460. {
  461. if (is_null($object))
  462. {
  463. $object = $this->_object;
  464. }
  465. switch ($root)
  466. {
  467. case QUICKBOOKS_ADD_INVENTORYADJUSTMENT:
  468. foreach ($object['InventoryAdjustmentLineAdd'] as $key => $obj)
  469. {
  470. $obj->setOverride('InventoryAdjustmentLineAdd');
  471. }
  472. $parent = null;
  473. break;
  474. }
  475. return parent::asXML($root, $parent, $object);
  476. }
  477. /**
  478. * Convert this object to a valid qbXML request
  479. *
  480. * @param string $request The type of request to convert this to (examples: CustomerAddRq, CustomerModRq, CustomerQueryRq)
  481. * @param boolean $todo_for_empty_elements A constant, one of: QUICKBOOKS_XML_XML_COMPRESS, QUICKBOOKS_XML_XML_DROP, QUICKBOOKS_XML_XML_PRESERVE
  482. * @param string $indent
  483. * @param string $root
  484. * @return string
  485. */
  486. public function asQBXML($request, $todo_for_empty_elements = QUICKBOOKS_OBJECT_XML_DROP, $indent = "\t", $root = null)
  487. {
  488. $this->_cleanup();
  489. return parent::asQBXML($request, $todo_for_empty_elements, $indent, $root);
  490. }
  491. /**
  492. * Tell what type of object this is
  493. *
  494. * @return string
  495. */
  496. public function object()
  497. {
  498. return QUICKBOOKS_OBJECT_INVENTORYADJUSTMENT;
  499. }
  500. }