mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
PHRAS-2161_coll-id-in-log-docs_MASTER
add "from_coll_id" parameter to logger, used only when action="collection"
This commit is contained in:
@@ -32,7 +32,6 @@ class Session_Logger
|
|||||||
const EVENT_EXPORTDOWNLOAD = 'download';
|
const EVENT_EXPORTDOWNLOAD = 'download';
|
||||||
const EVENT_EXPORTFTP = 'ftp';
|
const EVENT_EXPORTFTP = 'ftp';
|
||||||
const EVENT_EXPORTMAIL = 'mail';
|
const EVENT_EXPORTMAIL = 'mail';
|
||||||
const EVENT_MOVE_FROM = 'collection_from';
|
|
||||||
const EVENT_MOVE = 'collection';
|
const EVENT_MOVE = 'collection';
|
||||||
const EVENT_PRINT = 'print';
|
const EVENT_PRINT = 'print';
|
||||||
const EVENT_PUSH = 'push';
|
const EVENT_PUSH = 'push';
|
||||||
@@ -64,17 +63,18 @@ class Session_Logger
|
|||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function log(record_adapter $record, $action, $final, $comment)
|
public function log(record_adapter $record, $action, $final, $comment, $coll_id_from=null)
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO log_docs
|
$sql = 'INSERT INTO log_docs
|
||||||
(id, log_id, date, record_id, coll_id, action, final, comment)
|
(id, log_id, date, record_id, coll_id_from, coll_id, action, final, comment)
|
||||||
VALUES (null, :log_id, NOW(), :record_id, :coll_id, :action, :final, :comm)';
|
VALUES (null, :log_id, NOW(), :record_id, :coll_id_from, :coll_id, :action, :final, :comm)';
|
||||||
|
|
||||||
$stmt = $this->databox->get_connection()->prepare($sql);
|
$stmt = $this->databox->get_connection()->prepare($sql);
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
':log_id' => $this->get_id(),
|
':log_id' => $this->get_id(),
|
||||||
':record_id' => $record->getRecordId(),
|
':record_id' => $record->getRecordId(),
|
||||||
|
':coll_id_from' => $coll_id_from,
|
||||||
':coll_id' => $record->getCollectionId(),
|
':coll_id' => $record->getCollectionId(),
|
||||||
':action' => $action,
|
':action' => $action,
|
||||||
':final' => $final,
|
':final' => $final,
|
||||||
|
@@ -529,8 +529,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->app['phraseanet.logger']($this->getDatabox())
|
$coll_id_from = $this->getCollectionId();
|
||||||
->log($this, Session_Logger::EVENT_MOVE_FROM, $this->getCollectionId(), '');
|
|
||||||
|
|
||||||
$sql = "UPDATE record SET moddate = NOW(), coll_id = :coll_id WHERE record_id =:record_id";
|
$sql = "UPDATE record SET moddate = NOW(), coll_id = :coll_id WHERE record_id =:record_id";
|
||||||
|
|
||||||
@@ -546,7 +545,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
|||||||
$this->base_id = $collection->get_base_id();
|
$this->base_id = $collection->get_base_id();
|
||||||
|
|
||||||
$this->app['phraseanet.logger']($this->getDatabox())
|
$this->app['phraseanet.logger']($this->getDatabox())
|
||||||
->log($this, Session_Logger::EVENT_MOVE, $collection->get_coll_id(), '');
|
->log($this, Session_Logger::EVENT_MOVE, $collection->get_coll_id(), '', $coll_id_from);
|
||||||
|
|
||||||
$this->delete_data_from_cache();
|
$this->delete_data_from_cache();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user