From 35a1c8b562894a90e72da20f1469e5d79340af58 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 28 Jun 2011 16:28:44 +0000 Subject: [PATCH] --- inc/ws/Controlleur/class.ws.url.php | 21 +++++++++++++-------- js/ws.js | 8 ++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 2caeb2ef6..ed52de13c 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -128,9 +128,9 @@ class wsUrl { } else { $res.=''; } - if ($droits->creation && $book->status<0) { + if ($droits->creation && $book->status < 0) { $res .= '' . $btDel . ''; - }else{ + } else { $res.=''; } $res .= ''; @@ -748,13 +748,18 @@ html{height:100%}' . "\n"; $book = $dao->selectById($book_id); $projects = array("--" => '0'); - $r = $core->con->select('SELECT * FROM projets WHERE client IN(SELECT facturable_id FROM ws_users_tree WHERE utilisateur_id=\'' . $core->con->escape($book->proprietaire_id) . '\') ORDER BY projet_id DESC'); + + $proprietaire = 'SELECT facturable_id FROM ws_users_tree WHERE utilisateur_id=\'' . $core->con->escape($book->proprietaire_id) . '\''; + $entreprise = 'SELECT entreprise FROM utilisateurs WHERE utilisateur_id IN (' . $proprietaire . ')'; + $collegues = 'SELECT utilisateur_id FROM utilisateurs WHERE entreprise IN(' . $entreprise . ')'; + + $r = $core->con->select('SELECT * FROM projets WHERE client IN(' . $collegues . ') ORDER BY projet_id DESC'); while ($r->fetch()) { $projects[$r->projet_id . ' - ' . $r->nom] = $r->projet_id; } - $res = '' . __('Choisir un projet') . ' : ' . form::hidden('book_id', $book_id) . form::combo('book_project', $projects, $book->projet) . ''; - $res .= '' . __('ou créer un nouveau projet') . ' : ' . form::field('new_book_project_nom', 64, 1024, $book->nom) . ''; + $res = '' . __('Choisir un projet') . ' : ' . form::hidden('book_id', $book_id) . form::combo('book_project', $projects, $book->projet, 'hide_new_value') . ''; + $res .= '' . __('ou créer un nouveau projet') . ' : ' . form::field('new_book_project_nom', 64, 1024, $book->nom) . ''; return $res; } @@ -774,8 +779,8 @@ html{height:100%}' . "\n"; $res = ''; if ($r->count() > 0) { - $res .= '' . __('Choisir une tâche') . ' : ' . form::hidden('book_id', $book_id) . form::hidden('projet_id', $projet_id) . form::combo('tache', $taches) . ''; - $res .= '' . __('ou créer une nouvelle tâche') . ' : ' . form::field('nom', 32, 1024, 'Fluidbook #' . $book->book_id . ' : ' . $book->nom) . ' ' . __('ayant le budget suivant') . ' ' . form::field('budget', 6, 6) . ''; + $res .= '' . __('Choisir une tâche') . ' : ' . form::hidden('book_id', $book_id) . form::hidden('projet_id', $projet_id) . form::combo('tache', $taches,'0', 'hide_new_value') . ''; + $res .= '' . __('ou créer une nouvelle tâche') . ' : ' . form::field('nom', 32, 1024, 'Fluidbook #' . $book->book_id . ' : ' . $book->nom) . ' ' . __('ayant le budget suivant') . ' ' . form::field('budget', 6, 6) . ''; } else { $res .= '' . __('Créer une tâche') . ' : ' . form::hidden('book_id', $book_id) @@ -808,7 +813,7 @@ html{height:100%}' . "\n"; wsSecureSWF::checkProtectedSWF(); cubePHP::neverStop(); $dao = new wsDAOBook($core->con); - + header('Content-type: text/plain'); ob_end_clean(); echo $dao->compile($args[1], 3, isset($args[2])); diff --git a/js/ws.js b/js/ws.js index fc2de7cc1..b9b8693d4 100644 --- a/js/ws.js +++ b/js/ws.js @@ -43,6 +43,14 @@ function load_ws(){ }); $(".restoreLink").click(restoreLink); + + $(".hide_new_value").change(function(){ + if($(this).val()==0){ + $(".new").show(); + }else{ + $(".new").hide(); + } + }); } function restoreLink(){ -- 2.39.5