diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 02d9e7b90a2..8d0cd566a7f 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -111,7 +111,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup'); -$head = member_admin_prepare_head($adh); +$head = member_admin_prepare_head(); dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); @@ -136,10 +136,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '
'; print ''; print ''; - print ''; print ''; print ''.$langs->trans("AdherentLoginRequired").''; - print $form->selectyesno('constvalue',!$conf->global->ADHERENT_LOGIN_NOT_REQUIRED,1); + print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?$conf->global->ADHERENT_LOGIN_NOT_REQUIRED:1),1); print ''; print ''; print "\n"; @@ -151,10 +150,9 @@ $var=!$var; print ''; print ''; print ''; -print ''; print ''; print ''.$langs->trans("AdherentMailRequired").''; -print $form->selectyesno('constvalue',$conf->global->ADHERENT_MAIL_REQUIRED,1); +print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_MAIL_REQUIRED)?$conf->global->ADHERENT_MAIL_REQUIRED:0),1); print ''; print ''; print "\n"; @@ -165,10 +163,9 @@ $var=!$var; print ''; print ''; print ''; -print ''; print ''; print ''.$langs->trans("MemberSendInformationByMailByDefault").''; -print $form->selectyesno('constvalue',$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL,1); +print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL:0),1); print ''; print ''; print "\n"; @@ -179,7 +176,6 @@ $var=!$var; print ''; print ''; print ''; -print ''; print ''; print ''.$langs->trans("AddSubscriptionIntoAccount").''; if ($conf->banque->enabled) diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php index 4f981a0607f..7d39eb33883 100755 --- a/htdocs/adherents/admin/adherent_extrafields.php +++ b/htdocs/adherents/admin/adherent_extrafields.php @@ -1,7 +1,8 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 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 @@ -38,7 +39,8 @@ $tmptype2label=getStaticMember(get_class($extrafields),'type2label'); $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); -$action=GETPOST("action"); +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); $elementtype='member'; if (!$user->admin) accessforbidden(); @@ -66,7 +68,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup'); -$head = member_admin_prepare_head($adh); +$head = member_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("Member"), 0, 'user'); @@ -161,32 +163,32 @@ if ($action == 'create') /* Edition d'un champ optionnel */ /* */ /* ************************************************************************** */ -if ($_GET["attrname"] && $action == 'edit') +if ($action == 'edit' && ! empty($attrname)) { print "
"; - print_titre($langs->trans("FieldEdition",$_GET["attrname"])); + print_titre($langs->trans("FieldEdition", $attrname)); /* * formulaire d'edition */ - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; // Label print ''; - print ''; + print ''; print ''; // Code print ''; print ''; - print ''; + print ''; print ''; // Type - $type=$extrafields->attribute_type[$_GET["attrname"]]; - $size=$extrafields->attribute_size[$_GET["attrname"]]; + $type=$extrafields->attribute_type[$attrname]; + $size=$extrafields->attribute_size[$attrname]; print ''; print '\n"; // Type @@ -141,7 +147,7 @@ print ''; print '\n"; // Can edit @@ -150,10 +156,10 @@ print ''; print '\n"; -if ($conf->paybox->enabled || $conf->paypal->enabled) +if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled)) { // Jump to an online payment page $var=! $var; @@ -163,7 +169,7 @@ if ($conf->paybox->enabled || $conf->paypal->enabled) $listofval=array(); if ($conf->paybox->enabled) $listofval['paybox']='Paybox'; if ($conf->paypal->enabled) $listofval['paypal']='PayPal'; - print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,$conf->global->MEMBER_NEWFORM_PAYONLINE,1); + print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1); print "\n"; } diff --git a/htdocs/adherents/admin/spip.php b/htdocs/adherents/admin/spip.php index 2d571d2c615..c099d0a93a3 100644 --- a/htdocs/adherents/admin/spip.php +++ b/htdocs/adherents/admin/spip.php @@ -112,7 +112,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup'); -$head = mailmanspip_admin_prepare_head($adh); +$head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 873b92641b9..973809c9e8a 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1,7 +1,7 @@ - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 J. Fernando Lagrange +/* Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 J. Fernando Lagrange * * 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 @@ -1024,7 +1024,7 @@ function form_constantes($tableau) $sql.= ", note"; $sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE ".$db->decrypt('name')." = '".$const."'"; - $sql.= " AND entity in (0, ".$conf->entity.")"; + $sql.= " AND entity IN (0, ".$conf->entity.")"; $sql.= " ORDER BY name ASC, entity DESC"; $result = $db->query($sql); @@ -1034,6 +1034,11 @@ function form_constantes($tableau) $obj = $db->fetch_object($result); // Take first result of select $var=!$var; + // For avoid warning in strict mode + if (empty($obj)) { + $obj = (object) array('rowid'=>'','name'=>'','value'=>'','type'=>'','note'=>''); + } + print "\n".''; print ""; diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 8928fac972e..15ada8ed4c0 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -106,7 +106,7 @@ function member_prepare_head($object) * @param Object $object Member * @return array head */ -function member_admin_prepare_head($object) +function member_admin_prepare_head() { global $langs, $conf, $user; @@ -122,7 +122,7 @@ function member_admin_prepare_head($object) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab - complete_head_from_modules($conf,$langs,$object,$head,$h,'member_admin'); + complete_head_from_modules($conf,$langs,'',$head,$h,'member_admin'); $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); @@ -134,7 +134,7 @@ function member_admin_prepare_head($object) $head[$h][2] = 'public'; $h++; - complete_head_from_modules($conf,$langs,$object,$head,$h,'member_admin','remove'); + complete_head_from_modules($conf,$langs,'',$head,$h,'member_admin','remove'); return $head; } diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index 03a251c47dc..4d979c9e493 100755 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -1,8 +1,9 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2012 Marcos García +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Marcos García + * Copyright (C) 2012 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 @@ -40,7 +41,8 @@ $tmptype2label=getStaticMember(get_class($extrafields),'type2label'); $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); -$action=GETPOST("action"); +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); $elementtype='product'; if (!$user->admin) accessforbidden(); @@ -174,32 +176,32 @@ if ($action == 'create') /* Edition d'un champ optionnel */ /* */ /* ************************************************************************** */ -if ($_GET["attrname"] && $action == 'edit') +if ($action == 'edit' && ! empty($attrname)) { print "
"; - print_titre($langs->trans("FieldEdition",$_GET["attrname"])); + print_titre($langs->trans("FieldEdition", $attrname)); /* * formulaire d'edition */ - print ''; + print ''; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("Label").''.$langs->trans("Label").'
'.$langs->trans("AttributeCode").''.$_GET["attrname"].' '.$attrname.' 
'.$langs->trans("Type").''; print $type2label[$type]; diff --git a/htdocs/adherents/admin/mailman.php b/htdocs/adherents/admin/mailman.php index 5e7aa08f547..05dba9a696c 100644 --- a/htdocs/adherents/admin/mailman.php +++ b/htdocs/adherents/admin/mailman.php @@ -151,7 +151,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup'); -$head = mailmanspip_admin_prepare_head($adh); +$head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index 911b1e13f7f..37ae2d63c25 100755 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -1,7 +1,8 @@ - * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2011 Juanjo Menent +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2006-2012 Regis Houssin + * Copyright (C) 2011 Juanjo Menent * * 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 @@ -32,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; $langs->load("members"); $langs->load("admin"); -$action=GETPOST('action'); +$action=GETPOST('action', 'alpha'); if (! $user->admin) accessforbidden(); @@ -43,10 +44,15 @@ if (! $user->admin) accessforbidden(); if ($action == 'update') { - $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$_POST["MEMBER_ENABLE_PUBLIC"],'chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$_POST["MEMBER_NEWFORM_AMOUNT"],'chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$_POST["MEMBER_NEWFORM_EDITAMOUNT"],'chaine',0,'',$conf->entity); - $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$_POST["MEMBER_NEWFORM_PAYONLINE"],'chaine',0,'',$conf->entity); + $public=GETPOST('MEMBER_ENABLE_PUBLIC'); + $amount=GETPOST('MEMBER_NEWFORM_AMOUNT'); + $editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); + $payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE'); + + $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity); + $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity); + $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity); + $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -74,7 +80,7 @@ llxHeader('',$langs->trans("MembersSetup"),$help_url); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("MembersSetup"),$linkback,'setup'); -$head = member_admin_prepare_head($adh); +$head = member_admin_prepare_head(); dol_fiche_head($head, 'public', $langs->trans("Member"), 0, 'user'); @@ -123,7 +129,7 @@ print ''; print '
'; print $langs->trans("EnablePublicSubscriptionForm"); print ''; -print $form->selectyesno("MEMBER_ENABLE_PUBLIC",$conf->global->MEMBER_ENABLE_PUBLIC,1); +print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1); print "
'; print $langs->trans("DefaultAmount"); print ''; -print '';; +print '';; print "
'; print $langs->trans("CanEditAmount"); print ''; -print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",$conf->global->MEMBER_NEWFORM_EDITAMOUNT,1); +print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1); print "
'; // Label print ''; - print ''; + print ''; print ''; // Code print ''; print ''; - print ''; + print ''; print ''; // Type - $type=$extrafields->attribute_type[$_GET["attrname"]]; - $size=$extrafields->attribute_size[$_GET["attrname"]]; + $type=$extrafields->attribute_type[$attrname]; + $size=$extrafields->attribute_size[$attrname]; print ''; print '
'.$langs->trans("Label").''.$langs->trans("Label").'
'.$langs->trans("AttributeCode").''.$_GET["attrname"].' '.$attrname.' 
'.$langs->trans("Type").''; print $type2label[$type]; diff --git a/htdocs/societe/admin/societe_extrafields.php b/htdocs/societe/admin/societe_extrafields.php index 6c4e4966910..cb0fd9df275 100755 --- a/htdocs/societe/admin/societe_extrafields.php +++ b/htdocs/societe/admin/societe_extrafields.php @@ -1,7 +1,8 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 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 @@ -38,7 +39,8 @@ $tmptype2label=getStaticMember(get_class($extrafields),'type2label'); $type2label=array(''); foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); -$action=GETPOST("action"); +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); $elementtype='company'; if (!$user->admin) accessforbidden(); @@ -161,32 +163,32 @@ if ($action == 'create') /* Edition d'un champ optionnel */ /* */ /* ************************************************************************** */ -if ($_GET["attrname"] && $action == 'edit') +if ($action == 'edit' && ! empty($attrname)) { print "
"; - print_titre($langs->trans("FieldEdition",$_GET["attrname"])); + print_titre($langs->trans("FieldEdition", $attrname)); /* * formulaire d'edition */ - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; // Label print ''; - print ''; + print ''; print ''; // Code print ''; print ''; - print ''; + print ''; print ''; // Type - $type=$extrafields->attribute_type[$_GET["attrname"]]; - $size=$extrafields->attribute_size[$_GET["attrname"]]; + $type=$extrafields->attribute_type[$attrname]; + $size=$extrafields->attribute_size[$attrname]; print ''; print '
'.$langs->trans("Label").''.$langs->trans("Label").'
'.$langs->trans("AttributeCode").''.$_GET["attrname"].' '.$attrname.' 
'.$langs->trans("Type").''; print $type2label[$type];