| '.$langs->trans("Description").' | ';
// Editeur wysiwyg
@@ -382,6 +405,38 @@ if ($action == 'create') {
$morehtmlref = '';
$morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu;
+
+ // Project
+ if (!empty($conf->projet->enabled)) {
+ $langs->load("projects");
+ $morehtmlref .= ' '.img_picto('', 'project').' '.$langs->trans('Project').' ';
+ if ($usercancreate) {
+ if ($action != 'classify') {
+ $morehtmlref .= ' '.img_edit($langs->transnoentitiesnoconv('SetProject')).' : ';
+ }
+ if ($action == 'classify') {
+ $projectid = $object->fk_project;
+ $morehtmlref .= ' ';
+ } else {
+ $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
+ } else {
+ if (!empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref .= ' ';
+ $morehtmlref .= $proj->ref;
+ $morehtmlref .= '';
+ } else {
+ $morehtmlref .= '';
+ }
+ }
+ }
$morehtmlref .= ' ';
$shownav = 1;
@@ -489,7 +544,7 @@ if ($action == 'create') {
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
- if (empty($action)) {
+ if (empty($action) || $action == 'classin') {
if ($user->rights->stock->creer) {
print ''.$langs->trans("Modify").'';
} else {
@@ -708,6 +763,16 @@ if ($action == 'create') {
print $formproduct->selectWarehouses($object->fk_parent, 'fk_parent', '', 1);
print ' |
';
+ // Project
+ if (!empty($conf->projet->enabled)) {
+ $projectid = $object->fk_project;
+ $langs->load('projects');
+ print '| '.$langs->trans("Description").' | ';
// Editeur wysiwyg
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index 214a12ead14..8bd250bc76e 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -108,6 +108,11 @@ class Entrepot extends CommonObject
*/
public $fk_parent;
+ /**
+ * @var int ID of project
+ */
+ public $fk_project;
+
/**
* @var array List of short language codes for status
*/
@@ -124,6 +129,7 @@ class Entrepot extends CommonObject
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35, 'searchall'=>1),
'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>1, 'searchall'=>1),
'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:statut=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41),
+ 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45, 'searchall'=>1),
'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'searchall'=>1),
'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-2, 'position'=>55, 'searchall'=>1),
@@ -198,8 +204,8 @@ class Entrepot extends CommonObject
$this->db->begin();
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent)";
- $sql .= " VALUES ('".$this->db->escape($this->label)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent, fk_project)";
+ $sql .= " VALUES ('".$this->db->escape($this->label)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").", ".($this->fk_project > 0 ? $this->fk_project : "NULL").")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$result = $this->db->query($sql);
@@ -290,6 +296,7 @@ class Entrepot extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
$sql .= " SET ref = '".$this->db->escape($this->label)."'";
$sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL");
+ $sql .= ", fk_project = ".(($this->fk_project > 0) ? $this->fk_project : "NULL");
$sql .= ", description = '".$this->db->escape($this->description)."'";
$sql .= ", statut = ".$this->statut;
$sql .= ", lieu = '".$this->db->escape($this->lieu)."'";
@@ -432,7 +439,7 @@ class Entrepot extends CommonObject
return -1;
}
- $sql = "SELECT rowid, entity, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax,";
+ $sql = "SELECT rowid, entity, fk_parent, fk_project, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax,";
$sql .= " model_pdf, import_key";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
if ($id) {
@@ -452,6 +459,7 @@ class Entrepot extends CommonObject
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->fk_parent = $obj->fk_parent;
+ $this->fk_project = $obj->fk_project;
$this->ref = $obj->label;
$this->label = $obj->label;
$this->libelle = $obj->label; // deprecated
|