noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
ajax_forecast.php
Go to the documentation of this file.
1<?php
2/*
3* This file is part of NOALYSS.
4*
5* NOALYSS is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation; either version 2 of the License, or
8* (at your option) any later version.
9*
10* NOALYSS is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with NOALYSS; if not, write to the Free Software
17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20// Copyright Author Dany De Bontridder danydb@noalyss.eu
21/**
22 * @file
23 * @brief FORECAST Edition
24 */
25if (!defined('ALLOWED')) die('Appel direct ne sont pas permis');
26
27require_once NOALYSS_INCLUDE . "/database/forecast_sql.class.php";
28
29if ($g_user->check_module("FORECAST")==0) die();
30
32$input = $http->request("input");
33$action = $http->request("ieaction", "string", "display");
34
35if ($action == "display") {
37 $f_id = $http->request("f_id", "number");
38
39 $ajax->set_callback("ajax_misc.php");
40 $ajax->add_json_param("op", "forecast");
41 $ajax->add_json_param("gDossier", Dossier::id());
42 $ajax->add_json_param("f_id", $f_id);
43 echo $ajax->ajax_input();
44}
45if ($action == "ok") {
46 $f_id = $http->request("f_id", "number");
48 $ajax->set_callback("ajax_misc.php");
49 $ajax->add_json_param("op", "forecast");
50 $ajax->add_json_param("gDossier", Dossier::id());
51 $ajax->add_json_param("f_id", $f_id);
52
53 $value = $http->request("value");
54 $ajax->set_value($value);
55 $input = $ajax->get_input();
56
57 $data_sql = new Forecast_SQL($cn, $f_id);
58 switch ($input->name) {
59 case 'f_name':
60 if ( trim($value)!="") {
61 $data_sql->setp($input->name, $value);
62 } else {
63 $value=$data_sql->getp('f_name');
64 $ajax->set_value($value);
65 }
66 break;
67 case 'p_start':
68 $data_sql->setp("f_start_date", $value);
69 break;
70 case 'p_end':
71 $data_sql->setp("f_end_date", $value);
72 break;
73 }
74
75 $data_sql->update();
76 echo $ajax->value();
77}
78if ($action == "cancel") {
80 $f_id = $http->request("f_id", "number");
81
82 $ajax->set_callback("ajax_misc.php");
83 $ajax->add_json_param("op", "forecast");
84 $ajax->add_json_param("gDossier", Dossier::id());
85 $f_id = $http->request("f_id", "number");
86 $ajax->add_json_param("f_id", $f_id);
87
88 echo $ajax->value();
89}
global $g_user
if no group available , then stop
ORM abstract of the table public.forecast.
manage the http input (get , post, request) and extract from an array
static build($p_serialize)
build a Inplace_Edit object from a serialized string (ajax json parameter = input)
$ajax
Definition popup.php:124