diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index 831aa15c68a..60fea392133 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -1,4 +1,7 @@
# .scrutinizer.yml
+build:
+ - php-scrutinizer-run
+
imports:
- javascript
- php
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 1aad39954fc..06a5aa3e598 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -2404,7 +2404,7 @@ class Adherent extends CommonObject
$this->country_id = 1;
$this->country_code = 'FR';
$this->country = 'France';
- $this->morphy = 1;
+ $this->morphy = 'mor';
$this->email = 'specimen@specimen.com';
$this->skype = 'skypepseudo';
$this->twitter = 'twitterpseudo';
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index 5cad21cdd71..9955466b158 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -81,7 +81,6 @@ $mesg = $px1->isGraphKo();
if (! $mesg)
{
$px1->SetData($data);
- $px1->SetPrecisionY(0);
$i=$startyear;
while ($i <= $endyear)
{
@@ -96,7 +95,6 @@ if (! $mesg)
$px1->SetYLabel($langs->trans("NbOfSubscriptions"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->mode='depth';
$px1->SetTitle($langs->trans("NbOfSubscriptions"));
@@ -116,7 +114,6 @@ $mesg = $px2->isGraphKo();
if (! $mesg)
{
$px2->SetData($data);
- $px2->SetPrecisionY(0);
$i=$startyear;
while ($i <= $endyear)
{
@@ -131,7 +128,6 @@ if (! $mesg)
$px2->SetYLabel($langs->trans("AmountOfSubscriptions"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountOfSubscriptions"));
diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index c05305b6393..6343be072d8 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -75,7 +75,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
activateModulesRequiredByCountry($mysoc->country_code);
}
- $tmparray=getState(GETPOST('state_id','int'), 'all', $db, $langs, 0);
+ $tmparray=getState(GETPOST('state_id', 'int'), 'all', $db, $langs, 0);
if (! empty($tmparray['id']))
{
$mysoc->state_id =$tmparray['id'];
@@ -83,23 +83,27 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
$mysoc->state_label=$tmparray['label'];
$s=$mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label;
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s,'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity);
+ }
+ else
+ {
+ dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity);
}
$db->begin();
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS",'nohtml'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code",'alpha'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'aZ09'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode",'alpha'),'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml'), 'chaine', 0, '' ,$conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alpha'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'aZ09'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel",'alpha'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax",'alpha'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail",'alpha'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web",'alpha'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note",'none'), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alpha'), 'chaine', 0, '', $conf->entity);
$varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
if ($_FILES[$varforimage]["tmp_name"])
@@ -385,7 +389,13 @@ if ($action == 'edit' || $action == 'updateedit')
print '
| ';
- $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE, $mysoc->country_code, 'state_id');
+ $state_id=0;
+ if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE))
+ {
+ $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
+ $state_id=$tmp[0];
+ }
+ $formcompany->select_departement($state_id, $mysoc->country_code, 'state_id');
print ' |
'."\n";
@@ -774,8 +784,12 @@ else
if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print '| '.$langs->trans("Region-State").' | ';
else print ' |
| '.$langs->trans("State").' | ';
- if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) print getState($conf->global->MAIN_INFO_SOCIETE_STATE, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
- else print ' ';
+ if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE))
+ {
+ $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE);
+ $state_id=$tmp[0];
+ print getState($state_id, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
+ }
print ' |
';
diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php
index c04c91e0e66..135efb734c2 100644
--- a/htdocs/admin/system/database-tables.php
+++ b/htdocs/admin/system/database-tables.php
@@ -21,7 +21,7 @@
/**
* \file htdocs/admin/system/database-tables.php
- * \brief Page d'infos des tables de la base
+ * \brief Page with information on database tables
*/
require '../../main.inc.php';
@@ -134,7 +134,7 @@ else
print ''.$obj->Auto_increment.' | ';
print ''.$obj->Check_time.' | ';
print ''.$obj->Collation;
- if (isset($obj->Collation) && ($obj->Collation == "utf8mb4_general_ci" || $obj->Collation == "utf8mb4_unicode_ci"))
+ if (isset($obj->Collation) && (in_array($obj->Collation, array("utf8mb4_general_ci", "utf8mb4_unicode_ci", "latin1_swedish_ci"))))
{
print ' '.$langs->trans("Convert").' UTF8';
}
diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php
index 8e9e31e68b2..37aeb4607c8 100644
--- a/htdocs/asset/class/asset.class.php
+++ b/htdocs/asset/class/asset.class.php
@@ -163,9 +163,9 @@ class Asset extends CommonObject
*/
//public $class_element_line = 'Assetline';
/**
- * @var array Array of child tables (child tables to delete before deleting a record)
+ * @var array List of child tables. To test if we can delete object.
*/
- //protected $childtables=array('assetdet');
+ //protected $childtables=array();
/**
* @var AssetLine[] Array of subtable lines
*/
diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php
index 75cff3a8202..22b78b421f6 100644
--- a/htdocs/asterisk/wrapper.php
+++ b/htdocs/asterisk/wrapper.php
@@ -39,6 +39,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
/**
* Empty header
*
+ * @ignore
* @return void
*/
function llxHeader()
@@ -48,9 +49,11 @@ function llxHeader()
print 'Asterisk redirection from Dolibarr...'."\n";
print ''."\n";
}
+
/**
* Empty footer
*
+ * @ignore
* @return void
*/
function llxFooter()
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 99331de8c62..5d9f1f50cbc 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -41,12 +41,6 @@ class BOM extends CommonObject
*/
public $table_element = 'bom_bom';
- /**
- * @var string Name of subtable if this object has sub lines
- */
- public $table_element_line = 'bom_bomline';
- public $fk_element = 'fk_bom';
-
/**
* @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
@@ -134,27 +128,32 @@ class BOM extends CommonObject
/**
* @var int Name of subtable line
*/
- //public $table_element_line = 'bomdet';
+ public $table_element_line = 'bom_bomline';
/**
* @var int Field with ID of parent key if this field has a parent
*/
- //public $fk_element = 'fk_bom';
+ public $fk_element = 'fk_bom';
/**
* @var int Name of subtable class that manage subtable lines
*/
- //public $class_element_line = 'BillOfMaterialsline';
+ public $class_element_line = 'BOMLine';
/**
- * @var array Array of child tables (child tables to delete before deleting a record)
+ * @var array List of child tables. To test if we can delete object.
*/
- //protected $childtables=array('bomdet');
+ //protected $childtables=array();
/**
- * @var BillOfMaterialsLine[] Array of subtable lines
+ * @var array List of child tables. To know object to delete on cascade.
*/
- //public $lines = array();
+ protected $childtablesoncascade=array('bom_bomline');
+
+ /**
+ * @var BOMLine[] Array of subtable lines
+ */
+ public $lines = array();
diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php
index aa47f1c226d..13b7b5fa2d2 100644
--- a/htdocs/comm/propal/stats/index.php
+++ b/htdocs/comm/propal/stats/index.php
@@ -110,7 +110,6 @@ $mesg = $px1->isGraphKo();
if (! $mesg)
{
$px1->SetData($data);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -125,7 +124,6 @@ if (! $mesg)
$px1->SetYLabel($langs->trans("NbOfProposals"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberOfProposalsByMonth"));
@@ -152,7 +150,6 @@ $mesg = $px2->isGraphKo();
if (! $mesg)
{
$px2->SetData($data);
- $px2->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -167,7 +164,6 @@ if (! $mesg)
$px2->SetYLabel($langs->trans("AmountOfProposals"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountOfProposalsByMonthHT"));
@@ -209,7 +205,6 @@ if (! $mesg)
$px3->SetHeight($HEIGHT);
$px3->SetShading(3);
$px3->SetHorizTickIncrement(1);
- $px3->SetPrecisionY(0);
$px3->mode='depth';
$px3->SetTitle($langs->trans("AmountAverage"));
diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php
index 81a477d07c5..1d2936263b8 100644
--- a/htdocs/commande/stats/index.php
+++ b/htdocs/commande/stats/index.php
@@ -119,7 +119,6 @@ $mesg = $px1->isGraphKo();
if (! $mesg)
{
$px1->SetData($data);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -134,7 +133,6 @@ if (! $mesg)
$px1->SetYLabel($langs->trans("NbOfOrder"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
@@ -178,7 +176,6 @@ if (! $mesg)
$px2->SetYLabel($langs->trans("AmountOfOrders"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
@@ -220,7 +217,6 @@ if (! $mesg)
$px3->SetHeight($HEIGHT);
$px3->SetShading(3);
$px3->SetHorizTickIncrement(1);
- $px3->SetPrecisionY(0);
$px3->mode='depth';
$px3->SetTitle($langs->trans("AmountAverage"));
diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php
index c4352b3b97e..6643a9f97fb 100644
--- a/htdocs/compta/bank/annuel.php
+++ b/htdocs/compta/bank/annuel.php
@@ -384,7 +384,6 @@ else
$px1->setBgColor('onglet');
$px1->setBgColorGrid(array(255,255,255));
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->draw($file, $fileurl);
$show1 = $px1->show();
@@ -471,7 +470,6 @@ else
$px2->setBgColor('onglet');
$px2->setBgColorGrid(array(255,255,255));
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->draw($file, $fileurl);
$show2 = $px2->show();
diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php
index cf355beeb77..cdd346c889f 100644
--- a/htdocs/compta/bank/graph.php
+++ b/htdocs/compta/bank/graph.php
@@ -252,7 +252,6 @@ else
$px1->setBgColor('onglet');
$px1->setBgColorGrid(array(255,255,255));
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->draw($file, $fileurl);
$show1=$px1->show();
@@ -389,7 +388,6 @@ else
$px2->setBgColorGrid(array(255,255,255));
$px2->SetHideXGrid(true);
//$px2->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne
- $px2->SetPrecisionY(0);
$px2->draw($file, $fileurl);
$show2=$px2->show();
@@ -503,7 +501,6 @@ else
$px3->SetType(array('linesnopoint','linesnopoint','linesnopoint'));
$px3->setBgColor('onglet');
$px3->setBgColorGrid(array(255,255,255));
- $px3->SetPrecisionY(0);
$px3->draw($file, $fileurl);
$show3=$px3->show();
@@ -633,7 +630,6 @@ else
$px4->setBgColor('onglet');
$px4->setBgColorGrid(array(255,255,255));
$px4->SetHorizTickIncrement(1);
- $px4->SetPrecisionY(0);
$px4->draw($file, $fileurl);
$show4=$px4->show();
@@ -742,7 +738,6 @@ else
$px5->setBgColor('onglet');
$px5->setBgColorGrid(array(255,255,255));
$px5->SetHorizTickIncrement(1);
- $px5->SetPrecisionY(0);
$px5->draw($file, $fileurl);
$show5=$px5->show();
diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php
index 33bec241d48..830a1bc7e4c 100644
--- a/htdocs/compta/deplacement/stats/index.php
+++ b/htdocs/compta/deplacement/stats/index.php
@@ -107,7 +107,6 @@ $mesg = $px1->isGraphKo();
if (! $mesg)
{
$px1->SetData($data);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -121,7 +120,6 @@ if (! $mesg)
$px1->SetYLabel($langs->trans("Number"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberByMonth"));
@@ -155,7 +153,6 @@ if (! $mesg)
$px2->SetYLabel($langs->trans("Amount"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountTotal"));
@@ -197,7 +194,6 @@ if (! $mesg)
$px3->SetHeight($HEIGHT);
$px3->SetShading(3);
$px3->SetHorizTickIncrement(1);
- $px3->SetPrecisionY(0);
$px3->mode='depth';
$px3->SetTitle($langs->trans("AmountAverage"));
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index 5d8fee98676..99abd48cb49 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -103,7 +103,6 @@ $mesg = $px1->isGraphKo();
if (! $mesg)
{
$px1->SetData($data);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -117,7 +116,6 @@ if (! $mesg)
$px1->SetYLabel($langs->trans("NumberOfBills"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
@@ -152,7 +150,6 @@ if (! $mesg)
$px2->SetYLabel($langs->trans("AmountOfBills"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
@@ -194,7 +191,6 @@ if (! $mesg)
$px3->SetHeight($HEIGHT);
$px3->SetShading(3);
$px3->SetHorizTickIncrement(1);
- $px3->SetPrecisionY(0);
$px3->mode='depth';
$px3->SetTitle($langs->trans("AmountAverage"));
diff --git a/htdocs/compta/salaries/stats/index.php b/htdocs/compta/salaries/stats/index.php
index 0c64ed5865e..d6f94427cce 100644
--- a/htdocs/compta/salaries/stats/index.php
+++ b/htdocs/compta/salaries/stats/index.php
@@ -83,7 +83,6 @@ $mesg = $px1->isGraphKo();
if (! $mesg)
{
$px1->SetData($data);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -97,7 +96,6 @@ if (! $mesg)
$px1->SetYLabel($langs->trans("Number"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberByMonth"));
@@ -131,7 +129,6 @@ if (! $mesg)
$px2->SetYLabel($langs->trans("Amount"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountTotal"));
@@ -163,7 +160,6 @@ if (! $mesg)
$px3->SetHeight($HEIGHT);
$px3->SetShading(3);
$px3->SetHorizTickIncrement(1);
- $px3->SetPrecisionY(0);
$px3->mode='depth';
$px3->SetTitle($langs->trans("AmountAverage"));
diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php
index 4323661370c..4ece2eae661 100644
--- a/htdocs/core/boxes/box_graph_invoices_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_permonth.php
@@ -143,7 +143,6 @@ class box_graph_invoices_permonth extends ModeleBoxes
$px1->SetData($data1);
unset($data1);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -157,7 +156,6 @@ class box_graph_invoices_permonth extends ModeleBoxes
$px1->SetYLabel($langs->trans("NumberOfBills"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->SetCssPrefix("cssboxes");
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
@@ -183,7 +181,6 @@ class box_graph_invoices_permonth extends ModeleBoxes
$px2->SetData($data2);
unset($data2);
- $px2->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -197,7 +194,6 @@ class box_graph_invoices_permonth extends ModeleBoxes
$px2->SetYLabel($langs->trans("AmountOfBillsHT"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->SetCssPrefix("cssboxes");
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
index bba5185c94a..4e7849ab048 100644
--- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php
@@ -140,7 +140,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$px1->SetData($data1);
unset($data1);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -154,7 +153,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$px1->SetYLabel($langs->trans("NumberOfBills"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->SetCssPrefix("cssboxes");
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
@@ -180,7 +178,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$px2->SetData($data2);
unset($data2);
- $px2->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -194,7 +191,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$px2->SetYLabel($langs->trans("AmountOfBillsHT"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->SetCssPrefix("cssboxes");
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php
index b06558393aa..3ba42cc6d0a 100644
--- a/htdocs/core/boxes/box_graph_orders_permonth.php
+++ b/htdocs/core/boxes/box_graph_orders_permonth.php
@@ -141,7 +141,6 @@ class box_graph_orders_permonth extends ModeleBoxes
{
$px1->SetData($data1);
unset($data1);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -155,7 +154,6 @@ class box_graph_orders_permonth extends ModeleBoxes
$px1->SetYLabel($langs->trans("NumberOfOrders"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->SetCssPrefix("cssboxes");
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
@@ -179,7 +177,6 @@ class box_graph_orders_permonth extends ModeleBoxes
{
$px2->SetData($data2);
unset($data2);
- $px2->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -193,7 +190,6 @@ class box_graph_orders_permonth extends ModeleBoxes
$px2->SetYLabel($langs->trans("AmountOfOrdersHT"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->SetCssPrefix("cssboxes");
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
index 9cb11aed7c1..6bfc47c504d 100644
--- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
+++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php
@@ -140,7 +140,6 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
{
$px1->SetData($data1);
unset($data1);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -154,7 +153,6 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$px1->SetYLabel($langs->trans("NumberOfOrders"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->SetCssPrefix("cssboxes");
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
@@ -178,7 +176,6 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
{
$px2->SetData($data2);
unset($data2);
- $px2->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -192,7 +189,6 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$px2->SetYLabel($langs->trans("AmountOfOrdersHT"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->SetCssPrefix("cssboxes");
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php
index 0fe5c66d532..e085cd82f07 100644
--- a/htdocs/core/boxes/box_graph_product_distribution.php
+++ b/htdocs/core/boxes/box_graph_product_distribution.php
@@ -171,7 +171,6 @@ class box_graph_product_distribution extends ModeleBoxes
unset($data1);
if ($nocolor) $px1->SetDataColor(array(array(220,220,220)));
- $px1->SetPrecisionY(0);
$px1->SetLegend($legend);
$px1->setShowLegend(0);
$px1->setShowPointValue($showpointvalue);
@@ -182,7 +181,6 @@ class box_graph_product_distribution extends ModeleBoxes
//$px1->SetYLabel($langs->trans("NumberOfBills"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->SetCssPrefix("cssboxes");
//$px1->mode='depth';
$px1->SetType(array('pie'));
@@ -231,7 +229,6 @@ class box_graph_product_distribution extends ModeleBoxes
unset($data2);
if ($nocolor) $px2->SetDataColor(array(array(220,220,220)));
- $px2->SetPrecisionY(0);
$px2->SetLegend($legend);
$px2->setShowLegend(0);
$px2->setShowPointValue($showpointvalue);
@@ -242,7 +239,6 @@ class box_graph_product_distribution extends ModeleBoxes
//$px2->SetYLabel($langs->trans("AmountOfBillsHT"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->SetCssPrefix("cssboxes");
//$px2->mode='depth';
$px2->SetType(array('pie'));
@@ -292,7 +288,6 @@ class box_graph_product_distribution extends ModeleBoxes
unset($data3);
if ($nocolor) $px3->SetDataColor(array(array(220,220,220)));
- $px3->SetPrecisionY(0);
$px3->SetLegend($legend);
$px3->setShowLegend(0);
$px3->setShowPointValue($showpointvalue);
@@ -303,7 +298,6 @@ class box_graph_product_distribution extends ModeleBoxes
//$px3->SetYLabel($langs->trans("AmountOfBillsHT"));
$px3->SetShading(3);
$px3->SetHorizTickIncrement(1);
- $px3->SetPrecisionY(0);
$px3->SetCssPrefix("cssboxes");
//$px3->mode='depth';
$px3->SetType(array('pie'));
diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php
index b21381473c2..9ced39271d0 100644
--- a/htdocs/core/boxes/box_graph_propales_permonth.php
+++ b/htdocs/core/boxes/box_graph_propales_permonth.php
@@ -141,7 +141,6 @@ class box_graph_propales_permonth extends ModeleBoxes
$px1->SetType($datatype1);
$px1->SetData($data1);
unset($data1);
- $px1->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -155,7 +154,6 @@ class box_graph_propales_permonth extends ModeleBoxes
$px1->SetYLabel($langs->trans("NumberOfProposals"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->SetPrecisionY(0);
$px1->SetCssPrefix("cssboxes");
$px1->mode='depth';
$px1->SetTitle($langs->trans("NumberOfProposalsByMonth"));
@@ -182,7 +180,6 @@ class box_graph_propales_permonth extends ModeleBoxes
$px2->SetType($datatype2);
$px2->SetData($data2);
unset($data2);
- $px2->SetPrecisionY(0);
$i=$startyear;$legend=array();
while ($i <= $endyear)
{
@@ -196,7 +193,6 @@ class box_graph_propales_permonth extends ModeleBoxes
$px2->SetYLabel($langs->trans("AmountOfProposalsHT"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->SetPrecisionY(0);
$px2->SetCssPrefix("cssboxes");
$px2->mode='depth';
$px2->SetTitle($langs->trans("AmountOfProposalsByMonthHT"));
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index f989f0bb431..9c5812069b7 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -7490,7 +7490,7 @@ abstract class CommonObject
$this->db->begin();
- if ($forcechilddeletion)
+ if ($forcechilddeletion) // Force also delete of childtables that should lock deletion in standard case when option force is off
{
foreach($this->childtables as $table)
{
@@ -7518,6 +7518,20 @@ abstract class CommonObject
}
}
+ // Delete cascade first
+ foreach($this->childtablesoncascade as $table)
+ {
+ $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.$this->fk_element.' = '.$this->id;
+ $resql = $this->db->query($sql);
+ if (! $resql)
+ {
+ $this->error=$this->db->lasterror();
+ $this->errors[]=$this->error;
+ $this->db->rollback();
+ return -1;
+ }
+ }
+
if (! $error) {
if (! $notrigger) {
// Call triggers
diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php
index 02a083978ef..41aae05d74a 100644
--- a/htdocs/core/class/coreobject.class.php
+++ b/htdocs/core/class/coreobject.class.php
@@ -25,6 +25,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
+// TODO Remove this class (used in Expensereportik and ExpenseReportRule
class CoreObject extends CommonObject
{
public $withChild = true;
@@ -175,7 +176,7 @@ class CoreObject extends CommonObject
*/
public function fetchChild()
{
- if($this->withChild && !empty($this->childtables) && !empty($this->fk_element))
+ if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element))
{
foreach($this->childtables as &$childTable)
{
diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php
index 8b7bc4acf18..458f0bd4fad 100644
--- a/htdocs/core/class/dolgraph.class.php
+++ b/htdocs/core/class/dolgraph.class.php
@@ -61,8 +61,6 @@ class DolGraph
public $MinValue=0;
public $SetShading=0;
- public $PrecisionY=-1;
-
public $horizTickIncrement=-1;
public $SetNumXTicks=-1;
public $labelInterval=-1;
@@ -116,7 +114,6 @@ class DolGraph
if (! $isgdinstalled)
{
$this->error="Error: PHP GD module is not available. It is required to build graphics.";
- return -1;
}
}
@@ -142,11 +139,11 @@ class DolGraph
*
* @param float $which_prec Precision
* @return boolean
+ * @deprecated
*/
public function SetPrecisionY($which_prec)
{
// phpcs:enable
- $this->PrecisionY = $which_prec;
return true;
}
@@ -891,6 +888,7 @@ class DolGraph
private function draw_jflot($file, $fileurl)
{
// phpcs:enable
+ global $langs;
dol_syslog(get_class($this)."::draw_jflot this->type=".join(',', $this->type)." this->MaxValue=".$this->MaxValue);
diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php
index f9eeeabf4c6..c3d37d03b85 100644
--- a/htdocs/core/class/emailsenderprofile.class.php
+++ b/htdocs/core/class/emailsenderprofile.class.php
@@ -131,9 +131,9 @@ class EmailSenderProfile extends CommonObject
*/
//public $class_element_line = 'EmailSenderProfileline';
/**
- * @var array Array of child tables (child tables to delete before deleting a record)
+ * @var array List of child tables. To test if we can delete object.
*/
- //protected $childtables=array('emailsenderprofiledet');
+ //protected $childtables=array();
/**
* @var EmailSenderProfileLine[] Array of subtable lines
*/
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index d1366cb8511..17643e2d69a 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -211,13 +211,13 @@ class FormCompany
* The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
* Thus the links with the departments are done on a department independently of its name.
*
- * @param string $selected Code state preselected (mus be state id)
+ * @param int $selected Code state preselected (mus be state id)
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
* @param string $htmlname Id of department. If '', we want only the string with |