Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0
This commit is contained in:
commit
50db6de309
@ -1378,7 +1378,8 @@ class BOM extends CommonObject
|
||||
if ($res > 0) {
|
||||
$bom_child->calculateCosts();
|
||||
$line->childBom[] = $bom_child;
|
||||
$this->total_cost += $bom_child->total_cost * $line->qty;
|
||||
$this->total_cost += price2num($bom_child->total_cost * $line->qty, 'MT');
|
||||
$this->total_cost += $line->total_cost;
|
||||
} else {
|
||||
$this->error = $bom_child->error;
|
||||
return -2;
|
||||
|
||||
@ -261,11 +261,19 @@ if ($resql) {
|
||||
}
|
||||
|
||||
// Qty
|
||||
$label = $sub_bom_product->getLabelOfUnit('long');
|
||||
if ($sub_bom_line->qty_frozen > 0) {
|
||||
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty, 0, '', 0, 0).'</td>';
|
||||
print '<td class="linecoluseunit nowrap left">';
|
||||
if ($label !== '') print $langs->trans($label);
|
||||
print '</td>';
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$langs->trans('Yes').'</td>';
|
||||
} else {
|
||||
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>';
|
||||
print '<td class="linecoluseunit nowrap left">';
|
||||
if ($label !== '') print $langs->trans($label);
|
||||
print '</td>';
|
||||
print '</td>';
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'"> </td>';
|
||||
}
|
||||
|
||||
@ -282,13 +290,13 @@ if ($resql) {
|
||||
// Cost
|
||||
if (!empty($sub_bom->id)) {
|
||||
$sub_bom->calculateCosts();
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).'</span></td>';
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>';
|
||||
$total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty;
|
||||
} elseif ($sub_bom_product->cost_price > 0) {
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).'</span></td>';
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>';
|
||||
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
|
||||
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).'</span></td>';
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>';
|
||||
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
|
||||
} else { // Minimum purchase price if cost price and PMP aren't defined
|
||||
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
||||
@ -298,7 +306,7 @@ if ($resql) {
|
||||
$obj = $object->db->fetch_object($resql_supplier_price);
|
||||
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
|
||||
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($line_cost).'</span></td>';
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price2num($line_cost, 'MT').'</span></td>';
|
||||
$total_cost+= $line_cost;
|
||||
}
|
||||
}
|
||||
|
||||
@ -846,12 +846,13 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
$totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
|
||||
}
|
||||
if ($object->trueVolume) {
|
||||
$totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
|
||||
if ($object->volume_units < 50) {
|
||||
$totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
|
||||
} else {
|
||||
$totalVolumetoshow = price($object->trueVolume, 0, $outputlangs, 0, 0).' '.measuringUnitString(0, "volume", $object->volume_units);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->getColumnStatus('desc')) {
|
||||
$this->printStdColumnContent($pdf, $tab2_top, 'desc', $outputlangs->transnoentities("Total"));
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ class modBom extends DolibarrModules
|
||||
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'bom_bomline');
|
||||
$this->import_regex_array[$r] = array();
|
||||
$this->import_updatekeys_array[$r] = array('bd.fk_bom' => 'BOM Id');
|
||||
$this->import_updatekeys_array[$r] = array('bd.fk_bom' => 'BOM Id', 'bd.fk_product' => 'ProductRef');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'bd.fk_bom' => array(
|
||||
'rule' => 'fetchidfromref',
|
||||
|
||||
@ -139,7 +139,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Close inventory by recording the stock movements
|
||||
if ($action == 'update' && !empty($user->rights->stock->mouvement->creer)) {
|
||||
if ($action == 'update' && !empty($user->rights->stock->mouvement->creer) && $object->status == $object::STATUS_VALIDATED) {
|
||||
$stockmovment = new MouvementStock($db);
|
||||
$stockmovment->setOrigin($object->element, $object->id);
|
||||
|
||||
|
||||
@ -790,7 +790,6 @@ class Societe extends CommonObject
|
||||
public $partnerships = array();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @var Account|string Default BAN account
|
||||
*/
|
||||
|
||||
@ -1995,29 +1995,29 @@ if ($action == 'create') {
|
||||
// Create an order
|
||||
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) && $object->statut == SupplierProposal::STATUS_SIGNED) {
|
||||
if ($usercancreateorder) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddSupplierOrderShort").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'&token='.newToken().'">'.$langs->trans("AddSupplierOrderShort").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Set accepted/refused
|
||||
if ($object->statut == SupplierProposal::STATUS_VALIDATED && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#acceptedrefused').'"';
|
||||
print '<div class="inline-block divButAction"><a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&token='.newToken().'&action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#acceptedrefused').'"';
|
||||
print '>'.$langs->trans('SetAcceptedRefused').'</a></div>';
|
||||
}
|
||||
|
||||
// Close
|
||||
if ($object->statut == SupplierProposal::STATUS_SIGNED && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close').'"';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&token='.newToken().'&action=close'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close').'"';
|
||||
print '>'.$langs->trans('Close').'</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object='.$object->element.'">'.$langs->trans("ToClone").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object='.$object->element.'&token='.newToken().'">'.$langs->trans("ToClone").'</a></div>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', ($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) || $usercandelete);
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', (($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) || $usercandelete));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user