Merge branch 'extrafields' into fgd
Conflicts: htdocs/core/class/commondocgenerator.class.php
This commit is contained in:
commit
4ff08b026f
@ -171,11 +171,13 @@ abstract class CommonDocGenerator
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
$extrafields = new ExtraFields($this->db);
|
$extrafields = new ExtraFields($this->db);
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('company',true);
|
$extralabels = $extrafields->fetch_name_optionals_label('company',true);
|
||||||
//Get extrafield values
|
|
||||||
$object->fetch_optionals($object->id,$extralabels);
|
|
||||||
|
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
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]));
|
$array_thirdparty=array_merge($array_thirdparty,array('company_options_'.$key => $object->array_options['options_'.$key]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,10 @@ class ExtraFields
|
|||||||
var $attribute_unique;
|
var $attribute_unique;
|
||||||
// Array to store if attribute is required or not
|
// Array to store if attribute is required or not
|
||||||
var $attribute_required;
|
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 $error;
|
||||||
var $errno;
|
var $errno;
|
||||||
|
|||||||
@ -998,14 +998,25 @@ else
|
|||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$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))
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
|
$e=0;
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
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]:''));
|
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options["options_".$key])?$object->array_options["options_".$key]:''));
|
||||||
print '<tr><td';
|
if (($e % 2) == 0)
|
||||||
|
{
|
||||||
|
print '<tr>';
|
||||||
|
$colspan='0';
|
||||||
|
}
|
||||||
|
print '<td';
|
||||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||||
print '>'.$label.'</td><td colspan="3">';
|
print '>'.$label.'</td>';
|
||||||
|
print '<td colspan="'.$colspan.'">';
|
||||||
print $extrafields->showInputField($key,$value);
|
print $extrafields->showInputField($key,$value);
|
||||||
print '</td></tr>'."\n";
|
print '</td>';
|
||||||
|
|
||||||
|
if (($e % 2) == 1) print '</tr>'."\n";
|
||||||
|
$e++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,23 +1437,38 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3');
|
$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
|
$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))
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
|
$old_pos=0;
|
||||||
|
$e=0;
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
|
$colspan = '3';
|
||||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||||
print '<tr><td';
|
|
||||||
|
if (($e % 2) == 0)
|
||||||
|
{
|
||||||
|
print '<tr>'."\n";
|
||||||
|
$colspan = '0';
|
||||||
|
}
|
||||||
|
print '<td';
|
||||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||||
print '>'.$label.'</td><td colspan="3">';
|
print '>'.$label.'</td>'."\n";
|
||||||
|
print '<td colspan="'.$colspan.'">';
|
||||||
print $extrafields->showInputField($key,$value);
|
print $extrafields->showInputField($key,$value);
|
||||||
print "</td></tr>\n";
|
print "</td>"."\n";
|
||||||
|
|
||||||
|
if (($e % 2) == 1 )
|
||||||
|
{
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
$old_pos = $extrafields->attribute_pos[$key];
|
||||||
|
$e++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logo
|
// Logo
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("Logo").'</td>';
|
print '<td>'.$langs->trans("Logo").'</td>';
|
||||||
@ -1756,12 +1782,23 @@ else
|
|||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$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))
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
|
$e=0;
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
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]:''));
|
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
|
||||||
print '<tr><td>'.$label.'</td><td colspan="3">';
|
if (($e % 2) == 0)
|
||||||
|
{
|
||||||
|
print '<tr>';
|
||||||
|
$colspan='0';
|
||||||
|
}
|
||||||
|
print '<td>'.$label.'</td>';
|
||||||
|
print '<td colspan="'.$colspan.'">';
|
||||||
print $extrafields->showOutputField($key,$value);
|
print $extrafields->showOutputField($key,$value);
|
||||||
print "</td></tr>\n";
|
print "</td>";
|
||||||
|
|
||||||
|
if (($e % 2) == 1) print '</tr>';
|
||||||
|
$e++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user