';
print '
';
@@ -2518,14 +2531,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
if (!empty($conf->incoterm->enabled))
{
print '
';
- print '| ';
- print $langs->trans('IncotermLabel');
- print ' | | ';
- if ($user->rights->societe->creer) print ''.img_edit('', 1).'';
- else print ' ';
- print ' | ';
- print ' | ';
- print '';
+ print '';
+ print ' | ';
if ($action != 'editincoterm')
{
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
@@ -2553,20 +2562,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY))
{
print ' |
';
- print '| ';
- print $langs->trans('ParentCompany');
- print ' | ';
- if ($action != 'editparentcompany') print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).' | ';
+ print '';
print '';
- if ($action == 'editparentcompany')
- {
- $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'editparentcompany', 's.rowid <> '.$object->id, 1);
- } else {
- $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'none', 's.rowid <> '.$object->id, 1);
- }
- print ' | ';
- print ' ';
+ $html_name = ($action == 'editparentcompany') ? 'parent_id' : 'none';
+ $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, $html_name, 's.rowid <> '.$object->id, 1);
+ print '';
}
// Sales representative
@@ -2587,8 +2589,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
} else {
print ''.$langs->trans("ThirdpartyNotLinkedToMember").'';
}
- print '';
- print "\n";
+ print "\n";
}
// Webservices url/key
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index f18a6e1b9a8..f8796739701 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -4355,6 +4355,31 @@ class Societe extends CommonObject
return $error ? -1 : 1;
}
+ /**
+ * Define third-party type of current company
+ *
+ * @param int $typent_id third party type rowid in llx_c_typent
+ * @return int <0 if KO, >0 if OK
+ */
+ public function setThirdpartyType($typent_id)
+ {
+ if ($this->id)
+ {
+ $sql = "UPDATE ".MAIN_DB_PREFIX."societe";
+ $sql .= " SET fk_typent = ".($typent_id > 0 ? $typent_id : "null");
+ $sql .= " WHERE rowid = ".$this->id;
+ dol_syslog(get_class($this).'::setThirdpartyType', LOG_DEBUG);
+ $resql = $this->db->query($sql);
+ if ($resql)
+ {
+ $this->typent_id = $typent_id;
+ $this->typent_code = dol_getIdFromCode($db, $this->$typent_id, 'c_typent', 'id', 'code');
+ return 1;
+ } else {
+ return -1;
+ }
+ } else return -1;
+ }
/**
* Function used to replace a thirdparty id with another one.
|