diff --git a/htdocs/admin/avoir.php b/htdocs/admin/avoir.php index 72f1b5f7c71..a22acaf7737 100644 --- a/htdocs/admin/avoir.php +++ b/htdocs/admin/avoir.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2005-2006 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -37,6 +37,10 @@ if (!$user->admin) accessforbidden(); +/* + * Actions + */ + if ($_GET["action"] == 'set') { $sql = "INSERT INTO ".MAIN_DB_PREFIX."avoir_model_pdf (nom) VALUES ('".$_GET["value"]."')"; @@ -121,7 +125,7 @@ dolibarr_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); /* * Module numérotation */ -print "
"; + print_titre($langs->trans("DiscountsNumberingModules")); print ''; @@ -279,7 +283,7 @@ print " \n"; print " \n"; print "\n"; print "\n \n \n\n"; -print "
".$langs->trans("Name")."".$langs->trans("Value")."
".$langs->trans("Directory")."".$conf->avoir->dir_output."
\n
"; +print "\n"; $db->close(); diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 9dd7f3c9788..3fc2304bddf 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -69,7 +69,11 @@ if ($_GET['action'] == 'delete') } } +/* + * Affichage page + */ +$html=new Form($db); print_titre($langs->trans('ComptaSetup')); @@ -142,7 +146,7 @@ if ($result) print ''; } print ''; - print '   '; + print '   '; print "\n"; print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 1a377736334..852675da1f8 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -93,6 +93,8 @@ if ($_GET["action"] == 'delete') */ $dir = "../includes/modules/facture/"; +$html=new Form($db); + llxHeader("",""); @@ -112,7 +114,7 @@ dolibarr_fiche_head($head, $hselected, $langs->trans("ModuleSetup")); /* * Module numérotation */ -print "
"; + print_titre($langs->trans("BillsNumberingModule")); print ''; @@ -342,7 +344,7 @@ print '
'; echo "Forcer la définition de la date des factures lors de la validation"; print ''; $forcedate=(defined("FAC_FORCE_DATE_VALIDATION") && FAC_FORCE_DATE_VALIDATION)?1:0; -$html=new Form($db); + print $html->selectyesno("forcedate",$forcedate,1); print ''; print ''; @@ -352,8 +354,6 @@ print ''; print '
'; -print "
"; - $db->close(); llxFooter('$Date$ - $Revision$'); diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php index 8a13b98008b..3a4b45231ae 100644 --- a/htdocs/admin/societe.php +++ b/htdocs/admin/societe.php @@ -44,6 +44,7 @@ if ($_GET["action"] == 'setcodeclient') if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$_GET["value"])) { Header("Location: ".$_SERVER["PHP_SELF"]); + exit; } else { @@ -56,6 +57,20 @@ if ($_GET["action"] == 'setcodecompta') if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON",$_GET["value"])) { Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dolibarr_print_error($db); + } +} + +if ($_POST["action"] == 'setdisablenotifications') +{ + if (dolibarr_set_const($db, "SOCIETE_DISABLE_NOTIFICATIONS",! $_POST["constvalue"])) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; } else { @@ -69,9 +84,11 @@ if ($_GET["action"] == 'setcodecompta') * */ -llxHeader(); +$form=new Form($db); +llxHeader(); + print_titre($langs->trans("CompanySetup")); print "
"; @@ -193,6 +210,43 @@ if ($handle) } print "\n"; +print '
'; + + +// Choix du module de gestion des codes compta + +print_titre($langs->trans("OtherOptions")); + +$var=true; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +print ''; +print ''; +print ''; + +$var=!$var; +print ''; +print '\n"; +print ''; +print ''; +print ''; +print "\n"; + +print ''; + +print "
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Description").' 
'.$langs->trans("UseNotifications")."'; +$form->selectyesnonum('constvalue',! $conf->global->SOCIETE_DISABLE_NOTIFICATIONS); +print ''.$langs->trans("NotificationsDesc").''; +print '   '; +print '
\n"; + $db->close(); diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 51bdf74557b..d1995689c5c 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -30,14 +30,12 @@ */ require_once("./pre.inc.php"); - -if (!$user->rights->societe->lire) accessforbidden(); - -require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); -require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); -require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); -require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); +require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); +if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); +if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); +if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); $langs->load("companies"); $langs->load("orders"); @@ -46,6 +44,7 @@ $langs->load("contracts"); if ($conf->fichinter->enabled) $langs->load("interventions"); $user->getrights("commercial"); +if (!$user->rights->societe->lire) accessforbidden(); $socidp = isset($_GET["socid"])?$_GET["socid"]:''; if ($socidp == '') accessforbidden(); @@ -192,69 +191,10 @@ if ($socidp > 0) /* * Affichage onglets */ - $h = 0; - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Company"); - $h++; + $head = societe_prepare_head($objsoc); - if ($objsoc->client==1) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Customer");; - $h++; - } - if ($objsoc->client==2) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($objsoc->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - 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"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Note"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT."/bookmarks/fiche.php?action=add&socid=".$objsoc->id."&urlsource=".$_SERVER["PHP_SELF"]."?socid=".$objsoc->id; - $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); - $head[$h][2] = 'image'; - $h++; - } - - dolibarr_fiche_head($head, $hselected, $objsoc->nom); + dolibarr_fiche_head($head, 'customer', $objsoc->nom); /* diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 3b62871ab73..85ed0afdd1f 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -28,6 +28,7 @@ */ require_once("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/prospect.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); @@ -96,6 +97,13 @@ if ($socid > 0) exit; } + /* + * Affichage onglets + */ + $head = societe_prepare_head($societe); + + dolibarr_fiche_head($head, 'prospect', $societe->nom); + /* TODO Finir verification PagesJaunes * print '
'; @@ -105,56 +113,7 @@ if ($socid > 0) * print '
'; */ - $h=0; - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; - $head[$h][1] = $langs->trans("Prospect"); - $hselected=$h; - $h++; - - if ($societe->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - 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"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Note"); - $h++; - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - - - dolibarr_fiche_head($head, $hselected, $societe->nom); - - /* - * - */ print "\n"; print '
'; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index f65555fe909..8af362dfa8c 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -28,6 +28,7 @@ */ require_once("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); $user->getrights('propale'); @@ -69,77 +70,24 @@ if ($user->societe_id > 0) *********************************************************************************/ if ($_socid > 0) { - // On recupere les donnees societes par l'objet - $objsoc = new Societe($db); - $objsoc->id=$_socid; - $objsoc->fetch($_socid,$to); + // On recupere les donnees societes par l'objet + $objsoc = new Societe($db); + $objsoc->id=$_socid; + $objsoc->fetch($_socid,$to); + + $dac = strftime("%Y-%m-%d %H:%M", time()); + if ($errmesg) + { + print '
'.$errmesg.'

'; + } - $dac = strftime("%Y-%m-%d %H:%M", time()); - if ($errmesg) - { - print '
'.$errmesg.'

'; - } - - /* - * Affichage onglets - */ - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - - if ($objsoc->client==1) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; - } - if ($objsoc->client==2) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($objsoc->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - 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++; - } + /* + * Affichage onglets + */ + $head = societe_prepare_head($objsoc); - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Note"); - $h++; + dolibarr_fiche_head($head, 'relativediscount', $objsoc->nom); - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT."/comm/index.php?socidp=$objsoc->id&action=add_bookmark"; - $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); - $head[$h][2] = 'image'; - } - - dolibarr_fiche_head($head, $hselected, $objsoc->nom); /* * diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 4f6d0f9b1ec..3d794aab804 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -28,6 +28,7 @@ */ require_once("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); $user->getrights('propale'); $user->getrights('commande'); @@ -92,75 +93,21 @@ llxHeader(); if ($_socid > 0) { - if ($mesg) print "$mesg
"; + if ($mesg) print "$mesg
"; + + // On recupere les donnees societes par l'objet + $objsoc = new Societe($db); + $objsoc->id=$_socid; + $objsoc->fetch($_socid,$to); + + $dac = strftime("%Y-%m-%d %H:%M", time()); + + /* + * Affichage onglets + */ + $head = societe_prepare_head($objsoc); - // On recupere les donnees societes par l'objet - $objsoc = new Societe($db); - $objsoc->id=$_socid; - $objsoc->fetch($_socid,$to); - - $dac = strftime("%Y-%m-%d %H:%M", time()); - - /* - * Affichage onglets - */ - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - - if ($objsoc->client==1) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; - } - if ($objsoc->client==2) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($objsoc->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - 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++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Note"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT."/comm/index.php?socidp=$objsoc->id&action=add_bookmark"; - $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); - $head[$h][2] = 'image'; - } - - dolibarr_fiche_head($head, $hselected, $objsoc->nom); + dolibarr_fiche_head($head, 'absolutediscount', $objsoc->nom); /* * diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index bf5e1e4c55a..dcc0081d2d1 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -28,6 +28,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); @@ -108,74 +109,14 @@ if ($socid > 0) dolibarr_print_error($db,$societe->error); } - /* - * Affichage onglets - */ - $h = 0; + /* + * Affichage onglets + */ + $head = societe_prepare_head($societe); - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Company"); - $h++; + dolibarr_fiche_head($head, 'compta', $societe->nom); - if ($societe->client==1) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; - } - if ($societe->client==2) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($societe->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - if ($conf->compta->enabled || $conf->comptaexpert->enabled) - { - $langs->load("compta"); - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Accountancy"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Note"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT."/index.php?socidp=$societe->id&action=add_bookmark"; - $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); - $head[$h][2] = 'image'; - } - - dolibarr_fiche_head($head, $hselected, $societe->nom); - - /* - * - */ print "\n"; print '
'; diff --git a/htdocs/docsoc.php b/htdocs/docsoc.php index df1b1adc99a..445fb4f1007 100644 --- a/htdocs/docsoc.php +++ b/htdocs/docsoc.php @@ -29,6 +29,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); $langs->load("companies"); $langs->load('other'); @@ -108,61 +109,13 @@ if ($socid > 0) $societe = new Societe($db); if ($societe->fetch($socid)) { - $h = 0; + /* + * Affichage onglets + */ + $head = societe_prepare_head($societe); + + dolibarr_fiche_head($head, 'document', $societe->nom); - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - - if ($societe->client==1) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; - } - - if ($societe->client==2) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($societe->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - 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"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Note"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Documents"); - $hselected = $h; - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - dolibarr_fiche_head($head, $hselected, $societe->nom); // Construit liste des fichiers clearstatcache(); diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 0f1cab6c2ec..31ff0b51574 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -30,6 +30,7 @@ require('./pre.inc.php'); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); $langs->load('suppliers'); $langs->load('products'); @@ -81,60 +82,9 @@ if ( $societe->fetch($socid) ) /* * Affichage onglets */ - $h = 0; + $head = societe_prepare_head($societe); - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$socid; - $head[$h][1] = $langs->trans('Company'); - $h++; - - if ($societe->client==1) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid; - $head[$h][1] = $langs->trans('Customer'); - $h++; - } - if ($societe->client==2) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$socid; - $head[$h][1] = $langs->trans('Prospect'); - $h++; - } - if ($societe->fournisseur) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid; - $head[$h][1] = $langs->trans('Supplier'); - $h++; - } - - 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'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; - $head[$h][1] = $langs->trans('Note'); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans('Documents'); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans('Notifications'); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - dolibarr_fiche_head($head, $hselected, $societe->nom); + dolibarr_fiche_head($head, 'supplier', $societe->nom); print ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3e41de3b3f3..c723e33434f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -342,11 +342,13 @@ RuleForGeneratedPasswords=Rule to generate suggested passwords DoNotSuggest=Do not suggest any password ##### Company setup ##### CompanySetup=Companies module setup -CompanyCodeChecker=Module for checking third parties code (customer or supplier) -AccountCodeManager=Module for managing accountancy code (customer or supplier) -ModuleCompanyCodeAquarium=Return an accountancy code built by "401" followed by third party supplier code for a supplier accountancy code, and "411" followed by third party customer code for a customer accountancy code -ModuleCompanyCodePanicum=Return an accountancy code that is always same than the one typed. For test use +CompanyCodeChecker=Module for third parties code checking (customer or supplier) +AccountCodeManager=Module for accountancy code generation (customer or supplier) +ModuleCompanyCodeAquarium=Return an accountancy code built by "401" followed by third party supplier code for a supplier accountancy code, and "411" followed by third party customer code for a customer accountancy code. +ModuleCompanyCodePanicum=Return an empty accountancy code. ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. Le code est composé du caractère 'C' en première position suivi des 5 premiers caractères du code tiers. +UseNotifications=Use notifications +NotificationsDesc=Notifications feature allows you to silently send automatic mail, for some Dolibarr events, to companies that are configured to ##### Webcal setup ##### WebCalSetup=Webcalendar link setup WebCalSyncro=Add Dolibarr events to WebCalendar diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index df800372e60..5a4f45aca93 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -343,10 +343,12 @@ DoNotSuggest=Ne pas proposer ##### Company setup ##### CompanySetup=Configuration du module Sociétés CompanyCodeChecker=Module de contrôle des codes tiers (clients/fournisseurs) -AccountCodeManager=Module de gestion des codes compta (clients/fournisseurs) -ModuleCompanyCodeAquarium=Renvoie un code compta composé de 401 suivi du code tiers fournisseur pour le code compta fournisseur, et 411 suivi du code tiers client pour le code compta client -ModuleCompanyCodePanicum=Renvoie un code compta identique à celui saisi. Module dédié aux tests +AccountCodeManager=Module de génération des codes compta (clients/fournisseurs) +ModuleCompanyCodeAquarium=Renvoie un code compta composé de 401 suivi du code tiers fournisseur pour le code compta fournisseur, et 411 suivi du code tiers client pour le code compta client. +ModuleCompanyCodePanicum=Renvoie un code compta vide. ModuleCompanyCodeDigitaria=Renvoie un code compta composé suivant le code tiers. Le code est composé du caractère 'C' en première position suivi des 5 premiers caractères du code tiers. +UseNotifications=Utiliser les notifications +NotificationsDesc=La fonction des notifications permet d'envoyer automatiquement un mail, pour certains évênement Dolibarr, aux sociétés configurées pour. ##### Webcal setup ##### WebCalSetup=Configuration du lien vers le calendrier Webcalendar WebCalSyncro=Intégrer les évênements Dolibarr dans WebCalendar diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php new file mode 100644 index 00000000000..f8f5d101c05 --- /dev/null +++ b/htdocs/lib/company.lib.php @@ -0,0 +1,112 @@ + + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * or see http://www.gnu.org/ + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/lib/company.lib.php + \brief Ensemble de fonctions de base pour le module societe + \version $Revision$ + + Ensemble de fonctions de base de dolibarr sous forme d'include +*/ + +function societe_prepare_head($objsoc) +{ + global $langs, $conf; + $h = 0; + $head = array(); + + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Company"); + $head[$h][2] = 'company'; + $h++; + + if ($objsoc->client==1) + { + $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Customer");; + $head[$h][2] = 'customer'; + $h++; + } + if ($objsoc->client==2) + { + $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$objsoc->id; + $head[$h][1] = $langs->trans("Prospect"); + $head[$h][2] = 'prospect'; + $h++; + } + if ($objsoc->fournisseur) + { + $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Supplier"); + $head[$h][2] = 'supplier'; + $h++; + } + + 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"); + $head[$h][2] = 'compta'; + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Note"); + $head[$h][2] = 'note'; + $h++; + + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Documents"); + $head[$h][2] = 'document'; + $h++; + } + + if (! $conf->global->SOCIETE_DISABLE_NOTIFICATIONS) + { + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Notifications"); + $head[$h][2] = 'notify'; + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT."/bookmarks/fiche.php?action=add&socid=".$objsoc->id."&urlsource=".$_SERVER["PHP_SELF"]."?socid=".$objsoc->id; + $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); + $head[$h][2] = 'image'; + $h++; + } + + return $head; +} + +?> \ No newline at end of file diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index a1986621b56..fab5ef48cdd 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -223,7 +223,7 @@ function dolibarr_syslog($message, $level=LOG_ERR) \param active 0=onglet non actif, 1=onglet actif \param title Titre tabelau ("" par defaut) */ -function dolibarr_fiche_head($links, $active=0, $title='') +function dolibarr_fiche_head($links, $active='0', $title='') { print '
'."\n"; @@ -248,7 +248,9 @@ function dolibarr_fiche_head($links, $active=0, $title='') } else { - if ($i == $active) + //print "x $i $active ".$links[$i][2]." z"; + if ((is_numeric($active) && $i == $active) + || (! is_numeric($active) && $active == $links[$i][2])) { print ''.$links[$i][1].''."\n"; } diff --git a/htdocs/soc.php b/htdocs/soc.php index 4eac8302775..1cd0c67a9c4 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -31,6 +31,7 @@ */ require("pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); $user->getrights('societe'); $user->getrights('commercial'); @@ -628,60 +629,9 @@ else exit; } - $h=0; + $head = societe_prepare_head($soc); - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Company"); - $hselected=$h; - $h++; - - if ($soc->client==1) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; - } - if ($soc->client==2) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$soc->id; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($soc->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Supplier");; - $h++; - } - - 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++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Note"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - dolibarr_fiche_head($head, $hselected, $soc->nom); + dolibarr_fiche_head($head, 'company', $soc->nom); // Confirmation de la suppression de la facture diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php index cb55c8fcf60..6195eb5a059 100644 --- a/htdocs/societe/info.php +++ b/htdocs/societe/info.php @@ -27,7 +27,8 @@ */ require("./pre.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/societe.class.php"); $langs->load("companies"); $langs->load("other"); @@ -69,60 +70,13 @@ $soc->id = $socid; $soc->fetch($socid); $soc->info($socid); -$h=0; +/* + * Affichage onglets + */ +$head = societe_prepare_head($soc); -$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; -$head[$h][1] = $langs->trans("Company"); -$h++; +dolibarr_fiche_head($head, 'info', $soc->nom); -if ($soc->client==1) -{ - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; -} -if ($soc->client==2) -{ - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$soc->id; - $head[$h][1] = $langs->trans("Prospect"); - $h++; -} -if ($soc->fournisseur) -{ - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Supplier");; - $h++; -} - -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++; -} - -$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$soc->id; -$head[$h][1] = $langs->trans("Note"); -$h++; - -if ($user->societe_id == 0) -{ - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; -} - -$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$soc->id; -$head[$h][1] = $langs->trans("Notifications"); -$h++; - -$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$soc->id; -$head[$h][1] = $langs->trans("Info"); -$hselected=$h; -$h++; - -dolibarr_fiche_head($head, $hselected, $soc->nom); print '
'; diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 09c155e1c56..a4748fa1220 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -28,6 +28,7 @@ */ require("pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); $langs->load("companies"); @@ -95,13 +96,8 @@ if ($_POST["action"] == 'add') */ if ($_GET["action"] == 'delete') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";"; - $db->query($sql); - - // if ($db->query($sql)) - // { - // TODO ajouter une sécu pour la suppression - //} + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";"; + $db->query($sql); } @@ -117,66 +113,13 @@ if ( $soc->fetch($soc->id) ) $html = new Form($db); $langs->load("other"); - $h=0; - - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - - if ($soc->client==1) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; - } - - if ($soc->client==2) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$soc->id; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($soc->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - 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++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Note"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Notifications"); - $hselected=$h; - $h++; + /* + * Affichage onglets + */ + $head = societe_prepare_head($soc); + + dolibarr_fiche_head($head, 'notify', $soc->nom); - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - dolibarr_fiche_head($head, $hselected, $soc->nom); - - /* - * - * - */ print ''; print ''; diff --git a/htdocs/socnote.php b/htdocs/socnote.php index eeb269c3d70..9170d110191 100644 --- a/htdocs/socnote.php +++ b/htdocs/socnote.php @@ -29,6 +29,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); $langs->load("companies"); @@ -78,78 +79,28 @@ if ($socidp > 0) $societe = new Societe($db, $socidp); $societe->fetch($socidp); - - $h=0; - - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - - if ($societe->client==1) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; - } - - if ($societe->client==2) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($societe->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - 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"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Note"); - $hselected = $h; - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - dolibarr_fiche_head($head, $hselected, $societe->nom); + /* + * Affichage onglets + */ + $head = societe_prepare_head($societe); - - print ""; - - print '
'.$langs->trans("Name").''.$soc->nom.'
'; - print ''; - print ''; - print ""; - print ''; - print "
'.$langs->trans("Note").''.$langs->trans("CurrentNote").'
'; - print ""; - print "id."\">"; - print '
'; - print '
'.nl2br($societe->note).'
"; - - print ''; + dolibarr_fiche_head($head, 'note', $societe->nom); + + + print "
"; + + print ''; + print ''; + print ''; + print ""; + print ''; + print "
'.$langs->trans("Note").''.$langs->trans("CurrentNote").'
'; + print ""; + print "id."\">"; + print '
'; + print '
'.nl2br($societe->note).'
"; + + print '
'; } print '
';