Skip to content

Commit

Permalink
Fix: MultiCompany compatibility for public page
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed May 4, 2012
1 parent 21a4dd9 commit 656d494
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 14 deletions.
4 changes: 4 additions & 0 deletions htdocs/master.inc.php
Expand Up @@ -135,6 +135,10 @@
{
$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."'";

Expand Down
19 changes: 14 additions & 5 deletions htdocs/public/members/new.php
@@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org>
* 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
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -36,6 +37,13 @@
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.

// 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_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
Expand Down Expand Up @@ -359,8 +367,9 @@ function initmorphy()

// Print form
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="action" value="add">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" / >';
print '<input type="hidden" name="entity" value"'.$entity.'" />';
print '<input type="hidden" name="action" value="add" />';

print '<div id="divsubscribe">';
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
Expand Down
18 changes: 13 additions & 5 deletions htdocs/public/members/public_card.php
@@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* 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
* it under the terms of the GNU General Public License as published by
Expand All @@ -26,6 +27,13 @@
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.

// For MultiCompany module
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : 1);
if (is_int($entity))
{
define("DOLENTITY", $entity);
}

require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
Expand All @@ -40,7 +48,7 @@
$langs->load("companies");
$langs->load("other");

$rowid=$_GET["id"];
$id=GETPOST('id','int');
$object = new Adherent($db);
$extrafields = new ExtraFields($db);

Expand All @@ -62,7 +70,7 @@

// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('member');
if ($rowid > 0)
if ($id > 0)
{
$res=$object->fetch($id,$ref);
if ($res < 0) { dol_print_error($db,$object->error); exit; }
Expand Down
17 changes: 13 additions & 4 deletions htdocs/public/members/public_list.php
@@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* 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
* it under the terms of the GNU General Public License as published by
Expand All @@ -26,6 +27,13 @@
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.

// For MultiCompany module
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : 1);
if (is_int($entity))
{
define("DOLENTITY", $entity);
}

require("../../main.inc.php");

// Security check
Expand Down Expand Up @@ -96,7 +104,8 @@ function llxFooterVierge()

$sql = "SELECT rowid, prenom, nom, societe, cp, ville, email, naiss, photo";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent";
$sql.= " WHERE statut = 1";
$sql.= " WHERE entity = ".$entity;
$sql.= " AND statut = 1";
$sql.= " AND public = 1";
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
Expand Down

0 comments on commit 656d494

Please sign in to comment.