Fix: Use div for tables when there is a different form on each line.

This commit is contained in:
Laurent Destailleur 2013-06-23 18:33:03 +02:00
parent e1bb3bafb7
commit b49a1168e3
3 changed files with 92 additions and 90 deletions

View File

@ -64,8 +64,8 @@ $page=GETPOST('page','int');
$negpage=GETPOST('negpage','int'); $negpage=GETPOST('negpage','int');
if ($negpage) if ($negpage)
{ {
$page=$_GET["nbpage"] - $negpage; $page=GETPOST("nbpage") - $negpage;
if ($page > $_GET["nbpage"]) $page = $_GET["nbpage"]; if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage");
} }
$mesg=''; $mesg='';
@ -269,6 +269,7 @@ if ($id > 0 || ! empty($ref))
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
@ -292,28 +293,32 @@ if ($id > 0 || ! empty($ref))
/** /**
* Search form * Search form
*/ */
$param.='&amp;account='.$object->id; $param.='&amp;account='.$object->id.'&amp;vline='.$vline;
// Define transaction list navigation string // Define transaction list navigation string
$navig = '<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="GET"><div data-role="fieldcontain">'; print '<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="POST">';
//print 'nbpage='.$totalPages.' viewline='.$viewline.' limitsql='.$limitsql; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="vline" value="'.$vline.'">';
print '<input type="hidden" name="paiementtype" value="'.$paiementtype.'">';
print '<input type="hidden" name="req_nb" value="'.$req_nb.'">';
print '<input type="hidden" name="req_desc" value="'.$req_desc.'">';
print '<input type="hidden" name="req_debit" value="'.$req_debit.'">';
print '<input type="hidden" name="req_credit" value="'.$req_credit.'">';
print '<input type="hidden" name="thirdparty" value="'.$thirdparty.'">';
print '<input type="hidden" name="nbpage" value="'.$totalPages.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
$navig ='<div data-role="fieldcontain">';
if ($limitsql > $viewline) $navig.='<a href="account.php?'.$param.'&amp;page='.($page+1).'">'.img_previous().'</a>'; if ($limitsql > $viewline) $navig.='<a href="account.php?'.$param.'&amp;page='.($page+1).'">'.img_previous().'</a>';
$navig.= '<label for="negpage">'.$langs->trans("Page")."</label> "; // ' Page '; $navig.= '<label for="negpage">'.$langs->trans("Page")."</label> "; // ' Page ';
$navig.='<input type="text" name="negpage" id="negpage" size="1" class="flat" value="'.($totalPages-$page).'">'; $navig.='<input type="text" name="negpage" id="negpage" size="1" class="flat" value="'.($totalPages-$page).'">';
$navig.='<input type="hidden" name="paiementtype" value="'.$paiementtype.'">';
$navig.='<input type="hidden" name="req_nb" value="'.$req_nb.'">';
$navig.='<input type="hidden" name="req_desc" value="'.$req_desc.'">';
$navig.='<input type="hidden" name="req_debit" value="'.$req_debit.'">';
$navig.='<input type="hidden" name="req_credit" value="'.$req_credit.'">';
$navig.='<input type="hidden" name="thirdparty" value="'.$thirdparty.'">';
$navig.='<input type="hidden" name="nbpage" value="'.$totalPages.'">';
$navig.='<input type="hidden" name="id" value="'.$object->id.'">';
$navig.='/'.$totalPages.' '; $navig.='/'.$totalPages.' ';
if ($total_lines > $limitsql ) if ($total_lines > $limitsql )
{ {
$navig.= '<a href="'.$_SERVER["PHP_SELF"].'?'.$param.'&amp;page='.($page-1).'">'.img_next().'</a>'; $navig.= '<a href="'.$_SERVER["PHP_SELF"].'?'.$param.'&amp;page='.($page-1).'">'.img_next().'</a>';
} }
$navig.='</fieldset></div></form>'; $navig.='</fieldset></div>';
//var_dump($navig); //var_dump($navig);
// Confirmation delete // Confirmation delete
@ -335,12 +340,6 @@ if ($id > 0 || ! empty($ref))
// Form to add a transaction with no invoice // Form to add a transaction with no invoice
if ($user->rights->banque->modifier && $action == 'addline') if ($user->rights->banque->modifier && $action == 'addline')
{ {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="vline" value="'.$vline.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<tr>'; print '<tr>';
print '<td align="left" colspan="10"><b>'.$langs->trans("AddBankRecordLong").'</b></td>'; print '<td align="left" colspan="10"><b>'.$langs->trans("AddBankRecordLong").'</b></td>';
print '</tr>'; print '</tr>';
@ -423,7 +422,7 @@ if ($id > 0 || ! empty($ref))
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center" width="40"><input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>'; print '<td align="center" width="40"><input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print "</tr>\n"; print "</tr>\n";
print "</form>\n";
/* /*
* Another solution * Another solution
@ -763,7 +762,10 @@ if ($id > 0 || ! empty($ref))
print "</table>"; print "</table>";
print "\n</div>\n"; print "</form>\n";
dol_fiche_end();
/* /*
* Boutons actions * Boutons actions
@ -777,7 +779,7 @@ if ($id > 0 || ! empty($ref))
{ {
if ($user->rights->banque->consolidate) if ($user->rights->banque->consolidate)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.'">'.$langs->trans("Conciliate").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
} }
else else
{ {
@ -789,7 +791,7 @@ if ($id > 0 || ! empty($ref))
{ {
if ($user->rights->banque->modifier) if ($user->rights->banque->modifier)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&amp;id='.$object->id.'&amp;page='.$page.'">'.$langs->trans("AddBankRecord").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&amp;id='.$object->id.'&amp;page='.$page.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>';
} }
else else
{ {

View File

@ -1076,11 +1076,12 @@ class Form
* @param array $exclude Array list of users id to exclude * @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled * @param int $disabled If select list must be disabled
* @param array $include Array list of users id to include * @param array $include Array list of users id to include
* @param int $enableonly Array list of users id to be enabled. All other must be disabled * @param array $enableonly Array list of users id to be enabled. All other must be disabled
* @param int $force_entity 0 or Id of environment to force * @param int $force_entity 0 or Id of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit)
* @return string HTML select string * @return string HTML select string
*/ */
function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0) function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0)
{ {
global $conf,$user,$langs; global $conf,$user,$langs;
@ -1161,7 +1162,8 @@ class Form
if ($disableline) $out.= ' disabled="disabled"'; if ($disableline) $out.= ' disabled="disabled"';
$out.= '>'; $out.= '>';
} }
$out.= $userstatic->getFullName($langs);
$out.= $userstatic->getFullName($langs, 0, 0, $maxlength);
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
{ {

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -13,7 +14,6 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
if (! class_exists('Contact')) { if (! class_exists('Contact')) {
@ -40,83 +40,81 @@ $userstatic=new User($db);
?> ?>
<!-- BEGIN PHP TEMPLATE CONTACTS --> <!-- BEGIN PHP TEMPLATE CONTACTS -->
<table class="noborder allwidth"> <div class="tagtable centpercent noborder allwidth">
<?php if ($permission) { ?> <?php if ($permission) { ?>
<tr class="liste_titre"> <form class="liste_titre">
<td><?php echo $langs->trans("Source"); ?></td> <div><?php echo $langs->trans("Source"); ?></div>
<td><?php echo $langs->trans("Company"); ?></td> <div><?php echo $langs->trans("Company"); ?></div>
<td><?php echo $langs->trans("Contacts"); ?></td> <div><?php echo $langs->trans("Contacts"); ?></div>
<td><?php echo $langs->trans("ContactType"); ?></td> <div><?php echo $langs->trans("ContactType"); ?></div>
<td colspan="3">&nbsp;</td> <div>&nbsp;</div>
</tr> <div>&nbsp;</div>
</form>
<?php $var=false; ?> <?php $var=false; ?>
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
<form <?php echo $bc[$var]; ?> action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="id" value="<?php echo $object->id; ?>" /> <input type="hidden" name="id" value="<?php echo $object->id; ?>" />
<input type="hidden" name="action" value="addcontact" /> <input type="hidden" name="action" value="addcontact" />
<input type="hidden" name="source" value="internal" /> <input type="hidden" name="source" value="internal" />
<div class="nowrap"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></div>
<tr <?php echo $bc[$var]; ?>> <div><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></div>
<td class="nowrap"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></td> <div><?php echo $form->select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56); ?></div>
<td><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></td> <div><?php echo $formcompany->selectTypeContact($object, '', 'type','internal'); ?></div>
<td><?php echo $form->select_users($user->id,'userid',0,(! empty($userAlreadySelected)?$userAlreadySelected:'')); ?></td> <div>&nbsp;</div>
<td><?php echo $formcompany->selectTypeContact($object, '', 'type','internal'); ?></td> <div align="right"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></div>
<td align="right" colspan="3" ><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></td>
</tr>
</form> </form>
<form action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
<input type="hidden" name="action" value="addcontact" />
<input type="hidden" name="source" value="internal" />
<?php $var=!$var; ?> <?php $var=!$var; ?>
<tr <?php echo $bc[$var]; ?>> <form <?php echo $bc[$var]; ?> action="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id; ?>" method="POST">
<td class="nowrap"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></td> <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="id" value="<?php echo $object->id; ?>" />
<input type="hidden" name="action" value="addcontact" />
<input type="hidden" name="source" value="external" />
<div class="nowrap"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></div>
<?php if ($conf->use_javascript_ajax && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { ?> <?php if ($conf->use_javascript_ajax && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { ?>
<td> <div class="nowrap">
<?php <?php
$events=array(); $events=array();
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
print $form->select_company($object->socid,'socid','',1,0,0,$events); print $form->select_company($object->socid,'socid','',1,0,0,$events);
?> ?>
</td> </div>
<td> <div>
<?php $nbofcontacts=$form->select_contacts($object->socid, '', 'contactid'); ?> <?php $nbofcontacts=$form->select_contacts($object->socid, '', 'contactid'); ?>
</td> </div>
<?php } else { ?> <?php } else { ?>
<td> <div>
<?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?> <?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?>
<?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany'); ?> <?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany'); ?>
</td> </div>
<td> <div>
<?php $nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid'); ?> <?php $nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid'); ?>
</td> </div>
<?php } ?> <?php } ?>
<td> <div>
<?php $formcompany->selectTypeContact($object, '', 'type','external'); ?> <?php $formcompany->selectTypeContact($object, '', 'type','external'); ?>
</td> </div>
<td align="right" colspan="3" > <div>&nbsp;</div>
<div align="right">
<input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled="disabled"'; ?>> <input type="submit" id="add-customer-contact" class="button" value="<?php echo $langs->trans("Add"); ?>"<?php if (! $nbofcontacts) echo ' disabled="disabled"'; ?>>
</td> </div>
</tr>
</form> </form>
<?php } ?> <?php } ?>
<tr class="liste_titre"> <form class="liste_titre">
<td><?php echo $langs->trans("Source"); ?></td> <div><?php echo $langs->trans("Source"); ?></div>
<td><?php echo $langs->trans("Company"); ?></td> <div><?php echo $langs->trans("Company"); ?></div>
<td><?php echo $langs->trans("Contacts"); ?></td> <div><?php echo $langs->trans("Contacts"); ?></div>
<td><?php echo $langs->trans("ContactType"); ?></td> <div><?php echo $langs->trans("ContactType"); ?></div>
<td align="center"><?php echo $langs->trans("Status"); ?></td> <div align="center"><?php echo $langs->trans("Status"); ?></div>
<td colspan="2">&nbsp;</td> <div>&nbsp;</div>
</tr> </form>
<?php $var=true; ?> <?php $var=true; ?>
@ -130,12 +128,12 @@ $userstatic=new User($db);
$var = !$var; $var = !$var;
?> ?>
<tr <?php echo $bc[$var]; ?> valign="top"> <form <?php echo $bc[$var]; ?>>
<td align="left"> <div align="left">
<?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?> <?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?>
<?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?> <?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?>
</td> </div>
<td align="left"> <div align="left">
<?php <?php
if ($tab[$i]['socid'] > 0) if ($tab[$i]['socid'] > 0)
{ {
@ -151,8 +149,8 @@ $userstatic=new User($db);
echo '&nbsp;'; echo '&nbsp;';
} }
?> ?>
</td> </div>
<td> <div>
<?php <?php
if ($tab[$i]['source']=='internal') if ($tab[$i]['source']=='internal')
{ {
@ -169,22 +167,22 @@ $userstatic=new User($db);
echo $contactstatic->getNomUrl(1); echo $contactstatic->getNomUrl(1);
} }
?> ?>
</td> </div>
<td><?php echo $tab[$i]['libelle']; ?></td> <div><?php echo $tab[$i]['libelle']; ?></div>
<td align="center"> <div align="center">
<?php if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">'; ?> <?php if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">'; ?>
<?php echo $contactstatic->LibStatut($tab[$i]['status'],3); ?> <?php echo $contactstatic->LibStatut($tab[$i]['status'],3); ?>
<?php if ($object->statut >= 0) echo '</a>'; ?> <?php if ($object->statut >= 0) echo '</a>'; ?>
</td> </div>
<td align="center" class="nowrap" colspan="2"> <div align="center" class="nowrap">
<?php if ($permission) { ?> <?php if ($permission) { ?>
&nbsp;<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=deletecontact&amp;lineid='.$tab[$i]['rowid']; ?>"><?php echo img_delete(); ?></a> &nbsp;<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=deletecontact&amp;lineid='.$tab[$i]['rowid']; ?>"><?php echo img_delete(); ?></a>
<?php } ?> <?php } ?>
</td> </div>
</tr> </form>
<?php $i++; ?> <?php $i++; ?>
<?php } } ?> <?php } } ?>
</table> </div>
<!-- END PHP TEMPLATE CONTACTS --> <!-- END PHP TEMPLATE CONTACTS -->