Merge branch 'master' of github.com:easysoft/zentaopms
This commit is contained in:
+7
-8
@@ -1222,7 +1222,6 @@ CREATE TABLE IF NOT EXISTS `zt_user` (
|
||||
`type` char(30) NOT NULL default 'inside',
|
||||
`dept` mediumint(8) unsigned NOT NULL default '0',
|
||||
`account` char(30) NOT NULL default '',
|
||||
`type` char(30) NOT NULL DEFAULT 'inside',
|
||||
`password` char(32) NOT NULL default '',
|
||||
`role` char(10) NOT NULL default '',
|
||||
`realname` varchar(100) NOT NULL default '',
|
||||
@@ -1379,14 +1378,14 @@ CREATE TABLE IF NOT EXISTS `zt_weeklyreport`(
|
||||
UNIQUE KEY `week` (`PRJ`,`weekStart`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
-- DROP TABLE IF EXISTS `zt_workestimation`;
|
||||
CREATE TABLE IF NOT EXISTS `zt_workestimation` (
|
||||
CREATE TABLE `zt_workestimation` (
|
||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`PRJ` mediumint(8) unsigned NOT NULL,
|
||||
`scale` mediumint(8) unsigned NOT NULL,
|
||||
`productivity` smallint(3) unsigned NOT NULL,
|
||||
`duration` mediumint(8) unsigned NOT NULL,
|
||||
`unitLaborCost` mediumint(8) unsigned NOT NULL,
|
||||
`totalLaborCost` mediumint(8) unsigned NOT NULL,
|
||||
`scale` decimal(10,2) unsigned NOT NULL,
|
||||
`productivity` decimal(10,2) unsigned NOT NULL,
|
||||
`duration` decimal(10,2) unsigned NOT NULL,
|
||||
`unitLaborCost` decimal(10,2) unsigned NOT NULL,
|
||||
`totalLaborCost` decimal(10,2) unsigned NOT NULL,
|
||||
`createdBy` varchar(30) NOT NULL,
|
||||
`createdDate` datetime NOT NULL,
|
||||
`editedBy` varchar(30) NOT NULL,
|
||||
@@ -1394,7 +1393,7 @@ CREATE TABLE IF NOT EXISTS `zt_workestimation` (
|
||||
`assignedTo` varchar(30) NOT NULL,
|
||||
`assignedDate` datetime NOT NULL,
|
||||
`deleted` enum('0','1') NOT NULL DEFAULT '0',
|
||||
`dayHour` float(5,2) DEFAULT NULL,
|
||||
`dayHour` decimal(10,2) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
-- DROP TABLE IF EXISTS `zt_log`;
|
||||
|
||||
+34
-25
@@ -445,35 +445,44 @@ class installModel extends model
|
||||
*/
|
||||
public function createTable($version)
|
||||
{
|
||||
$this->dbh->exec("USE {$this->config->db->name}");
|
||||
|
||||
$dbFile = $this->app->getAppRoot() . 'db' . DS . 'zentao.sql';
|
||||
$tables = explode(';', file_get_contents($dbFile));
|
||||
|
||||
foreach($tables as $table)
|
||||
/* Add exception handling to ensure that all SQL is executed successfully. */
|
||||
try
|
||||
{
|
||||
$table = trim($table);
|
||||
if(empty($table)) continue;
|
||||
$this->dbh->exec("USE {$this->config->db->name}");
|
||||
|
||||
if(strpos($table, 'CREATE') !== false and $version <= 4.1)
|
||||
$dbFile = $this->app->getAppRoot() . 'db' . DS . 'zentao.sql';
|
||||
$tables = explode(';', file_get_contents($dbFile));
|
||||
|
||||
foreach($tables as $table)
|
||||
{
|
||||
$table = str_replace('DEFAULT CHARSET=utf8', '', $table);
|
||||
$table = trim($table);
|
||||
if(empty($table)) continue;
|
||||
|
||||
if(strpos($table, 'CREATE') !== false and $version <= 4.1)
|
||||
{
|
||||
$table = str_replace('DEFAULT CHARSET=utf8', '', $table);
|
||||
}
|
||||
elseif(strpos($table, 'DROP') !== false and $this->post->clearDB != false)
|
||||
{
|
||||
$table = str_replace('--', '', $table);
|
||||
}
|
||||
|
||||
$table = str_replace('__DELIMITER__', ';', $table);
|
||||
$table = str_replace('__TABLE__', $this->config->db->name, $table);
|
||||
|
||||
/* Skip sql that is note. */
|
||||
if(strpos($table, '--') === 0) continue;
|
||||
|
||||
$table = str_replace('`zt_', $this->config->db->name . '.`zt_', $table);
|
||||
$table = str_replace('`ztv_', $this->config->db->name . '.`ztv_', $table);
|
||||
$table = str_replace('zt_', $this->config->db->prefix, $table);
|
||||
if(!$this->dbh->query($table)) return false;
|
||||
}
|
||||
elseif(strpos($table, 'DROP') !== false and $this->post->clearDB != false)
|
||||
{
|
||||
$table = str_replace('--', '', $table);
|
||||
}
|
||||
|
||||
$table = str_replace('__DELIMITER__', ';', $table);
|
||||
$table = str_replace('__TABLE__', $this->config->db->name, $table);
|
||||
|
||||
/* Skip sql that is note. */
|
||||
if(strpos($table, '--') === 0) continue;
|
||||
|
||||
$table = str_replace('`zt_', $this->config->db->name . '.`zt_', $table);
|
||||
$table = str_replace('`ztv_', $this->config->db->name . '.`ztv_', $table);
|
||||
$table = str_replace('zt_', $this->config->db->prefix, $table);
|
||||
if(!$this->dbh->query($table)) return false;
|
||||
}
|
||||
catch (PDOException $exception)
|
||||
{
|
||||
echo $exception->getMessage();
|
||||
die();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ $lang->program->cv = 'CV%';
|
||||
$lang->program->PRJTeamCount = 'Team';
|
||||
$lang->program->PRJLongTime = 'Long-Term Project';
|
||||
|
||||
$lang->program->productNotEmpty = 'Affiliated products cannot be empty!';
|
||||
$lang->program->productNotEmpty = 'Please link products or create products.';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = 'Yuan';
|
||||
|
||||
@@ -87,7 +87,7 @@ $lang->program->cv = 'CV%';
|
||||
$lang->program->PRJTeamCount = 'Team';
|
||||
$lang->program->PRJLongTime = 'Long-Term Project';
|
||||
|
||||
$lang->program->productNotEmpty = 'Affiliated products cannot be empty!';
|
||||
$lang->program->productNotEmpty = 'Please link products or create products.';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = 'Yuan';
|
||||
|
||||
@@ -87,7 +87,7 @@ $lang->program->cv = 'CV%';
|
||||
$lang->program->PRJTeamCount = 'Team';
|
||||
$lang->program->PRJLongTime = 'Long-Term Project';
|
||||
|
||||
$lang->program->productNotEmpty = 'Affiliated products cannot be empty!';
|
||||
$lang->program->productNotEmpty = 'Please link products or create products.';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = 'Yuan';
|
||||
|
||||
@@ -87,7 +87,7 @@ $lang->program->cv = 'CV%';
|
||||
$lang->program->PRJTeamCount = 'Team';
|
||||
$lang->program->PRJLongTime = 'Long-Term Project';
|
||||
|
||||
$lang->program->productNotEmpty = 'Affiliated products cannot be empty!';
|
||||
$lang->program->productNotEmpty = 'Please link products or create products.';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = 'Yuan';
|
||||
|
||||
@@ -87,7 +87,7 @@ $lang->program->cv = 'CV%';
|
||||
$lang->program->PRJTeamCount = '项目成员';
|
||||
$lang->program->PRJLongTime = '长期';
|
||||
|
||||
$lang->program->productNotEmpty = '关联产品不能为空!';
|
||||
$lang->program->productNotEmpty = '请关联产品或创建产品。';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = '元';
|
||||
|
||||
@@ -85,7 +85,7 @@ $lang->program->cv = 'CV%';
|
||||
$lang->program->PRJTeamCount = '項目成員';
|
||||
$lang->program->PRJLongTime = '長期';
|
||||
|
||||
$lang->program->productNotEmpty = '關聯產品不能為空!';
|
||||
$lang->program->productNotEmpty = '請關聯產品或創建產品。';
|
||||
|
||||
$lang->program->unitList[''] = '';
|
||||
$lang->program->unitList['yuan'] = '元';
|
||||
|
||||
+22
-12
@@ -1208,13 +1208,18 @@ class programModel extends model
|
||||
|
||||
if(dao::isError()) return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Judge products not empty. */
|
||||
if(!$_POST['products'][0])
|
||||
{
|
||||
dao::$errors[] = $this->lang->program->productNotEmpty;
|
||||
return false;
|
||||
}
|
||||
/* Judge products not empty. */
|
||||
$linkedProductsCount = 0;
|
||||
foreach($_POST['products'] as $product)
|
||||
{
|
||||
if(!empty($product)) $linkedProductsCount++;
|
||||
}
|
||||
if(empty($linkedProductsCount))
|
||||
{
|
||||
dao::$errors[] = $this->lang->program->productNotEmpty;
|
||||
return false;
|
||||
}
|
||||
|
||||
$requiredFields = $this->config->program->PRJCreate->requiredFields;
|
||||
@@ -1336,13 +1341,18 @@ class programModel extends model
|
||||
|
||||
if(dao::isError()) return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Judge products not empty. */
|
||||
if(!$_POST['products'][0])
|
||||
{
|
||||
dao::$errors[] = $this->lang->program->productNotEmpty;
|
||||
return false;
|
||||
}
|
||||
/* Judge products not empty. */
|
||||
$linkedProductsCount = 0;
|
||||
foreach($_POST['products'] as $product)
|
||||
{
|
||||
if(!empty($product)) $linkedProductsCount++;
|
||||
}
|
||||
if(empty($linkedProductsCount))
|
||||
{
|
||||
dao::$errors[] = $this->lang->program->productNotEmpty;
|
||||
return false;
|
||||
}
|
||||
|
||||
$project = $this->loadModel('file')->processImgURL($project, $this->config->program->editor->prjedit['id'], $this->post->uid);
|
||||
|
||||
Reference in New Issue
Block a user