define('SITE_PATH', WEBROOT . '/');\r
define('FONT_PATH', ROOT . '/fluidbook/fonts/');\r
define('FTPROOT', '/home/extranet/ftp/');\r
-define('DEV', false);\r
+define('DEV', $dev);\r
define('WINDOWS', false);\r
define('CONVERTER_PATH', '/bin:/usr/bin:/usr/local/bin:/home/extranet/dev/fluidbook/tools:/usr/local/flex:/usr/local/secureSWF');\r
define('MXMLC_PATH', '/usr/local/flex/bin/mxmlc');\r
define('DB_NAME', 'extranet_dev');\r
define('DB_USER', 'ws');\r
define('DB_PASSWORD', '*arica*2');\r
+\r
+ define('EXTRANET_URL', 'http://dev.extranet.cubedesigners.com');\r
+ define('WS_URL', 'http://dev.ws.fluidbook.com');\r
} else {\r
// Définition des variables dans l'environnement de production\r
define('DB_HOST', 'localhost');\r
define('DB_NAME', 'extranet');\r
define('DB_USER', 'ws');\r
define('DB_PASSWORD', '*arica*2');\r
+\r
+ define('EXTRANET_URL', 'http://extranet.cubedesigners.com');\r
+ define('WS_URL', 'http://ws.fluidbook.com');\r
}\r
\r
if ($ws) {\r
$dao = new extranetDAOProjet($core->con);\r
$projet = $dao->selectById($projet_id);\r
\r
- $hasFacture = $dao->projectHasFacture($projet_id);\r
+ $hasFacture = $dao->hasFacture($projet_id);\r
\r
$droits = extranetDroits::projet($projet, false);\r
\r
$c = $this->con->openCursor('projets');\r
$c->nom = $data['nom'];\r
$c->chef = $data['chef'];\r
- $c->date_debut = cubeDate::formFreeToTime($data['date_debut']);\r
- $c->deadline = cubeDate::formFreeToTime($data['deadline']);\r
- $c->date_fin = cubeDate::formFreeToTime($data['date_fin']);\r
+ if (isset($data['date_debut'])) {\r
+ $c->date_debut = cubeDate::formFreeToTime($data['date_debut']);\r
+ $c->deadline = cubeDate::formFreeToTime($data['deadline']);\r
+ $c->date_fin = cubeDate::formFreeToTime($data['date_fin']);\r
+ } elseif ($data['projet_id'] == 'new') {\r
+ $c->date_debut = $c->deadline = $c->date_fin = TIME;\r
+ }\r
$c->client = $data['client'];\r
$c->devis = $data['devis'];\r
if ($data['projet_id'] == 'new') {\r
$c->status = 0;\r
$c->projet_id = $this->getNextId();\r
- $c->date_creation = time();\r
+ $c->date_creation = TIME;\r
$c->insert();\r
return $c->projet_id;\r
} else {\r
\r
public function hasFacture($projet_id)\r
{\r
- $r = $this->con->select('SELECT * FROM factures WHERE projet=\'' . $core->con->escape($projet_id) . '\'');\r
+ $r = $this->con->select('SELECT * FROM factures WHERE projet=\'' . $this->con->escape($projet_id) . '\'');\r
return $r->count() > 0;\r
}\r
\r
}\r
\r
if ($data['tache_id'] == 'new') {\r
- $c->tache_id = $this->getNextId();\r
- return $c->insert();\r
+ $tache_id=$c->tache_id = $this->getNextId();\r
+ $c->insert();\r
} else {\r
- return $c->update('WHERE tache_id=\'' . $this->con->escape($data['tache_id']) . '\'');\r
+ $tache_id=$data['tache_id'];\r
+ $c->update('WHERE tache_id=\'' . $this->con->escape($data['tache_id']) . '\'');\r
}\r
+\r
+ return $tache_id;\r
}\r
\r
public function supprime($tache_id)\r
\r
$book_id = $args[1];\r
$status = $args[2];\r
- if ($status == 2 && isset($args[3])) {\r
+ if ($status == 2) {\r
$x->addOpenPopup(self::formBookChooseProject($book_id));\r
+ return;\r
}\r
\r
$daoBook = new wsDAOBook($core->con);\r
\r
public static function bookChooseProject($args, &$x)\r
{\r
+ global $core;\r
+\r
$book_id = $_POST['book_id'];\r
+\r
if ($_POST['book_project'] == 0) {\r
- $project = 0;\r
+ if (!isset($_POST['new_book_project_nom']) || $_POST['new_book_project_nom'] == '') {\r
+ $x->addError('new_book_project_nom');\r
+ return;\r
+ }\r
+\r
+ $core->loadExtranetClasses();\r
+\r
+ $daoBook = new wsDAOBook($core->con);\r
+ $book = $daoBook->selectById($book_id);\r
+\r
+ $daoProjet = new extranetDAOProjet($core->con);\r
+ $data = array();\r
+ $data['nom'] = $_POST['new_book_project_nom'];\r
+ $data['chef'] = $core->user->utilisateur_id;\r
+ $data['client'] = $book->proprietaire_id;\r
+ $data['devis'] = 0;\r
+ $data['projet_id'] = 'new';\r
+ $project = $daoProjet->sauve($data);\r
} else {\r
$project = $_POST['book_project'];\r
}\r
\r
public static function bookChooseTache($args, &$x)\r
{\r
+ global $core;\r
+\r
$book_id = $_POST['book_id'];\r
$projet_id = $_POST['projet_id'];\r
\r
- if ($_POST['book_tache'] == 0) {\r
- $tache = 0;\r
+ if ($_POST['tache'] == 0) {\r
+ $ok = true;\r
+\r
+ if (!isset($_POST['nom']) || $_POST['nom'] == '') {\r
+ $x->addError('nom');\r
+ $ok = false;\r
+ } else {\r
+ $x->addOk('nom');\r
+ }\r
+\r
+ if (!isset($_POST['budget']) || $_POST['budget'] == '') {\r
+ $x->addError('budget');\r
+ $ok = false;\r
+ } else {\r
+ $x->addOk('budget');\r
+ }\r
+\r
+ $core->loadExtranetClasses();\r
+ $daoTache = new extranetDAOTache($core->con);\r
+\r
+ $data = array();\r
+ $data['tache_id'] = 'new';\r
+ $data['projet'] = $projet_id;\r
+ $data['nom'] = $_POST['nom'];\r
+ $data['categorie'] = 8;\r
+ $data['taux_journalier'] = TAUX_JOURNALIER;\r
+ $data['budget'] = $_POST['budget'];\r
+ $data['type'] = 0;\r
+\r
+ $tache = $daoTache->sauve($data);\r
} else {\r
- $tache = $_POST['book_tache'];\r
+ $tache = $_POST['tache'];\r
}\r
\r
+ $daoBook = new wsDAOBook($core->con);\r
+ $daoBook->setTache($book_id, $tache);\r
+\r
$x->addClosePopup();\r
+ $x->addContent('listeBooks', wsUrl::listeBooks());\r
}\r
\r
public static function changeLang($args, &$x)\r
}\r
if ($droits->revendeur) {\r
if ($droits->admin || $book->status <= 1) {\r
- $res .= '<td><a href="#" class="openContextMenu" rel="' . $context_status_id . '" rev="' . $book->book_id . '">' . $core->books_status[$book->status] . '</a></td>';\r
+ $p = '';\r
+ if (!is_null($book->projet)) {\r
+ $p = ' <a href="' . EXTRANET_URL . '/projet/' . $book->projet . '" title="' . __('Voir les détails du projet') . '" class="blank icon">' . cubeMedia::silk('arrow_right.png') . '</a>';\r
+ }\r
+\r
+ $res .= '<td><a href="#" class="openContextMenu" rel="' . $context_status_id . '" rev="' . $book->book_id . '">' . $core->books_status[$book->status] . '</a>' . $p . '</td>';\r
} else if ($book->status > 1) {\r
$res .= '<td>' . $core->books_status[1] . '</td>';\r
}\r
\r
if (wsDroits::admin()) {\r
$status = $core->books_status;\r
+ $status[2] = __('Facturé (associé à un projet)');\r
} else {\r
$status = array();\r
$status[-1] = $core->books_status[-1];\r
foreach($status as $s => $title) {\r
$res .= '<li><a href="#" rel="statusBook/$1/' . $s . '" class="ajax">' . $title . '</a></li>';\r
}\r
- if (wsDroits::admin()) {\r
- $res .= '<li><a href="#" rel="statusBook/$1/' . $s . '/1" class="ajax">' . __('Ajouter à un projet') . '</a></li>';\r
- }\r
$res .= '</ul></div>';\r
return $res;\r
}\r
$book = $dao->selectById($book_id);\r
\r
$projects = array("--" => '0');\r
- $r = $core->con->select('SELECT * FROM projets WHERE client IN( SELECT facturable_id FROM ws_users_tree WHERE utilisateur_id IN (SELECT utilisateur_id FROM utilisateurs WHERE entreprise=\'' . $core->con->escape($book->proprietaire_id) . '\')) ORDER BY projet_id DESC');\r
+ $r = $core->con->select('SELECT * FROM projets WHERE client IN(SELECT entreprise FROM utilisateurs WHERE utilisateur_id IN( SELECT facturable_id FROM ws_users_tree WHERE utilisateur_id IN (SELECT utilisateur_id FROM utilisateurs WHERE entreprise=\'' . $core->con->escape($book->proprietaire_id) . '\'))) ORDER BY projet_id DESC');\r
while ($r->fetch()) {\r
$projects[$r->projet_id . ' - ' . $r->nom] = $r->projet_id;\r
}\r
\r
- $res = '<tr><td>' . __('Choisir un projet') . ' : </td><td>' . form::hidden('book_id', $book_id) . form::combo('book_project', $projects,$book->projet) . '</td></tr>';\r
- $res .= '<tr><td>' . __('ou créer un nouveau projet') . ' : </td><td>' . form::field('new_book_project_nom', 64, 1024) . '</td></tr>';\r
+ $res = '<tr><td>' . __('Choisir un projet') . ' : </td><td>' . form::hidden('book_id', $book_id) . form::combo('book_project', $projects, $book->projet) . '</td></tr>';\r
+ $res .= '<tr><td>' . __('ou créer un nouveau projet') . ' : </td><td>' . form::field('new_book_project_nom', 64, 1024, $book->nom) . '</td></tr>';\r
return $res;\r
}\r
\r
$book = $dao->selectById($book_id);\r
\r
$taches = array("--" => '0');\r
- $r = $core->con->select('SELECT * FROM taches WHERE projet=\'' . $core->con->escape($projet_id) . '\'');\r
+ $r = $core->con->select('SELECT * FROM taches WHERE projet=\'' . $core->con->escape($projet_id) . '\' AND categorie=8');\r
while ($r->fetch()) {\r
$taches[$r->nom] = $r->tache_id;\r
}\r
\r
- $res = '<tr><td>' . __('Choisir une tâche') . ' : </td><td>' . form::hidden('book_id', $book_id) . form::hidden('projet_id', $projet_id) . form::combo('tache', $taches) . '</td></tr>';\r
- $res .= '<tr><td>' . __('ou créer une nouvelle tâche') . ' : </td><td>' . form::field('nom', 32, 1024, $book->nom) . ' ' . __('ayant le budget suivant') . ' ' . form::field('budget', 6, 6) . '</td></tr>';\r
+ $res = '';\r
+\r
+ if ($r->count() > 0) {\r
+ $res .= '<tr><td>' . __('Choisir une tâche') . ' : </td><td>' . form::hidden('book_id', $book_id) . form::hidden('projet_id', $projet_id) . form::combo('tache', $taches) . '</td></tr>';\r
+ $res .= '<tr><td>' . __('ou créer une nouvelle tâche') . ' : </td><td>' . form::field('nom', 32, 1024, 'Fluidbook #' . $book->book_id . ' : ' . $book->nom) . ' ' . __('ayant le budget suivant') . ' ' . form::field('budget', 6, 6) . '</td></tr>';\r
+ } else {\r
+ $res .= '<tr><td>' . __('Créer une tâche') . ' : </td><td>'\r
+ . form::hidden('book_id', $book_id)\r
+ . form::hidden('projet_id', $projet_id)\r
+ . form::hidden('tache', '0')\r
+ . form::field('nom', 32, 1024, 'Fluidbook #' . $book->book_id . ' : ' . $book->nom)\r
+ . ' ' . __('ayant le budget suivant')\r
+ . ' ' . form::field('budget', 6, 6) . '</td></tr>';\r
+ }\r
+\r
return $res;\r
}\r
\r
$book->date = TIME;\r
$book->chapters = json_encode(array());\r
$book->parametres = new wsBookParametres();\r
- $book->tache=0;\r
+ $book->tache = 0;\r
$book->pages = array();\r
return $book;\r
}\r
$c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
}\r
\r
+ public function setTache($book_id, $tache)\r
+ {\r
+ $c = $this->con->openCursor('books');\r
+ $c->tache = $tache;\r
+ $c->status = 2;\r
+ $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\'');\r
+ }\r
+\r
public function touch($book_id)\r
{\r
$c = $this->con->openCursor('books');\r
protected $hash;\r
protected $compteur_visites;\r
\r
+ protected $tache;\r
+ protected $projet;\r
+\r
protected $status;\r
protected $date_status;\r
\r
.liste .action{width:1px;}\r
.liste th a{color:#797D62;text-decoration:none;font-weight:bold;}\r
.liste th a:hover{text-decoration:underline;}\r
+.liste td a.icon img{vertical-align:middle;margin-top:0px;}\r
\r
.form td a img, .liste td a img{margin-top:4px;}\r
\r
.downbookContextMenu a{\r
text-decoration:none;\r
}\r
+\r
+\r