diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 90fd1c534ba..4580df68fe0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -567,7 +567,7 @@ class Form * @param string $maxlength Max length for labels (0=no limit) * @return string HTML string with select */ - function select_incoterms($selected='',$htmlname='incoterm_id',$htmloption='',$maxlength=0) + function select_incoterms($selected='', $location_incoterms='', $page='',$htmlname='incoterm_id',$htmloption='', $forcecombo=0, $events=array()) { global $conf,$langs; @@ -580,12 +580,25 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX."c_incoterms"; $sql.= " WHERE active = 1"; $sql.= " ORDER BY code ASC"; - + dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { - $out.= ''; + $out .= ''; + } + + $out.= ''; + + $out .= ''; + + if (!empty($page)) + { + $out .= ''; + } } else { diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 279197b27e1..5c821a2b86d 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -521,6 +521,12 @@ if (empty($reshook)) $result = $object->set_parent(GETPOST('editparentcompany','int')); } + // Set incoterm + if ($action == 'set_incoterms' && $conf->incoterm->enabled && !empty($conf->global->INCOTERM_ACTIVATE)) + { + $object->fetch($socid); + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); + } // Actions to send emails $id=$socid; @@ -1088,8 +1094,7 @@ else print ''; print ''; print ''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : '')); - print ''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print ''; } @@ -1615,8 +1620,7 @@ else print ''; print ''; print ''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : '')); - print ''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print ''; } @@ -2013,12 +2017,19 @@ else print '
'; print $langs->trans('IncotermLabel'); print ''; - if ($user->rights->societe->creer) print ''.img_edit().''; + if ($user->rights->societe->creer) print ''.img_edit().''; else print ' '; print '
'; print ''; print ''; - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?socid='.$object->id); + } print ''; }