Skip to content
Snippets Groups Projects
Commit 12b6d6c0 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: MultiCompany compatibility for public page

parent 8b920073
No related branches found
No related tags found
No related merge requests found
...@@ -135,6 +135,10 @@ if (! defined('NOREQUIREDB')) ...@@ -135,6 +135,10 @@ if (! defined('NOREQUIREDB'))
{ {
$conf->entity = GETPOST("entity",'int'); $conf->entity = GETPOST("entity",'int');
} }
else if (defined('DOLENTITY') && is_int(DOLENTITY)) // For public page with MultiCompany module
{
$conf->entity = DOLENTITY;
}
//print "Will work with data into entity instance number '".$conf->entity."'"; //print "Will work with data into entity instance number '".$conf->entity."'";
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* *
* 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
...@@ -36,6 +37,13 @@ ...@@ -36,6 +37,13 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_int($entity))
{
define("DOLENTITY", $entity);
}
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
...@@ -359,8 +367,9 @@ jQuery(document).ready(function () { ...@@ -359,8 +367,9 @@ jQuery(document).ready(function () {
// Print form // Print form
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n"; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" / >';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="entity" value"'.$entity.'" />';
print '<input type="hidden" name="action" value="add" />';
print '<div id="divsubscribe">'; print '<div id="divsubscribe">';
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n"; print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* *
* 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
...@@ -26,6 +27,13 @@ ...@@ -26,6 +27,13 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : 1);
if (is_int($entity))
{
define("DOLENTITY", $entity);
}
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
...@@ -40,7 +48,7 @@ $langs->load("members"); ...@@ -40,7 +48,7 @@ $langs->load("members");
$langs->load("companies"); $langs->load("companies");
$langs->load("other"); $langs->load("other");
$rowid=$_GET["id"]; $id=GETPOST('id','int');
$object = new Adherent($db); $object = new Adherent($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
...@@ -62,7 +70,7 @@ llxHeaderVierge($langs->trans("MemberCard")); ...@@ -62,7 +70,7 @@ llxHeaderVierge($langs->trans("MemberCard"));
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('member'); $extralabels=$extrafields->fetch_name_optionals_label('member');
if ($rowid > 0) if ($id > 0)
{ {
$res=$object->fetch($id,$ref); $res=$object->fetch($id,$ref);
if ($res < 0) { dol_print_error($db,$object->error); exit; } if ($res < 0) { dol_print_error($db,$object->error); exit; }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
* *
* 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
...@@ -26,6 +27,13 @@ ...@@ -26,6 +27,13 @@
define("NOLOGIN",1); // This means this output page does not require to be logged. define("NOLOGIN",1); // This means this output page does not require to be logged.
define("NOCSRFCHECK",1); // We accept to go on this page from external web site. define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
// For MultiCompany module
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : 1);
if (is_int($entity))
{
define("DOLENTITY", $entity);
}
require("../../main.inc.php"); require("../../main.inc.php");
// Security check // Security check
...@@ -96,7 +104,8 @@ llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers")); ...@@ -96,7 +104,8 @@ llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"));
$sql = "SELECT rowid, prenom, nom, societe, cp, ville, email, naiss, photo"; $sql = "SELECT rowid, prenom, nom, societe, cp, ville, email, naiss, photo";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent";
$sql.= " WHERE statut = 1"; $sql.= " WHERE entity = ".$entity;
$sql.= " AND statut = 1";
$sql.= " AND public = 1"; $sql.= " AND public = 1";
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset); $sql.= $db->plimit($conf->liste_limit+1, $offset);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment