From 3d4a1ccaa5ccfe96e89257752dcc6b8078acd0bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Mar 2006 15:28:54 +0000 Subject: [PATCH] =?UTF-8?q?Conditionnement=20de=20compta->enabled=20avec?= =?UTF-8?q?=20comptaexpert->enabled=20Simplification=20du=20code=20pour=20?= =?UTF-8?q?gestion=20des=20codes=20compta=20(pr=E9paration=20module=20comp?= =?UTF-8?q?ta=20expert)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/societe.php | 65 +++-- htdocs/comm/fiche.php | 5 +- htdocs/comm/multiprix.php | 3 +- htdocs/comm/prospect/fiche.php | 2 +- htdocs/comm/remise.php | 3 +- htdocs/comm/remx.php | 3 +- htdocs/commande/apercu.php | 2 +- htdocs/commande/fiche.php | 12 +- htdocs/commande/info.php | 8 +- htdocs/compta/commande/fiche.php | 2 +- htdocs/compta/commande/pre.inc.php | 4 +- htdocs/compta/fiche.php | 3 +- htdocs/compta/index.php | 2 +- htdocs/compta/pre.inc.php | 4 +- htdocs/compta/recap-client.php | 3 +- htdocs/docsoc.php | 3 +- htdocs/expedition/commande.php | 2 +- htdocs/fourn/fiche.php | 3 +- .../menus/barre_left/eldy_backoffice.php | 10 +- .../menus/barre_left/eldy_frontoffice.php | 7 +- htdocs/includes/menus/barre_top/default.php | 4 +- .../menus/barre_top/eldy_backoffice.php | 2 +- .../menus/barre_top/eldy_frontoffice.php | 2 +- .../societe/mod_codeclient_leopard.php | 14 +- .../modules/societe/mod_codeclient_zebre.php | 14 +- .../societe/mod_codecompta_aquarium.php | 160 ++++++----- .../societe/mod_codecompta_digitaria.php | 17 +- .../societe/mod_codecompta_panicum.php | 17 +- htdocs/index.php | 2 +- htdocs/master.inc.php | 9 + htdocs/pre.inc.php | 2 +- htdocs/soc.php | 44 +-- htdocs/societe.class.php | 271 ++++++++---------- htdocs/societe/info.php | 3 +- htdocs/societe/notify/fiche.php | 5 +- htdocs/socnote.php | 3 +- htdocs/user/fiche.php | 7 +- 37 files changed, 398 insertions(+), 324 deletions(-) diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php index 2416a478c16..07ee76aad16 100644 --- a/htdocs/admin/societe.php +++ b/htdocs/admin/societe.php @@ -1,7 +1,7 @@ - * Copyright (C) 2004 Éric Seigne - * Copyright (C) 2005 Laurent Destailleur +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004 Éric Seigne + * Copyright (C) 2005-2006 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 @@ -35,47 +35,50 @@ $langs->load("admin"); if (!$user->admin) accessforbidden(); -$codeclient_addon_var = CODECLIENT_ADDON; +/* + * Actions + */ if ($_GET["action"] == 'setcodeclient') { - if (dolibarr_set_const($db, "CODECLIENT_ADDON",$_GET["value"])) - { - // la constante qui a été lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage cohérent - $codeclient_addon_var = $_GET["value"]; - Header("Location: societe.php"); - } + if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$_GET["value"])) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + } + else + { + dolibarr_print_error($db); + } } - -$codecompta_addon_var = CODECOMPTA_ADDON; - if ($_GET["action"] == 'setcodecompta') { - if (dolibarr_set_const($db, "CODECOMPTA_ADDON",$_GET["value"])) - { - // la constante qui a été lue en avant du nouveau set - // on passe donc par une variable pour avoir un affichage cohérent - $codecompta_addon_var = $_GET["value"]; - Header("Location: societe.php"); - } + if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON",$_GET["value"])) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + } + else + { + dolibarr_print_error($db); + } } +/* + * Affichage page configuration module societe + * + */ llxHeader(); -/* - * - * - * - */ print_titre($langs->trans("CompanySetup")); print "
"; + +// Choix du module de gestion des codes clients / fournisseurs + print_titre($langs->trans("CustomerCodeChecker")); print "\n"; @@ -107,7 +110,7 @@ if ($handle) print $modCodeClient->info(); print "\n"; - if ($codeclient_addon_var == "$file") + if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file") { print "
\n"; print img_tick(); @@ -127,8 +130,12 @@ if ($handle) } print '
'; + print "
"; + +// Choix du module de gestion des codes compta + print_titre($langs->trans("AccountCodeManager")); print ''; @@ -161,7 +168,7 @@ if ($handle) print $modCodeCompta->info(); print ''; - if ($codecompta_addon_var == "$file") + if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file") { print '
'; print img_tick(); @@ -180,7 +187,7 @@ if ($handle) closedir($handle); } print "
\n"; - + $db->close(); diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 61aecebfbcb..0b2dc5d233e 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -227,7 +227,8 @@ if ($socidp > 0) $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $langs->load("compta"); $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Accountancy"); @@ -286,7 +287,7 @@ if ($socidp > 0) if ($objsoc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); print ''; } - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { print ''; print ''.$langs->trans("CustomerAccountancyCode").''.$objsoc->code_compta.''; diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 1a4cd4acd95..8848eb6a1d8 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -110,7 +110,8 @@ if ($_socid > 0) $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Accountancy"); $h++; diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 5ce1125b6bd..a07e1cca5b6 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -129,7 +129,7 @@ if ($socid > 0) $h++; } - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { $langs->load("compta"); $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 8cb8b1b007d..720a3e9e76c 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -110,7 +110,8 @@ if ($_socid > 0) $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Accountancy"); $h++; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 5a3113885ca..b0c5f51691f 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -109,7 +109,8 @@ if ($_socid > 0) $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Accountancy"); $h++; diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php index dfff2e522bd..62e028e2470 100644 --- a/htdocs/commande/apercu.php +++ b/htdocs/commande/apercu.php @@ -96,7 +96,7 @@ if ($_GET["id"] > 0) { $h++; } - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; $head[$h][1] = $langs->trans('ComptaCard'); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 04c345a769c..aeb5875a024 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -536,7 +536,7 @@ else $h++; } - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; $head[$h][1] = $langs->trans('ComptaCard'); @@ -544,11 +544,11 @@ else } if ($conf->use_preview_tabs) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id; - $head[$h][1] = $langs->trans("Preview"); - $h++; - } + { + $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id; + $head[$h][1] = $langs->trans("Preview"); + $h++; + } $head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id; $head[$h][1] = $langs->trans('Info'); diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index f79646cda67..0a7811fd5c0 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -58,14 +58,14 @@ $h = 0; } if ($conf->expedition->enabled && $user->rights->expedition->lire) - { + { $head[$h][0] = DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id; $head[$h][1] = $langs->trans("SendingCard"); $h++; - } + } - if ($conf->compta->enabled) - { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; $head[$h][1] = $langs->trans("ComptaCard"); $h++; diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index e2f0bb54b49..5c718b1ae19 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -103,7 +103,7 @@ if ($_GET["id"] > 0) $h++; } - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; $head[$h][1] = $langs->trans("ComptaCard"); diff --git a/htdocs/compta/commande/pre.inc.php b/htdocs/compta/commande/pre.inc.php index 17bbf296f4b..662aec5c341 100644 --- a/htdocs/compta/commande/pre.inc.php +++ b/htdocs/compta/commande/pre.inc.php @@ -102,12 +102,12 @@ function llxHeader($head = "", $title="", $help_url='') $menu->add(DOL_URL_ROOT."/compta/deplacement/", "Déplacement"); } - if ($conf->compta->enabled && $conf->compta->tva && $user->societe_id == 0) + if (($conf->compta->enabled || $conf->comptaexpert->enabled) && $conf->compta->tva && $user->societe_id == 0) { $menu->add(DOL_URL_ROOT."/compta/tva/index.php",$langs->trans("VAT")); } - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { $menu->add(DOL_URL_ROOT."/compta/charges/index.php",$langs->trans("Charges")); } diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index e2fbabec97f..72e8090bebb 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -176,7 +176,8 @@ if ($socid > 0) $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $langs->load("compta"); $hselected=$h; $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index e0424ab2f34..fb7f73ceebd 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -164,7 +164,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) /** * Charges a payer */ -if ($conf->compta->enabled) +if ($conf->compta->enabled || $conf->comptaexpert->enabled) { if ($user->societe_id == 0) { diff --git a/htdocs/compta/pre.inc.php b/htdocs/compta/pre.inc.php index e429b089308..747ab8ca2bf 100644 --- a/htdocs/compta/pre.inc.php +++ b/htdocs/compta/pre.inc.php @@ -99,12 +99,12 @@ function llxHeader($head = "", $title="", $help_url='') $menu->add(DOL_URL_ROOT."/compta/deplacement/", $langs->trans("Trips")); } - if ($conf->compta->enabled && $conf->compta->tva && $user->societe_id == 0) + if (($conf->compta->enabled || $conf->comptaexpert->enabled) && $conf->compta->tva && $user->societe_id == 0) { $menu->add(DOL_URL_ROOT."/compta/tva/index.php",$langs->trans("VAT")); } - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { $menu->add(DOL_URL_ROOT."/compta/charges/index.php",$langs->trans("Charges")); } diff --git a/htdocs/compta/recap-client.php b/htdocs/compta/recap-client.php index e6e2e7c7a46..590dca968bc 100644 --- a/htdocs/compta/recap-client.php +++ b/htdocs/compta/recap-client.php @@ -90,7 +90,8 @@ if ($socid > 0) $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $langs->load("compta"); $hselected=$h; $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; diff --git a/htdocs/docsoc.php b/htdocs/docsoc.php index ff90ef50a76..765614e5cae 100644 --- a/htdocs/docsoc.php +++ b/htdocs/docsoc.php @@ -134,7 +134,8 @@ if ($socid > 0) $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $langs->load("compta"); $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; $head[$h][1] = $langs->trans("Accountancy"); diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index d200d73331e..60c34a5cebd 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -103,7 +103,7 @@ if ($_GET["id"] > 0) $h++; } - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; $head[$h][1] = $langs->trans("ComptaCard"); diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 13f19d2b942..31cb3727701 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -104,7 +104,8 @@ if ( $societe->fetch($socid) ) $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $langs->load('compta'); $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$socid; $head[$h][1] = $langs->trans('Accountancy'); diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index d81e90cd1bc..bde52f5e911 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -354,20 +354,21 @@ class MenuLeft { } // Charges - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=charges&mainmenu=accountancy",$langs->trans("Charges"), 0, $user->rights->compta->charges->lire); if ($leftmenu=="charges") $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php",$langs->trans("SocialContributions"), 1, $user->rights->compta->charges->creer); } - if ($conf->compta->enabled && $conf->compta->tva && $user->societe_id == 0) + if (($conf->compta->enabled || $conf->comptaexpert->enabled) && $conf->compta->tva && $user->societe_id == 0) { $newmenu->add(DOL_URL_ROOT."/compta/tva/index.php?leftmenu=vat&mainmenu=accountancy",$langs->trans("VAT"),0,$user->rights->compta->charges->lire); if ($leftmenu=="vat") $newmenu->add_submenu(DOL_URL_ROOT."/compta/tva/fiche.php?action=create",$langs->trans("NewPayment"),1,$user->rights->compta->charges->creer); if ($leftmenu=="vat") $newmenu->add_submenu(DOL_URL_ROOT."/compta/tva/reglement.php",$langs->trans("Payments"),1,$user->rights->compta->charges->lire); } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { //$newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Ventilations")); //if ($leftmenu=="ventil") $newmenu->add_submenu(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("A ventiler"),1); //if ($leftmenu=="ventil") $newmenu->add_submenu(DOL_URL_ROOT."/compta/ventilation/lignes.php",$langs->trans("Ventilées"),1); @@ -407,7 +408,8 @@ class MenuLeft { } // Rapports - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { // Bilan, résultats $newmenu->add(DOL_URL_ROOT."/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy",$langs->trans("Reportings"),0,$user->rights->compta->resultat->lire); diff --git a/htdocs/includes/menus/barre_left/eldy_frontoffice.php b/htdocs/includes/menus/barre_left/eldy_frontoffice.php index 00e69cb47ff..c0cf571a152 100644 --- a/htdocs/includes/menus/barre_left/eldy_frontoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_frontoffice.php @@ -374,20 +374,21 @@ class MenuLeft { // Charges /* - if ($conf->compta->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled) { $newmenu->add(DOL_URL_ROOT."/compta/charges/index.php?leftmenu=charges&mainmenu=accountancy",$langs->trans("Charges"), 0, $user->rights->compta->charges->lire); if ($leftmenu=="charges") $newmenu->add_submenu(DOL_URL_ROOT."/compta/sociales/index.php",$langs->trans("SocialContributions"), 1, $user->rights->compta->charges->creer); } - if ($conf->compta->enabled && $conf->compta->tva && $user->societe_id == 0) + if (($conf->compta->enabled || $conf->comptaexpert->enabled) && $conf->compta->tva && $user->societe_id == 0) { $newmenu->add(DOL_URL_ROOT."/compta/tva/index.php?leftmenu=vat&mainmenu=accountancy",$langs->trans("VAT"),0,$user->rights->compta->charges->lire); if ($leftmenu=="vat") $newmenu->add_submenu(DOL_URL_ROOT."/compta/tva/fiche.php?action=create",$langs->trans("NewPayment"),1,$user->rights->compta->charges->creer); if ($leftmenu=="vat") $newmenu->add_submenu(DOL_URL_ROOT."/compta/tva/reglement.php",$langs->trans("Payments"),1,$user->rights->compta->charges->lire); } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { //$newmenu->add(DOL_URL_ROOT."/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Ventilations")); //if ($leftmenu=="ventil") $newmenu->add_submenu(DOL_URL_ROOT."/compta/ventilation/liste.php",$langs->trans("A ventiler"),1); //if ($leftmenu=="ventil") $newmenu->add_submenu(DOL_URL_ROOT."/compta/ventilation/lignes.php",$langs->trans("Ventilées"),1); diff --git a/htdocs/includes/menus/barre_top/default.php b/htdocs/includes/menus/barre_top/default.php index 9fe2d42c2b2..5fd3d90a035 100644 --- a/htdocs/includes/menus/barre_top/default.php +++ b/htdocs/includes/menus/barre_top/default.php @@ -144,9 +144,9 @@ class MenuTop { } // Entrée compta - if ($conf->compta->enabled || $conf->banque->enabled || $conf->caisse->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled || $conf->banque->enabled || $conf->caisse->enabled) { - if ($user->rights->compta->general->lire) + if ($user->rights->compta->general->lire || $user->rights->comptaexpert->general->lire) { $langs->load("compta"); diff --git a/htdocs/includes/menus/barre_top/eldy_backoffice.php b/htdocs/includes/menus/barre_top/eldy_backoffice.php index d4346383f85..6394cccbdde 100644 --- a/htdocs/includes/menus/barre_top/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_top/eldy_backoffice.php @@ -175,7 +175,7 @@ class MenuTop { } // Compta - if ($conf->compta->enabled || $conf->banque->enabled || $conf->caisse->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled || $conf->banque->enabled || $conf->caisse->enabled) { $langs->load("compta"); diff --git a/htdocs/includes/menus/barre_top/eldy_frontoffice.php b/htdocs/includes/menus/barre_top/eldy_frontoffice.php index b70b44f8471..3d3fc4b8f36 100644 --- a/htdocs/includes/menus/barre_top/eldy_frontoffice.php +++ b/htdocs/includes/menus/barre_top/eldy_frontoffice.php @@ -177,7 +177,7 @@ class MenuTop { } // Compta - if ($conf->compta->enabled || $conf->banque->enabled || $conf->caisse->enabled) + if ($conf->compta->enabled || $conf->comptaexpert->enabled || $conf->banque->enabled || $conf->caisse->enabled) { $langs->load("compta"); diff --git a/htdocs/includes/modules/societe/mod_codeclient_leopard.php b/htdocs/includes/modules/societe/mod_codeclient_leopard.php index bef0704422c..76041a07c05 100644 --- a/htdocs/includes/modules/societe/mod_codeclient_leopard.php +++ b/htdocs/includes/modules/societe/mod_codeclient_leopard.php @@ -18,8 +18,20 @@ * * $Id$ * $Source$ - * */ + +/** + \file htdocs/includes/modules/societe/mod_codeclient_leopard.class.php + \ingroup societe + \brief Fichier de la classe des gestion leopard des codes clients + \version $Revision$ +*/ + + +/** + \class mod_codeclient_leopard + \brief Classe permettant la gestion leopard des codes clients +*/ class mod_codeclient_leopard { diff --git a/htdocs/includes/modules/societe/mod_codeclient_zebre.php b/htdocs/includes/modules/societe/mod_codeclient_zebre.php index 817ccd293c9..ed9c36ee6ce 100644 --- a/htdocs/includes/modules/societe/mod_codeclient_zebre.php +++ b/htdocs/includes/modules/societe/mod_codeclient_zebre.php @@ -18,9 +18,21 @@ * * $Id$ * $Source$ - * */ +/** + \file htdocs/includes/modules/societe/mod_codeclient_zebre.class.php + \ingroup societe + \brief Fichier de la classe des gestion zebre des codes clients + \version $Revision$ +*/ + + +/** + \class mod_codeclient_zebre + \brief Classe permettant la gestion zebre des codes clients +*/ + class mod_codeclient_zebre { diff --git a/htdocs/includes/modules/societe/mod_codecompta_aquarium.php b/htdocs/includes/modules/societe/mod_codecompta_aquarium.php index d5dbe567133..6d13a876660 100644 --- a/htdocs/includes/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/includes/modules/societe/mod_codecompta_aquarium.php @@ -1,7 +1,7 @@ - * Copyright (C) 2005 Eric Seigne +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2006 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 @@ -20,84 +20,98 @@ * * $Id$ * $Source$ - * */ +/** + \file htdocs/includes/modules/societe/mod_codecompta_aquarium.class.php + \ingroup societe + \brief Fichier de la classe des gestion aquarium des codes compta des societes clientes + \version $Revision$ +*/ + + +/** + \class mod_codecompta_aquarium + \brief Classe permettant la gestion aquarium des codes compta des societes clients +*/ + class mod_codecompta_aquarium { + var $nom; - function mod_codecompta_aquarium() - { - $this->nom = "Aquarium"; - } - - function info() - { - return "Renvoie un code compta composé de 401 suivit du code tiers si c'est un fournisseur, et 411 suivit du code tiers si c'est un client (compta française)."; - } - - /** - * \brief Renvoi code - * \param DB Handler d'accès base - * \param societe Objet societe - */ - function get_code($DB, $societe) - { - $i = 0; - $this->db = $DB; - - if($societe->fournisseur == "1") - $this->code = "401".$societe->code_client; - if($societe->client == "1") - $this->code = "411".$societe->code_client; - - $is_dispo = $this->verif($DB, $this->code); - - while ( $is_dispo <> 0 && $i < 37) - { - $arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - - $this->code = $societe->prefix_comm . $societe->code_client . substr($arr, $i, 1); - - $is_dispo = $this->verif($DB, $this->code); - - $i++; - } + function mod_codecompta_aquarium() + { + $this->nom = "Aquarium"; + } + + function info() + { + return "Renvoie un code compta composé de 401 suivi du code tiers si c'est un fournisseur, et 411 suivit du code tiers si c'est un client"; + } - if ($is_dispo == 0) - { - return 0; - } - else - { - return -1; - } - - } + /** + * \brief Renvoi code compta d'une societe + * \param DB Handler d'accès base + * \param societe Objet societe + * \param type Type de tiers ('customer' ou 'supplier') + * \return int >=0 ok, <0 ko + */ + function get_code($DB, $societe, $type) + { + $i = 0; + $this->db = $DB; + + // Regle gestion compte compta + if ($type == 'supplier') $codetouse=$societe->code_client; + if ($type == 'customer') $codetouse=$societe->code_fournisseur; + + if ($type == 'supplier') $this->code = "401".$codetouse; + if ($type == 'customer') $this->code = "411".$codetouse; + + $is_dispo = $this->verif($DB, $this->code); + while ($is_dispo == 0 && $i < 37) // 40 char max + { + $arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + + $this->code = $societe->prefix_comm . $codetouse . substr($arr, $i, 1); + + $is_dispo = $this->verif($DB, $this->code); + + $i++; + } + + dolibarr_debug("mod_codecompta_aquarium::get_code code=>".$this->code); + return $is_dispo; + } + + + /** + * \brief Renvoi si un code compta est dispo + * \return int 0 non dispo, >0 dispo, <0 erreur + */ + function verif($db, $code) + { + $sql = "SELECT code_compta FROM ".MAIN_DB_PREFIX."societe"; + $sql .= " WHERE code_compta = '".$code."'"; + + if ($db->query($sql)) + { + if ($db->num_rows() == 0) + { + return 1; // Dispo + } + else + { + return 0; // Non dispo + } + } + else + { + return -1; // Erreur + } + } - function verif($db, $code) - { - $sql = "SELECT code_compta FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " WHERE code_compta = '".$code."'"; - - if ($db->query($sql)) - { - if ($db->num_rows() == 0) - { - return 0; - } - else - { - return -1; - } - } - else - { - return -2; - } - - } } ?> diff --git a/htdocs/includes/modules/societe/mod_codecompta_digitaria.php b/htdocs/includes/modules/societe/mod_codecompta_digitaria.php index 2a22fb7218a..26adef9243d 100644 --- a/htdocs/includes/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/includes/modules/societe/mod_codecompta_digitaria.php @@ -1,5 +1,6 @@ + * Copyright (C) 2006 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 @@ -18,11 +19,25 @@ * * $Id$ * $Source$ - * */ +/** + \file htdocs/includes/modules/societe/mod_codecompta_digitaria.class.php + \ingroup societe + \brief Fichier de la classe des gestion digitaria des codes compta des societes clientes + \version $Revision$ +*/ + + +/** + \class mod_codecompta_digitaria + \brief Classe permettant la gestion digitaria des codes compta des societes clients +*/ + class mod_codecompta_digitaria { + var $nom; + function mod_codecompta_digitaria() { diff --git a/htdocs/includes/modules/societe/mod_codecompta_panicum.php b/htdocs/includes/modules/societe/mod_codecompta_panicum.php index c9b465a1819..f5f04c17149 100644 --- a/htdocs/includes/modules/societe/mod_codecompta_panicum.php +++ b/htdocs/includes/modules/societe/mod_codecompta_panicum.php @@ -1,5 +1,6 @@ + * Copyright (C) 2006 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 @@ -18,11 +19,25 @@ * * $Id$ * $Source$ - * */ +/** + \file htdocs/includes/modules/societe/mod_codecompta_panicum.class.php + \ingroup societe + \brief Fichier de la classe des gestion panicum des codes compta des societes clientes + \version $Revision$ +*/ + + +/** + \class mod_codecompta_panicum + \brief Classe permettant la gestion panicum des codes compta des societes clients +*/ + class mod_codecompta_panicum { + var $nom; + function mod_codecompta_panicum() { diff --git a/htdocs/index.php b/htdocs/index.php index 21de4f670a4..dad4c01c736 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -219,7 +219,7 @@ if (MAIN_SHOW_WORKBOARD == 1) // // Nbre actions à faire (en retard) - if (($conf->commercial->enabled || $conf->compta->enabled) && $user->rights->actions->lire) + if (($conf->commercial->enabled || $conf->compta->enabled || $conf->comptaexpert->enabled) && $user->rights->actions->lire) { include_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); $board=new ActionComm($db); diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 86318ea7f00..9bbecfc5086 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -339,6 +339,15 @@ $conf->export->dir_ouput=DOL_DATA_ROOT."/export"; * Modification de quelques variable de conf en fonction des Constantes */ +// societe +if (! $conf->global->SOCIETE_CODECLIENT_ADDON) $conf->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard"; +if (! $conf->global->SOCIETE_CODEFOURNISSEUR_ADDON) $conf->global->SOCIETE_CODEFOURNISSEUR_ADDON="mod_codeclient_leopard"; +if (! $conf->global->SOCIETE_CODECOMPTA_ADDON) $conf->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum"; +// Pour compatibilite ascendante: +if ($conf->global->CODECLIENT_ADDON) $conf->global->SOCIETE_CODECLIENT_ADDON=$conf->global->CODECLIENT_ADDON; +if ($conf->global->CODEFOURNISSEUR_ADDON) $conf->global->SOCIETE_CODEFOURNISSEUR_ADDON=$conf->global->CODEFOURNISSEUR_ADDON; + + // conf->use_preview_tabs $conf->use_preview_tabs=1; if (isset($conf->global->MAIN_USE_PREVIEW_TABS)) $conf->use_preview_tabs=$conf->global->MAIN_USE_PREVIEW_TABS; diff --git a/htdocs/pre.inc.php b/htdocs/pre.inc.php index 8902024a658..d884e2a461b 100644 --- a/htdocs/pre.inc.php +++ b/htdocs/pre.inc.php @@ -71,7 +71,7 @@ function llxHeader($head = "") { } } - if ($conf->compta->enabled && $user->rights->general->lire) + if (($conf->compta->enabled || $conf->comptaexpert->enabled) && $user->rights->general->lire) { $langs->load("compta"); $menu->add(DOL_URL_ROOT."/compta/index.php", $langs->trans("Accountancy")); diff --git a/htdocs/soc.php b/htdocs/soc.php index 4f2596ce913..e4d5fc9f865 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -48,7 +48,7 @@ if (! $user->rights->societe->creer) } $socid = isset($_GET["socid"])?$_GET["socid"]:''; -if (! $socid && ($_GET["action"] != 'create' && $_POST["action"] == 'create')) accessforbidden(); +if (! $socid && ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add')) accessforbidden(); // Sécurité accés client if ($user->societe_id > 0) @@ -116,25 +116,6 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update') $soc->fournisseur = $_POST["fournisseur"]; $soc->tva_assuj = $_POST["assujtva_value"]; - if ($_POST["action"] == 'update') - { - $result = $soc->update($socid,$user); - if ($result <= 0) - { - $soc->id = $socid; - // doublon sur le prefix comm - $reload = 0; - $mesg = $soc->error; //"Erreur, le prefix '".$soc->prefix_comm."' existe déjà vous devez en choisir un autre"; - $_GET["action"]= "edit"; - } - else - { - Header("Location: soc.php?socid=".$socid); - exit; - } - - } - if ($_POST["action"] == 'add') { $result = $soc->create($user); @@ -146,10 +127,28 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update') } else { + $mesg=$soc->error; $_GET["action"]='create'; - //dolibarr_print_error($db); } } + + if ($_POST["action"] == 'update') + { + $result = $soc->update($socid,$user); + if ($result > 0) + { + Header("Location: soc.php?socid=".$socid); + exit; + } + else + { + $soc->id = $socid; + $reload = 0; + $mesg = $soc->error; + $_GET["action"]= "edit"; + } + } + } if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->societe->creer) @@ -640,7 +639,8 @@ else $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $langs->load("compta"); $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id; $head[$h][1] = $langs->trans("Accountancy"); diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 3043d3fe8dd..7897f8fcc56 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -87,9 +87,10 @@ class Societe { * \param DB handler accès base de données * \param id id societe (0 par defaut) */ - function Societe($DB, $id=0) { + global $conf; + $this->db = $DB; $this->creation_bit = 0; @@ -101,21 +102,26 @@ class Societe { $this->effectif_id = 0; $this->forme_juridique_code = 0; + // Définit selon les modules codeclient et codefournisseur + // definit module code client - if (defined('CODECLIENT_ADDON') && strlen(CODECLIENT_ADDON) > 0) $var = CODECLIENT_ADDON; - else $var = "mod_codeclient_leopard"; - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$var.'.php'; - - $this->mod_codeclient = new $var; + $varclient = $conf->global->SOCIETE_CODECLIENT_ADDON; + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$varclient.'.php'; + $this->mod_codeclient = new $varclient; $this->codeclient_modifiable = $this->mod_codeclient->code_modifiable; // definit module code fournisseur - if (defined('CODEFOURNISSEUR_ADDON') && strlen(CODEFOURNISSEUR_ADDON) > 0) $var = CODEFOURNISSEUR_ADDON; - else $var = "mod_codeclient_leopard"; - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$var.'.php'; - - $this->mod_codefournisseur = new $var; - $this->codeclient_modifiable = $this->mod_codeclient->code_modifiable; + $varfournisseur = $conf->global->SOCIETE_CODEFOURNISSEUR_ADDON; + if ($varfournisseur == $varclient) // Optimisation + { + $this->mod_codefournisseur = $this->mod_codeclient; + } + else + { + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$varfournisseur.'.php'; + $this->mod_codefournisseur = new $varfournisseur; + } + $this->codefournisseur_modifiable = $this->mod_codefournisseur->code_modifiable; return 1; } @@ -250,6 +256,7 @@ class Societe { dolibarr_syslog("Societe::Update"); + // Nettoyage des paramètres $this->id=$id; $this->capital=trim($this->capital); $this->nom=trim($this->nom); @@ -270,7 +277,8 @@ class Societe { $this->effectif_id=trim($this->effectif_id); $this->forme_juridique_code=trim($this->forme_juridique_code); $this->tva_assuj=trim($this->tva_assuj); - $result = $this->verify(); + + $result = $this->verify(); // Verifie que nom obligatoire et code client ok et unique if ($result >= 0) { @@ -286,11 +294,6 @@ class Societe { $this->fax = ereg_replace(" ","",$this->fax); $this->fax = ereg_replace("\.","",$this->fax); - /* - * Supression des if (trim(valeur)) pour construire la requete - * sinon il est impossible de vider les champs - */ - $sql = "UPDATE ".MAIN_DB_PREFIX."societe "; $sql .= " SET nom = '" . addslashes($this->nom) ."'"; // Champ obligatoire $sql .= ", datea = now()"; @@ -330,40 +333,34 @@ class Societe { if ($this->creation_bit || $this->codeclient_modifiable) { - // Attention check_codeclient peut modifier le code - // suivant le module utilis - + // Attention check_codeclient peut modifier le code suivant le module utilise $this->check_codeclient(); $sql .= ", code_client = ".($this->code_client?"'".addslashes($this->code_client)."'":"null"); - // Attention check_codecompta_client peut modifier le code - // suivant le module utilis - - $this->check_codecompta_client(); + // Attention get_codecompta peut modifier le code suivant le module utilise + $this->get_codecompta('customer'); $sql .= ", code_compta = ".($this->code_compta?"'".addslashes($this->code_compta)."'":"null"); } if ($this->creation_bit || $this->codefournisseur_modifiable) { - // Attention check_codefournisseur peut modifier le code - // suivant le module utilis - + // Attention check_codefournisseur peut modifier le code suivant le module utilise $this->check_codefournisseur(); $sql .= ", code_fournisseur = ".($this->code_fournisseur?"'".addslashes($this->code_fournisseur)."'":"null"); - // Attention check_codecompta_fournisseur peut modifier le code - // suivant le module utilis - - $this->check_codecompta_fournisseur(); + // Attention get_codecompta peut modifier le code suivant le module utilise + $this->get_codecompta('supplier'); $sql .= ", code_compta_fournisseur = ".($this->code_compta_fournisseur?"'".addslashes($this->code_compta_fournisseur)."'":"null"); } if ($user) $sql .= ",fk_user_modif = '".$user->id."'"; $sql .= " WHERE idp = '" . $id ."'"; + // Verifie que code compta défini + $resql=$this->db->query($sql); if ($resql) { @@ -1188,127 +1185,101 @@ function set_price_level($price_level, $user) return $this->bank_account->verif(); } - /** - * \brief Verifie code client - * \return Renvoie 0 si ok, peut modifier le code client suivant le module utilisé - */ - function verif_codeclient() - { - if (defined('CODECLIENT_ADDON') && strlen(CODECLIENT_ADDON) > 0) - { - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODECLIENT_ADDON.'.php'; - - $var = CODECLIENT_ADDON; - - $mod = new $var; - - return $mod->verif($this->db, $this->code_client, $this->id); - } - else - { - return 0; - } - } - - function check_codeclient() - { - if (defined('CODECLIENT_ADDON') && strlen(CODECLIENT_ADDON) > 0) - { - - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODECLIENT_ADDON.'.php'; - - $var = CODECLIENT_ADDON; - - $mod = new $var; - - return $mod->verif($this->db, $this->code_client); - } - else - { - return 0; - } - } - - function check_codefournisseur() - { - if (defined('CODEFOURNISSEUR_ADDON') && strlen(CODEFOURNISSEUR_ADDON) > 0) - { - - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODEFOURNISSEUR_ADDON.'.php'; - - $var = CODEFOURNISSEUR_ADDON; - - $mod = new $var; - - return $mod->verif($this->db, $this->code_fournisseur); - } - else - { - return 0; - } - } - - /** - * \brief Renvoie un code compta, suivant le module le code compta renvoyé - * peut être identique à celui saisit ou généré automatiquement - * - * A ce jour seul la génération automatique est implémentée - */ - function check_codecompta_client() - { - if (defined('CODECOMPTA_ADDON') && strlen(CODECOMPTA_ADDON) > 0) - { - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODECOMPTA_ADDON.'.php'; - - $var = CODECOMPTA_ADDON; - - $mod = new $var; - - $result = $mod->get_code($this->db, $this); - - $this->code_compta = $mod->code; - - return $result; - } - else - { - $this->code_compta = ''; - return 0; - } - } - - - /** - * \brief Renvoie un code compta, suivant le module le code compta renvoyé - * peut être identique à celui saisit ou généré automatiquement - * - * A ce jour seul la génération automatique est implémentée - */ - function check_codecompta_fournisseur() - { - if (defined('CODECOMPTAFOURN_ADDON') && strlen(CODECOMPTAFOURN_ADDON) > 0) - { - require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.CODECOMPTAFOURN_ADDON.'.php'; - - $var = CODECOMPTAFOURN_ADDON; - - $mod = new $var; - - $result = $mod->get_code($this->db, $this); - - $this->code_compta_fournisseur = $mod->code; - - return $result; - } - else - { - $this->code_compta = ''; - return 0; - } - } + /** + * \brief Verifie code client + * \return Renvoie 0 si ok, peut modifier le code client suivant le module utilis + */ + function verif_codeclient() + { + global $conf; + if ($conf->global->SOCIETE_CODECLIENT_ADDON) + { + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$conf->global->SOCIETE_CODECLIENT_ADDON.'.php'; + + $var = $conf->global->SOCIETE_CODECLIENT_ADDON; + + $mod = new $var; + + return $mod->verif($this->db, $this->code_client, $this->id); + } + else + { + return 0; + } + } + + + function check_codeclient() + { + if ($conf->global->SOCIETE_CODECLIENT_ADDON) + { + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$conf->global->SOCIETE_CODECLIENT_ADDON.'.php'; + + $var = $conf->global->SOCIETE_CODECLIENT_ADDON; + + $mod = new $var; + + return $mod->verif($this->db, $this->code_client); + } + else + { + return 0; + } + } + + function check_codefournisseur() + { + if ($conf->global->CODEFOURNISSEUR_ADDON) + { + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$conf->global->CODEFOURNISSEUR_ADDON.'.php'; + + $var = $conf->global->CODEFOURNISSEUR_ADDON; + + $mod = new $var; + + return $mod->verif($this->db, $this->code_fournisseur); + } + else + { + return 0; + } + } + /** + * \brief Renvoie un code compta, suivant le module de code compta. + * Peut être identique à celui saisit ou généré automatiquement. + * A ce jour seul la génération automatique est implémentée + * \param type Type de tiers ('customer' ou 'supplier') + */ + function get_codecompta($type) + { + global $conf; + + if ($conf->global->SOCIETE_CODECOMPTA_ADDON) + { + require_once DOL_DOCUMENT_ROOT.'/includes/modules/societe/'.$conf->global->SOCIETE_CODECOMPTA_ADDON.'.php'; + + $var = $conf->global->SOCIETE_CODECOMPTA_ADDON; + + $mod = new $var; + + $result = $mod->get_code($this->db, $this, $type); + + if ($type == 'customer') $this->code_compta = $mod->code; + if ($type == 'supplier') $this->code_compta_fournisseur = $mod->code; + + return $result; + } + else + { + if ($type == 'customer') $this->code_compta = ''; + if ($type == 'supplier') $this->code_compta_fournisseur = ''; + return 0; + } + } + /** * \brief Défini la société mère pour les filiales * \param id id compagnie mère à positionner diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php index 00dd1f03187..755a4561c50 100644 --- a/htdocs/societe/info.php +++ b/htdocs/societe/info.php @@ -94,7 +94,8 @@ if ($soc->fournisseur) $h++; } -if ($conf->compta->enabled) { +if ($conf->compta->enabled || $conf->comptaexpert->enabled) +{ $langs->load("compta"); $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id; $head[$h][1] = $langs->trans("Accountancy"); diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index e80e396f610..76bb88df937 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -143,8 +143,9 @@ if ( $soc->fetch($soc->id) ) $h++; } - if ($conf->compta->enabled) { - $langs->load("compta"); + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { + $langs->load("compta"); $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id; $head[$h][1] = $langs->trans("Accountancy"); $h++; diff --git a/htdocs/socnote.php b/htdocs/socnote.php index 3418ee4ed73..4e7e0515e2c 100644 --- a/htdocs/socnote.php +++ b/htdocs/socnote.php @@ -103,7 +103,8 @@ if ($socidp > 0) $h++; } - if ($conf->compta->enabled) { + if ($conf->compta->enabled || $conf->comptaexpert->enabled) + { $langs->load("compta"); $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; $head[$h][1] = $langs->trans("Accountancy"); diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 3e900063fc5..4e0d1e5e047 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -315,7 +315,12 @@ if ($action == 'create') $generated_password=''; if ($conf->global->USER_PASSWORD_GENERATED) { - $generated_passowrd=''; + $nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED); + $nomfichier=$nomclass.".class.php"; + //print DOL_DOCUMENT_ROOT."/includes/modules/security/generate/".$nomclass; + require_once(DOL_DOCUMENT_ROOT."/includes/modules/security/generate/".$nomfichier); + $genhandler=new $nomclass($db,$conf,$lang,$user); + $generated_password=$genhandler->getNewGeneratedPassword(); } print ''.$langs->trans("Password").''; print '';