dolibarr  9.0.0
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 <http://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') { $classpath = $subelement = 'commande'; }
55  else if ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; }
56  else if ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; }
57  else if ($element == 'contract') { $classpath = $subelement = 'contrat'; }
58  else if ($element == 'shipping') { $classpath = $subelement = 'expedition'; }
59  else if ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; }
60  else if ($element == 'order_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.commande'; }
61  else if ($element == 'invoice_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.facture'; }
62 
63  dol_include_once('/'.$classpath.'/class/'.$subelement.'.class.php');
64 
65  if ($element == 'order_supplier') { $classname = 'CommandeFournisseur'; }
66  else if ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; }
67  else $classname = ucfirst($subelement);
68 
69  $object = new $classname($db);
70  $object->fetch($id);
71 
72  $params[$htmlelement] = array($type => $value);
73  $object->extraparams = array_merge($object->extraparams, $params);
74 
75  $result=$object->setExtraParameters();
76 }
77 
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
if(! defined('NOREQUIREMENU')) if(! function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1107
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
if(! function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.