chore: snapshot current working tree changes
Save all currently accumulated repository changes as a backup snapshot for Gitea so no local work is lost.
This commit is contained in:
@@ -235,7 +235,7 @@ class ModComments_Record_Model extends Vtiger_Record_Model {
|
||||
$listView = Vtiger_ListView_Model::getInstance('ModComments');
|
||||
$queryGenerator = $listView->get('query_generator');
|
||||
$queryGenerator->setFields(array('parent_comments', 'createdtime', 'modifiedtime', 'related_to', 'assigned_user_id',
|
||||
'commentcontent', 'creator', 'id', 'customer', 'reasontoedit', 'userid', 'from_mailconverter', 'from_mailroom', 'is_private', 'customer_email', 'related_email_id', 'filename'));
|
||||
'commentcontent', 'creator', 'id', 'customer', 'reasontoedit', 'userid', 'from_mailconverter', 'from_mailroom', 'is_private', 'customer_email', 'related_email_id', 'filename', 'channel'));
|
||||
|
||||
$query = $queryGenerator->getQuery();
|
||||
$query = $query ." AND related_to = ? ORDER BY vtiger_crmentity.createdtime DESC";
|
||||
@@ -253,6 +253,9 @@ class ModComments_Record_Model extends Vtiger_Record_Model {
|
||||
|
||||
for ($i=0; $i<$rows; $i++) {
|
||||
$row = $db->query_result_rowdata($result, $i);
|
||||
if (!isset($row['channel']) || $row['channel'] === null || $row['channel'] === '') {
|
||||
$row['channel'] = self::getChannelById(isset($row['id']) ? $row['id'] : (isset($row['modcommentsid']) ? $row['modcommentsid'] : null));
|
||||
}
|
||||
$recordInstance = new self();
|
||||
$recordInstance->setData($row);
|
||||
$recordInstances[] = $recordInstance;
|
||||
@@ -317,7 +320,7 @@ class ModComments_Record_Model extends Vtiger_Record_Model {
|
||||
|
||||
$listView = Vtiger_ListView_Model::getInstance('ModComments');
|
||||
$queryGenerator = $listView->get('query_generator');
|
||||
$queryGenerator->setFields(array('parent_comments', 'createdtime', 'modifiedtime', 'related_to', 'id', 'assigned_user_id',
|
||||
$queryGenerator->setFields(array('parent_comments', 'createdtime', 'modifiedtime', 'related_to', 'id', 'assigned_user_id', 'channel',
|
||||
'commentcontent', 'creator', 'reasontoedit', 'userid', 'from_mailconverter', 'from_mailroom','is_private', 'customer_email'));
|
||||
$query = $queryGenerator->getQuery();
|
||||
|
||||
@@ -330,6 +333,9 @@ class ModComments_Record_Model extends Vtiger_Record_Model {
|
||||
$rows = $db->num_rows($result);
|
||||
for ($i=0; $i<$rows; $i++) {
|
||||
$row = $db->query_result_rowdata($result, $i);
|
||||
if (!isset($row['channel']) || $row['channel'] === null || $row['channel'] === '') {
|
||||
$row['channel'] = self::getChannelById(isset($row['id']) ? $row['id'] : (isset($row['modcommentsid']) ? $row['modcommentsid'] : null));
|
||||
}
|
||||
$recordInstance = new self();
|
||||
$recordInstance->setData($row);
|
||||
$recordInstances[] = $recordInstance;
|
||||
@@ -354,6 +360,35 @@ class ModComments_Record_Model extends Vtiger_Record_Model {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Подгружаем channel из БД для отображения иконки, если не был в выборке (QueryGenerator может не включать поле).
|
||||
*/
|
||||
public function get($key) {
|
||||
$value = parent::get($key);
|
||||
if ($key === 'channel' && ($value === null || $value === '') && $this->getId()) {
|
||||
$value = self::getChannelById($this->getId());
|
||||
if ($value !== null && $value !== '') {
|
||||
$this->set('channel', $value);
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Возвращает channel из БД по ID комментария.
|
||||
*/
|
||||
public static function getChannelById($commentId) {
|
||||
if (empty($commentId)) {
|
||||
return null;
|
||||
}
|
||||
$db = PearDatabase::getInstance();
|
||||
$r = $db->pquery('SELECT channel FROM vtiger_modcomments WHERE modcommentsid = ?', array($commentId));
|
||||
if ($db->num_rows($r) > 0) {
|
||||
return $db->query_result($r, 0, 'channel');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getCommentedByName() {
|
||||
$customer = $this->get('customer');
|
||||
$customerEmail = $this->get('customer_email');
|
||||
@@ -387,6 +422,9 @@ class ModComments_Record_Model extends Vtiger_Record_Model {
|
||||
$count = $db->num_rows($result);
|
||||
for($i = 0; $i < $count; $i++) {
|
||||
$rowData = $db->query_result_rowdata($result, $i);
|
||||
if (!isset($rowData['channel']) || $rowData['channel'] === null || $rowData['channel'] === '') {
|
||||
$rowData['channel'] = self::getChannelById(isset($rowData['id']) ? $rowData['id'] : (isset($rowData['modcommentsid']) ? $rowData['modcommentsid'] : null));
|
||||
}
|
||||
$recordInstance = new self();
|
||||
$recordInstance->setData($rowData);
|
||||
$recordInstances[] = $recordInstance;
|
||||
|
||||
Reference in New Issue
Block a user