From 2527ae263be5e3da3f3e0e19572f9b29d66eb106 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 27 Aug 2015 14:28:12 +0200 Subject: [PATCH 1/7] fix : Fatal error: Uncaught exception 'Exception' with message 'Incorrect log level' --- htdocs/core/class/commonobject.class.php | 6 ++--- htdocs/core/lib/pdf.lib.php | 33 +++++++++++------------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4bbe7b3aa98..fc740b5215a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1837,7 +1837,7 @@ abstract class CommonObject * @return void * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') + function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR') { global $conf; @@ -1865,11 +1865,11 @@ abstract class CommonObject $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element); - if (empty($sourceid) && empty($targetid)) + /*if (empty($sourceid) && empty($targetid)) { dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR); return -1; - } + }*/ // Links beetween objects are stored in this table $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 794ba7ac2af..0350bce7a4b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1585,55 +1585,52 @@ function pdf_getLinkedObjects($object,$outputlangs) if ($objecttype == 'propal') { $outputlangs->load('propal'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'commande') { $outputlangs->load('orders'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : ''); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'contrat') { $outputlangs->load('contracts'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs); } } else if ($objecttype == 'shipping') { $outputlangs->load('orders'); $outputlangs->load('sendings'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { - $objects[$i]->fetchObjectLinked(); - $order = $objects[$i]->linkedObjects['commande'][0]; + $elementobject->fetchObjectLinked(); + $order = $elementobject->linkedObjects['commande'][0]; $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs); } } } From db7defb7c30e982807211df2a4983e9c3440d14e Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 27 Aug 2015 14:43:48 +0200 Subject: [PATCH 2/7] Revert "fix : Fatal error: Uncaught exception 'Exception' with message 'Incorrect log level'" This reverts commit 2527ae263be5e3da3f3e0e19572f9b29d66eb106. --- htdocs/core/class/commonobject.class.php | 6 ++--- htdocs/core/lib/pdf.lib.php | 33 +++++++++++++----------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fc740b5215a..4bbe7b3aa98 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1837,7 +1837,7 @@ abstract class CommonObject * @return void * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR') + function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') { global $conf; @@ -1865,11 +1865,11 @@ abstract class CommonObject $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element); - /*if (empty($sourceid) && empty($targetid)) + if (empty($sourceid) && empty($targetid)) { dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR); return -1; - }*/ + } // Links beetween objects are stored in this table $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 0350bce7a4b..794ba7ac2af 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1585,52 +1585,55 @@ function pdf_getLinkedObjects($object,$outputlangs) if ($objecttype == 'propal') { $outputlangs->load('propal'); - - foreach($objects as $elementobject) + $num=count($objects); + for ($i=0;$i<$num;$i++) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); } } else if ($objecttype == 'commande') { $outputlangs->load('orders'); - foreach($objects as $elementobject) + $num=count($objects); + for ($i=0;$i<$num;$i++) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : ''); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); } } else if ($objecttype == 'contrat') { $outputlangs->load('contracts'); - foreach($objects as $elementobject) + $num=count($objects); + for ($i=0;$i<$num;$i++) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs); } } else if ($objecttype == 'shipping') { $outputlangs->load('orders'); $outputlangs->load('sendings'); - foreach($objects as $elementobject) + $num=count($objects); + for ($i=0;$i<$num;$i++) { - $elementobject->fetchObjectLinked(); - $order = $elementobject->linkedObjects['commande'][0]; + $objects[$i]->fetchObjectLinked(); + $order = $objects[$i]->linkedObjects['commande'][0]; $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); + $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); } } } From e9f631d2e3a78f3c3277a4415c3f2c4082537914 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 27 Aug 2015 14:49:12 +0200 Subject: [PATCH 3/7] fix : Fatal error: Uncaught exception 'Exception' with message 'Incorrect log level' --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4bbe7b3aa98..ce71b953208 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1837,7 +1837,7 @@ abstract class CommonObject * @return void * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') + function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR') { global $conf; From aff134ab65f862a9ca6c1cd3dbe3c9b1e2a5ef80 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 27 Aug 2015 16:10:02 +0200 Subject: [PATCH 4/7] Fix #3289 Salaries module shows amounts with currency symbol unlike the rest of Dolibarr --- htdocs/compta/salaries/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 678b3bfaa2e..008a0ef3e2c 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -168,7 +168,7 @@ if ($result) // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; // Amount - print "".price($obj->amount,0,$outputlangs,1,-1,-1,$conf->currency).""; + print "".price($obj->amount).""; print " "; print "\n"; @@ -177,7 +177,7 @@ if ($result) $i++; } print ''.$langs->trans("Total").''; - print ''.price($total,0,$outputlangs,1,-1,-1,$conf->currency).""; + print ''.price($total).""; print " "; print ""; From 6952084be30cef84b22f668bcec0541f240e882f Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 27 Aug 2015 17:23:23 +0200 Subject: [PATCH 5/7] it's a mess --- htdocs/core/class/commonobject.class.php | 4 +-- htdocs/core/lib/pdf.lib.php | 33 +++++++++++------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ce71b953208..fc740b5215a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1865,11 +1865,11 @@ abstract class CommonObject $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element); - if (empty($sourceid) && empty($targetid)) + /*if (empty($sourceid) && empty($targetid)) { dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR); return -1; - } + }*/ // Links beetween objects are stored in this table $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 794ba7ac2af..0350bce7a4b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1585,55 +1585,52 @@ function pdf_getLinkedObjects($object,$outputlangs) if ($objecttype == 'propal') { $outputlangs->load('propal'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'commande') { $outputlangs->load('orders'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : ''); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'contrat') { $outputlangs->load('contracts'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs); } } else if ($objecttype == 'shipping') { $outputlangs->load('orders'); $outputlangs->load('sendings'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { - $objects[$i]->fetchObjectLinked(); - $order = $objects[$i]->linkedObjects['commande'][0]; + $elementobject->fetchObjectLinked(); + $order = $elementobject->linkedObjects['commande'][0]; $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs); } } } From 17b69e16d2fe6bbe487c03c13ea94f054b34cbb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Aug 2015 13:45:23 +0200 Subject: [PATCH 6/7] Fix remove a bad log reporting error when not --- htdocs/contact/class/contact.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ba12d039e10..3e1e3fd1720 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -499,9 +499,10 @@ class Contact extends CommonObject */ function fetch($id, $user=0, $ref_ext='') { - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); global $langs; + dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG); + $langs->load("companies"); $sql = "SELECT c.rowid, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,"; @@ -524,7 +525,6 @@ class Contact extends CommonObject if ($id) $sql.= " WHERE c.rowid = ". $id; elseif ($ref_ext) $sql .= " WHERE c.ref_ext = '".$this->db->escape($ref_ext)."'"; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -565,7 +565,7 @@ class Contact extends CommonObject $this->email = $obj->email; $this->jabberid = $obj->jabberid; - $this->skype = $obj->skype; + $this->skype = $obj->skype; $this->priv = $obj->priv; $this->mail = $obj->email; From c8f12dc5f2dcfff71f799a114e893ac061e4bd3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Aug 2015 15:06:42 +0200 Subject: [PATCH 7/7] Fix PUT method for already formated strings --- htdocs/core/lib/geturl.lib.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 8f6847bcb9a..3b62556f482 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -24,12 +24,12 @@ /** * Function get content from an URL (use proxy if proxy defined) * - * @param string $url URL to call. - * @param string $postorget 'POST', 'GET', 'HEAD' - * @param string $param Parameters of URL (x=value1&y=value2) - * @param string $followlocation 1=Follow location, 0=Do not follow - * @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) - * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) + * @param string $url URL to call. + * @param string $postorget 'POST', 'GET', 'HEAD', 'PUTALREADYFORMATED' + * @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED + * @param string $followlocation 1=Follow location, 0=Do not follow + * @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) + * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) */ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array()) { @@ -74,10 +74,19 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea else if ($postorget == 'PUT') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' - if ( ! is_array($param) ) - parse_str($param, $array_param); + if (! is_array($param)) parse_str($param, $array_param); + else + { + dol_syslog("parameter param must be a string", LOG_WARNING); + $array_param=$param; + } curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields } + else if ($postorget == 'PUTALREADYFORMATED') + { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' + curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string + } else if ($postorget == 'HEAD') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD'