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="PEAR.Commenting.ClassComment" />
<rule ref="PEAR.Commenting.ClassComment.MissingTag">
<severity>0</severity>
</rule>
<rule ref="PEAR.Commenting.ClassComment.MissingTag" />
<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">
<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>
@@ -201,93 +246,20 @@
<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.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" />
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn" />
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired" />
<rule ref="PEAR.Commenting.FunctionComment.Missing" />
<!--
<rule ref="PEAR.Commenting.FileComment" />

View File

@@ -40,6 +40,16 @@ class autoTranslator
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)
{

View File

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

View File

@@ -30,8 +30,7 @@ $langs->load("other");
$localTaxType=GETPOST('localTaxType', 'int');
$year=$_GET["year"];
if ($year == 0 )
{
if ($year == 0 ) {
$year_current = strftime("%Y",time());
$year_start = $year_current;
} else {
@@ -41,21 +40,30 @@ if ($year == 0 )
// Security check
$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');
// Define modetax (0 or 1)
// 0=normal, 1=option vat for services is on debit
$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)
{
global $conf, $bc,$langs;
$result = $db->query($sql);
if ($result)
{
if ($result) {
$num = $db->num_rows($result);
$i = 0;
$total = 0;
@@ -66,8 +74,7 @@ function pt ($db, $sql, $date)
print '<td>&nbsp;</td>'."\n";
print "</tr>\n";
$var=True;
while ($i < $num)
{
while ($i < $num) {
$obj = $db->fetch_object($result);
$var=!$var;
print '<tr '.$bc[$var].'>';
@@ -83,8 +90,7 @@ function pt ($db, $sql, $date)
print "</table>";
$db->free($result);
}
else {
} else {
dol_print_error($db);
}
}
@@ -96,17 +102,14 @@ function pt ($db, $sql, $date)
llxHeader();
if($localTaxType==1)
{
if($localTaxType==1) {
$LT='LT1';
$LTSummary='LT1Summary';
$LTPaid='LT1Paid';
$LTCustomer='LT1Customer';
$LTSupplier='LT1Supplier';
$CalcLT= $conf->global->MAIN_INFO_LOCALTAX_CALC1;
}
else
{
} else {
$LT='LT2';
$LTSummary='LT2Summary';
$LTPaid='LT2Paid';
@@ -138,17 +141,14 @@ print '<tr><td width="50%" valign="top">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
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($LTSupplier,$mysoc->country_code)."</td>";
}
if($CalcLT==1)
{
if($CalcLT==1) {
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>";
}
@@ -161,8 +161,7 @@ $y = $year_current ;
$var=True;
$total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=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_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'));
$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");
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
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>';
break;
}
$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>';
if($CalcLT==0)
{
if($CalcLT==0) {
$x_coll = 0;
foreach($coll_listsell as $vatrate=>$val)
{
foreach($coll_listsell as $vatrate=>$val) {
$x_coll+=$val[$localTaxType==1?'localtax1':'localtax2'];
}
$subtotalcoll = $subtotalcoll + $x_coll;
print "<td class=\"nowrap\" align=\"right\">".price($x_coll)."</td>";
$x_paye = 0;
foreach($coll_listbuy as $vatrate=>$val)
{
foreach($coll_listbuy as $vatrate=>$val) {
$x_paye+=$val[$localTaxType==1?'localtax1':'localtax2'];
}
$subtotalpaye = $subtotalpaye + $x_paye;
print "<td class=\"nowrap\" align=\"right\">".price($x_paye)."</td>";
}
elseif($CalcLT==1)
{
} elseif($CalcLT==1) {
$x_paye = 0;
foreach($coll_listbuy as $vatrate=>$val)
{
foreach($coll_listbuy as $vatrate=>$val) {
$x_paye+=$val[$localTaxType==1?'localtax1':'localtax2'];
}
$subtotalpaye = $subtotalpaye + $x_paye;
print "<td class=\"nowrap\" align=\"right\">".price($x_paye)."</td><td></td>";
}
elseif($CalcLT==2)
{
} elseif($CalcLT==2) {
$x_coll = 0;
foreach($coll_listsell as $vatrate=>$val)
{
foreach($coll_listsell as $vatrate=>$val) {
$x_coll+=$val[$localTaxType==1?'localtax1':'localtax2'];
}
$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;
}
elseif($CalcLT==1)
{
} elseif($CalcLT==1) {
$diff= $x_paye;
}
elseif($CalcLT==2)
{
} elseif($CalcLT==2) {
$diff= $x_coll;
}
@@ -251,23 +234,17 @@ for ($m = 1 ; $m < 13 ; $m++ )
print "</tr>\n";
$i++;
if ($i > 2)
{
if ($i > 2) {
print '<tr class="liste_total">';
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($subtotalpaye).'</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($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($subtotal).'</td>';
}
@@ -298,7 +275,7 @@ $sql.= " GROUP BY dm ASC";
pt($db, $sql,$langs->trans("Year")." $y");
print "</td></tr></table>";
print '</td></tr></table>';
print '</td></tr>';
print '</table>';

View File

@@ -38,14 +38,18 @@ class box_project extends ModeleBoxes
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;
$langs->load("boxes");
$langs->load("projects");
$this->db = $db;
$this->boxlabel="Projects";
}
@@ -69,8 +73,7 @@ class box_project extends ModeleBoxes
$this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead));
// 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.= " FROM ".MAIN_DB_PREFIX."projet as p";
@@ -81,23 +84,26 @@ class box_project extends ModeleBoxes
$result = $db->query($sql);
if ($result)
{
if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
while ($i < $num) {
$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',
'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,
'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
);
@@ -106,8 +112,7 @@ class box_project extends ModeleBoxes
$sql.=" WHERE p.entity = ".$conf->entity;
$resultTask = $db->query($sql);
if ($resultTask)
{
if ($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"));
if ($objTask->nb > 0 )
@@ -115,9 +120,7 @@ class box_project extends ModeleBoxes
else
$this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A&nbsp;");
$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][4] = array('td' => 'align="right"', 'text' => "N/A&nbsp;");
}

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
*
* 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
@@ -41,13 +42,17 @@ class box_task extends ModeleBoxes
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function box_task()
function __construct($db,$param='')
{
global $langs;
$langs->load("boxes");
$langs->load("projects");
$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));
// 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.= " 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);
if ($result)
{
if ($result) {
$num = $db->num_rows($result);
$i = 0;
while ($i < $num)
{
while ($i < $num) {
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"','logo' => 'object_projecttask');
$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)
);
$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"),
'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>' ;
}
/**
* Create folder
*
* @param string $resourceType Resource type
* @param string $currentFolder Current folder
* @return void
*/
function CreateFolder( $resourceType, $currentFolder )
{
if (!isset($_GET)) {

View File

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

View File

@@ -1,4 +1,19 @@
<?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';

View File

@@ -1,4 +1,25 @@
<?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

View File

@@ -341,8 +341,12 @@ llxFooter();
$db->close();
/*
* Print html activity for product type
*
* @param int $product_type Type of product
* @return void
*/
function activitytrim($product_type)
{
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) {
switch ($origintype) {
case 'commande':

View File

@@ -798,12 +798,16 @@ class Resource extends CommonObject
return $resources;
}
/*
* Return an int number of resources linked to the element
*
* @return int
*/
function fetchElementResources($element,$element_id)
{
$resources = $this->getElementResources($element,$element_id);
$i=0;
foreach($resources as $nb => $resource)
{
foreach($resources as $nb => $resource) {
$this->lines[$i] = fetchObjectByElement($resource['resource_id'],$resource['resource_type']);
$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_type.class.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -80,10 +79,15 @@ class AdherentTest extends PHPUnit_Framework_TestCase
global $conf,$user,$langs,$db;
$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";
}
// tear down after class
public static function tearDownAfterClass()
{
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/core/lib/admin.lib.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -80,6 +79,8 @@ class AdminLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;

View File

@@ -31,17 +31,14 @@ global $conf,$user,$langs,$db;
//require_once 'PHPUnit/Autoload.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";
exit;
}
if (! empty($conf->google->enabled))
{
if (! empty($conf->google->enabled)) {
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";
$user->fetch(1);
$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/compta/bank/class/account.class.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -82,6 +81,8 @@ class BankAccountTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
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/expedition/modules_expedition.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -116,6 +115,8 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
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/core/class/CMailFile.class.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -80,6 +79,8 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
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/product/class/product.class.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -81,6 +80,8 @@ class CategorieTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;

View File

@@ -80,6 +80,8 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
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.product.class.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -82,6 +81,8 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
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/commande/class/commande.class.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -80,6 +79,8 @@ class CommandeTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
@@ -104,6 +105,7 @@ class CommandeTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
//print $db->getVersion()."\n";
}
/**
* 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/projet/class/project.class.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -81,6 +80,8 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;

View File

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

View File

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

View File

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

View File

@@ -82,6 +82,8 @@ class CoreTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
@@ -143,8 +145,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// To prepare this test:
// - Create link from htdocs to /var/www/dolibarrnew
// - Put into conf.php $dolibarr_main_document_root='/var/www/dolibarrnew';
if ($testtodo == 1)
{
if ($testtodo == 1) {
$_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhost';
$_SERVER["SERVER_PORT"]='80';
@@ -159,8 +160,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// To prepare this test:
// - Create link from dolibarr to /var/www/aaa
// - Put into conf.php $dolibarr_main_document_root='/var/www/aaa/htdocs';
if ($testtodo == 2)
{
if ($testtodo == 2) {
$_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhost';
$_SERVER["SERVER_PORT"]='80';
@@ -176,8 +176,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// To prepare this test:
// - 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';
if ($testtodo == 3)
{
if ($testtodo == 3) {
$_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhostdolibarrnew';
$_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
// a symbolic link
// URL: http://localhostdolibarrnew/admin/system/phpinfo.php
if ($testtodo == 4)
{
if ($testtodo == 4) {
$_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhostdolibarrnew';
$_SERVER["SERVER_PORT"]='80';
@@ -207,8 +205,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
// - 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_url_root='http://localhost/dolibarralias'; (because autodetect will fails in this case)
if ($testtodo == 5)
{
if ($testtodo == 5) {
$_SERVER["HTTPS"]='';
$_SERVER["SERVER_NAME"]='localhost';
$_SERVER["SERVER_PORT"]='80';
@@ -261,8 +258,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
{
$sql_inj = 0;
// 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('/create[\s]+table/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);
if (! defined('NOSTYLECHECK')) $sql_inj += preg_match('/<style/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('/vbscript:/i', $val);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -81,6 +81,8 @@ class FactureRecTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
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/compta/facture/class/facture.class.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -83,6 +82,8 @@ class FactureTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -92,6 +92,8 @@ class SecurityTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
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';
$langs->load("dict");
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -86,6 +85,8 @@ class SocieteTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;

View File

@@ -92,6 +92,8 @@ class SqlTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
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');
foreach ($listofsqldir as $dir)
{
foreach ($listofsqldir as $dir) {
print 'Process dir '.$dir."\n";
$filesarray = scandir($dir);
foreach($filesarray as $key => $file)
{
if (! preg_match('/\.sql$/',$file)) continue;
foreach($filesarray as $key => $file) {
if (! preg_match('/\.sql$/',$file))
continue;
print 'Check sql file '.$file."\n";
$filecontent=file_get_contents($dir.'/'.$file);
@@ -183,9 +184,9 @@ class SqlTest extends PHPUnit_Framework_TestCase
$db=$this->savdb;
$filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdata');
foreach($filesarray as $key => $file)
{
if (! preg_match('/\.sql$/',$file)) continue;
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);

View File

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

View File

@@ -31,8 +31,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/date.lib.php';
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";
$user->fetch(1);
$user->getrights();
@@ -82,6 +81,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
// Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
if ($soapclient) {
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
@@ -149,7 +149,8 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'admin',
'entity'=>'');
'entity'=>''
);
// Test URL
$result='';
@@ -157,14 +158,11 @@ class WebservicesInvoicesTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$result=0;
}
if (! $result || ! empty($result['faultstring']))
{
if (! $result || ! empty($result['faultstring'])) {
//var_dump($soapclient);
print $soapclient->error_str;
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
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -82,6 +81,8 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
// Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
if ($soapclient) {
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
@@ -149,21 +149,19 @@ class WebservicesOrdersTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'admin',
'entity'=>'');
'entity'=>''
);
// Test URL
$parameters = array('authentication'=>$authentication,'id'=>1);
print __METHOD__." call method ".$WS_METHOD."\n";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$result=0;
}
if (! $result || ! empty($result['faultstring']))
{
if (! $result || ! empty($result['faultstring'])) {
//var_dump($soapclient);
print $soapclient->error_str;
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
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -82,6 +81,8 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
// Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
if ($soapclient) {
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
@@ -149,7 +149,8 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'admin',
'entity'=>'');
'entity'=>''
);
// Test URL
$result='';
@@ -157,19 +158,15 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$result=0;
}
if (! empty($result['faultstring']))
{
if (! empty($result['faultstring'])) {
print $result['faultstring']."\n";
$result=0;
}
if (! $result)
{
if (! $result) {
//var_dump($soapclient);
print $soapclient->error_str;
print "\n<br>\n";
@@ -189,14 +186,11 @@ class WebservicesOtherTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$result=0;
}
if (! $result || ! empty($result['faultstring']))
{
if (! $result || ! empty($result['faultstring'])) {
//var_dump($soapclient);
print $soapclient->error_str;
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
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -84,6 +83,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
@@ -141,8 +141,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
// Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
if ($soapclient) {
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
@@ -153,26 +152,27 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'admin',
'entity'=>'');
'entity'=>''
);
// Test URL
$result='';
$parameters = array('authentication'=>$authentication,'product'=>array(
$parameters = array(
'authentication'=>$authentication,'product'=>array(
'ref'=>'NewProductFromWS'.$datestring,
'label'=>'New Product From WS '.$datestring,
'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";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$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);
print $soapclient->error_str;
print "\n<br>\n";
@@ -211,8 +211,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
// Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
if ($soapclient) {
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
@@ -223,7 +222,8 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'admin',
'entity'=>'');
'entity'=>''
);
// Test URL
$result='';
@@ -231,14 +231,11 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$result=0;
}
if (! $result || ! empty($result['faultstring']))
{
if (! $result || ! empty($result['faultstring'])) {
//var_dump($soapclient);
print $soapclient->error_str;
print "\n<br>\n";
@@ -277,8 +274,7 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
// Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
if ($soapclient) {
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
@@ -289,7 +285,8 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'admin',
'entity'=>'');
'entity'=>''
);
// Test URL
$result='';
@@ -297,14 +294,11 @@ class WebservicesProductsTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$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);
print $soapclient->error_str;
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
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -82,6 +81,8 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
// Set the WebService URL
print __METHOD__." create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
if ($soapclient) {
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
@@ -157,14 +157,11 @@ class WebservicesThirdpartyTest extends PHPUnit_Framework_TestCase
print __METHOD__." call method ".$WS_METHOD."\n";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$result=0;
}
if (! $result || ! empty($result['faultstring']))
{
if (! $result || ! empty($result['faultstring'])) {
//var_dump($soapclient);
print $soapclient->error_str;
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
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -82,6 +81,8 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
@@ -137,8 +138,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
// Set the WebService URL
print __METHOD__."Create nusoap_client for URL=".$WS_DOL_URL."\n";
$soapclient = new nusoap_client($WS_DOL_URL);
if ($soapclient)
{
if ($soapclient) {
$soapclient->soap_defencoding='UTF-8';
$soapclient->decodeUTF8(false);
}
@@ -149,7 +149,8 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
'sourceapplication'=>'DEMO',
'login'=>'admin',
'password'=>'admin',
'entity'=>'');
'entity'=>''
);
// Test URL
$result='';
@@ -157,19 +158,15 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
print __METHOD__."Call method ".$WS_METHOD."\n";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$result=0;
}
if (! empty($result['faultstring']))
{
if (! empty($result['faultstring'])) {
print $result['faultstring']."\n";
$result=0;
}
if (! $result)
{
if (! $result) {
//var_dump($soapclient);
print $soapclient->error_str;
print "\n<br>\n";
@@ -188,14 +185,11 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
print __METHOD__."Call method ".$WS_METHOD."\n";
try {
$result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
}
catch(SoapFault $exception)
{
} catch(SoapFault $exception) {
echo $exception;
$result=0;
}
if (! $result || ! empty($result['faultstring']))
{
if (! $result || ! empty($result['faultstring'])) {
//var_dump($soapclient);
print $soapclient->error_str;
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/core/lib/xcal.lib.php';
if (empty($user->id))
{
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
@@ -80,6 +79,8 @@ class XCalLibTest extends PHPUnit_Framework_TestCase
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;