* Fix create program.

This commit is contained in:
holan20180123
2021-03-08 11:46:44 +08:00
parent ff07ecad8e
commit b2b617ff7d
6 changed files with 17 additions and 39 deletions

View File

@@ -69,8 +69,8 @@ ALTER TABLE `zt_user` ADD `strategy` text NOT NULL AFTER `analysis`;
ALTER TABLE `zt_user` CHANGE `avatar` `avatar` text NOT NULL AFTER `commiter`;
REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'custom', '', 'URSR', '6');
REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'program', '', 'unitList', 'CNY,USD');
REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'program', '', 'defaultCurrency', 'CNY');
REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'project', '', 'unitList', 'CNY,USD');
REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'project', '', 'defaultCurrency', 'CNY');
ALTER TABLE `zt_config` MODIFY COLUMN `value` longtext NOT NULL AFTER `key`;

View File

@@ -1142,7 +1142,7 @@ CREATE TABLE IF NOT EXISTS `zt_usergroup` (
`account` char(30) NOT NULL default '',
`group` mediumint(8) unsigned NOT NULL default '0',
`project` text NOT NULL,
UNIQUE KEY `account` (`account`,`group`)
UNIQUE KEY `account` (`account`,`group`,`project`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- DROP TABLE IF EXISTS `zt_userquery`;
CREATE TABLE IF NOT EXISTS `zt_userquery` (
@@ -4137,5 +4137,5 @@ INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRProduct', '1');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRExecution', '1');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'custom', '', 'URSR', '6');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'program', '', 'unitList', 'CNY,USD');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'program', '', 'defaultCurrency', 'CNY');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'project', '', 'unitList', 'CNY,USD');
INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'project', '', 'defaultCurrency', 'CNY');

View File

@@ -246,19 +246,19 @@ function adjustPlanBoxMargin()
$(function()
{
$('#privList > tbody > tr > th input[type=checkbox]').change(function()
{
{
var id = $(this).attr('id');
var checked = $(this).prop('checked');
if(id == 'allChecker')
{
{
$('input[type=checkbox]').prop('checked', checked);
}
}
else
{
{
$(this).parents('tr').find('input[type=checkbox]').prop('checked', checked);
}
});
}
});
})
/**
@@ -295,9 +295,9 @@ function setBudgetTipsAndAclList(programID)
{
$.get(createLink('program', 'ajaxGetBudgetLeft', "ProgramID=" + programID), function(budgetLeft)
{
parentProgram = PGMList[programID];
parentProgram = programList[programID];
programBudget = parentProgram.budget;
PGMBudgetUnit = currencySymbol[program.budgetUnit];
PGMBudgetUnit = currencySymbol[parentProgram.budgetUnit];
budgetNotes = programBudget != 0 ? (PGMParentBudget + PGMBudgetUnit + budgetLeft) : '';
$('#budget').attr('placeholder', budgetNotes);

View File

@@ -311,28 +311,6 @@ class programModel extends model
$this->file->updateObjectID($this->post->uid, $programID, 'program');
$this->setTreePath($programID);
/* Add program admin.*/
$groupPriv = $this->dao->select('t1.*')->from(TABLE_USERGROUP)->alias('t1')
->leftJoin(TABLE_GROUP)->alias('t2')->on('t1.group = t2.id')
->where('t1.account')->eq($this->app->user->account)
->andWhere('t2.role')->eq('programAdmin')
->fetch();
if(!empty($groupPriv))
{
$newProgram = $groupPriv->project . ",$programID";
$this->dao->update(TABLE_USERGROUP)->set('program')->eq($newProgram)->where('account')->eq($groupPriv->account)->andWhere('`group`')->eq($groupPriv->group)->exec();
}
else
{
$programAdminID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('programAdmin')->fetch('id');
$groupPriv = new stdclass();
$groupPriv->account = $this->app->user->account;
$groupPriv->group = $programAdminID;
$groupPriv->project = $programID;
$this->dao->insert(TABLE_USERGROUP)->data($groupPriv)->exec();
}
return $programID;
}
}

View File

@@ -60,7 +60,7 @@
<td class='text-right'><?php echo $program->budget != 0 ? zget($lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $lang->project->future;?></td>
<td class='c-status'><span class="status-program status-<?php echo $program->status?>"><?php echo zget($lang->project->statusList, $program->status, '');?></span></td>
<td><?php echo $program->begin;?></td>
<td><?php echo $program->end == LONG_TIME ? $lang->program->PRJLongTime : $program->end;?></td>
<td><?php echo $program->end == LONG_TIME ? $lang->program->longTime : $program->end;?></td>
<td class='c-actions'>
<?php if($program->type == 'program'):?>
<?php if($program->status == 'wait' || $program->status == 'suspended') common::printIcon('program', 'start', "programID=$program->id", $program, 'list', 'play', '', 'iframe', true, '', $this->lang->program->start);?>

View File

@@ -38,7 +38,7 @@
<?php js::set('currencySymbol', $lang->project->currencySymbol);?>
<?php js::set('PGMParentBudget', $lang->program->parentBudget);?>
<?php js::set('future', $lang->project->future);?>
<?php js::set('PGMList', $PGMList);?>
<?php js::set('programList', $programList);?>
<?php $aclList = $parentProgram ? $lang->program->subAclList : $lang->program->aclList;?>
<?php $requiredFields = $config->program->create->requiredFields;?>
<div id='mainContent' class='main-content'>
@@ -157,10 +157,10 @@
</div>
</div>
<div id='PGMAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->PGMAclList, 'private', "onclick='setWhite(this.value);'", 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->aclList, 'private', "onclick='setWhite(this.value);'", 'block'));?>
</div>
<div id='subPGMAcl' class='hidden'>
<?php echo nl2br(html::radio('acl', $lang->program->subPGMAclList, 'private', "onclick='setWhite(this.value);'", 'block'));?>
<?php echo nl2br(html::radio('acl', $lang->program->subAclList, 'private', "onclick='setWhite(this.value);'", 'block'));?>
</div>
<?php js::set('parentProgramID', isset($parentProgram->id) ? $parentProgram->id : 0);?>
<?php include '../../common/view/footer.html.php';?>