From 6329c01d5d76517ef1f61579bd4b659a4989c3f1 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 1 Oct 2012 11:23:51 +0200 Subject: [PATCH 1/8] Added link to multi-origin invoicing on thirdparty page --- htdocs/comm/fiche.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 889f13c635e..2abee28066e 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -498,6 +498,7 @@ if ($id > 0) print ''; print ''; print ''; + print ''; print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')'.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'
'; print ''; } From 3e4fd761a597d6d90ab8b0887cbc0ede88a7a524 Mon Sep 17 00:00:00 2001 From: Spangaro Alexandre Date: Sun, 30 Sep 2012 11:52:15 +0200 Subject: [PATCH 2/8] Add function to choose chart of accounts --- htdocs/admin/accounting.php | 172 -------------------- htdocs/admin/compta.php | 79 ++++++++- htdocs/core/modules/modAccounting.class.php | 74 ++++----- htdocs/langs/fr_FR/admin.lang | 5 + htdocs/langs/fr_FR/compta.lang | 2 +- 5 files changed, 121 insertions(+), 211 deletions(-) delete mode 100644 htdocs/admin/accounting.php diff --git a/htdocs/admin/accounting.php b/htdocs/admin/accounting.php deleted file mode 100644 index 4928aa2a172..00000000000 --- a/htdocs/admin/accounting.php +++ /dev/null @@ -1,172 +0,0 @@ - - * Copyright (C) 2004-2009 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/admin/accounting.php - * \ingroup accounting - * \brief Page de configuration du module comptabilite expert - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; - -$langs->load('admin'); -$langs->load('compta'); - -if (!$user->admin) - accessforbidden(); - - - -$compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES'; - -if ($_POST['action'] == 'setcomptamode') -{ - $compta_mode = $_POST['compta_mode']; - if (! dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode,'chaine',0,'',$conf->entity)) { print $db->error(); } -} - - -$form = new Form($db); -$typeconst=array('yesno','texte','chaine'); - - -if ($_POST['action'] == 'update' || $_POST['action'] == 'add') -{ - if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '',$conf->entity)); - { - print $db->error(); - } -} - - -if ($_GET['action'] == 'delete') -{ - if (! dolibarr_del_const($db, $_GET['constname'],$conf->entity)); - { - print $db->error(); - } -} - - -/* - * View - */ - -llxHeader(); - -$form=new Form($db); - -$linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans('ComptaSetup'),$linkback,'setup'); - - -print '
'; - -print ''; - -// Cas du parametre COMPTA_MODE -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; -print ''; -print '\n"; -print ''; -print '\n"; -print ''; - -print "
'.$langs->trans('OptionMode').''.$langs->trans('Description').'
'.$langs->trans('OptionModeTrue').''.nl2br($langs->trans('OptionModeTrueDesc'))."
'.$langs->trans('OptionModeVirtual').''.$langs->trans('OptionModeVirtualDesc')."
\n"; - -print "
\n"; - -// Cas des autres param�tres COMPTA_* -/* -$sql ="SELECT rowid, name, value, type, note"; -$sql.=" FROM ".MAIN_DB_PREFIX."const"; -$sql.=" WHERE name like 'COMPTA_%' and name not in ('COMPTA_MODE')"; -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows($result); - $i = 0; - $var=true; - - if ($num) - { - print ''; - print ''; - print ''; - print "\n"; - } - - while ($i < $num) - { - $obj = $db->fetch_object($result); - $var=!$var; - - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print '\n"; - - print '\n"; - - print ''; - - $i++; - } - - if ($num) - { - print "
'.$langs->trans('OtherOptions').'
'.stripslashes(nl2br($obj->note))."'; - if ($obj->type == 'yesno') - { - print $form->selectyesno('constvalue',$obj->value,1); - } - elseif ($obj->type == 'texte') - { - print '\n"; - } - else - { - print ''; - } - print ''; - print '   '; - print "
\n"; - } -} -*/ - - -$db->close(); - - -llxFooter(); - -?> diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 6f45e70bc98..407dca5200d 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -2,7 +2,8 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2012 Alexandre Spangaro * * 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 @@ -56,6 +57,26 @@ if ($action == 'setcomptamode') } +$chartofaccounts = defined('CHARTOFACCOUNTS')?CHARTOFACCOUNTS:''; + +if ($action == 'setchart') +{ + $chartofaccounts = GETPOST('chartofaccounts','alpha'); + + $res = dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + if ($action == 'update' || $action == 'add') { $constname = GETPOST('constname','alpha'); @@ -130,6 +151,62 @@ print ''; print "\n"; +/* + * Define Chart of accounts + * + */ +if (! empty($conf->global->ACCOUNTING_SELECTCHART) && ! empty($conf->accounting->enabled)) +{ + print '
'; + print_titre($langs->trans("Definechartofaccounts")); + + print '
'; + print ''; + + print ''; + $var=True; + + print ''; + print ''; + print ''; + print "\n"; + $var=!$var; + print ''; + print ""; + print ""; + print "
'; + print ''; + print $langs->trans("Chartofaccounts").'
".$langs->trans("Selectchartofaccounts").""; + print '"; + print "
"; + print "
"; +} + print "
\n"; // Cas des autres parametres COMPTA_* diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 65e93734777..38a04db07f1 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -61,7 +61,7 @@ class modAccounting extends DolibarrModules $this->special = 0; // Config pages - $this->config_page_url = array("accounting.php"); + $this->config_page_url = array("compta.php"); // Dependancies $this->depends = array("modFacture","modBanque","modTax"); @@ -85,47 +85,47 @@ class modAccounting extends DolibarrModules $this->rights = array(); $this->rights_class = 'accounting'; - $this->rights[1][0] = 50401; - $this->rights[1][1] = 'Lire le plan de compte'; - $this->rights[1][2] = 'r'; - $this->rights[1][3] = 1; - $this->rights[1][4] = 'plancompte'; - $this->rights[1][5] = 'lire'; + $this->rights[$r][0] = 50401; + $this->rights[$r][1] = 'Lire le plan de compte'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'plancompte'; + $this->rights[$r][5] = 'lire'; - $this->rights[2][0] = 50402; - $this->rights[2][1] = 'Creer/modifier un plan de compte'; - $this->rights[2][2] = 'w'; - $this->rights[2][3] = 0; - $this->rights[2][4] = 'plancompte'; - $this->rights[2][5] = 'creer'; + $this->rights[$r][0] = 50402; + $this->rights[$r][1] = 'Creer/modifier un plan de compte'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'plancompte'; + $this->rights[$r][5] = 'creer'; - $this->rights[3][0] = 50403; - $this->rights[3][1] = 'Cloturer plan de compte'; - $this->rights[3][2] = 'w'; - $this->rights[3][3] = 0; - $this->rights[3][4] = 'plancompte'; - $this->rights[3][5] = 'cloturer'; + $this->rights[$r][0] = 50403; + $this->rights[$r][1] = 'Cloturer plan de compte'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'plancompte'; + $this->rights[$r][5] = 'cloturer'; - $this->rights[4][0] = 50411; - $this->rights[4][1] = 'Lire les mouvements comptables'; - $this->rights[4][2] = 'r'; - $this->rights[4][3] = 1; - $this->rights[4][4] = 'mouvements'; - $this->rights[4][5] = 'lire'; + $this->rights[$r][0] = 50411; + $this->rights[$r][1] = 'Lire les mouvements comptables'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'lire'; - $this->rights[5][0] = 50412; - $this->rights[5][1] = 'Creer/modifier/annuler les mouvements comptables'; - $this->rights[5][2] = 'w'; - $this->rights[5][3] = 0; - $this->rights[5][4] = 'mouvements'; - $this->rights[5][5] = 'creer'; + $this->rights[$r][0] = 50412; + $this->rights[$r][1] = 'Creer/modifier/annuler les mouvements comptables'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'creer'; - $this->rights[6][0] = 50415; - $this->rights[6][1] = 'Lire CA, bilans, resultats, journaux, grands livres'; - $this->rights[6][2] = 'r'; - $this->rights[6][3] = 0; - $this->rights[6][4] = 'comptarapport'; - $this->rights[6][5] = 'lire'; + $this->rights[$r][0] = 50415; + $this->rights[$r][1] = 'Lire CA, bilans, resultats, journaux, grands livres'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'comptarapport'; + $this->rights[$r][5] = 'lire'; } diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 5fd957fe11b..98f2a9df43d 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1355,3 +1355,8 @@ TestGeoIPResult=Test de conversion IP -> Pays ProjectsNumberingModules=Modèles de numérotation des références projets ProjectsSetup=Configuration du module Projets ProjectsModelModule=Modèles de document de rapport projets +#### Accountancy #### +Chartofaccounts=Plan comptable +Definechartofaccounts=Définir un plan comptable +Selectchartofaccounts=Sélection d'un plan comptable +DoNotSuggestChart=Ne pas suggérer de plan comptable diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index abc6603d4e6..ede4691ef72 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -159,4 +159,4 @@ RemainToDivide=Reste à répartir : WarningDepositsNotIncluded=Les factures d'accomptes ne sont pas encore prises en compte dans cette version avec ce module de comptabilité. Pcg_version=Version du plan Pcg_type=Classe de compte -Pcg_subtype=Sous classe de compte \ No newline at end of file +Pcg_subtype=Sous classe de compte From 8a99eedc6cb6655e4e1cb1fb3449d601511ea83a Mon Sep 17 00:00:00 2001 From: Spangaro Alexandre Date: Sun, 30 Sep 2012 14:40:31 +0200 Subject: [PATCH 3/8] Hum... Now it's work ! Little fix --- htdocs/admin/compta.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 407dca5200d..23e0ea845f1 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -57,8 +57,6 @@ if ($action == 'setcomptamode') } -$chartofaccounts = defined('CHARTOFACCOUNTS')?CHARTOFACCOUNTS:''; - if ($action == 'setchart') { $chartofaccounts = GETPOST('chartofaccounts','alpha'); @@ -176,7 +174,7 @@ if (! empty($conf->global->ACCOUNTING_SELECTCHART) && ! empty($conf->accounting- print ''; print "".$langs->trans("Selectchartofaccounts").""; print ""; - print ''; print ''; $sql = "SELECT rowid, pcg_version, fk_pays, label, active"; @@ -196,7 +194,7 @@ if (! empty($conf->global->ACCOUNTING_SELECTCHART) && ! empty($conf->accounting- print ''; + print '>'.$row[1].' - '.$row[3].''; $i++; } From 5c56bd629ba8e46d58720e7ac4ec2bae4a6b9b19 Mon Sep 17 00:00:00 2001 From: Spangaro Alexandre Date: Sun, 30 Sep 2012 17:10:41 +0200 Subject: [PATCH 4/8] Fix: add country in request --- htdocs/admin/compta.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 23e0ea845f1..33ebec240b1 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -180,7 +180,7 @@ if (! empty($conf->global->ACCOUNTING_SELECTCHART) && ! empty($conf->accounting- $sql = "SELECT rowid, pcg_version, fk_pays, label, active"; $sql.= " FROM ".MAIN_DB_PREFIX."accountingsystem"; $sql.= " WHERE active = 1"; -// $sql.= " AND fk_pays = ".substr($conf->global->MAIN_INFO_SOCIETE_PAYS,0,1); Ne fonctionne pas avec un rowid pays > 9 + $sql.= " AND fk_pays = ".$mysoc->country_id; $var=True; $resql=$db->query($sql); if ($resql) From 3ae6117e16336e35ad4d9b18bc15bbf5cfd8cf90 Mon Sep 17 00:00:00 2001 From: Spangaro Alexandre Date: Tue, 2 Oct 2012 06:07:57 +0200 Subject: [PATCH 5/8] Reintegrate accounting.php in admin --- htdocs/admin/accounting.php | 283 ++++++++++++++++++++ htdocs/admin/compta.php | 75 ------ htdocs/core/modules/modAccounting.class.php | 2 +- 3 files changed, 284 insertions(+), 76 deletions(-) create mode 100644 htdocs/admin/accounting.php diff --git a/htdocs/admin/accounting.php b/htdocs/admin/accounting.php new file mode 100644 index 00000000000..571fc5a5672 --- /dev/null +++ b/htdocs/admin/accounting.php @@ -0,0 +1,283 @@ + + * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2011-2012 Alexandre Spangaro + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/admin/accounting.php + * \ingroup compta + * \brief Page to setup accountancy module + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + +$langs->load('admin'); +$langs->load('compta'); + +if (!$user->admin) +accessforbidden(); + +$action = GETPOST('action','alpha'); + +$compta_mode = defined('COMPTA_MODE')?COMPTA_MODE:'RECETTES-DEPENSES'; + +if ($action == 'setcomptamode') +{ + $compta_mode = GETPOST('compta_mode','alpha'); + + $res = dolibarr_set_const($db, 'COMPTA_MODE', $compta_mode,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } + +} + +if ($action == 'setchart') +{ + $chartofaccounts = GETPOST('chartofaccounts','alpha'); + + $res = dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + +if ($action == 'update' || $action == 'add') +{ + $constname = GETPOST('constname','alpha'); + $constvalue = GETPOST('constvalue','alpha'); + $consttype = GETPOST('consttype','alpha'); + $constnote = GETPOST('constnote','alpha'); + + $res = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } +} + + +/*if ($action == 'delete') +{ + if (! dolibarr_del_const($db, $_GET['constname'],$conf->entity)); + { + print $db->error(); + } +}*/ + +/* + * Affichage page + */ + +llxHeader(); + +$form=new Form($db); + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans('ComptaSetup'),$linkback,'setup'); + + +print '
'; + +print ''; + +// Cas du parametre COMPTA_MODE +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; +print ''; +print '\n"; +print ''; +print '\n"; +print ''; + +print "
'.$langs->trans('OptionMode').''.$langs->trans('Description').'
'.$langs->trans('OptionModeTrue').''.nl2br($langs->trans('OptionModeTrueDesc')); +// Write info on way to count VAT +if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) +{ + // print "
\n"; + // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite')); +} +else +{ + // print "
\n"; + // print nl2br($langs->trans('OptionModeTrueInfoExpert')); +} +print "
'.$langs->trans('OptionModeVirtual').''.nl2br($langs->trans('OptionModeVirtualDesc'))."
\n"; + +/* + * Define Chart of accounts + * + */ +if (! empty($conf->global->ACCOUNTING_SELECTCHART) && ! empty($conf->accounting->enabled)) +{ + print '
'; + print_titre($langs->trans("Definechartofaccounts")); + + print '
'; + print ''; + + print ''; + $var=True; + + print ''; + print ''; + print ''; + print "\n"; + $var=!$var; + print ''; + print ""; + print ""; + print "
'; + print ''; + print $langs->trans("Chartofaccounts").'
".$langs->trans("Selectchartofaccounts").""; + print '"; + print "
"; + print "
"; +} + +print "
\n"; + +// Cas des autres parametres COMPTA_* +$list=array('COMPTA_PRODUCT_BUY_ACCOUNT','COMPTA_PRODUCT_SOLD_ACCOUNT','COMPTA_SERVICE_BUY_ACCOUNT','COMPTA_SERVICE_SOLD_ACCOUNT', +'COMPTA_VAT_ACCOUNT','COMPTA_ACCOUNT_CUSTOMER','COMPTA_ACCOUNT_SUPPLIER' +); + +/*$sql = "SELECT rowid, name, value, type, note"; +$sql.= " FROM ".MAIN_DB_PREFIX."const"; +$sql.= " WHERE name LIKE 'COMPTA_%'"; +$sql.= " AND name NOT IN ('COMPTA_MODE')"; +$sql.= " AND entity = ".$conf->entity; +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $i = 0; + + while ($i < $num) + { + $obj = $db->fetch_object($result); + $var=!$var; + $list[$obj->name]=$obj->value; + $i++; + } +}*/ + +$num=count($list); +if ($num) +{ + print ''; + print ''; + print ''; + print "\n"; +} + +foreach ($list as $key) +{ + $var=!$var; + + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + + // Param + $libelle = $langs->trans($key); + print '\n"; + + // Value + print '\n"; + print ''; + + $i++; +} + +if ($num) +{ + print "
'.$langs->trans('OtherOptions').'
'.$libelle; + //print ' ('.$key.')'; + print "'; + print ''; + print ''; + print '   '; + print "
\n"; +} + +dol_htmloutput_mesg($mesg); + +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 33ebec240b1..6f3fc1a52a0 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -3,7 +3,6 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2011-2012 Alexandre Spangaro * * 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 @@ -57,24 +56,6 @@ if ($action == 'setcomptamode') } -if ($action == 'setchart') -{ - $chartofaccounts = GETPOST('chartofaccounts','alpha'); - - $res = dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - $mesg = "".$langs->trans("SetupSaved").""; - } - else - { - $mesg = "".$langs->trans("Error").""; - } -} - if ($action == 'update' || $action == 'add') { $constname = GETPOST('constname','alpha'); @@ -149,62 +130,6 @@ print ''; print "\n"; -/* - * Define Chart of accounts - * - */ -if (! empty($conf->global->ACCOUNTING_SELECTCHART) && ! empty($conf->accounting->enabled)) -{ - print '
'; - print_titre($langs->trans("Definechartofaccounts")); - - print '
'; - print ''; - - print ''; - $var=True; - - print ''; - print ''; - print ''; - print "\n"; - $var=!$var; - print ''; - print ""; - print ""; - print "
'; - print ''; - print $langs->trans("Chartofaccounts").'
".$langs->trans("Selectchartofaccounts").""; - print '"; - print "
"; - print "
"; -} - print "
\n"; // Cas des autres parametres COMPTA_* diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 38a04db07f1..84f13e501db 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -61,7 +61,7 @@ class modAccounting extends DolibarrModules $this->special = 0; // Config pages - $this->config_page_url = array("compta.php"); + $this->config_page_url = array("accounting.php"); // Dependancies $this->depends = array("modFacture","modBanque","modTax"); From 3ca55eb058b9c170a2178aeaf6fefe28bdb10202 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 2 Oct 2012 10:52:08 +0200 Subject: [PATCH 6/8] Task # 104 : display invoice multi order link on third party page only if there are orders to bill + translations --- htdocs/comm/fiche.php | 29 +- htdocs/comm/propal/propalstoorder.php | 688 +++++++++++++++++++++++++ htdocs/compta/facture_multi_origin.php | 213 ++++++++ 3 files changed, 923 insertions(+), 7 deletions(-) create mode 100755 htdocs/comm/propal/propalstoorder.php create mode 100644 htdocs/compta/facture_multi_origin.php diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 2abee28066e..bd3b96977c1 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -493,14 +493,29 @@ if ($id > 0) if ($num > 0) { - print ''; + // Check if there are orders billable + $sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,'; + $sql2.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee'; + $sql2.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; + $sql2.= ', '.MAIN_DB_PREFIX.'commande as c'; + $sql2.= ' WHERE c.fk_soc = s.rowid'; + $sql2.= ' AND s.rowid = '.$object->id; + // Show orders with status validated, shipping started and delivered (well any order we can bill) + $sql2.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; + + $resql2=$db->query($sql2); + $num2 = $db->num_rows($resql2); + $db->free($resql2); + + print '
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } $i = 0; diff --git a/htdocs/comm/propal/propalstoorder.php b/htdocs/comm/propal/propalstoorder.php new file mode 100755 index 00000000000..77905ed3170 --- /dev/null +++ b/htdocs/comm/propal/propalstoorder.php @@ -0,0 +1,688 @@ + + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Andreu Bisquerra Gaya + * Copyright (C) 2012 David Rodriguez Martinez + * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012 Maxime Kohlhaas + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/comm/propal/propalstoorder.php + * \ingroup propal + * \brief Page to order multiple propals + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; +if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; + +$langs->load('orders'); +$langs->load('deliveries'); +$langs->load('companies'); + +if (! $user->rights->commande->creer) + accessforbidden(); + +$id = (GETPOST('id')?GETPOST("id"):GETPOST("facid")); // For backward compatibility +$ref = GETPOST('ref','alpha'); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); +$sref = GETPOST('sref'); +$sref_client = GETPOST('sref_client'); +$sall = GETPOST('sall'); +$socid = GETPOST('socid','int'); + + +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +if (! $sortfield) $sortfield='p.rowid'; +if (! $sortorder) $sortorder='DESC'; + +$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server +$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +$date_starty=dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server +$date_endy=dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]); +$selected=GETPOST('propals_to_order'); +$action=GETPOST('action','alpha'); +if ($action == 'create') +{ + if (! is_array($selected)) + { + $mesgs[]='
'.$langs->trans('Error_OrderNotChecked').'
'; + } + else + { + $socid=GETPOST('socid'); + $action=GETPOST('action'); + $origin=GETPOST('origin'); + $originid=GETPOST('originid'); + } +} +$now=dol_now(); + +$viewstatut=GETPOST('viewstatut'); + + +/* + * Actions + */ + +if (($action == 'create' || $action == 'add') && empty($mesgs)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; + } + $langs->load('bills'); + $langs->load('products'); + $langs->load('main'); + if (isset($_GET['propals_to_order'])) + { + $orders_id = $_GET['propals_to_order']; + $n = count($orders_id); + $i = 0; + + $originid=$orders_id[0]; + $_GET['originid']=$orders_id[0]; + + } + if (isset($_POST['propals_to_order'])) + { + $orders_id = $_POST['propals_to_order']; + $nn = count($orders_id); + $ii = 0; + + $originid=$orders_id[0]; + $_POST['originid']=$orders_id[0]; + + } + + $projectid = GETPOST('projectid','int')?GETPOST('projectid','int'):0; + $lineid = GETPOST('lineid','int'); + $userid = GETPOST('userid','int'); + $search_ref = GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref'); + $closeOrders = GETPOST('autocloseorders') != '' ? true : false; + + // Security check + $fieldid = GETPOST('ref','alpha')?'facnumber':'rowid'; + if ($user->societe_id) $socid=$user->societe_id; + $result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid); + + $usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE; + $object=new Facture($db); + + // Insert new invoice in database + if ($action == 'add' && $user->rights->facture->creer) + { + $object->socid=GETPOST('socid'); + $db->begin(); + $error=0; + + // Standard or deposit or proforma invoice + if ($_POST['type'] == 0 ) + { + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($datefacture)) + { + $datefacture = dol_mktime(12, 0, 0, date("m"), date("d"), date("Y")); + } + if (! $error) + { + // Si facture standard + $object->socid = $_POST['socid']; + $object->type = $_POST['type']; + $object->number = $_POST['facnumber']; + $object->date = $datefacture; + $object->note_public = trim($_POST['note_public']); + $object->note = trim($_POST['note']); + $object->ref_client = $_POST['ref_client']; + $object->ref_int = $_POST['ref_int']; + $object->modelpdf = $_POST['model']; + $object->fk_project = $_POST['projectid']; + $object->cond_reglement_id = ($_POST['type'] == 3?1:$_POST['cond_reglement_id']); + $object->mode_reglement_id = $_POST['mode_reglement_id']; + $object->amount = $_POST['amount']; + $object->remise_absolue = $_POST['remise_absolue']; + $object->remise_percent = $_POST['remise_percent']; + + if ($_POST['origin'] && $_POST['originid']) + { + $object->origin = $_POST['origin']; + $object->origin_id = $orders_id[$ii]; + $object->linked_objects = $orders_id; + $id = $object->create($user); + + if ($id>0) + { + foreach($orders_id as $origin => $origin_id) + { + $origin_id = (! empty($origin_id) ? $origin_id : $object->origin_id); + $db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; + $sql.= "fk_source"; + $sql.= ", sourcetype"; + $sql.= ", fk_target"; + $sql.= ", targettype"; + $sql.= ") VALUES ("; + $sql.= $origin_id; + $sql.= ", '".$object->origin."'"; + $sql.= ", ".$id; + $sql.= ", '".$object->element."'"; + $sql.= ")"; + + if ($db->query($sql)) + { + $db->commit(); + } + else + { + $db->rollback(); + } + } + + while ($ii < $nn) + { + dol_include_once('/commande/class/commande.class.php'); + $srcobject = new Commande($db); + dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); + $result=$srcobject->fetch($orders_id[$ii]); + if ($result > 0) + { + if($closeOrders) { + $srcobject->classer_facturee(); + $srcobject->setStatut(3); + } + $lines = $srcobject->lines; + if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); + $fk_parent_line=0; + $num=count($lines); + for ($i=0;$i<$num;$i++) + { + $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + if ($lines[$i]->subprice < 0) + { + // Negative line, we create a discount line + $discount = new DiscountAbsolute($db); + $discount->fk_soc=$object->socid; + $discount->amount_ht=abs($lines[$i]->total_ht); + $discount->amount_tva=abs($lines[$i]->total_tva); + $discount->amount_ttc=abs($lines[$i]->total_ttc); + $discount->tva_tx=$lines[$i]->tva_tx; + $discount->fk_user=$user->id; + $discount->description=$desc; + $discountid=$discount->create($user); + if ($discountid > 0) + { + $result=$object->insert_discount($discountid); + //$result=$discount->link_to_invoice($lineid,$id); + } + else + { + $mesgs[]=$discount->error; + $error++; + break; + } + } + else + { + // Positive line + $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + // Date start + $date_start=false; + if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; + //Date end + $date_end=false; + if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) + { + $fk_parent_line = 0; + } + $result = $object->addline( + $id, + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $date_start, + $date_end, + 0, + $lines[$i]->info_bits, + $lines[$i]->fk_remise_except, + 'HT', + 0, + $product_type, + $lines[$i]->rang, + $lines[$i]->special_code, + $object->origin, + $lines[$i]->rowid, + $fk_parent_line + ); + if ($result > 0) + { + $lineid=$result; + } + else + { + $lineid=0; + $error++; + break; + } + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) + { + $fk_parent_line = $result; + } + } + } + } + else + { + $mesgs[]=$srcobject->error; + $error++; + } + $ii++; + } + } + else + { + $mesgs[]=$object->error; + $error++; + } + } + } + } + + // End of object creation, we show it + if ($id > 0 && ! $error) + { + $db->commit(); + header('Location: '.DOL_URL_ROOT.'/compta/facture.php?facid='.$id); + exit; + } + else + { + $db->rollback(); + $action='create'; + $_GET["origin"]=$_POST["origin"]; + $_GET["originid"]=$_POST["originid"]; + $mesgs[]='
'.$object->error.'
'; + } + } +} + + +/* + * View + */ + +$html = new Form($db); +$htmlother = new FormOther($db); +$formfile = new FormFile($db); +$companystatic = new Societe($db); + +// Mode creation +if ($action == 'create') +{ + $facturestatic=new Facture($db); + + llxHeader(); + print_fiche_titre($langs->trans('NewBill')); + + $soc = new Societe($db); + if ($socid) $res=$soc->fetch($socid); + if ($res) + { + $cond_reglement_id = $soc->cond_reglement_id; + $mode_reglement_id = $soc->mode_reglement_id; + $remise_percent = $soc->remise_percent; + } + $remise_absolue = 0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + + $absolute_discount=$soc->getAvailableDiscounts(); + print '
'; + print ''; + print ''; + print '' ."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; - print ''; - print ''; - print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')'.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'
'; + print ''; + if($num2 > 0) print ''; + else print ''; + print '
'.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')'.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'
'; + // Ref + print ''; + // Tiers + print ''; + print ''."\n"; + print ''; + // Payment term + print ''; + // Payment mode + print ''; + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load('projects'); + print ''; + } + // Modele PDF + print ''; + print '"; + + // Public note + print ''; + print ''; + print ''; + // Private note + if (! $user->societe_id) + { + print ''; + print ''; + print ''; + } + + print '
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Customer').''; + print $soc->getNomUrl(1); + print ''; + print '
'.$langs->trans('Type').''; + print ''."\n"; + // Standard invoice + print ''."\n"; + print '
'; + print ''; + print ''; + $desc=$html->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1); + print $desc; + print '
'; + + // Date invoice + print '
'.$langs->trans('Date').''; + $html->select_date(0,'','','','',"add",1,1); + print '
'.$langs->trans('PaymentConditionsShort').''; + $html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id'); + print '
'.$langs->trans('PaymentMode').''; + $html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id'); + print '
'.$langs->trans('Project').''; + select_projects($soc->id, $projectid, 'projectid'); + print '
'.$langs->trans('Model').''; + include_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; + $liste=ModelePDFFactures::liste_modeles($db); + print $html->selectarray('model',$liste,$conf->global->FACTURE_ADDON_PDF); + print "
'.$langs->trans('NotePublic').''; + print '
'.$langs->trans('NotePrivate').''; + print '
'; + + while ($i < $n) + { + print ''; + + $i++; + } + + // Button "Create Draft" + print '
'; + print "\n"; + + print ''; + print "\n"; +} + + +//Mode liste +if (($action != 'create' && $action != 'add') || ! empty($mesgs)) +{ + llxHeader(); + ?> + + rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ' WHERE p.entity = '.$conf->entity; + $sql.= ' AND p.fk_soc = s.rowid'; + + // Show orders with status validated, shipping started and delivered (well any order we can bill) + $sql.= " AND p.fk_statut IN (1,2)"; + + if ($socid) $sql.= ' AND s.rowid = '.$socid; + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($sref) + { + $sql.= " AND p.ref LIKE '%".$db->escape($sref)."%'"; + } + if ($sall) + { + $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')"; + } + + //Date filter + if ($date_start && $date_end) $sql.= " AND p.date_valid >= '".$db->idate($date_start)."' AND p.date_valid <= '".$db->idate($date_end)."'"; + if ($date_starty && $date_endy) $sql.= " AND p.fin_validite >= '".$db->idate($date_starty)."' AND p.fin_validite <= '".$db->idate($date_endy)."'"; + + if (!empty($sref_client)) + { + $sql.= ' AND p.ref_client LIKE \'%'.$db->escape($sref_client).'%\''; + } + $sql.= ' ORDER BY '.$sortfield.' '.$sortorder; + $resql = $db->query($sql); + + if ($resql) + { + if ($socid) + { + $soc = new Societe($db); + $soc->fetch($socid); + } + $title.= $langs->trans('ListOfProposals').' - '.$langs->trans('PropalStatusOpened').', '.$langs->trans("PropalStatusSigned"); + $num = $db->num_rows($resql); + print_fiche_titre($title); + $i = 0; + $period=$html->select_date($date_start,'date_start',0,0,1,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,1,'',1,0,1); + $periodely=$html->select_date($date_starty,'date_start_dely',0,0,1,'',1,0,1).' - '.$html->select_date($date_endy,'date_end_dely',0,0,1,'',1,0,1); + + if (! empty($socid)) + { + // Company + $companystatic->id=$socid; + $companystatic->nom=$soc->nom; + print '

'.$companystatic->getNomUrl(1,'customer').'

'; + } + + print ''; + print ''; + print_liste_field_titre($langs->trans('Ref'),'propalstoorder.php','p.ref','','&socid='.$socid,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('RefCustomerOrder'),'propalstoorder.php','p.ref_client','','&socid='.$socid,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),'propalstoorder.php','p.date_valid','','&socid='.$socid, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('DateEndPropal'),'propalstoorder.php','p.fin_validite','','&socid='.$socid, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Status'),'','','','','align="right"'); + print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"'); + print ''; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + //print ''; + + //DATE DELIVERY + print ''; + + //SEARCH BUTTON + print ''; + + print ''; + print ''; + + print ''; + $var=True; + $generic_propal = new Propal($db); + + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ''; + print ''; + + print ''; + + // Validation date + print ''; + + // Limit valid date + print ''; + + // Statut + print ''; + + // Checkbox + print '' ; + + print ''; + + $total = $total + $objp->price; + $subtotal = $subtotal + $objp->price; + $i++; + } + print '
'; + //REF + print ''; + print ''; + print ''; + print ''; + + //DATE ORDER + print ''; + print $period; + print ''; + print $periodely; + print ''; + print ''; + + //ALL/NONE + print ''; + if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; + print '
'; + + $generic_propal->id=$objp->rowid; + $generic_propal->ref=$objp->ref; + + print ''; + print ''; + + print ''; + + print '
'; + print $generic_propal->getNomUrl(1); + print ''; + if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $db->jdate($objp->fin_validite) < ($now - $conf->propal->client->warning_delay)) print img_picto($langs->trans("Late"),"warning"); + print ''; + $filename=dol_sanitizeFileName($objp->ref); + $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($objp->ref); + $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; + print $formfile->getDocumentsLink($generic_propal->element, $filename, $filedir); + print '
'; + print '
'.$objp->ref_client.''; + print dol_print_date($db->jdate($objp->date_valid),'day'); + print ''; + print dol_print_date($db->jdate($objp->fin_validite),'day'); + print ''.$generic_propal->LibStatut($objp->fk_statut,5).''; + print ''; + print '
'; + + /* + * Boutons actions + */ + print '
'; + print ''; + print ''; + print '
'; + print ''.$langs->trans("GoBack").''; + print ''; + print '

'.$langs->trans("ClosePropalsAutomatically"); + print '
'; + print ''; + $db->free($resql); + } + else + { + print dol_print_error($db); + } + +} + +dol_htmloutput_mesg($mesg,$mesgs); + +llxFooter(); +$db->close(); +?> \ No newline at end of file diff --git a/htdocs/compta/facture_multi_origin.php b/htdocs/compta/facture_multi_origin.php new file mode 100644 index 00000000000..0d6424f3ecd --- /dev/null +++ b/htdocs/compta/facture_multi_origin.php @@ -0,0 +1,213 @@ +global->FACTURE_MULTI_ORIGIN) include_once(DOL_DOCUMENT_ROOT.'/compta/facture_multi_origin.php'); + +if(empty($origin)) return 0; +else if ($origin == 'commande') { + + // Show other origin objects mergeable into same invoice + print_titre($langs->trans('OtherOrders')); + + // Display list of elements + // 1 - Filters + $sref = GETPOST('sref'); + $sref_client = GETPOST('sref_client'); + $sall = GETPOST('sall'); + $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server + $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); + $date_starty=dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server + $date_endy=dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]); + + $sortfield = GETPOST("sortfield",'alpha'); + $sortorder = GETPOST("sortorder",'alpha'); + if (! $sortfield) $sortfield='c.rowid'; + if (! $sortorder) $sortorder='DESC'; + + $html = new Form($db); + $htmlother = new FormOther($db); + $formfile = new FormFile($db); + $companystatic = new Societe($db); + + // 2 - Query for orders + $sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,'; + $sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; + $sql.= ', '.MAIN_DB_PREFIX.'commande as c'; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ' WHERE c.entity = '.$conf->entity; + $sql.= ' AND c.fk_soc = s.rowid'; + + // Show orders with status validated, shipping started and delivered (well any order we can bill) + $sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; + + if ($socid) $sql.= ' AND s.rowid = '.$socid; + if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($sref) + { + $sql.= " AND c.ref LIKE '%".$db->escape($sref)."%'"; + } + if ($sall) + { + $sql.= " AND (c.ref LIKE '%".$db->escape($sall)."%' OR c.note LIKE '%".$db->escape($sall)."%')"; + } + if (!empty($sref_client)) + { + $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\''; + } + + // Date filter + if ($date_start && $date_end) $sql.= " AND c.date_commande >= '".$db->idate($date_start)."' AND c.date_commande <= '".$db->idate($date_end)."'"; + if ($date_starty && $date_endy) $sql.= " AND c.date_livraison >= '".$db->idate($date_starty)."' AND c.date_livraison <= '".$db->idate($date_endy)."'"; + + $sql.= ' ORDER BY '.$sortfield.' '.$sortorder; + $resql = $db->query($sql); + + if ($resql) + { + if ($socid) + { + $soc = new Societe($db); + $soc->fetch($socid); + } + $num = $db->num_rows($resql); + + $i = 0; + $period=$html->select_date($date_start,'date_start',0,0,1,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,1,'',1,0,1); + $periodely=$html->select_date($date_starty,'date_start_dely',0,0,1,'',1,0,1).' - '.$html->select_date($date_endy,'date_end_dely',0,0,1,'',1,0,1); + + print ''; + print ''; + print_liste_field_titre($langs->trans('Ref'),'orderstoinvoice.php','c.ref','','&socid='.$socid,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('RefCustomerOrder'),'orderstoinvoice.php','c.ref_client','','&socid='.$socid,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('OrderDate'),'orderstoinvoice.php','c.date_commande','','&socid='.$socid, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('DeliveryDate'),'orderstoinvoice.php','c.date_livraison','','&socid='.$socid, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Status'),'','','','','align="right"'); + print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"'); + print ''; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + + //DATE DELIVERY + print ''; + + //SEARCH BUTTON + print ''; + + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + $var=True; + $generic_commande = new Commande($db); + + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ''; + print ''; + + print ''; + + // Order date + print ''; + + //Delivery date + print ''; + + // Statut + print ''; + + // Checkbox + print '' ; + + print ''; + + $total = $total + $objp->price; + $subtotal = $subtotal + $objp->price; + $i++; + } + print '
'; + //REF + print ''; + print ''; + print ''; + print ''; + + //DATE ORDER + print ''; + print $period; + print ''; + print $periodely; + print ''; + print ''; + + //ALL/NONE + print ''; + if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; + print '
'; + + $generic_commande->id=$objp->rowid; + $generic_commande->ref=$objp->ref; + + print ''; + print ''; + + print ''; + + print '
'; + print $generic_commande->getNomUrl(1,$objp->fk_statut); + print ''; + if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $db->jdate($objp->date_valid) < ($now - $conf->commande->client->warning_delay)) print img_picto($langs->trans("Late"),"warning"); + print ''; + $filename=dol_sanitizeFileName($objp->ref); + $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); + $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid; + print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir); + print '
'; + print '
'.$objp->ref_client.''; + print dol_print_date($db->jdate($objp->date_commande),'day'); + print ''; + print dol_print_date($db->jdate($objp->date_livraison),'day'); + print ''.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).''; + print ''; + print '
'; + print '

'.$langs->trans("CloseProcessedOrdersAutomatically"); + // Button "Create Draft" + print '
'; + print ''; + $db->free($resql); + ?> + + \ No newline at end of file From 085923dc646ba3faad8761374fb3c2a2a1688159 Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Tue, 2 Oct 2012 18:27:41 +0200 Subject: [PATCH 7/8] try to fix canvas within members module --- htdocs/adherents/fiche.php | 1756 ++++++++++++++++++------------------ 1 file changed, 895 insertions(+), 861 deletions(-) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 7ca413a0c4a..df281e9bf09 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -52,7 +52,7 @@ $userid=GETPOST('userid','int'); $socid=GETPOST('socid','int'); // Security check -$result=restrictedArea($user,'adherent',$rowid); +$result=restrictedArea($user,'adherent',$rowid,'','','fk_soc', 'rowid', $objcanvas); if (! empty($conf->mailmanspip->enabled)) { @@ -66,6 +66,17 @@ if (! empty($conf->mailmanspip->enabled)) $object = new Adherent($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(); if ($rowid > 0) @@ -104,7 +115,7 @@ $hookmanager->initHooks(array('membercard')); * 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 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') { $error=0; @@ -184,6 +197,7 @@ if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user $errmsg=$object->error; } } +else $object->canvas=$canvas; // Create third party from a member 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; } } +else $object->canvas=$canvas; if ($action == 'confirm_sendinfo' && $confirm == 'yes') { @@ -677,925 +692,944 @@ llxHeader('',$langs->trans("Member"),$help_url); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -if ($action == 'create') +if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { - /* ************************************************************************** */ - /* */ - /* Fiche creation */ - /* */ - /* ************************************************************************** */ - $object->fk_departement = $_POST["departement_id"]; - - // We set country_id, country_code and country for the selected country - $object->country_id=GETPOST('country_id','int')?GETPOST('country_id','int'):$mysoc->country_id; - if ($object->country_id) - { - $tmparray=getCountry($object->country_id,'all'); - $object->pays_code=$tmparray['code']; - $object->pays=$tmparray['code']; - $object->country_code=$tmparray['code']; - $object->country=$tmparray['label']; - } - - $adht = new AdherentType($db); - - print_fiche_titre($langs->trans("NewMember")); - - dol_htmloutput_mesg($errmsg,$errmsgs,'error'); - dol_htmloutput_mesg($mesg,$mesgs); - - if ($conf->use_javascript_ajax) - { - print "\n".''."\n"; - } - - print '
'; - print ''; - print ''; - - print ''; - - // Login - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - print ''; - } - - // Moral-Physique - $morphys["phy"] = $langs->trans("Physical"); - $morphys["mor"] = $langs->trans("Moral"); - print '\n"; - - // Type - print '\n"; - - // Company - print ''; - - // Civility - print ''; - print ''; - - // Lastname - print ''; - print ''; - - // Firstname - print ''; - print ''; - - // Password - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $generated_password=getRandomPassword(''); - print ''; - } - - // Address - print ''; - - // Zip / Town - print ''; - - // Country - $object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; - print ''; - - // State - if (empty($conf->global->MEMBER_DISABLE_STATE)) - { - print ''; - } - - // Tel pro - print ''; - - // Tel perso - print ''; - - // Tel mobile - print ''; - - // EMail - print ''; - - // Birthday - print "\n"; - - // Profil public - print "\n"; - - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?GETPOST('options_'.$key,'alpha'):$object->array_options["options_".$key]); - print ''."\n"; - } - } - - /* - // Third party Dolibarr - if (! empty($conf->societe->enabled)) - { - print ''; - } - - // Login Dolibarr - print ''; - */ - - print "
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Nature")."\n"; - print $form->selectarray("morphy", $morphys, GETPOST('morphy','alpha')?GETPOST('morphy','alpha'):$object->morphy, 1); - print "
'.$langs->trans("MemberType").''; - $listetype=$adht->liste_array(); - if (count($listetype)) - { - print $form->selectarray("typeid", $listetype, GETPOST('typeid','int')?GETPOST('typeid','int'):$typeid, count($listetype)>1?1:0); - } else { - print ''.$langs->trans("NoTypeDefinedGoToSetup").''; - } - print "
'.$langs->trans("Company").'
'.$langs->trans("UserTitle").''; - print $formcompany->select_civility(GETPOST('civilite_id','int')?GETPOST('civilite_id','int'):$object->civilite_id,'civilite_id').'
'.$langs->trans("Lastname").'
'.$langs->trans("Firstname").'
'.$langs->trans("Password").''; - print ''; - print '
'.$langs->trans("Address").''; - print ''; - print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; - print $formcompany->select_ziptown((GETPOST('zipcode','alpha')?GETPOST('zipcode','alpha'):$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6); - print ' '; - print $formcompany->select_ziptown((GETPOST('town','alpha')?GETPOST('town','alpha'):$object->town),'town',array('zipcode','selectcountry_id','departement_id')); - print '
'.$langs->trans('Country').''; - print $form->select_country(GETPOST('country_id','alpha')?GETPOST('country_id','alpha'):$object->country_id,'country_id'); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); - print '
'.$langs->trans('State').''; - if ($object->country_id) - { - print $formcompany->select_state(GETPOST('departement_id','int')?GETPOST('departement_id','int'):$object->fk_departement,$object->country_code); - } - else - { - print $countrynotdefined; - } - print '
'.$langs->trans("PhonePro").'
'.$langs->trans("PhonePerso").'
'.$langs->trans("PhoneMobile").'
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'
".$langs->trans("Birthday")."\n"; - $form->select_date(($object->naiss ? $object->naiss : -1),'naiss','','',1,'formsoc'); - print "
".$langs->trans("Public")."\n"; - print $form->selectyesno("public",$object->public,1); - print "
'.$label.''; - print $extrafields->showInputField($key,$value); - print '
'.$langs->trans("LinkedToDolibarrThirdParty").''; - print $form->select_company($object->fk_soc,'socid','',1); - print '
'.$langs->trans("LinkedToDolibarrUser").''; - print $form->select_users($object->user_id,'userid',1); - print '
\n"; - print '
'; - - print '
'; - - print "
\n"; - + // ----------------------------------------- + // 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 } - -if ($action == 'edit') +else { - /******************************************** - * - * Fiche en mode edition - * - ********************************************/ + // ----------------------------------------- + // When used in standard mode + // ----------------------------------------- - $res=$object->fetch($rowid); - if ($res < 0) { dol_print_error($db,$object->error); exit; } - $res=$object->fetch_optionals($object->id,$extralabels); - if ($res < 0) { dol_print_error($db); exit; } - - $adht = new AdherentType($db); - $adht->fetch($object->typeid); - - // We set country_id, and country_code, country of the chosen country - if (isset($_POST["pays"]) || $object->country_id) + if ($action == 'create') { - $sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["pays"])?$_POST["pays"]:$object->country_id); - $resql=$db->query($sql); - if ($resql) + /* ************************************************************************** */ + /* */ + /* Fiche creation */ + /* */ + /* ************************************************************************** */ + $object->fk_departement = $_POST["departement_id"]; + + // We set country_id, country_code and country for the selected country + $object->country_id=GETPOST('country_id','int')?GETPOST('country_id','int'):$mysoc->country_id; + if ($object->country_id) { - $obj = $db->fetch_object($resql); - } - else - { - dol_print_error($db); - } - $object->pays_id=$obj->rowid; - $object->pays_code=$obj->code; - $object->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; - $object->country_id=$obj->rowid; - $object->country_code=$obj->code; - $object->country=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; - } - - $head = member_prepare_head($object); - - dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); - - dol_htmloutput_errors($errmsg,$errmsgs); - dol_htmloutput_mesg($mesg); - - if ($conf->use_javascript_ajax) - { - print "\n".''."\n"; - } - - $rowspan=15; - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; - if (! empty($conf->societe->enabled)) $rowspan++; - - print '
'; - print ''; - print ''; - print ''; - print ''; - if ($backtopage) print ''; - - print ''; - - // Ref - print ''; - - // Login - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - print ''; - } - - // Physique-Moral - $morphys["phy"] = $langs->trans("Physical"); - $morphys["mor"] = $langs->trans("Morale"); - print '"; - // Photo - print ''; - - // Type - print '"; - - // Company - print ''; - - // Civilite - print ''; - print ''; - - // Name - print ''; - print ''; - - // Firstname - print ''; - print ''; - - // Password - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - print ''; - } - - // Address - print ''; - - // Zip / Town - print ''; - - // Country - //$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined - print ''; - - // State - if (empty($conf->global->MEMBER_DISABLE_STATE)) - { - print ''; - } - - // Tel - print ''; - - // Tel perso - print ''; - - // Tel mobile - print ''; - - // EMail - print ''; - - // Date naissance - print "\n"; - - // Profil public - print "\n"; - - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); - print ''."\n"; - } - } - - // Third party Dolibarr - if (! empty($conf->societe->enabled)) - { - print ''; - } - - // Login Dolibarr - print ''; - - print '
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Nature").''; - print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); - print "'; - print $form->showphoto('memberphoto',$object)."\n"; - if ($caneditfieldmember) - { - if ($object->photo) print "
\n"; - print ''; - if ($object->photo) print ''; - print ''; - print ''; - print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; - } - print '
'.$langs->trans("Type").''; - if ($user->rights->adherent->creer) - { - print $form->selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"])?$_POST["typeid"]:$object->typeid)); - } - else - { - print $adht->getNomUrl(1); - print ''; - } - print "
'.$langs->trans("Company").'societe).'">
'.$langs->trans("UserTitle").''; - print $formcompany->select_civility(isset($_POST["civilite_id"])?$_POST["civilite_id"]:$object->civilite_id)."\n"; - print '
'.$langs->trans("Lastname").'lastname).'">
'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("Password").'pass).'">
'.$langs->trans("Address").''; - print ''; - print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; - print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6); - print ' '; - print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','departement_id')); - print '
'.$langs->trans('Country').''; - print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id'); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); - print '
'.$langs->trans('State').''; - print $formcompany->select_state($object->fk_departement,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id); - print '
'.$langs->trans("PhonePro").'phone).'">
'.$langs->trans("PhonePerso").'phone_perso).'">
'.$langs->trans("PhoneMobile").'phone_mobile).'">
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">
".$langs->trans("Birthday")."\n"; - $form->select_date(($object->naiss ? $object->naiss : -1),'naiss','','',1,'formsoc'); - print "
".$langs->trans("Public")."\n"; - print $form->selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1); - print "
'.$label.''; - print $extrafields->showInputField($key,$value); - print '
'.$langs->trans("LinkedToDolibarrThirdParty").''; - if ($object->fk_soc) - { - $company=new Societe($db); - $result=$company->fetch($object->fk_soc); - print $company->getNomUrl(1); - } - else - { - print $langs->trans("NoThirdPartyAssociatedToMember"); - } - print '
'.$langs->trans("LinkedToDolibarrUser").''; - if ($object->user_id) - { - print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); - } - else print $langs->trans("NoDolibarrAccess"); - print '
'; - - print '
'; - print ''; - print '       '; - print ''; - print ''; - - print ''; -} - -if ($rowid && $action != 'edit') -{ - dol_htmloutput_mesg($mesg); - - /* ************************************************************************** */ - /* */ - /* Mode affichage */ - /* */ - /* ************************************************************************** */ - - $res=$object->fetch($rowid); - if ($res < 0) { dol_print_error($db,$object->error); exit; } - $res=$object->fetch_optionals($object->id,$extralabels); - if ($res < 0) { dol_print_error($db); exit; } - - $adht = new AdherentType($db); - $res=$adht->fetch($object->typeid); - if ($res < 0) { dol_print_error($db); exit; } - - - /* - * Affichage onglets - */ - $head = member_prepare_head($object); - - dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); - - dol_htmloutput_errors($errmsg,$errmsgs); - - // Confirm create user - if ($_GET["action"] == 'create_user') - { - $login=$object->login; - if (empty($login)) - { - // Full firstname and name separated with a dot : firstname.name - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $login=dol_buildlogin($object->lastname,$object->firstname); - } - if (empty($login)) $login=strtolower(substr($object->firstname, 0, 4)) . strtolower(substr($object->lastname, 0, 4)); - - // Create a form array - $formquestion=array( - array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) - ); - $text=$langs->trans("ConfirmCreateLogin").'
'; - if (! empty($conf->societe->enabled)) - { - if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); - else $text.=$langs->trans("UserWillBeInternalUser"); - } - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); - if ($ret == 'html') print '
'; - } - - // Confirm create third party - if ($_GET["action"] == 'create_thirdparty') - { - $name = $object->getFullName($langs); - if (! empty($name)) - { - if ($object->societe) $name.=' ('.$object->societe.')'; - } - else - { - $name=$object->societe; + $tmparray=getCountry($object->country_id,'all'); + $object->pays_code=$tmparray['code']; + $object->pays=$tmparray['code']; + $object->country_code=$tmparray['code']; + $object->country=$tmparray['label']; } - // Create a form array - $formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name)); + $adht = new AdherentType($db); - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1); - if ($ret == 'html') print '
'; - } + print_fiche_titre($langs->trans("NewMember")); - // Confirm validate member - if ($action == 'valid') - { - $langs->load("mails"); + dol_htmloutput_mesg($errmsg,$errmsgs,'error'); + dol_htmloutput_mesg($mesg,$mesgs); - $adht = new AdherentType($db); - $adht->fetch($object->typeid); - - $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_VALID_SUBJECT); - $texttosend=$object->makeSubstitution($adht->getMailOnValid()); - - $tmp=$langs->trans("SendAnEMailToMember"); - $tmp.=' ('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; - $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; - $helpcontent=''; - $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; - $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; - $helpcontent.=''.$langs->trans("Subject").':
'."\n"; - $helpcontent.=$subjecttosend."\n"; - $helpcontent.="
"; - $helpcontent.=''.$langs->trans("Content").':
'; - $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; - $label=$form->textwithpicto($tmp,$helpcontent,1,'help'); - - // Cree un tableau formulaire - $formquestion=array(); - 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_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); - } - - // Confirm send card by mail - if ($action == 'sendinfo') - { - print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1); - } - - // Confirm resiliate - if ($action == 'resign') - { - $langs->load("mails"); - - $adht = new AdherentType($db); - $adht->fetch($object->typeid); - - $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_RESIL_SUBJECT); - $texttosend=$object->makeSubstitution($adht->getMailOnResiliate()); - - $tmp=$langs->trans("SendAnEMailToMember"); - $tmp.=' ('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; - $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; - $helpcontent=''; - $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; - $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; - $helpcontent.=''.$langs->trans("Subject").':
'."\n"; - $helpcontent.=$subjecttosend."\n"; - $helpcontent.="
"; - $helpcontent.=''.$langs->trans("Content").':
'; - $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; - $label=$form->textwithpicto($tmp,$helpcontent,1,'help'); - - // Cree un tableau formulaire - $formquestion=array(); - if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?'true':'false')); - if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - $ret=$form->form_confirm("fiche.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); - if ($ret == 'html') print '
'; - } - - // Confirm remove member - if ($action == 'delete') - { - $formquestion=array(); - if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - $ret=$form->form_confirm("fiche.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); - if ($ret == 'html') print '
'; - } - - /* - * Confirm add in spip - */ - if ($action == 'add_spip') - { - $ret=$form->form_confirm("fiche.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); - if ($ret == 'html') print '
'; - } - - /* - * Confirm removed from spip - */ - if ($action == 'del_spip') - { - $ret=$form->form_confirm("fiche.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); - if ($ret == 'html') print '
'; - } - - $rowspan=17; - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; - if (! empty($conf->societe->enabled)) $rowspan++; - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - print ''; - - $showphoto=''; - - // Login - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - print ''; - print $showphoto; $showphoto=''; - print ''; - } - - // Morphy - print ''; - print $showphoto; $showphoto=''; - print ''; - - // Type - print '\n"; - - // Company - print ''; - - // Civility - print ''; - print ''; - - // Name - print ''; - print ''; - - // Firstname - print ''; - - // Password - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - print ''; - } - - // Address - print ''; - - // Zip / Town - print ''; - - // Country - print ''; - - // State - print ''; - - // Tel pro. - print ''; - - // Tel perso - print ''; - - // Tel mobile - print ''; - - // EMail - print ''; - - // Date naissance - print ''; - - // Public - print ''; - - // Status - print ''; - - // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - if (empty($reshook) && ! empty($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key=>$label) - { - $value=$object->array_options["options_$key"]; - print "\n"; - } - } - - // Third party Dolibarr - if (! empty($conf->societe->enabled)) - { - print ''; - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'rowid', $linkback); - print '
'; - $showphoto.=$form->showphoto('memberphoto',$object); - $showphoto.='
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Lastname").''.$object->lastname.' 
'.$langs->trans("Firstname").''.$object->firstname.' 
'.$langs->trans("Password").''.preg_replace('/./i','*',$object->pass).'
'.$langs->trans("Address").''; - dol_print_address($object->address,'gmap','member',$object->id); - print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'
'.$langs->trans("Country").''; - $img=picto_from_langcode($object->country_code); - if ($img) print $img.' '; - print getCountry($object->country_code); - print '
'.$langs->trans('State').''.$object->departement.'
'.$langs->trans("PhonePro").''.dol_print_phone($object->phone,$object->country_code,0,$object->fk_soc,1).'
'.$langs->trans("PhonePerso").''.dol_print_phone($object->phone_perso,$object->country_code,0,$object->fk_soc,1).'
'.$langs->trans("PhoneMobile").''.dol_print_phone($object->phone_mobile,$object->country_code,0,$object->fk_soc,1).'
'.$langs->trans("EMail").''.dol_print_email($object->email,0,$object->fk_soc,1).'
'.$langs->trans("Birthday").''.dol_print_date($object->naiss,'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
".$label.""; - print $extrafields->showOutputField($key,$value); - print "
'; - print ''; - if ($_GET['action'] != 'editthirdparty' && $user->rights->adherent->creer) print ''; - print '
'; - print $langs->trans("LinkedToDolibarrThirdParty"); - print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; - print '
'; - if ($_GET['action'] == 'editthirdparty') + if ($conf->use_javascript_ajax) { - $htmlname='socid'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + } + + // Login Dolibarr + print ''; + */ + + print "
'; + print "\n".''."\n"; + } + + print ''; + print ''; + print ''; + + print ''; + + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } + + // Moral-Physique + $morphys["phy"] = $langs->trans("Physical"); + $morphys["mor"] = $langs->trans("Moral"); + print '\n"; + + // Type + print '\n"; + + // Company + print ''; + + // Civility + print ''; + print ''; + + // Lastname + print ''; + print ''; + + // Firstname + print ''; + print ''; + + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; + $generated_password=getRandomPassword(''); + print ''; + } + + // Address + print ''; + + // Zip / Town + print ''; + + // Country + $object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; + print ''; + + // State + if (empty($conf->global->MEMBER_DISABLE_STATE)) + { + print ''; + } + + // Tel pro + print ''; + + // Tel perso + print ''; + + // Tel mobile + print ''; + + // EMail + print ''; + + // Birthday + print "\n"; + + // Profil public + print "\n"; + + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?GETPOST('options_'.$key,'alpha'):$object->array_options["options_".$key]); + print ''."\n"; + } + } + + /* + // Third party Dolibarr + if (! empty($conf->societe->enabled)) + { + print ''; - print ''; - print '
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Nature")."\n"; + print $form->selectarray("morphy", $morphys, GETPOST('morphy','alpha')?GETPOST('morphy','alpha'):$object->morphy, 1); + print "
'.$langs->trans("MemberType").''; + $listetype=$adht->liste_array(); + if (count($listetype)) + { + print $form->selectarray("typeid", $listetype, GETPOST('typeid','int')?GETPOST('typeid','int'):$typeid, count($listetype)>1?1:0); + } else { + print ''.$langs->trans("NoTypeDefinedGoToSetup").''; + } + print "
'.$langs->trans("Company").'
'.$langs->trans("UserTitle").''; + print $formcompany->select_civility(GETPOST('civilite_id','int')?GETPOST('civilite_id','int'):$object->civilite_id,'civilite_id').'
'.$langs->trans("Lastname").'
'.$langs->trans("Firstname").'
'.$langs->trans("Password").''; + print ''; + print '
'.$langs->trans("Address").''; + print ''; + print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print $formcompany->select_ziptown((GETPOST('zipcode','alpha')?GETPOST('zipcode','alpha'):$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6); + print ' '; + print $formcompany->select_ziptown((GETPOST('town','alpha')?GETPOST('town','alpha'):$object->town),'town',array('zipcode','selectcountry_id','departement_id')); + print '
'.$langs->trans('Country').''; + print $form->select_country(GETPOST('country_id','alpha')?GETPOST('country_id','alpha'):$object->country_id,'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + print '
'.$langs->trans('State').''; + if ($object->country_id) + { + print $formcompany->select_state(GETPOST('departement_id','int')?GETPOST('departement_id','int'):$object->fk_departement,$object->country_code); + } + else + { + print $countrynotdefined; + } + print '
'.$langs->trans("PhonePro").'
'.$langs->trans("PhonePerso").'
'.$langs->trans("PhoneMobile").'
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'
".$langs->trans("Birthday")."\n"; + $form->select_date(($object->naiss ? $object->naiss : -1),'naiss','','',1,'formsoc'); + print "
".$langs->trans("Public")."\n"; + print $form->selectyesno("public",$object->public,1); + print "
'.$label.''; + print $extrafields->showInputField($key,$value); + print '
'.$langs->trans("LinkedToDolibarrThirdParty").''; print $form->select_company($object->fk_soc,'socid','',1); - print '
'; + print '
'.$langs->trans("LinkedToDolibarrUser").''; + print $form->select_users($object->user_id,'userid',1); + print '
\n"; + print '
'; + + print '
'; + + print "\n"; + + } + + if ($action == 'edit') + { + /******************************************** + * + * Fiche en mode edition + * + ********************************************/ + + $res=$object->fetch($rowid); + if ($res < 0) { dol_print_error($db,$object->error); exit; } + $res=$object->fetch_optionals($object->id,$extralabels); + if ($res < 0) { dol_print_error($db); exit; } + + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + // We set country_id, and country_code, country of the chosen country + if (isset($_POST["pays"]) || $object->country_id) + { + $sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["pays"])?$_POST["pays"]:$object->country_id); + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + } + else + { + dol_print_error($db); + } + $object->pays_id=$obj->rowid; + $object->pays_code=$obj->code; + $object->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; + $object->country_id=$obj->rowid; + $object->country_code=$obj->code; + $object->country=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; + } + + $head = member_prepare_head($object); + + dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); + + dol_htmloutput_errors($errmsg,$errmsgs); + dol_htmloutput_mesg($mesg); + + if ($conf->use_javascript_ajax) + { + print "\n".''."\n"; + } + + $rowspan=15; + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; + if (! empty($conf->societe->enabled)) $rowspan++; + + print '
'; + print ''; + print ''; + print ''; + print ''; + if ($backtopage) print ''; + + print ''; + + // Ref + print ''; + + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } + + // Physique-Moral + $morphys["phy"] = $langs->trans("Physical"); + $morphys["mor"] = $langs->trans("Morale"); + print '"; + // Photo + print ''; + + // Type + print ''; - } + print ""; - // Login Dolibarr - print ''; + + // Civilite + print ''; + print ''; + + // Name + print ''; + print ''; + + // Firstname + print ''; + print ''; + + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } + + // Address + print ''; + + // Zip / Town + print ''; + + // Country + //$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined + print ''; + + // State + if (empty($conf->global->MEMBER_DISABLE_STATE)) + { + print ''; + } + + // Tel + print ''; + + // Tel perso + print ''; + + // Tel mobile + print ''; + + // EMail + print ''; + + // Date naissance + print "\n"; + + // Profil public + print "\n"; + + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]); + print ''."\n"; + } + } + + // Third party Dolibarr + if (! empty($conf->societe->enabled)) + { + print ''; + } + + // Login Dolibarr + print ''; + + print '
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Nature").''; + print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); + print "'; + print $form->showphoto('memberphoto',$object)."\n"; + if ($caneditfieldmember) + { + if ($object->photo) print "
\n"; + print ''; + if ($object->photo) print ''; + print ''; + print ''; + print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; + } + print '
'.$langs->trans("Type").''; + if ($user->rights->adherent->creer) + { + print $form->selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"])?$_POST["typeid"]:$object->typeid)); } else { - if ($object->fk_soc) - { - $company=new Societe($db); - $result=$company->fetch($object->fk_soc); - print $company->getNomUrl(1); - } - else - { - print $langs->trans("NoThirdPartyAssociatedToMember"); - } + print $adht->getNomUrl(1); + print ''; } - print '
'; - print ''; - if ($_GET['action'] != 'editlogin' && $user->rights->adherent->creer) - { - print ''; - } - print '
'; - print $langs->trans("LinkedToDolibarrUser"); - print ''; - if ($user->rights->user->user->creer) - { - print 'id.'">'.img_edit($langs->trans('SetLinkToUser'),1).''; - } - print '
'; - print '
'; - if ($_GET['action'] == 'editlogin') - { - print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); - } - else - { + // Company + print '
'.$langs->trans("Company").'societe).'">
'.$langs->trans("UserTitle").''; + print $formcompany->select_civility(isset($_POST["civilite_id"])?$_POST["civilite_id"]:$object->civilite_id)."\n"; + print '
'.$langs->trans("Lastname").'lastname).'">
'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("Password").'pass).'">
'.$langs->trans("Address").''; + print ''; + print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','departement_id'),6); + print ' '; + print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','departement_id')); + print '
'.$langs->trans('Country').''; + print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); + print '
'.$langs->trans('State').''; + print $formcompany->select_state($object->fk_departement,isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id); + print '
'.$langs->trans("PhonePro").'phone).'">
'.$langs->trans("PhonePerso").'phone_perso).'">
'.$langs->trans("PhoneMobile").'phone_mobile).'">
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">
".$langs->trans("Birthday")."\n"; + $form->select_date(($object->naiss ? $object->naiss : -1),'naiss','','',1,'formsoc'); + print "
".$langs->trans("Public")."\n"; + print $form->selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1); + print "
'.$label.''; + print $extrafields->showInputField($key,$value); + print '
'.$langs->trans("LinkedToDolibarrThirdParty").''; + if ($object->fk_soc) + { + $company=new Societe($db); + $result=$company->fetch($object->fk_soc); + print $company->getNomUrl(1); + } + else + { + print $langs->trans("NoThirdPartyAssociatedToMember"); + } + print '
'.$langs->trans("LinkedToDolibarrUser").''; if ($object->user_id) { print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); } else print $langs->trans("NoDolibarrAccess"); + print '
'; + + print '
'; + print ''; + print '       '; + print ''; + print ''; + + print ''; } - print '
\n"; + if ($rowid && $action != 'edit') + { + dol_htmloutput_mesg($mesg); - print "\n"; + /* ************************************************************************** */ + /* */ + /* Mode affichage */ + /* */ + /* ************************************************************************** */ + + $res=$object->fetch($rowid); + if ($res < 0) { dol_print_error($db,$object->error); exit; } + $res=$object->fetch_optionals($object->id,$extralabels); + if ($res < 0) { dol_print_error($db); exit; } + + $adht = new AdherentType($db); + $res=$adht->fetch($object->typeid); + if ($res < 0) { dol_print_error($db); exit; } - /* - * Barre d'actions - * - */ - print '
'; + /* + * Affichage onglets + */ + $head = member_prepare_head($object); - if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty') - { - // Modify - if ($user->rights->adherent->creer) + dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); + + dol_htmloutput_errors($errmsg,$errmsgs); + + // Confirm create user + if ($_GET["action"] == 'create_user') { - print "".$langs->trans("Modify").""; - } - else - { - print "trans("NotEnoughPermissions"))."\">".$langs->trans("Modify").""; + $login=$object->login; + if (empty($login)) + { + // Full firstname and name separated with a dot : firstname.name + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $login=dol_buildlogin($object->lastname,$object->firstname); + } + if (empty($login)) $login=strtolower(substr($object->firstname, 0, 4)) . strtolower(substr($object->lastname, 0, 4)); + + // Create a form array + $formquestion=array( + array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) + ); + $text=$langs->trans("ConfirmCreateLogin").'
'; + if (! empty($conf->societe->enabled)) + { + if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); + else $text.=$langs->trans("UserWillBeInternalUser"); + } + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); + if ($ret == 'html') print '
'; } - // Valider - if ($object->statut == -1) + // Confirm create third party + if ($_GET["action"] == 'create_thirdparty') { - if ($user->rights->adherent->creer) + $name = $object->getFullName($langs); + if (! empty($name)) { - print "".$langs->trans("Validate")."\n"; + if ($object->societe) $name.=' ('.$object->societe.')'; } else { - print "trans("NotEnoughPermissions"))."\">".$langs->trans("Validate").""; + $name=$object->societe; + } + + // Create a form array + $formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name)); + + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1); + if ($ret == 'html') print '
'; + } + + // Confirm validate member + if ($action == 'valid') + { + $langs->load("mails"); + + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_VALID_SUBJECT); + $texttosend=$object->makeSubstitution($adht->getMailOnValid()); + + $tmp=$langs->trans("SendAnEMailToMember"); + $tmp.=' ('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; + $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; + $helpcontent=''; + $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; + $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; + $helpcontent.=''.$langs->trans("Subject").':
'."\n"; + $helpcontent.=$subjecttosend."\n"; + $helpcontent.="
"; + $helpcontent.=''.$langs->trans("Content").':
'; + $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; + $label=$form->textwithpicto($tmp,$helpcontent,1,'help'); + + // Cree un tableau formulaire + $formquestion=array(); + 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_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); + } + + // Confirm send card by mail + if ($action == 'sendinfo') + { + print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1); + } + + // Confirm resiliate + if ($action == 'resign') + { + $langs->load("mails"); + + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_RESIL_SUBJECT); + $texttosend=$object->makeSubstitution($adht->getMailOnResiliate()); + + $tmp=$langs->trans("SendAnEMailToMember"); + $tmp.=' ('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; + $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; + $helpcontent=''; + $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; + $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; + $helpcontent.=''.$langs->trans("Subject").':
'."\n"; + $helpcontent.=$subjecttosend."\n"; + $helpcontent.="
"; + $helpcontent.=''.$langs->trans("Content").':
'; + $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; + $label=$form->textwithpicto($tmp,$helpcontent,1,'help'); + + // Cree un tableau formulaire + $formquestion=array(); + if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?'true':'false')); + if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); + $ret=$form->form_confirm("fiche.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); + if ($ret == 'html') print '
'; + } + + // Confirm remove member + if ($action == 'delete') + { + $formquestion=array(); + if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); + $ret=$form->form_confirm("fiche.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); + if ($ret == 'html') print '
'; + } + + /* + * Confirm add in spip + */ + if ($action == 'add_spip') + { + $ret=$form->form_confirm("fiche.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); + if ($ret == 'html') print '
'; + } + + /* + * Confirm removed from spip + */ + if ($action == 'del_spip') + { + $ret=$form->form_confirm("fiche.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); + if ($ret == 'html') print '
'; + } + + $rowspan=17; + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; + if (! empty($conf->societe->enabled)) $rowspan++; + + print ''; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + print ''; + + $showphoto=''; + + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + print $showphoto; $showphoto=''; + print ''; + } + + // Morphy + print ''; + print $showphoto; $showphoto=''; + print ''; + + // Type + print '\n"; + + // Company + print ''; + + // Civility + print ''; + print ''; + + // Name + print ''; + print ''; + + // Firstname + print ''; + + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } + + // Address + print ''; + + // Zip / Town + print ''; + + // Country + print ''; + + // State + print ''; + + // Tel pro. + print ''; + + // Tel perso + print ''; + + // Tel mobile + print ''; + + // EMail + print ''; + + // Date naissance + print ''; + + // Public + print ''; + + // Status + print ''; + + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key=>$label) + { + $value=$object->array_options["options_$key"]; + print "\n"; } } - // Reactiver - if ($object->statut == 0) + // Third party Dolibarr + if (! empty($conf->societe->enabled)) { - if ($user->rights->adherent->creer) + print ''; } - // Create user - if (! $user->societe_id && ! $object->user_id) + // Login Dolibarr + print ''; + + print "
'.$langs->trans("Ref").''; + print $form->showrefnav($object, 'rowid', $linkback); + print '
'; + $showphoto.=$form->showphoto('memberphoto',$object); + $showphoto.='
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Lastname").''.$object->lastname.' 
'.$langs->trans("Firstname").''.$object->firstname.' 
'.$langs->trans("Password").''.preg_replace('/./i','*',$object->pass).'
'.$langs->trans("Address").''; + dol_print_address($object->address,'gmap','member',$object->id); + print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'
'.$langs->trans("Country").''; + $img=picto_from_langcode($object->country_code); + if ($img) print $img.' '; + print getCountry($object->country_code); + print '
'.$langs->trans('State').''.$object->departement.'
'.$langs->trans("PhonePro").''.dol_print_phone($object->phone,$object->country_code,0,$object->fk_soc,1).'
'.$langs->trans("PhonePerso").''.dol_print_phone($object->phone_perso,$object->country_code,0,$object->fk_soc,1).'
'.$langs->trans("PhoneMobile").''.dol_print_phone($object->phone_mobile,$object->country_code,0,$object->fk_soc,1).'
'.$langs->trans("EMail").''.dol_print_email($object->email,0,$object->fk_soc,1).'
'.$langs->trans("Birthday").''.dol_print_date($object->naiss,'day').'
'.$langs->trans("Public").''.yn($object->public).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
".$label.""; + print $extrafields->showOutputField($key,$value); + print "
'; + print ''; + if ($_GET['action'] != 'editthirdparty' && $user->rights->adherent->creer) print ''; + print '
'; + print $langs->trans("LinkedToDolibarrThirdParty"); + print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; + print '
'; + if ($_GET['action'] == 'editthirdparty') { - print "".$langs->trans("Reenable")."\n"; - } - else - { - print "trans("NotEnoughPermissions"))."\">".$langs->trans("Reenable").""; - } - } - - // Send card by email - if ($user->rights->adherent->creer) - { - if ($object->statut >= 1) - { - if ($object->email) print "id&action=sendinfo\">".$langs->trans("SendCardByMail")."\n"; - else print "trans("NoEMail"))."\">".$langs->trans("SendCardByMail")."\n"; - } - else - { - print "trans("ValidateBefore"))."\">".$langs->trans("SendCardByMail").""; - } - } - else - { - print "trans("NotEnoughPermissions"))."\">".$langs->trans("SendCardByMail").""; - } - - // Resilier - if ($object->statut >= 1) - { - if ($user->rights->adherent->supprimer) - { - print "".$langs->trans("Resiliate")."\n"; - } - else - { - print "trans("NotEnoughPermissions"))."\">".$langs->trans("Resiliate").""; - } - } - - // Create third party - if (! empty($conf->societe->enabled) && ! $object->fk_soc) - { - if ($user->rights->societe->creer) - { - if ($object->statut != -1) print ''.$langs->trans("CreateDolibarrThirdParty").''; - else print ''.$langs->trans("CreateDolibarrThirdParty").''; + $htmlname='socid'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->select_company($object->fk_soc,'socid','',1); + print '
'; } else { - print "trans("NotEnoughPermissions"))."\">".$langs->trans("CreateDolibarrThirdParty").""; + if ($object->fk_soc) + { + $company=new Societe($db); + $result=$company->fetch($object->fk_soc); + print $company->getNomUrl(1); + } + else + { + print $langs->trans("NoThirdPartyAssociatedToMember"); + } } + print '
'; + print ''; + if ($_GET['action'] != 'editlogin' && $user->rights->adherent->creer) { + print ''; + } + print '
'; + print $langs->trans("LinkedToDolibarrUser"); + print ''; if ($user->rights->user->user->creer) { - if ($object->statut != -1) print ''.$langs->trans("CreateDolibarrLogin").''; - else print ''.$langs->trans("CreateDolibarrLogin").''; + print 'id.'">'.img_edit($langs->trans('SetLinkToUser'),1).''; + } + print '
'; + print '
'; + if ($_GET['action'] == 'editlogin') + { + print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); + } + else + { + if ($object->user_id) + { + print $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); + } + else print $langs->trans("NoDolibarrAccess"); + } + print '
\n"; + + print "
\n"; + + + /* + * Barre d'actions + * + */ + print '
'; + + if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty') + { + // Modify + if ($user->rights->adherent->creer) + { + print "".$langs->trans("Modify").""; } else { - print "trans("NotEnoughPermissions"))."\">".$langs->trans("CreateDolibarrLogin").""; + print "trans("NotEnoughPermissions"))."\">".$langs->trans("Modify").""; } + + // Valider + if ($object->statut == -1) + { + if ($user->rights->adherent->creer) + { + print "".$langs->trans("Validate")."\n"; + } + else + { + print "trans("NotEnoughPermissions"))."\">".$langs->trans("Validate").""; + } + } + + // Reactiver + if ($object->statut == 0) + { + if ($user->rights->adherent->creer) + { + print "".$langs->trans("Reenable")."\n"; + } + else + { + print "trans("NotEnoughPermissions"))."\">".$langs->trans("Reenable").""; + } + } + + // Send card by email + if ($user->rights->adherent->creer) + { + if ($object->statut >= 1) + { + if ($object->email) print "id&action=sendinfo\">".$langs->trans("SendCardByMail")."\n"; + else print "trans("NoEMail"))."\">".$langs->trans("SendCardByMail")."\n"; + } + else + { + print "trans("ValidateBefore"))."\">".$langs->trans("SendCardByMail").""; + } + } + else + { + print "trans("NotEnoughPermissions"))."\">".$langs->trans("SendCardByMail").""; + } + + // Resilier + if ($object->statut >= 1) + { + if ($user->rights->adherent->supprimer) + { + print "".$langs->trans("Resiliate")."\n"; + } + else + { + print "trans("NotEnoughPermissions"))."\">".$langs->trans("Resiliate").""; + } + } + + // Create third party + if (! empty($conf->societe->enabled) && ! $object->fk_soc) + { + if ($user->rights->societe->creer) + { + if ($object->statut != -1) print ''.$langs->trans("CreateDolibarrThirdParty").''; + else print ''.$langs->trans("CreateDolibarrThirdParty").''; + } + else + { + print "trans("NotEnoughPermissions"))."\">".$langs->trans("CreateDolibarrThirdParty").""; + } + } + + // Create user + if (! $user->societe_id && ! $object->user_id) + { + if ($user->rights->user->user->creer) + { + if ($object->statut != -1) print ''.$langs->trans("CreateDolibarrLogin").''; + else print ''.$langs->trans("CreateDolibarrLogin").''; + } + else + { + print "trans("NotEnoughPermissions"))."\">".$langs->trans("CreateDolibarrLogin").""; + } + } + + // Delete + if ($user->rights->adherent->supprimer) + { + print "id&action=delete\">".$langs->trans("Delete")."\n"; + } + else + { + print "trans("NotEnoughPermissions"))."\">".$langs->trans("Delete").""; + } + + // Action SPIP + if (! empty($conf->mailmanspip->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) + { + $isinspip = $mailmanspip->is_in_spip($object); + + if ($isinspip == 1) + { + print "id&action=del_spip\">".$langs->trans("DeleteIntoSpip")."\n"; + } + if ($isinspip == 0) + { + print "id&action=add_spip\">".$langs->trans("AddIntoSpip")."\n"; + } + if ($isinspip == -1) + { + print '

'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.''; + } + } + } - // Delete - if ($user->rights->adherent->supprimer) - { - print "id&action=delete\">".$langs->trans("Delete")."\n"; - } - else - { - print "trans("NotEnoughPermissions"))."\">".$langs->trans("Delete").""; - } - - // Action SPIP - if (! empty($conf->mailmanspip->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) - { - $isinspip = $mailmanspip->is_in_spip($object); - - if ($isinspip == 1) - { - print "id&action=del_spip\">".$langs->trans("DeleteIntoSpip")."\n"; - } - if ($isinspip == 0) - { - print "id&action=add_spip\">".$langs->trans("AddIntoSpip")."\n"; - } - if ($isinspip == -1) - { - print '

'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.''; - } - } - - } - - print '
'; - print "
\n"; + print ''; + print "
\n"; + } } - llxFooter(); $db->close(); From ec9946222db03c6d05666c75500f842ab9994cbb Mon Sep 17 00:00:00 2001 From: Grand Philippe Date: Tue, 2 Oct 2012 22:58:49 +0200 Subject: [PATCH 8/8] new try to fix canvas within members module --- htdocs/adherents/fiche.php | 684 +++++++++++++++++++------------------ 1 file changed, 349 insertions(+), 335 deletions(-) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index df281e9bf09..ddb4632181d 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -1,29 +1,29 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Marcos García - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +* Copyright (C) 2004-2011 Laurent Destailleur +* Copyright (C) 2005-2012 Regis Houssin +* Copyright (C) 2012 Marcos García +* +* 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 +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +*/ /** * \file htdocs/adherents/fiche.php - * \ingroup member - * \brief Page of member - */ +* \ingroup member +* \brief Page of member +*/ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; @@ -72,9 +72,9 @@ $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); + require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; + $objcanvas = new Canvas($db, $action); + $objcanvas->getCanvas('adherent', 'card', $canvas); } $errmsg=''; $errmsgs=array(); @@ -91,9 +91,9 @@ if ($rowid > 0) { // $user est le user qui edite, $object->user_id est l'id de l'utilisateur lies au membre edite $caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer) - || (($user->id != $object->user_id) && $user->rights->user->user->creer)); + || (($user->id != $object->user_id) && $user->rights->user->user->creer)); $caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password) - || (($user->id != $object->user_id) && $user->rights->user->user->password)); + || (($user->id != $object->user_id) && $user->rights->user->user->password)); } } @@ -113,7 +113,7 @@ $hookmanager->initHooks(array('membercard')); /* * Actions - */ +*/ $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 @@ -226,13 +226,13 @@ if ($action == 'confirm_sendinfo' && $confirm == 'yes') { if ($object->email) { - $from=$conf->email_from; - if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; + $from=$conf->email_from; + if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; - $result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent")); + $result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent")); - $langs->load("mails"); - $mesg=$langs->trans("MailSuccessfulySent", $from, $object->email); + $langs->load("mails"); + $mesg=$langs->trans("MailSuccessfulySent", $from, $object->email); } } @@ -242,8 +242,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) $datenaiss=''; if (isset($_POST["naissday"]) && $_POST["naissday"] - && isset($_POST["naissmonth"]) && $_POST["naissmonth"] - && isset($_POST["naissyear"]) && $_POST["naissyear"]) + && isset($_POST["naissmonth"]) && $_POST["naissmonth"] + && isset($_POST["naissyear"]) && $_POST["naissyear"]) { $datenaiss=dol_mktime(12, 0, 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]); } @@ -263,12 +263,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) $object->pass = trim($_POST["pass"]); $object->societe = trim($_POST["societe"]); - $object->adresse = trim($_POST["address"]); // deprecated + $object->adresse = trim($_POST["address"]); // deprecated $object->address = trim($_POST["address"]); - $object->cp = trim($_POST["zipcode"]); // deprecated + $object->cp = trim($_POST["zipcode"]); // deprecated $object->zip = trim($_POST["zipcode"]); - $object->ville = trim($_POST["town"]); // deprecated - $object->town = trim($_POST["town"]); + $object->ville = trim($_POST["town"]); // deprecated + $object->town = trim($_POST["town"]); $object->state_id = $_POST["departement_id"]; $object->country_id = $_POST["country_id"]; $object->fk_departement = $_POST["departement_id"]; // deprecated @@ -286,7 +286,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) $object->amount = $_POST["amount"]; - if (GETPOST('deletephoto')) $object->photo=''; + if (GETPOST('deletephoto')) $object->photo=''; elseif (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); // Get status and public property @@ -319,78 +319,78 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) $result=$object->update($user,0,$nosyncuser,$nosyncuserpass); if ($result >= 0 && ! count($object->errors)) { - $dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1).'/photos'; - $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); - if ($file_OK) - { - if (GETPOST('deletephoto')) - { - $fileimg=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/'.$object->photo; - $dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/thumbs'; - dol_delete_file($fileimg); - dol_delete_dir_recursive($dirthumbs); - } + $dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1).'/photos'; + $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); + if ($file_OK) + { + if (GETPOST('deletephoto')) + { + $fileimg=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/'.$object->photo; + $dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1).'/photos/thumbs'; + dol_delete_file($fileimg); + dol_delete_dir_recursive($dirthumbs); + } - if (image_format_supported($_FILES['photo']['name']) > 0) - { - dol_mkdir($dir); + if (image_format_supported($_FILES['photo']['name']) > 0) + { + dol_mkdir($dir); - if (@is_dir($dir)) - { - $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); - if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']) > 0) - { - $message .= '
'.$langs->trans("ErrorFailedToSaveFile").'
'; - } - else - { - // Create small thumbs for company (Ratio is near 16/9) - // Used on logon for example - $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); + if (@is_dir($dir)) + { + $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']) > 0) + { + $message .= '
'.$langs->trans("ErrorFailedToSaveFile").'
'; + } + else + { + // Create small thumbs for company (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality); - // Create mini thumbs for company (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); - } - } - } - else - { - $errmsgs[] = "ErrorBadImageFormat"; - } - } + // Create mini thumbs for company (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality); + } + } + } + else + { + $errmsgs[] = "ErrorBadImageFormat"; + } + } - // Rajoute l'utilisateur dans les divers abonnements (mailman, spip, etc...) - if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) - { - if ($object->oldcopy->email != $object->email) // If email has changed we delete mailman subscription for old email - { - if ($object->oldcopy->del_to_abo() < 0) - { - // error - $errmsgs[]= $langs->trans("FailedToCleanMailmanList").': '.$object->error."
\n"; - } - } - if ($object->add_to_abo() < 0) // We add subscription if new email or new type (new type may means more mailing-list to subscribe) - { - // error - $errmsgs[]= $langs->trans("FailedToAddToMailmanList").': '.$object->error."
\n"; - } - } + // Rajoute l'utilisateur dans les divers abonnements (mailman, spip, etc...) + if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) + { + if ($object->oldcopy->email != $object->email) // If email has changed we delete mailman subscription for old email + { + if ($object->oldcopy->del_to_abo() < 0) + { + // error + $errmsgs[]= $langs->trans("FailedToCleanMailmanList").': '.$object->error."
\n"; + } + } + if ($object->add_to_abo() < 0) // We add subscription if new email or new type (new type may means more mailing-list to subscribe) + { + // error + $errmsgs[]= $langs->trans("FailedToAddToMailmanList").': '.$object->error."
\n"; + } + } $rowid=$object->id; $action=''; - if (! empty($backtopage)) - { - header("Location: ".$backtopage); - exit; - } + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } } else { - if ($object->error) $errmsg=$object->error; - else $errmsgs=$object->errors; + if ($object->error) $errmsg=$object->error; + else $errmsgs=$object->errors; $action=''; } } @@ -400,147 +400,147 @@ if ($action == 'add' && $user->rights->adherent->creer) { $datenaiss=''; if (isset($_POST["naissday"]) && $_POST["naissday"] - && isset($_POST["naissmonth"]) && $_POST["naissmonth"] - && isset($_POST["naissyear"]) && $_POST["naissyear"]) + && isset($_POST["naissmonth"]) && $_POST["naissmonth"] + && isset($_POST["naissyear"]) && $_POST["naissyear"]) { $datenaiss=dol_mktime(12, 0, 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]); } $datecotisation=''; if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) - { + { $datecotisation=dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); } - $typeid=$_POST["typeid"]; + $typeid=$_POST["typeid"]; $civilite_id=$_POST["civilite_id"]; - $nom=$_POST["nom"]; - $prenom=$_POST["prenom"]; - $societe=$_POST["societe"]; - $address=$_POST["address"]; - $zip=$_POST["zipcode"]; - $town=$_POST["town"]; + $nom=$_POST["nom"]; + $prenom=$_POST["prenom"]; + $societe=$_POST["societe"]; + $address=$_POST["address"]; + $zip=$_POST["zipcode"]; + $town=$_POST["town"]; $state_id=$_POST["departement_id"]; - $country_id=$_POST["country_id"]; + $country_id=$_POST["country_id"]; - $phone=$_POST["phone"]; - $phone_perso=$_POST["phone_perso"]; - $phone_mobile=$_POST["phone_mobile"]; - $email=$_POST["member_email"]; - $login=$_POST["member_login"]; - $pass=$_POST["password"]; - $photo=$_POST["photo"]; - //$comment=$_POST["comment"]; - $morphy=$_POST["morphy"]; - $cotisation=$_POST["cotisation"]; - $public=$_POST["public"]; + $phone=$_POST["phone"]; + $phone_perso=$_POST["phone_perso"]; + $phone_mobile=$_POST["phone_mobile"]; + $email=$_POST["member_email"]; + $login=$_POST["member_login"]; + $pass=$_POST["password"]; + $photo=$_POST["photo"]; + //$comment=$_POST["comment"]; + $morphy=$_POST["morphy"]; + $cotisation=$_POST["cotisation"]; + $public=$_POST["public"]; - $userid=$_POST["userid"]; - $socid=$_POST["socid"]; + $userid=$_POST["userid"]; + $socid=$_POST["socid"]; - $object->civilite_id = $civilite_id; - $object->prenom = $prenom; // deprecated - $object->nom = $nom; // deprecated - $object->firstname = $prenom; - $object->lastname = $nom; - $object->societe = $societe; - $object->adresse = $address; // deprecated - $object->address = $address; - $object->cp = $zip; // deprecated - $object->zip = $zip; - $object->ville = $town; // deprecated - $object->town = $town; - $object->fk_departement = $state_id; - $object->state_id = $state_id; - $object->pays_id = $country_id; - $object->country_id = $country_id; - $object->phone = $phone; - $object->phone_perso = $phone_perso; - $object->phone_mobile= $phone_mobile; - $object->email = $email; - $object->login = $login; - $object->pass = $pass; - $object->naiss = $datenaiss; - $object->photo = $photo; - $object->typeid = $typeid; - //$object->note = $comment; - $object->morphy = $morphy; - $object->user_id = $userid; - $object->fk_soc = $socid; - $object->public = $public; + $object->civilite_id = $civilite_id; + $object->prenom = $prenom; // deprecated + $object->nom = $nom; // deprecated + $object->firstname = $prenom; + $object->lastname = $nom; + $object->societe = $societe; + $object->adresse = $address; // deprecated + $object->address = $address; + $object->cp = $zip; // deprecated + $object->zip = $zip; + $object->ville = $town; // deprecated + $object->town = $town; + $object->fk_departement = $state_id; + $object->state_id = $state_id; + $object->pays_id = $country_id; + $object->country_id = $country_id; + $object->phone = $phone; + $object->phone_perso = $phone_perso; + $object->phone_mobile= $phone_mobile; + $object->email = $email; + $object->login = $login; + $object->pass = $pass; + $object->naiss = $datenaiss; + $object->photo = $photo; + $object->typeid = $typeid; + //$object->note = $comment; + $object->morphy = $morphy; + $object->user_id = $userid; + $object->fk_soc = $socid; + $object->public = $public; - // Get extra fields - foreach($_POST as $key => $value) - { - if (preg_match("/^options_/",$key)) - { - $object->array_options[$key]=$_POST[$key]; - } - } + // Get extra fields + foreach($_POST as $key => $value) + { + if (preg_match("/^options_/",$key)) + { + $object->array_options[$key]=$_POST[$key]; + } + } - // Check parameters - if (empty($morphy) || $morphy == "-1") { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Nature"))."
\n"; - } - // Test si le login existe deja - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - if (empty($login)) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Login"))."
\n"; - } - else { - $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows($result); - } - if ($num) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorLoginAlreadyExists",$login)."
\n"; - } - } - if (empty($pass)) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Password"))."
\n"; - } - } - if (empty($nom)) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."
\n"; - } + // Check parameters + if (empty($morphy) || $morphy == "-1") { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Nature"))."
\n"; + } + // Test si le login existe deja + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + if (empty($login)) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Login"))."
\n"; + } + else { + $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + } + if ($num) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorLoginAlreadyExists",$login)."
\n"; + } + } + if (empty($pass)) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Password"))."
\n"; + } + } + if (empty($nom)) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."
\n"; + } if ($morphy != 'mor' && (!isset($prenom) || $prenom=='')) { $error++; - $langs->load("errors"); + $langs->load("errors"); $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."
\n"; - } - if (! ($typeid > 0)) { // Keep () before ! - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type"))."
\n"; - } - if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorBadEMail",$email)."
\n"; - } - $public=0; - if (isset($public)) $public=1; + } + if (! ($typeid > 0)) { // Keep () before ! + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type"))."
\n"; + } + if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorBadEMail",$email)."
\n"; + } + $public=0; + if (isset($public)) $public=1; - if (! $error) - { + if (! $error) + { $db->begin(); // Email a peu pres correct et le login n'existe pas - $result=$object->create($user); + $result=$object->create($user); if ($result > 0) - { + { $db->commit(); $rowid=$object->id; $action=''; - } - else + } + else { $db->rollback(); @@ -548,45 +548,45 @@ if ($action == 'add' && $user->rights->adherent->creer) else $errmsgs=$object->errors; $action = 'create'; - } - } - else { - $action = 'create'; - } + } + } + else { + $action = 'create'; + } } if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { - $result=$object->delete($rowid); - if ($result > 0) - { - if (! empty($backtopage)) - { - header("Location: ".$backtopage); - exit; - } - else - { - header("Location: liste.php"); - exit; - } - } - else - { - $errmesg=$object->error; - } + $result=$object->delete($rowid); + if ($result > 0) + { + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: liste.php"); + exit; + } + } + else + { + $errmesg=$object->error; + } } if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') { - $result=$object->validate($user); + $result=$object->validate($user); - $adht = new AdherentType($db); - $adht->fetch($object->typeid); + $adht = new AdherentType($db); + $adht->fetch($object->typeid); if ($result >= 0 && ! count($object->errors)) { - // Send confirmation Email (selon param du type adherent sinon generique) + // Send confirmation Email (selon param du type adherent sinon generique) if ($object->email && $_POST["send_mail"]) { $result=$object->send_an_email($adht->getMailOnValid(),$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2); @@ -596,60 +596,60 @@ if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == } } - // Rajoute l'utilisateur dans les divers abonnements (mailman, spip, etc...) - if ($object->add_to_abo() < 0) - { - // error - $errmsg.= $langs->trans("ErrorFailedToAddToMailmanList").': '.$object->error."
\n"; - } + // Rajoute l'utilisateur dans les divers abonnements (mailman, spip, etc...) + if ($object->add_to_abo() < 0) + { + // error + $errmsg.= $langs->trans("ErrorFailedToAddToMailmanList").': '.$object->error."
\n"; + } } else { - if ($object->error) $errmsg=$object->error; - else $errmsgs=$object->errors; + if ($object->error) $errmsg=$object->error; + else $errmsgs=$object->errors; $action=''; } } if ($user->rights->adherent->supprimer && $action == 'confirm_resign') { - if ($confirm == 'yes') - { - $adht = new AdherentType($db); - $adht->fetch($object->typeid); + if ($confirm == 'yes') + { + $adht = new AdherentType($db); + $adht->fetch($object->typeid); - $result=$object->resiliate($user); + $result=$object->resiliate($user); - if ($result >= 0 && ! count($object->errors)) - { - if ($object->email && $_POST["send_mail"]) - { - $result=$object->send_an_email($adht->getMailOnResiliate(),$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,-1); - } - if ($result < 0) - { - $errmsg.=$object->error; - } + if ($result >= 0 && ! count($object->errors)) + { + if ($object->email && $_POST["send_mail"]) + { + $result=$object->send_an_email($adht->getMailOnResiliate(),$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,-1); + } + if ($result < 0) + { + $errmsg.=$object->error; + } - // supprime l'utilisateur des divers abonnements .. - if ($object->del_to_abo() < 0) - { - // error - $errmsg.=$langs->trans("FaildToRemoveFromMailmanList").': '.$object->error."
\n"; - } - } - else - { - if ($object->error) $errmsg=$object->error; - else $errmsgs=$object->errors; - $action=''; - } - } - if (! empty($backtopage) && ! $errmsg) - { - header("Location: ".$backtopage); - exit; - } + // supprime l'utilisateur des divers abonnements .. + if ($object->del_to_abo() < 0) + { + // error + $errmsg.=$langs->trans("FaildToRemoveFromMailmanList").': '.$object->error."
\n"; + } + } + else + { + if ($object->error) $errmsg=$object->error; + else $errmsgs=$object->errors; + $action=''; + } + } + if (! empty($backtopage) && ! $errmsg) + { + header("Location: ".$backtopage); + exit; + } } // SPIP Management @@ -657,10 +657,10 @@ if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $conf { if (! count($object->errors)) { - if (!$mailmanspip->del_to_spip($object)) - { - $errmsg.= $langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error."
\n"; - } + if (!$mailmanspip->del_to_spip($object)) + { + $errmsg.= $langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error."
\n"; + } } } @@ -668,10 +668,10 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm { if (! count($object->errors)) { - if (!$mailmanspip->add_to_spip($object)) - { - $errmsg.= $langs->trans('AddIntoSpipError').': '.$mailmanspip->error."
\n"; - } + if (!$mailmanspip->add_to_spip($object)) + { + $errmsg.= $langs->trans('AddIntoSpipError').': '.$mailmanspip->error."
\n"; + } } } @@ -679,7 +679,7 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm /* * View - */ +*/ $form = new Form($db); $formcompany = new FormCompany($db); @@ -694,22 +694,22 @@ $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("Se 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 + // ----------------------------------------- + // 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 - // ----------------------------------------- + // ----------------------------------------- + // When used in standard mode + // ----------------------------------------- if ($action == 'create') { @@ -742,11 +742,11 @@ else { print "\n".''."\n"; } @@ -877,12 +877,12 @@ else } /* - // Third party Dolibarr + // Third party Dolibarr if (! empty($conf->societe->enabled)) { - print ''.$langs->trans("LinkedToDolibarrThirdParty").''; - print $form->select_company($object->fk_soc,'socid','',1); - print ''; + print ''.$langs->trans("LinkedToDolibarrThirdParty").''; + print $form->select_company($object->fk_soc,'socid','',1); + print ''; } // Login Dolibarr @@ -904,14 +904,18 @@ else { /******************************************** * - * Fiche en mode edition - * - ********************************************/ + * Fiche en mode edition + * + ********************************************/ $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); - if ($res < 0) { dol_print_error($db); exit; } + if ($res < 0) { + dol_print_error($db); exit; + } $adht = new AdherentType($db); $adht->fetch($object->typeid); @@ -948,11 +952,11 @@ else { print "\n".''."\n"; } @@ -1147,18 +1151,24 @@ else /* ************************************************************************** */ $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); - if ($res < 0) { dol_print_error($db); exit; } + if ($res < 0) { + dol_print_error($db); exit; + } $adht = new AdherentType($db); $res=$adht->fetch($object->typeid); - if ($res < 0) { dol_print_error($db); exit; } + if ($res < 0) { + dol_print_error($db); exit; + } /* * Affichage onglets - */ + */ $head = member_prepare_head($object); dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); @@ -1179,7 +1189,7 @@ else // Create a form array $formquestion=array( - array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) + array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) ); $text=$langs->trans("ConfirmCreateLogin").'
'; if (! empty($conf->societe->enabled)) @@ -1238,8 +1248,12 @@ else // Cree un tableau formulaire $formquestion=array(); 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_SPIP)) { $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); } + if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { + $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); } @@ -1291,7 +1305,7 @@ else } /* - * Confirm add in spip + * Confirm add in spip */ if ($action == 'add_spip') { @@ -1300,7 +1314,7 @@ else } /* - * Confirm removed from spip + * Confirm removed from spip */ if ($action == 'del_spip') { @@ -1492,8 +1506,8 @@ else /* * Barre d'actions - * - */ + * + */ print '
'; if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty')