From e60131e3eedaf6a0b2eae97e8f878bf0879f7acf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 13:42:27 +0200 Subject: [PATCH] Fix look and feel v10 --- htdocs/product/composition/card.php | 383 ++++++++++++++-------------- 1 file changed, 185 insertions(+), 198 deletions(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index f27aac68eb4..a3b444db6b7 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -214,7 +214,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // 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 '
'; - //if (count($prodsfather) > 0) - //{ - print load_fiche_titre($langs->trans("ProductParentList"), '', ''); - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (count($prodsfather) > 0) + print load_fiche_titre($langs->trans("ProductParentList"), '', ''); + + print '
'.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + 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 ''; - - print ''; - print ''; - print ''; - print ''; - } - } - else - { - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; } - print '
'.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''.$value['qty'].'
'.$langs->trans("None").'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''.$value['qty'].'
'; - //} - + } + else + { + print ''; + print ''.$langs->trans("None").''; + print ''; + } + print ''; + print '
'; print '
'."\n"; - // Number of subproducts - //print $form->textwithpicto($langs->trans("AssociatedProductsNumber").': '.(empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)?$nbofsubproducts:$nbofsubsubproducts), $langs->trans('IfZeroItIsNotAVirtualProduct')); + print '
'; - // 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 '
'; - print ''; - print ''; + print ''; + print ''; + print ''; - print ''; + print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->stock->enabled)) print ''; - print ''; - print ''; - print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->stock->enabled)) print ''; + print ''; + print ''; + print ''."\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 ''; - if ($value['level'] <= 1) + $notdefined=0; + $nb_of_subproduct = $value['nb']; + + print ''; + print ''; + + // Best buying price + print ''; + 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 ''; - $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 ''; - print ''; + $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); + $total+=$totalline; - // Best buying price - print ''; + print ''; - // 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 ''; - - // Best selling price - $pricesell=$productstatic->price; - if (! empty($conf->global->PRODUIT_MULTIPRICES)) - { - $pricesell='Variable'; - } - else - { - $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); - $totalsell+=$totallinesell; - } - print ''; - - // Stock - if (! empty($conf->stock->enabled)) print ''; // Real stock - - // Qty + IncDec - if ($user->rights->produit->creer || $user->rights->service->creer) - { - print ''; - print ''; - } - else{ - print ''; - print ''; - } - - print ''."\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 ''; - - //$productstatic->ref=$value['label']; - $productstatic->ref=$value['ref']; - print ''; - print ''; - - // Best buying price - print ''; - print ''; - // Best selling price - print ''; - print ''; - - if (! empty($conf->stock->enabled)) print ''; // Real stock - print ''; - print ''; - - print ''."\n"; + $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); + $totalsell+=$totallinesell; } + print ''; + + // Stock + if (! empty($conf->stock->enabled)) print ''; // Real stock + + // Qty + IncDec + if ($user->rights->produit->creer || $user->rights->service->creer) + { + print ''; + print ''; + } + else{ + print ''; + print ''; + } + + print ''."\n"; } - - print ''; - print ''; - print ''; - - // Minimum buying price - print ''; - - print ''; - - // Minimum selling price - print ''; - - print ''; - - // Stock - if (! empty($conf->stock->enabled)) print ''; - - print ''; + + //$productstatic->ref=$value['label']; + $productstatic->ref=$value['ref']; + print ''; + print ''; + + // Best buying price + print ''; + print ''; + // Best selling price + print ''; + print ''; + + if (! empty($conf->stock->enabled)) print ''; // Real stock + print ''; + print ''; + + print ''."\n"; } - print ''; - print ''."\n"; } - else + + print ''; + print ''; + print ''; + + // Minimum buying price + print ''; + + print ''; + + // Minimum selling price + print ''; + + print ''; + + // Stock + if (! empty($conf->stock->enabled)) print ''; + + print ''; - print ''; - print ''; - } - - print '
'.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('Stock').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').'
'.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('Stock').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''; + if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0) { - $class=($class=='impair')?'pair':'impair'; - print '
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''; - 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 ''; + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); + print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); - print ''; - 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 ''.$value['stock'].''.$nb_of_subproduct.''.($value['incdec']==1?'x':'' ).'
'; - for ($i=0; $i < $value['level']; $i++) print '     '; // Add indentation - print $productstatic->getNomUrl(1, 'composition').''.$productstatic->label.'    '.$value['nb'].' 
'; + 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 ''.$value['stock'].''.$nb_of_subproduct.''.($value['incdec']==1?'x':'' ).'
'; - print $langs->trans("TotalBuyingPriceMinShort"); - print ''; - if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; - print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency)); - print ''; - print $langs->trans("TotalSellingPriceMinShort"); - print ''; - if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; - print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency)); - print ' '; - if ($user->rights->produit->creer || $user->rights->service->creer) + else { - print ''; + $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 '
'; + for ($i=0; $i < $value['level']; $i++) print '     '; // Add indentation + print $productstatic->getNomUrl(1, 'composition').''.$productstatic->label.'    '.$value['nb'].' 
'; + print $langs->trans("TotalBuyingPriceMinShort"); + print ''; + if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; + print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency)); + print ''; + print $langs->trans("TotalSellingPriceMinShort"); + print ''; + if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; + print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency)); + print ' '; + if ($user->rights->produit->creer || $user->rights->service->creer) { - $colspan=8; - if (! empty($conf->stock->enabled)) $colspan++; - - print '
'.$langs->trans("None").'
'; - - /*if($user->rights->produit->creer || $user->rights->service->creer) { print ''; - }*/ + } + print ''; + print ''."\n"; + } + else + { + $colspan=8; + if (! empty($conf->stock->enabled)) $colspan++; + + print ''; + print ''.$langs->trans("None").''; + print ''; + } + + print ''; + + /*if($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + }*/ + + print '
'; + print '
'; + - print ''; - //} // 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))