diff --git a/.editorconfig b/.editorconfig
index 2df455f0d4f..a40a586406f 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -8,7 +8,8 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
[*.php]
-indent_style = tab
+indent_style = space
+trim_trailing_whitespace = true
[*.js]
indent_style = tab
[*.css]
diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php
index e519c62a436..792341f5c79 100755
--- a/dev/examples/code/create_invoice.php
+++ b/dev/examples/code/create_invoice.php
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
@set_time_limit(0);
// Load user and its permissions
-$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
-if (! $result > 0) { dol_print_error('',$user->error); exit; }
+$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
+if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
@@ -89,13 +89,13 @@ if ($idobject > 0)
else
{
$error++;
- dol_print_error($db,$obj->error);
+ dol_print_error($db, $obj->error);
}
}
else
{
$error++;
- dol_print_error($db,$obj->error);
+ dol_print_error($db, $obj->error);
}
diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php
index 95b047705fa..fa3fa573223 100755
--- a/dev/examples/code/create_order.php
+++ b/dev/examples/code/create_order.php
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
@set_time_limit(0);
// Load user and its permissions
-$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
-if (! $result > 0) { dol_print_error('',$user->error); exit; }
+$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
+if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
@@ -87,13 +87,13 @@ if ($idobject > 0)
else
{
$error++;
- dol_print_error($db,$com->error);
+ dol_print_error($db, $com->error);
}
}
else
{
$error++;
- dol_print_error($db,$com->error);
+ dol_print_error($db, $com->error);
}
diff --git a/dev/examples/code/create_product.php b/dev/examples/code/create_product.php
index 8cbc07a1b63..7ca09246980 100755
--- a/dev/examples/code/create_product.php
+++ b/dev/examples/code/create_product.php
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
@set_time_limit(0);
// Load user and its permissions
-$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
-if (! $result > 0) { dol_print_error('',$user->error); exit; }
+$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
+if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
@@ -86,7 +86,7 @@ if ($idobject > 0)
else
{
$error++;
- dol_print_error($db,$myproduct->error);
+ dol_print_error($db, $myproduct->error);
}
// -------------------- END OF YOUR CODE --------------------
diff --git a/dev/examples/code/create_user.php b/dev/examples/code/create_user.php
index f8e0ba23011..e154b0ef6bb 100755
--- a/dev/examples/code/create_user.php
+++ b/dev/examples/code/create_user.php
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
@set_time_limit(0);
// Load user and its permissions
-$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
-if (! $result > 0) { dol_print_error('',$user->error); exit; }
+$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
+if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
@@ -77,7 +77,7 @@ if ($idobject > 0)
else
{
$error++;
- dol_print_error($db,$obj->error);
+ dol_print_error($db, $obj->error);
}
}
else if ($obj->error == 'ErrorLoginAlreadyExists')
@@ -87,7 +87,7 @@ else if ($obj->error == 'ErrorLoginAlreadyExists')
else
{
$error++;
- dol_print_error($db,$obj->error);
+ dol_print_error($db, $obj->error);
}
diff --git a/dev/examples/code/get_contracts.php b/dev/examples/code/get_contracts.php
index daff0e43e6f..eafc0dfeed5 100755
--- a/dev/examples/code/get_contracts.php
+++ b/dev/examples/code/get_contracts.php
@@ -48,8 +48,8 @@ $langs->load("main"); // To load language file for default language
@set_time_limit(0);
// Load user and its permissions
-$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
-if (! $result > 0) { dol_print_error('',$user->error); exit; }
+$result=$user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
+if (! $result > 0) { dol_print_error('', $user->error); exit; }
$user->getrights();
diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php
index 280518bd4e3..0f04a4d236f 100755
--- a/dev/initdata/generate-invoice.php
+++ b/dev/initdata/generate-invoice.php
@@ -43,59 +43,59 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
define(GEN_NUMBER_FACTURE, 1);
$year = 2016;
-$dates = array (mktime(12,0,0,1,3,$year),
- mktime(12,0,0,1,9,$year),
- mktime(12,0,0,2,13,$year),
- mktime(12,0,0,2,23,$year),
- mktime(12,0,0,3,30,$year),
- mktime(12,0,0,4,3,$year),
- mktime(12,0,0,4,3,$year),
- mktime(12,0,0,5,9,$year),
- mktime(12,0,0,5,1,$year),
- mktime(12,0,0,5,13,$year),
- mktime(12,0,0,5,19,$year),
- mktime(12,0,0,5,23,$year),
- mktime(12,0,0,6,3,$year),
- mktime(12,0,0,6,19,$year),
- mktime(12,0,0,6,24,$year),
- mktime(12,0,0,7,3,$year),
- mktime(12,0,0,7,9,$year),
- mktime(12,0,0,7,23,$year),
- mktime(12,0,0,7,30,$year),
- mktime(12,0,0,8,9,$year),
- mktime(12,0,0,9,23,$year),
- mktime(12,0,0,10,3,$year),
- mktime(12,0,0,11,12,$year),
- mktime(12,0,0,11,13,$year),
- mktime(12,0,0,1,3,($year - 1)),
- mktime(12,0,0,1,9,($year - 1)),
- mktime(12,0,0,2,13,($year - 1)),
- mktime(12,0,0,2,23,($year - 1)),
- mktime(12,0,0,3,30,($year - 1)),
- mktime(12,0,0,4,3,($year - 1)),
- mktime(12,0,0,4,3,($year - 1)),
- mktime(12,0,0,5,9,($year - 1)),
- mktime(12,0,0,5,1,($year - 1)),
- mktime(12,0,0,5,13,($year - 1)),
- mktime(12,0,0,5,19,($year - 1)),
- mktime(12,0,0,5,23,($year - 1)),
- mktime(12,0,0,6,3,($year - 1)),
- mktime(12,0,0,6,19,($year - 1)),
- mktime(12,0,0,6,24,($year - 1)),
- mktime(12,0,0,7,3,($year - 1)),
- mktime(12,0,0,7,9,($year - 1)),
- mktime(12,0,0,7,23,($year - 1)),
- mktime(12,0,0,7,30,($year - 1)),
- mktime(12,0,0,8,9,($year - 1)),
- mktime(12,0,0,9,23,($year - 1)),
- mktime(12,0,0,10,3,($year - 1)),
- mktime(12,0,0,11,12,$year),
- mktime(12,0,0,11,13,$year),
- mktime(12,0,0,12,12,$year),
- mktime(12,0,0,12,13,$year),
+$dates = array (mktime(12, 0, 0, 1, 3, $year),
+ mktime(12, 0, 0, 1, 9, $year),
+ mktime(12, 0, 0, 2, 13, $year),
+ mktime(12, 0, 0, 2, 23, $year),
+ mktime(12, 0, 0, 3, 30, $year),
+ mktime(12, 0, 0, 4, 3, $year),
+ mktime(12, 0, 0, 4, 3, $year),
+ mktime(12, 0, 0, 5, 9, $year),
+ mktime(12, 0, 0, 5, 1, $year),
+ mktime(12, 0, 0, 5, 13, $year),
+ mktime(12, 0, 0, 5, 19, $year),
+ mktime(12, 0, 0, 5, 23, $year),
+ mktime(12, 0, 0, 6, 3, $year),
+ mktime(12, 0, 0, 6, 19, $year),
+ mktime(12, 0, 0, 6, 24, $year),
+ mktime(12, 0, 0, 7, 3, $year),
+ mktime(12, 0, 0, 7, 9, $year),
+ mktime(12, 0, 0, 7, 23, $year),
+ mktime(12, 0, 0, 7, 30, $year),
+ mktime(12, 0, 0, 8, 9, $year),
+ mktime(12, 0, 0, 9, 23, $year),
+ mktime(12, 0, 0, 10, 3, $year),
+ mktime(12, 0, 0, 11, 12, $year),
+ mktime(12, 0, 0, 11, 13, $year),
+ mktime(12, 0, 0, 1, 3, ($year - 1)),
+ mktime(12, 0, 0, 1, 9, ($year - 1)),
+ mktime(12, 0, 0, 2, 13, ($year - 1)),
+ mktime(12, 0, 0, 2, 23, ($year - 1)),
+ mktime(12, 0, 0, 3, 30, ($year - 1)),
+ mktime(12, 0, 0, 4, 3, ($year - 1)),
+ mktime(12, 0, 0, 4, 3, ($year - 1)),
+ mktime(12, 0, 0, 5, 9, ($year - 1)),
+ mktime(12, 0, 0, 5, 1, ($year - 1)),
+ mktime(12, 0, 0, 5, 13, ($year - 1)),
+ mktime(12, 0, 0, 5, 19, ($year - 1)),
+ mktime(12, 0, 0, 5, 23, ($year - 1)),
+ mktime(12, 0, 0, 6, 3, ($year - 1)),
+ mktime(12, 0, 0, 6, 19, ($year - 1)),
+ mktime(12, 0, 0, 6, 24, ($year - 1)),
+ mktime(12, 0, 0, 7, 3, ($year - 1)),
+ mktime(12, 0, 0, 7, 9, ($year - 1)),
+ mktime(12, 0, 0, 7, 23, ($year - 1)),
+ mktime(12, 0, 0, 7, 30, ($year - 1)),
+ mktime(12, 0, 0, 8, 9, ($year - 1)),
+ mktime(12, 0, 0, 9, 23, ($year - 1)),
+ mktime(12, 0, 0, 10, 3, ($year - 1)),
+ mktime(12, 0, 0, 11, 12, $year),
+ mktime(12, 0, 0, 11, 13, $year),
+ mktime(12, 0, 0, 12, 12, $year),
+ mktime(12, 0, 0, 12, 13, $year),
);
-$ret=$user->fetch('','admin');
+$ret=$user->fetch('', 'admin');
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
@@ -150,7 +150,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
$object->mode_reglement_id = 3;
$fuser = new User($db);
- $fuser->fetch(mt_rand(1,2));
+ $fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$result=$object->create($fuser);
@@ -163,10 +163,10 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
- $result=$object->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
+ $result=$object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
if ($result < 0)
{
- dol_print_error($db,$propal->error);
+ dol_print_error($db, $propal->error);
}
$xnbp++;
}
@@ -178,11 +178,11 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
}
else
{
- dol_print_error($db,$object->error);
+ dol_print_error($db, $object->error);
}
}
else
{
- dol_print_error($db,$object->error);
+ dol_print_error($db, $object->error);
}
}
diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php
index 5e53fa752a2..87d0ea1dee6 100755
--- a/dev/initdata/generate-order.php
+++ b/dev/initdata/generate-order.php
@@ -49,59 +49,59 @@ require_once DOL_DOCUMENT_ROOT."/commande/class/commande.class.php";
define(GEN_NUMBER_COMMANDE, 10);
$year = 2016;
-$dates = array (mktime(12,0,0,1,3,$year),
- mktime(12,0,0,1,9,$year),
- mktime(12,0,0,2,13,$year),
- mktime(12,0,0,2,23,$year),
- mktime(12,0,0,3,30,$year),
- mktime(12,0,0,4,3,$year),
- mktime(12,0,0,4,3,$year),
- mktime(12,0,0,5,9,$year),
- mktime(12,0,0,5,1,$year),
- mktime(12,0,0,5,13,$year),
- mktime(12,0,0,5,19,$year),
- mktime(12,0,0,5,23,$year),
- mktime(12,0,0,6,3,$year),
- mktime(12,0,0,6,19,$year),
- mktime(12,0,0,6,24,$year),
- mktime(12,0,0,7,3,$year),
- mktime(12,0,0,7,9,$year),
- mktime(12,0,0,7,23,$year),
- mktime(12,0,0,7,30,$year),
- mktime(12,0,0,8,9,$year),
- mktime(12,0,0,9,23,$year),
- mktime(12,0,0,10,3,$year),
- mktime(12,0,0,11,12,$year),
- mktime(12,0,0,11,13,$year),
- mktime(12,0,0,1,3,($year - 1)),
- mktime(12,0,0,1,9,($year - 1)),
- mktime(12,0,0,2,13,($year - 1)),
- mktime(12,0,0,2,23,($year - 1)),
- mktime(12,0,0,3,30,($year - 1)),
- mktime(12,0,0,4,3,($year - 1)),
- mktime(12,0,0,4,3,($year - 1)),
- mktime(12,0,0,5,9,($year - 1)),
- mktime(12,0,0,5,1,($year - 1)),
- mktime(12,0,0,5,13,($year - 1)),
- mktime(12,0,0,5,19,($year - 1)),
- mktime(12,0,0,5,23,($year - 1)),
- mktime(12,0,0,6,3,($year - 1)),
- mktime(12,0,0,6,19,($year - 1)),
- mktime(12,0,0,6,24,($year - 1)),
- mktime(12,0,0,7,3,($year - 1)),
- mktime(12,0,0,7,9,($year - 1)),
- mktime(12,0,0,7,23,($year - 1)),
- mktime(12,0,0,7,30,($year - 1)),
- mktime(12,0,0,8,9,($year - 1)),
- mktime(12,0,0,9,23,($year - 1)),
- mktime(12,0,0,10,3,($year - 1)),
- mktime(12,0,0,11,12,$year),
- mktime(12,0,0,11,13,$year),
- mktime(12,0,0,12,12,$year),
- mktime(12,0,0,12,13,$year),
+$dates = array (mktime(12, 0, 0, 1, 3, $year),
+ mktime(12, 0, 0, 1, 9, $year),
+ mktime(12, 0, 0, 2, 13, $year),
+ mktime(12, 0, 0, 2, 23, $year),
+ mktime(12, 0, 0, 3, 30, $year),
+ mktime(12, 0, 0, 4, 3, $year),
+ mktime(12, 0, 0, 4, 3, $year),
+ mktime(12, 0, 0, 5, 9, $year),
+ mktime(12, 0, 0, 5, 1, $year),
+ mktime(12, 0, 0, 5, 13, $year),
+ mktime(12, 0, 0, 5, 19, $year),
+ mktime(12, 0, 0, 5, 23, $year),
+ mktime(12, 0, 0, 6, 3, $year),
+ mktime(12, 0, 0, 6, 19, $year),
+ mktime(12, 0, 0, 6, 24, $year),
+ mktime(12, 0, 0, 7, 3, $year),
+ mktime(12, 0, 0, 7, 9, $year),
+ mktime(12, 0, 0, 7, 23, $year),
+ mktime(12, 0, 0, 7, 30, $year),
+ mktime(12, 0, 0, 8, 9, $year),
+ mktime(12, 0, 0, 9, 23, $year),
+ mktime(12, 0, 0, 10, 3, $year),
+ mktime(12, 0, 0, 11, 12, $year),
+ mktime(12, 0, 0, 11, 13, $year),
+ mktime(12, 0, 0, 1, 3, ($year - 1)),
+ mktime(12, 0, 0, 1, 9, ($year - 1)),
+ mktime(12, 0, 0, 2, 13, ($year - 1)),
+ mktime(12, 0, 0, 2, 23, ($year - 1)),
+ mktime(12, 0, 0, 3, 30, ($year - 1)),
+ mktime(12, 0, 0, 4, 3, ($year - 1)),
+ mktime(12, 0, 0, 4, 3, ($year - 1)),
+ mktime(12, 0, 0, 5, 9, ($year - 1)),
+ mktime(12, 0, 0, 5, 1, ($year - 1)),
+ mktime(12, 0, 0, 5, 13, ($year - 1)),
+ mktime(12, 0, 0, 5, 19, ($year - 1)),
+ mktime(12, 0, 0, 5, 23, ($year - 1)),
+ mktime(12, 0, 0, 6, 3, ($year - 1)),
+ mktime(12, 0, 0, 6, 19, ($year - 1)),
+ mktime(12, 0, 0, 6, 24, ($year - 1)),
+ mktime(12, 0, 0, 7, 3, ($year - 1)),
+ mktime(12, 0, 0, 7, 9, ($year - 1)),
+ mktime(12, 0, 0, 7, 23, ($year - 1)),
+ mktime(12, 0, 0, 7, 30, ($year - 1)),
+ mktime(12, 0, 0, 8, 9, ($year - 1)),
+ mktime(12, 0, 0, 9, 23, ($year - 1)),
+ mktime(12, 0, 0, 10, 3, ($year - 1)),
+ mktime(12, 0, 0, 11, 12, $year),
+ mktime(12, 0, 0, 11, 13, $year),
+ mktime(12, 0, 0, 12, 12, $year),
+ mktime(12, 0, 0, 12, 13, $year),
);
-$ret=$user->fetch('','admin');
+$ret=$user->fetch('', 'admin');
if ($ret <= 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
@@ -177,7 +177,7 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
$listofuserid=array(12,13,16);
$fuser = new User($db);
- $fuser->fetch($listofuserid[mt_rand(0,2)]);
+ $fuser->fetch($listofuserid[mt_rand(0, 2)]);
$fuser->getRights();
$db->begin();
@@ -192,10 +192,10 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
- $result=$object->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
+ $result=$object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
if ($result <= 0)
{
- dol_print_error($db,$object->error);
+ dol_print_error($db, $object->error);
}
$xnbp++;
}
@@ -210,14 +210,14 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
{
print " KO\n";
$db->rollback();
- dol_print_error($db,$object->error);
+ dol_print_error($db, $object->error);
}
}
else
{
print " KO\n";
$db->rollback();
- dol_print_error($db,$object->error);
+ dol_print_error($db, $object->error);
}
}
diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php
index 393d5c5ce3d..4de100cb393 100755
--- a/dev/initdata/generate-product.php
+++ b/dev/initdata/generate-product.php
@@ -49,7 +49,7 @@ include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
define(GEN_NUMBER_PRODUIT, 100000);
-$ret=$user->fetch('','admin');
+$ret=$user->fetch('', 'admin');
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
@@ -85,12 +85,12 @@ for ($s = 0 ; $s < GEN_NUMBER_PRODUIT ; $s++)
{
print "Product ".$s;
$produit = new Product($db);
- $produit->type = mt_rand(0,1);
+ $produit->type = mt_rand(0, 1);
$produit->status = 1;
$produit->ref = ($produit->type?'S':'P').time().$s;
$produit->label = 'Label '.time().$s;
$produit->description = 'Description '.time().$s;
- $produit->price = mt_rand(1,1000);
+ $produit->price = mt_rand(1, 1000);
$produit->tva_tx = "19.6";
$ret=$produit->create($user);
if ($ret < 0) print "Error $ret - ".$produit->error."\n";
diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php
index eb2bfe15a00..4bd9c2c654b 100755
--- a/dev/initdata/generate-proposal.php
+++ b/dev/initdata/generate-proposal.php
@@ -45,59 +45,59 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
define(GEN_NUMBER_PROPAL, 10);
$year = 2016;
-$dates = array (mktime(12,0,0,1,3,$year),
- mktime(12,0,0,1,9,$year),
- mktime(12,0,0,2,13,$year),
- mktime(12,0,0,2,23,$year),
- mktime(12,0,0,3,30,$year),
- mktime(12,0,0,4,3,$year),
- mktime(12,0,0,4,3,$year),
- mktime(12,0,0,5,9,$year),
- mktime(12,0,0,5,1,$year),
- mktime(12,0,0,5,13,$year),
- mktime(12,0,0,5,19,$year),
- mktime(12,0,0,5,23,$year),
- mktime(12,0,0,6,3,$year),
- mktime(12,0,0,6,19,$year),
- mktime(12,0,0,6,24,$year),
- mktime(12,0,0,7,3,$year),
- mktime(12,0,0,7,9,$year),
- mktime(12,0,0,7,23,$year),
- mktime(12,0,0,7,30,$year),
- mktime(12,0,0,8,9,$year),
- mktime(12,0,0,9,23,$year),
- mktime(12,0,0,10,3,$year),
- mktime(12,0,0,11,12,$year),
- mktime(12,0,0,11,13,$year),
- mktime(12,0,0,1,3,($year - 1)),
- mktime(12,0,0,1,9,($year - 1)),
- mktime(12,0,0,2,13,($year - 1)),
- mktime(12,0,0,2,23,($year - 1)),
- mktime(12,0,0,3,30,($year - 1)),
- mktime(12,0,0,4,3,($year - 1)),
- mktime(12,0,0,4,3,($year - 1)),
- mktime(12,0,0,5,9,($year - 1)),
- mktime(12,0,0,5,1,($year - 1)),
- mktime(12,0,0,5,13,($year - 1)),
- mktime(12,0,0,5,19,($year - 1)),
- mktime(12,0,0,5,23,($year - 1)),
- mktime(12,0,0,6,3,($year - 1)),
- mktime(12,0,0,6,19,($year - 1)),
- mktime(12,0,0,6,24,($year - 1)),
- mktime(12,0,0,7,3,($year - 1)),
- mktime(12,0,0,7,9,($year - 1)),
- mktime(12,0,0,7,23,($year - 1)),
- mktime(12,0,0,7,30,($year - 1)),
- mktime(12,0,0,8,9,($year - 1)),
- mktime(12,0,0,9,23,($year - 1)),
- mktime(12,0,0,10,3,($year - 1)),
- mktime(12,0,0,11,12,$year),
- mktime(12,0,0,11,13,$year),
- mktime(12,0,0,12,12,$year),
- mktime(12,0,0,12,13,$year),
+$dates = array (mktime(12, 0, 0, 1, 3, $year),
+ mktime(12, 0, 0, 1, 9, $year),
+ mktime(12, 0, 0, 2, 13, $year),
+ mktime(12, 0, 0, 2, 23, $year),
+ mktime(12, 0, 0, 3, 30, $year),
+ mktime(12, 0, 0, 4, 3, $year),
+ mktime(12, 0, 0, 4, 3, $year),
+ mktime(12, 0, 0, 5, 9, $year),
+ mktime(12, 0, 0, 5, 1, $year),
+ mktime(12, 0, 0, 5, 13, $year),
+ mktime(12, 0, 0, 5, 19, $year),
+ mktime(12, 0, 0, 5, 23, $year),
+ mktime(12, 0, 0, 6, 3, $year),
+ mktime(12, 0, 0, 6, 19, $year),
+ mktime(12, 0, 0, 6, 24, $year),
+ mktime(12, 0, 0, 7, 3, $year),
+ mktime(12, 0, 0, 7, 9, $year),
+ mktime(12, 0, 0, 7, 23, $year),
+ mktime(12, 0, 0, 7, 30, $year),
+ mktime(12, 0, 0, 8, 9, $year),
+ mktime(12, 0, 0, 9, 23, $year),
+ mktime(12, 0, 0, 10, 3, $year),
+ mktime(12, 0, 0, 11, 12, $year),
+ mktime(12, 0, 0, 11, 13, $year),
+ mktime(12, 0, 0, 1, 3, ($year - 1)),
+ mktime(12, 0, 0, 1, 9, ($year - 1)),
+ mktime(12, 0, 0, 2, 13, ($year - 1)),
+ mktime(12, 0, 0, 2, 23, ($year - 1)),
+ mktime(12, 0, 0, 3, 30, ($year - 1)),
+ mktime(12, 0, 0, 4, 3, ($year - 1)),
+ mktime(12, 0, 0, 4, 3, ($year - 1)),
+ mktime(12, 0, 0, 5, 9, ($year - 1)),
+ mktime(12, 0, 0, 5, 1, ($year - 1)),
+ mktime(12, 0, 0, 5, 13, ($year - 1)),
+ mktime(12, 0, 0, 5, 19, ($year - 1)),
+ mktime(12, 0, 0, 5, 23, ($year - 1)),
+ mktime(12, 0, 0, 6, 3, ($year - 1)),
+ mktime(12, 0, 0, 6, 19, ($year - 1)),
+ mktime(12, 0, 0, 6, 24, ($year - 1)),
+ mktime(12, 0, 0, 7, 3, ($year - 1)),
+ mktime(12, 0, 0, 7, 9, ($year - 1)),
+ mktime(12, 0, 0, 7, 23, ($year - 1)),
+ mktime(12, 0, 0, 7, 30, ($year - 1)),
+ mktime(12, 0, 0, 8, 9, ($year - 1)),
+ mktime(12, 0, 0, 9, 23, ($year - 1)),
+ mktime(12, 0, 0, 10, 3, ($year - 1)),
+ mktime(12, 0, 0, 11, 12, $year),
+ mktime(12, 0, 0, 11, 13, $year),
+ mktime(12, 0, 0, 12, 12, $year),
+ mktime(12, 0, 0, 12, 13, $year),
);
-$ret=$user->fetch('','admin');
+$ret=$user->fetch('', 'admin');
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
@@ -174,7 +174,7 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
$object = new Propal($db);
$fuser = new User($db);
- $fuser->fetch(mt_rand(1,2));
+ $fuser->fetch(mt_rand(1, 2));
$fuser->getRights();
$object->contactid = $contids[$socids[$socid]][0];
@@ -193,10 +193,10 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
- $result=$object->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
+ $result=$object->addline($product->description, $product->price, mt_rand(1, 5), 0, 0, 0, $prodids[$prodid], 0);
if ($result < 0)
{
- dol_print_error($db,$object->error);
+ dol_print_error($db, $object->error);
}
$xnbp++;
}
@@ -211,11 +211,11 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
{
print " KO\n";
$db->rollback();
- dol_print_error($db,$object->error);
+ dol_print_error($db, $object->error);
}
}
else
{
- dol_print_error($db,$object->error);
+ dol_print_error($db, $object->error);
}
}
diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php
index 7f2c3e2055d..0281d7a289e 100755
--- a/dev/initdata/generate-thirdparty.php
+++ b/dev/initdata/generate-thirdparty.php
@@ -52,7 +52,7 @@ $listoflastname = array("Joe","Marc","Steve","Laurent","Nico","Isabelle","Doroth
define(GEN_NUMBER_SOCIETE, 10);
-$ret=$user->fetch('','admin');
+$ret=$user->fetch('', 'admin');
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
@@ -91,22 +91,22 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
$soc = new Societe($db);
$soc->name = "Company num ".time()."$s";
$soc->town = $listoftown[mt_rand(0, count($listoftown)-1)];
- $soc->client = mt_rand(1,2); // Une societe sur 2 est prospect, l'autre client
- $soc->fournisseur = mt_rand(0,1); // Une societe sur 2 est fournisseur
+ $soc->client = mt_rand(1, 2); // Une societe sur 2 est prospect, l'autre client
+ $soc->fournisseur = mt_rand(0, 1); // Une societe sur 2 est fournisseur
$soc->code_client='CU'.time()."$s";
$soc->code_fournisseur='SU'.time()."$s";
$soc->tva_assuj=1;
$soc->country_id=1;
$soc->country_code='FR';
// Un client sur 3 a une remise de 5%
- $user_remise=mt_rand(1,3); if ($user_remise==3) $soc->remise_percent=5;
+ $user_remise=mt_rand(1, 3); if ($user_remise==3) $soc->remise_percent=5;
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
$soc->note_private = 'Company created by the script generate-societe.php';
$socid = $soc->create();
if ($socid >= 0)
{
- $rand = mt_rand(1,4);
+ $rand = mt_rand(1, 4);
print "> Generates $rand contact(s)\n";
for ($c = 0 ; $c < $rand ; $c++)
{
diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php
index 0f4856aefb2..4494e65c280 100755
--- a/dev/initdata/import-products.php
+++ b/dev/initdata/import-products.php
@@ -35,7 +35,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
}
// Recupere root dolibarr
-$path=preg_replace('/import-products.php/i','',$_SERVER["PHP_SELF"]);
+$path=preg_replace('/import-products.php/i', '', $_SERVER["PHP_SELF"]);
require $path."../../htdocs/master.inc.php";
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -57,7 +57,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
-dol_syslog($script_file." launched with arg ".implode(',',$argv));
+dol_syslog($script_file." launched with arg ".implode(',', $argv));
$mode = $argv[1];
$filepath = $argv[2];
@@ -66,7 +66,7 @@ $defaultlang = empty($argv[3])?'en_US':$argv[3];
$startlinenb = empty($argv[4])?1:$argv[4];
$endlinenb = empty($argv[5])?0:$argv[5];
-if (empty($mode) || ! in_array($mode,array('test','confirm','confirmforced')) || empty($filepath)) {
+if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv fr_FR 2 1002\n";
print "\n";
@@ -78,7 +78,7 @@ if (! file_exists($filepath)) {
exit(-1);
}
-$ret=$user->fetch('','admin');
+$ret=$user->fetch('', 'admin');
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php
index 63c6856e5ec..69b9bb8bdc6 100755
--- a/dev/initdata/import-thirdparties.php
+++ b/dev/initdata/import-thirdparties.php
@@ -35,7 +35,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
}
// Recupere root dolibarr
-$path=preg_replace('/import-thirdparties.php/i','',$_SERVER["PHP_SELF"]);
+$path=preg_replace('/import-thirdparties.php/i', '', $_SERVER["PHP_SELF"]);
require $path."../../htdocs/master.inc.php";
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -57,7 +57,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
-dol_syslog($script_file." launched with arg ".implode(',',$argv));
+dol_syslog($script_file." launched with arg ".implode(',', $argv));
$mode = $argv[1];
$filepath = $argv[2];
@@ -66,7 +66,7 @@ $filepatherr = $filepath.'.err';
$startlinenb = empty($argv[3])?1:$argv[3];
$endlinenb = empty($argv[4])?0:$argv[4];
-if (empty($mode) || ! in_array($mode,array('test','confirm','confirmforced')) || empty($filepath)) {
+if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv 2 1002\n";
print "\n";
@@ -78,7 +78,7 @@ if (! file_exists($filepath)) {
exit(-1);
}
-$ret=$user->fetch('','admin');
+$ret=$user->fetch('', 'admin');
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
@@ -199,13 +199,13 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
{
$salesrep=new User($db);
- $tmp=explode(' ',$fields[3],2);
+ $tmp=explode(' ', $fields[3], 2);
$salesrep->firstname = trim($tmp[0]);
$salesrep->lastname = trim($tmp[1]);
if ($salesrep->lastname) $salesrep->login = strtolower(substr($salesrep->firstname, 0, 1)) . strtolower(substr($salesrep->lastname, 0));
else $salesrep->login=strtolower($salesrep->firstname);
- $salesrep->login=preg_replace('/ /','',$salesrep->login);
- $salesrep->fetch(0,$salesrep->login);
+ $salesrep->login=preg_replace('/ /', '', $salesrep->login);
+ $salesrep->fetch(0, $salesrep->login);
$result = $object->add_commercial($user, $salesrep->id);
if ($result < 0)
diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php
index c94f74341f6..2a1dcc3d826 100755
--- a/dev/initdata/import-users.php
+++ b/dev/initdata/import-users.php
@@ -35,7 +35,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
}
// Recupere root dolibarr
-$path=preg_replace('/import-users.php/i','',$_SERVER["PHP_SELF"]);
+$path=preg_replace('/import-users.php/i', '', $_SERVER["PHP_SELF"]);
require $path."../../htdocs/master.inc.php";
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -57,7 +57,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
-dol_syslog($script_file." launched with arg ".implode(',',$argv));
+dol_syslog($script_file." launched with arg ".implode(',', $argv));
$mode = $argv[1];
$filepath = $argv[2];
@@ -66,7 +66,7 @@ $filepatherr = $filepath.'.err';
$startlinenb = empty($argv[3])?1:$argv[3];
$endlinenb = empty($argv[4])?0:$argv[4];
-if (empty($mode) || ! in_array($mode,array('test','confirm','confirmforced')) || empty($filepath)) {
+if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) || empty($filepath)) {
print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n";
print "Usage: $script_file test myfilepath.csv 2 1002\n";
print "\n";
@@ -78,7 +78,7 @@ if (! file_exists($filepath)) {
exit(-1);
}
-$ret=$user->fetch('','admin');
+$ret=$user->fetch('', 'admin');
if (! $ret > 0)
{
print 'A user with login "admin" and all permissions must be created to use this script.'."\n";
@@ -127,12 +127,12 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
$object = new User($db);
$object->statut = 1;
- $tmp=explode(' ',$fields[3],2);
+ $tmp=explode(' ', $fields[3], 2);
$object->firstname = trim($tmp[0]);
$object->lastname = trim($tmp[1]);
if ($object->lastname) $object->login = strtolower(substr($object->firstname, 0, 1)) . strtolower(substr($object->lastname, 0));
else $object->login=strtolower($object->firstname);
- $object->login=preg_replace('/ /','',$object->login);
+ $object->login=preg_replace('/ /', '', $object->login);
$object->password = 'init';
print "Process line nb ".$i.", login ".$object->login;
diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php
index 2bdf200225b..996ad42e451 100755
--- a/dev/initdata/purge-data.php
+++ b/dev/initdata/purge-data.php
@@ -35,7 +35,7 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
}
// Recupere root dolibarr
-$path=preg_replace('/purge-data.php/i','',$_SERVER["PHP_SELF"]);
+$path=preg_replace('/purge-data.php/i', '', $_SERVER["PHP_SELF"]);
require $path."../../htdocs/master.inc.php";
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
@@ -150,22 +150,22 @@ $sqls=array(
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
-dol_syslog($script_file." launched with arg ".implode(',',$argv));
+dol_syslog($script_file." launched with arg ".implode(',', $argv));
$mode = $argv[1];
$option = $argv[2];
-if (empty($mode) || ! in_array($mode,array('test','confirm'))) {
+if (empty($mode) || ! in_array($mode, array('test','confirm'))) {
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
- print "option can be ".implode(',',array_keys($sqls))."\n";
+ print "option can be ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
-if (empty($option) || ! in_array($option, array_merge(array('all'),array_keys($sqls))) ) {
+if (empty($option) || ! in_array($option, array_merge(array('all'), array_keys($sqls))) ) {
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
- print "option can be ".implode(',',array_keys($sqls))."\n";
+ print "option can be ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
@@ -179,7 +179,7 @@ if (! empty($argv[3]))
}
//var_dump($user->db->database_name);
-$ret=$user->fetch('','admin');
+$ret=$user->fetch('', 'admin');
if (! $ret > 0)
{
print 'An admin user with login "admin" must exists to use this script.'."\n";
@@ -215,9 +215,9 @@ function processfamily($family)
$error=0;
foreach($sqls[$family] as $sql)
{
- if (preg_match('/^@/',$sql))
+ if (preg_match('/^@/', $sql))
{
- $newfamily=preg_replace('/@/','',$sql);
+ $newfamily=preg_replace('/@/', '', $sql);
processfamily($newfamily);
continue;
}
diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php
index 98cb6189935..e9641ac6816 100755
--- a/dev/initdemo/sftpget_and_loaddump.php
+++ b/dev/initdemo/sftpget_and_loaddump.php
@@ -46,8 +46,8 @@ if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include $p
if (! $res && file_exists("../master.inc.php")) $res=@include "../master.inc.php";
if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.inc.php";
if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php";
-if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
-if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
+if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
+if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
if (! $res) die ("Failed to include master.inc.php file\n");
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -58,7 +58,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$login='';
$server='';
-if (preg_match('/^(.*)@(.*):(.*)$/',$sourceserver,$reg))
+if (preg_match('/^(.*)@(.*):(.*)$/', $sourceserver, $reg))
{
$login=$reg[1];
$server=$reg[2];
@@ -84,7 +84,7 @@ print 'SFTP connect string : '.$sftpconnectstring."\n";
// SFTP connect
if (! function_exists("ssh2_connect")) {
- dol_print_error('','ssh2_connect function does not exists'); exit(1);
+ dol_print_error('', 'ssh2_connect function does not exists'); exit(1);
}
$connection = ssh2_connect($server, 22);
@@ -92,7 +92,7 @@ if ($connection)
{
if (! @ssh2_auth_password($connection, $login, $password))
{
- dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password),LOG_ERR);
+ dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR);
exit(-5);
}
else
@@ -112,11 +112,11 @@ if ($connection)
ssh2_scp_recv($connection, $sourcefile, $targetdir.$targetfile);
$fullcommand="cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
- if (preg_match('/\.bz2$/',$targetfile))
+ if (preg_match('/\.bz2$/', $targetfile))
{
$fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
}
- if (preg_match('/\.gz$/',$targetfile))
+ if (preg_match('/\.gz$/', $targetfile))
{
$fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
}
diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php
index 53717314d5f..606bdbe6f56 100755
--- a/dev/initdemo/updatedemo.php
+++ b/dev/initdemo/updatedemo.php
@@ -41,8 +41,8 @@ if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include $p
if (! $res && file_exists("../master.inc.php")) $res=@include "../master.inc.php";
if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.inc.php";
if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php";
-if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
-if (! $res && preg_match('/\/nltechno([^\/]*)\//',$_SERVER["PHP_SELF"],$reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
+if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
+if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
if (! $res) die ("Failed to include master.inc.php file\n");
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml
index 879d791b8e9..19b32753940 100644
--- a/dev/setup/codesniffer/ruleset.xml
+++ b/dev/setup/codesniffer/ruleset.xml
@@ -65,7 +65,7 @@