Skip to content

Commit 10f1d5b

Browse files
committed
version 4.9.54.0
2 parents 09f6222 + 1fe72d5 commit 10f1d5b

28 files changed

+379
-198
lines changed

Diff for: http/css/main.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: http/html.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
<link rel="stylesheet"
1212
type="text/css"
13-
href="/css/main.css?v=5669a1d">
14-
<script src="/js/main.js?v=3a41aa5"></script>
13+
href="/css/main.css?v=4c81692">
14+
<script src="/js/main.js?v=69b6ef4"></script>
1515

1616
</head>
1717
<body id="pk">

Diff for: http/js/main.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: totum/common/Cycle.php

+15-8
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public function addVersionForCycle($tableName)
8282
$this->Totum->getTable('calcstable_cycle_version')->reCalculateFromOvers(
8383
['add' => [
8484
['table_name' => $tableName, 'cycle' => $cycleId, 'version' => $defaults['version'], 'ord' => $defaults['default_ord'], 'auto_recalc' => $defaults['default_auto_recalc'] === 'false' ? false : true]
85-
]]
85+
]]/*,
86+
Log: $this->getCyclesTable()->getCalculateLog()*/
8687
);
8788

8889
return $this->cacheVersions[$tableName] = [$defaults['version'], 'true'];
@@ -319,7 +320,7 @@ public function getViewTablesWithOrds()
319320
return $dataWithOrd;
320321
}
321322

322-
public function saveTables($forceReCalculateCyclesTableRow = false, $forceSaveTables = false)
323+
public function saveTables($forceReCalculateCyclesTableRow = false, $forceSaveTables = false, $log = null)
323324
{
324325
$isChanged = false;
325326
/** @var calcsTable $t */
@@ -329,18 +330,17 @@ public function saveTables($forceReCalculateCyclesTableRow = false, $forceSaveTa
329330
}
330331
}
331332
if ($forceReCalculateCyclesTableRow || $isChanged) {
332-
$this->reCalculateCyclesRow();
333+
$this->reCalculateCyclesRow($log);
333334
}
334335
}
335336

336-
public function reCalculateCyclesRow()
337+
public function reCalculateCyclesRow($log)
337338
{
338339
if ($this->getId()) {
339340
$CyclesTable = $this->getCyclesTable();
340-
341341
$CyclesTable->reCalculateFromOvers([
342342
'modify' => [$this->getId() => []],
343-
]);
343+
], $log);
344344
}
345345
}
346346

@@ -363,6 +363,9 @@ public function recalculate($isAdding = false)
363363
unset($t);
364364

365365
$cyclesTable = $this->Totum->getTable($this->cyclesTableId);
366+
367+
$Log = $cyclesTable->calcLog(['name' => 'RECALC', 'table' => 'cycle ' . $this->getId()]);
368+
366369
foreach ($tables as $t) {
367370
if ($tablesUpdates[$t->getTableRow()['id']] === $t->getLastUpdated()) {
368371
/** @var calcsTable $t */
@@ -371,11 +374,15 @@ public function recalculate($isAdding = false)
371374
}
372375
$t->reCalculateFromOvers(
373376
[],
374-
$cyclesTable->getCalculateLog()
377+
$Log
375378
);
379+
376380
}
377381
}
378-
$this->saveTables(true);
382+
383+
$this->saveTables(true, log: $Log);
384+
385+
$cyclesTable->calcLog($Log, 'result', 'done');
379386
}
380387

381388
protected function afterCreate()

Diff for: totum/common/Lang/DE.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public function smallTranslit($s): string
476476
$s,
477477
[
478478
'ß'=>'ss', 'ä'=>'a', 'ü'=>'u', 'ö'=>'o',
479-
479+
'ñ'=>'ny',
480480
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'j', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'y', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'ъ' => '', 'ь' => '']
481481
);
482482
}

Diff for: totum/common/Lang/EN.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function smallTranslit($s): string
8181
$s,
8282
[
8383
'ß'=>'ss', 'ä'=>'a', 'ü'=>'u', 'ö'=>'o',
84-
84+
'ñ'=>'ny',
8585
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'j', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'y', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'ъ' => '', 'ь' => '']
8686
);
8787
}

Diff for: totum/common/Lang/RU.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ public function smallTranslit($s): string
478478
$s,
479479
[
480480
'ß'=>'ss', 'ä'=>'a', 'ü'=>'u', 'ö'=>'o',
481-
481+
'ñ'=>'ny',
482482
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'j', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'y', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'ъ' => '', 'ь' => '']
483483
);
484484
}

Diff for: totum/common/Totum.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
class Totum
2929
{
30-
public const VERSION = '4.9.53.3';
30+
public const VERSION = '4.9.54.0';
3131

3232

3333
public const TABLE_CODE_PARAMS = ['row_format', 'table_format', 'on_duplicate', 'default_action'];

Diff for: totum/common/TotumInstall.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ class Conf extends ConfParent{
151151
152152
const db=$dbExport;
153153
154-
public static \$timeLimit = 120;
154+
public static \$timeLimit = 120; //Do not set long time limits, because this limit is used as param of a PostgreSQL transaction. If you set a very long limit — part of your database may be blocked when errors occur.
155155
156156
const adminEmail='{$post['admin_email']}';
157157

Diff for: totum/common/configs/WithPhpMailerSmtpTrait.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public function sendMail($to, $title, $body, $attachments = [], $from = null, $r
3636
$mail->addAddress($_to); // Add a recipient
3737
}
3838

39-
if($replyTo){
39+
if ($replyTo) {
4040
$mail->addReplyTo($replyTo);
4141
}
42-
if($hcopy){
42+
if ($hcopy) {
4343
$mail->addBCC($hcopy);
4444
}
4545

@@ -54,7 +54,13 @@ public function sendMail($to, $title, $body, $attachments = [], $from = null, $r
5454
$mail->isHTML(true); // Set email format to HTML
5555
$mail->Subject = $title;
5656
$mail->Body = $body;
57-
return $mail->send();
57+
58+
try {
59+
return $mail->send();
60+
} catch (\Exception) {
61+
return $mail->send();
62+
}
63+
5864
} catch (\Exception $e) {
5965
throw new \ErrorException($mail->ErrorInfo);
6066
}

Diff for: totum/common/configs/WithPhpMailerTrait.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public function sendMail($to, $title, $body, $attachments = [], $from = null, $r
4141
$mail->addAddress($_to); // Add a recipient
4242
}
4343

44-
if($replyTo){
44+
if ($replyTo) {
4545
$mail->addReplyTo($replyTo);
4646
}
47-
if($hcopy){
47+
if ($hcopy) {
4848
$mail->addBCC($hcopy);
4949
}
5050

@@ -59,7 +59,11 @@ public function sendMail($to, $title, $body, $attachments = [], $from = null, $r
5959
$mail->isHTML(true); // Set email format to HTML
6060
$mail->Subject = $title;
6161
$mail->Body = $body;
62-
return $mail->send();
62+
try {
63+
return $mail->send();
64+
} catch (\Exception) {
65+
return $mail->send();
66+
}
6367
} catch (\Exception $e) {
6468
throw new \ErrorException($mail->ErrorInfo);
6569
}

Diff for: totum/common/logs/CalculateLog.php

+54-18
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ class CalculateLog
3434
protected $section;
3535

3636
protected $types = [];
37+
protected $typesIndexed = [];
38+
3739

3840
protected $topParent;
3941
/**
4042
* @var mixed|null
4143
*/
4244
protected $tableId;
4345

44-
public function __construct($params = ["Totum"], $parent = null, $tableName = null, $tableId = null, $fieldName = null, $section = null)
46+
public function __construct($params = ['Totum'], $parent = null, $tableName = null, $tableId = null, $fieldName = null, $section = null)
4547
{
4648
$this->startMicrotime = microtime(true);
4749

@@ -72,9 +74,22 @@ public function __construct($params = ["Totum"], $parent = null, $tableName = nu
7274
) . "\n\n";*/
7375
}
7476

77+
/**
78+
* @return array
79+
*/
80+
public function getTypesIndexed($type): bool
81+
{
82+
return $this->typesIndexed[$type] ?? false;
83+
}
84+
7585
public function setLogTypes($types)
7686
{
7787
$this->types = $types;
88+
$this->typesIndexed = [];
89+
foreach ($types as $k) {
90+
$this->typesIndexed[$k] = true;
91+
}
92+
7893
}
7994

8095
public function getTopParent()
@@ -108,28 +123,34 @@ public function getChildInstance($params)
108123
if ($params['field'] ?? null) {
109124
$fieldName = $params['field'];
110125
}
111-
switch ($params['name'] ?? '') {
112-
case 'RECALC':
113-
$section = 'code';
114-
break;
115-
case 'ACTIONS':
116-
$section = 'actions';
117-
break;
118-
case 'SELECTS AND FORMATS':
119-
case 'TABLE FORMAT':
120-
case 'SELECTS AND FORMATS ROWS':
121-
case 'SELECTS AND FORMATS OF OTHER NON-ROWS PARTS':
122-
$section = 'views';
123-
break;
126+
if ($params['recalculate'] ?? '') {
127+
$section = 'code';
128+
} else {
129+
switch ($params['name'] ?? '') {
130+
case 'RECALC':
131+
$section = 'code';
132+
break;
133+
case 'ACTIONS':
134+
$section = 'actions';
135+
break;
136+
case 'SELECTS AND FORMATS':
137+
case 'TABLE FORMAT':
138+
case 'SELECTS AND FORMATS ROWS':
139+
case 'SELECTS AND FORMATS OF OTHER NON-ROWS PARTS':
140+
$section = 'views';
141+
break;
142+
}
124143
}
125144

145+
126146
$logTypes = $this->topParent->getTypes();
127-
if (!$logTypes) {
147+
if (!$logTypes || ($logTypes === ['C'] && (($this->params['cType'] ?? false) || ($this->params['calc'] ?? false)))) {
128148
$log = new CalculateLogEmpty([], $this);
129149
} elseif ($logTypes !== ['all']) {
130150
switch ($section) {
131151
case 'code':
132-
if (($params['field'] ?? null) && !array_intersect(['c', 'flds'], $logTypes)) {
152+
if (($params['field'] ?? $params['recalculate'] ?? null) && !array_intersect(['c', 'flds'],
153+
$logTypes)) {
133154
$log = new CalculateLogEmpty([], $this);
134155
break;
135156
}
@@ -159,6 +180,7 @@ public function getChildInstance($params)
159180
break;
160181
}
161182
}
183+
162184
/*
163185
* ?
164186
* if ($logTypes === ['flds'] && $this->fieldName && $this->section !== 'actions') {
@@ -284,6 +306,10 @@ public function getLogsForJsTree(LangInterface $Lang)
284306
}
285307

286308

309+
if (($this->params['name'] ?? null) === 'ACTIONS' && !$this->children) {
310+
return null;
311+
}
312+
287313
$tree = $this->formatLogItem($tree, $this->topParent->getTypes() === ['flds']);
288314

289315

@@ -496,8 +522,18 @@ protected function formatLogItem(array $tree = [], $withTimes = false): array
496522
if ($this->params['times'] > 0.001) {
497523
$tree['text'] .= ': ' . round($this->params['times'], 3) . ' c.';
498524
}
499-
} elseif (in_array($this->params['result'], ['changed', 'no changed'], true)) {
500-
$tree['text'] .= ': ' . $this->params['result'];
525+
} elseif (in_array($this->params['result'],
526+
['changed', 'not changed'],
527+
true) || (is_array($this->params['result']) && ($this->params['result'][0] ?? null) === 'changed')) {
528+
if (is_array($this->params['result'])) {
529+
$tree['text'] .= ': ' . $this->params['result'][0];
530+
$tree['children'][] = ['text' => 'CHANGES: ' . json_encode($this->params['result'][1],
531+
JSON_UNESCAPED_UNICODE), 'icon' => 'fa fa-puzzle-piece', 'children'];
532+
} else {
533+
$tree['text'] .= ': ' . $this->params['result'];
534+
}
535+
536+
501537
if ($this->params['times'] > 0.001) {
502538
$tree['text'] .= ': ' . round($this->params['times'], 3) . ' c.';
503539
}

0 commit comments

Comments
 (0)