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

View File

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