* Fix primary key of dmdb.
This commit is contained in:
@@ -595,7 +595,7 @@ class baseHelper
|
||||
*/
|
||||
static public function isZeroDate($date)
|
||||
{
|
||||
return (empty($date) or substr($date, 0, 4) == '0000');
|
||||
return (empty($date) or substr($date, 0, 4) <= '1970');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1008,7 +1008,7 @@ if (!function_exists('getallheaders')) {
|
||||
function getallheaders()
|
||||
{
|
||||
$headers = array();
|
||||
foreach ($_SERVER as $name => $value)
|
||||
foreach ($_SERVER as $name => $value)
|
||||
{
|
||||
if (substr($name, 0, 5) == 'HTTP_')
|
||||
{
|
||||
|
||||
@@ -1703,6 +1703,8 @@ class baseSQL
|
||||
continue;
|
||||
}
|
||||
if(strpos($this->skipFields, ",$field,") !== false) continue;
|
||||
if($field == 'id' and $this->method == 'update') continue; // primary key not allowed in dmdb.
|
||||
|
||||
$this->sql .= "`$field` = " . $this->quote($value) . ',';
|
||||
}
|
||||
}
|
||||
|
||||
+13
-3
@@ -255,7 +255,8 @@ class dm extends dao
|
||||
|
||||
public function getPKColumns()
|
||||
{
|
||||
$sql = "SELECT A.OWNER, A.TABLE_NAME, WM_CONCAT(B.COLUMN_NAME) PK_COLUMNS FROM ALL_CONSTRAINTS A, ALL_CONS_COLUMNS B where A.CONSTRAINT_type = 'P' AND A.OWNER = '{$this->config->db->user}' AND A.TABLE_NAME = '{$this->table}' AND B.OWNER = A.OWNER AND A.TABLE_NAME = B.TABLE_NAME GROUP BY A.OWNER, A.TABLE_NAME;";
|
||||
$table = trim($this->table, '`');
|
||||
$sql = "SELECT A.OWNER, A.TABLE_NAME, WM_CONCAT(B.COLUMN_NAME) PK_COLUMNS FROM ALL_CONSTRAINTS A, ALL_CONS_COLUMNS B where A.CONSTRAINT_type = 'P' AND A.OWNER = '{$this->config->db->name}' AND A.TABLE_NAME = '{$table}' AND B.OWNER = A.OWNER AND A.TABLE_NAME = B.TABLE_NAME GROUP BY A.OWNER, A.TABLE_NAME;";
|
||||
|
||||
$content = $this->dbh->query($sql)->fetch();
|
||||
return empty($content) ? false : $content->PK_COLUMNS;
|
||||
@@ -300,8 +301,17 @@ class dm extends dao
|
||||
$insertSql .= $fields . ' ' . $values;
|
||||
|
||||
$updateSql = str_replace('REPLACE', 'UPDATE', $sql);
|
||||
$pk = $this->getPKColumns();
|
||||
if(!empty($pk) && isset($this->sqlobj->data->{$pk})) $updateSql .= " where {$pk} = '{$this->sqlobj->data->{$pk}}'";
|
||||
$pks = $this->getPKColumns();
|
||||
if(!empty($pks))
|
||||
{
|
||||
$pks = explode(',', $pks);
|
||||
$conditions = array();
|
||||
foreach($pks as $pk)
|
||||
{
|
||||
if(isset($this->sqlobj->data->{$pk})) $conditions[] = " \"{$pk}\" = '{$this->sqlobj->data->{$pk}}'";
|
||||
}
|
||||
$updateSql .= ' WHERE ' . implode(' AND ', $conditions);
|
||||
}
|
||||
|
||||
$deleteSql = "DELETE FROM {$this->table} WHERE ";
|
||||
$ingore = array();
|
||||
|
||||
@@ -3857,6 +3857,8 @@ class executionModel extends model
|
||||
$burn->estimate -= (int)$finishedEstimate->estimate;
|
||||
}
|
||||
|
||||
$burn->product = 0;
|
||||
$burn->task = 0;
|
||||
if(isset($storyPoints[$executionID])) $burn->storyPoint = $storyPoints[$executionID]->storyPoint;
|
||||
|
||||
$this->dao->replace(TABLE_BURN)->data($burn)->exec();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @copyright Copyright 2009-2015 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Chunsheng Wang<wwccss@gmail.com>
|
||||
* @package project
|
||||
* @package project
|
||||
* @version $Id: suspend.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
@@ -33,11 +33,11 @@
|
||||
<tr>
|
||||
<th><?php echo $lang->project->realEnd;?></th>
|
||||
<td>
|
||||
<div class='w-150px'>
|
||||
<?php echo html::input('realEnd',(!empty($project->realEnd) && $project->realEnd != '0000-00-00' ? $project->realEnd : date('Y-m-d')), "class='form-control form-date' required");?>
|
||||
</div>
|
||||
<div class='w-150px'>
|
||||
<?php echo html::input('realEnd',(!helper::isZeroDate($project->realEnd) ? $project->realEnd : date('Y-m-d')), "class='form-control form-date' required");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='w-50px'><?php echo $lang->comment;?></th>
|
||||
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
|
||||
|
||||
Reference in New Issue
Block a user