Fix: Update select with list

This commit is contained in:
Laurent Destailleur 2013-06-14 02:09:34 +02:00
parent c1b21d1480
commit b3ca9de399
2 changed files with 35 additions and 33 deletions

View File

@ -258,33 +258,33 @@ class modSociete extends DolibarrModules
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='company';
}
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='company';
}
}
// End add axtra fields
$this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@ -61,12 +61,14 @@ if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_a
$param_chain = '';
foreach ($param['options'] as $key => $value)
{
if(strlen($key))
if(strlen($key))
{
$param_chain .= $key.', '.$value."\n";
$param_chain .= $key.','.$value."\n";
}
}
}elseif ($type== 'sellist') {
}
elseif ($type== 'sellist')
{
$paramlist=array_keys($param['options']);
$param_chain = $paramlist[0];
}
@ -83,8 +85,8 @@ if((($type == 'select') || ($type == 'checkbox') ||(($type == 'radio'))) && is_a
<input type="hidden" name="type" id="type" value="<?php print $type; ?>">
</td></tr>
<!-- Value (for select list / radio) -->
<?php
if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($type == 'radio')))
<?php
if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($type == 'radio')))
{
?>
<tr id="value_choice">
@ -99,7 +101,7 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') ||(($typ
</table>
</td>
</tr>
<?php
<?php
}
?>
<!-- Size -->