Date: Fri, 18 Feb 2022 15:39:56 +0100
Subject: [PATCH 06/62] NEW : JS inventory autocalc input
---
htdocs/product/inventory/inventory.php | 76 +++++++++++++++++++++++---
1 file changed, 67 insertions(+), 9 deletions(-)
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 795e3ad11bb..06c8ae0d2f5 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -1016,20 +1016,15 @@ if ($object->id > 0) {
print '';
//PMP Real
print '';
- print '';
- print img_picto('', 'eraser', 'class="opacitymedium"');
- print ' ';
+
if(! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
else $pmp_real = $product_static->pmp;
$pmp_valuation_real = $pmp_real * $qty_view;
- print ' ';
+ print ' ';
print ' ';
print '';
- print '';
- print img_picto('', 'eraser', 'class="opacitymedium"');
- print ' ';
- print ' ';
+ print ' ';
print ' ';
$totalExpectedValuation += $pmp_valuation;
@@ -1089,7 +1084,7 @@ if ($object->id > 0) {
print '';
print ''.$langs->trans("Total").' ';
print ''.price($totalExpectedValuation).' ';
- print ''.price($totalRealValuation).' ';
+ print ''.price($totalRealValuation).' ';
print ' ';
print ' ';
}
@@ -1115,6 +1110,69 @@ if ($object->id > 0) {
';
}
print '';
+
+
+ if(! empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
+ ?>
+
+
Date: Mon, 21 Feb 2022 14:25:18 +0100
Subject: [PATCH 07/62] new pmp column
---
.../install/mysql/migration/15.0.0-16.0.0.sql | 2 +-
.../mysql/tables/llx_inventorydet-stock.sql | 4 +-
.../inventory/class/inventory.class.php | 4 ++
htdocs/product/inventory/inventory.php | 62 +++++++++++++------
4 files changed, 51 insertions(+), 21 deletions(-)
diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
index 85d8763a4fe..2667ac03e0e 100644
--- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
+++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
@@ -238,5 +238,5 @@ ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget;
ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity);
ALTER TABLE llx_inventorydet ADD COLUMN pmp_real double DEFAULT NULL;
-ALTER TABLE llx_inventorydet ADD COLUMN valuation_real double DEFAULT NULL;
+ALTER TABLE llx_inventorydet ADD COLUMN pmp_expected double DEFAULT NULL;
diff --git a/htdocs/install/mysql/tables/llx_inventorydet-stock.sql b/htdocs/install/mysql/tables/llx_inventorydet-stock.sql
index 5ce878124b6..8999b0e298b 100644
--- a/htdocs/install/mysql/tables/llx_inventorydet-stock.sql
+++ b/htdocs/install/mysql/tables/llx_inventorydet-stock.sql
@@ -29,8 +29,8 @@ CREATE TABLE llx_inventorydet
qty_stock double DEFAULT NULL, -- Value or real stock we have, when we start the inventory (may be updated during intermediary steps).
qty_view double DEFAULT NULL, -- Quantity found during inventory. It is the targeted value, filled during edition of inventory.
qty_regulated double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now.
- pmp_real double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now.
- valuation_real double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now.
+ pmp_real double DEFAULT NULL,
+ pmp_expected double DEFAULT NULL,
fk_movement integer NULL -- can contain the id of stock movement we recorded to make the inventory regulation of this line
)
ENGINE=innodb;
diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php
index 92061972e60..81300d6bac8 100644
--- a/htdocs/product/inventory/class/inventory.class.php
+++ b/htdocs/product/inventory/class/inventory.class.php
@@ -755,6 +755,8 @@ class InventoryLine extends CommonObjectLine
'qty_stock' => array('type'=>'double', 'label'=>'QtyFound', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'Qty we found/want (to define during draft edition)'),
'qty_view' => array('type'=>'double', 'label'=>'QtyBefore', 'visible'=>1, 'enabled'=>1, 'position'=>33, 'index'=>1, 'help'=>'Qty before (filled once movements are validated)'),
'qty_regulated' => array('type'=>'double', 'label'=>'QtyDelta', 'visible'=>1, 'enabled'=>1, 'position'=>34, 'index'=>1, 'help'=>'Qty aadded or removed (filled once movements are validated)'),
+ 'pmp_real' => array('type'=>'double', 'label'=>'PMPReal', 'visible'=>1, 'enabled'=>1, 'position'=>35),
+ 'pmp_expected' => array('type'=>'double', 'label'=>'PMPExpected', 'visible'=>1, 'enabled'=>1, 'position'=>36),
);
/**
@@ -771,6 +773,8 @@ class InventoryLine extends CommonObjectLine
public $qty_stock;
public $qty_view;
public $qty_regulated;
+ public $pmp_real;
+ public $pmp_expected;
/**
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 06c8ae0d2f5..b593fc1b414 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -127,7 +127,7 @@ if (empty($reshook)) {
$db->begin();
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
- $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
+ $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.pmp_real';
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
@@ -176,14 +176,26 @@ if (empty($reshook)) {
$datemovement = '';
//$inventorycode = 'INV'.$object->id;
$inventorycode = 'INV-'.$object->ref;
+ $price = 0;
+ if(!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) $price = $line->pmp_real;
- $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, 0, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch);
+ $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch);
if ($idstockmove < 0) {
$error++;
setEventMessages($stockmovment->error, $stockmovment->errors, 'errors');
break;
}
+ if(!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
+ $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product SET pmp = '.((float) $line->pmp_real).' WHERE rowid = '.((int) $line->fk_product);
+ $resqlpmp = $db->query($sqlpmp);
+ if(! $resqlpmp) {
+ $error++;
+ setEventMessages($db->lasterror(), null, 'errors');
+ break;
+ }
+ }
+
// Update line with id of stock movement (and the start quantity if it has changed this last recording)
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."inventorydet";
$sqlupdate .= " SET fk_movement = ".((int) $idstockmove);
@@ -247,6 +259,8 @@ if (empty($reshook)) {
if ($result > 0) {
$inventoryline->qty_stock = price2num(GETPOST('stock_qty_'.$lineid, 'alpha'), 'MS'); // The new value that was set in as hidden field
$inventoryline->qty_view = $qtytoupdate; // The new value we want
+ $inventoryline->pmp_real = price2num(GETPOST('realpmp_'.$lineid, 'alpha'), 'MS');
+ $inventoryline->pmp_expected = price2num(GETPOST('expectedpmp_'.$lineid, 'alpha'), 'MS');
$resultupdate = $inventoryline->update($user);
}
} else {
@@ -584,6 +598,7 @@ if ($object->id > 0) {
var object = $(this)[0];
var objecttofill = $("#"+object.id+"_input")[0];
objecttofill.value = object.innerText;
+ jQuery(".realqty").trigger("change");
})
console.log("Values filled (after click on fillwithexpected)");
disablebuttonmakemovementandclose();
@@ -829,6 +844,7 @@ if ($object->id > 0) {
$("#clearqty").on("click", function() {
console.log("Clear all values");
jQuery(".realqty").val("");
+ jQuery(".realqty").trigger("change");
return false; /* disable submit */
});
$(".undochangesqty").on("click", function undochangesqty() {
@@ -919,7 +935,7 @@ if ($object->id > 0) {
// Request to show lines of inventory (prefilled after start/validate step)
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
- $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.valuation_real';
+ $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected';
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
@@ -1007,9 +1023,12 @@ if ($object->id > 0) {
print '';
if(! empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
//PMP Expected
- $pmp_valuation = $product_static->pmp * $valuetoshow;
+ if(! empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
+ else $pmp_expected = $product_static->pmp;
+ $pmp_valuation = $pmp_expected * $valuetoshow;
print '';
- print price($product_static->pmp);
+ print price($pmp_expected);
+ print ' ';
print ' ';
print '';
print price($pmp_valuation);
@@ -1021,10 +1040,10 @@ if ($object->id > 0) {
if(! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
else $pmp_real = $product_static->pmp;
$pmp_valuation_real = $pmp_real * $qty_view;
- print ' ';
+ print ' ';
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
$totalExpectedValuation += $pmp_valuation;
@@ -1043,10 +1062,11 @@ if ($object->id > 0) {
print '';
if(!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
//PMP Expected
- $pmp_valuation = $product_static->pmp * $valuetoshow;
- $pmp_valuation_real = $pmp_real * $obj->qty_view;
+ if(! empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
+ else $pmp_expected = $product_static->pmp;
+ $pmp_valuation = $pmp_expected * $valuetoshow;
print '';
- print price($product_static->pmp);
+ print price($pmp_expected);
print ' ';
print '';
print price($pmp_valuation);
@@ -1056,6 +1076,7 @@ if ($object->id > 0) {
print ' ';
if(! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
else $pmp_real = $product_static->pmp;
+ $pmp_valuation_real = $pmp_real * $obj->qty_view;
print price($pmp_real);
print ' ';
print '';
@@ -1117,25 +1138,26 @@ if ($object->id > 0) {
Date: Tue, 22 Feb 2022 10:06:05 +0100
Subject: [PATCH 10/62] WIP dolGetButtonAction
---
htdocs/societe/card.php | 48 +++++++++++++++++++++++++++++++----------
1 file changed, 37 insertions(+), 11 deletions(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index b6c483fc026..d99f080ed24 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2444,10 +2444,29 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$formconfirm = '';
// Confirm delete third party
- if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "action-delete");
+// if ($action == 'delete' ) {
+// var_dump("dlzk,dmz,kdml,zdzd");
+//
+//
+// $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "action-delete");
+// print $formconfirm;
+// }
+
+
+ if ($action == 'delete') {
+ $formquestion = array(
+ array(
+ 'label' => $langs->trans('M456465645y'),
+ 'value' => 'yes',
+ )
+ );
+
+ $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteThirdParty'), $langs->trans('ConfirmDeleteCompany'), 'confirm_delete', '', 0, 2);
}
+
+
+
if ($action == 'merge') {
$formquestion = array(
array(
@@ -2910,15 +2929,25 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($user->socid)) {
if (!empty($object->email) || $at_least_one_email_contact) {
$langs->load("mails");
+ //TODO replace to dolGetButtonAction
+ $params = array(
+ 'attr' => array(
+ 'title' => ''
+ )
+ );
print ''.$langs->trans('SendMail').' '."\n";
+ print dolGetButtonAction($langs->trans('SendMaiAl'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '',true,$params);
} else {
$langs->load("mails");
+ //TODO replace to dolGetButtonAction
print ''.$langs->trans('SendMail').' '."\n";
+ print dolGetButtonAction($langs->trans('SendMaiAl'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle'.newToken(), '',false);
}
}
if ($user->rights->societe->creer) {
- print 'id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").' '."\n";
+ //TODO MODIFIER OK
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
}
if (!empty($conf->adherent->enabled)) {
@@ -2930,16 +2959,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if ($user->rights->societe->supprimer) {
- print ''.$langs->trans('Merge').' '."\n";
- }
+ //TODO FUSIONNER OK
+ print dolGetButtonAction($langs->trans('MergeThirdparties'), '', 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontoadd);
+
- if ($user->rights->societe->supprimer) {
- if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) { // We can't use preloaded confirm form with jmobile
- print ''.$langs->trans('Delete').' '."\n";
- } else {
- print 'id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').' '."\n";
- }
}
+ //TODO SUPPRIMER OK
+ print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->supprimer);
}
print ''."\n";
From b05a5d63b210f3b341bf3017ce0edc3a56d3575d Mon Sep 17 00:00:00 2001
From: GregM
Date: Tue, 22 Feb 2022 11:28:33 +0100
Subject: [PATCH 11/62] WIP dolGetButtonAction
---
htdocs/societe/card.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index d99f080ed24..9b097bfab99 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2929,14 +2929,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($user->socid)) {
if (!empty($object->email) || $at_least_one_email_contact) {
$langs->load("mails");
- //TODO replace to dolGetButtonAction
+ //TODO ENVOYER EMAIL
$params = array(
'attr' => array(
'title' => ''
)
);
- print ''.$langs->trans('SendMail').' '."\n";
- print dolGetButtonAction($langs->trans('SendMaiAl'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '',true,$params);
+ //print ''.$langs->trans('SendMail').' '."\n";
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '',true,$params);
} else {
$langs->load("mails");
//TODO replace to dolGetButtonAction
@@ -2947,7 +2947,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($user->rights->societe->creer) {
//TODO MODIFIER OK
- print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd,$params);
}
if (!empty($conf->adherent->enabled)) {
@@ -2965,7 +2965,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
//TODO SUPPRIMER OK
- print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->supprimer);
+ print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->supprimer,$params);
}
print ''."\n";
From 69bb3aaad19884c7c54bae6f9238329899ec692e Mon Sep 17 00:00:00 2001
From: GregM
Date: Tue, 22 Feb 2022 11:35:55 +0100
Subject: [PATCH 12/62] WIP dolGetButtonAction
---
htdocs/societe/card.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 9b097bfab99..ece24428a2e 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2940,8 +2940,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} else {
$langs->load("mails");
//TODO replace to dolGetButtonAction
- print ''.$langs->trans('SendMail').' '."\n";
- print dolGetButtonAction($langs->trans('SendMaiAl'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle'.newToken(), '',false);
+ //print ''.$langs->trans('SendMail').' '."\n";
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle'.newToken(), '',false);
}
}
@@ -2960,7 +2960,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($user->rights->societe->supprimer) {
//TODO FUSIONNER OK
- print dolGetButtonAction($langs->trans('MergeThirdparties'), '', 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('MergeThirdparties'), '', 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontoadd, $params);
}
From b0473c475a2d62518605bf79ce2866cd59a85128 Mon Sep 17 00:00:00 2001
From: GregM
Date: Tue, 22 Feb 2022 11:48:35 +0100
Subject: [PATCH 13/62] wip dolGetButtonAction
---
htdocs/societe/card.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index ece24428a2e..7123bd1d18c 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2941,7 +2941,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$langs->load("mails");
//TODO replace to dolGetButtonAction
//print ''.$langs->trans('SendMail').' '."\n";
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle'.newToken(), '',false);
+ $params['attr']['title'] = $langs->trans('NoEMail');
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle'.newToken(), '',false,$params);
}
}
From 059548105c83d0b1d06aa7c85e68c99f4fec01b5 Mon Sep 17 00:00:00 2001
From: GregM
Date: Tue, 22 Feb 2022 12:14:18 +0100
Subject: [PATCH 14/62] WIP dolGetButtonAction
---
htdocs/societe/card.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 7123bd1d18c..4a3a33af83f 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2948,7 +2948,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($user->rights->societe->creer) {
//TODO MODIFIER OK
- print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd,$params);
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
}
if (!empty($conf->adherent->enabled)) {
@@ -2961,12 +2961,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($user->rights->societe->supprimer) {
//TODO FUSIONNER OK
- print dolGetButtonAction($langs->trans('MergeThirdparties'), '', 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontoadd, $params);
+ print dolGetButtonAction($langs->trans('MergeThirdparties'), $langs->trans('Merge'), 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontoadd);
}
//TODO SUPPRIMER OK
- print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->supprimer,$params);
+ print dolGetButtonAction('', $langs->trans('Delete'),'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->supprimer);
}
print ''."\n";
From e21a9bdd7d832f6ef859af6e0c716f7170c68b78 Mon Sep 17 00:00:00 2001
From: GregM
Date: Wed, 23 Feb 2022 09:25:43 +0100
Subject: [PATCH 15/62] WIP dolGetButtonAction lib
---
htdocs/core/lib/functions.lib.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 7be3f5e3351..9a866303eb3 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9965,6 +9965,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
if (empty($html)) {
$html = $label;
+ $attr['title'] = ''; // if html not set, leave label on title is redundant
} else {
$attr['aria-label'] = $label;
}
From 5dcb4c85ee0ced5776dcf6aec36e4d48d5113297 Mon Sep 17 00:00:00 2001
From: GregM
Date: Wed, 23 Feb 2022 10:03:48 +0100
Subject: [PATCH 16/62] fix dolGetButtonAction societe card
---
htdocs/societe/card.php | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 4a3a33af83f..8c1c0102e30 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2444,15 +2444,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$formconfirm = '';
// Confirm delete third party
-// if ($action == 'delete' ) {
-// var_dump("dlzk,dmz,kdml,zdzd");
-//
-//
-// $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "action-delete");
-// print $formconfirm;
-// }
-
-
if ($action == 'delete') {
$formquestion = array(
array(
@@ -2929,25 +2920,20 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($user->socid)) {
if (!empty($object->email) || $at_least_one_email_contact) {
$langs->load("mails");
- //TODO ENVOYER EMAIL
$params = array(
'attr' => array(
'title' => ''
)
);
- //print ''.$langs->trans('SendMail').' '."\n";
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '',true,$params);
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params);
} else {
$langs->load("mails");
- //TODO replace to dolGetButtonAction
- //print ''.$langs->trans('SendMail').' '."\n";
$params['attr']['title'] = $langs->trans('NoEMail');
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle'.newToken(), '',false,$params);
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle'.newToken(), '', false, $params);
}
}
if ($user->rights->societe->creer) {
- //TODO MODIFIER OK
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
}
@@ -2960,13 +2946,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if ($user->rights->societe->supprimer) {
- //TODO FUSIONNER OK
print dolGetButtonAction($langs->trans('MergeThirdparties'), $langs->trans('Merge'), 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontoadd);
-
-
}
- //TODO SUPPRIMER OK
- print dolGetButtonAction('', $langs->trans('Delete'),'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->supprimer);
+ print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->supprimer);
}
print ''."\n";
From f866f9641e1898c6178cd3004894955891709532 Mon Sep 17 00:00:00 2001
From: GregM
Date: Wed, 23 Feb 2022 10:12:43 +0100
Subject: [PATCH 17/62] update change on another PR
---
htdocs/core/lib/functions.lib.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 9a866303eb3..7be3f5e3351 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9965,7 +9965,6 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
if (empty($html)) {
$html = $label;
- $attr['title'] = ''; // if html not set, leave label on title is redundant
} else {
$attr['aria-label'] = $label;
}
From b95460844396600d4f49b1cf5206233e24a0ce41 Mon Sep 17 00:00:00 2001
From: GregM
Date: Wed, 23 Feb 2022 12:09:15 +0100
Subject: [PATCH 18/62] Update card
---
htdocs/societe/card.php | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 8c1c0102e30..995e731cdca 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2447,12 +2447,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($action == 'delete') {
$formquestion = array(
array(
- 'label' => $langs->trans('M456465645y'),
'value' => 'yes',
)
);
- $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteThirdParty'), $langs->trans('ConfirmDeleteCompany'), 'confirm_delete', '', 0, 2);
+ $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteACompany'), $langs->trans('ConfirmDeleteCompany'), 'confirm_delete', '', 0, 2);
}
@@ -2933,9 +2932,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
}
- if ($user->rights->societe->creer) {
- print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
- }
+ print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
if (!empty($conf->adherent->enabled)) {
$adh = new Adherent($db);
@@ -2945,10 +2942,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
}
+ print dolGetButtonAction($langs->trans('MergeThirdparties'), $langs->trans('Merge'), 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontodelete);
+
if ($user->rights->societe->supprimer) {
- print dolGetButtonAction($langs->trans('MergeThirdparties'), $langs->trans('Merge'), 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontoadd);
+ if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) { // We can't use preloaded confirm form with jmobile
+ print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), 'action-delete', $permissiontodelete);
+ } else {
+ print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete);
+ }
}
- print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $user->rights->societe->supprimer);
}
print ''."\n";
From 74bfdb0842f9e45b8e5a9e1b653ff7f00bcedc10 Mon Sep 17 00:00:00 2001
From: GregM
Date: Wed, 23 Feb 2022 15:34:17 +0100
Subject: [PATCH 19/62] fix retour
---
htdocs/societe/card.php | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 995e731cdca..3a9fcaff07b 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2917,19 +2917,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if (empty($user->socid)) {
- if (!empty($object->email) || $at_least_one_email_contact) {
- $langs->load("mails");
- $params = array(
- 'attr' => array(
- 'title' => ''
- )
- );
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params);
- } else {
- $langs->load("mails");
- $params['attr']['title'] = $langs->trans('NoEMail');
- print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle'.newToken(), '', false, $params);
- }
+ $langs->load("mails");
+ $title = '';
+ if (empty($object->email) && !$at_least_one_email_contact) { $title = $langs->trans('NoEMail'); }
+ print dolGetButtonAction($title, $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', 'btn-send-mail', !empty($object->email) || $at_least_one_email_contact);
}
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
@@ -2945,11 +2936,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print dolGetButtonAction($langs->trans('MergeThirdparties'), $langs->trans('Merge'), 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontodelete);
if ($user->rights->societe->supprimer) {
+ $deleteUrl = $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken();
+ $buttonId = 'action-delete-no-ajax';
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) { // We can't use preloaded confirm form with jmobile
- print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), 'action-delete', $permissiontodelete);
- } else {
- print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete);
+ $deleteUrl = '';
+ $buttonId = 'action-delete';
}
+ print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteUrl, $buttonId, $permissiontodelete);
}
}
From 114827934eac8374cfa02f627f282f9139ba9305 Mon Sep 17 00:00:00 2001
From: GregM
Date: Wed, 23 Feb 2022 15:51:44 +0100
Subject: [PATCH 20/62] Fix merge conflict
---
htdocs/societe/card.php | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index d598e310aaf..25b48936341 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2455,19 +2455,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$formconfirm = '';
// Confirm delete third party
- if ($action == 'delete') {
- $formquestion = array(
- array(
- 'value' => 'yes',
- )
- );
-
- $formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteACompany'), $langs->trans('ConfirmDeleteCompany'), 'confirm_delete', '', 0, 2);
+ if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) {
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "action-delete");
}
-
-
-
if ($action == 'merge') {
$formquestion = array(
array(
From 6462fd83067f07f9a7a667fcd3f7b55668be0c4a Mon Sep 17 00:00:00 2001
From: Quentin VIAL-GOUTEYRON
Date: Mon, 28 Mar 2022 16:02:18 +0200
Subject: [PATCH 21/62] update pmp real even if it's not edit
---
htdocs/product/inventory/inventory.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 536aaf7d354..895ff8105cd 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -268,6 +268,8 @@ if (empty($reshook)) {
$result = $inventoryline->fetch($lineid);
if ($result > 0) {
$inventoryline->qty_view = null; // The new value we want
+ $inventoryline->pmp_real = price2num(GETPOST('realpmp_'.$lineid, 'alpha'), 'MS');
+ $inventoryline->pmp_expected = price2num(GETPOST('expectedpmp_'.$lineid, 'alpha'), 'MS');
$resultupdate = $inventoryline->update($user);
}
}
From ca7ecfbb579e6115b78698ef16ddde56d5bc5076 Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Tue, 29 Mar 2022 11:06:18 +0200
Subject: [PATCH 22/62] FIX avoid warning for missing cookie samesite params
(and more secure)
---
htdocs/main.inc.php | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index fe0986e8d13..c13f7cbe2c9 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -265,10 +265,22 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) {
$cookiearrayvalue[$tmpkey] = $_POST[$postkey];
}
}
- $cookiename = $tmpautoset[0];
+ $cookiename = (empty($dolibarr_main_force_https) ? $tmpautoset[0] : '__Secure-'.$tmpautoset[0]); // __Secure- || __Host-
$cookievalue = json_encode($cookiearrayvalue);
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
- setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // keep cookie 1 year and add tag httponly
+ if (PHP_VERSION_ID < 70300) {
+ setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // keep cookie 1 year and add tag httponly
+ } else {
+ $cookieparams = array(
+ 'expires' => empty($cookievalue) ? 0 : (time() + (86400 * 354)),
+ 'path' => '/',
+ //'domain' => '.mywebsite.com', // the dot at the beginning allows compatibility with subdomains
+ 'secure' => (empty($dolibarr_main_force_https) ? false : true),
+ 'httponly' => true,
+ 'samesite' => 'Lax' // None || Lax || Strict
+ );
+ setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, $cookieparams);
+ }
if (empty($cookievalue)) {
unset($_COOKIE[$cookiename]);
}
@@ -284,7 +296,7 @@ if (!empty($php_session_save_handler) && $php_session_save_handler == 'db') {
// Must be done after the include of filefunc.inc.php so global variables of conf file are defined (like $dolibarr_main_instance_unique_id or $dolibarr_main_force_https).
// Note: the function dol_getprefix() is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect.
$prefix = dol_getprefix('');
-$sessionname = 'DOLSESSID_'.$prefix;
+$sessionname = (empty($dolibarr_main_force_https) ? 'DOLSESSID_'.$prefix : '__Secure-DOLSESSID_'.$prefix); // __Secure- || __Host-
$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
if (!empty($_COOKIE[$sessiontimeout])) {
ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
@@ -293,7 +305,19 @@ if (!empty($_COOKIE[$sessiontimeout])) {
// This create lock, released by session_write_close() or end of page.
// We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished.
if (!defined('NOSESSION')) {
- session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
+ if (PHP_VERSION_ID < 70300) {
+ session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
+ } else {
+ $sessioncookieparams = array(
+ 'lifetime' => 0,
+ 'path' => '/',
+ //'domain' => '.mywebsite.com', // the dot at the beginning allows compatibility with subdomains
+ 'secure' => (empty($dolibarr_main_force_https) ? false : true),
+ 'httponly' => true,
+ 'samesite' => 'Lax' // None || Lax || Strict
+ );
+ session_set_cookie_params($sessioncookieparams);
+ }
session_name($sessionname);
session_start(); // This call the open and read of session handler
//exit; // this exist generates a call to write and close
From b7d6436e339a9e2653344620abd3e5567afc341a Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Tue, 29 Mar 2022 11:10:41 +0200
Subject: [PATCH 23/62] FIX add doc
---
htdocs/main.inc.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index c13f7cbe2c9..eba557ffe17 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -271,6 +271,7 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) {
if (PHP_VERSION_ID < 70300) {
setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // keep cookie 1 year and add tag httponly
} else {
+ // Only available for php >= 7.3
$cookieparams = array(
'expires' => empty($cookievalue) ? 0 : (time() + (86400 * 354)),
'path' => '/',
@@ -308,6 +309,7 @@ if (!defined('NOSESSION')) {
if (PHP_VERSION_ID < 70300) {
session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
} else {
+ // Only available for php >= 7.3
$sessioncookieparams = array(
'lifetime' => 0,
'path' => '/',
From 29a4e7c725612b08c898eb3830f23d2010ff83e3 Mon Sep 17 00:00:00 2001
From: Regis Houssin
Date: Tue, 29 Mar 2022 12:03:18 +0200
Subject: [PATCH 24/62] FIX check if https or not
---
htdocs/main.inc.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index eba557ffe17..e66c9e9d313 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -265,18 +265,18 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) {
$cookiearrayvalue[$tmpkey] = $_POST[$postkey];
}
}
- $cookiename = (empty($dolibarr_main_force_https) ? $tmpautoset[0] : '__Secure-'.$tmpautoset[0]); // __Secure- || __Host-
+ $cookiename = ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? $tmpautoset[0] : '__Secure-'.$tmpautoset[0]); // __Secure- || __Host-
$cookievalue = json_encode($cookiearrayvalue);
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
if (PHP_VERSION_ID < 70300) {
- setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // keep cookie 1 year and add tag httponly
+ setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), true); // keep cookie 1 year and add tag httponly
} else {
// Only available for php >= 7.3
$cookieparams = array(
'expires' => empty($cookievalue) ? 0 : (time() + (86400 * 354)),
'path' => '/',
//'domain' => '.mywebsite.com', // the dot at the beginning allows compatibility with subdomains
- 'secure' => (empty($dolibarr_main_force_https) ? false : true),
+ 'secure' => ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true),
'httponly' => true,
'samesite' => 'Lax' // None || Lax || Strict
);
@@ -297,7 +297,7 @@ if (!empty($php_session_save_handler) && $php_session_save_handler == 'db') {
// Must be done after the include of filefunc.inc.php so global variables of conf file are defined (like $dolibarr_main_instance_unique_id or $dolibarr_main_force_https).
// Note: the function dol_getprefix() is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect.
$prefix = dol_getprefix('');
-$sessionname = (empty($dolibarr_main_force_https) ? 'DOLSESSID_'.$prefix : '__Secure-DOLSESSID_'.$prefix); // __Secure- || __Host-
+$sessionname = ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? 'DOLSESSID_'.$prefix : '__Secure-DOLSESSID_'.$prefix); // __Secure- || __Host-
$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
if (!empty($_COOKIE[$sessiontimeout])) {
ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
@@ -307,14 +307,14 @@ if (!empty($_COOKIE[$sessiontimeout])) {
// We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished.
if (!defined('NOSESSION')) {
if (PHP_VERSION_ID < 70300) {
- session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
+ session_set_cookie_params(0, '/', null, ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
} else {
// Only available for php >= 7.3
$sessioncookieparams = array(
'lifetime' => 0,
'path' => '/',
//'domain' => '.mywebsite.com', // the dot at the beginning allows compatibility with subdomains
- 'secure' => (empty($dolibarr_main_force_https) ? false : true),
+ 'secure' => ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true),
'httponly' => true,
'samesite' => 'Lax' // None || Lax || Strict
);
From 67e7c91c3ed34b1c8a0f94c0e5032e4ee7ce8edb Mon Sep 17 00:00:00 2001
From: Quentin VIAL-GOUTEYRON
Date: Mon, 11 Apr 2022 15:47:38 +0200
Subject: [PATCH 25/62] pmp inventory conf MAIN_PRODUCT_PERENTITY_SHARED
---
htdocs/product/inventory/inventory.php | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 2b21de99079..77cdc965164 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -194,6 +194,15 @@ if (empty($reshook)) {
setEventMessages($db->lasterror(), null, 'errors');
break;
}
+ if(!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
+ $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product_perentity SET pmp = '.((float) $line->pmp_real).' WHERE fk_product = '.((int) $line->fk_product).' AND entity='.$conf->entity;
+ $resqlpmp = $db->query($sqlpmp);
+ if (! $resqlpmp) {
+ $error++;
+ setEventMessages($db->lasterror(), null, 'errors');
+ break;
+ }
+ }
}
// Update line with id of stock movement (and the start quantity if it has changed this last recording)
From ddb50264aeb5c132ec89aa39c09c074f0b65e234 Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Mon, 11 Apr 2022 13:58:59 +0000
Subject: [PATCH 26/62] Fixing style errors.
---
htdocs/product/inventory/inventory.php | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 77cdc965164..9cef5671041 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -194,15 +194,15 @@ if (empty($reshook)) {
setEventMessages($db->lasterror(), null, 'errors');
break;
}
- if(!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
- $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product_perentity SET pmp = '.((float) $line->pmp_real).' WHERE fk_product = '.((int) $line->fk_product).' AND entity='.$conf->entity;
- $resqlpmp = $db->query($sqlpmp);
- if (! $resqlpmp) {
- $error++;
- setEventMessages($db->lasterror(), null, 'errors');
- break;
- }
- }
+ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
+ $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product_perentity SET pmp = '.((float) $line->pmp_real).' WHERE fk_product = '.((int) $line->fk_product).' AND entity='.$conf->entity;
+ $resqlpmp = $db->query($sqlpmp);
+ if (! $resqlpmp) {
+ $error++;
+ setEventMessages($db->lasterror(), null, 'errors');
+ break;
+ }
+ }
}
// Update line with id of stock movement (and the start quantity if it has changed this last recording)
From 89b7c8298b4f7f27b4d3b08079014826437677a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alo=C3=AFs=20Micard?=
Date: Mon, 11 Apr 2022 17:25:45 +0200
Subject: [PATCH 27/62] Module builder: Translate permissions label
---
htdocs/modulebuilder/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index f3922aa6342..f8abd703bf0 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -3008,7 +3008,7 @@ if ($module == 'initmodule')
print ' ';
print '';
- print $perm[1];
+ print $langs->trans($perm[1]);
print ' ';
print '';
From 9547b9e7febb4312bd491d6d3e089d0eb7c521e3 Mon Sep 17 00:00:00 2001
From: Ferran Marcet
Date: Mon, 11 Apr 2022 18:01:25 +0200
Subject: [PATCH 28/62] Fix: Online signature of proposals does not work well
with multicompany
---
htdocs/core/ajax/onlineSign.php | 4 ++++
htdocs/public/onlinesign/newonlinesign.php | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php
index 5110918541f..ce9ae57864d 100644
--- a/htdocs/core/ajax/onlineSign.php
+++ b/htdocs/core/ajax/onlineSign.php
@@ -48,6 +48,10 @@ if (!defined('NOIPCHECK')) {
if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1');
}
+$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
+if (is_numeric($entity)) {
+ define("DOLENTITY", $entity);
+}
include '../../main.inc.php';
$action = GETPOST('action', 'aZ09');
diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php
index 8bd95d23c8d..2a9ed568fe8 100644
--- a/htdocs/public/onlinesign/newonlinesign.php
+++ b/htdocs/public/onlinesign/newonlinesign.php
@@ -431,11 +431,12 @@ if ($action == "dosign" && empty($cancel)) {
"ref" : \''.dol_escape_js($REF).'\',
"securekey" : \''.dol_escape_js($SECUREKEY).'\',
"mode" : \''.dol_escape_htmltag($source).'\',
+ "entity" : \''.dol_escape_htmltag($entity).'\',
},
success: function(response) {
if(response == "success"){
console.log("Success on saving signature");
- window.location.replace("'.$_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&message=signed&securekey='.urlencode($SECUREKEY).'");
+ window.location.replace("'.$_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&message=signed&securekey='.urlencode($SECUREKEY).($conf->multicompany->enabled?'&entity='.$entity:'').'");
}else{
console.error(response);
}
From 62b74962535ed38c424e569d9dbd79b25653ab16 Mon Sep 17 00:00:00 2001
From: Ferran Marcet
Date: Mon, 11 Apr 2022 18:26:49 +0200
Subject: [PATCH 29/62] Fix: Direct download don't work with multicompany
---
htdocs/document.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/htdocs/document.php b/htdocs/document.php
index 060722e8d5b..fc894091615 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2010 Pierre Morin
* Copyright (C) 2010 Juanjo Menent
+ * Copyright (C) 2022 Ferran Marcet
*
* 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
@@ -140,6 +141,11 @@ if (!empty($hashp))
$modulepart = $moduleparttocheck;
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
}
+ $entity = $ecmfile->entity;
+ if ($entity != $conf->entity) {
+ $conf->entity = $entity;
+ $conf->setValues($db);
+ }
} else {
$langs->load("errors");
accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1);
From b8bccd62efa45ce1617eaa3d4a0278c3d3305adc Mon Sep 17 00:00:00 2001
From: Ferran Marcet
Date: Mon, 11 Apr 2022 18:41:36 +0200
Subject: [PATCH 30/62] Update newonlinesign.php
---
htdocs/public/onlinesign/newonlinesign.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php
index 2a9ed568fe8..d1020dc2c1d 100644
--- a/htdocs/public/onlinesign/newonlinesign.php
+++ b/htdocs/public/onlinesign/newonlinesign.php
@@ -193,7 +193,7 @@ $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '' : '').'
';
llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1);
if ($action == 'refusepropal') {
- print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1);
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).($conf->multicompany->enabled?'&entity='.$entity:''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1);
}
// Check link validity for param 'source' to avoid use of the examples as value
From f679392d26ad3f902c9f42d0e38f6a5c897e29d1 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Tue, 12 Apr 2022 02:26:37 +0200
Subject: [PATCH 31/62] FIX missing picto in combo of mass actions of
thirdparties.
---
htdocs/societe/list.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index da056ec33da..bdc0fae08e0 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -870,10 +870,10 @@ if ($user->rights->societe->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if ($user->rights->societe->creer) {
- $arrayofmassactions['preenable'] = img_picto('', '', 'class="pictofixedwidth"').$langs->trans("SetToEnabled");
+ $arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToEnabled");
}
if ($user->rights->societe->creer) {
- $arrayofmassactions['predisable'] = img_picto('', '', 'class="pictofixedwidth"').$langs->trans("SetToDisabled");
+ $arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToDisabled");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
$arrayofmassactions = array();
From cfe554b04cbec7987f1f4b8951ba75a9d87a3831 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Tue, 12 Apr 2022 03:08:31 +0200
Subject: [PATCH 32/62] Fix var not defined
---
htdocs/modulebuilder/index.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 872a88b28aa..39f70d30d2d 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -46,6 +46,9 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
+$sortfield = '';
+$sortorder = '';
+
$module = GETPOST('module', 'alpha');
$tab = GETPOST('tab', 'aZ09');
$tabobj = GETPOST('tabobj', 'alpha');
From f4023b4e44160e0861eb09a0d0d407e5420575e3 Mon Sep 17 00:00:00 2001
From: kevin
Date: Tue, 12 Apr 2022 11:08:50 +0200
Subject: [PATCH 33/62] Add missing entity on salary's payment
---
htdocs/salaries/class/paymentsalary.class.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php
index 76236bb88aa..506e9b73ea5 100644
--- a/htdocs/salaries/class/paymentsalary.class.php
+++ b/htdocs/salaries/class/paymentsalary.class.php
@@ -164,9 +164,9 @@ class PaymentSalary extends CommonObject
$this->db->begin();
if ($totalamount != 0) {
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_salary, datec, datep, amount,";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (entity, fk_salary, datec, datep, amount,";
$sql .= " fk_typepayment, num_payment, note, fk_user_author, fk_bank)";
- $sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
+ $sql .= " VALUES (".$conf->entity.", ".$this->chid.", '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datepaye)."',";
$sql .= " ".price2num($totalamount).",";
$sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".((int) $user->id).",";
From a6407257dd2752b6f2931f43b0c4bcdf9b1ffe05 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alo=C3=AFs=20Micard?=
Date: Tue, 12 Apr 2022 11:11:26 +0200
Subject: [PATCH 34/62] Allow to view tabs in module builder
---
htdocs/langs/en_US/modulebuilder.lang | 5 +-
htdocs/modulebuilder/index.php | 127 ++++++++++++++++++++++++++
2 files changed, 131 insertions(+), 1 deletion(-)
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 7ba539d3bd4..6376024ea0b 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -143,4 +143,7 @@ AsciiToHtmlConverter=Ascii to HTML converter
AsciiToPdfConverter=Ascii to PDF converter
TableNotEmptyDropCanceled=Table not empty. Drop has been canceled.
ModuleBuilderNotAllowed=The module builder is available but not allowed to your user.
-ImportExportProfiles=Import and export profiles
\ No newline at end of file
+ImportExportProfiles=Import and export profiles
+ListOfTabsEntries=List of tab entries
+TabsDefDesc= Define here the tabs provided by your module
+TabsDefDescTooltip=The tabs provided by your module/application are defined into the array $this->tabs into the module descriptor file. You can edit manually this file or use the embedded editor.
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 82567e05fac..16671ddf137 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1931,6 +1931,11 @@ if ($module == 'initmodule') {
$head2[$h][2] = 'permissions';
$h++;
+ $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=tabs&module='.$module.($forceddirread ? '@'.$dirread : '');
+ $head2[$h][1] = $langs->trans("Tabs");
+ $head2[$h][2] = 'tabs';
+ $h++;
+
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread ? '@'.$dirread : '');
$head2[$h][1] = $langs->trans("Menus");
$head2[$h][2] = 'menus';
@@ -3902,6 +3907,128 @@ if ($module == 'initmodule') {
print '';
}
+ if ($tab == 'tabs') {
+ $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
+
+ $tabs = $moduleobj->tabs;
+
+ if ($action != 'editfile' || empty($file)) {
+ print '';
+ $htmlhelp = $langs->trans("TabsDefDescTooltip", '{s1}');
+ $htmlhelp = str_replace('{s1}', ''.$langs->trans('Setup').' - '.$langs->trans('Tabs').' ', $htmlhelp);
+ print $form->textwithpicto($langs->trans("TabsDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').' ';
+ print ' ';
+ print ' ';
+
+ print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.' ';
+ print ' '.img_picto($langs->trans("Edit"), 'edit').' ';
+ print ' ';
+
+ print ' ';
+ print load_fiche_titre($langs->trans("ListOfTabsEntries"), '', '');
+
+ print '';
+ } else {
+ $fullpathoffile = dol_buildpath($file, 0);
+
+ $content = file_get_contents($fullpathoffile);
+
+ // New module
+ print '';
+ }
+ }
+
if ($tab != 'description') {
print dol_get_fiche_end();
}
From 25a851ac70f70df00e5408e344b26b3b5a979c49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alo=C3=AFs=20Micard?=
Date: Tue, 12 Apr 2022 11:12:43 +0200
Subject: [PATCH 35/62] Fix translation
---
htdocs/langs/en_US/modulebuilder.lang | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang
index 6376024ea0b..5544c2b932a 100644
--- a/htdocs/langs/en_US/modulebuilder.lang
+++ b/htdocs/langs/en_US/modulebuilder.lang
@@ -145,5 +145,5 @@ TableNotEmptyDropCanceled=Table not empty. Drop has been canceled.
ModuleBuilderNotAllowed=The module builder is available but not allowed to your user.
ImportExportProfiles=Import and export profiles
ListOfTabsEntries=List of tab entries
-TabsDefDesc= Define here the tabs provided by your module
+TabsDefDesc=Define here the tabs provided by your module
TabsDefDescTooltip=The tabs provided by your module/application are defined into the array $this->tabs into the module descriptor file. You can edit manually this file or use the embedded editor.
From a747f574b3dc5144e9e695f1ec42d19935ca1ebf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alo=C3=AFs=20Micard?=
Date: Tue, 12 Apr 2022 11:15:40 +0200
Subject: [PATCH 36/62] Improve comment
---
htdocs/modulebuilder/index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 16671ddf137..14385864b6b 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -3957,7 +3957,7 @@ if ($module == 'initmodule') {
$condition = isset($parts[4]) ? $parts[4] : '';
$path = isset($parts[5]) ? $parts[5] : '';
- // If we want to remove the tab, then the format is 'tabname:optionalcondition'
+ // If we want to remove the tab, then the format is 'objecttype:tabname:optionalcondition'
// See: https://wiki.dolibarr.org/index.php?title=Tabs_system#To_remove_an_existing_tab
if ($tabName[0] === '-') {
$tabTitle = '';
From 752cc6f4a7adbc4fd791ef6229ce28feb5c8569d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alo=C3=AFs=20Micard?=
Date: Tue, 12 Apr 2022 11:17:24 +0200
Subject: [PATCH 37/62] Lint source code
---
htdocs/modulebuilder/index.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 14385864b6b..937ef6d83fb 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -3971,10 +3971,11 @@ if ($module == 'initmodule') {
print ' ';
print '';
- if ($tabName[0] === "+")
+ if ($tabName[0] === "+") {
print '' . dol_escape_htmltag($tabName) . ' ';
- else
+ } else {
print '' . dol_escape_htmltag($tabName) . ' ';
+ }
print ' ';
print '';
From a006eaecdeac66bf6f1c67112a9dde9e77e8029e Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Tue, 12 Apr 2022 13:02:33 +0200
Subject: [PATCH 38/62] Fix trans
---
htdocs/adherents/list.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 996f2d16c8d..441ce85ec86 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -482,7 +482,7 @@ if (GETPOSTISSET("search_status")) {
$titre = $langs->trans("MembersListToValid");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
- $titre = $langs->trans("MembersValidated");
+ $titre = $langs->trans("MenuMembersValidated");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
$titre = $langs->trans("MembersWithSubscriptionToReceive");
From d41676cf8bd71789a90eeb08ed66f72cdf0f1de9 Mon Sep 17 00:00:00 2001
From: lmarcouiller
Date: Tue, 12 Apr 2022 13:57:00 +0200
Subject: [PATCH 39/62] Close #20609 : new massaction asign sale representative
---
htdocs/core/actions_massactions.inc.php | 38 +++++++++++++++++++++++++
htdocs/core/tpl/massactions_pre.tpl.php | 10 ++++++-
htdocs/langs/en_US/main.lang | 4 +++
htdocs/societe/list.php | 3 ++
4 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index c5ff1d8f82a..5ec011f5017 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -1602,6 +1602,44 @@ if (!$error && ($massaction == 'disable' || ($action == 'disable' && $confirm ==
}
}
+if (!$error && ($massaction == 'affectcommercial' || ($action == 'affectcommercial' && $confirm == 'yes')) && $permissiontoadd) {
+ $db->begin();
+
+ $objecttmp = new $objectclass($db);
+ $nbok = 0;
+
+ foreach ($toselect as $toselectid) {
+ $result = $objecttmp->fetch($toselectid);
+ if ($result>0) {
+ if (in_array($objecttmp->element, array('societe'))) {
+ $result = $objecttmp->setSalesRep(GETPOST("commercial", "alpha"));
+ }
+ if ($result <= 0) {
+ setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
+ $error++;
+ break;
+ } else {
+ $nbok++;
+ }
+ } else {
+ setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
+ $error++;
+ break;
+ }
+ }
+
+ if (!$error) {
+ if ($nbok > 1) {
+ setEventMessages($langs->trans("CommercialsAffected", $nbok), null, 'mesgs');
+ } else {
+ setEventMessages($langs->trans("CommercialAffected"), null, 'mesgs');
+ }
+ $db->commit();
+ } else {
+ $db->rollback();
+ }
+}
+
// Approve for leave only
if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $confirm == 'yes')) && $permissiontoapprove) {
$db->begin();
diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php
index de034f652d3..4e138b0f1dc 100644
--- a/htdocs/core/tpl/massactions_pre.tpl.php
+++ b/htdocs/core/tpl/massactions_pre.tpl.php
@@ -217,7 +217,15 @@ if ($massaction == 'preenable') {
if ($massaction == 'predisable') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDisabling"), $langs->trans("ConfirmMassDisablingQuestion", count($toselect)), "disable", null, '', 0, 200, 500, 1);
}
-
+if ($massaction == 'presetcommercial') {
+ $formquestion = array();
+ $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1);
+ $formquestion[] = array('type' => 'other',
+ 'name' => 'affectedcommercial',
+ 'label' => $form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0),
+ 'value' => $form->multiselectarray('commercial', $userlist, null, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1));
+ print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAllocateCommercial"), $langs->trans("ConfirmAllocateCommercialQuestion", count($toselect)), "affectcommercial", $formquestion, 1, 0, 200, 500, 1);
+}
if ($massaction == 'preapproveleave') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassLeaveApproval"), $langs->trans("ConfirmMassLeaveApprovalQuestion", count($toselect)), "approveleave", null, 'yes', 0, 200, 500, 1);
}
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index c66895e58a4..b39124c7c53 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -1169,3 +1169,7 @@ CanceledShown=Canceled shown
Terminate=Terminate
Terminated=Terminated
AddLineOnPosition=Add line on position (at the end if empty)
+ConfirmAllocateCommercial=Assign sales representative confirmation
+ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)?
+CommercialsAffected=Sales representatives affected
+CommercialAffected=Sales representative affected
\ No newline at end of file
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 3544611ac45..26e955e7ab4 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -875,6 +875,9 @@ if ($user->rights->societe->creer) {
if ($user->rights->societe->creer) {
$arrayofmassactions['predisable'] = img_picto('', '', 'class="pictofixedwidth"').$langs->trans("SetToDisabled");
}
+if ($user->rights->societe->creer) {
+ $arrayofmassactions['presetcommercial'] = img_picto('', '', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial");
+}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
$arrayofmassactions = array();
}
From c51aff99af711f0a7a04fcd2de99ab243ad2175c Mon Sep 17 00:00:00 2001
From: kevin
Date: Tue, 12 Apr 2022 14:38:17 +0200
Subject: [PATCH 40/62] Add missing entity on adding new VAT
---
htdocs/compta/tva/class/tva.class.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index 45d3d2e74b4..ce5ff657eca 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -125,6 +125,7 @@ class Tva extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva(";
+ $sql .= "entity,";
$sql .= "datec,";
$sql .= "datep,";
$sql .= "datev,";
@@ -136,6 +137,7 @@ class Tva extends CommonObject
$sql .= "fk_user_creat,";
$sql .= "fk_user_modif";
$sql .= ") VALUES (";
+ $sql .= " '".$conf->entity."',";
$sql .= " '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datep)."',";
$sql .= " '".$this->db->idate($this->datev)."',";
From adda436dab9acc806ff33c5ea25e9f21df41f90d Mon Sep 17 00:00:00 2001
From: stickler-ci
Date: Tue, 12 Apr 2022 12:45:05 +0000
Subject: [PATCH 41/62] Fixing style errors.
---
htdocs/compta/tva/class/tva.class.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index ce5ff657eca..c9fcf18d587 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -125,7 +125,7 @@ class Tva extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva(";
- $sql .= "entity,";
+ $sql .= "entity,";
$sql .= "datec,";
$sql .= "datep,";
$sql .= "datev,";
@@ -137,7 +137,7 @@ class Tva extends CommonObject
$sql .= "fk_user_creat,";
$sql .= "fk_user_modif";
$sql .= ") VALUES (";
- $sql .= " '".$conf->entity."',";
+ $sql .= " '".$conf->entity."',";
$sql .= " '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datep)."',";
$sql .= " '".$this->db->idate($this->datev)."',";
From 1bfd9c695fda90db19047a04305877bf809580e3 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Tue, 12 Apr 2022 16:29:25 +0200
Subject: [PATCH 42/62] Update tva.class.php
---
htdocs/compta/tva/class/tva.class.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index c9fcf18d587..a6828587763 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -137,7 +137,7 @@ class Tva extends CommonObject
$sql .= "fk_user_creat,";
$sql .= "fk_user_modif";
$sql .= ") VALUES (";
- $sql .= " '".$conf->entity."',";
+ $sql .= " ".((int) $conf->entity.", ";
$sql .= " '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datep)."',";
$sql .= " '".$this->db->idate($this->datev)."',";
@@ -146,8 +146,8 @@ class Tva extends CommonObject
$sql .= " '".$this->db->escape($this->note)."',";
$sql .= " '".$this->db->escape($this->fk_account)."',";
$sql .= " '".$this->db->escape($this->type_payment)."',";
- $sql .= " '".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id)."',";
- $sql .= " '".$this->db->escape($this->fk_user_modif)."'";
+ $sql .= " ".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id).",";
+ $sql .= " ".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
From 6cbcc54bd964eab272fd3e7f6ea63efc65dec6b5 Mon Sep 17 00:00:00 2001
From: Ferran Marcet
Date: Tue, 12 Apr 2022 19:19:41 +0200
Subject: [PATCH 43/62] Fix: The resource dropdown does not show the values
---
htdocs/resource/class/html.formresource.class.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php
index 99916b8ed70..fa775bf5d58 100644
--- a/htdocs/resource/class/html.formresource.class.php
+++ b/htdocs/resource/class/html.formresource.class.php
@@ -1,6 +1,7 @@
* Copyright (C) 2019 Frédéric France
+ * Copyright (C) 2022 Ferran Marcet
*
* 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
@@ -224,9 +225,10 @@ class FormResource
$value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
} elseif ($format == 3) {
$value = $arraytypes['code'];
- } elseif (empty($value)) {
- print ' ';
+ } else {
+ $value = ' ';
}
+ print $value;
print '';
}
}
From ed172421f0bf1b425fb86227686dbcc633558d54 Mon Sep 17 00:00:00 2001
From: Ferran Marcet
Date: Tue, 12 Apr 2022 19:20:45 +0200
Subject: [PATCH 44/62] Fix: The resource dropdown does not show the values
---
htdocs/resource/class/html.formresource.class.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php
index fa775bf5d58..a541dfab700 100644
--- a/htdocs/resource/class/html.formresource.class.php
+++ b/htdocs/resource/class/html.formresource.class.php
@@ -225,7 +225,8 @@ class FormResource
$value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
} elseif ($format == 3) {
$value = $arraytypes['code'];
- } else {
+ }
+ if (empty($value)) {
$value = ' ';
}
print $value;
From 5e76c1a45d627ab077413ceab556694549558c0f Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Tue, 12 Apr 2022 21:59:34 +0200
Subject: [PATCH 45/62] Fix doc
---
htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 30636a8bb98..6f35a9f1c44 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
@@ -512,5 +512,5 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value
-- Add column to help to fix a very critical bug when transferring into accounting bank record of a bank account into another currency.
-- Idea is to update this column manually in v15 with value in currency of company for bank that are not into the main currency and the transfer
--- into accounting will use it in priority if value is not null.
+-- into accounting will use it in priority if value is not null. The script repair.sql contains the sequence to fix datas in llx_bank.
ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL;
From 6a7212a48df1a03baeed55960379992303141ad6 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Tue, 12 Apr 2022 22:02:46 +0200
Subject: [PATCH 46/62] Fix sql error
---
htdocs/compta/tva/class/tva.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index a6828587763..1b71cb261e1 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -137,7 +137,7 @@ class Tva extends CommonObject
$sql .= "fk_user_creat,";
$sql .= "fk_user_modif";
$sql .= ") VALUES (";
- $sql .= " ".((int) $conf->entity.", ";
+ $sql .= " ".((int) $conf->entity).", ";
$sql .= " '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datep)."',";
$sql .= " '".$this->db->idate($this->datev)."',";
From e9e10e84b2adb333e276f8dd5fce713b34ed87bb Mon Sep 17 00:00:00 2001
From: Norbert Penel
Date: Wed, 13 Apr 2022 10:47:33 +0200
Subject: [PATCH 47/62] ensure priority in this usage
ensure priority in this usage
---
htdocs/product/class/product.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index bd3cf69c86a..6fd09ed9723 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1690,7 +1690,7 @@ class Product extends CommonObject
$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
foreach ($testExit as $field) {
- if (!isset($this->$field[$level])) {
+ if (!isset($this->{$field}[$level])) {
return array();
}
}
From 29242a23c36be39dfe7f76a21ae02aecce75165b Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Wed, 13 Apr 2022 12:11:35 +0200
Subject: [PATCH 48/62] Update product.class.php
---
htdocs/product/class/product.class.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 6fd09ed9723..8ff89d8d086 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1690,7 +1690,11 @@ class Product extends CommonObject
$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
foreach ($testExit as $field) {
- if (!isset($this->{$field}[$level])) {
+ if (!isset($this->$field)) {
+ return array();
+ }
+ $tmparray = $this->$field;
+ if (!isset($tmparray[$level])) {
return array();
}
}
From d154696c32b3ccdeb02b161fd3e04d27db2a3c02 Mon Sep 17 00:00:00 2001
From: BB2A Anthony Berton
Date: Wed, 13 Apr 2022 16:15:07 +0200
Subject: [PATCH 49/62] morecss select_compagny
---
htdocs/comm/propal/card.php | 2 +-
htdocs/commande/card.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 0153f554169..f6989d90d59 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -1921,7 +1921,7 @@ if ($action == 'create') {
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
- array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')),
+ array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300')),
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)),
);
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 3a903e233de..53b6d40d6b0 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -2043,7 +2043,7 @@ if ($action == 'create' && $usercancreate) {
if ($action == 'clone') {
// Create an array for form
$formquestion = array(
- array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)'))
+ array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300'))
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
From 90366b1b81799d1244275e1559f1b9d8589204d8 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Wed, 13 Apr 2022 16:21:25 +0200
Subject: [PATCH 50/62] Revert "NEW : Import with select boxes"
---
htdocs/imports/import.php | 188 +++++++++-----------------------
htdocs/langs/en_US/exports.lang | 4 +-
htdocs/langs/fr_FR/exports.lang | 4 +-
3 files changed, 54 insertions(+), 142 deletions(-)
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 9ec98f8a495..01f152f1ea5 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -136,14 +136,13 @@ $step = (GETPOST('step') ? GETPOST('step') : 1);
$import_name = GETPOST('import_name');
$hexa = GETPOST('hexa');
$importmodelid = GETPOST('importmodelid');
-$excludefirstline = (GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 2);
+$excludefirstline = (GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 1);
$endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
$updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
$separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ','));
$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"');
$separator_used = str_replace('\t', "\t", $separator);
-
$objimport = new Import($db);
$objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport));
@@ -161,7 +160,7 @@ foreach ($fieldsarray as $elem) {
$tabelem = explode('=', $elem, 2);
$key = $tabelem[0];
$val = (isset($tabelem[1]) ? $tabelem[1] : '');
- if ($key && $val && ($key > 0 && $step != 4)) {
+ if ($key && $val) {
$array_match_file_to_database[$key] = $val;
}
}
@@ -326,16 +325,13 @@ if ($action == 'saveorder') {
$pos = 0;
foreach ($fieldsarray as $fieldnb) { // For each elem in list. fieldnb start from 1 to ...
// Get name of database fields at position $pos and put it into $namefield
- $posbis = 0;
-
- $namefield = '';
+ $posbis = 0; $namefield = '';
foreach ($fieldstarget as $key => $val) { // key: val:
//dol_syslog('AjaxImport key='.$key.' val='.$val);
if ($posbis < $pos) {
$posbis++;
continue;
}
-
// We found the key of targets that is at position pos
$namefield = $key;
//dol_syslog('AjaxImport Field name found for file field nb '.$fieldnb.'='.$namefield);
@@ -1008,7 +1004,7 @@ if ($step == 4 && $datatoimport) {
$lefti = 1;
foreach ($array_match_file_to_database as $key => $val) {
$var = !$var;
- show_elem($fieldssource, $key, $val, $var, 1, '', $listofkeys); // key is field number in source file
+ show_elem($fieldssource, $key, $val, $var); // key is field number in source file
//print '> '.$lefti.'-'.$key.'-'.$val;
$listofkeys[$key] = 1;
$fieldsplaced[$key] = 1;
@@ -1027,7 +1023,7 @@ if ($step == 4 && $datatoimport) {
while ($lefti <= $num) {
$var = !$var;
$newkey = getnewkey($fieldssource, $listofkeys);
- show_elem($fieldssource, $newkey, '', $var, 1, '', $listofkeys); // key start after field number in source file
+ show_elem($fieldssource, $newkey, '', $var); // key start after field number in source file
//print '> '.$lefti.'-'.$newkey;
$listofkeys[$key] = 1;
$lefti++;
@@ -1041,14 +1037,11 @@ if ($step == 4 && $datatoimport) {
print ' ';
// List of target fields
- // $height = '24px'; //needs px for css height attribute below
- $height = '30px';
+ $height = '24px'; //needs px for css height attribute below
$i = 0;
$mandatoryfieldshavesource = true;
- $fieldselect = 1;
- print '';
- $pos = 1;
+ print '';
foreach ($fieldstarget as $code => $label) {
print '';
@@ -1058,7 +1051,7 @@ if ($step == 4 && $datatoimport) {
$tablealias = preg_replace('/(\..*)$/i', '', $code);
$tablename = $objimport->array_import_tables[0][$tablealias];
- $entityicon = !empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity; // $entityicon must string name of picto of the field like 'project', 'company', 'contact', 'modulename', ...
+ $entityicon = $entitytoicon[$entity] ? $entitytoicon[$entity] : $entity; // $entityicon must string name of picto of the field like 'project', 'company', 'contact', 'modulename', ...
$entitylang = $entitytolang[$entity] ? $entitytolang[$entity] : $objimport->array_import_label[0]; // $entitylang must be a translation key to describe object the field is related to, like 'Company', 'Contact', 'MyModyle', ...
print '=>'.img_object('', $entityicon).' '.$langs->trans($entitylang).' ';
@@ -1078,7 +1071,7 @@ if ($step == 4 && $datatoimport) {
print '';
// Info field
print '';
- $filecolumn = !empty($array_match_database_to_file[$code])?$array_match_database_to_file[$code]:0;
+ $filecolumn = $array_match_database_to_file[$code];
// Source field info
$htmltext = ''.$langs->trans("FieldSource").' ';
if ($filecolumn > count($fieldssource)) {
@@ -1098,7 +1091,7 @@ if ($step == 4 && $datatoimport) {
}
// Source required
$htmltext .= $langs->trans("SourceRequired").': '.yn(preg_match('/\*$/', $label)).' ';
- $example = !empty($objimport->array_import_examplevalues[0][$code])?$objimport->array_import_examplevalues[0][$code]:"";
+ $example = $objimport->array_import_examplevalues[0][$code];
// Example
if (empty($objimport->array_import_convertvalue[0][$code])) { // If source file does not need convertion
if ($example) {
@@ -1136,7 +1129,6 @@ if ($step == 4 && $datatoimport) {
print ' ';
print ' ';
- $fieldselect++;
}
print '
';
@@ -1155,7 +1147,7 @@ if ($step == 4 && $datatoimport) {
if (empty($fieldsplaced[$key])) {
//
$nbofnotimportedfields++;
- show_elem($fieldssource, $key, '', $var, 0, 'nostyle', $listofkeys);
+ show_elem($fieldssource, $key, '', $var, 'nostyle');
//print '> '.$lefti.'-'.$key;
$listofkeys[$key] = 1;
$lefti++;
@@ -1164,7 +1156,7 @@ if ($step == 4 && $datatoimport) {
// Print one more empty field
$newkey = getnewkey($fieldssource, $listofkeys);
- show_elem($fieldssource, $newkey, '', $var, 1, 'nostyle', $listofkeys);
+ show_elem($fieldssource, $newkey, '', $var, 'nostyle');
//print '> '.$lefti.'-'.$newkey;
$listofkeys[$newkey] = 1;
$nbofnotimportedfields++;
@@ -1177,7 +1169,7 @@ if ($step == 4 && $datatoimport) {
$i = 0;
while ($i < $nbofnotimportedfields) {
// Print empty cells
- show_elem('', '', 'none', $var, 0, 'nostyle', $listofkeys);
+ show_elem('', '', 'none', $var, 'nostyle');
$i++;
}
print '';
@@ -1188,51 +1180,35 @@ if ($step == 4 && $datatoimport) {
if ($conf->use_javascript_ajax) {
print ''."\n";
@@ -1495,20 +1471,6 @@ if ($step == 5 && $datatoimport) {
if ($action == 'launchsimu') {
print ' '.$langs->trans("Modify").' ';
}
- if ($excludefirstline == 2) {
- print $form->textwithpicto("", $langs->trans("WarningFirstImportedLine", $excludefirstline), 1, 'warning', "warningexcludefirstline");
- print '';
- }
print '';
// Keys for data UPDATE (not INSERT of new data)
@@ -2131,21 +2093,18 @@ $db->close();
/**
* Function to put the movable box of a source field
*
- * @param array $fieldssource List of source fields
- * @param int $pos Pos
- * @param string $key Key
- * @param boolean $var Line style (odd or not)
- * @param boolean $isimportedfield Verify if it's an imported field
- * @param int $nostyle Hide style
- * @param array $listofkeys List of keys for select boxes
+ * @param array $fieldssource List of source fields
+ * @param int $pos Pos
+ * @param string $key Key
+ * @param boolean $var Line style (odd or not)
+ * @param int $nostyle Hide style
* @return void
*/
-function show_elem($fieldssource, $pos, $key, $var, $isimportedfield, $nostyle = '', &$listofkeys = array())
+function show_elem($fieldssource, $pos, $key, $var, $nostyle = '')
{
global $langs, $bc;
- // $height = '24px';
- $height = '30px';
+ $height = '24px';
if ($key == 'none') {
//stop multiple duplicate ids with no number
@@ -2162,7 +2121,7 @@ function show_elem($fieldssource, $pos, $key, $var, $isimportedfield, $nostyle =
if ($pos && $pos > count($fieldssource)) { // No fields
print '';
print '';
- //print img_picto(($pos > 0 ? $langs->trans("MoveField", $pos) : ''), 'grip_title', 'class="boxhandle" style="cursor:move;"');
+ print img_picto(($pos > 0 ? $langs->trans("MoveField", $pos) : ''), 'grip_title', 'class="boxhandle" style="cursor:move;"');
print ' ';
print '';
print $langs->trans("NoFields");
@@ -2177,65 +2136,22 @@ function show_elem($fieldssource, $pos, $key, $var, $isimportedfield, $nostyle =
print ' ';
print ' ';
print ' ';
- } elseif (empty($isimportedfield)) {
- $example = !empty($fieldssource[$pos]['example1'])?$fieldssource[$pos]['example1']:"";
- if ($example) {
- if (!utf8_check($example)) {
- $example = utf8_encode($example);
- }
- print '';
- print '';
- print ' ';
- print ' ';
- print '';
- print $langs->trans("EmptyField").': ';
- print ' ('.$example.' )';
- print ' ';
- print ' ';
- }
} else {
// Print field of source file
print '';
print '';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
- //print img_picto($langs->trans("MoveField", $pos), 'grip_title', 'class="boxhandle" style="cursor:move;"');
+ print img_picto($langs->trans("MoveField", $pos), 'grip_title', 'class="boxhandle" style="cursor:move;"');
print ' ';
- print '';
- $example = !empty($fieldssource[$pos]['example1'])?$fieldssource[$pos]['example1']:"";
- if ($example != "") {
- print $langs->trans("Field").' '.$pos.': ';
- } else {
- print $langs->trans("EmptyField").': ';
- }
+ print ' ';
+ print $langs->trans("Field").' '.$pos;
+ $example = $fieldssource[$pos]['example1'];
if ($example) {
if (!utf8_check($example)) {
$example = utf8_encode($example);
}
- }
- $nameselect = ($pos > 0) ? $pos : (-$pos);
- print ' ';
- print '';
- $valueemptyoption = ($pos < 0) ? $pos : (-$pos);
- print ' ';
- if ($example != "") {
- print '';
print ' ('.$example.' )';
- print ' ';
}
- foreach ($fieldssource as $newkey => $val) {
- if (empty($listofkeys[$newkey])) {
- $example = $fieldssource[$newkey]['example1'];
- if ($example) {
- if (!utf8_check($example)) {
- $example = utf8_encode($example);
- }
- print '';
- print ' ('.$example.' )';
- print ' ';
- }
- }
- }
- print ' ';
print '';
print ' ';
}
diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang
index 8bbc6f1ad98..f2f2d2cf587 100644
--- a/htdocs/langs/en_US/exports.lang
+++ b/htdocs/langs/en_US/exports.lang
@@ -8,7 +8,7 @@ ImportableDatas=Importable dataset
SelectExportDataSet=Choose dataset you want to export...
SelectImportDataSet=Choose dataset you want to import...
SelectExportFields=Choose the fields you want to export, or select a predefined export profile
-SelectImportFields=Choose the source file fields you want to import and their target field in database by choosing the fields with the select box, or select a predefined import profile:
+SelectImportFields=Choose the source file fields you want to import and their target field in database by moving them up and down with anchor %s, or select a predefined import profile:
NotImportedFields=Fields of source file not imported
SaveExportModel=Save your selections as an export profile/template (for reuse).
SaveImportModel=Save this import profile (for reuse) ...
@@ -135,5 +135,3 @@ NbInsert=Number of inserted lines: %s
NbUpdate=Number of updated lines: %s
MultipleRecordFoundWithTheseFilters=Multiple records have been found with these filters: %s
StocksWithBatch=Stocks and location (warehouse) of products with batch/serial number
-WarningFirstImportedLine=The first line(s) will not be imported with the current selection
-EmptyField=Empty field
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/exports.lang b/htdocs/langs/fr_FR/exports.lang
index 4f4490ef4a5..5c87e8f186f 100644
--- a/htdocs/langs/fr_FR/exports.lang
+++ b/htdocs/langs/fr_FR/exports.lang
@@ -8,7 +8,7 @@ ImportableDatas=Lot de données importables
SelectExportDataSet=Choisissez un lot prédéfini de données que vous désirez exporter…
SelectImportDataSet=Choisissez un lot prédéfini de données que vous désirez importer…
SelectExportFields=Choisissez les champs à exporter, ou choisissez un profil d'export prédéfini
-SelectImportFields=Choisissez les champs du fichier source à importer et leur destination dans la base en utilisant les boîtes de sélection, ou choisissez un profil d'import prédéfini:
+SelectImportFields=Choisissez les champs du fichier source à importer et leur destination dans la base en les déplaçant vers le haut ou vers le bas via l'ancre %s, ou choisissez un profil d'import prédéfini:
NotImportedFields=Champs du fichier source non importés
SaveExportModel=Enregistrer ce profil d'export (si vous désirez le réutiliser ultérieurement) …
SaveImportModel=Enregistrer ce profil d'import (si vous désirez le réutiliser ultérieurement) …
@@ -135,5 +135,3 @@ NbInsert=Nombre de lignes insérées: %s
NbUpdate=Nombre de lignes mises à jour: %s
MultipleRecordFoundWithTheseFilters=Plusieurs enregistrements ont été trouvés avec ces filtres: %s
StocksWithBatch=Stocks et entrepôts des produits avec numéro de lot/série
-WarningFirstImportedLine=Les première(s) ligne(s) ne seront pas importée(s) avec cette selection
-EmptyField=Champ vide
From 5f7f9a751508dc5840151b0f674a671a2a88281a Mon Sep 17 00:00:00 2001
From: lvessiller
Date: Thu, 14 Apr 2022 09:48:06 +0200
Subject: [PATCH 51/62] FIX include tpl path in product stock
---
htdocs/product/stock/tpl/stockcorrection.tpl.php | 2 +-
htdocs/product/stock/tpl/stocktransfer.tpl.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php
index eb84df7d14e..6afea0abe54 100644
--- a/htdocs/product/stock/tpl/stockcorrection.tpl.php
+++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php
@@ -180,7 +180,7 @@ print '';
print '';
// Extrafield template
-include 'extrafields_add.tpl.php';
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '
';
diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php
index ccedf993221..f1c08b7673e 100644
--- a/htdocs/product/stock/tpl/stocktransfer.tpl.php
+++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php
@@ -137,7 +137,7 @@ print ' ';
print '';
// Extrafield template
-include 'extrafields_add.tpl.php';
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '';
From c90d758b0ff06021b5eafd72b69c0276fa88e4eb Mon Sep 17 00:00:00 2001
From: lmarcouiller
Date: Thu, 14 Apr 2022 11:06:54 +0200
Subject: [PATCH 52/62] New : add of unique(entity,label)
---
htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 ++
.../tables/llx_takepos_floor_tables.key.sql | 16 ++++++++++++++++
htdocs/takepos/floors.php | 2 +-
3 files changed, 19 insertions(+), 1 deletion(-)
create mode 100644 htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql
diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
index 5f8b1d886c3..745955c7bcd 100644
--- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
+++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
@@ -324,3 +324,5 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext;
DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php'));
DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php');
+
+ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label);
\ No newline at end of file
diff --git a/htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql b/htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql
new file mode 100644
index 00000000000..e90cd67e889
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql
@@ -0,0 +1,16 @@
+-- Copyright (C) 2018 SuperAdmin
+--
+-- 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 https://www.gnu.org/licenses/.
+
+ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label);
\ No newline at end of file
diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php
index 64040a24466..73e84109116 100644
--- a/htdocs/takepos/floors.php
+++ b/htdocs/takepos/floors.php
@@ -104,7 +104,7 @@ if ($action == "updatename") {
if (strlen($newname) > 3) {
$newname = substr($newname, 0, 3); // Only 3 chars
}
- $db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set label='".$db->escape($newname)."' WHERE rowid = ".((int) $place));
+ $resql = $db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set label='".$db->escape($newname)."' WHERE rowid = ".((int) $place));
}
if ($action == "add") {
From 0fcfb7c5fd3988fb362ee550dd7edc6beb185c97 Mon Sep 17 00:00:00 2001
From: atm-arnaud
Date: Thu, 14 Apr 2022 12:08:06 +0200
Subject: [PATCH 53/62] FIX intervention entity missing
---
htdocs/fichinter/class/fichinter.class.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 371853dc70c..92b628b9aab 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -426,7 +426,7 @@ class Fichinter extends CommonObject
$sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
$sql .= " f.date_valid as datev,";
$sql .= " f.tms as datem,";
- $sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat";
+ $sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat, f.entity as entity";
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
if ($ref) {
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
@@ -459,6 +459,7 @@ class Fichinter extends CommonObject
$this->model_pdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf; // deprecated
$this->fk_contrat = $obj->fk_contrat;
+ $this->entity = $obj->entity;
$this->user_creation = $obj->fk_user_author;
From f15438dd039dc3f6ecb7c4c3642d83f8e57e7927 Mon Sep 17 00:00:00 2001
From: Florian HENRY
Date: Thu, 14 Apr 2022 12:28:51 +0200
Subject: [PATCH 54/62] NEW: data sign on propal list
---
htdocs/comm/propal/list.php | 71 ++++++++++++++++++++++++++++++++++++-
1 file changed, 70 insertions(+), 1 deletion(-)
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 73b4c479b2e..561682ba02f 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -123,6 +123,15 @@ $search_fk_input_reason = GETPOST("search_fk_input_reason", 'int');
$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
+$search_date_signature_startday = GETPOST('search_date_signature_startday', 'int');
+$search_date_signature_startmonth = GETPOST('search_date_signature_startmonth', 'int');
+$search_date_signature_startyear = GETPOST('search_date_signature_startyear', 'int');
+$search_date_signature_endday = GETPOST('search_date_signature_endday', 'int');
+$search_date_signature_endmonth = GETPOST('search_date_signature_endmonth', 'int');
+$search_date_signature_endyear = GETPOST('search_date_signature_endyear', 'int');
+$search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
+$search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
+
$search_status = GETPOST('search_status', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
@@ -207,6 +216,7 @@ $arrayfields = array(
'p.date'=>array('label'=>"DatePropal", 'checked'=>1),
'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1),
'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
+ 'p.date_signature'=>array('label'=>"DateSigning", 'checked'=>0),
'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>!empty($conf->expedition->enabled)),
'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1),
@@ -337,6 +347,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_fk_shipping_method = '';
$search_fk_input_reason = '';
$search_fk_mode_reglement = '';
+ $search_date_signature_startday = '';
+ $search_date_signature_startmonth = '';
+ $search_date_signature_startyear = '';
+ $search_date_signature_endday = '';
+ $search_date_signature_endmonth = '';
+ $search_date_signature_endyear = '';
+ $search_date_signature_start = '';
+ $search_date_signature_end = '';
}
if ($object_statut != '') {
$search_status = $object_statut;
@@ -517,6 +535,7 @@ $sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
+$sql .= ' p.date_signature as dsignature,';
$sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
@@ -701,6 +720,12 @@ if ($search_sale > 0) {
if ($search_user > 0) {
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user);
}
+if ($search_date_signature_start) {
+ $sql .= " AND p.date_signature >= '".$db->idate($search_date_signature_start)."'";
+}
+if ($search_date_signature_end) {
+ $sql .= " AND p.date_signature <= '".$db->idate($search_date_signature_end)."'";
+}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -917,6 +942,24 @@ if ($resql) {
if ($search_country) {
$param .= '&search_country='.urlencode($search_country);
}
+ if ($search_date_signature_startday) {
+ $param .= '&search_date_signature_startday='.urlencode($search_date_signature_startday);
+ }
+ if ($search_date_signature_startmonth) {
+ $param .= '&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth);
+ }
+ if ($search_date_signature_startyear) {
+ $param .= '&search_date_signature_startyear='.urlencode($search_date_signature_startyear);
+ }
+ if ($search_date_signature_endday) {
+ $param .= '&search_date_signature_endday='.urlencode($search_date_signature_endday);
+ }
+ if ($search_date_signature_endmonth) {
+ $param .= '&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth);
+ }
+ if ($search_date_signature_endyear) {
+ $param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear);
+ }
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -1148,6 +1191,17 @@ if ($resql) {
print '';
print '';
}
+ // Date Signature
+ if (!empty($arrayfields['p.date_signature']['checked'])) {
+ print '';
+ print '';
+ print $form->selectDate($search_date_signature_start ? $search_date_signature_start : -1, 'search_date_signature_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print '
';
+ print '';
+ print $form->selectDate($search_date_signature_end ? $search_date_signature_end : -1, 'search_date_signature_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print '
';
+ print ' ';
+ }
// Availability
if (!empty($arrayfields['ava.rowid']['checked'])) {
print '';
@@ -1361,7 +1415,10 @@ if ($resql) {
print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.date_livraison']['checked'])) {
- print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder);
+ print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder);
+ }
+ if (!empty($arrayfields['p.date_signature']['checked'])) {
+ print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['ava.rowid']['checked'])) {
print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder);
@@ -1720,6 +1777,18 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
+ // Date Signature
+ if (!empty($arrayfields['p.date_signature']['checked'])) {
+ if ($obj->dsignature) {
+ print ' '.dol_print_date($db->jdate($obj->dsignature), 'day');
+ print ' ';
+ } else {
+ print ' ';
+ }
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
// Availability
if (!empty($arrayfields['ava.rowid']['checked'])) {
print '';
From 3d21023110a27ab96d6ff0fafb8ae6eb3117709a Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Apr 2022 14:11:40 +0200
Subject: [PATCH 55/62] Label of option
---
htdocs/admin/pdf.php | 6 +++---
htdocs/langs/en_US/companies.lang | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php
index fd8377b0a27..1e015d69f9c 100644
--- a/htdocs/admin/pdf.php
+++ b/htdocs/admin/pdf.php
@@ -309,7 +309,7 @@ print ''.$langs->trans("Par
// Show sender name
-/* Set option as hidden because no need of this for 99.99% of users.
+/* Set option as hidden because no need of this for 99.99% of users. Having it as hidden feature is enough.
print ' '.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").' ';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
@@ -321,7 +321,7 @@ print ' ';
// Hide VAT Intra on address
-print ''.$langs->trans("ShowVATIntaInAddress").' ';
+print ' '.$langs->trans("ShowVATIntaInAddress").' - '.$langs->trans("ThirdPartyAddress").' ';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_TVAINTRA_NOT_IN_ADDRESS');
} else {
@@ -340,7 +340,7 @@ for ($i = 1; $i <= 6; $i++) {
$pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).' ';
}
if ($pid) {
- print ' '.$langs->trans("ShowProfIdInAddress").' - '.$pid.' ';
+ print ' '.$langs->trans("ShowProfIdInAddress").' - '.$pid.' - '.$langs->trans("ThirdPartyAddress").' ';
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff($keyforconstant);
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 093fb47189d..b1438691cd9 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -19,6 +19,7 @@ ProspectionArea=Prospection area
IdThirdParty=Id third party
IdCompany=Company Id
IdContact=Contact Id
+ThirdPartyAddress=Third-party address
ThirdPartyContacts=Third-party contacts
ThirdPartyContact=Third-party contact/address
Company=Company
From 8a9be6705d4c674013dfa2ab74184b2370d73df4 Mon Sep 17 00:00:00 2001
From: kamel
Date: Thu, 14 Apr 2022 14:14:07 +0200
Subject: [PATCH 56/62] FIX: Call of printOriginObjectLine hook
---
htdocs/core/class/commonobject.class.php | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 02421ea9157..7828e61b166 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4824,11 +4824,9 @@ abstract class CommonObject
if (!empty($this->lines)) {
foreach ($this->lines as $line) {
if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) {
- if (empty($line->fk_parent_line)) {
- $parameters = array('line'=>$line, 'i'=>$i);
- $action = '';
- $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
- }
+ $parameters = array('line' => $line, 'i' => $i);
+ $action = '';
+ $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
} else {
$this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines);
}
From e0d208214731df7f404c33b1488f543e4ad0d109 Mon Sep 17 00:00:00 2001
From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com>
Date: Thu, 14 Apr 2022 16:49:08 +0200
Subject: [PATCH 57/62] Update barcode_EAN13.txt
start formatting & english translation
---
dev/resources/iso-normes/barcode_EAN13.txt | 64 +++++++++++-----------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/dev/resources/iso-normes/barcode_EAN13.txt b/dev/resources/iso-normes/barcode_EAN13.txt
index f4496327ee4..f6b3c5f5ebb 100644
--- a/dev/resources/iso-normes/barcode_EAN13.txt
+++ b/dev/resources/iso-normes/barcode_EAN13.txt
@@ -16,57 +16,57 @@ Voici la liste des codes pays ou systeme :
EN
==
-Meaning of the numbers.
+Meaning of the numbers:
-- 2 digits for the country code or system code
+- first 2-3 digits for the country code or system code
- 5 digits for the company identifier
- 5 digits for item identifier
- 1 digit for checksum
This rule has been twisted many times to improve the use of the available numbers.
-Here is the list of country codes or system:
+Here is the list of country codes or system:
List
====
-00 � 13 UCC (Etats-Unis et Canada)
-20 � 29 Codification interne en magasin
-30 � 37 GENCOD-EAN France
-380 BCCI (Bulgarie)
-383 SANA (Slovenie)
-385 CRO-EAN (Croatie)
-387 EAN-BIH (Bosnie-Herzegovine)
-400 � 440 CCG (Allemagne)
-45 + 49 Distribution Code Center � DCC (Japon)
-460 � 469 UNISCAN - EAN Russie (Federation de Russie)
-471 CAN (Taiwan)
-474 EAN Estonie
-475 EAN Lettonie
-476 EAN Azerba� djan
-477 EAN Lituanie
-478 EAN Ouzbekistan
-479 EAN Sri Lanka
-480 PANC (Philippines)
-481 EAN Bielorussie
-482 EAN Ukraine
-484 EAN Moldavie
-485 EAN Armenie
-486 EAN Georgie
-487 EAN Kazakhstan
-489 HKANA (Hong Kong)
-50 E Centre UK
+00 - 13 UCC (U.S.A / États-Unis & Canada)
+20 - 29 Flag for internal numbering / Codification interne en magasin
+30 - 37 GENCOD-EAN France
+380 BCCI (Bulgaria)
+383 SANA (Slovenia)
+385 CRO-EAN (Croatia)
+387 EAN-BIH (Bosnia-Herzegovina)
+400-440 CCG (Allemagne/Germany)
+45 + 49 Distribution Code Center - DCC (Japan)
+460-469 UNISCAN - EAN Russia (Federation de Russie)
+471 CAN Taiwan
+474 EAN Estonia
+475 EAN Latvia
+476 EAN Azerbaijan
+477 EAN Lithuania
+478 EAN Uzbekistan
+479 EAN Sri Lanka
+480 PANC Philippines
+481 EAN Belarus
+482 EAN Ukraine
+484 EAN Moldova
+485 EAN Armenia
+486 EAN Georgia
+487 EAN Kazakhstan
+489 HKANA Hong Kong
+50 E Centre UK - United Kingdom
520 HELLCAN-EAN HELLAS (Grece)
528 EAN Liban
529 EAN Chypre
-531 EAN-MAC (FYR Mac�donie)
+531 EAN-MAC (FYR Macedonie)
535 EAN Malte
539 EAN Irlande
-54 ICODIF/EAN Belgique. Luxembourg
+54 ICODIF/EAN Belgique. Luxembourg
560 CODIPOR (Portugal)
569 EAN Islande
-57 EAN Danemark
+57 EAN Danemark
590 EAN Pologne
594 EAN Roumanie
599 H.A.P.M.H. (Hongrie)
From 02a3cfbb5f16672f2fff6c65f0fe6a0a3386d56b Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Apr 2022 21:43:55 +0200
Subject: [PATCH 58/62] Update paymentsalary.class.php
---
htdocs/salaries/class/paymentsalary.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php
index 506e9b73ea5..08e850c259a 100644
--- a/htdocs/salaries/class/paymentsalary.class.php
+++ b/htdocs/salaries/class/paymentsalary.class.php
@@ -166,7 +166,7 @@ class PaymentSalary extends CommonObject
if ($totalamount != 0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (entity, fk_salary, datec, datep, amount,";
$sql .= " fk_typepayment, num_payment, note, fk_user_author, fk_bank)";
- $sql .= " VALUES (".$conf->entity.", ".$this->chid.", '".$this->db->idate($now)."',";
+ $sql .= " VALUES (".((int) $conf->entity).", ".((int) $this->chid).", '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datepaye)."',";
$sql .= " ".price2num($totalamount).",";
$sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".((int) $user->id).",";
From d62d24a337778890f042a58aaa17d3ab459160aa Mon Sep 17 00:00:00 2001
From: Philippe GRAND
Date: Thu, 14 Apr 2022 21:47:35 +0200
Subject: [PATCH 59/62] add code to get documents list by knowledgemanagement
with api
---
htdocs/api/class/api_documents.class.php | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php
index da49e4cbba7..d4e35e848ac 100644
--- a/htdocs/api/class/api_documents.class.php
+++ b/htdocs/api/class/api_documents.class.php
@@ -458,6 +458,20 @@ class Documents extends DolibarrApi
}
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
+ } elseif ($modulepart == 'knowledgemanagement') {
+ require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
+
+ if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) {
+ throw new RestException(401);
+ }
+
+ $object = new KnowledgeRecord($this->db);
+ $result = $object->fetch($id, $ref);
+ if (!$result) {
+ throw new RestException(404, 'Expense report not found');
+ }
+
+ $upload_dir = $conf->knowledgemanagement->dir_output.'/knowledgerecord/'.dol_sanitizeFileName($object->ref);
} elseif ($modulepart == 'categorie' || $modulepart == 'category') {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
From 0023850c9a6f37c31db33d95a018ea3ee8d55fb5 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Apr 2022 22:16:17 +0200
Subject: [PATCH 60/62] Update api_documents.class.php
---
htdocs/api/class/api_documents.class.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php
index d4e35e848ac..9bf7dd7c117 100644
--- a/htdocs/api/class/api_documents.class.php
+++ b/htdocs/api/class/api_documents.class.php
@@ -468,7 +468,7 @@ class Documents extends DolibarrApi
$object = new KnowledgeRecord($this->db);
$result = $object->fetch($id, $ref);
if (!$result) {
- throw new RestException(404, 'Expense report not found');
+ throw new RestException(404, 'KM article not found');
}
$upload_dir = $conf->knowledgemanagement->dir_output.'/knowledgerecord/'.dol_sanitizeFileName($object->ref);
From 06f112d3ce5454cd428d7862bea2fdd7402d426e Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Apr 2022 22:43:43 +0200
Subject: [PATCH 61/62] Update main.inc.php
---
htdocs/main.inc.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index e66c9e9d313..dd8010dfa92 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -265,7 +265,7 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) {
$cookiearrayvalue[$tmpkey] = $_POST[$postkey];
}
}
- $cookiename = ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? $tmpautoset[0] : '__Secure-'.$tmpautoset[0]); // __Secure- || __Host-
+ $cookiename = $tmpautoset[0];
$cookievalue = json_encode($cookiearrayvalue);
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
if (PHP_VERSION_ID < 70300) {
From 75d3b3527c148aa2e444f0ac70da2b2aaac7eb4c Mon Sep 17 00:00:00 2001
From: Laurent Destailleur
Date: Thu, 14 Apr 2022 22:45:56 +0200
Subject: [PATCH 62/62] Update main.inc.php
---
htdocs/main.inc.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index dd8010dfa92..3b5793a2cf1 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -297,7 +297,7 @@ if (!empty($php_session_save_handler) && $php_session_save_handler == 'db') {
// Must be done after the include of filefunc.inc.php so global variables of conf file are defined (like $dolibarr_main_instance_unique_id or $dolibarr_main_force_https).
// Note: the function dol_getprefix() is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect.
$prefix = dol_getprefix('');
-$sessionname = ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? 'DOLSESSID_'.$prefix : '__Secure-DOLSESSID_'.$prefix); // __Secure- || __Host-
+$sessionname = 'DOLSESSID_'.$prefix;
$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
if (!empty($_COOKIE[$sessiontimeout])) {
ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);