2010-09-08 18:09:59 +02:00
< ? php
2018-10-27 14:43:12 +02:00
/* Copyright ( C ) 2010 - 2013 Regis Houssin < regis . houssin @ inodbox . com >
2012-08-23 13:45:51 +02:00
* Copyright ( C ) 2010 - 2011 Laurent Destailleur < eldy @ users . sourceforge . net >
2013-10-30 18:17:37 +01:00
* Copyright ( C ) 2012 - 2013 Christophe Battarel < christophe . battarel @ altairis . fr >
2014-11-14 16:43:49 +01:00
* Copyright ( C ) 2012 Cédric Salvador < csalvador @ gpcsolutions . fr >
* Copyright ( C ) 2012 - 2014 Raphaël Doursenaud < rdoursenaud @ gpcsolutions . fr >
2013-06-10 16:05:41 +02:00
* Copyright ( C ) 2013 Florian Henry < florian . henry @ open - concept . pro >
2017-08-30 14:36:00 +02:00
* Copyright ( C ) 2017 Juanjo Menent < jmenent @ 2 byte . es >
2022-02-14 04:52:39 +01:00
* Copyright ( C ) 2022 OpenDSI < support @ open - dsi . fr >
2025-01-13 20:04:35 +01:00
* Copyright ( C ) 2024 - 2025 MDW < mdeweerd @ users . noreply . github . com >
2024-09-28 11:10:57 +02:00
* Copyright ( C ) 2024 Alexandre Spangaro < alexandre @ inovea - conseil . com >
* Copyright ( C ) 2024 Frédéric France < frederic . france @ free . fr >
2010-09-08 18:09:59 +02:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2010-09-08 18:09:59 +02:00
* ( 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
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2010-09-08 18:09:59 +02:00
*
2024-06-30 21:02:50 +02:00
* Need to have the following variables defined :
2014-08-30 20:36:53 +02:00
* $object ( invoice , order , ... )
* $conf
* $langs
* $dateSelector
* $forceall ( 0 by default , 1 for supplier invoices / orders )
2015-02-28 03:11:15 +01:00
* $element ( used to test $user -> rights -> $element -> creer )
* $permtoedit ( used to replace test $user -> rights -> $element -> creer )
2014-08-30 20:36:53 +02:00
* $senderissupplier ( 0 by default , 1 for supplier invoices / orders )
* $inputalsopricewithtax ( 0 by default , 1 to also show column with unit price including tax )
2019-06-11 21:02:41 +02:00
* $outputalsopricetotalwithtax
2015-02-27 18:05:12 +01:00
* $usemargins ( 0 to disable all margins columns , 1 to show according to margin setup )
2016-04-26 22:00:41 +02:00
* $disableedit , $disablemove , $disableremove
2017-08-29 20:40:51 +02:00
*
2020-03-19 10:15:34 +01:00
* $text , $description , $line
2010-09-08 18:09:59 +02:00
*/
2024-11-04 23:53:20 +01:00
/**
* @ var CommonObject $object
* @ var CommonObject $this
* @ var CommonObjectLine $line
2024-11-10 11:16:23 +01:00
* @ var Conf $conf
2024-11-10 23:47:14 +01:00
* @ var Form $form
2024-11-04 23:53:20 +01:00
* @ var HookManager $hookmanager
* @ var ? Product $product_static
* @ var Societe $mysoc
* @ var Translate $langs
* @ var User $user
*
2024-12-20 12:14:09 +01:00
* @ var string $action
* @ var int $i
2024-11-04 23:53:20 +01:00
* @ var 0 | 1 $forceall
* @ var int $num
* @ var 0 | 1 $senderissupplier
* @ var string $text
* @ var string $description
*/
2017-12-21 13:32:16 +01:00
// Protection to avoid direct call of template
2021-02-23 22:03:23 +01:00
if ( empty ( $object ) || ! is_object ( $object )) {
2017-12-21 13:32:16 +01:00
print " Error, template page can't be called as URL " ;
2024-03-16 23:08:15 +01:00
exit ( 1 );
2017-12-21 13:32:16 +01:00
}
2024-10-20 01:57:12 +02:00
'
@ phan - var - force PropaleLigne | ContratLigne | CommonObjectLine | CommonInvoiceLine | CommonOrderLine | ExpeditionLigne | DeliveryLine | FactureFournisseurLigneRec | SupplierInvoiceLine | SupplierProposalLine $line
@ phan - var - force CommonObject $this
@ phan - var - force Propal | Contrat | Commande | Facture | Expedition | Delivery | FactureFournisseur | FactureFournisseur | SupplierProposal $object
@ phan - var - force 0 | 1 $forceall
@ phan - var - force int $num
@ phan - var - force ? Product $product_static
@ phan - var - force string $text
@ phan - var - force string $description
2025-01-13 20:04:35 +01:00
@ phan - var - force Object $objp
2024-02-21 18:14:29 +01:00
' ;
2020-04-21 14:14:49 +02:00
global $mysoc ;
2017-02-15 01:11:25 +01:00
global $forceall , $senderissupplier , $inputalsopricewithtax , $outputalsopricetotalwithtax ;
2015-03-04 17:54:43 +01:00
2019-11-13 19:35:39 +01:00
$usemargins = 0 ;
2022-09-25 22:47:12 +02:00
if ( isModEnabled ( 'margin' ) && ! empty ( $object -> element ) && in_array ( $object -> element , array ( 'facture' , 'facturerec' , 'propal' , 'commande' ))) {
2021-02-23 22:03:23 +01:00
$usemargins = 1 ;
}
2014-08-30 20:36:53 +02:00
2021-02-23 22:03:23 +01:00
if ( empty ( $dateSelector )) {
$dateSelector = 0 ;
}
if ( empty ( $forceall )) {
$forceall = 0 ;
}
if ( empty ( $senderissupplier )) {
$senderissupplier = 0 ;
}
if ( empty ( $inputalsopricewithtax )) {
$inputalsopricewithtax = 0 ;
}
if ( empty ( $outputalsopricetotalwithtax )) {
$outputalsopricetotalwithtax = 0 ;
}
2017-02-15 01:11:25 +01:00
2018-02-20 17:46:32 +01:00
// 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 . '"' ;
2020-09-15 11:18:21 +02:00
$sign = 1 ;
2024-11-04 23:53:20 +01:00
if ( getDolGlobalString ( 'INVOICE_POSITIVE_CREDIT_NOTE_SCREEN' ) && in_array ( $object -> element , array ( 'facture' , 'invoice_supplier' ))) {
/** @var CommonInvoice $object */
// @phan-suppress-next-line PhanUndeclaredConstantOfClass
if ( $object -> type == $object :: TYPE_CREDIT_NOTE ) {
$sign = - 1 ;
}
2020-09-15 11:18:21 +02:00
}
2018-02-20 17:46:32 +01:00
2021-08-30 21:22:00 +02:00
2020-09-15 11:18:21 +02:00
$coldisplay = 0 ;
?>
2012-08-23 13:45:51 +02:00
<!-- BEGIN PHP TEMPLATE objectline_view . tpl . php -->
2020-01-20 12:25:25 +01:00
< tr id = " row-<?php print $line->id ?> " class = " drag drop oddeven " < ? php print $domData ; ?> >
2023-11-27 11:39:32 +01:00
< ? php if ( getDolGlobalString ( 'MAIN_VIEW_LINE_NUMBER' )) { ?>
2023-12-04 12:07:53 +01:00
< td class = " linecolnum center " >< span class = " opacitymedium " >< ? php $coldisplay ++ ; ?> <?php print($i + 1); ?></span></td>
2019-10-27 17:01:23 +01:00
< ? php } ?>
2020-01-20 12:25:25 +01:00
< td class = " linecoldescription minwidth300imp " >< ? php $coldisplay ++ ; ?> <div id="line_<?php print $line->id; ?>"></div>
2019-10-27 17:01:23 +01:00
< ? php
2024-12-20 11:33:58 +01:00
2025-01-13 20:04:35 +01:00
$parameters = [ 'line' => $line , 'i' => & $i , 'coldisplay' => & $coldisplay ];
2024-12-20 11:33:58 +01:00
$reshook = $hookmanager -> executeHooks ( 'objectLineView_BeforeProduct' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2019-10-27 17:01:23 +01:00
if (( $line -> info_bits & 2 ) == 2 ) {
2020-10-31 14:32:18 +01:00
print '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $this -> socid . '">' ;
2019-12-16 13:06:25 +01:00
$txt = '' ;
2019-10-27 17:01:23 +01:00
print img_object ( $langs -> trans ( " ShowReduc " ), 'reduc' ) . ' ' ;
2021-02-23 22:03:23 +01:00
if ( $line -> description == '(DEPOSIT)' ) {
$txt = $langs -> trans ( " Deposit " );
} elseif ( $line -> description == '(EXCESS RECEIVED)' ) {
$txt = $langs -> trans ( " ExcessReceived " );
} elseif ( $line -> description == '(EXCESS PAID)' ) {
$txt = $langs -> trans ( " ExcessPaid " );
}
2019-10-27 17:01:23 +01:00
//else $txt=$langs->trans("Discount");
print $txt ;
print '</a>' ;
2021-02-23 22:03:23 +01:00
if ( $line -> description ) {
if ( $line -> description == '(CREDIT_NOTE)' && $line -> fk_remise_except > 0 ) {
2021-03-03 22:46:25 +01:00
include_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php' ;
2019-12-16 13:06:25 +01:00
$discount = new DiscountAbsolute ( $this -> db );
2019-10-27 17:01:23 +01:00
$discount -> fetch ( $line -> fk_remise_except );
2023-12-04 12:07:53 +01:00
print ( $txt ? ' - ' : '' ) . $langs -> transnoentities ( " DiscountFromCreditNote " , $discount -> getNomUrl ( 0 ));
} elseif ( $line -> description == '(DEPOSIT)' && $line -> fk_remise_except > 0 ) {
2021-03-03 22:46:25 +01:00
include_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php' ;
2019-12-16 13:06:25 +01:00
$discount = new DiscountAbsolute ( $this -> db );
2019-10-27 17:01:23 +01:00
$discount -> fetch ( $line -> fk_remise_except );
2023-12-04 12:07:53 +01:00
print ( $txt ? ' - ' : '' ) . $langs -> transnoentities ( " DiscountFromDeposit " , $discount -> getNomUrl ( 0 ));
2019-10-27 17:01:23 +01:00
// Add date of deposit
2023-11-27 11:39:32 +01:00
if ( getDolGlobalString ( 'INVOICE_ADD_DEPOSIT_DATE' )) {
2020-10-31 14:32:18 +01:00
print ' (' . dol_print_date ( $discount -> datec ) . ')' ;
2021-02-23 22:03:23 +01:00
}
2023-12-04 12:07:53 +01:00
} elseif ( $line -> description == '(EXCESS RECEIVED)' && $objp -> fk_remise_except > 0 ) {
2021-03-03 22:46:25 +01:00
include_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php' ;
2019-12-16 13:06:25 +01:00
$discount = new DiscountAbsolute ( $this -> db );
2019-10-27 17:01:23 +01:00
$discount -> fetch ( $line -> fk_remise_except );
2023-12-04 12:07:53 +01:00
print ( $txt ? ' - ' : '' ) . $langs -> transnoentities ( " DiscountFromExcessReceived " , $discount -> getNomUrl ( 0 ));
2021-02-23 22:03:23 +01:00
} elseif ( $line -> description == '(EXCESS PAID)' && $objp -> fk_remise_except > 0 ) {
2021-03-03 22:46:25 +01:00
include_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php' ;
2019-12-16 13:06:25 +01:00
$discount = new DiscountAbsolute ( $this -> db );
2019-10-27 17:01:23 +01:00
$discount -> fetch ( $line -> fk_remise_except );
2023-12-04 12:07:53 +01:00
print ( $txt ? ' - ' : '' ) . $langs -> transnoentities ( " DiscountFromExcessPaid " , $discount -> getNomUrl ( 0 ));
2020-05-21 15:05:19 +02:00
} else {
2023-12-04 12:07:53 +01:00
print ( $txt ? ' - ' : '' ) . dol_htmlentitiesbr ( $line -> description );
2011-11-16 18:58:11 +01:00
}
2013-03-22 17:10:17 +01:00
}
2020-05-21 15:05:19 +02:00
} else {
2023-11-27 11:39:32 +01:00
$format = ( getDolGlobalString ( 'MAIN_USE_HOURMIN_IN_DATE_RANGE' ) ? 'dayhour' : 'day' );
2019-10-06 14:41:52 +02:00
2021-01-07 12:39:51 +01:00
if ( $line -> fk_product > 0 ) {
2024-04-17 18:02:03 +02:00
if ( getDolGlobalInt ( 'MAIN_ENABLE_AJAX_TOOLTIP' )) {
print ( ! empty ( $line -> fk_parent_line ) ? img_picto ( '' , 'rightarrow' ) : '' ) . $text ;
2024-05-16 12:48:18 +02:00
if ( ! getDolGlobalInt ( 'PRODUIT_DESC_IN_FORM' )) {
print $form -> textwithpicto ( '' , $description );
}
2024-04-17 18:02:03 +02:00
} else {
print $form -> textwithtooltip ( $text , $description , 3 , 0 , '' , $i , 0 , ( ! empty ( $line -> fk_parent_line ) ? img_picto ( '' , 'rightarrow' ) : '' ));
}
2020-05-21 15:05:19 +02:00
} else {
2020-03-19 10:15:34 +01:00
$type = ( ! empty ( $line -> product_type ) ? $line -> product_type : $line -> fk_product_type );
2021-02-23 22:03:23 +01:00
if ( $type == 1 ) {
$text = img_object ( $langs -> trans ( 'Service' ), 'service' );
} else {
$text = img_object ( $langs -> trans ( 'Product' ), 'product' );
}
2019-10-27 17:01:23 +01:00
2019-12-16 13:06:25 +01:00
if ( ! empty ( $line -> label )) {
$text .= ' <strong>' . $line -> label . '</strong>' ;
2023-12-04 12:07:53 +01:00
print $form -> textwithtooltip ( $text , dol_htmlentitiesbr ( $line -> description ), 3 , 0 , '' , $i , 0 , ( ! empty ( $line -> fk_parent_line ) ? img_picto ( '' , 'rightarrow' ) : '' ));
2019-10-27 17:01:23 +01:00
} else {
2021-02-23 22:03:23 +01:00
if ( ! empty ( $line -> fk_parent_line )) {
print img_picto ( '' , 'rightarrow' );
}
2020-01-16 02:48:24 +01:00
if ( preg_match ( '/^\(DEPOSIT\)/' , $line -> description )) {
$newdesc = preg_replace ( '/^\(DEPOSIT\)/' , $langs -> trans ( " Deposit " ), $line -> description );
2020-01-20 12:25:25 +01:00
print $text . ' ' . dol_htmlentitiesbr ( $newdesc );
2020-05-21 15:05:19 +02:00
} else {
2020-01-20 12:25:25 +01:00
print $text . ' ' . dol_htmlentitiesbr ( $line -> description );
2020-01-16 02:48:24 +01:00
}
2019-10-27 17:01:23 +01:00
}
}
// Show date range
2022-02-07 14:34:27 +01:00
if ( $line -> element == 'facturedetrec' || $line -> element == 'invoice_supplier_det_rec' ) {
if ( $line -> element == 'invoice_supplier_det_rec' && $line -> product_type != Product :: TYPE_PRODUCT ) {
$line -> date_start_fill = $line -> date_start ;
$line -> date_end_fill = $line -> date_end ;
}
2021-02-23 22:03:23 +01:00
if ( $line -> date_start_fill || $line -> date_end_fill ) {
2021-09-19 19:25:38 +02:00
print '<div class="clearboth nowraponall daterangeofline-facturedetrec">' ;
2021-02-23 22:03:23 +01:00
}
if ( $line -> date_start_fill ) {
2022-03-22 11:47:25 +01:00
print '<span class="opacitymedium" title="' . dol_escape_htmltag ( $langs -> trans ( " AutoFillDateFrom " )) . '">' . $langs -> trans ( 'AutoFillDateFromShort' ) . ':</span> ' . yn ( $line -> date_start_fill );
2021-02-23 22:03:23 +01:00
}
if ( $line -> date_start_fill && $line -> date_end_fill ) {
print ' - ' ;
}
if ( $line -> date_end_fill ) {
2022-03-22 11:47:25 +01:00
print '<span class="opacitymedium" title="' . dol_escape_htmltag ( $langs -> trans ( " AutoFillDateTo " )) . '">' . $langs -> trans ( 'AutoFillDateToShort' ) . ':</span> ' . yn ( $line -> date_end_fill );
2021-02-23 22:03:23 +01:00
}
if ( $line -> date_start_fill || $line -> date_end_fill ) {
print '</div>' ;
}
2020-05-21 15:05:19 +02:00
} else {
2021-02-23 22:03:23 +01:00
if ( $line -> date_start || $line -> date_end ) {
2021-09-19 19:25:38 +02:00
print '<div class="clearboth nowraponall opacitymedium daterangeofline">' . get_date_range ( $line -> date_start , $line -> date_end , $format ) . '</div>' ;
2021-02-23 22:03:23 +01:00
}
2023-02-22 12:19:36 +01:00
2021-07-20 15:35:10 +02:00
if ( ! $line -> date_start || ! $line -> date_end ) {
2021-07-20 11:23:35 +02:00
// show warning under line
// we need to fetch product associated to line for some test
2023-02-22 12:19:36 +01:00
if ( $object -> element == 'propal' || $object -> element == 'order' || $object -> element == 'facture' || $object -> element == 'propal_supplier' || $object -> element == 'supplier_proposal' || $object -> element == 'commande' ) {
2021-07-21 08:31:07 +02:00
$res = $line -> fetch_product ();
2023-12-04 12:07:53 +01:00
if ( $res > 0 ) {
2021-07-21 08:31:07 +02:00
if ( $line -> product -> isService () && $line -> product -> isMandatoryPeriod ()) {
print '<div><span class="clearboth nowraponall warning">' . $langs -> trans ( " mandatoryPeriodNeedTobeSet " ) . '</span></div>' ;
}
2021-07-20 11:23:35 +02:00
}
}
2021-02-23 22:03:23 +01:00
}
2021-07-20 11:23:35 +02:00
2022-03-22 11:47:25 +01:00
// If we show the lines in a context to create a recurring sale invoice
if ( basename ( $_SERVER [ " PHP_SELF " ]) == 'card-rec.php' ) {
$default_start_fill = getDolGlobalInt ( 'INVOICEREC_SET_AUTOFILL_DATE_START' );
$default_end_fill = getDolGlobalInt ( 'INVOICEREC_SET_AUTOFILL_DATE_END' );
print '<div class="clearboth nowraponall daterangeofline-facturedetrec">' ;
print '<span class="opacitymedium" title="' . dol_escape_htmltag ( $langs -> trans ( " AutoFillDateFrom " )) . '">' . $langs -> trans ( 'AutoFillDateFromShort' ) . ':</span> ' . yn ( $default_start_fill );
print ' - ' ;
print '<span class="opacitymedium" title="' . dol_escape_htmltag ( $langs -> trans ( " AutoFillDateTo " )) . '">' . $langs -> trans ( 'AutoFillDateToShort' ) . ':</span> ' . yn ( $default_end_fill );
print '</div>' ;
}
2019-08-11 13:08:17 +02:00
}
2018-03-19 12:30:48 +01:00
2019-10-27 17:01:23 +01:00
// Add description in form
2022-10-21 11:14:28 +02:00
if ( $line -> fk_product > 0 && getDolGlobalInt ( 'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE' )) {
2021-10-05 12:09:03 +02:00
if ( $line -> element == 'facturedetrec' ) {
print ( ! empty ( $line -> description ) && $line -> description != $line -> product_label ) ? (( $line -> date_start_fill || $line -> date_end_fill ) ? '' : '<br>' ) . '<br>' . dol_htmlentitiesbr ( $line -> description ) : '' ;
2022-02-07 14:34:27 +01:00
} elseif ( $line -> element == 'invoice_supplier_det_rec' ) {
print ( ! empty ( $line -> description ) && $line -> description != $line -> label ) ? (( $line -> date_start || $line -> date_end ) ? '' : '<br>' ) . '<br>' . dol_htmlentitiesbr ( $line -> description ) : '' ;
2021-10-05 12:09:03 +02:00
} else {
print ( ! empty ( $line -> description ) && $line -> description != $line -> product_label ) ? (( $line -> date_start || $line -> date_end ) ? '' : '<br>' ) . '<br>' . dol_htmlentitiesbr ( $line -> description ) : '' ;
}
2018-03-19 12:13:18 +01:00
}
2021-08-30 21:22:00 +02:00
2024-12-20 11:33:58 +01:00
2025-01-13 20:04:35 +01:00
$parameters = [ 'line' => $line , 'i' => & $i , 'coldisplay' => & $coldisplay ];
2024-12-20 11:33:58 +01:00
$reshook = $hookmanager -> executeHooks ( 'objectLineView_BeforeProductExtrafield' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2021-08-30 21:22:00 +02:00
// Line extrafield
2024-12-20 11:33:58 +01:00
if ( ! empty ( $extrafields ) && empty ( $reshook )) {
2021-01-16 14:10:37 +01:00
$temps = $line -> showOptionals ( $extrafields , 'view' , array (), '' , '' , 1 , 'line' );
if ( ! empty ( $temps )) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_' . $line -> id . '" name="extrafield_lines_area_' . $line -> id . '">' ;
print $temps ;
print '</div>' ;
}
2020-12-22 12:52:01 +01:00
}
2019-10-27 17:01:23 +01:00
}
2018-03-19 12:30:48 +01:00
2025-01-13 20:04:35 +01:00
$parameters = [ 'line' => $line , 'i' => & $i , 'coldisplay' => & $coldisplay ];
2024-12-20 12:04:03 +01:00
$reshook = $hookmanager -> executeHooks ( 'objectLineView_ProductSupplier' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
if ( empty ( $reshook )) {
if ( $user -> hasRight ( 'fournisseur' , 'lire' ) && isset ( $line -> fk_fournprice ) && $line -> fk_fournprice > 0 && ! getDolGlobalString ( 'SUPPLIER_HIDE_SUPPLIER_OBJECTLINES' )) {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php' ;
$productfourn = new ProductFournisseur ( $this -> db );
$productfourn -> fetch_product_fournisseur_price ( $line -> fk_fournprice );
print '<div class="clearboth"></div>' ;
print '<span class="opacitymedium">' . $langs -> trans ( 'Supplier' ) . ' : </span>' . $productfourn -> getSocNomUrl ( 1 , 'supplier' ) . ' - <span class="opacitymedium">' . $langs -> trans ( 'Ref' ) . ' : </span>' ;
// Supplier ref
if ( $user -> hasRight ( 'produit' , 'creer' ) || $user -> hasRight ( 'service' , 'creer' )) { // change required right here
print $productfourn -> getNomUrl ();
} else {
print $productfourn -> ref_supplier ;
2024-12-20 11:33:58 +01:00
}
2019-10-27 17:01:23 +01:00
}
2024-12-20 12:04:03 +01:00
}
2019-10-27 17:01:23 +01:00
2023-07-01 13:07:14 +02:00
if ( isModEnabled ( 'accounting' ) && ! empty ( $line -> fk_accounting_account ) && $line -> fk_accounting_account > 0 ) {
2019-12-16 13:06:25 +01:00
$accountingaccount = new AccountingAccount ( $this -> db );
2019-10-27 17:01:23 +01:00
$accountingaccount -> fetch ( $line -> fk_accounting_account );
2020-01-20 12:25:25 +01:00
print '<div class="clearboth"></div><br><span class="opacitymedium">' . $langs -> trans ( 'AccountingAffectation' ) . ' : </span>' . $accountingaccount -> getNomUrl ( 0 , 1 , 1 );
2019-10-27 17:01:23 +01:00
}
print '</td>' ;
2024-06-18 16:40:28 +02:00
2023-01-06 12:08:40 +01:00
// Vendor price ref
2022-02-07 14:34:27 +01:00
if ( $object -> element == 'supplier_proposal' || $object -> element == 'order_supplier' || $object -> element == 'invoice_supplier' || $object -> element == 'invoice_supplier_rec' ) { // We must have same test in printObjectLines
2019-10-27 17:01:23 +01:00
print '<td class="linecolrefsupplier">' ;
2023-12-04 12:07:53 +01:00
print ( $line -> ref_fourn ? $line -> ref_fourn : $line -> ref_supplier );
2019-10-27 17:01:23 +01:00
print '</td>' ;
}
2023-01-06 12:08:40 +01:00
2024-11-11 14:00:39 +01:00
// Set the text for tooltip.
// The value of maount must be shown with price(..., 0, '', 0, 0) so value will be visible exactly like it is into database.
2023-01-06 12:08:40 +01:00
$tooltiponprice = '' ;
2024-11-08 18:11:30 +01:00
$tooltiponpricemultiprice = '' ;
2023-01-06 12:08:40 +01:00
$tooltiponpriceend = '' ;
2024-11-08 18:11:30 +01:00
$tooltiponpriceendmultiprice = '' ;
2023-11-27 11:39:32 +01:00
if ( ! getDolGlobalString ( 'MAIN_OPTIMIZEFORTEXTBROWSER' )) {
2024-12-12 15:42:14 +01:00
$tooltiponprice .= $langs -> transcountry ( " TotalHT " , $mysoc -> country_code ) . '=' . price ( $line -> total_ht , 0 , '' , 0 , 0 );
$tooltiponpricemultiprice .= $langs -> transcountry ( " TotalHT " , $mysoc -> country_code ) . '=' . price ( $line -> multicurrency_total_ht , 0 , '' , 0 , 0 );
2024-11-11 14:00:39 +01:00
$tooltiponprice .= '<br>' . $langs -> transcountry ( " TotalVAT " , ( $senderissupplier ? $object -> thirdparty -> country_code : $mysoc -> country_code )) . '=' . price ( $line -> total_tva , 0 , '' , 0 , 0 );
$tooltiponpricemultiprice .= '<br>' . $langs -> transcountry ( " TotalVAT " , ( $senderissupplier ? $object -> thirdparty -> country_code : $mysoc -> country_code )) . '=' . price ( $line -> multicurrency_total_tva , 0 , '' , 0 , 0 );
2023-01-06 12:26:54 +01:00
if ( is_object ( $object -> thirdparty )) {
if ( $senderissupplier ) {
$seller = $object -> thirdparty ;
$buyer = $mysoc ;
} else {
$seller = $mysoc ;
$buyer = $object -> thirdparty ;
}
if ( $mysoc -> useLocalTax ( 1 )) {
if (( $seller -> country_code == $buyer -> country_code ) || $line -> total_localtax1 || $seller -> useLocalTax ( 1 )) {
2024-11-11 14:00:39 +01:00
$tooltiponprice .= '<br>' . $langs -> transcountry ( " TotalLT1 " , $seller -> country_code ) . '=' . price ( $line -> total_localtax1 , 0 , '' , 0 , 0 );
$tooltiponpricemultiprice .= '<br>' . $langs -> transcountry ( " TotalLT1 " , $seller -> country_code ) . '=' . price ( $line -> multicurrency_total_localtax1 , 0 , '' , 0 , 0 );
2023-01-06 12:08:40 +01:00
} else {
2023-01-06 12:26:54 +01:00
$tooltiponprice .= '<br>' . $langs -> transcountry ( " TotalLT1 " , $seller -> country_code ) . '=<span class="opacitymedium">' . $langs -> trans ( $senderissupplier ? " NotUsedForThisVendor " : " NotUsedForThisCustomer " ) . '</span>' ;
2024-11-08 18:11:30 +01:00
$tooltiponpricemultiprice .= '<br>' . $langs -> transcountry ( " TotalLT1 " , $seller -> country_code ) . '=<span class="opacitymedium">' . $langs -> trans ( $senderissupplier ? " NotUsedForThisVendor " : " NotUsedForThisCustomer " ) . '</span>' ;
2023-01-06 12:08:40 +01:00
}
}
2023-01-06 12:26:54 +01:00
if ( $mysoc -> useLocalTax ( 2 )) {
2023-12-04 12:07:53 +01:00
if (( isset ( $seller -> country_code ) && isset ( $buyer -> thirdparty -> country_code ) && $seller -> country_code == $buyer -> thirdparty -> country_code ) || $line -> total_localtax2 || $seller -> useLocalTax ( 2 )) {
2024-11-11 14:00:39 +01:00
$tooltiponprice .= '<br>' . $langs -> transcountry ( " TotalLT2 " , $seller -> country_code ) . '=' . price ( $line -> total_localtax2 , 0 , '' , 0 , 0 );
$tooltiponpricemultiprice .= '<br>' . $langs -> transcountry ( " TotalLT2 " , $seller -> country_code ) . '=' . price ( $line -> multicurrency_total_localtax2 , 0 , '' , 0 , 0 );
2023-01-06 12:08:40 +01:00
} else {
2023-01-06 12:26:54 +01:00
$tooltiponprice .= '<br>' . $langs -> transcountry ( " TotalLT2 " , $seller -> country_code ) . '=<span class="opacitymedium">' . $langs -> trans ( $senderissupplier ? " NotUsedForThisVendor " : " NotUsedForThisCustomer " ) . '</span>' ;
2024-11-08 18:11:30 +01:00
$tooltiponpricemultiprice .= '<br>' . $langs -> transcountry ( " TotalLT2 " , $seller -> country_code ) . '=<span class="opacitymedium">' . $langs -> trans ( $senderissupplier ? " NotUsedForThisVendor " : " NotUsedForThisCustomer " ) . '</span>' ;
2023-01-06 12:08:40 +01:00
}
}
}
2024-11-11 14:00:39 +01:00
$tooltiponprice .= '<br>' . $langs -> transcountry ( " TotalTTC " , $mysoc -> country_code ) . '=' . price ( $line -> total_ttc , 0 , '' , 0 , 0 );
$tooltiponpricemultiprice .= '<br>' . $langs -> transcountry ( " TotalTTC " , $mysoc -> country_code ) . '=' . price ( $line -> multicurrency_total_ttc , 0 , '' , 0 , 0 );
2023-01-06 15:30:55 +01:00
2024-12-12 15:42:14 +01:00
if ( ! empty ( $line -> special_code ) || $line -> product_type == 9 ) {
$tooltiponprice .= '<br>' ;
$tooltiponpricemultiprice .= '<br>' ;
if ( ! empty ( $line -> special_code )) {
2024-12-13 07:43:15 +01:00
$tooltiponprice .= '<br>' . $langs -> trans ( " SpecialLine " ) . ' : ' . getLabelSpecialCode ( $line -> special_code );
$tooltiponpricemultiprice .= '<br>' . $langs -> trans ( " SpecialLine " ) . ' : ' . getLabelSpecialCode ( $line -> special_code );
2024-12-12 15:42:14 +01:00
}
if ( $line -> product_type == 9 ) {
$tooltiponprice .= '<br>' . $langs -> trans ( " SpecialLine " ) . ' : ' . $langs -> trans ( " GroupingLine " );
$tooltiponpricemultiprice .= '<br>' . $langs -> trans ( " SpecialLine " ) . ' : ' . $langs -> trans ( " GroupingLine " );
}
}
2023-01-06 15:30:55 +01:00
$tooltiponprice = '<span class="classfortooltip" title="' . dol_escape_htmltag ( $tooltiponprice ) . '">' ;
2024-11-08 18:11:30 +01:00
$tooltiponpricemultiprice = '<span class="classfortooltip" title="' . dol_escape_htmltag ( $tooltiponpricemultiprice ) . '">' ;
2023-01-06 12:08:40 +01:00
$tooltiponpriceend = '</span>' ;
2024-11-08 18:11:30 +01:00
$tooltiponpriceendmultiprice = '</span>' ;
2023-01-06 12:08:40 +01:00
}
2019-10-27 17:01:23 +01:00
// VAT Rate
print '<td class="linecolvat nowrap right">' ;
$coldisplay ++ ;
2019-12-16 13:06:25 +01:00
$positiverates = '' ;
2021-02-23 22:03:23 +01:00
if ( price2num ( $line -> tva_tx )) {
$positiverates .= ( $positiverates ? '/' : '' ) . price2num ( $line -> tva_tx );
}
if ( price2num ( $line -> total_localtax1 )) {
$positiverates .= ( $positiverates ? '/' : '' ) . price2num ( $line -> localtax1_tx );
}
if ( price2num ( $line -> total_localtax2 )) {
$positiverates .= ( $positiverates ? '/' : '' ) . price2num ( $line -> localtax2_tx );
}
if ( empty ( $positiverates )) {
$positiverates = '0' ;
}
2023-01-06 12:08:40 +01:00
print $tooltiponprice ;
2024-09-23 01:59:14 +02:00
print vatrate ( $positiverates . ( $line -> vat_src_code ? ' (' . $line -> vat_src_code . ')' : '' ), true , $line -> info_bits );
2023-01-06 12:08:40 +01:00
print $tooltiponpriceend ;
2019-10-27 17:01:23 +01:00
?> </td>
2010-09-18 16:44:57 +02:00
2022-08-13 19:30:26 +02:00
< td class = " linecoluht nowraponall right " >< ? php $coldisplay ++ ; ?> <?php print price($sign * $line->subprice); ?></td>
2017-08-29 20:40:51 +02:00
2022-09-03 11:24:17 +02:00
< ? php if ( isModEnabled ( " multicurrency " ) && $this -> multicurrency_code != $conf -> currency ) { ?>
2022-08-13 19:30:26 +02:00
< td class = " linecoluht_currency nowraponall right " >< ? php $coldisplay ++ ; ?> <?php print price($sign * $line->multicurrency_subprice); ?></td>
2019-10-27 17:01:23 +01:00
< ? php }
2017-08-29 20:40:51 +02:00
2023-03-11 19:38:39 +01:00
if ( ! empty ( $inputalsopricewithtax ) && ! getDolGlobalInt ( 'MAIN_NO_INPUT_PRICE_WITH_TAX' )) { ?>
2023-03-11 20:25:27 +01:00
< td class = " linecoluttc nowraponall right " >< ? php $coldisplay ++ ; ?> <?php
$upinctax = isset ( $line -> pu_ttc ) ? $line -> pu_ttc : null ;
if ( getDolGlobalInt ( 'MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES' )) {
2024-03-28 02:12:55 +01:00
$upinctax = price2num ( $line -> total_ttc / ( float ) $line -> qty , 'MU' );
2023-03-11 20:25:27 +01:00
}
2023-12-04 12:07:53 +01:00
print ( isset ( $upinctax ) ? price ( $sign * $upinctax ) : price ( $sign * $line -> subprice ));
2023-03-11 20:25:27 +01:00
?> </td>
2019-10-27 17:01:23 +01:00
< ? php } ?>
2012-08-22 17:42:40 +02:00
2022-08-13 19:30:26 +02:00
< td class = " linecolqty nowraponall right " >< ? php $coldisplay ++ ; ?>
2019-10-27 17:01:23 +01:00
< ? php
if ((( $line -> info_bits & 2 ) != 2 ) && $line -> special_code != 3 ) {
2024-03-28 02:12:55 +01:00
// I comment this because it shows info even when not required
2019-10-27 17:01:23 +01:00
// 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;"')." ";
2024-01-13 19:48:20 +01:00
print price ( $line -> qty , 0 , '' , 0 , 0 ); // Yes, it is a quantity, not a price, but we just want the formatting role of function price
2021-02-23 22:03:23 +01:00
} else {
print ' ' ;
}
2019-10-27 17:01:23 +01:00
print '</td>' ;
2023-11-27 11:39:32 +01:00
if ( getDolGlobalString ( 'PRODUCT_USE_UNITS' )) {
2019-10-27 17:01:23 +01:00
print '<td class="linecoluseunit nowrap left">' ;
$label = $line -> getLabelOfUnit ( 'short' );
if ( $label !== '' ) {
print $langs -> trans ( $label );
2015-02-26 14:15:33 +01:00
}
2019-10-27 17:01:23 +01:00
print '</td>' ;
}
if ( ! empty ( $line -> remise_percent ) && $line -> special_code != 3 ) {
print '<td class="linecoldiscount right">' ;
$coldisplay ++ ;
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php' ;
2024-11-04 23:53:20 +01:00
print dol_print_reduction (( float ) $line -> remise_percent , $langs );
2019-10-27 17:01:23 +01:00
print '</td>' ;
} else {
print '<td class="linecoldiscount"> </td>' ;
$coldisplay ++ ;
}
2015-02-26 14:15:33 +01:00
2019-10-27 17:01:23 +01:00
// Fields for situation invoices
2021-06-29 16:37:07 +02:00
if ( isset ( $this -> situation_cycle_ref ) && $this -> situation_cycle_ref ) {
2020-10-31 14:32:18 +01:00
include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php' ;
2019-10-27 17:01:23 +01:00
$coldisplay ++ ;
2024-06-18 20:21:56 +02:00
if ( getDolGlobalInt ( 'INVOICE_USE_SITUATION' ) == 2 ) {
2024-09-28 11:10:57 +02:00
$previous_progress = $line -> getAllPrevProgress ( $object -> id );
2024-06-18 20:21:56 +02:00
$current_progress = $previous_progress + floatval ( $line -> situation_percent );
print '<td class="linecolcycleref nowrap right">' . $current_progress . '%</td>' ;
$coldisplay ++ ;
print '<td class="nowrap right">' . $line -> situation_percent . '%</td>' ;
$coldisplay ++ ;
$locataxes_array = getLocalTaxesFromRate ( $line -> tva . ( $line -> vat_src_code ? ' (' . $line -> vat_src_code . ')' : '' ), 0 , ( $senderissupplier ? $mysoc : $object -> thirdparty ), ( $senderissupplier ? $object -> thirdparty : $mysoc ));
$tmp = calcul_price_total ( $line -> qty , $line -> pu , $line -> remise_percent , $line -> txtva , - 1 , - 1 , 0 , 'HT' , $line -> info_bits , $line -> type , ( $senderissupplier ? $object -> thirdparty : $mysoc ), $locataxes_array , 100 , $object -> multicurrency_tx , $line -> multicurrency_subprice );
2024-11-04 12:32:13 +01:00
print '<td class="linecolcycleref2 right nowrap">' . price ( $sign * ( float ) $tmp [ 0 ]) . '</td>' ;
2024-06-18 20:21:56 +02:00
} else {
print '<td class="linecolcycleref nowrap right">' . $line -> situation_percent . '%</td>' ;
$coldisplay ++ ;
$locataxes_array = getLocalTaxesFromRate ( $line -> tva . ( $line -> vat_src_code ? ' (' . $line -> vat_src_code . ')' : '' ), 0 , ( $senderissupplier ? $mysoc : $object -> thirdparty ), ( $senderissupplier ? $object -> thirdparty : $mysoc ));
$tmp = calcul_price_total ( $line -> qty , $line -> pu , $line -> remise_percent , $line -> txtva , - 1 , - 1 , 0 , 'HT' , $line -> info_bits , $line -> type , ( $senderissupplier ? $object -> thirdparty : $mysoc ), $locataxes_array , 100 , $object -> multicurrency_tx , $line -> multicurrency_subprice );
2024-11-04 12:32:13 +01:00
print '<td class="linecolcycleref2 right nowrap">' . price ( $sign * ( float ) $tmp [ 0 ]) . '</td>' ;
2024-06-18 20:21:56 +02:00
}
2019-10-27 17:01:23 +01:00
}
2019-04-30 18:11:35 +02:00
2022-09-25 22:47:12 +02:00
if ( $usemargins && isModEnabled ( 'margin' ) && empty ( $user -> socid )) {
2023-10-15 15:32:35 +02:00
if ( $user -> hasRight ( 'margins' , 'creer' )) { ?>
2020-01-20 12:25:25 +01:00
< td class = " linecolmargin1 nowrap margininfos right " >< ? php $coldisplay ++ ; ?> <?php print price($line->pa_ht); ?></td>
2019-10-27 17:01:23 +01:00
< ? php }
2023-11-27 11:39:32 +01:00
if ( getDolGlobalString ( 'DISPLAY_MARGIN_RATES' ) && $user -> hasRight ( 'margins' , 'liretous' )) { ?>
2023-12-04 12:07:53 +01:00
< td class = " linecolmargin2 nowrap margininfos right " >< ? php $coldisplay ++ ; ?> <?php print(($line->pa_ht == 0) ? 'n/a' : price(price2num($line->marge_tx, 'MT')).'%'); ?></td>
2019-10-27 17:01:23 +01:00
< ? php }
2023-11-27 11:39:32 +01:00
if ( getDolGlobalString ( 'DISPLAY_MARK_RATES' ) && $user -> hasRight ( 'margins' , 'liretous' )) { ?>
2024-11-12 13:48:12 +01:00
< td class = " linecolmark1 nowrap margininfos right " >< ? php $coldisplay ++ ; ?> <?php print price(price2num($line->marque_tx, 'MT')).'%'; ?></td>
2021-02-23 22:03:23 +01:00
< ? php }
2019-10-27 17:01:23 +01:00
}
2023-01-06 12:08:40 +01:00
2020-09-15 11:18:21 +02:00
// Price total without tax
2024-01-22 12:25:53 +01:00
if ( $line -> special_code == 3 ) {
$coldisplay ++ ;
$colspanOptions = '' ;
2024-11-08 18:11:30 +01:00
if ( isModEnabled ( 'multicurrency' ) && $object -> multicurrency_code != $conf -> currency ) {
2024-01-22 12:25:53 +01:00
$coldisplay ++ ;
$colspanOptions = ' colspan="2"' ;
}
print '<td class="linecoloption nowrap right"' . $colspanOptions . '>' . $langs -> trans ( 'Option' ) . '</td>' ;
} else {
2019-10-27 17:01:23 +01:00
print '<td class="linecolht nowrap right">' ;
$coldisplay ++ ;
2023-01-06 12:08:40 +01:00
print $tooltiponprice ;
2020-09-15 11:18:21 +02:00
print price ( $sign * $line -> total_ht );
2023-01-06 12:08:40 +01:00
print $tooltiponpriceend ;
2019-10-27 17:01:23 +01:00
print '</td>' ;
2022-09-03 11:24:17 +02:00
if ( isModEnabled ( " multicurrency " ) && $this -> multicurrency_code != $conf -> currency ) {
2024-11-08 18:11:30 +01:00
print '<td class="linecolutotalht_currency nowrap right">' ;
print $tooltiponpricemultiprice ;
print price ( $sign * $line -> multicurrency_total_ht );
print $tooltiponpriceendmultiprice ;
print '</td>' ;
2019-04-30 18:11:35 +02:00
$coldisplay ++ ;
2014-11-14 16:43:49 +01:00
}
2019-10-27 17:01:23 +01:00
}
2023-01-06 12:08:40 +01:00
// Price inc tax
2019-10-27 17:01:23 +01:00
if ( $outputalsopricetotalwithtax ) {
2020-09-15 11:18:21 +02:00
print '<td class="linecolht nowrap right">' . price ( $sign * $line -> total_ttc ) . '</td>' ;
2019-10-27 17:01:23 +01:00
$coldisplay ++ ;
}
2014-11-14 16:43:49 +01:00
2024-08-27 06:20:04 +02:00
// TODO Replace this with $permissiontoedit ?
$objectRights = $this -> getRights ();
$tmppermtoedit = $objectRights -> creer ;
if ( $this -> status == 0 && $tmppermtoedit && $action != 'selectlines' ) {
2021-07-01 13:36:04 +02:00
$situationinvoicelinewithparent = 0 ;
2023-04-24 17:37:44 +02:00
if ( isset ( $line -> fk_prev_id ) && in_array ( $object -> element , array ( 'facture' , 'facturedet' ))) {
2024-11-04 23:53:20 +01:00
/** @var CommonInvoice $object */
2024-02-21 18:14:29 +01:00
// @phan-suppress-next-line PhanUndeclaredConstantOfClass
2021-07-01 13:36:04 +02:00
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 ;
}
}
2023-01-06 12:08:40 +01:00
// Asset info
2022-08-30 11:45:15 +02:00
if ( isModEnabled ( 'asset' ) && $object -> element == 'invoice_supplier' ) {
2022-02-14 04:52:39 +01:00
print '<td class="linecolasset center">' ;
$coldisplay ++ ;
2024-10-20 01:57:12 +02:00
if (
$product_static !== null
&&
(
! empty ( $product_static -> accountancy_code_buy ) ||
! empty ( $product_static -> accountancy_code_buy_intra ) ||
! empty ( $product_static -> accountancy_code_buy_export )
)
2022-02-14 04:52:39 +01:00
) {
2024-01-05 04:18:53 +01:00
$accountancy_category_asset = getDolGlobalString ( 'ASSET_ACCOUNTANCY_CATEGORY' );
2022-02-14 04:52:39 +01:00
$filters = array ();
2023-12-04 12:07:53 +01:00
if ( ! empty ( $product_static -> accountancy_code_buy )) {
$filters [] = " account_number = ' " . $this -> db -> escape ( $product_static -> accountancy_code_buy ) . " ' " ;
}
if ( ! empty ( $product_static -> accountancy_code_buy_intra )) {
$filters [] = " account_number = ' " . $this -> db -> escape ( $product_static -> accountancy_code_buy_intra ) . " ' " ;
}
if ( ! empty ( $product_static -> accountancy_code_buy_export )) {
$filters [] = " account_number = ' " . $this -> db -> escape ( $product_static -> accountancy_code_buy_export ) . " ' " ;
}
2022-02-14 04:52:39 +01:00
$sql = " SELECT COUNT(*) AS found " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " accounting_account " ;
$sql .= " WHERE pcg_type = ' " . $this -> db -> escape ( $conf -> global -> ASSET_ACCOUNTANCY_CATEGORY ) . " ' " ;
$sql .= " AND ( " . implode ( ' OR ' , $filters ) . " ) " ;
$resql_asset = $this -> db -> query ( $sql );
if ( ! $resql_asset ) {
print 'Error SQL: ' . $this -> db -> lasterror ();
} elseif ( $obj = $this -> db -> fetch_object ( $resql_asset )) {
if ( ! empty ( $obj -> found )) {
2022-12-07 18:11:25 +01:00
print '<a class="reposition" href="' . DOL_URL_ROOT . '/asset/card.php?action=create&token=' . newToken () . '&supplier_invoice_id=' . $object -> id . '">' ;
2022-02-14 04:52:39 +01:00
print img_edit_add () . '</a>' ;
}
}
}
2022-02-14 04:56:45 +01:00
print '</td>' ;
2022-02-14 04:52:39 +01:00
}
2023-01-06 12:08:40 +01:00
// Edit picto
2019-10-27 17:01:23 +01:00
print '<td class="linecoledit center">' ;
$coldisplay ++ ;
2019-12-16 13:06:25 +01:00
if (( $line -> info_bits & 2 ) == 2 || ! empty ( $disableedit )) {
2019-10-27 17:01:23 +01:00
} else { ?>
2022-12-07 18:11:25 +01:00
< a class = " editfielda reposition " href = " <?php print $_SERVER["PHP_SELF"] .'?id='. $this->id .'&action=editline&token='.newToken().'&lineid='. $line->id ; ?> " >
2020-01-20 12:25:25 +01:00
< ? php print img_edit () . '</a>' ;
2019-05-20 14:41:47 +02:00
}
2019-10-27 17:01:23 +01:00
print '</td>' ;
2023-01-06 12:08:40 +01:00
// Delete picto
2019-10-27 17:01:23 +01:00
print '<td class="linecoldelete center">' ;
$coldisplay ++ ;
2021-07-01 13:36:04 +02:00
if ( ! $situationinvoicelinewithparent && empty ( $disableremove )) { // For situation invoice, deletion is not possible if there is a parent company.
2021-09-27 12:24:01 +02:00
print '<a class="reposition" href="' . $_SERVER [ " PHP_SELF " ] . '?id=' . $this -> id . '&action=ask_deleteline&token=' . newToken () . '&lineid=' . $line -> id . '">' ;
2019-10-27 17:01:23 +01:00
print img_delete ();
print '</a>' ;
}
print '</td>' ;
2010-09-18 16:44:57 +02:00
2023-01-06 12:08:40 +01:00
// Move up-down picto
2023-07-01 20:16:10 +02:00
if ( $num > 1 && $conf -> browser -> layout != 'phone' && (( property_exists ( $this , 'situation_counter' ) && $this -> situation_counter == 1 ) || empty ( $this -> situation_cycle_ref )) && empty ( $disablemove )) {
2019-10-27 17:01:23 +01:00
print '<td class="linecolmove tdlineupdown center">' ;
$coldisplay ++ ;
if ( $i > 0 ) { ?>
2021-09-27 12:24:01 +02:00
< a class = " lineupdown " href = " <?php print $_SERVER["PHP_SELF"] .'?id='. $this->id .'&action=up&token='.newToken().'&rowid='. $line->id ; ?> " >
2020-01-20 12:25:25 +01:00
< ? php print img_up ( 'default' , 0 , 'imgupforline' ); ?>
2019-05-20 14:41:47 +02:00
</ a >
2019-10-27 17:01:23 +01:00
< ? php }
2019-12-16 13:06:25 +01:00
if ( $i < $num - 1 ) { ?>
2021-09-27 12:24:01 +02:00
< a class = " lineupdown " href = " <?php print $_SERVER["PHP_SELF"] .'?id='. $this->id .'&action=down&token='.newToken().'&rowid='. $line->id ; ?> " >
2020-01-20 12:25:25 +01:00
< ? php print img_down ( 'default' , 0 , 'imgdownforline' ); ?>
2019-05-20 14:41:47 +02:00
</ a >
2019-10-27 17:01:23 +01:00
< ? php }
print '</td>' ;
2020-10-31 14:32:18 +01:00
} else {
2019-12-16 13:06:25 +01:00
print '<td ' . (( $conf -> browser -> layout != 'phone' && empty ( $disablemove )) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"' ) . '></td>' ;
2019-10-27 17:01:23 +01:00
$coldisplay ++ ;
}
} else {
2023-12-14 15:16:11 +01:00
$colspan = 3 ;
if ( isModEnabled ( 'asset' ) && $object -> element == 'invoice_supplier' ) {
$colspan ++ ;
}
print '<td colspan="' . $colspan . '"></td>' ;
2024-08-07 02:53:45 +02:00
$coldisplay += $colspan ;
2019-10-27 17:01:23 +01:00
}
2019-05-20 14:41:47 +02:00
2019-10-27 17:01:23 +01:00
if ( $action == 'selectlines' ) { ?>
2020-01-20 12:25:25 +01:00
< td class = " linecolcheck center " >< input type = " checkbox " class = " linecheckbox " name = " line_checkbox[<?php print $i + 1; ?>] " value = " <?php print $line->id ; ?> " ></ td >
2019-10-27 17:01:23 +01:00
< ? php }
2010-09-08 18:09:59 +02:00
2019-10-27 17:01:23 +01:00
print " </tr> \n " ;
2018-03-20 10:10:21 +01:00
2019-10-27 17:01:23 +01:00
print " <!-- END PHP TEMPLATE objectline_view.tpl.php --> \n " ;