Fixed empty table when few modules are activated in product card view

This commit is contained in:
Marcos García 2013-06-02 00:37:33 +02:00
parent 67a6313487
commit c12da33dcd

View File

@ -1315,7 +1315,8 @@ print "\n</div><br>\n";
if ($object->id && ($action == '' || $action == 'view') && $object->status) if ($object->id && ($action == '' || $action == 'view') && $object->status)
{ {
print '<table width="100%" class="noborder">'; //Variable used to check if any text is going to be printed
$html = '';
//print '<div class="fichecenter"><div class="fichehalfleft">'; //print '<div class="fichecenter"><div class="fichehalfleft">';
// Propals // Propals
@ -1325,42 +1326,42 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
$langs->load("propal"); $langs->load("propal");
print '<tr class="liste_titre">'; $html .= '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("AddToOtherProposals").'</td>'; $html .= '<td class="liste_titre">'.$langs->trans("AddToOtherProposals").'</td>';
print '</tr><tr>'; $html .= '</tr><tr>';
print '<td valign="top">'; $html .= '<td valign="top">';
$var=true; $var=true;
$otherprop = $propal->liste_array(2,1,0); $otherprop = $propal->liste_array(2,1,0);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'; $html .= '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $html .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" width="100%">'; $html .= '<table class="nobordernopadding" width="100%">';
if (is_array($otherprop) && count($otherprop)) if (is_array($otherprop) && count($otherprop))
{ {
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td style="width: 200px;">'; $html .= '<tr '.$bc[$var].'><td style="width: 200px;">';
print '<input type="hidden" name="action" value="addinpropal">'; $html .= '<input type="hidden" name="action" value="addinpropal">';
print $langs->trans("Proposals").'</td><td colspan="2">'; $html .= $langs->trans("Proposals").'</td><td colspan="2">';
print $form->selectarray("propalid", $otherprop, 0, 1); $html .= $form->selectarray("propalid", $otherprop, 0, 1);
print '</td></tr>'; $html .= '</td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' '; $html .= '<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").'(%) '; $html .= '<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">'; $html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
print '</td><td align="right">'; $html .= '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">'; $html .= '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td></tr>'; $html .= '</td></tr>';
} }
else else
{ {
print "<tr ".$bc[!$var]."><td>"; $html .= "<tr ".$bc[!$var]."><td>";
print $langs->trans("NoOtherOpenedPropals"); $html .= $langs->trans("NoOtherOpenedPropals");
print '</td></tr>'; $html .= '</td></tr>';
} }
print '</table>'; $html .= '</table>';
print '</form>'; $html .= '</form>';
print '</td>'; $html .= '</td>';
print '</tr>'; $html .= '</tr>';
} }
// Commande // Commande
@ -1370,42 +1371,42 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
$langs->load("orders"); $langs->load("orders");
print '<tr class="liste_titre">'; $html .= '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>'; $html .= '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>';
print '</tr><tr>'; $html .= '</tr><tr>';
print '<td valign="top">'; $html .= '<td valign="top">';
$var=true; $var=true;
$othercom = $commande->liste_array(2, 1, null); $othercom = $commande->liste_array(2, 1, null);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'; $html .= '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $html .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" width="100%">'; $html .= '<table class="nobordernopadding" width="100%">';
if (is_array($othercom) && count($othercom)) if (is_array($othercom) && count($othercom))
{ {
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td style="width: 200px;">'; $html .= '<tr '.$bc[$var].'><td style="width: 200px;">';
print '<input type="hidden" name="action" value="addincommande">'; $html .= '<input type="hidden" name="action" value="addincommande">';
print $langs->trans("Orders").'</td><td colspan="2">'; $html .= $langs->trans("Orders").'</td><td colspan="2">';
print $form->selectarray("commandeid", $othercom, 0, 1); $html .= $form->selectarray("commandeid", $othercom, 0, 1);
print '</td></tr>'; $html .= '</td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' '; $html .= '<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").'(%) '; $html .= '<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">'; $html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
print '</td><td align="right">'; $html .= '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">'; $html .= '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td></tr>'; $html .= '</td></tr>';
} }
else else
{ {
print "<tr ".$bc[!$var]."><td>"; $html .= "<tr ".$bc[!$var]."><td>";
print $langs->trans("NoOtherOpenedOrders"); $html .= $langs->trans("NoOtherOpenedOrders");
print '</td></tr>'; $html .= '</td></tr>';
} }
print '</table>'; $html .= '</table>';
print '</form>'; $html .= '</form>';
print '</td>'; $html .= '</td>';
print '</tr>'; $html .= '</tr>';
} }
// Factures // Factures
@ -1415,47 +1416,52 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
$langs->load("bills"); $langs->load("bills");
print '<tr class="liste_titre">'; $html .= '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>'; $html .= '<td class="liste_titre">'.$langs->trans("AddToOtherOrders").'</td>';
print '</tr><tr>'; $html .= '</tr><tr>';
print '<td valign="top">'; $html .= '<td valign="top">';
$var=true; $var=true;
$otherinvoice = $invoice->liste_array(2, 1, null); $otherinvoice = $invoice->liste_array(2, 1, null);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'; $html .= '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $html .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" width="100%">'; $html .= '<table class="nobordernopadding" width="100%">';
if (is_array($otherinvoice) && count($otherinvoice)) if (is_array($otherinvoice) && count($otherinvoice))
{ {
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td style="width: 200px;">'; $html .= '<tr '.$bc[$var].'><td style="width: 200px;">';
print '<input type="hidden" name="action" value="addinfacture">'; $html .= '<input type="hidden" name="action" value="addinfacture">';
print $langs->trans("Invoice").'</td><td colspan="2">'; $html .= $langs->trans("Invoice").'</td><td colspan="2">';
print $form->selectarray("factureid", $otherinvoice, 0, 1); $html .= $form->selectarray("factureid", $otherinvoice, 0, 1);
print '</td></tr>'; $html .= '</td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' '; $html .= '<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").'(%) '; $html .= '<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">'; $html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
print '</td><td align="right">'; $html .= '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">'; $html .= '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td></tr>'; $html .= '</td></tr>';
} }
else else
{ {
print "<tr ".$bc[!$var]."><td>"; $html .= "<tr ".$bc[!$var]."><td>";
print $langs->trans("NoOtherDraftBills"); $html .= $langs->trans("NoOtherDraftBills");
print '</td></tr>'; $html .= '</td></tr>';
} }
print '</table>'; $html .= '</table>';
print '</form>'; $html .= '</form>';
print '</td>'; $html .= '</td>';
print '</tr>'; $html .= '</tr>';
} }
//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 '</table>';
print '<br>'; print '<br>';
}
} }