Projet

Général

Profil

Révision 8c2a3d1e

Voir les différences:

plugins/anet_epacks/front/plugin_anet_epacks.verif_contract_epack.php
25 25
$automatique = "";
26 26
$manuel = "";
27 27

  
28
$query = "SELECT FK_enduser,code FROM glpi_plugin_anet_epacks WHERE FK_contract='0' AND FK_enduser>'0'";
28
$query = "SELECT FK_enduser,code FROM glpi_plugin_anet_epacks WHERE (FK_contract='0' OR FK_contract='-1') AND FK_enduser>'0'";
29 29
$result = $DB->query($query);
30 30
//print $query;
31 31
while($data=$DB->fetch_array($result)) {
......
37 37
  $data1=$DB->fetch_array($result1);
38 38
  $clientfinal = $data1['completename'];
39 39

  
40

  
41
  $query2 = "SELECT * FROM glpi_contracts WHERE FK_entities='" . $enduser  . "'";
40
  //order by pour prendre le dernier contrat ... si on recolle automatiquement et qu'il y a un ancien contrat il faut recoller avecle plus recent
41
  $query2 = "SELECT *,(TO_DAYS(begin_date) + (duration*30)) AS endDay FROM glpi_contracts WHERE FK_entities='" . $enduser  . "' AND (TO_DAYS(begin_date) + (duration*30)) > TO_DAYS(NOW()) AND deleted='0' ORDER BY begin_date DESC LIMIT 1";
42
  //print "<pre>$query2</pre>";
42 43
  $result2 = $DB->query($query2);
43 44
  $data2=$DB->fetch_array($result2);
44

  
45
  if(trim($data2['name'])) {
46
    $query3 = "UPDATE glpi_plugin_anet_epacks SET FK_contract='" . $data2['ID']  . "' WHERE FK_enduser='$enduser' AND FK_contract='0'";
45
  if(trim($data2['name']) != "") {
46
    $query3 = "UPDATE glpi_plugin_anet_epacks SET FK_contract='" . $data2['ID']  . "' WHERE FK_enduser='$enduser'";
47
    //$query3 = "UPDATE glpi_plugin_anet_epacks SET FK_contract='-1' WHERE FK_enduser='$enduser'";
47 48
    $automatique .= "<p>Recollement automatique pour $code -> $clientfinal -> nouvelle ref contrat: " . $data2['ID'] . "</p>";
49
    //print $query3;
48 50
    $result3 = $DB->query($query3);
49 51
    $data3=$DB->fetch_array($result3);
50 52
  }
51 53
  else {
52
    $manuel .= "<tr><td>$code</td><td>$clientfinal</td><td>$enduser</td><td>" . $data2['ID'] . "</td></tr>\n";
54
    if(is_array($data2)) {
55
      $manuel .= "<tr><td>$code</td><td>$clientfinal</td><td>$enduser</td><td>" . $data2['ID'] . "</td></tr>\n";
56
    }
53 57
  }
54 58
 }
55 59

  
plugins/anet_epacks/front/plugin_anet_epacks.view.php
20 20
  if($data['name'] == "revendeur") {
21 21
    print "<h1>Liste synthétique de vos epacks</h1>";
22 22
    $entityid = $data['FK_entities'];
23
print "<p>Liste des epacks attribués: <a href=\"" . $PHP_SELF . "\">Tous</a> - <a href=\"" . $PHP_SELF . "?year=2008\">2008</a> - <a href=\"" . $PHP_SELF . "?year=2009\">2009</a> - <a href=\"" . $PHP_SELF . "?year=2010\">2010</a> - <a href=\"" . $PHP_SELF . "?year=2011\">2011</a>.</p>";
23
    print "<p>Liste des epacks attribués: <a href=\"" . $PHP_SELF . "\">Tous</a> - ";
24
    for($i=2008; $i <= date("Y"); $i++) {
25
	print "<a href=\"" . $PHP_SELF . "?year=$i\">$i</a> - ";
26
      }
27
    print "</p>";
24 28

  
25 29
//Les packs attribués
26 30
//Permet de limiter un peu l'affichage, il faudra faire un système de recherche ou pagination à terme
......
74 78
checkRight("config","w");
75 79
//checkSeveralRightsOr(array("config" => "w", "profile" => "w"));
76 80

  
77
print "<p>Liste des epacks attribués: <a href=\"" . $PHP_SELF . "\">Tous</a> - <a href=\"" . $PHP_SELF . "?year=2008\">2008</a> - <a href=\"" . $PHP_SELF . "?year=2009\">2009</a> - <a href=\"" . $PHP_SELF . "?year=2010\">2010</a> - <a href=\"" . $PHP_SELF . "?year=2011\">2011</a>.</p>";
81
//print "<p>Liste des epacks attribués: <a href=\"" . $PHP_SELF . "\">Tous</a> - <a href=\"" . $PHP_SELF . "?year=2008\">2008</a> - <a href=\"" . $PHP_SELF . "?year=2009\">2009</a> - <a href=\"" . $PHP_SELF . "?year=2010\">2010</a> - <a href=\"" . $PHP_SELF . "?year=2011\">2011</a>.</p>";
82

  
83
 print "<p>Liste des epacks attribués: <a href=\"" . $PHP_SELF . "\">Tous</a> - ";
84
 for($i=2008; $i <= date("Y"); $i++) {
85
     print "<a href=\"" . $PHP_SELF . "?year=$i\">$i</a> - ";
86
   }
87
 print "</p>";
88

  
78 89

  
79 90
global $DB;
80 91

  
......
95 106

  
96 107
print "<table class='tab_cadre' width='100%' cellpadding='2'>\n";
97 108
  print "<tr class='tab_bg_3'>
109
  <td>N°</td>
98 110
  <td>Nom</td>
99 111
  <td>Création</td>
100 112
  <td>Activation</td>
......
107 119
for($i = 0; $i < $DB->numrows($result); $i++) {
108 120
  $data=$DB->fetch_array($result);
109 121
  print "<tr class='tab_bg_3'>\n";
122
  print "  <td>" . ($i+1) . "</td>";
110 123
  print "  <td>" . $data['clientderyxeo'] . "</td>
111 124
  <td>" . $data['creation_date'] . "</td>
112 125
  <td>" . $data['activation_date'] . "</td>
......
143 156

  
144 157
print "<table class='tab_cadre' width='100%' cellpadding='2'>\n";
145 158
  print "<tr class='tab_bg_3'>
159
  <td>N°</td>
146 160
  <td>Nom</td>
147 161
  <td>Date de création du pack</td>
148 162
  <td>Date d'activation du pack</td>
......
155 169
for($i = 0; $i < $DB->numrows($result); $i++) {
156 170
  $data=$DB->fetch_array($result);
157 171
  print "<tr class='tab_bg_3'>\n";
172
  print "  <td>" . ($i+1) . "</td>";
158 173
  print "  <td>" . $data['clientderyxeo'] . "</td>
159 174
  <td>" . $data['creation_date'] . "</td>
160 175
  <td>" . $data['activation_date'] . "</td>
plugins/anet_epacks/front/plugin_anet_epacks.view_array_recap.php
229 229
	  $dataLastOK = $DB->fetch_array($resultLastOK);
230 230
	  if($dataLastOK[0]) {
231 231
	    //	  print_r($dataLastOK);
232
	    $ssh_status .= "<br /><font color=\"green\">LAST OK</font>";
233
	    $ssh_dateLastOK = "<br />" . $dataLastOK[0];
232
	    $ssh_status .= "<br /><font color=\"green\">LAST&nbsp;OK</font>";
233
	    $ssh_dateLastOK = "<br />" . str_replace(" ","&nbsp;",$dataLastOK[0]);
234 234
	  }
235 235
	}
236 236
	else {

Formats disponibles : Unified diff

Redmine Appliance - Powered by TurnKey Linux