Fixed empty table when few modules are activated in product card view
This commit is contained in:
parent
67a6313487
commit
c12da33dcd
@ -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</div><br>\n";
|
||||
|
||||
if ($object->id && ($action == '' || $action == 'view') && $object->status)
|
||||
{
|
||||
print '<table width="100%" class="noborder">';
|
||||
//print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
//Variable used to check if any text is going to be printed
|
||||
$html = '';
|
||||
//print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
// 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 '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("AddToOtherProposals").'</td>';
|
||||
print '</tr><tr>';
|
||||
print '<td valign="top">';
|
||||
$html .= '<tr class="liste_titre">';
|
||||
$html .= '<td class="liste_titre">'.$langs->trans("AddToOtherProposals").'</td>';
|
||||
$html .= '</tr><tr>';
|
||||
$html .= '<td valign="top">';
|
||||
|
||||
$var=true;
|
||||
$otherprop = $propal->liste_array(2,1,0);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
$html .= '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
$html .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$html .= '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($otherprop) && count($otherprop))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td style="width: 200px;">';
|
||||
print '<input type="hidden" name="action" value="addinpropal">';
|
||||
print $langs->trans("Proposals").'</td><td colspan="2">';
|
||||
print $form->selectarray("propalid", $otherprop, 0, 1);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
$html .= '<tr '.$bc[$var].'><td style="width: 200px;">';
|
||||
$html .= '<input type="hidden" name="action" value="addinpropal">';
|
||||
$html .= $langs->trans("Proposals").'</td><td colspan="2">';
|
||||
$html .= $form->selectarray("propalid", $otherprop, 0, 1);
|
||||
$html .= '</td></tr>';
|
||||
$html .= '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
$html .= '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
|
||||
$html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
|
||||
$html .= '</td><td align="right">';
|
||||
$html .= '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
$html .= '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOtherOpenedPropals");
|
||||
print '</td></tr>';
|
||||
$html .= "<tr ".$bc[!$var]."><td>";
|
||||
$html .= $langs->trans("NoOtherOpenedPropals");
|
||||
$html .= '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
$html .= '</table>';
|
||||
$html .= '</form>';
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
// Commande
|
||||
@ -1370,42 +1371,42 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
|
||||
|
||||
$langs->load("orders");
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>';
|
||||
print '</tr><tr>';
|
||||
print '<td valign="top">';
|
||||
$html .= '<tr class="liste_titre">';
|
||||
$html .= '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>';
|
||||
$html .= '</tr><tr>';
|
||||
$html .= '<td valign="top">';
|
||||
|
||||
$var=true;
|
||||
$othercom = $commande->liste_array(2, 1, null);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
$html .= '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
$html .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$html .= '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($othercom) && count($othercom))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td style="width: 200px;">';
|
||||
print '<input type="hidden" name="action" value="addincommande">';
|
||||
print $langs->trans("Orders").'</td><td colspan="2">';
|
||||
print $form->selectarray("commandeid", $othercom, 0, 1);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
$html .= '<tr '.$bc[$var].'><td style="width: 200px;">';
|
||||
$html .= '<input type="hidden" name="action" value="addincommande">';
|
||||
$html .= $langs->trans("Orders").'</td><td colspan="2">';
|
||||
$html .= $form->selectarray("commandeid", $othercom, 0, 1);
|
||||
$html .= '</td></tr>';
|
||||
$html .= '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
$html .= '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
|
||||
$html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
|
||||
$html .= '</td><td align="right">';
|
||||
$html .= '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
$html .= '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOtherOpenedOrders");
|
||||
print '</td></tr>';
|
||||
$html .= "<tr ".$bc[!$var]."><td>";
|
||||
$html .= $langs->trans("NoOtherOpenedOrders");
|
||||
$html .= '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
$html .= '</table>';
|
||||
$html .= '</form>';
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
// Factures
|
||||
@ -1415,47 +1416,52 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>';
|
||||
print '</tr><tr>';
|
||||
print '<td valign="top">';
|
||||
|
||||
$var=true;
|
||||
$otherinvoice = $invoice->liste_array(2, 1, null);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($otherinvoice) && count($otherinvoice))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td style="width: 200px;">';
|
||||
print '<input type="hidden" name="action" value="addinfacture">';
|
||||
print $langs->trans("Invoice").'</td><td colspan="2">';
|
||||
print $form->selectarray("factureid", $otherinvoice, 0, 1);
|
||||
print '</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr ".$bc[!$var]."><td>";
|
||||
print $langs->trans("NoOtherDraftBills");
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$html .= '<tr class="liste_titre">';
|
||||
$html .= '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>';
|
||||
$html .= '</tr><tr>';
|
||||
$html .= '<td valign="top">';
|
||||
|
||||
$var=true;
|
||||
$otherinvoice = $invoice->liste_array(2, 1, null);
|
||||
$html .= '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
$html .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$html .= '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($otherinvoice) && count($otherinvoice))
|
||||
{
|
||||
$var=!$var;
|
||||
$html .= '<tr '.$bc[$var].'><td style="width: 200px;">';
|
||||
$html .= '<input type="hidden" name="action" value="addinfacture">';
|
||||
$html .= $langs->trans("Invoice").'</td><td colspan="2">';
|
||||
$html .= $form->selectarray("factureid", $otherinvoice, 0, 1);
|
||||
$html .= '</td></tr>';
|
||||
$html .= '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
|
||||
$html .= '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
|
||||
$html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
|
||||
$html .= '</td><td align="right">';
|
||||
$html .= '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
$html .= '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html .= "<tr ".$bc[!$var]."><td>";
|
||||
$html .= $langs->trans("NoOtherDraftBills");
|
||||
$html .= '</td></tr>';
|
||||
}
|
||||
$html .= '</table>';
|
||||
$html .= '</form>';
|
||||
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
//If any text is going to be printed, then we show the table
|
||||
if (!empty($html))
|
||||
{
|
||||
print '<table width="100%" class="noborder">';
|
||||
print $html;
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user