PMCORE-1062 [18214] Warning message of multiple file upload control is not translating
This commit is contained in:
@@ -1,43 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Translation.php
|
|
||||||
*
|
|
||||||
* @package workflow.engine.classes.model
|
|
||||||
*
|
|
||||||
* ProcessMaker Open Source Edition
|
|
||||||
* Copyright (C) 2004 - 2011 Colosa Inc.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
//require_once 'classes/model/om/BaseTranslation.php';
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use ProcessMaker\Model\Translation as ModelTranslation;
|
||||||
|
|
||||||
/**
|
|
||||||
* Skeleton subclass for representing a row from the 'TRANSLATION' table.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* You should add additional methods to this class to meet the
|
|
||||||
* application requirements. This class will only be generated as
|
|
||||||
* long as it does not already exist in the output directory.
|
|
||||||
*
|
|
||||||
* @package workflow.engine.classes.model
|
|
||||||
*/
|
|
||||||
class Translation extends BaseTranslation
|
class Translation extends BaseTranslation
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -198,52 +164,44 @@ class Translation extends BaseTranslation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load strings from a Database for labels MAFE.
|
/**
|
||||||
*
|
* Load strings from a Database for labels MAFE.
|
||||||
*/
|
* @return array
|
||||||
public function generateFileTranslationMafe ()
|
*/
|
||||||
|
public function generateFileTranslationMafe()
|
||||||
{
|
{
|
||||||
$translation = Array ();
|
|
||||||
|
|
||||||
$c = new Criteria();
|
|
||||||
$c->add( TranslationPeer::TRN_ID, '%ID_MAFE_%', Criteria::LIKE );
|
|
||||||
$c->addAscendingOrderByColumn( 'TRN_CATEGORY' );
|
|
||||||
$c->addAscendingOrderByColumn( 'TRN_ID' );
|
|
||||||
//$c->addAscendingOrderByColumn( 'TRN_LANG' );
|
|
||||||
$tranlations = TranslationPeer::doSelect( $c );
|
|
||||||
|
|
||||||
$mafeFolder = PATH_HTML . "translations";
|
|
||||||
$cacheFileMafe = PATH_HTML . "translations" . PATH_SEP. 'translationsMafe' . ".js";
|
|
||||||
|
|
||||||
foreach ($tranlations as $key => $row) {
|
|
||||||
if ($row->getTrnCategory() === 'LABEL') {
|
|
||||||
$translation[$row->getTrnLang()][$row->getTrnId()] = $row->getTrnValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$translation = [];
|
||||||
|
$result = ModelTranslation::select()
|
||||||
|
->where('TRN_ID', 'LIKE', '%ID_MAFE_%')
|
||||||
|
->where('TRN_CATEGORY', '=', 'LABEL')
|
||||||
|
->orderBy('TRN_CATEGORY', 'asc')
|
||||||
|
->orderBy('TRN_ID', 'asc')
|
||||||
|
->get();
|
||||||
|
foreach ($result as $object) {
|
||||||
|
$translation[$object->TRN_LANG][$object->TRN_ID] = $object->TRN_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$mafeFolder = PATH_HTML . "translations";
|
||||||
G::verifyPath($mafeFolder, true);
|
G::verifyPath($mafeFolder, true);
|
||||||
if (! is_dir( dirname( $cacheFileMafe ) )) {
|
if (!is_dir($mafeFolder)) {
|
||||||
G::mk_dir( dirname( $cacheFileMafe ) );
|
G::mk_dir($mafeFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
$f = fopen( $cacheFileMafe, 'w' );
|
$cacheFileMafe = PATH_HTML . "translations" . PATH_SEP . 'translationsMafe' . ".js";
|
||||||
if ($f == false) {
|
$status = file_put_contents($cacheFileMafe, "var __TRANSLATIONMAFE = " . Bootstrap::json_encode($translation) . ";\n");
|
||||||
error_log("Error: Cannot write into cacheFileMafe: $cacheFileMafe\n");
|
if ($status === false) {
|
||||||
} else {
|
Log::channel(':generateFileTranslationMafe')->error("Cannot write into cacheFileMafe: {$cacheFileMafe}", Bootstrap::context());
|
||||||
fwrite( $f, "var __TRANSLATIONMAFE = " . Bootstrap::json_encode( $translation ) . ";\n");
|
|
||||||
fclose( $f );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$res['cacheFileMafe'] = $cacheFileMafe;
|
return [
|
||||||
$res['languague'] = (is_array($cacheFileMafe) || $cacheFileMafe instanceof Countable) ? count($cacheFileMafe) : 0;
|
'cacheFileMafe' => $cacheFileMafe,
|
||||||
$res['rowsMafeJS'] = count( $translation );
|
'languague' => 0, //must be deprecated
|
||||||
return $res;
|
'rowsMafeJS' => count($translation)
|
||||||
|
];
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$token = strtotime("now");
|
Log::channel(':generateFileTranslationMafe')->error($e->getMessage(), Bootstrap::context());
|
||||||
PMException::registerErrorLog($e, $token);
|
G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", [strtotime("now")]));
|
||||||
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
workflow/engine/src/ProcessMaker/Model/Translation.php
Normal file
14
workflow/engine/src/ProcessMaker/Model/Translation.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\Model;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Translation extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'TRANSLATION';
|
||||||
|
protected $primaryKey = ['TRN_CATEGORY', 'TRN_ID', 'TRN_LANG'];
|
||||||
|
public $incrementing = false;
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user