diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index b887696fb13..393629ae505 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -207,31 +207,31 @@ if ($action == 'validatehistory') {
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result);
- $thirdpartystatic->id = $objp->socid;
- $thirdpartystatic->name = $objp->name;
- $thirdpartystatic->client = $objp->client;
- $thirdpartystatic->fournisseur = $objp->fournisseur;
- $thirdpartystatic->code_client = $objp->code_client;
- $thirdpartystatic->code_compta_client = $objp->code_compta_client;
- $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
- $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
- $thirdpartystatic->email = $objp->email;
- $thirdpartystatic->country_code = $objp->country_code;
- $thirdpartystatic->tva_intra = $objp->tva_intra;
- $thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
+ $thirdpartystatic->id = !empty($objp->socid) ? $objp->socid : 0;
+ $thirdpartystatic->name = !empty($objp->name) ? $objp->name : "";
+ $thirdpartystatic->client = !empty($objp->client) ? $objp->client : "";
+ $thirdpartystatic->fournisseur = !empty($objp->fournisseur) ? $objp->fournisseur : "";
+ $thirdpartystatic->code_client = !empty($objp->code_client) ? $objp->code_client : "";
+ $thirdpartystatic->code_compta_client = !empty($objp->code_compta_client) ? $objp->code_compta_client : "";
+ $thirdpartystatic->code_fournisseur = !empty($objp->code_fournisseur) ? $objp->code_fournisseur : "";
+ $thirdpartystatic->code_compta_fournisseur = !empty($objp->code_compta_fournisseur) ? $objp->code_compta_fournisseur : "";
+ $thirdpartystatic->email = !empty($objp->email) ? $objp->email : "";
+ $thirdpartystatic->country_code = !empty($objp->country_code) ? $objp->country_code : "";
+ $thirdpartystatic->tva_intra = !empty($objp->tva_intra) ? $objp->tva_intra : "";
+ $thirdpartystatic->code_compta_product = !empty($objp->company_code_sell) ? $objp->company_code_sell : ""; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
$product_static->label = $objp->product_label;
- $product_static->status = $objp->status;
- $product_static->status_buy = $objp->status_buy;
+ $product_static->status = !empty($objp->status) ? $objp->status : 0;
+ $product_static->status_buy = !empty($objp->status_buy) ? $objp->status_buy : 0;
$product_static->accountancy_code_sell = $objp->code_sell;
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
$product_static->accountancy_code_sell_export = $objp->code_sell_export;
- $product_static->accountancy_code_buy = $objp->code_buy;
- $product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
- $product_static->accountancy_code_buy_export = $objp->code_buy_export;
+ $product_static->accountancy_code_buy = !empty($objp->code_buy) ? $objp->code_buy : "";
+ $product_static->accountancy_code_buy_intra = !empty($objp->code_buy_intra) ? $objp->code_buy_intra : "";
+ $product_static->accountancy_code_buy_export = !empty($objp->code_buy_export) ? $objp->code_buy_export : "";
$product_static->tva_tx = $objp->tva_tx_prod;
$facture_static->ref = $objp->ref;
diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php
index 78ba0e2335e..dfc8564b34c 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_card.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_card.php
@@ -96,7 +96,7 @@ if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
-if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) {
+if (!$user->hasRight("cashdesk", "run") && !$user->hasRight("takepos", "run")) {
accessforbidden();
}
@@ -105,10 +105,10 @@ if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) {
* Actions
*/
-$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run);
-$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run) || ($permissiontoadd && $object->status == 0);
+$permissiontoadd = ($user->hasRight("cashdesk", "run") || $user->hasRight("takepos", "run"));
+$permissiontodelete = ($user->hasRight("cashdesk", "run") || $user->hasRight("takepos", "run")) || ($permissiontoadd && $object->status == 0);
if (empty($backtopage)) {
- $backtopage = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.($id > 0 ? $id : '__ID__');
+ $backtopage = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.(!empty($id) && $id > 0 ? $id : '__ID__');
}
$backurlforlist = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_list.php';
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record
diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php
index a617c99e7af..c3d625c01e4 100644
--- a/htdocs/compta/cashcontrol/report.php
+++ b/htdocs/compta/cashcontrol/report.php
@@ -360,21 +360,21 @@ if ($resql) {
print '
';
print '
';
- print $langs->trans("Cash").($transactionspertype['CASH'] ? ' ('.$transactionspertype['CASH'].')' : '').' :
'.price($cash).'
';
+ print $langs->trans("Cash").(!empty($transactionspertype['CASH']) ? ' ('.$transactionspertype['CASH'].')' : '').' : '.price($cash).'
';
if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) {
print ' <> '.$langs->trans("Declared").': '.price($object->cash).'
';
}
print "
";
//print '
';
- print $langs->trans("PaymentTypeCHQ").($transactionspertype['CHQ'] ? ' ('.$transactionspertype['CHQ'].')' : '').' : '.price($cheque).'
';
+ print $langs->trans("PaymentTypeCHQ").(!empty($transactionspertype['CHQ']) ? ' ('.$transactionspertype['CHQ'].')' : '').' : '.price($cheque).'
';
if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) {
print ' <> '.$langs->trans("Declared").' : '.price($object->cheque).'
';
}
print "
";
//print '
';
- print $langs->trans("PaymentTypeCB").($transactionspertype['CB'] ? ' ('.$transactionspertype['CB'].')' : '').' : '.price($bank).'
';
+ print $langs->trans("PaymentTypeCB").(!empty($transactionspertype['CB']) ? ' ('.$transactionspertype['CB'].')' : '').' : '.price($bank).'
';
if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) {
print ' <> '.$langs->trans("Declared").': '.price($object->card).'
';
}
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index b83c30d15b6..dced78b6c3c 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -44,6 +44,7 @@ if (empty($objectclass) || empty($uploaddir)) {
if (empty($massaction)) {
$massaction = '';
}
+$error = 0;
// For backward compatibility
if (!empty($permtoread) && empty($permissiontoread)) {
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index fb3af09a72b..5b0aebac0f0 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4978,7 +4978,7 @@ abstract class CommonObject
// Line in view mode
if ($action != 'editline' || $selected != $line->id) {
// Product
- if ($line->fk_product > 0) {
+ if (!empty($line->fk_product) && $line->fk_product > 0) {
$product_static = new Product($this->db);
$product_static->fetch($line->fk_product);
@@ -8410,6 +8410,8 @@ abstract class CommonObject
$element = 'facture';
} elseif ($element == 'invoice_supplier_rec') {
return $user->rights->fournisseur->facture;
+ } elseif ($element == 'evaluation') {
+ return $user->rights->hrm->evaluation;
}
return $user->rights->{$element};
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 4a11fb1b0d5..3d929307e2f 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -9304,7 +9304,7 @@ class Form
} elseif ($object->element == 'ecm_directories') {
$ret .= '';
} elseif ($fieldref != 'none') {
- $ret .= dol_htmlentities($object->$fieldref);
+ $ret .= dol_htmlentities(!empty($object->$fieldref) ? $object->$fieldref : "");
}
if ($morehtmlref) {
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 5274d196dc1..cfd3e69a577 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1575,7 +1575,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= ", ".MAIN_DB_PREFIX."contrat as o";
- } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (is_array($filterobj->fields['ref']) || is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
+ } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref']) || $filterobj->fields['label'] && is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
$sql .= ", ".MAIN_DB_PREFIX.$filterobj->table_element." as o";
}
@@ -1617,7 +1617,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
- } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (is_array($filterobj->fields['ref']) || is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
+ } elseif (is_object($filterobj) && is_array($filterobj->fields) && is_array($filterobj->fields['rowid']) && (!empty($filterobj->fields['ref']) && is_array($filterobj->fields['ref']) || $filterobj->fields['label'] && is_array($filterobj->fields['label'])) && $filterobj->table_element && $filterobj->element) {
// Generic case
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element).($module ? "@".$module : "")."'";
if ($filterobj->id) {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index eb22b2b5153..d36d17c5125 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2297,11 +2297,13 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$tmptxt = $object->getLibStatut(5);
$morehtmlstatus .= $tmptxt; // No status on task
} else { // Generic case
- $tmptxt = $object->getLibStatut(6);
- if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
- $tmptxt = $object->getLibStatut(5);
+ if (isset($object->status)) {
+ $tmptxt = $object->getLibStatut(6);
+ if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
+ $tmptxt = $object->getLibStatut(5);
+ }
+ $morehtmlstatus .= $tmptxt;
}
- $morehtmlstatus .= $tmptxt;
}
// Add if object was dispatched "into accountancy"
diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php
index 83c2504be3d..d859ae0ca56 100644
--- a/htdocs/core/modules/dons/html_cerfafr.modules.php
+++ b/htdocs/core/modules/dons/html_cerfafr.modules.php
@@ -126,7 +126,7 @@ class html_cerfafr extends ModeleDon
} else {
$paymentmode = '';
}
- $modepaymentcode = $formclass->cache_types_paiements[$don->modepaymentid]['code'];
+ $modepaymentcode = !empty($formclass->cache_types_paiements[$don->modepaymentid]['code']) ? $formclass->cache_types_paiements[$don->modepaymentid]['code'] : "";
if ($modepaymentcode == 'CHQ') {
$ModePaiement = ' Remise d\'espèces | Chèque | Virement, prélèvement, carte bancaire | ';
} elseif ($modepaymentcode == 'LIQ') {
diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php
index e8476d0449d..f9bbde51912 100644
--- a/htdocs/hrm/class/evaluationdet.class.php
+++ b/htdocs/hrm/class/evaluationdet.class.php
@@ -383,10 +383,10 @@ class Evaluationline extends CommonObject
foreach ($filter as $key => $value) {
if ($key == 't.rowid') {
$sqlwhere[] = $key.'='.$value;
- } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
- $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
} elseif ($key == 'customsql') {
$sqlwhere[] = $value;
+ } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
+ $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
} elseif (strpos($value, '%') === false) {
$sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')';
} else {
diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php
index 4f6d43baa59..4dface42230 100644
--- a/htdocs/hrm/class/skilldet.class.php
+++ b/htdocs/hrm/class/skilldet.class.php
@@ -376,10 +376,10 @@ class Skilldet extends CommonObject
foreach ($filter as $key => $value) {
if ($key == 't.rowid') {
$sqlwhere[] = $key.'='.$value;
- } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
- $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
} elseif ($key == 'customsql') {
$sqlwhere[] = $value;
+ } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
+ $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
} elseif (strpos($value, '%') === false) {
$sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")";
} else {
diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php
index 732b91d756f..cc314bd9bce 100644
--- a/htdocs/hrm/evaluation_agenda.php
+++ b/htdocs/hrm/evaluation_agenda.php
@@ -85,7 +85,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
- $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
+ $upload_dir = $conf->hrm->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
// Permissions
@@ -210,7 +210,7 @@ if ($object->id > 0) {
print ' ';
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
- $param = '&id='.$object->id.'&socid='.$socid;
+ $param = '&id='.$object->id.'&socid='.(!empty($socid) ? '&socid='.$socid : '');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php
index 08854e2d88e..b46ea5f5fc7 100644
--- a/htdocs/hrm/evaluation_card.php
+++ b/htdocs/hrm/evaluation_card.php
@@ -51,7 +51,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'evaluationcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
-//$lineid = GETPOST('lineid', 'int');
+$lineid = GETPOST('lineid', 'int');
// Initialize technical objects
$object = new Evaluation($db);
diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php
index ff0921cc59e..3f0d41e946a 100644
--- a/htdocs/hrm/evaluation_note.php
+++ b/htdocs/hrm/evaluation_note.php
@@ -56,7 +56,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
- $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
+ $upload_dir = $conf->hrm->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
// Permissions
diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php
index 3d371c878e3..1da6b4948b1 100644
--- a/htdocs/hrm/job_agenda.php
+++ b/htdocs/hrm/job_agenda.php
@@ -84,7 +84,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
- $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
+ $upload_dir = $conf->hrm->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
// Permissions
@@ -198,7 +198,7 @@ if ($object->id > 0) {
}
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
- $param = '&id='.$object->id.'&socid='.$socid;
+ $param = '&id='.$object->id.'&socid='.(!empty($socid) ? '&socid='.$socid : '');
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
diff --git a/htdocs/hrm/job_card.php b/htdocs/hrm/job_card.php
index d8be48bce69..ba4198497b0 100644
--- a/htdocs/hrm/job_card.php
+++ b/htdocs/hrm/job_card.php
@@ -47,7 +47,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
-//$lineid = GETPOST('lineid', 'int');
+$lineid = GETPOST('lineid', 'int');
// Initialize technical objects
$object = new Job($db);
diff --git a/htdocs/hrm/job_note.php b/htdocs/hrm/job_note.php
index 9e64e27d6ae..f90ccfc18e0 100644
--- a/htdocs/hrm/job_note.php
+++ b/htdocs/hrm/job_note.php
@@ -55,7 +55,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
- $upload_dir = $conf->hrm->multidir_output[$object->entity]."/".$object->id;
+ $upload_dir = $conf->hrm->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
// Permissions
diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php
index 7a1114ac4a0..4d6b130d1e0 100644
--- a/htdocs/hrm/position.php
+++ b/htdocs/hrm/position.php
@@ -901,6 +901,8 @@ function DisplayPositionList()
// Part to create
if ($action == 'create') {
$object = new Position($db);
+ // Fetch optionals attributes and labels
+ $extrafields->fetch_name_optionals_label($object->table_element);
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Position")), '', 'object_' . $object->picto);
print '