diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 632540df203..0a8aed4634f 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -638,16 +638,16 @@ $formproduct = new FormProduct($db); if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { - // ----------------------------------------- - // When used with CANVAS - // ----------------------------------------- - if (empty($object->error) && $id) - { - $object = new Product($db); - $result=$object->fetch($id); - if ($result <= 0) dol_print_error('',$object->error); - } - $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates + // ----------------------------------------- + // When used with CANVAS + // ----------------------------------------- + if (empty($object->error) && $id) + { + $object = new Product($db); + $result=$object->fetch($id); + if ($result <= 0) dol_print_error('',$object->error); + } + $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template } else @@ -1315,8 +1315,9 @@ print "\n
\n"; if ($object->id && ($action == '' || $action == 'view') && $object->status) { - print ''; - //print '
'; + //Variable used to check if any text is going to be printed + $html = ''; + //print '
'; // Propals if (! empty($conf->propal->enabled) && $user->rights->propale->creer) @@ -1325,42 +1326,42 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) $langs->load("propal"); - print '
'; - print ''; - print ''; - print ''; + $html .= ''; + $html .= ''; + $html .= '
'.$langs->trans("AddToOtherProposals").'
'; + $html .= '
'.$langs->trans("AddToOtherProposals").'
'; $var=true; $otherprop = $propal->liste_array(2,1,0); - print '
'; - print ''; - print ''; + $html .= ''; + $html .= ''; + $html .= '
'; if (is_array($otherprop) && count($otherprop)) { $var=!$var; - print ''; - print ''; + $html .= ''; + $html .= ''; } else { - print "'; + $html .= "'; } - print '
'; - print ''; - print $langs->trans("Proposals").''; - print $form->selectarray("propalid", $otherprop, 0, 1); - print '
'.$langs->trans("Quantity").' '; - print ''.$langs->trans("ReductionShort").'(%) '; - print ''; - print ''; - print ''; - print '
'; + $html .= ''; + $html .= $langs->trans("Proposals").''; + $html .= $form->selectarray("propalid", $otherprop, 0, 1); + $html .= '
'.$langs->trans("Quantity").' '; + $html .= ''.$langs->trans("ReductionShort").'(%) '; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= '
"; - print $langs->trans("NoOtherOpenedPropals"); - print '
"; + $html .= $langs->trans("NoOtherOpenedPropals"); + $html .= '
'; - print '
'; + $html .= '
'; + $html .= ''; - print ''; - print ''; + $html .= ''; + $html .= ''; } // Commande @@ -1370,42 +1371,42 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) $langs->load("orders"); - print ''; - print ''.$langs->trans("AddToOtherOrders").''; - print ''; - print ''; + $html .= ''; + $html .= ''.$langs->trans("AddToOtherOrders").''; + $html .= ''; + $html .= ''; $var=true; $othercom = $commande->liste_array(2, 1, null); - print '
'; - print ''; - print ''; + $html .= ''; + $html .= ''; + $html .= '
'; if (is_array($othercom) && count($othercom)) { $var=!$var; - print ''; - print ''; + $html .= ''; + $html .= ''; } else { - print "'; + $html .= "'; } - print '
'; - print ''; - print $langs->trans("Orders").''; - print $form->selectarray("commandeid", $othercom, 0, 1); - print '
'.$langs->trans("Quantity").' '; - print ''.$langs->trans("ReductionShort").'(%) '; - print ''; - print ''; - print ''; - print '
'; + $html .= ''; + $html .= $langs->trans("Orders").''; + $html .= $form->selectarray("commandeid", $othercom, 0, 1); + $html .= '
'.$langs->trans("Quantity").' '; + $html .= ''.$langs->trans("ReductionShort").'(%) '; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= '
"; - print $langs->trans("NoOtherOpenedOrders"); - print '
"; + $html .= $langs->trans("NoOtherOpenedOrders"); + $html .= '
'; - print '
'; + $html .= ''; + $html .= ''; - print ''; - print ''; + $html .= ''; + $html .= ''; } // Factures @@ -1415,47 +1416,52 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status) $langs->load("bills"); - print ''; - print ''.$langs->trans("AddToOtherOrders").''; - print ''; - print ''; - - $var=true; - $otherinvoice = $invoice->liste_array(2, 1, null); - print '
'; - print ''; - print ''; - if (is_array($otherinvoice) && count($otherinvoice)) - { - $var=!$var; - print ''; - print ''; - } - else - { - print "'; - } - print '
'; - print ''; - print $langs->trans("Invoice").''; - print $form->selectarray("factureid", $otherinvoice, 0, 1); - print '
'.$langs->trans("Quantity").' '; - print ''.$langs->trans("ReductionShort").'(%) '; - print ''; - print ''; - print ''; - print '
"; - print $langs->trans("NoOtherDraftBills"); - print '
'; - print '
'; - - print ''; - print ''; + $html .= ''; + $html .= ''.$langs->trans("AddToOtherOrders").''; + $html .= ''; + $html .= ''; + + $var=true; + $otherinvoice = $invoice->liste_array(2, 1, null); + $html .= '
'; + $html .= ''; + $html .= ''; + if (is_array($otherinvoice) && count($otherinvoice)) + { + $var=!$var; + $html .= ''; + $html .= ''; + } + else + { + $html .= "'; + } + $html .= '
'; + $html .= ''; + $html .= $langs->trans("Invoice").''; + $html .= $form->selectarray("factureid", $otherinvoice, 0, 1); + $html .= '
'.$langs->trans("Quantity").' '; + $html .= ''.$langs->trans("ReductionShort").'(%) '; + $html .= ''; + $html .= ''; + $html .= ''; + $html .= '
"; + $html .= $langs->trans("NoOtherDraftBills"); + $html .= '
'; + $html .= '
'; + + $html .= ''; + $html .= ''; } - print ''; - - print '
'; + //If any text is going to be printed, then we show the table + if (!empty($html)) + { + print ''; + print $html; + print '
'; + print '
'; + } }