Skip to content

Commit

Permalink
version 4.9.54.0
Browse files Browse the repository at this point in the history
  • Loading branch information
poluninatm committed May 10, 2023
2 parents 09f6222 + 1fe72d5 commit 10f1d5b
Show file tree
Hide file tree
Showing 28 changed files with 379 additions and 198 deletions.
2 changes: 1 addition & 1 deletion http/css/main.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions http/html.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

<link rel="stylesheet"
type="text/css"
href="/css/main.css?v=5669a1d">
<script src="/js/main.js?v=3a41aa5"></script>
href="/css/main.css?v=4c81692">
<script src="/js/main.js?v=69b6ef4"></script>

</head>
<body id="pk">
Expand Down
4 changes: 2 additions & 2 deletions http/js/main.js

Large diffs are not rendered by default.

23 changes: 15 additions & 8 deletions totum/common/Cycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public function addVersionForCycle($tableName)
$this->Totum->getTable('calcstable_cycle_version')->reCalculateFromOvers(
['add' => [
['table_name' => $tableName, 'cycle' => $cycleId, 'version' => $defaults['version'], 'ord' => $defaults['default_ord'], 'auto_recalc' => $defaults['default_auto_recalc'] === 'false' ? false : true]
]]
]]/*,
Log: $this->getCyclesTable()->getCalculateLog()*/
);

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

public function saveTables($forceReCalculateCyclesTableRow = false, $forceSaveTables = false)
public function saveTables($forceReCalculateCyclesTableRow = false, $forceSaveTables = false, $log = null)
{
$isChanged = false;
/** @var calcsTable $t */
Expand All @@ -329,18 +330,17 @@ public function saveTables($forceReCalculateCyclesTableRow = false, $forceSaveTa
}
}
if ($forceReCalculateCyclesTableRow || $isChanged) {
$this->reCalculateCyclesRow();
$this->reCalculateCyclesRow($log);
}
}

public function reCalculateCyclesRow()
public function reCalculateCyclesRow($log)
{
if ($this->getId()) {
$CyclesTable = $this->getCyclesTable();

$CyclesTable->reCalculateFromOvers([
'modify' => [$this->getId() => []],
]);
], $log);
}
}

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

$cyclesTable = $this->Totum->getTable($this->cyclesTableId);

$Log = $cyclesTable->calcLog(['name' => 'RECALC', 'table' => 'cycle ' . $this->getId()]);

foreach ($tables as $t) {
if ($tablesUpdates[$t->getTableRow()['id']] === $t->getLastUpdated()) {
/** @var calcsTable $t */
Expand All @@ -371,11 +374,15 @@ public function recalculate($isAdding = false)
}
$t->reCalculateFromOvers(
[],
$cyclesTable->getCalculateLog()
$Log
);

}
}
$this->saveTables(true);

$this->saveTables(true, log: $Log);

$cyclesTable->calcLog($Log, 'result', 'done');
}

protected function afterCreate()
Expand Down
2 changes: 1 addition & 1 deletion totum/common/Lang/DE.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public function smallTranslit($s): string
$s,
[
'ß'=>'ss', 'ä'=>'a', 'ü'=>'u', 'ö'=>'o',

'ñ'=>'ny',
'а' => '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', 'ъ' => '', 'ь' => '']
);
}
Expand Down
2 changes: 1 addition & 1 deletion totum/common/Lang/EN.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function smallTranslit($s): string
$s,
[
'ß'=>'ss', 'ä'=>'a', 'ü'=>'u', 'ö'=>'o',

'ñ'=>'ny',
'а' => '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', 'ъ' => '', 'ь' => '']
);
}
Expand Down
2 changes: 1 addition & 1 deletion totum/common/Lang/RU.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ public function smallTranslit($s): string
$s,
[
'ß'=>'ss', 'ä'=>'a', 'ü'=>'u', 'ö'=>'o',

'ñ'=>'ny',
'а' => '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', 'ъ' => '', 'ь' => '']
);
}
Expand Down
2 changes: 1 addition & 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 = '4.9.53.3';
public const VERSION = '4.9.54.0';


public const TABLE_CODE_PARAMS = ['row_format', 'table_format', 'on_duplicate', 'default_action'];
Expand Down
2 changes: 1 addition & 1 deletion totum/common/TotumInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Conf extends ConfParent{
const db=$dbExport;
public static \$timeLimit = 120;
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.
const adminEmail='{$post['admin_email']}';
Expand Down
12 changes: 9 additions & 3 deletions totum/common/configs/WithPhpMailerSmtpTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public function sendMail($to, $title, $body, $attachments = [], $from = null, $r
$mail->addAddress($_to); // Add a recipient
}

if($replyTo){
if ($replyTo) {
$mail->addReplyTo($replyTo);
}
if($hcopy){
if ($hcopy) {
$mail->addBCC($hcopy);
}

Expand All @@ -54,7 +54,13 @@ public function sendMail($to, $title, $body, $attachments = [], $from = null, $r
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $title;
$mail->Body = $body;
return $mail->send();

try {
return $mail->send();
} catch (\Exception) {
return $mail->send();
}

} catch (\Exception $e) {
throw new \ErrorException($mail->ErrorInfo);
}
Expand Down
10 changes: 7 additions & 3 deletions totum/common/configs/WithPhpMailerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public function sendMail($to, $title, $body, $attachments = [], $from = null, $r
$mail->addAddress($_to); // Add a recipient
}

if($replyTo){
if ($replyTo) {
$mail->addReplyTo($replyTo);
}
if($hcopy){
if ($hcopy) {
$mail->addBCC($hcopy);
}

Expand All @@ -59,7 +59,11 @@ public function sendMail($to, $title, $body, $attachments = [], $from = null, $r
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $title;
$mail->Body = $body;
return $mail->send();
try {
return $mail->send();
} catch (\Exception) {
return $mail->send();
}
} catch (\Exception $e) {
throw new \ErrorException($mail->ErrorInfo);
}
Expand Down
72 changes: 54 additions & 18 deletions totum/common/logs/CalculateLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ class CalculateLog
protected $section;

protected $types = [];
protected $typesIndexed = [];


protected $topParent;
/**
* @var mixed|null
*/
protected $tableId;

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

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

/**
* @return array
*/
public function getTypesIndexed($type): bool
{
return $this->typesIndexed[$type] ?? false;
}

public function setLogTypes($types)
{
$this->types = $types;
$this->typesIndexed = [];
foreach ($types as $k) {
$this->typesIndexed[$k] = true;
}

}

public function getTopParent()
Expand Down Expand Up @@ -108,28 +123,34 @@ public function getChildInstance($params)
if ($params['field'] ?? null) {
$fieldName = $params['field'];
}
switch ($params['name'] ?? '') {
case 'RECALC':
$section = 'code';
break;
case 'ACTIONS':
$section = 'actions';
break;
case 'SELECTS AND FORMATS':
case 'TABLE FORMAT':
case 'SELECTS AND FORMATS ROWS':
case 'SELECTS AND FORMATS OF OTHER NON-ROWS PARTS':
$section = 'views';
break;
if ($params['recalculate'] ?? '') {
$section = 'code';
} else {
switch ($params['name'] ?? '') {
case 'RECALC':
$section = 'code';
break;
case 'ACTIONS':
$section = 'actions';
break;
case 'SELECTS AND FORMATS':
case 'TABLE FORMAT':
case 'SELECTS AND FORMATS ROWS':
case 'SELECTS AND FORMATS OF OTHER NON-ROWS PARTS':
$section = 'views';
break;
}
}


$logTypes = $this->topParent->getTypes();
if (!$logTypes) {
if (!$logTypes || ($logTypes === ['C'] && (($this->params['cType'] ?? false) || ($this->params['calc'] ?? false)))) {
$log = new CalculateLogEmpty([], $this);
} elseif ($logTypes !== ['all']) {
switch ($section) {
case 'code':
if (($params['field'] ?? null) && !array_intersect(['c', 'flds'], $logTypes)) {
if (($params['field'] ?? $params['recalculate'] ?? null) && !array_intersect(['c', 'flds'],
$logTypes)) {
$log = new CalculateLogEmpty([], $this);
break;
}
Expand Down Expand Up @@ -159,6 +180,7 @@ public function getChildInstance($params)
break;
}
}

/*
* ?
* if ($logTypes === ['flds'] && $this->fieldName && $this->section !== 'actions') {
Expand Down Expand Up @@ -284,6 +306,10 @@ public function getLogsForJsTree(LangInterface $Lang)
}


if (($this->params['name'] ?? null) === 'ACTIONS' && !$this->children) {
return null;
}

$tree = $this->formatLogItem($tree, $this->topParent->getTypes() === ['flds']);


Expand Down Expand Up @@ -496,8 +522,18 @@ protected function formatLogItem(array $tree = [], $withTimes = false): array
if ($this->params['times'] > 0.001) {
$tree['text'] .= ': ' . round($this->params['times'], 3) . ' c.';
}
} elseif (in_array($this->params['result'], ['changed', 'no changed'], true)) {
$tree['text'] .= ': ' . $this->params['result'];
} elseif (in_array($this->params['result'],
['changed', 'not changed'],
true) || (is_array($this->params['result']) && ($this->params['result'][0] ?? null) === 'changed')) {
if (is_array($this->params['result'])) {
$tree['text'] .= ': ' . $this->params['result'][0];
$tree['children'][] = ['text' => 'CHANGES: ' . json_encode($this->params['result'][1],
JSON_UNESCAPED_UNICODE), 'icon' => 'fa fa-puzzle-piece', 'children'];
} else {
$tree['text'] .= ': ' . $this->params['result'];
}


if ($this->params['times'] > 0.001) {
$tree['text'] .= ': ' . round($this->params['times'], 3) . ' c.';
}
Expand Down
Loading

0 comments on commit 10f1d5b

Please sign in to comment.