diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php new file mode 100644 index 00000000000..8250f478298 --- /dev/null +++ b/htdocs/projet/fiche.php @@ -0,0 +1,191 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("./pre.inc.php"); +require("./project.class.php"); +require("../propal.class.php3"); + +if ($HTTP_POST_VARS["action"] == 'update') +{ + $projet = new Project($db); + $projet->id = $id; + $projet->ref = $HTTP_POST_VARS["ref"]; + $projet->title = $HTTP_POST_VARS["title"]; + $projet->update(); +} + +if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == yes) +{ + $projet = new Project($db); + $projet->id = $id; + $projet->delete(); + Header("Location: index.php"); +} + +llxHeader("","../"); + +if ($action == 'delete') +{ + + print '
'; + print ''; + print ''; + + print ''; + + print '\n"; + print ''; + print '
Supprimer le projet
Etes-vous sur de vouloir supprimer ce projet ?'; + $htmls = new Form($db); + + $htmls->selectyesno("confirm","no"); + + print "
'; + print "
\n"; +} + + + +if ($action == 'create') +{ + print_titre("Nouveau projet"); + + print '
'; + ?> + + + + '; + ?> + + + +
Société + get_nom($socidp); + print ''.$societe->nom.''; + + ?> +
Créateur'.$user->fullname.'
Référence
Titre
+
+ fetch($id); + + $projet->societe->fetch($projet->societe->id); + + if ($action == 'edit') + { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
Société'.$projet->societe->nom.'
Ref
Titre
'; + } + else + { + print ''; + print ''; + + print ''; + print ''; + print '
Société'.$projet->societe->nom.'
Réf'.$projet->ref.'
Titre'.$projet->title.'
'; + + $propales = $projet->get_propal_list(); + + if (sizeof($propales)>0 && is_array($propales)) + { + + print_titre('Listes des propales associées au projet'); + print ''; + + print ''; + print ""; + print ''; + print ''; + print ''; + print ''; + + for ($i = 0; $ifetch($propales[$i]); + + $var=!$var; + print ""; + print "\n"; + + print ''; + + print ''; + print ''; + print ''; + + $total = $total + $propale->price; + } + + print ''; + print ''; + print ''; + print "
RéfDatePrixStatut
id\">$propale->ref'.strftime("%d %B %Y",$propale->datep).''.price($propale->price).''.$propale->statut.'
'.$i.' propalesTotal : '.price($total).'Euros HT
"; + } + } + + + print "

"; + + if ($action == "edit") + { + print ""; + } + else + { + print ""; + } + + print ''; + print ''; + print ''; + + print ""; + + print "
AnnulerEditer---Supprimer
"; + +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php new file mode 100644 index 00000000000..4203a384213 --- /dev/null +++ b/htdocs/projet/index.php @@ -0,0 +1,125 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ +require("./pre.inc.php"); +require("./project.class.php"); + +/* + * Sécurité accés client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socidp = $user->societe_id; +} + +llxHeader("","../"); +print_titre("Projets"); + +/* + * Traitements des actions + * + */ +if ($HTTP_POST_VARS["action"] == 'create') +{ + $pro = new Project($db); + $pro->socidp = $socidp; + $pro->ref = $ref; + $pro->title = $title; + $pro->create( $user->id); +} + +/* + * + * Affichage + * + */ +if ($sortfield == "") +{ + $sortfield="lower(s.nom)"; +} +if ($sortorder == "") +{ + $sortorder="ASC"; +} + +if ($page == -1) { $page = 0 ; } +$limit = 26; +$offset = $limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + +/* + * + * + * Liste des projets + * + * + */ +print '

'; +print '\n"; + +$sql = "SELECT s.nom, s.idp, p.rowid as projectid, p.ref, p.title,".$db->pdate("p.dateo")." as do"; +$sql .= " FROM llx_societe as s, llx_projet as p"; +$sql .= " WHERE p.fk_soc = s.idp"; + +if ($socidp) +{ + $sql .= " AND s.idp = $socidp"; +} + +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); + +if ( $db->query($sql) ) +{ + $num = $db->num_rows(); + $i = 0; + + while ($i < $num) + { + $objp = $db->fetch_object( $i); + + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + + $i++; + } + + $db->free(); +} +else +{ + print $db->error(); +} + +print "
'; +print_liste_field_titre("Titre",$PHP_SELF,"p.title"); +print "Réf"; +print_liste_field_titre("Société",$PHP_SELF,"s.nom"); +print "
projectid\">$objp->titleprojectid\">$objp->refidp\">$objp->nom
"; + +$db->close(); +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/projet/pre.inc.php b/htdocs/projet/pre.inc.php new file mode 100644 index 00000000000..6d6fa73246c --- /dev/null +++ b/htdocs/projet/pre.inc.php @@ -0,0 +1,39 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require ("../main.inc.php3"); + +function llxHeader($head = "", $urlp = "") { + /* + * + * + */ + top_menu($head); + + $menu = new Menu(); + + $menu->add(DOL_URL_ROOT."/projet/", "Projets"); + + left_menu($menu->liste); +} + +?>