Fix select2 component go over parent container so we introduce option to

deal this.
This commit is contained in:
Laurent Destailleur 2016-01-08 23:17:45 +01:00
parent 127354f0af
commit a0d11e157b
12 changed files with 22 additions and 17 deletions

View File

@ -175,7 +175,7 @@ if ($action == 'edit')
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
$var=!$var;
$var=false;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' .$form->selectyesno('MAIN_DISABLE_METEO',(isset($conf->global->MAIN_DISABLE_METEO)?1:0),1) . '</td></tr>';
@ -222,7 +222,7 @@ else
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>';
$var=!$var;
$var=false;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>';

View File

@ -240,7 +240,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// Company
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
$filter='s.client in (1,2,3)';
print $form->select_company($socid,'socid',$filter,1);
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
print '</td></tr>';
// User
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';

View File

@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php';
if (!$user->rights->commande->lire) accessforbidden();
$langs->load("orders");
$langs->load("bills");
// Security check
$socid=GETPOST('socid','int');

View File

@ -256,7 +256,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
if ($mode == 'customer') $filter='s.client in (1,2,3)';
if ($mode == 'supplier') $filter='s.fournisseur = 1';
print $form->select_company($socid,'socid',$filter,1);
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
print '</td></tr>';
// User
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';

View File

@ -237,7 +237,7 @@ print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->tra
// Company
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
$filter='';
print $form->select_company($socid,'socid',$filter,1,1);
print $form->select_company($socid,'socid',$filter,1,1,0,array(),0,'','style="width: 95%"');
print '</td></tr>';
// User
print '<tr><td>'.$langs->trans("User").'</td><td>';

View File

@ -240,7 +240,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($mode == 'customer') $filter='s.client in (1,2,3)';
if ($mode == 'supplier') $filter='s.fournisseur = 1';
print $form->selectarray('socid', $companies, $socid, 1, 0, 0, 'style="width: 100%"');
print $form->selectarray('socid', $companies, $socid, 1, 0, 0, 'style="width: 95%"', 0, 0, 0, '', '', 1);
print '</td></tr>';
// User
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';

View File

@ -336,9 +336,11 @@ if ($id)
print '<table class="border" width="100%">';
print "<tr>";
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/salaries/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
print "<tr>";
print '<td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $object->ref;
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '</td></tr>';
// Employee

View File

@ -898,9 +898,10 @@ class Form
* @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
* @param int $limit Maximum number of elements
* @param string $morecss Add more css styles to the SELECT component
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @return string HTML string with select box for thirdparty.
*/
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100')
function select_company($selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='')
{
$out='';
@ -934,7 +935,7 @@ class Form
}
else
{*/
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss);
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam);
//}
return $out;
@ -954,9 +955,10 @@ class Form
* @param int $outputmode 0=HTML select string, 1=Array
* @param int $limit Limit number of answers
* @param string $morecss Add more css styles to the SELECT component
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @return string HTML string with
*/
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100')
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='')
{
global $conf,$user,$langs;
@ -1010,7 +1012,7 @@ class Form
}
// Construct $out and $outarray
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'"'.$nodatarole.'>'."\n";
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparam?' '.$moreparam:'').' name="'.$htmlname.'"'.$nodatarole.'>'."\n";
$textifempty='';
// Do not use textempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@ -4510,7 +4512,7 @@ class Form
* @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or '&nbsp;'), <0 to add an empty value with key that is this value.
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
* @param int $value_as_key 1 to use value as key
* @param string $moreparam Add more parameters onto the select tag
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @param int $translate Translate and encode value
* @param int $maxlen Length maximum for labels
* @param int $disabled Html select box is disabled

View File

@ -241,7 +241,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
if ($mode == 'customer') $filter='s.client in (1,2,3)';
if ($mode == 'supplier') $filter='s.fournisseur = 1';
print $form->select_company($socid,'socid',$filter,1);
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
print '</td></tr>';
// User
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';

View File

@ -240,7 +240,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
if ($mode == 'customer') $filter='s.client in (1,2,3)';
if ($mode == 'supplier') $filter='s.fournisseur = 1';
print $form->select_company($socid,'socid',$filter,1);
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
print '</td></tr>';
// User
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';

View File

@ -218,7 +218,7 @@ print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->tra
/*
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
$filter='';
print $form->select_company($socid,'socid',$filter,1,1);
print $form->select_company($socid,'socid',$filter,1,1,0,array(),0,'','style="width: 95%"');
print '</td></tr>';
*/
// User

View File

@ -283,7 +283,7 @@ print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->tra
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
if ($mode == 'customer') $filter='s.client in (1,2,3)';
if ($mode == 'supplier') $filter='s.fournisseur = 1';
print $form->select_company($socid,'socid',$filter,1);
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
print '</td></tr>';
// User
/*print '<tr><td>'.$langs->trans("ProjectCommercial").'</td><td>';