Updated to display the Advanced Stock Transfers
Regular stock transfers can not be associated with projects in normal use, so the previous functionality was depreciated.
This commit is contained in:
parent
bc73033d22
commit
45bf2cd9a8
2 changed files with 13 additions and 5 deletions
|
|
@ -790,8 +790,8 @@ class Project extends CommonObject
|
|||
$sql = "SELECT DISTINCT pt.rowid FROM ".MAIN_DB_PREFIX."projet_task as pt WHERE pt.fk_projet IN (".$this->db->sanitize($ids).")";
|
||||
} elseif ($type == 'element_time') { // Case we want to duplicate line foreach user
|
||||
$sql = "SELECT DISTINCT pt.rowid, ptt.fk_user FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."element_time as ptt WHERE pt.rowid = ptt.fk_element AND ptt.elementtype = 'task' AND pt.fk_projet IN (".$this->db->sanitize($ids).")";
|
||||
} elseif ($type == 'stock_mouvement') {
|
||||
$sql = "SELECT ms.rowid, ms.fk_user_author as fk_user FROM ".MAIN_DB_PREFIX."stock_mouvement as ms, ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = ms.fk_entrepot AND e.entity IN (".getEntity('stock').") AND ms.origintype = 'project' AND ms.fk_origin IN (".$this->db->sanitize($ids).") AND ms.type_mouvement = 1";
|
||||
} elseif ($type == 'stocktransfer_stocktransfer') {
|
||||
$sql = "SELECT ms.rowid, ms.fk_user_author as fk_user FROM ".MAIN_DB_PREFIX."stocktransfer_stocktransfer as ms, ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = ms.fk_entrepot AND e.entity IN (".getEntity('stock').") AND ms.origintype = 'project' AND ms.fk_origin IN (".$this->db->sanitize($ids).") AND ms.type_mouvement = 1";
|
||||
} elseif ($type == 'loan') {
|
||||
$sql = "SELECT l.rowid, l.fk_user_author as fk_user FROM ".MAIN_DB_PREFIX."loan as l WHERE l.entity IN (".getEntity('loan').") AND l.fk_projet IN (".$this->db->sanitize($ids).")";
|
||||
} else {
|
||||
|
|
@ -1928,7 +1928,7 @@ class Project extends CommonObject
|
|||
if ($tableName == "actioncomm") {
|
||||
$sql .= " SET fk_project=".$this->id;
|
||||
$sql .= " WHERE id=".((int) $elementSelectId);
|
||||
} elseif (in_array($tableName, ["entrepot","mrp_mo"])) {
|
||||
} elseif (in_array($tableName, ["entrepot","mrp_mo","stocktransfer_stocktransfer"])) {
|
||||
$sql .= " SET fk_project=".$this->id;
|
||||
$sql .= " WHERE rowid=".((int) $elementSelectId);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@ if (isModEnabled('supplier_proposal')) {
|
|||
if (isModEnabled('tax')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
}
|
||||
if (isModEnabled('stocktransfer')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransferline.class.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -139,6 +143,9 @@ if (isModEnabled('mrp')) {
|
|||
if (isModEnabled('eventorganization')) {
|
||||
$langs->load("eventorganization");
|
||||
}
|
||||
//if (isModEnabled('stocktransfer')) {
|
||||
// $langs->load("stockstransfer");
|
||||
//}
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
|
@ -610,10 +617,11 @@ $listofreferent = array(
|
|||
'stock_mouvement'=>array(
|
||||
'name'=>"MouvementStockAssociated",
|
||||
'title'=>"ListMouvementStockProject",
|
||||
'class'=>'MouvementStock',
|
||||
'table'=>'stock_mouvement',
|
||||
'class'=>'StockTransfer',
|
||||
'table'=>'stocktransfer_stocktransfer',
|
||||
'datefieldname'=>'datem',
|
||||
'margin'=>'minus',
|
||||
'project_field'=>'fk_project',
|
||||
'disableamount'=>0,
|
||||
'test'=>isModEnabled('stock') && $user->hasRight('stock', 'mouvement', 'lire') && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)
|
||||
),
|
||||
|
|
|
|||
Loading…
Reference in a new issue