From 38aa64836351d83f2d1087cfb561def8ab827d14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Oct 2019 11:38:35 +0200 Subject: [PATCH] Autofill the MO with data from BOM --- htdocs/mrp/ajax/ajax_bom.php | 7 +++++-- htdocs/mrp/mo_card.php | 32 ++++++++++++++++++++++++++------ htdocs/mrp/mo_document.php | 1 - htdocs/mrp/mo_list.php | 1 - htdocs/mrp/mo_note.php | 1 - 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/htdocs/mrp/ajax/ajax_bom.php b/htdocs/mrp/ajax/ajax_bom.php index 7f5a2040403..761a54876ee 100644 --- a/htdocs/mrp/ajax/ajax_bom.php +++ b/htdocs/mrp/ajax/ajax_bom.php @@ -43,9 +43,12 @@ $action = GETPOST('action', 'alpha'); $object = new BOM($db); $result=$object->fetch($idbom); -if ($result) +if ($result > 0) { - echo json_encode($result); + // We remove properties we don't need in answer + unset ($object->fields); + unset ($object->db); + echo json_encode($object); } else { diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index f15b45b96e5..15a1aeff0a1 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- * * 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 @@ -204,16 +203,37 @@ if ($action == 'create') dol_fiche_end(); - print ' + ?> - '; + '; print ''; diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 09f34ae583e..351274de4b8 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- * * 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 diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 2f32058a41f..81cb781ccff 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- * * 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 diff --git a/htdocs/mrp/mo_note.php b/htdocs/mrp/mo_note.php index a006f79a609..d7429a4da86 100644 --- a/htdocs/mrp/mo_note.php +++ b/htdocs/mrp/mo_note.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- * * 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