Merge branch '3.5' of github.com:Dolibarr/dolibarr into 3.5
This commit is contained in:
commit
27266ba7e1
11
ChangeLog
11
ChangeLog
@ -3,9 +3,19 @@ English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 3.5.5 compared to 3.5.4 *****
|
||||
Fix: Holiday module was broken. Initializaion of amount of holidays failed.
|
||||
Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas.
|
||||
Fix: Fusion PDF button on unpaid invoice is no more displayed
|
||||
Fix: Unpaid invoice launch fusion PDF action even if it is only search (with enter keyboard input instead of lens click)
|
||||
Fix: Pb when showing log list of holiday module with some mysql versions.
|
||||
Fix: Error with bad timezone pushed by some browsers.
|
||||
Fix: shipping list SQL request was not filtering on shipping element
|
||||
Fix: debian package provided by dolibarr team must use embedded libraries.
|
||||
Fix: [ bug #1528 ] Leopard Services numeration module description is not translated.
|
||||
Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas
|
||||
Fix: [ bug #1534 ] Unknown error when deleting a product photo under special circumstances
|
||||
Fix: Update impayees.php
|
||||
Fix: Fix Link product, In list view and label product
|
||||
|
||||
***** ChangeLog for 3.5.4 compared to 3.5.3 *****
|
||||
Fix: Hide title of event when agenda module disabled.
|
||||
@ -323,6 +333,7 @@ Fix: Add a limit into list to avoid browser to hang when database is too large.
|
||||
Fix: [ bug #1212 ] 'jqueryFileTree.php' directory traversal vulnerability
|
||||
Fix: Agenda and Banks module were not working with multicompany module
|
||||
Fix: [ bug #1317 ] Removing a category does not remove all child categories
|
||||
Fix: [ bug #1380 ] Customer invoices are not grouped in company results report.
|
||||
|
||||
***** ChangeLog for 3.4.2 compared to 3.4.1 *****
|
||||
Fix: field's problem into company's page (RIB).
|
||||
|
||||
@ -30,8 +30,25 @@ if (! -s $CONFFILE)
|
||||
exit 1;
|
||||
}
|
||||
|
||||
print "Running doxygen, please wait...\n";
|
||||
$result=`doxygen $OPTIONS $CONFFILE 2>&1`;
|
||||
$SOURCE="../..";
|
||||
|
||||
# Get version $MAJOR, $MINOR and $BUILD
|
||||
$result = open( IN, "< " . $SOURCE . "/htdocs/filefunc.inc.php" );
|
||||
if ( !$result ) { die "Error: Can't open descriptor file " . $SOURCE . "/htdocs/filefunc.inc.php\n"; }
|
||||
while (<IN>) {
|
||||
if ( $_ =~ /define\('DOL_VERSION','([\d\.a-z\-]+)'\)/ ) { $PROJVERSION = $1; break; }
|
||||
}
|
||||
close IN;
|
||||
($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
|
||||
if ($MINOR eq '') { die "Error can't detect version into ".$SOURCE . "/htdocs/filefunc.inc.php"; }
|
||||
|
||||
|
||||
$version=$MAJOR.".".$MINOR.".".$BUILD;
|
||||
|
||||
|
||||
print "Running doxygen for version ".$version.", please wait...\n";
|
||||
print "cat $CONFFILE | sed -e 's/x\.y\.z/".$version."/' | doxygen $OPTIONS - 2>&1\n";
|
||||
$result=`cat $CONFFILE | sed -e 's/x\.y\.z/$version/' | doxygen $OPTIONS - 2>&1`;
|
||||
|
||||
print $result;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 3.5
|
||||
PROJECT_NUMBER = x.y.z
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
||||
@ -35,15 +35,15 @@ File added into doxygen generated documentation
|
||||
<div class="bannergroupmybanner">
|
||||
|
||||
<div class="banneritemmybanner">
|
||||
<script type="text/javascript"><!--
|
||||
google_ad_client = "pub-1071905880519467";
|
||||
/* PUBBANDEAUDOLIBARR */
|
||||
google_ad_slot = "1421205532";
|
||||
google_ad_width = 468;
|
||||
google_ad_height = 60;
|
||||
//-->
|
||||
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||||
<!-- BAN_728x90_DOXYGEN -->
|
||||
<ins class="adsbygoogle"
|
||||
style="display:inline-block;width:728px;height:90px"
|
||||
data-ad-client="ca-pub-1465985984238664"
|
||||
data-ad-slot="4297390217"></ins>
|
||||
<script>
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
</script>
|
||||
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -835,7 +835,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
}
|
||||
|
||||
// Show page nb only on iso languages (so default Helvetica font)
|
||||
if (pdf_getPDFFont($outputlangs) == 'Helvetica')
|
||||
if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica')
|
||||
{
|
||||
$pdf->SetXY(-20,-$posy);
|
||||
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
|
||||
|
||||
@ -77,7 +77,7 @@ class Holiday extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* updateSold
|
||||
* updateSold. Update sold and check table of users for holidays is complete. If not complete.
|
||||
*
|
||||
* @return int Return 1
|
||||
*/
|
||||
@ -886,7 +886,7 @@ class Holiday extends CommonObject
|
||||
$month = date('m',$now);
|
||||
$lastUpdate = $this->getConfCP('lastUpdate');
|
||||
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
|
||||
//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;
|
||||
//print 'month: '.$month.' '.$lastUpdate.' '.$monthLastUpdate;exit;
|
||||
|
||||
// Si la date du mois n'est pas la même que celle sauvegardée, on met à jour le timestamp
|
||||
if ($month != $monthLastUpdate)
|
||||
@ -983,25 +983,31 @@ class Holiday extends CommonObject
|
||||
*/
|
||||
function createCPusers($single=false,$userid='')
|
||||
{
|
||||
// Si c'est l'ensemble des utilisateurs à ajoutés
|
||||
if(!$single)
|
||||
// Si c'est l'ensemble des utilisateurs à ajouter
|
||||
if (! $single)
|
||||
{
|
||||
dol_syslog(get_class($this).'::createCPusers');
|
||||
foreach($this->fetchUsers(false,true) as $users) {
|
||||
$arrayofusers = $this->fetchUsers(false,true);
|
||||
|
||||
foreach($arrayofusers as $users)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_users";
|
||||
$sql.= " (fk_user, nb_holiday)";
|
||||
$sql.= " VALUES ('".$users['rowid']."','0')";
|
||||
|
||||
$this->db->query($sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) dol_print_error($this->db);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_users";
|
||||
$sql.= " (fk_user, nb_holiday)";
|
||||
$sql.= " VALUES ('".$userid."','0')";
|
||||
|
||||
$this->db->query($sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1048,7 +1054,7 @@ class Holiday extends CommonObject
|
||||
* uniquement pour vérifier si il existe de nouveau utilisateur
|
||||
*
|
||||
* @param boolean $liste si vrai retourne une liste, si faux retourne un array
|
||||
* @param boolean $type si vrai retourne pour Dolibarr si faux retourne pour CP
|
||||
* @param boolean $type si vrai retourne pour Dolibarr, si faux retourne pour CP
|
||||
* @return string retourne un tableau de tout les utilisateurs actifs
|
||||
*/
|
||||
function fetchUsers($liste=true,$type=true)
|
||||
@ -1263,50 +1269,56 @@ class Holiday extends CommonObject
|
||||
function verifNbUsers($userDolibarrWithoutCP,$userCP) {
|
||||
|
||||
if (empty($userCP)) $userCP=0;
|
||||
dol_syslog(get_class($this).'::verifNbUsers userDolibarr='.$userDolibarr.' userCP='.$userCP);
|
||||
dol_syslog(get_class($this).'::verifNbUsers userDolibarr='.$userDolibarrWithoutCP.' userCP='.$userCP);
|
||||
|
||||
// On vérifie les users Dolibarr sans CP
|
||||
if ($userDolibarrWithoutCP > 0)
|
||||
{
|
||||
$this->updateConfCP('nbUser',$userDolibarr);
|
||||
$this->db->begin();
|
||||
|
||||
$this->updateConfCP('nbUser',$userDolibarrWithoutCP);
|
||||
|
||||
$listUsersCP = $this->fetchUsers(true,false);
|
||||
|
||||
// On séléctionne les utilisateurs qui ne sont pas déjà dans le module
|
||||
$sql = "SELECT u.rowid, u.lastname, u.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.rowid NOT IN(".$listUsersCP.")";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
// Si pas d'erreur SQL
|
||||
if($result) {
|
||||
if ($listUsersCP != '') $sql.= " WHERE u.rowid NOT IN(".$listUsersCP.")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while($i < $num) {
|
||||
|
||||
while($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$uid = $obj->rowid;
|
||||
|
||||
// On ajoute l'utilisateur
|
||||
$this->createCPusers(true,$obj->rowid);
|
||||
//print "Add user rowid = ".$uid." into database holiday";
|
||||
|
||||
$result = $this->createCPusers(true,$uid);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
} else {
|
||||
// Erreur SQL
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::verifNbUsers ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
// Si il y a moins d'utilisateur Dolibarr que dans le module CP
|
||||
$this->db->begin();
|
||||
|
||||
$this->updateConfCP('nbUser',$userDolibarr);
|
||||
// Si il y a moins d'utilisateur Dolibarr que dans le module CP
|
||||
|
||||
$this->updateConfCP('nbUser',$userDolibarrWithoutCP);
|
||||
|
||||
$listUsersDolibarr = $this->fetchUsers(true,true);
|
||||
|
||||
@ -1333,11 +1345,12 @@ class Holiday extends CommonObject
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
} else {
|
||||
// Erreur SQL
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::verifNbUsers ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1674,12 +1687,12 @@ class Holiday extends CommonObject
|
||||
|
||||
// Filtrage de séléction
|
||||
if(!empty($filter)) {
|
||||
$sql.= $filter;
|
||||
$sql.= " ".$filter;
|
||||
}
|
||||
|
||||
// Ordre d'affichage
|
||||
if(!empty($order)) {
|
||||
$sql.= $order;
|
||||
$sql.= " ".$order;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetchLog sql=".$sql, LOG_DEBUG);
|
||||
|
||||
@ -43,14 +43,17 @@ $action=GETPOST('action');
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$userstatic=new User($db);
|
||||
$holiday = new Holiday($db);
|
||||
|
||||
|
||||
llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||
|
||||
print_fiche_titre($langs->trans('MenuConfCP'));
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
$holiday->updateSold(); // Create users into table holiday if they don't exists. TODO Remove if we use field into table user.
|
||||
|
||||
$listUsers = $holiday->fetchUsers(false,false);
|
||||
$userstatic=new User($db);
|
||||
|
||||
// Si il y a une action de mise à jour
|
||||
if ($action == 'update' && isset($_POST['update_cp']))
|
||||
@ -71,7 +74,7 @@ if ($action == 'update' && isset($_POST['update_cp']))
|
||||
$comment = ((isset($_POST['note_holiday'][$userID]) && !empty($_POST['note_holiday'][$userID])) ? ' ('.$_POST['note_holiday'][$userID].')' : '');
|
||||
|
||||
// We add the modification to the log
|
||||
$holiday->addLogCP($user->id,$userID, $langs->trans('ManualUpdate').$comment,$userValue);
|
||||
$holiday->addLogCP($user->id,$userID, $langs->transnoentitiesnoconv('ManualUpdate').$comment,$userValue);
|
||||
|
||||
// Update of the days of the employee
|
||||
$holiday->updateSoldeCP($userID,$userValue);
|
||||
|
||||
@ -237,9 +237,9 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes')
|
||||
if($user->rights->holiday->delete)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$cp = new Holiday($db);
|
||||
$cp->fetch($id);
|
||||
|
||||
@ -251,12 +251,12 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes')
|
||||
{
|
||||
$result=$cp->delete($id);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$error = $langs->trans('ErrorCantDeleteCP');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
@ -265,7 +265,7 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes')
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -384,7 +384,7 @@ if($action == 'confirm_valid')
|
||||
$verif = $cp->update($user->id);
|
||||
|
||||
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
||||
if ($verif > 0)
|
||||
if ($verif > 0)
|
||||
{
|
||||
// Calculcate number of days consummed
|
||||
$nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1);
|
||||
@ -470,7 +470,7 @@ if ($action == 'confirm_refuse')
|
||||
$verif = $cp->update($user->id);
|
||||
|
||||
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
||||
if ($verif > 0)
|
||||
if ($verif > 0)
|
||||
{
|
||||
// To
|
||||
$destinataire = new User($db);
|
||||
@ -541,7 +541,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
|
||||
if (($cp->statut == 2 || $cp->statut == 3) && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
$oldstatus = $cp->statut;
|
||||
$cp->date_cancel = dol_now();
|
||||
$cp->fk_user_cancel = $user->id;
|
||||
@ -568,16 +568,16 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
|
||||
$error = $langs->trans('ErrorCantDeleteCP');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
|
||||
// Si pas d'erreur SQL on redirige vers la fiche de la demande
|
||||
if (! $error && $result > 0)
|
||||
{
|
||||
@ -874,7 +874,7 @@ else
|
||||
if($user->id == $cp->fk_user || $user->rights->holiday->lire_tous)
|
||||
{
|
||||
|
||||
if ($action == 'delete')
|
||||
if ($action == 'delete')
|
||||
{
|
||||
if($user->rights->holiday->delete)
|
||||
{
|
||||
@ -943,8 +943,8 @@ else
|
||||
print $langs->trans($listhalfday[$starthalfday]);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
|
||||
@ -965,8 +965,8 @@ else
|
||||
print $langs->trans($listhalfday[$endhalfday]);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -37,7 +37,7 @@ if(!$user->rights->holiday->view_log) accessforbidden();
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
*/
|
||||
|
||||
$langs->load('users');
|
||||
|
||||
@ -45,7 +45,7 @@ llxHeader(array(),$langs->trans('CPTitreMenu'));
|
||||
|
||||
|
||||
$cp = new Holiday($db);
|
||||
//Recent changes are more important than old changes
|
||||
// Recent changes are more important than old changes
|
||||
$log_holiday = $cp->fetchLog('ORDER BY cpl.rowid DESC','');
|
||||
|
||||
print_fiche_titre($langs->trans('LogCP'));
|
||||
|
||||
199
test/phpunit/SqlTest.php
Executable file
199
test/phpunit/SqlTest.php
Executable file
@ -0,0 +1,199 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file test/phpunit/SqlTest.php
|
||||
* \ingroup test
|
||||
* \brief PHPUnit test
|
||||
* \remarks To run this script as CLI: phpunit filename.php
|
||||
*/
|
||||
|
||||
global $conf,$user,$langs,$db;
|
||||
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
|
||||
//require_once 'PHPUnit/Autoload.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php';
|
||||
require_once dirname(__FILE__).'/../../htdocs/core/lib/security2.lib.php';
|
||||
|
||||
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||
|
||||
if (empty($user->id))
|
||||
{
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
$user->fetch(1);
|
||||
$user->getrights();
|
||||
}
|
||||
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
|
||||
|
||||
|
||||
/**
|
||||
* Class for PHPUnit tests
|
||||
*
|
||||
* @backupGlobals disabled
|
||||
* @backupStaticAttributes enabled
|
||||
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
|
||||
*/
|
||||
class SqlTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $savconf;
|
||||
protected $savuser;
|
||||
protected $savlangs;
|
||||
protected $savdb;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* We save global variables into local variables
|
||||
*
|
||||
* @return SecurityTest
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
//$this->sharedFixture
|
||||
global $conf,$user,$langs,$db;
|
||||
$this->savconf=$conf;
|
||||
$this->savuser=$user;
|
||||
$this->savlangs=$langs;
|
||||
$this->savdb=$db;
|
||||
|
||||
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
|
||||
//print " - db ".$db->db;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
// Static methods
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$db->rollback();
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* testSql
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function testSql()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$filesarray = scandir(DOL_DOCUMENT_ROOT.'/install/mysql/tables');
|
||||
foreach($filesarray as $key => $file)
|
||||
{
|
||||
if (! preg_match('/\.sql$/',$file)) continue;
|
||||
|
||||
print 'Check sql file '.$file."\n";
|
||||
$filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/install/mysql/tables/'.$file);
|
||||
|
||||
$result=strpos($filecontent,'`');
|
||||
print __METHOD__." Result for checking we don't have back quote = ".$result."\n";
|
||||
$this->assertTrue($result===false, 'Found ON back quote. Bad.');
|
||||
|
||||
$result=strpos($filecontent,'int(');
|
||||
print __METHOD__." Result for checking we don't have 'int(' instead of 'integer' = ".$result."\n";
|
||||
$this->assertTrue($result===false, 'Found int(x) instead of integer. Bad.');
|
||||
|
||||
$result=strpos($filecontent,'ON DELETE CASCADE');
|
||||
print __METHOD__." Result for checking we don't have 'ON DELETE CASCADE' = ".$result."\n";
|
||||
$this->assertTrue($result===false, 'Found ON DELETE CASCADE. Bad.');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* testInitData
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function testInitData()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdata');
|
||||
foreach($filesarray as $key => $file)
|
||||
{
|
||||
if (! preg_match('/\.sql$/',$file)) continue;
|
||||
|
||||
print 'Check sql file '.$file."\n";
|
||||
$filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/../dev/initdata/'.$file);
|
||||
|
||||
$result=strpos($filecontent,'@gmail.com');
|
||||
print __METHOD__." Result for checking we don't have personal data = ".$result."\n";
|
||||
$this->assertTrue($result===false, 'Found a bad key into file '.$file);
|
||||
|
||||
$result=strpos($filecontent,'eldy@');
|
||||
print __METHOD__." Result for checking we don't have personal data = ".$result."\n";
|
||||
$this->assertTrue($result===false, 'Found a bad key into file '.$file);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user