mirror of
https://github.com/espocrm/espocrm.git
synced 2026-03-06 02:57:01 +00:00
Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdeaaa7965 | ||
|
|
2768a975d7 | ||
|
|
2533854745 | ||
|
|
b32f0976ee | ||
|
|
c616baf0a0 | ||
|
|
5b2a07310e | ||
|
|
f6ff8e77e4 | ||
|
|
ff492e2a81 | ||
|
|
1a401381c4 | ||
|
|
79dfd6177a | ||
|
|
8492916d81 | ||
|
|
917f86a771 | ||
|
|
f3f13a1d96 | ||
|
|
f750330171 | ||
|
|
de19a8274a | ||
|
|
0d66e4097c | ||
|
|
55d54ee2da | ||
|
|
e52177a687 | ||
|
|
d424e6a282 | ||
|
|
9e06108d23 | ||
|
|
e0b9b22ff4 | ||
|
|
17f8f1c291 | ||
|
|
bde5ca7b9e |
@@ -79,27 +79,27 @@ class Extension extends \Espo\Core\Controllers\Record
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionCreate()
|
||||
public function actionCreate($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionUpdate()
|
||||
public function actionUpdate($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionPatch()
|
||||
public function actionPatch($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionListLinked()
|
||||
public function actionListLinked($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionDelete($params, $data, $request)
|
||||
public function actionDelete($params)
|
||||
{
|
||||
$manager = new \Espo\Core\ExtensionManager($this->getContainer());
|
||||
|
||||
@@ -108,22 +108,22 @@ class Extension extends \Espo\Core\Controllers\Record
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actionMassUpdate()
|
||||
public function actionMassUpdate($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionMassDelete()
|
||||
public function actionMassDelete($params, $data, $request)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionCreateLink()
|
||||
public function actionCreateLink($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
public function actionRemoveLink()
|
||||
public function actionRemoveLink($params, $data)
|
||||
{
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class Sender
|
||||
|
||||
if (in_array('fromName', $params)) {
|
||||
$this->params['fromName'] = $params['fromName'];
|
||||
}
|
||||
}
|
||||
if (in_array('fromAddress', $params)) {
|
||||
$this->params['fromAddress'] = $params['fromAddress'];
|
||||
}
|
||||
@@ -134,8 +134,8 @@ class Sender
|
||||
public function send(Email $email, $params = array())
|
||||
{
|
||||
$message = new Message();
|
||||
$config = $this->config;
|
||||
$params = $this->params + $params;
|
||||
$config = $this->config;
|
||||
$params = $this->params + $params;
|
||||
|
||||
if ($email->get('from')) {
|
||||
$fromName = null;
|
||||
@@ -202,29 +202,13 @@ class Sender
|
||||
}
|
||||
}
|
||||
|
||||
$message->setSubject($email->get('name'));
|
||||
$attachmentPartList = array();
|
||||
|
||||
$body = new MimeMessage;
|
||||
$parts = array();
|
||||
|
||||
$attachmentCollection = $email->get('attachments');
|
||||
$attachmentInlineCollection = $email->getInlineAttachments();
|
||||
|
||||
$bodyPart = new MimePart($email->getBodyPlainForSending());
|
||||
$bodyPart->type = 'text/plain';
|
||||
$bodyPart->charset = 'utf-8';
|
||||
$parts[] = $bodyPart;
|
||||
|
||||
|
||||
if ($email->get('isHtml')) {
|
||||
$bodyPart = new MimePart($email->getBodyForSending());
|
||||
$bodyPart->type = 'text/html';
|
||||
$bodyPart->charset = 'utf-8';
|
||||
$parts[] = $bodyPart;
|
||||
}
|
||||
|
||||
|
||||
$aCollection = $email->get('attachments');
|
||||
if (!empty($aCollection)) {
|
||||
foreach ($aCollection as $a) {
|
||||
if (!empty($attachmentCollection)) {
|
||||
foreach ($attachmentCollection as $a) {
|
||||
$fileName = 'data/upload/' . $a->id;
|
||||
$attachment = new MimePart(file_get_contents($fileName));
|
||||
$attachment->disposition = Mime::DISPOSITION_ATTACHMENT;
|
||||
@@ -233,13 +217,12 @@ class Sender
|
||||
if ($a->get('type')) {
|
||||
$attachment->type = $a->get('type');
|
||||
}
|
||||
$parts[] = $attachment;
|
||||
$attachmentPartList[] = $attachment;
|
||||
}
|
||||
}
|
||||
|
||||
$aCollection = $email->getInlineAttachments();
|
||||
if (!empty($aCollection)) {
|
||||
foreach ($aCollection as $a) {
|
||||
if (!empty($attachmentInlineCollection)) {
|
||||
foreach ($attachmentInlineCollection as $a) {
|
||||
$fileName = 'data/upload/' . $a->id;
|
||||
$attachment = new MimePart(file_get_contents($fileName));
|
||||
$attachment->disposition = Mime::DISPOSITION_INLINE;
|
||||
@@ -248,28 +231,81 @@ class Sender
|
||||
if ($a->get('type')) {
|
||||
$attachment->type = $a->get('type');
|
||||
}
|
||||
$parts[] = $attachment;
|
||||
$attachmentPartList[] = $attachment;
|
||||
}
|
||||
}
|
||||
|
||||
$body->setParts($parts);
|
||||
$message->setBody($body);
|
||||
|
||||
$message->setSubject($email->get('name'));
|
||||
|
||||
$body = new MimeMessage();
|
||||
|
||||
$textPart = new MimePart($email->getBodyPlainForSending());
|
||||
$textPart->type = 'text/plain';
|
||||
$textPart->encoding = Mime::ENCODING_QUOTEDPRINTABLE;
|
||||
$textPart->charset = 'utf-8';
|
||||
|
||||
if ($email->get('isHtml')) {
|
||||
$message->getHeaders()->get('content-type')->setType('multipart/alternative');
|
||||
$htmlPart = new MimePart($email->getBodyForSending());
|
||||
$htmlPart->encoding = Mime::ENCODING_QUOTEDPRINTABLE;
|
||||
$htmlPart->type = 'text/html';
|
||||
$htmlPart->charset = 'utf-8';
|
||||
}
|
||||
|
||||
try {
|
||||
if ($email->get('parentType') && $email->get('parentId')) {
|
||||
$messageId = '<' . $email->get('parentType') .'/' . $email->get('parentId') . '/' . time() . '@espo>';
|
||||
if (!empty($attachmentPartList)) {
|
||||
$messageType = 'multipart/related';
|
||||
if ($email->get('isHtml')) {
|
||||
$content = new MimeMessage();
|
||||
$content->addPart($textPart);
|
||||
$content->addPart($htmlPart);
|
||||
|
||||
$messageType = 'multipart/mixed';
|
||||
|
||||
$contentPart = new MimePart($content->generateMessage());
|
||||
$contentPart->type = "multipart/alternative;\n boundary=\"" . $content->getMime()->boundary() . '"';
|
||||
|
||||
$body->addPart($contentPart);
|
||||
} else {
|
||||
$messageId = '<' . md5($email->get('name')) . '/' . time() . '@espo>';
|
||||
$body->addPart($textPart);
|
||||
}
|
||||
$message->getHeaders()->addHeaderLine('Message-Id', $messageId);
|
||||
|
||||
foreach ($attachmentPartList as $attachmentPart) {
|
||||
$body->addPart($attachmentPart);
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($email->get('isHtml')) {
|
||||
$body->setParts(array($textPart, $htmlPart));
|
||||
$messageType = 'multipart/alternative';
|
||||
} else {
|
||||
$body = $email->getBodyPlainForSending();
|
||||
$messageType = 'text/plain';
|
||||
}
|
||||
}
|
||||
|
||||
$message->setBody($body);
|
||||
|
||||
if ($message->getHeaders()->has('content-type')) {
|
||||
$message->getHeaders()->get('content-type')->setType($messageType);
|
||||
}
|
||||
$message->setEncoding('UTF-8');
|
||||
|
||||
try {
|
||||
$rand = mt_rand(1000, 9999);
|
||||
|
||||
if ($email->get('parentType') && $email->get('parentId')) {
|
||||
$messageId = '' . $email->get('parentType') .'/' . $email->get('parentId') . '/' . time() . '/' . $rand . '@espo';
|
||||
} else {
|
||||
$messageId = '' . md5($email->get('name')) . '/' . time() . '/' . $rand . '@espo';
|
||||
}
|
||||
|
||||
$messageIdHeader = new \Zend\Mail\Header\MessageId();
|
||||
$messageIdHeader->setId($messageId);
|
||||
$message->getHeaders()->addHeader($messageIdHeader);
|
||||
|
||||
$this->transport->send($message);
|
||||
|
||||
$email->set('messageId', $message_id);
|
||||
$email->set('messageId', $messageId);
|
||||
$email->set('status', 'Sent');
|
||||
$email->set('dateSent', date("Y-m-d H:i:s"));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -95,7 +95,7 @@ class Base
|
||||
if (!empty($params['where']) && is_array($params['where'])) {
|
||||
$where = array();
|
||||
|
||||
foreach ($params['where'] as $item) {
|
||||
foreach ($params['where'] as $item) {
|
||||
if ($item['type'] == 'boolFilters' && !empty($item['value']) && is_array($item['value'])) {
|
||||
foreach ($item['value'] as $filter) {
|
||||
$p = $this->getBoolFilterWhere($filter);
|
||||
@@ -183,7 +183,7 @@ class Base
|
||||
$d = array();
|
||||
foreach ($fieldList as $field) {
|
||||
if (
|
||||
strlen($item['value']) >= self::MIN_LENGTH_FOR_CONTENT_SEARCH
|
||||
strlen($value) >= self::MIN_LENGTH_FOR_CONTENT_SEARCH
|
||||
&&
|
||||
!empty($fieldDefs[$field]['type']) && $fieldDefs[$field]['type'] == 'text'
|
||||
) {
|
||||
|
||||
@@ -55,7 +55,7 @@ class Auth extends \Slim\Middleware
|
||||
}
|
||||
|
||||
$espoCgiAuth = $req->headers('HTTP_ESPO_CGI_AUTH');
|
||||
if ( !isset($authUsername) && !isset($authPassword) && isset($espoCgiAuth) ) {
|
||||
if ( !isset($authUsername) && !isset($authPassword) && !empty($espoCgiAuth) ) {
|
||||
list($authUsername, $authPassword) = explode(':' , base64_decode(substr($espoCgiAuth, 6)));
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ class Crypt
|
||||
private $key = null;
|
||||
|
||||
private $cryptKey = null;
|
||||
|
||||
private $iv = null;
|
||||
|
||||
public function __construct($config)
|
||||
{
|
||||
@@ -43,15 +45,28 @@ class Crypt
|
||||
}
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
protected function getIv()
|
||||
{
|
||||
if (empty($this->iv)) {
|
||||
$this->iv = mcrypt_create_iv(16, MCRYPT_RAND);
|
||||
}
|
||||
return $this->iv;
|
||||
}
|
||||
|
||||
public function encrypt($string)
|
||||
{
|
||||
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->getKey(), $string, MCRYPT_MODE_CBC));
|
||||
$iv = $this->getIv();
|
||||
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->getKey(), $string, MCRYPT_MODE_CBC, $iv) . $iv);
|
||||
}
|
||||
|
||||
public function decrypt($encryptedString)
|
||||
{
|
||||
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->getKey(), base64_decode($encryptedString), MCRYPT_MODE_CBC));
|
||||
$encryptedString = base64_decode($encryptedString);
|
||||
|
||||
$string = substr($encryptedString, 0, strlen($encryptedString) - 16);
|
||||
$iv = substr($encryptedString, -16);
|
||||
return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $this->getKey(), $string, MCRYPT_MODE_CBC, $iv));
|
||||
}
|
||||
|
||||
public function generateKey()
|
||||
|
||||
@@ -118,29 +118,6 @@ class Base
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start process Orm converting for fields/relations
|
||||
*
|
||||
* @param string $itemName Field name OR Link name
|
||||
* @param string $entityName
|
||||
* @return array
|
||||
*/
|
||||
public function process($itemName, $entityName)
|
||||
{
|
||||
$inputs = array(
|
||||
'itemName' => $itemName,
|
||||
'entityName' => $entityName,
|
||||
);
|
||||
$this->setMethods($inputs);
|
||||
|
||||
$convertedDefs = $this->load($itemName, $entityName);
|
||||
|
||||
$inputs = $this->setArrayValue(null, $inputs);
|
||||
$this->setMethods($inputs);
|
||||
|
||||
return $convertedDefs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Entity Defs by type (entity/orm)
|
||||
*
|
||||
|
||||
49
application/Espo/Core/Utils/Database/Orm/Fields/Base.php
Normal file
49
application/Espo/Core/Utils/Database/Orm/Fields/Base.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
* EspoCRM - Open Source CRM application.
|
||||
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
|
||||
* Website: http://www.espocrm.com
|
||||
*
|
||||
* EspoCRM 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* EspoCRM 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
|
||||
************************************************************************/
|
||||
|
||||
namespace Espo\Core\Utils\Database\Orm\Fields;
|
||||
|
||||
class Base extends \Espo\Core\Utils\Database\Orm\Base
|
||||
{
|
||||
/**
|
||||
* Start process Orm converting for fields
|
||||
*
|
||||
* @param string $itemName Field name
|
||||
* @param string $entityName
|
||||
* @return array
|
||||
*/
|
||||
public function process($itemName, $entityName)
|
||||
{
|
||||
$inputs = array(
|
||||
'itemName' => $itemName,
|
||||
'entityName' => $entityName,
|
||||
);
|
||||
$this->setMethods($inputs);
|
||||
|
||||
$convertedDefs = $this->load($itemName, $entityName);
|
||||
|
||||
$inputs = $this->setArrayValue(null, $inputs);
|
||||
$this->setMethods($inputs);
|
||||
|
||||
return $convertedDefs;
|
||||
}
|
||||
}
|
||||
@@ -24,22 +24,22 @@ namespace Espo\Core\Utils\Database\Orm\Fields;
|
||||
|
||||
use Espo\Core\Utils\Util;
|
||||
|
||||
class Currency extends \Espo\Core\Utils\Database\Orm\Base
|
||||
class Currency extends Base
|
||||
{
|
||||
protected function load($fieldName, $entityName)
|
||||
{
|
||||
$converedFieldName = $fieldName . 'Converted';
|
||||
|
||||
|
||||
$currencyColumnName = Util::toUnderScore($fieldName);
|
||||
|
||||
|
||||
$alias = Util::toUnderScore($fieldName) . "_currency_alias";
|
||||
|
||||
|
||||
return array(
|
||||
$entityName => array(
|
||||
'fields' => array(
|
||||
'fields' => array(
|
||||
$fieldName => array(
|
||||
"type" => "float",
|
||||
"orderBy" => $converedFieldName . " {direction}"
|
||||
"orderBy" => $converedFieldName . " {direction}"
|
||||
),
|
||||
$fieldName . 'Converted' => array(
|
||||
'type' => 'float',
|
||||
@@ -54,11 +54,10 @@ class Currency extends \Espo\Core\Utils\Database\Orm\Base
|
||||
"<>" => Util::toUnderScore($entityName) . "." . $currencyColumnName . " * {$alias}.rate <> {value}"
|
||||
),
|
||||
'notStorable' => true,
|
||||
'orderBy' => $converedFieldName . " {direction}"
|
||||
'orderBy' => $converedFieldName . " {direction}"
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
namespace Espo\Core\Utils\Database\Orm\Fields;
|
||||
|
||||
class Email extends \Espo\Core\Utils\Database\Orm\Base
|
||||
class Email extends Base
|
||||
{
|
||||
protected function load($fieldName, $entityName)
|
||||
{
|
||||
@@ -34,28 +34,28 @@ class Email extends \Espo\Core\Utils\Database\Orm\Base
|
||||
'where' =>
|
||||
array (
|
||||
'LIKE' => \Espo\Core\Utils\Util::toUnderScore($entityName) . ".id IN (
|
||||
SELECT entity_id
|
||||
SELECT entity_id
|
||||
FROM entity_email_address
|
||||
JOIN email_address ON email_address.id = entity_email_address.email_address_id
|
||||
WHERE
|
||||
WHERE
|
||||
entity_email_address.deleted = 0 AND entity_email_address.entity_type = '{$entityName}' AND
|
||||
email_address.deleted = 0 AND email_address.name LIKE {value}
|
||||
email_address.deleted = 0 AND email_address.name LIKE {value}
|
||||
)",
|
||||
'=' => \Espo\Core\Utils\Util::toUnderScore($entityName) . ".id IN (
|
||||
SELECT entity_id
|
||||
SELECT entity_id
|
||||
FROM entity_email_address
|
||||
JOIN email_address ON email_address.id = entity_email_address.email_address_id
|
||||
WHERE
|
||||
WHERE
|
||||
entity_email_address.deleted = 0 AND entity_email_address.entity_type = '{$entityName}' AND
|
||||
email_address.deleted = 0 AND email_address.name = {value}
|
||||
email_address.deleted = 0 AND email_address.name = {value}
|
||||
)",
|
||||
'<>' => \Espo\Core\Utils\Util::toUnderScore($entityName) . ".id IN (
|
||||
SELECT entity_id
|
||||
SELECT entity_id
|
||||
FROM entity_email_address
|
||||
JOIN email_address ON email_address.id = entity_email_address.email_address_id
|
||||
WHERE
|
||||
WHERE
|
||||
entity_email_address.deleted = 0 AND entity_email_address.entity_type = '{$entityName}' AND
|
||||
email_address.deleted = 0 AND email_address.name <> {value}
|
||||
email_address.deleted = 0 AND email_address.name <> {value}
|
||||
)"
|
||||
),
|
||||
'orderBy' => 'email_address.name {direction}',
|
||||
@@ -93,5 +93,4 @@ class Email extends \Espo\Core\Utils\Database\Orm\Base
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
namespace Espo\Core\Utils\Database\Orm\Fields;
|
||||
|
||||
class LinkMultiple extends \Espo\Core\Utils\Database\Orm\Base
|
||||
class LinkMultiple extends Base
|
||||
{
|
||||
protected function load($fieldName, $entityName)
|
||||
{
|
||||
@@ -56,6 +56,4 @@ class LinkMultiple extends \Espo\Core\Utils\Database\Orm\Base
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
namespace Espo\Core\Utils\Database\Orm\Fields;
|
||||
|
||||
class LinkParent extends \Espo\Core\Utils\Database\Orm\Base
|
||||
class LinkParent extends Base
|
||||
{
|
||||
protected function load($fieldName, $entityName)
|
||||
{
|
||||
@@ -46,6 +46,4 @@ class LinkParent extends \Espo\Core\Utils\Database\Orm\Base
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -24,31 +24,33 @@ namespace Espo\Core\Utils\Database\Orm\Fields;
|
||||
|
||||
use Espo\Core\Utils\Util;
|
||||
|
||||
class PersonName extends \Espo\Core\Utils\Database\Orm\Base
|
||||
class PersonName extends Base
|
||||
{
|
||||
protected function load($fieldName, $entityName)
|
||||
{
|
||||
$foreignField = array('first' . ucfirst($fieldName), ' ', 'last' . ucfirst($fieldName));
|
||||
|
||||
$subList = array('first' . ucfirst($fieldName), ' ', 'last' . ucfirst($fieldName));
|
||||
|
||||
$tableName = Util::toUnderScore($entityName);
|
||||
|
||||
$fullList = array(); //contains empty string (" ") like delimiter
|
||||
$fullListReverse = array(); //reverse of $fullList
|
||||
$fieldList = array(); //doesn't contain empty string (" ") like delimiter
|
||||
$orderByField = 'first' . ucfirst($fieldName); // TODO available in settings
|
||||
|
||||
|
||||
$fullList = array();
|
||||
$fullListReverse = array();
|
||||
$fieldList = array();
|
||||
$like = array();
|
||||
$equal = array();
|
||||
|
||||
foreach($foreignField as $foreignFieldName) {
|
||||
|
||||
$fieldNameTrimmed = trim($foreignFieldName);
|
||||
foreach($subList as $subFieldName) {
|
||||
$fieldNameTrimmed = trim($subFieldName);
|
||||
if (!empty($fieldNameTrimmed)) {
|
||||
$columnName = $tableName.'.'.Util::toUnderScore($fieldNameTrimmed);
|
||||
$columnName = $tableName . '.' . Util::toUnderScore($fieldNameTrimmed);
|
||||
|
||||
$fullList[] = $fieldList[] = $columnName;
|
||||
$like[] = $columnName." LIKE {value}";
|
||||
$equal[] = $columnName." = {value}";
|
||||
} else {
|
||||
$fullList[] = "'".$foreignFieldName."'";
|
||||
$fullList[] = "'" . $subFieldName . "'";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +66,7 @@ class PersonName extends \Espo\Core\Utils\Database\Orm\Base
|
||||
'LIKE' => "(".implode(" OR ", $like)." OR CONCAT(".implode(", ", $fullList).") LIKE {value} OR CONCAT(".implode(", ", $fullListReverse).") LIKE {value})",
|
||||
'=' => "(".implode(" OR ", $equal)." OR CONCAT(".implode(", ", $fullList).") = {value} OR CONCAT(".implode(", ", $fullListReverse).") = {value})",
|
||||
),
|
||||
'orderBy' => implode(", ", array_map(function ($item) {return $item . ' {direction}';}, $fieldList)),
|
||||
'orderBy' => ''. $tableName . '.' . Util::toUnderScore($orderByField) . ' {direction}'
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
namespace Espo\Core\Utils\Database\Orm\Fields;
|
||||
|
||||
class Phone extends \Espo\Core\Utils\Database\Orm\Base
|
||||
class Phone extends Base
|
||||
{
|
||||
protected function load($fieldName, $entityName)
|
||||
{
|
||||
@@ -34,28 +34,28 @@ class Phone extends \Espo\Core\Utils\Database\Orm\Base
|
||||
'where' =>
|
||||
array (
|
||||
'LIKE' => \Espo\Core\Utils\Util::toUnderScore($entityName) . ".id IN (
|
||||
SELECT entity_id
|
||||
SELECT entity_id
|
||||
FROM entity_phone_number
|
||||
JOIN phone_number ON phone_number.id = entity_phone_number.phone_number_id
|
||||
WHERE
|
||||
WHERE
|
||||
entity_phone_number.deleted = 0 AND entity_phone_number.entity_type = '{$entityName}' AND
|
||||
phone_number.deleted = 0 AND phone_number.name LIKE {value}
|
||||
phone_number.deleted = 0 AND phone_number.name LIKE {value}
|
||||
)",
|
||||
'=' => \Espo\Core\Utils\Util::toUnderScore($entityName) . ".id IN (
|
||||
SELECT entity_id
|
||||
SELECT entity_id
|
||||
FROM entity_phone_number
|
||||
JOIN phone_number ON phone_number.id = entity_phone_number.phone_number_id
|
||||
WHERE
|
||||
WHERE
|
||||
entity_phone_number.deleted = 0 AND entity_phone_number.entity_type = '{$entityName}' AND
|
||||
phone_number.deleted = 0 AND phone_number.name = {value}
|
||||
phone_number.deleted = 0 AND phone_number.name = {value}
|
||||
)",
|
||||
'<>' => \Espo\Core\Utils\Util::toUnderScore($entityName) . ".id IN (
|
||||
SELECT entity_id
|
||||
SELECT entity_id
|
||||
FROM entity_phone_number
|
||||
JOIN phone_number ON phone_number.id = entity_phone_number.phone_number_id
|
||||
WHERE
|
||||
WHERE
|
||||
entity_phone_number.deleted = 0 AND entity_phone_number.entity_type = '{$entityName}' AND
|
||||
phone_number.deleted = 0 AND phone_number.name <> {value}
|
||||
phone_number.deleted = 0 AND phone_number.name <> {value}
|
||||
)"
|
||||
),
|
||||
'orderBy' => 'phone_number.name {direction}',
|
||||
|
||||
@@ -208,7 +208,7 @@ class Manager
|
||||
*/
|
||||
public function putContentsPHP($path, $data)
|
||||
{
|
||||
return $this->putContents($path, $this->getPHPFormat($data));
|
||||
return $this->putContents($path, $this->getPHPFormat($data), LOCK_EX);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +227,7 @@ class Manager
|
||||
$data = Utils\Json::encode($data, JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
return $this->putContents($path, $data);
|
||||
return $this->putContents($path, $data, LOCK_EX);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,6 +245,11 @@ class Manager
|
||||
{
|
||||
$fileContent = $this->getContents($path);
|
||||
|
||||
$fullPath = $this->concatPaths($path);
|
||||
if (file_exists($fullPath) && ($fileContent === false || empty($fileContent))) {
|
||||
throw new Error('Failed to read file [' . $fullPath .'].');
|
||||
}
|
||||
|
||||
$savedDataArray = Utils\Json::getArrayData($fileContent);
|
||||
$newDataArray = Utils\Json::getArrayData($content);
|
||||
|
||||
|
||||
@@ -130,28 +130,60 @@ class Util
|
||||
return array();
|
||||
}
|
||||
|
||||
/** add root items from currentArray */
|
||||
foreach ($currentArray as $currentName => $currentValue) {
|
||||
foreach ($newArray as $newName => $newValue) {
|
||||
|
||||
if (!array_key_exists($currentName, $newArray)) {
|
||||
if (is_array($newValue) && empty($newValue)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$newArray[$currentName] = $currentValue;
|
||||
if (is_array($newValue) && array_key_exists($newName, $currentArray) && is_array($currentArray[$newName])) {
|
||||
|
||||
} else if (is_array($currentValue) && is_array($newArray[$currentName])) {
|
||||
|
||||
/** check __APPEND__ identifier */
|
||||
$appendKey = array_search($mergeIdentifier, $newArray[$currentName], true);
|
||||
// check __APPEND__ identifier
|
||||
$appendKey = array_search($mergeIdentifier, $newValue, true);
|
||||
if ($appendKey !== false) {
|
||||
unset($newArray[$currentName][$appendKey]);
|
||||
$newArray[$currentName] = array_merge($currentValue, $newArray[$currentName]);
|
||||
} else if (!static::isSingleArray($newArray[$currentName])) {
|
||||
$newArray[$currentName] = static::merge($currentValue, $newArray[$currentName]);
|
||||
unset($newValue[$appendKey]);
|
||||
$newValue = array_merge($currentArray[$newName], $newValue);
|
||||
} else if (!static::isSingleArray($newValue)) {
|
||||
$newValue = static::merge($currentArray[$newName], $newValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//check if exists __APPEND__ identifier and remove its
|
||||
if (!isset($currentArray[$newName]) && is_array($newValue)) {
|
||||
$newValue = static::unsetInArrayByValue($mergeIdentifier, $newValue);
|
||||
}
|
||||
|
||||
$currentArray[$newName] = $newValue;
|
||||
}
|
||||
|
||||
return $newArray;
|
||||
return $currentArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset a value in array recursively
|
||||
*
|
||||
* @param string $needle
|
||||
* @param array $haystack
|
||||
* @param bool $reIndex
|
||||
* @return array
|
||||
*/
|
||||
public static function unsetInArrayByValue($needle, array $haystack, $reIndex = true)
|
||||
{
|
||||
foreach($haystack as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$haystack[$key] = static::unsetInArrayByValue($needle, $value);
|
||||
} else if ($needle === $value) {
|
||||
|
||||
if ($reIndex) {
|
||||
array_splice($haystack, $key, 1);
|
||||
} else {
|
||||
unset($haystack[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $haystack;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,6 +84,9 @@ class Stream extends \Espo\Core\Hooks\Base
|
||||
$scopeNotifiedList = array();
|
||||
foreach ($linkDefs as $link => $defs) {
|
||||
if ($defs['type'] == 'belongsTo') {
|
||||
if (empty($defs['foreign']) || empty($defs['entity'])) {
|
||||
continue;
|
||||
}
|
||||
$foreign = $defs['foreign'];
|
||||
$scope = $defs['entity'];
|
||||
$entityId = $entity->get($link . 'Id');
|
||||
@@ -96,6 +99,9 @@ class Stream extends \Espo\Core\Hooks\Base
|
||||
}
|
||||
} else if ($defs['type'] == 'belongsToParent') {
|
||||
$foreign = $defs['foreign'];
|
||||
if (empty($defs['foreign'])) {
|
||||
continue;
|
||||
}
|
||||
$scope = $entity->get($link . 'Type');
|
||||
$entityId = $entity->get($link . 'Id');
|
||||
if (!empty($scope) && !empty($entityId)) {
|
||||
@@ -107,6 +113,9 @@ class Stream extends \Espo\Core\Hooks\Base
|
||||
|
||||
}
|
||||
} else if ($defs['type'] == 'hasMany') {
|
||||
if (empty($defs['foreign']) || empty($defs['entity'])) {
|
||||
continue;
|
||||
}
|
||||
$foreign = $defs['foreign'];
|
||||
$scope = $defs['entity'];
|
||||
$entityIds = $entity->get($link . 'Ids');
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Espo\Modules\Crm\Services;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Account extends \Espo\Services\Record
|
||||
{
|
||||
{
|
||||
protected $linkSelectParams = array(
|
||||
'contacts' => array(
|
||||
'additionalColumns' => array(
|
||||
@@ -39,6 +39,6 @@ class Account extends \Espo\Services\Record
|
||||
return array(
|
||||
'name' => $entity->get('name')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,17 +28,21 @@ class Contact extends \Espo\Services\Record
|
||||
{
|
||||
protected function getDuplicateWhereClause(Entity $entity)
|
||||
{
|
||||
return array(
|
||||
$data = array(
|
||||
'OR' => array(
|
||||
array(
|
||||
'firstName' => $entity->get('firstName'),
|
||||
'lastName' => $entity->get('lastName'),
|
||||
),
|
||||
array(
|
||||
'emailAddress' => $entity->get('emailAddress'),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($entity->get('emailAddress')) {
|
||||
$data['OR'][] = array(
|
||||
'emailAddress' => $entity->get('emailAddress'),
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class InboundEmail extends \Espo\Services\Record
|
||||
|
||||
$folders = new \RecursiveIteratorIterator($storage->getFolders(), \RecursiveIteratorIterator::SELF_FIRST);
|
||||
foreach ($folders as $name => $folder) {
|
||||
$foldersArr[] = $folder->getGlobalName();
|
||||
$foldersArr[] = mb_convert_encoding($folder->getGlobalName(), 'UTF-8', 'UTF7-IMAP');
|
||||
}
|
||||
return $foldersArr;
|
||||
}
|
||||
@@ -168,9 +168,11 @@ class InboundEmail extends \Espo\Services\Record
|
||||
|
||||
$monitoredFoldersArr = explode(',', $monitoredFolders);
|
||||
foreach ($monitoredFoldersArr as $folder) {
|
||||
$folder = trim($folder);
|
||||
$folder = mb_convert_encoding(trim($folder), 'UTF7-IMAP', 'UTF-8');
|
||||
|
||||
$storage->selectFolder($folder);
|
||||
|
||||
|
||||
$lastUID = 0;
|
||||
$lastDate = 0;
|
||||
if (!empty($fetchData['lastUID'][$folder])) {
|
||||
|
||||
@@ -28,20 +28,24 @@ use \Espo\Core\Exceptions\Forbidden;
|
||||
use \Espo\ORM\Entity;
|
||||
|
||||
class Lead extends \Espo\Services\Record
|
||||
{
|
||||
{
|
||||
protected function getDuplicateWhereClause(Entity $entity)
|
||||
{
|
||||
return array(
|
||||
$data = array(
|
||||
'OR' => array(
|
||||
array(
|
||||
'firstName' => $entity->get('firstName'),
|
||||
'lastName' => $entity->get('lastName'),
|
||||
),
|
||||
array(
|
||||
'emailAddress' => $entity->get('emailAddress'),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($entity->get('emailAddress')) {
|
||||
$data['OR'][] = array(
|
||||
'emailAddress' => $entity->get('emailAddress'),
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function convert($id, $recordsData)
|
||||
@@ -55,7 +59,7 @@ class Lead extends \Espo\Services\Record
|
||||
$entityManager = $this->getEntityManager();
|
||||
|
||||
|
||||
if (!empty($recordsData->Account)) {
|
||||
if (!empty($recordsData->Account)) {
|
||||
$account = $entityManager->getEntity('Account');
|
||||
$account->set(get_object_vars($recordsData->Account));
|
||||
$entityManager->saveEntity($account);
|
||||
@@ -80,17 +84,17 @@ class Lead extends \Espo\Services\Record
|
||||
if (isset($opportunity)) {
|
||||
$entityManager->getRepository('Contact')->relate($contact, 'opportunities', $opportunity);
|
||||
}
|
||||
$lead->set('createdContactId', $contact->id);
|
||||
$lead->set('createdContactId', $contact->id);
|
||||
}
|
||||
|
||||
$lead->set('status', 'Converted');
|
||||
$lead->set('status', 'Converted');
|
||||
$entityManager->saveEntity($lead);
|
||||
|
||||
if ($meetings = $lead->get('meetings')) {
|
||||
foreach ($meetings as $meeting) {
|
||||
if (!empty($contact)) {
|
||||
$entityManager->getRepository('Meeting')->relate($meeting, 'contacts', $contact);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($opportunity)) {
|
||||
$meeting->set('parentId', $opportunity->id);
|
||||
@@ -118,7 +122,7 @@ class Lead extends \Espo\Services\Record
|
||||
$entityManager->saveEntity($call);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $lead;
|
||||
}
|
||||
|
||||
@@ -547,6 +547,8 @@ class Query
|
||||
|
||||
$operator = '=';
|
||||
|
||||
$leftPart = null;
|
||||
|
||||
if (!preg_match('/^[a-z0-9]+$/i', $field)) {
|
||||
foreach (self::$comparisonOperators as $op => $opDb) {
|
||||
if (strpos($field, $op) !== false) {
|
||||
|
||||
@@ -56,6 +56,11 @@ class RDB extends \Espo\ORM\Repository
|
||||
$this->seed = $this->entityFactory->create($entityName);
|
||||
$this->entityClassName = get_class($this->seed);
|
||||
$this->entityManager = $entityManager;
|
||||
$this->init();
|
||||
}
|
||||
|
||||
protected function init()
|
||||
{
|
||||
}
|
||||
|
||||
protected function getMapper()
|
||||
@@ -217,7 +222,7 @@ class RDB extends \Espo\ORM\Repository
|
||||
return $this->getMapper()->countRelated($entity, $relationName, $params);
|
||||
}
|
||||
|
||||
public function relate(Entity $entity, $relationName, $foreign, $data)
|
||||
public function relate(Entity $entity, $relationName, $foreign, $data = null)
|
||||
{
|
||||
if ($data instanceof \stdClass) {
|
||||
$data = get_object_vars($data);
|
||||
|
||||
@@ -26,9 +26,10 @@ use Espo\ORM\Entity;
|
||||
|
||||
class Attachment extends \Espo\Core\ORM\Repositories\RDB
|
||||
{
|
||||
protected $dependencies = array(
|
||||
'fileManager',
|
||||
);
|
||||
protected function init()
|
||||
{
|
||||
$this->dependencies[] = 'fileManager';
|
||||
}
|
||||
|
||||
protected function getFileManager()
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ class EmailAccount extends Record
|
||||
|
||||
$folders = new \RecursiveIteratorIterator($storage->getFolders(), \RecursiveIteratorIterator::SELF_FIRST);
|
||||
foreach ($folders as $name => $folder) {
|
||||
$foldersArr[] = $folder->getGlobalName();
|
||||
$foldersArr[] = mb_convert_encoding($folder->getGlobalName(), 'UTF-8', 'UTF7-IMAP');
|
||||
}
|
||||
return $foldersArr;
|
||||
}
|
||||
@@ -152,7 +152,8 @@ class EmailAccount extends Record
|
||||
|
||||
$monitoredFoldersArr = explode(',', $monitoredFolders);
|
||||
foreach ($monitoredFoldersArr as $folder) {
|
||||
$folder = trim($folder);
|
||||
$folder = mb_convert_encoding(trim($folder), 'UTF7-IMAP', 'UTF-8');
|
||||
|
||||
$storage->selectFolder($folder);
|
||||
|
||||
$lastUID = 0;
|
||||
|
||||
@@ -70,6 +70,8 @@ class Stream extends \Espo\Core\Services\Base
|
||||
'container',
|
||||
);
|
||||
|
||||
protected $auditedFieldsCache = array();
|
||||
|
||||
protected function getServiceFactory()
|
||||
{
|
||||
return $this->injections['container']->get('serviceFactory');
|
||||
|
||||
@@ -48,9 +48,9 @@ class User extends Record
|
||||
return $this->injections['language'];
|
||||
}
|
||||
|
||||
public function getEntity($id)
|
||||
public function getEntity($id = null)
|
||||
{
|
||||
if ($id == 'system') {
|
||||
if (isset($id) && $id == 'system') {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ Espo.define('Views.Record.RowActions.Default', 'View', function (Dep) {
|
||||
data: function () {
|
||||
return {
|
||||
acl: this.options.acl,
|
||||
actions: this.getActions()
|
||||
actions: this.getActions(),
|
||||
scope: this.model.name
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "espocrm",
|
||||
"version": "2.7.0",
|
||||
"version": "2.7.2",
|
||||
"description": "",
|
||||
"main": "index.php",
|
||||
"repository": "",
|
||||
|
||||
@@ -586,6 +586,278 @@ class UtilTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($result, Util::merge($currentArray, $newArray));
|
||||
}
|
||||
|
||||
public function testMergeEmptyArray()
|
||||
{
|
||||
$currentArray = array(
|
||||
'Call' =>array (
|
||||
'fields' =>
|
||||
array (
|
||||
'accountId' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'where' =>
|
||||
array (
|
||||
'=' => 'contact.id IN ({value})',
|
||||
),
|
||||
'len' => 255,
|
||||
),
|
||||
'deleted' =>
|
||||
array (
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'trueValue' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$newArray = array(
|
||||
'Call' =>array (
|
||||
'fields' =>
|
||||
array (
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$result = $currentArray;
|
||||
|
||||
$this->assertEquals($result, Util::merge($currentArray, $newArray));
|
||||
}
|
||||
|
||||
public function testMergeEmptyArray2()
|
||||
{
|
||||
$currentArray = array(
|
||||
'Call' => array (
|
||||
'fields' =>
|
||||
array (
|
||||
'accountId' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'where' =>
|
||||
array (
|
||||
'=' => 'contact.id IN ({value})',
|
||||
),
|
||||
'len' => 255,
|
||||
),
|
||||
'deleted' =>
|
||||
array (
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'trueValue' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$newArray = array(
|
||||
'Call' => array (),
|
||||
);
|
||||
|
||||
$result = $currentArray;
|
||||
|
||||
$this->assertEquals($result, Util::merge($currentArray, $newArray));
|
||||
}
|
||||
|
||||
public function testMergeEmptyArray3()
|
||||
{
|
||||
$currentArray = array(
|
||||
'Call' =>array (
|
||||
'fields' =>
|
||||
array (
|
||||
'accountId' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'where' =>
|
||||
array (
|
||||
'=' => 'contact.id IN ({value})',
|
||||
),
|
||||
'len' => 255,
|
||||
),
|
||||
'deleted' =>
|
||||
array (
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
'trueValue' => true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$newArray = array(
|
||||
);
|
||||
|
||||
$result = $currentArray;
|
||||
|
||||
$this->assertEquals($result, Util::merge($currentArray, $newArray));
|
||||
}
|
||||
|
||||
public function testMergeCompleteTest()
|
||||
{
|
||||
$currentArray = array (
|
||||
'fields' =>
|
||||
array (
|
||||
'aaa1' =>
|
||||
array (
|
||||
'type' => 'enum',
|
||||
'required' => false,
|
||||
'options' =>
|
||||
array (
|
||||
0 => 'a1',
|
||||
1 => 'a3',
|
||||
2 => 'a3',
|
||||
),
|
||||
'isCustom' => true,
|
||||
),
|
||||
'append' =>
|
||||
array (
|
||||
'type' => 'enum',
|
||||
'required' => false,
|
||||
'options' =>
|
||||
array (
|
||||
'b1',
|
||||
'b3',
|
||||
'b3',
|
||||
),
|
||||
),
|
||||
't1111' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'required' => false,
|
||||
'isCustom' => true,
|
||||
'default' => '11111',
|
||||
),
|
||||
't2222' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'required' => false,
|
||||
'isCustom' => true,
|
||||
'default' => '2222',
|
||||
),
|
||||
't3333' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'required' => false,
|
||||
'isCustom' => true,
|
||||
'default' => '3333',
|
||||
'maxLength' => 70,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$newArray = array (
|
||||
'fields' =>
|
||||
array (
|
||||
'aaa1' =>
|
||||
array (
|
||||
'type' => 'enum',
|
||||
'required' => false,
|
||||
'options' =>
|
||||
array (
|
||||
'a1',
|
||||
),
|
||||
'isCustom' => false,
|
||||
'newValue' => 'NNNNN',
|
||||
),
|
||||
'new111' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'required' => false,
|
||||
),
|
||||
'append' =>
|
||||
array (
|
||||
'type' => 'enum',
|
||||
'required' => false,
|
||||
'options' =>
|
||||
array (
|
||||
'__APPEND__',
|
||||
'b4',
|
||||
'b5',
|
||||
),
|
||||
),
|
||||
'aloneAppend' =>
|
||||
array (
|
||||
'type' => 'enum',
|
||||
'required' => false,
|
||||
'options' =>
|
||||
array (
|
||||
'__APPEND__',
|
||||
'c1',
|
||||
'c2',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$result = array (
|
||||
'fields' =>
|
||||
array (
|
||||
'aaa1' =>
|
||||
array (
|
||||
'type' => 'enum',
|
||||
'required' => false,
|
||||
'options' =>
|
||||
array (
|
||||
0 => 'a1',
|
||||
),
|
||||
'isCustom' => false,
|
||||
'newValue' => 'NNNNN',
|
||||
),
|
||||
'append' =>
|
||||
array (
|
||||
'type' => 'enum',
|
||||
'required' => false,
|
||||
'options' =>
|
||||
array (
|
||||
'b1',
|
||||
'b3',
|
||||
'b3',
|
||||
'b4',
|
||||
'b5',
|
||||
),
|
||||
),
|
||||
't1111' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'required' => false,
|
||||
'isCustom' => true,
|
||||
'default' => '11111',
|
||||
),
|
||||
't2222' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'required' => false,
|
||||
'isCustom' => true,
|
||||
'default' => '2222',
|
||||
),
|
||||
't3333' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'required' => false,
|
||||
'isCustom' => true,
|
||||
'default' => '3333',
|
||||
'maxLength' => 70,
|
||||
),
|
||||
'new111' =>
|
||||
array (
|
||||
'type' => 'varchar',
|
||||
'required' => false,
|
||||
),
|
||||
'aloneAppend' =>
|
||||
array (
|
||||
'type' => 'enum',
|
||||
'required' => false,
|
||||
'options' =>
|
||||
array (
|
||||
'c1',
|
||||
'c2',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertEquals($result, Util::merge($currentArray, $newArray));
|
||||
}
|
||||
|
||||
public function testToFormat()
|
||||
{
|
||||
$this->assertEquals('/Espo/Core/Utils', Util::toFormat('/Espo/Core/Utils', '/'));
|
||||
|
||||
Reference in New Issue
Block a user