diff --git a/htdocs/projet/commandes.php b/htdocs/projet/commandes.php index fd7f46f2b74..803543d8c8b 100644 --- a/htdocs/projet/commandes.php +++ b/htdocs/projet/commandes.php @@ -30,20 +30,31 @@ llxHeader("","../"); $projet = new Project($db); $projet->fetch($_GET["id"]); -$h=0; -$head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$projet->id; -$head[$h][1] = 'Fiche projet'; + $h=0; + $head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$projet->id; + $head[$h][1] = 'Fiche projet'; + $h++; + + if ($conf->propal->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$projet->id; + $head[$h][1] = 'Prop. Commerciales'; + $h++; + } -$head[$h+1][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$projet->id; -$head[$h+1][1] = 'Prop. Commerciales'; - -$head[$h+2][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$projet->id; -$head[$h+2][1] = 'Commandes'; - -$head[$h+3][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$projet->id; -$head[$h+3][1] = 'Factures'; - -dolibarr_fiche_head($head, 2); + if ($conf->commande->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$projet->id; + $head[$h][1] = 'Commandes'; + $hselected=$h; + $h++; + } + + if ($conf->facture->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$projet->id; + $head[$h][1] = 'Factures'; + $h++; + } + +dolibarr_fiche_head($head, $hselected); /* * * @@ -51,9 +62,9 @@ dolibarr_fiche_head($head, 2); */ $projet->societe->fetch($projet->societe->id); -print ''; +print '
'; print ''; -print ''; +print ''; print ''; print '
Titre'.$projet->title.'Réf'.$projet->ref.'
'.$langs->trans("Ref").''.$projet->ref.'
Société'.$projet->societe->nom.'

'; @@ -69,7 +80,7 @@ if (sizeof($commandes)>0 && is_array($commandes)) print ''; print ''; - print ''; + print ''; for ($i = 0; $i + * Copyright (C) 2004 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 @@ -25,6 +26,7 @@ require("../facture.class.php"); require("../commande/commande.class.php"); $user->getrights('projet'); + if (!$user->rights->projet->lire) accessforbidden(); @@ -33,20 +35,31 @@ llxHeader("","../"); $projet = new Project($db); $projet->fetch($_GET["id"]); -$h=0; -$head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$projet->id; -$head[$h][1] = 'Fiche projet'; + $h=0; + $head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$projet->id; + $head[$h][1] = 'Fiche projet'; + $h++; + + if ($conf->propal->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$projet->id; + $head[$h][1] = 'Prop. Commerciales'; + $h++; + } -$head[$h+1][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$projet->id; -$head[$h+1][1] = 'Prop. Commerciales'; - -$head[$h+2][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$projet->id; -$head[$h+2][1] = 'Commandes'; - -$head[$h+3][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$projet->id; -$head[$h+3][1] = 'Factures'; - -dolibarr_fiche_head($head, 3); + if ($conf->commande->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$projet->id; + $head[$h][1] = 'Commandes'; + $h++; + } + + if ($conf->facture->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$projet->id; + $head[$h][1] = 'Factures'; + $hselected=$h; + $h++; + } + +dolibarr_fiche_head($head, $hselected); /* * * @@ -54,9 +67,9 @@ dolibarr_fiche_head($head, 3); */ $projet->societe->fetch($projet->societe->id); -print '
RéfDateMontant 
'.$langs->trans("Ref").'DateMontant 
'; +print '
'; print ''; -print ''; +print ''; print ''; print '
Titre'.$projet->title.'Réf'.$projet->ref.'
'.$langs->trans("Ref").''.$projet->ref.'
Société'.$projet->societe->nom.'

'; @@ -70,10 +83,10 @@ print '
'; if (sizeof($factures)>0 && is_array($factures)) { print_titre('Listes des factures associées au projet'); - print ''; + print '
'; print ''; - print ''; + print ''; for ($i = 0; $iload("projects"); + $user->getrights('projet'); + if (!$user->rights->projet->lire) accessforbidden(); + if ($_POST["action"] == 'add' && $user->rights->projet->creer) { $pro = new Project($db); @@ -46,28 +50,31 @@ if ($_POST["action"] == 'add' && $user->rights->projet->creer) if ($_POST["action"] == 'update' && $user->rights->projet->creer) { $projet = new Project($db); - $projet->id = $id; + $projet->id = $_POST["id"]; $projet->ref = $_POST["ref"]; $projet->title = $_POST["title"]; $projet->update(); + + $_GET["id"]=$projet->id; // On retourne sur la fiche projet } if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes) { $projet = new Project($db); - $projet->id = $id; + $projet->id = $_POST["id"]; $projet->delete(); Header("Location: index.php"); } llxHeader("","Projet","Projet"); + if ($_GET["action"] == 'delete') { print '
'; print ''; - print '
RéfDateMontant 
'.$langs->trans("Ref").'DateMontant 
'; + print '
'; print ''; @@ -88,7 +95,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print ''; ?> -
Supprimer le projet
+
'; ?> - +
Société rights->projet->creer) Créateur'.$user->fullname.'
Référence
trans("Ref") ?>
Titre
@@ -110,8 +117,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) } else { /* - * - * + * Fiche projet en mode visu * */ @@ -122,36 +128,51 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) $h=0; $head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$projet->id; $head[$h][1] = 'Fiche projet'; + $hselected=$h; + $h++; - $head[$h+1][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$projet->id; - $head[$h+1][1] = 'Prop. Commerciales'; + if ($conf->propal->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$projet->id; + $head[$h][1] = 'Prop. Commerciales'; + $h++; + } + + if ($conf->commande->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$projet->id; + $head[$h][1] = 'Commandes'; + $h++; + } - $head[$h+2][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$projet->id; - $head[$h+2][1] = 'Commandes'; - - $head[$h+3][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$projet->id; - $head[$h+3][1] = 'Factures'; + if ($conf->facture->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$projet->id; + $head[$h][1] = 'Factures'; + $h++; + } - dolibarr_fiche_head($head, 0); + dolibarr_fiche_head($head, $hselected); if ($_GET["action"] == 'edit') { - print ''; + print ''; print ''; - print ''; + print ''; + + print '
'; print ''; - print ''; - - print '
Société'.$projet->societe->nom.'
Ref
'; + print ''.$langs->trans("Title").''; + print ''.$langs->trans("Ref").''; + print ''; + print '

'; + print ''; } else { - print ''; - - print ''; - print ''; + print '
Titre'.$projet->title.'Réf'.$projet->ref.'
'; + print ''; + print ''; print ''; print '
'.$langs->trans("Title").''.$projet->title.''.$langs->trans("Ref").''.$projet->ref.'
Société'.$projet->societe->nom_url.'
'; + print '
'; } print ''; @@ -161,7 +182,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print '
'; if ($_GET["action"] == "edit") { - print 'Annuler'; + print ''.$langs->trans("Cancel").''; } else { diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index eff030da148..2be0ed4c683 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -22,6 +22,8 @@ */ require("./pre.inc.php"); +$langs->load("projects"); + /* * Sécurité accés client */ @@ -63,10 +65,10 @@ $pagenext = $page + 1; * */ print '
'; -print ''; +print '
'; print '\n"; @@ -81,6 +83,7 @@ if ($socidp) $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); +$var=true; if ( $db->query($sql) ) { $num = $db->num_rows(); diff --git a/htdocs/projet/propal.php b/htdocs/projet/propal.php index 342e134ced2..90466ed5a30 100644 --- a/htdocs/projet/propal.php +++ b/htdocs/projet/propal.php @@ -30,20 +30,31 @@ llxHeader("","../"); $projet = new Project($db); $projet->fetch($_GET["id"]); -$h=0; -$head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$projet->id; -$head[$h][1] = 'Fiche projet'; + $h=0; + $head[$h][0] = DOL_URL_ROOT.'/projet/fiche.php?id='.$projet->id; + $head[$h][1] = 'Fiche projet'; + $h++; + + if ($conf->propal->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$projet->id; + $head[$h][1] = 'Prop. Commerciales'; + $hselected=$h; + $h++; + } -$head[$h+1][0] = DOL_URL_ROOT.'/projet/propal.php?id='.$projet->id; -$head[$h+1][1] = 'Prop. Commerciales'; - -$head[$h+2][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$projet->id; -$head[$h+2][1] = 'Commandes'; - -$head[$h+3][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$projet->id; -$head[$h+3][1] = 'Factures'; - -dolibarr_fiche_head($head, 1); + if ($conf->commande->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/commandes.php?id='.$projet->id; + $head[$h][1] = 'Commandes'; + $h++; + } + + if ($conf->facture->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/projet/facture.php?id='.$projet->id; + $head[$h][1] = 'Factures'; + $h++; + } + +dolibarr_fiche_head($head, $hselected); /* * * @@ -53,9 +64,9 @@ $propales = array(); $projet->societe->fetch($projet->societe->id); -print '
'; print_liste_field_titre("Titre","index.php","p.title"); -print "Réf"; +print ''.$langs->trans("Ref").''; print_liste_field_titre("Société","index.php","s.nom"); print "
'; +print '
'; print ''; -print ''; +print ''; print ''; print '
Titre'.$projet->title.'Réf'.$projet->ref.'
'.$langs->trans("Ref").''.$projet->ref.'
Société'.$projet->societe->nom.'

'; @@ -64,10 +75,10 @@ $propales = $projet->get_propal_list(); if (sizeof($propales)>0 && is_array($propales)) { print_titre('Listes des propositions commerciales associées au projet'); - print ''; + print '
'; - print ''; - print ''; + print ''; + print ''; for ($i = 0; $i
RéfDateMontant 
'.$langs->trans("Ref").'DateMontant