Responsive enhancements

This commit is contained in:
Laurent Destailleur 2016-10-29 17:02:48 +02:00
parent 32b6660f63
commit cc43732c56
4 changed files with 67 additions and 61 deletions

View File

@ -1618,9 +1618,11 @@ class Form
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @param int $hidepriceinlabel 1=Hide prices in label
* @return void
*/
function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0)
function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel)
{
global $langs,$conf;
@ -1660,28 +1662,30 @@ class Form
}
else
{
print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid,$showempty,$forcecombo);
print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid,$showempty,$forcecombo,$morecss,$hidepriceinlabel);
}
}
/**
* Return list of products for a customer
*
* @param int $selected Preselected product
* @param string $htmlname Name of select html
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
* @param string $filterkey Filter on product
* @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $finished Filter on finished field: 2=No filter
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @return array Array of keys for json
* @param int $selected Preselected product
* @param string $htmlname Name of select html
* @param string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
* @param string $filterkey Filter on product
* @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $finished Filter on finished field: 2=No filter
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @param int $hidepriceinlabel 1=Hide prices in label
* @return array Array of keys for json
*/
function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0)
function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0)
{
global $langs,$conf,$user,$db;
@ -1782,7 +1786,7 @@ class Form
$nodatarole=($comboenhancement?' data-role="none"':'');
}
$out.='<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'"'.$nodatarole.'>';
$out.='<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'"'.$nodatarole.'>';
$textifempty='';
// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@ -1824,7 +1828,7 @@ class Form
$objp->remise = $objp2->remise;
$objp->price_by_qty_rowid = $objp2->rowid;
$this->constructProductListOption($objp, $opt, $optJson, 0, $selected);
$this->constructProductListOption($objp, $opt, $optJson, 0, $selected, $hidepriceinlabel);
$j++;
@ -1851,7 +1855,7 @@ class Form
$objp->price_ttc = price2num($objp->price_ttc,'MU');
}
}
$this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected);
$this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected, $hidepriceinlabel);
// Add new entry
// "key" value of json key array is used by jQuery automatically as selected value
// "label" value of json key array is used by jQuery automatically as text for combo box
@ -1931,13 +1935,13 @@ class Form
$opt.= '>';
$opt.= $objp->ref;
if ($outbarcode) $opt.=' ('.$outbarcode.')';
$opt.=' - '.dol_trunc($label,$maxlengtharticle).' - ';
$opt.=' - '.dol_trunc($label,$maxlengtharticle);
$objRef = $objp->ref;
if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$objRef,1);
$outval.=$objRef;
if ($outbarcode) $outval.=' ('.$outbarcode.')';
$outval.=' - '.dol_trunc($label,$maxlengtharticle).' - ';
$outval.=' - '.dol_trunc($label,$maxlengtharticle);
$found=0;
@ -1962,13 +1966,13 @@ class Form
$found=1;
if ($objp2->price_base_type == 'HT')
{
$opt.= price($objp2->price,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("HT");
$outval.= price($objp2->price,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("HT");
$opt.= ' - '.price($objp2->price,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("HT");
$outval.= ' - '.price($objp2->price,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("HT");
}
else
{
$opt.= price($objp2->price_ttc,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("TTC");
$outval.= price($objp2->price_ttc,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("TTC");
$opt.= ' - '.price($objp2->price_ttc,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("TTC");
$outval.= ' - '.price($objp2->price_ttc,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("TTC");
}
$outprice_ht=price($objp2->price);
$outprice_ttc=price($objp2->price_ttc);
@ -1990,15 +1994,15 @@ class Form
$outdiscount=$objp->remise_percent;
if ($objp->quantity == 1)
{
$opt.= price($objp->unitprice,1,$langs,0,0,-1,$conf->currency)."/";
$outval.= price($objp->unitprice,0,$langs,0,0,-1,$conf->currency)."/";
$opt.= ' - '.price($objp->unitprice,1,$langs,0,0,-1,$conf->currency)."/";
$outval.= ' - '.price($objp->unitprice,0,$langs,0,0,-1,$conf->currency)."/";
$opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
$outval.=$langs->transnoentities("Unit");
}
else
{
$opt.= price($objp->price,1,$langs,0,0,-1,$conf->currency)."/".$objp->quantity;
$outval.= price($objp->price,0,$langs,0,0,-1,$conf->currency)."/".$objp->quantity;
$opt.= ' - '.price($objp->price,1,$langs,0,0,-1,$conf->currency)."/".$objp->quantity;
$outval.= ' - '.price($objp->price,0,$langs,0,0,-1,$conf->currency)."/".$objp->quantity;
$opt.= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
$outval.=$langs->transnoentities("Units");
}
@ -2028,13 +2032,13 @@ class Form
if ($objp->custprice_base_type == 'HT')
{
$opt.= price($objp->custprice,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("HT");
$outval.= price($objp->custprice,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("HT");
$opt.= ' - '.price($objp->custprice,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("HT");
$outval.= ' - '.price($objp->custprice,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("HT");
}
else
{
$opt.= price($objp->custprice_ttc,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("TTC");
$outval.= price($objp->custprice_ttc,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("TTC");
$opt.= ' - '.price($objp->custprice_ttc,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("TTC");
$outval.= ' - '.price($objp->custprice_ttc,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("TTC");
}
$outprice_ht=price($objp->custprice);
@ -2049,13 +2053,13 @@ class Form
{
if ($objp->price_base_type == 'HT')
{
$opt.= price($objp->price,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("HT");
$outval.= price($objp->price,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("HT");
$opt.= ' - '.price($objp->price,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("HT");
$outval.= ' - '.price($objp->price,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("HT");
}
else
{
$opt.= price($objp->price_ttc,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("TTC");
$outval.= price($objp->price_ttc,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("TTC");
$opt.= ' - '.price($objp->price_ttc,1,$langs,0,0,-1,$conf->currency).' '.$langs->trans("TTC");
$outval.= ' - '.price($objp->price_ttc,0,$langs,0,0,-1,$conf->currency).' '.$langs->transnoentities("TTC");
}
$outprice_ht=price($objp->price);
$outprice_ttc=price($objp->price_ttc);

View File

@ -173,14 +173,15 @@ class FormProduct
* @param int $disabled 1=Select is disabled
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
* @param string $empty_label Empty label if needed (only if $empty=1)
* @param int $showstock 1=show stock count
* @param int $forcecombo force combo iso ajax select2
* @param array $events events to add to select2
* @param string $morecss Add more css classes
* @param array $exclude warehouses ids to exclude
* @param int $showstock 1=Show stock count
* @param int $forcecombo 1=Force combo iso ajax select2
* @param array $events Events to add to select2
* @param string $morecss Add more css classes to HTML select
* @param array $exclude Warehouses ids to exclude
* @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse
* @return string HTML select
*/
function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='minwidth200', $exclude='')
function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='minwidth200', $exclude='', $showfullpath=1)
{
global $conf,$langs,$user;
@ -206,7 +207,8 @@ class FormProduct
$out.='<option value="'.$id.'"';
if ($selected == $id || ($selected == 'ifone' && $nbofwarehouses == 1)) $out.=' selected';
$out.='>';
$out.=$arraytypes['full_label'];
if ($showfullpath) $out.=$arraytypes['full_label'];
else $out.=$arraytypes['label'];
if (($fk_product || ($showstock > 0)) && ($arraytypes['stock'] != 0 || ($showstock > 0))) $out.=' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')';
$out.='</option>';
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2013-2015 Laurent Destaileur <ely@users.sourceforge.net>
/* Copyright (C) 2013-2016 Laurent Destaileur <ely@users.sourceforge.net>
* Copyright (C) 2014 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software: you can redistribute it and/or modify
@ -347,21 +347,21 @@ print '<table class="liste" width="100%">';
$param='';
print '<tr class="liste_titre">';
print getTitleFieldOfList($langs->trans('ProductRef'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans('ProductRef'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd maxwidthonsmartphone"',$sortfield,$sortorder);
if ($conf->productbatch->enabled)
{
print getTitleFieldOfList($langs->trans('Batch'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans('Batch'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd maxwidthonsmartphone"',$sortfield,$sortorder);
}
print getTitleFieldOfList($langs->trans('WarehouseSource'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans('WarehouseTarget'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans('Qty'),0,$_SERVER["PHP_SELF"],'',$param,'','align="center" class="tagtd"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans('WarehouseSource'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd maxwidthonsmartphone"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans('WarehouseTarget'),0,$_SERVER["PHP_SELF"],'',$param,'','class="tagtd maxwidthonsmartphone"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans('Qty'),0,$_SERVER["PHP_SELF"],'',$param,'','align="center" class="tagtd maxwidthonsmartphone"',$sortfield,$sortorder);
print getTitleFieldOfList('',0);
print '</tr>';
print '<tr '.$bc[$var].'>';
// Product
print '<td>';
print '<td class="titlefield">';
$filtertype=0;
if (! empty($conf->global->STOCK_SUPPORTS_SERVICES)) $filtertype='';
if ($conf->global->PRODUIT_LIMIT_SIZE <= 0)
@ -372,22 +372,22 @@ else
{
$limit = $conf->global->PRODUIT_LIMIT_SIZE;
}
print $form->select_produits($id_product,'productid',$filtertype,$limit);
print $form->select_produits($id_product, 'productid', $filtertype, $limit, 0, 1, 2, '', 0, array(), 0, '1', 0, 'minwidth300imp maxwidth400', 1);
print '</td>';
// Batch number
if ($conf->productbatch->enabled)
{
print '<td>';
print '<input type="text" name="batch" size="10" value="'.$batch.'">';
print '<input type="text" name="batch" size="6" value="'.$batch.'">';
print '</td>';
}
// In warehouse
print '<td>';
print $formproduct->selectWarehouses($id_sw,'id_sw','',1);
print $formproduct->selectWarehouses($id_sw, 'id_sw', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp');
print '</td>';
// Out warehouse
print '<td>';
print $formproduct->selectWarehouses($id_tw,'id_tw','',1);
print $formproduct->selectWarehouses($id_tw, 'id_tw', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp');
print '</td>';
// Qty
print '<td align="center"><input type="text" size="3" class="flat" name="qty" value="'.$qty.'"></td>';
@ -445,15 +445,15 @@ $labelmovement=GETPOST("label")?GETPOST('label'):$langs->trans("StockTransfer").
print '<table class="border" width="100%">';
print '<tr>';
print '<td width="20%">'.$langs->trans("InventoryCode").'</td>';
print '<td colspan="5">';
print '<td class="titlefield">'.$langs->trans("InventoryCode").'</td>';
print '<td>';
print '<input type="text" name="codemove" size="10" value="'.dol_escape_htmltag($codemove).'">';
print '</td>';
print '</tr>';
print '<tr>';
print '<td width="20%">'.$langs->trans("LabelMovement").'</td>';
print '<td colspan="5">';
print '<input type="text" name="label" size="80" value="'.dol_escape_htmltag($labelmovement).'">';
print '<td>'.$langs->trans("LabelMovement").'</td>';
print '<td>';
print '<input type="text" name="label" class="quatrevingtpercent" value="'.dol_escape_htmltag($labelmovement).'">';
print '</td>';
print '</tr>';
print '</table><br>';

View File

@ -4629,7 +4629,7 @@ img.demothumb {
select {
width: 100%;
max-width: 100px;
min-width: 0 !important;
min-width: 50px;
}
div.divphotoref {
padding-right: 5px;