Skip to content
Snippets Groups Projects
Commit 66819a34 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix several bugs

parent b0e9f314
No related branches found
No related tags found
No related merge requests found
......@@ -37,33 +37,57 @@ $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'prelevement','','','bons');
// Get supervariables
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha');
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="p.datec";
// Get supervariables
$statut = GETPOST('statut','int');
$search_line = GETPOST('search_ligne','int');
$search_ref = GETPOST('search_ref','alpha');
llxHeader('',$langs->trans("WithdrawalsReceipts"));
$bon=new BonPrelevement($db,"");
/*
* Actions
*/
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
$search_ref="";
}
/*
* Mode List
*
* View
*/
llxHeader('',$langs->trans("WithdrawalsReceipts"));
$bon=new BonPrelevement($db,"");
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
$sql.= ", p.datec";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " ORDER BY $sortfield $sortorder ";
$sql.= $db->plimit($conf->liste_limit+1, $offset);
if ($search_ref) $sql.=natural_search("p.ref", $search_ref);
$sql.= $db->order($sortfield,$sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit + 1,$offset);
$result = $db->query($sql);
if ($result)
......@@ -73,9 +97,22 @@ if ($result)
$urladd= "&statut=".$statut;
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
print '<table class="liste" width="100%">';
// Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
......@@ -84,17 +121,18 @@ if ($result)
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_ligne" value="'. $search_line.'" size="10"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. $db->escape($search_ref).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print '</form>';
print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print '</tr>';
$var=True;
while ($i < min($num,$conf->liste_limit))
{
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
$var=!$var;
......@@ -113,6 +151,10 @@ if ($result)
$i++;
}
print "</table>";
print '</div>';
print '</form>';
$db->free($result);
}
else
......
......@@ -23,6 +23,7 @@
* \ingroup prelevement
* \brief Page liste des prelevements
*/
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
......@@ -38,10 +39,18 @@ $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'prelevement','','','bons');
// Get supervariables
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha');
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="p.datec";
$search_line = GETPOST('search_line','alpha');
$search_bon = GETPOST('search_bon','alpha');
$search_code = GETPOST('search_code','alpha');
......@@ -51,9 +60,12 @@ $statut = GETPOST('statut','int');
$bon=new BonPrelevement($db,"");
$ligne=new LignePrelevement($db,$user);
$offset = $conf->liste_limit * $page ;
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
/*
* Actions
*/
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
$search_line="";
$search_bon="";
......@@ -62,10 +74,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$statut="";
}
/*
* View
*/
$form=new Form($db);
llxHeader('',$langs->trans("WithdrawalsLines"));
$sql = "SELECT p.rowid, p.ref, p.statut, p.datec";
......@@ -83,24 +98,22 @@ $sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity;
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_line)
{
$sql.= " AND pl.rowid = '".$db->escape($search_line)."'";
}
if ($search_bon)
{
$sql.= " AND p.ref LIKE '%".$db->escape($search_bon)."%'";
}
if ($search_code)
{
$sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
}
if ($search_company)
if ($search_line) $sql.= " AND pl.rowid = '".$db->escape($search_line)."'";
if ($search_bon) $sql.= natural_search("p.ref", $search_bon);
if ($search_code) $sql.= natural_search("s.code_client", $search_code);
if ($search_company) natural_search("s.nom", $search_company);
$sql.= $db->order($sortfield,$sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.=$db->order($sortfield,$sortorder);
$sql.=$db->plimit($conf->liste_limit+1, $offset);
$sql.= $db->plimit($limit + 1,$offset);
$result = $db->query($sql);
if ($result)
......@@ -111,11 +124,15 @@ if ($result)
$urladd = "&amp;statut=".$statut;
$urladd .= "&amp;search_bon=".$search_bon;
print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
print"\n<!-- debut table -->\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<table class="liste" width="100%">';
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]);
......@@ -144,7 +161,7 @@ if ($result)
$var=True;
while ($i < min($num,$conf->liste_limit))
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
......@@ -185,6 +202,7 @@ if ($result)
$i++;
}
print "</table>";
print '</div>';
print '</form>';
......
......@@ -641,7 +641,9 @@ if (! empty($conf->don->enabled))
$totentrees=array();
$totsorties=array();
print '<table class="noborder" width="100%">';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste">'."\n";
print '<tr class="liste_titre"><td class="liste_titre">&nbsp;</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
......@@ -735,7 +737,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
print "</tr>\n";
print "</table>";
print '</div>';
llxFooter();
$db->close();
......@@ -967,7 +967,7 @@ if ($action == 'create')
// Description (must be a textarea and not html must be allowed (used in list view)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td>';
print '<textarea name="description" cols="80" rows="'.ROWS_3.'">'.GETPOST('description').'</textarea>';
print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.'">'.GETPOST('description').'</textarea>';
print '</td></tr>';
// Project
......
......@@ -251,7 +251,8 @@ if ($result)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
......@@ -527,6 +528,8 @@ if ($result)
}
print '</table>';
print '</div>';
print "</form>\n";
$db->free($result);
}
......
......@@ -81,7 +81,7 @@ LT2PaymentES=IRPF Payment
LT2PaymentsES=IRPF Payments
VATPayment=Sales tax payment
VATPayments=Sales tax payments
VATRefund=Sales tax refund Refund
VATRefund=Sales tax refund
Refund=Refund
SocialContributionsPayments=Social/fiscal taxes payments
ShowVatPayment=Show VAT payment
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment