diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 46b7a532a35..d945513f952 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -32,6 +32,8 @@
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+
/**
* Manage the different format accountancy export
@@ -742,10 +744,10 @@ class AccountancyExport
print $line->label_operation.$separator;
// FEC:Debit
- print price2num($line->debit).$separator;
+ print price2fec($line->debit).$separator;
// FEC:Credit
- print price2num($line->credit).$separator;
+ print price2fec($line->credit).$separator;
// FEC:EcritureLet
print $line->lettering_code.$separator;
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index e5a525a62c9..af07dc9bfc6 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -1298,7 +1298,6 @@ if ($id)
// Determines the name of the field in relation to the possible names
// in data dictionaries
$showfield = 1; // By defaut
- $align = "left";
$cssprefix = '';
$sortable = 1;
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
@@ -1310,23 +1309,23 @@ if ($id)
if ($fieldlist[$field] == 'taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow = $langs->trans("Rate");
else $valuetoshow = $langs->trans("Amount");
- $align = 'center';
+ $cssprefix = 'center ';
}
- if ($fieldlist[$field] == 'localtax1_type') { $valuetoshow = $langs->trans("UseLocalTax")." 2"; $align = "center"; $sortable = 0; }
- if ($fieldlist[$field] == 'localtax1') { $valuetoshow = $langs->trans("Rate")." 2"; $align = "center"; $sortable = 0; }
- if ($fieldlist[$field] == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; $align = "center"; $sortable = 0; }
- if ($fieldlist[$field] == 'localtax2') { $valuetoshow = $langs->trans("Rate")." 3"; $align = "center"; $sortable = 0; }
+ if ($fieldlist[$field] == 'localtax1_type') { $valuetoshow = $langs->trans("UseLocalTax")." 2"; $cssprefix = "center "; $sortable = 0; }
+ if ($fieldlist[$field] == 'localtax1') { $valuetoshow = $langs->trans("Rate")." 2"; $cssprefix = "center "; $sortable = 0; }
+ if ($fieldlist[$field] == 'localtax2_type') { $valuetoshow = $langs->trans("UseLocalTax")." 3"; $cssprefix = "center "; $sortable = 0; }
+ if ($fieldlist[$field] == 'localtax2') { $valuetoshow = $langs->trans("Rate")." 3"; $cssprefix = "center "; $sortable = 0; }
if ($fieldlist[$field] == 'organization') { $valuetoshow = $langs->trans("Organization"); }
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
- if ($fieldlist[$field] == 'position') { $align = 'right'; }
+ if ($fieldlist[$field] == 'position') { $cssprefix = 'right '; }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Label"); }
if ($fieldlist[$field] == 'libelle_facture') { $valuetoshow = $langs->trans("LabelOnDocuments"); }
if ($fieldlist[$field] == 'country') { $valuetoshow = $langs->trans("Country"); }
- if ($fieldlist[$field] == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $align = "center"; }
+ if ($fieldlist[$field] == 'recuperableonly') { $valuetoshow = $langs->trans("NPR"); $cssprefix = "center "; }
if ($fieldlist[$field] == 'nbjour') { $valuetoshow = $langs->trans("NbOfDays"); }
- if ($fieldlist[$field] == 'type_cdr') { $valuetoshow = $langs->trans("AtEndOfMonth"); $align = "center"; }
+ if ($fieldlist[$field] == 'type_cdr') { $valuetoshow = $langs->trans("AtEndOfMonth"); $cssprefix = "center "; }
if ($fieldlist[$field] == 'decalage') { $valuetoshow = $langs->trans("Offset"); }
if ($fieldlist[$field] == 'width' || $fieldlist[$field] == 'nx') { $valuetoshow = $langs->trans("Width"); }
if ($fieldlist[$field] == 'height' || $fieldlist[$field] == 'ny') { $valuetoshow = $langs->trans("Height"); }
@@ -1368,7 +1367,7 @@ if ($id)
// Show field title
if ($showfield)
{
- print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder, $cssprefix);
+ print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $cssprefix);
}
}
// Favorite - Only activated on country dictionary
@@ -1424,8 +1423,8 @@ if ($id)
foreach ($fieldlist as $field => $value)
{
//var_dump($fieldlist);
+ $class = '';
$showfield = 1;
- $align = "left";
$valuetoshow = $obj->{$fieldlist[$field]};
if ($fieldlist[$field] == 'entity') {
@@ -1457,13 +1456,13 @@ if ($id)
}
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
$valuetoshow = yn($valuetoshow);
- $align = "center";
+ $class = "center";
}
elseif ($fieldlist[$field] == 'type_cdr') {
if (empty($valuetoshow)) $valuetoshow = $langs->trans('None');
elseif ($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth');
elseif ($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext');
- $align = "center";
+ $class = "center";
} elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
$valuetoshow = price($valuetoshow);
}
@@ -1577,20 +1576,20 @@ if ($id)
$valuetoshow = $localtax_typeList[$valuetoshow];
else
$valuetoshow = '';
- $align = "center";
+ $class = "center";
}
elseif ($fieldlist[$field] == 'localtax2_type') {
if ($obj->localtax2 != 0)
$valuetoshow = $localtax_typeList[$valuetoshow];
else
$valuetoshow = '';
- $align = "center";
+ $class = "center";
}
elseif ($fieldlist[$field] == 'taux') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
- $align = "center";
+ $class = "center";
} elseif (in_array($fieldlist[$field], array('recuperableonly'))) {
- $align = "center";
+ $class = "center";
}
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy') {
$valuetoshow = length_accountg($valuetoshow);
@@ -1622,14 +1621,14 @@ if ($id)
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
}
- $class = 'tddict';
+ $class .= ($class ? ' ' : '').'tddict';
if ($fieldlist[$field] == 'note' && $id == 10) $class .= ' tdoverflowmax200';
if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto';
if ($fieldlist[$field] == 'position') $class .= ' right';
if ($fieldlist[$field] == 'localtax1_type') $class .= ' nowrap';
if ($fieldlist[$field] == 'localtax2_type') $class .= ' nowrap';
// Show value for field
- if ($showfield) print '
';
@@ -656,7 +659,6 @@ if ($resql)
if (!empty($arrayfields['a.fk_contact']['checked'])) {
print '| ';
- $actionstatic->fetchResources();
if (!empty($actionstatic->socpeopleassigned))
{
$contactList = array();
diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php
index bb6eb95b32f..883dec19981 100644
--- a/htdocs/core/boxes/box_factures_imp.php
+++ b/htdocs/core/boxes/box_factures_imp.php
@@ -109,7 +109,7 @@ class box_factures_imp extends ModeleBoxes
$sql.= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
- $sql.= " GROUP BY s.nom, s.rowid, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
+ $sql.= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
$sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
$sql.= " ORDER BY datelimite ASC, f.ref ASC ";
diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php
index e80c2a57214..295c358caf0 100644
--- a/htdocs/core/boxes/box_services_expired.php
+++ b/htdocs/core/boxes/box_services_expired.php
@@ -94,6 +94,7 @@ class box_services_expired extends ModeleBoxes
if ($user->socid) $sql .= ' AND c.fk_soc = '.$user->socid;
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
$sql .= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid";
+ $sql.= ", s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
$sql .= " ORDER BY date_line ASC";
$sql .= $this->db->plimit($max, 0);
diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php
index 9eebf9091b2..f80d2f1547a 100644
--- a/htdocs/core/class/smtps.class.php
+++ b/htdocs/core/class/smtps.class.php
@@ -508,7 +508,7 @@ class SMTPs
// The error here just means the ID/password combo doesn't work.
$_retVal = $this->socket_send_str(base64_encode("\0" . $this->_smtpsID . "\0" . $this->_smtpsPW), '235');
break;
- case 'LOGIN':
+ case 'LOGIN': // most common case
default:
$this->socket_send_str('AUTH LOGIN', '334');
// User name will not return any error, server will take anything we give it.
@@ -588,7 +588,11 @@ class SMTPs
// From this point onward most server response codes should be 250
// Specify who the mail is from....
// This has to be the raw email address, strip the "name" off
- $this->socket_send_str('MAIL FROM: ' . $this->getFrom('addr'), '250');
+ $resultmailfrom = $this->socket_send_str('MAIL FROM: ' . $this->getFrom('addr'), '250');
+ if (! $resultmailfrom) {
+ fclose($this->socket);
+ return false;
+ }
// 'RCPT TO:' must be given a single address, so this has to loop
// through the list of addresses, regardless of TO, CC or BCC
@@ -1792,6 +1796,7 @@ class SMTPs
$_retVal = false;
break;
}
+ $this->log .= $server_response;
$limit++;
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 00719db30d5..9172c5e51cf 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -4605,7 +4605,6 @@ function price2num($amount, $rounding = '', $alreadysqlnb = 0)
return $amount;
}
-
/**
* Output a dimension with best unit
*
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 87a1baa4064..4d105e0074e 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -2613,3 +2613,32 @@ function convertBackOfficeMediasLinksToPublicLinks($notetoshow)
$notetoshow = preg_replace('/src="[a-zA-Z0-9_\/\-\.]*(viewimage\.php\?modulepart=medias[^"]*)"/', 'src="'.$urlwithroot.'/\1"', $notetoshow);
return $notetoshow;
}
+
+/**
+ * Function to format a value into a defined format for French administration (no thousand separator & decimal separator force to ',' with two decimals)
+ * Function used into accountancy FEC export
+ *
+ * @param float $amount Amount to format
+ * @return string Chain with formatted upright
+ * @see price2num() Format a numeric into a price for FEC files
+ */
+function price2fec($amount)
+{
+ global $conf;
+
+ // Clean parameters
+ if (empty($amount)) $amount=0; // To have a numeric value if amount not defined or = ''
+ $amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number)
+
+ // Output decimal number by default
+ $nbdecimal = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH) ? 2 : $conf->global->ACCOUNTING_FEC_DECIMAL_LENGTH);
+
+ // Output separators by default
+ $dec = (empty($conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR) ? ',' : $conf->global->ACCOUNTING_FEC_DECIMAL_SEPARATOR);
+ $thousand = (empty($conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR) ? '' : $conf->global->ACCOUNTING_FEC_THOUSAND_SEPARATOR);
+
+ // Format number
+ $output = number_format($amount, $nbdecimal, $dec, $thousand);
+
+ return $output;
+}
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 0749d0a7645..6de51cfe7ba 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -10,6 +10,7 @@
* Copyright (C) 2014 Cedric GROSS
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* Copyright (C) 2015-2016 Marcos GarcĂa
+ * Copyright (C) 2019 Lenin Rivas
*
* 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
@@ -2153,6 +2154,17 @@ function pdf_getLinkedObjects($object, $outputlangs)
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat, 'day', '', $outputlangs);
}
}
+ else if ($objecttype == 'fichinter')
+ {
+ $outputlangs->load('interventions');
+ foreach($objects as $elementobject)
+ {
+ $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("InterRef");
+ $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref);
+ $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("InterDate");
+ $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->datec, 'day', '', $outputlangs);
+ }
+ }
elseif ($objecttype == 'shipping')
{
$outputlangs->loadLangs(array("orders", "sendings"));
diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php
index 9951c05d323..b8b0d0d2301 100644
--- a/htdocs/product/stock/class/api_stockmovements.class.php
+++ b/htdocs/product/stock/class/api_stockmovements.class.php
@@ -186,11 +186,19 @@ class StockMovements extends DolibarrApi
}
// Type increase or decrease
- if ($qty >= 0) $type = 3;
- else $type = 2;
+ $type = 2;
+ if ($qty >= 0){
+ $type = 3;
+ }
- if($this->stockmovement->_create(DolibarrApiAccess::$user, $product_id, $warehouse_id, $qty, $type, $price, $movementlabel, $movementcode, '', $dlc, $dluo, $lot) <= 0) {
- throw new RestException(503, 'Error when create stock movement : '.$this->stockmovement->error);
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+ $eatBy = empty($dluo) ? '' : dol_stringtotime($dluo);
+ $sellBy = empty($dlc) ? '' : dol_stringtotime($dlc);
+
+ if($this->stockmovement->_create(DolibarrApiAccess::$user, $product_id, $warehouse_id, $qty, $type, $price, $movementlabel, $movementcode, '', $eatBy, $sellBy, $lot) <= 0) {
+ $errormessage = $this->stockmovement->error;
+ if (empty($errormessage)) $errormessage = join(',', $this->stockmovement->errors);
+ throw new RestException(503, 'Error when create stock movement : '.$errormessage);
}
return $this->stockmovement->id;
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index bc4dd12e9d4..9364dd21fca 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -173,7 +173,7 @@ class MouvementStock extends CommonObject
{
if (empty($batch))
{
- $this->errors[] = $langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData", $product->ref);
+ $this->errors[] = $langs->transnoentitiesnoconv("ErrorTryToMakeMoveOnProductRequiringBatchData", $product->ref);
dol_syslog("Try to make a movement of a product with status_batch on without any batch data");
$this->db->rollback();
@@ -208,7 +208,8 @@ class MouvementStock extends CommonObject
if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility
{
// If found and eatby/sellby defined into table and provided and differs, return error
- $this->errors[] = $langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby), 'dayhour'), dol_print_date($eatby, 'dayhour'));
+ $langs->load("stocks");
+ $this->errors[] = $langs->transnoentitiesnoconv("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby), 'dayhour'), dol_print_date($eatbywithouthour, 'dayhour'));
dol_syslog("ThisSerialAlreadyExistWithDifferentDate batch=".$batch.", eatby found into product_lot = ".$obj->eatby." = ".dol_print_date($this->db->jdate($obj->eatby), 'dayhourrfc')." so eatbywithouthour = ".$eatbywithouthour." = ".dol_print_date($eatbywithouthour)." - eatby provided = ".$eatby." = ".dol_print_date($eatby, 'dayhourrfc'), LOG_ERR);
$this->db->rollback();
return -3;
@@ -245,7 +246,7 @@ class MouvementStock extends CommonObject
if ($this->db->jdate($obj->sellby) != $sellby && $this->db->jdate($obj->sellby) != $sellbywithouthour) // We test date without hours and with hours for backward compatibility
{
// If found and eatby/sellby defined into table and provided and differs, return error
- $this->errors[] = $langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby));
+ $this->errors[] = $langs->transnoentitiesnoconv("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby));
dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR);
$this->db->rollback();
return -3;
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index ea5a9a39eda..ec4ac4182d6 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -920,7 +920,7 @@ class Societe extends CommonObject
}
}
- // Check for unicity
+ // Check for unicity on profid
if (!$error && $vallabel && $this->id_prof_verifiable($i))
{
if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0)))
|