NEW add new function "setEntity()"
This commit is contained in:
parent
7b8b1a9052
commit
38246b4088
@ -260,7 +260,6 @@ if (empty($reshook))
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$object->date_commande = $datecommande;
|
$object->date_commande = $datecommande;
|
||||||
$object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity);
|
|
||||||
$object->note_private = GETPOST('note_private', 'none');
|
$object->note_private = GETPOST('note_private', 'none');
|
||||||
$object->note_public = GETPOST('note_public', 'none');
|
$object->note_public = GETPOST('note_public', 'none');
|
||||||
$object->source = GETPOST('source_id');
|
$object->source = GETPOST('source_id');
|
||||||
|
|||||||
@ -776,7 +776,6 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->brouillon = 1; // set command as draft
|
$this->brouillon = 1; // set command as draft
|
||||||
if (empty($this->entity)) $this->entity = $conf->entity;
|
|
||||||
|
|
||||||
// $date_commande is deprecated
|
// $date_commande is deprecated
|
||||||
$date = ($this->date_commande ? $this->date_commande : $this->date);
|
$date = ($this->date_commande ? $this->date_commande : $this->date);
|
||||||
@ -860,7 +859,7 @@ class Commande extends CommonOrder
|
|||||||
$sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0);
|
$sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0);
|
||||||
$sql.= ", ".(int) $this->fk_incoterms;
|
$sql.= ", ".(int) $this->fk_incoterms;
|
||||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||||
$sql.= ", ".$this->entity;
|
$sql.= ", ".setEntity($this);
|
||||||
$sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null");
|
$sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null");
|
||||||
$sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null");
|
$sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null");
|
||||||
$sql.= ", ".(int) $this->fk_multicurrency;
|
$sql.= ", ".(int) $this->fk_multicurrency;
|
||||||
|
|||||||
@ -1238,7 +1238,7 @@ class FormFile
|
|||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
// Preview link
|
// Preview link
|
||||||
if (! $editline) print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(! empty($object->entity)?$object->entity:$onf->entity));
|
if (! $editline) print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(! empty($object->entity)?$object->entity:$conf->entity));
|
||||||
|
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
|
|||||||
* @param int $shared 0=Return id of current entity only,
|
* @param int $shared 0=Return id of current entity only,
|
||||||
* 1=Return id of current entity + shared entities (default)
|
* 1=Return id of current entity + shared entities (default)
|
||||||
* @param object $currentobject Current object if needed
|
* @param object $currentobject Current object if needed
|
||||||
* @return mixed Entity id(s) to use
|
* @return mixed Entity id(s) to use
|
||||||
*/
|
*/
|
||||||
function getEntity($element, $shared = 1, $currentobject = null)
|
function getEntity($element, $shared = 1, $currentobject = null)
|
||||||
{
|
{
|
||||||
@ -95,6 +95,26 @@ function getEntity($element, $shared = 1, $currentobject = null)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get entity id to use when to create an object
|
||||||
|
*
|
||||||
|
* @param object $currentobject Current object
|
||||||
|
* @return mixed Entity id to use
|
||||||
|
*/
|
||||||
|
function setEntity($currentobject)
|
||||||
|
{
|
||||||
|
global $conf, $mc;
|
||||||
|
|
||||||
|
if (is_object($mc))
|
||||||
|
{
|
||||||
|
return $mc->setEntity($currentobject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $conf->entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return information about user browser
|
* Return information about user browser
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user