fix : php8.1 warnings

This commit is contained in:
hystepik 2022-11-25 15:34:38 +01:00
parent 511a3eda95
commit efc1697c62
20 changed files with 56 additions and 47 deletions

View File

@ -207,31 +207,31 @@ if ($action == 'validatehistory') {
while ($i < min($num_lines, 10000)) { // No more than 10000 at once while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$thirdpartystatic->id = $objp->socid; $thirdpartystatic->id = !empty($objp->socid) ? $objp->socid : 0;
$thirdpartystatic->name = $objp->name; $thirdpartystatic->name = !empty($objp->name) ? $objp->name : "";
$thirdpartystatic->client = $objp->client; $thirdpartystatic->client = !empty($objp->client) ? $objp->client : "";
$thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->fournisseur = !empty($objp->fournisseur) ? $objp->fournisseur : "";
$thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_client = !empty($objp->code_client) ? $objp->code_client : "";
$thirdpartystatic->code_compta_client = $objp->code_compta_client; $thirdpartystatic->code_compta_client = !empty($objp->code_compta_client) ? $objp->code_compta_client : "";
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur; $thirdpartystatic->code_fournisseur = !empty($objp->code_fournisseur) ? $objp->code_fournisseur : "";
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdpartystatic->code_compta_fournisseur = !empty($objp->code_compta_fournisseur) ? $objp->code_compta_fournisseur : "";
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = !empty($objp->email) ? $objp->email : "";
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = !empty($objp->country_code) ? $objp->country_code : "";
$thirdpartystatic->tva_intra = $objp->tva_intra; $thirdpartystatic->tva_intra = !empty($objp->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->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->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
$product_static->type = $objp->type; $product_static->type = $objp->type;
$product_static->label = $objp->product_label; $product_static->label = $objp->product_label;
$product_static->status = $objp->status; $product_static->status = !empty($objp->status) ? $objp->status : 0;
$product_static->status_buy = $objp->status_buy; $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 = $objp->code_sell;
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra; $product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
$product_static->accountancy_code_sell_export = $objp->code_sell_export; $product_static->accountancy_code_sell_export = $objp->code_sell_export;
$product_static->accountancy_code_buy = $objp->code_buy; $product_static->accountancy_code_buy = !empty($objp->code_buy) ? $objp->code_buy : "";
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra; $product_static->accountancy_code_buy_intra = !empty($objp->code_buy_intra) ? $objp->code_buy_intra : "";
$product_static->accountancy_code_buy_export = $objp->code_buy_export; $product_static->accountancy_code_buy_export = !empty($objp->code_buy_export) ? $objp->code_buy_export : "";
$product_static->tva_tx = $objp->tva_tx_prod; $product_static->tva_tx = $objp->tva_tx_prod;
$facture_static->ref = $objp->ref; $facture_static->ref = $objp->ref;

View File

@ -96,7 +96,7 @@ if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid; //$socid = $user->socid;
accessforbidden(); accessforbidden();
} }
if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) { if (!$user->hasRight("cashdesk", "run") && !$user->hasRight("takepos", "run")) {
accessforbidden(); accessforbidden();
} }
@ -105,10 +105,10 @@ if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) {
* Actions * Actions
*/ */
$permissiontoadd = ($user->rights->cashdesk->run || $user->rights->takepos->run); $permissiontoadd = ($user->hasRight("cashdesk", "run") || $user->hasRight("takepos", "run"));
$permissiontodelete = ($user->rights->cashdesk->run || $user->rights->takepos->run) || ($permissiontoadd && $object->status == 0); $permissiontodelete = ($user->hasRight("cashdesk", "run") || $user->hasRight("takepos", "run")) || ($permissiontoadd && $object->status == 0);
if (empty($backtopage)) { 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'; $backurlforlist = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_list.php';
$triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record $triggermodname = 'CACHCONTROL_MODIFY'; // Name of trigger action code to execute when we modify record

View File

@ -360,21 +360,21 @@ if ($resql) {
print '<div style="text-align: right">'; print '<div style="text-align: right">';
print '<h2>'; print '<h2>';
print $langs->trans("Cash").($transactionspertype['CASH'] ? ' ('.$transactionspertype['CASH'].')' : '').' : <div class="inline-block amount width100">'.price($cash).'</div>'; print $langs->trans("Cash").(!empty($transactionspertype['CASH']) ? ' ('.$transactionspertype['CASH'].')' : '').' : <div class="inline-block amount width100">'.price($cash).'</div>';
if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) { if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) {
print ' <> <div class="inline-block amountremaintopay fontsizeunset">'.$langs->trans("Declared").': '.price($object->cash).'</div>'; print ' <> <div class="inline-block amountremaintopay fontsizeunset">'.$langs->trans("Declared").': '.price($object->cash).'</div>';
} }
print "<br>"; print "<br>";
//print '<br>'; //print '<br>';
print $langs->trans("PaymentTypeCHQ").($transactionspertype['CHQ'] ? ' ('.$transactionspertype['CHQ'].')' : '').' : <div class="inline-block amount width100">'.price($cheque).'</div>'; print $langs->trans("PaymentTypeCHQ").(!empty($transactionspertype['CHQ']) ? ' ('.$transactionspertype['CHQ'].')' : '').' : <div class="inline-block amount width100">'.price($cheque).'</div>';
if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) { if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) {
print ' <> <div class="inline-block amountremaintopay fontsizeunset">'.$langs->trans("Declared").' : '.price($object->cheque).'</div>'; print ' <> <div class="inline-block amountremaintopay fontsizeunset">'.$langs->trans("Declared").' : '.price($object->cheque).'</div>';
} }
print "<br>"; print "<br>";
//print '<br>'; //print '<br>';
print $langs->trans("PaymentTypeCB").($transactionspertype['CB'] ? ' ('.$transactionspertype['CB'].')' : '').' : <div class="inline-block amount width100">'.price($bank).'</div>'; print $langs->trans("PaymentTypeCB").(!empty($transactionspertype['CB']) ? ' ('.$transactionspertype['CB'].')' : '').' : <div class="inline-block amount width100">'.price($bank).'</div>';
if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) { if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) {
print ' <> <div class="inline-block amountremaintopay fontsizeunset">'.$langs->trans("Declared").': '.price($object->card).'</div>'; print ' <> <div class="inline-block amountremaintopay fontsizeunset">'.$langs->trans("Declared").': '.price($object->card).'</div>';
} }

View File

@ -44,6 +44,7 @@ if (empty($objectclass) || empty($uploaddir)) {
if (empty($massaction)) { if (empty($massaction)) {
$massaction = ''; $massaction = '';
} }
$error = 0;
// For backward compatibility // For backward compatibility
if (!empty($permtoread) && empty($permissiontoread)) { if (!empty($permtoread) && empty($permissiontoread)) {

View File

@ -9304,7 +9304,7 @@ class Form
} elseif ($object->element == 'ecm_directories') { } elseif ($object->element == 'ecm_directories') {
$ret .= ''; $ret .= '';
} elseif ($fieldref != 'none') { } elseif ($fieldref != 'none') {
$ret .= dol_htmlentities($object->$fieldref); $ret .= dol_htmlentities(!empty($object->$fieldref) ? $object->$fieldref : "");
} }
if ($morehtmlref) { if ($morehtmlref) {

View File

@ -1575,7 +1575,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= ", ".MAIN_DB_PREFIX."bom_bom as o"; $sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= ", ".MAIN_DB_PREFIX."contrat as o"; $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"; $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) { if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $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 // Generic case
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element).($module ? "@".$module : "")."'"; $sql .= " AND a.fk_element = o.rowid AND a.elementtype = '".$db->escape($filterobj->element).($module ? "@".$module : "")."'";
if ($filterobj->id) { if ($filterobj->id) {

View File

@ -2297,12 +2297,14 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$tmptxt = $object->getLibStatut(5); $tmptxt = $object->getLibStatut(5);
$morehtmlstatus .= $tmptxt; // No status on task $morehtmlstatus .= $tmptxt; // No status on task
} else { // Generic case } else { // Generic case
if (isset($object->status)) {
$tmptxt = $object->getLibStatut(6); $tmptxt = $object->getLibStatut(6);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) {
$tmptxt = $object->getLibStatut(5); $tmptxt = $object->getLibStatut(5);
} }
$morehtmlstatus .= $tmptxt; $morehtmlstatus .= $tmptxt;
} }
}
// Add if object was dispatched "into accountancy" // Add if object was dispatched "into accountancy"
if (isModEnabled('accounting') && in_array($object->element, array('bank', 'paiementcharge', 'facture', 'invoice', 'invoice_supplier', 'expensereport', 'payment_various'))) { if (isModEnabled('accounting') && in_array($object->element, array('bank', 'paiementcharge', 'facture', 'invoice', 'invoice_supplier', 'expensereport', 'payment_various'))) {

View File

@ -126,7 +126,7 @@ class html_cerfafr extends ModeleDon
} else { } else {
$paymentmode = ''; $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') { if ($modepaymentcode == 'CHQ') {
$ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>'; $ModePaiement = '<td width="25%"><input type="checkbox"> Remise d\'espèces</td><td width="25%"><input type="checkbox" disabled="true" checked="checked"> Chèque</td><td width="50%"><input type="checkbox"> Virement, prélèvement, carte bancaire</td>';
} elseif ($modepaymentcode == 'LIQ') { } elseif ($modepaymentcode == 'LIQ') {

View File

@ -376,10 +376,10 @@ class Skilldet extends CommonObject
foreach ($filter as $key => $value) { foreach ($filter as $key => $value) {
if ($key == 't.rowid') { if ($key == 't.rowid') {
$sqlwhere[] = $key.'='.$value; $sqlwhere[] = $key.'='.$value;
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
} elseif ($key == 'customsql') { } elseif ($key == 'customsql') {
$sqlwhere[] = $value; $sqlwhere[] = $value;
} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
} elseif (strpos($value, '%') === false) { } elseif (strpos($value, '%') === false) {
$sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")"; $sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")";
} else { } else {

View File

@ -84,7 +84,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object // 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 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)) { 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 // Permissions
@ -198,7 +198,7 @@ if ($object->id > 0) {
} }
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { 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"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }

View File

@ -47,7 +47,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobcard'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
//$lineid = GETPOST('lineid', 'int'); $lineid = GETPOST('lineid', 'int');
// Initialize technical objects // Initialize technical objects
$object = new Job($db); $object = new Job($db);

View File

@ -55,7 +55,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object // 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 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)) { 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 // Permissions

View File

@ -901,6 +901,8 @@ function DisplayPositionList()
// Part to create // Part to create
if ($action == 'create') { if ($action == 'create') {
$object = new Position($db); $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 load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Position")), '', 'object_' . $object->picto);
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';

View File

@ -86,7 +86,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object // 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 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)) { 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 // Permissions
@ -210,7 +210,7 @@ if ($object->id > 0) {
print '</div>'; print '</div>';
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { 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"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }

View File

@ -199,6 +199,9 @@ function displayPositionCard(&$object)
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$title = $langs->trans("Position"); $title = $langs->trans("Position");
$help_url = ''; $help_url = '';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);

View File

@ -52,6 +52,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'positionlist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'positionlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'aZ');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');

View File

@ -56,7 +56,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object // 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 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)) { 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 // Permissions

View File

@ -85,7 +85,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object // 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 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)) { 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 // Permissions
@ -204,7 +204,7 @@ if ($object->id > 0) {
print '</div>'; print '</div>';
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { 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"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }

View File

@ -53,7 +53,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object // 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 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)) { 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 // Permissions

View File

@ -268,7 +268,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
} }
} }
print showValueWithClipboardCPButton($object->login).$addadmin; print showValueWithClipboardCPButton(!empty($object->login) ? $object->login : '').$addadmin;
print '</td>'; print '</td>';
} }
print '</tr>'."\n"; print '</tr>'."\n";
@ -281,14 +281,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Ref employee // Ref employee
print '<tr><td class="titlefield">'.$langs->trans("RefEmployee").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("RefEmployee").'</td>';
print '<td class="error">'; print '<td class="error">';
print showValueWithClipboardCPButton($object->ref_employee); print showValueWithClipboardCPButton(!empty($object->ref_employee) ? $object->ref_employee : '');
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// National Registration Number // National Registration Number
print '<tr><td class="titlefield">'.$langs->trans("NationalRegistrationNumber").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("NationalRegistrationNumber").'</td>';
print '<td class="error">'; print '<td class="error">';
print showValueWithClipboardCPButton($object->national_registration_number); print showValueWithClipboardCPButton(!empty($object->national_registration_number) ? $object->national_registration_number : '');
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";