FIX Using extrafield with type "Link to object" works correctly.
This commit is contained in:
parent
0d9c0b1215
commit
0c6441df74
@ -1142,7 +1142,7 @@ class Commande extends CommonOrder
|
||||
* @param int $fk_fournprice Id supplier price
|
||||
* @param int $pa_ht Buying price (without tax)
|
||||
* @param string $label Label
|
||||
* @param array $array_options extrafields array
|
||||
* @param array $array_options extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
|
||||
@ -3801,10 +3801,10 @@ abstract class CommonObject
|
||||
|
||||
foreach ($tab as $key => $value)
|
||||
{
|
||||
// Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine)
|
||||
// Test fetch_array ! is_int($key) because fetch_array result is a mix table with Key as alpha and Key as int (depend db engine)
|
||||
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
|
||||
{
|
||||
// we can add this attribute to adherent object
|
||||
// we can add this attribute to object
|
||||
$this->array_options["options_".$key]=$value;
|
||||
}
|
||||
}
|
||||
@ -3852,7 +3852,7 @@ abstract class CommonObject
|
||||
/**
|
||||
* Add/Update all extra fields values for the current object.
|
||||
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
* This function delte record with all extrafields and insert them again from the array $this->array_options.
|
||||
* This function delete record with all extrafields and insert them again from the array $this->array_options.
|
||||
*
|
||||
* @return int -1=error, O=did nothing, 1=OK
|
||||
*/
|
||||
@ -3906,12 +3906,25 @@ abstract class CommonObject
|
||||
// 1 : classPath
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
if ($value)
|
||||
{
|
||||
$object->fetch(0,$value);
|
||||
$this->array_options[$key]=$object->id;
|
||||
}
|
||||
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
|
||||
{
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
if ($value)
|
||||
{
|
||||
$res=$object->fetch(0,$value);
|
||||
if ($res > 0) $this->array_options[$key]=$object->id;
|
||||
else
|
||||
{
|
||||
$this->error="Ref '".$value."' for object '".$object->element."' not found";
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1085,10 +1085,19 @@ class ExtraFields
|
||||
// 1 : classPath
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
$object->fetch($value);
|
||||
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$object->ref.'" >';
|
||||
|
||||
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
|
||||
{
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
$object->fetch($value);
|
||||
$valuetoshow=$object->ref;
|
||||
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ref is id because name is not unique
|
||||
$out.='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$valuetoshow.'" >';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
|
||||
$out.='Error bad setup of extrafield';
|
||||
}
|
||||
}
|
||||
/* Add comments
|
||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||
@ -1326,9 +1335,17 @@ class ExtraFields
|
||||
// 1 : classPath
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
$object->fetch($value);
|
||||
$value=$object->getNomUrl(3);
|
||||
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
|
||||
{
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
$object->fetch($value);
|
||||
$value=$object->getNomUrl(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
|
||||
$out.='Error bad setup of extrafield';
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($type == 'text')
|
||||
|
||||
@ -100,9 +100,12 @@
|
||||
<table class="nobordernopadding">
|
||||
<tr><td>
|
||||
<textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo GETPOST('param'); ?></textarea>
|
||||
</td><td id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></td>
|
||||
<td><span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></span>
|
||||
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?></span></td></tr>
|
||||
</td><td>
|
||||
<span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></span>
|
||||
<span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></span>
|
||||
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?></span>
|
||||
<span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0)?></span>
|
||||
</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') )
|
||||
<tr><td><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo $extrafields->attribute_pos[$attrname]; ?>"></td></tr>
|
||||
<!-- Value (for select list / radio) -->
|
||||
<?php
|
||||
if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($type == 'chkbxlst') || ($type == 'radio'))
|
||||
if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($type == 'chkbxlst') || ($type == 'radio') || ($type == 'link'))
|
||||
{
|
||||
?>
|
||||
<tr id="value_choice">
|
||||
|
||||
@ -398,6 +398,7 @@ ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value<br><br> fo
|
||||
ExtrafieldParamHelpradio=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
|
||||
ExtrafieldParamHelpsellist=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value <br> if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
|
||||
ExtrafieldParamHelpchkbxlst=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value <br> if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
|
||||
ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax : ObjectName:Classpath<br>Example : Societe:societe/class/societe.class.php
|
||||
LibraryToBuildPDF=Library used to build PDF
|
||||
WarningUsingFPDF=Warning: Your <b>conf.php</b> contains directive <b>dolibarr_pdf_force_fpdf=1</b>. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.<br>To solve this and have a full support of PDF generation, please download <a href="http://www.tcpdf.org/" target="_blank">TCPDF library</a>, then comment or remove the line <b>$dolibarr_pdf_force_fpdf=1</b>, and add instead <b>$dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir'</b>
|
||||
LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:<br>1 : local tax apply on products and services without vat (localtax is calculated on amount without tax)<br>2 : local tax apply on products and services including vat (localtax is calculated on amount + main tax)<br>3 : local tax apply on products without vat (localtax is calculated on amount without tax)<br>4 : local tax apply on products including vat (localtax is calculated on amount + main vat)<br>5 : local tax apply on services without vat (localtax is calculated on amount without tax)<br>6 : local tax apply on services including vat (localtax is calculated on amount + tax)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user