Merge remote-tracking branch 'origin/3.7' into develop
Conflicts: .travis.yml htdocs/core/class/notify.class.php htdocs/product/stock/class/mouvementstock.class.php test/phpunit/AllTests.php test/phpunit/MouvementStockTest.php
This commit is contained in:
commit
a55af4387b
19
.travis.yml
19
.travis.yml
@ -104,16 +104,15 @@ before_script:
|
||||
script:
|
||||
- cd htdocs/install
|
||||
- date
|
||||
# - php upgrade.php 3.4.0 3.5.0 > upgrade.log
|
||||
# - php upgrade2.php 3.4.0 3.5.0 > upgrade2.log
|
||||
- php upgrade.php 3.5.0 3.6.0 >> upgrade.log
|
||||
- php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log
|
||||
- php upgrade.php 3.6.0 3.7.0 >> upgrade.log
|
||||
# - cat upgrade360370.log
|
||||
- php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log
|
||||
- php upgrade.php 3.7.0 3.8.0 >> upgrade.log
|
||||
- php upgrade2.php 3.7.0 3.8.0 >> upgrade2.log
|
||||
# - cat upgrade2.log
|
||||
# - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade340350.log
|
||||
# - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade340350-2.log
|
||||
- php upgrade.php 3.5.0 3.6.0 ignoredbversion > upgrade350360.log
|
||||
- php upgrade2.php 3.5.0 3.6.0 ignoredbversion > upgrade350360-2.log
|
||||
- php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log
|
||||
- php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log
|
||||
- php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log
|
||||
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
|
||||
# - cat upgrade370380-2.log
|
||||
- cd ../..
|
||||
- date
|
||||
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
|
||||
@ -592,16 +592,17 @@ function dol_strtoupper($utf8_string)
|
||||
* This function works only if syslog module is enabled.
|
||||
* This must not use any call to other function calling dol_syslog (avoid infinite loop).
|
||||
*
|
||||
* @param string $message Line to log. Ne doit pas etre traduit si level = LOG_ERR
|
||||
* @param int $level Log level
|
||||
* 0=Show nothing
|
||||
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
|
||||
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
||||
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
|
||||
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
|
||||
* @param string $message Line to log.
|
||||
* @param int $level Log level
|
||||
* 0=Show nothing
|
||||
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
|
||||
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
||||
* @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
|
||||
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
|
||||
* @param string $restricttologhandler Output log only for this log handler
|
||||
* @return void
|
||||
*/
|
||||
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='')
|
||||
function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='', $restricttologhandler='')
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
@ -624,7 +625,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
|
||||
$conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message;
|
||||
}
|
||||
|
||||
//TODO: Remove this. MAIN_ENABLE_LOG_HTML should be deprecated and use a HTML handler
|
||||
//TODO: Remove this. MAIN_ENABLE_LOG_HTML should be deprecated and use a log handler dedicated to HTML output
|
||||
// If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
|
||||
if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"]))
|
||||
{
|
||||
@ -648,10 +649,10 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
|
||||
else if (! empty($_SERVER['COMPUTERNAME'])) $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME'])?'':'@'.$_SERVER['USERNAME']);
|
||||
// This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it).
|
||||
else if (! empty($_SERVER['LOGNAME'])) $data['ip'] = '???@'.$_SERVER['LOGNAME'];
|
||||
|
||||
// Loop on each log handler and send output
|
||||
foreach ($conf->loghandlers as $loghandlerinstance)
|
||||
{
|
||||
if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) continue;
|
||||
$loghandlerinstance->export($data,$suffixinfilename);
|
||||
}
|
||||
unset($data);
|
||||
|
||||
@ -7,6 +7,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
|
||||
*/
|
||||
class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
|
||||
{
|
||||
var $code = 'chromephp';
|
||||
|
||||
/**
|
||||
* Return name of logger
|
||||
*
|
||||
@ -111,7 +113,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Output log content
|
||||
* Output log content. We also start output buffering at first log write.
|
||||
*
|
||||
* @param array $content Content to log
|
||||
* @return null|false
|
||||
|
||||
@ -7,6 +7,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
|
||||
*/
|
||||
class mod_syslog_file extends LogHandler implements LogHandlerInterface
|
||||
{
|
||||
var $code = 'file';
|
||||
|
||||
/**
|
||||
* Return name of logger
|
||||
|
||||
@ -7,6 +7,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
|
||||
*/
|
||||
class mod_syslog_firephp extends LogHandler implements LogHandlerInterface
|
||||
{
|
||||
var $code = 'firephp';
|
||||
|
||||
/**
|
||||
* Return name of logger
|
||||
*
|
||||
|
||||
@ -7,6 +7,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
|
||||
*/
|
||||
class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
|
||||
{
|
||||
var $code = 'syslog';
|
||||
|
||||
/**
|
||||
* Return name of logger
|
||||
*
|
||||
|
||||
@ -29,7 +29,7 @@ if (GETPOST('dol_use_jmobile')) $conf->dol_use_jmobile=1;
|
||||
if (! empty($conf->dol_use_jmobile)) $conf->use_javascript_ajax=1;
|
||||
|
||||
$arrayofjs=array('/core/js/dst.js'.(empty($conf->dol_use_jmobile)?'':'?version='.urlencode(DOL_VERSION))); // Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
|
||||
$titleofloginpage=$langs->trans('Login').' '.$title; // title is defined by dol_loginfunction in security2.lib.php
|
||||
$titleofloginpage=$langs->trans('Login').' @ '.$title; // title is defined by dol_loginfunction in security2.lib.php. We must keep the @, some tools use it to know it is login page.
|
||||
|
||||
print top_htmlhead('',$titleofloginpage,0,0,$arrayofjs);
|
||||
?>
|
||||
@ -49,7 +49,6 @@ $(document).ready(function () {
|
||||
<div align="center">
|
||||
<div class="login_vertical_align">
|
||||
|
||||
|
||||
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
|
||||
<input type="hidden" name="loginfunction" value="loginfunction" />
|
||||
|
||||
@ -159,7 +159,7 @@ class ProductFournisseur extends Product
|
||||
*/
|
||||
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $langs;
|
||||
|
||||
// Clean parameter
|
||||
if (empty($qty)) $qty=0;
|
||||
|
||||
@ -2279,8 +2279,13 @@ elseif (! empty($object->id))
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
|
||||
$object->fetch_projet();
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__ORDERREF__']=$object->ref;
|
||||
$formmail->substit['__ORDERSUPPLIERREF__']=$object->ref_supplier;
|
||||
$formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
|
||||
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
|
||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
||||
$formmail->substit['__PERSONALIZED__']='';
|
||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
||||
|
||||
@ -19,9 +19,11 @@
|
||||
* Upgrade scripts can be ran from command line with syntax:
|
||||
*
|
||||
* cd htdocs/install
|
||||
* php upgrade.php 3.4.0 3.5.0
|
||||
* php upgrade.php 3.4.0 3.5.0 [dirmodule|ignoredbversion]
|
||||
* php upgrade2.php 3.4.0 3.5.0
|
||||
*
|
||||
* Option 'dirmodule' allows to provide a path for an external module, so we migrate from command line a script from a module.
|
||||
* Option 'ignoredbversion' allows to run migration even if database is a bugged database version.
|
||||
* Return code is 0 if OK, >0 if error
|
||||
*/
|
||||
|
||||
@ -55,7 +57,8 @@ $setuplang=GETPOST("selectlang",'',3)?GETPOST("selectlang",'',3):'auto';
|
||||
$langs->setDefaultLang($setuplang);
|
||||
$versionfrom=GETPOST("versionfrom",'',3)?GETPOST("versionfrom",'',3):(empty($argv[1])?'':$argv[1]);
|
||||
$versionto=GETPOST("versionto",'',3)?GETPOST("versionto",'',3):(empty($argv[2])?'':$argv[2]);
|
||||
$versionmodule=GETPOST("versionmodule",'',3)?GETPOST("versionmodule",'',3):(empty($argv[3])?'':$argv[3]);
|
||||
$dirmodule=((GETPOST("dirmodule",'',3) && GETPOST("dirmodule",'',3) != 'ignoredbversion'))?GETPOST("dirmodule",'',3):((empty($argv[3]) || $argv[3] == 'ignoredbversion')?'':$argv[3]);
|
||||
$ignoredbversion=(GETPOST('ignoredbversion','',3)=='ignoredbversion')?GETPOST('ignoredbversion','',3):((empty($argv[3]) || $argv[3] != 'ignoredbversion')?'':$argv[3]);
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("install");
|
||||
@ -191,31 +194,34 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
|
||||
}
|
||||
|
||||
// Test database version is not forbidden for migration
|
||||
$dbversion_disallowed=array(
|
||||
array('type'=>'mysql','version'=>array(5,5,40)),
|
||||
array('type'=>'mysqli','version'=>array(5,5,40))
|
||||
//,array('type'=>'mysql','version'=>array(5,5,41)),
|
||||
//array('type'=>'mysqli','version'=>array(5,5,41))
|
||||
);
|
||||
$listofforbiddenversion='';
|
||||
foreach ($dbversion_disallowed as $dbversion_totest)
|
||||
{
|
||||
if ($dbversion_totest['type'] == $db->type) $listofforbiddenversion.=($listofforbiddenversion?', ':'').join('.',$dbversion_totest['version']);
|
||||
}
|
||||
foreach ($dbversion_disallowed as $dbversion_totest)
|
||||
{
|
||||
//print $db->type.' - '.join('.',$versionarray).' - '.versioncompare($dbversion_totest['version'],$versionarray)."<br>\n";
|
||||
if ($dbversion_totest['type'] == $db->type
|
||||
&& (versioncompare($dbversion_totest['version'],$versionarray) == 0 || versioncompare($dbversion_totest['version'],$versionarray)<=-4 || versioncompare($dbversion_totest['version'],$versionarray)>=4)
|
||||
)
|
||||
{
|
||||
// Warning: database version too low.
|
||||
print '<tr><td><div class="warning">'.$langs->trans("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion)."</div></td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
|
||||
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion));
|
||||
$ok=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($ignoredbversion))
|
||||
{
|
||||
$dbversion_disallowed=array(
|
||||
array('type'=>'mysql','version'=>array(5,5,40)),
|
||||
array('type'=>'mysqli','version'=>array(5,5,40)),
|
||||
array('type'=>'mysql','version'=>array(5,5,41)),
|
||||
array('type'=>'mysqli','version'=>array(5,5,41))
|
||||
);
|
||||
$listofforbiddenversion='';
|
||||
foreach ($dbversion_disallowed as $dbversion_totest)
|
||||
{
|
||||
if ($dbversion_totest['type'] == $db->type) $listofforbiddenversion.=($listofforbiddenversion?', ':'').join('.',$dbversion_totest['version']);
|
||||
}
|
||||
foreach ($dbversion_disallowed as $dbversion_totest)
|
||||
{
|
||||
//print $db->type.' - '.join('.',$versionarray).' - '.versioncompare($dbversion_totest['version'],$versionarray)."<br>\n";
|
||||
if ($dbversion_totest['type'] == $db->type
|
||||
&& (versioncompare($dbversion_totest['version'],$versionarray) == 0 || versioncompare($dbversion_totest['version'],$versionarray)<=-4 || versioncompare($dbversion_totest['version'],$versionarray)>=4)
|
||||
)
|
||||
{
|
||||
// Warning: database version too low.
|
||||
print '<tr><td><div class="warning">'.$langs->trans("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion)."</div></td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
|
||||
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion));
|
||||
$ok=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Force l'affichage de la progression
|
||||
@ -370,7 +376,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
|
||||
if ($ok)
|
||||
{
|
||||
$dir = "mysql/migration/"; // We use mysql migration scripts whatever is database driver
|
||||
if (! empty($versionmodule)) $dir=dol_buildpath('/'.$versionmodule.'/sql/',0);
|
||||
if (! empty($dirmodule)) $dir=dol_buildpath('/'.$dirmodule.'/sql/',0);
|
||||
|
||||
// Clean last part to exclude minor version x.y.z -> x.y
|
||||
$newversionfrom=preg_replace('/(\.[0-9]+)$/i','.0',$versionfrom);
|
||||
@ -475,7 +481,7 @@ $ret=0;
|
||||
if (! $ok && isset($argv[1])) $ret=1;
|
||||
dol_syslog("Exit ".$ret);
|
||||
|
||||
pFooter(((! $ok && empty($_GET["ignoreerrors"])) || $versionmodule),$setuplang);
|
||||
pFooter(((! $ok && empty($_GET["ignoreerrors"])) || $dirmodule),$setuplang);
|
||||
|
||||
if ($db->connected) $db->close();
|
||||
|
||||
|
||||
@ -490,7 +490,8 @@ if (! defined('NOLOGIN'))
|
||||
if (! $login || (in_array('ldap',$authmode) && empty($passwordtotest))) // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success.
|
||||
{
|
||||
// We show login page
|
||||
dol_loginfunction($langs,$conf,(! empty($mysoc)?$mysoc:''));
|
||||
dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." showing the login form and exit");
|
||||
dol_loginfunction($langs,$conf,(! empty($mysoc)?$mysoc:''));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -491,7 +491,7 @@ class MouvementStock extends CommonObject
|
||||
* @param int $qty Quantity of product with batch number
|
||||
* @return int <0 if KO, else return productbatch id
|
||||
*/
|
||||
function _create_batch($dluo, $qty )
|
||||
function _create_batch($dluo, $qty)
|
||||
{
|
||||
$pdluo=new Productbatch($this->db);
|
||||
|
||||
@ -516,7 +516,7 @@ class MouvementStock extends CommonObject
|
||||
$result = -1;
|
||||
}
|
||||
|
||||
//batch record found so we update it
|
||||
// Batch record found so we update it
|
||||
if ($result>0)
|
||||
{
|
||||
if ($pdluo->id >0)
|
||||
@ -556,8 +556,10 @@ class MouvementStock extends CommonObject
|
||||
* @param int $origintype origin type
|
||||
* @return string name url
|
||||
*/
|
||||
function get_origin($fk_origin, $origintype) {
|
||||
switch ($origintype) {
|
||||
function get_origin($fk_origin, $origintype)
|
||||
{
|
||||
switch ($origintype)
|
||||
{
|
||||
case 'commande':
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$origin = new Commande($this->db);
|
||||
|
||||
@ -157,7 +157,6 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase
|
||||
$warehouse2id=$warehouse2->create($user);
|
||||
|
||||
$localobject=new MouvementStock($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
|
||||
// Do a list of movement into warehouse 1
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user