';
- if ($user->rights->import->run) {
+ if ($user->hasRight('import', 'run')) {
if (empty($nboferrors)) {
print ''.$langs->trans("RunImportFile").'';
} else {
diff --git a/htdocs/includes/jquery/js/jquery-ui.js b/htdocs/includes/jquery/js/jquery-ui.js
index 5d9bfa2f1b1..1a613bf2f94 100644
--- a/htdocs/includes/jquery/js/jquery-ui.js
+++ b/htdocs/includes/jquery/js/jquery-ui.js
@@ -1,4 +1,4 @@
-/*! jQuery UI - v1.13.1 - 2022-01-20
+/*! jQuery UI - v1.13.2 - 2022-07-14
* http://jqueryui.com
* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */
@@ -20,11 +20,11 @@
$.ui = $.ui || {};
-var version = $.ui.version = "1.13.1";
+var version = $.ui.version = "1.13.2";
/*!
- * jQuery UI Widget 1.13.1
+ * jQuery UI Widget 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -766,7 +766,7 @@ var widget = $.widget;
/*!
- * jQuery UI Position 1.13.1
+ * jQuery UI Position 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -1263,7 +1263,7 @@ var position = $.ui.position;
/*!
- * jQuery UI :data 1.13.1
+ * jQuery UI :data 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -1292,7 +1292,7 @@ var data = $.extend( $.expr.pseudos, {
} );
/*!
- * jQuery UI Disable Selection 1.13.1
+ * jQuery UI Disable Selection 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -2047,7 +2047,7 @@ colors = jQuery.Color.names = {
/*!
- * jQuery UI Effects 1.13.1
+ * jQuery UI Effects 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -2431,7 +2431,7 @@ if ( $.uiBackCompat !== false ) {
}
$.extend( $.effects, {
- version: "1.13.1",
+ version: "1.13.2",
define: function( name, mode, effect ) {
if ( !effect ) {
@@ -2999,7 +2999,7 @@ var effect = $.effects;
/*!
- * jQuery UI Effects Blind 1.13.1
+ * jQuery UI Effects Blind 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3054,7 +3054,7 @@ var effectsEffectBlind = $.effects.define( "blind", "hide", function( options, d
/*!
- * jQuery UI Effects Bounce 1.13.1
+ * jQuery UI Effects Bounce 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3149,7 +3149,7 @@ var effectsEffectBounce = $.effects.define( "bounce", function( options, done )
/*!
- * jQuery UI Effects Clip 1.13.1
+ * jQuery UI Effects Clip 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3199,7 +3199,7 @@ var effectsEffectClip = $.effects.define( "clip", "hide", function( options, don
/*!
- * jQuery UI Effects Drop 1.13.1
+ * jQuery UI Effects Drop 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3253,7 +3253,7 @@ var effectsEffectDrop = $.effects.define( "drop", "hide", function( options, don
/*!
- * jQuery UI Effects Explode 1.13.1
+ * jQuery UI Effects Explode 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3349,7 +3349,7 @@ var effectsEffectExplode = $.effects.define( "explode", "hide", function( option
/*!
- * jQuery UI Effects Fade 1.13.1
+ * jQuery UI Effects Fade 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3381,7 +3381,7 @@ var effectsEffectFade = $.effects.define( "fade", "toggle", function( options, d
/*!
- * jQuery UI Effects Fold 1.13.1
+ * jQuery UI Effects Fold 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3455,7 +3455,7 @@ var effectsEffectFold = $.effects.define( "fold", "hide", function( options, don
/*!
- * jQuery UI Effects Highlight 1.13.1
+ * jQuery UI Effects Highlight 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3497,7 +3497,7 @@ var effectsEffectHighlight = $.effects.define( "highlight", "show", function( op
/*!
- * jQuery UI Effects Size 1.13.1
+ * jQuery UI Effects Size 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3675,7 +3675,7 @@ var effectsEffectSize = $.effects.define( "size", function( options, done ) {
/*!
- * jQuery UI Effects Scale 1.13.1
+ * jQuery UI Effects Scale 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3715,7 +3715,7 @@ var effectsEffectScale = $.effects.define( "scale", function( options, done ) {
/*!
- * jQuery UI Effects Puff 1.13.1
+ * jQuery UI Effects Puff 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3741,7 +3741,7 @@ var effectsEffectPuff = $.effects.define( "puff", "hide", function( options, don
/*!
- * jQuery UI Effects Pulsate 1.13.1
+ * jQuery UI Effects Pulsate 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3790,7 +3790,7 @@ var effectsEffectPulsate = $.effects.define( "pulsate", "show", function( option
/*!
- * jQuery UI Effects Shake 1.13.1
+ * jQuery UI Effects Shake 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3849,7 +3849,7 @@ var effectsEffectShake = $.effects.define( "shake", function( options, done ) {
/*!
- * jQuery UI Effects Slide 1.13.1
+ * jQuery UI Effects Slide 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3910,7 +3910,7 @@ var effectsEffectSlide = $.effects.define( "slide", "show", function( options, d
/*!
- * jQuery UI Effects Transfer 1.13.1
+ * jQuery UI Effects Transfer 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -3935,7 +3935,7 @@ var effectsEffectTransfer = effect;
/*!
- * jQuery UI Focusable 1.13.1
+ * jQuery UI Focusable 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4017,7 +4017,7 @@ var form = $.fn._form = function() {
/*!
- * jQuery UI Form Reset Mixin 1.13.1
+ * jQuery UI Form Reset Mixin 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4079,7 +4079,7 @@ var formResetMixin = $.ui.formResetMixin = {
/*!
- * jQuery UI Support for jQuery core 1.8.x and newer 1.13.1
+ * jQuery UI Support for jQuery core 1.8.x and newer 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4154,7 +4154,7 @@ if ( !$.fn.even || !$.fn.odd ) {
;
/*!
- * jQuery UI Keycode 1.13.1
+ * jQuery UI Keycode 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4189,7 +4189,7 @@ var keycode = $.ui.keyCode = {
/*!
- * jQuery UI Labels 1.13.1
+ * jQuery UI Labels 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4244,7 +4244,7 @@ var labels = $.fn.labels = function() {
/*!
- * jQuery UI Scroll Parent 1.13.1
+ * jQuery UI Scroll Parent 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4278,7 +4278,7 @@ var scrollParent = $.fn.scrollParent = function( includeHidden ) {
/*!
- * jQuery UI Tabbable 1.13.1
+ * jQuery UI Tabbable 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4302,7 +4302,7 @@ var tabbable = $.extend( $.expr.pseudos, {
/*!
- * jQuery UI Unique ID 1.13.1
+ * jQuery UI Unique ID 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4340,7 +4340,7 @@ var uniqueId = $.fn.extend( {
/*!
- * jQuery UI Accordion 1.13.1
+ * jQuery UI Accordion 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4361,7 +4361,7 @@ var uniqueId = $.fn.extend( {
var widgetsAccordion = $.widget( "ui.accordion", {
- version: "1.13.1",
+ version: "1.13.2",
options: {
active: 0,
animate: {},
@@ -4972,7 +4972,7 @@ var safeActiveElement = $.ui.safeActiveElement = function( document ) {
/*!
- * jQuery UI Menu 1.13.1
+ * jQuery UI Menu 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -4991,7 +4991,7 @@ var safeActiveElement = $.ui.safeActiveElement = function( document ) {
var widgetsMenu = $.widget( "ui.menu", {
- version: "1.13.1",
+ version: "1.13.2",
defaultElement: "
",
delay: 300,
options: {
@@ -5663,7 +5663,7 @@ var widgetsMenu = $.widget( "ui.menu", {
/*!
- * jQuery UI Autocomplete 1.13.1
+ * jQuery UI Autocomplete 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -5682,7 +5682,7 @@ var widgetsMenu = $.widget( "ui.menu", {
$.widget( "ui.autocomplete", {
- version: "1.13.1",
+ version: "1.13.2",
defaultElement: "",
options: {
appendTo: null,
@@ -6319,7 +6319,7 @@ var widgetsAutocomplete = $.ui.autocomplete;
/*!
- * jQuery UI Controlgroup 1.13.1
+ * jQuery UI Controlgroup 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -6340,7 +6340,7 @@ var widgetsAutocomplete = $.ui.autocomplete;
var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
var widgetsControlgroup = $.widget( "ui.controlgroup", {
- version: "1.13.1",
+ version: "1.13.2",
defaultElement: "
",
options: {
direction: "horizontal",
@@ -6604,7 +6604,7 @@ var widgetsControlgroup = $.widget( "ui.controlgroup", {
} );
/*!
- * jQuery UI Checkboxradio 1.13.1
+ * jQuery UI Checkboxradio 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -6624,7 +6624,7 @@ var widgetsControlgroup = $.widget( "ui.controlgroup", {
$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
- version: "1.13.1",
+ version: "1.13.2",
options: {
disabled: null,
label: null,
@@ -6636,8 +6636,7 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
},
_getCreateOptions: function() {
- var disabled, labels;
- var that = this;
+ var disabled, labels, labelContents;
var options = this._super() || {};
// We read the type here, because it makes more sense to throw a element type error first,
@@ -6657,12 +6656,18 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
// We need to get the label text but this may also need to make sure it does not contain the
// input itself.
- this.label.contents().not( this.element[ 0 ] ).each( function() {
+ // The label contents could be text, html, or a mix. We wrap all elements
+ // and read the wrapper's `innerHTML` to get a string representation of
+ // the label, without the input as part of it.
+ labelContents = this.label.contents().not( this.element[ 0 ] );
- // The label contents could be text, html, or a mix. We concat each element to get a
- // string representation of the label, without the input as part of it.
- that.originalLabel += this.nodeType === 3 ? $( this ).text() : this.outerHTML;
- } );
+ if ( labelContents.length ) {
+ this.originalLabel += labelContents
+ .clone()
+ .wrapAll( "" )
+ .parent()
+ .html();
+ }
// Set the label option if we found label text
if ( this.originalLabel ) {
@@ -6870,7 +6875,7 @@ var widgetsCheckboxradio = $.ui.checkboxradio;
/*!
- * jQuery UI Button 1.13.1
+ * jQuery UI Button 1.13.2
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
@@ -6889,7 +6894,7 @@ var widgetsCheckboxradio = $.ui.checkboxradio;
$.widget( "ui.button", {
- version: "1.13.1",
+ version: "1.13.2",
defaultElement: "
'."\n";
// Select of all the sub-BOM lines
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 1681ef45387..9137a3b7c10 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -16,7 +16,7 @@
* Copyright (C) 2016-2022 Charlene Benke
* Copyright (C) 2016 Meziane Sof
* Copyright (C) 2017 Josep Lluís Amador
- * Copyright (C) 2019-2021 Frédéric France
+ * Copyright (C) 2019-2022 Frédéric France
* Copyright (C) 2019-2020 Thibault FOUCART
* Copyright (C) 2020 Pierre Ardoin
*
@@ -1973,7 +1973,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '
'.$langs->trans("Description").'
';
// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
- $doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
+ $doleditor = new DolEditor('desc', GETPOSTISSET('desc') ? GETPOST('desc', 'restricthtml') : $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
$doleditor->Create();
print "
";
@@ -1983,7 +1983,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) {
print '
';
}
diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php
index 2566ca24919..e34b270562e 100644
--- a/htdocs/product/class/api_products.class.php
+++ b/htdocs/product/class/api_products.class.php
@@ -253,7 +253,7 @@ class Products extends DolibarrApi
if (!$ids_only) {
$product_static = new Product($this->db);
if ($product_static->fetch($obj->rowid)) {
- if ($includestockdata && DolibarrApiAccess::$user->rights->stock->lire) {
+ if (!empty($includestockdata) && DolibarrApiAccess::$user->rights->stock->lire) {
$product_static->load_stock();
if (is_array($product_static->stock_warehouse)) {
@@ -1644,10 +1644,10 @@ class Products extends DolibarrApi
$combinations[$key]->attributes = $prodc2vp->fetchByFkCombination((int) $combination->id);
$combinations[$key] = $this->_cleanObjectDatas($combinations[$key]);
- if ($includestock==1 && DolibarrApiAccess::$user->rights->stock->lire) {
+ if (!empty($includestock) && DolibarrApiAccess::$user->rights->stock->lire) {
$productModel = new Product($this->db);
$productModel->fetch((int) $combination->fk_product_child);
- $productModel->load_stock();
+ $productModel->load_stock($includestock);
$combinations[$key]->stock_warehouse = $this->_cleanObjectDatas($productModel)->stock_warehouse;
}
}
@@ -2040,8 +2040,8 @@ class Products extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
- if ($includestockdata && DolibarrApiAccess::$user->rights->stock->lire) {
- $this->product->load_stock();
+ if (!empty($includestockdata) && DolibarrApiAccess::$user->rights->stock->lire) {
+ $this->product->load_stock($includestockdata);
if (is_array($this->product->stock_warehouse)) {
foreach ($this->product->stock_warehouse as $keytmp => $valtmp) {
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 6c249e6b3bd..fde8c453a2e 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -3038,12 +3038,13 @@ class Product extends CommonObject
/**
* Charge tableau des stats commande fournisseur pour le produit/service
*
- * @param int $socid Id societe pour filtrer sur une societe
- * @param string $filtrestatut Id des statuts pour filtrer sur des statuts
- * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
- * @return int Array of stats in $this->stats_commande_fournisseur, <0 if ko or >0 if ok
+ * @param int $socid Id societe pour filtrer sur une societe
+ * @param string $filtrestatut Id des statuts pour filtrer sur des statuts
+ * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
+ * @param int $dateofvirtualstock Date of virtual stock
+ * @return int Array of stats in $this->stats_commande_fournisseur, <0 if ko or >0 if ok
*/
- public function load_stats_commande_fournisseur($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
+ public function load_stats_commande_fournisseur($socid = 0, $filtrestatut = '', $forVirtualStock = 0, $dateofvirtualstock = null)
{
// phpcs:enable
global $conf, $user, $hookmanager, $action;
@@ -3069,6 +3070,9 @@ class Product extends CommonObject
if ($filtrestatut != '') {
$sql .= " AND c.fk_statut in (".$this->db->sanitize($filtrestatut).")"; // Peut valoir 0
}
+ if (!empty($dateofvirtualstock)) {
+ $sql .= " AND c.date_livraison <= '".$this->db->idate($dateofvirtualstock)."'";
+ }
$result = $this->db->query($sql);
if ($result) {
@@ -3181,12 +3185,13 @@ class Product extends CommonObject
/**
* Charge tableau des stats réception fournisseur pour le produit/service
*
- * @param int $socid Id societe pour filtrer sur une societe
- * @param string $filtrestatut Id statut pour filtrer sur un statut
- * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
+ * @param int $socid Id societe pour filtrer sur une societe
+ * @param string $filtrestatut Id statut pour filtrer sur un statut
+ * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
+ * @param int $dateofvirtualstock Date of virtual stock
* @return int Array of stats in $this->stats_reception, <0 if ko or >0 if ok
*/
- public function load_stats_reception($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
+ public function load_stats_reception($socid = 0, $filtrestatut = '', $forVirtualStock = 0, $dateofvirtualstock = null)
{
// phpcs:enable
global $conf, $user, $hookmanager, $action;
@@ -3212,6 +3217,9 @@ class Product extends CommonObject
if ($filtrestatut <> '') {
$sql .= " AND cf.fk_statut IN (".$this->db->sanitize($filtrestatut).")";
}
+ if (!empty($dateofvirtualstock)) {
+ $sql .= " AND fd.datec <= '".$this->db->idate($dateofvirtualstock)."'";
+ }
$result = $this->db->query($sql);
if ($result) {
@@ -3238,12 +3246,13 @@ class Product extends CommonObject
/**
* Charge tableau des stats production pour le produit/service
*
- * @param int $socid Id societe pour filtrer sur une societe
- * @param string $filtrestatut Id statut pour filtrer sur un statut
- * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
+ * @param int $socid Id societe pour filtrer sur une societe
+ * @param string $filtrestatut Id statut pour filtrer sur un statut
+ * @param int $forVirtualStock Ignore rights filter for virtual stock calculation.
+ * @param int $dateofvirtualstock Date of virtual stock
* @return integer Array of stats in $this->stats_mrptoproduce (nb=nb of order, qty=qty ordered), <0 if ko or >0 if ok
*/
- public function load_stats_inproduction($socid = 0, $filtrestatut = '', $forVirtualStock = 0)
+ public function load_stats_inproduction($socid = 0, $filtrestatut = '', $forVirtualStock = 0, $dateofvirtualstock = null)
{
// phpcs:enable
global $conf, $user, $hookmanager, $action;
@@ -3268,6 +3277,9 @@ class Product extends CommonObject
if ($filtrestatut <> '') {
$sql .= " AND m.status IN (".$this->db->sanitize($filtrestatut).")";
}
+ if (!empty($dateofvirtualstock)) {
+ $sql .= " AND m.date_valid <= '".$this->db->idate($dateofvirtualstock)."'"; // better date to code ? end of production ?
+ }
$sql .= " GROUP BY role";
$this->stats_mrptoconsume['customers'] = 0;
@@ -5037,7 +5049,7 @@ class Product extends CommonObject
$result .= (img_object(($notooltip ? '' : $label), 'service', ($notooltip ? 'class="paddingright"' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1));
}
}
- $result .= $newref;
+ $result .= dol_escape_htmltag($newref);
$result .= $linkend;
if ($withpicto != 2) {
$result .= (($add_label && $this->label) ? $sep.dol_trunc($this->label, ($add_label > 1 ? $add_label : 0)) : '');
@@ -5346,10 +5358,11 @@ class Product extends CommonObject
* @param string $option '' = Load all stock info, also from closed and internal warehouses, 'nobatch', 'novirtual'
* You can also filter on 'warehouseclosed', 'warehouseopen', 'warehouseinternal'
* @param int $includedraftpoforvirtual Include draft status of PO for virtual stock calculation
+ * @param int $dateofvirtualstock Date of virtual stock
* @return int < 0 if KO, > 0 if OK
* @see load_virtual_stock(), loadBatchInfo()
*/
- public function load_stock($option = '', $includedraftpoforvirtual = null)
+ public function load_stock($option = '', $includedraftpoforvirtual = null, $dateofvirtualstock = null)
{
// phpcs:enable
global $conf;
@@ -5407,7 +5420,7 @@ class Product extends CommonObject
$this->db->free($result);
if (!preg_match('/novirtual/', $option)) {
- $this->load_virtual_stock($includedraftpoforvirtual); // This also load all arrays stats_xxx...
+ $this->load_virtual_stock($includedraftpoforvirtual, $dateofvirtualstock); // This also load all arrays stats_xxx...
}
return 1;
@@ -5424,10 +5437,11 @@ class Product extends CommonObject
* This function need a lot of load. If you use it on list, use a cache to execute it one for each product id.
*
* @param int $includedraftpoforvirtual Include draft status and not yet approved Purchase Orders for virtual stock calculation
+ * @param int $dateofvirtualstock Date of virtual stock
* @return int < 0 if KO, > 0 if OK
* @see load_stock(), loadBatchInfo()
*/
- public function load_virtual_stock($includedraftpoforvirtual = null)
+ public function load_virtual_stock($includedraftpoforvirtual = null, $dateofvirtualstock = null)
{
// phpcs:enable
global $conf, $hookmanager, $action;
@@ -5466,7 +5480,7 @@ class Product extends CommonObject
if (isset($includedraftpoforvirtual)) {
$filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
}
- $result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1);
+ $result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock);
if ($result < 0) {
dol_print_error($this->db, $this->error);
}
@@ -5478,7 +5492,7 @@ class Product extends CommonObject
if (isset($includedraftpoforvirtual)) {
$filterStatus = '0,'.$filterStatus;
}
- $result = $this->load_stats_reception(0, $filterStatus, 1);
+ $result = $this->load_stats_reception(0, $filterStatus, 1, $dateofvirtualstock);
if ($result < 0) {
dol_print_error($this->db, $this->error);
}
@@ -5490,14 +5504,14 @@ class Product extends CommonObject
if (isset($includedraftpoforvirtual)) {
$filterStatus = '0,'.$filterStatus;
}
- $result = $this->load_stats_reception(0, $filterStatus, 1); // Use same tables than when module reception is not used.
+ $result = $this->load_stats_reception(0, $filterStatus, 1, $dateofvirtualstock); // Use same tables than when module reception is not used.
if ($result < 0) {
dol_print_error($this->db, $this->error);
}
$stock_reception_fournisseur = $this->stats_reception['qty'];
}
if (!empty($conf->mrp->enabled)) {
- $result = $this->load_stats_inproduction(0, '1,2', 1);
+ $result = $this->load_stats_inproduction(0, '1,2', 1, $dateofvirtualstock);
if ($result < 0) {
dol_print_error($this->db, $this->error);
}
@@ -6196,8 +6210,6 @@ class Product extends CommonObject
}
}
-
-
/**
* Class to manage products or services.
* Do not use 'Service' as class name since it is already used by APIs.
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 49242eb47e4..99d204a1d64 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -471,6 +471,7 @@ if ($id > 0 || $ref) {
print load_fiche_titre($langs->trans("AddSupplierPrice"));
}
+ print "\n";
print '