Skip to content

Commit

Permalink
CLOSE Dolibarr#26384 Implement STATUS_OPENEXT_ALL for use of non-coun…
Browse files Browse the repository at this point in the history
…ting warehouses e.g. quarantine

This feature complements the need explained in Dolibarr#26384 and the implementation of the STATUS_OPENEXT_ALL warehouse type. With the changes a warehouse can be used e.g. as a quarantine warehouse or a temporary pre-QC warehouse. The status "Open (omitted from stock calculation)" keeps the definition vague enough as not to constrain the use of this status too much in the sense of "either quarantine or pre-QC".
For code-readability and convenience the change is using the load_stock and loadWarehouses implementation. As the option of warehouseclosed, warehouseopen and warehouseinternal is already introduced in the code we can piggyback ride with the introduction of the STATUS_OPENEXT_ALL onto the product list view, stock transfer, delivery selection etc.
  • Loading branch information
DaBootO committed Jun 29, 2024
1 parent b574fe4 commit 0d069b4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions htdocs/langs/en_US/stocks.lang
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ NoPendingReceptionOnSupplierOrder=No pending reception due to open purchase orde
ThisSerialAlreadyExistWithDifferentDate=This lot/serial number (<strong>%s</strong>) already exists but with different eatby or sellby date (found <strong>%s</strong> but you enter <strong>%s</strong>).
OpenAnyMovement=Open (all movement)
OpenInternal=Open (only internal movement)
OpenExtAll=Open (omitted from stock calculation)
UseDispatchStatus=Use a dispatch status (approve/refuse) for product lines on purchase order reception
OptionMULTIPRICESIsOn=Option "several prices per segment" is on. It means a product has several selling price so value for sell can't be calculated
ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock correctly created
Expand Down
7 changes: 4 additions & 3 deletions htdocs/product/class/html.formproduct.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumS
$warehouseStatus = array();

if (preg_match('/warehouseclosed/', $status)) {
$warehouseStatus[] = Entrepot::STATUS_CLOSED;
$warehouseStatus[Entrepot::STATUS_CLOSED] = Entrepot::STATUS_CLOSED;
}
if (preg_match('/warehouseopen/', $status)) {
$warehouseStatus[] = Entrepot::STATUS_OPEN_ALL;
$warehouseStatus[Entrepot::STATUS_OPEN_ALL] = Entrepot::STATUS_OPEN_ALL;
}
if (preg_match('/warehouseinternal/', $status)) {
$warehouseStatus[] = Entrepot::STATUS_OPEN_INTERNAL;
$warehouseStatus[Entrepot::STATUS_OPEN_INTERNAL] = Entrepot::STATUS_OPEN_INTERNAL;
$warehouseStatus[Entrepot::STATUS_OPENEXT_ALL] = Entrepot::STATUS_OPENEXT_ALL;
}

$sql = "SELECT e.rowid, e.ref as label, e.description, e.fk_parent";
Expand Down
1 change: 1 addition & 0 deletions htdocs/product/class/product.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -5863,6 +5863,7 @@ public function load_stock($option = '', $includedraftpoforvirtual = null, $date
if (preg_match('/warehouseinternal/', $option)) {
if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) {
$warehouseStatus[Entrepot::STATUS_OPEN_INTERNAL] = Entrepot::STATUS_OPEN_INTERNAL;
$warehouseStatus[Entrepot::STATUS_OPENEXT_ALL] = Entrepot::STATUS_OPENEXT_ALL;
} else {
$warehouseStatus[Entrepot::STATUS_OPEN_ALL] = Entrepot::STATUS_OPEN_ALL;
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@
// STOCK_DISABLE_OPTIM_LOAD can be set to force load_stock whatever is permissions on stock.
if ((isModEnabled('stock') && $user->hasRight('stock', 'lire') && $search_type != 1) || getDolGlobalString('STOCK_DISABLE_OPTIM_LOAD')) { // To optimize call of load_stock
if ($product_static->type != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Not a service
$option = 'nobatch';
$option = 'nobatch,warehouseopen';
if (empty($arrayfields['stock_virtual']['checked'])) {
$option .= ',novirtual';
}
Expand Down
3 changes: 2 additions & 1 deletion htdocs/product/stock/class/entrepot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Entrepot extends CommonObject
/**
* Warehouse open and any operations are allowed, but warehouse is not included into calculation of stock.
*/
const STATUS_OPENEXT_ALL = 3; // TODO Implement this
const STATUS_OPENEXT_ALL = 3;



Expand All @@ -220,6 +220,7 @@ public function __construct($db)
if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) {
$this->labelStatus[self::STATUS_OPEN_ALL] = 'OpenAnyMovement';
$this->labelStatus[self::STATUS_OPEN_INTERNAL] = 'OpenInternal';
$this->labelStatus[self::STATUS_OPENEXT_ALL] = 'OpenExtAll';
} else {
$this->labelStatus[self::STATUS_OPEN_ALL] = 'Opened';
}
Expand Down

0 comments on commit 0d069b4

Please sign in to comment.