Commit ee7cadef authored by mbriand's avatar mbriand
Browse files

Archivage des objets de l'inventaire

parent a7909c84
...@@ -42,9 +42,14 @@ $cts = new contents($asso->get_html_path()); ...@@ -42,9 +42,14 @@ $cts = new contents($asso->get_html_path());
$cts->add(new tabshead($asso->get_tabs($site->user),"inv")); $cts->add(new tabshead($asso->get_tabs($site->user),"inv"));
$show_all = false;
if (isset($_REQUEST['show_all']))
$show_all = true;
$cts->add_paragraph("<a href=\"../objet.php?id_asso=".$asso->id."\">Ajouter un objet</a>"); $cts->add_paragraph("<a href=\"../objet.php?id_asso=".$asso->id."\">Ajouter un objet</a>");
$cts->add_paragraph("<a href=\"../etiquette.php?id_asso=".$asso->id."\">Imprimer codes barres</a>"); $cts->add_paragraph("<a href=\"../etiquette.php?id_asso=".$asso->id."\">Imprimer codes barres</a>");
$cts->add_paragraph("<a href=\"inventaire.php?id_asso=".$asso->id."&showall\">Afficher les objets archivés</a>");
...@@ -57,19 +62,34 @@ $req = new requete ( $site->db, "SELECT `inv_objet`.`id_objet`," . ...@@ -57,19 +62,34 @@ $req = new requete ( $site->db, "SELECT `inv_objet`.`id_objet`," .
"`sl_batiment`.`id_batiment`,`sl_batiment`.`nom_bat`," . "`sl_batiment`.`id_batiment`,`sl_batiment`.`nom_bat`," .
"`sl_salle`.`id_salle`,`sl_salle`.`nom_salle`, " . "`sl_salle`.`id_salle`,`sl_salle`.`nom_salle`, " .
"`inv_type_objets`.`id_objtype`,`inv_type_objets`.`nom_objtype` " . "`inv_type_objets`.`id_objtype`,`inv_type_objets`.`nom_objtype` " .
($show_all ? "if(`inv_objet`.`archive_objet` = 1, 'Oui', 'Non') archive_objet" : "").
"FROM `inv_objet` " . "FROM `inv_objet` " .
"INNER JOIN `asso` AS `asso_gest` ON `inv_objet`.`id_asso`=`asso_gest`.`id_asso` " . "INNER JOIN `asso` AS `asso_gest` ON `inv_objet`.`id_asso`=`asso_gest`.`id_asso` " .
"INNER JOIN `asso` AS `asso_prop` ON `inv_objet`.`id_asso_prop`=`asso_prop`.`id_asso` " . "INNER JOIN `asso` AS `asso_prop` ON `inv_objet`.`id_asso_prop`=`asso_prop`.`id_asso` " .
"INNER JOIN `sl_salle` ON `inv_objet`.`id_salle`=`sl_salle`.`id_salle` " . "INNER JOIN `sl_salle` ON `inv_objet`.`id_salle`=`sl_salle`.`id_salle` " .
"INNER JOIN `sl_batiment` ON `sl_batiment`.`id_batiment`=`sl_salle`.`id_batiment` " . "INNER JOIN `sl_batiment` ON `sl_batiment`.`id_batiment`=`sl_salle`.`id_batiment` " .
"INNER JOIN `inv_type_objets` ON `inv_objet`.`id_objtype`=`inv_type_objets`.`id_objtype` " . "INNER JOIN `inv_type_objets` ON `inv_objet`.`id_objtype`=`inv_type_objets`.`id_objtype` " .
"WHERE `inv_objet`.`id_asso`='".$asso->id."'" ); "WHERE `inv_objet`.`id_asso`='".$asso->id."'".
($show_all ? "" : "AND `archive_objet` = 0")
);
$columns = array(
"nom_objet"=>"Objet",
"nom_objtype"=>"Type",
"nom_asso_gest"=>"Gestionnaire",
"nom_asso_prop"=>"Propriétaire",
"nom_salle"=>"Salle",
"nom_bat"=>"Batiment",
);
if ($show_all)
$columns["archive_objet"] = "Archivé";
$tbl = new sqltable( $tbl = new sqltable(
"listobjets", "listobjets",
"Inventaire", $req, "asso.php", "Inventaire", $req, "asso.php",
"id_objet", "id_objet",
array("nom_objet"=>"Objet","nom_objtype"=>"Type","nom_asso_gest"=>"Gestionnaire","nom_asso_prop"=>"Propriétaire","nom_salle"=>"Salle","nom_bat"=>"Batiment"), $columns,
array(), array(), array() array(), array(), array()
); );
......
...@@ -374,7 +374,7 @@ class objet extends stdentity ...@@ -374,7 +374,7 @@ class objet extends stdentity
function save_objet ( $id_asso, $id_asso_prop, $id_salle, $id_objtype, $id_op, $nom, function save_objet ( $id_asso, $id_asso_prop, $id_salle, $id_objtype, $id_op, $nom,
$num_serie, $prix, $caution, $prix_emprunt, $empruntable, $num_serie, $prix, $caution, $prix_emprunt, $empruntable,
$en_etat, $date_achat, $notes,$cbar ) $en_etat, $date_achat, $notes,$cbar, $archive )
{ {
$this->id_asso = $id_asso; $this->id_asso = $id_asso;
...@@ -392,6 +392,7 @@ class objet extends stdentity ...@@ -392,6 +392,7 @@ class objet extends stdentity
$this->en_etat = $en_etat; $this->en_etat = $en_etat;
$this->notes = $notes; $this->notes = $notes;
$this->date_achat = $date_achat; $this->date_achat = $date_achat;
$this->archive = $archive;
$sql = new update ($this->dbrw, $sql = new update ($this->dbrw,
"inv_objet", "inv_objet",
......
...@@ -75,7 +75,7 @@ if ( isset($_REQUEST["id_objet"]) ) ...@@ -75,7 +75,7 @@ if ( isset($_REQUEST["id_objet"]) )
$asso_gest->id, $asso_prop->id, $salle->id, $objtype->id, $objet->id_op, $_REQUEST["nom"], $asso_gest->id, $asso_prop->id, $salle->id, $objtype->id, $objet->id_op, $_REQUEST["nom"],
$_REQUEST["num_serie"], $_REQUEST["prix"], $_REQUEST["caution"], $_REQUEST["num_serie"], $_REQUEST["prix"], $_REQUEST["caution"],
$_REQUEST["prix_emprunt"], $_REQUEST["empruntable"], $_REQUEST["prix_emprunt"], $_REQUEST["empruntable"],
$_REQUEST["en_etat"], $_REQUEST["date_achat"], $_REQUEST["notes"], $_REQUEST["cbar"] ); $_REQUEST["en_etat"], $_REQUEST["date_achat"], $_REQUEST["notes"], $_REQUEST["cbar"], $_REQUEST["archive"] );
} }
elseif ( $_REQUEST["page"] == "edit" && $can_admin) elseif ( $_REQUEST["page"] == "edit" && $can_admin)
{ {
...@@ -99,6 +99,7 @@ if ( isset($_REQUEST["id_objet"]) ) ...@@ -99,6 +99,7 @@ if ( isset($_REQUEST["id_objet"]) )
$frm->add_price_field("prix_emprunt","Prix d'un emprunt",$objet->prix_emprunt); $frm->add_price_field("prix_emprunt","Prix d'un emprunt",$objet->prix_emprunt);
$frm->add_checkbox("empruntable","Reservable via le site internet",$objet->empruntable); $frm->add_checkbox("empruntable","Reservable via le site internet",$objet->empruntable);
$frm->add_checkbox("en_etat","En etat",$objet->en_etat); $frm->add_checkbox("en_etat","En etat",$objet->en_etat);
$frm->add_checkbox("archive", "Archive",$objet->archive);
$frm->add_text_area("notes","Notes",$objet->notes); $frm->add_text_area("notes","Notes",$objet->notes);
$frm->add_submit("valide","Enregistrer"); $frm->add_submit("valide","Enregistrer");
$site->add_contents($frm); $site->add_contents($frm);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment