Merge with develop: solving conflicts

This commit is contained in:
Paula Quispe
2019-05-29 13:12:45 -04:00
93 changed files with 6342 additions and 6993 deletions

1
.gitignore vendored
View File

@@ -41,3 +41,4 @@ node_modules
test_shared/
**/cache/
storage/
phpunit.xml

View File

@@ -40,7 +40,7 @@
"monolog/monolog": "1.19.0",
"geshi/geshi": "dev-master",
"libchart/libchart": "1.4.0",
"phpmailer/phpmailer": "5.2.4",
"phpmailer/phpmailer": "5.2.27",
"pear/archive_tar": "1.4.*",
"pear/console_getopt": "1.4.*",
"TYPO3/class-alias-loader": "^1.0",
@@ -48,7 +48,10 @@
"smarty/smarty": "2.6.30",
"pdepend/pdepend": "@stable",
"chumper/zipper": "^1.0",
"php-imap/php-imap": "^3.0"
"php-imap/php-imap": "^3.0",
"nikic/php-parser": "3.1.5",
"laravel/tinker": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "^1.7",

355
composer.lock generated
View File

@@ -1,10 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3242f53453d9e9a3d7fdf3a56961ae40",
"content-hash": "a9ba65f7fb68be7c36dd45b62216b2c6",
"packages": [
{
"name": "bshaffer/oauth2-server-php",
@@ -209,6 +209,39 @@
],
"time": "2018-03-09T06:07:41+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
"version": "0.1",
"source": {
"type": "git",
"url": "https://github.com/dnoegel/php-xdg-base-dir.git",
"reference": "265b8593498b997dc2d31e75b89f053b5cc9621a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/265b8593498b997dc2d31e75b89f053b5cc9621a",
"reference": "265b8593498b997dc2d31e75b89f053b5cc9621a",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "@stable"
},
"type": "project",
"autoload": {
"psr-4": {
"XdgBaseDir\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "implementation of xdg base directory specification for php",
"time": "2014-10-24T07:27:01+00:00"
},
{
"name": "doctrine/inflector",
"version": "v1.1.0",
@@ -405,6 +438,94 @@
],
"time": "2015-10-16T22:11:08+00:00"
},
{
"name": "jakub-onderka/php-console-color",
"version": "v0.2",
"source": {
"type": "git",
"url": "https://github.com/JakubOnderka/PHP-Console-Color.git",
"reference": "d5deaecff52a0d61ccb613bb3804088da0307191"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191",
"reference": "d5deaecff52a0d61ccb613bb3804088da0307191",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"jakub-onderka/php-code-style": "1.0",
"jakub-onderka/php-parallel-lint": "1.0",
"jakub-onderka/php-var-dump-check": "0.*",
"phpunit/phpunit": "~4.3",
"squizlabs/php_codesniffer": "1.*"
},
"type": "library",
"autoload": {
"psr-4": {
"JakubOnderka\\PhpConsoleColor\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Jakub Onderka",
"email": "jakub.onderka@gmail.com"
}
],
"time": "2018-09-29T17:23:10+00:00"
},
{
"name": "jakub-onderka/php-console-highlighter",
"version": "v0.4",
"source": {
"type": "git",
"url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git",
"reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/9f7a229a69d52506914b4bc61bfdb199d90c5547",
"reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"jakub-onderka/php-console-color": "~0.2",
"php": ">=5.4.0"
},
"require-dev": {
"jakub-onderka/php-code-style": "~1.0",
"jakub-onderka/php-parallel-lint": "~1.0",
"jakub-onderka/php-var-dump-check": "~0.1",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~1.5"
},
"type": "library",
"autoload": {
"psr-4": {
"JakubOnderka\\PhpConsoleHighlighter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jakub Onderka",
"email": "acci@acci.cz",
"homepage": "http://www.acci.cz/"
}
],
"description": "Highlight PHP code in terminal",
"time": "2018-09-29T18:48:56+00:00"
},
{
"name": "laravel/framework",
"version": "v5.4.36",
@@ -534,6 +655,69 @@
],
"time": "2017-08-30T09:26:16+00:00"
},
{
"name": "laravel/tinker",
"version": "v1.0.8",
"source": {
"type": "git",
"url": "https://github.com/laravel/tinker.git",
"reference": "cafbf598a90acde68985660e79b2b03c5609a405"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/tinker/zipball/cafbf598a90acde68985660e79b2b03c5609a405",
"reference": "cafbf598a90acde68985660e79b2b03c5609a405",
"shasum": ""
},
"require": {
"illuminate/console": "~5.1",
"illuminate/contracts": "~5.1",
"illuminate/support": "~5.1",
"php": ">=5.5.9",
"psy/psysh": "0.7.*|0.8.*|0.9.*",
"symfony/var-dumper": "~3.0|~4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0|~5.0"
},
"suggest": {
"illuminate/database": "The Illuminate Database package (~5.1)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
},
"laravel": {
"providers": [
"Laravel\\Tinker\\TinkerServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Tinker\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "Powerful REPL for the Laravel framework.",
"keywords": [
"REPL",
"Tinker",
"laravel",
"psysh"
],
"time": "2018-10-12T19:39:35+00:00"
},
{
"name": "league/flysystem",
"version": "1.0.49",
@@ -923,6 +1107,57 @@
],
"time": "2018-11-22T18:23:02+00:00"
},
{
"name": "nikic/php-parser",
"version": "v3.1.5",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce",
"reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "~4.0|~5.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"time": "2018-02-28T20:30:58+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.17",
@@ -1278,31 +1513,55 @@
},
{
"name": "phpmailer/phpmailer",
"version": "v5.2.4",
"version": "v5.2.27",
"source": {
"type": "git",
"url": "https://github.com/PHPMailer/PHPMailer.git",
"reference": "adb0197c106fad05c1fab28dbed5437133836c44"
"reference": "dde1db116511aa4956389d75546c5be4c2beb2a6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/adb0197c106fad05c1fab28dbed5437133836c44",
"reference": "adb0197c106fad05c1fab28dbed5437133836c44",
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/dde1db116511aa4956389d75546c5be4c2beb2a6",
"reference": "dde1db116511aa4956389d75546c5be4c2beb2a6",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"php": ">=5.0.0"
},
"require-dev": {
"phpdocumentor/phpdocumentor": "*",
"phpunit/phpunit": "*"
"doctrine/annotations": "1.2.*",
"jms/serializer": "0.16.*",
"phpdocumentor/phpdocumentor": "2.*",
"phpunit/phpunit": "4.8.*",
"symfony/debug": "2.8.*",
"symfony/filesystem": "2.8.*",
"symfony/translation": "2.8.*",
"symfony/yaml": "2.8.*",
"zendframework/zend-cache": "2.5.1",
"zendframework/zend-config": "2.5.1",
"zendframework/zend-eventmanager": "2.5.1",
"zendframework/zend-filter": "2.5.1",
"zendframework/zend-i18n": "2.5.1",
"zendframework/zend-json": "2.5.1",
"zendframework/zend-math": "2.5.1",
"zendframework/zend-serializer": "2.5.*",
"zendframework/zend-servicemanager": "2.5.*",
"zendframework/zend-stdlib": "2.5.1"
},
"suggest": {
"league/oauth2-google": "Needed for Google XOAUTH2 authentication"
},
"type": "library",
"autoload": {
"classmap": [
"class.phpmailer.php",
"class.phpmaileroauth.php",
"class.phpmaileroauthgoogle.php",
"class.smtp.php",
"class.pop3.php",
"class.smtp.php"
"extras/EasyPeasyICS.php",
"extras/ntlm_sasl_client.php"
]
},
"notification-url": "https://packagist.org/downloads/",
@@ -1327,7 +1586,7 @@
}
],
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
"time": "2013-02-21T11:44:28+00:00"
"time": "2017-11-04T09:26:05+00:00"
},
{
"name": "psr/container",
@@ -1416,6 +1675,80 @@
],
"time": "2012-12-21T11:40:51+00:00"
},
{
"name": "psy/psysh",
"version": "v0.9.9",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
"reference": "9aaf29575bb8293206bb0420c1e1c87ff2ffa94e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/9aaf29575bb8293206bb0420c1e1c87ff2ffa94e",
"reference": "9aaf29575bb8293206bb0420c1e1c87ff2ffa94e",
"shasum": ""
},
"require": {
"dnoegel/php-xdg-base-dir": "0.1",
"ext-json": "*",
"ext-tokenizer": "*",
"jakub-onderka/php-console-highlighter": "0.3.*|0.4.*",
"nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",
"php": ">=5.4.0",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0",
"symfony/var-dumper": "~2.7|~3.0|~4.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.2",
"hoa/console": "~2.15|~3.16",
"phpunit/phpunit": "~4.8.35|~5.0|~6.0|~7.0"
},
"suggest": {
"ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)",
"ext-pdo-sqlite": "The doc command requires SQLite to work.",
"ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.",
"ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.",
"hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit."
},
"bin": [
"bin/psysh"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.9.x-dev"
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Psy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Justin Hileman",
"email": "justin@justinhileman.info",
"homepage": "http://justinhileman.com"
}
],
"description": "An interactive shell for modern PHP.",
"homepage": "http://psysh.org",
"keywords": [
"REPL",
"console",
"interactive",
"shell"
],
"time": "2018-10-13T15:16:03+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "2.0.5",
@@ -4935,6 +5268,7 @@
"mock",
"xunit"
],
"abandoned": true,
"time": "2017-06-30T09:13:00+00:00"
},
{
@@ -5875,6 +6209,7 @@
"phpcs",
"standards"
],
"abandoned": "phpcompatibility/php-compatibility",
"time": "2018-10-07T17:38:02+00:00"
}
],

View File

@@ -23,7 +23,9 @@ return [
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
ViewServiceProvider::class
Laravel\Tinker\TinkerServiceProvider::class,
ViewServiceProvider::class,
],
'aliases' => [
'Crypt' => Illuminate\Support\Facades\Crypt::class

View File

@@ -0,0 +1,18 @@
<?php
/**
* Model factory for a APP_ASSIGN_SELF_SERVICE_VALUE
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\AppAssignSelfServiceValue::class, function(Faker $faker) {
return [
'ID' => $faker->unique()->numberBetween(1, 2000),
'APP_UID' => G::generateUniqueID(),
'DEL_INDEX' => 2,
'PRO_UID' => G::generateUniqueID(),
'TAS_UID' => G::generateUniqueID(),
'TAS_ID' => $faker->unique()->numberBetween(1, 2000),
'GRP_UID' => G::generateUniqueID(),
];
});

View File

@@ -0,0 +1,15 @@
<?php
/**
* Model factory for a APP_ASSIGN_SELF_SERVICE_VALUE_GROUP
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\AppAssignSelfServiceValueGroup::class, function(Faker $faker) {
return [
'ID' => $faker->unique()->numberBetween(1, 2000),
'GRP_UID' => G::generateUniqueID(),
'ASSIGNEE_ID' => $faker->unique()->numberBetween(1, 2000),
'ASSIGNEE_TYPE' => $faker->unique()->numberBetween(1, 2000),
];
});

View File

@@ -0,0 +1,26 @@
<?php
use Faker\Generator as Faker;
use ProcessMaker\BusinessModel\Cases as BmCases;
$factory->define(\ProcessMaker\Model\Application::class, function(Faker $faker) {
$process = \ProcessMaker\Model\Process::all()->random();
$statuses = ['DRAFT', 'TO_DO'];
$status = $faker->randomElement($statuses);
$statusId = array_search($status, $statuses) + 1;
return [
'APP_UID' => G::generateUniqueID(),
'APP_TITLE' => G::generateUniqueID(),
'APP_NUMBER' => $faker->unique()->numberBetween(1000),
'APP_STATUS' => $status,
'APP_STATUS_ID' => $statusId,
'PRO_UID' => $process->PRO_UID,
'APP_PARALLEL' => 'N',
'APP_INIT_USER' => \ProcessMaker\Model\User::all()->random()->USR_UID,
'APP_CUR_USER' => \ProcessMaker\Model\User::all()->random()->USR_UID,
'APP_PIN' => G::generateUniqueID(),
'APP_CREATE_DATE' => $faker->dateTime(),
'APP_UPDATE_DATE' => $faker->dateTime(),
'APP_INIT_DATE' => $faker->dateTime(),
'APP_DATA' => serialize(['APP_NUMBER' => 12])
];
});

View File

@@ -0,0 +1,76 @@
<?php
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\Delegation::class, function(Faker $faker) {
$app = factory(\ProcessMaker\Model\Application::class)->create();
$process = \ProcessMaker\Model\Process::where('PRO_UID', $app->PRO_UID)->first();
$task = $process->tasks->first();
// Grab a user if random
$users = \ProcessMaker\Model\User::all();
if(!count($users)) {
$user = factory(\ProcessMaker\Model\User::class)->create();
} else{
$user = $users->random();
}
// Return with default values
return [
'APP_UID' => $app->APP_UID,
'DEL_INDEX' => 1,
'APP_NUMBER' => $app->APP_NUMBER,
'DEL_PREVIOUS' => 0,
'PRO_UID' => $app->PRO_UID,
'TAS_UID' => $task->TAS_UID,
'USR_UID' => $user->USR_UID,
'DEL_TYPE' => 'NORMAL',
'DEL_THREAD' => 1,
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_PRIORITY' => 3,
'DEL_DELEGATE_DATE' => $faker->dateTime(),
'DEL_INIT_DATE' => $faker->dateTime(),
'DEL_TASK_DUE_DATE' => $faker->dateTime(),
'DEL_RISK_DATE' => $faker->dateTime(),
'USR_ID' => $user->USR_ID,
'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID,
'DEL_DATA' => ''
];
});
// Create a open delegation
$factory->state(\ProcessMaker\Model\Delegation::class, 'open', function (Faker $faker) {
// Create dates with sense
$delegateDate = $faker->dateTime();
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+1 day');
return [
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_DELEGATE_DATE' => $delegateDate,
'DEL_INIT_DATE' => $initDate,
'DEL_RISK_DATE' => $riskDate,
'DEL_TASK_DUE_DATE' => $taskDueDate,
'DEL_FINISH_DATE' => null
];
});
// Create a closed delegation
$factory->state(\ProcessMaker\Model\Delegation::class, 'closed', function (Faker $faker) {
// Create dates with sense
$delegateDate = $faker->dateTime();
$initDate = $faker->dateTimeInInterval($delegateDate, '+30 minutes');
$riskDate = $faker->dateTimeInInterval($initDate, '+1 day');
$taskDueDate = $faker->dateTimeInInterval($riskDate, '+1 day');
$finishDate = $faker->dateTimeInInterval($initDate, '+10 days');
return [
'DEL_THREAD_STATUS' => 'CLOSED',
'DEL_DELEGATE_DATE' => $delegateDate,
'DEL_INIT_DATE' => $initDate,
'DEL_RISK_DATE' => $riskDate,
'DEL_TASK_DUE_DATE' => $taskDueDate,
'DEL_FINISH_DATE' => $finishDate
];
});

View File

@@ -0,0 +1,26 @@
<?php
/**
* Model factory for a dynaform.
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\Dynaform::class, function(Faker $faker) {
$date = $faker->dateTime();
return [
'DYN_UID' => G::generateUniqueID(),
'DYN_ID' => '',
'DYN_TITLE' => '',
'DYN_DESCRIPTION' => '',
'PRO_UID' => function() {
$process = factory(\ProcessMaker\Model\Process::class)->create();
return $process->PRO_UID;
},
'DYN_TYPE' => 'xmlform',
'DYN_FILENAME' => '',
'DYN_CONTENT' => '',
'DYN_LABEL' => '',
'DYN_VERSION' => 2,
'DYN_UPDATE_DATE' => $date->format('Y-m-d H:i:s'),
];
});

View File

@@ -0,0 +1,14 @@
<?php
/**
* Model factory for a group user relation
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\GroupUser::class, function(Faker $faker) {
return [
'GRP_UID' => G::generateUniqueID(),
'GRP_ID' => $faker->unique()->numberBetween(1, 2000),
'USR_UID' => G::generateUniqueID()
];
});

View File

@@ -0,0 +1,17 @@
<?php
/**
* Model factory for a groups
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\Groupwf::class, function(Faker $faker) {
return [
'GRP_UID' => G::generateUniqueID(),
'GRP_ID' => $faker->unique()->numberBetween(1, 2000),
'GRP_TITLE' => $faker->sentence(2),
'GRP_STATUS' => 'ACTIVE',
'GRP_LDAP_DN' => '',
'GRP_UX' => 'NORMAL',
];
});

View File

@@ -0,0 +1,40 @@
<?php
/**
* Model factory for a list unassigned
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\ListUnassigned::class, function (Faker $faker) {
$app = factory(\ProcessMaker\Model\Application::class)->create();
$process = \ProcessMaker\Model\Process::where('PRO_UID', $app->PRO_UID)->first();
$task = $process->tasks->first();
// Grab a user if random
$users = \ProcessMaker\Model\User::all();
if(!count($users)) {
$user = factory(\ProcessMaker\Model\User::class)->create();
} else{
$user = $users->random();
}
return [
'APP_UID' => $app->APP_UID,
'DEL_INDEX' => 1,
'TAS_UID' => $task->TAS_UID,
'PRO_UID' => $app->PRO_UID,
'APP_NUMBER' => $app->APP_NUMBER,
'APP_TITLE' => $app->APP_TITLE,
'APP_PRO_TITLE' => $process->PRO_TITLE,
'APP_TAS_TITLE' => $task->TAS_TITLE,
'DEL_PREVIOUS_USR_USERNAME' => $user->USR_USERNAME,
'DEL_PREVIOUS_USR_FIRSTNAME' => $user->USR_FIRSTNAME,
'DEL_PREVIOUS_USR_LASTNAME' => $user->USR_LASTNAME,
'APP_UPDATE_DATE' => $faker->dateTime(),
'DEL_PREVIOUS_USR_UID' => G::generateUniqueID(),
'DEL_DELEGATE_DATE' => $faker->dateTime(),
'DEL_DUE_DATE' => $faker->dateTime(),
'DEL_PRIORITY' => 3,
'PRO_ID' => $process->PRO_ID,
'TAS_ID' => $task->TAS_ID,
];
});

View File

@@ -0,0 +1,14 @@
<?php
/**
* Model factory for a process category
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\ProcessCategory::class, function (Faker $faker) {
return [
'CATEGORY_UID' => G::generateUniqueID(),
'CATEGORY_PARENT' => '',
'CATEGORY_NAME' => $faker->sentence(5),
'CATEGORY_ICON' => '',
];
});

View File

@@ -5,13 +5,57 @@
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\Process::class, function(Faker $faker) {
/**
* @todo Determine if we need more base columns populated
*/
return [
$process = [
'PRO_UID' => G::generateUniqueID(),
'PRO_TITLE' => $faker->sentence(3),
'PRO_DESCRIPTION' => $faker->paragraph(3)
'PRO_DESCRIPTION' => $faker->paragraph(3),
'PRO_CREATE_USER' => '00000000000000000000000000000001',
'PRO_DYNAFORMS' => '',
'PRO_ITEE' => 1,
'PRO_STATUS' => 'ACTIVE'
];
$task1 = factory(\ProcessMaker\Model\Task::class)
->create([
'PRO_UID' => $process['PRO_UID'],
'TAS_START'=>'TRUE'
]);
$task2 = factory(\ProcessMaker\Model\Task::class)
->create([
'PRO_UID' => $process['PRO_UID'],
]);
//routes
factory(\ProcessMaker\Model\Route::class)
->create([
'PRO_UID' => $process['PRO_UID'],
'TAS_UID' => $task2['TAS_UID'],
'ROU_NEXT_TASK' => '-1',
]);
factory(\ProcessMaker\Model\Route::class)
->create([
'PRO_UID' => $process['PRO_UID'],
'TAS_UID' => $task1['TAS_UID'],
'ROU_NEXT_TASK' => $task2['TAS_UID']
]);
//User assignments
factory(\ProcessMaker\Model\TaskUser::class)
->create([
'TAS_UID' => $task1['TAS_UID'],
'USR_UID' => \ProcessMaker\Model\User::all()->random()->USR_UID
]);
factory(\ProcessMaker\Model\TaskUser::class)
->create([
'TAS_UID' => $task2['TAS_UID'],
'USR_UID' => \ProcessMaker\Model\User::all()->random()->USR_UID
]);
return $process;
});

View File

@@ -0,0 +1,22 @@
<?php
/**
* Model factory for a process
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\Route::class, function(Faker $faker) {
return [
'PRO_UID' => function() {
$process = factory(\ProcessMaker\Model\Process::class)->create();
return $process->PRO_UID;
},
'TAS_UID' => function() {
$task = factory(\ProcessMaker\Model\Task::class)->create();
return $task->TAS_UID;
},
'ROU_UID' => G::generateUniqueID(),
'ROU_PARENT' => 0,
'ROU_CASE' => 1,
'ROU_TYPE' => 'SEQUENTIAL'
];
});

View File

@@ -0,0 +1,35 @@
<?php
/**
* Model factory for a process
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\Task::class, function(Faker $faker) {
return [
'PRO_UID' => function() {
$process = factory(\ProcessMaker\Model\Process::class)->create();
return $process->PRO_UID;
},
'TAS_UID' => G::generateUniqueID(),
'TAS_ID' => $faker->unique()->numberBetween(1, 100000),
'TAS_TITLE' => $faker->sentence(2),
'TAS_TYPE' => 'NORMAL',
'TAS_TYPE_DAY' => 1,
'TAS_DURATION' => 1,
'TAS_ASSIGN_TYPE' => 'BALANCED',
'TAS_ASSIGN_VARIABLE' => '@@SYS_NEXT_USER_TO_BE_ASSIGNED',
'TAS_MI_INSTANCE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCE',
'TAS_MI_COMPLETE_VARIABLE' => '@@SYS_VAR_TOTAL_INSTANCES_COMPLETE',
'TAS_ASSIGN_LOCATION' => 'FALSE',
'TAS_ASSIGN_LOCATION_ADHOC' => 'FALSE',
'TAS_TRANSFER_FLY' => 'FALSE',
'TAS_LAST_ASSIGNED' => 0,
'TAS_USER' => 0,
'TAS_CAN_UPLOAD' => 'FALSE',
'TAS_CAN_CANCEL' => 'FALSE',
'TAS_OWNER_APP' => 'FALSE',
'TAS_CAN_SEND_MESSAGE' => 'FALSE',
'TAS_SEND_LAST_EMAIL' => 'FALSE',
];
});

View File

@@ -0,0 +1,16 @@
<?php
/**
* Model factory for a process
*/
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\TaskUser::class, function(Faker $faker) {
return [
'TAS_UID' => function() {
$task = factory(\ProcessMaker\Model\Task::class)->create();
return $task->TAS_UID;
},
'TU_TYPE' => 1,
'TU_RELATION' => 1
];
});

View File

@@ -0,0 +1,19 @@
<?php
use Faker\Generator as Faker;
$factory->define(\ProcessMaker\Model\User::class, function(Faker $faker) {
return [
'USR_UID' => G::generateUniqueID(),
'USR_USERNAME' => $faker->unique()->userName,
'USR_PASSWORD' => $faker->password,
'USR_FIRSTNAME' => $faker->firstName,
'USR_LASTNAME' => $faker->lastName,
'USR_EMAIL' => $faker->unique()->email,
'USR_DUE_DATE' => new \Carbon\Carbon(2030,1,1),
'USR_STATUS' => 'ACTIVE',
'USR_ROLE' => $faker->randomElement(['PROCESSMAKER_ADMIN', 'PROCESSMAKER_OPERATOR']),
'USR_UX' => 'NORMAL',
'USR_TIME_ZONE' => 'America/Anguilla',
'USR_DEFAULT_LANG' => 'en',
];
});

View File

@@ -1348,8 +1348,7 @@ class Bootstrap
*
* @return void
*/
// _Internal: Remove recursion in result array
public function _del_p(&$ary)
public static function _del_p(&$ary)
{
foreach ($ary as $k => $v) {
if ($k === '_p') {

View File

@@ -1636,13 +1636,16 @@ class G
/**
* Escapes special characters in a string for use in a SQL statement
* @param string $sqlString The string to be escaped
* @param string $DBEngine Target DBMS
*/
public function sqlEscape($sqlString, $DBEngine = DB_ADAPTER)
* @param string $sqlString The string to be escaped
* @param string $dbEngine Target DBMS
*
* @return string
*/
public static function sqlEscape($sqlString, $dbEngine = DB_ADAPTER)
{
$DBEngine = DB_ADAPTER;
switch ($DBEngine) {
// @todo: Research why always this value is set with the same constant?
$dbEngine = DB_ADAPTER;
switch ($dbEngine) {
case 'mysql':
$con = Propel::getConnection('workflow');
return mysqli_real_escape_string($con->getResource(), stripslashes($sqlString));
@@ -1689,9 +1692,15 @@ class G
* @# Non-quoted parameter
* @! Evaluate string : Replace the parameters in value and then in the sql string
* @fn() Evaluate string with the function "fn"
* @author David Callizaya <calidavidx21@hotmail.com>
*
* @param string $sqlString
* @param array $result
* @param string $dbEngine
* @param bool $applyHtmlEntities
*
* @return string
*/
public static function replaceDataField($sqlString, $result, $DBEngine = 'mysql')
public static function replaceDataField($sqlString, $result, $dbEngine = 'mysql', $applyHtmlEntities = false)
{
if (!is_array($result)) {
$result = array();
@@ -1710,7 +1719,12 @@ class G
$u = $match[0][$r][1] + strlen($match[0][$r][0]);
//Mysql quotes scape
if (($match[1][$r][0] == '@') && (isset($result[$match[2][$r][0]]))) {
$__textoEval .= "\"" . G::sqlEscape($result[$match[2][$r][0]], $DBEngine) . "\"";
$text = ($applyHtmlEntities && !stringIsValidHtml($result[$match[2][$r][0]])) ?
htmlentities(G::unhtmlentities($result[$match[2][$r][0]]), ENT_COMPAT, 'UTF-8') :
$result[$match[2][$r][0]];
// Replenish the tag <br /> because is valid
$text = str_replace('&lt;br /&gt;', '<br />', $text);
$__textoEval .= "\"" . G::sqlEscape($text, $dbEngine) . "\"";
continue;
}
//URL encode
@@ -1730,7 +1744,7 @@ class G
}
//Substring (Sub replaceDataField)
if (($match[1][$r][0] == '!') && (isset($result[$match[2][$r][0]]))) {
$__textoEval .= G::replaceDataField($result[$match[2][$r][0]], $result);
$__textoEval .= G::replaceDataField($result[$match[2][$r][0]], $result, $dbEngine, $applyHtmlEntities);
continue;
}
//Call function
@@ -1748,18 +1762,33 @@ class G
}
//Non-quoted
if (($match[1][$r][0] == '#') && (isset($result[$match[2][$r][0]]))) {
$__textoEval .= G::replaceDataField($result[$match[2][$r][0]], $result);
$text = ($applyHtmlEntities && !stringIsValidHtml($result[$match[2][$r][0]]) && $match[2][$r][0] !== '__ABE__') ?
htmlentities(G::unhtmlentities($result[$match[2][$r][0]]), ENT_COMPAT, 'UTF-8') :
$result[$match[2][$r][0]];
// Replenish the tag <br /> because is valid
$text = str_replace('&lt;br /&gt;', '<br />', $text);
$__textoEval .= G::replaceDataField($text, $result);
continue;
}
//Non-quoted =
if (($match[1][$r][0] == '=') && (isset($result[$match[2][$r][0]]))) {
$__textoEval .= G::replaceDataField($result[$match[2][$r][0]], $result);
$text = ($applyHtmlEntities && !stringIsValidHtml($result[$match[2][$r][0]]) && $match[2][$r][0] !== '__ABE__') ?
htmlentities(G::unhtmlentities($result[$match[2][$r][0]]), ENT_COMPAT, 'UTF-8') :
$result[$match[2][$r][0]];
// Replenish the tag <br /> because is valid
$text = str_replace('&lt;br /&gt;', '<br />', $text);
$__textoEval .= G::replaceDataField($text, $result);
continue;
}
//Objects attributes
if (($match[1][$r][0] == '&') && (isset($result[$match[2][$r][0]]))) {
if (isset($result[$match[2][$r][0]]->{$match[6][$r][0]})) {
$__textoEval .= $result[$match[2][$r][0]]->{$match[6][$r][0]};
$text = ($applyHtmlEntities && !stringIsValidHtml($result[$match[2][$r][0]]->{$match[6][$r][0]})) ?
htmlentities(G::unhtmlentities($result[$match[2][$r][0]]->{$match[6][$r][0]}), ENT_COMPAT, 'UTF-8') :
$result[$match[2][$r][0]]->{$match[6][$r][0]};
// Replenish the tag <br /> because is valid
$text = str_replace('&lt;br /&gt;', '<br />', $text);
$__textoEval .= $text;
}
continue;
}
@@ -1771,27 +1800,35 @@ class G
}
/**
* Replace Grid Values
* The tag @>GRID-NAME to open the grid and @<GRID-NAME to close the grid,
*
* @param type String $sContent
* @param type Array $aFields
* @return type String
*/
public static function replaceDataGridField($sContent, $aFields, $nl2brRecursive = true)
* Replace Grid Values in a string.
* The tag @>GRID-NAME to open the grid and @<GRID-NAME to close the grid,
*
* @param string $content
* @param array $fields
* @param bool $nl2brRecursive
* @param bool $applyHtmlEntities
*
* @return string
*
* @see \Cases->sendMessage()
* @see \WsBase->sendMessage()
* @see \OutputDocument->generate()
* @see \ProcessMaker\BusinessModel\Cases\OutputDocument->generate()
*/
public static function replaceDataGridField($content, $fields, $nl2brRecursive = true, $applyHtmlEntities = false)
{
$nrt = array("\n", "\r", "\t");
$nrthtml = array("(n /)", "(r /)", "(t /)");
$sContent = G::unhtmlentities($sContent);
$strContentAux = str_replace($nrt, $nrthtml, $sContent);
$strContentAux = str_replace($nrt, $nrthtml, $content);
$iOcurrences = preg_match_all('/\@(?:([\>])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/', $strContentAux, $arrayMatch1, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
$occurrences = preg_match_all('/\@(?:([\>])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/',
$strContentAux, $arrayMatch1, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
if ($iOcurrences) {
if ($occurrences) {
$arrayGrid = array();
for ($i = 0; $i <= $iOcurrences - 1; $i++) {
for ($i = 0; $i <= $occurrences - 1; $i++) {
$arrayGrid[] = $arrayMatch1[2][$i][0];
}
@@ -1817,16 +1854,16 @@ class G
while (preg_match($ereg, $strContentAux1, $arrayMatch2)) {
$strData = null;
if (isset($aFields[$grdName]) && is_array($aFields[$grdName])) {
foreach ($aFields[$grdName] as $aRow) {
if (isset($fields[$grdName]) && is_array($fields[$grdName])) {
foreach ($fields[$grdName] as $aRow) {
if ($nl2brRecursive) {
foreach ($aRow as $sKey => $vValue) {
if (!is_array($vValue)) {
$aRow[$sKey] = str_replace($nrt, $nrthtml, nl2br($aRow[$sKey]));
foreach ($aRow as $key => $item) {
if (!is_array($item)) {
$aRow[$key] = str_replace($nrt, $nrthtml, nl2br($aRow[$key]));
}
}
}
$strData = $strData . G::replaceDataField($arrayMatch2[2], $aRow);
$strData = $strData . G::replaceDataField($arrayMatch2[2], $aRow, 'mysql', $applyHtmlEntities);
}
}
@@ -1841,19 +1878,19 @@ class G
$strContentAux = str_replace($nrthtml, $nrt, $strContentAux);
$sContent = $strContentAux;
$content = $strContentAux;
if ($nl2brRecursive) {
foreach ($aFields as $sKey => $vValue) {
if (!is_array($vValue) && !is_object($vValue)) {
$aFields[$sKey] = nl2br($aFields[$sKey]);
foreach ($fields as $key => $item) {
if (!is_array($item) && !is_object($item)) {
$fields[$key] = nl2br($fields[$key]);
}
}
}
$sContent = G::replaceDataField($sContent, $aFields);
$content = G::replaceDataField($content, $fields, 'mysql', $applyHtmlEntities);
return $sContent;
return $content;
}
/**

View File

@@ -15,9 +15,9 @@
<directory>./tests/workflow/engine/src/</directory>
</testsuite>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="false">
@@ -33,31 +33,32 @@
</filter>
<php>
<var name="APP_ENV" value="testing" />
<var name="SYS_SYS" value="test" />
<var name="SYS_LANG" value="en" />
<var name="SYS_SKIN" value="neoclassic" />
<var name="DB_ADAPTER" value="mysql" />
<var name="DB_HOST" value="processmaker3" />
<var name="DB_NAME" value="wf_test" />
<var name="DB_USER" value="root" />
<var name="DB_PASS" value="" />
<var name="PATH_DB" value="./shared/sites/" />
<var name="PATH_DATA" value="./shared/" />
<var name="APP_HOST" value="processmaker3.local" />
<var name="HTTPS" value="off" />
<var name="SERVER_PORT" value="8080" />
<env name="DB_DATABASE" value="test" />
<env name="DB_USERNAME" value="root" />
<env name="DB_PASSWORD" value="" />
<env name="RUN_MSSQL_TESTS" value="true" />
<env name="MSSQL_HOST" value="172.16.3.1" />
<env name="MSSQL_PORT" value="1433" />
<env name="MSSQL_DATABASE" value="testexternal" />
<env name="MSSQL_USERNAME" value="test" />
<env name="MSSQL_PASSWORD" value="test" />
<!--Connection to database-->
<env name="DB_HOST" value="127.0.0.1" />
<env name="DB_DATABASE" value="test" />
<env name="DB_USERNAME" value="root" />
<env name="DB_PASSWORD" value="password" />
<!--Connection to database SQLServer-->
<env name="RUN_MSSQL_TESTS" value="false" />
<env name="MSSQL_HOST" value="172.16.3.1" />
<env name="MSSQL_PORT" value="1433" />
<env name="MSSQL_DATABASE" value="testexternal" />
<env name="MSSQL_USERNAME" value="test" />
<env name="MSSQL_PASSWORD" value="test" />
<!--Php variables-->
<var name="APP_ENV" value="testing" />
<var name="SYS_SYS" value="test" />
<var name="SYS_LANG" value="en" />
<var name="SYS_SKIN" value="neoclassic" />
<var name="DB_ADAPTER" value="mysql" />
<var name="DB_HOST" value="processmaker3" />
<var name="DB_NAME" value="wf_test" />
<var name="DB_USER" value="root" />
<var name="DB_PASS" value="" />
<var name="PATH_DB" value="./shared/sites/" />
<var name="PATH_DATA" value="./shared/" />
<var name="APP_HOST" value="processmaker3.local" />
<var name="HTTPS" value="off" />
<var name="SERVER_PORT" value="8080" />
</php>
</phpunit>

View File

@@ -1,4 +1,5 @@
<?php
/**
* Test harness bootstrap that sets up initial defines and builds up the initial database schema
*/
@@ -13,13 +14,21 @@ use Illuminate\Support\Facades\Schema;
/**
* @todo Migrate to configuration parameters
*/
define('PATH_CORE', 'workflow/engine/');
define('PATH_TRUNK', dirname(__DIR__));
define('PATH_CORE', PATH_TRUNK.'/workflow/engine/');
define('PATH_CONFIG', PATH_CORE . 'config/');
define('PATH_RBAC_CORE', 'rbac/engine/');
define('PATH_DB', 'shared/sites/');
define('PATH_DATA', 'shared/rbac/');
define('PATH_RBAC_CORE',dirname(__DIR__).'/rbac/engine/');
define('PATH_DB', dirname(__DIR__).'/shared/sites/');
define('PATH_DATA', dirname(__DIR__).'/shared/rbac/');
define('PATH_SEP', '/');
define('PATH_METHODS', 'workflow/engine/methods/');
define('PATH_METHODS', dirname(__DIR__).'/workflow/engine/methods/');
define('SYS_LANG', 'en');
define('DB_ADAPTER', 'mysql');
define('SYS_SKIN', 'neoclassic');
define('SYS_SYS', 'workflow');
define('PATH_WORKSPACE',PATH_TRUNK.'/shared/sites/' . SYS_SYS . '/');
define('PMTABLE_KEY','pmtable');
// Setup basic app services
$app = require __DIR__ . '/../bootstrap/app.php';
@@ -27,17 +36,17 @@ $app->make(Kernel::class)->bootstrap();
// Setup our testexternal database
config(['database.connections.testexternal' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'database' => env('DB_TESTEXTERNAL_DB', 'testexternal'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'database' => env('DB_DATABASE', 'testexternal'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', 'password'),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null
]]);
// Now, drop all test tables and repopulate with schema
@@ -52,13 +61,13 @@ DB::connection('testexternal')->table('test')->insert([
]);
// Only do if we are supporting MSSql tests
if(env('RUN_MSSQL_TESTS')) {
if (env('RUN_MSSQL_TESTS')) {
config(['database.connections.mssql' => [
'driver' => 'sqlsrv',
'host' => env('MSSQL_HOST', '127.0.0.1'),
'database' => env('MSSQL_DATABASE', 'testexternal'),
'username' => env('MSSQL_USERNAME', 'root'),
'password' => env('MSSQL_PASSWORD', ''),
'driver' => 'sqlsrv',
'host' => env('MSSQL_HOST', '127.0.0.1'),
'database' => env('MSSQL_DATABASE', 'testexternal'),
'username' => env('MSSQL_USERNAME', 'root'),
'password' => env('MSSQL_PASSWORD', 'password'),
]]);
Schema::connection('mssql')->dropIfExists('test');
@@ -73,26 +82,25 @@ if(env('RUN_MSSQL_TESTS')) {
// THIS IS FOR STANDARD PROCESSMAKER TABLES
// Now, drop all test tables and repopulate with schema
DB::unprepared('SET FOREIGN_KEY_CHECKS = 0');
$colname = 'Tables_in_' . env('DB_DATABASE');
$tables = DB::select('SHOW TABLES');
$drop = [];
foreach($tables as $table) {
foreach ($tables as $table) {
$drop[] = $table->$colname;
}
if(count($drop)) {
if (count($drop)) {
$drop = implode(',', $drop);
DB::statement("DROP TABLE $drop");
DB::unprepared('SET FOREIGN_KEY_CHECKS = 1');
}
// Repopulate with schema and standard inserts
DB::unprepared(file_get_contents(PATH_CORE.'data/mysql/schema.sql'));
DB::unprepared(file_get_contents(PATH_RBAC_CORE.'data/mysql/schema.sql'));
DB::unprepared(file_get_contents(PATH_CORE.'data/mysql/insert.sql'));
DB::unprepared(file_get_contents(PATH_RBAC_CORE.'data/mysql/insert.sql'));
DB::unprepared(file_get_contents(PATH_CORE . 'data/mysql/schema.sql'));
DB::unprepared(file_get_contents(PATH_RBAC_CORE . 'data/mysql/schema.sql'));
DB::unprepared(file_get_contents(PATH_CORE . 'data/mysql/insert.sql'));
DB::unprepared(file_get_contents(PATH_RBAC_CORE . 'data/mysql/insert.sql'));
// Set our APP_SEQUENCE val
DB::table('APP_SEQUENCE')->insert([
@@ -106,7 +114,7 @@ DB::table('OAUTH_CLIENTS')->insert([
'CLIENT_NAME' => 'PM Web Designer',
'CLIENT_DESCRIPTION' => 'ProcessMaker Web Designer App',
'CLIENT_WEBSITE' => 'www.processmaker.com',
'REDIRECT_URI' => config('app.url') . '/sys' . config('system.workspace').'/en/neoclassic/oauth2/grant',
'REDIRECT_URI' => config('app.url') . '/sys' . config('system.workspace') . '/en/neoclassic/oauth2/grant',
'USR_UID' => '00000000000000000000000000000001'
]);
DB::table('OAUTH_ACCESS_TOKENS')->insert([
@@ -133,4 +141,4 @@ Propel::initConfiguration([
'adapter' => 'mysql'
]
]
]);
]);

View File

@@ -0,0 +1,280 @@
<?php
use Tests\TestCase;
class ReplaceDataFieldTest extends TestCase
{
/**
* This checks that strings with HTML reserved characters are replaced with entities
* @test
* @covers G::replaceDataField
*/
public function it_should_replace_entities()
{
// Initializing Faker instance
$faker = Faker\Factory::create();
// Initializing variables to use that will not change
$stringWithVariablesToReplace = 'Hello @@var1 the @#var2 is @=var3 not @&var4->value';
$dbEngine = 'mysql'; // This only affects the way to escape the variables with "@@" prefix
$applyEntities = true; // If a value to replace is a not valid HTML and have HTML reserved characters, entities should be applied
// Initializing variables to test the assertions, entities should be applied in variable with @@
$var4 = new stdClass();
$var4->value = $faker->words(1, true);
$valuesToReplace = [
'var1' => 'Java < PHP & Python',
'var2' => $faker->words(1, true),
'var3' => $faker->words(1, true),
'var4' => $var4
];
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithVariablesToReplace, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp('/&lt;/', $stringToCheck);
$this->assertRegExp('/&amp;/', $stringToCheck);
// Initializing variables to test the assertions, entities should be applied in variable with @#
$var4 = new stdClass();
$var4->value = $faker->words(1, true);
$valuesToReplace = [
'var1' => $faker->words(1, true),
'var2' => 'Java < PHP & Python',
'var3' => $faker->words(1, true),
'var4' => $var4
];
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithVariablesToReplace, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp('/&lt;/', $stringToCheck);
$this->assertRegExp('/&amp;/', $stringToCheck);
// Initializing variables to test the assertions, entities should be applied in variable with @=
$var4 = new stdClass();
$var4->value = $faker->words(1, true);
$valuesToReplace = [
'var1' => $faker->words(1, true),
'var2' => $faker->words(1, true),
'var3' => 'Java < PHP & Python',
'var4' => $var4
];
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithVariablesToReplace, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp('/&lt;/', $stringToCheck);
$this->assertRegExp('/&amp;/', $stringToCheck);
// Initializing variables to test the assertions, entities should be applied in variable with @&
$var4 = new stdClass();
$var4->value = 'Java < PHP & Python';
$valuesToReplace = [
'var1' => $faker->words(1, true),
'var2' => $faker->words(1, true),
'var3' => $faker->words(1, true),
'var4' => $var4
];
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithVariablesToReplace, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp('/&lt;/', $stringToCheck);
$this->assertRegExp('/&amp;/', $stringToCheck);
}
/**
* This checks that strings with HTML reserved characters are NOT replaced with entities
* @test
* @covers G::replaceDataField
*/
public function it_should_no_replace_entities()
{
// Initializing Faker instance
$faker = Faker\Factory::create();
// Initializing variables to use that will not change
$stringWithVariablesToReplace = 'Hello @@var1 the @#var2 is @=var3 not @&var4->value';
$dbEngine = 'mysql'; // This only affects the way to escape the variables with "@@" prefix
$applyEntities = false; // The values should not be replaced with entities
// Initializing variables to test the assertions, entities should be applied in variable with @@
$var4 = new stdClass();
$var4->value = $faker->words(1, true);
$valuesToReplace = [
'var1' => 'Java < PHP & Python',
'var2' => $faker->words(1, true),
'var3' => $faker->words(1, true),
'var4' => $var4
];
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithVariablesToReplace, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp('/</', $stringToCheck);
$this->assertRegExp('/&/', $stringToCheck);
// Initializing variables to test the assertions, entities should be applied in variable with @#
$var4 = new stdClass();
$var4->value = $faker->words(1, true);
$valuesToReplace = [
'var1' => $faker->words(1, true),
'var2' => 'Java < PHP & Python',
'var3' => $faker->words(1, true),
'var4' => $var4
];
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithVariablesToReplace, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp('/</', $stringToCheck);
$this->assertRegExp('/&/', $stringToCheck);
// Initializing variables to test the assertions, entities should be applied in variable with @=
$var4 = new stdClass();
$var4->value = $faker->words(1, true);
$valuesToReplace = [
'var1' => $faker->words(1, true),
'var2' => $faker->words(1, true),
'var3' => 'Java < PHP & Python',
'var4' => $var4
];
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithVariablesToReplace, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp('/</', $stringToCheck);
$this->assertRegExp('/&/', $stringToCheck);
// Initializing variables to test the assertions, entities should be applied in variable with @&
$var4 = new stdClass();
$var4->value = 'Java < PHP & Python';
$valuesToReplace = [
'var1' => $faker->words(1, true),
'var2' => $faker->words(1, true),
'var3' => $faker->words(1, true),
'var4' => $var4
];
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithVariablesToReplace, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp('/</', $stringToCheck);
$this->assertRegExp('/&/', $stringToCheck);
}
/**
* This checks that strings with HTML reserved characters are NOT replaced with entities if is a valid HTML, because
* PS team sometimes build a HTML string to insert in templates (output documents or emails), Ex.- A table to list
* users or results from a query
* @test
* @covers G::replaceDataField
*/
public function it_should_no_replace_entities_if_exists_valid_html()
{
// Initializing Faker instance
$faker = Faker\Factory::create();
// Initializing variables to use
$stringWithVariablesToReplace = 'bla @#var1 bla @=listHtml bla @@var2 bla';
$valuesToReplace = [
'var1' => $faker->words(1, true),
'listHtml' => '<table>
<tr>
<th>t1</th>
<th>t2</th>
<th>t3</th>
<th>t4</th>
<th>t5</th>
<th>t6</th>
</tr>
<tr>
<td>c1</td>
<td>c2</td>
<td>c3</td>
<td>c4</td>
<td>c5</td>
<td>c6</td>
</tr>
</table>',
'var2' => $faker->words(1, true)
];
$dbEngine = 'mysql'; // This only affects the way to escape the variables with "@@" prefix
$applyEntities = true; // Is true because the string will b used in a output document or a email template
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithVariablesToReplace, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp('/<table>/', $stringToCheck);
$this->assertRegExp('/<tr>/', $stringToCheck);
$this->assertRegExp('/<th>/', $stringToCheck);
$this->assertRegExp('/<td>/', $stringToCheck);
}
/**
* This checks that strings with tag <br /> should not be replaced, because is a valid tag
* @test
* @covers G::replaceDataField
*/
public function it_should_no_replace_tag_br()
{
// Initializing variables to use
$stringWithTagBr = nl2br("prospection auprès d'entreprises de CA < 10 M euros
test
<a
>a
&a
\"a
'a
¢a
£a
¥a
€a
©a
®a
test");
$valuesToReplace = [];
$dbEngine = 'mysql'; // This only affects the way to escape the variables with "@@" prefix
$applyEntities = true; // Is true because the string will be used in a output document or a email template
// Replace variables in the string
$stringToCheck = G::replaceDataField($stringWithTagBr, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp("/<br \/>/", $stringToCheck);
}
/**
* Check that the value for the System variable "__ABE__" should not be replaced never
* @test
* @covers G::replaceDataField
*/
public function it_should_no_replace_entities_for_var_abe()
{
// Initializing variables to use
$string = "bla @#__ABE__ bla @#anotherVar bla";
$valuesToReplace = [// Add a value for reserved system variable "__ABE__" used in Actions By Email feature
'__ABE__' => 'Java < PHP', // The value for System variable "__ABE__" shouldn't be changed never
'anotherVar' => '.NET < Java' // The value for another variables should be validated/replaced normally
];
$dbEngine = 'mysql'; // This only affects the way to escape the variables with "@@" prefix
$applyEntities = true; // Is true because the string will be used in a output document or a email template
// Replace variables in the string
$stringToCheck = G::replaceDataField($string, $valuesToReplace, $dbEngine, $applyEntities);
// Assertions
$this->assertRegExp("/Java < PHP/", $stringToCheck);
$this->assertRegExp("/.NET &lt; Java/", $stringToCheck);
}
}

View File

@@ -0,0 +1,535 @@
<?php
use Illuminate\Foundation\Testing\DatabaseTransactions;
use ProcessMaker\Model\Dynaform;
use ProcessMaker\Model\Process;
use Tests\TestCase;
class PmDynaformTest extends TestCase
{
use DatabaseTransactions;
/**
* Constructor of the class.
*/
function __construct()
{
$_SERVER["REQUEST_URI"] = "";
}
/**
* Check if the getDynaform() method returning null if current dynaform parameter not exist.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_null_if_current_dynaform_parameter_not_exist()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 6,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform();
$result = $pmDynaform->getDynaform();
$this->assertEquals(null, $result);
}
/**
* Check if the getDynaform() method returning null if parameters is empty.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_null_if_parameters_is_empty()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 5,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform([]);
$result = $pmDynaform->getDynaform();
$this->assertEquals(null, $result);
}
/**
* Check if the getDynaform() method returning null if current dynaform not exist.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_null_if_current_dynaform_not_exist()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 5,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform(['CURRENT_DYNAFORM' => G::generateUniqueID()]);
$result = $pmDynaform->getDynaform();
$this->assertEquals(null, $result);
}
/**
* Check if the getDynaform() method returning null if parameters is not empty.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_null_if_parameters_is_not_empty()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 5,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform(["APP_DATA" => []]);
$result = $pmDynaform->getDynaform();
$this->assertEquals(null, $result);
}
/**
* Check if the getDynaform() method returning null if parameter is a string.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_null_if_parameter_is_a_string()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 5,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform("");
$result = $pmDynaform->getDynaform();
$this->assertEquals(null, $result);
}
/**
* Check if the getDynaform() method returning null if parameter is a integer.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_null_if_parameter_is_a_integer()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 5,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform(1);
$result = $pmDynaform->getDynaform();
$this->assertEquals(null, $result);
}
/**
* Check if the getDynaform() method returning record property.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_record_property_if_record_is_not_null()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 4,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$expected = (array) $dynaform->first()->toArray();
unset($expected['id']); //This is removed because is aggregate from factory.
//first execution in constructor
$pmDynaform = new PmDynaform(['CURRENT_DYNAFORM' => $arrayForm['items'][0]['id']]);
//second execution
$pmDynaform->getDynaform();
//third execution
$pmDynaform->getDynaform();
$this->assertEquals($expected, $pmDynaform->record);
}
/**
* Check if the getDynaform() method setting langs property in null if current dynaform not exist.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_langs_property_in_null_if_current_dynaform_not_exist()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 6,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform(['CURRENT_DYNAFORM' => G::generateUniqueID()]);
$pmDynaform->getDynaform();
$this->assertEquals(null, $pmDynaform->langs);
}
/**
* Check if the getDynaform() method returning null if dynaform not exist in the process.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_null_if_dynaform_not_exist_in_the_process()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 5,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform(['CURRENT_DYNAFORM' => G::generateUniqueID()]);
$pmDynaform->getDynaform();
$this->assertEquals(null, $pmDynaform->record);
}
/**
* Check if the getDynaform() method returning fields.
* @covers PmDynaform::getDynaform
* @test
*/
public function it_should_return_a_dynaform_in_array_format()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 3,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$expected = (array) $dynaform->first()->toArray();
unset($expected['id']); //This is removed because is aggregate from factory.
$pmDynaform = new PmDynaform(['CURRENT_DYNAFORM' => $arrayForm['items'][0]['id']]);
$result = $pmDynaform->getDynaform();
$this->assertEquals($expected, $result);
}
/**
* Check if the getDynaforms() method returning null when not exist dynaform.
* @covers PmDynaform::getDynaforms
* @test
*/
public function it_should_return_null_when_not_exist_dynaform()
{
$process = factory(Process::class, 1)->create();
$arrayForm = $this->createArrayDynaform();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 7,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform();
$result = $pmDynaform->getDynaforms(['CURRENT_DYNAFORM' => G::generateUniqueID()]);
$this->assertEquals(null, $result);
}
/**
* Check if the getDynaforms() method returning null when record is null.
* @covers PmDynaform::getDynaforms
* @test
*/
public function it_should_return_null_when_record_is_null()
{
$pmDynaform = new PmDynaform();
$pmDynaform->getDynaforms();
$this->assertEquals(null, $pmDynaform->record);
}
/**
* Check if the getDynaforms() method returning record property.
* @covers PmDynaform::getDynaforms
* @test
*/
public function it_should_return_array_dynaforms_except_current_dynaform_in_second_execution()
{
$process = factory(Process::class, 1)->create();
$arrayForm = $this->createArrayDynaform();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 7,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$arrayForm2 = $this->createArrayDynaform();
$dynaform2 = factory(Dynaform::class, 1)->create([
'DYN_ID' => 9,
'DYN_UID' => $arrayForm2['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm2)
]);
$expected = (array) $dynaform2->first()->toArray();
unset($expected['id']); //This is removed because is aggregate from factory.
$pmDynaform = new PmDynaform(['CURRENT_DYNAFORM' => $arrayForm['items'][0]['id']]);
$pmDynaform->getDynaforms();
$this->assertEquals([$expected], $pmDynaform->records);
}
/**
* Check if the getDynaforms() method returning arrays dynaforms except current dynaform.
* @covers PmDynaform::getDynaforms
* @test
*/
public function it_should_return_array_dynaforms_except_current_dynaform()
{
$process = factory(Process::class, 1)->create();
$arrayForm = $this->createArrayDynaform();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 7,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$arrayForm2 = $this->createArrayDynaform();
$dynaform2 = factory(Dynaform::class, 1)->create([
'DYN_ID' => 9,
'DYN_UID' => $arrayForm2['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm2)
]);
$expected = (array) $dynaform2->first()->toArray();
unset($expected['id']); //This is removed because is aggregate from factory.
$pmDynaform = new PmDynaform(['CURRENT_DYNAFORM' => $arrayForm['items'][0]['id']]);
$result = $pmDynaform->getDynaforms();
$this->assertEquals([$expected], $result);
}
/**
* Check if the isUsed() method is returning false when not exist data related to process id.
* @covers PmDynaform::isUsed
* @test
*/
public function it_should_return_false_when_not_exist_data_related_to_id_process()
{
$processId = G::generateUniqueID();
$pmDynaform = new PmDynaform();
$result = $pmDynaform->isUsed($processId, 'var1');
$this->assertEquals(false, $result);
}
/**
* Check if the isUsed() method is returning the ID of the dynaform in case
* the variable is part of the dynaform.
* @covers PmDynaform::isUsed
* @test
*/
public function it_should_return_id_of_dynaform_when_is_used_variable()
{
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 1,
'DYN_UID' => $arrayForm['items'][0]['id'],
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform();
$result = $pmDynaform->isUsed($process[0]->PRO_UID, $arrayForm['items'][0]['variables'][0]);
$this->assertEquals($dynaform[0]->DYN_UID, $result);
}
/**
* Check if the isUsed() method is returning false in case the variable is
* not part of the dynaform.
* @covers PmDynaform::isUsed
* @test
*/
public function it_should_return_false_when_not_used_variable()
{
$arrayVariable = $this->createArrayVariable('var10');
$arrayForm = $this->createArrayDynaform();
$process = factory(Process::class, 1)->create();
$dynaform = factory(Dynaform::class, 1)->create([
'DYN_ID' => 2,
'PRO_UID' => $process[0]->PRO_UID,
'DYN_CONTENT' => G::json_encode($arrayForm)
]);
$pmDynaform = new PmDynaform();
$result = $pmDynaform->isUsed($process[0]->PRO_UID, $arrayVariable);
$this->assertEquals(false, $result);
}
/**
* Return an object that represents the structure of a process variable.
* @return array
*/
private function createArrayVariable($varName)
{
return [
"var_uid" => G::generateUniqueID(),
"prj_uid" => G::generateUniqueID(),
"var_name" => $varName,
"var_field_type" => "string",
"var_field_size" => 10,
"var_label" => "string",
"var_dbconnection" => "workflow",
"var_dbconnection_label" => "PM Database",
"var_sql" => "",
"var_null" => 0,
"var_default" => "",
"var_accepted_values" => "[]",
"inp_doc_uid" => ""
];
}
/**
* Returns an object that represents the structure of a control.
* @return array
*/
private function createArrayControl($varUid, $varName)
{
return [
"type" => "textarea",
"variable" => $varName,
"var_uid" => $varUid,
"dataType" => "string",
"protectedValue" => false,
"id" => "textareaVar001",
"name" => "textareaVar001",
"label" => "textarea_1",
"defaultValue" => "",
"placeholder" => "",
"hint" => "",
"required" => false,
"requiredFieldErrorMessage" => "",
"validate" => "",
"validateMessage" => "",
"mode" => "parent",
"dbConnection" => "workflow",
"dbConnectionLabel" => "PM Database",
"sql" => "",
"rows" => "5",
"var_name" => "textareaVar001",
"colSpan" => 12
];
}
/**
* Returns an object that represents the structure of a dynaform.
* @return array
*/
private function createArrayDynaform()
{
$var1 = $this->createArrayVariable('var1');
$control1 = $this->createArrayControl($var1['var_uid'], $var1['var_name']);
$var2 = $this->createArrayVariable('var2');
$control2 = $this->createArrayControl($var2['var_uid'], $var2['var_name']);
return [
"name" => "subform",
"description" => "",
"items" => [
[
"type" => "form",
"variable" => "",
"var_uid" => "",
"dataType" => "",
"id" => G::generateUniqueID(),
"name" => "subform",
"description" => "",
"mode" => "edit",
"script" => "",
"language" => "en",
"externalLibs" => "",
"printable" => false,
"items" => [
[$control1],
[$control2]
],
"variables" => [
$var1,
$var2
]
]
]
];
}
}

View File

@@ -0,0 +1,733 @@
<?php
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
use Tests\TestCase;
class PmDynaformTest extends TestCase
{
use DatabaseTransactions;
/**
* Constructor of the class.
*/
protected function setUp()
{
$_SERVER["REQUEST_URI"] = "";
}
/**
* Check if the "populateTable" function returns an array value if entered all parameters.
* @test
* @covers ReportTables::populateTable
*/
public function it_should_populating_data_with_all_parameters()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 1);
$connectionShortName = 'wf';
$type = 'NORMAL';
$fields = $result->fields;
$proUid = $result->processUid;
$grid = '';
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields, $proUid, $grid);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals($expected, $actual);
}
/**
* Check if the "populateTable" function returns an array value if entered all
* parameters and type and grid are correct values.
* @test
* @covers ReportTables::populateTable
*/
public function it_should_populating_data_with_all_parameters_with_type_is_grid()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 18, true);
$connectionShortName = 'wf';
$type = 'GRID';
$fields = $result->fields;
$proUid = $result->processUid;
$grid = 'var_Grid1';
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields, $proUid, $grid);
$indexRow = 1;
$expected = $result->appData[$grid];
foreach ($expected as &$row) {
$row['APP_UID'] = $result->applicationUid;
$row['APP_NUMBER'] = $result->applicationNumber;
$row['ROW'] = (string) ($indexRow++);
}
$expected = array_values($expected);
$actual = DB::table($tableName)
->select()
->get();
$actual->transform(function ($item, $key) {
return (array) $item;
});
$actual = $actual->toArray();
$this->assertEquals($expected, $actual);
}
/**
* Check if the "populateTable" function returns an array value if entered all
* parameters and type and grid are incorrect values.
* @test
* @covers ReportTables::populateTable
*/
public function it_should_populating_data_with_all_parameters_with_type_is_grid_null()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 19, true);
$connectionShortName = 'wf';
$type = 'GRID';
$fields = $result->fields;
$proUid = $result->processUid;
$grid = null;
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields, $proUid, $grid);
$actual = DB::table($tableName)
->select()
->get();
$actual->transform(function ($item, $key) {
return (array) $item;
});
$actual = $actual->toArray();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if only the
* name of the report table has been entered.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_only_with_the_mandatory_parameter_tableName()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 2);
$reportTables = new ReportTables();
$reportTables->populateTable($tableName);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable and the name of the
* connection.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_connectionShortName_parameter()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 3);
$connectionShortName = 'wf';
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable and the name of the
* connection is null.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_connectionShortName_parameter_is_null()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 8);
$connectionShortName = null;
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable and the name of the
* connection is incorrect value.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_connectionShortName_parameter_is_incorrect_value()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 9);
$connectionShortName = G::generateUniqueID();
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable, the name of the
* connection and type.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 4);
$connectionShortName = 'wf';
$type = 'NORMAL';
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable, the name of the
* connection and type is grid.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_is_grid()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 11);
$connectionShortName = 'wf';
$type = 'GRID';
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable, the name of the
* connection and type is null.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_is_null()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 10);
$connectionShortName = 'wf';
$type = null;
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable, the name of the
* connection, the type and fields.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_fields()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 5);
$connectionShortName = 'wf';
$type = 'NORMAL';
$fields = $result->fields;
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable, the name of the
* connection, the type and fields is null.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_fields_is_null()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 12);
$connectionShortName = 'wf';
$type = 'NORMAL';
$fields = null;
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable, the name of the
* connection, the type and fields is empty array.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_fields_is_empty_array()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 13);
$connectionShortName = 'wf';
$type = 'NORMAL';
$fields = [];
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable, the name of the
* connection, the type and fields is incorrect value.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_fields_is_incorrect_value()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 14);
$connectionShortName = 'wf';
$type = 'NORMAL';
$fields = "";
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an array value if you have
* entered the name of the table of the reportTable, the name of the
* connection, the type, the fields and process identifier.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_fields_proUid()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 6);
$connectionShortName = 'wf';
$type = 'NORMAL';
$fields = $result->fields;
$proUid = $result->processUid;
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields, $proUid);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals($expected, $actual);
}
/**
* Check if the "populateTable" function returns an empty array if you have
* entered the name of the table of the reportTable, the name of the
* connection, the type, the fields and process identifier is null.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_fields_proUid_is_null()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 15);
$connectionShortName = 'wf';
$type = 'NORMAL';
$fields = $result->fields;
$proUid = null;
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields, $proUid);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals([], $actual);
}
/**
* Check if the "populateTable" function returns an array value if you have
* entered the name of the table of the reportTable, the name of the
* connection, the type, the fields, the process identifier and grid name.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_fields_proUid_grid()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 7);
$connectionShortName = 'wf';
$type = 'NORMAL';
$fields = $result->fields;
$proUid = $result->processUid;
$grid = '';
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields, $proUid, $grid);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals($expected, $actual);
}
/**
* Check if the "populateTable" function returns an array value if you have
* entered the name of the table of the reportTable, the name of the
* connection, the type, the fields, the process identifier and grid name if null.
* @test
* @covers ReportTables::populateTable
*/
public function this_should_populate_the_reports_table_with_the_parameters_connectionShortName_type_fields_proUid_grid_if_null()
{
$tableName = 'TestReportTable';
$result = $this->prepareData($tableName, 16);
$connectionShortName = 'wf';
$type = 'NORMAL';
$fields = $result->fields;
$proUid = $result->processUid;
$grid = null;
$reportTables = new ReportTables();
$reportTables->populateTable($tableName, $connectionShortName, $type, $fields, $proUid, $grid);
$expected = $result->dataFields;
$expected['APP_UID'] = $result->applicationUid;
$expected['APP_NUMBER'] = $result->applicationNumber;
$actual = (array) DB::table($tableName)
->select()
->first();
$this->assertEquals($expected, $actual);
}
/**
* Get mapping fields supported by report table.
* @return array
*/
private function getMapFields()
{
return [
[
'sFieldName' => 'var_Text1',
'sType' => 'char'
],
[
'sFieldName' => 'var_Textarea1',
'sType' => 'text'
],
[
'sFieldName' => 'var_Dropdown1',
'sType' => 'char'
],
[
'sFieldName' => 'var_Suggest1',
'sType' => 'char'
],
[
'sFieldName' => 'var_DateTime1',
'sType' => 'date'
],
[
'sFieldName' => 'var_String1',
'sType' => 'char'
],
[
'sFieldName' => 'var_Integer1',
'sType' => 'number'
],
[
'sFieldName' => 'var_Boolean1',
'sType' => 'boolean'
],
[
'sFieldName' => 'var_Array1',
'sType' => 'array'
]
];
}
/**
* Create fields data by type supported.
* @param array $types
* @return array
*/
private function createFieldsByType($types = [])
{
$fields = [];
$mapping = [];
$faker = Faker\Factory::create();
$date = $faker->dateTime();
$mapFields = $this->getMapFields();
foreach ($mapFields as $key => $value) {
if (!in_array($value['sType'], $types)) {
continue;
}
switch ($value['sType']) {
case 'number':
$mapping[] = $value;
$fields[$value['sFieldName']] = (string) random_int(0, 100);
break;
case 'char':
$mapping[] = $value;
$fields[$value['sFieldName']] = G::generateUniqueID();
break;
case 'text':
$mapping[] = $value;
$fields[$value['sFieldName']] = G::generateUniqueID();
break;
case 'date':
$mapping[] = $value;
$fields[$value['sFieldName']] = $date->format('Y-m-d H:i:s');
break;
case 'boolean':
$mapping[] = $value;
$fields[$value['sFieldName']] = ['0' => 0];
break;
}
}
return [
'data' => $fields,
'mapping' => $mapping
];
}
/**
* Prepare data initial for test, the grid parameter is optional if you want
* to create a grid type field.
*
* @param string $tableName
* @param integer $applicationNumber
* @param boolean $grid
* @return object
*/
private function prepareData($tableName, $applicationNumber, $grid = null)
{
$faker = Faker\Factory::create();
$date = $faker->dateTime();
$userUid = G::generateUniqueID();
$processUid = G::generateUniqueID();
$taskUid = G::generateUniqueID();
$applicationUid = G::generateUniqueID();
$structure = $this->createFieldsByType(['number', 'char', 'text', 'date']);
$fields = $structure['mapping'];
$dataFields = $structure['data'];
$appData = [
'SYS_LANG' => 'en',
'SYS_SKIN' => 'neoclassic',
'SYS_SYS' => 'workflow',
'APPLICATION' => G::generateUniqueID(),
'PROCESS' => G::generateUniqueID(),
'TASK' => '',
'INDEX' => 2,
'USER_LOGGED' => $userUid,
'USR_USERNAME' => 'admin',
'APP_NUMBER' => $applicationNumber,
'PIN' => '97ZN'
];
$appData = array_merge($appData, $dataFields);
if ($grid === true) {
$gridFields = [
'var_Grid1' => [
'1' => $dataFields,
'2' => $dataFields,
]
];
$appData = array_merge($appData, $gridFields);
}
$user = factory(User::class)->create([
'USR_UID' => $userUid
]);
$process = factory(Process::class)->create([
'PRO_UID' => $processUid
]);
$task = factory(Task::class)->create([
'PRO_UID' => $process->PRO_UID
]);
$application = factory(Application::class)->create([
'PRO_UID' => $process->PRO_UID,
'APP_UID' => $applicationUid,
'APP_NUMBER' => $applicationNumber,
'APP_DATA' => serialize($appData)
]);
Schema::dropIfExists($tableName);
Schema::create($tableName, function ($table) use ($dataFields, $grid) {
$table->string('APP_UID');
$table->string('APP_NUMBER');
if ($grid === true) {
$table->string('ROW');
}
foreach ($dataFields as $key => $value) {
$table->string($key);
}
});
$result = new stdClass();
$result->userUid = $userUid;
$result->processUid = $processUid;
$result->taskUid = $taskUid;
$result->applicationUid = $applicationUid;
$result->applicationNumber = $applicationNumber;
$result->fields = $fields;
$result->dataFields = $dataFields;
$result->appData = $appData;
$result->user = $user;
$result->process = $process;
$result->task = $task;
$result->application = $application;
return $result;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,834 @@
<?php
namespace Tests\unit\workflow\src\ProcessMaker\Model;
use ProcessMaker\Model\AppAssignSelfServiceValue;
use ProcessMaker\Model\AppAssignSelfServiceValueGroup;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\GroupUser;
use ProcessMaker\Model\Groupwf;
use ProcessMaker\Model\ListUnassigned;
use ProcessMaker\Model\Process;
use ProcessMaker\Model\ProcessCategory;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\TaskUser;
use ProcessMaker\Model\User;
use Tests\TestCase;
class ListUnassignedTest extends TestCase
{
/**
* This is using instead of DatabaseTransactions
* @todo DatabaseTransactions is having conflicts with propel
*/
protected function setUp()
{
}
/**
* This checks the counters is working properly in self-service user assigned
* @covers ListUnassigned::doCount
* @test
*/
public function it_should_count_cases_by_user_with_self_service_user_assigned()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create();
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 15)->create([
'TAS_ID' => $task[0]->TAS_ID
]);
$timeStart = microtime(true);
$result = ListUnassigned::doCount($user[0]->USR_UID);
$timeEnd = microtime(true);
$this->assertEquals(15, $result);
$time = $timeEnd - $timeStart;
error_log('it_should_count_cases_by_user_with_self_service_user_assigned took [15]--->' . $time);
}
/**
* This checks the counters is working properly in self-service-value-based when the variable has a value related with the USR_UID
* When the value assigned in the variable @@ARRAY_OF_USERS = [USR_UID]
* @covers ListUnassigned::doCount
* @test
*/
public function it_should_count_cases_by_user_with_self_service_value_based_usr_uid()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create a case
$application = factory(Application::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create();
//Create a task self service value based
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS',
'PRO_UID' => $process[0]->PRO_UID
]);
//Create the relation for the value assigned in the TAS_GROUP_VARIABLE
$appSelfValue = factory(AppAssignSelfServiceValue::class, 1)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'DEL_INDEX' => 2,
'TAS_ID' => $task[0]->TAS_ID
]);
factory(AppAssignSelfServiceValueGroup::class, 1)->create([
'ID' => $appSelfValue[0]->ID,
'GRP_UID' => $user[0]->USR_UID,
'ASSIGNEE_ID' => $user[0]->USR_ID, //The usrId or grpId
'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 10)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'DEL_INDEX' => $appSelfValue[0]->DEL_INDEX,
'TAS_ID' => $task[0]->TAS_ID,
]);
$timeStart = microtime(true);
$result = ListUnassigned::doCount($user[0]->USR_UID);
$this->assertEquals(10, $result);
$timeEnd = microtime(true);
$time = $timeEnd - $timeStart;
error_log('it_should_count_cases_by_user_with_self_service_value_based_usr_uid took [10]--->' . $time);
}
/**
* This checks the counters is working properly in self-service and self-service value based
* @covers ListUnassigned::doCount
* @test
*/
public function it_should_count_cases_by_user_with_self_service_mixed_with_self_service_value_based()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create a case
$application = factory(Application::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create();
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create the register in self service
factory(ListUnassigned::class, 15)->create([
'TAS_ID' => $task[0]->TAS_ID
]);
//Create a task self service value based
$task1 = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS',
'PRO_UID' => $process[0]->PRO_UID
]);
//Create the relation for the value assigned in the TAS_GROUP_VARIABLE
$appSelfValue = factory(AppAssignSelfServiceValue::class, 1)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'DEL_INDEX' => 2,
'TAS_ID' => $task1[0]->TAS_ID
]);
factory(AppAssignSelfServiceValueGroup::class, 1)->create([
'ID' => $appSelfValue[0]->ID,
'GRP_UID' => $user[0]->USR_UID,
'ASSIGNEE_ID' => $user[0]->USR_ID, //The usrId or grpId
'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2
]);
//Create the register in self service value based
factory(ListUnassigned::class, 10)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'DEL_INDEX' => $appSelfValue[0]->DEL_INDEX,
'TAS_ID' => $task[0]->TAS_ID,
]);
$timeStart = microtime(true);
$result = ListUnassigned::doCount($user[0]->USR_UID);
$timeEnd = microtime(true);
$this->assertEquals(25, $result);
$time = $timeEnd - $timeStart;
error_log('it_should_count_cases_by_user_with_self_service_mixed_with_self_service_value_based took [25]--->' . $time);
}
/**
* This checks the counters is working properly in self-service group assigned
* @covers ListUnassigned::doCount
* @test
*/
public function it_should_count_cases_by_user_with_self_service_group_assigned()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create group
$group = factory(Groupwf::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create();
//Assign a user in the group
factory(GroupUser::class, 1)->create([
'GRP_UID' => $group[0]->GRP_UID,
'GRP_ID' => $group[0]->GRP_ID,
'USR_UID' => $user[0]->USR_UID
]);
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 2, //Related to the group
'TU_TYPE' => 1
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 15)->create([
'TAS_ID' => $task[0]->TAS_ID
]);
$timeStart = microtime(true);
$result = ListUnassigned::doCount($user[0]->USR_UID);
$timeEnd = microtime(true);
$this->assertEquals(15, $result);
$time = $timeEnd - $timeStart;
error_log('it_should_count_cases_by_user_with_self_service_group_assigned took [15]--->' . $time);
}
/**
* This checks the counters is working properly in self-service-value-based when the variable has a value related with the GRP_UID
* When the value assigned in the variable @@ARRAY_OF_USERS = [GRP_UID]
* @covers ListUnassigned::doCount
* @test
*/
public function it_should_count_cases_by_user_with_self_service_value_based_grp_uid()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create a task self service value based
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS',
'PRO_UID' => $process[0]->PRO_UID
]);
//Create a case
$application = factory(Application::class, 1)->create();
//Create group
$group = factory(Groupwf::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create([
'USR_USERNAME' => 'gary',
'USR_LASTNAME' => 'Gary',
'USR_FIRSTNAME' => 'Bailey',
]);
//Assign a user in the group
factory(GroupUser::class, 1)->create([
'GRP_UID' => $group[0]->GRP_UID,
'GRP_ID' => $group[0]->GRP_ID,
'USR_UID' => $user[0]->USR_UID,
]);
//Create the relation for the value assigned in the TAS_GROUP_VARIABLE
$appSelfValue = factory(AppAssignSelfServiceValue::class, 1)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'APP_UID' => $application[0]->APP_UID,
'DEL_INDEX' => 2,
'TAS_ID' => $task[0]->TAS_ID
]);
factory(AppAssignSelfServiceValueGroup::class, 1)->create([
'ID' => $appSelfValue[0]->ID,
'GRP_UID' => $group[0]->GRP_UID,
'ASSIGNEE_ID' => $group[0]->GRP_ID, //The usrId or grpId
'ASSIGNEE_TYPE' => 2 //Related to the user=1 related to the group=2
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 10)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'DEL_INDEX' => 2,
'TAS_ID' => $task[0]->TAS_ID,
]);
$timeStart = microtime(true);
$result = ListUnassigned::doCount($user[0]->USR_UID);
$this->assertEquals(10, $result);
$timeEnd = microtime(true);
$time = $timeEnd - $timeStart;
error_log('it_should_count_cases_by_user_with_self_service_value_based_grp_uid took [10]--->' . $time);
}
/**
* This checks the counters is working properly in self-service user and group assigned in parallel task
* @covers ListUnassigned::doCount
* @test
*/
public function it_should_count_cases_by_user_with_self_service_user_and_group_assigned_parallel_task()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create group
$group = factory(Groupwf::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create();
//Assign a user in the group
factory(GroupUser::class, 1)->create([
'GRP_UID' => $group[0]->GRP_UID,
'GRP_ID' => $group[0]->GRP_ID,
'USR_UID' => $user[0]->USR_UID
]);
//Create a task self service
$task1 = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task1
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task1[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create a task self service
$task2 = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task2
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task2[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create a task self service
$task3 = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task3[0]->TAS_UID,
'USR_UID' => $group[0]->GRP_UID,
'TU_RELATION' => 2, //Related to the group
'TU_TYPE' => 1
]);
//Create a task self service
$task4 = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task4[0]->TAS_UID,
'USR_UID' => $group[0]->GRP_UID,
'TU_RELATION' => 2, //Related to the group
'TU_TYPE' => 1
]);
//Create the register in list unassigned related to the task1
factory(ListUnassigned::class, 15)->create([
'TAS_ID' => $task1[0]->TAS_ID
]);
//Create the register in list unassigned related to the task2
factory(ListUnassigned::class, 15)->create([
'TAS_ID' => $task2[0]->TAS_ID
]);
//Create the register in list unassigned related to the task3
factory(ListUnassigned::class, 15)->create([
'TAS_ID' => $task3[0]->TAS_ID
]);
//Create the register in list unassigned related to the task4
factory(ListUnassigned::class, 15)->create([
'TAS_ID' => $task4[0]->TAS_ID
]);
$timeStart = microtime(true);
$result = ListUnassigned::doCount($user[0]->USR_UID);
$timeEnd = microtime(true);
$this->assertEquals(60, $result);
$time = $timeEnd - $timeStart;
error_log('it_should_count_cases_by_user_with_self_service_user_and_group_assigned_parallel_task took [60]--->' . $time);
}
/**
* This checks the counters is working properly in self-service-value-based with GRP_UID and USR_UID in parallel task
* When the value assigned in the variable @@ARRAY_OF_USERS = [GRP_UID, USR_UID]
* @covers ListUnassigned::doCount
* @test
*/
public function it_should_count_cases_by_user_with_self_service_value_based_usr_uid_and_grp_uid()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create a case
$application = factory(Application::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create();
//Create a task1 self service value based
$task1 = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS',
'PRO_UID' => $process[0]->PRO_UID
]);
//Create the relation for the value assigned in the TAS_GROUP_VARIABLE
$appSelfValue = factory(AppAssignSelfServiceValue::class, 1)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'TAS_ID' => $task1[0]->TAS_ID
]);
factory(AppAssignSelfServiceValueGroup::class, 1)->create([
'ID' => $appSelfValue[0]->ID,
'GRP_UID' => $user[0]->USR_UID,
'ASSIGNEE_ID' => $user[0]->USR_ID, //The usrId or grpId
'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 10)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'DEL_INDEX' => $appSelfValue[0]->DEL_INDEX,
'TAS_ID' => $task1[0]->TAS_ID,
]);
//Create a task2 self service value based
$task2 = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '@@ARRAY_OF_USERS',
'PRO_UID' => $process[0]->PRO_UID
]);
//Create the relation for the value assigned in the TAS_GROUP_VARIABLE
$appSelfValue = factory(AppAssignSelfServiceValue::class, 1)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'TAS_ID' => $task2[0]->TAS_ID
]);
factory(AppAssignSelfServiceValueGroup::class, 1)->create([
'ID' => $appSelfValue[0]->ID,
'GRP_UID' => $user[0]->USR_UID,
'ASSIGNEE_ID' => $user[0]->USR_ID, //The usrId or grpId
'ASSIGNEE_TYPE' => 1 //Related to the user=1 related to the group=2
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 10)->create([
'APP_NUMBER' => $application[0]->APP_NUMBER,
'DEL_INDEX' => $appSelfValue[0]->DEL_INDEX,
'TAS_ID' => $task2[0]->TAS_ID,
]);
$timeStart = microtime(true);
$result = ListUnassigned::doCount($user[0]->USR_UID);
$this->assertEquals(20, $result);
$timeEnd = microtime(true);
$time = $timeEnd - $timeStart;
error_log('it_should_count_cases_by_user_with_self_service_value_based_usr_uid_and_grp_uid took [20]--->' . $time);
}
/**
* This checks to make sure pagination is working properly
* @covers ListUnassigned::loadList
* @test
*/
public function it_should_return_pages_of_data()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create();
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 51)->create([
'TAS_ID' => $task[0]->TAS_ID
]);
//Define the filters
$filters = ['start' => 0, 'limit' => 25];
//Get data first page
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(25, $result);
//Get data second page
$filters = ['start' => 25, 'limit' => 25];
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(25, $result);
//Get data third page
$filters = ['start' => 50, 'limit' => 25];
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(1, $result);
}
/**
* This ensures ordering ascending and descending works by case number APP_NUMBER
* @covers ListUnassigned::loadList
* @test
*/
public function it_should_sort_by_case_number()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create();
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create a case
$application = factory(Application::class, 1)->create([
'APP_NUMBER' => 3000
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 1)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_NUMBER' => $application[0]->APP_NUMBER
]);
//Create a case
$application = factory(Application::class, 1)->create([
'APP_NUMBER' => 2000
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 1)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_NUMBER' => $application[0]->APP_NUMBER
]);
//Define the filters
$filters = ['sort' => 'APP_NUMBER', 'dir' => 'ASC'];
//Get data
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Get the minor case number first
$this->assertEquals(2000, $result[0]['APP_NUMBER']);
//Get the major case number second
$this->assertEquals(3000, $result[1]['APP_NUMBER']);
//Define the filters
$filters = ['sort' => 'APP_NUMBER', 'dir' => 'DESC'];
//Get data
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Get the major case number first
$this->assertEquals(3000, $result[0]['APP_NUMBER']);
//Get the minor case number second
$this->assertEquals(2000, $result[1]['APP_NUMBER']);
}
/**
* This ensures ordering ascending and descending works by case number APP_TITLE
* @covers ListUnassigned::loadList
* @test
*/
public function it_should_sort_by_case_title()
{
//Create process
$process = factory(Process::class, 1)->create();
//Create user
$user = factory(User::class, 1)->create();
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create a case
$application = factory(Application::class, 1)->create([
'APP_NUMBER' => 3001
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 1)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_NUMBER' => $application[0]->APP_NUMBER,
'APP_TITLE' => 'Request nro ' . $application[0]->APP_NUMBER,
]);
//Create a case
$application = factory(Application::class, 1)->create([
'APP_NUMBER' => 2001
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 1)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_NUMBER' => $application[0]->APP_NUMBER,
'APP_TITLE' => 'Request nro ' . $application[0]->APP_NUMBER,
]);
//Define the filters
$filters = ['sort' => 'APP_TITLE', 'dir' => 'ASC'];
//Get data
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Get the minor case title first
$this->assertEquals('Request nro 2001', $result[0]['APP_TITLE']);
//Get the major case title second
$this->assertEquals('Request nro 3001', $result[1]['APP_TITLE']);
//Define the filters
$filters = ['sort' => 'APP_TITLE', 'dir' => 'DESC'];
//Get data
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Get the major case title first
$this->assertEquals('Request nro 3001', $result[0]['APP_TITLE']);
//Get the minor case title second
$this->assertEquals('Request nro 2001', $result[1]['APP_TITLE']);
}
/**
* This ensures ordering ascending and descending works by case number APP_PRO_TITLE
* @covers ListUnassigned::loadList
* @test
*/
public function it_should_sort_by_process()
{
//Create user
$user = factory(User::class, 1)->create();
//Create process
$process = factory(Process::class, 1)->create();
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 1)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_PRO_TITLE' => 'Egypt Supplier Payment Proposal',
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 1)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_PRO_TITLE' => 'Russia Supplier Payment Proposal',
]);
//Define the filters
$filters = ['sort' => 'APP_PRO_TITLE', 'dir' => 'ASC'];
//Get data
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Get the minor process name first
$this->assertEquals('Egypt Supplier Payment Proposal', $result[0]['APP_PRO_TITLE']);
//Get the major process name second
$this->assertEquals('Russia Supplier Payment Proposal', $result[1]['APP_PRO_TITLE']);
//Define the filters
$filters = ['sort' => 'APP_PRO_TITLE', 'dir' => 'DESC'];
//Get data
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Get the major process name first
$this->assertEquals('Russia Supplier Payment Proposal', $result[0]['APP_PRO_TITLE']);
//Get the minor process name second
$this->assertEquals('Egypt Supplier Payment Proposal', $result[1]['APP_PRO_TITLE']);
}
/**
* This ensures ordering ascending and descending works by case number APP_TAS_TITLE
* @covers ListUnassigned::loadList
* @test
*/
public function it_should_sort_by_task()
{
//Create user
$user = factory(User::class, 1)->create();
//Create process
$process = factory(Process::class, 1)->create();
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 1)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_TAS_TITLE' => 'Initiate Request',
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 1)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_TAS_TITLE' => 'Waiting for AP Manager Validation',
]);
//Define the filters
$filters = ['sort' => 'APP_TAS_TITLE', 'dir' => 'ASC'];
//Get data
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Get the minor task name first
$this->assertEquals('Initiate Request', $result[0]['APP_TAS_TITLE']);
//Get the major task name second
$this->assertEquals('Waiting for AP Manager Validation', $result[1]['APP_TAS_TITLE']);
//Define the filters
$filters = ['sort' => 'APP_TAS_TITLE', 'dir' => 'DESC'];
//Get data
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Get the major task name first
$this->assertEquals('Waiting for AP Manager Validation', $result[0]['APP_TAS_TITLE']);
//Get the minor task namesecond
$this->assertEquals('Initiate Request', $result[1]['APP_TAS_TITLE']);
}
/**
* This checks to make sure filter by category is working properly
* @covers ListUnassigned::loadList
* @test
*/
public function it_should_return_data_filtered_by_process_category()
{
//Create user
$user = factory(User::class, 1)->create();
//Create a category
$category = factory(ProcessCategory::class, 1)->create();
//Create process
$process = factory(Process::class, 1)->create([
'PRO_CATEGORY' => $category[0]->CATEGORY_UID
]);
//Create a category
$category1 = factory(ProcessCategory::class, 1)->create();
//Create process
$process1 = factory(Process::class, 1)->create([
'PRO_CATEGORY' => $category1[0]->CATEGORY_UID
]);
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 2)->create([
'TAS_ID' => $task[0]->TAS_ID,
'PRO_UID' => $process[0]->PRO_UID,
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 5)->create([
'TAS_ID' => $task[0]->TAS_ID,
'PRO_UID' => $process1[0]->PRO_UID,
]);
//Get all data
$result = ListUnassigned::loadList($user[0]->USR_UID);
$this->assertCount(7, $result);
//Define the filters
$filters = ['category' => $category[0]->CATEGORY_UID];
//Get data
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Get the minor case number first
$this->assertEquals($category[0]->CATEGORY_UID, $result[0]['PRO_CATEGORY']);
//Get the major case number second
$this->assertEquals($category[0]->CATEGORY_UID, $result[1]['PRO_CATEGORY']);
}
/**
* This checks to make sure filter by category is working properly
* @covers ListUnassigned::loadList
* @test
*/
public function it_should_return_data_filtered_by_generic_search()
{
//Create user
$user = factory(User::class, 1)->create();
//Create process
$process = factory(Process::class, 1)->create();
//Create a task self service
$task = factory(Task::class, 1)->create([
'TAS_ASSIGN_TYPE' => 'SELF_SERVICE',
'TAS_GROUP_VARIABLE' => '',
'PRO_UID' => $process[0]->PRO_UID
]);
//Assign a user in the task
factory(TaskUser::class, 1)->create([
'TAS_UID' => $task[0]->TAS_UID,
'USR_UID' => $user[0]->USR_UID,
'TU_RELATION' => 1, //Related to the user
'TU_TYPE' => 1
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 2)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_TITLE' => 'This is a case name',
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 2)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_PRO_TITLE' => 'This is a process name',
]);
//Create the register in list unassigned
factory(ListUnassigned::class, 2)->create([
'TAS_ID' => $task[0]->TAS_ID,
'APP_TAS_TITLE' => 'This is a task name',
]);
//Create other registers
factory(ListUnassigned::class, 4)->create([
'TAS_ID' => $task[0]->TAS_ID
]);
//Define the filters
$filters = ['search' => 'case name'];
//Get data related to the search
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Define the filters
$filters = ['search' => 'process name'];
//Get data related to the search
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
//Define the filters
$filters = ['search' => 'task name'];
//Get data related to the search
$result = ListUnassigned::loadList($user[0]->USR_UID, $filters);
$this->assertCount(2, $result);
}
}

View File

@@ -0,0 +1,588 @@
<?php
namespace Tests\unit\workflow\src\ProcessMaker\Util\Helpers;
use stdClass;
use Tests\TestCase;
class GetDiffBetweenModifiedVariablesTest extends TestCase
{
/**
* Test to make sure a diff is an empty associative array when two input arrays have the same data
* @test
*/
public function it_should_return_an_empty_diff()
{
// Create two of the same associative arrays
$change = [
'a' => 'b',
];
$source = [
'a' => 'b',
];
$this->assertEquals([], getDiffBetweenModifiedVariables($change, $source));
}
/**
* Test to make sure a diff contains nothing if the source has additional properties but the change does not have them
* Reviewing: string
* @test
*/
public function it_should_return_empty_diff_with_source_having_extra_properties()
{
// Create two of the same associative arrays
$change = [
'a' => 'b',
];
$source = [
'a' => 'b',
'c' => 'd',
];
$this->assertEquals([], getDiffBetweenModifiedVariables($change, $source));
}
/**
* Test to make sure a diff contains an extra property if the change has it but source does not
* Reviewing: string
* @test
*/
public function it_should_return_simple_diff_with_change_having_extra_property()
{
// Create two of the same associative arrays
$change = [
'a' => 'b',
'c' => 'd',
];
$source = [
'a' => 'b',
];
$expected = [
'c' => 'd',
];
$this->assertEquals($expected, getDiffBetweenModifiedVariables($change, $source));
}
/**
* Test to make sure the diff includes a property that is in a nested deep array and object property
* @test
*/
public function it_should_return_diff_with_nested_difference()
{
$object1 = new stdClass();
$object1->h = 'i';
$object1->j = 'Goodbye';
$change = [
'a' => 'b',
'c' => [
'd' => 'e',
'f' => 'Goodbye',
],
'g' => $object1
];
$object2 = new stdClass();
$object2->h = 'i';
$object2->j = 'Hello';
$source = [
'a' => 'b',
'c' => [
'd' => 'e',
'f' => 'Hello',
],
'g' => $object2
];
$object1 = new stdClass();
$object1->h = 'i';
$object1->j = 'Goodbye';
$expected = [
'c' => [
'd' => 'e',
'f' => 'Goodbye',
],
'g' => $object1
];
$this->assertEquals($expected, getDiffBetweenModifiedVariables($change, $source));
}
/**
* Test to make sure the diff includes changes in a nested array
* @test
*/
public function it_should_return_a_diff_with_array_changes()
{
$change = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'field2' => 'BB']
]
];
$source = [
'var1' => 'A',
'var2' => 'B',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B']
]
];
$expected = [
'var2' => 'X',
'grid1' => [
// Note, the entire array will be updated
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'field2' => 'BB']
]
];
$this->assertEquals($expected, getDiffBetweenModifiedVariables($change, $source));
}
/**
* Ensure that the diff provided can be merged with source array to show added rows with proper indexes
* @test
*/
public function it_should_provide_diff_with_merge_that_supports_added_rows_to_array()
{
$change = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'field2' => 'BB']
]
];
$source = [
'var1' => 'A',
'var2' => 'B',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B']
]
];
// Now, let's make sure that when we array replace recursive, it properly has all rows and changes
$expected = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'field2' => 'BB']
]
];
$diff = getDiffBetweenModifiedVariables($change, $source);
$collection = collect($source);
$merged = $collection->merge($diff);
$merged = $merged->all();
$this->assertEquals($expected, $merged);
}
/**
* Test to make sure it provides a diff that can be used with replace_recursive to modify an array in place
* @test
*/
public function it_should_provide_diff_with_merge_that_supports_modifying_rows_in_array()
{
$change = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'field2' => 'CC'],
3 => ['field1' => 'AAA', 'field2' => 'BBB']
]
];
$source = [
'var1' => 'A',
'var2' => 'B',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'field2' => 'BB'],
3 => ['field1' => 'AAA', 'field2' => 'BBB']
]
];
// Now, let's make sure that when we array replace recursive, it properly has all rows and changes
$expected = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
// Note the changed record at 2
2 => ['field1' => 'AA', 'field2' => 'CC'],
3 => ['field1' => 'AAA', 'field2' => 'BBB']
]
];
$diff = getDiffBetweenModifiedVariables($change, $source);
$collection = collect($source);
$merged = $collection->merge($diff);
$merged = $merged->all();
$this->assertEquals($expected, $merged);
}
/**
* Ensure that the diff can be applied to source to REMOVE records from the array
* @note This will absolutely fail, because you can't apply the diff to remove something, it's not possible in this way
* @test
*/
public function it_should_provide_diff_with_merge_that_supports_removed_rows_from_array()
{
$change = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
]
];
$source = [
'var1' => 'A',
'var2' => 'B',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'field2' => 'BB']
]
];
// Now, let's make sure that when we array replace recursive, it properly has all rows and changes
$expected = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B']
]
];
$diff = getDiffBetweenModifiedVariables($change, $source);
$collection = collect($source);
$merged = $collection->merge($diff);
$merged = $merged->all();
$this->assertEquals($expected, $merged);
}
/**
* Utilize new behavior using laravel collections to map and filter to create the desired merged array
* @test
*/
public function it_should_utilize_laravel_collections_to_map_and_filter_for_desired_final_array()
{
$change = [
'var1' => 'A',
// Note the changed var 2
'var2' => 'X',
// Note the missing var3 element
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
// Note the missing record at index 2
]
];
$source = [
'var1' => 'A',
'var2' => 'B',
'var3' => 'C',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'field2' => 'BB']
]
];
// Now, let's make sure that when we array replace recursive, it properly has all rows and changes
$expected = [
'var1' => 'A',
'var2' => 'X',
// Note we don't have var3
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B']
// And we should not have index 2
]
];
$diff = getDiffBetweenModifiedVariables($change, $source);
$merged = array_replace_recursive($source, $diff);
// Now collect and map
$final = collect($merged)->filter(function ($value, $key) use ($change) {
// Only accept properties that exist in the change
return array_key_exists($key, $change);
})->map(function ($item, $key) use ($change) {
// We aren't recursively calling, but that's not needed for our situation, so we'll
// Check if it's an array, if so, create a collection, filter, then return the array
if (is_array($item)) {
return collect($item)->filter(function ($value, $subkey) use ($change, $key) {
return array_key_exists($subkey, $change[$key]);
})->all();
}
// Otherwise, just return item
return $item;
})->all();
$this->assertEquals($expected, $final);
}
/**
* Test to make sure the diff includes changes in a nested array
* @test
*/
public function it_should_return_a_diff_with_object_changes()
{
$person1 = new stdClass();
$person1->firstName = 'Corine';
$person1->lastName = 'Martell';
$change = [
'var1' => 'A',
'var2' => 'X',
'varPerson' => $person1
];
$person2 = new stdClass();
$person2->firstName = 'Corine';
$person2->lastName = 'Erler';
$source = [
'var1' => 'A',
'var2' => 'B',
'varPerson' => $person2
];
$person1 = new stdClass();
$person1->firstName = 'Corine';
$person1->lastName = 'Martell';
$expected = [
'var2' => 'X',
'varPerson' => $person1
];
$this->assertEquals($expected, getDiffBetweenModifiedVariables($change, $source));
}
/**
* Ensure that the diff provided can be merged with source object to show added rows with proper indexes
* @test
*/
public function it_should_provide_diff_with_merge_that_supports_added_rows_to_object()
{
$person1 = new stdClass();
$person1->firstName = 'Corine';
$person1->lastName = 'Martell';
$person1->address = '2789 Parkview Drive';
$change = [
'var1' => 'A',
'var2' => 'X',
'varPerson' => $person1
];
$person2 = new stdClass();
$person2->firstName = 'Corine';
$person2->lastName = 'Erler';
$source = [
'var1' => 'A',
'var2' => 'B',
'varPerson' => $person2
];
// Now, let's make sure that when we array replace recursive, it properly has all rows and changes
$person1 = new stdClass();
$person1->firstName = 'Corine';
$person1->lastName = 'Martell';
$person1->address = '2789 Parkview Drive';
$expected = [
'var1' => 'A',
'var2' => 'X',
'varPerson' => $person1
];
$diff = getDiffBetweenModifiedVariables($change, $source);
$collection = collect($source);
$merged = $collection->merge($diff);
$merged = $merged->all();
$this->assertEquals($expected, $merged);
}
/**
* Test to make sure it provides a diff that can be used with replace_recursive to modify an object in place
* @test
*/
public function it_should_provide_diff_with_merge_that_supports_modifying_rows_in_object()
{
$person1 = new stdClass();
$person1->firstName = 'Corine';
$person1->lastName = 'Martell';
$person1->address = '2789 Parkview Drive';
$change = [
'var1' => 'A',
'var2' => 'X',
'varPerson' => $person1
];
$person2 = new stdClass();
$person2->firstName = 'Corine';
$person2->lastName = 'Martell';
$person2->address = '2789 Parkview Drive';
$source = [
'var1' => 'A',
'var2' => 'B',
'varPerson' => $person2
];
// Now, let's make sure that when we array replace recursive, it properly has all rows and changes
$person1 = new stdClass();
$person1->firstName = 'Corine';
$person1->lastName = 'Martell';
$person1->address = '2789 Parkview Drive';
$expected = [
'var1' => 'A',
'var2' => 'X',
'varPerson' => $person1
];
$diff = getDiffBetweenModifiedVariables($change, $source);
$collection = collect($source);
$merged = $collection->merge($diff);
$merged = $merged->all();
$this->assertEquals($expected, $merged);
}
/**
* Ensure that the diff can be applied to source to REMOVE records from the object
* @test
*/
public function it_should_provide_diff_with_merge_that_supports_removed_rows_from_object()
{
$person1 = new stdClass();
$person1->lastName = 'Gail';
$person1->address = '3607 Sycamore Road';
$change = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'varPerson' => $person1],
3 => ['field1' => 'AAA', 'field2' => 'BBB']
],
'varPerson' => $person1
];
$person2 = new stdClass();
$person2->firstName = 'Corine';
$person2->lastName = 'Martell';
$person2->address = '2789 Parkview Drive';
$source = [
'var1' => 'A',
'var2' => 'B',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'varPerson' => $person2],
3 => ['field1' => 'AAA', 'field2' => 'BBB']
],
'varPerson' => $person2
];
// Now, let's make sure that when we has object variable we need to replace with the last change over the object
$person1 = new stdClass();
$person1->lastName = 'Gail';
$person1->address = '3607 Sycamore Road';
$expected = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'varPerson' => $person1],
3 => ['field1' => 'AAA', 'field2' => 'BBB']
],
'varPerson' => $person1
];
$diff = getDiffBetweenModifiedVariables($change, $source);
$collection = collect($source);
$merged = $collection->merge($diff);
$merged = $merged->all();
$this->assertEquals($expected, $merged);
}
/**
* Ensure that the diff can be applied to source to REMOVE records from the object
* @test
*/
public function it_should_provide_diff_with_merge_in_the_same_object()
{
$person2 = new stdClass();
$person2->firstName = 'Corine';
$person2->lastName = 'Martell';
$person2->address = '2789 Parkview Drive';
$source = [
'var1' => 'A',
'var2' => 'B',
'varPerson' => $person2
];
$person2->lastName = 'Gail';
$person2->email = 'corine.gail@email.com';
$change = [
'var1' => 'A',
'var2' => 'X',
'varPerson' => $person2
];
// Now, let's make sure that when we has object variable we need to replace with the last change over the object
$person1 = new stdClass();
$person1->firstName = 'Corine';
$person1->lastName = 'Martell';
$person1->address = '2789 Parkview Drive';
$person1->lastName = 'Gail';
$person1->email = 'corine.gail@email.com';
$expected = [
'var1' => 'A',
'var2' => 'X',
'varPerson' => $person1
];
$diff = getDiffBetweenModifiedVariables($change, $source);
$collection = collect($source);
$merged = $collection->merge($diff);
$merged = $merged->all();
$this->assertEquals($expected, $merged);
}
/**
* Ensure that the diff can be applied to source to REMOVE records from nested object
* @test
*/
public function it_should_provide_diff_with_merge_that_supports_rows_from_nested_object()
{
$person1 = new stdClass();
$person1->firstName = 'Gail';
$person1->lastName = 'Martell';
$person1->address = '3607 Sycamore Road';
$email1 = new stdClass();
$email1->personal = 'gail@personal.com';
$email1->coorporative = 'gail@coorporative.com';
$person1->email = $email1;
$change = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'varPerson' => $person1],
3 => ['field1' => 'AAA', 'field2' => 'BBB']
],
'varPerson' => $person1
];
$person2 = new stdClass();
$person2->firstName = 'Corine';
$person2->lastName = 'Martell';
$email2 = new stdClass();
$email2->new = 'GailJMartell@email.com';
$person2->email = $email2;
$source = [
'var1' => 'A',
'var2' => 'B',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'varPerson' => $person2],
3 => ['field1' => 'AAA', 'field2' => 'BBB']
],
'varPerson' => $person2
];
// Now, let's make sure that when we has object variable we need to replace with the last change over the object
$person1 = new stdClass();
$person1->firstName = 'Gail';
$person1->lastName = 'Martell';
$person1->address = '3607 Sycamore Road';
$email1 = new stdClass();
$email1->personal = 'gail@personal.com';
$email1->coorporative = 'gail@coorporative.com';
$person1->email = $email1;
$expected = [
'var1' => 'A',
'var2' => 'X',
'grid1' => [
1 => ['field1' => 'A', 'field2' => 'B'],
2 => ['field1' => 'AA', 'varPerson' => $person1],
3 => ['field1' => 'AAA', 'field2' => 'BBB']
],
'varPerson' => $person1
];
$diff = getDiffBetweenModifiedVariables($change, $source);
$collection = collect($source);
$merged = $collection->merge($diff);
$merged = $merged->all();
$this->assertEquals($expected, $merged);
}
}

View File

@@ -83,7 +83,8 @@ class MSSQLConnection extends ConnectionCommon implements Connection
$opt = [
'UID' => $user,
'PWD' => $pw,
'Database' => $dsninfo['database']
'Database' => $dsninfo['database'],
'CharacterSet' => 'UTF-8'
];
// SQLSrv is persistent always
$conn = sqlsrv_connect($dbhost, $opt);

File diff suppressed because it is too large Load Diff

View File

@@ -1,418 +0,0 @@
<?php
/*~ class.pop3.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
| Version: 5.2.4 |
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
| ------------------------------------------------------------------------- |
| Admin: Jim Jagielski (project admininistrator) |
| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
| : Jim Jagielski (jimjag) jimjag@gmail.com |
| Founder: Brent R. Matzelle (original founder) |
| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. |
| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
| Copyright (c) 2001-2003, Brent R. Matzelle |
| ------------------------------------------------------------------------- |
| License: Distributed under the Lesser General Public License (LGPL) |
| http://www.gnu.org/copyleft/lesser.html |
| This program is distributed in the hope that it will be useful - WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. |
'---------------------------------------------------------------------------'
*/
/**
* PHPMailer - PHP POP Before SMTP Authentication Class
* NOTE: Designed for use with PHP version 5 and up
* @package PHPMailer
* @author Andy Prevost
* @author Marcus Bointon
* @author Jim Jagielski
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
*/
/**
* PHP POP-Before-SMTP Authentication Class
*
* Version 5.2.4
*
* @license: LGPL, see PHPMailer License
*
* Specifically for PHPMailer to allow POP before SMTP authentication.
* Does not yet work with APOP - if you have an APOP account, contact Jim Jagielski
* and we can test changes to this script.
*
* This class is based on the structure of the SMTP class originally authored by Chris Ryan
*
* This class is rfc 1939 compliant and implements all the commands
* required for POP3 connection, authentication and disconnection.
*
* @package PHPMailer
* @author Richard Davey (orig) <rich@corephp.co.uk>
* @author Andy Prevost
* @author Jim Jagielski
*/
class POP3 {
/**
* Default POP3 port
* @var int
*/
public $POP3_PORT = 110;
/**
* Default Timeout
* @var int
*/
public $POP3_TIMEOUT = 30;
/**
* POP3 Carriage Return + Line Feed
* @var string
*/
public $CRLF = "\r\n";
/**
* Displaying Debug warnings? (0 = now, 1+ = yes)
* @var int
*/
public $do_debug = 2;
/**
* POP3 Mail Server
* @var string
*/
public $host;
/**
* POP3 Port
* @var int
*/
public $port;
/**
* POP3 Timeout Value
* @var int
*/
public $tval;
/**
* POP3 Username
* @var string
*/
public $username;
/**
* POP3 Password
* @var string
*/
public $password;
/**
* Sets the POP3 PHPMailer Version number
* @var string
*/
public $Version = '5.2.4';
/////////////////////////////////////////////////
// PROPERTIES, PRIVATE AND PROTECTED
/////////////////////////////////////////////////
/**
* @var resource Resource handle for the POP connection socket
*/
private $pop_conn;
/**
* @var boolean Are we connected?
*/
private $connected;
/**
* @var array Error container
*/
private $error; // Error log array
/**
* Constructor, sets the initial values
* @access public
* @return POP3
*/
public function __construct() {
$this->pop_conn = 0;
$this->connected = false;
$this->error = null;
}
/**
* Combination of public events - connect, login, disconnect
* @access public
* @param string $host
* @param bool|int $port
* @param bool|int $tval
* @param string $username
* @param string $password
* @param int $debug_level
* @return bool
*/
public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
$this->host = $host;
// If no port value is passed, retrieve it
if ($port == false) {
$this->port = $this->POP3_PORT;
} else {
$this->port = $port;
}
// If no port value is passed, retrieve it
if ($tval == false) {
$this->tval = $this->POP3_TIMEOUT;
} else {
$this->tval = $tval;
}
$this->do_debug = $debug_level;
$this->username = $username;
$this->password = $password;
// Refresh the error log
$this->error = null;
// Connect
$result = $this->Connect($this->host, $this->port, $this->tval);
if ($result) {
$login_result = $this->Login($this->username, $this->password);
if ($login_result) {
$this->Disconnect();
return true;
}
}
// We need to disconnect regardless if the login succeeded
$this->Disconnect();
return false;
}
/**
* Connect to the POP3 server
* @access public
* @param string $host
* @param bool|int $port
* @param integer $tval
* @return boolean
*/
public function Connect ($host, $port = false, $tval = 30) {
// Are we already connected?
if ($this->connected) {
return true;
}
/*
On Windows this will raise a PHP Warning error if the hostname doesn't exist.
Rather than supress it with @fsockopen, let's capture it cleanly instead
*/
set_error_handler(array(&$this, 'catchWarning'));
// Connect to the POP3 server
$this->pop_conn = fsockopen($host, // POP3 Host
$port, // Port #
$errno, // Error Number
$errstr, // Error Message
$tval); // Timeout (seconds)
// Restore the error handler
restore_error_handler();
// Does the Error Log now contain anything?
if ($this->error && $this->do_debug >= 1) {
$this->displayErrors();
}
// Did we connect?
if ($this->pop_conn == false) {
// It would appear not...
$this->error = array(
'error' => "Failed to connect to server $host on port $port",
'errno' => $errno,
'errstr' => $errstr
);
if ($this->do_debug >= 1) {
$this->displayErrors();
}
return false;
}
// Increase the stream time-out
// Check for PHP 4.3.0 or later
if (version_compare(phpversion(), '5.0.0', 'ge')) {
stream_set_timeout($this->pop_conn, $tval, 0);
} else {
// Does not work on Windows
if (substr(PHP_OS, 0, 3) !== 'WIN') {
socket_set_timeout($this->pop_conn, $tval, 0);
}
}
// Get the POP3 server response
$pop3_response = $this->getResponse();
// Check for the +OK
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
return true;
}
return false;
}
/**
* Login to the POP3 server (does not support APOP yet)
* @access public
* @param string $username
* @param string $password
* @return boolean
*/
public function Login ($username = '', $password = '') {
if ($this->connected == false) {
$this->error = 'Not connected to POP3 server';
if ($this->do_debug >= 1) {
$this->displayErrors();
}
}
if (empty($username)) {
$username = $this->username;
}
if (empty($password)) {
$password = $this->password;
}
$pop_username = "USER $username" . $this->CRLF;
$pop_password = "PASS $password" . $this->CRLF;
// Send the Username
$this->sendString($pop_username);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
// Send the Password
$this->sendString($pop_password);
$pop3_response = $this->getResponse();
if ($this->checkResponse($pop3_response)) {
return true;
}
}
return false;
}
/**
* Disconnect from the POP3 server
* @access public
*/
public function Disconnect () {
$this->sendString('QUIT');
fclose($this->pop_conn);
}
/////////////////////////////////////////////////
// Private Methods
/////////////////////////////////////////////////
/**
* Get the socket response back.
* $size is the maximum number of bytes to retrieve
* @access private
* @param integer $size
* @return string
*/
private function getResponse ($size = 128) {
$pop3_response = fgets($this->pop_conn, $size);
return $pop3_response;
}
/**
* Send a string down the open socket connection to the POP3 server
* @access private
* @param string $string
* @return integer
*/
private function sendString ($string) {
$bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
return $bytes_sent;
}
/**
* Checks the POP3 server response for +OK or -ERR
* @access private
* @param string $string
* @return boolean
*/
private function checkResponse ($string) {
if (substr($string, 0, 3) !== '+OK') {
$this->error = array(
'error' => "Server reported an error: $string",
'errno' => 0,
'errstr' => ''
);
if ($this->do_debug >= 1) {
$this->displayErrors();
}
return false;
} else {
return true;
}
}
/**
* If debug is enabled, display the error message array
* @access private
*/
private function displayErrors () {
echo '<pre>';
foreach ($this->error as $single_error) {
print_r($single_error);
}
echo '</pre>';
}
/**
* Takes over from PHP for the socket warning handler
* @access private
* @param integer $errno
* @param string $errstr
* @param string $errfile
* @param integer $errline
*/
private function catchWarning ($errno, $errstr, $errfile, $errline) {
$this->error[] = array(
'error' => "Connecting to the POP3 server raised a PHP warning: ",
'errno' => $errno,
'errstr' => $errstr
);
}
// End of class
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,489 +0,0 @@
<?php
/*************************************************************************
* *
* class.html2text.inc *
* *
*************************************************************************
* *
* Converts HTML to formatted plain text *
* *
* Copyright (c) 2005-2007 Jon Abernathy <jon@chuggnutt.com> *
* All rights reserved. *
* *
* This script is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* The GNU General Public License can be found at *
* http://www.gnu.org/copyleft/gpl.html. *
* *
* This script 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 General Public License for more details. *
* *
* Author(s): Jon Abernathy <jon@chuggnutt.com> *
* *
* Last modified: 08/08/07 *
* *
*************************************************************************/
/**
* Takes HTML and converts it to formatted, plain text.
*
* Thanks to Alexander Krug (http://www.krugar.de/) to pointing out and
* correcting an error in the regexp search array. Fixed 7/30/03.
*
* Updated set_html() function's file reading mechanism, 9/25/03.
*
* Thanks to Joss Sanglier (http://www.dancingbear.co.uk/) for adding
* several more HTML entity codes to the $search and $replace arrays.
* Updated 11/7/03.
*
* Thanks to Darius Kasperavicius (http://www.dar.dar.lt/) for
* suggesting the addition of $allowed_tags and its supporting function
* (which I slightly modified). Updated 3/12/04.
*
* Thanks to Justin Dearing for pointing out that a replacement for the
* <TH> tag was missing, and suggesting an appropriate fix.
* Updated 8/25/04.
*
* Thanks to Mathieu Collas (http://www.myefarm.com/) for finding a
* display/formatting bug in the _build_link_list() function: email
* readers would show the left bracket and number ("[1") as part of the
* rendered email address.
* Updated 12/16/04.
*
* Thanks to Wojciech Bajon (http://histeria.pl/) for submitting code
* to handle relative links, which I hadn't considered. I modified his
* code a bit to handle normal HTTP links and MAILTO links. Also for
* suggesting three additional HTML entity codes to search for.
* Updated 03/02/05.
*
* Thanks to Jacob Chandler for pointing out another link condition
* for the _build_link_list() function: "https".
* Updated 04/06/05.
*
* Thanks to Marc Bertrand (http://www.dresdensky.com/) for
* suggesting a revision to the word wrapping functionality; if you
* specify a $width of 0 or less, word wrapping will be ignored.
* Updated 11/02/06.
*
* *** Big housecleaning updates below:
*
* Thanks to Colin Brown (http://www.sparkdriver.co.uk/) for
* suggesting the fix to handle </li> and blank lines (whitespace).
* Christian Basedau (http://www.movetheweb.de/) also suggested the
* blank lines fix.
*
* Special thanks to Marcus Bointon (http://www.synchromedia.co.uk/),
* Christian Basedau, Norbert Laposa (http://ln5.co.uk/),
* Bas van de Weijer, and Marijn van Butselaar
* for pointing out my glaring error in the <th> handling. Marcus also
* supplied a host of fixes.
*
* Thanks to Jeffrey Silverman (http://www.newtnotes.com/) for pointing
* out that extra spaces should be compressed--a problem addressed with
* Marcus Bointon's fixes but that I had not yet incorporated.
*
* Thanks to Daniel Schledermann (http://www.typoconsult.dk/) for
* suggesting a valuable fix with <a> tag handling.
*
* Thanks to Wojciech Bajon (again!) for suggesting fixes and additions,
* including the <a> tag handling that Daniel Schledermann pointed
* out but that I had not yet incorporated. I haven't (yet)
* incorporated all of Wojciech's changes, though I may at some
* future time.
*
* *** End of the housecleaning updates. Updated 08/08/07.
*
* @author Jon Abernathy <jon@chuggnutt.com>
* @version 1.0.0
* @since PHP 4.0.2
*/
class html2text
{
/**
* Contains the HTML content to convert.
*
* @var string $html
* @access public
*/
var $html;
/**
* Contains the converted, formatted text.
*
* @var string $text
* @access public
*/
var $text;
/**
* Maximum width of the formatted text, in columns.
*
* Set this value to 0 (or less) to ignore word wrapping
* and not constrain text to a fixed-width column.
*
* @var integer $width
* @access public
*/
var $width = 70;
/**
* List of preg* regular expression patterns to search for,
* used in conjunction with $replace.
*
* @var array $search
* @access public
* @see $replace
*/
var $search = array(
"/\r/", // Non-legal carriage return
"/[\n\t]+/", // Newlines and tabs
'/[ ]{2,}/', // Runs of spaces, pre-handling
'/<script[^>]*>.*?<\/script>/i', // <script>s -- which strip_tags supposedly has problems with
'/<style[^>]*>.*?<\/style>/i', // <style>s -- which strip_tags supposedly has problems with
//'/<!-- .* -->/', // Comments -- which strip_tags might have problem a with
'/<h[123][^>]*>(.*?)<\/h[123]>/ie', // H1 - H3
'/<h[456][^>]*>(.*?)<\/h[456]>/ie', // H4 - H6
'/<p[^>]*>/i', // <P>
'/<br[^>]*>/i', // <br>
'/<b[^>]*>(.*?)<\/b>/ie', // <b>
'/<strong[^>]*>(.*?)<\/strong>/ie', // <strong>
'/<i[^>]*>(.*?)<\/i>/i', // <i>
'/<em[^>]*>(.*?)<\/em>/i', // <em>
'/(<ul[^>]*>|<\/ul>)/i', // <ul> and </ul>
'/(<ol[^>]*>|<\/ol>)/i', // <ol> and </ol>
'/<li[^>]*>(.*?)<\/li>/i', // <li> and </li>
'/<li[^>]*>/i', // <li>
'/<a [^>]*href="([^"]+)"[^>]*>(.*?)<\/a>/ie',
// <a href="">
'/<hr[^>]*>/i', // <hr>
'/(<table[^>]*>|<\/table>)/i', // <table> and </table>
'/(<tr[^>]*>|<\/tr>)/i', // <tr> and </tr>
'/<td[^>]*>(.*?)<\/td>/i', // <td> and </td>
'/<th[^>]*>(.*?)<\/th>/ie', // <th> and </th>
'/&(nbsp|#160);/i', // Non-breaking space
'/&(quot|rdquo|ldquo|#8220|#8221|#147|#148);/i',
// Double quotes
'/&(apos|rsquo|lsquo|#8216|#8217);/i', // Single quotes
'/&gt;/i', // Greater-than
'/&lt;/i', // Less-than
'/&(amp|#38);/i', // Ampersand
'/&(copy|#169);/i', // Copyright
'/&(trade|#8482|#153);/i', // Trademark
'/&(reg|#174);/i', // Registered
'/&(mdash|#151|#8212);/i', // mdash
'/&(ndash|minus|#8211|#8722);/i', // ndash
'/&(bull|#149|#8226);/i', // Bullet
'/&(pound|#163);/i', // Pound sign
'/&(euro|#8364);/i', // Euro sign
'/&[^&;]+;/i', // Unknown/unhandled entities
'/[ ]{2,}/' // Runs of spaces, post-handling
);
/**
* List of pattern replacements corresponding to patterns searched.
*
* @var array $replace
* @access public
* @see $search
*/
var $replace = array(
'', // Non-legal carriage return
' ', // Newlines and tabs
' ', // Runs of spaces, pre-handling
'', // <script>s -- which strip_tags supposedly has problems with
'', // <style>s -- which strip_tags supposedly has problems with
//'', // Comments -- which strip_tags might have problem a with
"strtoupper(\"\n\n\\1\n\n\")", // H1 - H3
"ucwords(\"\n\n\\1\n\n\")", // H4 - H6
"\n\n\t", // <P>
"\n", // <br>
'strtoupper("\\1")', // <b>
'strtoupper("\\1")', // <strong>
'_\\1_', // <i>
'_\\1_', // <em>
"\n\n", // <ul> and </ul>
"\n\n", // <ol> and </ol>
"\t* \\1\n", // <li> and </li>
"\n\t* ", // <li>
'$this->_build_link_list("\\1", "\\2")',
// <a href="">
"\n-------------------------\n", // <hr>
"\n\n", // <table> and </table>
"\n", // <tr> and </tr>
"\t\t\\1\n", // <td> and </td>
"strtoupper(\"\t\t\\1\n\")", // <th> and </th>
' ', // Non-breaking space
'"', // Double quotes
"'", // Single quotes
'>',
'<',
'&',
'(c)',
'(tm)',
'(R)',
'--',
'-',
'*',
'<27>',
'EUR', // Euro sign. <20> ?
'', // Unknown/unhandled entities
' ' // Runs of spaces, post-handling
);
/**
* Contains a list of HTML tags to allow in the resulting text.
*
* @var string $allowed_tags
* @access public
* @see set_allowed_tags()
*/
var $allowed_tags = '';
/**
* Contains the base URL that relative links should resolve to.
*
* @var string $url
* @access public
*/
var $url;
/**
* Indicates whether content in the $html variable has been converted yet.
*
* @var boolean $_converted
* @access private
* @see $html, $text
*/
var $_converted = false;
/**
* Contains URL addresses from links to be rendered in plain text.
*
* @var string $_link_list
* @access private
* @see _build_link_list()
*/
var $_link_list = '';
/**
* Number of valid links detected in the text, used for plain text
* display (rendered similar to footnotes).
*
* @var integer $_link_count
* @access private
* @see _build_link_list()
*/
var $_link_count = 0;
/**
* Constructor.
*
* If the HTML source string (or file) is supplied, the class
* will instantiate with that source propagated, all that has
* to be done it to call get_text().
*
* @param string $source HTML content
* @param boolean $from_file Indicates $source is a file to pull content from
* @access public
* @return void
*/
function html2text( $source = '', $from_file = false )
{
if ( !empty($source) ) {
$this->set_html($source, $from_file);
}
$this->set_base_url();
}
/**
* Loads source HTML into memory, either from $source string or a file.
*
* @param string $source HTML content
* @param boolean $from_file Indicates $source is a file to pull content from
* @access public
* @return void
*/
function set_html( $source, $from_file = false )
{
$this->html = $source;
if ( $from_file && file_exists($source) ) {
$fp = fopen($source, 'r');
$this->html = fread($fp, filesize($source));
fclose($fp);
}
$this->_converted = false;
}
/**
* Returns the text, converted from HTML.
*
* @access public
* @return string
*/
function get_text()
{
if ( !$this->_converted ) {
$this->_convert();
}
return $this->text;
}
/**
* Prints the text, converted from HTML.
*
* @access public
* @return void
*/
function print_text()
{
print $this->get_text();
}
/**
* Alias to print_text(), operates identically.
*
* @access public
* @return void
* @see print_text()
*/
function p()
{
print $this->get_text();
}
/**
* Sets the allowed HTML tags to pass through to the resulting text.
*
* Tags should be in the form "<p>", with no corresponding closing tag.
*
* @access public
* @return void
*/
function set_allowed_tags( $allowed_tags = '' )
{
if ( !empty($allowed_tags) ) {
$this->allowed_tags = $allowed_tags;
}
}
/**
* Sets a base URL to handle relative links.
*
* @access public
* @return void
*/
function set_base_url( $url = '' )
{
if ( empty($url) ) {
if ( !empty($_SERVER['HTTP_HOST']) ) {
$this->url = 'http://' . $_SERVER['HTTP_HOST'];
} else {
$this->url = '';
}
} else {
// Strip any trailing slashes for consistency (relative
// URLs may already start with a slash like "/file.html")
if ( substr($url, -1) == '/' ) {
$url = substr($url, 0, -1);
}
$this->url = $url;
}
}
/**
* Workhorse function that does actual conversion.
*
* First performs custom tag replacement specified by $search and
* $replace arrays. Then strips any remaining HTML tags, reduces whitespace
* and newlines to a readable format, and word wraps the text to
* $width characters.
*
* @access private
* @return void
*/
function _convert()
{
// Variables used for building the link list
$this->_link_count = 0;
$this->_link_list = '';
$text = trim(stripslashes($this->html));
// Run our defined search-and-replace
$text = preg_replace($this->search, $this->replace, $text);
// Strip any other HTML tags
$text = strip_tags($text, $this->allowed_tags);
// Bring down number of empty lines to 2 max
$text = preg_replace("/\n\s+\n/", "\n\n", $text);
$text = preg_replace("/[\n]{3,}/", "\n\n", $text);
// Add link list
if ( !empty($this->_link_list) ) {
$text .= "\n\nLinks:\n------\n" . $this->_link_list;
}
// Wrap the text to a readable format
// for PHP versions >= 4.0.2. Default width is 75
// If width is 0 or less, don't wrap the text.
if ( $this->width > 0 ) {
$text = wordwrap($text, $this->width);
}
$this->text = $text;
$this->_converted = true;
}
/**
* Helper function called by preg_replace() on link replacement.
*
* Maintains an internal list of links to be displayed at the end of the
* text, with numeric indices to the original point in the text they
* appeared. Also makes an effort at identifying and handling absolute
* and relative links.
*
* @param string $link URL of the link
* @param string $display Part of the text to associate number with
* @access private
* @return string
*/
function _build_link_list( $link, $display )
{
if ( substr($link, 0, 7) == 'http://' || substr($link, 0, 8) == 'https://' ||
substr($link, 0, 7) == 'mailto:' ) {
$this->_link_count++;
$this->_link_list .= "[" . $this->_link_count . "] $link\n";
$additional = ' [' . $this->_link_count . ']';
} elseif ( substr($link, 0, 11) == 'javascript:' ) {
// Don't count the link; ignore it
$additional = '';
// what about href="#anchor" ?
} else {
$this->_link_count++;
$this->_link_list .= "[" . $this->_link_count . "] " . $this->url;
if ( substr($link, 0, 1) != '/' ) {
$this->_link_list .= '/';
}
$this->_link_list .= "$link\n";
$additional = ' [' . $this->_link_count . ']';
}
return $display . $additional;
}
}
?>

View File

@@ -1,861 +0,0 @@
<?php
/**
* htmlfilter.inc
* ---------------
* This set of functions allows you to filter html in order to remove
* any malicious tags from it. Useful in cases when you need to filter
* user input for any cross-site-scripting attempts.
*
* Copyright (C) 2002-2004 by Duke University
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* @Author Konstantin Riabitsev <icon@linux.duke.edu>
* @Version 1.1 ($Date: 2011-07-04 14:02:23 -0400 (Mon, 04 Jul 2011) $)
*/
/**
* @Author Jim Jagielski <jim@jaguNET.com / jimjag@gmail.com>
*/
/**
* This function returns the final tag out of the tag name, an array
* of attributes, and the type of the tag. This function is called by
* tln_sanitize internally.
*
* @param $tagname the name of the tag.
* @param $attary the array of attributes and their values
* @param $tagtype The type of the tag (see in comments).
* @return a string with the final tag representation.
*/
function tln_tagprint($tagname, $attary, $tagtype){
$me = 'tln_tagprint';
if ($tagtype == 2){
$fulltag = '</' . $tagname . '>';
} else {
$fulltag = '<' . $tagname;
if (is_array($attary) && sizeof($attary)){
$atts = Array();
while (list($attname, $attvalue) = each($attary)){
array_push($atts, "$attname=$attvalue");
}
$fulltag .= ' ' . join(' ', $atts);
}
if ($tagtype == 3){
$fulltag .= ' /';
}
$fulltag .= '>';
}
return $fulltag;
}
/**
* A small helper function to use with array_walk. Modifies a by-ref
* value and makes it lowercase.
*
* @param $val a value passed by-ref.
* @return void since it modifies a by-ref value.
*/
function tln_casenormalize(&$val){
$val = strtolower($val);
}
/**
* This function skips any whitespace from the current position within
* a string and to the next non-whitespace value.
*
* @param $body the string
* @param $offset the offset within the string where we should start
* looking for the next non-whitespace character.
* @return the location within the $body where the next
* non-whitespace char is located.
*/
function tln_skipspace($body, $offset){
$me = 'tln_skipspace';
preg_match('/^(\s*)/s', substr($body, $offset), $matches);
if (sizeof($matches[1])){
$count = strlen($matches[1]);
$offset += $count;
}
return $offset;
}
/**
* This function looks for the next character within a string. It's
* really just a glorified "strpos", except it catches the failures
* nicely.
*
* @param $body The string to look for needle in.
* @param $offset Start looking from this position.
* @param $needle The character/string to look for.
* @return location of the next occurance of the needle, or
* strlen($body) if needle wasn't found.
*/
function tln_findnxstr($body, $offset, $needle){
$me = 'tln_findnxstr';
$pos = strpos($body, $needle, $offset);
if ($pos === FALSE){
$pos = strlen($body);
}
return $pos;
}
/**
* This function takes a PCRE-style regexp and tries to match it
* within the string.
*
* @param $body The string to look for needle in.
* @param $offset Start looking from here.
* @param $reg A PCRE-style regex to match.
* @return Returns a false if no matches found, or an array
* with the following members:
* - integer with the location of the match within $body
* - string with whatever content between offset and the match
* - string with whatever it is we matched
*/
function tln_findnxreg($body, $offset, $reg){
$me = 'tln_findnxreg';
$matches = Array();
$retarr = Array();
$preg_rule = '%^(.*?)(' . $reg . ')%s';
preg_match($preg_rule, substr($body, $offset), $matches);
if (!isset($matches[0])){
$retarr = false;
} else {
$retarr[0] = $offset + strlen($matches[1]);
$retarr[1] = $matches[1];
$retarr[2] = $matches[2];
}
return $retarr;
}
/**
* This function looks for the next tag.
*
* @param $body String where to look for the next tag.
* @param $offset Start looking from here.
* @return false if no more tags exist in the body, or
* an array with the following members:
* - string with the name of the tag
* - array with attributes and their values
* - integer with tag type (1, 2, or 3)
* - integer where the tag starts (starting "<")
* - integer where the tag ends (ending ">")
* first three members will be false, if the tag is invalid.
*/
function tln_getnxtag($body, $offset){
$me = 'tln_getnxtag';
if ($offset > strlen($body)){
return false;
}
$lt = tln_findnxstr($body, $offset, '<');
if ($lt == strlen($body)){
return false;
}
/**
* We are here:
* blah blah <tag attribute="value">
* \---------^
*/
$pos = tln_skipspace($body, $lt + 1);
if ($pos >= strlen($body)){
return Array(false, false, false, $lt, strlen($body));
}
/**
* There are 3 kinds of tags:
* 1. Opening tag, e.g.:
* <a href="blah">
* 2. Closing tag, e.g.:
* </a>
* 3. XHTML-style content-less tag, e.g.:
* <img src="blah"/>
*/
$tagtype = false;
switch (substr($body, $pos, 1)){
case '/':
$tagtype = 2;
$pos++;
break;
case '!':
/**
* A comment or an SGML declaration.
*/
if (substr($body, $pos+1, 2) == '--'){
$gt = strpos($body, '-->', $pos);
if ($gt === false){
$gt = strlen($body);
} else {
$gt += 2;
}
return Array(false, false, false, $lt, $gt);
} else {
$gt = tln_findnxstr($body, $pos, '>');
return Array(false, false, false, $lt, $gt);
}
break;
default:
/**
* Assume tagtype 1 for now. If it's type 3, we'll switch values
* later.
*/
$tagtype = 1;
break;
}
$tag_start = $pos;
$tagname = '';
/**
* Look for next [\W-_], which will indicate the end of the tag name.
*/
$regary = tln_findnxreg($body, $pos, '[^\w\-_]');
if ($regary == false){
return Array(false, false, false, $lt, strlen($body));
}
list($pos, $tagname, $match) = $regary;
$tagname = strtolower($tagname);
/**
* $match can be either of these:
* '>' indicating the end of the tag entirely.
* '\s' indicating the end of the tag name.
* '/' indicating that this is type-3 xhtml tag.
*
* Whatever else we find there indicates an invalid tag.
*/
switch ($match){
case '/':
/**
* This is an xhtml-style tag with a closing / at the
* end, like so: <img src="blah"/>. Check if it's followed
* by the closing bracket. If not, then this tag is invalid
*/
if (substr($body, $pos, 2) == '/>'){
$pos++;
$tagtype = 3;
} else {
$gt = tln_findnxstr($body, $pos, '>');
$retary = Array(false, false, false, $lt, $gt);
return $retary;
}
case '>':
return Array($tagname, false, $tagtype, $lt, $pos);
break;
default:
/**
* Check if it's whitespace
*/
if (preg_match('/\s/', $match)){
} else {
/**
* This is an invalid tag! Look for the next closing ">".
*/
$gt = tln_findnxstr($body, $lt, '>');
return Array(false, false, false, $lt, $gt);
}
}
/**
* At this point we're here:
* <tagname attribute='blah'>
* \-------^
*
* At this point we loop in order to find all attributes.
*/
$attname = '';
$atttype = false;
$attary = Array();
while ($pos <= strlen($body)){
$pos = tln_skipspace($body, $pos);
if ($pos == strlen($body)){
/**
* Non-closed tag.
*/
return Array(false, false, false, $lt, $pos);
}
/**
* See if we arrived at a ">" or "/>", which means that we reached
* the end of the tag.
*/
$matches = Array();
preg_match('%^(\s*)(>|/>)%s', substr($body, $pos), $matches);
if (isset($matches[0]) && $matches[0]){
/**
* Yep. So we did.
*/
$pos += strlen($matches[1]);
if ($matches[2] == '/>'){
$tagtype = 3;
$pos++;
}
return Array($tagname, $attary, $tagtype, $lt, $pos);
}
/**
* There are several types of attributes, with optional
* [:space:] between members.
* Type 1:
* attrname[:space:]=[:space:]'CDATA'
* Type 2:
* attrname[:space:]=[:space:]"CDATA"
* Type 3:
* attr[:space:]=[:space:]CDATA
* Type 4:
* attrname
*
* We leave types 1 and 2 the same, type 3 we check for
* '"' and convert to "&quot" if needed, then wrap in
* double quotes. Type 4 we convert into:
* attrname="yes".
*/
$regary = tln_findnxreg($body, $pos, '[^\w\-_]');
if ($regary == false){
/**
* Looks like body ended before the end of tag.
*/
return Array(false, false, false, $lt, strlen($body));
}
list($pos, $attname, $match) = $regary;
$attname = strtolower($attname);
/**
* We arrived at the end of attribute name. Several things possible
* here:
* '>' means the end of the tag and this is attribute type 4
* '/' if followed by '>' means the same thing as above
* '\s' means a lot of things -- look what it's followed by.
* anything else means the attribute is invalid.
*/
switch($match){
case '/':
/**
* This is an xhtml-style tag with a closing / at the
* end, like so: <img src="blah"/>. Check if it's followed
* by the closing bracket. If not, then this tag is invalid
*/
if (substr($body, $pos, 2) == '/>'){
$pos++;
$tagtype = 3;
} else {
$gt = tln_findnxstr($body, $pos, '>');
$retary = Array(false, false, false, $lt, $gt);
return $retary;
}
case '>':
$attary{$attname} = '"yes"';
return Array($tagname, $attary, $tagtype, $lt, $pos);
break;
default:
/**
* Skip whitespace and see what we arrive at.
*/
$pos = tln_skipspace($body, $pos);
$char = substr($body, $pos, 1);
/**
* Two things are valid here:
* '=' means this is attribute type 1 2 or 3.
* \w means this was attribute type 4.
* anything else we ignore and re-loop. End of tag and
* invalid stuff will be caught by our checks at the beginning
* of the loop.
*/
if ($char == '='){
$pos++;
$pos = tln_skipspace($body, $pos);
/**
* Here are 3 possibilities:
* "'" attribute type 1
* '"' attribute type 2
* everything else is the content of tag type 3
*/
$quot = substr($body, $pos, 1);
if ($quot == '\''){
$regary = tln_findnxreg($body, $pos+1, '\'');
if ($regary == false){
return Array(false, false, false, $lt, strlen($body));
}
list($pos, $attval, $match) = $regary;
$pos++;
$attary{$attname} = '\'' . $attval . '\'';
} else if ($quot == '"'){
$regary = tln_findnxreg($body, $pos+1, '\"');
if ($regary == false){
return Array(false, false, false, $lt, strlen($body));
}
list($pos, $attval, $match) = $regary;
$pos++;
$attary{$attname} = '"' . $attval . '"';
} else {
/**
* These are hateful. Look for \s, or >.
*/
$regary = tln_findnxreg($body, $pos, '[\s>]');
if ($regary == false){
return Array(false, false, false, $lt, strlen($body));
}
list($pos, $attval, $match) = $regary;
/**
* If it's ">" it will be caught at the top.
*/
$attval = preg_replace('/\"/s', '&quot;', $attval);
$attary{$attname} = '"' . $attval . '"';
}
} else if (preg_match('|[\w/>]|', $char)) {
/**
* That was attribute type 4.
*/
$attary{$attname} = '"yes"';
} else {
/**
* An illegal character. Find next '>' and return.
*/
$gt = tln_findnxstr($body, $pos, '>');
return Array(false, false, false, $lt, $gt);
}
}
}
/**
* The fact that we got here indicates that the tag end was never
* found. Return invalid tag indication so it gets stripped.
*/
return Array(false, false, false, $lt, strlen($body));
}
/**
* Translates entities into literal values so they can be checked.
*
* @param $attvalue the by-ref value to check.
* @param $regex the regular expression to check against.
* @param $hex whether the entites are hexadecimal.
* @return True or False depending on whether there were matches.
*/
function tln_deent(&$attvalue, $regex, $hex=false){
$me = 'tln_deent';
$ret_match = false;
preg_match_all($regex, $attvalue, $matches);
if (is_array($matches) && sizeof($matches[0]) > 0){
$repl = Array();
for ($i = 0; $i < sizeof($matches[0]); $i++){
$numval = $matches[1][$i];
if ($hex){
$numval = hexdec($numval);
}
$repl{$matches[0][$i]} = chr($numval);
}
$attvalue = strtr($attvalue, $repl);
return true;
} else {
return false;
}
}
/**
* This function checks attribute values for entity-encoded values
* and returns them translated into 8-bit strings so we can run
* checks on them.
*
* @param $attvalue A string to run entity check against.
* @return Nothing, modifies a reference value.
*/
function tln_defang(&$attvalue){
$me = 'tln_defang';
/**
* Skip this if there aren't ampersands or backslashes.
*/
if (strpos($attvalue, '&') === false
&& strpos($attvalue, '\\') === false){
return;
}
$m = false;
do {
$m = false;
$m = $m || tln_deent($attvalue, '/\&#0*(\d+);*/s');
$m = $m || tln_deent($attvalue, '/\&#x0*((\d|[a-f])+);*/si', true);
$m = $m || tln_deent($attvalue, '/\\\\(\d+)/s', true);
} while ($m == true);
$attvalue = stripslashes($attvalue);
}
/**
* Kill any tabs, newlines, or carriage returns. Our friends the
* makers of the browser with 95% market value decided that it'd
* be funny to make "java[tab]script" be just as good as "javascript".
*
* @param attvalue The attribute value before extraneous spaces removed.
* @return attvalue Nothing, modifies a reference value.
*/
function tln_unspace(&$attvalue){
$me = 'tln_unspace';
if (strcspn($attvalue, "\t\r\n\0 ") != strlen($attvalue)){
$attvalue = str_replace(Array("\t", "\r", "\n", "\0", " "),
Array('', '', '', '', ''), $attvalue);
}
}
/**
* This function runs various checks against the attributes.
*
* @param $tagname String with the name of the tag.
* @param $attary Array with all tag attributes.
* @param $rm_attnames See description for tln_sanitize
* @param $bad_attvals See description for tln_sanitize
* @param $add_attr_to_tag See description for tln_sanitize
* @return Array with modified attributes.
*/
function tln_fixatts($tagname,
$attary,
$rm_attnames,
$bad_attvals,
$add_attr_to_tag
){
$me = 'tln_fixatts';
while (list($attname, $attvalue) = each($attary)){
/**
* See if this attribute should be removed.
*/
foreach ($rm_attnames as $matchtag=>$matchattrs){
if (preg_match($matchtag, $tagname)){
foreach ($matchattrs as $matchattr){
if (preg_match($matchattr, $attname)){
unset($attary{$attname});
continue;
}
}
}
}
/**
* Remove any backslashes, entities, or extraneous whitespace.
*/
tln_defang($attvalue);
tln_unspace($attvalue);
/**
* Now let's run checks on the attvalues.
* I don't expect anyone to comprehend this. If you do,
* get in touch with me so I can drive to where you live and
* shake your hand personally. :)
*/
foreach ($bad_attvals as $matchtag=>$matchattrs){
if (preg_match($matchtag, $tagname)){
foreach ($matchattrs as $matchattr=>$valary){
if (preg_match($matchattr, $attname)){
/**
* There are two arrays in valary.
* First is matches.
* Second one is replacements
*/
list($valmatch, $valrepl) = $valary;
$newvalue = preg_replace($valmatch,$valrepl,$attvalue);
if ($newvalue != $attvalue){
$attary{$attname} = $newvalue;
}
}
}
}
}
}
/**
* See if we need to append any attributes to this tag.
*/
foreach ($add_attr_to_tag as $matchtag=>$addattary){
if (preg_match($matchtag, $tagname)){
$attary = array_merge($attary, $addattary);
}
}
return $attary;
}
/**
*
* @param $body the string with HTML you wish to filter
* @param $tag_list see description above
* @param $rm_tags_with_content see description above
* @param $self_closing_tags see description above
* @param $force_tag_closing see description above
* @param $rm_attnames see description above
* @param $bad_attvals see description above
* @param $add_attr_to_tag see description above
* @return tln_sanitized html safe to show on your pages.
*/
function tln_sanitize($body,
$tag_list,
$rm_tags_with_content,
$self_closing_tags,
$force_tag_closing,
$rm_attnames,
$bad_attvals,
$add_attr_to_tag
)
{
$me = 'tln_sanitize';
/**
* Normalize rm_tags and rm_tags_with_content.
*/
$rm_tags = array_shift($tag_list);
@array_walk($tag_list, 'tln_casenormalize');
@array_walk($rm_tags_with_content, 'tln_casenormalize');
@array_walk($self_closing_tags, 'tln_casenormalize');
/**
* See if tag_list is of tags to remove or tags to allow.
* false means remove these tags
* true means allow these tags
*/
$curpos = 0;
$open_tags = Array();
$trusted = "<!-- begin tln_sanitized html -->\n";
$skip_content = false;
/**
* Take care of netscape's stupid javascript entities like
* &{alert('boo')};
*/
$body = preg_replace('/&(\{.*?\};)/si', '&amp;\\1', $body);
while (($curtag = tln_getnxtag($body, $curpos)) != FALSE){
list($tagname, $attary, $tagtype, $lt, $gt) = $curtag;
$free_content = substr($body, $curpos, $lt - $curpos);
if ($skip_content == false){
$trusted .= $free_content;
} else {
}
if ($tagname != FALSE){
if ($tagtype == 2){
if ($skip_content == $tagname){
/**
* Got to the end of tag we needed to remove.
*/
$tagname = false;
$skip_content = false;
} else {
if ($skip_content == false){
if (isset($open_tags{$tagname}) &&
$open_tags{$tagname} > 0){
$open_tags{$tagname}--;
} else {
$tagname = false;
}
} else {
}
}
} else {
/**
* $rm_tags_with_content
*/
if ($skip_content == false){
/**
* See if this is a self-closing type and change
* tagtype appropriately.
*/
if ($tagtype == 1
&& in_array($tagname, $self_closing_tags)){
$tagtype = 3;
}
/**
* See if we should skip this tag and any content
* inside it.
*/
if ($tagtype == 1
&& in_array($tagname, $rm_tags_with_content)){
$skip_content = $tagname;
} else {
if (($rm_tags == false
&& in_array($tagname, $tag_list)) ||
($rm_tags == true
&& !in_array($tagname, $tag_list))){
$tagname = false;
} else {
if ($tagtype == 1){
if (isset($open_tags{$tagname})){
$open_tags{$tagname}++;
} else {
$open_tags{$tagname} = 1;
}
}
/**
* This is where we run other checks.
*/
if (is_array($attary) && sizeof($attary) > 0){
$attary = tln_fixatts($tagname,
$attary,
$rm_attnames,
$bad_attvals,
$add_attr_to_tag);
}
}
}
} else {
}
}
if ($tagname != false && $skip_content == false){
$trusted .= tln_tagprint($tagname, $attary, $tagtype);
}
} else {
}
$curpos = $gt + 1;
}
$trusted .= substr($body, $curpos, strlen($body) - $curpos);
if ($force_tag_closing == true){
foreach ($open_tags as $tagname=>$opentimes){
while ($opentimes > 0){
$trusted .= '</' . $tagname . '>';
$opentimes--;
}
}
$trusted .= "\n";
}
$trusted .= "<!-- end tln_sanitized html -->\n";
return $trusted;
}
//
// Use the nifty htmlfilter library
//
function HTMLFilter($body, $trans_image_path, $block_external_images = false) {
$tag_list = Array(
false,
"object",
"meta",
"html",
"head",
"base",
"link",
"frame",
"iframe",
"plaintext",
"marquee"
);
$rm_tags_with_content = Array(
"script",
"applet",
"embed",
"title",
"frameset",
"xmp",
"xml"
);
$self_closing_tags = Array(
"img",
"br",
"hr",
"input",
"outbind"
);
$force_tag_closing = true;
$rm_attnames = Array(
"/.*/" =>
Array(
// "/target/i",
"/^on.*/i",
"/^dynsrc/i",
"/^data.*/i",
"/^lowsrc.*/i"
)
);
$bad_attvals = Array(
"/.*/" =>
Array(
"/^src|background/i" =>
Array(
Array(
"/^([\'\"])\s*\S+script\s*:.*([\'\"])/si",
"/^([\'\"])\s*mocha\s*:*.*([\'\"])/si",
"/^([\'\"])\s*about\s*:.*([\'\"])/si"
),
Array(
"\\1$trans_image_path\\2",
"\\1$trans_image_path\\2",
"\\1$trans_image_path\\2",
"\\1$trans_image_path\\2"
)
),
"/^href|action/i" =>
Array(
Array(
"/^([\'\"])\s*\S+script\s*:.*([\'\"])/si",
"/^([\'\"])\s*mocha\s*:*.*([\'\"])/si",
"/^([\'\"])\s*about\s*:.*([\'\"])/si"
),
Array(
"\\1#\\1",
"\\1#\\1",
"\\1#\\1",
"\\1#\\1"
)
),
"/^style/i" =>
Array(
Array(
"/expression/i",
"/binding/i",
"/behaviou*r/i",
"/include-source/i",
"/position\s*:\s*absolute/i",
"/url\s*\(\s*([\'\"])\s*\S+script\s*:.*([\'\"])\s*\)/si",
"/url\s*\(\s*([\'\"])\s*mocha\s*:.*([\'\"])\s*\)/si",
"/url\s*\(\s*([\'\"])\s*about\s*:.*([\'\"])\s*\)/si",
"/(.*)\s*:\s*url\s*\(\s*([\'\"]*)\s*\S+script\s*:.*([\'\"]*)\s*\)/si"
),
Array(
"idiocy",
"idiocy",
"idiocy",
"idiocy",
"",
"url(\\1#\\1)",
"url(\\1#\\1)",
"url(\\1#\\1)",
"url(\\1#\\1)",
"url(\\1#\\1)",
"\\1:url(\\2#\\3)"
)
)
)
);
if ($block_external_images){
array_push($bad_attvals{'/.*/'}{'/^src|background/i'}[0],
'/^([\'\"])\s*https*:.*([\'\"])/si');
array_push($bad_attvals{'/.*/'}{'/^src|background/i'}[1],
"\\1$trans_image_path\\1");
array_push($bad_attvals{'/.*/'}{'/^style/i'}[0],
'/url\(([\'\"])\s*https*:.*([\'\"])\)/si');
array_push($bad_attvals{'/.*/'}{'/^style/i'}[1],
"url(\\1$trans_image_path\\1)");
}
$add_attr_to_tag = Array(
"/^a$/i" =>
Array('target'=>'"_blank"')
);
$trusted = tln_sanitize($body,
$tag_list,
$rm_tags_with_content,
$self_closing_tags,
$force_tag_closing,
$rm_attnames,
$bad_attvals,
$add_attr_to_tag
);
return $trusted;
}
?>

View File

@@ -1,185 +0,0 @@
<?php
/*
* ntlm_sasl_client.php
*
* @(#) $Id: ntlm_sasl_client.php,v 1.3 2004/11/17 08:00:37 mlemos Exp $
*
**
** Source: http://www.phpclasses.org/browse/file/7495.html
** License: BSD (http://www.phpclasses.org/package/1888-PHP-Single-API-for-standard-authentication-mechanisms.html)
** Bundled with Permission
**
*/
define("SASL_NTLM_STATE_START", 0);
define("SASL_NTLM_STATE_IDENTIFY_DOMAIN", 1);
define("SASL_NTLM_STATE_RESPOND_CHALLENGE", 2);
define("SASL_NTLM_STATE_DONE", 3);
class ntlm_sasl_client_class
{
var $credentials=array();
var $state=SASL_NTLM_STATE_START;
Function Initialize(&$client)
{
if(!function_exists($function="mcrypt_encrypt")
|| !function_exists($function="mhash"))
{
$extensions=array(
"mcrypt_encrypt"=>"mcrypt",
"mhash"=>"mhash"
);
$client->error="the extension ".$extensions[$function]." required by the NTLM SASL client class is not available in this PHP configuration";
return(0);
}
return(1);
}
Function ASCIIToUnicode($ascii)
{
for($unicode="",$a=0;$a<strlen($ascii);$a++)
$unicode.=substr($ascii,$a,1).chr(0);
return($unicode);
}
Function TypeMsg1($domain,$workstation)
{
$domain_length=strlen($domain);
$workstation_length=strlen($workstation);
$workstation_offset=32;
$domain_offset=$workstation_offset+$workstation_length;
return(
"NTLMSSP\0".
"\x01\x00\x00\x00".
"\x07\x32\x00\x00".
pack("v",$domain_length).
pack("v",$domain_length).
pack("V",$domain_offset).
pack("v",$workstation_length).
pack("v",$workstation_length).
pack("V",$workstation_offset).
$workstation.
$domain
);
}
Function NTLMResponse($challenge,$password)
{
$unicode=$this->ASCIIToUnicode($password);
$md4=mhash(MHASH_MD4,$unicode);
$padded=$md4.str_repeat(chr(0),21-strlen($md4));
$iv_size=mcrypt_get_iv_size(MCRYPT_DES,MCRYPT_MODE_ECB);
$iv=mcrypt_create_iv($iv_size,MCRYPT_RAND);
for($response="",$third=0;$third<21;$third+=7)
{
for($packed="",$p=$third;$p<$third+7;$p++)
$packed.=str_pad(decbin(ord(substr($padded,$p,1))),8,"0",STR_PAD_LEFT);
for($key="",$p=0;$p<strlen($packed);$p+=7)
{
$s=substr($packed,$p,7);
$b=$s.((substr_count($s,"1") % 2) ? "0" : "1");
$key.=chr(bindec($b));
}
$ciphertext=mcrypt_encrypt(MCRYPT_DES,$key,$challenge,MCRYPT_MODE_ECB,$iv);
$response.=$ciphertext;
}
return $response;
}
Function TypeMsg3($ntlm_response,$user,$domain,$workstation)
{
$domain_unicode=$this->ASCIIToUnicode($domain);
$domain_length=strlen($domain_unicode);
$domain_offset=64;
$user_unicode=$this->ASCIIToUnicode($user);
$user_length=strlen($user_unicode);
$user_offset=$domain_offset+$domain_length;
$workstation_unicode=$this->ASCIIToUnicode($workstation);
$workstation_length=strlen($workstation_unicode);
$workstation_offset=$user_offset+$user_length;
$lm="";
$lm_length=strlen($lm);
$lm_offset=$workstation_offset+$workstation_length;
$ntlm=$ntlm_response;
$ntlm_length=strlen($ntlm);
$ntlm_offset=$lm_offset+$lm_length;
$session="";
$session_length=strlen($session);
$session_offset=$ntlm_offset+$ntlm_length;
return(
"NTLMSSP\0".
"\x03\x00\x00\x00".
pack("v",$lm_length).
pack("v",$lm_length).
pack("V",$lm_offset).
pack("v",$ntlm_length).
pack("v",$ntlm_length).
pack("V",$ntlm_offset).
pack("v",$domain_length).
pack("v",$domain_length).
pack("V",$domain_offset).
pack("v",$user_length).
pack("v",$user_length).
pack("V",$user_offset).
pack("v",$workstation_length).
pack("v",$workstation_length).
pack("V",$workstation_offset).
pack("v",$session_length).
pack("v",$session_length).
pack("V",$session_offset).
"\x01\x02\x00\x00".
$domain_unicode.
$user_unicode.
$workstation_unicode.
$lm.
$ntlm
);
}
Function Start(&$client, &$message, &$interactions)
{
if($this->state!=SASL_NTLM_STATE_START)
{
$client->error="NTLM authentication state is not at the start";
return(SASL_FAIL);
}
$this->credentials=array(
"user"=>"",
"password"=>"",
"realm"=>"",
"workstation"=>""
);
$defaults=array();
$status=$client->GetCredentials($this->credentials,$defaults,$interactions);
if($status==SASL_CONTINUE)
$this->state=SASL_NTLM_STATE_IDENTIFY_DOMAIN;
Unset($message);
return($status);
}
Function Step(&$client, $response, &$message, &$interactions)
{
switch($this->state)
{
case SASL_NTLM_STATE_IDENTIFY_DOMAIN:
$message=$this->TypeMsg1($this->credentials["realm"],$this->credentials["workstation"]);
$this->state=SASL_NTLM_STATE_RESPOND_CHALLENGE;
break;
case SASL_NTLM_STATE_RESPOND_CHALLENGE:
$ntlm_response=$this->NTLMResponse(substr($response,24,8),$this->credentials["password"]);
$message=$this->TypeMsg3($ntlm_response,$this->credentials["user"],$this->credentials["realm"],$this->credentials["workstation"]);
$this->state=SASL_NTLM_STATE_DONE;
break;
case SASL_NTLM_STATE_DONE:
$client->error="NTLM authentication was finished without success";
return(SASL_FAIL);
default:
$client->error="invalid NTLM authentication step state";
return(SASL_FAIL);
}
return(SASL_CONTINUE);
}
};
?>

View File

@@ -1,27 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Arabic Version, UTF-8
* by : bahjat al mostafa <bahjat983@hotmail.com>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Error: لم نستطع تأكيد الهوية.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Error: لم نستطع الاتصال بمخدم SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: لم يتم قبول المعلومات .';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'ترميز غير معروف: ';
$PHPMAILER_LANG['execute'] = 'لم أستطع تنفيذ : ';
$PHPMAILER_LANG['file_access'] = 'لم نستطع الوصول للملف: ';
$PHPMAILER_LANG['file_open'] = 'File Error: لم نستطع فتح الملف: ';
$PHPMAILER_LANG['from_failed'] = 'البريد التالي لم نستطع ارسال البريد له : ';
$PHPMAILER_LANG['instantiate'] = 'لم نستطع توفير خدمة البريد.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer غير مدعوم.';
//$PHPMAILER_LANG['provide_address'] = 'You must provide at least one recipient email address.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: الأخطاء التالية ' .
'فشل في الارسال لكل من : ';
$PHPMAILER_LANG['signing'] = 'خطأ في التوقيع: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Portuguese Version
* By Paulo Henrique Garcia - paulo@controllerweb.com.br
*/
$PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possível autenticar.';
$PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possível conectar com o servidor SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Erro de SMTP: Dados não aceitos.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: ';
$PHPMAILER_LANG['execute'] = 'Não foi possível executar: ';
$PHPMAILER_LANG['file_access'] = 'Não foi possível acessar o arquivo: ';
$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possível abrir o arquivo: ';
$PHPMAILER_LANG['from_failed'] = 'Os endereços de rementente a seguir falharam: ';
$PHPMAILER_LANG['instantiate'] = 'Não foi possível instanciar a função mail.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não suportado.';
$PHPMAILER_LANG['provide_address'] = 'Você deve fornecer pelo menos um endereço de destinatário de email.';
$PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os endereços de destinatário a seguir falharam: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Catalan Version
* By Ivan: web AT microstudi DOT com
*/
$PHPMAILER_LANG['authenticate'] = 'Error SMTP: No s\'hapogut autenticar.';
$PHPMAILER_LANG['connect_host'] = 'Error SMTP: No es pot connectar al servidor SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Dades no acceptades.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Codificació desconeguda: ';
$PHPMAILER_LANG['execute'] = 'No es pot executar: ';
$PHPMAILER_LANG['file_access'] = 'No es pot accedir a l\'arxiu: ';
$PHPMAILER_LANG['file_open'] = 'Error d\'Arxiu: No es pot obrir l\'arxiu: ';
$PHPMAILER_LANG['from_failed'] = 'La(s) següent(s) adreces de remitent han fallat: ';
$PHPMAILER_LANG['instantiate'] = 'No s\'ha pogut crear una instància de la funció Mail.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no està suportat';
$PHPMAILER_LANG['provide_address'] = 'S\'ha de proveir almenys una adreça d\'email com a destinatari.';
$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Els següents destinataris han fallat: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Chinese Version
* By LiuXin: www.80x86.cn/blog/
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:身份验证失败。';
$PHPMAILER_LANG['connect_host'] = 'SMTP 错误: 不能连接SMTP主机。';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误: 数据不可接受。';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = '未知编码:';
$PHPMAILER_LANG['execute'] = '不能执行: ';
$PHPMAILER_LANG['file_access'] = '不能访问文件:';
$PHPMAILER_LANG['file_open'] = '文件错误:不能打开文件:';
$PHPMAILER_LANG['from_failed'] = '下面的发送地址邮件发送失败了: ';
$PHPMAILER_LANG['instantiate'] = '不能实现mail方法。';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' 您所选择的发送邮件的方法并不支持。';
$PHPMAILER_LANG['provide_address'] = '您必须提供至少一个 收信人的email地址。';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误: 下面的 收件人失败了: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,25 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Czech Version
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Chyba autentikace.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Nelze navázat spojení se SMTP serverem.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Data nebyla pøijata';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Neznámé kódování: ';
$PHPMAILER_LANG['execute'] = 'Nelze provést: ';
$PHPMAILER_LANG['file_access'] = 'Soubor nenalezen: ';
$PHPMAILER_LANG['file_open'] = 'File Error: Nelze otevøít soubor pro ètení: ';
$PHPMAILER_LANG['from_failed'] = 'Následující adresa From je nesprávná: ';
$PHPMAILER_LANG['instantiate'] = 'Nelze vytvoøit instanci emailové funkce.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailový klient není podporován.';
$PHPMAILER_LANG['provide_address'] = 'Musíte zadat alespoò jednu emailovou adresu pøíjemce.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Adresy pøíjemcù nejsou správné ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,25 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* German Version
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Fehler: Daten werden nicht akzeptiert.';
$PHPMAILER_LANG['empty_message'] = 'E-Mail Inhalt ist leer.';
$PHPMAILER_LANG['encoding'] = 'Unbekanntes Encoding-Format: ';
$PHPMAILER_LANG['execute'] = 'Konnte folgenden Befehl nicht ausführen: ';
$PHPMAILER_LANG['file_access'] = 'Zugriff auf folgende Datei fehlgeschlagen: ';
$PHPMAILER_LANG['file_open'] = 'Datei Fehler: konnte folgende Datei nicht öffnen: ';
$PHPMAILER_LANG['from_failed'] = 'Die folgende Absenderadresse ist nicht korrekt: ';
$PHPMAILER_LANG['instantiate'] = 'Mail Funktion konnte nicht initialisiert werden.';
$PHPMAILER_LANG['invalid_address'] = 'E-Mail wird nicht gesendet, die Adresse ist ungültig.';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wird nicht unterstützt.';
$PHPMAILER_LANG['provide_address'] = 'Bitte geben Sie mindestens eine Empfänger E-Mailadresse an.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Fehler: Die folgenden Empfänger sind nicht korrekt: ';
$PHPMAILER_LANG['signing'] = 'Fehler beim Signieren: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Verbindung zu SMTP Server fehlgeschlagen.';
$PHPMAILER_LANG['smtp_error'] = 'Fehler vom SMTP Server: ';
$PHPMAILER_LANG['variable_set'] = 'Kann Variable nicht setzen oder zurücksetzen: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Danish Version
* Author: Mikael Stokkebro <info@stokkebro.dk>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Kunne ikke logge på.';
$PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data kunne ikke accepteres.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: ';
$PHPMAILER_LANG['execute'] = 'Kunne ikke køre: ';
$PHPMAILER_LANG['file_access'] = 'Ingen adgang til fil: ';
$PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke åbne filen: ';
$PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: ';
$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere email funktionen.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.';
$PHPMAILER_LANG['provide_address'] = 'Du skal indtaste mindst en modtagers emailadresse.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,23 +0,0 @@
<?php
/**
* PHPMailer language file.
* English Version
*/
$PHPMAILER_LANG = array();
$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
'recipient email address.';
$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
$PHPMAILER_LANG["execute"] = 'Could not execute: ';
$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
'recipients failed: ';
$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
$PHPMAILER_LANG["file_access"] = 'Could not access file: ';
$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Spanish version
* Versión en español
*/
$PHPMAILER_LANG['authenticate'] = 'Error SMTP: No se pudo autentificar.';
$PHPMAILER_LANG['connect_host'] = 'Error SMTP: No puedo conectar al servidor SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Datos no aceptados.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Codificación desconocida: ';
$PHPMAILER_LANG['execute'] = 'No puedo ejecutar: ';
$PHPMAILER_LANG['file_access'] = 'No puedo acceder al archivo: ';
$PHPMAILER_LANG['file_open'] = 'Error de Archivo: No puede abrir el archivo: ';
$PHPMAILER_LANG['from_failed'] = 'La(s) siguiente(s) direcciones de remitente fallaron: ';
$PHPMAILER_LANG['instantiate'] = 'No pude crear una instancia de la función Mail.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no está soportado.';
$PHPMAILER_LANG['provide_address'] = 'Debe proveer al menos una dirección de email como destinatario.';
$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Los siguientes destinatarios fallaron: ';
$PHPMAILER_LANG['signing'] = 'Error al firmar: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Estonian Version
* By Indrek Päri
* Revised By Elan Ruusamäe <glen@delfi.ee>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Viga: Autoriseerimise viga.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Viga: Ei õnnestunud luua ühendust SMTP serveriga.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Viga: Vigased andmed.';
$PHPMAILER_LANG['empty_message'] = 'Tühi kirja sisu';
$PHPMAILER_LANG["encoding"] = 'Tundmatu kodeering: ';
$PHPMAILER_LANG['execute'] = 'Tegevus ebaõnnestus: ';
$PHPMAILER_LANG['file_access'] = 'Pole piisavalt õiguseid järgneva faili avamiseks: ';
$PHPMAILER_LANG['file_open'] = 'Faili Viga: Faili avamine ebaõnnestus: ';
$PHPMAILER_LANG['from_failed'] = 'Järgnev saatja e-posti aadress on vigane: ';
$PHPMAILER_LANG['instantiate'] = 'mail funktiooni käivitamine ebaõnnestus.';
$PHPMAILER_LANG['invalid_address'] = 'Saatmine peatatud, e-posti address vigane: ';
$PHPMAILER_LANG['provide_address'] = 'Te peate määrama vähemalt ühe saaja e-posti aadressi.';
$PHPMAILER_LANG['mailer_not_supported'] = ' maileri tugi puudub.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Viga: Järgnevate saajate e-posti aadressid on vigased: ';
$PHPMAILER_LANG["signing"] = 'Viga allkirjastamisel: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() ebaõnnestus.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri viga: ';
$PHPMAILER_LANG['variable_set'] = 'Ei õnnestunud määrata või lähtestada muutujat: ';

View File

@@ -1,27 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Finnish Version
* By Jyry Kuukanen
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP-virhe: käyttäjätunnistus epäonnistui.';
$PHPMAILER_LANG['connect_host'] = 'SMTP-virhe: yhteys palvelimeen ei onnistu.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-virhe: data on virheellinen.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: ';
$PHPMAILER_LANG['execute'] = 'Suoritus epäonnistui: ';
$PHPMAILER_LANG['file_access'] = 'Seuraavaan tiedostoon ei ole oikeuksia: ';
$PHPMAILER_LANG['file_open'] = 'Tiedostovirhe: Ei voida avata tiedostoa: ';
$PHPMAILER_LANG['from_failed'] = 'Seuraava lähettäjän osoite on virheellinen: ';
$PHPMAILER_LANG['instantiate'] = 'mail-funktion luonti epäonnistui.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = 'postivälitintyyppiä ei tueta.';
$PHPMAILER_LANG['provide_address'] = 'Aseta vähintään yksi vastaanottajan sähk&ouml;postiosoite.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.';
$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,27 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Faroese Version [language of the Faroe Islands, a Danish dominion]
* This file created: 11-06-2004
* Supplied by Dávur Sørensen [www.profo-webdesign.dk]
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP feilur: Kundi ikki góðkenna.';
$PHPMAILER_LANG['connect_host'] = 'SMTP feilur: Kundi ikki knýta samband við SMTP vert.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP feilur: Data ikki góðkent.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Ókend encoding: ';
$PHPMAILER_LANG['execute'] = 'Kundi ikki útføra: ';
$PHPMAILER_LANG['file_access'] = 'Kundi ikki tilganga fílu: ';
$PHPMAILER_LANG['file_open'] = 'Fílu feilur: Kundi ikki opna fílu: ';
$PHPMAILER_LANG['from_failed'] = 'fylgjandi Frá/From adressa miseydnaðist: ';
$PHPMAILER_LANG['instantiate'] = 'Kuni ikki instantiera mail funktión.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' er ikki supporterað.';
$PHPMAILER_LANG['provide_address'] = 'Tú skal uppgeva minst móttakara-emailadressu(r).';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feilur: Fylgjandi móttakarar miseydnaðust: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,25 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* French Version
*/
$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : Echec de l\'authentification.';
$PHPMAILER_LANG['connect_host'] = 'Erreur SMTP : Impossible de se connecter au serveur SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Erreur SMTP : Données incorrects.';
$PHPMAILER_LANG['empty_message'] = 'Corps de message vide';
$PHPMAILER_LANG['encoding'] = 'Encodage inconnu : ';
$PHPMAILER_LANG['execute'] = 'Impossible de lancer l\'exécution : ';
$PHPMAILER_LANG['file_access'] = 'Impossible d\'accéder au fichier : ';
$PHPMAILER_LANG['file_open'] = 'Erreur Fichier : ouverture impossible : ';
$PHPMAILER_LANG['from_failed'] = 'L\'adresse d\'expéditeur suivante a échouée : ';
$PHPMAILER_LANG['instantiate'] = 'Impossible d\'instancier la fonction mail.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' client de messagerie non supporté.';
$PHPMAILER_LANG['provide_address'] = 'Vous devez fournir au moins une adresse de destinataire.';
$PHPMAILER_LANG['recipients_failed'] = 'Erreur SMTP : Les destinataires suivants sont en erreur : ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,25 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Hungarian Version
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Hiba: Sikertelen autentikáció.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Hiba: Nem tudtam csatlakozni az SMTP host-hoz.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Hiba: Nem elfogadható adat.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Ismeretlen kódolás: ';
$PHPMAILER_LANG['execute'] = 'Nem tudtam végrehajtani: ';
$PHPMAILER_LANG['file_access'] = 'Nem sikerült elérni a következõ fájlt: ';
$PHPMAILER_LANG['file_open'] = 'Fájl Hiba: Nem sikerült megnyitni a következõ fájlt: ';
$PHPMAILER_LANG['from_failed'] = 'Az alábbi Feladó cím hibás: ';
$PHPMAILER_LANG['instantiate'] = 'Nem sikerült példányosítani a mail funkciót.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['provide_address'] = 'Meg kell adnod legalább egy címzett email címet.';
$PHPMAILER_LANG['mailer_not_supported'] = ' levelezõ nem támogatott.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Hiba: Az alábbi címzettek hibásak: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,27 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Italian version
* @package PHPMailer
* @author Ilias Bartolini <brain79@inwind.it>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Impossibile autenticarsi.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Impossibile connettersi all\'host SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Data non accettati dal server.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Encoding set dei caratteri sconosciuto: ';
$PHPMAILER_LANG['execute'] = 'Impossibile eseguire l\'operazione: ';
$PHPMAILER_LANG['file_access'] = 'Impossibile accedere al file: ';
$PHPMAILER_LANG['file_open'] = 'File Error: Impossibile aprire il file: ';
$PHPMAILER_LANG['from_failed'] = 'I seguenti indirizzi mittenti hanno generato errore: ';
$PHPMAILER_LANG['instantiate'] = 'Impossibile istanziare la funzione mail';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['provide_address'] = 'Deve essere fornito almeno un indirizzo ricevente';
$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer non supportato';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: I seguenti indirizzi destinatari hanno generato errore: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Japanese Version
* By Mitsuhiro Yoshida - http://mitstek.com/
*/
$PHPMAILER_LANG['authenticate'] = 'SMTPエラー: 認証できませんでした。';
$PHPMAILER_LANG['connect_host'] = 'SMTPエラー: SMTPホストに接続できませんでした。';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTPエラー: データが受け付けられませんでした。';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = '不明なエンコーディング: ';
$PHPMAILER_LANG['execute'] = '実行できませんでした: ';
$PHPMAILER_LANG['file_access'] = 'ファイルにアクセスできません: ';
$PHPMAILER_LANG['file_open'] = 'ファイルエラー: ファイルを開けません: ';
$PHPMAILER_LANG['from_failed'] = '次のFromアドレスに間違いがあります: ';
$PHPMAILER_LANG['instantiate'] = 'メール関数が正常に動作しませんでした。';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['provide_address'] = '少なくとも1つメールアドレスを 指定する必要があります。';
$PHPMAILER_LANG['mailer_not_supported'] = ' メーラーがサポートされていません。';
$PHPMAILER_LANG['recipients_failed'] = 'SMTPエラー: 次の受信者アドレスに 間違いがあります: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,25 +0,0 @@
<?php
/**
* PHPMailer language file: refer to class.phpmailer.php for definitive list.
* Dutch Version by Tuxion <team@tuxion.nl>
*/
$PHPMAILER_LANG['provide_address'] = 'Er moet tenmiste één ontvanger e-mailadres opgegeven worden.';//You must provide at least one recipient email address.
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wordt niet ondersteund.';// mailer is not supported.
$PHPMAILER_LANG['execute'] = 'Kon niet uitvoeren: ';//Could not execute:
$PHPMAILER_LANG['instantiate'] = 'Kon mailfunctie niet initialiseren.';//Could not instantiate mail function.
$PHPMAILER_LANG['authenticate'] = 'SMTP-fout: authenticatie mislukt.';//SMTP Error: Could not authenticate.
$PHPMAILER_LANG['from_failed'] = 'Het volgende afzendersadres is mislukt: ';//The following From address failed:
$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: de volgende ontvangers zijn mislukt: ';//SMTP Error: The following recipients failed:
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-fout: data niet geaccepteerd.';//SMTP Error: Data not accepted.
$PHPMAILER_LANG['connect_host'] = 'SMTP-fout: kon niet verbinden met SMTP-host.';//SMTP Error: Could not connect to SMTP host.
$PHPMAILER_LANG['file_access'] = 'Kreeg geen toegang tot bestand: ';//Could not access file:
$PHPMAILER_LANG['file_open'] = 'Bestandsfout: kon bestand niet openen: ';//File Error: Could not open file:
$PHPMAILER_LANG['encoding'] = 'Onbekende codering: ';//Unknown encoding:
$PHPMAILER_LANG['signing'] = 'Signeerfout: ';//Signing Error:
$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfout: ';//SMTP server error:
$PHPMAILER_LANG['empty_message'] = 'Berichttekst is leeg';//Message body empty
$PHPMAILER_LANG['invalid_address'] = 'Ongeldig adres';//Invalid address
$PHPMAILER_LANG['variable_set'] = 'Kan de volgende variablen niet instellen of resetten: ';//Cannot set or reset variable:
?>

View File

@@ -1,25 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Norwegian Version
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Feil: Kunne ikke authentisere.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Feil: Kunne ikke koble til SMTP host.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Feil: Data ble ikke akseptert.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Ukjent encoding: ';
$PHPMAILER_LANG['execute'] = 'Kunne ikke utføre: ';
$PHPMAILER_LANG['file_access'] = 'Kunne ikke få tilgang til filen: ';
$PHPMAILER_LANG['file_open'] = 'Fil feil: Kunne ikke åpne filen: ';
$PHPMAILER_LANG['from_failed'] = 'Følgende Fra feilet: ';
$PHPMAILER_LANG['instantiate'] = 'Kunne ikke instantiate mail funksjonen.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['provide_address'] = 'Du må ha med minst en mottager adresse.';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer er ikke supportert.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feil: Følgende mottagere feilet: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,25 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Polish Version
*/
$PHPMAILER_LANG['authenticate'] = 'Błąd SMTP: Nie można przeprowadzić autentykacji.';
$PHPMAILER_LANG['connect_host'] = 'Błąd SMTP: Nie można połączyć się z wybranym hostem.';
$PHPMAILER_LANG['data_not_accepted'] = 'Błąd SMTP: Dane nie zostały przyjęte.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Nieznany sposób kodowania znaków: ';
$PHPMAILER_LANG['execute'] = 'Nie można uruchomić: ';
$PHPMAILER_LANG['file_access'] = 'Brak dostępu do pliku: ';
$PHPMAILER_LANG['file_open'] = 'Nie można otworzyć pliku: ';
$PHPMAILER_LANG['from_failed'] = 'Następujący adres Nadawcy jest jest nieprawidłowy: ';
$PHPMAILER_LANG['instantiate'] = 'Nie można wywołać funkcji mail(). Sprawdź konfigurację serwera.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['provide_address'] = 'Należy podać prawidłowy adres email Odbiorcy.';
$PHPMAILER_LANG['mailer_not_supported'] = 'Wybrana metoda wysyłki wiadomości nie jest obsługiwana.';
$PHPMAILER_LANG['recipients_failed'] = 'Błąd SMTP: Następujący odbiorcy są nieprawidłowi: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,27 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Romanian Version
* @package PHPMailer
* @author Catalin Constantin <catalin@dazoot.ro>
*/
$PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Nu a functionat autentificarea.';
$PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Nu m-am putut conecta la adresa SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Continutul mailului nu a fost acceptat.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Encodare necunoscuta: ';
$PHPMAILER_LANG['execute'] = 'Nu pot executa: ';
$PHPMAILER_LANG['file_access'] = 'Nu pot accesa fisierul: ';
$PHPMAILER_LANG['file_open'] = 'Eroare de fisier: Nu pot deschide fisierul: ';
$PHPMAILER_LANG['from_failed'] = 'Urmatoarele adrese From au dat eroare: ';
$PHPMAILER_LANG['instantiate'] = 'Nu am putut instantia functia mail.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.';
$PHPMAILER_LANG['provide_address'] = 'Trebuie sa adaugati cel putin un recipient (adresa de mail).';
$PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Urmatoarele adrese de mail au dat eroare: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Russian Version by Alexey Chumakov <alex@chumakov.ru>
*/
$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.';
$PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удается подключиться к серверу SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не приняты.';
$PHPMAILER_LANG['encoding'] = 'Неизвестный вид кодировки: ';
$PHPMAILER_LANG['execute'] = 'Невозможно выполнить команду: ';
$PHPMAILER_LANG['file_access'] = 'Нет доступа к файлу: ';
$PHPMAILER_LANG['file_open'] = 'Файловая ошибка: не удается открыть файл: ';
$PHPMAILER_LANG['from_failed'] = 'Неверный адрес отправителя: ';
$PHPMAILER_LANG['instantiate'] = 'Невозможно запустить функцию mail.';
$PHPMAILER_LANG['provide_address'] = 'Пожалуйста, введите хотя бы один адрес e-mail получателя.';
$PHPMAILER_LANG['mailer_not_supported'] = ' - почтовый сервер не поддерживается.';
$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: отправка по следующим адресам получателей не удалась: ';
$PHPMAILER_LANG['empty_message'] = 'Пустое тело сообщения';
$PHPMAILER_LANG['invalid_address'] = 'Не отослано, неправильный формат email адреса: ';
$PHPMAILER_LANG['signing'] = 'Ошибка подписывания: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка соединения с SMTP-сервером';
$PHPMAILER_LANG['smtp_error'] = 'Ошибка SMTP-сервера: ';
$PHPMAILER_LANG['variable_set'] = 'Невозможно установить или переустановить переменную: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Swedish Version
* Author: Johan Linnér <johan@linner.biz>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP fel: Kunde inte autentisera.';
$PHPMAILER_LANG['connect_host'] = 'SMTP fel: Kunde inte ansluta till SMTP-server.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fel: Data accepterades inte.';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = 'Okänt encode-format: ';
$PHPMAILER_LANG['execute'] = 'Kunde inte köra: ';
$PHPMAILER_LANG['file_access'] = 'Ingen åtkomst till fil: ';
$PHPMAILER_LANG['file_open'] = 'Fil fel: Kunde inte öppna fil: ';
$PHPMAILER_LANG['from_failed'] = 'Följande avsändaradress är felaktig: ';
$PHPMAILER_LANG['instantiate'] = 'Kunde inte initiera e-postfunktion.';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['provide_address'] = 'Du måste ange minst en mottagares e-postadress.';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailer stöds inte.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP fel: Följande mottagare är felaktig: ';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Slovak Version
* Author: Michal Tinka <michaltinka@gmail.com>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Chyba autentifikácie.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Nebolo možné nadviazať spojenie so SMTP serverom.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dáta neboli prijaté';
$PHPMAILER_LANG['empty_message'] = 'Prázdne telo správy.';
$PHPMAILER_LANG['encoding'] = 'Neznáme kódovanie: ';
$PHPMAILER_LANG['execute'] = 'Nedá sa vykonať: ';
$PHPMAILER_LANG['file_access'] = 'Súbor nebol nájdený: ';
$PHPMAILER_LANG['file_open'] = 'File Error: Súbor sa otvoriť pre čítanie: ';
$PHPMAILER_LANG['from_failed'] = 'Následujúca adresa From je nesprávna: ';
$PHPMAILER_LANG['instantiate'] = 'Nedá sa vytvoriť inštancia emailovej funkcie.';
$PHPMAILER_LANG['invalid_address'] = 'Neodoslané, emailová adresa je nesprávna: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' emailový klient nieje podporovaný.';
$PHPMAILER_LANG['provide_address'] = 'Musíte zadať aspoň jednu emailovú adresu príjemcu.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Adresy príjemcov niesu správne ';
$PHPMAILER_LANG['signing'] = 'Chyba prihlasovania: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zlyhalo.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP chyba serveru: ';
$PHPMAILER_LANG['variable_set'] = 'Nemožno nastaviť alebo resetovať premennú: ';
?>

View File

@@ -1,27 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Turkish version
* Türkçe Versiyonu
* ÝZYAZILIM - Elçin Özel - Can Yýlmaz - Mehmet Benlioðlu
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP Hatası: Doğrulanamıyor.';
$PHPMAILER_LANG['connect_host'] = 'SMTP Hatası: SMTP hosta bağlanılamıyor.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Hatası: Veri kabul edilmedi.';
$PHPMAILER_LANG['empty_message'] = 'Mesaj içeriği boş';
$PHPMAILER_LANG['encoding'] = 'Bilinmeyen şifreleme: ';
$PHPMAILER_LANG['execute'] = 'Çalıtırılamıyor: ';
$PHPMAILER_LANG['file_access'] = 'Dosyaya erişilemiyor: ';
$PHPMAILER_LANG['file_open'] = 'Dosya Hatası: Dosya açılamıyor: ';
$PHPMAILER_LANG['from_failed'] = 'Başarısız olan gönderici adresi: ';
$PHPMAILER_LANG['instantiate'] = 'Örnek mail fonksiyonu oluşturulamadı.';
$PHPMAILER_LANG['invalid_address'] = 'Gönderilmedi, email adresi geçersiz: ';
$PHPMAILER_LANG['provide_address'] = 'En az bir tane mail adresi belirtmek zorundasınız alıcının email adresi.';
$PHPMAILER_LANG['mailer_not_supported'] = ' mailler desteklenmemektedir.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP Hatası: alıcılara ulaımadı: ';
$PHPMAILER_LANG['signing'] = 'İmzalama hatası: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP bağlantı() başarısız.';
$PHPMAILER_LANG['smtp_error'] = 'SMTP sunucu hatası: ';
$PHPMAILER_LANG['variable_set'] = 'Ayarlanamıyor yada sıfırlanamıyor: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Traditional Chinese Version
* @author liqwei <liqwei@liqwei.com>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP 錯誤:登錄失敗。';
$PHPMAILER_LANG['connect_host'] = 'SMTP 錯誤:無法連接到 SMTP 主機。';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 錯誤:數據不被接受。';
//$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = '未知編碼: ';
$PHPMAILER_LANG['file_access'] = '無法訪問文件:';
$PHPMAILER_LANG['file_open'] = '文件錯誤:無法打開文件:';
$PHPMAILER_LANG['from_failed'] = '發送地址錯誤:';
$PHPMAILER_LANG['execute'] = '無法執行:';
$PHPMAILER_LANG['instantiate'] = '未知函數調用。';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['provide_address'] = '必須提供至少一個收件人地址。';
$PHPMAILER_LANG['mailer_not_supported'] = '發信客戶端不被支持。';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP 錯誤:收件人地址錯誤:';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -1,26 +0,0 @@
<?php
/**
* PHPMailer language file: refer to English translation for definitive list
* Simplified Chinese Version
* @author liqwei <liqwei@liqwei.com>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。';
$PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数据不被接受。';
//$P$PHPMAILER_LANG['empty_message'] = 'Message body empty';
$PHPMAILER_LANG['encoding'] = '未知编码: ';
$PHPMAILER_LANG['execute'] = '无法执行:';
$PHPMAILER_LANG['file_access'] = '无法访问文件:';
$PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:';
$PHPMAILER_LANG['from_failed'] = '发送地址错误:';
$PHPMAILER_LANG['instantiate'] = '未知函数调用。';
//$PHPMAILER_LANG['invalid_address'] = 'Not sending, email address is invalid: ';
$PHPMAILER_LANG['mailer_not_supported'] = '发信客户端不被支持。';
$PHPMAILER_LANG['provide_address'] = '必须提供至少一个收件人地址。';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地址错误:';
//$PHPMAILER_LANG['signing'] = 'Signing Error: ';
//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.';
//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: ';
//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: ';
?>

View File

@@ -5612,30 +5612,30 @@ class Cases
/**
* This function send an email for each task in $arrayTask if $to is definded
*
* @param $dataLastEmail
* @param $arrayData
* @param $arrayTask
* @param array $dataLastEmail
* @param array $arrayData
* @param array $arrayTask
* @return void
*
* @see \Cases->sendNotifications()
*/
public function sendMessage($dataLastEmail, $arrayData, $arrayTask)
{
foreach ($arrayTask as $aTask) {
foreach ($arrayTask as $theTask) {
//Check and fix if Task Id is complex
if (strpos($aTask['TAS_UID'], "/") !== false) {
$aux = explode("/", $aTask['TAS_UID']);
if (strpos($theTask['TAS_UID'], "/") !== false) {
$aux = explode("/", $theTask['TAS_UID']);
if (isset($aux[1])) {
$aTask['TAS_UID'] = $aux[1];
$theTask['TAS_UID'] = $aux[1];
}
}
//if the next is EOP dont send notification and continue with the next
if ($aTask['TAS_UID'] === '-1') {
if ($theTask['TAS_UID'] === '-1') {
continue;
}
if (isset($aTask['DEL_INDEX'])) {
if (isset($theTask['DEL_INDEX'])) {
$arrayData2 = $arrayData;
$appDelegation = AppDelegationPeer::retrieveByPK($dataLastEmail['applicationUid'], $aTask['DEL_INDEX']);
$appDelegation = AppDelegationPeer::retrieveByPK($dataLastEmail['applicationUid'], $theTask['DEL_INDEX']);
if (!is_null($appDelegation)) {
$oTaskUpd = new Task();
$aTaskUpdate = $oTaskUpd->load($appDelegation->getTasUid());
@@ -5646,25 +5646,25 @@ class Cases
$arrayData2 = $arrayData;
}
if (isset($aTask['USR_UID']) && !empty($aTask['USR_UID'])) {
if (isset($theTask['USR_UID']) && !empty($theTask['USR_UID'])) {
$user = new \ProcessMaker\BusinessModel\User();
$arrayUserData = $user->getUser($aTask['USR_UID'], true);
$arrayUserData = $user->getUser($theTask['USR_UID'], true);
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2,
(trim($arrayUserData['USR_TIME_ZONE']) != '') ? trim($arrayUserData['USR_TIME_ZONE']) :
\ProcessMaker\Util\System::getTimeZone());
} else {
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2);
}
$body2 = G::replaceDataGridField($dataLastEmail['body'], $arrayData2, false);
$body2 = G::replaceDataGridField($dataLastEmail['body'], $arrayData2, false, true);
$to = null;
$cc = '';
if ($aTask['TAS_UID'] != '-1') {
$respTo = $this->getTo($aTask['TAS_UID'], $aTask['USR_UID'], $arrayData);
if ($theTask['TAS_UID'] != '-1') {
$respTo = $this->getTo($theTask['TAS_UID'], $theTask['USR_UID'], $arrayData);
$to = $respTo['to'];
$cc = $respTo['cc'];
}
if ($aTask ["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
if ($theTask["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
if ($dataLastEmail['swtplDefault'] == 1) {
G::verifyPath($dataLastEmail['pathEmail'], true); // Create if it does not exist
$fileTemplate = $dataLastEmail['pathEmail'] . G::LoadTranslation('ID_UNASSIGNED_MESSAGE');

View File

@@ -4,6 +4,7 @@ use ProcessMaker\Core\System;
use ProcessMaker\BusinessModel\DynaForm\SuggestTrait;
use ProcessMaker\BusinessModel\Cases;
use ProcessMaker\BusinessModel\DynaForm\ValidatorFactory;
use ProcessMaker\Model\Dynaform as ModelDynaform;
/**
* Implementing pmDynaform library in the running case.
@@ -78,6 +79,14 @@ class PmDynaform
return $titleDynaform;
}
/**
* Get a dynaform.
* @return array|null
* @see ConsolidatedCases->processConsolidated()
* @see workflow/engine/methods/cases/caseConsolidated.php
* @see ProcessMaker\BusinessModel\Cases->getCaseVariables()
* @see PmDynaform->__construct()
*/
public function getDynaform()
{
if (!isset($this->fields["CURRENT_DYNAFORM"])) {
@@ -86,22 +95,21 @@ class PmDynaform
if ($this->record != null) {
return $this->record;
}
$a = new Criteria("workflow");
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
$a->addSelectColumn(DynaformPeer::DYN_LABEL);
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
$a->addSelectColumn(DynaformPeer::PRO_UID);
$a->addSelectColumn(DynaformPeer::DYN_UID);
$a->add(DynaformPeer::DYN_UID, $this->fields["CURRENT_DYNAFORM"], Criteria::EQUAL);
$ds = DynaformPeer::doSelectRS($a);
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$ds->next();
$row = $ds->getRow();
$this->record = isset($row) ? $row : null;
$this->langs = ($this->record["DYN_LABEL"] !== "" && $this->record["DYN_LABEL"] !== null) ? G::json_decode($this->record["DYN_LABEL"]) : null;
$dynaform = ModelDynaform::getByDynUid($this->fields["CURRENT_DYNAFORM"]);
if (empty($dynaform)) {
$this->langs = null;
return null;
}
$this->langs = empty($dynaform->DYN_LABEL) ? null : G::json_decode($dynaform->DYN_LABEL);
$this->record = (array) $dynaform;
return $this->record;
}
/**
* Get all dynaforms except this dynaform, related to process.
* @return array
* @see PmDynaform->__construct()
*/
public function getDynaforms()
{
if ($this->record === null) {
@@ -110,21 +118,11 @@ class PmDynaform
if ($this->records != null) {
return $this->records;
}
$a = new Criteria("workflow");
$a->addSelectColumn(DynaformPeer::DYN_UPDATE_DATE);
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
$a->addSelectColumn(DynaformPeer::DYN_LABEL);
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
$a->addSelectColumn(DynaformPeer::PRO_UID);
$a->addSelectColumn(DynaformPeer::DYN_UID);
$a->add(DynaformPeer::PRO_UID, $this->record["PRO_UID"], Criteria::EQUAL);
$a->add(DynaformPeer::DYN_UID, $this->record["DYN_UID"], Criteria::NOT_EQUAL);
$ds = DynaformPeer::doSelectRS($a);
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$this->records = array();
while ($ds->next()) {
array_push($this->records, $ds->getRow());
}
$result = ModelDynaform::getByProUidExceptDynUid($this->record["PRO_UID"], $this->record["DYN_UID"]);
$result->transform(function($item) {
return (array) $item;
});
$this->records = $result->toArray();
return $this->records;
}
@@ -1562,19 +1560,27 @@ class PmDynaform
}
}
/**
* Verify the use of the variable in all the forms of the process.
*
* @param string $processUid
* @param string $variable
* @return boolean | string
*
* @see ProcessMaker\BusinessModel\Variable->delete()
* @link https://wiki.processmaker.com/3.2/Variables#Managing_Variables
*/
public function isUsed($processUid, $variable)
{
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(DynaformPeer::DYN_UID);
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
$criteria->add(DynaformPeer::PRO_UID, $processUid, Criteria::EQUAL);
$rsCriteria = DynaformPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$aRow = $rsCriteria->getRow();
$json = G::json_decode($aRow['DYN_CONTENT']);
$result = ModelDynaform::getByProUid($processUid);
if (empty($result)) {
return false;
}
foreach ($result as $row) {
$dynaform = new PmDynaform(["CURRENT_DYNAFORM" => $row->DYN_UID]);
$json = G::json_decode($dynaform->record["DYN_CONTENT"]);
if ($this->jsoni($json, $variable)) {
return $aRow['DYN_UID'];
return $row->DYN_UID;
}
}
return false;

View File

@@ -1,7 +1,10 @@
<?php
use Illuminate\Support\Facades\DB;
use ProcessMaker\Model\Application;
/**
* ReportTables - Report tables
* Report Tables
*/
class ReportTables
{
@@ -184,218 +187,188 @@ class ReportTables
* This Function fills the table
*
* @access public
*
* @param string $sTableName Table name
* @param string $sConnection Connection name
* @param string $sType
* @param array $aFields
* @param string $sProcessUid
* @param string $sGrid
*
* @param string $tableName Table name
* @param string $connectionShortName Connection name
* @param string $type
* @param array $fields
* @param string $proUid
* @param string $grid
* @see ConsolidatedCases->processConsolidated()
* @see Processes->createReportTables()
* @see workflow/engine/methods/cases/caseConsolidated.php
* @see workflow/engine/methods/processes/consolidated.php ajax_con->con_save_properties()
* @see workflow/engine/methods/reportTables/reportTables_Save.php
* @link https://wiki.processmaker.com/3.0/Report_Tables
* @return void
*/
public function populateTable(
$sTableName,
$sConnection = 'report',
$sType = 'NORMAL',
$aFields = array(),
$sProcessUid = '',
$sGrid = ''
)
public function populateTable($tableName, $connectionShortName = 'report', $type = 'NORMAL', $fields = [], $proUid = '', $grid = '')
{
$sTableName = $this->sPrefix . $sTableName;
$tableName = $this->sPrefix . $tableName;
//we have to do the propel connection
$PropelDatabase = $this->chooseDB($sConnection);
$con = Propel::getConnection($PropelDatabase);
$stmt = $con->createStatement();
if ($sType == 'GRID') {
$aAux = explode('-', $sGrid);
$sGrid = $aAux[0];
$database = $this->chooseDB($connectionShortName);
$connection = Propel::getConnection($database);
$statement = $connection->createStatement();
if ($type == 'GRID') {
$aux = explode('-', $grid);
$grid = $aux[0];
}
$case = new Cases();
try {
switch (DB_ADAPTER) {
case 'mysql':
//select cases for this Process, ordered by APP_NUMBER
$oCriteria = new Criteria('workflow');
$oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUid);
$oCriteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
$oDataset = ApplicationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aData = unserialize($aRow['APP_DATA']);
//delete previous record from this report table ( previous records in case this is a grid )
$deleteSql = 'DELETE FROM `' . $sTableName . "` WHERE APP_UID = '" . $aRow['APP_UID'] . "'";
$rsDel = $stmt->executeQuery($deleteSql);
if ($sType == 'NORMAL') {
$sQuery = 'INSERT INTO `' . $sTableName . '` (';
$sQuery .= '`APP_UID`,`APP_NUMBER`';
foreach ($aFields as $aField) {
$sQuery .= ',`' . $aField['sFieldName'] . '`';
$applications = Application::getByProUid($proUid);
foreach ($applications as $application) {
$appData = $case->unserializeData($application->APP_DATA);
DB::delete("DELETE FROM `{$tableName}` WHERE APP_UID = '{$application->APP_UID}'");
if ($type == 'NORMAL') {
$query = 'INSERT INTO `' . $tableName . '` (';
$query .= '`APP_UID`,`APP_NUMBER`';
foreach ($fields as $field) {
$query .= ',`' . $field['sFieldName'] . '`';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'];
foreach ($aFields as $aField) {
switch ($aField['sType']) {
$query .= ") VALUES ('" . $application->APP_UID . "'," . $application->APP_NUMBER;
foreach ($fields as $field) {
switch ($field['sType']) {
case 'number':
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(
',',
'',
$aData[$aField['sFieldName']]
) : '0');
$query .= ',' . (isset($appData[$field['sFieldName']]) ? (float) str_replace(',', '', $appData[$field['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (!isset($aData[$aField['sFieldName']])) {
$aData[$aField['sFieldName']] = '';
if (!isset($appData[$field['sFieldName']])) {
$appData[$field['sFieldName']] = '';
}
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysqli_real_escape_string(
$con->getResource(),
$aData[$aField['sFieldName']]
) : '') . "'";
$string = $appData[$field['sFieldName']];
if (is_array($string)) {
$string = implode($string, ",");
}
$query .= ",'" . (isset($appData[$field['sFieldName']]) ? mysqli_real_escape_string($connection->getResource(), $string) : '') . "'";
break;
case 'date':
$value = (isset($aData[$aField['sFieldName']]) && trim($aData[$aField['sFieldName']])) != '' ? "'" . $aData[$aField['sFieldName']] . "'" : 'NULL';
$sQuery .= "," . $value;
$value = (isset($appData[$field['sFieldName']]) && trim($appData[$field['sFieldName']])) != '' ? "'" . $appData[$field['sFieldName']] . "'" : 'NULL';
$query .= "," . $value;
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery($sQuery);
$query .= ')';
DB::insert($query);
} else {
if (isset($aData[$sGrid])) {
foreach ($aData[$sGrid] as $iRow => $aGridRow) {
$sQuery = 'INSERT INTO `' . $sTableName . '` (';
$sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`';
foreach ($aFields as $aField) {
$sQuery .= ',`' . $aField['sFieldName'] . '`';
if (isset($appData[$grid])) {
foreach ($appData[$grid] as $indexRow => $gridRow) {
$query = 'INSERT INTO `' . $tableName . '` (';
$query .= '`APP_UID`,`APP_NUMBER`,`ROW`';
foreach ($fields as $field) {
$query .= ',`' . $field['sFieldName'] . '`';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'] . ',' . $iRow;
foreach ($aFields as $aField) {
switch ($aField['sType']) {
$query .= ") VALUES ('" . $application->APP_UID . "'," . (int) $application->APP_NUMBER . ',' . $indexRow;
foreach ($fields as $field) {
switch ($field['sType']) {
case 'number':
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(
',',
'',
$aGridRow[$aField['sFieldName']]
) : '0');
$query .= ',' . (isset($gridRow[$field['sFieldName']]) ? (float) str_replace(',', '', $gridRow[$field['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (!isset($aGridRow[$aField['sFieldName']])) {
$aGridRow[$aField['sFieldName']] = '';
if (!isset($gridRow[$field['sFieldName']])) {
$gridRow[$field['sFieldName']] = '';
}
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysqli_real_escape_string(
$con->getResource(),
$aGridRow[$aField['sFieldName']]
) : '') . "'";
$stringEscape = mysqli_real_escape_string($connection->getResource(), $gridRow[$field['sFieldName']]);
$query .= ",'" . (isset($gridRow[$field['sFieldName']]) ? $stringEscape : '') . "'";
break;
case 'date':
$value = (isset($aGridRow[$aField['sFieldName']]) && trim($aGridRow[$aField['sFieldName']])) != '' ? "'" . $aGridRow[$aField['sFieldName']] . "'" : 'NULL';
$sQuery .= "," . $value;
$value = (isset($gridRow[$field['sFieldName']]) && trim($gridRow[$field['sFieldName']])) != '' ? "'" . $gridRow[$field['sFieldName']] . "'" : 'NULL';
$query .= "," . $value;
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery($sQuery);
$query .= ')';
DB::insert($query);
}
}
}
$oDataset->next();
}
break;
/**
* For SQLServer code
* Note: It is only possible to create Report Tables in MySQL databases. The list will only show connections to those databases even if the project has connections to other DBMS.
* This section is not used and has been marked for deletion.
* @link https://wiki.processmaker.com/3.0/Report_Tables#Creating_Report_Tables
* @deprecated
*/
case 'mssql':
$oCriteria = new Criteria('workflow');
$oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUid);
$oCriteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
$oDataset = ApplicationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aData = unserialize($aRow['APP_DATA']);
$criteria = new Criteria('workflow');
$criteria->add(ApplicationPeer::PRO_UID, $proUid);
$criteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER);
$dataset = ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
while ($row = $dataset->getRow()) {
$appData = unserialize($row['APP_DATA']);
//verify use mssql
mysqli_query(
$con->getResource(),
'DELETE FROM [' . $sTableName . "] WHERE APP_UID = '" . $aRow['APP_UID'] . "'"
$connection->getResource(), 'DELETE FROM [' . $tableName . "] WHERE APP_UID = '" . $row['APP_UID'] . "'"
);
if ($sType == 'NORMAL') {
$sQuery = 'INSERT INTO [' . $sTableName . '] (';
$sQuery .= '[APP_UID],[APP_NUMBER]';
foreach ($aFields as $aField) {
$sQuery .= ',[' . $aField['sFieldName'] . ']';
if ($type == 'NORMAL') {
$query = 'INSERT INTO [' . $tableName . '] (';
$query .= '[APP_UID],[APP_NUMBER]';
foreach ($fields as $field) {
$query .= ',[' . $field['sFieldName'] . ']';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'];
foreach ($aFields as $aField) {
switch ($aField['sType']) {
$query .= ") VALUES ('" . $row['APP_UID'] . "'," . (int) $row['APP_NUMBER'];
foreach ($fields as $field) {
switch ($field['sType']) {
case 'number':
$sQuery .= ',' . (isset($aData[$aField['sFieldName']]) ? (float)str_replace(
',',
'',
$aData[$aField['sFieldName']]
) : '0');
$query .= ',' . (isset($appData[$field['sFieldName']]) ? (float) str_replace(',', '', $appData[$field['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (!isset($aData[$aField['sFieldName']])) {
$aData[$aField['sFieldName']] = '';
if (!isset($appData[$field['sFieldName']])) {
$appData[$field['sFieldName']] = '';
}
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? mysqli_real_escape_string(
$con->getResource(),
$aData[$aField['sFieldName']]
) : '') . "'";
$stringEscape = mysqli_real_escape_string($connection->getResource(), $appData[$field['sFieldName']]);
$query .= ",'" . (isset($appData[$field['sFieldName']]) ? $stringEscape : '') . "'";
break;
case 'date':
$sQuery .= ",'" . (isset($aData[$aField['sFieldName']]) ? $aData[$aField['sFieldName']] : '') . "'";
$query .= ",'" . (isset($appData[$field['sFieldName']]) ? $appData[$field['sFieldName']] : '') . "'";
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery($sQuery);
$query .= ')';
$rs = $statement->executeQuery($query);
} else {
if (isset($aData[$sGrid])) {
foreach ($aData[$sGrid] as $iRow => $aGridRow) {
$sQuery = 'INSERT INTO [' . $sTableName . '] (';
$sQuery .= '`APP_UID`,`APP_NUMBER`,`ROW`';
foreach ($aFields as $aField) {
$sQuery .= ',[' . $aField['sFieldName'] . ']';
if (isset($appData[$grid])) {
foreach ($appData[$grid] as $indexRow => $gridRow) {
$query = 'INSERT INTO [' . $tableName . '] (';
$query .= '`APP_UID`,`APP_NUMBER`,`ROW`';
foreach ($fields as $field) {
$query .= ',[' . $field['sFieldName'] . ']';
}
$sQuery .= ") VALUES ('" . $aRow['APP_UID'] . "'," . (int)$aRow['APP_NUMBER'] . ',' . $iRow;
foreach ($aFields as $aField) {
switch ($aField['sType']) {
$query .= ") VALUES ('" . $row['APP_UID'] . "'," . (int) $row['APP_NUMBER'] . ',' . $indexRow;
foreach ($fields as $field) {
switch ($field['sType']) {
case 'number':
$sQuery .= ',' . (isset($aGridRow[$aField['sFieldName']]) ? (float)str_replace(
',',
'',
$aGridRow[$aField['sFieldName']]
) : '0');
$query .= ',' . (isset($gridRow[$field['sFieldName']]) ? (float) str_replace(',', '', $gridRow[$field['sFieldName']]) : '0');
break;
case 'char':
case 'text':
if (!isset($aGridRow[$aField['sFieldName']])) {
$aGridRow[$aField['sFieldName']] = '';
if (!isset($gridRow[$field['sFieldName']])) {
$gridRow[$field['sFieldName']] = '';
}
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? mysqli_real_escape_string(
$con->getResource(),
$aGridRow[$aField['sFieldName']]
) : '') . "'";
$stringEscape = mysqli_real_escape_string($connection->getResource(), $gridRow[$field['sFieldName']]);
$query .= ",'" . (isset($gridRow[$field['sFieldName']]) ? $stringEscape : '') . "'";
break;
case 'date':
$sQuery .= ",'" . (isset($aGridRow[$aField['sFieldName']]) ? $aGridRow[$aField['sFieldName']] : '') . "'";
$query .= ",'" . (isset($gridRow[$field['sFieldName']]) ? $gridRow[$field['sFieldName']] : '') . "'";
break;
}
}
$sQuery .= ')';
$rs = $stmt->executeQuery($sQuery);
$query .= ')';
$rs = $statement->executeQuery($query);
}
}
}
$oDataset->next();
$dataset->next();
}
break;
}
} catch (Exception $oError) {
throw ($oError);

View File

@@ -991,7 +991,7 @@ class WsBase
$subject,
G::buildFrom($setup, $from),
$to,
G::replaceDataGridField(file_get_contents($fileTemplate), $fieldsCase, false),
G::replaceDataGridField(file_get_contents($fileTemplate), $fieldsCase, false, true),
$cc,
$bcc,
'',

View File

@@ -508,20 +508,29 @@ class OutputDocument extends BaseOutputDocument
}
}
/*
/**
* Generate the output document
* @param string $sUID
* @param array $aFields
* @param string $sPath
* @return variant
*
* @param string $outDocUid
* @param array $caseFields
* @param string $path
* @param string $filename
* @param string $content
* @param bool $landscape
* @param string $typeDocsToGen
* @param array $properties
*
* @return mixed
*
* @see workflow/engine/methods/cases/cases_Step.php
* @see workflow/engine/classes/class.pmFunctions.php:PMFGenerateOutputDocument()
*/
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array())
public function generate($outDocUid, $caseFields, $path, $filename, $content, $landscape = false, $typeDocsToGen = 'BOTH', $properties = [])
{
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
$sContent = G::replaceDataGridField($sContent, $aFields);
if (($outDocUid != '') && is_array($caseFields) && ($path != '')) {
$content = G::replaceDataGridField($content, $caseFields, true, true);
if (strpos($sContent, '<!---{') !== false) {
if (strpos($content, '<!---{') !== false) {
$template = new Smarty();
$template->compile_dir = PATH_SMARTY_C;
$template->cache_dir = PATH_SMARTY_CACHE;
@@ -529,20 +538,20 @@ class OutputDocument extends BaseOutputDocument
$template->caching = false;
$template->left_delimiter = '<!---{';
$template->right_delimiter = '}--->';
$oFile = fopen($sPath . $sFilename . '_smarty.html', 'wb');
fwrite($oFile, $sContent);
fclose($oFile);
$template->templateFile = $sPath . $sFilename . '_smarty.html';
$fp = fopen($path . $filename . '_smarty.html', 'wb');
fwrite($fp, $content);
fclose($fp);
$template->templateFile = $path . $filename . '_smarty.html';
//assign the variables and use the template $template
$template->assign($aFields);
$sContent = $template->fetch($template->templateFile);
$template->assign($caseFields);
$content = $template->fetch($template->templateFile);
unlink($template->templateFile);
}
G::verifyPath($sPath, true);
G::verifyPath($path, true);
//Start - Create .doc
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
$fp = fopen($path . $filename . '.doc', 'wb');
$size = [];
$size["Letter"] = "216mm 279mm";
@@ -566,6 +575,7 @@ class OutputDocument extends BaseOutputDocument
$size["Screenshot800"] = "800mm 600mm";
$size["Screenshot1024"] = "1024mm 768mm";
$sizeLandscape = [];
$sizeLandscape["Letter"] = "279mm 216mm";
$sizeLandscape["Legal"] = "357mm 216mm";
$sizeLandscape["Executive"] = "267mm 184mm";
@@ -587,41 +597,41 @@ class OutputDocument extends BaseOutputDocument
$sizeLandscape["Screenshot800"] = "600mm 800mm";
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
if (!isset($aProperties['media'])) {
$aProperties['media'] = 'Letter';
if (!isset($properties['media'])) {
$properties['media'] = 'Letter';
}
if ($sLandscape) {
$media = $sizeLandscape[$aProperties['media']];
if ($landscape) {
$media = $sizeLandscape[$properties['media']];
} else {
$media = $size[$aProperties['media']];
$media = $size[$properties['media']];
}
$marginLeft = '15';
if (isset($aProperties['margins']['left'])) {
$marginLeft = $aProperties['margins']['left'];
if (isset($properties['margins']['left'])) {
$marginLeft = $properties['margins']['left'];
}
$marginRight = '15';
if (isset($aProperties['margins']['right'])) {
$marginRight = $aProperties['margins']['right'];
if (isset($properties['margins']['right'])) {
$marginRight = $properties['margins']['right'];
}
$marginTop = '15';
if (isset($aProperties['margins']['top'])) {
$marginTop = $aProperties['margins']['top'];
if (isset($properties['margins']['top'])) {
$marginTop = $properties['margins']['top'];
}
$marginBottom = '15';
if (isset($aProperties['margins']['bottom'])) {
$marginBottom = $aProperties['margins']['bottom'];
if (isset($properties['margins']['bottom'])) {
$marginBottom = $properties['margins']['bottom'];
}
fwrite($oFile, '<html xmlns:v="urn:schemas-microsoft-com:vml"
fwrite($fp, '<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
@@ -667,31 +677,31 @@ class OutputDocument extends BaseOutputDocument
<body>
<div class=WordSection1>');
fwrite($oFile, $sContent);
fwrite($oFile, "\n</div></body></html>\n\n");
fclose($oFile);
fwrite($fp, $content);
fwrite($fp, "\n</div></body></html>\n\n");
fclose($fp);
/* End - Create .doc */
if ($sTypeDocToGener == 'BOTH' || $sTypeDocToGener == 'PDF') {
$oFile = fopen($sPath . $sFilename . '.html', 'wb');
fwrite($oFile, $sContent);
fclose($oFile);
if ($typeDocsToGen == 'BOTH' || $typeDocsToGen == 'PDF') {
$fp = fopen($path . $filename . '.html', 'wb');
fwrite($fp, $content);
fclose($fp);
/* Start - Create .pdf */
if (isset($aProperties['report_generator'])) {
switch ($aProperties['report_generator']) {
if (isset($properties['report_generator'])) {
switch ($properties['report_generator']) {
case 'TCPDF':
$this->generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
$this->generateTcpdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
break;
case 'HTML2PDF':
default:
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
break;
}
} else {
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
}
}
//end if $sTypeDocToGener
//end if $typeDocsToGen
/* End - Create .pdf */
} else {
return PEAR::raiseError(

View File

@@ -1,6 +1,6 @@
;Setting Android
android[url] = "https://android.googleapis.com/gcm/send"
android[serverApiKey] = "AIzaSyALwyLUYtZDcJQr54V5rxhZjoWnOLWCSvc"
android[url] = "https://fcm.googleapis.com/fcm/send"
android[serverApiKey] = "AAAAMvip2iU:APA91bHFAvHmCsSh0zbRaC9Xo2EPIbbRYzehkFAKUdXmj_ZVBOOO52npae183LYUONHjNPHaKo1MqT4BWiEuTF7HVEMfwn05XOA-h1LQ_bJ0ezAA35l-wADPq5VtKDiHT1VFGW1oeU7L"
;Setting Apple
apple[url] = "ssl://gateway.push.apple.com:2195"

View File

@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ProcessMaker (Branch 3.3.1)\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2018-11-23 20:16:26\n"
"PO-Revision-Date: 2019-05-20 19:36:15\n"
"Last-Translator: \n"
"Language-Team: Colosa Developers Team <developers@colosa.com>\n"
"MIME-Version: 1.0\n"
@@ -23039,6 +23039,18 @@ msgstr "Rules and user groups"
msgid "It sends a request to Sales Department, do you want to continue?"
msgstr "It sends a request to Sales Department, do you want to continue?"
# TRANSLATION
# LABEL/ID_SAML_ENABLE
#: LABEL/ID_SAML_ENABLE
msgid "SAML Authentication Enable"
msgstr "SAML Authentication Enable"
# TRANSLATION
# LABEL/ID_SAML_PROVIDER
#: LABEL/ID_SAML_PROVIDER
msgid "SAML Authentication Provider"
msgstr "SAML Authentication Provider"
# TRANSLATION
# LABEL/ID_SAMPLES
#: LABEL/ID_SAMPLES
@@ -23261,6 +23273,36 @@ msgstr "Username"
msgid "Search XML metadata"
msgstr "Search XML metadata"
# TRANSLATION
# LABEL/ID_SEARCHING
#: LABEL/ID_SEARCHING
msgid "Searching..."
msgstr "Searching..."
# TRANSLATION
# LABEL/ID_SEARCHING_CANCEL_MESSAGE
#: LABEL/ID_SEARCHING_CANCEL_MESSAGE
msgid "We are still gathering your search results. This may take a while based on your search criteria. You may cancel this search at any time"
msgstr "We are still gathering your search results. This may take a while based on your search criteria. You may cancel this search at any time"
# TRANSLATION
# LABEL/ID_SEARCHING_TIME_OUT
#: LABEL/ID_SEARCHING_TIME_OUT
msgid "Your search timed out"
msgstr "Your search timed out"
# TRANSLATION
# LABEL/ID_SEARCHING_UNEXPECTED_ERROR
#: LABEL/ID_SEARCHING_UNEXPECTED_ERROR
msgid "An unexpected error occurred while searching for your results. Error Code {0} and Please contact your administrator."
msgstr "An unexpected error occurred while searching for your results. Error Code {0} and Please contact your administrator."
# TRANSLATION
# LABEL/ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT
#: LABEL/ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT
msgid "An unexpected error occurred while searching for your results. Please contact your administrator."
msgstr "An unexpected error occurred while searching for your results. Please contact your administrator."
# TRANSLATION
# LABEL/ID_SECOND
#: LABEL/ID_SECOND

View File

@@ -11,8 +11,9 @@ use ProcessMaker\Core\System;
use ProcessMaker\Validation\ExceptionRestApi;
use ProcessMaker\Validation\ValidationUploadedFiles;
header("Content-type: text/html;charset=utf-8");
require_once 'classes/model/AdditionalTables.php';
//We need to suppress the error for the unittest that use this function
@header("Content-type: text/html;charset=utf-8");
class pmTablesProxy extends HttpProxyController
{
@@ -404,7 +405,6 @@ class pmTablesProxy extends HttpProxyController
$this->className = $table['ADD_TAB_CLASS_NAME'];
$this->classPeerName = $this->className . 'Peer';
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
if (! file_exists( $sPath . $this->className . '.php' )) {
throw new Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className ) );
}
@@ -427,7 +427,6 @@ class pmTablesProxy extends HttpProxyController
if ($result) {
G::auditLog("UpdateDataPmtable", "Table Name: ".$table['ADD_TAB_NAME']." Table ID: (".$table['ADD_TAB_UID'].") ");
}
$this->success = $result;
$this->message = $result ? G::loadTranslation( 'ID_UPDATED_SUCCESSFULLY' ) : G::loadTranslation( 'ID_UPDATE_FAILED' );
}
@@ -1094,32 +1093,38 @@ class pmTablesProxy extends HttpProxyController
/**
* Update data from a addTable record
*
* @param $row
* @param array $row
* @param array $primaryKeys
* @return boolean
* @throws Exception
*
* @see workflow/engine/controllers/pmTablesProxy::dataUpdate()
* @link https://wiki.processmaker.com/3.2/PM_Tables
*/
public function _dataUpdate ($row, $primaryKeys)
public function _dataUpdate($row, $primaryKeys)
{
$keys = G::decrypt( $row['__index__'], 'pmtable' );
$keys = explode( ',', $keys );
unset( $row['__index__'] );
$keys = G::decrypt($row['__index__'], 'pmtable');
$keys = explode(',', $keys);
unset($row['__index__']);
$params = array ();
$params = [];
foreach ($keys as $key) {
$params[] = is_numeric( $key ) ? $key : "'$key'";
$params[] = is_int($key) ? (int)$key : (string)$key;
}
$obj = null;
eval( '$obj = ' . $this->classPeerName . '::retrieveByPk(' . implode( ',', $params ) . ');' );
if (is_object( $obj )) {
$className = $this->classPeerName;
$obj = call_user_func_array($className . "::retrieveByPk", $params);
if (is_object($obj)) {
foreach ($row as $key => $value) {
// validation, don't modify primary keys
if (in_array( $key, $primaryKeys )) {
throw new Exception( G::loadTranslation( 'ID_DONT_MODIFY_PK_VALUE', array ($key
) ) );
if (in_array($key, $primaryKeys)) {
throw new Exception(G::loadTranslation('ID_DONT_MODIFY_PK_VALUE', [
$key
]));
}
$action = 'set' . AdditionalTables::getPHPName( $key );
$obj->$action( $value );
$action = 'set' . AdditionalTables::getPHPName($key);
$obj->$action($value);
}
if ($r = $obj->validate()) {
$obj->save();
@@ -1129,7 +1134,7 @@ class pmTablesProxy extends HttpProxyController
foreach ($obj->getValidationFailures() as $objValidationFailure) {
$msg .= $objValidationFailure->getMessage() . "\n";
}
throw new Exception( $msg );
throw new Exception($msg);
}
} else {
$result = false;
@@ -1141,22 +1146,25 @@ class pmTablesProxy extends HttpProxyController
/**
* Update data from a addTable record
*
* @param $row
* @param array $row
* @return boolean
* @see workflow/engine/controllers/pmTablesProxy::dataDestroy()
* @link https://wiki.processmaker.com/3.2/PM_Tables
*/
public function _dataDestroy ($row)
public function _dataDestroy($row)
{
$row = G::decrypt( $row, 'pmtable' );
$row = str_replace( '"', '', $row );
$keys = explode( ',', $row );
$params = array ();
$row = G::decrypt($row, 'pmtable');
$row = str_replace('"', '', $row);
$keys = explode(',', $row);
$params = [];
foreach ($keys as $key) {
$params[] = is_numeric( $key ) ? $key : "'$key'";
$params[] = is_int($key) ? (int)$key : (string)$key;
}
$obj = null;
eval( '$obj = ' . $this->classPeerName . '::retrieveByPk(' . implode( ',', $params ) . ');' );
$className = $this->classPeerName;
$obj = call_user_func_array($className . "::retrieveByPk", $params);
if (is_object( $obj )) {
if (is_object($obj)) {
$obj->delete();
return true;
} else {

View File

@@ -60723,6 +60723,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_RT_RENAME_NAME_TABLE','en','All references to the previous table name are going to be invalid. Do you really want to change the table name?','2016-06-29') ,
( 'LABEL','ID_RULES_AND_USER_GROUPS','en','Rules and user groups','2014-01-15') ,
( 'LABEL','ID_SALES_DEPARTMENT_REQUEST','en','It sends a request to Sales Department, do you want to continue?','2014-10-21') ,
( 'LABEL','ID_SAML_ENABLE','en','SAML Authentication Enable','2019-05-20') ,
( 'LABEL','ID_SAML_PROVIDER','en','SAML Authentication Provider','2019-05-20') ,
( 'LABEL','ID_SAMPLES','en','Samples','2014-01-15') ,
( 'LABEL','ID_SAT','en','Sat','2014-01-15') ,
( 'LABEL','ID_SAVE','en','Save','2014-01-15') ,
@@ -60762,6 +60764,11 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_SEARCH_RESULT','en','Search results','2014-01-15') ,
( 'LABEL','ID_SEARCH_USER','en','Username','2014-01-15') ,
( 'LABEL','ID_SEARCH_XML_METADATA','en','Search XML metadata','2014-01-15') ,
( 'LABEL','ID_SEARCHING','en','Searching...','2019-05-03') ,
( 'LABEL','ID_SEARCHING_CANCEL_MESSAGE','en','We are still gathering your search results. This may take a while based on your search criteria. You may cancel this search at any time','2019-05-03') ,
( 'LABEL','ID_SEARCHING_TIME_OUT','en','Your search timed out','2019-05-03') ,
( 'LABEL','ID_SEARCHING_UNEXPECTED_ERROR','en','An unexpected error occurred while searching for your results. Error Code {0} and Please contact your administrator.','2019-05-03') ,
( 'LABEL','ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT','en','An unexpected error occurred while searching for your results. Please contact your administrator.','2019-05-15') ,
( 'LABEL','ID_SECOND','en','Second','2014-01-15') ,
( 'LABEL','ID_SECONDS','en','Seconds','2014-01-15') ,
( 'LABEL','ID_SECOND_FIGURE','en','Second Graph','2015-03-09') ,

View File

@@ -1010,7 +1010,7 @@ try {
$aFields['TASK'][$sKey]['NEXT_TASK']['ROU_PREVIOUS_TYPE'] = '<input type="hidden" name="' . $hiddenName . '[ROU_PREVIOUS_TYPE]" id="' . $hiddenName . '[ROU_PREVIOUS_TYPE]" value="' . $aValues['NEXT_TASK']['ROU_PREVIOUS_TYPE'] . '">';
}
if (isset($aValues['ROU_CONDITION'])) {
$aFields['TASK'][$sKey]['NEXT_TASK']['ROU_CONDITION'] = '<input type="hidden" name="' . $hiddenName . '[ROU_CONDITION]" id="' . $hiddenName . '[ROU_CONDITION]" value="' . $aValues['ROU_CONDITION'] . '">';
$aFields['TASK'][$sKey]['NEXT_TASK']['ROU_CONDITION'] = '<input type="hidden" name="' . $hiddenName . '[ROU_CONDITION]" id="' . $hiddenName . '[ROU_CONDITION]" value="' . htmlentities($aValues['ROU_CONDITION'], ENT_QUOTES, 'UTF-8') . '">';
}
if (isset($aValues['SOURCE_UID'])) {
$aFields['TASK'][$sKey]['NEXT_TASK']['SOURCE_UID'] = '<input type="hidden" name="' . $hiddenName . '[SOURCE_UID]" id="' . $hiddenName . '[SOURCE_UID]" value="' . $aValues['SOURCE_UID'] . '">';

View File

@@ -1,4 +1,9 @@
<?php
use ProcessMaker\Model\Delegation;
/**
* Authentication check for session. If not logged in, return json error
*/
if (!isset($_SESSION['USER_LOGGED'])) {
$responseObject = new stdclass();
$responseObject->error = G::LoadTranslation('ID_LOGIN_AGAIN');
@@ -9,31 +14,59 @@ if (!isset($_SESSION['USER_LOGGED'])) {
}
/**
* Do input filtering, although filtering should be done on the frontend rendering, not here
*/
$filter = new InputFilter();
$_GET = $filter->xssFilterHard($_GET);
$_REQUEST = $filter->xssFilterHard($_REQUEST);
$_SESSION['USER_LOGGED'] = $filter->xssFilterHard($_SESSION['USER_LOGGED']);
//Getting the extJs parameters
// Callback in the UI to utilize
$callback = isset($_REQUEST["callback"]) ? $_REQUEST["callback"] : "stcCallback1001";
//This default value was defined in casesList.js
$dir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "DESC";
//This default value was defined in casesList.js
// Sort column
$sort = isset($_REQUEST["sort"]) ? $_REQUEST["sort"] : "APP_NUMBER";
// Sort direction
$dir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "DESC";
// Pagination control
$start = !empty($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
$limit = !empty($_REQUEST["limit"]) ? $_REQUEST["limit"] : 25;
// Our search filter
$filter = isset($_REQUEST["filter"]) ? $_REQUEST["filter"] : "";
// What process
$process = isset($_REQUEST["process"]) ? $_REQUEST["process"] : "";
// What category
$category = isset($_REQUEST["category"]) ? $_REQUEST["category"] : "";
// What status
$status = isset($_REQUEST["status"]) ? strtoupper($_REQUEST["status"]) : "";
$filterStatus = isset($_REQUEST["filterStatus"]) ? strtoupper($_REQUEST["filterStatus"]) : "";
// What user
$user = isset($_REQUEST["user"]) ? $_REQUEST["user"] : "";
// What keywords to search
$search = isset($_REQUEST["search"]) ? $_REQUEST["search"] : "";
// What kind of action
$action = isset($_GET["action"]) ? $_GET["action"] : (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "todo");
// What kind of search
$type = isset($_GET["type"]) ? $_GET["type"] : (isset($_REQUEST["type"]) ? $_REQUEST["type"] : "extjs");
// Date ranges
$dateFrom = isset($_REQUEST["dateFrom"]) ? substr($_REQUEST["dateFrom"], 0, 10) : "";
$dateTo = isset($_REQUEST["dateTo"]) ? substr($_REQUEST["dateTo"], 0, 10) : "";
// First? No idea
$first = isset($_REQUEST["first"]) ? true : false;
$openApplicationUid = (isset($_REQUEST['openApplicationUid']) && $_REQUEST['openApplicationUid'] != '') ?
$_REQUEST['openApplicationUid'] : null;
$search = (!is_null($openApplicationUid)) ? $openApplicationUid : $search;
@@ -67,10 +100,8 @@ try {
break;
}
$apps = new Applications();
if ($action == 'search') {
$data = $apps->searchAll(
$data = Delegation::search(
$userUid,
$start,
$limit,
@@ -85,7 +116,7 @@ try {
$columnSearch
);
} else {
$data = $apps->getAll(
$data = Delegation::search(
$userUid,
$start,
$limit,

View File

@@ -41,11 +41,11 @@ if (isset ($_POST['form']['USER_ENV'])) {
//Save session variables
$arraySession = array();
if (isset($_SESSION["G_MESSAGE"])) {
if (!empty($_SESSION['G_MESSAGE'])) {
$arraySession["G_MESSAGE"] = $_SESSION["G_MESSAGE"];
}
if (isset($_SESSION["G_MESSAGE_TYPE"])) {
if (!empty($_SESSION['G_MESSAGE_TYPE'])) {
$arraySession["G_MESSAGE_TYPE"] = $_SESSION["G_MESSAGE_TYPE"];
}

View File

@@ -172,7 +172,9 @@ class AuditLog
"GSuiteConnect" => G::LoadTranslation("ID_G_SUITE_CONNECT"),
"GSuiteDisconnect" => G::LoadTranslation("ID_G_SUITE_DISCONNECT"),
"GSuiteLoadGroups" => G::LoadTranslation("ID_G_SUITE_LOAD_GROUPS"),
"GSuiteSyncUsers" => G::LoadTranslation("ID_G_SUITE_SYNC_USERS")
"GSuiteSyncUsers" => G::LoadTranslation("ID_G_SUITE_SYNC_USERS"),
"SamlEnable" => G::LoadTranslation("ID_SAML_ENABLE"),
"SamlProvider" => G::LoadTranslation("ID_SAML_PROVIDER")
];
}

View File

@@ -39,6 +39,7 @@ use ProcessMaker\BusinessModel\Task as BmTask;
use ProcessMaker\BusinessModel\User as BmUser;
use ProcessMaker\Core\System;
use ProcessMaker\Exception\UploadException;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Services\OAuth2\Server;
use ProcessMaker\Util\DateTime as UtilDateTime;
@@ -2438,6 +2439,14 @@ class Cases
*
* @return array Return an array with status info Case, array empty otherwise
* @throws Exception
*
* @see workflow/engine/methods/cases/main_init.php
* @see workflow/engine/methods/cases/opencase.php
* @see ProcessMaker\BusinessModel\Cases->setCaseVariables()
* @see ProcessMaker\BusinessModel\Cases\InputDocument->getCasesInputDocuments()
* @see ProcessMaker\BusinessModel\Cases\InputDocument->throwExceptionIfHaventPermissionToDelete()
* @see ProcessMaker\BusinessModel\Cases\OutputDocument->throwExceptionIfCaseNotIsInInbox()
* @see ProcessMaker\BusinessModel\Cases\OutputDocument->throwExceptionIfHaventPermissionToDelete()
*/
public function getStatusInfo($applicationUid, $delIndex = 0, $userUid = "")
{
@@ -2598,19 +2607,7 @@ class Cases
}
//Status is PARTICIPATED
$criteria2 = clone $criteria;
$criteria2->setDistinct();
$criteria2->clearSelectColumns();
$criteria2->addSelectColumn($delimiter . 'PARTICIPATED' . $delimiter . ' AS APP_STATUS');
$criteria2->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$criteria2->addSelectColumn(ApplicationPeer::APP_UID);
$criteria2->addSelectColumn(ApplicationPeer::PRO_UID);
$rsCriteria2 = ApplicationPeer::doSelectRS($criteria2);
$rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria2);
$arrayData = Delegation::getParticipatedInfo($applicationUid);
if (!empty($arrayData)) {
return $arrayData;

View File

@@ -1,6 +1,9 @@
<?php
namespace ProcessMaker\BusinessModel\Cases;
use G;
use OutputDocument as ClassesOutputDocument;
use PEAR;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
@@ -592,21 +595,31 @@ class OutputDocument
}
}
/*
/**
* Generate the output document
* @param string $sUID
* @param array $aFields
* @param string $sPath
* @return variant
*
* @param string $outDocUid
* @param array $caseFields
* @param string $path
* @param string $filename
* @param string $content
* @param bool $landscape
* @param string $typeDocsToGen
* @param array $properties
* @param string $application
*
* @return mixed
*
* @see this->addCasesOutputDocument()
*/
public function generate($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape = false, $sTypeDocToGener = 'BOTH', $aProperties = array(), $sApplication)
public function generate($outDocUid, $caseFields, $path, $filename, $content, $landscape = false, $typeDocsToGen = 'BOTH', $properties = [], $application = '')
{
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
$sContent = \G::replaceDataGridField($sContent, $aFields);
\G::verifyPath($sPath, true);
if (($outDocUid != '') && is_array($caseFields) && ($path != '')) {
$content = G::replaceDataGridField($content, $caseFields, true, true);
G::verifyPath($path, true);
//Start - Create .doc
$oFile = fopen($sPath . $sFilename . '.doc', 'wb');
$size = array();
$fp = fopen($path . $filename . '.doc', 'wb');
$size = [];
$size["Letter"] = "216mm 279mm";
$size["Legal"] = "216mm 357mm";
$size["Executive"] = "184mm 267mm";
@@ -627,6 +640,7 @@ class OutputDocument
$size["Screenshot640"] = "640mm 480mm";
$size["Screenshot800"] = "800mm 600mm";
$size["Screenshot1024"] = "1024mm 768mm";
$sizeLandscape = [];
$sizeLandscape["Letter"] = "279mm 216mm";
$sizeLandscape["Legal"] = "357mm 216mm";
$sizeLandscape["Executive"] = "267mm 184mm";
@@ -647,31 +661,31 @@ class OutputDocument
$sizeLandscape["Screenshot640"] = "480mm 640mm";
$sizeLandscape["Screenshot800"] = "600mm 800mm";
$sizeLandscape["Screenshot1024"] = "768mm 1024mm";
if (!isset($aProperties['media'])) {
$aProperties['media'] = 'Letter';
if (!isset($properties['media'])) {
$properties['media'] = 'Letter';
}
if ($sLandscape) {
$media = $sizeLandscape[$aProperties['media']];
if ($landscape) {
$media = $sizeLandscape[$properties['media']];
} else {
$media = $size[$aProperties['media']];
$media = $size[$properties['media']];
}
$marginLeft = '15';
if (isset($aProperties['margins']['left'])) {
$marginLeft = $aProperties['margins']['left'];
if (isset($properties['margins']['left'])) {
$marginLeft = $properties['margins']['left'];
}
$marginRight = '15';
if (isset($aProperties['margins']['right'])) {
$marginRight = $aProperties['margins']['right'];
if (isset($properties['margins']['right'])) {
$marginRight = $properties['margins']['right'];
}
$marginTop = '15';
if (isset($aProperties['margins']['top'])) {
$marginTop = $aProperties['margins']['top'];
if (isset($properties['margins']['top'])) {
$marginTop = $properties['margins']['top'];
}
$marginBottom = '15';
if (isset($aProperties['margins']['bottom'])) {
$marginBottom = $aProperties['margins']['bottom'];
if (isset($properties['margins']['bottom'])) {
$marginBottom = $properties['margins']['bottom'];
}
fwrite($oFile, '<html xmlns:v="urn:schemas-microsoft-com:vml"
fwrite($fp, '<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
@@ -716,40 +730,40 @@ class OutputDocument
</head>
<body>
<div class=WordSection1>');
fwrite($oFile, $sContent);
fwrite($oFile, "\n</div></body></html>\n\n");
fclose($oFile);
fwrite($fp, $content);
fwrite($fp, "\n</div></body></html>\n\n");
fclose($fp);
/* End - Create .doc */
if ($sTypeDocToGener == 'BOTH' || $sTypeDocToGener == 'PDF') {
$oFile = fopen($sPath . $sFilename . '.html', 'wb');
fwrite($oFile, $sContent);
fclose($oFile);
if ($typeDocsToGen == 'BOTH' || $typeDocsToGen == 'PDF') {
$fp = fopen($path . $filename . '.html', 'wb');
fwrite($fp, $content);
fclose($fp);
/* Start - Create .pdf */
if (isset($aProperties['report_generator'])) {
switch ($aProperties['report_generator']) {
if (isset($properties['report_generator'])) {
switch ($properties['report_generator']) {
case 'TCPDF':
$o = new \OutputDocument();
if (strlen($sContent) == 0) {
$o = new ClassesOutputDocument();
if (strlen($content) == 0) {
libxml_use_internal_errors(true);
$o->generateTcpdf($sUID, $aFields, $sPath, $sFilename, ' ', $sLandscape, $aProperties);
$o->generateTcpdf($outDocUid, $caseFields, $path, $filename, ' ', $landscape, $properties);
libxml_use_internal_errors(false);
} else {
$o->generateTcpdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
$o->generateTcpdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
}
break;
case 'HTML2PDF':
default:
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties, $sApplication);
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties, $application);
break;
}
} else {
$this->generateHtml2ps_pdf($sUID, $aFields, $sPath, $sFilename, $sContent, $sLandscape, $aProperties);
$this->generateHtml2ps_pdf($outDocUid, $caseFields, $path, $filename, $content, $landscape, $properties);
}
}
//end if $sTypeDocToGener
//end if $typeDocsToGen
/* End - Create .pdf */
} else {
return \PEAR::raiseError(
return PEAR::raiseError(
null,
G_ERROR_USER_UID,
null,

View File

@@ -17,9 +17,9 @@ use ProcessMaker\Core\System;
class PushMessageAndroid
{
private $url = 'https://android.googleapis.com/gcm/send';
private $serverApiKey = "AIzaSyBO-VLXGhjf0PPlwmPFTPQEKIBfVDydLAk";
private $devices = array();
private $url = 'https://fcm.googleapis.com/fcm/send';
private $serverApiKey = "AAAAMvip2iU:APA91bHFAvHmCsSh0zbRaC9Xo2EPIbbRYzehkFAKUdXmj_ZVBOOO52npae183LYUONHjNPHaKo1MqT4BWiEuTF7HVEMfwn05XOA-h1LQ_bJ0ezAA35l-wADPq5VtKDiHT1VFGW1oeU7L";
private $devices = [];
private $numberDevices = 0;
/**
@@ -78,24 +78,24 @@ class PushMessageAndroid
}
if (!is_null($data)) {
$fields = array(
$fields = [
'registration_ids' => $this->devices,
'data' => array(
"message" => $message,
"data" => $data
),
);
'notification' => [
"body" => $message,
"data" => $data,
],
];
} else {
$fields = array(
$fields = [
'registration_ids' => $this->devices,
'data' => array("message" => $message),
);
'data' => ["message" => $message],
];
}
$headers = array(
$headers = [
'Authorization: key=' . $this->serverApiKey,
'Content-Type: application/json'
);
];
// Open connection
$ch = curl_init();

View File

@@ -0,0 +1,14 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class AppAssignSelfServiceValue extends Model
{
protected $table = 'APP_ASSIGN_SELF_SERVICE_VALUE';
protected $primaryKey = 'ID';
// We do not have create/update timestamps for this table
public $timestamps = false;
}

View File

@@ -0,0 +1,13 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class AppAssignSelfServiceValueGroup extends Model
{
protected $table = 'APP_ASSIGN_SELF_SERVICE_VALUE_GROUP';
// We do not have create/update timestamps for this table
public $timestamps = false;
}

View File

@@ -0,0 +1,55 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Application extends Model
{
protected $table = "APPLICATION";
// No timestamps
public $timestamps = false;
public function delegations()
{
return $this->hasMany(Delegation::class, 'APP_UID', 'APP_UID');
}
public function parent()
{
return $this->hasOne(Application::class, 'APP_PARENT', 'APP_UID');
}
public function currentUser()
{
return $this->hasOne(User::class, 'APP_CUR_USER', 'USR_UID');
}
/**
* Get Applications by PRO_UID, ordered by APP_NUMBER.
* @param string $proUid
* @return object
* @see ReportTables->populateTable()
*/
public static function getByProUid($proUid)
{
$query = Application::query()
->select()
->proUid($proUid)
->orderBy('APP_NUMBER', 'ASC');
return $query->get();
}
/**
* Scope for query to get the applications by PRO_UID.
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $proUid
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeProUid($query, $proUid)
{
$result = $query->where('PRO_UID', '=', $proUid);
return $result;
}
}

View File

@@ -0,0 +1,392 @@
<?php
namespace ProcessMaker\Model;
use G;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Delegation extends Model
{
protected $table = "APP_DELEGATION";
// We don't have our standard timestamp columns
public $timestamps = false;
/**
* Returns the application this delegation belongs to
*/
public function application()
{
return $this->belongsTo(Application::class, 'APP_UID', 'APP_UID');
}
/**
* Returns the user this delegation belongs to
*/
public function user()
{
return $this->belongsTo(User::class, 'USR_ID', 'USR_ID');
}
/**
* Return the process task this belongs to
*/
public function task()
{
return $this->belongsTo(Task::class, 'TAS_ID', 'TAS_ID');
}
/**
* Return the process this delegation belongs to
*/
public function process()
{
return $this->belongsTo(Process::class, 'PRO_ID', 'PRO_ID');
}
/**
* Scope a query to get the delegations from a case by APP_UID
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param string $appUid
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeAppUid($query, $appUid)
{
return $query->where('APP_UID', '=', $appUid);
}
/**
* Searches for delegations which match certain criteria
*
* The query is related to advanced search with different filters
* We can search by process, status of case, category of process, users, delegate date from and to
*
* @param integer $userId The USR_ID to search for (Note, this is no longer the USR_UID)
* @param integer $start for the pagination
* @param integer $limit for the pagination
* @param string $search
* @param integer $process the pro_id
* @param integer $status of the case
* @param string $dir if the order is DESC or ASC
* @param string $sort name of column by sort, can be:
* [APP_NUMBER, APP_TITLE, APP_PRO_TITLE, APP_TAS_TITLE, APP_CURRENT_USER, APP_UPDATE_DATE, DEL_DELEGATE_DATE, DEL_TASK_DUE_DATE, APP_STATUS_LABEL]
* @param string $category uid for the process
* @param date $dateFrom
* @param date $dateTo
* @param string $filterBy name of column for a specific search, can be: [APP_NUMBER, APP_TITLE, TAS_TITLE]
* @return array $result result of the query
*/
public static function search(
$userId = null,
// Default pagination values
$start = 0,
$limit = 25,
$search = null,
$process = null,
$status = null,
$dir = null,
$sort = null,
$category = null,
$dateFrom = null,
$dateTo = null,
$filterBy = 'APP_TITLE'
) {
$search = trim($search);
// Start the query builder, selecting our base attributes
$selectColumns = [
'APPLICATION.APP_NUMBER',
'APPLICATION.APP_UID',
'APPLICATION.APP_STATUS',
'APPLICATION.APP_STATUS AS APP_STATUS_LABEL',
'APPLICATION.PRO_UID',
'APPLICATION.APP_CREATE_DATE',
'APPLICATION.APP_FINISH_DATE',
'APPLICATION.APP_UPDATE_DATE',
'APPLICATION.APP_TITLE',
'APP_DELEGATION.USR_UID',
'APP_DELEGATION.TAS_UID',
'APP_DELEGATION.USR_ID',
'APP_DELEGATION.PRO_ID',
'APP_DELEGATION.DEL_INDEX',
'APP_DELEGATION.DEL_LAST_INDEX',
'APP_DELEGATION.DEL_DELEGATE_DATE',
'APP_DELEGATION.DEL_INIT_DATE',
'APP_DELEGATION.DEL_FINISH_DATE',
'APP_DELEGATION.DEL_TASK_DUE_DATE',
'APP_DELEGATION.DEL_RISK_DATE',
'APP_DELEGATION.DEL_THREAD_STATUS',
'APP_DELEGATION.DEL_PRIORITY',
'APP_DELEGATION.DEL_DURATION',
'APP_DELEGATION.DEL_QUEUE_DURATION',
'APP_DELEGATION.DEL_STARTED',
'APP_DELEGATION.DEL_DELAY_DURATION',
'APP_DELEGATION.DEL_FINISHED',
'APP_DELEGATION.DEL_DELAYED',
'APP_DELEGATION.DEL_DELAY_DURATION',
'TASK.TAS_TITLE AS APP_TAS_TITLE',
'TASK.TAS_TYPE AS APP_TAS_TYPE',
];
$query = DB::table('APP_DELEGATION')->select(DB::raw(implode(',', $selectColumns)));
// Add join for task, filtering for task title if needed
// It doesn't make sense for us to search for any delegations that match tasks that are events or web entry
$query->join('TASK', function ($join) use ($filterBy, $search) {
$join->on('APP_DELEGATION.TAS_ID', '=', 'TASK.TAS_ID')
->whereNotIn('TASK.TAS_TYPE', [
'WEBENTRYEVENT',
'END-MESSAGE-EVENT',
'START-MESSAGE-EVENT',
'INTERMEDIATE-THROW',
]);
if ($filterBy == 'TAS_TITLE' && $search) {
$join->where('TASK.TAS_TITLE', 'LIKE', "%${search}%");
}
});
// Add join for application, taking care of status and filtering if necessary
$query->join('APPLICATION', function ($join) use ($filterBy, $search, $status, $query) {
$join->on('APP_DELEGATION.APP_NUMBER', '=', 'APPLICATION.APP_NUMBER');
if ($filterBy == 'APP_TITLE' && $search) {
$join->where('APPLICATION.APP_TITLE', 'LIKE', "%${search}%");
}
// Based on the below, we can further limit the join so that we have a smaller data set based on join criteria
switch ($status) {
case 1: //DRAFT
$join->where('APPLICATION.APP_STATUS_ID', 1);
break;
case 2: //TO_DO
$join->where('APPLICATION.APP_STATUS_ID', 2);
break;
case 3: //COMPLETED
$join->where('APPLICATION.APP_STATUS_ID', 3);
break;
case 4: //CANCELLED
$join->where('APPLICATION.APP_STATUS_ID', 4);
break;
case "PAUSED":
$join->where('APPLICATION.APP_STATUS', 'TO_DO');
break;
default: //All status
// Don't do anything here, we'll need to do the more advanced where below
}
});
// Add join for process, but only for certain scenarios such as category or process
if ($category || $process || $sort == 'APP_PRO_TITLE') {
$query->join('PROCESS', function ($join) use ($category) {
$join->on('APP_DELEGATION.PRO_ID', '=', 'PROCESS.PRO_ID');
if ($category) {
$join->where('PROCESS.PRO_CATEGORY', $category);
}
});
}
// Add join for user, but only for certain scenarios as sorting
if ($sort == 'APP_CURRENT_USER') {
$query->join('USERS', function ($join) use ($userId) {
$join->on('APP_DELEGATION.USR_ID', '=', 'USERS.USR_ID');
});
}
// Search for specified user
if ($userId) {
$query->where('APP_DELEGATION.USR_ID', $userId);
}
// Search for specified process
if ($process) {
$query->where('APP_DELEGATION.PRO_ID', $process);
}
// Search for an app/case number
if ($filterBy == 'APP_NUMBER' && $search) {
$query->where('APP_DELEGATION.APP_NUMBER', 'LIKE', "%${search}%");
}
// Date range filter
if (!empty($dateFrom)) {
$query->where('APP_DELEGATION.DEL_DELEGATE_DATE', '>=', $dateFrom);
}
if (!empty($dateTo)) {
$dateTo = $dateTo . " 23:59:59";
// This is inclusive
$query->where('APP_DELEGATION.DEL_DELEGATE_DATE', '<=', $dateTo);
}
// Status Filter
// This is tricky, the below behavior is combined with the application join behavior above
switch ($status) {
case 1: //DRAFT
$query->where('APP_DELEGATION.DEL_THREAD_STATUS', 'OPEN');
break;
case 2: //TO_DO
$query->where('APP_DELEGATION.DEL_THREAD_STATUS', 'OPEN');
break;
case 3: //COMPLETED
$query->where('APP_DELEGATION.DEL_LAST_INDEX', 1);
break;
case 4: //CANCELLED
$query->where('APP_DELEGATION.DEL_LAST_INDEX', 1);
break;
case "PAUSED":
// Do nothing, as the app status check for TO_DO is performed in the join above
break;
default: //All statuses.
$query->where(function ($query) {
// Check to see if thread status is open
$query->where('APP_DELEGATION.DEL_THREAD_STATUS', 'OPEN')
->orWhere(function ($query) {
// Or, we make sure if the thread is closed, and it's the last delegation, and if the app is completed or cancelled
$query->where('APP_DELEGATION.DEL_THREAD_STATUS', 'CLOSED')
->where('APP_DELEGATION.DEL_LAST_INDEX', 1)
->whereIn('APPLICATION.APP_STATUS_ID', [3, 4]);
});
});
break;
}
// Add any sort if needed
if($sort) {
switch ($sort) {
case 'APP_NUMBER':
$query->orderBy('APP_DELEGATION.APP_NUMBER', $dir);
break;
case 'APP_PRO_TITLE':
// We can do this because we joined the process table if sorting by it
$query->orderBy('PROCESS.PRO_TITLE', $dir);
break;
case 'APP_TAS_TITLE':
$query->orderBy('TASK.TAS_TITLE', $dir);
break;
case 'APP_CURRENT_USER':
// We can do this because we joined the user table if sorting by it
$query->orderBy('USERS.USR_LASTNAME', $dir);
$query->orderBy('USERS.USR_FIRSTNAME', $dir);
break;
default:
$query->orderBy($sort, $dir);
}
}
// Add pagination to the query
$query = $query->offset($start)
->limit($limit);
// Fetch results and transform to a laravel collection
$results = $query->get();
// Transform with additional data
$priorities = ['1' => 'VL', '2' => 'L', '3' => 'N', '4' => 'H', '5' => 'VH'];
$results->transform(function ($item, $key) use ($priorities) {
// Convert to an array as our results must be an array
$item = json_decode(json_encode($item), true);
// If it's assigned, fetch the user
if($item['USR_ID']) {
$user = User::where('USR_ID', $item['USR_ID'])->first();
} else {
$user = null;
}
$process = Process::where('PRO_ID', $item['PRO_ID'])->first();
// Rewrite priority string
if ($item['DEL_PRIORITY']) {
$item['DEL_PRIORITY'] = G::LoadTranslation("ID_PRIORITY_{$priorities[$item['DEL_PRIORITY']]}");
}
// Merge in desired application data
if ($item['APP_STATUS']) {
$item['APP_STATUS_LABEL'] = G::LoadTranslation("ID_${item['APP_STATUS']}");
} else {
$item['APP_STATUS_LABEL'] = $item['APP_STATUS'];
}
// Merge in desired process data
// Handle situation where the process might not be in the system anymore
$item['APP_PRO_TITLE'] = $process ? $process->PRO_TITLE : '';
// Merge in desired user data
$item['USR_LASTNAME'] = $user ? $user->USR_LASTNAME : '';
$item['USR_FIRSTNAME'] = $user ? $user->USR_FIRSTNAME : '';
$item['USR_USERNAME'] = $user ? $user->USR_USERNAME : '';
//@todo: this section needs to use 'User Name Display Format', currently in the extJs is defined this
$item["APP_CURRENT_USER"] = $item["USR_LASTNAME"] . ' ' . $item["USR_FIRSTNAME"];
$item["APPDELCR_APP_TAS_TITLE"] = '';
$item["USRCR_USR_UID"] = $item["USR_UID"];
$item["USRCR_USR_FIRSTNAME"] = $item["USR_FIRSTNAME"];
$item["USRCR_USR_LASTNAME"] = $item["USR_LASTNAME"];
$item["USRCR_USR_USERNAME"] = $item["USR_USERNAME"];
$item["APP_OVERDUE_PERCENTAGE"] = '';
return $item;
});
// Remove any empty erroenous data
$results = $results->filter();
// Bundle into response array
$response = [
// Fake totalCount to show pagination
'totalCount' => $start + $limit + 1,
'sql' => $query->toSql(),
'bindings' => $query->getBindings(),
'data' => $results->values()->toArray(),
];
return $response;
}
/**
* Get participation information for a case
*
* @param string $appUid
* @return array
*
* @see ProcessMaker\BusinessModel\Cases:getStatusInfo()
*/
public static function getParticipatedInfo($appUid)
{
// Build the query
$query = Delegation::query()->select([
'APP_UID',
'DEL_INDEX',
'PRO_UID'
]);
$query->appUid($appUid);
$query->orderBy('DEL_INDEX', 'ASC');
// Fetch results
$results = $query->get();
// Initialize the array to return
$arrayData = [];
// If the collection have at least one item, build the main array to return
if ($results->count() > 0) {
// Get the first item
$first = $results->first();
// Build the main array to return
$arrayData = [
'APP_STATUS' => 'PARTICIPATED', // Value hardcoded because we need to return the same structure previously sent
'DEL_INDEX' => [], // Initialize this item like an array
'PRO_UID' => $first->PRO_UID
];
// Populate the DEL_INDEX key with the values of the items collected
$results->each(function ($item) use (&$arrayData) {
$arrayData['DEL_INDEX'][] = $item->DEL_INDEX;
});
}
return $arrayData;
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
/**
* Class Dynaform
* @package ProcessMaker\Model
*
* Represents a dynaform object in the system.
*/
class Dynaform extends Model
{
protected $table = 'DYNAFORM';
public $timestamps = false;
public function process()
{
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
}
/**
* Get dynaforms by PRO_UID.
* @param string $proUid
* @return object
*/
public static function getByProUid($proUid)
{
return DB::table('DYNAFORM')
->select()
->where('DYNAFORM.PRO_UID', '=', $proUid)
->get();
}
/**
* Get dynaform by DYN_UID.
* @param string $dynUid
* @return object
*/
public static function getByDynUid($dynUid)
{
return DB::table('DYNAFORM')
->select()
->where('DYNAFORM.DYN_UID', '=', $dynUid)
->first();
}
/**
* Get dynaforms by PRO_UID except the DYN_UID specified in the second parameter.
* @param string $proUid
* @param string $dynUid
* @return object
*/
public static function getByProUidExceptDynUid($proUid, $dynUid)
{
return DB::table('DYNAFORM')
->select()
->where('DYNAFORM.PRO_UID', '=', $proUid)
->where('DYNAFORM.DYN_UID', '!=', $dynUid)
->get();
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class GroupUser extends Model
{
protected $table = 'GROUP_USER';
// We do not have create/update timestamps for this table
public $timestamps = false;
}

View File

@@ -0,0 +1,14 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class Groupwf extends Model
{
protected $table = 'GROUPWF';
protected $primaryKey = 'GRP_ID';
// We do not have create/update timestamps for this table
public $timestamps = false;
}

View File

@@ -0,0 +1,70 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
use ListUnassigned as PropelListUnassigned;
class ListUnassigned extends Model
{
protected $table = "LIST_UNASSIGNED";
// No timestamps
public $timestamps = false;
/**
* Returns the application this belongs to
*/
public function application()
{
return $this->belongsTo(Application::class, 'APP_UID', 'APP_UID');
}
/**
* Return the process task this belongs to
*/
public function task()
{
return $this->belongsTo(Task::class, 'TAS_ID', 'TAS_ID');
}
/**
* Return the process this belongs to
*/
public function process()
{
return $this->belongsTo(Process::class, 'PRO_ID', 'PRO_ID');
}
/**
* Get count
*
* @param string $userUid
* @param array $filters
*
* @return array
*/
public static function doCount($userUid, $filters = [])
{
$list = new PropelListUnassigned();
$result = $list->getCountList($userUid, $filters);
return $result;
}
/**
* Search data
*
* @param string $userUid
* @param array $filters
*
* @return array
*/
public static function loadList($userUid, $filters = [])
{
$list = new PropelListUnassigned();
$result = $list->loadList($userUid, $filters);
return $result;
}
}

View File

@@ -14,8 +14,29 @@ class Process extends Model
{
// Set our table name
protected $table = 'PROCESS';
// We do have a created at, but we don't store an updated at
// Our custom timestamp columns
const CREATED_AT = 'PRO_CREATE_DATE';
const UPDATED_AT = null;
const UPDATED_AT = 'PRO_UPDATE_DATE';
/**
* Retrieve all applications that belong to this process
*/
public function applications()
{
return $this->hasMany(Application::class, 'PRO_ID', 'PRO_ID');
}
}
public function tasks()
{
return $this->hasMany(Task::class, 'PRO_UID', 'PRO_UID');
}
public function creator()
{
return $this->hasOne(User::class, 'PRO_CREATE_USER', 'USR_UID');
}
public function category()
{
return $this->hasOne(ProcessCategory::class, 'PRO_CATEGORY', 'CATEGORY_UID');
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
/**
* Class ProcessCategory
* @package ProcessMaker\Model
*
* Represents a process category object in the system.
*/
class ProcessCategory extends Model
{
// Set our table name
protected $table = 'PROCESS_CATEGORY';
public $timestamps = false;
}

View File

@@ -0,0 +1,19 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
/**
* Class Process
* @package ProcessMaker\Model
*
* Represents a business process object in the system.
*/
class Route extends Model
{
// Set our table name
protected $table = 'ROUTE';
public $timestamps = false;
}

View File

@@ -0,0 +1,23 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class Task extends Model
{
protected $table = 'TASK';
protected $primaryKey = 'TAS_ID';
// We do not have create/update timestamps for this table
public $timestamps = false;
public function process()
{
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
}
public function delegations()
{
return $this->hasMany(Delegation::class, 'TAS_ID', 'TAS_ID');
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class TaskUser extends Model
{
protected $table = 'TASK_USER';
public $timestamps = false;
}

View File

@@ -0,0 +1,21 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $table = "USERS";
// Our custom timestamp columns
const CREATED_AT = 'USR_CREATE_DATE';
const UPDATED_AT = 'USR_UPDATE_DATE';
/**
* Returns the delegations this user has (all of them)
*/
public function delegations()
{
return $this->hasMany(Delegation::class, 'USR_ID', 'USR_ID');
}
}

View File

@@ -485,6 +485,33 @@ function csrfToken()
return isset($_SESSION['USR_CSRF_TOKEN']) ? $_SESSION['USR_CSRF_TOKEN'] : '';
}
/**
* Check if a string is a valid HTML code
*
* @param string $string
*
* @return bool
*
* @see G::replaceDataField()
*/
function stringIsValidHtml($string)
{
// To validate we use the DOMDocument class
$doc = new DOMDocument('1.0', 'UTF-8');
// Clean previous errors
libxml_clear_errors();
// This line have to be silenced because if the string is not an HTML a Warning is displayed
@$doc->loadHTML($string);
// Get last error parsing the HTML
$libXmlError = libxml_get_last_error();
// If the attribute "textContent" is empty or exists libxml errors, is not a valid HTML
return $doc->textContent !== '' && empty($libXmlError);
}
// Methods deleted in PHP 7.x, added in this file in order to keep compatibility with old libraries included/used in ProcessMaker
if (!function_exists('set_magic_quotes_runtime')) {
function set_magic_quotes_runtime($value) {

View File

@@ -25,6 +25,12 @@ var textJump;
var ids = '';
var winReassignInCasesList;
var casesNewTab;
var mask;
var loadingMessage;
var timeoutMark = false;
var processProxy;
var processStore;
var comboCategory;
function formatAMPM(date, initVal, calendarDate) {
@@ -855,25 +861,30 @@ Ext.onReady ( function() {
this.setBaseParam(
"openApplicationUid", (__OPEN_APPLICATION_UID__ !== null)? __OPEN_APPLICATION_UID__ : ""
);
timeoutMark = false;
},
load: function(response){
if (response.reader.jsonData.result === false) {
PMExt.notify('ERROR', response.reader.jsonData.message);
//PMExt.error
if (action === "search" && loadingMessage) {
loadingMessage.hide();
timeoutMark = true;
}
},
exception: function(dp, type, action, options, response, arg) {
responseObject = Ext.util.JSON.decode(response.responseText);
if (typeof(responseObject.error) != 'undefined') {
Ext.Msg.show({
title: _('ID_ERROR'),
msg: responseObject.error,
fn: function(){parent.parent.location = '../login/login';},
animEl: 'elId',
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
exception: function(dp, type, action, options, response, arg) {
if (response && typeof (response.status) !== 'undefined') {
showErrorMessage(response.status);
timeoutMark = true;
} else {
responseObject = Ext.util.JSON.decode(response.responseText);
if (typeof(responseObject.error) !== 'undefined') {
Ext.Msg.show({
title: _('ID_ERROR'),
msg: responseObject.error,
fn: function(){parent.parent.location = '../login/login';},
animEl: 'elId',
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
}
}
}
}
@@ -986,11 +997,13 @@ Ext.onReady ( function() {
}
});
var processStore = new Ext.data.Store( {
proxy : new Ext.data.HttpProxy( {
url : 'casesList_Ajax?actionAjax=processListExtJs&action='+action,
method : 'POST'
}),
processProxy = new Ext.data.HttpProxy( {
url : 'casesList_Ajax?actionAjax=processListExtJs&action='+action,
method : 'POST'
});
processStore = new Ext.data.Store( {
proxy : processProxy,
reader : new Ext.data.JsonReader( {
fields : [ {
name : 'PRO_UID'
@@ -1064,11 +1077,10 @@ Ext.onReady ( function() {
handler: function(){
storeCases.setBaseParam('process', '');
suggestProcess.setValue('');
doSearch();
}
};
var comboCategory = new Ext.form.ComboBox({
comboCategory = new Ext.form.ComboBox({
width : 180,
boxMaxWidth : 200,
editable : false,
@@ -1101,12 +1113,28 @@ Ext.onReady ( function() {
action: action,
CATEGORY_UID: filterCategory},
success: function ( result, request ) {
var data = Ext.util.JSON.decode(result.responseText);
var data = Ext.util.JSON.decode(result.responseText),
url = "";
suggestProcess.getStore().removeAll();
suggestProcess.getStore().loadData( data );
suggestProcess.setValue('');
// processStore proxy url must be updated every time when the category was changed
url = 'casesList_Ajax?actionAjax=processListExtJs&action=' + action;
url = comboCategory.value ? url + '&CATEGORY_UID=' + comboCategory.value : url;
processProxy = new Ext.data.HttpProxy( {
url : url,
method : 'POST'
});
processStore.proxy = processProxy;
},
failure: function ( result, request) {
// processStore will be restored to default value if something failed.
var url = 'casesList_Ajax?actionAjax=processListExtJs&action=' + action;
processProxy = new Ext.data.HttpProxy( {
url : url,
method : 'POST'
});
processStore.proxy = processProxy;
if (typeof(result.responseText) != 'undefined') {
Ext.MessageBox.alert(_('ID_FAILED'), result.responseText);
}
@@ -1323,7 +1351,6 @@ Ext.onReady ( function() {
storeCases.setBaseParam( 'user', filterUser);
storeCases.setBaseParam( 'start', 0);
storeCases.setBaseParam( 'limit', pageSize);
doSearch();
}
}
});
@@ -1348,6 +1375,72 @@ Ext.onReady ( function() {
//cls: 'x-form-toolbar-standardButton',
handler: doSearch
});
/**
* Show loading Dialog
*/
function showLoadingDialog() {
mask.hide();
var commonSettings = {
title: _('ID_SEARCHING'),
width: 700,
wait: true,
waitConfig: {interval:200}
};
loadingMessage = Ext.Msg.show(commonSettings);
setTimeout(
function() {
if (!timeoutMark) {
loadingMessage.hide();
commonSettings['msg'] = _('ID_SEARCHING_CANCEL_MESSAGE'),
commonSettings['buttons'] = Ext.Msg.CANCEL,
commonSettings['fn'] = function (btn, text) {
if (btn === 'cancel') {
proxyCasesList.getConnection().abort();
};
}
loadingMessage = Ext.Msg.show(commonSettings);
timeoutMark = false;
}
}, 2000);
};
/**
* Show the error code.
* @param {*} errorCode
*/
function showErrorMessage(errorCode) {
var message;
switch (errorCode) {
case 408:
case 504:
message = _('ID_SEARCHING_TIME_OUT');
break;
case 0:
case -1:
message = _('ID_SEARCHING_UNEXPECTED_ERROR_DEFAULT');
break;
default:
message = _('ID_SEARCHING_UNEXPECTED_ERROR', [errorCode]);
}
Ext.Msg.show({
title:_('ID_ERROR'),
msg: message,
animEl: 'elId',
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
};
function showTimeoutMessage() {
Ext.Msg.show({
title:_('ID_ERROR'),
msg: _('ID_SEARCHING_TIME_OUT'),
animEl: 'elId',
icon: Ext.MessageBox.ERROR,
buttons: Ext.MessageBox.OK
});
};
function doSearch(){
//var viewText = Ext.getCmp('casesGrid').getView();
@@ -1359,14 +1452,16 @@ Ext.onReady ( function() {
storeCases.setBaseParam('dateTo', dateTo.getValue());
storeCases.setBaseParam( 'search', searchText);
storeCases.load({params:{ start : 0 , limit : pageSize }});
}
if ( action === 'search' ){
showLoadingDialog();
}
};
var resetSearchButton = {
text:'X',
ctCls:"pm_search_x_button_des",
handler: function(){
textSearch.setValue('');
doSearch();
}
}
@@ -1376,7 +1471,6 @@ Ext.onReady ( function() {
handler: function(){
suggestUser.setValue('');
storeCases.setBaseParam('user', '');
doSearch();
}
}
@@ -2219,7 +2313,7 @@ Ext.onReady ( function() {
emptyMsg: _('ID_DISPLAY_EMPTY')
})
}
var mask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_LOADING')});
mask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_LOADING')});
// create the editor grid
grid = new Ext.grid.GridPanel({
region: 'center',
@@ -2227,7 +2321,6 @@ Ext.onReady ( function() {
store: storeCases,
cm: cm,
loadMask: mask,
sm: new Ext.grid.RowSelectionModel({
selectSingle: false,
listeners:{