Skip to content

Commit

Permalink
Fix: uniformize code
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Sep 20, 2011
1 parent 551e1f8 commit 25cf224
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
9 changes: 5 additions & 4 deletions htdocs/comm/contact.php
@@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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
Expand Down Expand Up @@ -112,7 +113,7 @@

if ($_GET["contactname"]) // acces a partir du module de recherche
{
$sql.= " AND ( p.name like '%".strtolower($_GET[contactname])."%' OR lower(p.firstname) like '%".strtolower($_GET[contactname])."%') ";
$sql.= " AND ( p.name like '%".strtolower($_GET["contactname"])."%' OR lower(p.firstname) like '%".strtolower($_GET["contactname"])."%') ";
$sortfield = "p.name";
$sortorder = "ASC";
}
Expand Down
5 changes: 4 additions & 1 deletion htdocs/comm/fiche.php
Expand Up @@ -53,6 +53,9 @@
if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user,'societe',$socid,'');

$mode=GETPOST("mode");
$modesearch=GETPOST("mode_search");

$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
Expand Down Expand Up @@ -138,7 +141,7 @@

if ($mode == 'search')
{
if ($mode-search == 'soc')
if ($modesearch == 'soc')
{
$sql = "SELECT s.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
Expand Down
5 changes: 4 additions & 1 deletion htdocs/compta/clients.php
Expand Up @@ -42,6 +42,9 @@

$langs->load("companies");

$mode=GETPOST("mode");
$modesearch=GETPOST("mode_search");

$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
Expand Down Expand Up @@ -75,7 +78,7 @@
}

if ($mode == 'search') {
if ($mode-search == 'soc') {
if ($modesearch == 'soc') {
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
$sql.= " WHERE lower(s.nom) like '%".$db->escape(strtolower($socname))."%'";
$sql.= " AND s.entity = ".$conf->entity;
Expand Down
7 changes: 5 additions & 2 deletions htdocs/fourn/facture/index.php
Expand Up @@ -44,6 +44,9 @@
$socid = $user->societe_id;
}

$mode=GETPOST("mode");
$modesearch=GETPOST("mode_search");

$page=$_GET["page"];
$sortorder = $_GET["sortorder"];
$sortfield = $_GET["sortfield"];
Expand All @@ -64,9 +67,9 @@
* Actions
*/

if ($_POST["mode"] == 'search')
if ($mode == 'search')
{
if ($_POST["mode-search"] == 'soc')
if ($modesearch == 'soc')
{
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
$sql.= " WHERE s.nom like '%".$db->escape(strtolower($socname))."%'";
Expand Down
2 changes: 1 addition & 1 deletion htdocs/main.inc.php
Expand Up @@ -1587,7 +1587,7 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$
$ret.='<form action="'.$urlaction.'" method="post">';
$ret.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$ret.='<input type="hidden" name="mode" value="search">';
$ret.='<input type="hidden" name="mode-search" value="'.$htmlmodesearch.'">';
$ret.='<input type="hidden" name="mode_search" value="'.$htmlmodesearch.'">';
$ret.='<input type="text" class="flat" ';
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $ret.=' placeholder="'.$langs->trans("SearchOf").''.strip_tags($title).'"';
else $ret.=' title="'.$langs->trans("SearchOf").''.strip_tags($title).'"';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/societe/societe.php
Expand Up @@ -48,7 +48,7 @@
$search_sale=trim(GETPOST("search_sale"));
$search_categ=trim(GETPOST("search_categ"));
$mode=GETPOST("mode");
$modesearch=GETPOST("mode-search");
$modesearch=GETPOST("mode_search");

$sortfield=GETPOST("sortfield");
$sortorder=GETPOST("sortorder");
Expand Down

0 comments on commit 25cf224

Please sign in to comment.