From 09c5dc506a16302405bddcc4b5c6eb6463de4bd6 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 20 Feb 2018 17:46:32 +0100 Subject: [PATCH] Add html dom element and fix class --- .../comm/propal/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/commande/tpl/linkedobjectblock.tpl.php | 2 +- .../facture/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/core/class/commonobject.class.php | 18 ++++++++++++------ htdocs/core/tpl/objectline_view.tpl.php | 9 ++++++++- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 3f7e6f2ed8b..2de3fd6afe3 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -52,7 +52,7 @@ foreach($linkedObjectBlock as $key => $objectlink) $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - + trans("Proposal"); ?> getNomUrl(1); ?> ref_client; ?> diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 3fb6f2d0bba..4f072ae94c8 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach($linkedObjectBlock as $key => $objectlink) $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - + trans("CustomerOrder"); ?> getNomUrl(1); ?> ref_client; ?> diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index e77a4975789..0dbc044b027 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach($linkedObjectBlock as $key => $objectlink) $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - + trans("CustomerInvoice"); ?> getNomUrl(1); ?> ref_client; ?> diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8def2194fb3..1fe99edb192 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5847,21 +5847,27 @@ abstract class CommonObject else { $csstyle=''; - $class=(!empty($extrafields->attribute_hidden[$key]) ? 'class="hideobject" ' : ''); + $class=(!empty($extrafields->attribute_hidden[$key]) ? 'hideobject ' : ''); if (is_array($params) && count($params)>0) { if (array_key_exists('style',$params)) { $csstyle=$params['style']; } } + + // add html5 elements + $domData = ' data-element="extrafield"'; + $domData .= ' data-targetelement="'.$this->element.'"'; + $domData .= ' data-targetid="'.$this->id.'"'; + + $html_id = !empty($this->id) ? 'extrarow-'.$this->element.'_'.$key.'_'.$this->id : ''; + + $out .= ''; + if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { - $out .= ''; $colspan='0'; } - else - { - $out .= ''; - } + // Convert date into timestamp format (value in memory must be a timestamp) if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) { diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 8d5b13ece7c..cdc7044cd42 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -56,10 +56,17 @@ if (empty($senderissupplier)) $senderissupplier=0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=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.'"'; + + ?> -> + > global->MAIN_VIEW_LINE_NUMBER)) { ?>