noalyss Version-9
ajax_report_definition.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * PhpCompta is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * PhpCompta is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PhpCompta; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20// Copyright (2002-2021) Author Dany De Bontridder <danydb@noalyss.eu>
21
22if (!defined('ALLOWED'))
23 die('Appel direct ne sont pas permis');
24
25/**
26 * @file
27 * @brief manage the simple report definition
28 */
30$sa=$http->request('sa', "string", "acc_report_mtable");
31if ($sa =="acc_report_mtable")
32{
33
34 try
35 {
36 $ctl=$http->request('ctl');
37 $id=$http->request("p_id", "number");
38 $action=$http->request("action");
39 $form_def=$http->request("form_def", "number");
40 }
41 catch (Exception $ex)
42 {
43 die("invalid data");
44 }
45
46
47 $acc_report=Acc_Report_MTable::build($id, $form_def);
48 $acc_report->set_object_name($ctl);
49
50 if ($action=='input')
51 {
52 $acc_report->send_header();
53 echo $acc_report->ajax_input()->saveXML();
54 return;
55 }
56 elseif ($action=='save')
57 {
58 $acc_report->send_header();
59 echo $acc_report->ajax_save()->saveXML();
60 return;
61 }
62 elseif ($action=="delete")
63 {
64 $acc_report->send_header();
65 echo $acc_report->ajax_delete()->saveXML();
66 return;
67 }
68}elseif ($sa == "change_name")
69{
70 try
71 {
72 $id=$http->request("p_id");
73 $input=$http->request("input");
74 $action=$http->request("ieaction","string","display");
75 }
76 catch (Exception $exc)
77 {
78 echo $exc->getMessage();
79
80 }
81 if ( $action == "display" ) {
83 $iName->set_callback("ajax_misc.php");
84 $iName->add_json_param("op", "report_definition");
85 $iName->add_json_param("sa", "change_name");
86 $iName->add_json_param("gDossier", Dossier::id());
87 $iName->add_json_param("p_id", $id);
88 echo $iName->ajax_input();
89 } elseif ($action == "ok") {
91 $iName->set_callback("ajax_misc.php");
92 $iName->add_json_param("op", "report_definition");
93 $iName->add_json_param("sa", "change_name");
94 $iName->add_json_param("p_id", $id);
95 $iName->add_json_param("gDossier", Dossier::id());
96 $iName->set_value($http->request("value"));
97 echo $iName->value();
98
99 $cn->exec_sql("update form_definition set fr_label=$1 where fr_id=$2",[
100 $http->request("value"),
101 $id]);
102 } elseif ($action == 'cancel'){
104 $iName->set_callback("ajax_misc.php");
105 $iName->add_json_param("op", "report_definition");
106 $iName->add_json_param("sa", "change_name");
107 $iName->add_json_param("p_id", $id);
108 $iName->add_json_param("gDossier", Dossier::id());
109 echo $iName->value();
110
111 }
112
113
114}
$action
$input
$ex
Definition: balance.inc.php:45
static build($p_id, $p_form_def_id)
build an object Acc_Report_MTable
static id()
return the 'gDossier' value after a check
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)
if( $delta< 0) elseif( $delta==0)