Project must be on a dedicated field

This commit is contained in:
Laurent Destailleur 2018-10-24 12:00:54 +02:00
parent c2c4366c62
commit 36323752ed
5 changed files with 21 additions and 7 deletions

View File

@ -54,6 +54,7 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN desc_fourn text after ref_f
ALTER TABLE llx_user ADD COLUMN dateemploymentend date after dateemployment;
ALTER TABLE llx_stock_mouvement ADD COLUMN fk_project integer;
ALTER TABLE llx_c_field_list ADD COLUMN visible tinyint DEFAULT 1 NOT NULL AFTER search;

View File

@ -33,6 +33,7 @@ create table llx_stock_mouvement
fk_user_author integer, -- Id user making movement
label varchar(255), -- Comment on movement
inventorycode varchar(128), -- Code used to group different movement line into one operation (may be an inventory, a mass picking)
fk_project integer,
fk_origin integer,
origintype varchar(32),
model_pdf varchar(255)

View File

@ -204,3 +204,7 @@ ListInventory=List
StockSupportServices=Stock management supports Services
StockSupportServicesDesc=By default, you can stock only product with type "product". If on, and if module service is on, you can also stock a product with type "service"
ReceiveProducts=Receive items
StockIncreaseAfterCorrectTransfer=Increase after correction/transfer
StockDecreaseAfterCorrectTransfer=Decrease after correction/transfer
StockIncrease=Stock increase
StockDecrease=Stock decrease

View File

@ -44,6 +44,13 @@ class MouvementStock extends CommonObject
public $product_id;
public $warehouse_id;
public $qty;
/**
* @var int Type of movement
* 0=input (stock increase by a stock transfer), 1=output (stock decrease after by a stock transfer),
* 2=output (stock decrease), 3=input (stock increase)
* Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2.
*/
public $type;
public $tms = '';

View File

@ -478,11 +478,11 @@ if (! empty($search_movement)) $sql.= natural_search('m.label', $search_mov
if (! empty($search_inventorycode)) $sql.= natural_search('m.inventorycode', $search_inventorycode);
if (! empty($search_product_ref)) $sql.= natural_search('p.ref', $search_product_ref);
if (! empty($search_product)) $sql.= natural_search('p.label', $search_product);
if ($search_warehouse > 0) $sql.= " AND e.rowid = '".$db->escape($search_warehouse)."'";
if ($search_warehouse != '' && $search_warehouse != '-1') $sql.= natural_search('e.rowid', $search_warehouse, 2);
if (! empty($search_user)) $sql.= natural_search('u.login', $search_user);
if (! empty($search_batch)) $sql.= natural_search('m.batch', $search_batch);
if ($search_qty != '') $sql.= natural_search('m.value', $search_qty, 1);
if ($search_type_mouvement) $sql.= " AND m.type_mouvement = '".$db->escape($search_type_mouvement)."'";
if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql.= natural_search('m.type_mouvement', $search_type_mouvement, 2);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
@ -843,13 +843,14 @@ if ($resql)
// Type of movement
print '<td class="liste_titre" align="center">';
//print '<input class="flat" type="text" size="3" name="search_type_mouvement" value="'.dol_escape_htmltag($search_type_mouvement).'">';
print '<select name="search_type_mouvement">';
print '<select id="search_type_mouvement" name="search_type_mouvement" class="maxwidth150">';
print '<option value="" '.(($search_type_mouvement=="")?'selected="selected"':'').'></option>';
print '<option value="0" '.(($search_type_mouvement=="0")?'selected="selected"':'').'>0</option>';
print '<option value="1" '.(($search_type_mouvement=="1")?'selected="selected"':'').'>1</option>';
print '<option value="2" '.(($search_type_mouvement=="2")?'selected="selected"':'').'>2</option>';
print '<option value="3" '.(($search_type_mouvement=="3")?'selected="selected"':'').'>3</option>';
print '<option value="0" '.(($search_type_mouvement=="0")?'selected="selected"':'').'>'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</option>';
print '<option value="1" '.(($search_type_mouvement=="1")?'selected="selected"':'').'>'.$langs->trans('StockDecreaseAfterCorrectTransfer').'</option>';
print '<option value="2" '.(($search_type_mouvement=="2")?'selected="selected"':'').'>'.$langs->trans('StockDecrease').'</option>';
print '<option value="3" '.(($search_type_mouvement=="3")?'selected="selected"':'').'>'.$langs->trans('StockIncrease').'</option>';
print '</select>';
print ajax_combobox('search_type_mouvement');
// TODO: add new function $formentrepot->selectTypeOfMovement(...) like
// print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200');
print '</td>';