diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index bfc1001ea1b..08e2981a060 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1178,7 +1178,16 @@ if (empty($reshook))
$action = 'edit_extras';
}
- include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
+ if ($action == 'set_thirdparty' && $user->rights->commande->creer)
+ {
+ $object->fetch($id);
+ $object->setValueFrom('fk_soc', $socid);
+
+ header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
+ exit();
+ }
+
+ include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
/*
@@ -1926,8 +1935,19 @@ if ($action == 'create' && $user->rights->commande->creer)
print '';
// Third party
- print '
| ' . $langs->trans('Company') . ' | ';
- print '' . $soc->getNomUrl(1) . ' | ';
+ print '
| ';
+ print '';
+ print ' | ';
+ if ($action == 'editthirdparty') {
+ $form->form_thirdparty($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, 'socid','client>0');
+ } else {
+ print ' ' . $soc->getNomUrl(1, 'compta');
+ }
print ' |
';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index f17be59d0db..5afd2ca38d4 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1001,26 +1001,30 @@ abstract class CommonObject
{
global $conf;
- if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) return 0;
+ if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id))
+ return 0;
- require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+ require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
- $idtofetch=isset($this->socid)?$this->socid:(isset($this->fk_soc)?$this->fk_soc:$this->fk_thirdparty);
- if ($force_thirdparty_id) $idtofetch=$force_thirdparty_id;
+ $idtofetch = isset($this->socid) ? $this->socid : (isset($this->fk_soc) ? $this->fk_soc : $this->fk_thirdparty);
+ if ($force_thirdparty_id)
+ $idtofetch = $force_thirdparty_id;
- $thirdparty = new Societe($this->db);
- $result=$thirdparty->fetch($idtofetch);
- $this->client = $thirdparty; // deprecated
- $this->thirdparty = $thirdparty;
+ if ($idtofetch) {
+ $thirdparty = new Societe($this->db);
+ $result = $thirdparty->fetch($idtofetch);
+ $this->client = $thirdparty; // deprecated
+ $this->thirdparty = $thirdparty;
- // Use first price level if level not defined for third party
- if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level))
- {
- $this->client->price_level=1; // deprecated
- $this->thirdparty->price_level=1;
- }
+ // Use first price level if level not defined for third party
+ if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level)) {
+ $this->client->price_level = 1; // deprecated
+ $this->thirdparty->price_level = 1;
+ }
- return $result;
+ return $result;
+ } else
+ return -1;
}
diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php
index b97721f2108..3638da31a76 100644
--- a/htdocs/filefunc.inc.php
+++ b/htdocs/filefunc.inc.php
@@ -81,6 +81,12 @@ if (! empty($_GET['conf']))
$conffile = 'conf/'.$confname.'.php';
}
*/
+if (!empty($_GET['conf'])) {
+ setcookie('dolconf', $_GET['conf']);
+ $conffile = 'conf/' . $_GET['conf'] . '.php';
+} else {
+ $conffile = 'conf/' . (!empty($_COOKIE['dolconf']) ? $_COOKIE['dolconf'] : 'conf') . '.php';
+}
// Include configuration
$result=@include_once $conffile; // Keep @ because with some error reporting this break the redirect