diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php
index f6aba7f2597..c35dd303dcc 100644
--- a/htdocs/mrp/mo_production.php
+++ b/htdocs/mrp/mo_production.php
@@ -257,6 +257,7 @@ if (empty($reshook)) {
// Process line to produce
$pos = 0;
+
foreach ($object->lines as $line) {
if ($line->role == 'toproduce') {
$tmpproduct = new Product($db);
@@ -430,6 +431,8 @@ $tmpstockmovement = new MouvementStock($db);
$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication';
llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, array('/mrp/js/lib_dispatch.js.php'));
+$newToken = newToken();
+
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
$res = $object->fetch_thirdparty();
@@ -588,7 +591,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($object->status == $object::STATUS_DRAFT) {
if ($permissiontoadd) {
if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
- print ''.$langs->trans("Validate").'';
+ print ''.$langs->trans("Validate").'';
} else {
$langs->load("errors");
print ''.$langs->trans("Validate").'';
@@ -599,7 +602,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Consume or produce
if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) {
if ($permissiontoproduce) {
- print 'id.'&action=consumeorproduce">'.$langs->trans('ConsumeOrProduce').'';
+ print 'id.'&action=consumeorproduce&token='.$newToken.'">'.$langs->trans('ConsumeOrProduce').'';
} else {
print ''.$langs->trans('ConsumeOrProduce').'';
}
@@ -610,7 +613,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// ConsumeAndProduceAll
if ($object->status == Mo::STATUS_VALIDATED || $object->status == Mo::STATUS_INPROGRESS) {
if ($permissiontoproduce) {
- print 'id.'&action=consumeandproduceall">'.$langs->trans('ConsumeAndProduceAll').'';
+ print 'id.'&action=consumeandproduceall&token='.$newToken.'">'.$langs->trans('ConsumeAndProduceAll').'';
} else {
print ''.$langs->trans('ConsumeAndProduceAll').'';
}
@@ -627,21 +630,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$nbProduced += $lineproduced['qty'];
}
if ($nbProduced > 0) { // If production has started, we can close it
- print 'id.'&action=confirm_produced&confirm=yes">'.$langs->trans("Close").''."\n";
+ print 'id.'&action=confirm_produced&confirm=yes&token='.$newToken.'">'.$langs->trans("Close").''."\n";
} else {
print 'transnoentitiesnoconv("Production")).'">'.$langs->trans("Close").''."\n";
}
- print 'id.'&action=confirm_close&confirm=yes">'.$langs->trans("Cancel").''."\n";
+ print 'id.'&action=confirm_close&confirm=yes&token='.$newToken.'">'.$langs->trans("Cancel").''."\n";
}
if ($object->status == $object::STATUS_CANCELED) {
- print 'id.'&action=confirm_reopen&confirm=yes">'.$langs->trans("Re-Open").''."\n";
+ print 'id.'&action=confirm_reopen&confirm=yes&token='.$newToken.'">'.$langs->trans("Re-Open").''."\n";
}
if ($object->status == $object::STATUS_PRODUCED) {
if ($permissiontoproduce) {
- print 'id.'&action=confirm_reopen">'.$langs->trans('ReOpen').'';
+ print 'id.'&action=confirm_reopen&token='.$newToken.'">'.$langs->trans('ReOpen').'';
} else {
print ''.$langs->trans('ReOpen').'';
}