From 887a40cf1dc795aa57aece8345d7b6c10946a7a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2018 16:45:03 +0200 Subject: [PATCH] Remove TODO --- htdocs/admin/system/index.php | 2 +- htdocs/core/class/html.form.class.php | 5 +-- htdocs/core/class/html.formfile.class.php | 8 ++-- htdocs/core/class/html.formother.class.php | 8 ++-- htdocs/core/get_info.php | 2 +- htdocs/core/lib/agenda.lib.php | 8 ++-- htdocs/core/lib/ajax.lib.php | 2 +- htdocs/core/lib/functions.lib.php | 6 +-- htdocs/core/tpl/objectline_view.tpl.php | 4 +- htdocs/main.inc.php | 48 +--------------------- htdocs/societe/paymentmodes.php | 2 +- htdocs/user/class/user.class.php | 2 +- 12 files changed, 25 insertions(+), 72 deletions(-) diff --git a/htdocs/admin/system/index.php b/htdocs/admin/system/index.php index 7ffef73999315..cf79ae910b3c7 100644 --- a/htdocs/admin/system/index.php +++ b/htdocs/admin/system/index.php @@ -105,7 +105,7 @@ print ''; print "\n"; print "\n"; -print "\n"; +print "\n"; print '
".$langs->trans("Browser")."
".$langs->trans("UserAgent")."" .$_SERVER["HTTP_USER_AGENT"]."
".$langs->trans("Smartphone")."".(empty($conf->browser->phone)?$langs->trans("No"):$conf->browser->phone)."
".$langs->trans("Smartphone")."".(($conf->browser->layout != 'phone')?$langs->trans("No"):$langs->trans("Yes"))."
'; print '
'; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a21c7ac310f04..550ecea486765 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -51,12 +51,12 @@ class Form * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; - + var $num; // Cache arrays @@ -4957,7 +4957,6 @@ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_nam if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) { $usecalendar = ((empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR == 'eldy')?'jquery':$conf->global->MAIN_POPUP_CALENDAR); } - //if (! empty($conf->browser->phone)) $usecalendar='combo'; if ($d) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 003235f57c903..3758fe950bbd6 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -40,7 +40,7 @@ class FormFile * @var string Error code (or message) */ public $error; - + public $numoffiles; public $infofiles; // Used to return informations by function getDocumentsLink @@ -678,7 +678,7 @@ function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed $formadmin=new FormAdmin($this->db); $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); $morecss='maxwidth150'; - if (! empty($conf->browser->phone)) $morecss='maxwidth100'; + if ($conf->browser->layout == 'phone') $morecss='maxwidth100'; $out.= $formadmin->select_language($defaultlang, 'lang_id', 0, 0, 0, 0, 0, $morecss); } else @@ -1318,7 +1318,7 @@ function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownlo if (empty($disablemove)) { - if ($nboffiles > 1 && empty($conf->browser->phone)) { + if ($nboffiles > 1 && $conf->browser->layout != 'phone') { print ''; if ($i > 0) { print 'id.'">'.img_up('default',0,'imgupforline').''; @@ -1329,7 +1329,7 @@ function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownlo print ''; } else { - print 'browser->phone) && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"').'>'; + print 'browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"').'>'; print ''; } } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 9a4bdc46b75df..ed371cc1e2339 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -38,7 +38,7 @@ class FormOther { private $db; - + /** * @var string Error code (or message) */ @@ -1029,7 +1029,7 @@ static function getBoxesArea($user,$areacode) if (! empty($boxidactivatedforuser[$box->id])) continue; // Already visible for user $label=$langs->transnoentitiesnoconv($box->boxlabel); //if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')'; - if (preg_match('/graph/',$box->class) && empty($conf->browser->phone)) + if (preg_match('/graph/',$box->class) && $conf->browser->layout != 'phone') { $label=$label.' '; } @@ -1163,7 +1163,7 @@ function updateBoxOrder(closing) { } } - if (empty($conf->browser->phone)) + if ($conf->browser->layout != 'phone') { $emptybox->box_id='A'; $emptybox->info_box_head=array(); @@ -1190,7 +1190,7 @@ function updateBoxOrder(closing) { } } - if (empty($conf->browser->phone)) + if ($conf->browser->layout != 'phone') { $emptybox->box_id='B'; $emptybox->info_box_head=array(); diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php index 2f08a1d7d2469..4e52c58408320 100644 --- a/htdocs/core/get_info.php +++ b/htdocs/core/get_info.php @@ -134,7 +134,7 @@ // Link to print main content area /* -if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone)) +if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone') { $qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]); diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 9f8d1988c075d..324ddc76cd765 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -68,7 +68,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
'; - if (! empty($conf->browser->phone)) print '
'; + if ($conf->browser->layout == 'phone') print '
'; else print ''; - if (! empty($conf->browser->phone)) print '
'; + if ($conf->browser->layout == 'phone') print '
'; else print '
'; print ''; @@ -180,10 +180,10 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
'; - if (! empty($conf->browser->phone)) print ''; + if ($conf->browser->layout == 'phone') print ''; else print '
'; print ''; print '
'; @@ -193,7 +193,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print '
'; - if (! empty($conf->browser->phone)) print ''; + if ($conf->browser->layout == 'phone') print ''; else print '
'; print '
'; // Close fichecenter diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 8fec9a5c160ec..8a39043a680b7 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -377,7 +377,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ // select2 disabled for smartphones with standard browser. // TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array) - if (! empty($conf->browser->phone)) return ''; + if ($conf->browser->layout == 'phone') return ''; if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; if (empty($conf->use_javascript_ajax)) return ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ee72252281cd3..95157ffea8db9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1353,7 +1353,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $width=80; $cssclass='photoref'; $showimage=$object->is_photo_available($conf->product->multidir_output[$entity]); $maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5); - if ($conf->browser->phone) $maxvisiblephotos=1; + if ($conf->browser->layout == 'phone') $maxvisiblephotos=1; if ($showimage) $morehtmlleft.='
'.$object->show_photos('product', $conf->product->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'
'; else { @@ -1372,7 +1372,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $width=80; $cssclass='photoref'; $showimage=$object->is_photo_available($conf->ticket->multidir_output[$entity].'/'.$object->track_id); $maxvisiblephotos=(isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO)?$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO:2); - if ($conf->browser->phone) $maxvisiblephotos=1; + if ($conf->browser->layout == 'phone') $maxvisiblephotos=1; if ($showimage) $morehtmlleft.='
'.$object->show_photos('ticket', $conf->ticket->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'
'; else { @@ -2549,7 +2549,7 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep } if (! empty($addlink)) // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set) { - if (! empty($conf->browser->phone) || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone + if ($conf->browser->layout == 'phone' || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone { $newphone =''; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index dbedf2be1ce64..e7166c14b28eb 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -292,7 +292,7 @@ 1 && empty($conf->browser->phone) && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> + if ($num > 1 && $conf->browser->layout != 'phone' && ($this->situation_counter == 1 || !$this->situation_cycle_ref) && empty($disablemove)) { ?> 0) { ?> id; ?>"> @@ -306,7 +306,7 @@ - browser->phone) && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"'); ?>> + browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"'); ?>> diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 26dcb94a0ba11..4a385fdc6cb20 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -256,8 +256,6 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $conf->browser->os=$tmp['browseros']; $conf->browser->version=$tmp['browserversion']; $conf->browser->layout=$tmp['layout']; // 'classic', 'phone', 'tablet' - $conf->browser->phone=$tmp['phone']; // TODO deprecated, use ->layout - $conf->browser->tablet=$tmp['tablet']; // TODO deprecated, use ->layout //var_dump($conf->browser); if ($conf->browser->layout == 'phone') $conf->dol_no_mouse_hover=1; @@ -486,17 +484,6 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadValueForCode"); $test=false; - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg='ErrorBadValueForCode - login='.GETPOST("username","alpha",2); - // Call of triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); - if ($result < 0) { - $error++; - } - // End Call of triggers - // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -565,17 +552,6 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) // We set a generic message if not defined inside function checkLoginPassEntity or subfunctions if (empty($_SESSION["dol_loginmesg"])) $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg=$langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username","alpha",2); - // Call of triggers - include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST("username","alpha",2)); - if ($result < 0) { - $error++; - } - // End Call of triggers - // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -612,27 +588,12 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login); - - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg='ErrorCantLoadUserFromDolibarrDatabase - login='.$login; } if ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"]=$user->error; - - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg=$user->error; } - // Call triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf); - if ($result < 0) { - $error++; - } - // End call triggers - // Hooks on failed login $action=''; $hookmanager->initHooks(array('login')); @@ -671,16 +632,10 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $langs->loadLangs(array('main', 'errors')); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorCantLoadUserFromDolibarrDatabase",$login); - - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg='ErrorCantLoadUserFromDolibarrDatabase - login='.$login; } if ($resultFetchUser < 0) { $_SESSION["dol_loginmesg"]=$user->error; - - // TODO @deprecated Remove this. Hook must be used, not this trigger. - $user->trigger_mesg=$user->error; } // TODO @deprecated Remove this. Hook must be used, not this trigger. @@ -900,7 +855,6 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $conf->theme='eldy'; $conf->css = "/theme/".$conf->theme."/style.css.php"; } -//var_dump($conf->browser->phone); if (! defined('NOREQUIRETRAN')) { @@ -1574,7 +1528,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a } // Link to print main content area - if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone)) + if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone') { $qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index d099cfcc10358..f8fcacb2bb3f5 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1184,7 +1184,7 @@ $formadmin=new FormAdmin($db); $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); $morecss='maxwidth150'; - if (! empty($conf->browser->phone)) $morecss='maxwidth100'; + if ($conf->browser->layout == 'phone') $morecss='maxwidth100'; $out.= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss); } // Button diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7cac041977201..adde437575cd4 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2232,7 +2232,7 @@ function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $max $label.= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; $label.= '
'.$langs->trans("Layout").': '.$conf->browser->layout; $label.= '
'.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; - if (! empty($conf->browser->phone)) $label.= '
'.$langs->trans("Phone").': '.$conf->browser->phone; + if ($conf->browser->layout == 'phone') $label.= '
'.$langs->trans("Phone").': '.$langs->trans("Yes");; if (! empty($_SESSION["disablemodules"])) $label.= '
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); } if ($infologin < 0) $label='';