From 41a5d50b5b914160fe847993fbe78e9b8d15234e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 May 2006 19:06:40 +0000 Subject: [PATCH] Qual: Mise en facteur du code de gestion des onglets commande --- htdocs/commande/apercu.php | 44 +-------- htdocs/commande/contact.php | 148 ++++++++++++------------------- htdocs/commande/fiche.php | 44 +-------- htdocs/commande/info.php | 49 ++-------- htdocs/compta/commande/fiche.php | 61 +++---------- htdocs/expedition/commande.php | 43 +-------- htdocs/langs/en_US/orders.lang | 2 + htdocs/langs/fr_FR/orders.lang | 2 + htdocs/lib/company.lib.php | 51 ++++++----- htdocs/lib/order.lib.php | 86 ++++++++++++++++++ 10 files changed, 200 insertions(+), 330 deletions(-) create mode 100644 htdocs/lib/order.lib.php diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php index 58553896ac0..309e8d98c5a 100644 --- a/htdocs/commande/apercu.php +++ b/htdocs/commande/apercu.php @@ -30,6 +30,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php"); $user->getrights('commande'); $user->getrights('expedition'); @@ -80,46 +81,9 @@ if ($_GET["id"] > 0) { $soc = new Societe($db, $commande->socidp); $soc->fetch($commande->socidp); - $h=0; - if ($conf->commande->enabled && $user->rights->commande->lire) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans('OrderCard'); - $h++; - } - - 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 || $conf->comptaexpert->enabled) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans('ComptaCard'); - $h++; - } - - if ($conf->use_preview_tabs) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id; - $head[$h][1] = $langs->trans("Preview"); - $hselected=$h; - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id; - $head[$h][1] = $langs->trans('Info'); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id; - $head[$h][1] = $langs->trans('OrderContact'); - $h++; - - dolibarr_fiche_head($head, $hselected, $langs->trans('Order').': '.$commande->ref); + $head = commande_prepare_head($commande); + dolibarr_fiche_head($head, 'preview', $langs->trans("CustomerOrder")); /* @@ -147,7 +111,7 @@ if ($_GET["id"] > 0) { print ''; - // Reference + // Ref print '"; print ''; print '
'.$langs->trans("Ref")."'.$commande->ref.''.$langs->trans("Source").' : ' . $commande->sources[$commande->source] ; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index f1bd55c8697..39c1fcb8c8b 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -30,7 +30,7 @@ require ("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); -require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php'); +require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php"); $langs->load("facture"); $langs->load("orders"); @@ -216,71 +216,41 @@ if ( isset($mesg)) $id = $_GET["id"]; if ($id > 0) { - $langs->trans("OrderCard"); - $commande = New Commande($db); - if ( $commande->fetch($_GET['id'], $user->societe_id) > 0) - { - $soc = new Societe($db, $commande->socidp); - $soc->fetch($commande->socidp); + $langs->trans("OrderCard"); + $commande = New Commande($db); + if ( $commande->fetch($_GET['id'], $user->societe_id) > 0) + { + $soc = new Societe($db, $commande->soc_id); + $soc->fetch($commande->soc_id); - $h=0; - - if ($conf->commande->enabled && $user->rights->commande->lire) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderCard"); - $h++; - } - - 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 || $conf->comptaexpert->enabled) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("ComptaCard"); - $h++; - } - - 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/info.php?id='.$commande->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - //Ajout de longlet contacts - $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id; - $head[$h][1] = $langs->trans('OrderContact'); - $hselected = $h; - $h++; - - dolibarr_fiche_head($head, $hselected, $langs->trans("Order").": $commande->ref"); + $head = commande_prepare_head($commande); + dolibarr_fiche_head($head, 'contact', $langs->trans("CustomerOrder")); + /* - * Facture synthese pour rappel - */ + * Facture synthese pour rappel + */ print ''; - // Reference de la commande + // Ref print '"; + // Ref commande client + print ''; + print ''; + // Customer - if ( is_null($commande->ref_client) ) - $soc = new Societe($db); - $soc->fetch($commande->soc_id); - - print ""; + print ""; print ''; print "
'.$langs->trans("Ref").''; print $commande->ref; print "
'; + print ''; + print '
'; + print $langs->trans('RefCustomer').''; + print '
'; + print '
'; + print $commande->ref_client; + print '
".$langs->trans("Customer")."
".$langs->trans("Company")."'; print ''.$soc->nom.'
"; @@ -288,14 +258,14 @@ if ($id > 0) print ''; /* - * Lignes de contacts - */ + * Lignes de contacts + */ echo '
'; /* - * Ajouter une ligne de contact - * Non affiché en mode modification de ligne - */ + * Ajouter une ligne de contact + * Non affiché en mode modification de ligne + */ if ($_GET["action"] != 'editline' && $user->rights->facture->creer) { print ''; @@ -313,13 +283,13 @@ if ($id > 0) print ''; print ''; - // Ligne ajout pour contact interne + // Ligne ajout pour contact interne print ""; - + print ''; - + print ''; + print ''; @@ -333,21 +303,21 @@ if ($id > 0) print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; - // Ligne ajout pour contact externe + // Ligne ajout pour contact externe $var=!$var; print ""; - + print ''; - + print ''; + print ''; print ''; print ''; - + print ""; - print ''; + print ''; } - + // Liste des contacts liés print ''; print ''; @@ -378,12 +348,12 @@ if ($id > 0) print "\n"; $societe = new Societe($db); - $var = true; + $var = true; foreach(array('internal','external') as $source) { - $tab = $commande->liste_contact(-1,$source); - $num=sizeof($tab); + $tab = $commande->liste_contact(-1,$source); + $num=sizeof($tab); $i = 0; while ($i < $num) @@ -392,12 +362,12 @@ if ($id > 0) print ''; - // Source + // Source print ''; - + print ''; + // Societe print ''; // Contact @@ -422,12 +392,12 @@ if ($id > 0) { print ''; print img_object($langs->trans("ShowUser"),"user").' '.$tab[$i]['nom'].''; - } + } if ($tab[$i]['source']=='external') { print ''; print img_object($langs->trans("ShowContact"),"contact").' '.$tab[$i]['nom'].''; - } + } print ''; // Type de contact @@ -437,11 +407,11 @@ if ($id > 0) print ''; // Icon update et delete (statut contrat 0=brouillon,1=validé,2=fermé) @@ -465,7 +435,7 @@ if ($id > 0) } else { - // Contrat non trouvé + // Contrat non trouv print "Contrat inexistant ou accés refusé"; } } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 1d306975533..bde0b700252 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -37,6 +37,7 @@ require_once(DOL_DOCUMENT_ROOT.'/propal.class.php'); require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php'); require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); +require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php"); $langs->load('orders'); $langs->load('sendings'); @@ -732,47 +733,8 @@ else $author->id = $commande->user_author_id; $author->fetch(); - $h=0; - - if ($conf->commande->enabled && $user->rights->commande->lire) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans('OrderCard'); - $hselected = $h; - $h++; - } - - 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 || $conf->comptaexpert->enabled) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans('ComptaCard'); - $h++; - } - - 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/info.php?id='.$commande->id; - $head[$h][1] = $langs->trans('Info'); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id; - $head[$h][1] = $langs->trans('OrderContact'); - $h++; - - - dolibarr_fiche_head($head, $hselected, $langs->trans('Order').': '.$commande->ref); + $head = commande_prepare_head($commande); + dolibarr_fiche_head($head, 'order', $langs->trans("CustomerOrder")); /* * Confirmation de la suppression de la commande diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 7f2e59c6751..ca7e5793e16 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -29,7 +29,8 @@ */ require("./pre.inc.php"); -require_once (DOL_DOCUMENT_ROOT."/commande/commande.class.php"); +require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php"); $langs->load("orders"); $langs->load("sendings"); @@ -45,49 +46,11 @@ llxHeader(); $commande = new Commande($db); $commande->fetch($_GET["id"]); $commande->info($_GET["id"]); -$soc = new Societe($db, $commande->socidp); -$soc->fetch($commande->socidp); +$soc = new Societe($db, $commande->soc_id); +$soc->fetch($commande->soc_id); -$h = 0; - - if ($conf->commande->enabled && $user->rights->commande->lire) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderCard"); - $h++; - } - - 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 || $conf->comptaexpert->enabled) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("ComptaCard"); - $h++; - } - - 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/info.php?id='.$commande->id; - $head[$h][1] = $langs->trans("Info"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id; - $head[$h][1] = $langs->trans('OrderContact'); - $h++; - -dolibarr_fiche_head($head, $hselected, $langs->trans("Order").": $commande->ref"); +$head = commande_prepare_head($commande); +dolibarr_fiche_head($head, 'info', $langs->trans("CustomerOrder")); print '
'; print $langs->trans("Internal"); - print ''; print $conf->global->MAIN_INFO_SOCIETE_NOM; print '
'; print $langs->trans("External"); - print ''; $selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$commande->client->id; $selectedCompany = select_societes_for_newconcat($commande, $selectedCompany, $htmlname = 'newcompany'); @@ -361,12 +331,12 @@ if ($id > 0) print '
 
 
'.$langs->trans("Source").'
'; if ($tab[$i]['source']=='internal') print $langs->trans("Internal"); if ($tab[$i]['source']=='external') print $langs->trans("External"); - print ''; if ($tab[$i]['socid'] > 0) @@ -405,15 +375,15 @@ if ($id > 0) print ''; print img_object($langs->trans("ShowCompany"),"company").' '.$societe->get_nom($tab[$i]['socid']); print ''; - } + } if ($tab[$i]['socid'] < 0) { - print $conf->global->MAIN_INFO_SOCIETE_NOM; - } + print $conf->global->MAIN_INFO_SOCIETE_NOM; + } if (! $tab[$i]['socid']) - { - print ' '; - } + { + print ' '; + } print ''; // Activation desativation du contact if ($commande->statut >= 0) - print ''; + print ''; print img_statut($tab[$i]['status']); if ($commande->statut >= 0) - print ''; + print ''; print '
'; diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 719ca8dbed9..dd5e8ce48b3 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -29,31 +29,28 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); +if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/project.class.php"); $langs->load("orders"); -$langs->load("sendings"); $langs->load("companies"); $langs->load("bills"); -$langs->load("propal"); -$user->getrights('facture'); +$user->getrights('commande'); if (! $user->rights->commande->lire) accessforbidden(); -require_once(DOL_DOCUMENT_ROOT."/project.class.php"); -require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); - - -/* - * Sécurité accés client - */ +// Sécurité accés client if ($user->societe_id > 0) { $action = ''; $socidp = $user->societe_id; } + + /* - * + * Actions */ if ($_GET["action"] == 'facturee') @@ -87,46 +84,8 @@ if ($_GET["id"] > 0) $author->id = $commande->user_author_id; $author->fetch(); - $h=0; - - if ($conf->commande->enabled && $user->rights->commande->lire) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderCard"); - $h++; - } - - 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 || $conf->comptaexpert->enabled) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("ComptaCard"); - $hselected = $h; - $h++; - } - - 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/info.php?id='.$commande->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id; - $head[$h][1] = $langs->trans('OrderContact'); - $h++; - - dolibarr_fiche_head($head, $hselected, $langs->trans("Order").": $commande->ref"); + $head = commande_prepare_head($commande); + dolibarr_fiche_head($head, 'accountancy', $langs->trans("CustomerOrder")); /* * Commande diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index 44eede18c63..939307672bb 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -34,6 +34,7 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/project.class.php"); require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/order.lib.php"); $langs->load("bills"); @@ -87,46 +88,8 @@ if ($_GET["id"] > 0) $author->id = $commande->user_author_id; $author->fetch(); - $h=0; - - if ($conf->commande->enabled && $user->rights->commande->lire) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; - $head[$h][1] = $langs->trans("OrderCard"); - $h++; - } - - 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"); - $hselected = $h; - $h++; - } - - 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++; - } - - 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/info.php?id='.$commande->id; - $head[$h][1] = $langs->trans("Info"); - $h++; - - $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id; - $head[$h][1] = $langs->trans('OrderContact'); - $h++; - - dolibarr_fiche_head($head, $hselected, $langs->trans("Order").": $commande->ref"); + $head = commande_prepare_head($commande); + dolibarr_fiche_head($head, 'shipping', $langs->trans("CustomerOrder")); /* * Confirmation de la validation diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 16575b800cf..29b75dedf2d 100755 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -8,6 +8,8 @@ OrderDate=Date commande NewOrder=New order SupplierOrder=Supplier order SuppliersOrders=Suppliers' orders +CustomerOrder=Customer order +CustomersOrders=Customers' orders OrdersToValid=Orders to valid OrdersToBill=Orders to bill OrdersInProcess=Orders in process diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index 60d649e5b40..3118054b61a 100755 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -8,6 +8,8 @@ OrderDate=Date commande NewOrder=Nouvelle commande SupplierOrder=Commande fournisseur SuppliersOrders=Commandes fournisseurs +CustomerOrder=Commande client +CustomersOrders=Commandes client OrdersToValid=Commandes à valider OrdersToBill=Commandes à facturer OrdersInProcess=Commandes en traitement diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index f8f5d101c05..5d3f1cbdecf 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -1,4 +1,4 @@ - * * This program is free software; you can redistribute it and/or modify @@ -23,43 +23,42 @@ /** \file htdocs/lib/company.lib.php \brief Ensemble de fonctions de base pour le module societe - \version $Revision$ + \ingroup 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; +*/ +function societe_prepare_head($objsoc) +{ + global $langs, $conf; + $h = 0; + $head = array(); + $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Company"); - $head[$h][2] = 'company'; + $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'; + $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'; + $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'; + $head[$h][2] = 'supplier'; $h++; } @@ -68,20 +67,20 @@ function societe_prepare_head($objsoc) $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'; + $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'; + $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'; + $head[$h][2] = 'document'; $h++; } @@ -89,13 +88,13 @@ function societe_prepare_head($objsoc) { $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Notifications"); - $head[$h][2] = 'notify'; + $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'; + $head[$h][2] = 'info'; $h++; if ($user->societe_id == 0) @@ -104,9 +103,9 @@ function societe_prepare_head($objsoc) $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); $head[$h][2] = 'image'; $h++; - } - - return $head; -} - + } + + return $head; +} + ?> \ No newline at end of file diff --git a/htdocs/lib/order.lib.php b/htdocs/lib/order.lib.php new file mode 100644 index 00000000000..b493f4f285c --- /dev/null +++ b/htdocs/lib/order.lib.php @@ -0,0 +1,86 @@ + + * + * 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/order.lib.php + \brief Ensemble de fonctions de base pour le module commande + \ingroup commande + \version $Revision$ + + Ensemble de fonctions de base de dolibarr sous forme d'include +*/ + +function commande_prepare_head($commande) +{ + global $langs, $conf, $user; + if ($conf->expedition->enabled) $langs->load("sendings"); + + $h = 0; + $head = array(); + + if ($conf->commande->enabled && $user->rights->commande->lire) + { + $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; + $head[$h][1] = $langs->trans("OrderCard"); + $head[$h][2] = 'order'; + $h++; + } + + 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"); + $head[$h][2] = 'shipping'; + $h++; + } + + 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"); + $head[$h][2] = 'accountancy'; + $hselected = $h; + $h++; + } + + if ($conf->use_preview_tabs) + { + $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id; + $head[$h][1] = $langs->trans("Preview"); + $head[$h][2] = 'preview'; + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id; + $head[$h][1] = $langs->trans('OrderContact'); + $head[$h][2] = 'contact'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + + return $head; +} + +?> \ No newline at end of file