Skip to content

Commit

Permalink
version 2.3.39.0
Browse files Browse the repository at this point in the history
  • Loading branch information
poluninatm committed Apr 27, 2022
2 parents 5281516 + 4817fef commit 4025732
Show file tree
Hide file tree
Showing 24 changed files with 181 additions and 68 deletions.
2 changes: 1 addition & 1 deletion http/css/main.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions http/html.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
type="text/css"
href="/css/libs.css?v=ead40ab">
<script src="/js/libs.js?v=c27fdf7"></script>
<script src="/js/functions.js?v=4085aac"></script>
<script src="/js/functions.js?v=2d837a4"></script>

<link rel="stylesheet"
type="text/css"
href="/css/main.css?v=d79625a">
<script src="/js/main.js?v=ffa0b02"></script>
href="/css/main.css?v=5ce5924">
<script src="/js/main.js?v=ceaba86"></script>

</head>
<body id="pk">
Expand Down
2 changes: 1 addition & 1 deletion http/js/functions.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion http/js/i18n/ru.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions http/js/main.js

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions totum/common/Lang/RU.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RU implements LangInterface

'You see the contents of the table calculated and saved before the last transaction with the error.' => 'Вы видите содержимое таблицы, вычисленное и сохраненное перед последней транзакцией с ошибкой.',
'System error. Action type not specified.' => 'Системная ошибка. Не указан тип действия.',
'Field [[%s]] of table [[%s]] in row with id [[%s]] contains non-numeric data'=>'Поле [[%s]] таблицы [[%s]] в строке с id [[%s]] содержит нечисловую информацию',
'Field [[%s]] of table [[%s]] in row with id [[%s]] contains non-numeric data' => 'Поле [[%s]] таблицы [[%s]] в строке с id [[%s]] содержит нечисловую информацию',
'Scheme source not defined.' => 'Не определен источник схемы.',
'Fill in the parameter [[%s]].' => 'Заполните параметр [[%s]].',
'Parametr [[%s]] is required.' => 'Параметр [[%s]] обязателен.',
Expand All @@ -40,8 +40,8 @@ class RU implements LangInterface
'The parameter [[%s]] should be of type string.' => 'Параметр [[%s]] должен быть типа строка.',
'The cycles table is specified incorrectly.' => 'Таблица циклов указана неверно.',

'Language %s not found.'=>'Язык %s не найден.',
'You cannot create query to PostgreSql with 65000 and more parameters.'=>'Вы не можете создать запрос к PostgreSql >= 65000 параметров.',
'Language %s not found.' => 'Язык %s не найден.',
'You cannot create query to PostgreSql with 65000 and more parameters.' => 'Вы не можете создать запрос к PostgreSql >= 65000 параметров.',

'For temporary tables only.' => 'Только для временных таблиц',
'For simple and cycles tables only.' => 'Только для простых таблиц и таблиц циклов.',
Expand Down Expand Up @@ -135,7 +135,8 @@ class RU implements LangInterface
'No characters selected for generation.' => 'Не выбраны символы для генерации.',
'For selecting by %s field should be passed only single value or list, not row' => 'Для выбора по %s полю должно передаваться только одно значение или list, а не row',

'The value by %s key is not a row/list'=>'Значение по ключу %s - не row/list',
'The value by %s key is not a row/list' => 'Значение по ключу %s - не row/list',
'The key must be an one value' => 'Ключ должен быть единичным значением',

'There is no NowField enabled in this type of code. We\'ll fix it - write us.' => 'В этом типе кода не подключен NowField. Мы исправимся - напишите нам.',
'[[%s]] is available only for the calculation table in the cycle.' => '[[%s]] доступно только для расчетной таблицы в цикле.',
Expand All @@ -157,7 +158,7 @@ class RU implements LangInterface
'The code should return [[%s]].' => 'Код должен возвращать [[%s]].',
'The [[insert]] field should return list - Table [[%s]]' => 'Поле [[insert]] должно возвращать list - Таблица [[%s]]',
'The [[insert]] field should return a list with unique values - Table [[%s]]' => 'Поле [[insert]] должно возвращать list с уникальными значениями - Таблица [[%s]]',
'This value is not available for entry in field %s.'=>'Это значение не доступно для ввода в поле %s.',
'This value is not available for entry in field %s.' => 'Это значение не доступно для ввода в поле %s.',

'Format sections' => 'Секции форматирования',

Expand All @@ -167,10 +168,14 @@ class RU implements LangInterface

'Page processing time: %s sec.<br/>
RAM: %sM. of %s.<br/>
Sql Schema: %s, V %s<br/>.' => 'Время обработки страницы: %s сек.<br/>
Sql Schema: %s, V %s<br/>' => 'Время обработки страницы: %s сек.<br/>
Оперативная память: %sM. из %s.<br/>
Sql схема: %s, V %s<br/>',


'Order field calculation errors' => 'Ошибки порядка расчета полей',
'in %s table in fields:' => 'в таблице %s в полях: ',

'Settings for sending mail are not set.' => 'Настройки для отправки почты не заданы.',
'The path to ssh script %s is not set.' => 'Не задан путь к ssh скрипту %s.',

Expand Down Expand Up @@ -206,6 +211,7 @@ class RU implements LangInterface
'The cycles table for the adding calculation table [[%s]] is not set.' => 'Не задана таблица циклов для добавляемой расчетной таблицы [[%s]].',
'The format of the schema name is incorrect. Small English letters, numbers and - _' => 'Формат имени схемы неверен. Строчные английские буквы, цифры и - _',
'A scheme exists - choose another one to install.' => 'Схема существует - выберите другую для установки.',
'You can\'t install totum in schema "public"' => 'Нельзя устанавливать Тотум в схему public',
'Category [[%s]] not found for replacement.' => 'Категория [[%s]] не найдена для замены.',
'Role [[%s]] not found for replacement.' => 'Категория [[%s]] не найдена для замены.',
'Branch [[%s]] not found for replacement.' => 'Ветка [[%s]] не найдена для замены.',
Expand Down
23 changes: 22 additions & 1 deletion totum/common/Totum.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
class Totum
{
public const VERSION = '2.3.38.20';
public const VERSION = '2.3.39.0';


public const TABLE_CODE_PARAMS = ['row_format', 'table_format', 'on_duplicate', 'default_action'];
Expand All @@ -49,6 +49,7 @@ class Totum
* @var Conf
*/
private $Config;
private TotumMessenger $Messenger;
/**
* @var User
*/
Expand All @@ -75,6 +76,7 @@ class Totum
*/
protected $CalculateLog;
protected $fieldObjectsCachesVar;
protected array $orderFieldCodeErrors = [];


/**
Expand All @@ -100,6 +102,25 @@ public static function isRealTable($tableRow)
return is_subclass_of(static::getTableClass($tableRow), RealTables::class);
}

public function addOrderFieldCodeError(aTable $Table, string $nameVar)
{
$this->orderFieldCodeErrors[$Table->getTableRow()['name']][$nameVar] = 1;
}


public function getMessenger()
{
return $this->Messenger = $this->Messenger ?? new TotumMessenger();
}

/**
* @return array
*/
public function getOrderFieldCodeErrors(): array
{
return $this->orderFieldCodeErrors;
}

public function getInterfaceDatas()
{
return $this->interfaceData;
Expand Down
4 changes: 4 additions & 0 deletions totum/common/TotumInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ public function createSchema($post, $getFilePath)
$Sql->transactionStart();

$this->consoleLog('Check/create schema');
if($this->Config->getSchema()==='public'){
throw new errorException($this->translate('You can\'t install totum in schema "public"'));
}

$this->checkSchemaExists($post['schema_exists']);

$this->consoleLog('Upload start sql');
Expand Down
18 changes: 18 additions & 0 deletions totum/common/TotumMessenger.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace totum\common;

class TotumMessenger
{

private bool $formatUseRows = false;

public function formatUseRows(bool $formatUseRows): void
{
$this->formatUseRows = $formatUseRows;
}
public function isFormatUseRows(): bool
{
return $this->formatUseRows;
}
}
6 changes: 6 additions & 0 deletions totum/common/calculates/Calculate.php
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,7 @@ function ($item, $isSection, $_itemFull) use ($WhereFieldName, &$paramArray, &$r
if (in_array($nameVar, Model::serviceFields)) {
$rowVar = null;
} else {
$this->Table->getTotum()->addOrderFieldCodeError($this->Table, $this->varName);
$rowVar = ['v' => null];
}
} elseif (key_exists($nameVar, $this->Table->getSortedFields()['filter'])) {
Expand Down Expand Up @@ -1169,6 +1170,11 @@ function ($item, $isSection, $_itemFull) use ($WhereFieldName, &$paramArray, &$r

$this->__processParamItems($paramArray['items'],
function ($item, $isSection) use (&$r, &$itemsNames) {
if(is_array($item)){
throw new errorException($this->translate('The key must be an one value',
$item));
}

$itemsNames .= "[$item]";

if ($isSection) {
Expand Down
2 changes: 1 addition & 1 deletion totum/common/calculates/CalculcateFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class CalculcateFormat extends Calculate
{
protected const formats = ['block', 'color', 'bold', 'background', 'italic', 'decoration', 'progress', 'progresscolor', 'icon', 'text', 'comment', 'hideinpanel', 'tab', 'align', 'editbutton', 'hide', 'placeholder', 'showhand', 'expand', 'textasvalue'];
protected const tableformats = ['buttons', 'blockadd', 'blockdelete', 'block', 'blockorder', 'background', 'blockduplicate', 'tabletitle', 'rowstitle', 'fieldtitle', 'fieldhide', 'tabletext', 'tablehtml', 'tablecomment', 'browsertitle', 'interlace'];
protected const tableformats = ['buttons', 'blockadd', 'blockdelete', 'block', 'blockorder', 'background', 'blockduplicate', 'tabletitle', 'rowstitle', 'fieldtitle', 'fieldhide', 'tabletext', 'tablehtml', 'tablecomment', 'browsertitle', 'interlace', 'printbuttons'];
protected const rowformats = ['block', 'blockdelete', 'blockorder', 'blockduplicate', 'color', 'bold', 'background', 'italic', 'decoration', 'rowcomment'];
protected const floatFormat = ['fill', 'glue', 'maxheight', 'maxwidth', 'nextline', 'blocknum', 'height', 'breakwidth'];

Expand Down
14 changes: 13 additions & 1 deletion totum/common/calculates/FuncNumbersTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace totum\common\calculates;

use totum\common\errorException;

trait FuncNumbersTrait
{

Expand Down Expand Up @@ -33,6 +35,16 @@ public static function bcRoundNumber($val, $step, $dectimal, $type, $logData = [
return bcadd($val, 0, $dectimal);
};

if (is_numeric($val)) {
if (!is_infinite($val)) {
$val = number_format((float)$val, 12, '.', '');
} else {
throw new errorException('Infinite value in round operation');
}
} else {
throw new errorException('Not number value in round operation');
}

if (bccomp($val, 0, 10) === 0) {
} elseif (!empty($step)) {

Expand Down Expand Up @@ -70,7 +82,7 @@ protected function funcNumFormat(string $params): string
{
$params = $this->getParamsArray($params);

if(is_null($params['num']) || $params['num'] ===''){
if (is_null($params['num']) || $params['num'] === '') {
return '';
}

Expand Down
2 changes: 1 addition & 1 deletion totum/common/configs/ConfParent.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ public function getTotumFooter()

return $this->translate('Page processing time: %s sec.<br/>
RAM: %sM. of %s.<br/>
Sql Schema: %s, V %s<br/>.',
Sql Schema: %s, V %s<br/>',
[$genTime, $mb, $memory_limit, $SchemaName, $version]);
}

Expand Down
11 changes: 7 additions & 4 deletions totum/fieldTypes/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,18 @@ public function modify($channel, $changeFlag, $newVal, $oldRow, $row = [], $oldT
protected function getDefaultValue()
{
if (!empty($this->data['multiple'])) {
if ($default = json_decode($this->data['default'] ?? "", true)) {
if ($default = json_decode($this->data['default'] ?? '[]', true)) {
if (!is_array($default)) {
$default = [$default];
}
} else {
$default = [$this->data['default'] ?? ""];
$default = [];
if (key_exists('default', $this->data)) {
$default = [$this->data['default']];
}
}
} else {
$default = $this->data['default'] ?? "";
$default = $this->data['default'] ?? '';
}
return $default;
}
Expand Down Expand Up @@ -857,7 +860,7 @@ public function checkSelectVal($channel, $newVal, array $row, array $tbl, array
}
$this->CalculateCodeSelectValue->hiddenInPreparedList(true);
$list = $this->calculateSelectValueList(['v' => $newVal], $row, $tbl, $vars);
if(is_string($list)){
if (is_string($list)) {
throw new errorException($list);
}
$this->CalculateCodeSelectValue->hiddenInPreparedList(false);
Expand Down
8 changes: 4 additions & 4 deletions totum/fieldTypes/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ public function addViewValues($viewType, array &$valArray, $row, $tbl = [])
break;
case 'print':

if (($isBig = mb_strlen($valArray['v']) > $this->data['viewTextMaxLength']) && !($this->data['printTextfull']??false)) {
if (($isBig = mb_strlen($valArray['v']) > $this->data['viewTextMaxLength']) && !($this->data['printTextfull'] ?? false)) {
$valArray['v'] = mb_substr($valArray['v'], 0, $this->data['viewTextMaxLength']) . '...';
}
$valArray['v'] = htmlspecialchars($valArray['v']);
if ($this->data['textType']==='text') {
if ($this->data['textType'] === 'text') {
$valArray['v'] = nl2br($valArray['v']);
}

Expand All @@ -78,7 +78,7 @@ public function addViewValues($viewType, array &$valArray, $row, $tbl = [])
protected function getDefaultValue()
{
if ($this->data['textType'] === 'json') {
return json_decode($this->data['default'], true) ?? $this->data['default'];
return json_decode($this->data['default'] ?? '', true) ?? $this->data['default'] ?? '';
}
return parent::getDefaultValue();
}
Expand Down Expand Up @@ -108,7 +108,7 @@ protected function modifyValue($modifyVal, $oldVal, $isCheck, $row)
{
if (is_object($modifyVal)) {
if ($modifyVal->sign === '+') {
$modifyVal = $oldVal.(string)$modifyVal->val;
$modifyVal = $oldVal . (string)$modifyVal->val;
} else {
$modifyVal = (string)$modifyVal->val;
}
Expand Down
9 changes: 6 additions & 3 deletions totum/fieldTypes/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -663,15 +663,18 @@ protected function checkValByType(&$val, $row, $isCheck = false)
protected function getDefaultValue()
{
if (!empty($this->data['multiple'])) {
if ($default = json_decode($this->data['default'], true)) {
if ($default = json_decode(($this->data['default'] ?? '[]'), true)) {
if (!is_array($default)) {
$default = [$default];
}
} else {
$default = [$this->data['default']];
$default = [];
if (key_exists('default', $this->data)) {
$default = [$this->data['default']];
}
}
} else {
$default = $this->data['default'];
$default = $this->data['default'] ?? '';
}
return $default;
}
Expand Down
17 changes: 15 additions & 2 deletions totum/moduls/Table/ReadTableActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,13 @@ public function loadPage()
}

$data = $this->Table->getSortedFilteredRows('web', 'web', [], $lastId, $prevLastId, $onPage);
$data['f'] = $this->getTableFormat(array_column($data['rows'], 'id'));

$rowIds = array_column($data['rows'], 'id');
$data['f'] = $this->getTableFormat($rowIds);

if ($this->post['recFormats'] ?? false) {
$data['params'] = $this->addValuesAndFormatsOfParams($this->Table->getTbl()['params'], $rowIds)['params'];
}

return $data;
}
Expand Down Expand Up @@ -1009,7 +1014,7 @@ public function printTable()
if ($columnFooters = array_filter(
$fields,
function ($field) use ($fields) {
if ($field['category'] === 'footer' && $field['column'] && array_key_exists(
if ($field['category'] === 'footer' && !empty($field['column']) && array_key_exists(
$field['column'],
$fields
)) {
Expand Down Expand Up @@ -1219,6 +1224,14 @@ public function getFullTableData($withRecalculate = true)
$result['rows'] = array_merge($rows, $rows_other);
unset($result['f']['order']);
}

if ($this->isPagingView() && $this->Totum->getMessenger()->isFormatUseRows()) {
$result['formatUseRows'] = true;
}
if($this->Totum->getConfig()->getSettings('h_hide_teh_plate')){
$result['hide_teh_plate'] = true;
}

return $result;
}

Expand Down
Loading

0 comments on commit 4025732

Please sign in to comment.