diff --git a/ChangeLog b/ChangeLog
index 6886a87017f..8a5ff03df02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@ FIX: Not showing task extrafields when creating from left menu
FIX [ bug #3288 ] Tasks box is not properly drawn
FIX [ bug #3211 ] Outstading bill amount of a client showed wrong amounts
FIX [ bug #3321 ] Users with certain permissions were shown a "forbidden access" page even if they had the rights
+FIX [ bug #3426 ] Unable to create an invoice from a contract with extrafields
FIX [ bug #3432 ] Spaces should be removed from IBAN when formatting it
NEW: Created new ContratLigne::insert function
diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php
index 930fee833fa..9a98b389bd0 100644
--- a/htdocs/commande/orderstoinvoice.php
+++ b/htdocs/commande/orderstoinvoice.php
@@ -505,7 +505,7 @@ if ($action == 'create' && !$error)
//Mode liste
-if (($action != 'create' && $action != 'add') || !$error)
+if (($action != 'create' && $action != 'add') && !$error)
{
llxHeader();
?>
diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php
index 5e893fe7d1e..e3f30fc5c0e 100644
--- a/htdocs/compta/facture/impayees.php
+++ b/htdocs/compta/facture/impayees.php
@@ -129,10 +129,12 @@ if ($action == 'presend' && GETPOST('sendmail'))
'__CHECK_READ__' => '
',
//'__LASTNAME__' => $obj2->lastname,
//'__FIRSTNAME__' => $obj2->firstname,
- '__REF__' => $object->ref,
+ '__FACREF__' => $object->ref, // For backward compatibility
+ '__REF__' => $object->ref,
'__REFCLIENT__' => $object->thirdparty->name
);
+ $subject=make_substitutions($subject, $substitutionarray);
$message=make_substitutions($message, $substitutionarray);
$actiontypecode='AC_FAC';
@@ -160,7 +162,7 @@ if ($action == 'presend' && GETPOST('sendmail'))
}
else
{
- //$result=$mailfile->sendfile();
+ $result=$mailfile->sendfile();
if ($result)
{
$resultmasssend.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
@@ -215,7 +217,6 @@ if ($action == 'presend' && GETPOST('sendmail'))
$langs->load("other");
$resultmasssend.='
'.$langs->trans('ErrorCantReadFile',$file).'
';
dol_syslog('Failed to read file: '.$file);
- break ;
}
}
}
@@ -469,8 +470,8 @@ if ($resql)
else $titre.=' ('.$langs->trans("All").')';
$link='';
- if (empty($option)) $link=''.$langs->trans("ShowUnpaidLateOnly").'';
- elseif ($option == 'late') $link=''.$langs->trans("ShowUnpaidAll").'';
+ if (empty($option)) $link=''.$langs->trans("ShowUnpaidLateOnly").'';
+ elseif ($option == 'late') $link=''.$langs->trans("ShowUnpaidAll").'';
print_fiche_titre($titre,$link);
//print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 2359d70d07b..e95ddc60eaa 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -1,7 +1,8 @@
- * Copyright (C) 2004-2013 Laurent Destailleur
- * Copyright (C) 2005-2012 Regis Houssin
+/* Copyright (C) 2001-2005 Rodolphe Quiedeville
+ * Copyright (C) 2004-2013 Laurent Destailleur
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2015 Raphaƫl Doursenaud
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -574,7 +575,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$chargestatic->lib=$obj->libelle;
$chargestatic->paye=$obj->paye;
print ''.$chargestatic->getNomUrl(1).' | ';
- print ''.dol_print_date($obj->date_ech,'day').' | ';
+ print ''.dol_print_date($db->jdate($obj->date_ech),'day').' | ';
print ''.price($obj->amount).' | ';
print ''.price($obj->sumpaid).' | ';
print ''.$chargestatic->getLibStatut(3).' | ';
@@ -915,8 +916,8 @@ if ($resql)
$obj = $db->fetch_object($resql);
$var=!$var;
- print "| ".dol_print_date($obj->da,"day")." | ";
- print "$obj->libelle $obj->label |
";
+ print "| ".dol_print_date($db->jdate($obj->da),"day")." | ";
+ print "".$obj->libelle." ".$obj->label." |
";
$i++;
}
$db->free($resql);
diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php
index f389b380b99..b5aab7090d6 100644
--- a/htdocs/compta/resultat/clientfourn.php
+++ b/htdocs/compta/resultat/clientfourn.php
@@ -304,7 +304,7 @@ if ($modecompta == 'CREANCES-DETTES')
}
else
{
- $sql = "SELECT s.nom, s.rowid as socid, sum(pf.amount) as amount_ttc";
+ $sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
$sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f";
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 "";
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;
diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php
index 3020f12f0c4..c2011c87d4c 100644
--- a/htdocs/core/boxes/box_prospect.php
+++ b/htdocs/core/boxes/box_prospect.php
@@ -136,7 +136,6 @@ class box_prospect extends ModeleBoxes
}
}
else {
- dol_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR);
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 4bbe7b3aa98..f9eeffbb018 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';
@@ -3375,6 +3375,11 @@ abstract class CommonObject
{
if (empty($rowid)) $rowid=$this->id;
+ //To avoid SQL errors. Probably not the better solution though
+ if (!$this->table_element) {
+ return 0;
+ }
+
if (! is_array($optionsArray))
{
// optionsArray not already loaded, so we load it
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'
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 326d9e7d24f..b80b06b6aaa 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1586,55 +1586,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);
}
}
}
diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php
index cd2ea512850..ea93d635322 100644
--- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php
+++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php
@@ -51,7 +51,9 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
global $conf;
try
{
- if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH='/usr/share/php';
+ if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) {
+ $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH=DOL_DOCUMENT_ROOT . '/includes/chromephp/';
+ }
set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH);
//print 'rrrrr'.get_include_path();
@@ -86,9 +88,9 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
array(
'name' => $langs->trans('IncludePath','SYSLOG_CHROMEPHP_INCLUDEPATH'),
'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH',
- 'default' => '/usr/share/php',
+ 'default' => DOL_DOCUMENT_ROOT . '/includes/chromephp/',
'attr' => 'size="60"',
- 'example' => DOL_DOCUMENT_ROOT.'/includes/chromephp'
+ 'example' =>'/usr/share/php'
)
);
}
diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensed.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.ctg.z
new file mode 100755
index 00000000000..df25b6497f0
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensed.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.z
new file mode 100755
index 00000000000..2053dd16f03
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.ctg.z
new file mode 100755
index 00000000000..71cef637e83
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.z
new file mode 100755
index 00000000000..af54a16a09a
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.ctg.z
new file mode 100755
index 00000000000..23445ef2f4b
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.z
new file mode 100755
index 00000000000..37da24ac6a9
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.ctg.z
new file mode 100755
index 00000000000..1b98d135f68
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.z
new file mode 100755
index 00000000000..aa35d093a84
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansextralight.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansextralight.ctg.z
new file mode 100755
index 00000000000..d5fff04b704
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansextralight.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansextralight.z b/htdocs/includes/tcpdf/fonts/dejavusansextralight.z
new file mode 100755
index 00000000000..a966f6de5c4
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansextralight.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmono.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmono.ctg.z
new file mode 100755
index 00000000000..209e2d50b74
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmono.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmono.z b/htdocs/includes/tcpdf/fonts/dejavusansmono.z
new file mode 100755
index 00000000000..126cc9228fe
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmono.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonob.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmonob.ctg.z
new file mode 100755
index 00000000000..76b78bc8f8b
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonob.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonob.z b/htdocs/includes/tcpdf/fonts/dejavusansmonob.z
new file mode 100755
index 00000000000..ef5638e2510
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonob.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonobi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.ctg.z
new file mode 100755
index 00000000000..aa6da414977
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonobi.z b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.z
new file mode 100755
index 00000000000..a866f79821a
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonoi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.ctg.z
new file mode 100755
index 00000000000..0fa53ab2eff
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.ctg.z differ
diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonoi.z b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.z
new file mode 100755
index 00000000000..14be5c14e57
Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.z differ
diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php
index 3cd39d4101f..79c241a9d7e 100644
--- a/htdocs/margin/customerMargins.php
+++ b/htdocs/margin/customerMargins.php
@@ -50,9 +50,9 @@ $pagenext = $page + 1;
$startdate=$enddate='';
if (!empty($_POST['startdatemonth']))
- $startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
+ $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
if (!empty($_POST['enddatemonth']))
- $enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
+ $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
/*
* View
diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php
index b359287d24f..94b24e459f8 100644
--- a/htdocs/margin/productMargins.php
+++ b/htdocs/margin/productMargins.php
@@ -72,9 +72,9 @@ $pagenext = $page + 1;
$startdate=$enddate='';
if (!empty($_POST['startdatemonth']))
- $startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
+ $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
if (!empty($_POST['enddatemonth']))
- $enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
+ $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
/*