Skip to content

Commit

Permalink
Fight against useless colspan
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 28, 2017
1 parent c2c6962 commit 0f11a42
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 41 deletions.
15 changes: 6 additions & 9 deletions htdocs/product/stock/product.php
Expand Up @@ -924,8 +924,8 @@
print "</table>";
print '</div>';

if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE))
{
print '<br><br>';
print_titre($langs->trans('AddNewProductStockWarehouse'));
//print '<br />';
Expand All @@ -944,11 +944,11 @@
$pse = new ProductStockEntrepot($db);
$lines = $pse->fetchAll(GETPOST('id'));

if(!empty($lines)) {
if (!empty($lines))
{
$var=false;
foreach($lines as $line) {
foreach($lines as $line)
{
$ent = new Entrepot($db);
$ent->fetch($line['fk_entrepot']);
print '<tr '.$bc[$var].'><td width="40%" colspan="4">'.$ent->getNomUrl(3).'</td>';
Expand All @@ -957,15 +957,12 @@
print '<td align="right"><a href="?id='.GETPOST('id').'&fk_productstockwarehouse='.$line['id'].'&action=delete_productstockwarehouse">'.img_delete().'</a></td>';
print '</tr>';
$var=!$var;

}

}

print "</table>";

print '</form>';

}

llxFooter();
Expand Down
43 changes: 24 additions & 19 deletions htdocs/product/stock/tpl/stockcorrection.tpl.php
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $object must be defined
* $backtopage
*/
?>

Expand Down Expand Up @@ -54,30 +55,34 @@ function init_price()
print '<tr>';
if ($object->element == 'product')
{
print '<td width="20%" class="fieldrequired" colspan="2">'.$langs->trans("Warehouse").'</td>';
print '<td width="20%">';
print '<td width="20%" class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
print '<td width="30%">';
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100');
print ' &nbsp; <select name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
print '</select>';
print '</td>';
}
if ($object->element == 'stock')
{
print '<td width="20%" class="fieldrequired" colspan="2">'.$langs->trans("Product").'</td>';
print '<td width="20%">';
print '<td width="30%">';
print $form->select_produits(GETPOST('product_id'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 20, 0, -1);
print ' &nbsp; <select name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
print '</select>';
print '</td>';
}
print '<td width="20%">';
print '<select name="mouvement" id="mouvement" class="flat">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
print '</select></td>';
print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>';
print '<td width="30%"><input name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
print '</tr>';

// Purchase price
print '<tr>';
print '<td width="20%" colspan="2">'.$langs->trans("UnitPurchaseValue").'</td>';
print '<td colspan="'.(!empty($conf->projet->enabled) ? '2' : '4').'"><input class="flat" name="unitprice" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
print '<td width="25%">'.$langs->trans("UnitPurchaseValue").'</td>';
print '<td colspan="'.(!empty($conf->projet->enabled) ? '1' : '3').'"><input name="unitprice" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
if (! empty($conf->projet->enabled))
{
print '<td>'.$langs->trans('Project').'</td>';
Expand All @@ -94,15 +99,15 @@ function init_price()
)
{
print '<tr>';
print '<td colspan="2"'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="4">';
print '<td'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
print '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
print '</td>';
print '</tr><tr>';
print '<td colspan="2">'.$langs->trans("EatByDate").'</td><td>';
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("EatByDate").'</td><td>';
$eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
$form->select_date($eatbyselected,'eatby','','',1,"");
print '</td>';
print '<td></td>';
print '<td>'.$langs->trans("SellByDate").'</td><td>';
$sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
$form->select_date($sellbyselected,'sellby','','',1,"");
Expand All @@ -113,11 +118,11 @@ function init_price()
// Label of mouvement of id of inventory
$valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock",''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref));
print '<tr>';
print '<td width="20%" colspan="2">'.$langs->trans("MovementLabel").'</td>';
print '<td colspan="2">';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" size="60" value="'.$valformovementlabel.'">';
print '</td>';
print '<td width="20%">'.$langs->trans("InventoryCode").'</td><td width="20%"><input class="flat maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.GETPOST("inventorycode").'"></td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.GETPOST("inventorycode").'"></td>';
print '</tr>';

print '</table>';
Expand Down
27 changes: 14 additions & 13 deletions htdocs/product/stock/tpl/stocktransfer.tpl.php
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -61,23 +61,23 @@
print '<tr>';
if ($object->element == 'product')
{
print '<td width="15%" class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<td width="15%">';
print '<td width="20%" class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<td width="30%">';
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', 'warehouseopen,warehouseinternal', 1);
print '</td>';
}
if ($object->element == 'stock')
{
print '<td width="15%" class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td width="15%">';
print '<td width="20%" class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td width="30%">';
print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''));
print '</td>';
}

print '<td width="15%" class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td width="15%">';
print '<td width="20%" class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td width="30%">';
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
print '</td>';
print '<td width="15%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="15%"><input type="text" class="flat" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td colspan="3"><input type="text" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
print '</tr>';

// Serial / Eat-by date
Expand All @@ -87,7 +87,7 @@
)
{
print '<tr>';
print '<td'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="5">';
print '<td'.($object->element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
if ($pdluoid > 0)
{
// If form was opened for a specific pdluoid, field is disabled
Expand All @@ -99,25 +99,26 @@
print '<input type="text" name="batch_number" size="40" value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">';
}
print '</td>';
print '</tr><tr>';
print '</tr>';

print '<tr>';
print '<td>'.$langs->trans("EatByDate").'</td><td>';
print $form->select_date(($d_eatby?$d_eatby:$pdluo->eatby),'eatby','','',1,"", 1, 0, 1, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
print '</td>';
print '<td>'.$langs->trans("SellByDate").'</td><td>';
print $form->select_date(($d_sellby?$d_sellby:$pdluo->sellby),'sellby','','',1,"", 1, 0, 1, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
print '</td>';
print '<td colspan="2"></td>';
print '</tr>';
}

// Label
$valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $productref));
print '<tr>';
print '<td width="15%">'.$langs->trans("MovementLabel").'</td>';
print '<td colspan="3">';
print '<td>';
print '<input type="text" name="label" size="60" value="'.dol_escape_htmltag($valformovementlabel).'">';
print '</td>';
print '<td width="20%">'.$langs->trans("InventoryCode").'</td><td width="20%"><input class="flat maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(GETPOST("inventorycode")?GETPOST("inventorycode",'alpha'):dol_print_date(dol_now(),'%y%m%d%H%M%S')).'"></td>';
print '<td width="15%">'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(GETPOST("inventorycode")?GETPOST("inventorycode",'alpha'):dol_print_date(dol_now(),'%y%m%d%H%M%S')).'"></td>';
print '</tr>';

print '</table>';
Expand Down

0 comments on commit 0f11a42

Please sign in to comment.