diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index 47e9d8161fd..5771ead70f1 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -347,7 +347,7 @@ class FactureRec extends CommonInvoice
{
// Extrafields
if (method_exists($facsrc->lines[$i], 'fetch_optionals')) {
- $facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->id);
+ $facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid);
$objectline->array_options = $facsrc->lines[$i]->array_options;
}
@@ -360,8 +360,8 @@ class FactureRec extends CommonInvoice
}
}
- if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) {
- // To use new linkedObjectsIds instead of old linked_objects
+ if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
+ {
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
}
@@ -381,8 +381,8 @@ class FactureRec extends CommonInvoice
$error++;
}
}
- } else {
- // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
+ } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
+ {
$origin_id = $tmp_origin_id;
$ret = $this->add_object_linked($origin, $origin_id);
if (!$ret)
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 4dd96ac88aa..797a2a58ddb 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1553,7 +1553,6 @@ class Facture extends CommonInvoice
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
- $this->ref_int = $obj->ref_int;
$this->type = $obj->type;
$this->date = $this->db->jdate($obj->df);
$this->date_pointoftax = $this->db->jdate($obj->date_pointoftax);
diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index fce09733349..a4c27855a30 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
-if (!empty($conf->projet->enabled))
-{
+if (!empty($conf->projet->enabled)) {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
@@ -124,8 +123,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
{
$object->fetch($id);
$result = $object->delete($user);
- if ($result > 0)
- {
+ if ($result > 0) {
header("Location: list.php");
exit;
} else {
@@ -137,7 +135,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
// Add social contribution
if ($action == 'add' && $user->rights->tax->charges->creer)
{
- $amount = price2num(GETPOST('amount'));
+ $amount = price2num(GETPOST('amount'), 'MT');
if (!$dateech)
{
@@ -155,23 +153,21 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
- } elseif (!is_numeric($amount))
- {
+ } elseif (!is_numeric($amount)) {
setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
} else {
$object->type = $actioncode;
$object->label = GETPOST('label', 'alpha');
$object->date_ech = $dateech;
- $object->periode = $dateperiod;
- $object->amount = $amount;
- $object->mode_reglement_id = GETPOST('mode_reglement_id');
- $object->fk_account = GETPOST('fk_account', 'int');
- $object->fk_project = GETPOST('fk_project');
+ $object->periode = $dateperiod;
+ $object->amount = $amount;
+ $object->mode_reglement_id = (int) GETPOST('mode_reglement_id', 'int');
+ $object->fk_account = (int) GETPOST('fk_account', 'int');
+ $object->fk_project = (int) GETPOST('fk_project', 'int');
$id = $object->create($user);
- if ($id <= 0)
- {
+ if ($id <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
@@ -181,7 +177,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->creer)
{
- $amount = price2num(GETPOST('amount'));
+ $amount = price2num(GETPOST('amount'), 'MT');
if (!$dateech)
{
@@ -203,12 +199,11 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre
$result = $object->fetch($id);
$object->date_ech = $dateech;
- $object->periode = $dateperiod;
- $object->amount = price2num($amount);
+ $object->periode = $dateperiod;
+ $object->amount = $amount;
$result = $object->update($user);
- if ($result <= 0)
- {
+ if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 19d9c039736..43588ba0d0e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -659,11 +659,11 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
break;
case 'alpha': // No html and no " and no ../
case 'alphanohtml': // Recommended for most scalar parameters and search parameters
- if (!is_array($out))
- {
+ if (!is_array($out)) {
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals
$out = str_replace(array('"', '"', '../'), '', trim($out));
+ // keep lines feed
$out = dol_string_nohtmltag($out, 0);
}
break;
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index a908556230d..8f7501e3fce 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -765,8 +765,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1);
$newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1);
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
- $newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"),1);
- $newmenu->add("/admin/system/security.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoSecurity"),1);
+ $newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"), 1);
+ $newmenu->add("/admin/system/security.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoSecurity"), 1);
}
$newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"), 1);
$newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"), 1);
diff --git a/htdocs/document.php b/htdocs/document.php
index 79ed9024a50..c48a0363f78 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -243,6 +243,23 @@ if (!file_exists($fullpath_original_file_osencoded))
exit;
}
+// Hooks
+if (!is_object($hookmanager)) {
+ include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
+ $hookmanager = new HookManager($this->db);
+}
+$hookmanager->initHooks(array('document'));
+$parameters = array('ecmfile' => $ecmfile, 'modulepart' => $modulepart, 'original_file' => $original_file,
+ 'entity' => $entity, 'refname' => $refname, 'fullpath_original_file' => $fullpath_original_file,
+ 'filename' => $filename, 'fullpath_original_file_osencoded' => $fullpath_original_file_osencoded);
+$reshook = $hookmanager->executeHooks('downloadDocument', $parameters); // Note that $action and $object may have been
+if ($reshook < 0) {
+ $errors = $hookmanager->error . (is_array($hookmanager->errors) ? (!empty($hookmanager->error) ? ', ' : '') . join($separator, $hookmanager->errors) : '');
+ dol_syslog("document.php - Errors when executing the hook 'downloadDocument' : " . $errors);
+ print "ErrorDownloadDocumentHooks: " . $errors;
+ exit;
+}
+
// Permissions are ok and file found, so we return it
top_httphead($type);
header('Content-Description: File Transfer');
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index c540d124f6b..611cf72593a 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -1594,7 +1594,10 @@ class ExpenseReport extends CommonObject
if ($short) return $url;
- $label = img_picto('', $this->picto).' '.$langs->trans("ExpenseReport").'';
+ $label = img_picto('', $this->picto).' '.$langs->trans("ExpenseReport").'';
+ if (isset($this->status)) {
+ $label .= ' '.$this->getLibStatut(5);
+ }
if (!empty($this->ref))
$label .= '
'.$langs->trans('Ref').': '.$this->ref;
if (!empty($this->total_ht))
@@ -1603,9 +1606,6 @@ class ExpenseReport extends CommonObject
$label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (!empty($this->total_ttc))
$label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
- if (isset($this->status)) {
- $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5);
- }
if ($moretitle) $label .= ' - '.$moretitle;
//if ($option != 'nolink')
diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php
index fa0974dedd9..046bde4efa1 100644
--- a/htdocs/expensereport/index.php
+++ b/htdocs/expensereport/index.php
@@ -165,8 +165,8 @@ $max = 10;
$langs->load("boxes");
-$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, u.email, u.admin";
-$sql .= ", d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as fk_status";
+$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut as user_status, u.photo, u.email, u.admin,";
+$sql .= " d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE u.rowid = d.fk_user_author";
@@ -210,16 +210,20 @@ if ($result)
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($result);
+
$expensereportstatic->id = $obj->rowid;
$expensereportstatic->ref = $obj->ref;
+ $expensereportstatic->status = $obj->status;
+
$userstatic->id = $obj->uid;
$userstatic->admin = $obj->admin;
$userstatic->email = $obj->email;
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->login = $obj->login;
- $userstatic->statut = $obj->statut;
+ $userstatic->statut = $obj->user_status;
$userstatic->photo = $obj->photo;
+
print '