/** * Update title and description of a document * * @param Docman_Item $item The item */ public function updateDocument(Docman_Item $item) { $update_data = $this->client->initializeSetterData(); $update_data = $this->client->appendSetterData($update_data, 'title', $item->getTitle()); $update_data = $this->client->appendSetterData($update_data, 'description', $item->getDescription()); $this->client->update($item->getid(), $update_data); }
/** * Update title and description if they've changed * $params are kept as array to be compliant with others events, * but we merely need event objects * * @param array $params */ public function updateDocument($params) { $item = $params['item']; $new_data = $params['new']; $update_data = $this->client->initializeSetterData(); $updated = false; if ($this->titleUpdated($new_data['title'], $item)) { $update_data = $this->client->appendSetterData($update_data, 'title', $new_data['title']); $updated = true; } if ($this->descriptionUpdated($new_data, $item)) { $update_data = $this->client->appendSetterData($update_data, 'description', $new_data['description']); $updated = true; } if ($updated) { $this->client->update($item->getid(), $update_data); } }