From 7040330914be2ce84b4009c2d03b00d0fd7ef687 Mon Sep 17 00:00:00 2001 From: altairis-noe Date: Wed, 14 Apr 2021 10:13:31 +0200 Subject: [PATCH] project select in edit or create warehouse --- htdocs/product/stock/card.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 7f2f8f58bb5..39c4c525696 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Simon Tosser * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2016 Francis Appels + * Copyright (C) 2021 NoĆ© Cendrier * * 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 @@ -35,6 +36,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +if (!empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} + // Load translation files required by the page $langs->loadLangs(array('products', 'stocks', 'companies', 'categories')); @@ -238,6 +244,9 @@ $form = new Form($db); $formproduct = new FormProduct($db); $formcompany = new FormCompany($db); $formfile = new FormFile($db); +if (!empty($conf->projet->enabled)) { + $formproject = new FormProjets($db); +} $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("", $langs->trans("WarehouseCard"), $help_url); @@ -267,6 +276,15 @@ if ($action == 'create') { print img_picto('', 'stock').$formproduct->selectWarehouses((GETPOSTISSET('fk_parent') ? GETPOST('fk_parent', 'int') : 'ifone'), 'fk_parent', '', 1); print ''; + // Project + if (!empty($conf->projet->enabled)) { + $langs->load('projects'); + print ''.$langs->trans('Project').''; + print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; + print ''; + } + // Description print ''.$langs->trans("Description").''; // Editeur wysiwyg @@ -382,6 +400,11 @@ if ($action == 'create') { $morehtmlref = '
'; $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu; $morehtmlref .= '
'; + if ($object->project) { + $morehtmlref .= '
'; + $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu; + $morehtmlref .= '
'; + } $shownav = 1; if ($user->socid && !in_array('stock', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) { @@ -707,6 +730,15 @@ if ($action == 'create') { print $formproduct->selectWarehouses($object->fk_parent, 'fk_parent', '', 1); print ''; + // Project + if (!empty($conf->projet->enabled)) { + $langs->load('projects'); + print ''.$langs->trans('Project').''; + print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; + print ''; + } + // Description print ''.$langs->trans("Description").''; // Editeur wysiwyg