diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 3b815e962c0..aec9e74dcb8 100755 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -171,11 +171,13 @@ abstract class CommonDocGenerator require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); $extralabels = $extrafields->fetch_name_optionals_label('company',true); - //Get extrafield values - $object->fetch_optionals($object->id,$extralabels); foreach($extrafields->attribute_label as $key=>$label) { + if($extrafields->attribute_type[$key] == 'price') + { + $object->array_options['options_'.$key] = price($object->array_options['options_'.$key]).' '.$outputlangs->getCurrencySymbol($conf->currency); + } $array_thirdparty=array_merge($array_thirdparty,array('company_options_'.$key => $object->array_options['options_'.$key])); } } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ec02f906e70..f72ddc8d6e2 100755 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -44,6 +44,10 @@ class ExtraFields var $attribute_unique; // Array to store if attribute is required or not var $attribute_required; + // Array to store parameters of attribute (used in select type) + var $attribute_param; + // Int to store position of attribute + var $attribute_pos; var $error; var $errno; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index c1dd0c4c09d..ee8f6e984b1 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -998,14 +998,25 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { + $e=0; foreach($extrafields->attribute_label as $key=>$label) { + $colspan='3'; $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:'')); - print ''; + $colspan='0'; + } + print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; + print '>'.$label.''; + print ''; print $extrafields->showInputField($key,$value); - print ''."\n"; + print ''; + + if (($e % 2) == 1) print ''."\n"; + $e++; } } @@ -1426,23 +1437,38 @@ else print ''; print ''; } - // Other attributes $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { + $old_pos=0; + $e=0; foreach($extrafields->attribute_label as $key=>$label) { + $colspan = '3'; $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''."\n"; + $colspan = '0'; + } + print 'attribute_required[$key])) print ' class="fieldrequired"'; - print '>'.$label.''; + print '>'.$label.''."\n"; + print ''; print $extrafields->showInputField($key,$value); - print "\n"; + print ""."\n"; + + if (($e % 2) == 1 ) + { + print "\n"; + } + $old_pos = $extrafields->attribute_pos[$key]; + $e++; } } - // Logo print ''; print ''.$langs->trans("Logo").''; @@ -1756,12 +1782,23 @@ else $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { + $e=0; foreach($extrafields->attribute_label as $key=>$label) { + $colspan='3'; $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:'')); - print ''.$label.''; + if (($e % 2) == 0) + { + print ''; + $colspan='0'; + } + print ''.$label.''; + print ''; print $extrafields->showOutputField($key,$value); - print "\n"; + print ""; + + if (($e % 2) == 1) print ''; + $e++; } }