Merge branch 'master' into PHRAS-2196-api-stories-pagination

This commit is contained in:
Nicolas Maillat
2019-11-21 17:54:23 +01:00
committed by GitHub
482 changed files with 45299 additions and 36138 deletions

View File

@@ -529,10 +529,13 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
return $this;
}
$coll_id_from = $this->getCollectionId();
$coll_id_to = $collection->get_coll_id();
$sql = "UPDATE record SET moddate = NOW(), coll_id = :coll_id WHERE record_id =:record_id";
$params = [
':coll_id' => $collection->get_coll_id(),
':coll_id' => $coll_id_to,
':record_id' => $this->getRecordId(),
];
@@ -541,12 +544,13 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
$stmt->closeCursor();
$this->base_id = $collection->get_base_id();
$this->app['phraseanet.logger']($this->getDatabox())
->log($this, Session_Logger::EVENT_MOVE, $collection->get_coll_id(), '');
$this->collection_id = $coll_id_to;
$this->delete_data_from_cache();
$this->app['phraseanet.logger']($this->getDatabox())
->log($this, Session_Logger::EVENT_MOVE, $collection->get_coll_id(), '', $coll_id_from);
$this->dispatch(RecordEvents::COLLECTION_CHANGED, new CollectionChangedEvent($this));
return $this;
@@ -1208,13 +1212,14 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
try {
$log_id = $app['phraseanet.logger']($collection->get_databox())->get_id();
$sql = 'INSERT INTO log_docs (id, log_id, date, record_id, action, final, comment)'
. ' VALUES (null, :log_id, now(), :record_id, "add", :coll_id,"")';
$sql = 'INSERT INTO log_docs (id, log_id, date, record_id, coll_id, action, final, comment)'
. ' VALUES (null, :log_id, now(), :record_id, :coll_id, "add", :final, "")';
$stmt = $connection->prepare($sql);
$stmt->execute([
':log_id' => $log_id,
':record_id' => $story_id,
':coll_id' => $collection->get_coll_id(),
':final' => $collection->get_coll_id(),
]);
$stmt->closeCursor();
} catch (\Exception $e) {
@@ -1261,14 +1266,15 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
try {
$log_id = $app['phraseanet.logger']($databox)->get_id();
$sql = "INSERT INTO log_docs (id, log_id, date, record_id, action, final, comment)"
. " VALUES (null, :log_id, now(), :record_id, 'add', :coll_id, '')";
$sql = "INSERT INTO log_docs (id, log_id, date, record_id, coll_id, action, final, comment)"
. " VALUES (null, :log_id, now(), :record_id, :coll_id, 'add', :final, '')";
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute([
':log_id' => $log_id,
':record_id' => $record_id,
':coll_id' => $file->getCollection()->get_coll_id(),
':final' => $file->getCollection()->get_coll_id(),
]);
$stmt->closeCursor();
} catch (\Exception $e) {
@@ -1600,14 +1606,15 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
public function log_view($log_id, $referrer, $gv_sit)
{
$sql = "INSERT INTO log_view (id, log_id, date, record_id, referrer, site_id)"
. " VALUES (null, :log_id, now(), :rec, :referrer, :site)";
$sql = "INSERT INTO log_view (id, log_id, date, record_id, referrer, site_id, coll_id)"
. " VALUES (null, :log_id, now(), :rec, :referrer, :site, :collid)";
$params = [
':log_id' => $log_id
, ':rec' => $this->getRecordId()
, ':referrer' => $referrer
, ':site' => $gv_sit,
, ':site' => $gv_sit
, ':collid' => $this->getCollectionId()
];
$stmt = $this->getDataboxConnection()->prepare($sql);
$stmt->execute($params);