';
print $langs->trans("NotificationDisableConfirmMessageUser").' ';
print '';
From f4d4733b15fac96d2fe011464fa40ee600900702 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Thu, 19 Aug 2021 15:37:32 +0200
Subject: [PATCH 007/252] NEW : Select for BOM workable + JS to fill it
according to the product selected
---
htdocs/bom/bom_card.php | 25 ++++++++++++++++++++
htdocs/bom/script/interface.php | 29 ++++++++++++++++++++++++
htdocs/bom/tpl/objectline_create.tpl.php | 4 ++++
htdocs/bom/tpl/objectline_title.tpl.php | 3 +++
htdocs/bom/tpl/objectline_view.tpl.php | 2 ++
htdocs/langs/en_US/mrp.lang | 1 +
htdocs/langs/fr_FR/mrp.lang | 1 +
7 files changed, 65 insertions(+)
create mode 100644 htdocs/bom/script/interface.php
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index cd530994b9b..7bcbcc19e46 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -570,6 +570,31 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
print '';
}
+ ?>
+
+ ';
print "\n";
diff --git a/htdocs/bom/script/interface.php b/htdocs/bom/script/interface.php
new file mode 100644
index 00000000000..d5811db0414
--- /dev/null
+++ b/htdocs/bom/script/interface.php
@@ -0,0 +1,29 @@
+query($sql);
+ if ($resql && $db->num_rows($resql) > 0) {
+ $options = array();
+ $cpt=0;
+ while ($obj = $db->fetch_object($resql)){
+
+ $options[$obj->rowid] = $obj->ref.' - '.$obj->label;
+ $cpt++;
+ }
+ print json_encode($options);
+ }
+
+ break;
+}
diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php
index 7cc2873b261..5835849e9ff 100644
--- a/htdocs/bom/tpl/objectline_create.tpl.php
+++ b/htdocs/bom/tpl/objectline_create.tpl.php
@@ -107,6 +107,10 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
echo '';
}
+$coldisplay++;
+print '';
+print ' ';
+print ' ';
$coldisplay++;
print ' ';
diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php
index d1b29ee03b0..6b7f04b58f0 100644
--- a/htdocs/bom/tpl/objectline_title.tpl.php
+++ b/htdocs/bom/tpl/objectline_title.tpl.php
@@ -52,6 +52,9 @@ if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
// Description
print ''.$langs->trans('Description').' ';
+// Linked BOM
+print ''.$langs->trans('BOM').' ';
+
// Qty
print ''.$form->textwithpicto($langs->trans('Qty'), $langs->trans("QtyRequiredIfNoLoss")).' ';
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index fff9d077a08..d3559857a2a 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -83,6 +83,8 @@ $tmpproduct->fetch($line->fk_product);
print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
print ' ';
+
+print ' ';
print '';
$coldisplay++;
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang
index 2414a92cefb..8aaf345feed 100644
--- a/htdocs/langs/en_US/mrp.lang
+++ b/htdocs/langs/en_US/mrp.lang
@@ -101,3 +101,4 @@ HumanMachine=Human / Machine
WorkstationArea=Workstation area
Machines=Machines
THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item
+BOM=Nomenclature
diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang
index e0a2e73365e..2db57d53bfb 100644
--- a/htdocs/langs/fr_FR/mrp.lang
+++ b/htdocs/langs/fr_FR/mrp.lang
@@ -101,3 +101,4 @@ HumanMachine=Humain/machine
WorkstationArea=Espace Poste de travail
Machines=Machines
THMEstimatedHelp=Ce taux permet de définir un coût prévisionnel de l'article
+BOM=Nomenclature
From 6de7d9b0af679fd56f68cebd8d604bbb31e598f3 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Fri, 20 Aug 2021 13:37:28 +0200
Subject: [PATCH 008/252] NEW : Add sub-BOM lines on BOM card
---
htdocs/bom/bom_card.php | 11 ++++-
htdocs/bom/class/bom.class.php | 6 +++
htdocs/bom/tpl/objectline_view.tpl.php | 56 +++++++++++++++++++++++++-
3 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 7bcbcc19e46..1126e04785e 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -140,6 +140,7 @@ if (empty($reshook)) {
// Set if we used free entry or predefined product
$idprod = (int) GETPOST('idprod', 'int');
+ $bom_child = (int) GETPOST('bom_select', 'int');
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
$disable_stock_change = GETPOST('disable_stock_change', 'int');
@@ -163,6 +164,7 @@ if (empty($reshook)) {
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
+ $bomline->fk_bom_child = $bom_child;
$bomline->qty = $qty;
$bomline->qty_frozen = (int) $qty_frozen;
$bomline->disable_stock_change = (int) $disable_stock_change;
@@ -574,18 +576,25 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
+
+ ';
*/
$coldisplay++;
+// For BOM
+print ' ';
print '';
if (($line->info_bits & 2) != 2) {
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 623fdab1474..c869a617b2a 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -81,9 +81,9 @@ $coldisplay++;
$tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($object->db);
-$res = $tmpbom->fetch($line->fk_bom_child);
+$tmpbom->fetch($line->fk_bom_child);
if (!empty($tmpbom->id)){
- print '' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
+ print '' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
}
print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
@@ -193,15 +193,15 @@ if ($resql){
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
- print ' ';
+ print ' ';
- print ''.$sub_bom_product->getNomUrl(1).' ';
+ print ' '.$sub_bom_product->getNomUrl(1).' ';
if ($sub_bom_line->fk_bom_child > 0) {
print ''.$sub_bom->getNomUrl(1).' ';
} else {
print ' ';
}
- print ''.price($sub_bom_line->qty, 0, '', 0, 0).' ';
+ print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).' ';
if ($sub_bom_line->qty_frozen > 0) {
print ''.$sub_bom_line->qty_frozen.' ';
} else {
@@ -215,7 +215,7 @@ if ($resql){
}
print ''.$sub_bom_line->efficiency.' ';
- print ''.price($sub_bom_line->total_cost).' ';
+ print ''.price($sub_bom_line->total_cost * $line->qty).' ';
print ' ';
print ' ';
print ' ';
From 2343ff2ed4a06690230c95204cf0ca7d307870f7 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Mon, 23 Aug 2021 11:58:15 +0200
Subject: [PATCH 010/252] NEW : ShowAll/HideAll Options
---
htdocs/bom/bom_card.php | 9 ++++-----
htdocs/bom/tpl/objectline_title.tpl.php | 2 ++
htdocs/bom/tpl/objectline_view.tpl.php | 2 +-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 2df4278ecbe..71c64087419 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -615,7 +615,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$(".collapse_bom").click(function() {
var id_bom_line = $(this).attr('id').replace('collapse-', '');
- console.log('tr [parentid="'+ id_bom_line +'"]')
if($(this).text().indexOf('+') > 0) {
$('[parentid="'+ id_bom_line +'"]').show();
$(this).html('(-) ');
@@ -630,14 +629,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//TODO : SHOW ALL / COLLAPSE ALL
$("#show_all").click(function() {
- $("[class^=batch_warehouse]").show();
- $("[class^=collapse_batch]").html('(-) ');
+ $("[class^=sub_bom_lines]").show();
+ $("[class^=collapse_bom]").html('(-) ');
return false;
});
$("#hide_all").click(function() {
- $("[class^=batch_warehouse]").hide();
- $("[class^=collapse_batch]").html('(+) ');
+ $("[class^=sub_bom_lines]").hide();
+ $("[class^=collapse_bom]").html('(+) ');
return false;
});
diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php
index 6b7f04b58f0..0656f23aed9 100644
--- a/htdocs/bom/tpl/objectline_title.tpl.php
+++ b/htdocs/bom/tpl/objectline_title.tpl.php
@@ -43,6 +43,8 @@ print "\n";
print "\n";
print '';
+print ''.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").' ';
+print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' ';
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index c869a617b2a..87013582fac 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -193,7 +193,7 @@ if ($resql){
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
- print ' ';
+ print ' ';
print ' '.$sub_bom_product->getNomUrl(1).' ';
if ($sub_bom_line->fk_bom_child > 0) {
From 6cd92ca82971b3cbf5654a3b8eb35651b0fe9ad5 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Mon, 23 Aug 2021 12:15:09 +0200
Subject: [PATCH 011/252] NEW : Trad + Comments + Adding tooltips for conf
---
htdocs/bom/bom_card.php | 4 ++--
htdocs/bom/tpl/objectline_title.tpl.php | 2 ++
htdocs/langs/en_US/mrp.lang | 4 +++-
htdocs/langs/fr_FR/mrp.lang | 1 +
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 71c64087419..85ce0a0366d 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -627,13 +627,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
return false;
});
- //TODO : SHOW ALL / COLLAPSE ALL
+ //To Show all the sub bom lines
$("#show_all").click(function() {
$("[class^=sub_bom_lines]").show();
$("[class^=collapse_bom]").html('(-) ');
return false;
});
-
+ //To Hide all the sub bom lines
$("#hide_all").click(function() {
$("[class^=sub_bom_lines]").hide();
$("[class^=collapse_bom]").html('(+) ');
diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php
index 0656f23aed9..ce811096d33 100644
--- a/htdocs/bom/tpl/objectline_title.tpl.php
+++ b/htdocs/bom/tpl/objectline_title.tpl.php
@@ -45,6 +45,8 @@ print "\n";
print '';
print ''.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").' ';
print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' ';
+$form = new Form($object->db);
+print $form->textwithpicto('', $langs->trans('CollapseBOMHelp'), 1, 'help', '');
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang
index 8aaf345feed..c414a219894 100644
--- a/htdocs/langs/en_US/mrp.lang
+++ b/htdocs/langs/en_US/mrp.lang
@@ -101,4 +101,6 @@ HumanMachine=Human / Machine
WorkstationArea=Workstation area
Machines=Machines
THMEstimatedHelp=This rate makes it possible to define a forecast cost of the item
-BOM=Nomenclature
+BOM=Bill Of Materials
+CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module
+
diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang
index 2db57d53bfb..12873fd5093 100644
--- a/htdocs/langs/fr_FR/mrp.lang
+++ b/htdocs/langs/fr_FR/mrp.lang
@@ -102,3 +102,4 @@ WorkstationArea=Espace Poste de travail
Machines=Machines
THMEstimatedHelp=Ce taux permet de définir un coût prévisionnel de l'article
BOM=Nomenclature
+CollapseBOMHelp=Vous pouvez définir l'affichage par défaut du détail des nomenclature dans la configuration du module "Nomenclature Produits"
From e282feb3970ef6f99b89b9ed1ced4364e91bd331 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Mon, 23 Aug 2021 14:43:17 +0200
Subject: [PATCH 012/252] NEW : Delete conf
---
htdocs/bom/tpl/objectline_title.tpl.php | 2 --
htdocs/bom/tpl/objectline_view.tpl.php | 8 ++++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_title.tpl.php b/htdocs/bom/tpl/objectline_title.tpl.php
index ce811096d33..0656f23aed9 100644
--- a/htdocs/bom/tpl/objectline_title.tpl.php
+++ b/htdocs/bom/tpl/objectline_title.tpl.php
@@ -45,8 +45,6 @@ print "\n";
print '';
print ''.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").' ';
print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' ';
-$form = new Form($object->db);
-print $form->textwithpicto('', $langs->trans('CollapseBOMHelp'), 1, 'help', '');
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 87013582fac..fbfb02576df 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -81,7 +81,7 @@ $coldisplay++;
$tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($object->db);
-$tmpbom->fetch($line->fk_bom_child);
+$res = $tmpbom->fetch($line->fk_bom_child);
if (!empty($tmpbom->id)){
print '' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
}
@@ -193,7 +193,11 @@ if ($resql){
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
- print ' ';
+ if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)){
+ print ' ';
+ } else {
+ print ' ';
+ }
print ' '.$sub_bom_product->getNomUrl(1).' ';
if ($sub_bom_line->fk_bom_child > 0) {
From 7474d2eef57aaec32713309ece7f84f7b85d8d88 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Mon, 23 Aug 2021 15:08:32 +0200
Subject: [PATCH 013/252] FIX : Add BOM column for create view
---
htdocs/bom/tpl/objectline_create.tpl.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php
index 5835849e9ff..1a60029c439 100644
--- a/htdocs/bom/tpl/objectline_create.tpl.php
+++ b/htdocs/bom/tpl/objectline_create.tpl.php
@@ -61,6 +61,8 @@ if ($nolinesbefore) {
print '';
print '
'.$langs->trans('AddNewLine').' ';
print ' ';
+ // Linked BOM
+ print ''.$langs->trans('BOM').' ';
print ''.$langs->trans('Qty').' ';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '';
From 2ecc448bc032e626436544c5eb6c7d95598fd480 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Wed, 25 Aug 2021 11:21:54 +0200
Subject: [PATCH 014/252] FIX : Set total_cost for parent line by additionning
total_cost of the children lines
---
htdocs/bom/tpl/objectline_view.tpl.php | 33 +++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index fbfb02576df..0d83754dd60 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -123,7 +123,8 @@ $coldisplay++;
echo $line->efficiency;
print ' ';
-print '';
+$total_cost = 0;
+print ' ';
$coldisplay++;
echo price($line->total_cost);
print ' ';
@@ -199,7 +200,7 @@ if ($resql){
print '';
}
- print ' '.$sub_bom_product->getNomUrl(1).' ';
+ print ''.$sub_bom_product->getNomUrl(1).' ';
if ($sub_bom_line->fk_bom_child > 0) {
print ''.$sub_bom->getNomUrl(1).' ';
} else {
@@ -219,13 +220,39 @@ if ($resql){
}
print ''.$sub_bom_line->efficiency.' ';
- print ''.price($sub_bom_line->total_cost * $line->qty).' ';
+ if ($sub_bom_product->cost_price > 0) {
+ print ''.price($sub_bom_product->cost_price * $line->qty).' ';
+ $total_cost.= $sub_bom_product->cost_price * $line->qty;
+ } else if ($sub_bom_product->pmp > 0) {
+ print ''.price($sub_bom_product->pmp * $line->qty).' ';
+ $total_cost.= $sub_bom_product->pmp * $line->qty;
+ } else {
+ $sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
+ $sql_supplier_price.= ' WHERE fk_product = '.$sub_bom_product->id;
+ $resql_supplier_price = $object->db->query($sql_supplier_price);
+ if ($resql_supplier_price) {
+ $obj = $object->db->fetch_object($resql_supplier_price);
+ print ''.price($obj->min_price * $line->qty).' ';
+ $total_cost+= $obj->min_price * $line->qty;
+ }
+ }
+
print ' ';
print ' ';
print ' ';
}
}
+if ($total_cost > 0) {
+ $line->total_cost = price($total_cost);
+ ?>
+
+ showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1, 'line');
From 5bf8685f72182994c38bde5dd35cabe75d516763 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Wed, 25 Aug 2021 16:58:22 +0200
Subject: [PATCH 015/252] NEW : Add comments
---
htdocs/bom/tpl/objectline_view.tpl.php | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 0d83754dd60..26f4d070876 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -89,6 +89,7 @@ print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
print '';
+// To show BOM links in the list
if ($res > 0) {
print ''.$tmpbom->getNomUrl(1).' ';
} else {
@@ -179,11 +180,13 @@ if ($action == 'selectlines') {
print ' ';
+// Select of all the sub-BOM lines
$sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
$sql.= ' WHERE fk_bom = '.$tmpbom->id;
$resql = $object->db->query($sql);
if ($resql){
+ // Loop on all the sub-BOM lines if they exist
while ($obj = $object->db->fetch_object($resql)){
$sub_bom_product = new Product($object->db);
$sub_bom_product->fetch($obj->fk_product);
@@ -194,18 +197,24 @@ if ($resql){
$sub_bom_line = new BOMLine($object->db);
$sub_bom_line->fetch($obj->rowid);
+ //If hidden conf is set, we show directly all the sub-BOM lines
if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)){
print '';
} else {
print ' ';
}
+ // Product
print ''.$sub_bom_product->getNomUrl(1).' ';
+
+ // Sub-BOM
if ($sub_bom_line->fk_bom_child > 0) {
print ''.$sub_bom->getNomUrl(1).' ';
} else {
print ' ';
}
+
+ // Qty
print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).' ';
if ($sub_bom_line->qty_frozen > 0) {
print ''.$sub_bom_line->qty_frozen.' ';
@@ -213,20 +222,28 @@ if ($resql){
print ' ';
}
+ // Disable stock change
if ($sub_bom_line->disable_stock_change > 0) {
print ''.$sub_bom_line->disable_stock_change.' ';
} else {
print ' ';
}
+ // Efficiency
print ''.$sub_bom_line->efficiency.' ';
+
+ // Cost price if it's defined
if ($sub_bom_product->cost_price > 0) {
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
- } else if ($sub_bom_product->pmp > 0) {
+ }
+ // PMP if cost price isn't defined
+ else if ($sub_bom_product->pmp > 0) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
- } else {
+ }
+ // Minimum purchase price if cost price and PMP aren't defined
+ else {
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql_supplier_price.= ' WHERE fk_product = '.$sub_bom_product->id;
$resql_supplier_price = $object->db->query($sql_supplier_price);
@@ -243,6 +260,7 @@ if ($resql){
}
}
+// Replace of the total_cost value by the sum of all sub-BOM lines total_cost
if ($total_cost > 0) {
$line->total_cost = price($total_cost);
?>
From 3a7d062d7deee5461391351bdb1cbbe6b60c863b Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Wed, 25 Aug 2021 15:24:03 +0000
Subject: [PATCH 016/252] Fixing style errors.
---
htdocs/bom/script/interface.php | 5 ++---
htdocs/bom/tpl/objectline_view.tpl.php | 10 +++++-----
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/htdocs/bom/script/interface.php b/htdocs/bom/script/interface.php
index d5811db0414..c93b54fdc33 100644
--- a/htdocs/bom/script/interface.php
+++ b/htdocs/bom/script/interface.php
@@ -7,7 +7,7 @@ $current_bom_id = GETPOST('current_bom_id', 'alphanohtml');
global $db;
-switch ($action){
+switch ($action) {
case 'select_BOM':
//Selection of nomenclatures corresponding to the selected product
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
@@ -17,8 +17,7 @@ switch ($action){
if ($resql && $db->num_rows($resql) > 0) {
$options = array();
$cpt=0;
- while ($obj = $db->fetch_object($resql)){
-
+ while ($obj = $db->fetch_object($resql)) {
$options[$obj->rowid] = $obj->ref.' - '.$obj->label;
$cpt++;
}
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 26f4d070876..a25cdeb87ec 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -82,7 +82,7 @@ $tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($object->db);
$res = $tmpbom->fetch($line->fk_bom_child);
-if (!empty($tmpbom->id)){
+if (!empty($tmpbom->id)) {
print '' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
}
print $tmpproduct->getNomUrl(1);
@@ -185,9 +185,9 @@ $sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomlin
$sql.= ' WHERE fk_bom = '.$tmpbom->id;
$resql = $object->db->query($sql);
-if ($resql){
+if ($resql) {
// Loop on all the sub-BOM lines if they exist
- while ($obj = $object->db->fetch_object($resql)){
+ while ($obj = $object->db->fetch_object($resql)) {
$sub_bom_product = new Product($object->db);
$sub_bom_product->fetch($obj->fk_product);
@@ -198,7 +198,7 @@ if ($resql){
$sub_bom_line->fetch($obj->rowid);
//If hidden conf is set, we show directly all the sub-BOM lines
- if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)){
+ if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) {
print '';
} else {
print ' ';
@@ -238,7 +238,7 @@ if ($resql){
$total_cost.= $sub_bom_product->cost_price * $line->qty;
}
// PMP if cost price isn't defined
- else if ($sub_bom_product->pmp > 0) {
+ elseif ($sub_bom_product->pmp > 0) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
}
From a79abfd4e01e70850c8893c1c5b645bd5fdb962c Mon Sep 17 00:00:00 2001
From: henrynopo
Date: Thu, 26 Aug 2021 10:37:03 +0800
Subject: [PATCH 017/252] Update card.php
---
htdocs/compta/facture/card.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 31de2bbd4ff..4658c10873d 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4052,6 +4052,8 @@ if ($action == 'create') {
$i++;
$close[$i]['code'] = 'badcustomer';
$i++;
+ $close[$i]['code'] = 'bankcharge';
+ $i++;
$close[$i]['code'] = 'other';
$i++;
// Help
@@ -4060,6 +4062,8 @@ if ($action == 'create') {
$i++;
$close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc");
$i++;
+ $close[$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBankChargeDesc");
+ $i++;
$close[$i]['label'] = $langs->trans("Other");
$i++;
// Texte
@@ -4068,6 +4072,8 @@ if ($action == 'create') {
$i++;
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
$i++;
+ $close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBankCharge", $resteapayer, $langs->trans("Currency".$conf->currency)), $close[$i]['label'], 1);
+ $i++;
$close[$i]['reason'] = $form->textwithpicto($langs->transnoentities("Other"), $close[$i]['label'], 1);
$i++;
// arrayreasons[code]=reason
From a25580f97cfeda3e314926264063d85e0d251a18 Mon Sep 17 00:00:00 2001
From: henrynopo
Date: Thu, 26 Aug 2021 10:38:53 +0800
Subject: [PATCH 018/252] Update bills.lang
---
htdocs/langs/en_US/bills.lang | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index a921aac9e48..6a88f2599dd 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -192,6 +192,7 @@ ConfirmClassifyPaidPartiallyReasonDiscount=Remaining unpaid (%s %s) is a
ConfirmClassifyPaidPartiallyReasonDiscountNoVat=Remaining unpaid (%s %s) is a discount granted because payment was made before term. I accept to lose the VAT on this discount.
ConfirmClassifyPaidPartiallyReasonDiscountVat=Remaining unpaid (%s %s) is a discount granted because payment was made before term. I recover the VAT on this discount without a credit note.
ConfirmClassifyPaidPartiallyReasonBadCustomer=Bad customer
+ConfirmClassifyPaidPartiallyReasonBankCharge=Deduction by bank (intermediary bank fees)
ConfirmClassifyPaidPartiallyReasonProductReturned=Products partially returned
ConfirmClassifyPaidPartiallyReasonOther=Amount abandoned for other reason
ConfirmClassifyPaidPartiallyReasonDiscountNoVatDesc=This choice is possible if your invoice has been provided with suitable comments. (Example «Only the tax corresponding to the price that has been actually paid gives rights to deduction»)
@@ -199,6 +200,7 @@ ConfirmClassifyPaidPartiallyReasonDiscountVatDesc=In some countries, this choice
ConfirmClassifyPaidPartiallyReasonAvoirDesc=Use this choice if all other does not suit
ConfirmClassifyPaidPartiallyReasonBadCustomerDesc=A bad customer is a customer that refuses to pay his debt.
ConfirmClassifyPaidPartiallyReasonProductReturnedDesc=This choice is used when payment is not complete because some of products were returned
+ConfirmClassifyPaidPartiallyReasonBankChargeDesc=The unpaid amount is intermediary bank fees , deducted directly from the correct amount paid by the Customer.
ConfirmClassifyPaidPartiallyReasonOtherDesc=Use this choice if all others are not suitable, for example in following situation: - payment not complete because some products were shipped back - amount claimed too important because a discount was forgotten In all cases, amount over-claimed must be corrected in accountancy system by creating a credit note.
ConfirmClassifyAbandonReasonOther=Other
ConfirmClassifyAbandonReasonOtherDesc=This choice will be used in all other cases. For example because you plan to create a replacing invoice.
From 0463846df1c65a23e128e51bb96a5f7a06bc333b Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Thu, 26 Aug 2021 09:27:03 +0200
Subject: [PATCH 019/252] FIX : Stickler
---
htdocs/bom/tpl/objectline_view.tpl.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 26f4d070876..3e1922db7fc 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -237,11 +237,13 @@ if ($resql){
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
}
+
// PMP if cost price isn't defined
else if ($sub_bom_product->pmp > 0) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
}
+
// Minimum purchase price if cost price and PMP aren't defined
else {
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
From 578de93dc4e98e3360223ca2053829605e73b676 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Thu, 26 Aug 2021 07:30:36 +0000
Subject: [PATCH 020/252] Fixing style errors.
---
htdocs/bom/tpl/objectline_view.tpl.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 1ee64890384..6aa00e79835 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -243,7 +243,7 @@ if ($resql) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
}
-
+
// Minimum purchase price if cost price and PMP aren't defined
else {
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
From 0222df7ecc65c0589a32fb911102d9c18facf991 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Thu, 26 Aug 2021 09:34:30 +0200
Subject: [PATCH 021/252] FIX : Expected 1 space after closing brace; newline
found
---
htdocs/bom/tpl/objectline_view.tpl.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 1ee64890384..b8d054d9ecc 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -236,14 +236,14 @@ if ($resql) {
if ($sub_bom_product->cost_price > 0) {
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
- }
+ }
// PMP if cost price isn't defined
elseif ($sub_bom_product->pmp > 0) {
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
}
-
+
// Minimum purchase price if cost price and PMP aren't defined
else {
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
From bdcddebb5fdc47084a5279b68ec65957cae47e54 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Thu, 26 Aug 2021 07:37:39 +0000
Subject: [PATCH 022/252] Fixing style errors.
---
htdocs/bom/tpl/objectline_view.tpl.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index b8d054d9ecc..6aa00e79835 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -236,7 +236,7 @@ if ($resql) {
if ($sub_bom_product->cost_price > 0) {
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
- }
+ }
// PMP if cost price isn't defined
elseif ($sub_bom_product->pmp > 0) {
From 05444078bdffd9fd880fd9b9a7cd537c3d34a58b Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Thu, 26 Aug 2021 09:43:50 +0200
Subject: [PATCH 023/252] FIX : stickler
---
htdocs/bom/tpl/objectline_view.tpl.php | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index b8d054d9ecc..41ff84b4d13 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -236,16 +236,10 @@ if ($resql) {
if ($sub_bom_product->cost_price > 0) {
print ''.price($sub_bom_product->cost_price * $line->qty).' ';
$total_cost.= $sub_bom_product->cost_price * $line->qty;
- }
-
- // PMP if cost price isn't defined
- elseif ($sub_bom_product->pmp > 0) {
+ } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
print ''.price($sub_bom_product->pmp * $line->qty).' ';
$total_cost.= $sub_bom_product->pmp * $line->qty;
- }
-
- // Minimum purchase price if cost price and PMP aren't defined
- else {
+ } else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
$sql_supplier_price.= ' WHERE fk_product = '.$sub_bom_product->id;
$resql_supplier_price = $object->db->query($sql_supplier_price);
From 2da16ade6c722e1464a6c8f571beaba150f194d9 Mon Sep 17 00:00:00 2001
From: atm-florian
Date: Fri, 8 Oct 2021 17:24:52 +0200
Subject: [PATCH 024/252] FIX: consistent UX when calling a tab from the
invoice card with empty ref / id
---
htdocs/compta/facture/card.php | 11 +++++++++++
htdocs/compta/facture/contact.php | 11 +++++++++++
htdocs/compta/facture/document.php | 11 +++++++++++
htdocs/compta/facture/info.php | 11 +++++++++++
htdocs/compta/facture/note.php | 11 +++++++++++
5 files changed, 55 insertions(+)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index e15b2722800..ab568332dd8 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -2756,6 +2756,17 @@ if (empty($reshook))
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index c340d68242e..c0e0a40c2c5 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -118,6 +118,17 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer)
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index e880d77db74..64ebed251d3 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -85,6 +85,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index bad63cf1f61..9e40fd8b5a8 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -43,6 +43,17 @@ $ref = GETPOST("ref", 'alpha');
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$form = new Form($db);
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 07084a0cf2c..428383b4907 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -64,6 +64,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
* View
*/
+if (empty($object->id)) {
+ llxHeader();
+ $head = facture_prepare_head($object);
+ $langs->load('errors');
+ echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
+ '' . $langs->trans("ErrorRecordNotFound") . '
';
+ llxFooter();
+ dol_shutdown();
+ exit;
+}
+
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);
From 57052e2fbabffa16b25a25fe02a1966e117d09db Mon Sep 17 00:00:00 2001
From: atm-florian
Date: Mon, 11 Oct 2021 11:10:14 +0200
Subject: [PATCH 025/252] FIX PR#18931 Remove useless explicit call to
dol_shutdown
---
htdocs/compta/facture/card.php | 1 -
htdocs/compta/facture/contact.php | 1 -
htdocs/compta/facture/document.php | 1 -
htdocs/compta/facture/info.php | 1 -
htdocs/compta/facture/note.php | 1 -
5 files changed, 5 deletions(-)
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index ab568332dd8..c772fd0ad7b 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -2763,7 +2763,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index c0e0a40c2c5..7177463c30e 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -125,7 +125,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 64ebed251d3..0818b944705 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -92,7 +92,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index 9e40fd8b5a8..955c41693c0 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -50,7 +50,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index 428383b4907..dadb61b551d 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -71,7 +71,6 @@ if (empty($object->id)) {
echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'' . $langs->trans("ErrorRecordNotFound") . '
';
llxFooter();
- dol_shutdown();
exit;
}
From e899d94ed5c396edb5956ea7ed4011a0acd7cb42 Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Mon, 11 Oct 2021 12:50:07 +0200
Subject: [PATCH 026/252] NEW Accountancy - rewrite bind accountancy code
finding on purchase invoice
---
htdocs/accountancy/supplier/index.php | 90 ++++++++++----
htdocs/accountancy/supplier/list.php | 161 ++++++++++----------------
2 files changed, 130 insertions(+), 121 deletions(-)
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index 5e409f303ea..476ead53860 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -1,7 +1,7 @@
- * Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2020 Alexandre Spangaro
+ * Copyright (C) 2013-2021 Florian Henry
+ * Copyright (C) 2013-2021 Alexandre Spangaro
* Copyright (C) 2014 Juanjo Menent
*
* This program is free software; you can redistribute it and/or modify
@@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
@@ -44,6 +45,7 @@ if (!$user->rights->accounting->bind->write) {
accessforbidden();
}
+$accountingAccount = new AccountingAccount($db);
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) {
@@ -97,6 +99,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity.')';
$sql1 .= ' AND fd.fk_facture_fourn IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE entity = '.$conf->entity.')';
$sql1 .= ' AND fk_code_ventilation <> 0';
+
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
if (!$resql1) {
@@ -163,7 +166,7 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
@@ -181,27 +184,74 @@ if ($action == 'validatehistory') {
$isBuyerInEEC = isInEEC($mysoc);
+ $thirdpartystatic = new Societe($db);
+ $facture_static = new FactureFournisseur($db);
+ $facture_static_det = new SupplierInvoiceLine($db);
+ $product_static = new Product($db);
+
$i = 0;
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result);
- $isSellerInEEC = isInEEC($objp);
+ $thirdpartystatic->id = $objp->socid;
+ $thirdpartystatic->name = $objp->name;
+ $thirdpartystatic->client = $objp->client;
+ $thirdpartystatic->fournisseur = $objp->fournisseur;
+ $thirdpartystatic->code_client = $objp->code_client;
+ $thirdpartystatic->code_compta_client = $objp->code_compta_client;
+ $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
+ $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
+ $thirdpartystatic->email = $objp->email;
+ $thirdpartystatic->country_code = $objp->country_code;
+ $thirdpartystatic->tva_intra = $objp->tva_intra;
+ $thirdpartystatic->code_compta = $objp->company_code_sell;
- // Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
- $suggestedaccountingaccountfor = '';
- if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
- $objp->code_buy_p = $objp->code_buy;
- $objp->aarowid_suggest = $objp->aarowid;
- $suggestedaccountingaccountfor = '';
+ $product_static->ref = $objp->product_ref;
+ $product_static->id = $objp->product_id;
+ $product_static->type = $objp->type;
+ $product_static->label = $objp->product_label;
+ $product_static->status = $objp->status;
+ $product_static->status_buy = $objp->status_buy;
+ $product_static->accountancy_code_sell = $objp->code_sell;
+ $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
+ $product_static->accountancy_code_sell_export = $objp->code_sell_export;
+ $product_static->accountancy_code_buy = $objp->code_buy;
+ $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
+ $product_static->accountancy_code_buy_export = $objp->code_buy_export;
+ $product_static->tva_tx = $objp->tva_tx_prod;
+
+ $facture_static->ref = $objp->ref;
+ $facture_static->id = $objp->facid;
+ $facture_static->type = $objp->ftype;
+ $facture_static->datef = $objp->datef;
+
+ $facture_static_det->id = $objp->rowid;
+ $facture_static_det->total_ht = $objp->total_ht;
+ $facture_static_det->tva_tx = $objp->tva_tx_line;
+ $facture_static_det->vat_src_code = $objp->vat_src_code;
+ $facture_static_det->product_type = $objp->type_l;
+ $facture_static_det->desc = $objp->description;
+
+ $accoutingAccountArray = array(
+ 'dom'=>$objp->aarowid,
+ 'intra'=>$objp->aarowid_intra,
+ 'export'=>$objp->aarowid_export,
+ 'thirdparty' =>$objp->aarowid_thirdparty);
+
+ $code_buy_p_notset = '';
+ $code_buy_t_notset = '';
+
+ $return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accoutingAccountArray);
+ if (!is_array($return) && $return<0) {
+ setEventMessage($accountingAccount->error, 'errors');
} else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
- $objp->code_buy_p = $objp->code_buy_intra;
- $objp->aarowid_suggest = $objp->aarowid_intra;
- $suggestedaccountingaccountfor = 'eec';
- } else { // Foreign sale
- $objp->code_buy_p = $objp->code_buy_export;
- $objp->aarowid_suggest = $objp->aarowid_export;
- $suggestedaccountingaccountfor = 'export';
+ $suggestedid=$return['suggestedid'];
+ $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
+
+ if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') {
+ $suggestedid=$return['suggestedid'];
+ } else {
+ $suggestedid=0;
}
}
@@ -216,8 +266,8 @@ if ($action == 'validatehistory') {
if ($objp->aarowid_suggest > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
- $sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);
- $sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $objp->rowid);
+ $sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
+ $sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
$resqlupdate = $db->query($sqlupdate);
if (!$resqlupdate) {
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index ffdd5b6de57..d3bb7985376 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2013-2014 Olivier Geffroy
* Copyright (C) 2013-2021 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
- * Copyright (C) 2013-2014 Florian Henry
+ * Copyright (C) 2013-2021 Florian Henry
* Copyright (C) 2014 Juanjo Menent s
* Copyright (C) 2016 Laurent Destailleur
*
@@ -46,6 +46,7 @@ $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
+$optioncss = GETPOST('optioncss', 'alpha');
// Select Box
$mesCasesCochees = GETPOST('toselect', 'array');
@@ -97,10 +98,7 @@ if (!$sortorder) {
$hookmanager->initHooks(array('accountancysupplierlist'));
$formaccounting = new FormAccounting($db);
-$accounting = new AccountingAccount($db);
-// TODO: we should need to check if result is a really exist accountaccount rowid.....
-$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
-$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
+$accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
@@ -518,9 +516,9 @@ if ($result) {
$thirdpartystatic = new Societe($db);
$facturefourn_static = new FactureFournisseur($db);
+ $facturefourn_static_det = new SupplierInvoiceLine($db);
$product_static = new Product($db);
- $isBuyerInEEC = isInEEC($mysoc);
$accountingaccount_codetotid_cache = array();
@@ -543,6 +541,8 @@ if ($result) {
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
+ $thirdpartystatic->tva_intra = $objp->tva_intra;
+ $thirdpartystatic->code_compta_fournisseur = $objp->company_code_buy;
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
@@ -556,95 +556,63 @@ if ($result) {
$product_static->accountancy_code_buy = $objp->code_buy;
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
+ $product_static->tva_tx = $objp->tva_tx_prod;
$facturefourn_static->ref = $objp->ref;
$facturefourn_static->id = $objp->facid;
$facturefourn_static->type = $objp->ftype;
$facturefourn_static->label = $objp->invoice_label;
+ $facturefourn_static_det->id = $objp->rowid;
+ $facturefourn_static_det->total_ht = $objp->total_ht;
+ $facturefourn_static_det->tva_tx_line = $objp->tva_tx_line;
+ $facturefourn_static_det->vat_src_code = $objp->vat_src_code;
+ $facturefourn_static_det->product_type = $objp->type_l;
+ $facturefourn_static_det->desc = $objp->description;
+
$code_buy_p_notset = '';
$code_buy_t_notset = '';
$objp->aarowid_suggest = ''; // Will be set later
- $isSellerInEEC = isInEEC($objp);
+ $accoutingAccountArray = array(
+ 'dom'=>$objp->aarowid,
+ 'intra'=>$objp->aarowid_intra,
+ 'export'=>$objp->aarowid_export,
+ 'thirdparty' =>$objp->aarowid_thirdparty);
- // Level 1: Search suggested default account for product/service
- $suggestedaccountingaccountbydefaultfor = '';
- if ($objp->type_l == 1) {
- if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = '';
- } else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = 'eec';
- } else { // Foreign sale
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = 'export';
- }
- }
- } elseif ($objp->type_l == 0) {
- if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = '';
- } else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = 'eec';
- } else {
- $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
- $suggestedaccountingaccountbydefaultfor = 'export';
- }
- }
- }
- if ($objp->code_sell_l == -1) {
- $objp->code_sell_l = '';
- }
+ $code_buy_p_notset = '';
+ $code_buy_t_notset = '';
- // Level 2: Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
- $suggestedaccountingaccountfor = '';
- if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
- $objp->code_buy_p = $objp->code_buy;
- $objp->aarowid_suggest = $objp->aarowid;
- $suggestedaccountingaccountfor = '';
+ $return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray);
+ if (!is_array($return) && $return<0) {
+ setEventMessage($accountingAccount->error, 'errors');
} else {
- if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
- $objp->code_buy_p = $objp->code_buy_intra;
- $objp->aarowid_suggest = $objp->aarowid_intra;
- $suggestedaccountingaccountfor = 'eec';
- } else { // Foreign sale
- $objp->code_buy_p = $objp->code_buy_export;
- $objp->aarowid_suggest = $objp->aarowid_export;
- $suggestedaccountingaccountfor = 'export';
- }
+ $suggestedid=$return['suggestedid'];
+ $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor'];
+ $suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor'];
+ $code_buy_l=$return['code_buy_l'];
+ $code_buy_p=$return['code_buy_p'];
+ $code_buy_t=$return['code_buy_t'];
}
+ //var_dump($return);
- // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
- if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
- if (!empty($objp->company_code_buy)) {
- $objp->code_buy_t = $objp->company_code_buy;
- $objp->aarowid_suggest = $objp->aarowid_thirdparty;
- $suggestedaccountingaccountfor = '';
- }
- }
-
- if (!empty($objp->code_buy_p)) {
+ if (!empty($code_buy_p)) {
// Value was defined previously
} else {
$code_buy_p_notset = 'color:orange';
}
- if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) {
+ if (empty($code_buy_l) && empty($code_buy_p)) {
$code_buy_p_notset = 'color:red';
}
- // $objp->code_buy_l is now default code of product/service
- // $objp->code_buy_p is now code of product/service
- // $objp->code_buy_t is now code of thirdparty
+ // $code_buy_l is now default code of product/service
+ // $code_buy_p is now code of product/service
+ // $code_buy_t is now code of thirdparty
print '';
// Line id
- print ''.$objp->rowid.' ';
+ print ''.$facturefourn_static_det->id.' ';
// Ref Invoice
print ''.$facturefourn_static->getNomUrl(1).' ';
@@ -654,23 +622,23 @@ if ($result) {
print '';
*/
- print ''.dol_print_date($db->jdate($objp->datef), 'day').' ';
+ print ''.dol_print_date($db->jdate($facturefourn_static_det->datef), 'day').' ';
// Ref Product
print '';
if ($product_static->id > 0) {
print $product_static->getNomUrl(1);
}
- if ($objp->product_label) {
- print ''.$objp->product_label.' ';
+ if ($product_static->product_label) {
+ print ''.$product_static->product_label.' ';
}
print ' ';
// Description
print '';
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
- print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
+ print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
print ' ';
print '';
@@ -678,11 +646,11 @@ if ($result) {
print ' ';
// Vat rate
- if ($objp->vat_tx_l != $objp->vat_tx_p) {
+ if ($product_static->vat_tx_l != $product_static->vat_tx_p) {
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
}
print '';
- print vatrate($objp->tva_tx_line.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : ''));
+ print vatrate($facturefourn_static_det->tva_tx_line.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
print ' ';
// Thirdparty
@@ -699,26 +667,26 @@ if ($result) {
// Found accounts
print '';
- $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
+ $s = '1. '.(($facturefourn_static_det->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountbydefaultfor == 'export') {
$shelp .= $langs->trans("SaleExport");
}
- $s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : ''.$langs->trans("NotDefined").' ');
+ $s .= ($code_buy_l > 0 ? length_accountg($code_buy_l) : ''.$langs->trans("NotDefined").' ');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
- if ($objp->product_id > 0) {
+ if ($product_static->id > 0) {
print ' ';
- $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
- $shelp = '';
+ $s = '2. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountfor == 'eec') {
$shelp = $langs->trans("SaleEEC");
} elseif ($suggestedaccountingaccountfor == 'export') {
$shelp = $langs->trans("SaleExport");
}
- $s .= (empty($objp->code_buy_p) ? ''.$langs->trans("NotDefined").' ' : length_accountg($objp->code_buy_p));
- print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
+ $s .= (empty($code_buy_p) ? ''.$langs->trans("NotDefined").' ' : length_accountg($code_buy_p));
+ print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1);
} else {
print ' ';
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
@@ -728,35 +696,26 @@ if ($result) {
}
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print ' ';
- $s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
+ $s = '3. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
$shelp = '';
- $s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : ''.$langs->trans("NotDefined").' ');
+ $s .= ($code_buy_t > 0 ? length_accountg($code_buy_t) : ''.$langs->trans("NotDefined").' ');
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
}
print ' ';
// Suggested accounting account
print '';
- $suggestedid = $objp->aarowid_suggest;
- if (empty($suggestedid) && empty($objp->code_buy_p) && !empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC)) {
- if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l])) {
- $tmpaccount = new AccountingAccount($db);
- $tmpaccount->fetch(0, $objp->code_buy_l, 1);
- if ($tmpaccount->id > 0) {
- $suggestedid = $tmpaccount->id;
- }
- $accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
- } else {
- $suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
- }
- }
- print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
+ print $formaccounting->select_account($suggestedid, 'codeventil'.$facturefourn_static_det->id, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print ' ';
// Column with checkbox
print '';
- $ischecked = $objp->aarowid_suggest;
- print ' ';
+ if (!empty($suggestedid)) {
+ $ischecked = 1;
+ } else {
+ $ischecked = 0;
+ }
+ print ' ';
print ' ';
print ' ';
From af8e8077b163eda70c4d0ca72a14d782a6590040 Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Mon, 11 Oct 2021 12:50:16 +0200
Subject: [PATCH 027/252] Uniformize
---
htdocs/accountancy/customer/index.php | 19 +++++++++++++++----
htdocs/accountancy/customer/list.php | 9 ++++-----
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 7c3cc2cf0e2..795da583486 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -73,12 +73,23 @@ $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
+// Security check
+if (empty($conf->accounting->enabled)) {
+ accessforbidden();
+}
+if ($user->socid > 0) {
+ accessforbidden();
+}
+if (empty($user->rights->accounting->mouvements->lire)) {
+ accessforbidden();
+}
+
/*
* Actions
*/
-if ($action == 'clean' || $action == 'validatehistory') {
+if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
// Clean database
$db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
@@ -165,6 +176,7 @@ if ($action == 'validatehistory') {
}
dol_syslog('htdocs/accountancy/customer/index.php');
+
$result = $db->query($sql);
if (!$result) {
$error++;
@@ -209,7 +221,6 @@ if ($action == 'validatehistory') {
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
$product_static->tva_tx = $objp->tva_tx_prod;
- $product_static->tva_tx = $objp->tva_tx_prod;
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
@@ -223,7 +234,7 @@ if ($action == 'validatehistory') {
$facture_static_det->product_type = $objp->type_l;
$facture_static_det->desc = $objp->description;
- $accoutinAccountArray = array(
+ $accoutingAccountArray = array(
'dom'=>$objp->aarowid,
'intra'=>$objp->aarowid_intra,
'export'=>$objp->aarowid_export,
@@ -232,7 +243,7 @@ if ($action == 'validatehistory') {
$code_sell_p_notset = '';
$code_sell_t_notset = '';
- $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accoutinAccountArray);
+ $return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accoutingAccountArray);
if (!is_array($return) && $return<0) {
setEventMessage($accountingAccount->error, 'errors');
} else {
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index a730a8a9af6..88e6c52be3d 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2013-2014 Olivier Geffroy
* Copyright (C) 2013-2021 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
- * Copyright (C) 2013-2014 Florian Henry
+ * Copyright (C) 2013-2021 Florian Henry
* Copyright (C) 2014 Juanjo Menent
* Copyright (C) 2016 Laurent Destailleur
*
@@ -192,10 +192,10 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
dol_syslog("accountancy/customer/list.php", LOG_DEBUG);
if ($db->query($sql)) {
- $msg .= ''.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
';
+ $msg .= ''.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
';
$ok++;
} else {
- $msg .= ''.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice", $monId).' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).' '.$sql.' ';
+ $msg .= ''.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).' '.$sql.' ';
$ko++;
}
}
@@ -550,7 +550,6 @@ if ($result) {
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
$product_static->tva_tx = $objp->tva_tx_prod;
- $product_static->tva_tx = $objp->tva_tx_prod;
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
@@ -564,7 +563,7 @@ if ($result) {
$facture_static_det->product_type = $objp->type_l;
$facture_static_det->desc = $objp->description;
- $accoutinAccountArray = array(
+ $accoutingAccountArray = array(
'dom'=>$objp->aarowid,
'intra'=>$objp->aarowid_intra,
'export'=>$objp->aarowid_export,
From ff7727466ad129070c0b56965eb0457f0ddf1795 Mon Sep 17 00:00:00 2001
From: atm-lena
Date: Thu, 14 Oct 2021 17:13:44 +0200
Subject: [PATCH 028/252] Function updateExtrafield : replace empty value to
null
---
htdocs/core/class/commonobject.class.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 5a5e1a58928..50c6f1893ea 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5492,7 +5492,6 @@ abstract class CommonObject
}
$sql .= ")";
-
$resql = $this->db->query($sql);
if (!$resql)
{
@@ -5792,7 +5791,7 @@ abstract class CommonObject
}
if ($linealreadyfound) {
- if ($this->array_options["options_".$key] === null) {
+ if ($this->array_options["options_".$key] === '') {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = null";
} else {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'";
From bd52613331d59d0d3cf8f08872319ce6c1312ea2 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sat, 16 Oct 2021 17:06:10 +0200
Subject: [PATCH 029/252] Fix phpcs
---
htdocs/compta/facture/stats/index.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index 03fcf5b37d0..c8961762a81 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -109,7 +109,6 @@ if ($mode == 'supplier') {
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)';
$stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')';
}
-
}
// Build graphic number of object
From 8daa1a810a6b51606863e9ba7fad1de504ed16a6 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Tue, 19 Oct 2021 16:44:59 +0200
Subject: [PATCH 030/252] FIX : Move interface.php to ajax/
---
htdocs/bom/{script => ajax}/interface.php | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename htdocs/bom/{script => ajax}/interface.php (100%)
diff --git a/htdocs/bom/script/interface.php b/htdocs/bom/ajax/interface.php
similarity index 100%
rename from htdocs/bom/script/interface.php
rename to htdocs/bom/ajax/interface.php
From 48b131b3f08772bf231b9de789bd610007e3b2e3 Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Tue, 19 Oct 2021 16:50:15 +0200
Subject: [PATCH 031/252] FIX : Retours
---
htdocs/bom/ajax/interface.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/htdocs/bom/ajax/interface.php b/htdocs/bom/ajax/interface.php
index c93b54fdc33..1416f44f922 100644
--- a/htdocs/bom/ajax/interface.php
+++ b/htdocs/bom/ajax/interface.php
@@ -2,8 +2,8 @@
require '../../main.inc.php';
$action = GETPOST('action', 'alphanohtml');
-$select_product_val = GETPOST('select_product_val', 'alphanohtml');
-$current_bom_id = GETPOST('current_bom_id', 'alphanohtml');
+$select_product_val = GETPOST('select_product_val', 'int');
+$current_bom_id = GETPOST('current_bom_id', 'int');
global $db;
@@ -12,7 +12,7 @@ switch ($action) {
//Selection of nomenclatures corresponding to the selected product
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product AS p ON b.fk_product=p.rowid';
- $sql.= ' WHERE fk_product='.$select_product_val.' AND b.rowid!='.$current_bom_id;
+ $sql.= ' WHERE fk_product='.(int)$select_product_val.' AND b.rowid<>'. (int)$current_bom_id;
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql) > 0) {
$options = array();
From d3035975cf038e24b4c1cfa853e97012a8446323 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Tue, 19 Oct 2021 14:52:56 +0000
Subject: [PATCH 032/252] Fixing style errors.
---
htdocs/bom/ajax/interface.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/bom/ajax/interface.php b/htdocs/bom/ajax/interface.php
index 1416f44f922..23b208e25ba 100644
--- a/htdocs/bom/ajax/interface.php
+++ b/htdocs/bom/ajax/interface.php
@@ -12,7 +12,7 @@ switch ($action) {
//Selection of nomenclatures corresponding to the selected product
$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product, p.label AS product_label FROM '.MAIN_DB_PREFIX.'bom_bom AS b ';
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product AS p ON b.fk_product=p.rowid';
- $sql.= ' WHERE fk_product='.(int)$select_product_val.' AND b.rowid<>'. (int)$current_bom_id;
+ $sql.= ' WHERE fk_product='.(int) $select_product_val.' AND b.rowid<>'. (int) $current_bom_id;
$resql = $db->query($sql);
if ($resql && $db->num_rows($resql) > 0) {
$options = array();
From a3e8d43cf582063da9acf7efc61879dd90e624bf Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Tue, 19 Oct 2021 17:25:51 +0200
Subject: [PATCH 033/252] FIX : Travis
---
htdocs/bom/tpl/objectline_view.tpl.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 96653773d65..2fa8b3c70dc 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -182,7 +182,7 @@ print ' ';
// Select of all the sub-BOM lines
$sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
-$sql.= ' WHERE fk_bom = '.$tmpbom->id;
+$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
$resql = $object->db->query($sql);
if ($resql) {
From dc465d6bac949520ffbcb6fc48f38b25f925ae76 Mon Sep 17 00:00:00 2001
From: daraelmin
Date: Wed, 20 Oct 2021 00:29:46 +0200
Subject: [PATCH 034/252] Fix adhtype amount as default on new subscription
---
htdocs/adherents/subscription.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index 17ac089670b..8d9fe0a5946 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -963,7 +963,7 @@ if ($rowid > 0) {
if ($adht->subscription) {
// Amount
- print ''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).' ';
+ print ''.$langs->trans("Amount").' 0 ? GETPOST("subscription") : $adht->amount).'"> '.$langs->trans("Currency".$conf->currency) .' ';
// Label
print ''.$langs->trans("Label").' ';
From 2ae38ff1a99f47710c47f7f2fa5029073f1cacaa Mon Sep 17 00:00:00 2001
From: Adrien Raze
Date: Wed, 20 Oct 2021 10:15:31 +0200
Subject: [PATCH 035/252] FIX : Travis
---
htdocs/bom/tpl/objectline_view.tpl.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 2fa8b3c70dc..8256019bd98 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -241,7 +241,7 @@ if ($resql) {
$total_cost.= $sub_bom_product->pmp * $line->qty;
} else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
- $sql_supplier_price.= ' WHERE fk_product = '.$sub_bom_product->id;
+ $sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id;
$resql_supplier_price = $object->db->query($sql_supplier_price);
if ($resql_supplier_price) {
$obj = $object->db->fetch_object($resql_supplier_price);
From a2adc6fc58912a9f0c70083e52d57dac68e9ad68 Mon Sep 17 00:00:00 2001
From: daraelmin
Date: Wed, 20 Oct 2021 15:59:42 +0200
Subject: [PATCH 036/252] Getpostisset
---
htdocs/adherents/subscription.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index 8d9fe0a5946..8f6fa4af34e 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -963,7 +963,7 @@ if ($rowid > 0) {
if ($adht->subscription) {
// Amount
- print ''.$langs->trans("Amount").' 0 ? GETPOST("subscription") : $adht->amount).'"> '.$langs->trans("Currency".$conf->currency) .' ';
+ print ''.$langs->trans("Amount").' amount).'"> '.$langs->trans("Currency".$conf->currency) .' ';
// Label
print ''.$langs->trans("Label").' ';
From eed689e1c188524deb4a048cda83f020cd66954b Mon Sep 17 00:00:00 2001
From: daraelmin
Date: Wed, 20 Oct 2021 16:33:38 +0200
Subject: [PATCH 037/252] quote instead double quote
---
htdocs/adherents/subscription.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index 8f6fa4af34e..1316a337610 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -963,7 +963,7 @@ if ($rowid > 0) {
if ($adht->subscription) {
// Amount
- print ''.$langs->trans("Amount").' amount).'"> '.$langs->trans("Currency".$conf->currency) .' ';
+ print ''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency) .' ';
// Label
print ''.$langs->trans("Label").' ';
From 3029804db7837bb584ececb247a0afb5e5461c67 Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Wed, 20 Oct 2021 19:21:18 +0200
Subject: [PATCH 038/252] FIX compatibility with Multicompany
---
htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 ++
htdocs/install/mysql/tables/llx_c_socialnetworks.key.sql | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
index d6e21f17aeb..03110b4425e 100644
--- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -627,3 +627,5 @@ CREATE TABLE llx_onlinesignature
ALTER TABLE llx_facture_fourn CHANGE COLUMN fk_mode_transport fk_transport_mode integer;
+ALTER TABLE llx_c_socialnetworks DROP INDEX idx_c_socialnetworks_code;
+ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code_entity (code, entity);
diff --git a/htdocs/install/mysql/tables/llx_c_socialnetworks.key.sql b/htdocs/install/mysql/tables/llx_c_socialnetworks.key.sql
index 2b7dcdc9d4e..ee48185e187 100644
--- a/htdocs/install/mysql/tables/llx_c_socialnetworks.key.sql
+++ b/htdocs/install/mysql/tables/llx_c_socialnetworks.key.sql
@@ -16,4 +16,4 @@
-- ========================================================================
-ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code (code);
+ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code_entity (code, entity);
From 0756a0100251cab1947742d7f47037afd7155ab4 Mon Sep 17 00:00:00 2001
From: JC Prieto
Date: Wed, 20 Oct 2021 19:33:28 +0200
Subject: [PATCH 039/252] Fix card.php
Error adding localtax
---
htdocs/compta/localtax/card.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php
index 451007932d7..4cffc5c85db 100644
--- a/htdocs/compta/localtax/card.php
+++ b/htdocs/compta/localtax/card.php
@@ -64,7 +64,7 @@ if ($cancel && !$id) {
exit;
}
-if ($action == 'add' && $cancel) {
+if ($action == 'add' && !$cancel) {
$db->begin();
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));
From 4b2b2328c35b7250128e754089086275d1c48683 Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Wed, 20 Oct 2021 21:33:18 +0200
Subject: [PATCH 040/252] FIX missing sql filter by entity
---
htdocs/admin/dict.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 9933c94876d..77b51d9a197 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -220,7 +220,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FR
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
-$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
+$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity($tabname[25]).")";
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
@@ -233,7 +233,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR
$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
-$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
+$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity IN (".getEntity($tabname[38]).")";
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
From 02bb39d4384933a052e38e551f73c6c7b109d985 Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Thu, 21 Oct 2021 05:06:50 +0200
Subject: [PATCH 041/252] FIX Accountancy simplified - Salaries are not present
in report
---
htdocs/compta/resultat/clientfourn.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index f2f192271ac..0b38a8f66c9 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -862,7 +862,8 @@ if ($modecompta == 'BOOKKEEPING') {
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
- $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
From be7c1c8a235a58ca8300cd7b0c765fc7010e85b2 Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Thu, 21 Oct 2021 05:18:56 +0200
Subject: [PATCH 042/252] Typo & translation
---
htdocs/compta/resultat/clientfourn.php | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index 0b38a8f66c9..2de55d1801f 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -9,6 +9,7 @@
* Copyright (C) 2014 Florian Henry
* Copyright (C) 2018 Frédéric France
* Copyright (C) 2020 Maxime DEMAREST
+ * Copyright (C) 2021 Alexandre Spangaro
*
* 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
@@ -366,7 +367,7 @@ if ($modecompta == 'BOOKKEEPING') {
}
} else {
/*
- * Factures clients
+ * Customer invoices
*/
print ''.$langs->trans("CustomersInvoices").' ';
@@ -386,8 +387,8 @@ if ($modecompta == 'BOOKKEEPING') {
}
} elseif ($modecompta == 'RECETTES-DEPENSES') {
/*
- * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
- * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
+ * List of payments (old payments are not seen by this query because, on older versions, they were not linked via payment_invoice.
+ * old versions, they were not linked via payment_invoice. They are added later)
*/
$sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
@@ -434,7 +435,7 @@ if ($modecompta == 'BOOKKEEPING') {
dol_print_error($db);
}
- // On ajoute les paiements clients anciennes version, non lie par paiement_facture
+ // We add the old customer payments, not linked by payment_invoice
if ($modecompta == 'RECETTES-DEPENSES') {
$sql = "SELECT 'Autres' as name, '0' as idp, sum(p.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@@ -673,7 +674,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
- * Charges sociales non deductibles
+ * Social / Fiscal contributions who are not deductible
*/
print ''.$langs->trans("SocialContributionsNondeductibles").' ';
@@ -760,7 +761,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
- * Charges sociales deductibles
+ * Social / Fiscal contributions who are deductible
*/
print ''.$langs->trans("SocialContributionsDeductibles").' ';
@@ -932,7 +933,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
- * Expense
+ * Expense report
*/
if (!empty($conf->expensereport->enabled)) {
@@ -1088,7 +1089,7 @@ if ($modecompta == 'BOOKKEEPING') {
}
/*
- * Payement Loan
+ * Payment Loan
*/
if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
@@ -1209,7 +1210,7 @@ if ($modecompta == 'BOOKKEEPING') {
print ''.price($amount)." \n";
print " \n";
- // VAT to retreive
+ // VAT to retrieve
$amount = 0;
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
From a1c0e1ad1f4fae5d30c929e6b042450b655a2bcb Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Thu, 21 Oct 2021 05:45:37 +0200
Subject: [PATCH 043/252] Better fix with backward compatibility with old
salary module
---
htdocs/compta/resultat/clientfourn.php | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index 2de55d1801f..e5984e527ae 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -869,8 +869,19 @@ if ($modecompta == 'BOOKKEEPING') {
if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
}
+ $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
+ // For backward compatibility with old module salary
+ $sql .= " UNION ";
+ $sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
+ $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
+ $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
+ if (!empty($date_start) && !empty($date_end)) {
+ $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
+ }
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
+
$newsortfield = $sortfield;
if ($newsortfield == 's.nom, s.rowid') {
$newsortfield = 'u.firstname, u.lastname';
From d2b96fe0f64a7bf3563ece5fe3c8051ad8a1398c Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Thu, 21 Oct 2021 06:08:48 +0200
Subject: [PATCH 044/252] Correct link to salary list with user search
---
htdocs/compta/resultat/clientfourn.php | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index e5984e527ae..1d2edd5c918 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -34,6 +34,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
+require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -861,7 +862,7 @@ if ($modecompta == 'BOOKKEEPING') {
$column = 'p.datep';
}
- $sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
+ $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
@@ -873,7 +874,7 @@ if ($modecompta == 'BOOKKEEPING') {
// For backward compatibility with old module salary
$sql .= " UNION ";
- $sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
+ $sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
@@ -913,7 +914,10 @@ if ($modecompta == 'BOOKKEEPING') {
print ' ';
- print "".$langs->trans("Salary")." fk_user."\">".$obj->firstname." ".$obj->lastname." \n";
+ $userstatic = new User($db);
+ $userstatic->fetch($obj->fk_user);
+
+ print "".$langs->trans("Salary")." getFullName($langs)."\">".$obj->firstname." ".$obj->lastname." \n";
if ($modecompta == 'CREANCES-DETTES') {
print ''.price(-$obj->amount).' ';
From 71b9ac384f6c7503f876175e533afbcacc529823 Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Thu, 21 Oct 2021 08:43:20 +0200
Subject: [PATCH 045/252] FIX only ones value is return for dictionaries
---
htdocs/admin/dict.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 77b51d9a197..eab0942ee4e 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -220,7 +220,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FR
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
-$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity($tabname[25]).")";
+$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
@@ -233,7 +233,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR
$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
-$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity IN (".getEntity($tabname[38]).")";
+$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]);
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
From 806c53d4c4c343299ffe4e6690f2889a9d50c2d8 Mon Sep 17 00:00:00 2001
From: atm-lena
Date: Thu, 21 Oct 2021 09:49:14 +0200
Subject: [PATCH 046/252] FIX Ret PR
---
htdocs/core/class/commonobject.class.php | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 50c6f1893ea..a4fc828ef4b 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5745,6 +5745,11 @@ abstract class CommonObject
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
}
break;
+ case 'boolean':
+ if (empty($this->array_options["options_".$key])) {
+ $this->array_options["options_".$key] = null;
+ }
+ break;
/*
case 'link':
$param_list = array_keys($attributeParam['options']);
@@ -5791,7 +5796,7 @@ abstract class CommonObject
}
if ($linealreadyfound) {
- if ($this->array_options["options_".$key] === '') {
+ if ($this->array_options["options_".$key] === null) {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = null";
} else {
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET ".$key." = '".$this->db->escape($this->array_options["options_".$key])."'";
From 5d854dcce1702532c6b3b17dbc97f5db5a036bea Mon Sep 17 00:00:00 2001
From: javieralapps4up
Date: Thu, 21 Oct 2021 18:17:43 +0200
Subject: [PATCH 047/252] FIX #19064
Access forbidden when the password of other users is changed
Steps to reproduce the behavior
User with lire and password (user) perms, but no creer.
When this user saves or cancels the edition of the password of another user, he is sent to the prohibited page
---
htdocs/core/lib/security.lib.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 4c36244a5bf..89211113d58 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -417,6 +417,9 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->password) {
continue; // User can edit its own password
}
+ if ($subfeature == 'user' && $user->id != $objectid && $user->rights->user->user->password) {
+ continue; // User can edit its own password
+ }
if (empty($user->rights->$feature->$subfeature->creer)
&& empty($user->rights->$feature->$subfeature->write)
From f50dfe85717f1ac9b875ec1a0be66542f82b4ae8 Mon Sep 17 00:00:00 2001
From: javieralapps4up
Date: Thu, 21 Oct 2021 18:20:06 +0200
Subject: [PATCH 048/252] Update security.lib.php
---
htdocs/core/lib/security.lib.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 89211113d58..978fd604021 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -418,7 +418,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
continue; // User can edit its own password
}
if ($subfeature == 'user' && $user->id != $objectid && $user->rights->user->user->password) {
- continue; // User can edit its own password
+ continue; // User can edit another user's password
}
if (empty($user->rights->$feature->$subfeature->creer)
From 2468c0e120611270573bbcd288fd87f0da601827 Mon Sep 17 00:00:00 2001
From: atm-florian
Date: Thu, 21 Oct 2021 18:24:03 +0200
Subject: [PATCH 049/252] FIX #19014 - the properties of some fields are not
updated when you submit the form + reformatting (one line per array item)
---
htdocs/modulebuilder/index.php | 38 ++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index ed090618855..06907b49742 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1296,19 +1296,31 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
}
- if (!$error) {
- $addfieldentry = array(
- 'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), 'type'=>GETPOST('proptype', 'alpha'),
- 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
- 'visible'=>GETPOST('propvisible', 'int'), 'enabled'=>GETPOST('propenabled', 'int'),
- 'position'=>GETPOST('propposition', 'int'), 'notnull'=>GETPOST('propnotnull', 'int'), 'index'=>GETPOST('propindex', 'int'), 'searchall'=>GETPOST('propsearchall', 'int'),
- 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'), 'help'=>GETPOST('prophelp', 'alpha'),
- 'css'=>GETPOST('propcss', 'aZ09'), 'cssview'=>GETPOST('propcssview', 'aZ09'), 'csslist'=>GETPOST('propcsslist', 'aZ09')
- );
+ }
+ if (!$error) {
+ $addfieldentry = array(
+ 'name'=>GETPOST('propname', 'aZ09'),
+ 'label'=>GETPOST('proplabel', 'alpha'),
+ 'type'=>GETPOST('proptype', 'alpha'),
+ 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
+ 'visible'=>GETPOST('propvisible', 'int'),
+ 'enabled'=>GETPOST('propenabled', 'int'),
+ 'position'=>GETPOST('propposition', 'int'),
+ 'notnull'=>GETPOST('propnotnull', 'int'),
+ 'index'=>GETPOST('propindex', 'int'),
+ 'searchall'=>GETPOST('propsearchall', 'int'),
+ 'isameasure'=>GETPOST('propisameasure', 'int'),
+ 'comment'=>GETPOST('propcomment', 'alpha'),
+ 'help'=>GETPOST('prophelp', 'alpha'),
+ 'css'=>GETPOST('propcss', 'aZ09'),
+ 'cssview'=>GETPOST('propcssview', 'aZ09'),
+ 'csslist'=>GETPOST('propcsslist', 'aZ09'),
+ 'default'=>GETPOST('propdefault', 'restricthtml'),
+ 'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
+ );
- if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
- $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
- }
+ if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
+ $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
}
@@ -2800,7 +2812,7 @@ if ($module == 'initmodule') {
print ' ';
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
print ' ';
From 03765528e155afc6f4756a71c6acd811b854b743 Mon Sep 17 00:00:00 2001
From: atm-lena
Date: Thu, 21 Oct 2021 18:42:06 +0200
Subject: [PATCH 050/252] Contract line : update boolean
---
htdocs/core/class/commonobject.class.php | 6 ++++++
htdocs/core/class/extrafields.class.php | 13 ++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 1013da7c430..d4f17cc81f7 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5971,6 +5971,12 @@ abstract class CommonObject
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
}
break;
+
+ case 'boolean':
+ if (empty($this->array_options["options_".$key])) {
+ $this->array_options["options_".$key] = null;
+ }
+ break;
}
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index abc2cd2bd49..56fb54cefbe 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -2216,15 +2216,22 @@ class ExtraFields
$value_arr = (array) $value_arr;
$value_key = implode(',', $value_arr);
} elseif (in_array($key_type, array('price', 'double', 'int'))) {
- if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
+ if (!GETPOSTISSET($keysuffix . "options_" . $key . $keyprefix)) {
continue; // Value was not provided, we should not set it.
}
- $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
- if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
+ $value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix);
+ if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
$value_key = price2num($value_arr);
} else {
$value_key = $value_arr;
}
+ } elseif (in_array($key_type, array('boolean'))) {
+ if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
+ $value_key = '';
+ } else {
+ $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
+ $value_key = $value_arr;
+ }
} else {
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
continue; // Value was not provided, we should not set it.
From bdc8854baa885769a32b7522675693f5cbab11f5 Mon Sep 17 00:00:00 2001
From: atm-lena
Date: Thu, 21 Oct 2021 18:54:07 +0200
Subject: [PATCH 051/252] Clean
---
htdocs/core/class/commonobject.class.php | 6 ------
htdocs/core/class/extrafields.class.php | 4 ++--
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index d4f17cc81f7..1013da7c430 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -5971,12 +5971,6 @@ abstract class CommonObject
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
}
break;
-
- case 'boolean':
- if (empty($this->array_options["options_".$key])) {
- $this->array_options["options_".$key] = null;
- }
- break;
}
}
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 56fb54cefbe..fc28abe6aa6 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -2216,10 +2216,10 @@ class ExtraFields
$value_arr = (array) $value_arr;
$value_key = implode(',', $value_arr);
} elseif (in_array($key_type, array('price', 'double', 'int'))) {
- if (!GETPOSTISSET($keysuffix . "options_" . $key . $keyprefix)) {
+ if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
continue; // Value was not provided, we should not set it.
}
- $value_arr = GETPOST($keysuffix . "options_" . $key . $keyprefix);
+ $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
$value_key = price2num($value_arr);
} else {
From 0c47a88098bf8f132e9e1e22405eee6b9f7e7d8b Mon Sep 17 00:00:00 2001
From: Polkiko
Date: Thu, 21 Oct 2021 23:53:37 +0200
Subject: [PATCH 052/252] FIX Content line substitution in email
---
htdocs/admin/mails_templates.php | 39 ++++++-----------------
htdocs/core/class/html.formmail.class.php | 2 +-
htdocs/core/tpl/card_presend.tpl.php | 1 +
htdocs/langs/en_US/admin.lang | 1 +
htdocs/langs/es_ES/admin.lang | 1 +
5 files changed, 13 insertions(+), 31 deletions(-)
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index 3545892d486..dbb670039d2 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -893,7 +893,7 @@ if ($resql) {
$valuetoshow = $langs->trans("Content"); $showfield = 0;
}
if ($fieldlist[$field] == 'content_lines') {
- $valuetoshow = $langs->trans("ContentLines"); $showfield = 0;
+ $valuetoshow = $langs->trans("ContentForLines"); $showfield = 0;
}
// Show fields
@@ -972,6 +972,14 @@ if ($resql) {
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1);
}
+ if ($tmpfieldlist == 'content_lines') {
+ print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' ';
+ $okforextended = true;
+ if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
+ $okforextended = false;
+ $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
+ print $doleditor->Create(1);
+ }
print ' ';
print ' ';
print ' ';
@@ -1113,35 +1121,6 @@ if ($resql) {
//else print ''.img_delete().' '; // Some dictionary can be edited by other profile than admin
}
print '';
-
- /*
- $fieldsforcontent = array('content');
- if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
- {
- $fieldsforcontent = array('content', 'content_lines');
- }
- foreach ($fieldsforcontent as $tmpfieldlist)
- {
- $showfield = 1;
- $align = "left";
- $valuetoshow = $obj->{$tmpfieldlist};
-
- $class = 'tddict';
- // Show value for field
- if ($showfield) {
-
- print ' '; // To create an artificial CR for the current tr we are on
- $okforextended = true;
- if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
- $okforextended = false;
- $doleditor = new DolEditor($tmpfieldlist.'-'.$i, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%', 1);
- print $doleditor->Create(1);
- print ' ';
- print ' ';
-
- }
- }*/
-
print " \n";
}
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 3dc2743adf1..e636cede798 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1523,7 +1523,7 @@ class FormMail extends Form
$product = new Product($this->db);
$product->fetch($line->fk_product, '', '', 1);
$product->fetch_optionals();
- if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
+ if (is_array($extrafields->attributes[$product->table_element]['label']) && count($extrafields->attributes[$product->table_element]['label']) > 0) {
foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) {
$substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = $product->array_options['options_'.$key];
}
diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php
index cbc7a8a688b..8295a29df4a 100644
--- a/htdocs/core/tpl/card_presend.tpl.php
+++ b/htdocs/core/tpl/card_presend.tpl.php
@@ -207,6 +207,7 @@ if ($action == 'presend') {
}
// Make substitution in email content
+ $formmail->setSubstitFromObject($object, $langs);
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? ' ' : '';
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 367f68e6a9b..7c24ddab9a3 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -278,6 +278,7 @@ SpaceX=Space X
SpaceY=Space Y
FontSize=Font size
Content=Content
+ContentForLines=Content to display for each product or service (from variable __LINES__ of Content)
NoticePeriod=Notice period
NewByMonth=New by month
Emails=Emails
diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang
index dc8459672b8..3222bdb7f5f 100644
--- a/htdocs/langs/es_ES/admin.lang
+++ b/htdocs/langs/es_ES/admin.lang
@@ -277,6 +277,7 @@ SpaceX=Área X
SpaceY=Área Y
FontSize=Tamaño de fuente
Content=Contenido
+ContentForLines=Contenido a mostrar por cada línea de producto o servicio (de la variable __LINES__ definida en Contenido)
NoticePeriod=Plazo de aviso
NewByMonth=Nuevo por mes
Emails=E-Mails
From 3f5d8d9a202ed1cfbdde85a5ec06ea988df6243a Mon Sep 17 00:00:00 2001
From: Laurent Magnin
Date: Fri, 22 Oct 2021 00:00:47 +0200
Subject: [PATCH 053/252] Fix : Listing responsive for ticket
PR for responsive table
---
htdocs/ticket/list.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 1f2816520bf..2566ee81073 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -478,8 +478,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page
// --------------------------------------------------------------------
-llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'classforhorizontalscrolloftabs');
-
+llxHeader('', $title, $help_url, '', 0, 0, '', '', '', '');
if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
$socstat = new Societe($db);
From 7c449892bb2c44f890f3af88f3ca67cefad9678f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Fri, 22 Oct 2021 00:19:10 +0200
Subject: [PATCH 054/252] fix display
---
htdocs/projet/tasks/time.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 83f27c11796..6271f0695fd 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -773,7 +773,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) {
print ' ';
}
if (!empty($conf->eventorganization->enabled)) {
- print ' usage_organize_event ? ' checked="checked"' : '')).'"> ';
+ print ' usage_organize_event ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
}
From 0020a5c61c8ed1e6265baee6dc115643d143b2f6 Mon Sep 17 00:00:00 2001
From: javieralapps4up
Date: Fri, 22 Oct 2021 02:53:37 +0200
Subject: [PATCH 055/252] Update card.php
When you edit a user (with read others and change password others), the form allows the civility_code to be changed but the changes are not saved. I will propose a change in the user card to avoid this
---
htdocs/user/card.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index 8d03d1d1cfb..429de7fd1a6 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -2036,7 +2036,11 @@ if ($action == 'create' || $action == 'adduserldap') {
// Civility
print ''.$langs->trans("UserTitle").' ';
- print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'aZ09') : $object->civility_code, 'civility_code');
+ if ($caneditfield && !$object->ldap_sid) {
+ print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'aZ09') : $object->civility_code, 'civility_code');
+ } elseif ($object->civility_code) {
+ print $langs->trans("Civility".$object->civility_code);
+ }
print ' ';
// Lastname
From 0c8291b60fd4ecf936e221220b3a79d46c55a161 Mon Sep 17 00:00:00 2001
From: Alexandre SPANGARO
Date: Fri, 22 Oct 2021 04:35:23 +0200
Subject: [PATCH 056/252] Fix INNER JOIN & Add urlencode()
---
htdocs/compta/resultat/clientfourn.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index 1d2edd5c918..b5aca49aaae 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -864,7 +864,7 @@ if ($modecompta == 'BOOKKEEPING') {
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
+ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
if (!empty($date_start) && !empty($date_end)) {
@@ -917,7 +917,7 @@ if ($modecompta == 'BOOKKEEPING') {
$userstatic = new User($db);
$userstatic->fetch($obj->fk_user);
- print "".$langs->trans("Salary")." getFullName($langs)."\">".$obj->firstname." ".$obj->lastname." \n";
+ print "".$langs->trans("Salary")." getFullName($langs))."\">".$obj->firstname." ".$obj->lastname." \n";
if ($modecompta == 'CREANCES-DETTES') {
print ''.price(-$obj->amount).' ';
From d1c9877c411640022079aa3b4d34bcd3b08cfba6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Fri, 22 Oct 2021 07:02:44 +0200
Subject: [PATCH 057/252] fix missing code comment
---
htdocs/core/lib/date.lib.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index 8514ab56554..e7ab98ca3b6 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -115,6 +115,7 @@ function getServerTimeZoneInt($refgmtdate = 'now')
* @param int $time Date timestamp (or string with format YYYY-MM-DD)
* @param int $duration_value Value of delay to add
* @param int $duration_unit Unit of added delay (d, m, y, w, h, i)
+ * @param int $ruleforendofmonth Change the behavior of PHP over data-interval, 0 or 1
* @return int New timestamp
*/
function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth = 0)
From 0adb910e56586115e2329b6395a910304562c916 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Fri, 22 Oct 2021 07:27:10 +0200
Subject: [PATCH 058/252] fix sql error
---
htdocs/eventorganization/conferenceorbooth_list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index d6266ec241e..c02306ba6be 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -487,7 +487,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
From e2e3e8ef7b1a561a3700d7edf8b3844a08f354e8 Mon Sep 17 00:00:00 2001
From: Dennis Priskorn <68460690+dpriskorn@users.noreply.github.com>
Date: Fri, 22 Oct 2021 10:18:23 +0200
Subject: [PATCH 059/252] Update api_supplier_invoices.class.php
Add 2 examples
---
htdocs/fourn/class/api_supplier_invoices.class.php | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php
index df1bf36b723..4c2b66caa96 100644
--- a/htdocs/fourn/class/api_supplier_invoices.class.php
+++ b/htdocs/fourn/class/api_supplier_invoices.class.php
@@ -201,6 +201,10 @@ class SupplierInvoices extends DolibarrApi
/**
* Create supplier invoice object
*
+ * Note: soc_id = dolibarr_order_id
+ *
+ * Example: {'ref': 'auto', 'ref_supplier': '7985630', 'socid': 1, 'note': 'Inserted with Python', 'order_supplier': 1, 'date': '2021-07-28'}
+ *
* @param array $request_data Request datas
*
* @return int ID of supplier invoice
@@ -525,6 +529,10 @@ class SupplierInvoices extends DolibarrApi
/**
* Add a line to given supplier invoice
*
+ * Note: socid = dolibarr_order_id, pu_ht = net price, remise = discount
+ *
+ * Example: {'socid': 1, 'qty': 1, 'pu_ht': 21.0, 'tva_tx': 25.0, 'fk_product': '1189', 'product_type': 0, 'remise_percent': 1.0, 'vat_src_code': None}
+ *
* @param int $id Id of supplier invoice to update
* @param array $request_data supplier invoice line data
*
From 4d63586e2a5de90a10c3ec932f70f645407db4e7 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Fri, 22 Oct 2021 08:22:23 +0000
Subject: [PATCH 060/252] Fixing style errors.
---
htdocs/fourn/class/api_supplier_invoices.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php
index 4c2b66caa96..51cd2673b0b 100644
--- a/htdocs/fourn/class/api_supplier_invoices.class.php
+++ b/htdocs/fourn/class/api_supplier_invoices.class.php
@@ -204,7 +204,7 @@ class SupplierInvoices extends DolibarrApi
* Note: soc_id = dolibarr_order_id
*
* Example: {'ref': 'auto', 'ref_supplier': '7985630', 'socid': 1, 'note': 'Inserted with Python', 'order_supplier': 1, 'date': '2021-07-28'}
- *
+ *
* @param array $request_data Request datas
*
* @return int ID of supplier invoice
From 962aa9f977ae7869f0d16ee3fde856ecb525ff24 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Fri, 22 Oct 2021 10:49:01 +0200
Subject: [PATCH 061/252] Fix #yogosha7494
---
htdocs/document.php | 2 ++
htdocs/viewimage.php | 1 +
2 files changed, 3 insertions(+)
diff --git a/htdocs/document.php b/htdocs/document.php
index 3c06801c9a0..e2cf8fb3c92 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -195,9 +195,11 @@ if (!in_array($type, array('text/x-javascript')) && !dolIsAllowedForPreview($ori
}
// Security: Delete string ../ or ..\ into $original_file
+$original_file = preg_replace('/\.\.+/','..', $original_file); // Replace '... or more' with '..'
$original_file = str_replace('../', '/', $original_file);
$original_file = str_replace('..\\', '/', $original_file);
+
// Find the subdirectory name as the reference
$refname = basename(dirname($original_file)."/");
diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php
index f514c7c0302..0e91bd5bc9f 100644
--- a/htdocs/viewimage.php
+++ b/htdocs/viewimage.php
@@ -222,6 +222,7 @@ if (preg_match('/\.noexe$/i', $original_file)) {
}
// Security: Delete string ../ or ..\ into $original_file
+$original_file = preg_replace('/\.\.+/', '..', $original_file); // Replace '... or more' with '..'
$original_file = str_replace('../', '/', $original_file);
$original_file = str_replace('..\\', '/', $original_file);
From 64bb2e6ece88cd6e92821e6dcf920e508d3a91e2 Mon Sep 17 00:00:00 2001
From: Florian HENRY
Date: Fri, 22 Oct 2021 10:49:47 +0200
Subject: [PATCH 062/252] fix various warning
---
htdocs/core/boxes/box_supplier_orders_awaiting_reception.php | 1 +
htdocs/user/class/user.class.php | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
index 8125a848fd0..78d38455d83 100644
--- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
+++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
@@ -97,6 +97,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
}
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
+ $sql .= " AND c.date_livraison IS NOT NULL";
$sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")";
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 0554c2c7983..844c1ae626b 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -289,6 +289,7 @@ class User extends CommonObject
*/
public $rights;
+
/**
* @var int All permissions are loaded
*/
@@ -365,6 +366,7 @@ class User extends CommonObject
*/
public function __construct($db)
{
+ global $conf;
$this->db = $db;
// User preference
@@ -384,6 +386,9 @@ class User extends CommonObject
$this->rights->user = new stdClass();
$this->rights->user->user = new stdClass();
$this->rights->user->self = new stdClass();
+ $this->rights->user->user_advance = new stdClass();
+ $this->rights->user->self_advance = new stdClass();
+ $this->rights->user->group_advance = new stdClass();
}
/**
From ba8ef15916ac2a12ec47a499c207dd45d47fea50 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Fri, 22 Oct 2021 08:50:15 +0000
Subject: [PATCH 063/252] Fixing style errors.
---
htdocs/document.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/document.php b/htdocs/document.php
index e2cf8fb3c92..d6f6584bb6f 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -195,7 +195,7 @@ if (!in_array($type, array('text/x-javascript')) && !dolIsAllowedForPreview($ori
}
// Security: Delete string ../ or ..\ into $original_file
-$original_file = preg_replace('/\.\.+/','..', $original_file); // Replace '... or more' with '..'
+$original_file = preg_replace('/\.\.+/', '..', $original_file); // Replace '... or more' with '..'
$original_file = str_replace('../', '/', $original_file);
$original_file = str_replace('..\\', '/', $original_file);
From 444f7703a6f2acad1b00128c06e09eb9c3244fc0 Mon Sep 17 00:00:00 2001
From: Florian HENRY
Date: Fri, 22 Oct 2021 10:50:24 +0200
Subject: [PATCH 064/252] fix various warning
---
htdocs/user/class/user.class.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 844c1ae626b..24200460d05 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -366,7 +366,6 @@ class User extends CommonObject
*/
public function __construct($db)
{
- global $conf;
$this->db = $db;
// User preference
From 9a9ed8989e85c89e1113025a91c7366c61234003 Mon Sep 17 00:00:00 2001
From: Florian HENRY
Date: Fri, 22 Oct 2021 10:50:54 +0200
Subject: [PATCH 065/252] fix various warning
---
htdocs/user/class/user.class.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 24200460d05..9540f082a4c 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -289,7 +289,6 @@ class User extends CommonObject
*/
public $rights;
-
/**
* @var int All permissions are loaded
*/
From 0c770b8810eaa5bf9a91a9705c2f10b380b8f24f Mon Sep 17 00:00:00 2001
From: Florian HENRY
Date: Fri, 22 Oct 2021 10:54:33 +0200
Subject: [PATCH 066/252] fix various warning
---
htdocs/core/lib/admin.lib.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index 3cd4b058a81..1122d434498 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -1101,7 +1101,7 @@ function activateModule($value, $withdeps = 1)
if (!count($ret['errors'])) {
$ret['nbmodules']++;
- $ret['nbperms'] += count($objMod->rights);
+ $ret['nbperms'] += (is_array($objMod->rights)?count($objMod->rights):0);
}
return $ret;
From 6c71cc1e1454feb1cb0520f873ac2954496926fb Mon Sep 17 00:00:00 2001
From: Florian HENRY
Date: Fri, 22 Oct 2021 11:03:35 +0200
Subject: [PATCH 067/252] better correction from modulebuilder source of #19081
---
htdocs/compta/cashcontrol/cashcontrol_list.php | 2 +-
htdocs/modulebuilder/template/myobject_list.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php
index 407e8b3cf73..49919e33e58 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_list.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_list.php
@@ -223,7 +223,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
}
// Add fields from hooks
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index fe067eb7fc5..a3462b99418 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -265,7 +265,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
}
// Add fields from hooks
From c789b12715052f3aa875edc2746fc0be2bea72a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Fri, 22 Oct 2021 11:07:38 +0200
Subject: [PATCH 068/252] fix more than one extrafield cause bug sql
---
htdocs/compta/cashcontrol/cashcontrol_list.php | 2 +-
htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +-
htdocs/hrm/evaluation_list.php | 2 +-
htdocs/hrm/job_list.php | 2 +-
htdocs/hrm/position_list.php | 2 +-
htdocs/hrm/skill_list.php | 2 +-
htdocs/product/inventory/list.php | 2 +-
htdocs/recruitment/recruitmentjobposition_list.php | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php
index 21a6c56689e..b46ff9433e3 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_list.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_list.php
@@ -223,7 +223,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php
index 3fe20e3c814..12d62e0ab76 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_list.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_list.php
@@ -266,7 +266,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php
index 54c4d547ffe..a713b37ca48 100644
--- a/htdocs/hrm/evaluation_list.php
+++ b/htdocs/hrm/evaluation_list.php
@@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php
index 0c169616f5a..ebd4535e6e7 100644
--- a/htdocs/hrm/job_list.php
+++ b/htdocs/hrm/job_list.php
@@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php
index 60e69bfac3f..3877a6ea14d 100644
--- a/htdocs/hrm/position_list.php
+++ b/htdocs/hrm/position_list.php
@@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php
index c0af4e28edc..fc2998d046a 100644
--- a/htdocs/hrm/skill_list.php
+++ b/htdocs/hrm/skill_list.php
@@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index 44726bb489c..41e43fdf433 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -205,7 +205,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php
index 26a3a81e998..29fde993e25 100644
--- a/htdocs/recruitment/recruitmentjobposition_list.php
+++ b/htdocs/recruitment/recruitmentjobposition_list.php
@@ -246,7 +246,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
- $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
}
}
// Add fields from hooks
From 0d868aa0d9eb3cc670c3f536aace6176a3662958 Mon Sep 17 00:00:00 2001
From: Theo
Date: Fri, 22 Oct 2021 11:14:04 +0200
Subject: [PATCH 069/252] Fix: can't delete categories when linked to some
objects
---
htdocs/categories/class/categorie.class.php | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index d5c135279bf..7547d04e2e4 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -626,12 +626,18 @@ class Categorie extends CommonObject
}
$arraydelete = array(
- 'categorie_societe' => 'fk_categorie',
- 'categorie_fournisseur' => 'fk_categorie',
'categorie_product' => 'fk_categorie',
+ 'categorie_fournisseur' => 'fk_categorie',
+ 'categorie_societe' => 'fk_categorie',
'categorie_member' => 'fk_categorie',
'categorie_contact' => 'fk_categorie',
+ 'categorie_user' => 'fk_categorie',
+ 'categorie_project' => 'fk_categorie',
'categorie_account' => 'fk_categorie',
+ 'categorie_website_page' => 'fk_categorie',
+ 'categorie_warehouse' => 'fk_categorie',
+ 'categorie_actioncomm' => 'fk_categorie',
+ 'categorie_ticket' => 'fk_categorie',
'bank_class' => 'fk_categ',
'categorie_lang' => 'fk_category',
'categorie' => 'rowid',
From 98eb07d6f250ce36d06eeff2658e38719d03b420 Mon Sep 17 00:00:00 2001
From: Richard Franks
Date: Fri, 22 Oct 2021 10:39:14 +0100
Subject: [PATCH 070/252] FIX #18695 Added ref_ext to supplier invoice
Added ref_ext to the fields for create, fetch and update functions
on fournisseur.facture class. This enables the REST API to use
this field for additional information.
---
htdocs/fourn/class/fournisseur.facture.class.php | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 4bca77809cb..2601c610e15 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -415,6 +415,7 @@ class FactureFournisseur extends CommonInvoice
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn (";
$sql .= "ref";
$sql .= ", ref_supplier";
+ $sql .= ", ref_ext";
$sql .= ", entity";
$sql .= ", type";
$sql .= ", libelle";
@@ -438,6 +439,7 @@ class FactureFournisseur extends CommonInvoice
$sql .= " VALUES (";
$sql .= "'(PROV)'";
$sql .= ", '".$this->db->escape($this->ref_supplier)."'";
+ $sql .= ", '".$this->db->escape($this->ref_ext)."'";
$sql .= ", ".$conf->entity;
$sql .= ", '".$this->db->escape($this->type)."'";
$sql .= ", '".$this->db->escape(isset($this->label) ? $this->label : (isset($this->libelle) ? $this->libelle : ''))."'";
@@ -647,6 +649,7 @@ class FactureFournisseur extends CommonInvoice
$sql .= " t.rowid,";
$sql .= " t.ref,";
$sql .= " t.ref_supplier,";
+ $sql .= " t.ref_ext,";
$sql .= " t.entity,";
$sql .= " t.type,";
$sql .= " t.fk_soc,";
@@ -708,6 +711,7 @@ class FactureFournisseur extends CommonInvoice
$this->ref = $obj->ref ? $obj->ref : $obj->rowid; // We take rowid if ref is empty for backward compatibility
$this->ref_supplier = $obj->ref_supplier;
+ $this->ref_ext = $obj->ref_ext;
$this->entity = $obj->entity;
$this->type = empty($obj->type) ? self::TYPE_STANDARD : $obj->type;
$this->fk_soc = $obj->fk_soc;
@@ -924,6 +928,9 @@ class FactureFournisseur extends CommonInvoice
if (isset($this->ref_supplier)) {
$this->ref_supplier = trim($this->ref_supplier);
}
+ if (isset($this->ref_ext)) {
+ $this->ref_ext = trim($this->ref_ext);
+ }
if (isset($this->entity)) {
$this->entity = trim($this->entity);
}
@@ -1013,6 +1020,7 @@ class FactureFournisseur extends CommonInvoice
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET";
$sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
$sql .= " ref_supplier=".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "null").",";
+ $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
$sql .= " entity=".(isset($this->entity) ? $this->entity : "null").",";
$sql .= " type=".(isset($this->type) ? $this->type : "null").",";
$sql .= " fk_soc=".(isset($this->fk_soc) ? $this->fk_soc : "null").",";
From b3f15167dca7d85bb633b8335619192c18b12fcf Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Fri, 22 Oct 2021 11:55:21 +0200
Subject: [PATCH 071/252] Fix : Error on fetchAll on line
---
htdocs/core/class/commonobjectline.class.php | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php
index 2856b535a3e..d93d0b67ff9 100644
--- a/htdocs/core/class/commonobjectline.class.php
+++ b/htdocs/core/class/commonobjectline.class.php
@@ -111,4 +111,20 @@ abstract class CommonObjectLine extends CommonObject
return -1;
}
}
+
+ /**
+ * Empty function to prevent errors on call of this function must be overload if usefull
+ *
+ * @param string $sortorder Sort Order
+ * @param string $sortfield Sort field
+ * @param int $limit offset limit
+ * @param int $offset offset limit
+ * @param array $filter filter array
+ * @param string $filtermode filter mode (AND or OR)
+ * @return int <0 if KO, >0 if OK
+ */
+ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
+ {
+ return 0;
+ }
}
From f354427b3cfc8478383126f70d2f0595c8697aa4 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Fri, 22 Oct 2021 11:58:00 +0200
Subject: [PATCH 072/252] Fix warning
---
htdocs/core/class/extrafields.class.php | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 4f9b9c470d9..cb2cb892adf 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1653,10 +1653,14 @@ class ExtraFields
$showsize = 0;
if ($type == 'date') {
$showsize = 10;
- $value = dol_print_date($value, 'day'); // For date without hour, date is always GMT for storage and output
+ if ($value !== '') {
+ $value = dol_print_date($value, 'day'); // For date without hour, date is always GMT for storage and output
+ }
} elseif ($type == 'datetime') {
$showsize = 19;
- $value = dol_print_date($value, 'dayhour', 'tzuserrel');
+ if ($value !== '') {
+ $value = dol_print_date($value, 'dayhour', 'tzuserrel');
+ }
} elseif ($type == 'int') {
$showsize = 10;
} elseif ($type == 'double') {
From 33e4d750d71a15f399d0d908139bf3321f67a3d8 Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Fri, 22 Oct 2021 12:01:46 +0200
Subject: [PATCH 073/252] Fix: scrutinizer errors + boxes activation
---
htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php | 2 ++
htdocs/core/class/dolgraph.class.php | 1 +
htdocs/core/class/html.formticket.class.php | 2 ++
htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 5 +++++
htdocs/mrp/class/api_mos.class.php | 4 ++--
htdocs/mrp/class/mo.class.php | 1 +
6 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php
index 98aed557557..f37bda11104 100644
--- a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php
+++ b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php
@@ -65,6 +65,8 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
public function loadBox($max = 5)
{
global $conf, $user, $langs;
+ $dataseries = "";
+ $graphtoshow = "";
$badgeStatus0 = '#cbd3d3'; // draft
$badgeStatus1 = '#bc9526'; // validated
diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php
index a892c557b34..26701cde6ff 100644
--- a/htdocs/core/class/dolgraph.class.php
+++ b/htdocs/core/class/dolgraph.class.php
@@ -1054,6 +1054,7 @@ class DolGraph
}
$showlegend = $this->showlegend;
+ $bordercolor = "";
$legends = array();
$nblot = 0;
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 89260c35d03..b9f320b7db8 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -753,6 +753,8 @@ class FormTicket
print ajax_combobox('select'.$htmlname);
} elseif ($htmlname!='') {
+ $selectedgroups = array();
+ $groupvalue = "";
$groupticket=GETPOST($htmlname, 'aZ09');
$child_id=GETPOST($htmlname.'_child_id', 'aZ09')?GETPOST($htmlname.'_child_id', 'aZ09'):0;
if (!empty($groupticket)) {
diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
index 34e8859596a..12fa6d2cb01 100644
--- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
+++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
@@ -378,3 +378,8 @@ ALTER TABLE llx_societe_perentity ADD COLUMN accountancy_code_customer varchar(2
ALTER TABLE llx_societe_perentity ADD COLUMN accountancy_code_supplier varchar(24) AFTER accountancy_code_customer; -- equivalent to code_compta_supplier in llx_societe
ALTER TABLE llx_projet_task ADD COLUMN budget_amount double(24,8) AFTER priority;
+
+-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_ticket_by_severity.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_ticket_by_severity.php' AND entity = 1);
+-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_nb_ticket_last_x_days.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_nb_ticket_last_x_days.php' AND entity = 1);
+-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_nb_tickets_type.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_nb_tickets_type.php' AND entity = 1);
+-- VMYSQL4.1 INSERT INTO llx_boxes_def (file, entity) SELECT 'box_graph_new_vs_close_ticket.php', 1 FROM DUAL WHERE NOT EXISTS (SELECT * FROM llx_boxes_def WHERE file = 'box_graph_new_vs_close_ticket.php' AND entity = 1);
diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php
index 92351184ebe..105fb58082e 100644
--- a/htdocs/mrp/class/api_mos.class.php
+++ b/htdocs/mrp/class/api_mos.class.php
@@ -491,7 +491,7 @@ class Mos extends DolibarrApi
if (!$error && $line->fk_warehouse > 0) {
// Record stock movement
$id_product_batch = 0;
- $stockmove->origin = $this->mo;
+ $stockmove->origin = 'mo';
if ($qtytoprocess >= 0) {
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
} else {
@@ -550,7 +550,7 @@ class Mos extends DolibarrApi
if (!$error && $line->fk_warehouse > 0) {
// Record stock movement
$id_product_batch = 0;
- $stockmove->origin = $this->mo;
+ $stockmove->origin = 'mo';
if ($qtytoprocess >= 0) {
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
} else {
diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
index a7ed52687df..cdad4e71968 100644
--- a/htdocs/mrp/class/mo.class.php
+++ b/htdocs/mrp/class/mo.class.php
@@ -625,6 +625,7 @@ class Mo extends CommonObject
public function updateProduction(User $user, $notrigger = true)
{
$error = 0;
+ $role = "";
if ($this->status != self::STATUS_DRAFT) {
$this->error = 'BadStatus';
From 1ecd0a2be7aab670bb5f6eed0a9cf49f57899b30 Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Fri, 22 Oct 2021 14:17:47 +0200
Subject: [PATCH 074/252] Fix : french labels of box_graph_new_vs_close
---
htdocs/core/boxes/box_graph_new_vs_close_ticket.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php
index ce8d7ab0078..435cc76451e 100644
--- a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php
+++ b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php
@@ -98,10 +98,10 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes
$num = $this->db->num_rows($resql);
if ($num > 0) {
$objp = $this->db->fetch_object($resql);
- $data[] = array($langs->trans('TicketCreatedToday'), $objp->nb);
+ $data[] = array($langs->transnoentitiesnoconv('TicketCreatedToday'), $objp->nb);
$totalnb += $objp->nb;
} else {
- $data[] = array($langs->trans('TicketCreatedToday'), 0);
+ $data[] = array($langs->transnoentitiesnoconv('TicketCreatedToday'), 0);
}
} else {
dol_print_error($this->db);
@@ -116,10 +116,10 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes
$num = $this->db->num_rows($resql);
if ($num > 0) {
$objp = $this->db->fetch_object($resql);
- $data[] = array($langs->trans('TicketClosedToday'), $objp->nb);
+ $data[] = array($langs->transnoentitiesnoconv('TicketClosedToday'), $objp->nb);
$totalnb += $objp->nb;
} else {
- $data[] = array($langs->trans('TicketClosedToday'), 0);
+ $data[] = array($langs->transnoentitiesnoconv('TicketClosedToday'), 0);
}
} else {
dol_print_error($this->db);
From f7923003e1405e9b6a64a81158c95fa794d0de40 Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Fri, 22 Oct 2021 14:27:42 +0200
Subject: [PATCH 075/252] better fix for api_mos.class.php
---
htdocs/mrp/class/api_mos.class.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php
index 105fb58082e..86d4758b45f 100644
--- a/htdocs/mrp/class/api_mos.class.php
+++ b/htdocs/mrp/class/api_mos.class.php
@@ -491,7 +491,8 @@ class Mos extends DolibarrApi
if (!$error && $line->fk_warehouse > 0) {
// Record stock movement
$id_product_batch = 0;
- $stockmove->origin = 'mo';
+ $stockmove->origin_type = 'mo';
+ $stockmove->origin_id = $this->mo->id;
if ($qtytoprocess >= 0) {
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
} else {
@@ -550,7 +551,8 @@ class Mos extends DolibarrApi
if (!$error && $line->fk_warehouse > 0) {
// Record stock movement
$id_product_batch = 0;
- $stockmove->origin = 'mo';
+ $stockmove->origin_type = 'mo';
+ $stockmove->origin_id = $this->mo->id;
if ($qtytoprocess >= 0) {
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement);
} else {
From db779c217566a43325391090bec34a128daa67e8 Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Fri, 22 Oct 2021 14:34:40 +0200
Subject: [PATCH 076/252] Fix : knowledgerecord_card clone part
---
htdocs/knowledgemanagement/knowledgerecord_card.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php
index 8af0431f361..f94dee0003c 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_card.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_card.php
@@ -418,7 +418,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Clone
- print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd);
/*
if ($permissiontoadd) {
From 0a278416f4fa7f6b7f28cd47ae62a1df85f6538c Mon Sep 17 00:00:00 2001
From: kevin
Date: Fri, 22 Oct 2021 15:12:56 +0200
Subject: [PATCH 077/252] Add missing ticket class property
---
htdocs/ticket/class/ticket.class.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 2fad1afd8ab..57d3e00bcfd 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -589,6 +589,7 @@ class Ticket extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
+ $this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->track_id = $obj->track_id;
$this->fk_soc = $obj->fk_soc;
From fd64f8966b9bccb13deb47236a85d046559a471e Mon Sep 17 00:00:00 2001
From: polkiko
Date: Fri, 22 Oct 2021 15:19:11 +0200
Subject: [PATCH 078/252] Fixed in-line substitution if there is no object
---
htdocs/core/tpl/card_presend.tpl.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php
index 8295a29df4a..9defdf87260 100644
--- a/htdocs/core/tpl/card_presend.tpl.php
+++ b/htdocs/core/tpl/card_presend.tpl.php
@@ -207,7 +207,9 @@ if ($action == 'presend') {
}
// Make substitution in email content
- $formmail->setSubstitFromObject($object, $langs);
+ if ($object) {
+ $formmail->setSubstitFromObject($object, $langs);
+ }
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? ' ' : '';
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
From 101ec9b3fed3fb51de61debbbd25fa850d0aa6a5 Mon Sep 17 00:00:00 2001
From: MOREAU FRANCK
Date: Fri, 22 Oct 2021 15:25:19 +0200
Subject: [PATCH 079/252] Fix scrutinizer FHENRY
---
htdocs/webservices/server_thirdparty.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php
index dbf2f3dd125..554f7e7e996 100644
--- a/htdocs/webservices/server_thirdparty.php
+++ b/htdocs/webservices/server_thirdparty.php
@@ -103,7 +103,7 @@ $thirdparty_fields = array(
'address' => array('name'=>'address', 'type'=>'xsd:string'),
'zip' => array('name'=>'zip', 'type'=>'xsd:string'),
'town' => array('name'=>'town', 'type'=>'xsd:string'),
- 'province_id' => array('name'=>'province_id', 'type'=>'xsd:string'),
+ 'region_code' => array('name'=>'region_code', 'type'=>'xsd:string'),
'country_id' => array('name'=>'country_id', 'type'=>'xsd:string'),
'country_code' => array('name'=>'country_code', 'type'=>'xsd:string'),
'country' => array('name'=>'country', 'type'=>'xsd:string'),
@@ -343,7 +343,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar
'address' => $thirdparty->address,
'zip' => $thirdparty->zip,
'town' => $thirdparty->town,
- 'province_id' => $thirdparty->state_id,
+ 'region_code' => $thirdparty->region_code,
'country_id' => $thirdparty->country_id,
'country_code' => $thirdparty->country_code,
'country' => $thirdparty->country,
@@ -462,7 +462,7 @@ function createThirdParty($authentication, $thirdparty)
if ($thirdparty['country_code']) {
$newobject->country_id = getCountry($thirdparty['country_code'], 3);
}
- $newobject->province_id = $thirdparty['province_id'];
+ $newobject->region_code = $thirdparty['region_code'];
//if ($thirdparty['province_code']) $newobject->province_code=getCountry($thirdparty['province_code'],3);
$newobject->phone = $thirdparty['phone'];
@@ -597,7 +597,7 @@ function updateThirdParty($authentication, $thirdparty)
if ($thirdparty['country_code']) {
$object->country_id = getCountry($thirdparty['country_code'], 3);
}
- $object->province_id = $thirdparty['province_id'];
+ $object->region_code = $thirdparty['region_code'];
//if ($thirdparty['province_code']) $newobject->province_code=getCountry($thirdparty['province_code'],3);
$object->phone = $thirdparty['phone'];
From cd52c3da7583bfa9f4070c3d39716cc51341c7d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Fri, 22 Oct 2021 15:27:09 +0200
Subject: [PATCH 080/252] fix warning
---
htdocs/eventorganization/conferenceorbooth_list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index c02306ba6be..d72941d2885 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -288,7 +288,7 @@ if ($projectid > 0) {
$morehtmlref .= '';
// Define a complementary filter for search of next/prev ref.
- if (!$user->rights->project->all->lire) {
+ if (empty($user->rights->project->all->lire)) {
$objectsListId = $project->getProjectsAuthorizedForUser($user, 0, 0);
$project->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
From fa21b27cedc3c67a5097932bae90114156820fa8 Mon Sep 17 00:00:00 2001
From: atm-lena
Date: Fri, 22 Oct 2021 15:27:16 +0200
Subject: [PATCH 081/252] Validate Holiday : keep files
---
htdocs/holiday/card.php | 1 +
htdocs/holiday/class/holiday.class.php | 39 ++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 150a9c0754b..93e748a51d2 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -266,6 +266,7 @@ if (empty($reshook)) {
// If update and we are an approver, we can update with another approver
if ($action == 'update' && GETPOSTISSET('savevalidator') && !empty($user->rights->holiday->approve)) {
+
$object->fetch($id);
$object->oldcopy = dol_clone($object);
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index 5ecc4d7325a..665e43c6ffd 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -701,6 +701,7 @@ class Holiday extends CommonObject
public function validate($user = null, $notrigger = 0)
{
global $conf, $langs;
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error = 0;
// Define new ref
@@ -740,6 +741,44 @@ class Holiday extends CommonObject
}
}
+ if (!$error) {
+ $this->oldref = $this->ref;
+
+ // Rename directory if dir was a temporary ref
+ if (preg_match('/^[\(]?PROV/i', $this->ref)) {
+ // Now we rename also files into index
+ $sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'holiday/" . $this->db->escape($this->newref) . "'";
+ $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'holiday/" . $this->db->escape($this->ref) . "' and entity = " . ((int)$conf->entity);
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $error++;
+ $this->error = $this->db->lasterror();
+ }
+
+ // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
+ $oldref = dol_sanitizeFileName($this->ref);
+ $newref = dol_sanitizeFileName($num);
+ $dirsource = $conf->holiday->multidir_output[$this->entity] . '/' . $oldref;
+ $dirdest = $conf->holiday->multidir_output[$this->entity] . '/' . $newref;
+ if (!$error && file_exists($dirsource)) {
+ dol_syslog(get_class($this) . "::validate rename dir " . $dirsource . " into " . $dirdest);
+ if (@rename($dirsource, $dirdest)) {
+ dol_syslog("Rename ok");
+ // Rename docs starting with $oldref with $newref
+ $listoffiles = dol_dir_list($dirdest, 'files', 1, '^' . preg_quote($oldref, '/'));
+ foreach ($listoffiles as $fileentry) {
+ $dirsource = $fileentry['name'];
+ $dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource);
+ $dirsource = $fileentry['path'] . '/' . $dirsource;
+ $dirdest = $fileentry['path'] . '/' . $dirdest;
+ @rename($dirsource, $dirdest);
+ }
+ }
+ }
+ }
+ }
+
+
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {
From 34b9890110b6741426fffae62f1114d589fd9467 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Fri, 22 Oct 2021 15:29:38 +0200
Subject: [PATCH 082/252] fix warning
---
htdocs/eventorganization/conferenceorbooth_list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index c02306ba6be..a423b532106 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -282,7 +282,7 @@ if ($projectid > 0) {
// Title
$morehtmlref .= $project->title;
// Thirdparty
- if ($project->thirdparty->id > 0) {
+ if (isset($project->thirdparty->id) && $project->thirdparty->id > 0) {
$morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$project->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '';
From 6855d8e91a1a0dbfec76e57c8254ff7982bbe6c5 Mon Sep 17 00:00:00 2001
From: MOREAU FRANCK
Date: Fri, 22 Oct 2021 15:32:24 +0200
Subject: [PATCH 083/252] Fix scrutinizer FHENRY
---
htdocs/contrat/class/contrat.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index a23a620359e..d63b0e7acb0 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -2545,7 +2545,7 @@ class Contrat extends CommonObject
if (!$error) {
foreach ($this->lines as $line) {
- $result = $clonedObj->addline($line->desc, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, $line->date_ouverture, $line->date_cloture, 'HT', 0, $line->info_bits, $line->fk_fournprice, $line->pa_ht, $line->array_options, $line->fk_unit);
+ $result = $clonedObj->addline($line->description, $line->subprice, $line->qty, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, $line->date_ouverture, $line->date_cloture, 'HT', 0, $line->info_bits, $line->fk_fournprice, $line->pa_ht, $line->array_options, $line->fk_unit);
if ($result < 0) {
$error++;
$this->error = $clonedObj->error;
From 311522bf042cf998dc58373847dfb71e1873b62d Mon Sep 17 00:00:00 2001
From: Theo
Date: Fri, 22 Oct 2021 15:33:57 +0200
Subject: [PATCH 084/252] fix: error return when adding a category to an object
---
htdocs/categories/viewcat.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index 8ebb9f43b1e..a3b9f9cedb0 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -199,7 +199,7 @@ if ($elemid && $action == 'addintocategory' &&
if ($result >= 0) {
setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs');
} else {
- if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
+ if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
} else {
setEventMessages($object->error, $object->errors, 'errors');
From 87b4805bc041237a87ab3da8788020a1306e40cf Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Fri, 22 Oct 2021 13:35:30 +0000
Subject: [PATCH 085/252] Fixing style errors.
---
htdocs/holiday/card.php | 1 -
htdocs/holiday/class/holiday.class.php | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 93e748a51d2..150a9c0754b 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -266,7 +266,6 @@ if (empty($reshook)) {
// If update and we are an approver, we can update with another approver
if ($action == 'update' && GETPOSTISSET('savevalidator') && !empty($user->rights->holiday->approve)) {
-
$object->fetch($id);
$object->oldcopy = dol_clone($object);
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index 665e43c6ffd..6271f1d43e8 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -748,7 +748,7 @@ class Holiday extends CommonObject
if (preg_match('/^[\(]?PROV/i', $this->ref)) {
// Now we rename also files into index
$sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'holiday/" . $this->db->escape($this->newref) . "'";
- $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'holiday/" . $this->db->escape($this->ref) . "' and entity = " . ((int)$conf->entity);
+ $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'holiday/" . $this->db->escape($this->ref) . "' and entity = " . ((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
From b5929fb7c41301178bb983206f1a089942bfd21e Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Fri, 22 Oct 2021 15:42:18 +0200
Subject: [PATCH 086/252] Fix phpcs
---
htdocs/modulebuilder/index.php | 2 +-
htdocs/product/class/api_products.class.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 06907b49742..82567e05fac 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1295,8 +1295,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
}
-
}
+
if (!$error) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'),
diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php
index b6230ce119e..c3b22adedb2 100644
--- a/htdocs/product/class/api_products.class.php
+++ b/htdocs/product/class/api_products.class.php
@@ -1945,7 +1945,7 @@ class Products extends DolibarrApi
unset($object->supplierprices); // Mut use another API to get them
- if(!DolibarrApiAccess::$user->rights->stock->lire){
+ if (empty(DolibarrApiAccess::$user->rights->stock->lire)) {
unset($object->stock_reel);
unset($object->stock_theorique);
}
From 29f847c13a9c54f43da959588318024e053fddaa Mon Sep 17 00:00:00 2001
From: Theo
Date: Fri, 22 Oct 2021 15:48:39 +0200
Subject: [PATCH 087/252] add: quick link categories to project
---
htdocs/categories/viewcat.php | 27 +++-
htdocs/core/class/html.form.class.php | 206 ++++++++++++++++++++++++++
htdocs/langs/fr_FR/categories.lang | 1 +
3 files changed, 233 insertions(+), 1 deletion(-)
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index 7ccd80eb4bd..0f3d6d075a5 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -173,7 +173,8 @@ if ($elemid && $action == 'addintocategory' &&
(($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer)) ||
($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) ||
($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) ||
- ($type == Categorie::TYPE_TICKET && $user->rights->ticket->write)
+ ($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) ||
+ ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer)
)) {
if ($type == Categorie::TYPE_PRODUCT) {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@@ -191,6 +192,10 @@ if ($elemid && $action == 'addintocategory' &&
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
$newobject = new Ticket($db);
$elementtype = 'ticket';
+ } elseif ($type == Categorie::TYPE_PROJECT) {
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+ $newobject = new Project($db);
+ $elementtype = 'project';
}
$result = $newobject->fetch($elemid);
@@ -874,6 +879,26 @@ if ($type == Categorie::TYPE_PROJECT) {
if ($objects < 0) {
dol_print_error($db, $object->error, $object->errors);
} else {
+ // Form to add record into a category
+ $showclassifyform = 1;
+ if ($showclassifyform) {
+ print ' ';
+ print '';
+ }
+
print ' ';
- $totalarray = array();
print '';
if (!empty($arrayfields['aa.account_number']['checked'])) {
print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
- $totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.label']['checked'])) {
print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
- $totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.labelshort']['checked'])) {
print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
- $totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.account_parent']['checked'])) {
print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
- $totalarray['nbfield']++;
}
if (!empty($arrayfields['aa.pcg_type']['checked'])) {
print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type,aa.account_number', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help'], 1);
- $totalarray['nbfield']++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder);
- $totalarray['nbfield']++;
}
}
if (!empty($arrayfields['aa.active']['checked'])) {
print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
- $totalarray['nbfield']++;
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print " \n";
$accountstatic = new AccountingAccount($db);
$accountparent = new AccountingAccount($db);
+ $totalarray = array();
+ $totalarray['nbfield'] = 0;
$i = 0;
while ($i < min($num, $limit)) {
From 93e223bf84186245c13d7f87a9e7735f1cf92a4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 07:38:10 +0200
Subject: [PATCH 114/252] fix warnings
---
htdocs/accountancy/admin/defaultaccounts.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php
index 061752c11c5..5d78036159a 100644
--- a/htdocs/accountancy/admin/defaultaccounts.php
+++ b/htdocs/accountancy/admin/defaultaccounts.php
@@ -186,7 +186,7 @@ foreach ($list_account as $key) {
print ''.$label.' ';
// Value
print ''; // Do not force class=right, or it align also the content of the select box
- print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
+ print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
print ' ';
print ' ';
}
From 21aaed4a862fb50d4fcba2a5546bceb0c2c8201d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 07:40:36 +0200
Subject: [PATCH 115/252] Update closure.php
---
htdocs/accountancy/admin/closure.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php
index 8efb869ffaf..437ff1b7116 100644
--- a/htdocs/accountancy/admin/closure.php
+++ b/htdocs/accountancy/admin/closure.php
@@ -109,7 +109,7 @@ foreach ($list_account_main as $key) {
print '';
// Value
print ''; // Do not force class=right, or it align also the content of the select box
- print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
+ print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
print ' ';
print ' ';
}
From febb48d345c436610cac62c9b617d3e0f39ed64e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 07:41:40 +0200
Subject: [PATCH 116/252] Update loan.php
---
htdocs/admin/loan.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php
index 0769ee5c0a0..59b7eb8b463 100644
--- a/htdocs/admin/loan.php
+++ b/htdocs/admin/loan.php
@@ -105,7 +105,7 @@ foreach ($list as $key) {
// Value
print '';
if (!empty($conf->accounting->enabled)) {
- print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
+ print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
} else {
print ' ';
}
From 4fa050bd1a18dd2c2970c0420fc8555c28ac1a01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 07:42:29 +0200
Subject: [PATCH 117/252] Update salaries.php
---
htdocs/salaries/admin/salaries.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/salaries/admin/salaries.php b/htdocs/salaries/admin/salaries.php
index f8ed3f3f7ce..1c9eeec6464 100644
--- a/htdocs/salaries/admin/salaries.php
+++ b/htdocs/salaries/admin/salaries.php
@@ -120,7 +120,7 @@ foreach ($list as $key) {
// Value
print '';
if (!empty($conf->accounting->enabled)) {
- print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
+ print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1);
} else {
print ' ';
}
From a194737f1c711d57ba459f553ca331e2683da962 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 07:58:35 +0200
Subject: [PATCH 118/252] fix permission
---
htdocs/opensurvey/list.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php
index 3dc42def482..b05abe3fd40 100644
--- a/htdocs/opensurvey/list.php
+++ b/htdocs/opensurvey/list.php
@@ -107,7 +107,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = $user->rights->opensurvey->read;
$permissiontoadd = $user->rights->opensurvey->write;
-$permissiontodelete = $user->rights->opensurvey->delete;
+// permission delete doesn't exists
+$permissiontodelete = $user->rights->opensurvey->write;
/*
From c19ea8b220db432a4fdcb0993ef8e7844b7c2836 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:37:07 +0200
Subject: [PATCH 119/252] clean code
---
htdocs/hrm/evaluation_note.php | 53 ++--------------------------------
1 file changed, 2 insertions(+), 51 deletions(-)
diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php
index aae7b56acaf..1b6b5a35564 100644
--- a/htdocs/hrm/evaluation_note.php
+++ b/htdocs/hrm/evaluation_note.php
@@ -25,57 +25,8 @@
* \brief Tab for notes on Evaluation
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
-
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluation.class.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_evaluation.lib.php';
@@ -86,7 +37,7 @@ $langs->loadLangs(array("hrm", "companies"));
// Get parameters
$id = GETPOST('id', 'int');
-$ref = GETPOST('ref', 'alpha');
+$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
From 8dd237b96470e50deefd573ee80656eb30ea0fb3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:38:27 +0200
Subject: [PATCH 120/252] Update evaluation_list.php
---
htdocs/hrm/evaluation_list.php | 50 +---------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php
index a713b37ca48..35189f11b87 100644
--- a/htdocs/hrm/evaluation_list.php
+++ b/htdocs/hrm/evaluation_list.php
@@ -25,57 +25,9 @@
* \brief List page for evaluation
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
From a81da58639f96f4ebbbbe3c8f3f9bdbb5b5b80d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:39:10 +0200
Subject: [PATCH 121/252] Update evaluation_document.php
---
htdocs/hrm/evaluation_document.php | 50 +-----------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php
index 06cbd7a621a..7318819644e 100644
--- a/htdocs/hrm/evaluation_document.php
+++ b/htdocs/hrm/evaluation_document.php
@@ -25,57 +25,9 @@
* \brief Tab for documents linked to Evaluation
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
From cf4954e1c59fbd5a434ab4e7f448378d35435076 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:39:37 +0200
Subject: [PATCH 122/252] Update evaluation_contact.php
---
htdocs/hrm/evaluation_contact.php | 30 +-----------------------------
1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php
index 540154b77ef..61af793b28a 100644
--- a/htdocs/hrm/evaluation_contact.php
+++ b/htdocs/hrm/evaluation_contact.php
@@ -26,35 +26,7 @@
*/
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
From 7792a69d8bf00a81c4511f9ce9014333e9b0cb21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:40:02 +0200
Subject: [PATCH 123/252] Update evaluation_card.php
---
htdocs/hrm/evaluation_card.php | 51 +---------------------------------
1 file changed, 1 insertion(+), 50 deletions(-)
diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php
index 64b54b4c80b..2716bbf8a83 100644
--- a/htdocs/hrm/evaluation_card.php
+++ b/htdocs/hrm/evaluation_card.php
@@ -25,57 +25,8 @@
* \brief Page to create/edit/view evaluation
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
-
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
From 1c32847c07ad4cc5643e5c93b821bb3add8cb7c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:40:29 +0200
Subject: [PATCH 124/252] Update evaluation_agenda.php
---
htdocs/hrm/evaluation_agenda.php | 50 +-------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php
index 8524f6df3d9..91a0615bc95 100644
--- a/htdocs/hrm/evaluation_agenda.php
+++ b/htdocs/hrm/evaluation_agenda.php
@@ -25,57 +25,9 @@
* \brief Tab of events on Evaluation
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
From fa516a146087b9433f56eeecbc87b78844c3642e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:42:42 +0200
Subject: [PATCH 125/252] Update skill_tab.php
---
htdocs/hrm/skill_tab.php | 55 ++--------------------------------------
1 file changed, 2 insertions(+), 53 deletions(-)
diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php
index 2aada2a771e..9a9ea39e31d 100644
--- a/htdocs/hrm/skill_tab.php
+++ b/htdocs/hrm/skill_tab.php
@@ -25,61 +25,10 @@
* \brief Page to add/delete/view skill to jobs/users
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
+
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
-$tmp2 = realpath(__FILE__);
-$i = strlen($tmp) - 1;
-$j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--;
- $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
From b1d948a0f39aade3b717b30a341659f377f2769b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:43:07 +0200
Subject: [PATCH 126/252] Update skill_note.php
---
htdocs/hrm/skill_note.php | 50 +--------------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/skill_note.php b/htdocs/hrm/skill_note.php
index 000c5e1b41b..1510f746e5e 100644
--- a/htdocs/hrm/skill_note.php
+++ b/htdocs/hrm/skill_note.php
@@ -25,57 +25,9 @@
* \brief Tab for notes on skill
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.lib.php';
From cbead902dfa1d405625f6bce4bb565e2045694f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:43:31 +0200
Subject: [PATCH 127/252] Update skill_list.php
---
htdocs/hrm/skill_list.php | 50 +--------------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php
index fc2998d046a..1fc5440e589 100644
--- a/htdocs/hrm/skill_list.php
+++ b/htdocs/hrm/skill_list.php
@@ -25,57 +25,9 @@
* \brief List page for skill
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
From 3c8b135de1d3c169036d4660a519aa2ef828be96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:43:59 +0200
Subject: [PATCH 128/252] Update skill_document.php
---
htdocs/hrm/skill_document.php | 50 +----------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/skill_document.php b/htdocs/hrm/skill_document.php
index ca13044f712..77f3325de15 100644
--- a/htdocs/hrm/skill_document.php
+++ b/htdocs/hrm/skill_document.php
@@ -25,57 +25,9 @@
* \brief Tab for documents linked to skill
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
From 5f2269761c9f8f723b57c13a97f490fe1c963f0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:44:27 +0200
Subject: [PATCH 129/252] Update skill_contact.php
---
htdocs/hrm/skill_contact.php | 30 +-----------------------------
1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/htdocs/hrm/skill_contact.php b/htdocs/hrm/skill_contact.php
index a535e00696b..f8ea2a04a9f 100644
--- a/htdocs/hrm/skill_contact.php
+++ b/htdocs/hrm/skill_contact.php
@@ -26,35 +26,7 @@
*/
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
From c5d60f44e3c279a2e9e832ec30f2f0d1ed44b9fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:44:54 +0200
Subject: [PATCH 130/252] Update skill_card.php
---
htdocs/hrm/skill_card.php | 55 +--------------------------------------
1 file changed, 1 insertion(+), 54 deletions(-)
diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php
index 2a5b58cd788..3b649ebf485 100644
--- a/htdocs/hrm/skill_card.php
+++ b/htdocs/hrm/skill_card.php
@@ -25,62 +25,9 @@
* \brief Page to create/edit/view skill
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
-$tmp2 = realpath(__FILE__);
-$i = strlen($tmp) - 1;
-$j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--;
- $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
-
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
From ad6d57502f7b3a5f9f7aa5631549453e251fb38b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:45:29 +0200
Subject: [PATCH 131/252] Update skill_agenda.php
---
htdocs/hrm/skill_agenda.php | 50 +------------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/skill_agenda.php b/htdocs/hrm/skill_agenda.php
index 0b854ccb028..9c1821fb8d7 100644
--- a/htdocs/hrm/skill_agenda.php
+++ b/htdocs/hrm/skill_agenda.php
@@ -25,57 +25,9 @@
* \brief Tab of events on skill
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
From d990b2dc3865fb31243475bbb6045e737a120184 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:45:59 +0200
Subject: [PATCH 132/252] Update position_note.php
---
htdocs/hrm/position_note.php | 50 +-----------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/position_note.php b/htdocs/hrm/position_note.php
index 81548761326..1eea4b82676 100644
--- a/htdocs/hrm/position_note.php
+++ b/htdocs/hrm/position_note.php
@@ -26,57 +26,9 @@
* \brief Tab for notes on Position
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php';
From 445473f1ca4d09eccb58f1140b15f9f9823d6731 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:46:27 +0200
Subject: [PATCH 133/252] Update position_list.php
---
htdocs/hrm/position_list.php | 50 +-----------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php
index 3877a6ea14d..d6ed72c2612 100644
--- a/htdocs/hrm/position_list.php
+++ b/htdocs/hrm/position_list.php
@@ -25,57 +25,9 @@
* \brief List page for position
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
From a7704d858e25bce58195e1e6d234b143d179bb2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:46:57 +0200
Subject: [PATCH 134/252] Update position_document.php
---
htdocs/hrm/position_document.php | 51 +-------------------------------
1 file changed, 1 insertion(+), 50 deletions(-)
diff --git a/htdocs/hrm/position_document.php b/htdocs/hrm/position_document.php
index 1ae41c193ab..7a820310ee2 100644
--- a/htdocs/hrm/position_document.php
+++ b/htdocs/hrm/position_document.php
@@ -25,57 +25,8 @@
* \brief Tab for documents linked to Position
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
-
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
From c37a5007490c9dbd29fc37079ca1f369c6926a26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:47:22 +0200
Subject: [PATCH 135/252] Update position_contact.php
---
htdocs/hrm/position_contact.php | 30 +-----------------------------
1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/htdocs/hrm/position_contact.php b/htdocs/hrm/position_contact.php
index 56a4fc8ff8f..a7246e3a82b 100644
--- a/htdocs/hrm/position_contact.php
+++ b/htdocs/hrm/position_contact.php
@@ -26,35 +26,7 @@
*/
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
From 8c28751d0354f05cb5adbae58271cf3384b2234b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:47:53 +0200
Subject: [PATCH 136/252] Update position_card.php
---
htdocs/hrm/position_card.php | 54 +-----------------------------------
1 file changed, 1 insertion(+), 53 deletions(-)
diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php
index 8cb8ba9de8c..4e003372a1c 100644
--- a/htdocs/hrm/position_card.php
+++ b/htdocs/hrm/position_card.php
@@ -25,61 +25,9 @@
* \brief Page to create/edit/view position
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
-$tmp2 = realpath(__FILE__);
-$i = strlen($tmp) - 1;
-$j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--;
- $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
From 72418ffbcee44fd1f75beca9b3bcbae57dee7222 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:48:26 +0200
Subject: [PATCH 137/252] Update position_agenda.php
---
htdocs/hrm/position_agenda.php | 50 +---------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php
index 670ec51304b..b3b68d9bcbc 100644
--- a/htdocs/hrm/position_agenda.php
+++ b/htdocs/hrm/position_agenda.php
@@ -25,57 +25,9 @@
* \brief Tab of events on Position
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
From a54fccf933e13264eac4628c28879d19e8870544 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:48:53 +0200
Subject: [PATCH 138/252] Update job_note.php
---
htdocs/hrm/job_note.php | 50 +----------------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/job_note.php b/htdocs/hrm/job_note.php
index 85a1cd1dc84..7205afec247 100644
--- a/htdocs/hrm/job_note.php
+++ b/htdocs/hrm/job_note.php
@@ -25,57 +25,9 @@
* \brief Tab for notes on Job
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
From b1a6094cc15f995568244ad3d4d2065748a1ae1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:49:16 +0200
Subject: [PATCH 139/252] Update job_list.php
---
htdocs/hrm/job_list.php | 50 +----------------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php
index ebd4535e6e7..55363d729b5 100644
--- a/htdocs/hrm/job_list.php
+++ b/htdocs/hrm/job_list.php
@@ -25,57 +25,9 @@
* \brief List page for job
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
From fe78912aee0a0c280d854f4d6963b0411fe5e51f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:49:46 +0200
Subject: [PATCH 140/252] Update job_document.php
---
htdocs/hrm/job_document.php | 51 +------------------------------------
1 file changed, 1 insertion(+), 50 deletions(-)
diff --git a/htdocs/hrm/job_document.php b/htdocs/hrm/job_document.php
index a32f02915e9..a055fbbc325 100644
--- a/htdocs/hrm/job_document.php
+++ b/htdocs/hrm/job_document.php
@@ -25,57 +25,8 @@
* \brief Tab for documents linked to Job
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
-
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
From 2a6e6edc5d4f981f25fc9192746737a9412c100f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:50:07 +0200
Subject: [PATCH 141/252] Update job_contact.php
---
htdocs/hrm/job_contact.php | 30 +-----------------------------
1 file changed, 1 insertion(+), 29 deletions(-)
diff --git a/htdocs/hrm/job_contact.php b/htdocs/hrm/job_contact.php
index cbc961d3f9e..67da8ecfd91 100644
--- a/htdocs/hrm/job_contact.php
+++ b/htdocs/hrm/job_contact.php
@@ -26,35 +26,7 @@
*/
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
From f76a6c024106fb8111b5201bdced44bb25ea38c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:50:41 +0200
Subject: [PATCH 142/252] Update job_card.php
---
htdocs/hrm/job_card.php | 54 +----------------------------------------
1 file changed, 1 insertion(+), 53 deletions(-)
diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php
index 19b40048f7b..23343c5c09b 100644
--- a/htdocs/hrm/job_card.php
+++ b/htdocs/hrm/job_card.php
@@ -25,61 +25,9 @@
* \brief Page to create/edit/view job
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"] . "/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
-$tmp2 = realpath(__FILE__);
-$i = strlen($tmp) - 1;
-$j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--;
- $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)) . "/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1)) . "/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1))) . "/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
From 46cfa7537eb350e568020e139bf4c75c15758f51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?=
Date: Sat, 23 Oct 2021 08:51:15 +0200
Subject: [PATCH 143/252] Update job_agenda.php
---
htdocs/hrm/job_agenda.php | 50 +--------------------------------------
1 file changed, 1 insertion(+), 49 deletions(-)
diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php
index 77dd464a7f0..d7772763d8d 100644
--- a/htdocs/hrm/job_agenda.php
+++ b/htdocs/hrm/job_agenda.php
@@ -25,57 +25,9 @@
* \brief Tab of events on Job
*/
-//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
-//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
-//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
-//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
-//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
-//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
-//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
-//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
-//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
-//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
-//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
-//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
-//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
-//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
-//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
-//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
-//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
-//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
-//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
+require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
From 452a8cfe18199dc81c80cd95cc667b4e9600bf80 Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Sat, 23 Oct 2021 10:27:24 +0200
Subject: [PATCH 144/252] FIX wrong position of error message
---
htdocs/societe/card.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 5c9c0f63e94..e5a624ec07f 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2509,7 +2509,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
print '';
print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
- print ' ';
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' ('.$langs->trans("WrongCustomerCode").') ';
From 9d927973a7651fccbfc51cf5931117ec8c021bd9 Mon Sep 17 00:00:00 2001
From: Nicolas Domenech
Date: Sat, 23 Oct 2021 10:32:50 +0200
Subject: [PATCH 145/252] fix: redirection after creation contact
---
htdocs/contact/card.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 8ae2deae1cf..8493fd03f3c 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -296,7 +296,7 @@ if (empty($reshook)) {
if (empty($error) && $id > 0) {
$db->commit();
if (!empty($backtopage)) {
- $url = $backtopage;
+ $url = str_replace('__ID__', $id, $backtopage);
} else {
$url = 'card.php?id='.$id;
}
From 953a56b08c27fbe72c82b7ffd575241e462fbf81 Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Sat, 23 Oct 2021 10:57:03 +0200
Subject: [PATCH 146/252] Fix: PHP 8.0 Warnings
---
htdocs/compta/bank/list.php | 8 +++++++-
htdocs/core/class/dolgraph.class.php | 4 ++--
htdocs/projet/index.php | 2 --
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index cd6e6cfd365..1463a0c44eb 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -506,6 +506,8 @@ print " \n";
$totalarray = array();
$totalarray['nbfield'] = 0;
+$totalarray['val'] = array('balance'=>0);
+$total = array();
$found = 0;
$i = 0;
$lastcurrencycode = '';
@@ -714,7 +716,11 @@ foreach ($accounts as $key => $type) {
print '';
- $total[$objecttmp->currency_code] += $solde;
+ if (empty($total[$objecttmp->currency_code])) {
+ $total[$objecttmp->currency_code] = $solde;
+ }else{
+ $total[$objecttmp->currency_code] += $solde;
+ }
$i++;
}
diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php
index 26701cde6ff..e52ab780195 100644
--- a/htdocs/core/class/dolgraph.class.php
+++ b/htdocs/core/class/dolgraph.class.php
@@ -1415,12 +1415,12 @@ class DolGraph
$color = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ', 0.9)';
$bordercolor = 'rgb(' . $newcolor[0] . ', ' . $newcolor[1] . ', ' . $newcolor[2] . ')';
} else { // We do not use a 'group by'
- if (is_array($this->datacolor[$i])) {
+ if (!empty($this->bordercolor[$i]) && is_array($this->datacolor[$i])) {
$color = 'rgb(' . $this->datacolor[$i][0] . ', ' . $this->datacolor[$i][1] . ', ' . $this->datacolor[$i][2] . ', 0.9)';
} else {
$color = $this->datacolor[$i];
}
- if (is_array($this->bordercolor[$i])) {
+ if (!empty($this->bordercolor[$i]) && is_array($this->bordercolor[$i])) {
$color = 'rgb(' . $this->bordercolor[$i][0] . ', ' . $this->bordercolor[$i][1] . ', ' . $this->bordercolor[$i][2] . ', 0.9)';
} else {
if ($type != 'horizontalBar') {
diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php
index 213691f4e25..d0e7773a06d 100644
--- a/htdocs/projet/index.php
+++ b/htdocs/projet/index.php
@@ -239,8 +239,6 @@ if ($resql) {
$projectstatic->id = $obj->rowid;
$projectstatic->ref = $obj->ref;
$projectstatic->title = $obj->title;
- $projectstatic->dateo = $obj->dateo;
- $projectstatic->datep = $obj->datep;
$projectstatic->thirdparty_name = $obj->name;
$projectstatic->status = $obj->status;
From 0270d1c1b717f056bc23af566e7d89067e403f2d Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Sat, 23 Oct 2021 10:57:21 +0200
Subject: [PATCH 147/252] fix syntax
---
htdocs/compta/bank/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index 1463a0c44eb..ea656141639 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -718,7 +718,7 @@ foreach ($accounts as $key => $type) {
if (empty($total[$objecttmp->currency_code])) {
$total[$objecttmp->currency_code] = $solde;
- }else{
+ } else {
$total[$objecttmp->currency_code] += $solde;
}
From d1ec71197a6406442f66a125606b9d584e6b3b41 Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Sat, 23 Oct 2021 11:10:58 +0200
Subject: [PATCH 148/252] Fix : scrutinizer errors
---
htdocs/commande/class/api_orders.class.php | 2 +-
htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index 0887c22a8f3..6d0b5a5d297 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -981,6 +981,7 @@ class Orders extends DolibarrApi
if (!DolibarrApiAccess::$user->rights->expedition->lire) {
throw new RestException(401);
}
+ $obj_ret = array();
$sql = "SELECT e.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql .= " JOIN ".MAIN_DB_PREFIX."expeditiondet as edet";
@@ -1054,7 +1055,6 @@ class Orders extends DolibarrApi
if ($result <= 0) {
throw new RestException(500, 'Error on creating expedition lines:'.$this->db->lasterror());
}
- $i++;
}
return $shipment->id;
}
diff --git a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php
index f37bda11104..83acae25b45 100644
--- a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php
+++ b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php
@@ -65,7 +65,7 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
public function loadBox($max = 5)
{
global $conf, $user, $langs;
- $dataseries = "";
+ $dataseries = array();
$graphtoshow = "";
$badgeStatus0 = '#cbd3d3'; // draft
@@ -118,7 +118,6 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
- $dataseries = array();
while ($i < $num) {
$objp = $this->db->fetch_object($resql);
while ($minimumdatecformated < $objp->datec) {
From 6ccd8ce83acde5e10a86b379a0d7466bc6aa4d3c Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Sat, 23 Oct 2021 11:45:06 +0200
Subject: [PATCH 149/252] Fix : PHP errors 8.0
---
htdocs/core/class/html.form.class.php | 2 +-
.../class/DataCollector/DolLogsCollector.php | 2 +-
.../class/DataCollector/DolibarrCollector.php | 12 ++++++------
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 88151e7c288..6293dd9e9ec 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2602,7 +2602,7 @@ class Form
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
- $out .= ajax_combobox($htmlname, $events, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT);
+ $out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
}
$out .= '';
diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php
index 520a0a20a72..220b76f4356 100644
--- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php
+++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php
@@ -73,7 +73,7 @@ class DolLogsCollector extends MessagesCollector
{
global $conf;
- $uselogfile = $conf->global->DEBUGBAR_USE_LOGFILE;
+ $uselogfile = getDolGlobalString("->DEBUGBAR_USE_LOGFILE");
if ($uselogfile) {
$this->getStorageLogs($this->path);
diff --git a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php
index 2e11887360f..c69ebb9a121 100644
--- a/htdocs/debugbar/class/DataCollector/DolibarrCollector.php
+++ b/htdocs/debugbar/class/DataCollector/DolibarrCollector.php
@@ -86,12 +86,12 @@ class DolibarrCollector extends DataCollector implements Renderable, AssetProvid
global $conf, $langs;
global $dolibarr_mailing_limit_sendbyweb;
- $info = $langs->trans('Method').': '.$conf->global->MAIN_MAIL_SENDMODE.' ';
- $info .= $langs->trans('Server').': '.$conf->global->MAIN_MAIL_SMTP_SERVER.' ';
- $info .= $langs->trans('Port').': '.$conf->global->MAIN_MAIL_SMTP_PORT.' ';
- $info .= $langs->trans('ID').': '.$conf->global->MAIN_MAIL_SMTPS_ID.' ';
- $info .= $langs->trans('Pwd').': '.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW).' ';
- $info .= $langs->trans('TLS/STARTTLS').': '.(empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? '' : $conf->global->MAIN_MAIL_EMAIL_TLS).' / '.(empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? '' : $conf->global->MAIN_MAIL_EMAIL_STARTTLS).' ';
+ $info = $langs->trans('Method').': '.getDolGlobalString("MAIN_MAIL_SENDMODE").' ';
+ $info .= $langs->trans('Server').': '.getDolGlobalString("MAIN_MAIL_SMTP_SERVER").' ';
+ $info .= $langs->trans('Port').': '.getDolGlobalString("MAIN_MAIL_SMTP_PORT").' ';
+ $info .= $langs->trans('ID').': '.getDolGlobalString("MAIN_MAIL_SMTPS_IDT").' ';
+ $info .= $langs->trans('Pwd').': '.preg_replace('/./', '*', getDolGlobalString("MAIN_MAIL_SMTPS_PW")).' ';
+ $info .= $langs->trans('TLS/STARTTLS').': '.getDolGlobalString("MAIN_MAIL_EMAIL_TLS").' / '.getDolGlobalString("MAIN_MAIL_EMAIL_STARTTLS").' ';
$info .= $langs->trans('MAIN_DISABLE_ALL_MAILS').': '.(empty($conf->global->MAIN_DISABLE_ALL_MAILS) ? $langs->trans('No') : $langs->trans('Yes')).' ';
$info .= 'dolibarr_mailing_limit_sendbyweb = '.$dolibarr_mailing_limit_sendbyweb.' ';
From 3a9ce1476de52e43e8d0df4bad72ffd763705980 Mon Sep 17 00:00:00 2001
From: Lucas Marcouiller
Date: Sat, 23 Oct 2021 11:45:27 +0200
Subject: [PATCH 150/252] fix error
---
htdocs/debugbar/class/DataCollector/DolLogsCollector.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php
index 220b76f4356..6610c841747 100644
--- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php
+++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php
@@ -73,7 +73,7 @@ class DolLogsCollector extends MessagesCollector
{
global $conf;
- $uselogfile = getDolGlobalString("->DEBUGBAR_USE_LOGFILE");
+ $uselogfile = getDolGlobalString("DEBUGBAR_USE_LOGFILE");
if ($uselogfile) {
$this->getStorageLogs($this->path);
From ce758067281724c5b4218b2fcad2d7e16b4c3f9c Mon Sep 17 00:00:00 2001
From: Philippe GRAND
Date: Sat, 23 Oct 2021 11:46:54 +0200
Subject: [PATCH 151/252] fix scrutinizer : The property datef does not exist
on Facture
---
htdocs/accountancy/customer/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index 24a64bac872..020fbab1e4d 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -613,7 +613,7 @@ if ($result) {
// Ref Invoice
print ''.$facture_static->getNomUrl(1).' ';
- print ''.dol_print_date($db->jdate($facture_static->datef), 'day').' ';
+ print ''.dol_print_date($db->jdate($facture_static->date), 'day').' ';
// Ref Product
print '';
From a95a99afef7d088da15c562c2612b77f6db11153 Mon Sep 17 00:00:00 2001
From: andreubisquerra
Date: Sat, 23 Oct 2021 11:59:40 +0200
Subject: [PATCH 152/252] TakePOS Split Sale fixes and improvements
---
htdocs/takepos/split.php | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/htdocs/takepos/split.php b/htdocs/takepos/split.php
index 4de053513f5..75599d0160f 100644
--- a/htdocs/takepos/split.php
+++ b/htdocs/takepos/split.php
@@ -103,12 +103,10 @@ if ($action=="split") {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid;
- echo $sql;
$db->query($sql);
}
}
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set fk_facture=".$placeid." where rowid=".$line;
- echo $sql;
$db->query($sql);
}
$invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-SPLIT)');
@@ -167,11 +165,11 @@ if ($conf->global->TAKEPOS_COLOR_THEME == 1) {
';
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index a588937e2bf..2e9f0558421 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -3206,6 +3206,7 @@ if (!function_exists("llxFooter")) {
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) {
//print '';
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
+
if (empty($conf->global->MAIN_FIRST_PING_OK_DATE)
|| (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled'))
|| $forceping) {
From b8250be2372b0ef8eee1f1314eef891816584432 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Sun, 24 Oct 2021 16:35:42 +0200
Subject: [PATCH 207/252] css for toolitp
---
htdocs/core/js/lib_foot.js.php | 6 +++---
htdocs/core/lib/functions.lib.php | 4 ++--
htdocs/theme/eldy/global.inc.php | 23 +++++++++++++++++++++++
htdocs/theme/md/style.css.php | 24 ++++++++++++++++++++++++
4 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php
index 1de4fef0176..997132ca132 100644
--- a/htdocs/core/js/lib_foot.js.php
+++ b/htdocs/core/js/lib_foot.js.php
@@ -258,12 +258,12 @@ print '
window.getSelection().removeAllRanges();
/* Show message */
- var lastchild = this.parentNode.lastChild;
+ var lastchild = this.parentNode.lastChild; /* .parentNode is clipboardCP and last child is clipboardCPText */
var tmp = lastchild.innerHTML
if (succeed) {
- lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\';
+ lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'
\';
} else {
- lastchild.innerHTML = \''.dol_escape_js($langs->trans('Error')).'\';
+ lastchild.innerHTML = \''.dol_escape_js($langs->trans('Error')).'
\';
}
setTimeout(() => { lastchild.innerHTML = tmp; }, 1000);
});
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 98a879410b0..7ee19214c64 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -10520,9 +10520,9 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex
$tag = 'span'; // Using div does not work when using the js copy code.
if ($texttoshow) {
- $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'>'.dol_escape_htmltag($texttoshow, 1, 1).' ';
+ $result = '<'.$tag.' class="clipboardCPValue hidewithsize">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'>'.dol_escape_htmltag($texttoshow, 1, 1).' ';
} else {
- $result = '<'.$tag.' class="clipboardCPValue">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'> ';
+ $result = '<'.$tag.' class="clipboardCPValue">'.dol_escape_htmltag($valuetocopy, 1, 1).''.$tag.'> ';
}
return $result;
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index 366e9322dde..91736813d15 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -6879,6 +6879,29 @@ div.clipboardCPValue.hidewithsize {
display: none;
}
+/* To make a div popup, we must use a position aboluste inside a position relative */
+.clipboardCPText {
+ position: relative;
+}
+.clipboardCPTextDivInside {
+ position: absolute;
+ background: #f8f8fa;
+ color: #888;
+ border: 1px solid #E0E0E0;
+ opacity: 1;
+ z-index: 20;
+ padding: 2px;
+ padding-left: 5px;
+ padding-right: 5px;
+ top: -5px;
+ left: 0px;
+ border-radius: 5px;
+ white-space: nowrap;
+ font-size: 0.9em;
+ box-shadow: 1px 1px 6px #ddd;
+}
+
+
/* ============================================================================== */
/* CSS style used for small screen */
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 51e625438fd..1acc8e26ed1 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -6717,6 +6717,30 @@ div.clipboardCPValue.hidewithsize {
display: none;
}
+/* To make a div popup, we must use a position aboluste inside a position relative */
+
+.clipboardCPText {
+ position: relative;
+}
+.clipboardCPTextDivInside {
+ position: absolute;
+ background: #EEE;
+ color: 888;
+ border: 1px solid #DDD;
+ opacity: 1;
+ z-index: 20;
+ padding: 2px;
+ padding-left: 4px;
+ padding-right: 4px;
+ top: -5px;
+ left: 0px;
+ border-radius: 5px;
+ white-space: nowrap;
+ font-size: 0.95em;
+ box-shadow: 1px 1px 6px #ddd;
+}
+
+
/* ============================================================================== */
/* CSS style used for small screen */
From 940c69b46d9f2c90e349090c4d91e976a4fd0fca Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Mon, 25 Oct 2021 12:09:17 +0200
Subject: [PATCH 208/252] Clean code
---
htdocs/core/bookmarks_page.php | 126 +++++++++++++++++++++++++++++++++
htdocs/main.inc.php | 6 +-
2 files changed, 128 insertions(+), 4 deletions(-)
create mode 100644 htdocs/core/bookmarks_page.php
diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php
new file mode 100644
index 00000000000..05ae866463f
--- /dev/null
+++ b/htdocs/core/bookmarks_page.php
@@ -0,0 +1,126 @@
+
+ *
+ * This file is a modified version of datepicker.php from phpBSM to fix some
+ * bugs, to add new features and to dramatically increase speed.
+ *
+ * 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 .
+ */
+
+/**
+ * \file htdocs/core/bookmarks_page.php
+ * \brief File to return a page with the complete list of bookmarks (all search input fields)
+ */
+
+//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
+//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
+if (!defined('NOCSRFCHECK')) {
+ define('NOCSRFCHECK', 1);
+}
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', 1);
+}
+//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', 1);
+}
+//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
+
+require_once '../main.inc.php';
+
+if (GETPOST('lang', 'aZ09')) {
+ $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
+}
+
+$langs->load("main");
+
+$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
+$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
+
+
+/*
+ * View
+ */
+
+$title = $langs->trans("Bookmarks");
+
+// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
+$head = ''."\n";
+$arrayofjs = array();
+$arrayofcss = array();
+top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
+
+
+
+print ''."\n";
+print '';
+//print '
';
+
+$nbofsearch = 0;
+
+// Instantiate hooks of thirdparty module
+$hookmanager->initHooks(array('bookmarks'));
+
+// Define $bookmarks
+$bookmarks = '';
+
+
+$arrayresult = array();
+//include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
+
+$i = 0;
+$accesskeyalreadyassigned = array();
+foreach ($arrayresult as $key => $val) {
+ $tmp = explode('?', $val['url']);
+ $urlaction = $tmp[0];
+ $keysearch = 'search_all';
+
+ $accesskey = '';
+ if (!$accesskeyalreadyassigned[$val['label'][0]]) {
+ $accesskey = $val['label'][0];
+ $accesskeyalreadyassigned[$accesskey] = $accesskey;
+ }
+
+ //$bookmarks .= printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, $val['img'], $showtitlebefore, ($i > 0 ? 0 : 1));
+
+ $i++;
+}
+
+
+// Execute hook printSearchForm
+$parameters = array('bookmarks'=>$bookmarks);
+$reshook = $hookmanager->executeHooks('printBookmarks', $parameters); // Note that $action and $object may have been modified by some hooks
+if (empty($reshook)) {
+ $bookmarks .= $hookmanager->resPrint;
+} else {
+ $bookmarks = $hookmanager->resPrint;
+}
+
+
+print "\n";
+print "\n";
+print '
';
+print '';
+print ''."\n";
+print '
';
+print "\n\n";
+
+print '
';
+print '