Fix look and feel v10

This commit is contained in:
Laurent Destailleur 2019-05-22 13:42:27 +02:00
parent e3d50c533c
commit e60131e3ee

View File

@ -214,7 +214,7 @@ if ($id > 0 || ! empty($ref))
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border centpercent tableforfield">';
// Nature
if ($object->type!=Product::TYPE_SERVICE)
@ -268,236 +268,223 @@ if ($id > 0 || ! empty($ref))
$nbofsubproducts=count($prodschild); // This include only first level of childs
// Number of parent virtual products
//print $form->textwithpicto($langs->trans("ParentProductsNumber").': '.count($prodsfather), $langs->trans('IfZeroItIsNotUsedByVirtualProduct'));
print '<div class="fichecenter">';
//if (count($prodsfather) > 0)
//{
print load_fiche_titre($langs->trans("ProductParentList"), '', '');
print '<table class="centpercent noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ParentProducts').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td>'.$langs->trans('Qty').'</td>';
print '</td>';
if (count($prodsfather) > 0)
print load_fiche_titre($langs->trans("ProductParentList"), '', '');
print '<table class="liste">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ParentProducts').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td>'.$langs->trans('Qty').'</td>';
print '</td>';
if (count($prodsfather) > 0)
{
foreach($prodsfather as $value)
{
$class='pair';
$idprod= $value["id"];
$productstatic->id=$idprod;// $value["id"];
$productstatic->type=$value["fk_product_type"];
$productstatic->ref=$value['ref'];
$productstatic->label=$value['label'];
$productstatic->entity=$value['entity'];
foreach($prodsfather as $value)
{
$idprod= $value["id"];
$productstatic->id=$idprod;// $value["id"];
$productstatic->type=$value["fk_product_type"];
$productstatic->ref=$value['ref'];
$productstatic->label=$value['label'];
$productstatic->entity=$value['entity'];
$class=($class=='impair')?'pair':'impair';
print '<tr class="'.$class.'">';
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
print '<td>'.$value['qty'].'</td>';
print '</tr>';
}
}
else
{
print '<tr class="impair">';
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
print '<tr class="oddeven">';
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
print '<td>'.$value['qty'].'</td>';
print '</tr>';
}
print '</table>';
//}
}
else
{
print '<tr class="oddeven">';
print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
print '</tr>';
}
print '</table>';
print '</div>';
print '<br>'."\n";
// Number of subproducts
//print $form->textwithpicto($langs->trans("AssociatedProductsNumber").': '.(empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)?$nbofsubproducts:$nbofsubsubproducts), $langs->trans('IfZeroItIsNotAVirtualProduct'));
print '<div class="fichecenter">';
// List of subproducts
//if (count($prods_arbo) > 0)
//{
$atleastonenotdefined=0;
print load_fiche_titre($langs->trans("ProductAssociationList"), '', '');
$atleastonenotdefined=0;
print load_fiche_titre($langs->trans("ProductAssociationList"), '', '');
print '<form name="formComposedProduct" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="action" value="save_composed_product" />';
print '<input type="hidden" name="id" value="'.$id.'" />';
print '<form name="formComposedProduct" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="action" value="save_composed_product" />';
print '<input type="hidden" name="id" value="'.$id.'" />';
print '<table class="centpercent noborder">';
print '<table class="liste">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ComposedProduct').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td class="right" colspan="2">'.$langs->trans('MinSupplierPrice').'</td>';
print '<td class="right" colspan="2">'.$langs->trans('MinCustomerPrice').'</td>';
if (! empty($conf->stock->enabled)) print '<td class="right">'.$langs->trans('Stock').'</td>';
print '<td class="center">'.$langs->trans('Qty').'</td>';
print '<td class="center">'.$langs->trans('ComposedProductIncDecStock').'</td>';
print '</tr>'."\n";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ComposedProduct').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td class="right" colspan="2">'.$langs->trans('MinSupplierPrice').'</td>';
print '<td class="right" colspan="2">'.$langs->trans('MinCustomerPrice').'</td>';
if (! empty($conf->stock->enabled)) print '<td class="right">'.$langs->trans('Stock').'</td>';
print '<td class="center">'.$langs->trans('Qty').'</td>';
print '<td class="center">'.$langs->trans('ComposedProductIncDecStock').'</td>';
print '</tr>'."\n";
$class='pair';
$totalsell=0;
if (count($prods_arbo))
$totalsell=0;
if (count($prods_arbo))
{
foreach($prods_arbo as $value)
{
foreach($prods_arbo as $value)
$productstatic->fetch($value['id']);
if ($value['level'] <= 1)
{
$productstatic->fetch($value['id']);
print '<tr class="oddeven">';
if ($value['level'] <= 1)
$notdefined=0;
$nb_of_subproduct = $value['nb'];
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
// Best buying price
print '<td class="right">';
if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0)
{
$class=($class=='impair')?'pair':'impair';
print '<tr class="'.$class.'">';
print $langs->trans("BuyingPriceMinShort").': ';
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0);
else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; }
}
print '</td>';
$notdefined=0;
$nb_of_subproduct = $value['nb'];
// For avoid a non-numeric value
$fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0);
$fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0);
$fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0);
print '<td>'.$productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
$totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT');
$total+=$totalline;
// Best buying price
print '<td class="right">';
if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0)
{
print $langs->trans("BuyingPriceMinShort").': ';
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0);
else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; }
}
print '</td>';
print '<td class="right">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// For avoid a non-numeric value
$fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0);
$fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0);
$fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0);
$totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT');
$total+=$totalline;
print '<td class="right">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Best selling price
$pricesell=$productstatic->price;
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
$pricesell='Variable';
}
else
{
$totallinesell=price2num($value['nb'] * ($pricesell), 'MT');
$totalsell+=$totallinesell;
}
print '<td class="right" colspan="2">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : ''));
if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency);
else print $langs->trans($pricesell);
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td class="right">'.$value['stock'].'</td>'; // Real stock
// Qty + IncDec
if ($user->rights->produit->creer || $user->rights->service->creer)
{
print '<td class="center"><input type="text" value="'.$nb_of_subproduct.'" name="TProduct['.$productstatic->id.'][qty]" size="4" /></td>';
print '<td class="center"><input type="checkbox" name="TProduct['.$productstatic->id.'][incdec]" value="1" '.($value['incdec']==1?'checked':'' ).' /></td>';
}
else{
print '<td>'.$nb_of_subproduct.'</td>';
print '<td>'.($value['incdec']==1?'x':'' ).'</td>';
}
print '</tr>'."\n";
// Best selling price
$pricesell=$productstatic->price;
if (! empty($conf->global->PRODUIT_MULTIPRICES))
{
$pricesell='Variable';
}
else
{
$hide='';
if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand
$class=($class=='impair')?'pair':'impair';
print '<tr class="'.$class.$hide.'" id="sub-'.$value['id_parent'].'">';
//$productstatic->ref=$value['label'];
$productstatic->ref=$value['ref'];
print '<td>';
for ($i=0; $i < $value['level']; $i++) print ' &nbsp; &nbsp; '; // Add indentation
print $productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
// Best buying price
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
// Best selling price
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
if (! empty($conf->stock->enabled)) print '<td></td>'; // Real stock
print '<td class="center">'.$value['nb'].'</td>';
print '<td>&nbsp;</td>';
print '</tr>'."\n";
$totallinesell=price2num($value['nb'] * ($pricesell), 'MT');
$totalsell+=$totallinesell;
}
print '<td class="right" colspan="2">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : ''));
if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency);
else print $langs->trans($pricesell);
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td class="right">'.$value['stock'].'</td>'; // Real stock
// Qty + IncDec
if ($user->rights->produit->creer || $user->rights->service->creer)
{
print '<td class="center"><input type="text" value="'.$nb_of_subproduct.'" name="TProduct['.$productstatic->id.'][qty]" size="4" /></td>';
print '<td class="center"><input type="checkbox" name="TProduct['.$productstatic->id.'][incdec]" value="1" '.($value['incdec']==1?'checked':'' ).' /></td>';
}
else{
print '<td>'.$nb_of_subproduct.'</td>';
print '<td>'.($value['incdec']==1?'x':'' ).'</td>';
}
print '</tr>'."\n";
}
print '<tr class="liste_total">';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
// Minimum buying price
print '<td class="liste_total right">';
print $langs->trans("TotalBuyingPriceMinShort");
print '</td>';
print '<td class="liste_total right">';
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Minimum selling price
print '<td class="liste_total right">';
print $langs->trans("TotalSellingPriceMinShort");
print '</td>';
print '<td class="liste_total right">';
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td class="liste_total right">&nbsp;</td>';
print '<td class="right" colspan="2">';
if ($user->rights->produit->creer || $user->rights->service->creer)
else
{
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
$hide='';
if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand
print '<tr class="oddeven'.$hide.'" id="sub-'.$value['id_parent'].'">';
//$productstatic->ref=$value['label'];
$productstatic->ref=$value['ref'];
print '<td>';
for ($i=0; $i < $value['level']; $i++) print ' &nbsp; &nbsp; '; // Add indentation
print $productstatic->getNomUrl(1, 'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
// Best buying price
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
// Best selling price
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
if (! empty($conf->stock->enabled)) print '<td></td>'; // Real stock
print '<td class="center">'.$value['nb'].'</td>';
print '<td>&nbsp;</td>';
print '</tr>'."\n";
}
print '</td>';
print '</tr>'."\n";
}
else
print '<tr class="liste_total">';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
// Minimum buying price
print '<td class="liste_total right">';
print $langs->trans("TotalBuyingPriceMinShort");
print '</td>';
print '<td class="liste_total right">';
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Minimum selling price
print '<td class="liste_total right">';
print $langs->trans("TotalSellingPriceMinShort");
print '</td>';
print '<td class="liste_total right">';
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency));
print '</td>';
// Stock
if (! empty($conf->stock->enabled)) print '<td class="liste_total right">&nbsp;</td>';
print '<td class="right" colspan="2">';
if ($user->rights->produit->creer || $user->rights->service->creer)
{
$colspan=8;
if (! empty($conf->stock->enabled)) $colspan++;
print '<tr class="impair">';
print '<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td>';
print '</tr>';
}
print '</table>';
/*if($user->rights->produit->creer || $user->rights->service->creer) {
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
}*/
}
print '</td>';
print '</tr>'."\n";
}
else
{
$colspan=8;
if (! empty($conf->stock->enabled)) $colspan++;
print '<tr class="oddeven">';
print '<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td>';
print '</tr>';
}
print '</table>';
/*if($user->rights->produit->creer || $user->rights->service->creer) {
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
}*/
print '</form>';
print '</div>';
print '</form>';
//}
// Form with product to add
if ((empty($action) || $action == 'view' || $action == 'edit' || $action == 'search' || $action == 're-edit') && ($user->rights->produit->creer || $user->rights->service->creer))