/[dolibarr]/dolibarr/htdocs/telephonie/contrat/services.php
ViewVC logotype

Diff of /dolibarr/htdocs/telephonie/contrat/services.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by rodolphe, Thu Aug 25 16:18:34 2005 UTC revision 1.5 by rodolphe, Wed Sep 7 08:05:30 2005 UTC
# Line 24  require "./pre.inc.php"; Line 24  require "./pre.inc.php";
24    
25  $mesg = '';  $mesg = '';
26    
27  if ($_POST["action"] == 'addservice')  if ($_POST["action"] == 'addservice' && $user->rights->telephonie->ligne->creer)
28  {  {
29    $contrat = new TelephonieContrat($db);    $contrat = new TelephonieContrat($db);
30    $contrat->id= $_GET["id"];    $contrat->id= $_GET["id"];
# Line 35  if ($_POST["action"] == 'addservice') Line 35  if ($_POST["action"] == 'addservice')
35      }      }
36  }  }
37    
38  if ($_GET["action"] == 'rmservice')  if ($_GET["action"] == 'rmservice' && $user->rights->telephonie->ligne->creer)
39  {  {
40    $contrat = new TelephonieContrat($db);    $contrat = new TelephonieContrat($db);
41    $contrat->id= $_GET["id"];    $contrat->id= $_GET["id"];
# Line 48  if ($_GET["action"] == 'rmservice') Line 48  if ($_GET["action"] == 'rmservice')
48    
49  llxHeader("","","Fiche Contrat - Services");  llxHeader("","","Fiche Contrat - Services");
50    
 if ($cancel == $langs->trans("Cancel"))  
 {  
   $action = '';  
 }  
51    
52    if ($_GET["id"])
53    if ($_GET["id"])  {
54      $client_comm = new Societe($db);
55      $contrat = new TelephonieContrat($db);
56      
57      if ($contrat->fetch($_GET["id"]) > 0)
58        {
59          $result = 1;
60          $client_comm->fetch($contrat->client_comm_id, $user);
61        }
62      else
63      {      {
64        if ($_GET["action"] <> 're-edit')        print "Erreur";
65        }
66        
67      if (!$client_comm->perm_read)
68        {
69          print "Lecture non authorisée";
70        }
71        
72      if ( $result && $client_comm->perm_read)
73        {
74          if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
75          {          {
76            $contrat = new TelephonieContrat($db);            
77              $h=0;
78            if ($contrat->fetch($_GET["id"]) == 0)            $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id;
79              $head[$h][1] = $langs->trans("Contrat");
80              $h++;
81              
82              $nser = $contrat->count_associated_services();
83              
84              $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id;
85              if ($nser > 0)
86              {              {
87                $result = 1;                $head[$h][1] = $langs->trans("Services")." (".$nser.")";
88              }              }
89          }            else
   
       if ( $result )  
         {  
           if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')  
90              {              {
91                  $head[$h][1] = $langs->trans("Services");
92                $h=0;              }
93                $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id;            $hselected = $h;
94                $head[$h][1] = $langs->trans("Contrat");            $h++;
95                $h++;            
96              $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/stats.php?id=".$contrat->id;
97                $nser = $contrat->count_associated_services();            $head[$h][1] = $langs->trans("Stats");
98                            $h++;
99                $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id;            
100                if ($nser > 0)            $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/info.php?id=".$contrat->id;
101                  {            $head[$h][1] = $langs->trans("Infos");
102                    $head[$h][1] = $langs->trans("Services")." (".$nser.")";            $h++;
103                  }            
104                else            dolibarr_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref);
105                  {            
106                    $head[$h][1] = $langs->trans("Services");            print_fiche_titre('Fiche Contrat', $mesg);
107                  }            
108                $hselected = $h;            print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';            
109                $h++;            print '<tr><td width="20%">Référence</td><td>'.$contrat->ref.'</td>';
110              print '<td>Facturé : '.$contrat->facturable.'</td></tr>';
111                $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/stats.php?id=".$contrat->id;            
112                $head[$h][1] = $langs->trans("Stats");            print '<tr><td width="20%">Client</td><td>';
113                $h++;            print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$client_comm->id.'">';
114              
115                $head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/info.php?id=".$contrat->id;            print $client_comm->nom.'</a></td><td>'.$client_comm->code_client;
116                $head[$h][1] = $langs->trans("Infos");            print '</td></tr>';
117                $h++;            
118              if ($contrat->client_comm_id <> $contrat->client_id)
119                dolibarr_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref);              {                
120                  $client = new Societe($db, $contrat->client_id);
121                print_fiche_titre('Fiche Contrat', $mesg);                $client->fetch($contrat->client_id);
122                        print '<tr><td width="20%">Client (Agence/Filiale)</td><td colspan="2">';
123                print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';                print $client->nom.'<br />';
124                  print $client->cp . " " .$client->ville;
               $client_comm = new Societe($db, $contrat->client_comm_id);  
               $client_comm->fetch($contrat->client_comm_id);  
   
               print '<tr><td width="20%">Référence</td><td>'.$contrat->ref.'</td>';  
               print '<td>Facturé : '.$contrat->facturable.'</td></tr>';  
   
               print '<tr><td width="20%">Client</td><td>';  
               print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$client_comm->id.'">';  
   
               print $client_comm->nom.'</a></td><td>'.$client_comm->code_client;  
125                print '</td></tr>';                print '</td></tr>';
126                }
127                if ($contrat->client_comm_id <> $contrat->client_id)            
128                  {                                $commercial = new User($db, $contrat->commercial_sign_id);
129                    $client = new Societe($db, $contrat->client_id);            $commercial->fetch();
130                    $client->fetch($contrat->client_id);            
131                    print '<tr><td width="20%">Client (Agence/Filiale)</td><td colspan="2">';            print '<tr><td width="20%">Commercial Signature</td>';
132                    print $client->nom.'<br />';            print '<td colspan="2">'.$commercial->fullname.'</td></tr>';
133                    print $client->cp . " " .$client->ville;            
134                    print '</td></tr>';            $commercial_suiv = new User($db, $contrat->commercial_suiv_id);
135                  }            $commercial_suiv->fetch();
136              
               $commercial = new User($db, $contrat->commercial_sign_id);  
               $commercial->fetch();  
   
               print '<tr><td width="20%">Commercial Signature</td>';  
               print '<td colspan="2">'.$commercial->fullname.'</td></tr>';  
   
               $commercial_suiv = new User($db, $contrat->commercial_suiv_id);  
               $commercial_suiv->fetch();  
   
137                print '<tr><td width="20%">Commercial Suivi</td>';                print '<tr><td width="20%">Commercial Suivi</td>';
138                print '<td colspan="2">'.$commercial_suiv->fullname.'</td></tr>';                print '<td colspan="2">'.$commercial_suiv->fullname.'</td></tr>';
139    
# Line 249  if ($cancel == $langs->trans("Cancel")) Line 248  if ($cancel == $langs->trans("Cancel"))
248             *             *
249             */             */
250    
251          if ($user->rights->telephonie->ligne->creer)
252            {
253    
254            print_fiche_titre('Ajouter un service', $mesg);            print_fiche_titre('Ajouter un service', $mesg);
255                        
256            print '<form action="services.php?id='.$contrat->id.'" method="post">';            print '<form action="services.php?id='.$contrat->id.'" method="post">';
# Line 294  if ($cancel == $langs->trans("Cancel")) Line 296  if ($cancel == $langs->trans("Cancel"))
296            print '</td></tr>';            print '</td></tr>';
297            print '</table>';            print '</table>';
298            print '</form>';            print '</form>';
299                      }
300            /*            /*
301             *             *
302             *             *

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26