예제 #1
0
 /**
  * Update data on Quickbooks
  * 
  * @return object
  */
 public function update()
 {
     // In order to update an entity, we need to have the complete data. Otherwise, unprovided data will be removed.
     $existing = $this->client->load($this->getId());
     // add existing data
     foreach ($existing as $key => $value) {
         if (!isset($this->data[$key])) {
             $this->data[$key] = $value;
         }
     }
     return $this->client->update($this);
 }
예제 #2
0
 /**
  * Constructor
  * @return void
  */
 public function __construct($options = [])
 {
     parent::__construct($options);
     if (isset($options['callback_url'])) {
         $this->callback_url = $options['callback_url'];
     }
 }
예제 #3
0
파일: Query.php 프로젝트: rangka/quickbooks
 /**
  * Get data from Quickbooks
  * 
  * @return array
  */
 public function get()
 {
     $data = $this->client->get('query?query=' . rawurlencode($this));
     // If Query syntax is incorrect, it will return a 200 with Fault.
     // Lets make that an Exception instead.
     if (property_exists($data, 'Fault')) {
         throw new \Exception('[' . $data->Fault->Error[0]->code . ' ' . $data->Fault->Error[0]->Message . '] ' . $data->Fault->Error[0]->Detail);
     }
     $data = $data->QueryResponse;
     if (!property_exists($data, $this->entity)) {
         $return = new \stdClass();
         $return->{$this->entity} = [];
         $return->maxResults = 0;
         $return->totalCount = 0;
         return $return;
     }
     return $data;
 }
예제 #4
0
 /**
  * Update an entity.
  *
  * @param array $data Item information.
  * @return void
  */
 public function update($data)
 {
     return parent::post($this->getResourceName() . '?operation=update', $data)->{$this->getEntityName()};
 }