This commit is contained in:
frederic34
2015-01-06 17:54:36 +01:00
parent f7dd4a1357
commit 73fda2cb86
70 changed files with 3612 additions and 3523 deletions

View File

@@ -183,15 +183,60 @@
<!-- <rule ref="Generic.Classes.DuplicateClassName" /> --> <!-- <rule ref="Generic.Classes.DuplicateClassName" /> -->
<rule ref="PEAR.Commenting.ClassComment" /> <rule ref="PEAR.Commenting.ClassComment" />
<rule ref="PEAR.Commenting.ClassComment.MissingTag">
<severity>0</severity> <rule ref="PEAR.Commenting.ClassComment.MissingTag" />
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag" />
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag" />
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag" />
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag" />
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag" />
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType" />
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName" />
<rule ref="PEAR.Commenting.ClassComment.Missing" />
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn" />
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired" />
<rule ref="PEAR.Commenting.FunctionComment.Missing" />
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag" />
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag" />
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag" />
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag" />
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag" />
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType" />
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName" />
<rule ref="PEAR.Commenting.ClassComment.Missing" />
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn" />
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired" />
<rule ref="PEAR.Commenting.FunctionComment.Missing" />
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag"> <rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag"> <rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag"> <rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
@@ -201,93 +246,20 @@
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag"> <rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType"> <rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName"> <rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<!-- TODO Remove this and fix reported errors --> <rule ref="PEAR.Commenting.ClassComment.Missing" />
<rule ref="PEAR.Commenting.ClassComment.Missing">
<severity>0</severity> <rule ref="PEAR.Commenting.FunctionComment.MissingReturn" />
</rule>
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn"> <rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired" />
<severity>0</severity>
</rule> <rule ref="PEAR.Commenting.FunctionComment.Missing" />
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity>
</rule>
<!-- TODO Remove this and fix reported errors -->
<rule ref="PEAR.Commenting.ClassComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
<severity>0</severity>
</rule>
<!-- TODO Remove this and fix reported errors -->
<rule ref="PEAR.Commenting.ClassComment.Missing">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.FunctionComment.Missing">
<severity>0</severity>
</rule>
<!-- <!--
<rule ref="PEAR.Commenting.FileComment" /> <rule ref="PEAR.Commenting.FileComment" />

View File

@@ -40,6 +40,16 @@ class autoTranslator
const DIR_SEPARATOR = '/'; const DIR_SEPARATOR = '/';
/**
* Constructor
*
* @param string $_destlang Destination lang
* @param string $_refLang Ref lang
* @param string $_langDir Dir lang
* @param string $_limittofile Limit to file
* @param string $_apikey Api key
* @return void
*/
function __construct($_destlang,$_refLang,$_langDir,$_limittofile,$_apikey) function __construct($_destlang,$_refLang,$_langDir,$_limittofile,$_apikey)
{ {

View File

@@ -34,8 +34,7 @@ if (!$user->admin) accessforbidden();
llxHeader(); llxHeader();
if (!function_exists('eaccelerator_info')) if (!function_exists('eaccelerator_info')) {
{
print 'eAccelerator is not installed.'; print 'eAccelerator is not installed.';
llxFooter(); llxFooter();
exit; exit;
@@ -69,17 +68,24 @@ if (!is_array($info)) {
} }
/**
* Compare revisions
*
* @param array $x Parts of version 1
* @param array $y Parts of version 2
* @return int -1 if 1<2, 0 if 1=2, 1 if 1>2
*/
function compare($x, $y) function compare($x, $y)
{ {
global $sortby; global $sortby;
if ( $x[$sortby] == $y[$sortby] ) if ( $x[$sortby] == $y[$sortby] ) {
return 0; return 0;
else if ( $x[$sortby] < $y[$sortby] ) } else if ($x[$sortby] < $y[$sortby]) {
return -1; return -1;
else } else {
return 1; return 1;
}
} }
/** /**
@@ -93,12 +99,13 @@ function revcompare($x, $y)
{ {
global $sortby, $langs; global $sortby, $langs;
if ( $x[$sortby] == $y[$sortby] ) if ($x[$sortby] == $y[$sortby]) {
return 0; return 0;
else if ( $x[$sortby] < $y[$sortby] ) } else if ($x[$sortby] < $y[$sortby]) {
return 1; return 1;
else } else {
return -1; return -1;
}
} }
/** /**
@@ -133,21 +140,24 @@ function create_script_table($list)
} }
} }
?> print '<table class="noborder">';
<table class="noborder"> print '<tr>';
<tr> print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=file&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Filename").'</a>&nbsp;';
<th><a if($sortby == "file")
href="<?php print $_SERVER['PHP_SELF']?>?sort=file&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Filename"); ?></a>&nbsp;<?php if($sortby == "file") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th> print ($order == "asc" ? "&darr;" : "&uarr;").'</th>';
<th><a print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=mtime&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Date").'</a>&nbsp;';
href="<?php print $_SERVER['PHP_SELF']?>?sort=mtime&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Date"); ?></a>&nbsp;<?php if($sortby == "mtime") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th> if($sortby == "mtime")
<th><a print ($order == "asc" ? "&darr;" : "&uarr;").'</th>';
href="<?php print $_SERVER['PHP_SELF']?>?sort=size&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Size"); ?></a>&nbsp;<?php if($sortby == "size") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th> print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=size&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Size").'</a>&nbsp;';
<th><a if($sortby == "size")
href="<?php print $_SERVER['PHP_SELF']?>?sort=reloads&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Reloads"); ?></a>&nbsp;<?php if($sortby == "reloads") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th> print ($order == "asc" ? "&darr;" : "&uarr;").'</th>';
<th><a print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=reloads&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Reloads").'</a>&nbsp;';
href="<?php print $_SERVER['PHP_SELF']?>?sort=hits&order=<?php print ($order == "asc" ? "desc" : "asc")?>"><?php print $langs->trans("Hits"); ?></a>&nbsp;<?php if($sortby == "hits") print ($order == "asc" ? "&darr;" : "&uarr;") ?></th> if($sortby == "reloads")
</tr> print ($order == "asc" ? "&darr;" : "&uarr;").'</th>';
<?php print '<th><a href="'.$_SERVER['PHP_SELF'].'?sort=hits&order='.($order == "asc" ? "desc" : "asc").'">'.$langs->trans("Hits").'</a>&nbsp;';
if($sortby == "hits")
print ($order == "asc" ? "&darr;" : "&uarr;").'</th>';
print '</tr>';
switch ($sortby) { switch ($sortby) {
case "mtime": case "mtime":
case "size": case "size":
@@ -162,18 +172,18 @@ function create_script_table($list)
} }
foreach($list as $script) { ?> foreach($list as $script) {
<tr <?php $var = ! $var; print $bc[$var]; ?>> $var = ! $var;
<td><?php print dol_trunc($script['file'],80,'left'); ?></td> print '<tr '.$bc[$var].'>';
<td align="center" class="nowrap"><?php print dol_print_date($script['mtime'],'dayhour'); ?></td> print '<td>'.dol_trunc($script['file'],80,'left').'</td>';
<td align="right" class="nowrap"><?php print number_format($script['size'] / 1024, 2); ?> print '<td align="center" class="nowrap">'.dol_print_date($script['mtime'],'dayhour').'</td>';
KB</td> print '<td align="right" class="nowrap">'.number_format($script['size'] / 1024, 2).'KB</td>';
<td align="right" class="nowrap"><?php print $script['reloads']; ?> (<?php print $script['usecount']; ?>)</td> print '<td align="right" class="nowrap">'.$script['reloads'].' ('.$script['usecount'].')</td>';
<td align="right" class="nowrap"><?php print $script['hits']; ?></td> print '<td align="right" class="nowrap">'.$script['hits'].'</td>';
</tr> print '</tr>';
<?php } ?> }
</table> print '</table>';
<?php
} }
/** /**
@@ -186,23 +196,22 @@ function create_key_table($list)
{ {
global $bc,$langs; global $bc,$langs;
$var=true; $var=true;
?>
<table class="noborder"> print '<table class="noborder">';
<tr class="liste_titre"> print '<tr class="liste_titre">';
<th>Name</th> print '<th>Name</th>';
<th>Created</th> print '<th>Created</th>';
<th><?php print $langs->trans("Size"); ?></th> print '<th>'.$langs->trans("Size").'</th>';
<th>ttl</th> print '<th>ttl</th>';
</tr> print '</tr>';
<?php
foreach($list as $key) { foreach($list as $key) {
?> $var = !$var;
<tr <?php $var = ! $var; print $bc[$var]; ?>> print '<tr '.$bc[$var].'>';
<td><?php print dol_trunc($key['name'],80,'left'); ?></td> print '<td>'.dol_trunc($key['name'],80,'left').'</td>';
<td align="center" class="nowrap"><?php dol_print_date($key['created'],'dayhour'); ?></td> print '<td align="center" class="nowrap">'.dol_print_date($key['created'],'dayhour').'</td>';
<td align="right" class="nowrap"><?php print number_format($key['size']/1024, 3); ?> print '<td align="right" class="nowrap">'.number_format($key['size']/1024, 3).'KB</td>';
KB</td> print '<td align="right" class="nowrap">';
<td align="right" class="nowrap"><?php
if ($key['ttl'] == -1) { if ($key['ttl'] == -1) {
print 'expired'; print 'expired';
} elseif ($key['ttl'] == 0) { } elseif ($key['ttl'] == 0) {
@@ -210,13 +219,10 @@ function create_key_table($list)
} else { } else {
print dol_print_date($key['ttl'],'dayhour'); print dol_print_date($key['ttl'],'dayhour');
} }
?></td> print '</td>';
</tr> print '</tr>';
<?php
} }
?> print '</table>';
</table>
<?php
} }
@@ -225,63 +231,63 @@ print_fiche_titre('Dolibarr eAccelerator '.$info['version'].' control panel','',
$var=true; $var=true;
?> print '<br>';
<br>
<table class="noborder"> print '<table class="noborder">';
<tr class="liste_titre"> print '<tr class="liste_titre">';
<td colspan="2">Information</td> print '<td colspan="2">Information</td>';
</tr> print '</tr>';
<tr <?php $var = ! $var; print $bc[$var]; ?>> $var = !$var;
<td>Caching enabled</td> print '<tr '.$bc[$var].'>';
<td align="right"><?php print $info['cache'] ? 'yes':'no' ?></td> print '<td>Caching enabled</td>';
</tr> print '<td align="right">'.($info['cache']?'yes':'no').'</td>';
<tr <?php $var = ! $var; print $bc[$var]; ?>> print '</tr>';
<td>Optimizer enabled</td> $var = !$var;
<td align="right"><?php print $info['optimizer'] ? 'yes':'no' ?></td> print '<tr '.$bc[$var].'>';
</tr> print '<td>Optimizer enabled</td>';
<tr <?php $var = ! $var; print $bc[$var]; ?>> print '<td align="right">'.$info['optimizer']?'yes':'no'.'</td>';
<td>Memory usage</td> print '</tr>';
<td align="right"><?php print number_format(100 * $info['memoryAllocated'] / $info['memorySize'], 2); ?>% $var = !$var;
(<?php print number_format($info['memoryAllocated'] / (1024*1024), 2); ?> print '<tr '.$bc[$var].'>';
MB / <?php print number_format($info['memorySize'] / (1024*1024), 2); ?> print '<td>Memory usage</td>';
MB)</td> print '<td align="right">'.number_format(100 * $info['memoryAllocated']/$info['memorySize'], 2).'%('.number_format($info['memoryAllocated'] / (1024*1024), 2).'MB / '.number_format($info['memorySize']/(1024*1024), 2).'MB)</td>';
</tr> print '</tr>';
<tr <?php $var = ! $var; print $bc[$var]; ?>> $var = ! $var;
<td>Free memory in reserved cache</td> print '<tr '.$bc[$var].'>';
<td align="right"><?php print number_format($info['memoryAvailable'] / (1024*1024), 2); ?>MB</td> print '<td>Free memory in reserved cache</td>';
</tr> print '<td align="right">'.number_format($info['memoryAvailable']/(1024*1024), 2).'MB</td>';
<tr <?php $var = ! $var; print $bc[$var]; ?>> print '</tr>';
<td>Cached scripts</td> $var = ! $var;
<td align="right"><?php print $info['cachedScripts']; ?></td> print '<tr '.$bc[$var].'>';
</tr> print '<td>Cached scripts</td>';
<tr <?php $var = ! $var; print $bc[$var]; ?>> print '<td align="right">'.$info['cachedScripts'].'</td>';
<td>Removed scripts</td> print '</tr>';
<td align="right"><?php print $info['removedScripts']; ?></td> $var = ! $var;
</tr> print '<tr '.$bc[$var].'>';
<tr <?php $var = ! $var; print $bc[$var]; ?>> print '<td>Removed scripts</td>';
<td>Cached keys</td> print '<td align="right">'.$info['removedScripts'].'</td>';
<td align="right"><?php print (isset($info['cachedKeys'])?$info['cachedKeys']:''); ?></td> print '</tr>';
</tr> $var = ! $var;
</table> print '<tr '.$bc[$var].'>';
<?php print '<td>Cached keys</td>';
print '<td align="right">'.(isset($info['cachedKeys'])?$info['cachedKeys']:'').'</td>';
print '</tr>';
print '</table>';
$var=true; $var=true;
$resCached = @eaccelerator_cached_scripts(); // If success return an array $resCached = @eaccelerator_cached_scripts(); // If success return an array
$resRemoved = @eaccelerator_removed_scripts(); $resRemoved = @eaccelerator_removed_scripts();
if (is_array($resCached) || is_array($resRemoved)) if (is_array($resCached) || is_array($resRemoved)) {
{
print "<br>"; print "<br>";
print '<form name="ea_control" method="post">'; print '<form name="ea_control" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre"><td colspan="2">Actions</td></tr>'; print '<tr class="liste_titre"><td colspan="2">Actions</td></tr>';
if (is_array($resCached)) if (is_array($resCached)) {
{
$var = ! $var; $var = ! $var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print "<td>Caching</td>"; print "<td>Caching</td>";
@@ -294,8 +300,7 @@ if (is_array($resCached) || is_array($resRemoved))
print "</tr>"; print "</tr>";
} }
if (is_array($resRemoved)) if (is_array($resRemoved)) {
{
$var = ! $var; $var = ! $var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print "<td>Clear cache</td>"; print "<td>Clear cache</td>";
@@ -313,22 +318,18 @@ if (is_array($resCached) || is_array($resRemoved))
print "</tr></table></form>"; print "</tr></table></form>";
} }
if (is_array($resCached)) if (is_array($resCached)) {
{
print "<br><br>"; print "<br><br>";
print "<b>Cached scripts</b><br>"; print "<b>Cached scripts</b><br>";
create_script_table($resCached); create_script_table($resCached);
} }
if (is_array($resRemoved)) if (is_array($resRemoved)) {
{
print "<br><br>"; print "<br><br>";
print "<b>Removed scripts</b><br>"; print "<b>Removed scripts</b><br>";
create_script_table($resRemoved); create_script_table($resRemoved);
} }
} } else {
else
{
print "<br><br>"; print "<br><br>";
print "Check in your <b>php.ini</b> that <b>eaccelerator.allowed_admin_path</b> parameter is : "; print "Check in your <b>php.ini</b> that <b>eaccelerator.allowed_admin_path</b> parameter is : ";
print "<br><br>"; print "<br><br>";
@@ -336,8 +337,7 @@ else
print "<br><br>"; print "<br><br>";
} }
if (function_exists('eaccelerator_get')) if (function_exists('eaccelerator_get')) {
{
print '<br><br>'; print '<br><br>';
print '<b>Cached keys</b><br>'; print '<b>Cached keys</b><br>';
$res=eaccelerator_list_keys(); $res=eaccelerator_list_keys();

View File

@@ -30,8 +30,7 @@ $langs->load("other");
$localTaxType=GETPOST('localTaxType', 'int'); $localTaxType=GETPOST('localTaxType', 'int');
$year=$_GET["year"]; $year=$_GET["year"];
if ($year == 0 ) if ($year == 0 ) {
{
$year_current = strftime("%Y",time()); $year_current = strftime("%Y",time());
$year_start = $year_current; $year_start = $year_current;
} else { } else {
@@ -41,21 +40,30 @@ if ($year == 0 )
// Security check // Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:''; $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id)
$socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges'); $result = restrictedArea($user, 'tax', '', '', 'charges');
// Define modetax (0 or 1) // Define modetax (0 or 1)
// 0=normal, 1=option vat for services is on debit // 0=normal, 1=option vat for services is on debit
$modetax = $conf->global->TAX_MODE; $modetax = $conf->global->TAX_MODE;
if (isset($_GET["modetax"])) $modetax=$_GET["modetax"]; if (isset($_GET["modetax"]))
$modetax=$_GET["modetax"];
/**
* print function
*
* @param DoliDB $db Database
* @param string $sql sql
* @param string $date date
* @return void
*/
function pt ($db, $sql, $date) function pt ($db, $sql, $date)
{ {
global $conf, $bc,$langs; global $conf, $bc,$langs;
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$total = 0; $total = 0;
@@ -66,8 +74,7 @@ function pt ($db, $sql, $date)
print '<td>&nbsp;</td>'."\n"; print '<td>&nbsp;</td>'."\n";
print "</tr>\n"; print "</tr>\n";
$var=True; $var=True;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
@@ -83,8 +90,7 @@ function pt ($db, $sql, $date)
print "</table>"; print "</table>";
$db->free($result); $db->free($result);
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -96,17 +102,14 @@ function pt ($db, $sql, $date)
llxHeader(); llxHeader();
if($localTaxType==1) if($localTaxType==1) {
{
$LT='LT1'; $LT='LT1';
$LTSummary='LT1Summary'; $LTSummary='LT1Summary';
$LTPaid='LT1Paid'; $LTPaid='LT1Paid';
$LTCustomer='LT1Customer'; $LTCustomer='LT1Customer';
$LTSupplier='LT1Supplier'; $LTSupplier='LT1Supplier';
$CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC1; $CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC1;
} } else {
else
{
$LT='LT2'; $LT='LT2';
$LTSummary='LT2Summary'; $LTSummary='LT2Summary';
$LTPaid='LT2Paid'; $LTPaid='LT2Paid';
@@ -138,17 +141,14 @@ print '<tr><td width="50%" valign="top">';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print "<td width=\"30%\">".$langs->trans("Year")." $y</td>"; print "<td width=\"30%\">".$langs->trans("Year")." $y</td>";
if($CalcLT==0) if($CalcLT==0) {
{
print "<td align=\"right\">".$langs->transcountry($LTCustomer,$mysoc->country_code)."</td>"; print "<td align=\"right\">".$langs->transcountry($LTCustomer,$mysoc->country_code)."</td>";
print "<td align=\"right\">".$langs->transcountry($LTSupplier,$mysoc->country_code)."</td>"; print "<td align=\"right\">".$langs->transcountry($LTSupplier,$mysoc->country_code)."</td>";
} }
if($CalcLT==1) if($CalcLT==1) {
{
print "<td align=\"right\">".$langs->transcountry($LTSupplier,$mysoc->country_code)."</td><td></td>"; print "<td align=\"right\">".$langs->transcountry($LTSupplier,$mysoc->country_code)."</td><td></td>";
} }
if($CalcLT==2) if($CalcLT==2) {
{
print "<td align=\"right\">".$langs->transcountry($LTCustomer,$mysoc->country_code)."</td><td></td>"; print "<td align=\"right\">".$langs->transcountry($LTCustomer,$mysoc->country_code)."</td><td></td>";
} }
@@ -161,8 +161,7 @@ $y = $year_current ;
$var=True; $var=True;
$total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0; $total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
$i=0; $i=0;
for ($m = 1 ; $m < 13 ; $m++ ) for ($m = 1 ; $m < 13 ; $m++ ) {
{
$coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
$coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
@@ -175,54 +174,43 @@ for ($m = 1 ; $m < 13 ; $m++ )
$hookmanager->initHooks(array('externalbalance')); $hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if (! is_array($coll_listbuy) && $coll_listbuy == -1) if (! is_array($coll_listbuy) && $coll_listbuy == -1) {
{
$langs->load("errors"); $langs->load("errors");
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>'; print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
break; break;
} }
if (! is_array($coll_listbuy) && $coll_listbuy == -2) if (! is_array($coll_listbuy) && $coll_listbuy == -2) {
{
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'; print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
break; break;
} }
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print '<tr '.$bc[$var].'>';
print '<td class="nowrap">'.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").'</td>'; print '<td class="nowrap">'.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").'</td>';
if($CalcLT==0) if($CalcLT==0) {
{
$x_coll = 0; $x_coll = 0;
foreach($coll_listsell as $vatrate=>$val) foreach($coll_listsell as $vatrate=>$val) {
{
$x_coll+=$val[$localTaxType==1?'localtax1':'localtax2']; $x_coll+=$val[$localTaxType==1?'localtax1':'localtax2'];
} }
$subtotalcoll = $subtotalcoll + $x_coll; $subtotalcoll = $subtotalcoll + $x_coll;
print "<td class=\"nowrap\" align=\"right\">".price($x_coll)."</td>"; print "<td class=\"nowrap\" align=\"right\">".price($x_coll)."</td>";
$x_paye = 0; $x_paye = 0;
foreach($coll_listbuy as $vatrate=>$val) foreach($coll_listbuy as $vatrate=>$val) {
{
$x_paye+=$val[$localTaxType==1?'localtax1':'localtax2']; $x_paye+=$val[$localTaxType==1?'localtax1':'localtax2'];
} }
$subtotalpaye = $subtotalpaye + $x_paye; $subtotalpaye = $subtotalpaye + $x_paye;
print "<td class=\"nowrap\" align=\"right\">".price($x_paye)."</td>"; print "<td class=\"nowrap\" align=\"right\">".price($x_paye)."</td>";
} } elseif($CalcLT==1) {
elseif($CalcLT==1)
{
$x_paye = 0; $x_paye = 0;
foreach($coll_listbuy as $vatrate=>$val) foreach($coll_listbuy as $vatrate=>$val) {
{
$x_paye+=$val[$localTaxType==1?'localtax1':'localtax2']; $x_paye+=$val[$localTaxType==1?'localtax1':'localtax2'];
} }
$subtotalpaye = $subtotalpaye + $x_paye; $subtotalpaye = $subtotalpaye + $x_paye;
print "<td class=\"nowrap\" align=\"right\">".price($x_paye)."</td><td></td>"; print "<td class=\"nowrap\" align=\"right\">".price($x_paye)."</td><td></td>";
} } elseif($CalcLT==2) {
elseif($CalcLT==2)
{
$x_coll = 0; $x_coll = 0;
foreach($coll_listsell as $vatrate=>$val) foreach($coll_listsell as $vatrate=>$val) {
{
$x_coll+=$val[$localTaxType==1?'localtax1':'localtax2']; $x_coll+=$val[$localTaxType==1?'localtax1':'localtax2'];
} }
$subtotalcoll = $subtotalcoll + $x_coll; $subtotalcoll = $subtotalcoll + $x_coll;
@@ -230,16 +218,11 @@ for ($m = 1 ; $m < 13 ; $m++ )
} }
if($CalcLT==0) if($CalcLT==0) {
{
$diff= $x_coll - $x_paye; $diff= $x_coll - $x_paye;
} } elseif($CalcLT==1) {
elseif($CalcLT==1)
{
$diff= $x_paye; $diff= $x_paye;
} } elseif($CalcLT==2) {
elseif($CalcLT==2)
{
$diff= $x_coll; $diff= $x_coll;
} }
@@ -251,23 +234,17 @@ for ($m = 1 ; $m < 13 ; $m++ )
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
if ($i > 2) if ($i > 2) {
{
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td align="right">'.$langs->trans("SubTotal").':</td>'; print '<td align="right">'.$langs->trans("SubTotal").':</td>';
if($CalcLT==0) if($CalcLT==0) {
{
print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td>'; print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td>';
print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td>'; print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td>';
print '<td class="nowrap" align="right">'.price($subtotal).'</td>'; print '<td class="nowrap" align="right">'.price($subtotal).'</td>';
} } elseif($CalcLT==1) {
elseif($CalcLT==1)
{
print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td><td></td>'; print '<td class="nowrap" align="right">'.price($subtotalpaye).'</td><td></td>';
print '<td class="nowrap" align="right">'.price($subtotal).'</td>'; print '<td class="nowrap" align="right">'.price($subtotal).'</td>';
} } elseif($CalcLT==2) {
elseif($CalcLT==2)
{
print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td><td></td>'; print '<td class="nowrap" align="right">'.price($subtotalcoll).'</td><td></td>';
print '<td class="nowrap" align="right">'.price($subtotal).'</td>'; print '<td class="nowrap" align="right">'.price($subtotal).'</td>';
} }
@@ -298,7 +275,7 @@ $sql.= " GROUP BY dm ASC";
pt($db, $sql,$langs->trans("Year")." $y"); pt($db, $sql,$langs->trans("Year")." $y");
print "</td></tr></table>"; print '</td></tr></table>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';

View File

@@ -38,14 +38,18 @@ class box_project extends ModeleBoxes
var $info_box_contents = array(); var $info_box_contents = array();
/** /**
* \brief Constructeur de la classe * Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/ */
function box_project() function __construct($db,$param='')
{ {
global $langs; global $langs;
$langs->load("boxes"); $langs->load("boxes");
$langs->load("projects"); $langs->load("projects");
$this->db = $db;
$this->boxlabel="Projects"; $this->boxlabel="Projects";
} }
@@ -69,8 +73,7 @@ class box_project extends ModeleBoxes
$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
// list the summary of the orders // list the summary of the orders
if ($user->rights->projet->lire) if ($user->rights->projet->lire) {
{
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut "; $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut ";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
@@ -81,23 +84,26 @@ class box_project extends ModeleBoxes
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array(
'td' => 'align="left" width="16"',
'logo' => 'object_project', 'logo' => 'object_project',
'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid); 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid
);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array(
'td' => 'align="left"',
'text' => $objp->ref, 'text' => $objp->ref,
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid
);
$this->info_box_contents[$i][2] = array('td' => 'align="left"', $this->info_box_contents[$i][2] = array(
'td' => 'align="left"',
'text' => $objp->title 'text' => $objp->title
); );
@@ -106,8 +112,7 @@ class box_project extends ModeleBoxes
$sql.=" WHERE p.entity = ".$conf->entity; $sql.=" WHERE p.entity = ".$conf->entity;
$resultTask = $db->query($sql); $resultTask = $db->query($sql);
if ($resultTask) if ($resultTask) {
{
$objTask = $db->fetch_object($resultTask); $objTask = $db->fetch_object($resultTask);
$this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks")); $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks"));
if ($objTask->nb > 0 ) if ($objTask->nb > 0 )
@@ -115,9 +120,7 @@ class box_project extends ModeleBoxes
else else
$this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A&nbsp;"); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A&nbsp;");
$totalnbTask += $objTask->nb; $totalnbTask += $objTask->nb;
} } else {
else
{
$this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0, 0, ',', ' ')); $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0, 0, ',', ' '));
$this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A&nbsp;"); $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A&nbsp;");
} }

View File

@@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr> /* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
*
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
@@ -41,13 +42,17 @@ class box_task extends ModeleBoxes
/** /**
* Constructor * Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/ */
function box_task() function __construct($db,$param='')
{ {
global $langs; global $langs;
$langs->load("boxes"); $langs->load("boxes");
$langs->load("projects"); $langs->load("projects");
$this->boxlabel="Tasks"; $this->boxlabel="Tasks";
$this->db = $db;
} }
/** /**
@@ -73,8 +78,7 @@ class box_task extends ModeleBoxes
$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
// list the summary of the orders // list the summary of the orders
if ($user->rights->projet->lire) if ($user->rights->projet->lire) {
{
$sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot"; $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt";
@@ -86,20 +90,20 @@ class box_task extends ModeleBoxes
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projecttask'); $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projecttask');
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array(
'td' => 'align="left"',
'text' =>$langs->trans("Task")."&nbsp;".$taskstatic->LibStatut($objp->fk_statut,0) 'text' =>$langs->trans("Task")."&nbsp;".$taskstatic->LibStatut($objp->fk_statut,0)
); );
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array(
'td' => 'align="right"',
'text' => $objp->nb."&nbsp;".$langs->trans("Tasks"), 'text' => $objp->nb."&nbsp;".$langs->trans("Tasks"),
'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut
); );

View File

@@ -118,6 +118,13 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
echo '</Files>' ; echo '</Files>' ;
} }
/**
* Create folder
*
* @param string $resourceType Resource type
* @param string $currentFolder Current folder
* @return void
*/
function CreateFolder( $resourceType, $currentFolder ) function CreateFolder( $resourceType, $currentFolder )
{ {
if (!isset($_GET)) { if (!isset($_GET)) {

View File

@@ -196,6 +196,11 @@ function CreateServerFolder($folderPath, $lastFolder = null)
return '' ; return '' ;
} }
/**
* Get Root Path
*
* @return string real path
*/
function GetRootPath() function GetRootPath()
{ {
if (!isset($_SERVER)) { if (!isset($_SERVER)) {
@@ -225,8 +230,7 @@ function GetRootPath()
function Server_MapPath( $path ) function Server_MapPath( $path )
{ {
// This function is available only for Apache // This function is available only for Apache
if (function_exists('apache_lookup_uri')) if (function_exists('apache_lookup_uri')) {
{
$info = apache_lookup_uri($path); $info = apache_lookup_uri($path);
return $info->filename . $info->path_info ; return $info->filename . $info->path_info ;
} }
@@ -236,6 +240,13 @@ function Server_MapPath( $path )
return GetRootPath() . $path ; return GetRootPath() . $path ;
} }
/**
* Is Allowed Extension
*
* @param string $sExtension File extension
* @param string $resourceType ressource type
* @return boolean true or false
*/
function IsAllowedExt($sExtension, $resourceType) function IsAllowedExt($sExtension, $resourceType)
{ {
global $Config ; global $Config ;
@@ -252,6 +263,12 @@ function IsAllowedExt($sExtension, $resourceType)
return true ; return true ;
} }
/**
* Is Allowed Type
*
* @param string $resourceType ressource type
* @return boolean true or false
*/
function IsAllowedType($resourceType) function IsAllowedType($resourceType)
{ {
global $Config ; global $Config ;

View File

@@ -1,4 +1,19 @@
<?php <?php
/*
* 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/
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandlerInterface.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandlerInterface.php';

View File

@@ -1,4 +1,25 @@
<?php <?php
/*
* 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 htdocs/core/modules/syslog/logHandlerInterface.php
* \ingroup syslog
* \brief LogHandlerInterface
*/
/** /**
* LogHandlerInterface * LogHandlerInterface

View File

@@ -341,8 +341,12 @@ llxFooter();
$db->close(); $db->close();
/*
* Print html activity for product type
*
* @param int $product_type Type of product
* @return void
*/
function activitytrim($product_type) function activitytrim($product_type)
{ {
global $conf,$langs,$db; global $conf,$langs,$db;

View File

@@ -496,6 +496,13 @@ class MouvementStock extends CommonObject
} }
/**
* Get origin
*
* @param variant $fk_origin id of origin
* @param int $origintype origin type
* @return string name url
*/
function get_origin($fk_origin, $origintype) { function get_origin($fk_origin, $origintype) {
switch ($origintype) { switch ($origintype) {
case 'commande': case 'commande':

View File

@@ -798,12 +798,16 @@ class Resource extends CommonObject
return $resources; return $resources;
} }
/*
* Return an int number of resources linked to the element
*
* @return int
*/
function fetchElementResources($element,$element_id) function fetchElementResources($element,$element_id)
{ {
$resources = $this->getElementResources($element,$element_id); $resources = $this->getElementResources($element,$element_id);
$i=0; $i=0;
foreach($resources as $nb => $resource) foreach($resources as $nb => $resource) {
{
$this->lines[$i] = fetchObjectByElement($resource['resource_id'],$resource['resource_type']); $this->lines[$i] = fetchObjectByElement($resource['resource_id'],$resource['resource_type']);
$i++; $i++;
} }

View File

@@ -31,8 +31,7 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent.class.php'; require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent.class.php';
require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent_type.class.php'; require_once dirname(__FILE__).'/../../htdocs/adherents/class/adherent_type.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -80,10 +79,15 @@ class AdherentTest extends PHPUnit_Framework_TestCase
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite. $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n"; die(); } if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) {
print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n";
die();
}
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -29,8 +29,7 @@ global $conf,$user,$langs,$db;
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/core/lib/admin.lib.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/admin.lib.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -80,6 +79,8 @@ class AdminLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -31,17 +31,14 @@ global $conf,$user,$langs,$db;
//require_once 'PHPUnit/Autoload.php'; //require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
if ($langs->defaultlang != 'en_US') if ($langs->defaultlang != 'en_US') {
{
print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n"; print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n";
exit; exit;
} }
if (! empty($conf->google->enabled)) if (! empty($conf->google->enabled)) {
{
print "Warning: Google module should not be enabled.\n"; print "Warning: Google module should not be enabled.\n";
} }
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();

View File

@@ -29,8 +29,7 @@ global $conf,$user,$langs,$db;
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/compta/bank/class/account.class.php'; require_once dirname(__FILE__).'/../../htdocs/compta/bank/class/account.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -82,6 +81,8 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -56,8 +56,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/modules/project/modules_proje
require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/modules_fichinter.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/modules_fichinter.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/modules_expedition.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/modules_expedition.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -116,6 +115,8 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -29,8 +29,7 @@ global $conf,$user,$langs,$db;
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/core/class/CMailFile.class.php'; require_once dirname(__FILE__).'/../../htdocs/core/class/CMailFile.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -80,6 +79,8 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -30,8 +30,7 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/categories/class/categorie.class.php'; require_once dirname(__FILE__).'/../../htdocs/categories/class/categorie.class.php';
require_once dirname(__FILE__).'/../../htdocs/product/class/product.class.php'; require_once dirname(__FILE__).'/../../htdocs/product/class/product.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -81,6 +80,8 @@ class CategorieTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -30,8 +30,7 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/fourn/class/fournisseur.commande.class.php'; require_once dirname(__FILE__).'/../../htdocs/fourn/class/fournisseur.commande.class.php';
require_once dirname(__FILE__).'/../../htdocs/fourn/class/fournisseur.product.class.php'; require_once dirname(__FILE__).'/../../htdocs/fourn/class/fournisseur.product.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -82,6 +81,8 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -29,8 +29,7 @@ global $conf,$user,$langs,$db;
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php'; require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -80,6 +79,8 @@ class CommandeTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -104,6 +105,7 @@ class CommandeTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
//print $db->getVersion()."\n"; //print $db->getVersion()."\n";
} }
/** /**
* End phpunit tests * End phpunit tests
* *

View File

@@ -30,8 +30,7 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php'; require_once dirname(__FILE__).'/../../htdocs/commande/class/commande.class.php';
require_once dirname(__FILE__).'/../../htdocs/projet/class/project.class.php'; require_once dirname(__FILE__).'/../../htdocs/projet/class/project.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -81,6 +80,8 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -89,6 +89,8 @@ class ContactTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class ContratTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -82,6 +82,8 @@ class CoreTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -143,8 +145,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// To prepare this test: // To prepare this test:
// - Create link from htdocs to /var/www/dolibarrnew // - Create link from htdocs to /var/www/dolibarrnew
// - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarrnew'; // - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarrnew';
if ($testtodo == 1) if ($testtodo == 1) {
{
$_SERVER["HTTPS"]=''; $_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhost'; $_SERVER["SERVER_NAME"]='localhost';
$_SERVER["SERVER_PORT"]='80'; $_SERVER["SERVER_PORT"]='80';
@@ -159,8 +160,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// To prepare this test: // To prepare this test:
// - Create link from dolibarr to /var/www/aaa // - Create link from dolibarr to /var/www/aaa
// - Put into conf.php $dolibarr_main_document_root='/var/www/aaa/htdocs'; // - Put into conf.php $dolibarr_main_document_root='/var/www/aaa/htdocs';
if ($testtodo == 2) if ($testtodo == 2) {
{
$_SERVER["HTTPS"]=''; $_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhost'; $_SERVER["SERVER_NAME"]='localhost';
$_SERVER["SERVER_PORT"]='80'; $_SERVER["SERVER_PORT"]='80';
@@ -176,8 +176,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// To prepare this test: // To prepare this test:
// - Create virtual host localhostdolibarrnew that point to /home/ldestailleur/git/dolibarr/htdocs // - Create virtual host localhostdolibarrnew that point to /home/ldestailleur/git/dolibarr/htdocs
// - Put into conf.php $dolibarr_main_document_root='/home/ldestailleur/git/dolibarr/htdocs'; // - Put into conf.php $dolibarr_main_document_root='/home/ldestailleur/git/dolibarr/htdocs';
if ($testtodo == 3) if ($testtodo == 3) {
{
$_SERVER["HTTPS"]=''; $_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhostdolibarrnew'; $_SERVER["SERVER_NAME"]='localhostdolibarrnew';
$_SERVER["SERVER_PORT"]='80'; $_SERVER["SERVER_PORT"]='80';
@@ -190,8 +189,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// Test for virtual host localhostdolibarrnew that point to htdocs directory with // Test for virtual host localhostdolibarrnew that point to htdocs directory with
// a symbolic link // a symbolic link
// URL: http://localhostdolibarrnew/admin/system/phpinfo.php // URL: http://localhostdolibarrnew/admin/system/phpinfo.php
if ($testtodo == 4) if ($testtodo == 4) {
{
$_SERVER["HTTPS"]=''; $_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhostdolibarrnew'; $_SERVER["SERVER_NAME"]='localhostdolibarrnew';
$_SERVER["SERVER_PORT"]='80'; $_SERVER["SERVER_PORT"]='80';
@@ -207,8 +205,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// - Copy content of dolibarr project into /var/www/dolibarr // - Copy content of dolibarr project into /var/www/dolibarr
// - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarr/htdocs'; // - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarr/htdocs';
// - Put into conf.php $dolibarr_main_url_root='http://localhost/dolibarralias'; (because autodetect will fails in this case) // - Put into conf.php $dolibarr_main_url_root='http://localhost/dolibarralias'; (because autodetect will fails in this case)
if ($testtodo == 5) if ($testtodo == 5) {
{
$_SERVER["HTTPS"]=''; $_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhost'; $_SERVER["SERVER_NAME"]='localhost';
$_SERVER["SERVER_PORT"]='80'; $_SERVER["SERVER_PORT"]='80';
@@ -261,8 +258,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
{ {
$sql_inj = 0; $sql_inj = 0;
// For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests) // For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests)
if ($type != 2) if ($type != 2) {
{
$sql_inj += preg_match('/delete[\s]+from/i', $val); $sql_inj += preg_match('/delete[\s]+from/i', $val);
$sql_inj += preg_match('/create[\s]+table/i', $val); $sql_inj += preg_match('/create[\s]+table/i', $val);
$sql_inj += preg_match('/update.+set.+=/i', $val); $sql_inj += preg_match('/update.+set.+=/i', $val);
@@ -278,8 +274,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
$sql_inj += preg_match('/<script/i', $val); $sql_inj += preg_match('/<script/i', $val);
if (! defined('NOSTYLECHECK')) $sql_inj += preg_match('/<style/i', $val); if (! defined('NOSTYLECHECK')) $sql_inj += preg_match('/<style/i', $val);
$sql_inj += preg_match('/base[\s]+href/i', $val); $sql_inj += preg_match('/base[\s]+href/i', $val);
if ($type == 1) if ($type == 1) {
{
$sql_inj += preg_match('/javascript:/i', $val); $sql_inj += preg_match('/javascript:/i', $val);
$sql_inj += preg_match('/vbscript:/i', $val); $sql_inj += preg_match('/vbscript:/i', $val);
} }

View File

@@ -80,6 +80,8 @@ class DateLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -85,6 +85,8 @@ class DateLibTzFranceTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class DiscountTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -83,6 +83,8 @@ class EntrepotTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -84,6 +84,8 @@ class ExportTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -81,6 +81,8 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -29,8 +29,7 @@ global $conf,$user,$langs,$db;
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php'; require_once dirname(__FILE__).'/../../htdocs/compta/facture/class/facture.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -83,6 +82,8 @@ class FactureTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class FactureTestRounding extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class FichinterTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -81,6 +81,8 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class FormAdminTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -83,6 +83,8 @@ class Functions2LibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -83,6 +83,8 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -83,6 +83,8 @@ class HolidayTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -81,6 +81,8 @@ class ImagesLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -82,6 +82,8 @@ class ImportTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -82,6 +82,8 @@ class JsonLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -92,6 +92,8 @@ class LangTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class MarginsLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -79,6 +79,8 @@ class ModulesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -79,6 +79,8 @@ class NumberingModulesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -84,6 +84,8 @@ class PaypalTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -83,6 +83,8 @@ class PdfDocTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -83,6 +83,8 @@ class PgsqlTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -81,6 +81,8 @@ class PricesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -83,6 +83,7 @@ class ProductTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// teardownafterclass
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -81,6 +81,8 @@ class ProjectTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class PropalTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -92,6 +92,8 @@ class ScriptsTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -92,6 +92,8 @@ class SecurityTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -30,8 +30,7 @@ require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/societe/class/societe.class.php'; require_once dirname(__FILE__).'/../../htdocs/societe/class/societe.class.php';
$langs->load("dict"); $langs->load("dict");
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -86,6 +85,8 @@ class SocieteTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -92,6 +92,8 @@ class SqlTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -141,13 +143,12 @@ class SqlTest extends PHPUnit_Framework_TestCase
$listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration'); $listofsqldir = array(DOL_DOCUMENT_ROOT.'/install/mysql/tables', DOL_DOCUMENT_ROOT.'/install/mysql/migration');
foreach ($listofsqldir as $dir) foreach ($listofsqldir as $dir) {
{
print 'Process dir '.$dir."\n"; print 'Process dir '.$dir."\n";
$filesarray = scandir($dir); $filesarray = scandir($dir);
foreach($filesarray as $key => $file) foreach($filesarray as $key => $file) {
{ if (! preg_match('/\.sql$/',$file))
if (! preg_match('/\.sql$/',$file)) continue; continue;
print 'Check sql file '.$file."\n"; print 'Check sql file '.$file."\n";
$filecontent=file_get_contents($dir.'/'.$file); $filecontent=file_get_contents($dir.'/'.$file);
@@ -183,9 +184,9 @@ class SqlTest extends PHPUnit_Framework_TestCase
$db=$this->savdb; $db=$this->savdb;
$filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdata'); $filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdata');
foreach($filesarray as $key => $file) foreach($filesarray as $key => $file) {
{ if (! preg_match('/\.sql$/',$file))
if (! preg_match('/\.sql$/',$file)) continue; continue;
print 'Check sql file '.$file."\n"; print 'Check sql file '.$file."\n";
$filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/../dev/initdata/'.$file); $filecontent=file_get_contents(DOL_DOCUMENT_ROOT.'/../dev/initdata/'.$file);

View File

@@ -29,8 +29,7 @@ global $conf,$user,$langs,$db;
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/user/class/usergroup.class.php'; require_once dirname(__FILE__).'/../../htdocs/user/class/usergroup.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -80,6 +79,8 @@ class UserGroupTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;

View File

@@ -29,8 +29,7 @@ global $conf,$user,$langs,$db;
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/user/class/user.class.php'; require_once dirname(__FILE__).'/../../htdocs/user/class/user.class.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -80,6 +79,8 @@ class UserTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -293,24 +294,19 @@ class UserTest extends PHPUnit_Framework_TestCase
{ {
$retAr=array(); $retAr=array();
if (get_class($oA) !== get_class($oB)) if (get_class($oA) !== get_class($oB)) {
{
$retAr[]="Supplied objects are not of same class."; $retAr[]="Supplied objects are not of same class.";
} } else {
else
{
$oVarsA=get_object_vars($oA); $oVarsA=get_object_vars($oA);
$oVarsB=get_object_vars($oB); $oVarsB=get_object_vars($oB);
$aKeys=array_keys($oVarsA); $aKeys=array_keys($oVarsA);
foreach($aKeys as $sKey) foreach($aKeys as $sKey) {
{ if (in_array($sKey,$fieldstoignorearray))
if (in_array($sKey,$fieldstoignorearray)) continue; continue;
if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) {
{
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
} }
if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey]) if ($ignoretype && $oVarsA[$sKey] != $oVarsB[$sKey]) {
{
$retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]); $retAr[]=$sKey.' : '.(is_object($oVarsA[$sKey])?get_class($oVarsA[$sKey]):$oVarsA[$sKey]).' <> '.(is_object($oVarsB[$sKey])?get_class($oVarsB[$sKey]):$oVarsB[$sKey]);
} }
} }

View File

@@ -31,8 +31,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -82,6 +81,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
// Set the WebService URL // Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL); $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient) if ($soapclient) {
{
$soapclient->soap_defencoding='UTF-8'; $soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false); $soapclient->decodeUTF8(false);
} }
@@ -149,7 +149,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO', 'sourceapplication'=>'DEMO',
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>''
);
// Test URL // Test URL
$result=''; $result='';
@@ -157,14 +158,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! $result || ! empty($result['faultstring'])) if (! $result || ! empty($result['faultstring'])) {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";

View File

@@ -31,8 +31,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -82,6 +81,8 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
// Set the WebService URL // Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL); $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient) if ($soapclient) {
{
$soapclient->soap_defencoding='UTF-8'; $soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false); $soapclient->decodeUTF8(false);
} }
@@ -149,21 +149,19 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO', 'sourceapplication'=>'DEMO',
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>''
);
// Test URL // Test URL
$parameters = array('authentication'=>$authentication,'id'=>1); $parameters = array('authentication'=>$authentication,'id'=>1);
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! $result || ! empty($result['faultstring'])) if (! $result || ! empty($result['faultstring'])) {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";

View File

@@ -31,8 +31,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -82,6 +81,8 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
// Set the WebService URL // Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL); $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient) if ($soapclient) {
{
$soapclient->soap_defencoding='UTF-8'; $soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false); $soapclient->decodeUTF8(false);
} }
@@ -149,7 +149,8 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO', 'sourceapplication'=>'DEMO',
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>''
);
// Test URL // Test URL
$result=''; $result='';
@@ -157,19 +158,15 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! empty($result['faultstring'])) if (! empty($result['faultstring'])) {
{
print $result['faultstring']."\n"; print $result['faultstring']."\n";
$result=0; $result=0;
} }
if (! $result) if (! $result) {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";
@@ -189,14 +186,11 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! $result || ! empty($result['faultstring'])) if (! $result || ! empty($result['faultstring'])) {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";

View File

@@ -33,8 +33,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -84,6 +83,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -141,8 +141,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
// Set the WebService URL // Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL); $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient) if ($soapclient) {
{
$soapclient->soap_defencoding='UTF-8'; $soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false); $soapclient->decodeUTF8(false);
} }
@@ -153,26 +152,27 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO', 'sourceapplication'=>'DEMO',
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>''
);
// Test URL // Test URL
$result=''; $result='';
$parameters = array('authentication'=>$authentication,'product'=>array( $parameters = array(
'authentication'=>$authentication,'product'=>array(
'ref'=>'NewProductFromWS'.$datestring, 'ref'=>'NewProductFromWS'.$datestring,
'label'=>'New Product From WS '.$datestring, 'label'=>'New Product From WS '.$datestring,
'type'=>1, 'type'=>1,
'description'=>'This is a new product created from WS PHPUnit test case')); 'description'=>'This is a new product created from WS PHPUnit test case'
)
);
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! $result || ! empty($result['faultstring']) || $result['result']['result_code'] != 'OK') if (! $result || ! empty($result['faultstring']) || $result['result']['result_code'] != 'OK') {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";
@@ -211,8 +211,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
// Set the WebService URL // Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL); $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient) if ($soapclient) {
{
$soapclient->soap_defencoding='UTF-8'; $soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false); $soapclient->decodeUTF8(false);
} }
@@ -223,7 +222,8 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO', 'sourceapplication'=>'DEMO',
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>''
);
// Test URL // Test URL
$result=''; $result='';
@@ -231,14 +231,11 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! $result || ! empty($result['faultstring'])) if (! $result || ! empty($result['faultstring'])) {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";
@@ -277,8 +274,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
// Set the WebService URL // Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL); $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient) if ($soapclient) {
{
$soapclient->soap_defencoding='UTF-8'; $soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false); $soapclient->decodeUTF8(false);
} }
@@ -289,7 +285,8 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO', 'sourceapplication'=>'DEMO',
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>''
);
// Test URL // Test URL
$result=''; $result='';
@@ -297,14 +294,11 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! $result || ! empty($result['faultstring']) || $result['result']['result_code'] != 'OK') if (! $result || ! empty($result['faultstring']) || $result['result']['result_code'] != 'OK') {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";

View File

@@ -31,8 +31,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -82,6 +81,8 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
// Set the WebService URL // Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n"; print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL); $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient) if ($soapclient) {
{
$soapclient->soap_defencoding='UTF-8'; $soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false); $soapclient->decodeUTF8(false);
} }
@@ -157,14 +157,11 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! $result || ! empty($result['faultstring'])) if (! $result || ! empty($result['faultstring'])) {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";

View File

@@ -31,8 +31,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -82,6 +81,8 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
// Set the WebService URL // Set the WebService URL
print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n"; print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL); $soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient) if ($soapclient) {
{
$soapclient->soap_defencoding='UTF-8'; $soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false); $soapclient->decodeUTF8(false);
} }
@@ -149,7 +149,8 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO', 'sourceapplication'=>'DEMO',
'login'=>'admin', 'login'=>'admin',
'password'=>'admin', 'password'=>'admin',
'entity'=>''); 'entity'=>''
);
// Test URL // Test URL
$result=''; $result='';
@@ -157,19 +158,15 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
print __METHOD__."Call method ".$WS_METHOD."\n"; print __METHOD__."Call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! empty($result['faultstring'])) if (! empty($result['faultstring'])) {
{
print $result['faultstring']."\n"; print $result['faultstring']."\n";
$result=0; $result=0;
} }
if (! $result) if (! $result) {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";
@@ -188,14 +185,11 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
print __METHOD__."Call method ".$WS_METHOD."\n"; print __METHOD__."Call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,''); $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
} } catch(SoapFault $exception) {
catch(SoapFault $exception)
{
echo $exception; echo $exception;
$result=0; $result=0;
} }
if (! $result || ! empty($result['faultstring'])) if (! $result || ! empty($result['faultstring'])) {
{
//var_dump($soapclient); //var_dump($soapclient);
print $soapclient->error_str; print $soapclient->error_str;
print "\n<br>\n"; print "\n<br>\n";

View File

@@ -29,8 +29,7 @@ global $conf,$user,$langs,$db;
require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/core/lib/xcal.lib.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/xcal.lib.php';
if (empty($user->id)) if (empty($user->id)) {
{
print "Load permissions for admin user nb 1\n"; print "Load permissions for admin user nb 1\n";
$user->fetch(1); $user->fetch(1);
$user->getrights(); $user->getrights();
@@ -80,6 +79,8 @@ class XCalLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n"; print __METHOD__."\n";
} }
// tear down after class
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
global $conf,$user,$langs,$db; global $conf,$user,$langs,$db;