epnadmin-fr
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Epnadmin-fr] CVS: epnadmin animateurs-horaires.php,1.2,1.3 entete.inc.p


From: Loïc Dayot
Subject: [Epnadmin-fr] CVS: epnadmin animateurs-horaires.php,1.2,1.3 entete.inc.php,1.28,1.29 header.inc.php,1.23,1.24 materiels.php,1.12,1.13 prets.php,1.6,1.7
Date: Mon, 16 Jun 2003 02:18:49 -0400

Update of /cvsroot/epnadmin/epnadmin
In directory subversions:/tmp/cvs-serv23930/epnadmin

Modified Files:
        animateurs-horaires.php entete.inc.php header.inc.php 
        materiels.php prets.php 
Log Message:
Gestion des prets, pas encore terminée.
Quelques punaises corrigées, notamment la conservation de l'opération lors de 
l'identification (plus faicle dans l'envoi de lien dans des courriels).



Index: animateurs-horaires.php
===================================================================
RCS file: /cvsroot/epnadmin/epnadmin/animateurs-horaires.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** animateurs-horaires.php     24 May 2003 11:58:29 -0000      1.2
--- animateurs-horaires.php     16 Jun 2003 06:18:47 -0000      1.3
***************
*** 44,48 ****
  
  echo "<html><head><title>$shorairesani - epnadmin</title>
! <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>";
  
  $titr = $shortitre;
--- 44,49 ----
  
  echo "<html><head><title>$shorairesani - epnadmin</title>
! <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
!   </head>";
  
  $titr = $shortitre;

Index: entete.inc.php
===================================================================
RCS file: /cvsroot/epnadmin/epnadmin/entete.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** entete.inc.php      11 Jun 2003 19:03:44 -0000      1.28
--- entete.inc.php      16 Jun 2003 06:18:47 -0000      1.29
***************
*** 3,7 ****
      Copyright (C) 2001, 2002 Loïc Dayot - Mairie de Pierrefitte (93)
  
!     EPNadmin - Version 0.6 - 25/01/2003
  
      This program is free software; you can redistribute it and/or modify
--- 3,7 ----
      Copyright (C) 2001, 2002 Loïc Dayot - Mairie de Pierrefitte (93)
  
!     EPNadmin - Version 0.7 - 12/06/2003
  
      This program is free software; you can redistribute it and/or modify
***************
*** 45,50 ****
  
  $cfondtitre="black";
! $cfond="#FCFCBC";
! $ctitre="yellow";
  
  switch ($is_ident)
--- 45,50 ----
  
  $cfondtitre="black";
! $cfond="white"; //"#FCFCBC";
! $ctitre="white"; //"yellow";
  
  switch ($is_ident)
***************
*** 72,76 ****
    $visiteur=TRUE;
        $logon=4; $premtitre="$svisiteur";
!       $COULEUR="yellow";
        break;
  }
--- 72,76 ----
    $visiteur=TRUE;
        $logon=4; $premtitre="$svisiteur";
!       $COULEUR=$ctitre;
        break;
  }

Index: header.inc.php
===================================================================
RCS file: /cvsroot/epnadmin/epnadmin/header.inc.php,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** header.inc.php      11 Jun 2003 19:03:44 -0000      1.23
--- header.inc.php      16 Jun 2003 06:18:47 -0000      1.24
***************
*** 145,155 ****
  
    if (($logon!=1) && defined("FCT_STRUCTURES"))
!     echo "<a href=\"$PHP_SELF?logon=1\">S'identifier en tant que 
structure.</a><br>\n";
    if (($logon!=2) && defined("FCT_USAGERS"))
!     echo "<a href=\"$PHP_SELF?logon=2\">S'identifier en tant qu'usager 
individuel.</a><br>\n";
    if (($logon!=3) && defined("FCT_ANIMATEURS"))
!     echo "<a href=\"$PHP_SELF?logon=3\">S'identifier en tant 
qu'animateur.</a><br>\n";
    if ($logon!=4)
!     echo "<a href=\"$PHP_SELF?logon=4\">Visiteur sans 
identification.</a><br>\n";
  
    if ($mes>"")
--- 145,155 ----
  
    if (($logon!=1) && defined("FCT_STRUCTURES"))
!     echo "<a href=\"$PHP_SELF?logon=1&operation=$operation\">S'identifier en 
tant que structure.</a><br>\n";
    if (($logon!=2) && defined("FCT_USAGERS"))
!     echo "<a href=\"$PHP_SELF?logon=2&operation=$operation\">S'identifier en 
tant qu'usager individuel.</a><br>\n";
    if (($logon!=3) && defined("FCT_ANIMATEURS"))
!     echo "<a href=\"$PHP_SELF?logon=3&operation=$operation\">S'identifier en 
tant qu'animateur.</a><br>\n";
    if ($logon!=4)
!     echo "<a href=\"$PHP_SELF?logon=4&operation=$operation\">Visiteur sans 
identification.</a><br>\n";
  
    if ($mes>"")

Index: materiels.php
===================================================================
RCS file: /cvsroot/epnadmin/epnadmin/materiels.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** materiels.php       6 May 2003 19:31:05 -0000       1.12
--- materiels.php       16 Jun 2003 06:18:47 -0000      1.13
***************
*** 3,7 ****
      Copyright (C) 2001 Loïc Dayot
  
!     EPNadmin - Version 0.6
  
      This program is free software; you can redistribute it and/or modify
--- 3,7 ----
      Copyright (C) 2001 Loïc Dayot
  
!     EPNadmin - Version 0.7
  
      This program is free software; you can redistribute it and/or modify
***************
*** 46,53 ****
        <head>
        <title>$smateriels - epnadmin</title>
!       <meta http-equiv=\"Content-Type\" content=\"text/html; 
charset=iso-8859-1\">";
  
  $titr = $stitremateriel;
! $datemaj="23 février 2003";
  require("entete.inc.php");
  
--- 46,54 ----
        <head>
        <title>$smateriels - epnadmin</title>
!       <meta http-equiv=\"Content-Type\" content=\"text/html; 
charset=iso-8859-1\">
!   </head>\n";
  
  $titr = $stitremateriel;
! $datemaj="13 juin 2003";
  require("entete.inc.php");
  
***************
*** 99,112 ****
    {
      if (! verifdroits("w"))
!               {
!                       echo cadre_fin(COULEUR_PARC);
!                       break;
!               }
    }
    elseif (PARC_MOI<"w" && PARC_AUTRES<"w")
!       {
!               echo cadre_fin(COULEUR_PARC);
!               break;
!       }
  
     $mes="";
--- 100,113 ----
    {
      if (! verifdroits("w"))
!     {
!       echo cadre_fin(COULEUR_PARC);
!       break;
!     }
    }
    elseif (PARC_MOI<"w" && PARC_AUTRES<"w")
!   {
!     echo cadre_fin(COULEUR_PARC);
!     break;
!   }
  
     $mes="";
***************
*** 116,120 ****
     if ($reservable=="") $mes.="$smanqueresa<br>";
     if ($mes!="")
!       echo "<p>$mes</p>";
     else
     {
--- 117,124 ----
     if ($reservable=="") $mes.="$smanqueresa<br>";
     if ($mes!="")
!    {
!      echo "<p>$mes</p>";
!      echo cadre_fin(COULEUR_PARC);
!    }
     else
     {
***************
*** 167,171 ****
          $i++;
       }
!               echo cadre_fin(COULEUR_PARC);
       break; // tout c'est bien passé
     }
--- 171,175 ----
          $i++;
       }
!      echo cadre_fin(COULEUR_PARC);
       break; // tout c'est bien passé
     }
***************
*** 174,178 ****
  case 2 : // formulaire d'édition
     // Saisie pour modification d'un enregistrement
!    if (! verifdroits("w"))
        break;
  
--- 178,182 ----
  case 2 : // formulaire d'édition
     // Saisie pour modification d'un enregistrement
!    if (! verifdroits("w") && $operation!=11)
        break;
  

Index: prets.php
===================================================================
RCS file: /cvsroot/epnadmin/epnadmin/prets.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** prets.php   24 May 2003 11:58:29 -0000      1.6
--- prets.php   16 Jun 2003 06:18:47 -0000      1.7
***************
*** 24,27 ****
--- 24,54 ----
  //        Modifier table_horaires.php/ligne 130-140
  
+ /* Principes de l'emprunt :
+   Tous les emprunts sont dans la table pret_materiel.
+ 
+   Demande d'emprunt (operation=4) :
+   1. préparation de la demande d'emprunt avec etat=préparé
+   2. saisie de la raison de la demande
+   3. validation (envoi de courriel)
+ 
+   Accord/refus du pret (operation=?) :
+   1. Visualisation / réception de courriel
+   2. Modification de la sélection
+   3. Accord ou désaccord
+   4. validation (envoi de courriel)
+ 
+   Retour de matériel
+   1. Retouver l'emprunt
+   2. Valider le retour de tout ou de chaque matériel
+ 
+   Relance
+   1. Retouver les emprunts en retards
+   2. Envoi de courriel
+ 
+   - liste des emprunts
+   - détail d'un emprunt
+     - détail des matériels
+ 
+ */
  
  require_once("header.inc.php");
***************
*** 51,76 ****
  $titr = $sprettitrecomplet;
  define("COULEUR", COULEUR_PRETS);
! $datemaj="18 mai 2003";
  require("entete.inc.php");
  
! function afficheEmprunt($id_pret)
  {
!   $req="SELECT *, pret_materiel.id_structure AS id_structure, 
pret_materiel.id AS id
!                  FROM pret_materiel
!                  LEFT JOIN materiels ON materiels.id=pret_materiel.id_materiel
!          WHERE pret_materiel.id=$id_pret";
    $res = executeRequete($req);
-   echo "<table align=center bgcolor=\"white\" border=1>";
    $pret=fetch_object($res);
!   echo "<tr><td>Emprunteur 
:</td><td>".structure($pret->id_structure)."</td></tr>\n";
!   echo "<tr><td>Etat :</td><td>$pret->etat</td></tr>\n";
!   echo "<tr><td>Matériel :</td><td>$pret->type";
!   if ($pret->materiel>"")
!     echo "<br>".$pret->materiel;
!   echo "<br>".$pret->description;
!   echo "</td></tr>\n";
!   echo "<tr><td>Date de la 
demande</td><td>".datetodate($pret->date_demande)."</td></tr>\n";
!   echo "<tr><td>Date 
d'emprunt</td><td>".datetodate($pret->date_emprunt)."</td></tr>\n";
!   echo "<tr><td>Date de retour prévu</td><td";
    if ($pret->date_retour_effectif<="1")
      if (date("Y-m-d", strtotime($pret->date_retour_prevu))<=date("Y-m-d", 
strtotime("now")))
--- 78,125 ----
  $titr = $sprettitrecomplet;
  define("COULEUR", COULEUR_PRETS);
! $datemaj="12 juin 2003";
  require("entete.inc.php");
  
! 
! function liste_emprunts($id_emprunteur=0, $id_preteur=0)
  {
!   $req="SELECT prets.id AS id_pret FROM prets ";
!   $cond=" WHERE (0=0) ";
!   if ($id_emprunteur>0)
!   {
!     $req.=" LEFT JOIN prets_contenu ON id_pret=prets.id ";
!     $cond.=" AND prets.id_structure=$id_emprunteur ";
!   }
!   if ($id_preteur>0)
!   {
!     if ($id_emprunteur==0)
!       $req.=" LEFT JOIN prets_contenu ON id_pret=prets.id ";
!     $req.=" LEFT JOIN materiels ON materiels.id=prets_contenu.id_materiel
!             LEFT JOIN localisations ON 
localisations.id=materiels.id_localisation ";
!     $cond.=" AND localisations.id_structure=$id_preteur";
!   }
!   $req=$req.$cond." ORDER BY prets.date_retour_prevu";
!   $res=executeRequete($req);
! 
!   echo "<table align=center border=1>
!         <tr><th>Emprunteur</th><th>Etat</th><th>Date de la demande<br>Date 
d'emprunt</th><th>Date de 
retour</th><th>Commentaire</th><th>Contenu</th></tr>\n";
!   while ($pret=fetch_object($res))
!     affiche_emprunt($pret->id_pret);
!   echo "</table>\n";
! }
! 
! function affiche_emprunt($id_pret)
! {
!   $req="SELECT * FROM prets WHERE id=$id_pret";
    $res = executeRequete($req);
    $pret=fetch_object($res);
!   echo "<tr>\n";
!   echo "<td>";
!   echo structure($pret->id_structure);
!   echo "</td>\n";
!   echo "<td>$pret->etat</td>\n";
!   echo "<td>".datetodate($pret->date_demande)."<br>\n";
!   echo datetodate($pret->date_emprunt)."</td>\n";
!   echo "<td";
    if ($pret->date_retour_effectif<="1")
      if (date("Y-m-d", strtotime($pret->date_retour_prevu))<=date("Y-m-d", 
strtotime("now")))
***************
*** 79,95 ****
        echo " bgcolor=\"orange\"";
    echo ">";
-   if ($pret->date_retour_prevu>"1")
-     echo datetodate($pret->date_retour_prevu);
-   echo "</td></tr>\n";
-   echo "<tr><td>Date de retour effectif</td><td>";
    if ($pret->date_retour_effectif>"1")
      echo datetodate($pret->date_retour_effectif);
    else
!     echo "pas encore retourné.";
    echo "</td></tr>\n";
-   echo "<tr><td>Commentaires</td><td>$pret->commentaires</td></tr>\n";
-   echo "</table>\n";
  }
  
  
  // Début de la page
--- 128,165 ----
        echo " bgcolor=\"orange\"";
    echo ">";
    if ($pret->date_retour_effectif>"1")
      echo datetodate($pret->date_retour_effectif);
    else
!     echo "prévu le ".datetodate($pret->date_retour_prevu);
!   echo "</td>\n";
!   echo "<td>$pret->commentaires</td>\n";
!   echo "<td>";
!   echo recap_emprunt($id_pret);
    echo "</td></tr>\n";
  }
  
+ function recap_emprunt($id_pret)
+ {
+   $req1 = "SELECT COUNT(*) AS nb, type FROM prets_contenu
+                LEFT JOIN materiels ON id_materiel=materiels.id
+                    WHERE id_pret=$id_pret
+                 GROUP BY type";
+   $res1=executeRequete($req1);
+   $sconf="";
+   while ($emprunt=fetch_object($res1))
+     $sconf.="$emprunt->nb : $emprunt->type\n";
+ 
+   $req1 = "SELECT COUNT(*) AS nb, type FROM prets_contenu
+                LEFT JOIN logiciels ON id_logiciel=logiciels.id
+                    WHERE id_pret=$id_pret
+                 GROUP BY type";
+   $res1=executeRequete($req1);
+   while ($emprunt=fetch_object($res1))
+     $sconf.="$emprunt->nb : $emprunt->type\n";
+ 
+   return $sconf;
+ }
+ 
+ 
  
  // Début de la page
***************
*** 101,156 ****
  case 1 : // matériel emprunté (ou en demande) de ma structure
  {
!   echo "<table bgcolor=\"COULEUR_PARC\" align=center>
!         <tr><td align=center><h3>Matériel prêté à d'autres 
structures</h3></td></tr>
!         <tr><td align=center>";
!   $req="SELECT *, pret_materiel.id_structure AS id_structure, 
pret_materiel.id AS id
!                  FROM pret_materiel
!                  LEFT JOIN materiels ON materiels.id=pret_materiel.id_materiel
!                  LEFT JOIN localisations ON 
localisations.id=materiels.id_localisation
!          WHERE localisations.id_structure=$id_structure
!          ORDER BY date_emprunt DESC, date_demande DESC";
! /*
! */
!   $res = executeRequete($req);
!   echo "<table align=center bgcolor=\"white\" border=1>
!         <tr><th rowspan=2>Emprunteur</th><th rowspan=2>Etat</th><th 
rowspan=2>Matériel</th><th colspan=4>Dates</th></tr>
!         <tr><th>demande</th><th>emprunt</th><th>retour 
prévu</th><th>retour</th></tr>\n";
!   while ($pret=fetch_object($res))
!   {
!     echo "<tr>\n";
!     echo "<td>".structure($pret->id_structure)."</td>\n";
!     echo "<td>$pret->etat";
!     if ($pret->etat=="demandé")
!       echo " <a href=\"$PHP_SELF?operation=6&id_pret=$pret->id\">accepter</a>
!              <a href=\"$PHP_SELF?operation=7&id_pret=$pret->id\">refuser</a>";
!     echo "</td>\n";
!     echo "<td>$pret->type : ";
!     if ($pret->materiel>"")
!       echo $pret->materiel;
!     else
!       echo $pret->description;
!     echo "</td>\n";
!     echo "<td>".datetodatecourt($pret->date_demande)."</td>\n";
!     echo "<td>".datetodatecourt($pret->date_emprunt)."</td>\n";
!     echo "<td";
!     if ($pret->date_retour_effectif<="1")
!       if (date("Y-m-d", strtotime($pret->date_retour_prevu))<=date("Y-m-d", 
strtotime("now")))
!         echo " bgcolor=\"red\"";
!       else
!         echo " bgcolor=\"orange\"";
!     echo ">";
!     if ($pret->date_retour_prevu>"1")
!       echo datetodatecourt($pret->date_retour_prevu);
!     echo "</td>\n";
!     echo "<td>";
!     if ($pret->date_retour_effectif>"1")
!       echo datetodatecourt($pret->date_retour_effectif);
!     else
!       echo " <a 
href=\"$PHP_SELF?operation=5&id_pret=$pret->id\">retourner</a>";
!     echo "</td>\n";
!     echo "</tr>\n";
!   }
!   echo "</table>\n";
!   echo "</td></tr></table>";
    break;
  }
--- 171,178 ----
  case 1 : // matériel emprunté (ou en demande) de ma structure
  {
!   echo cadre_debut("Matériel emprunté à d'autres structures");
!   if (! $id_stru) $id_stru=$id_structure;
!   liste_emprunts(0, $id_stru);
!   echo cadre_fin();
    break;
  }
***************
*** 158,211 ****
  case 2 : // matériel emprunté par ma structure
  {
!   echo "<table bgcolor=\"COULEUR_PARC\" align=center>
!         <tr><td align=center><h3>Matériel emprunté par ma 
structures</h3></td></tr>
!         <tr><td align=center>";
!   $req="SELECT *, pret_materiel.id_structure AS id_structure, 
pret_materiel.id AS id
!                  FROM pret_materiel
!                  LEFT JOIN materiels ON materiels.id=pret_materiel.id_materiel
!                  LEFT JOIN localisations ON 
localisations.id=materiels.id_localisation
!          WHERE pret_materiel.id_structure=$id_structure
!          ORDER BY date_emprunt DESC, date_demande DESC";
! /*
! */
!   $res = executeRequete($req);
!   echo "<table align=center bgcolor=\"white\" border=1>
!         <tr><th rowspan=2>Emprunteur</th><th rowspan=2>Etat</th><th 
rowspan=2>Matériel</th><th colspan=4>Dates</th></tr>
!         <tr><th>demande</th><th>emprunt</th><th>retour 
prévu</th><th>retour</th></tr>\n";
!   while ($pret=fetch_object($res))
!   {
!     echo "<tr>\n";
!     echo "<td>".structure($pret->id_structure)."</td>\n";
!     echo "<td>$pret->etat";
!     if ($pret->etat=="demandé")
!       echo " <a href=\"$PHP_SELF?operation=8&id_pret=$pret->id\">modifier</a>
!              <a href=\"$PHP_SELF?operation=9&id_pret=$pret->id\">annuler</a>";
!     echo "</td>\n";
!     echo "<td>$pret->type : ";
!     if ($pret->materiel>"")
!       echo $pret->materiel;
!     else
!       echo $pret->description;
!     echo "</td>\n";
!     echo "<td>".datetodatecourt($pret->date_demande)."</td>\n";
!     echo "<td>".datetodatecourt($pret->date_emprunt)."</td>\n";
!     echo "<td";
!     if ($pret->date_retour_effectif<="1")
!       if (date("Y-m-d", strtotime($pret->date_retour_prevu))<=date("Y-m-d", 
strtotime("now")))
!         echo " bgcolor=\"red\"";
!       else
!         echo " bgcolor=\"orange\"";
!     echo ">";
!     if ($pret->date_retour_prevu>"1")
!       echo datetodatecourt($pret->date_retour_prevu);
!     echo "</td>\n";
!     echo "<td>";
!     if ($pret->date_retour_effectif>"1")
!       echo datetodatecourt($pret->date_retour_effectif);
!     echo "</td>\n";
!     echo "</tr>\n";
!   }
!   echo "</table>\n";
!   echo "</td></tr></table>";
    break;
  }
--- 180,187 ----
  case 2 : // matériel emprunté par ma structure
  {
!   echo cadre_debut("Matériel prêté à d'autres structures");
!   if (! $id_stru) $id_stru=$id_structure;
!   liste_emprunts($id_stru, 0);
!   echo cadre_fin();
    break;
  }
***************
*** 213,273 ****
  case 3 : // tout le matériel emprunté
  {
!   echo "<table bgcolor=\"COULEUR_PARC\" align=center>
!         <tr><td align=center><h3>Tout le matériel prêté</h3></td></tr>
!         <tr><td align=center>";
!   $req="SELECT *, pret_materiel.id_structure AS id_structure, 
pret_materiel.id AS id
!                  FROM pret_materiel
!                  LEFT JOIN materiels ON materiels.id=pret_materiel.id_materiel
!                  LEFT JOIN localisations ON 
localisations.id=materiels.id_localisation
!          ORDER BY date_emprunt DESC, date_demande DESC";
!   $res = executeRequete($req);
!   echo "<table align=center bgcolor=\"white\" border=1>
!         <tr><th rowspan=2>Emprunteur</th><th rowspan=2>Etat</th><th 
rowspan=2>Matériel</th><th colspan=4>Dates</th></tr>
!         <tr><th>demande</th><th>emprunt</th><th>retour 
prévu</th><th>retour</th></tr>\n";
!   while ($pret=fetch_object($res))
    {
!     echo "<tr>\n";
!     echo "<td>".structure($pret->id_structure)."</td>\n";
!     echo "<td>$pret->etat";
!     if ($pret->etat=="demandé")
!       echo " <a href=\"$PHP_SELF?operation=6&id_pret=$pret->id\">accepter</a>
!              <a href=\"$PHP_SELF?operation=7&id_pret=$pret->id\">refuser</a>";
!     echo " <a href=\"$PHP_SELF?operation=8&id_pret=$pret->id\">modifier</a>
!            <a href=\"$PHP_SELF?operation=9&id_pret=$pret->id\">annuler</a>";
!     echo "</td>\n";
!     echo "<td>$pret->type : ";
!     if ($pret->materiel>"")
!       echo $pret->materiel;
!     else
!       echo $pret->description;
!     echo "</td>\n";
!     echo "<td>".datetodatecourt($pret->date_demande)."</td>\n";
!     echo "<td>".datetodatecourt($pret->date_emprunt)."</td>\n";
!     echo "<td";
!     if ($pret->date_retour_effectif<="1")
!       if (date("Y-m-d", strtotime($pret->date_retour_prevu))<=date("Y-m-d", 
strtotime("now")))
!         echo " bgcolor=\"red\"";
!       else
!         echo " bgcolor=\"orange\"";
!     echo ">";
!     if ($pret->date_retour_prevu>"1")
!       echo datetodatecourt($pret->date_retour_prevu);
!     echo "</td>\n";
!     echo "<td>";
!     if ($pret->date_retour_effectif>"1")
!       echo datetodatecourt($pret->date_retour_effectif);
!     else
!       echo " <a 
href=\"$PHP_SELF?operation=5&id_pret=$pret->id\">retourner</a>";
!     echo "</td>\n";
!     echo "</tr>\n";
    }
!   echo "</table>\n";
!   echo "</td></tr></table>";
    break;
  }
  
! case 4 : // Faire une demande d'emprunt
  {
    echo cadre_debut($spretselectionpourdemande);
    // Présenter la liste des matériels disponibles
  
--- 189,299 ----
  case 3 : // tout le matériel emprunté
  {
!   echo cadre_debut("Matériel prêté à d'autres structures");
!   if (! $id_stru) $id_stru=$id_structure;
!   liste_emprunts(0, 0);
!   echo cadre_fin();
!   break;
! }
! 
! case 41 : // Enregistrement de l'expression de la demande
!   // un insert ou un update à faire
! 
!   // Proposer de modifier la liste des matériels empruntés
!   break;
! 
! case 4 : // Expression de la demande d'emprunt
! {
!   echo cadre_debut("Demande d'emprunt de matériel");
!   echo "<table border=1 align=center>\n";
!   echo "  <form action=\"$PHP_SELF\" method=\"POST\" 
enctype=\"multipart/form-data\">
!           <input type=\"hidden\" name=\"operation\" value=\"41\">\n";
!   if ($id_pret)
    {
!     $req="SELECT * FROM prets WHERE id=$id_pret";
!     $res=executeRequete($req);
!     $pret=fetch_object($res);
!     echo "<input type=\"hidden\" name=\"id_pret\" value=\"$id_pret\">\n";
    }
! 
!   echo "<tr><td>Emprunteur</td><td>";
!   if (! $pret->id_structure)
!     $pret->id_structure=$id_structure;
!   echo choix_structure($pret->id_structure, "id_stru", "");
!   echo "</td></tr>
!         <tr><td>Date de la demande</td><td>";
!   if (! $pret->date_demande)
!     $pret->date_demande=date("Y-m-d");
!   echo choixdate($pret->date_demande, "date_demande");
!   echo "</td></tr>
!         <tr><td>Date souhaitée de l'emprunt</td><td>";
!   if (! $pret->date_emprunt)
!     $pret->date_emprunt=date("Y-m-d", strtotime("+ 2 weeks"));
!   echo choixdate($pret->date_emprunt, "date_emprunt");
!   echo "</td></tr>
!         <tr><td>Date de retour prévu</td><td>";
!   if (! $pret->date_retour_prevu)
!     $pret->date_retour_prevu=date("Y-m-d", strtotime("+ 3 weeks"));
!   echo choixdate($pret->date_retour_prevu, "date_retour_prevu");
!   if (! $pret->etat)
!     $pret->etat="préparé";
!   echo "</td></tr>
!         <tr><td>Etat</td><td>$pret->etat</td></tr>
!         <tr><td>Raison de l'emprunt<br>Commentaires</td><td>
!           <textarea name=\"commentaires\" cols=40 
rows=5>".$pret->commentaires."</textarea></td></tr>\n";
!   echo "<tr><td colspan=2 align=center>
!           <input type=\"submit\" value=\"Confirmer\">
!         </td></tr>
!         </form>
!         </table>";
!   echo cadre_fin();
    break;
  }
  
! 
! case 43 : // Enregistrer le changement de sélection de matériel en 
préparation d'emprunt.
! if ($operation==43)
! {
!   // Retrouver les valeurs dans le formulaire d'où l'on vient.
!   $variables=$_POST; // v 4.1.0., anciennement $HTTP_POST_VARS
!   while (list ($key, $val) = each ($variables))
!   {
!     //echo "$key => $val<br />\n";
!     // Deux noms de variables nous intéressent.
!     // id? qui vaut ? et qui permet de savoir que le matériel était dans le 
formulaire,
!     //     ce qui permet de savoir les matériels qui ont été déléctionnés.
!     // sl? qui vaut ? si sélectionné
!     if (substr($key,0,2)=="id")
!     { // était dans le formulaire, on le retire de la sélection en préparation
!       $reqs="DELETE FROM pret_materiel
!                    WHERE id_structure=$id_structure AND id_materiel=$val AND 
etat='préparé'";
!       $ress=executeRequete($reqs);
!     }
!     if (substr($key,0,2)=="sl")
!     { // est sélectionné, on l'ajoute à la sélection en préparation
!       $reqs="INSERT INTO pret_materiel (id_structure, id_materiel, etat)
!                 VALUES ($id_structure, $val, 'préparé')";
!       $ress=executeRequete($reqs);
!     }
!   }
! }
! 
! case 42 : // Faire une demande d'emprunt
  {
    echo cadre_debut($spretselectionpourdemande);
+ 
+   // Faire le bilan des matériels en préparation d'emprunt
+   $sconf=recap_emprunt($id_structure);
+   if ($sconf!="")
+     // Il y a du matériel en préparation pour être emprunté
+     $sconf="<table border=1 align=center>
+               <tr><td>$sconf</td>
+                   <td valign=middle align=center>
+                   <form action=\"$PHP_SELF\" method=\"POST\" 
enctype=\"multipart/form-data\">
+                   <input type=\"hidden\" name=\"operation\" value=\"42\">
+                   <input type=\"submit\" value=\"Terminer/confirmer la 
demande d'emprunt\">
+                 </form>
+               </td></tr></table>";
+   echo $sconf;
+ 
    // Présenter la liste des matériels disponibles
  
***************
*** 294,297 ****
--- 320,324 ----
        echo 
"</th><th>$sLocalisation</th><th>$sAppellation</th><th>$sCommentaire</th><th>$sActions";
        echo "</th></tr>\n\n";
+ 
    // Ligne pour les critères de sélection.
        echo "<form action=\"$PHP_SELF\" method=\"POST\" 
enctype=\"multipart/form-data\">
***************
*** 312,316 ****
--- 339,349 ----
        echo "</td><td></td><td></td><td><input type=\"submit\" 
value=\"$srechercher\">";
        echo "</td></tr>\n</form>\n";
+ 
+   // Début du formulaire de sélection de matériel pour l'emprunt
+       echo "<form action=\"$PHP_SELF\" method=\"POST\" 
enctype=\"multipart/form-data\">
+                               <input type=\"hidden\" name=\"operation\" 
value=\"41\">\n";
+ 
    $type="";
+   $nbitems=0;
    while ($log = fetch_object($res))
    {
***************
*** 327,347 ****
            <td>$log->description</td>
            <td nowrap><a href=\"materiels.php?id_materiel=$log->id\" 
target=\"details\">$info</a>";
! /*    if ((PARC_MOI>="w" && $log->id_structure==$id_structure) || 
PARC_AUTRES>="w")
!       echo "<a 
href=\"$PHP_SELF?operation=2&id_materiel=$log->id\">$modifier</a>
!             <a 
href=\"$PHP_SELF?operation=3&id_materiel=$log->id\">$supprimer</a>"; */
      echo "</td></tr>\n";
    }
  
- /*  if (PARC_MOI>="w" || PARC_AUTRES>="w")
-     echo "<tr><td colspan='4'></td><td><a 
href=\"$PHP_SELF?operation=1\">$ajouter</a></td></tr>\n"; */
    echo "</table>\n";
  
  
  
- 
-   // Permettre de sélectionner tels ou tels matériels
-   // Enregistrer la sélection
-   // Remplir la vraie demande
-   // Envoyer un courriel...
    echo cadre_fin();
    break;
--- 360,405 ----
            <td>$log->description</td>
            <td nowrap><a href=\"materiels.php?id_materiel=$log->id\" 
target=\"details\">$info</a>";
!     // On regarde si c'est un matériel sélectionné ou non.
!     $req1 = "SELECT * FROM prets_contenu
!                     WHERE id_pret=$id_pret
!                       AND id_materiel=$log->id";
!     $res1=executeRequete($req1);
!     if (fetch_object($res1))
!     {
!       echo "<input type=\"hidden\" name=\"id$log->id\" value=\"$log->id\">";
!       echo "<input type='checkbox' name='sl$log->id' value='$log->id' 
checked>";
!       $nbitems++;
!     }
!     else
!       echo "<input type='checkbox' name='sl$log->id' value='$log->id'>";
!     $nbitems++;
! 
      echo "</td></tr>\n";
    }
+   echo "<tr><td colspan=4></td>
+           <td><input type=\"submit\" value=\"Confirmer la sélection\"><br>
+               <input type=\"button\" value=\"Tout désélectionner\" 
onClick=\"deselect(this.form)\"><br>
+               <input type=\"reset\" value=\"Revenir à l'état initial\">
+           </td></tr>\n";
+   echo "</form>";
  
    echo "</table>\n";
  
+   // Fonction en javascript permettant de désélectionner les cases cochées 
présentes sur l'écran.
+   echo "<script type=\"text/javascript\" language=\"javascript\">
+     <!--
+     function deselect(formulaire)
+     {
+     var i;
+       for (i=1; i<=$nbitems; i++)
+        if (formulaire.elements[i].checked == true)
+         formulaire.elements[i].checked = false;
+     }
+     // -->
+     </script>\n";
  
+   // On rappelle le tableau récapitulatif de l'emprunt en préparation.
+   echo $sconf;
  
    echo cadre_fin();
    break;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]