* Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2015-2016 Marcos García * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Ferran Marcet * * 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 * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Need to have following variables defined: * $object (invoice, order, ...) * $conf * $langs * $forceall (0 by default, 1 for supplier invoices/orders) */ require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"; // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error: this template page cannot be called directly as an URL"; exit; } global $forceall, $forcetoshowtitlelines, $filtertype; if (empty($forceall)) { $forceall = 0; } if (empty($filtertype)) $filtertype = 0; if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->STOCK_SUPPORT_SERVICES)) { $filtertype = -1; } $formproduct = new FormProduct($object->db); // Define colspan for the button 'Add' $colspan = 3; // Columns: total ht + col edit + col delete //print $object->element; // Lines for extrafield $objectline = new BOMLine($this->db); print "\n"; $nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines); if ($nolinesbefore) { print ''; if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print ''; } print ''; print '
'.$langs->trans('AddNewLine').''; print ''; print ''.$langs->trans('Qty').''; if ($filtertype != 1) { if (!empty($conf->global->PRODUCT_USE_UNITS)) { print ''; print ''; print $langs->trans('Unit'); print ''; } print '' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . ''; print '' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . ''; print '' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . ''; } else { print '' . $form->textwithpicto($langs->trans('Unit'), '').''; if (isModEnabled('workstation')) print '' . $form->textwithpicto($langs->trans('Workstation'), '') . ''; print '' . $form->textwithpicto($langs->trans('TotalCost'), '') . ''; } print ' '; print ''; } print ''; $coldisplay = 0; // Adds a line numbering column if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay++; echo ''; } $coldisplay++; print ''; // Predefined product/service if (isModEnabled("product") || isModEnabled("service")) { if ($filtertype == 1) { print $langs->trans("Service"); } else { print $langs->trans("Product"); } echo ''; $statustoshow = -1; if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { // hide products in closed warehouse, but show products for internal transfer $form->select_produits(GETPOST('idprod', 'int'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } else { $form->select_produits(GETPOST('idprod', 'int'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } echo ''; } if (!empty($conf->global->BOM_SUB_BOM) && $filtertype!=1) { print '
'.$langs->trans("or").'
'.$langs->trans("BOM"); // TODO Add component to select a BOM $form->select_bom(); } if (is_object($objectline)) { $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); if (!empty($temps)) { print '
'; print $temps; print '
'; } } print ''; $coldisplay++; print ''; print ''; if ($filtertype != 1) { if (!empty($conf->global->PRODUCT_USE_UNITS)) { $coldisplay++; print ''; print ''; } $coldisplay++; print ''; print ''; $coldisplay++; print ''; print ''; $coldisplay++; print ''; print ''; print ''; $coldisplay++; print ''; print ' '; print ''; } else { $coldisplay++; require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; $cUnit = new CUnits($this->db); $fk_unit_default = $cUnit->getUnitFromCode('h', 'short_label', 'time'); print ''; print $formproduct->selectMeasuringUnits("fk_unit", "time", $fk_unit_default, 0, 0); print ''; $coldisplay++; print ''; print ' '; print ''; $coldisplay++; print ''; print ' '; print ''; } $coldisplay += $colspan; print ''; print ''; print ''; print ''; if (is_object($objectline)) { print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1, 'line'); } ?>