dolibarr  7.0.0-beta
extraparams.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.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 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
29 
30 include '../../main.inc.php';
31 
32 $id = GETPOST('id','int');
33 $element = GETPOST('element','alpha');
34 $htmlelement = GETPOST('htmlelement','alpha');
35 $type = GETPOST('type', 'alpha');
36 
37 /*
38  * View
39  */
40 
41 top_httphead();
42 
43 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
44 
45 if(! empty($id) && ! empty($element) && ! empty($htmlelement) && ! empty($type))
46 {
47  $value = GETPOST('value','alpha');
48  $params=array();
49 
50  dol_syslog("AjaxSetExtraParameters id=".$id." element=".$element." htmlelement=".$htmlelement." type=".$type." value=".$value, LOG_DEBUG);
51 
52  $classpath = $subelement = $element;
53 
54  // For compatibility
55  if ($element == 'order' || $element == 'commande') { $classpath = $subelement = 'commande'; }
56  else if ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; }
57  else if ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; }
58  else if ($element == 'contract') { $classpath = $subelement = 'contrat'; }
59  else if ($element == 'shipping') { $classpath = $subelement = 'expedition'; }
60  else if ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; }
61  else if ($element == 'order_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.commande'; }
62  else if ($element == 'invoice_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.facture'; }
63 
64  dol_include_once('/'.$classpath.'/class/'.$subelement.'.class.php');
65 
66  if ($element == 'order_supplier') { $classname = 'CommandeFournisseur'; }
67  else if ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; }
68  else $classname = ucfirst($subelement);
69 
70  $object = new $classname($db);
71  $object->fetch($id);
72 
73  $params[$htmlelement] = array($type => $value);
74  $object->extraparams = array_merge($object->extraparams, $params);
75 
76  $result=$object->setExtraParameters();
77 }
78 
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...
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
print
Draft customers invoices.
Definition: index.php:91
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Return a prefix to use for this Dolibarr instance, for session/cookie names or email id...
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html')
Show HTTP header.
Definition: main.inc.php:1052