* 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-2024 Frédéric France * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2024 Vincent Maury * Copyright (C) 2024 MDW * * 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 the 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"; /** * @var CommonObject $this * @var CommonObject $object * @var Form $form * @var Societe $buyer * @var Translate $langs */ // 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; } ' @phan-var-force CommonObject $this @phan-var-force CommonObject $object @phan-var-force Societe $buyer '; global $forceall, $forcetoshowtitlelines, $filtertype; if (empty($forceall)) { $forceall = 0; } if (empty($filtertype)) { $filtertype = 0; } if (!empty($object->element) && $object->element == 'contrat' && !getDolGlobalString('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 (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) { print ''; } print ''; print '
'.$langs->trans('AddNewLine').''; print ''; print ''.$langs->trans('Qty').''; if ($filtertype != 1) { // Product if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; print ''; print $langs->trans('Unit'); print ''; } } else { // Service print '' . $form->textwithpicto($langs->trans('Unit'), '').''; } if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active // Qty frozen print '' . $form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")) . ''; // Disable stock change print '' . $form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')) . ''; // Efficiency print '' . $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')) . ''; } // Service and workstations are active if ($filtertype == 1 && isModEnabled('workstation')) { print '' . $form->textwithpicto($langs->trans('Workstation'), '') . ''; } // Cost print '' . $form->textwithpicto($langs->trans('TotalCost'), '') . ''; print ' '; print ''; } print ''; $coldisplay = 0; // Adds a line numbering column if (getDolGlobalString('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 (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { // hide products in closed warehouse, but show products for internal transfer print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, 'warehouseopen,warehouseinternal', GETPOSTINT('combinations'), 1); } else { print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOSTINT('combinations'), 1); } $urltocreateproduct = DOL_URL_ROOT.'/product/card.php?action=create'.(($filtertype == 1) ? '&leftmenu=service&type=1' : '&leftmenu=product&type=0').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); print ''; echo ''; } if (getDolGlobalString('BOM_SUB_BOM') && $filtertype != 1) { print '
'.$langs->trans("or").'
'.$langs->trans("BOM"); print $form->select_bom('', 'bom_id', 0, 1, 0, '1', '', 1); } 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) { // Product if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $coldisplay++; print ''; print ''; } } else { // Service $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, 1); print ''; } if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active // Qty frozen $coldisplay++; print ''; print ''; // Disable stock change $coldisplay++; print ''; print ''; // Efficiency $coldisplay++; print ''; print ''; print ''; } // Service and workstations are active if ($filtertype == 1 && isModEnabled('workstation')) { $coldisplay++; print ''; print $formproduct->selectWorkstations('', 'idworkstations', 1); print ''; } // Cost $coldisplay++; print ''; print ' '; print ''; $coldisplay += $colspan; print ''; print ''; print ''; print ''; ?>