noalyss Version-9
ajax_save_predf_op.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@aevalys.eu
21
22/*!\file
23 * \brief save the new predefined operation
24 * included from ajax_misc
25 */
26
27if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
29
30
31
32try {
33 $table=$http->request('table');
34 $action=$http->request('action');
35 $p_id=$http->request('p_id', "number");
36 $ctl_id=$http->request('ctl');
37
38} catch(Exception $e) {
39 echo $e->getMessage();
40 return;
41}
42if ( $g_user->check_module("PREDOP") == 0) die();
43
45$prd_op->set_pk_value($p_id);
46$prd_op->load();
47
49
50
51$operation_predef_mtable->add_json_param("op","save_predf");
52$operation_predef_mtable->set_object_name($ctl_id);
53$operation_predef_mtable->set_callback("ajax_misc.php");
54
55if ($action=="input")
56{
57 if ($p_id < 0 ) {
58
59 $operation_predef_mtable->set_force_ledger_type($p_id);
60 }
61 // display existing operation for updating
62 header('Content-type: text/xml; charset=UTF-8');
63 echo $operation_predef_mtable->ajax_input()->saveXML();
64 return;
65}
66elseif ($action == "save")
67{
68 $xml=$operation_predef_mtable->ajax_save();
69 header('Content-type: text/xml; charset=UTF-8');
70 echo $xml->saveXML();
71}
72elseif ($action == "delete")
73{
74 $xml=$operation_predef_mtable->ajax_delete();
75 header('Content-type: text/xml; charset=UTF-8');
76 echo $xml->saveXML();
77}
global $g_user
if no group available , then stop
switch($op2) $xml
Definition: ajax_card.php:806
$operation_predef_mtable
manage the http input (get , post, request) and extract from an array
ORM abstract of the table public.op_predef.
Display a table and allow to change the predefined operation, insert or delete. Used the class Manage...
if( $delta< 0) elseif( $delta==0)
$table
Definition: menu.inc.php:103