diff --git a/htdocs/reception/tpl/objectline_create.tpl.php b/htdocs/reception/tpl/objectline_create.tpl.php new file mode 100644 index 00000000000..344279239c4 --- /dev/null +++ b/htdocs/reception/tpl/objectline_create.tpl.php @@ -0,0 +1,186 @@ + + * 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-2025 MDW + * Copyright (C) 2025 Nick Fragoulis + * + * 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; +} + +$formproduct = new FormProduct($object->db); + +// Define colspan for the button 'Add' +$colspan = 3; + + +// Lines for extrafield +$objectline = new ReceptionLineBatch($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 (getDolGlobalInt('PRODUCT_USE_UNITS')) { + print ''; + print ''; + print $langs->trans('Unit'); + print ''; + } + + print ''; +} + +print ''; +$coldisplay = 0; + +// Adds a line numbering column +if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) { + $coldisplay++; + echo ''; +} + +// Product +$coldisplay++; +print ''; + +// Predefined product/service +if (isModEnabled("product")) { + if ($filtertype == 1) { + print $langs->trans("Service"); + } else { + print $langs->trans("Product"); + } + + echo ''; + + $statustoshow = -1; + + echo ''; +} + + +if (!empty($extrafields)) { + $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', '1', 'line'); + + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; + } +} +print ''; + +// Qty +$coldisplay++; +print ''; +print ''; + +// Unit +if (getDolGlobalInt('PRODUCT_USE_UNITS')) { + $coldisplay++; + print ''; + print ''; +} + +$coldisplay += $colspan; +print ''; +print ''; +print ''; +print ''; + +?> + + + + diff --git a/htdocs/reception/tpl/objectline_edit.tpl.php b/htdocs/reception/tpl/objectline_edit.tpl.php new file mode 100644 index 00000000000..4f22caeac22 --- /dev/null +++ b/htdocs/reception/tpl/objectline_edit.tpl.php @@ -0,0 +1,165 @@ + + * Copyright (C) 2010-2012 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-2024 Frédéric France + * Copyright (C) 2024 Vincent Maury + * Copyright (C) 2024 MDW + * Copyright (C) 2025 Nick Fragoulis + * + * 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 + * $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) + */ + +require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"; + +/** + * @var CommonObject $this + * @var CommonObject $object + * @var HookManager $hookmanager + * @var CommonObjectLine $line + * @var Societe $buyer + * @var Societe $seller + * @var Translate $langs + * + * @var string $action + * @var int $i + * @var bool $var + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error, template page can't be called as URL"; + exit(1); +} + +' +@phan-var-force receptionlinebatch $line +@phan-var-force CommonObject $this +@phan-var-force CommonObject $object +@phan-var-force int $i +@phan-var-force bool $var +@phan-var-force Societe $buyer +@phan-var-force Societe $seller +'; + +global $forceall, $filtertype; + +if (empty($forceall)) { + $forceall = 0; +} + +if (empty($filtertype)) { + $filtertype = 0; +} + +$formproduct = new FormProduct($object->db); +$form = new Form($object->db); + +// Define colspan for the button 'Add' +$colspan = 3; + +// Lines for extrafield +$objectline = new ReceptionLineBatch($this->db); + +print "\n"; + +$coldisplay = 0; +print ''; +// Adds a line numbering column +if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) { + print ''.($i + 1).''; + $coldisplay++; +} + +$coldisplay++; +?> + +
+ + + + + + +fk_product > 0) { + $tmpproduct = new Product($object->db); + $tmpproduct->fetch($line->fk_product); + print $tmpproduct->getNomUrl(1); + print ' - '.$tmpproduct->label; +} + +//Line extrafield +if (!empty($extrafields)) { + $temps = $line->showOptionals($extrafields, 'edit', array('class' => 'tredited'), '', '', '1', 'line'); + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; + } +} + +print ''; + +$coldisplay++; + +print ''; + +if (((int) $line->info_bits & 2) != 2) { + print ''; +} +print ''; + + +if (getDolGlobalString('PRODUCT_USE_UNITS')) { + $unit_type = false; + // limit unit select to unit type + if (!empty($line->fk_unit) && !getDolGlobalString('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((int) $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 ''; +} + +$coldisplay += $colspan; +print ''; +$coldisplay += $colspan; +print ''; +print ''; +print ''; +print ''; + +print "\n"; diff --git a/htdocs/reception/tpl/objectline_title.tpl.php b/htdocs/reception/tpl/objectline_title.tpl.php new file mode 100644 index 00000000000..fc3d09be0fa --- /dev/null +++ b/htdocs/reception/tpl/objectline_title.tpl.php @@ -0,0 +1,101 @@ + + * Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2017 Juanjo Menent + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Nick Fragoulis + * + * 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 + * $element (used to test $user->hasRight($element, 'creer')) + * $permtoedit (used to replace test $user->hasRight($element, 'creer')) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $outputalsopricetotalwithtax + * $usemargins (0 to disable all margins columns, 1 to show according to margin setup) + * + * $type, $text, $description, $line + */ +/** + * @var CommonObject $this + * @var CommonObject $object + * @var Form $form + * @var Translate $langs + * + * @var string $action + */ + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error, template page can't be called as URL"; + exit(1); +} + +'@phan-var-force CommonObject $this + @phan-var-force CommonObject $object'; + +global $filtertype; +if (empty($filtertype)) { + $filtertype = 0; +} + +print "\n"; + + +// Title line +print "\n"; + +print ''; + +// Adds a line numbering column +if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) { + print ' '; +} + +// Product +print ''.$langs->trans('Description'); + +// Qty +print ''.$langs->trans('Qty').''; + + +// Unit +if (getDolGlobalString('PRODUCT_USE_UNITS')) { + print ''.$langs->trans('Unit').''; +} + +print ''; // No width to allow autodim + +print ''; + +print ''; + +if ($action == 'selectlines') { + print ''; + print ''; + print ''; + print ''; +} + +print "\n"; +print "\n"; + +print "\n"; diff --git a/htdocs/reception/tpl/objectline_view.tpl.php b/htdocs/reception/tpl/objectline_view.tpl.php new file mode 100644 index 00000000000..cb2770facd0 --- /dev/null +++ b/htdocs/reception/tpl/objectline_view.tpl.php @@ -0,0 +1,181 @@ + + * Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2017 Juanjo Menent + * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 Nick Fragoulis + * + * 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) + * $element (used to test $user->hasRight($element, 'creer')) + * $permtoedit (used to replace test $user->hasRight($element, 'creer')) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $disableedit, $disablemove, $disableremove + * + * $type, $text, $description, $line + */ + +/** + * @var Conf $conf + * @var CommonObject $this + * @var CommonObject $object + * @var CommonObjectLine $line + * @var Translate $langs + * @var User $user + * + * @var int $i + * @var int $num + * @var string $action + */ +' +@phan-var-force receptionlinebatch $line +@phan-var-force int $num +@phan-var-force int $i +@phan-var-force CommonObject $this +@phan-var-force CommonObject $object +'; + +// Protection to avoid direct call of template +if (empty($object) || !is_object($object)) { + print "Error, template page can't be called as URL"; + exit(1); +} + +global $filtertype; +if (empty($filtertype)) { + $filtertype = 0; +} + + +global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax, $langs; + +if (empty($dateSelector)) { + $dateSelector = 0; +} +if (empty($forceall)) { + $forceall = 0; +} + + +// add html5 elements +$domData = ' data-element="'.$line->element.'"'; +$domData .= ' data-id="'.$line->id.'"'; +$domData .= ' data-qty="'.$line->qty.'"'; +$domData .= ' data-product_type="'.$line->product_type.'"'; + +// Lines for extrafield +$objectline = new ReceptionLineBatch($this->db); + +$coldisplay = 0; +print "\n"; +print ''; + +// Line nb +if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) { + print ''.($i + 1).''; + $coldisplay++; +} + +// Product +print ''; +print '
'; +$coldisplay++; +$tmpproduct = new Product($object->db); +$tmpproduct->fetch($line->fk_product); +$tmprecep = new Reception($object->db); +if ($line->fk_product > 0) { + print $tmpproduct->getNomUrl(1); + print ' - '.$tmpproduct->label; +} else { + print ' - '.$line->description; +} +print ''; + +// Qty +print ''; +$coldisplay++; +echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formatting role of function price +print ''; + +// Unit +if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // For product, unit is shown only if option PRODUCT_USE_UNITS is on + print ''; + $coldisplay++; + $label = measuringUnitString((int) $line->fk_unit, '', null, 1); + if ($label !== '') { + print $langs->trans($label); + } + print ''; +} + +if ($this->status == 0 && $user->hasRight('reception', 'write') && $action != 'selectlines') { + print ''; + $coldisplay++; + if (((int) $line->info_bits & 2) == 2 || !empty($disableedit)) { + } else { + print 'id.'">'.img_edit().''; + } + print ''; + + print ''; + $coldisplay++; + + print 'id.'">'; + print img_delete(); + print ''; + + print ''; + + if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { + print ''; + $coldisplay++; + if ($i > 0) { + print 'id.'">'; + echo img_up('default', 0, 'imgupforline'); + print ''; + } + if ($i < $num - 1) { + print 'id.'">'; + echo img_down('default', 0, 'imgdownforline'); + print ''; + } + print ''; + } else { + print 'browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>'; + $coldisplay++; + } +} else { + print ''; + $coldisplay += 3; +} + +if ($action == 'selectlines') { + print ''; + print ''; + print ''; +} + +print ''; + +print "\n";