Merge pull request #432 from grandoc/develop
try to fix canvas within members module
This commit is contained in:
commit
883e51566f
@ -1,29 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 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-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/adherents/fiche.php
|
* \file htdocs/adherents/fiche.php
|
||||||
* \ingroup member
|
* \ingroup member
|
||||||
* \brief Page of member
|
* \brief Page of member
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||||
@ -52,7 +52,7 @@ $userid=GETPOST('userid','int');
|
|||||||
$socid=GETPOST('socid','int');
|
$socid=GETPOST('socid','int');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$result=restrictedArea($user,'adherent',$rowid);
|
$result=restrictedArea($user,'adherent',$rowid,'','','fk_soc', 'rowid', $objcanvas);
|
||||||
|
|
||||||
if (! empty($conf->mailmanspip->enabled))
|
if (! empty($conf->mailmanspip->enabled))
|
||||||
{
|
{
|
||||||
@ -66,6 +66,17 @@ if (! empty($conf->mailmanspip->enabled))
|
|||||||
$object = new Adherent($db);
|
$object = new Adherent($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
|
$object->getCanvas($socid);
|
||||||
|
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
|
||||||
|
$objcanvas='';
|
||||||
|
if (! empty($canvas))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
|
||||||
|
$objcanvas = new Canvas($db, $action);
|
||||||
|
$objcanvas->getCanvas('adherent', 'card', $canvas);
|
||||||
|
}
|
||||||
|
|
||||||
$errmsg=''; $errmsgs=array();
|
$errmsg=''; $errmsgs=array();
|
||||||
|
|
||||||
if ($rowid > 0)
|
if ($rowid > 0)
|
||||||
@ -102,9 +113,9 @@ $hookmanager->initHooks(array('membercard'));
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid, 'objcanvas'=>$objcanvas);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer))
|
||||||
@ -129,6 +140,8 @@ if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else $object->canvas=$canvas;
|
||||||
|
|
||||||
if ($action == 'setsocid')
|
if ($action == 'setsocid')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -184,6 +197,7 @@ if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user
|
|||||||
$errmsg=$object->error;
|
$errmsg=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else $object->canvas=$canvas;
|
||||||
|
|
||||||
// Create third party from a member
|
// Create third party from a member
|
||||||
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer)
|
if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer)
|
||||||
@ -206,6 +220,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
|
|||||||
$errmsg=$object->error;
|
$errmsg=$object->error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else $object->canvas=$canvas;
|
||||||
|
|
||||||
if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
if ($action == 'confirm_sendinfo' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
@ -664,7 +679,7 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
@ -677,8 +692,27 @@ llxHeader('',$langs->trans("Member"),$help_url);
|
|||||||
|
|
||||||
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||||
|
|
||||||
if ($action == 'create')
|
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||||
{
|
{
|
||||||
|
// -----------------------------------------
|
||||||
|
// When used with CANVAS
|
||||||
|
// -----------------------------------------
|
||||||
|
if (empty($object->error) && $socid)
|
||||||
|
{
|
||||||
|
$object = new Adherent($db);
|
||||||
|
$object->fetch($socid);
|
||||||
|
}
|
||||||
|
$objcanvas->assign_values($action, $socid); // Set value for templates
|
||||||
|
$objcanvas->display_canvas($action); // Show template
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// -----------------------------------------
|
||||||
|
// When used in standard mode
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
if ($action == 'create')
|
||||||
|
{
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* Fiche creation */
|
/* Fiche creation */
|
||||||
@ -864,10 +898,10 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'edit')
|
if ($action == 'edit')
|
||||||
{
|
{
|
||||||
/********************************************
|
/********************************************
|
||||||
*
|
*
|
||||||
* Fiche en mode edition
|
* Fiche en mode edition
|
||||||
@ -875,9 +909,13 @@ if ($action == 'edit')
|
|||||||
********************************************/
|
********************************************/
|
||||||
|
|
||||||
$res=$object->fetch($rowid);
|
$res=$object->fetch($rowid);
|
||||||
if ($res < 0) { dol_print_error($db,$object->error); exit; }
|
if ($res < 0) {
|
||||||
|
dol_print_error($db,$object->error); exit;
|
||||||
|
}
|
||||||
$res=$object->fetch_optionals($object->id,$extralabels);
|
$res=$object->fetch_optionals($object->id,$extralabels);
|
||||||
if ($res < 0) { dol_print_error($db); exit; }
|
if ($res < 0) {
|
||||||
|
dol_print_error($db); exit;
|
||||||
|
}
|
||||||
|
|
||||||
$adht = new AdherentType($db);
|
$adht = new AdherentType($db);
|
||||||
$adht->fetch($object->typeid);
|
$adht->fetch($object->typeid);
|
||||||
@ -1100,10 +1138,10 @@ if ($action == 'edit')
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rowid && $action != 'edit')
|
if ($rowid && $action != 'edit')
|
||||||
{
|
{
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
@ -1113,13 +1151,19 @@ if ($rowid && $action != 'edit')
|
|||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
$res=$object->fetch($rowid);
|
$res=$object->fetch($rowid);
|
||||||
if ($res < 0) { dol_print_error($db,$object->error); exit; }
|
if ($res < 0) {
|
||||||
|
dol_print_error($db,$object->error); exit;
|
||||||
|
}
|
||||||
$res=$object->fetch_optionals($object->id,$extralabels);
|
$res=$object->fetch_optionals($object->id,$extralabels);
|
||||||
if ($res < 0) { dol_print_error($db); exit; }
|
if ($res < 0) {
|
||||||
|
dol_print_error($db); exit;
|
||||||
|
}
|
||||||
|
|
||||||
$adht = new AdherentType($db);
|
$adht = new AdherentType($db);
|
||||||
$res=$adht->fetch($object->typeid);
|
$res=$adht->fetch($object->typeid);
|
||||||
if ($res < 0) { dol_print_error($db); exit; }
|
if ($res < 0) {
|
||||||
|
dol_print_error($db); exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1204,8 +1248,12 @@ if ($rowid && $action != 'edit')
|
|||||||
// Cree un tableau formulaire
|
// Cree un tableau formulaire
|
||||||
$formquestion=array();
|
$formquestion=array();
|
||||||
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false));
|
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false));
|
||||||
if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>''); }
|
if (! empty($conf->global->ADHERENT_USE_MAILMAN)) {
|
||||||
if (! empty($conf->global->ADHERENT_USE_SPIP)) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); }
|
$formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>'');
|
||||||
|
}
|
||||||
|
if (! empty($conf->global->ADHERENT_USE_SPIP)) {
|
||||||
|
$formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>'');
|
||||||
|
}
|
||||||
print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1);
|
print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1593,9 +1641,9 @@ if ($rowid && $action != 'edit')
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user