Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2017-10-17 10:44:29 +02:00
commit 8b140ab069
25 changed files with 8920 additions and 8911 deletions

View File

@ -4602,11 +4602,12 @@ abstract class CommonObject
* @param Extrafields $extrafields Extrafield Object * @param Extrafields $extrafields Extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield * @param string $mode Show output (view) or input (edit) for extrafield
* @param array $params Optional parameters * @param array $params Optional parameters
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* *
* @return string * @return string
*/ */
function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='') function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='')
{ {
global $_POST, $conf, $langs, $action; global $_POST, $conf, $langs, $action;
@ -4634,12 +4635,12 @@ abstract class CommonObject
switch($mode) { switch($mode) {
case "view": case "view":
$value=$this->array_options["options_".$key]; $value=$this->array_options["options_".$key.$keysuffix];
break; break;
case "edit": case "edit":
$getposttemp = GETPOST('options_'.$key, 'none'); // GETPOST can get value from GET, POST or setup of default values. $getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values.
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc') // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET('options_'.$key)) if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix))
{ {
if (is_array($getposttemp)) { if (is_array($getposttemp)) {
// $getposttemp is an array but following code expects a comma separated string // $getposttemp is an array but following code expects a comma separated string
@ -4679,12 +4680,12 @@ abstract class CommonObject
// Convert date into timestamp format (value in memory must be a timestamp) // Convert date into timestamp format (value in memory must be a timestamp)
if (in_array($extrafields->attribute_type[$key],array('date','datetime'))) if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
{ {
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]); $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min",'int',3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year",'int',3)):$this->db->jdate($this->array_options['options_'.$key]);
} }
// Convert float submited string into real php numeric (value in memory must be a php numeric) // Convert float submited string into real php numeric (value in memory must be a php numeric)
if (in_array($extrafields->attribute_type[$key],array('price','double'))) if (in_array($extrafields->attribute_type[$key],array('price','double')))
{ {
$value = isset($_POST["options_".$key])?price2num($_POST["options_".$key]):$this->array_options['options_'.$key]; $value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix,'int',3)):$this->array_options['options_'.$key];
} }
$labeltoshow = $langs->trans($label); $labeltoshow = $langs->trans($label);
@ -4703,7 +4704,7 @@ abstract class CommonObject
$out .= $extrafields->showOutputField($key, $value); $out .= $extrafields->showOutputField($key, $value);
break; break;
case "edit": case "edit":
$out .= $extrafields->showInputField($key, $value, '', $keyprefix, '', 0, $this->id); $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id);
break; break;
} }
@ -4716,7 +4717,7 @@ abstract class CommonObject
} }
$out .= "\n"; $out .= "\n";
// Add code to manage list depending on others // Add code to manage list depending on others
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax)) {
$out .= ' $out .= '
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
@ -4748,9 +4749,11 @@ abstract class CommonObject
</script>'."\n"; </script>'."\n";
$out .= '<!-- /showOptionalsInput --> '."\n"; $out .= '<!-- /showOptionalsInput --> '."\n";
} }
}
return $out; return $out;
} }
/** /**
* Returns the rights used for this class * Returns the rights used for this class
* @return stdClass * @return stdClass

View File

@ -806,13 +806,13 @@ class ExtraFields
* @param string $key Key of attribute * @param string $key Key of attribute
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value) * @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
* @param string $moreparam To add more parametes on html input tag * @param string $moreparam To add more parametes on html input tag
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @param mixed $showsize Value for css to define size. May also be a numeric. * @param mixed $showsize Value for css to define size. May also be a numeric.
* @param int $objectid Current object id * @param int $objectid Current object id
* @return string * @return string
*/ */
function showInputField($key, $value, $moreparam='', $keyprefix='', $keysuffix='', $showsize=0, $objectid=0) function showInputField($key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0, $objectid=0)
{ {
global $conf,$langs; global $conf,$langs;
@ -831,7 +831,7 @@ class ExtraFields
if ($computed) if ($computed)
{ {
if ($keysuffix != 'search_') return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>'; if ($keyprefix != 'search_') return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
else return ''; else return '';
} }
@ -893,26 +893,26 @@ class ExtraFields
if (! is_object($form)) $form=new Form($this->db); if (! is_object($form)) $form=new Form($this->db);
// TODO Must also support $moreparam // TODO Must also support $moreparam
$out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, ($keysuffix != 'search_' ? 1 : 0), 1, 0, 1); $out = $form->select_date($value, $keyprefix.'options_'.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1);
} }
elseif (in_array($type,array('int'))) elseif (in_array($type,array('int')))
{ {
$tmp=explode(',',$size); $tmp=explode(',',$size);
$newsize=$tmp[0]; $newsize=$tmp[0];
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>'; $out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
} }
elseif ($type == 'varchar') elseif ($type == 'varchar')
{ {
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>'; $out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
} }
elseif (in_array($type, array('mail', 'phone', 'url'))) elseif (in_array($type, array('mail', 'phone', 'url')))
{ {
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>'; $out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
} }
elseif ($type == 'text') elseif ($type == 'text')
{ {
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($keysuffix.'options_'.$key.$keyprefix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%'); $doleditor=new DolEditor($keyprefix.'options_'.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
$out=$doleditor->Create(1); $out=$doleditor->Create(1);
} }
elseif ($type == 'boolean') elseif ($type == 'boolean')
@ -923,21 +923,21 @@ class ExtraFields
} else { } else {
$checked=' value="1" '; $checked=' value="1" ';
} }
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>'; $out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
} }
elseif ($type == 'price') elseif ($type == 'price')
{ {
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value); $value=price($value);
} }
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency); $out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
} }
elseif ($type == 'double') elseif ($type == 'double')
{ {
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
$value=price($value); $value=price($value);
} }
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '; $out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
} }
elseif ($type == 'select') elseif ($type == 'select')
{ {
@ -945,10 +945,10 @@ class ExtraFields
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0); $out.= ajax_combobox($keyprefix.'options_'.$key.$keysuffix, array(), 0);
} }
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>'; $out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
$out.='<option value="0">&nbsp;</option>'; $out.='<option value="0">&nbsp;</option>';
foreach ($param['options'] as $key => $val) foreach ($param['options'] as $key => $val)
{ {
@ -967,10 +967,10 @@ class ExtraFields
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
{ {
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0); $out.= ajax_combobox($keyprefix.'options_'.$key.$keysuffix, array(), 0);
} }
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>'; $out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
if (is_array($param['options'])) if (is_array($param['options']))
{ {
$param_list=array_keys($param['options']); $param_list=array_keys($param['options']);
@ -1132,7 +1132,7 @@ class ExtraFields
$form = new Form($db); $form = new Form($db);
$value_arr=explode(',',$value); $value_arr=explode(',',$value);
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%'); $out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
} }
elseif ($type == 'radio') elseif ($type == 'radio')
@ -1140,11 +1140,11 @@ class ExtraFields
$out=''; $out='';
foreach ($param['options'] as $keyopt => $val) foreach ($param['options'] as $keyopt => $val)
{ {
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:''); $out.='<input class="flat '.$showsize.'" type="radio" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
$out.=' value="'.$keyopt.'"'; $out.=' value="'.$keyopt.'"';
$out.=' id="'.$keysuffix.'options_'.$key.$keyprefix.'_'.$keyopt.'"'; $out.=' id="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'"';
$out.= ($value==$keyopt?'checked':''); $out.= ($value==$keyopt?'checked':'');
$out.='/><label for="'.$keysuffix.'options_'.$key.$keyprefix.'_'.$keyopt.'">'.$val.'</label><br>'; $out.='/><label for="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>';
} }
} }
elseif ($type == 'chkbxlst') elseif ($type == 'chkbxlst')
@ -1286,7 +1286,7 @@ class ExtraFields
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$form = new Form($db); $form = new Form($db);
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, $data, $value_arr, '', 0, '', 0, '100%'); $out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
} else { } else {
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
@ -1316,7 +1316,7 @@ class ExtraFields
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique) if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique)
} }
} }
$out.='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$valuetoshow.'" >'; $out.='<input type="text" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$valuetoshow.'" >';
} }
else else
{ {
@ -1327,10 +1327,10 @@ class ExtraFields
elseif ($type == 'password') elseif ($type == 'password')
{ {
// If prefix is 'search_', field is used as a filter, we use a common text field. // If prefix is 'search_', field is used as a filter, we use a common text field.
$out='<input type="'.($keysuffix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>'; $out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
} }
if (!empty($hidden)) { if (!empty($hidden)) {
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>'; $out='<input type="hidden" value="'.$value.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'"/>';
} }
/* Add comments /* Add comments
if ($type == 'date') $out.=' (YYYY-MM-DD)'; if ($type == 'date') $out.=' (YYYY-MM-DD)';
@ -1339,6 +1339,7 @@ class ExtraFields
return $out; return $out;
} }
/** /**
* Return HTML string to put an output field into a page * Return HTML string to put an output field into a page
* *

View File

@ -60,30 +60,30 @@ if ($conf->multicompany->enabled) {
print '<td width="80">&nbsp;</td>'; print '<td width="80">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
if (count($extrafields->attribute_type)) if (count($extrafields->attributes[$elementtype]['type']))
{ {
foreach($extrafields->attribute_type as $key => $value) foreach($extrafields->attributes[$elementtype]['type'] as $key => $value)
{ {
// Load language if required // Load language if required
if (! empty($extrafields->attribute_langfile[$key])) { if (! empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
$langs->load($extrafields->attribute_langfile[$key]); $langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>".$extrafields->attribute_pos[$key]."</td>\n"; print "<td>".$extrafields->attributes[$elementtype]['pos'][$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value print "<td>".$extrafields->attributes[$elementtype]['label'][$key]."</td>\n"; // We don't translate here, we want admin to know what is the key not translated value
print "<td>".$langs->trans($extrafields->attribute_label[$key])."</td>\n"; print "<td>".$langs->trans($extrafields->attributes[$elementtype]['label'][$key])."</td>\n";
print "<td>".$key."</td>\n"; print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n"; print "<td>".$type2label[$extrafields->attributes[$elementtype]['type'][$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n"; print '<td align="right">'.$extrafields->attributes[$elementtype]['size'][$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n"; print '<td align="center">'.yn($extrafields->attributes[$elementtype]['unique'][$key])."</td>\n";
print '<td>'.dol_trunc($extrafields->attribute_computed[$key], 20)."</td>\n"; print '<td>'.dol_trunc($extrafields->attributes[$elementtype]['computed'][$key], 20)."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n"; print '<td align="center">'.yn($extrafields->attributes[$elementtype]['required'][$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n"; print '<td align="center">'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."</td>\n";
print '<td align="center">'.$extrafields->attribute_list[$key]."</td>\n"; print '<td align="center">'.$extrafields->attributes[$elementtype]['list'][$key]."</td>\n";
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it. if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '<td align="center">'.yn($extrafields->attributes[$elementtype]['ishidden'][$key])."</td>\n"; // Add hidden option on not working feature. Why hide if user can't see it.
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
print '<td align="center">'.($extrafields->attribute_entityid[$key]==0?$langs->trans("All"):$extrafields->attribute_entitylabel[$key]).'</td>'; print '<td align="center">'.($extrafields->attributes[$elementtype]['entityid'][$key]==0?$langs->trans("All"):$extrafields->attributes[$elementtype]['entitylabel'][$key]).'</td>';
} }
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n"; print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";

View File

@ -32,7 +32,7 @@
$parameters = array(); $parameters = array();
$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
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit');
} }

View File

@ -32,7 +32,7 @@
$parameters = array(); $parameters = array();
$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
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook) && ! empty($extrafields->attribute_label)) { if (empty($reshook) && ! empty($extrafields->attributes[$object->table_element]['label'])) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit');
} }

View File

@ -738,6 +738,8 @@ class Societe extends CommonObject
$this->email = trim($this->email); $this->email = trim($this->email);
$this->skype = trim($this->skype); $this->skype = trim($this->skype);
$this->url = $this->url?clean_url($this->url,0):''; $this->url = $this->url?clean_url($this->url,0):'';
$this->note_private = trim($this->note_private);
$this->note_public = trim($this->note_public);
$this->idprof1 = trim($this->idprof1); $this->idprof1 = trim($this->idprof1);
$this->idprof2 = trim($this->idprof2); $this->idprof2 = trim($this->idprof2);
$this->idprof3 = trim($this->idprof3); $this->idprof3 = trim($this->idprof3);
@ -852,6 +854,9 @@ class Societe extends CommonObject
$sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null"); $sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null");
$sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null"); $sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null");
$sql .= ",note_private = ".(! empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
$sql .= ",note_public = ".(! empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
$sql .= ",siren = '". $this->db->escape($this->idprof1) ."'"; $sql .= ",siren = '". $this->db->escape($this->idprof1) ."'";
$sql .= ",siret = '". $this->db->escape($this->idprof2) ."'"; $sql .= ",siret = '". $this->db->escape($this->idprof2) ."'";
$sql .= ",ape = '". $this->db->escape($this->idprof3) ."'"; $sql .= ",ape = '". $this->db->escape($this->idprof3) ."'";