| '.$langs->trans("WelcomeEMail").' | ';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
@@ -261,7 +264,7 @@ if ($_GET["action"] == 'create')
/* ************************************************************************** */
if ($rowid > 0)
{
- if ($_GET["action"] != 'edit')
+ if ($action != 'edit')
{
$adht = new AdherentType($db);
$adht->id = $rowid;
@@ -316,16 +319,16 @@ if ($rowid > 0)
// Edit
if ($user->rights->adherent->configurer)
{
- print "id."\">".$langs->trans("Modify")."";
+ print ''.$langs->trans("Modify").'';
}
// Add
- print "id."\">".$langs->trans("AddMember")."";
+ print ''.$langs->trans("AddMember").'';
// Delete
if ($user->rights->adherent->configurer)
{
- print "id."\">".$langs->trans("DeleteType")."";
+ print ''.$langs->trans("DeleteType").'';
}
print "";
@@ -342,38 +345,35 @@ if ($rowid > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_adherent_type = t.rowid ";
$sql.= " AND d.entity = ".$conf->entity;
+ $sql.= " AND t.rowid = ".$adht->id;
if ($sall)
{
- $sql.=" AND (d.prenom like '%".$sall."%' OR d.nom like '%".$sall."%' OR d.societe like '%".$sall."%'";
- $sql.=" OR d.email like '%".$sall."%' OR d.login like '%".$sall."%' OR d.adresse like '%".$sall."%'";
- $sql.=" OR d.ville like '%".$sall."%' OR d.note like '%".$sall."%')";
+ $sql.= " AND (d.prenom LIKE '%".$sall."%' OR d.nom LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'";
+ $sql.= " OR d.email LIKE '%".$sall."%' OR d.login LIKE '%".$sall."%' OR d.adresse LIKE '%".$sall."%'";
+ $sql.= " OR d.ville LIKE '%".$sall."%' OR d.note LIKE '%".$sall."%')";
}
- //if ($_REQUEST["type"] > 0)
- //{
- //$sql.=" AND t.rowid=".$_REQUEST["type"];
- $sql.=" AND t.rowid=".$adht->id;
- //}
- if (isset($_GET["statut"]))
+ if ($status != '')
{
- $sql.=" AND d.statut in ($statut)"; // Peut valoir un nombre ou liste de nombre separes par virgules
+ $sql.= " AND d.statut IN (".$status.")"; // Peut valoir un nombre ou liste de nombre separes par virgules
}
- if ( $_POST["action"] == 'search')
+ if ($action == 'search')
{
- if (isset($_POST['search']) && $_POST['search'] != ''){
+ if (isset($_POST['search']) && $_POST['search'] != '')
+ {
$sql.= " AND (d.prenom LIKE '%".$_POST['search']."%' OR d.nom LIKE '%".$_POST['search']."%')";
}
}
- if ($_GET["search_nom"])
+ if (! empty($search_lastname))
{
- $sql.= " AND (d.prenom LIKE '%".$_GET["search_nom"]."%' OR d.nom LIKE '%".$_GET["search_nom"]."%')";
+ $sql.= " AND (d.prenom LIKE '%".$search_lastname."%' OR d.nom LIKE '%".$search_lastname."%')";
}
- if ($_GET["search_login"])
+ if (! empty($search_login))
{
- $sql.= " AND d.login LIKE '%".$_GET["search_login"]."%'";
+ $sql.= " AND d.login LIKE '%".$search_login."%'";
}
- if ($_GET["search_email"])
+ if (! empty($search_email))
{
- $sql.= " AND (d.email LIKE '%".$_GET["search_email"]."%')";
+ $sql.= " AND d.email LIKE '%".$search_email."%'";
}
if ($filter == 'uptodate')
{
@@ -402,32 +402,34 @@ if ($rowid > 0)
$i = 0;
$titre=$langs->trans("MembersList");
- if (isset($_GET["statut"]))
+ if ($status != '')
{
- if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); }
- if ($statut == '-1') { $titre=$langs->trans("MembersListToValid"); }
- if ($statut == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); }
- if ($statut == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); }
- if ($statut == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); }
- if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); }
+ if ($status == '-1,1') { $titre=$langs->trans("MembersListQualified"); }
+ else if ($status == '-1') { $titre=$langs->trans("MembersListToValid"); }
+ else if ($status == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); }
+ else if ($status == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); }
+ else if ($status == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); }
+ else if ($status == '0') { $titre=$langs->trans("MembersListResiliated"); }
}
- elseif ($_POST["action"] == 'search') {
+ elseif ($action == 'search')
+ {
$titre=$langs->trans("MembersListQualified");
}
- if ($_REQUEST["type"] > 0)
+ if ($type > 0)
{
$membertype=new AdherentType($db);
- $result=$membertype->fetch($_REQUEST["type"]);
+ $result=$membertype->fetch($type);
$titre.=" (".$membertype->libelle.")";
}
$param="&rowid=".$rowid;
- if (isset($_GET["statut"])) $param.="&statut=".$_GET["statut"];
- if (isset($_GET["search_nom"])) $param.="&search_nom=".$_GET["search_nom"];
- if (isset($_GET["search_login"])) $param.="&search_login=".$_GET["search_login"];
- if (isset($_GET["search_email"])) $param.="&search_email=".$_GET["search_email"];
- if (isset($_GET["filter"])) $param.="&filter=".$_GET["filter"];
+ if (! empty($status)) $param.="&status=".$status;
+ if (! empty($search_lastname)) $param.="&search_nom=".$search_lastname;
+ if (! empty($search_firstname)) $param.="&search_prenom=".$search_firstname;
+ if (! empty($search_login)) $param.="&search_login=".$search_login;
+ if (! empty($search_email)) $param.="&search_email=".$search_email;
+ if (! empty($filter)) $param.="&filter=".$filter;
if ($sall)
{
@@ -436,7 +438,7 @@ if ($rowid > 0)
print ' ';
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
- print "";
+ print '';
print '';
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.nom",$param,"","",$sortfield,$sortorder);
@@ -455,15 +457,15 @@ if ($rowid > 0)
print ' ';
print '| ';
- print ' | ';
+ print '';
print '';
- print ' | ';
+ print '';
print ' | ';
print '';
- print ' | ';
+ print '';
print ' | ';
@@ -487,14 +489,14 @@ if ($rowid > 0)
// Nom
$var=!$var;
- print " ";
+ print ' ';
if ($objp->societe != '')
{
- print "| rowid\">".img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom." ".dol_trunc($objp->nom,12)." / ".dol_trunc($objp->societe,12)." | \n";
+ print ''.img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom.' '.dol_trunc($objp->nom,12).' / '.dol_trunc($objp->societe,12).' | '."\n";
}
else
{
- print "rowid\">".img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom." ".dol_trunc($objp->nom)." | \n";
+ print ''.img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom.' '.dol_trunc($objp->nom).' | '."\n";
}
// Login
@@ -552,12 +554,12 @@ if ($rowid > 0)
print '';
if ($user->rights->adherent->creer)
{
- print "rowid&action=edit&return=liste.php\">".img_edit()."";
+ print ''.img_edit().'';
}
print ' ';
if ($user->rights->adherent->supprimer)
{
- print "rowid&action=resign&return=liste.php\">".img_picto($langs->trans("Resiliate"),'disable.png')."";
+ print ''.img_picto($langs->trans("Resiliate"),'disable.png').'';
}
print " | ";
@@ -579,7 +581,7 @@ if ($rowid > 0)
}
- if ($_GET["action"] == 'edit')
+ if ($action == 'edit')
{
$form = new Form($db);
@@ -597,7 +599,6 @@ if ($rowid > 0)
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
-
print ' ';
print '| '.$langs->trans("Description").' | ';
- print " | ";
+ print '';
print '| '.$langs->trans("WelcomeEMail").' | ';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php
index 703715c15c4..cd526042024 100644
--- a/htdocs/core/class/html.formbarcode.class.php
+++ b/htdocs/core/class/html.formbarcode.class.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2008-2010 Laurent Destailleur
+/* Copyright (C) 2007-2011 Regis Houssin
+ * Copyright (C) 2008-2011 Laurent Destailleur
*
* 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
@@ -18,7 +18,7 @@
*/
/**
- * \file htdocs/includes/barcode/html.formbarcode.class.php
+ * \file htdocs/core/class/html.formbarcode.class.php
* \brief Fichier de la classe des fonctions predefinie de composants html
*/
diff --git a/htdocs/product/admin/produit.php b/htdocs/product/admin/produit.php
index e19fceb7448..a158bc5a4b7 100644
--- a/htdocs/product/admin/produit.php
+++ b/htdocs/product/admin/produit.php
@@ -28,7 +28,7 @@
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
-require_once(DOL_DOCUMENT_ROOT."/includes/barcode/html.formbarcode.class.php");
+require_once(DOL_DOCUMENT_ROOT."/core/class/html.formbarcode.class.php");
$langs->load("admin");
diff --git a/htdocs/product/barcode.php b/htdocs/product/barcode.php
index 58e9d13ee75..e7aadd55177 100644
--- a/htdocs/product/barcode.php
+++ b/htdocs/product/barcode.php
@@ -1,7 +1,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur
- * Copyright (C) 2005-2010 Regis Houssin
+ * Copyright (C) 2005-2011 Regis Houssin
*
* 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
@@ -26,44 +26,44 @@
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
-require_once(DOL_DOCUMENT_ROOT."/includes/barcode/html.formbarcode.class.php");
+require_once(DOL_DOCUMENT_ROOT."/core/class/html.formbarcode.class.php");
$langs->load("products");
$langs->load("bills");
-// Security check
-if (isset($_GET["id"]) || isset($_GET["ref"]))
-{
- $id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:'');
-}
-$fieldid = isset($_GET["ref"])?'ref':'rowid';
-if ($user->societe_id) $socid=$user->societe_id;
-$result=restrictedArea($user,'produit|service&barcode',$id,'product','','',$fieldid);
+$id = GETPOST('id','int');
+$ref = GETPOST('ref','alpha');
+$action = GETPOST('action','alpha');
+// Security check
+$fieldvalue = (! empty($id) ? $id : $ref);
+$fieldname = (! empty($ref) ? 'ref' : 'rowid');
+if ($user->societe_id) $socid=$user->societe_id;
+$result=restrictedArea($user,'produit|service&barcode',$fieldvalue,'product','','',$fieldname);
+
+$object = new Product($db);
/*
* Actions
*/
// Modification du type de code barre
-if ($_POST['action'] == 'setbarcodetype' && $user->rights->barcode->creer)
+if ($action == 'setbarcodetype' && $user->rights->barcode->creer)
{
- $product = new Product($db);
- $product->fetch($_GET["id"]);
- $product->barcode_type = $_POST['barcodetype_id'];
- $result = $product->update_barcode_type($user);
- Header("Location: barcode.php?id=".$_GET["id"]);
+ $object->fetch($id);
+ $object->barcode_type = $_POST['barcodetype_id'];
+ $result = $object->update_barcode_type($user);
+ Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
// Modification du code barre
-if ($_POST['action'] == 'setbarcode' && $user->rights->barcode->creer)
+if ($action == 'setbarcode' && $user->rights->barcode->creer)
{
- $product = new Product($db);
- $product->fetch($_GET["id"]);
- $product->barcode = $_POST['barcode']; //Todo: ajout verification de la validite du code barre en fonction du type
- $result = $product->update_barcode($user);
- Header("Location: barcode.php?id=".$_GET["id"]);
+ $object->fetch($id);
+ $object->barcode = $_POST['barcode']; //Todo: ajout verification de la validite du code barre en fonction du type
+ $result = $object->update_barcode($user);
+ Header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
exit;
}
@@ -77,13 +77,11 @@ llxHeader("","",$langs->trans("BarCode"));
$form = new Form($db);
$formbarcode = new FormBarCode($db);
-$product = new Product($db);
-if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
-if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
+$result = $object->fetch($id,$ref);
-$head=product_prepare_head($product, $user);
-$titre=$langs->trans("CardProduct".$product->type);
-$picto=($product->type==1?'service':'product');
+$head=product_prepare_head($object, $user);
+$titre=$langs->trans("CardProduct".$object->type);
+$picto=($object->type==1?'service':'product');
dol_fiche_head($head, 'barcode', $titre, 0, $picto);
@@ -92,15 +90,15 @@ print ''."\n";
// Reference
print '';
print '| '.$langs->trans("Ref").' | ';
-print $form->showrefnav($product,'ref','',1,'ref');
+print $form->showrefnav($object,'ref','',1,'ref');
print ' | ';
print ' '."\n";
// Libelle
-print '| '.$langs->trans("Label").' | '.$product->libelle.' | ';
+print ' | '.$langs->trans("Label").' | '.$object->libelle.' | ';
// Barcode image
-$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($product->barcode_type_coder).'&code='.urlencode($product->barcode).'&encoding='.urlencode($product->barcode_type_code);
+$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
print '';
print '';
print ' ';
@@ -110,12 +108,12 @@ print ' | '."\n";
// Status (to sell)
print '| '.$langs->trans("Status").' ('.$langs->trans("Sell").')'.' | ';
-print $product->getLibStatut(2,0);
+print $object->getLibStatut(2,0);
print ' | ';
// Status (to buy)
print '| '.$langs->trans("Status").' ('.$langs->trans("Buy").')'.' | ';
-print $product->getLibStatut(2,1);
+print $object->getLibStatut(2,1);
print ' | ';
// Barcode type
@@ -123,16 +121,16 @@ print '| ';
print '';
print ' | ';
if ($_GET['action'] == 'editbarcodetype')
{
- $formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$product->id,$product->barcode_type,'barcodetype_id');
+ $formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'barcodetype_id');
}
else
{
- print $product->barcode_type_label?$product->barcode_type_label:''.$langs->trans("SetDefaultBarcodeType").' ';
+ print $object->barcode_type_label?$object->barcode_type_label:' '.$langs->trans("SetDefaultBarcodeType").' ';
}
print ' | '."\n";
@@ -141,20 +139,20 @@ print '| ';
print '';
print ' | ';
if ($_GET['action'] == 'editbarcode')
{
- print ' | '."\n";
| |