Merge remote-tracking branch 'upstream/develop' into socialnetworks
This commit is contained in:
commit
1ba9612f12
@ -125,9 +125,11 @@ if (empty($reshook))
|
||||
$error = 0;
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$idprod=GETPOST('idprod', 'int');
|
||||
$qty=GETPOST('qty', 'int');
|
||||
$efficiency=GETPOST('efficiency', 'int');
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$qty = GETPOST('qty', 'int');
|
||||
$qty_frozen = GETPOST('qty_frozen', 'int');
|
||||
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
||||
$efficiency = GETPOST('efficiency', 'int');
|
||||
|
||||
if ($qty == '') {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
@ -138,17 +140,27 @@ if (empty($reshook))
|
||||
$error++;
|
||||
}
|
||||
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fk_bom = $id;
|
||||
$bomline->fk_product = $idprod;
|
||||
$bomline->qty = $qty;
|
||||
$bomline->efficiency = $efficiency;
|
||||
|
||||
$result = $bomline->create($user);
|
||||
if ($result <= 0)
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($bomline->error, $bomline->errors, 'errors');
|
||||
$action = '';
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fk_bom = $id;
|
||||
$bomline->fk_product = $idprod;
|
||||
$bomline->qty = $qty;
|
||||
$bomline->qty_frozen = $qty_frozen;
|
||||
$bomline->disable_stock_change = $disable_stock_change;
|
||||
$bomline->efficiency = $efficiency;
|
||||
|
||||
$result = $bomline->create($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($bomline->error, $bomline->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['disable_stock_change']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,6 +172,8 @@ if (empty($reshook))
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$qty=GETPOST('qty', 'int');
|
||||
$qty_frozen = GETPOST('qty_frozen', 'int');
|
||||
$disable_stock_change = GETPOST('disable_stock_change', 'int');
|
||||
$efficiency=GETPOST('efficiency', 'int');
|
||||
|
||||
if ($qty == '') {
|
||||
@ -170,6 +184,8 @@ if (empty($reshook))
|
||||
$bomline = new BOMLine($db);
|
||||
$bomline->fetch($lineid);
|
||||
$bomline->qty = $qty;
|
||||
$bomline->qty_frozen = $qty_frozen;
|
||||
$bomline->disable_stock_change = $disable_stock_change;
|
||||
$bomline->efficiency = $efficiency;
|
||||
|
||||
$result = $bomline->update($user);
|
||||
@ -178,6 +194,11 @@ if (empty($reshook))
|
||||
setEventMessages($bomline->error, $bomline->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($_POST['qty_frozen']);
|
||||
unset($_POST['disable_stock_change']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,12 +315,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
|
||||
}
|
||||
$formconfirm = '';
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirmation of validation
|
||||
if ($action == 'validate')
|
||||
|
||||
@ -240,9 +240,10 @@ class BOM extends CommonObject
|
||||
unset($object->import_key);
|
||||
|
||||
// Clear fields
|
||||
$object->ref = "copy_of_".$object->ref;
|
||||
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
|
||||
$object->ref = empty($this->fields['ref']['default']) ? $langs->trans("copy_of_").$object->ref: $this->fields['ref']['default'];
|
||||
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label: $this->fields['label']['default'];
|
||||
$object->status = self::STATUS_DRAFT;
|
||||
// ...
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0)
|
||||
{
|
||||
@ -1035,12 +1036,14 @@ class BOMLine extends CommonObject
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||
'rowid' => array('type'=>'integer', 'label'=>'LineID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||
'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1,),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
|
||||
'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'),
|
||||
'disable_stock_change' => array('type'=>'smallint', 'label'=>'DisableStockChange', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>108, 'css'=>'maxwidth50imp', 'help'=>'DisableStockChangeHelp'),
|
||||
'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
);
|
||||
@ -1049,6 +1052,8 @@ class BOMLine extends CommonObject
|
||||
public $fk_product;
|
||||
public $description;
|
||||
public $qty;
|
||||
public $qty_frozen;
|
||||
public $disable_stock_change;
|
||||
public $efficiency;
|
||||
public $position;
|
||||
public $import_key;
|
||||
@ -1315,47 +1320,7 @@ class BOMLine extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
if (empty($this->labelstatus))
|
||||
{
|
||||
global $langs;
|
||||
//$langs->load("mrp");
|
||||
$this->labelstatus[1] = $langs->trans('Enabled');
|
||||
$this->labelstatus[0] = $langs->trans('Disabled');
|
||||
}
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
return $this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status];
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
elseif ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle');
|
||||
elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -63,11 +63,13 @@ if ($nolinesbefore) {
|
||||
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
print '<td class="linecoluseunit left">';
|
||||
print '<span id="title_units">';
|
||||
print $langs->trans('Unit');
|
||||
print '</span></td>';
|
||||
print '<td class="linecoluseunit left">';
|
||||
print '<span id="title_units">';
|
||||
print $langs->trans('Unit');
|
||||
print '</span></td>';
|
||||
}
|
||||
print '<td class="linecolqtyfrozen right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>';
|
||||
print '<td class="linecoldisablestockchange right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>';
|
||||
print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
|
||||
print '<td class="linecoledit" colspan="'.$colspan.'"> </td>';
|
||||
print '</tr>';
|
||||
@ -109,6 +111,7 @@ if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1).'">';
|
||||
print '</td>';
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$coldisplay++;
|
||||
@ -118,7 +121,14 @@ if($conf->global->PRODUCT_USE_UNITS)
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"'.(GETPOST("qty_frozen", 'alpha')?' checked="checked"':'').'>';
|
||||
print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"'.(GETPOST("disable_stock_change", 'alpha')?' checked="checked"':'').'">';
|
||||
print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom nowrap linecollost right">';
|
||||
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.(GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1).'">';
|
||||
print '</td>';
|
||||
|
||||
@ -116,6 +116,14 @@ if ($conf->global->PRODUCT_USE_UNITS)
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"'.(GETPOSTISSET("qty_frozen")?(GETPOST('qty_frozen', 'int')?' checked="checked"':''):($line->qty_frozen?' checked="checked"':'')).'>';
|
||||
print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"'.(GETPOSTISSET('disablestockchange')?(GETPOST("disable_stock_change", 'int')?' checked="checked"':''):($line->disable_stock_change?' checked="checked"':'')).'">';
|
||||
print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom nowrap linecollost right">';
|
||||
print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
|
||||
|
||||
@ -59,6 +59,13 @@ if ($conf->global->PRODUCT_USE_UNITS)
|
||||
print '<td class="linecoluseunit left">'.$langs->trans('Unit').'</td>';
|
||||
}
|
||||
|
||||
// Qty frozen
|
||||
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>';
|
||||
|
||||
// Disable stock change
|
||||
print '<td class="linecolqty right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>';
|
||||
|
||||
// Efficiency
|
||||
print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
|
||||
|
||||
print '<td class="linecoledit"></td>'; // No width to allow autodim
|
||||
|
||||
@ -87,6 +87,16 @@ if($conf->global->PRODUCT_USE_UNITS)
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="linecolqtyfrozen nowrap right">';
|
||||
$coldisplay++;
|
||||
echo $line->qty_frozen ? yn($line->qty_frozen) : '';
|
||||
print '</td>';
|
||||
print '<td class="linecoldisablestockchange nowrap right">';
|
||||
$coldisplay++;
|
||||
echo $line->disable_stock_change ? yn($line->disable_stock_change) : ''; // Yes, it is a quantity, not a price, but we just want the formating role of function price
|
||||
print '</td>';
|
||||
|
||||
print '<td class="linecolqty nowrap right">';
|
||||
$coldisplay++;
|
||||
echo $line->efficiency;
|
||||
|
||||
@ -56,7 +56,7 @@ if ($action == 'add' && ! empty($permissiontoadd))
|
||||
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='datetime') {
|
||||
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='price') {
|
||||
} elseif (in_array($object->fields[$key]['type'], array('price', 'real'))) {
|
||||
$value = price2num(GETPOST($key));
|
||||
} else {
|
||||
$value = GETPOST($key, 'alpha');
|
||||
@ -108,7 +108,7 @@ if ($action == 'update' && ! empty($permissiontoadd))
|
||||
{
|
||||
if (! GETPOSTISSET($key)) continue; // The field was not submited to be edited
|
||||
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
|
||||
|
||||
var_dump($object->fields[$key]['type']);
|
||||
// Set value to update
|
||||
if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
|
||||
$value = GETPOST($key, 'none');
|
||||
@ -116,7 +116,7 @@ if ($action == 'update' && ! empty($permissiontoadd))
|
||||
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='datetime') {
|
||||
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
|
||||
} elseif ($object->fields[$key]['type']=='price') {
|
||||
} elseif (in_array($object->fields[$key]['type'], array('price', 'real'))) {
|
||||
$value = price2num(GETPOST($key));
|
||||
} else {
|
||||
$value = GETPOST($key, 'alpha');
|
||||
|
||||
@ -7483,6 +7483,7 @@ abstract class CommonObject
|
||||
{
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET ref = '(PROV".$this->id.")' WHERE ref = '(PROV)' AND rowid = ".$this->id;
|
||||
$resqlupdate = $this->db->query($sql);
|
||||
|
||||
if ($resqlupdate===false)
|
||||
{
|
||||
$error++;
|
||||
|
||||
@ -2416,10 +2416,12 @@ class Form
|
||||
|
||||
// Units
|
||||
$outvalUnits = '';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
if (!empty($objp->unit_short)) {
|
||||
$outvalUnits .= ' - ' . $objp->unit_short;
|
||||
}
|
||||
}
|
||||
if (! empty($conf->global->PRODUCT_SHOW_DIMENSIONS_IN_COMBO)) {
|
||||
if (!empty($objp->weight) && $objp->weight_units!==null) {
|
||||
$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
|
||||
$outvalUnits .= ' - ' . $unitToShow;
|
||||
@ -2436,17 +2438,17 @@ class Form
|
||||
$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
|
||||
$outvalUnits .= ' - ' . $unitToShow;
|
||||
}
|
||||
if ($outdurationvalue && $outdurationunit) {
|
||||
$da = array(
|
||||
'h' => $langs->trans('Hour'),
|
||||
'd' => $langs->trans('Day'),
|
||||
'w' => $langs->trans('Week'),
|
||||
'm' => $langs->trans('Month'),
|
||||
'y' => $langs->trans('Year')
|
||||
);
|
||||
if (isset($da[$outdurationunit])) {
|
||||
$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
|
||||
}
|
||||
}
|
||||
if ($outdurationvalue && $outdurationunit) {
|
||||
$da = array(
|
||||
'h' => $langs->trans('Hour'),
|
||||
'd' => $langs->trans('Day'),
|
||||
'w' => $langs->trans('Week'),
|
||||
'm' => $langs->trans('Month'),
|
||||
'y' => $langs->trans('Year')
|
||||
);
|
||||
if (isset($da[$outdurationunit])) {
|
||||
$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2458,8 +2460,10 @@ class Form
|
||||
}
|
||||
if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)))
|
||||
{
|
||||
if ($objp->stock > 0) $opt.= ' class="product_line_stock_ok"';
|
||||
elseif ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"';
|
||||
if (! empty($user->rights->stock->lire)) {
|
||||
if ($objp->stock > 0) $opt.= ' class="product_line_stock_ok"';
|
||||
elseif ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"';
|
||||
}
|
||||
}
|
||||
$opt.= '>';
|
||||
$opt.= $objp->ref;
|
||||
@ -2602,37 +2606,39 @@ class Form
|
||||
|
||||
if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)))
|
||||
{
|
||||
$opt.= ' - '.$langs->trans("Stock").':'.$objp->stock;
|
||||
if (! empty($user->rights->stock->lire)) {
|
||||
$opt.= ' - '.$langs->trans("Stock").':'.$objp->stock;
|
||||
|
||||
if ($objp->stock > 0) {
|
||||
$outval.= ' - <span class="product_line_stock_ok">';
|
||||
}elseif ($objp->stock <= 0) {
|
||||
$outval.= ' - <span class="product_line_stock_too_low">';
|
||||
}
|
||||
$outval.= $langs->transnoentities("Stock").':'.$objp->stock;
|
||||
$outval.= '</span>';
|
||||
if (! empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation
|
||||
{
|
||||
$langs->load("stocks");
|
||||
if ($objp->stock > 0) {
|
||||
$outval.= ' - <span class="product_line_stock_ok">';
|
||||
}elseif ($objp->stock <= 0) {
|
||||
$outval.= ' - <span class="product_line_stock_too_low">';
|
||||
}
|
||||
$outval.= $langs->transnoentities("Stock").':'.$objp->stock;
|
||||
$outval.= '</span>';
|
||||
if (! empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation
|
||||
{
|
||||
$langs->load("stocks");
|
||||
|
||||
$tmpproduct=new Product($this->db);
|
||||
$tmpproduct->fetch($objp->rowid);
|
||||
$tmpproduct->load_virtual_stock();
|
||||
$virtualstock = $tmpproduct->stock_theorique;
|
||||
$tmpproduct=new Product($this->db);
|
||||
$tmpproduct->fetch($objp->rowid);
|
||||
$tmpproduct->load_virtual_stock();
|
||||
$virtualstock = $tmpproduct->stock_theorique;
|
||||
|
||||
$opt.= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
|
||||
$opt.= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
|
||||
|
||||
$outval.=' - '.$langs->transnoentities("VirtualStock").':';
|
||||
if ($virtualstock > 0) {
|
||||
$outval.= ' - <span class="product_line_stock_ok">';
|
||||
}elseif ($virtualstock <= 0) {
|
||||
$outval.= ' - <span class="product_line_stock_too_low">';
|
||||
}
|
||||
$outval.=$virtualstock;
|
||||
$outval.='</span>';
|
||||
$outval.=' - '.$langs->transnoentities("VirtualStock").':';
|
||||
if ($virtualstock > 0) {
|
||||
$outval.= ' - <span class="product_line_stock_ok">';
|
||||
}elseif ($virtualstock <= 0) {
|
||||
$outval.= ' - <span class="product_line_stock_too_low">';
|
||||
}
|
||||
$outval.=$virtualstock;
|
||||
$outval.='</span>';
|
||||
|
||||
unset($tmpproduct);
|
||||
}
|
||||
unset($tmpproduct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$opt.= "</option>\n";
|
||||
|
||||
@ -6,6 +6,7 @@ if (empty($keyforclass) || empty($keyforclassfile) || empty($keyforelement))
|
||||
dol_print_error('', 'include of file commonfieldsinexport.inc.php was done but var $keyforclass or $keyforclassfile or $keyforelement was not set');
|
||||
exit;
|
||||
}
|
||||
if (empty($keyforalias)) $keyforalias = 't';
|
||||
|
||||
dol_include_once($keyforclassfile);
|
||||
if (class_exists($keyforclass))
|
||||
@ -15,7 +16,7 @@ if (class_exists($keyforclass))
|
||||
// Add common fields
|
||||
foreach($tmpobject->fields as $keyfield => $valuefield)
|
||||
{
|
||||
$fieldname = 't' . '.' . $keyfield;
|
||||
$fieldname = $keyforalias . '.' . $keyfield;
|
||||
$fieldlabel = ucfirst($valuefield['label']);
|
||||
$typeFilter = "Text";
|
||||
$typefield=preg_replace('/\(.*$/', '', $valuefield['type']); // double(24,8) -> double
|
||||
|
||||
@ -286,21 +286,26 @@ class modBom extends DolibarrModules
|
||||
$r=1;
|
||||
|
||||
/* BEGIN MODULEBUILDER EXPORT BILLOFMATERIALS */
|
||||
/*
|
||||
$langs->load("mrp@mrp");
|
||||
$langs->load("mrp");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='BomLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_label[$r]='BomAndBomLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bom';
|
||||
$keyforclass = 'Bom'; $keyforclassfile='/mymobule/class/bom.class.php'; $keyforelement='bom';
|
||||
$keyforclass = 'BOM'; $keyforclassfile='/bom/class/bom.class.php'; $keyforelement='bom';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='bom'; $keyforaliasextra='extra'; $keyforelement='bom';
|
||||
$keyforclass = 'BOMLine'; $keyforclassfile='/bom/class/bom.class.php'; $keyforelement='bomline'; $keyforalias='tl';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
unset($this->export_fields_array[$r]['tl.fk_bom']);
|
||||
$keyforselect ='bom_bom'; $keyforaliasextra='extra'; $keyforelement='bom';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$keyforselect ='bom_bomline'; $keyforaliasextra='extraline'; $keyforelement='bomline';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_dependencies_array[$r]=array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'bom as t';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'bom_bom as t';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bom_bomline as tl ON tl.fk_bom = t.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('bom').')';
|
||||
$r++; */
|
||||
$r++;
|
||||
/* END MODULEBUILDER EXPORT BILLOFMATERIALS */
|
||||
}
|
||||
|
||||
|
||||
@ -255,28 +255,6 @@ class modDav extends DolibarrModules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
END MODULEBUILDER LEFTMENU MYOBJECT */
|
||||
|
||||
|
||||
// Exports
|
||||
$r=1;
|
||||
|
||||
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */
|
||||
/*
|
||||
$langs->load("dav@dav");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='myobject@dav';
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER EXPORT MYOBJECT */
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -252,28 +252,6 @@ class modEmailCollector extends DolibarrModules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
END MODULEBUILDER LEFTMENU MYOBJECT */
|
||||
|
||||
|
||||
// Exports
|
||||
$r=1;
|
||||
|
||||
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */
|
||||
/*
|
||||
$langs->load("dav@dav");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='myobject@dav';
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER EXPORT MYOBJECT */
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -253,28 +253,6 @@ class modTakePos extends DolibarrModules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
END MODULEBUILDER LEFTMENU MYOBJECT */
|
||||
|
||||
|
||||
// Exports
|
||||
$r=1;
|
||||
|
||||
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */
|
||||
/*
|
||||
$langs->load("cashdesk");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='myobject@takepos';
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER EXPORT MYOBJECT */
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -134,7 +134,6 @@ class modWebsite extends DolibarrModules
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
//$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'website_page as t, '.MAIN_DB_PREFIX.'website as p';
|
||||
$this->export_sql_end[$r] .=' WHERE t.fk_website = p.rowid';
|
||||
|
||||
@ -316,24 +316,6 @@ class modZapier extends DolibarrModules
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
*/
|
||||
// Exports
|
||||
$r=1;
|
||||
/* EXPORT */
|
||||
/*
|
||||
$langs->load("zapier@zapier");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='myobject@zapier';
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
|
||||
$r++; */
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -73,7 +73,9 @@ $entitytoicon = array(
|
||||
'expensereport_line'=> 'trip',
|
||||
'holiday' => 'holiday',
|
||||
'contract_line' => 'contract',
|
||||
'translation' => 'generic'
|
||||
'translation' => 'generic',
|
||||
'bomm' => 'bom',
|
||||
'bomline' => 'bom'
|
||||
);
|
||||
|
||||
// Translation code
|
||||
@ -120,7 +122,9 @@ $entitytolang = array(
|
||||
'holiday' => 'TitreRequestCP',
|
||||
'contract' => 'Contract',
|
||||
'contract_line'=> 'ContractLine',
|
||||
'translation' => 'Translation'
|
||||
'translation' => 'Translation',
|
||||
'bom' => 'BOM',
|
||||
'bomline' => 'BOMLine'
|
||||
);
|
||||
|
||||
$array_selected=isset($_SESSION["export_selected_fields"])?$_SESSION["export_selected_fields"]:array();
|
||||
|
||||
@ -119,6 +119,14 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','ficheinter',19);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',142);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',400);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',401);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',402);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',403);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',404);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',410);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO disabled','Executed when a MO is produced','bom',411);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',412);
|
||||
-- actions not enabled by default : they are excluded when we enable the module Agenda (except TASK_...)
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',151);
|
||||
|
||||
@ -58,6 +58,9 @@ UPDATE llx_rights_def SET subperms = 'write' WHERE perms = 'fiscalyear' AND modu
|
||||
|
||||
ALTER TABLE llx_bom_bom ADD COLUMN duration double(8,4) DEFAULT NULL;
|
||||
ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
|
||||
ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0;
|
||||
ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_bom_bomline DROP COLUMN rank;
|
||||
|
||||
create table llx_categorie_warehouse
|
||||
@ -410,3 +413,62 @@ create table llx_c_shipment_package_type
|
||||
entity integer DEFAULT 1 NOT NULL -- Multi company id
|
||||
)ENGINE=innodb;
|
||||
|
||||
|
||||
CREATE TABLE llx_mrp_mo(
|
||||
-- BEGIN MODULEBUILDER FIELDS
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
label varchar(255),
|
||||
qty real NOT NULL,
|
||||
fk_warehouse integer,
|
||||
fk_soc integer,
|
||||
note_public text,
|
||||
note_private text,
|
||||
date_creation datetime NOT NULL,
|
||||
tms timestamp,
|
||||
fk_user_creat integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
import_key varchar(14),
|
||||
status integer NOT NULL,
|
||||
fk_product integer NOT NULL,
|
||||
date_start_planned datetime,
|
||||
date_end_planned datetime,
|
||||
fk_bom integer,
|
||||
fk_project integer
|
||||
-- END MODULEBUILDER FIELDS
|
||||
) ENGINE=innodb;
|
||||
|
||||
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_ref (ref);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_entity (entity);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_mrp_mo ADD CONSTRAINT llx_mrp_mo_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES user(rowid);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_status (status);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_product (fk_product);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_date_start_planned (date_start_planned);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_date_end_planned (date_end_planned);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_bom (fk_bom);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_project (fk_project);
|
||||
|
||||
|
||||
create table llx_mrp_myobject_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_mrp_myobject_extrafields ADD INDEX idx_fk_object(fk_object);
|
||||
|
||||
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_VALIDATE','BOM validated','Executed when a BOM is validated','bom',400);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_UNVALIDATE','BOM unvalidated','Executed when a BOM is unvalidated','bom',401);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',402);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',403);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',404);
|
||||
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',410);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO disabled','Executed when a MO is produced','bom',411);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',412);
|
||||
|
||||
@ -22,6 +22,8 @@ CREATE TABLE llx_bom_bomline(
|
||||
description text,
|
||||
import_key varchar(14),
|
||||
qty double(24,8) NOT NULL,
|
||||
qty_frozen smallint DEFAULT 0,
|
||||
disable_stock_change smallint DEFAULT 0,
|
||||
efficiency double(8,4) NOT NULL DEFAULT 1,
|
||||
position integer NOT NULL DEFAULT 0
|
||||
-- END MODULEBUILDER FIELDS
|
||||
|
||||
@ -15,10 +15,8 @@
|
||||
|
||||
|
||||
-- BEGIN MODULEBUILDER INDEXES
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_rowid (rowid);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_ref (ref);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_entity (entity);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_qty (qty);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_mrp_mo ADD CONSTRAINT llx_mrp_mo_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES user(rowid);
|
||||
ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_status (status);
|
||||
@ -20,7 +20,8 @@ CREATE TABLE llx_mrp_mo(
|
||||
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
label varchar(255),
|
||||
qty real NOT NULL,
|
||||
qty real NOT NULL,
|
||||
fk_warehouse integer,
|
||||
fk_soc integer,
|
||||
note_public text,
|
||||
note_private text,
|
||||
@ -114,6 +114,7 @@ InformationToHelpDiagnose=This information can be useful for diagnostic purposes
|
||||
MoreInformation=More information
|
||||
TechnicalInformation=Technical information
|
||||
TechnicalID=Technical ID
|
||||
LineID=Line ID
|
||||
NotePublic=Note (public)
|
||||
NotePrivate=Note (private)
|
||||
PrecisionUnitIsLimitedToXDecimals=Dolibarr was setup to limit precision of unit prices to <b>%s</b> decimals.
|
||||
|
||||
@ -31,4 +31,13 @@ EstimatedDuration=Estimated duration
|
||||
EstimatedDurationDesc=Estimated duration to manufacture this product using this BOM
|
||||
ConfirmValidateBom=Are you sure you want to validate the BOM with the reference <strong>%s</strong> (you will be able to use it to build new Manufacturing Orders)
|
||||
ConfirmCloseBom=Are you sure you want to cancel this BOM (you won't be able to use it to build new Manufacturing Orders anymore) ?
|
||||
ConfirmReopenBom=Are you sure you want to re-open this BOM (you will be able to use it to build new Manufacturing Orders)
|
||||
ConfirmReopenBom=Are you sure you want to re-open this BOM (you will be able to use it to build new Manufacturing Orders)
|
||||
StatusMOProduced=Produced
|
||||
QtyFrozen=Frozen Qty
|
||||
QuantityFrozen=Frozen Quantity
|
||||
QuantityConsumedInvariable=When this flag is set, the quantity consumed is always the value defined and is not relative to the quantity produced.
|
||||
DisableStockChange=Disable stock change
|
||||
DisableStockChangeHelp=When this flag is set, there is no stock change on this product, whatever is the quantity produced
|
||||
BomAndBomLines=Bills Of Material and lines
|
||||
BOMLine=Line of BOM
|
||||
WarehouseForProduction=Warehouse for production
|
||||
@ -71,7 +71,7 @@ class MyObject extends CommonObject
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'noteditable' says if field is not editable (1 or 0)
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
|
||||
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'position' is the sort order of field.
|
||||
@ -283,8 +283,9 @@ class MyObject extends CommonObject
|
||||
|
||||
|
||||
// Clear fields
|
||||
$object->ref = "copy_of_".$object->ref;
|
||||
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
$object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref: $this->fields['ref']['default'];
|
||||
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label: $this->fields['label']['default'];
|
||||
$object->status = self::STATUS_DRAFT;
|
||||
// ...
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0)
|
||||
|
||||
@ -336,11 +336,16 @@ class modMyModule extends DolibarrModules
|
||||
$this->export_icon[$r]='myobject@mymodule';
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
//$keyforclass = 'MyObjectLine'; $keyforclassfile='/mymodule/class/myobject.class.php'; $keyforelement='myobjectline'; $keyforalias='tl';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
//$keyforselect='myobjectline'; $keyforaliasextra='extraline'; $keyforelement='myobjectline';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('myobjectline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
|
||||
//$this->export_sql_end[$r] =' LEFT JOIN '.MAIN_DB_PREFIX.'myobject_line as tl ON tl.fk_myobject = t.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
|
||||
$r++; */
|
||||
|
||||
@ -61,7 +61,7 @@ class Mo extends CommonObject
|
||||
const STATUS_DRAFT = 0;
|
||||
const STATUS_VALIDATED = 1; // To produce
|
||||
const STATUS_INPROGRESS = 2;
|
||||
const STATUS_DONE = 3;
|
||||
const STATUS_PRODUCED = 3;
|
||||
const STATUS_CANCELED = -1;
|
||||
|
||||
|
||||
@ -92,12 +92,13 @@ class Mo extends CommonObject
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>-1, 'position'=>20, 'notnull'=>1, 'default'=>'1', 'index'=>1,),
|
||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',),
|
||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>20, 'notnull'=>1, 'default'=>'1', 'index'=>1,),
|
||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',),
|
||||
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'index'=>1, 'comment'=>"Qty to produce",),
|
||||
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce",),
|
||||
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,),
|
||||
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>52),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,),
|
||||
@ -109,13 +110,14 @@ class Mo extends CommonObject
|
||||
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,),
|
||||
'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",),
|
||||
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,),
|
||||
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>4, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'Done', '-1'=>'Canceled')),
|
||||
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>4, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '-1'=>'Canceled')),
|
||||
);
|
||||
public $rowid;
|
||||
public $ref;
|
||||
public $entity;
|
||||
public $label;
|
||||
public $qty;
|
||||
public $fk_warehouse;
|
||||
public $fk_soc;
|
||||
public $note_public;
|
||||
public $note_private;
|
||||
@ -246,10 +248,10 @@ class Mo extends CommonObject
|
||||
unset($object->fk_user_creat);
|
||||
unset($object->import_key);
|
||||
|
||||
|
||||
// Clear fields
|
||||
$object->ref = "copy_of_".$object->ref;
|
||||
$object->title = $langs->trans("CopyOf")." ".$object->title;
|
||||
$object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref: $this->fields['ref']['default'];
|
||||
$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label: $this->fields['label']['default'];
|
||||
$object->status = self::STATUS_DRAFT;
|
||||
// ...
|
||||
// Clear extrafields that are unique
|
||||
if (is_array($object->array_options) && count($object->array_options) > 0)
|
||||
@ -549,8 +551,10 @@ class Mo extends CommonObject
|
||||
global $langs;
|
||||
//$langs->load("mrp");
|
||||
$this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft');
|
||||
$this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
|
||||
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
|
||||
$this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Validated');
|
||||
$this->labelstatus[self::STATUS_INPROGRESS] = $langs->trans('InProgress');
|
||||
$this->labelstatus[self::STATUS_PRODUCED] = $langs->trans('StatusMOProduced');
|
||||
$this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Canceled');
|
||||
}
|
||||
|
||||
$statusType = 'status'.$status;
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
|
||||
|
||||
$hookmanager = new HookManager($db);
|
||||
|
||||
@ -46,6 +47,7 @@ $result=restrictedArea($user, 'bom|mrp');
|
||||
*/
|
||||
|
||||
$staticbom = new BOM($db);
|
||||
$staticmo = new Mo($db);
|
||||
|
||||
llxHeader('', $langs->trans("MRP"), '');
|
||||
|
||||
@ -81,7 +83,7 @@ if ($conf->use_javascript_ajax)
|
||||
{
|
||||
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
|
||||
{
|
||||
$dataseries[$obj->status]=$obj->nb;
|
||||
$dataseries[$obj->status]=array(0=>$staticmo->LibStatut($obj->status), $obj->nb);
|
||||
$totalnb+=$obj->nb;
|
||||
}
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
// Common attributes
|
||||
$keyforbreak='qty';
|
||||
$keyforbreak='fk_warehouse';
|
||||
unset($object->fields['fk_project']);
|
||||
unset($object->fields['fk_soc']);
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
|
||||
|
||||
@ -144,7 +144,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
||||
foreach($listofsearchfields as $key => $value)
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<tr>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
print '</tr>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user