* Copyright (C) 2010-2022 Laurent Destailleur * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2013 Florian Henry * Copyright (C) 2018 Frédéric France * Copyright (C) 2022 OpenDSI * * 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 * $seller, $buyer * $dateSelector * $forceall (0 by default, 1 for supplier invoices/orders) * $senderissupplier (0 by default, 1 for supplier invoices/orders) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) * $canchangeproduct (0 by default, 1 to allow to change the product if it is a predefined product) */ // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { print "Error, template page can't be called as URL"; exit; } $usemargins = 0; if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { $usemargins = 1; } global $forceall, $senderissupplier, $inputalsopricewithtax, $canchangeproduct; if (empty($dateSelector)) { $dateSelector = 0; } if (empty($forceall)) { $forceall = 0; } if (empty($senderissupplier)) { $senderissupplier = 0; } if (empty($inputalsopricewithtax)) { $inputalsopricewithtax = 0; } if (empty($canchangeproduct)) { $canchangeproduct = 0; } // Define colspan for the button 'Add' $colspan = 3; // Col total ht + col edit + col delete if (!empty($inputalsopricewithtax)) { $colspan++; // We add 1 if col total ttc } if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'facturerec', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) { $colspan++; // With this, there is a column move button } if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) { $colspan += 2; } if (isModEnabled('asset') && $object->element == 'invoice_supplier') { $colspan++; } print "\n"; $coldisplay = 0; ?> global->MAIN_VIEW_LINE_NUMBER)) { ?>
fk_product > 0) { ?> fk_parent_line > 0) { echo img_picto('', 'rightarrow'); } ?> product_type == 1) { echo img_object($langs->trans('ShowService'), 'service'); } else { print img_object($langs->trans('ShowProduct'), 'product'); } echo ' '.$line->ref; ?> product_label); print ''; } else { if ($senderissupplier) { $form->select_produits_fournisseurs(!empty($line->fk_product) ? $line->fk_product : 0, 'productid'); } else { print $form->select_produits(!empty($line->fk_product) ? $line->fk_product : 0, 'productid'); } } ?>

fk_parent_line); $parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer); $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); } $situationinvoicelinewithparent = 0; if ($line->fk_prev_id != null && in_array($object->element, array('facture', 'facturedet'))) { if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice // Set constant to disallow editing during a situation cycle $situationinvoicelinewithparent = 1; } } // Do not allow editing during a situation cycle if (!$situationinvoicelinewithparent) { // editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $nbrows = ROWS_2; if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; } $enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); $toolbarname = 'dolibarr_details'; if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { $toolbarname = 'dolibarr_notes'; } $doleditor = new DolEditor('product_desc', GETPOSTISSET('product_desc') ? GETPOST('product_desc', 'restricthtml') : $line->description, '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT) ? 164 : $conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enable, $nbrows, '98%'); $doleditor->Create(); } else { print ''; } //Line extrafield if (!empty($extrafields)) { $temps = $line->showOptionals($extrafields, 'edit', array('class'=>'tredited'), '', '', 1, 'line'); if (!empty($temps)) { print '
'; print $temps; print '
'; } } // Show autofill date for recuring invoices if (isModEnabled("service") && $line->product_type == 1 && ($line->element == 'facturedetrec' || $line->element == 'invoice_supplier_det_rec')) { if ($line->element == 'invoice_supplier_det_rec') { $line->date_start_fill = $line->date_start; $line->date_end_fill = $line->date_end; } echo '
'; echo $langs->trans('AutoFillDateFrom').' '; echo $form->selectyesno('date_start_fill', GETPOSTISSET('date_start_fill') ? GETPOST('date_start_fill', 'int') : $line->date_start_fill, 1); echo ' - '; echo $langs->trans('AutoFillDateTo').' '; echo $form->selectyesno('date_end_fill', GETPOSTISSET('date_end_fill') ? GETPOST('date_end_fill', 'int') : $line->date_end_fill, 1); } ?> element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { // We must have same test in printObjectLines $coldisplay++; ?> fk_fournprice.'">'; } // VAT Rate $coldisplay++; if (!$situationinvoicelinewithparent) { print ''; print $form->load_tva('tva_tx', GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : ($line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : '')), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1); print ''; } else { print '%'; } $coldisplay++; print ''; if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) { $coldisplay++; print ''; } if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { $coldisplay++; $upinctax = isset($line->pu_ttc) ? $line->pu_ttc : null; if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) { $upinctax = price2num($line->total_ttc / $line->qty, 'MU'); } print 'fk_prev_id != null) { print ' readonly'; } print '>'; } ?> info_bits & 2) != 2) { // I comment warning of stock because it shows the info even when it should not. // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated // must also not be output for most entities (proposal, intervention, ...) //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; print ''; } else { ?>   global->PRODUCT_USE_UNITS)) { $unit_type = false; // limit unit select to unit type if (!empty($line->fk_unit) && empty($conf->global->MAIN_EDIT_LINE_ALLOW_ALL_UNIT_TYPE)) { include_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; $cUnit = new CUnits($line->db); if ($cUnit->fetch($line->fk_unit) > 0) { if (!empty($cUnit->unit_type)) { $unit_type = $cUnit->unit_type; } } } $coldisplay++; print ''; print $form->selectUnits(GETPOSTISSET('units') ? GETPOST('units') : $line->fk_unit, "units", 0, $unit_type); print ''; } ?> info_bits & 2) != 2) { print '%'; } else { ?>   situation_cycle_ref) { $coldisplay++; print '%'; $coldisplay++; print ''; } if (!empty($usemargins)) { if (!empty($user->rights->margins->creer)) { $coldisplay++; ?> rights->margins->creer) { if (!empty($conf->global->DISPLAY_MARGIN_RATES)) { $margin_rate = (GETPOSTISSET("np_marginRate") ? GETPOST("np_marginRate", "alpha", 2) : (($line->pa_ht == 0) ? '' : price($line->marge_tx))); // if credit note, dont allow to modify margin if ($line->subprice < 0) { echo ''.$margin_rate.'%'; } else { echo '%'; } $coldisplay++; } if (!empty($conf->global->DISPLAY_MARK_RATES)) { $mark_rate = (GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : price($line->marque_tx)); // if credit note, dont allow to modify margin if ($line->subprice < 0) { echo ''.$mark_rate.'%'; } else { echo '%'; } $coldisplay++; } } } ?> ">
"> product_type == 1 && $dateSelector) { ?> global->MAIN_VIEW_LINE_NUMBER)) { ?> trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : ''); print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start ? 0 : 1, "updateline", 1, 0); print ' '.$langs->trans('to').' '; print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end ? 0 : 1, "updateline", 1, 0); print '' ?>