-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
140 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* Copyright (C) 2019 Laurent Destailleur <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
|
@@ -35,7 +35,6 @@ | |
* @var Conf $conf | ||
* @var DoliDB $db | ||
* @var HookManager $hookmanager | ||
* @var Societe $mysoc | ||
* @var Translate $langs | ||
* @var User $user | ||
*/ | ||
|
@@ -263,13 +262,15 @@ | |
|
||
$mrp = new Mo($db); | ||
$mrp->initAsSpecimen(); | ||
$product = new Product($db); | ||
$product->initAsSpecimen(); | ||
|
||
// Info | ||
$htmltooltip = ''; | ||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; | ||
$mrp->type = 0; | ||
$nextval = $module->getNextValue($mysoc, $mrp); | ||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval | ||
$nextval = $module->getNextValue($product, $mrp); | ||
if ((string) $nextval != $langs->trans("NotAvailable")) { | ||
$htmltooltip .= ''.$langs->trans("NextValue").': '; | ||
if ($nextval) { | ||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { | ||
|
@@ -282,7 +283,7 @@ | |
} | ||
|
||
print '<td class="center">'; | ||
print $form->textwithpicto('', $htmltooltip, 1, 0); | ||
print $form->textwithpicto('', $htmltooltip, 1, 'info'); | ||
print '</td>'; | ||
|
||
print "</tr>\n"; | ||
|
@@ -417,7 +418,7 @@ | |
|
||
|
||
print '<td class="center">'; | ||
print $form->textwithpicto('', $htmltooltip, 1, 0); | ||
print $form->textwithpicto('', $htmltooltip, 1, 'info'); | ||
print '</td>'; | ||
|
||
// Preview | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<?php | ||
/* Copyright (C) 2019 Laurent Destailleur (eldy) <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* Copyright (C) 2025 MDW <[email protected]> | ||
* | ||
* 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 | ||
|
@@ -52,7 +53,7 @@ | |
* @var User $user | ||
*/ | ||
|
||
$idbom = GETPOST('idbom', 'alpha'); | ||
$idbom = GETPOSTINT('idbom'); | ||
//$action = GETPOST('action', 'aZ09'); | ||
|
||
$object = new BOM($db); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
/* Copyright (C) 2015 Jean-François Ferry <[email protected]> | ||
* Copyright (C) 2019 Maxime Kohlhaas <[email protected]> | ||
* Copyright (C) 2024 MDW <[email protected]> | ||
* Copyright (C) 2024-2025 MDW <[email protected]> | ||
* Copyright (C) 2024 Frédéric France <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
|
@@ -38,7 +38,7 @@ | |
class Mos extends DolibarrApi | ||
{ | ||
/** | ||
* @var Mo $mo {@type Mo} | ||
* @var Mo {@type Mo} | ||
*/ | ||
public $mo; | ||
|
||
|
@@ -94,6 +94,8 @@ public function get($id) | |
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" | ||
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names | ||
* @return array Array of order objects | ||
* @phan-return Mo[] | ||
* @phpstan-return Mo[] | ||
* | ||
* @throws RestException | ||
*/ | ||
|
@@ -175,6 +177,8 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, | |
* Create MO object | ||
* | ||
* @param array $request_data Request datas | ||
* @phan-param ?array<string,string> $request_data | ||
* @phpstan-param ?array<string,string> $request_data | ||
* @return int ID of MO | ||
*/ | ||
public function post($request_data = null) | ||
|
@@ -208,6 +212,8 @@ public function post($request_data = null) | |
* | ||
* @param int $id Id of MO to update | ||
* @param array $request_data Datas | ||
* @phan-param ?array<string,string> $request_data | ||
* @phpstan-param ?array<string,string> $request_data | ||
* @return Object Updated object | ||
*/ | ||
public function put($id, $request_data = null) | ||
|
@@ -259,6 +265,8 @@ public function put($id, $request_data = null) | |
* | ||
* @param int $id MO ID | ||
* @return array | ||
* @phan-return array<string,array{code:int,message:string}> | ||
* @phpstan-return array<string,array{code:int,message:string}> | ||
*/ | ||
public function delete($id) | ||
{ | ||
|
@@ -312,6 +320,8 @@ public function delete($id) | |
* | ||
* @param int $id ID of state | ||
* @param array $request_data Request datas | ||
* @phan-param ?array<string,string> $request_data | ||
* @phpstan-param ?array<string,string> $request_data | ||
* | ||
* @url POST {id}/produceandconsumeall | ||
* | ||
|
@@ -431,7 +441,7 @@ public function produceAndConsumeAll($id, $request_data = null) | |
$error++; | ||
throw new RestException(500, $moline->error); | ||
} | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $value["objectid"], $value["fk_warehouse"], $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $value["objectid"], $value["fk_warehouse"], $qtytoprocess, 0, $labelmovement, dol_now(), '', '', (string) $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
} else { | ||
$moline = new MoLine($this->db); | ||
$moline->fk_mo = $this->mo->id; | ||
|
@@ -450,7 +460,7 @@ public function produceAndConsumeAll($id, $request_data = null) | |
$error++; | ||
throw new RestException(500, $moline->error); | ||
} | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $value["objectid"], $value["fk_warehouse"], $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $value["objectid"], $value["fk_warehouse"], $qtytoprocess, 0, $labelmovement, '', '', (string) $tmpproduct->status_batch, dol_now(), $id_product_batch, $codemovement); | ||
} | ||
if ($idstockmove < 0) { | ||
$error++; | ||
|
@@ -519,9 +529,9 @@ public function produceAndConsumeAll($id, $request_data = null) | |
$stockmove->origin_type = 'mo'; | ||
$stockmove->origin_id = $this->mo->id; | ||
if ($qtytoprocess >= 0) { | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', (string) $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
} else { | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, '', '', (string) $tmpproduct->status_batch, dol_now(), $id_product_batch, $codemovement); | ||
} | ||
if ($idstockmove < 0) { | ||
$error++; | ||
|
@@ -579,9 +589,9 @@ public function produceAndConsumeAll($id, $request_data = null) | |
$stockmove->origin_type = 'mo'; | ||
$stockmove->origin_id = $this->mo->id; | ||
if ($qtytoprocess >= 0) { | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, '', '', (string) $tmpproduct->status_batch, dol_now(), $id_product_batch, $codemovement); | ||
} else { | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $line->fk_product, $line->fk_warehouse, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', (string) $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
} | ||
if ($idstockmove < 0) { | ||
$error++; | ||
|
@@ -688,6 +698,8 @@ public function produceAndConsumeAll($id, $request_data = null) | |
* | ||
* @param int $id ID of state | ||
* @param array $request_data Request datas | ||
* @phan-param ?array<string,string> $request_data | ||
* @phpstan-param ?array<string,string> $request_data | ||
* | ||
* @url POST {id}/produceandconsume | ||
* | ||
|
@@ -803,15 +815,15 @@ public function produceAndConsume($id, $request_data = null) | |
$stockmove->origin_id = $this->mo->id; | ||
if ($arrayname == "arraytoconsume") { | ||
if ($qtytoprocess >= 0) { | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $molinetoprocess->fk_product, $fk_warehousetoprocess, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $molinetoprocess->fk_product, $fk_warehousetoprocess, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', (string) $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
} else { | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $molinetoprocess->fk_product, $fk_warehousetoprocess, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $molinetoprocess->fk_product, $fk_warehousetoprocess, $qtytoprocess, 0, $labelmovement, '', '', (string) $tmpproduct->status_batch, dol_now(), $id_product_batch, $codemovement); | ||
} | ||
} else { | ||
if ($qtytoprocess >= 0) { | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $molinetoprocess->fk_product, $fk_warehousetoprocess, $qtytoprocess, $pricetoproduce, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->reception(DolibarrApiAccess::$user, $molinetoprocess->fk_product, $fk_warehousetoprocess, $qtytoprocess, $pricetoproduce, $labelmovement, '', '', (string) $tmpproduct->status_batch, dol_now(), $id_product_batch, $codemovement); | ||
} else { | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $molinetoprocess->fk_product, $fk_warehousetoprocess, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
$idstockmove = $stockmove->livraison(DolibarrApiAccess::$user, $molinetoprocess->fk_product, $fk_warehousetoprocess, $qtytoprocess, 0, $labelmovement, dol_now(), '', '', (string) $tmpproduct->status_batch, $id_product_batch, $codemovement); | ||
} | ||
} | ||
if ($idstockmove <= 0) { | ||
|
@@ -962,10 +974,10 @@ protected function _cleanObjectDatas($object) | |
} | ||
|
||
/** | ||
* Validate fields before create or update object | ||
* Validate fields before creating or updating an object | ||
* | ||
* @param array $data Array of data to validate | ||
* @return array | ||
* @param ?array<null|int|float|string> $data Data to validate | ||
* @return array<string,null|int|float|string> | ||
* | ||
* @throws RestException | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.