noalyss Version-9
ajax_anc_key_compute.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 2014 Author Dany De Bontridder danydb@aevalys.eu
21
22
23/**
24 * @file
25 * @brief Compute the amount. This file compute the amount and distribute it
26 * following the given distribution key given in parameter.
27 * Parameters are :
28 - gDossier
29 - t the element HTML to use as target
30 - amount the amount to distribute
31 - key the Distribution key to use
32*/
33if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
34
36
37try
38{
39 $key=$http->get('key',"number");
40 $amount=$http->get('amount',"number");
41 $target=$http->get('t');
42}
43catch (Exception $exc)
44{
45 echo $exc->getMessage();
46 error_log($exc->getTraceAsString());
47 return;
48}
49ob_start();
51$pos=strrpos($target,"t");
52$row=substr($target,$pos+1);
53
54$compute_key->fill_table($target,$amount);
55echo <<<EOF
56<script>
57anc_refresh_remain('$target','$row');
58</script>
59EOF;
60////
61$response = ob_get_clean();
63header('Content-type: text/xml; charset=UTF-8');
64echo <<<EOF
65<?xml version="1.0" encoding="UTF-8"?>
66<data>
67<ctl></ctl>
68<code>$html</code>
69</data>
70EOF;
if(headers_sent() &&DEBUGNOALYSS > 0) $html
Class to manage distribution keys for Analytic accountancy.
manage the http input (get , post, request) and extract from an array
escape_xml($p_xml)
When data are transfered thanks ajax in a xml document, the xml can not contains some character,...