mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop Conflicts: htdocs/core/lib/json.lib.php test/phpunit/JsonLibTest.php
This commit is contained in:
commit
a5711a51ab
|
|
@ -309,7 +309,7 @@ script:
|
|||
set -e
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
#phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 .
|
||||
phpcs -s -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
|
||||
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
|
||||
set +e
|
||||
echo
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,8 @@
|
|||
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
|
||||
<exclude-pattern type="relative">*/nltechno*</exclude-pattern>
|
||||
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
|
||||
<exclude-pattern type="relative">*.min.css</exclude-pattern>
|
||||
<exclude-pattern type="relative">*.js</exclude-pattern>
|
||||
|
||||
<!-- List of all tests -->
|
||||
<!-- List of all tests -->
|
||||
|
||||
|
||||
<!-- Rules from Internal Standard -->
|
||||
|
|
|
|||
|
|
@ -167,10 +167,10 @@ class BookKeeping extends CommonObject
|
|||
$this->doc_ref = trim($this->doc_ref);
|
||||
}
|
||||
if (isset($this->fk_doc)) {
|
||||
$this->fk_doc = trim($this->fk_doc);
|
||||
$this->fk_doc = (int) $this->fk_doc;
|
||||
}
|
||||
if (isset($this->fk_docdet)) {
|
||||
$this->fk_docdet = trim($this->fk_docdet);
|
||||
$this->fk_docdet = (int) $this->fk_docdet;
|
||||
}
|
||||
if (isset($this->thirdparty_code)) {
|
||||
$this->thirdparty_code = trim($this->thirdparty_code);
|
||||
|
|
@ -487,10 +487,10 @@ class BookKeeping extends CommonObject
|
|||
$this->doc_ref = trim($this->doc_ref);
|
||||
}
|
||||
if (isset($this->fk_doc)) {
|
||||
$this->fk_doc = trim($this->fk_doc);
|
||||
$this->fk_doc = (int) $this->fk_doc;
|
||||
}
|
||||
if (isset($this->fk_docdet)) {
|
||||
$this->fk_docdet = trim($this->fk_docdet);
|
||||
$this->fk_docdet = (int) $this->fk_docdet;
|
||||
}
|
||||
if (isset($this->thirdparty_code)) {
|
||||
$this->thirdparty_code = trim($this->thirdparty_code);
|
||||
|
|
@ -1104,10 +1104,10 @@ class BookKeeping extends CommonObject
|
|||
$this->doc_ref = trim($this->doc_ref);
|
||||
}
|
||||
if (isset($this->fk_doc)) {
|
||||
$this->fk_doc = trim($this->fk_doc);
|
||||
$this->fk_doc = (int) $this->fk_doc;
|
||||
}
|
||||
if (isset($this->fk_docdet)) {
|
||||
$this->fk_docdet = trim($this->fk_docdet);
|
||||
$this->fk_docdet = (int) $this->fk_docdet;
|
||||
}
|
||||
if (isset($this->thirdparty_code)) {
|
||||
$this->thirdparty_code = trim($this->thirdparty_code);
|
||||
|
|
@ -1473,8 +1473,8 @@ class BookKeeping extends CommonObject
|
|||
$this->doc_date = $now;
|
||||
$this->doc_type = '';
|
||||
$this->doc_ref = '';
|
||||
$this->fk_doc = '';
|
||||
$this->fk_docdet = '';
|
||||
$this->fk_doc = 0;
|
||||
$this->fk_docdet = 0;
|
||||
$this->thirdparty_code = 'CU001';
|
||||
$this->subledger_account = '41100001';
|
||||
$this->subledger_label = 'My customer company';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||
|
|
@ -323,6 +323,8 @@ class FactureRec extends CommonInvoice
|
|||
{
|
||||
global $conf;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET";
|
||||
$sql.= " fk_soc = ".$this->fk_soc;
|
||||
// TODO Add missing fields
|
||||
|
|
@ -1082,7 +1084,7 @@ class FactureRec extends CommonInvoice
|
|||
$parameters = array(
|
||||
'restrictioninvoiceid' => $restrictioninvoiceid,
|
||||
'forcevalidation' => $forcevalidation,
|
||||
);
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('beforeCreationOfRecurringInvoices', $parameters, $sql); // note that $sql might be modified by hooks
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
|
@ -1183,7 +1185,7 @@ class FactureRec extends CommonInvoice
|
|||
'invoiceidgenerated' => $invoiceidgenerated,
|
||||
'facturerec' => $facturerec, // it's an object which PHP passes by "reference", so modifiable by hooks.
|
||||
'this' => $this, // it's an object which PHP passes by "reference", so modifiable by hooks.
|
||||
);
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('afterCreationOfRecurringInvoice', $parameters, $facture); // note: $facture can be modified by hooks (warning: $facture can be null)
|
||||
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -352,56 +352,40 @@ class CMailFile
|
|||
elseif ($this->sendmode == 'swiftmailer')
|
||||
{
|
||||
// Use Swift Mailer library
|
||||
// ------------------------------------------
|
||||
|
||||
$host = dol_getprefix('email');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Exception/InvalidEmail.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Exception/NoDomainPart.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailParser.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailLexer.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/EmailValidator.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/Warning.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/Parser.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/DomainPart.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Parser/LocalPart.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/EmailValidation.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/egulias/email-validator/EmailValidator/Validation/RFCValidation.php';
|
||||
// egulias autoloader lib
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/autoload.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/InputByteStream.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/Signer.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php';
|
||||
//require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/classes/Swift/SignedMessage.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
||||
// Create the message
|
||||
//$this->message = Swift_Message::newInstance();
|
||||
$this->message = new Swift_Message();
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
||||
|
||||
// Create the message
|
||||
//$this->message = Swift_Message::newInstance();
|
||||
$this->message = new Swift_Message();
|
||||
//$this->message = new Swift_SignedMessage();
|
||||
// Adding a trackid header to a message
|
||||
$headers = $this->message->getHeaders();
|
||||
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid . '@' . $host);
|
||||
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host;
|
||||
$msgid = $headers->get('Message-ID');
|
||||
$msgid->setId($headerID);
|
||||
$headers->addIdHeader('References', $headerID);
|
||||
// TODO if (! empty($moreinheader)) ...
|
||||
$headers = $this->message->getHeaders();
|
||||
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid . '@' . $host);
|
||||
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host;
|
||||
$msgid = $headers->get('Message-ID');
|
||||
$msgid->setId($headerID);
|
||||
$headers->addIdHeader('References', $headerID);
|
||||
// TODO if (! empty($moreinheader)) ...
|
||||
|
||||
// Give the message a subject
|
||||
try {
|
||||
$result = $this->message->setSubject($subject);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
// Give the message a subject
|
||||
try {
|
||||
$result = $this->message->setSubject($subject);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
|
||||
// Set the From address with an associative array
|
||||
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
|
||||
if (! empty($from)) {
|
||||
// Set the From address with an associative array
|
||||
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
|
||||
if (! empty($from)) {
|
||||
try {
|
||||
$result = $this->message->setFrom($this->getArrayAddress($from));
|
||||
$result = $this->message->setFrom($this->getArrayAddress($from));
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
|
|
@ -410,13 +394,13 @@ class CMailFile
|
|||
// Set the To addresses with an associative array
|
||||
if (! empty($to)) {
|
||||
try {
|
||||
$result = $this->message->setTo($this->getArrayAddress($to));
|
||||
$result = $this->message->setTo($this->getArrayAddress($to));
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($replyto)) {
|
||||
if (! empty($replyto)) {
|
||||
try {
|
||||
$result = $this->message->SetReplyTo($this->getArrayAddress($replyto));
|
||||
} catch (Exception $e) {
|
||||
|
|
@ -424,16 +408,14 @@ class CMailFile
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $this->message->setCharSet($conf->file->character_set_client);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
try {
|
||||
$result = $this->message->setCharSet($conf->file->character_set_client);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
|
||||
if (! empty($this->html))
|
||||
{
|
||||
if (!empty($css))
|
||||
{
|
||||
if (! empty($this->html)) {
|
||||
if (!empty($css)) {
|
||||
$this->css = $css;
|
||||
$this->buildCSS();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,13 +21,13 @@
|
|||
* \brief File that include javascript functions for timepicker
|
||||
*/
|
||||
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN',1);
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN', 1);
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
session_cache_limiter('public');
|
||||
|
||||
|
|
|
|||
|
|
@ -282,8 +282,8 @@ function dol_json_decode($json, $assoc = false)
|
|||
/**
|
||||
* Return text according to type
|
||||
*
|
||||
* @param string $val Value to decode
|
||||
* @return string Formated value
|
||||
* @param string $val Value to decode
|
||||
* @return string Formated value
|
||||
*/
|
||||
function _unval($val)
|
||||
{
|
||||
|
|
@ -310,7 +310,7 @@ function _unval($val)
|
|||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
if (function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
|
|
|
|||
13
htdocs/includes/swiftmailer/autoload.php
Normal file
13
htdocs/includes/swiftmailer/autoload.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Bootstrap the library.
|
||||
*/
|
||||
|
||||
namespace Egulias;
|
||||
|
||||
require_once __DIR__ . '/egulias/email-validator/AutoLoader.php';
|
||||
|
||||
$autoloader = new EguliasAutoLoader(__NAMESPACE__, dirname(__DIR__));
|
||||
|
||||
$autoloader->register();
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
namespace Egulias;
|
||||
|
||||
/**
|
||||
* PSR-0 Autoloader
|
||||
*
|
||||
* @author ieter Hordijk <info@pieterhordijk.com>
|
||||
*/
|
||||
class EguliasAutoLoader
|
||||
{
|
||||
/**
|
||||
* @var string The namespace prefix for this instance.
|
||||
*/
|
||||
protected $namespace = '';
|
||||
|
||||
/**
|
||||
* @var string The filesystem prefix to use for this instance
|
||||
*/
|
||||
protected $path = '';
|
||||
|
||||
/**
|
||||
* Build the instance of the autoloader
|
||||
*
|
||||
* @param string $namespace The prefixed namespace this instance will load
|
||||
* @param string $path The filesystem path to the root of the namespace
|
||||
*/
|
||||
public function __construct($namespace, $path)
|
||||
{
|
||||
$this->namespace = ltrim($namespace, '\\');
|
||||
$this->path = rtrim($path, '/\\') . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to load a class
|
||||
*
|
||||
* @param string $class The class name to load
|
||||
*
|
||||
* @return boolean If the loading was successful
|
||||
*/
|
||||
public function load($class)
|
||||
{
|
||||
$class = ltrim($class, '\\');
|
||||
if (strpos($class, $this->namespace) === 0) {
|
||||
$nsparts = explode('\\', $class);
|
||||
$class = array_pop($nsparts);
|
||||
$path = $this->path . 'swiftmailer/egulias/email-validator/EmailValidator/';
|
||||
$max=count($nsparts);
|
||||
for ($i=2; $i<$max;$i++) {
|
||||
$path .= $nsparts[$i].'/';
|
||||
}
|
||||
$nsparts = array();
|
||||
$path .= str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
|
||||
if (file_exists($path)) {
|
||||
require $path;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the autoloader to PHP
|
||||
*
|
||||
* @return boolean The status of the registration
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
return spl_autoload_register(array($this, 'load'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister the autoloader to PHP
|
||||
*
|
||||
* @return boolean The status of the unregistration
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
return spl_autoload_unregister(array($this, 'load'));
|
||||
}
|
||||
}
|
||||
|
|
@ -18,15 +18,15 @@
|
|||
*/
|
||||
|
||||
if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1');
|
||||
if (!defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1');
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (!defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', 1);
|
||||
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@
|
|||
* \brief Fichier de javascript de traduction pour JSGantt
|
||||
*/
|
||||
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN',1);
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
||||
if (! defined('NOLOGIN')) define('NOLOGIN', 1);
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
|
||||
require_once __DIR__.'/../main.inc.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
/**
|
||||
* \file test/phpunit/JsonLibTest.php
|
||||
* \ingroup test
|
||||
* \ingroup test
|
||||
* \brief PHPUnit test
|
||||
* \remarks To run this script as CLI: phpunit filename.php
|
||||
* \remarks To run this script as CLI: phpunit filename.php
|
||||
*/
|
||||
|
||||
global $conf,$user,$langs,$db;
|
||||
|
|
@ -122,7 +122,7 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
|
|||
/**
|
||||
* testJsonEncode
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function testJsonEncode()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user