';
switch($mode) {
case "view":
@@ -6038,8 +6050,9 @@ abstract class CommonObject
}
$out .= '
';
- $out .= '
';
+ if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '';
+ else $out .= '';
$e++;
}
}
@@ -6051,7 +6064,7 @@ abstract class CommonObject
jQuery(document).ready(function() {
function showOptions(child_list, parent_list)
{
- var val = $("select[name="+parent_list+"]").val();
+ var val = $("select[name=\"options_"+parent_list+"\"]").val();
var parentVal = parent_list + ":" + val;
if(val > 0) {
$("select[name=\""+child_list+"\"] option[parent]").hide();
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 8f9be1356d4..665c4987e9a 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5985,9 +5985,10 @@ class Form
*
* @param CommonObject $object Object we want to show links to
* @param string $morehtmlright More html to show on right of title
+ * @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
* @return int <0 if KO, >=0 if OK
*/
- function showLinkedObjectBlock($object, $morehtmlright='')
+ function showLinkedObjectBlock($object, $morehtmlright='',$compatibleImportElementsList=false)
{
global $conf,$langs,$hookmanager;
global $bc;
@@ -5996,7 +5997,9 @@ class Form
// Bypass the default method
$hookmanager->initHooks(array('commonobject'));
- $parameters=array();
+ $parameters=array(
+ 'compatibleImportElementsList' =>& $compatibleImportElementsList,
+ );
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
@@ -6008,7 +6011,7 @@ class Form
print '
';
- print '
';
+ print '
';
print '
';
print '
'.$langs->trans("Type").'
';
@@ -6025,7 +6028,13 @@ class Form
foreach($object->linkedObjects as $objecttype => $objects)
{
$tplpath = $element = $subelement = $objecttype;
-
+
+ // to display inport button on tpl
+ $showImportButton=false;
+ if(!empty($compatibleImportElementsList) && in_array($element,$compatibleImportElementsList)){
+ $showImportButton=true;
+ }
+
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
{
$element = $regs[1];
@@ -6085,7 +6094,7 @@ class Form
global $noMoreLinkedObjectBlockAfter;
$noMoreLinkedObjectBlockAfter=1;
}
-
+
$res=@include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
if ($res)
{
@@ -6101,6 +6110,13 @@ class Form
}
print '
';
+
+ if(!empty($compatibleImportElementsList))
+ {
+ $res=@include dol_buildpath('core/tpl/ajax/objectlinked_lineimport.tpl.php');
+ }
+
+
print '';
return $nbofdifferenttypes;
diff --git a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php
new file mode 100644
index 00000000000..ad32f1b9aa8
--- /dev/null
+++ b/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php
@@ -0,0 +1,106 @@
+
+ *
+ * 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 .
+ */
+
+// Protection to avoid direct call of template
+if (empty($conf) || ! is_object($conf))
+{
+ print "Error, template page can't be called as URL";
+ exit;
+}
+
+?>
+
+
+
+
+
\ No newline at end of file
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index 8fa73ed5709..bc191ce9d80 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.'"';
+
+
?>
-