dolibarr  13.0.2
extraparams.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
23 if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24 if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
25 if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
26 if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
27 if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
28 
29 include '../../main.inc.php';
30 
31 $id = GETPOST('id', 'int');
32 $element = GETPOST('element', 'alpha');
33 $htmlelement = GETPOST('htmlelement', 'alpha');
34 $type = GETPOST('type', 'alpha');
35 
36 /*
37  * View
38  */
39 
40 top_httphead();
41 
42 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
43 
44 if (!empty($id) && !empty($element) && !empty($htmlelement) && !empty($type))
45 {
46  $value = GETPOST('value', 'alpha');
47  $params = array();
48 
49  dol_syslog("AjaxSetExtraParameters id=".$id." element=".$element." htmlelement=".$htmlelement." type=".$type." value=".$value, LOG_DEBUG);
50 
51  $classpath = $subelement = $element;
52 
53  // For compatibility
54  if ($element == 'order' || $element == 'commande') {
55  $classpath = $subelement = 'commande';
56  } elseif ($element == 'propal') {
57  $classpath = 'comm/propal';
58  $subelement = 'propal';
59  } elseif ($element == 'facture') {
60  $classpath = 'compta/facture';
61  $subelement = 'facture';
62  } elseif ($element == 'contract') {
63  $classpath = $subelement = 'contrat';
64  } elseif ($element == 'shipping') {
65  $classpath = $subelement = 'expedition';
66  } elseif ($element == 'deplacement') {
67  $classpath = 'compta/deplacement';
68  $subelement = 'deplacement';
69  } elseif ($element == 'order_supplier') {
70  $classpath = 'fourn';
71  $subelement = 'fournisseur.commande';
72  } elseif ($element == 'invoice_supplier') {
73  $classpath = 'fourn';
74  $subelement = 'fournisseur.facture';
75  }
76 
77  dol_include_once('/'.$classpath.'/class/'.$subelement.'.class.php');
78 
79  if ($element == 'order_supplier') {
80  $classname = 'CommandeFournisseur';
81  } elseif ($element == 'invoice_supplier') {
82  $classname = 'FactureFournisseur';
83  } else {
84  $classname = ucfirst($subelement);
85  }
86 
87  $object = new $classname($db);
88  $object->fetch($id);
89 
90  $params[$htmlelement] = array($type => $value);
91  $object->extraparams = array_merge($object->extraparams, $params);
92 
93  $result = $object->setExtraParameters();
94 }
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype= 'text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1214
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
Definition: index.php:89
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...