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');
if ($negpage)
{
$page=$_GET["nbpage"] - $negpage;
if ($page > $_GET["nbpage"]) $page = $_GET["nbpage"];
$page=GETPOST("nbpage") - $negpage;
if ($page > GETPOST("nbpage")) $page = GETPOST("nbpage");
}
$mesg='';
@ -269,6 +269,7 @@ if ($id > 0 || ! empty($ref))
$head=bank_prepare_head($object);
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
print '<table class="border" width="100%">';
$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
*/
$param.='&amp;account='.$object->id;
$param.='&amp;account='.$object->id.'&amp;vline='.$vline;
// Define transaction list navigation string
$navig = '<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="GET"><div data-role="fieldcontain">';
//print 'nbpage='.$totalPages.' viewline='.$viewline.' limitsql='.$limitsql;
print '<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="POST">';
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>';
$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="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.' ';
if ($total_lines > $limitsql )
{
$navig.= '<a href="'.$_SERVER["PHP_SELF"].'?'.$param.'&amp;page='.($page-1).'">'.img_next().'</a>';
}
$navig.='</fieldset></div></form>';
$navig.='</fieldset></div>';
//var_dump($navig);
// Confirmation delete
@ -335,12 +340,6 @@ if ($id > 0 || ! empty($ref))
// Form to add a transaction with no invoice
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 '<td align="left" colspan="10"><b>'.$langs->trans("AddBankRecordLong").'</b></td>';
print '</tr>';
@ -423,7 +422,7 @@ if ($id > 0 || ! empty($ref))
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 "</tr>\n";
print "</form>\n";
/*
* Another solution
@ -763,7 +762,10 @@ if ($id > 0 || ! empty($ref))
print "</table>";
print "\n</div>\n";
print "</form>\n";
dol_fiche_end();
/*
* Boutons actions
@ -777,7 +779,7 @@ if ($id > 0 || ! empty($ref))
{
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
{
@ -789,7 +791,7 @@ if ($id > 0 || ! empty($ref))
{
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
{

View File

@ -1076,11 +1076,12 @@ class Form
* @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled
* @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 $maxlength Maximum length of string into list (0=no limit)
* @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;
@ -1161,7 +1162,8 @@ class Form
if ($disableline) $out.= ' disabled="disabled"';
$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)
{
@ -2685,7 +2687,7 @@ class Form
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
$formproject=new FormProjets($this->db);
$langs->load("project");

View File

@ -1,5 +1,6 @@
<?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
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
if (! class_exists('Contact')) {
@ -40,83 +40,81 @@ $userstatic=new User($db);
?>
<!-- BEGIN PHP TEMPLATE CONTACTS -->
<table class="noborder allwidth">
<div class="tagtable centpercent noborder allwidth">
<?php if ($permission) { ?>
<tr class="liste_titre">
<td><?php echo $langs->trans("Source"); ?></td>
<td><?php echo $langs->trans("Company"); ?></td>
<td><?php echo $langs->trans("Contacts"); ?></td>
<td><?php echo $langs->trans("ContactType"); ?></td>
<td colspan="3">&nbsp;</td>
</tr>
<form class="liste_titre">
<div><?php echo $langs->trans("Source"); ?></div>
<div><?php echo $langs->trans("Company"); ?></div>
<div><?php echo $langs->trans("Contacts"); ?></div>
<div><?php echo $langs->trans("ContactType"); ?></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
</form>
<?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="id" value="<?php echo $object->id; ?>" />
<input type="hidden" name="action" value="addcontact" />
<input type="hidden" name="source" value="internal" />
<tr <?php echo $bc[$var]; ?>>
<td class="nowrap"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></td>
<td><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></td>
<td><?php echo $form->select_users($user->id,'userid',0,(! empty($userAlreadySelected)?$userAlreadySelected:'')); ?></td>
<td><?php echo $formcompany->selectTypeContact($object, '', 'type','internal'); ?></td>
<td align="right" colspan="3" ><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></td>
</tr>
<div class="nowrap"><?php echo img_object('','user').' '.$langs->trans("Users"); ?></div>
<div><?php echo $conf->global->MAIN_INFO_SOCIETE_NOM; ?></div>
<div><?php echo $form->select_dolusers($user->id, 'userid', 0, (! empty($userAlreadySelected)?$userAlreadySelected:null), 0, null, null, 0, 56); ?></div>
<div><?php echo $formcompany->selectTypeContact($object, '', 'type','internal'); ?></div>
<div>&nbsp;</div>
<div align="right"><input type="submit" class="button" value="<?php echo $langs->trans("Add"); ?>"></div>
</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; ?>
<tr <?php echo $bc[$var]; ?>>
<td class="nowrap"><?php echo img_object('','contact').' '.$langs->trans("ThirdPartyContacts"); ?></td>
<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="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)) { ?>
<td>
<div class="nowrap">
<?php
$events=array();
$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);
?>
</td>
<td>
</div>
<div>
<?php $nbofcontacts=$form->select_contacts($object->socid, '', 'contactid'); ?>
</td>
</div>
<?php } else { ?>
<td>
<div>
<?php $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$object->socid; ?>
<?php $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany'); ?>
</td>
<td>
</div>
<div>
<?php $nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid'); ?>
</td>
</div>
<?php } ?>
<td>
<div>
<?php $formcompany->selectTypeContact($object, '', 'type','external'); ?>
</td>
<td align="right" colspan="3" >
</div>
<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"'; ?>>
</td>
</tr>
</div>
</form>
<?php } ?>
<tr class="liste_titre">
<td><?php echo $langs->trans("Source"); ?></td>
<td><?php echo $langs->trans("Company"); ?></td>
<td><?php echo $langs->trans("Contacts"); ?></td>
<td><?php echo $langs->trans("ContactType"); ?></td>
<td align="center"><?php echo $langs->trans("Status"); ?></td>
<td colspan="2">&nbsp;</td>
</tr>
<form class="liste_titre">
<div><?php echo $langs->trans("Source"); ?></div>
<div><?php echo $langs->trans("Company"); ?></div>
<div><?php echo $langs->trans("Contacts"); ?></div>
<div><?php echo $langs->trans("ContactType"); ?></div>
<div align="center"><?php echo $langs->trans("Status"); ?></div>
<div>&nbsp;</div>
</form>
<?php $var=true; ?>
@ -130,12 +128,12 @@ $userstatic=new User($db);
$var = !$var;
?>
<tr <?php echo $bc[$var]; ?> valign="top">
<td align="left">
<form <?php echo $bc[$var]; ?>>
<div align="left">
<?php if ($tab[$i]['source']=='internal') echo $langs->trans("User"); ?>
<?php if ($tab[$i]['source']=='external') echo $langs->trans("ThirdPartyContact"); ?>
</td>
<td align="left">
</div>
<div align="left">
<?php
if ($tab[$i]['socid'] > 0)
{
@ -151,8 +149,8 @@ $userstatic=new User($db);
echo '&nbsp;';
}
?>
</td>
<td>
</div>
<div>
<?php
if ($tab[$i]['source']=='internal')
{
@ -169,22 +167,22 @@ $userstatic=new User($db);
echo $contactstatic->getNomUrl(1);
}
?>
</td>
<td><?php echo $tab[$i]['libelle']; ?></td>
<td align="center">
</div>
<div><?php echo $tab[$i]['libelle']; ?></div>
<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 echo $contactstatic->LibStatut($tab[$i]['status'],3); ?>
<?php if ($object->statut >= 0) echo '</a>'; ?>
</td>
<td align="center" class="nowrap" colspan="2">
</div>
<div align="center" class="nowrap">
<?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>
<?php } ?>
</td>
</tr>
</div>
</form>
<?php $i++; ?>
<?php } } ?>
</table>
</div>
<!-- END PHP TEMPLATE CONTACTS -->