Merge branch 'sprint/master_fixbug' into 'master'

* Adjust for license.

See merge request easycorp/zentaopms!2847
This commit is contained in:
王怡栋
2022-04-11 03:09:24 +00:00
2 changed files with 71 additions and 0 deletions
@@ -1,2 +1,3 @@
<?php
$lang->user->task = '任务';
$lang->user->noticeFeedbackUserLimit = "迅捷企业版用户数已经达到授权的上限,不能继续添加用户!";
@@ -0,0 +1,70 @@
<?php if(!empty($properties['user'])):?>
<?php
$userMaxCount = $properties['user']['value'];
$userCount = $this->dao->select("COUNT('*') as count")->from(TABLE_USER)
->where('deleted')->eq(0)
->beginIF($this->config->edition != 'open')->andWhere("visions")->ne('lite')->fi()
->fetch('count');
js::set('userCount', $userCount);
js::set('userMaxCount', $userMaxCount);
js::set('noticeUserCreate', str_replace('%maxcount%', $userMaxCount, $lang->user->noticeUserCreate));
if($this->config->edition != 'open')
{
$liteCount = $this->dao->select("COUNT('*') as count")->from(TABLE_USER)->where('deleted')->eq(0)->andWhere("visions")->eq('lite')->fetch('count');
$liteMaxCount = $properties['lite']['value'];
js::set('liteCount', $liteCount);
js::set('liteMaxCount', $liteMaxCount);
js::set('noticeFeedbackCreate', str_replace('%maxcount%', $liteMaxCount, $lang->user->noticeFeedbackCreate));
}
?>
<script>
$(function()
{
$('#submit').click(function()
{
var allUserCount = parseInt(userCount);
var allLiteCount = parseInt(liteCount);
var lastVision;
$('[id^="account"]').each(function()
{
if($(this).val())
{
var i = parseInt($(this).attr('id').replace(/[^0-9]/ig, ''));
var visions = $('select[id="visions' + i + '"]').val();
if($.inArray("ditto", visions) == '-1') lastVision = visions;
visions = lastVision;
if(visions == undefined) visions = ['lite'];
var index = $.inArray('lite', visions);
if(index != '-1' && visions.length == '1')
{
allLiteCount += 1;
}
else
{
allUserCount += 1;
}
}
});
if(allUserCount > userMaxCount)
{
alert(noticeUserCreate.replace('%usercount%', allUserCount));
return false;
}
if(allLiteCount > liteMaxCount)
{
alert(noticeFeedbackCreate.replace('%usercount%', allLiteCount));
return false;
}
})
})
</script>
<?php endif;?>