Compatibility phpv8

This commit is contained in:
Givriz 2021-09-02 18:48:46 +02:00
parent baaf1519d6
commit 1c99bd7c4a
10 changed files with 36 additions and 35 deletions

View File

@ -695,7 +695,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Address
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) {
$object->address = $objsoc->address; // Predefined with third party
}
print '<tr><td><label for="address">'.$langs->trans("Address").'</label></td>';
@ -714,10 +714,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</tr>';
// Zip / Town
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) {
$object->zip = $objsoc->zip; // Predefined with third party
}
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) {
$object->town = $objsoc->town; // Predefined with third party
}
print '<tr><td><label for="zipcode">'.$langs->trans("Zip").'</label> / <label for="town">'.$langs->trans("Town").'</label></td><td colspan="'.$colspan.'" class="maxwidthonsmartphone">';
@ -751,10 +751,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>';
}
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) {
$object->phone_pro = $objsoc->phone; // Predefined with third party
}
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) {
$object->fax = $objsoc->fax; // Predefined with third party
}
@ -784,7 +784,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<input type="text" name="fax" id="fax" class="maxwidth200" value="'.(GETPOSTISSET('fax') ? GETPOST('fax', 'alpha') : $object->fax).'"></td>';
print '</tr>';
if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) {
if (((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) {
$object->email = $objsoc->email; // Predefined with third party
}
@ -888,7 +888,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td>';
print '<td><label for="birthday_alert">'.$langs->trans("Alert").'</label>: ';
if ($object->birthday_alert) {
if (!empty($object->birthday_alert)) {
print '<input type="checkbox" name="birthday_alert" id="birthday_alert" checked>';
} else {
print '<input type="checkbox" name="birthday_alert" id="birthday_alert">';

View File

@ -371,7 +371,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";

View File

@ -1236,7 +1236,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Description (used in invoice, propal...)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
$doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
$doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
$doleditor->Create();
print "</td></tr>";
@ -1395,13 +1395,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '90%');
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_8, '90%');
$doleditor->Create();
print "</td></tr>";
//}
if ($conf->categorie->enabled) {
if (!empty($conf->categorie->enabled)) {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);

View File

@ -37,7 +37,7 @@ $type = GETPOST("type", 'int');
if ($type == '' && !$user->rights->produit->lire) {
$type = '1'; // Force global page on service page only
}
if ($type == '' && !$user->rights->service->lire) {
if ($type == '' && empty($user->rights->service->lire)) {
$type = '0'; // Force global page on product page only
}

View File

@ -950,7 +950,7 @@ if ($resql) {
}
// Multiprice
if ($conf->global->PRODUIT_MULTIPRICES) {
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
foreach ($arraypricelevel as $key => $value) {
if (!empty($arrayfields['p.sellprice'.$key]['checked'])) {
print '<td class="liste_titre right">';
@ -1156,7 +1156,7 @@ if ($resql) {
}
// Multiprices
if ($conf->global->PRODUIT_MULTIPRICES) {
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
foreach ($arraypricelevel as $key => $value) {
if (!empty($arrayfields['p.sellprice'.$key]['checked'])) {
print_liste_field_titre($arrayfields['p.sellprice'.$key]['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');

View File

@ -51,6 +51,7 @@ $confirm = GETPOST('confirm');
$projectid = GETPOST('projectid', 'int');
$id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
$ref = GETPOST('ref', 'alpha');
$sortfield = GETPOST("sortfield", 'alpha');
@ -288,7 +289,7 @@ if ($action == 'create') {
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$socid.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$socid.(!empty($fac_rec) ? '&fac_rec='.$fac_rec : '')).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print '</td></tr>';
}
@ -296,7 +297,7 @@ if ($action == 'create') {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('desc', (!empty($object->description) ? $object->description : ''), '', 180, 'dolibarr_notes', 'In', false, true, $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor = new DolEditor('desc', (!empty($object->description) ? $object->description : ''), '', 180, 'dolibarr_notes', 'In', false, true, empty($conf->fckeditor->enabled) ? '' : $conf->fckeditor->enabled, ROWS_5, '90%');
$doleditor->Create();
print '</td></tr>';
@ -347,7 +348,7 @@ if ($action == 'create') {
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
if ($conf->categorie->enabled) {
if (!empty($conf->categorie->enabled)) {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1);

View File

@ -451,9 +451,9 @@ $formfile = new FormFile($db);
$formproject = new FormProjets($db);
$userstatic = new User($db);
$title = $langs->trans("Project").' - '.$object->ref.($object->thirdparty->name ? ' - '.$object->thirdparty->name : '').($object->title ? ' - '.$object->title : '');
$title = $langs->trans("Project").' - '.$object->ref.(!empty($object->thirdparty->name) ? ' - '.$object->thirdparty->name : '').(!empty($object->title) ? ' - '.$object->title : '');
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE)) {
$title = $object->ref.($object->thirdparty->name ? ' - '.$object->thirdparty->name : '').($object->title ? ' - '.$object->title : '');
$title = $object->ref.(!empty($object->thirdparty->name) ? ' - '.$object->thirdparty->name : '').(!empty($object->title) ? ' - '.$object->title : '');
}
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos|DE:Modul_Projekte";
@ -665,11 +665,11 @@ if ($action == 'create' && $user->rights->projet->creer) {
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td>';
$doleditor = new DolEditor('description', GETPOST("description", 'restricthtml'), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%');
$doleditor = new DolEditor('description', GETPOST("description", 'restricthtml'), '', 90, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';
if ($conf->categorie->enabled) {
if (!empty($conf->categorie->enabled)) {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1);

View File

@ -553,7 +553,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
$num = $nbtotalofrecords;
} else {
if ($limit) {
if (!empty($limit)) {
$sql .= $db->plimit($limit + 1, $offset);
}

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
if ($conf->categorie->enabled) {
if (!empty($conf->categorie->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
@ -718,7 +718,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
// Project
print '<tr><td class="fieldrequired">'.$langs->trans("ChildOfProjectTask").'</td><td>';
print img_picto('', 'project');
$formother->selectProjectTasks(GETPOST('task_parent'), $projectid ? $projectid : $object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500');
$formother->selectProjectTasks(GETPOST('task_parent'), !empty($projectid) ? $projectid : $object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500');
print '</td></tr>';
// Assigned to
@ -733,17 +733,17 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
// Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print $form->selectDate(($date_start ? $date_start : ''), 'dateo', 1, 1, 0, '', 1, 1);
print $form->selectDate((!empty($date_start) ? $date_start : ''), 'dateo', 1, 1, 0, '', 1, 1);
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print $form->selectDate(($date_end ? $date_end : -1), 'datee', -1, 1, 0, '', 1, 1);
print $form->selectDate((!empty($date_end) ? $date_end : -1), 'datee', -1, 1, 0, '', 1, 1);
print '</td></tr>';
// Planned workload
print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
print $form->select_duration('planned_workload', $planned_workload ? $planned_workload : 0, 0, 'text');
print $form->select_duration('planned_workload', !empty($planned_workload) ? $planned_workload : 0, 0, 'text');
print '</td></tr>';
// Progress

View File

@ -1396,7 +1396,7 @@ while ($i < min($num, $limit)) {
print '<td class="tdoverflowmax50">';
print $obj->rowid;
print "</td>\n";
if (!$i) {
if (empty($i)) {
$totalarray['nbfield']++;
}
}
@ -1413,7 +1413,7 @@ while ($i < min($num, $limit)) {
}
print "</td>\n";
$companystatic->name_alias = $savalias;
if (!$i) {
if (empty($i)) {
$totalarray['nbfield']++;
}
}
@ -1508,12 +1508,12 @@ while ($i < min($num, $limit)) {
// Type ent
if (!empty($arrayfields['typent.code']['checked'])) {
print '<td class="center">';
if (!is_array($typenArray) || count($typenArray) == 0) {
if (!isset($typenArray) || !is_array($typenArray) || count($typenArray) == 0) {
$typenArray = $formcompany->typent_array(1);
}
print $typenArray[$obj->typent_code];
print empty($typenArray[$obj->typent_code]) ? '' : $typenArray[$obj->typent_code];
print '</td>';
if (!$i) {
if (empty($i)) {
$totalarray['nbfield']++;
}
}
@ -1532,19 +1532,19 @@ while ($i < min($num, $limit)) {
}
print $staffArray[$obj->staff_code];
print '</td>';
if (!$i) {
if (empty($i)) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['s.email']['checked'])) {
print '<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 0, 0, 1)."</td>\n";
if (!$i) {
if (empty($i)) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['s.phone']['checked'])) {
print '<td class="nowraponall">'.dol_print_phone($obj->phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n";
if (!$i) {
if (empty($i)) {
$totalarray['nbfield']++;
}
}