diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 1b69e035fba..a593e10adf4 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -18,7 +18,7 @@ */ // Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) { +if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit; } @@ -36,14 +36,14 @@ $langs->load("orders"); $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1); -$total=0; -$ilink=0; -foreach($linkedObjectBlock as $key => $objectlink) +$total = 0; +$ilink = 0; +foreach ($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass='oddeven'; - if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; + $trclass = 'oddeven'; + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total'; echo ''; echo ''.$langs->trans("CustomerOrder"); if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { @@ -62,14 +62,14 @@ foreach($linkedObjectBlock as $key => $objectlink) echo ''.$objectlink->getLibStatut(3).''; echo ''; // For now, shipments must stay linked to order, so link is not deletable - if($object->element != 'shipping') { + if ($object->element != 'shipping') { echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; } echo ''; echo "\n"; } if (count($linkedObjectBlock) > 1) { - echo ''; + echo ''; echo ''.$langs->trans("Total").''; echo ''; echo ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0d39cda6513..f0854eabde2 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1216,7 +1216,7 @@ if (empty($reshook)) // Si facture standard $object->socid = GETPOST('socid', 'int'); $object->type = GETPOST('type'); - $object->ref = $_POST['ref']; + $object->ref = $_POST['ref']; $object->date = $dateinvoice; $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'none')); diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 1cc0e30934d..fbc1763beb3 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -17,7 +17,7 @@ */ // Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) +if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit; @@ -35,14 +35,14 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; // Load translation files required by the page $langs->load("sendings"); -$total=0; -$ilink=0; -foreach($linkedObjectBlock as $key => $objectlink) +$total = 0; +$ilink = 0; +foreach ($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass='oddeven'; - if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; + $trclass = 'oddeven'; + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total'; ?> trans("Shipment"); ?> @@ -58,7 +58,7 @@ foreach($linkedObjectBlock as $key => $objectlink) element != 'commande') { + if ($object->element != 'commande') { ?> ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) } if (count($linkedObjectBlock) > 1) { ?> - + trans("Total"); ?> diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2fe3dbc140a..6b17bb6f947 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -89,28 +89,28 @@ function testSqlAndScriptInject($val, $type) $inj += preg_match('/'."\n"; + print ''."\n"; } } // Global js function print ''."\n"; - print ''."\n"; + print ''."\n"; // JS forced by modules (relative url starting with /) - if (! empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) + if (!empty($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) { - $arrayjs=(array) $conf->modules_parts['js']; - foreach($arrayjs as $modjs => $filesjs) + $arrayjs = (array) $conf->modules_parts['js']; + foreach ($arrayjs as $modjs => $filesjs) { - $filesjs=(array) $filesjs; // To be sure filejs is an array - foreach($filesjs as $jsfile) + $filesjs = (array) $filesjs; // To be sure filejs is an array + foreach ($filesjs as $jsfile) { // jsfile is a relative path - print ''."\n".''."\n"; + print ''."\n".''."\n"; } } } @@ -1613,15 +1613,15 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead // Add login user link - $toprightmenu.='
'; + $toprightmenu .= '
'; // Login name with photo and tooltip - $mode=-1; - $toprightmenu.='
'; - $toprightmenu.='
'."\n"; + $toprightmenu .= '
'."\n"; - $toprightmenu.='
'; + $toprightmenu .= '
'; // Execute hook printTopRightMenu (hooks should output string like '') - $parameters=array(); - $result=$hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks + $parameters = array(); + $result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks if (is_numeric($result)) { if ($result == 0) - $toprightmenu.=$hookmanager->resPrint; // add + $toprightmenu .= $hookmanager->resPrint; // add else - $toprightmenu=$hookmanager->resPrint; // replace + $toprightmenu = $hookmanager->resPrint; // replace } else { - $toprightmenu.=$result; // For backward compatibility + $toprightmenu .= $result; // For backward compatibility } // Link to module builder - if (! empty($conf->modulebuilder->enabled)) + if (!empty($conf->modulebuilder->enabled)) { - $text =''; + $text = ''; //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"'); - $text.=''; - $text.=''; - $toprightmenu.=@Form::textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2); + $text .= ''; + $text .= ''; + $toprightmenu .= @Form::textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2); } // Link to print main content area if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $conf->browser->layout != 'phone') { - $qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]); + $qs = dol_escape_htmltag($_SERVER["QUERY_STRING"]); if (is_array($_POST)) { - foreach($_POST as $key=>$value) { - if ($key!=='action' && $key!=='password' && !is_array($value)) $qs.='&'.$key.'='.urlencode($value); + foreach ($_POST as $key=>$value) { + if ($key !== 'action' && $key !== 'password' && !is_array($value)) $qs .= '&'.$key.'='.urlencode($value); } } - $qs.=(($qs && $morequerystring)?'&':'').$morequerystring; - $text =''; + $qs .= (($qs && $morequerystring) ? '&' : '').$morequerystring; + $text = ''; //$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"'); - $text.=''; - $text.=''; - $toprightmenu.=@Form::textwithtooltip('', $langs->trans("PrintContentArea"), 2, 1, $text, 'login_block_elem', 2); + $text .= ''; + $text .= ''; + $toprightmenu .= @Form::textwithtooltip('', $langs->trans("PrintContentArea"), 2, 1, $text, 'login_block_elem', 2); } // Link to Dolibarr wiki pages @@ -1687,48 +1687,48 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead { $langs->load("help"); - $helpbaseurl=''; - $helppage=''; - $mode=''; + $helpbaseurl = ''; + $helppage = ''; + $mode = ''; - if (empty($helppagename)) $helppagename='EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios'; + if (empty($helppagename)) $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios'; // Get helpbaseurl, helppage and mode from helppagename and langs - $arrayres=getHelpParamFor($helppagename, $langs); - $helpbaseurl=$arrayres['helpbaseurl']; - $helppage=$arrayres['helppage']; - $mode=$arrayres['mode']; + $arrayres = getHelpParamFor($helppagename, $langs); + $helpbaseurl = $arrayres['helpbaseurl']; + $helppage = $arrayres['helppage']; + $mode = $arrayres['mode']; // Link to help pages if ($helpbaseurl && $helppage) { - $text=''; - if(!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) { + $text = ''; + if (!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) { $langs->load('admin'); - $appli .= '
' . $langs->trans("Database") . ': ' . $db->database_name; + $appli .= '
'.$langs->trans("Database").': '.$db->database_name; } - $title=$appli.'
'; - $title.=$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage'); - if ($mode == 'wiki') $title.=' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'"'; - $text.=''; - $text.=''; - $text.=''; - $toprightmenu.=@Form::textwithtooltip('', $title, 2, 1, $text, 'login_block_elem', 2); + $title = $appli.'
'; + $title .= $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage'); + if ($mode == 'wiki') $title .= ' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'"'; + $text .= ''; + $text .= ''; + $text .= ''; + $toprightmenu .= @Form::textwithtooltip('', $title, 2, 1, $text, 'login_block_elem', 2); } } // Logout link - $toprightmenu.=@Form::textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem logout-btn', 2); + $toprightmenu .= @Form::textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem logout-btn', 2); - $toprightmenu.='
'; + $toprightmenu .= '
'; print $toprightmenu; - print "\n"; // end div class="login_block" + print "\n"; // end div class="login_block" print ''; @@ -1752,94 +1752,94 @@ function top_menu_user() global $menumanager; $userImage = $userDropDownImage = ''; - if (! empty($user->photo)) + if (!empty($user->photo)) { $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); } else { - $nophoto='/public/theme/common/user_anonymous.png'; - if ($user->gender == 'man') $nophoto='/public/theme/common/user_man.png'; - if ($user->gender == 'woman') $nophoto='/public/theme/common/user_woman.png'; + $nophoto = '/public/theme/common/user_anonymous.png'; + if ($user->gender == 'man') $nophoto = '/public/theme/common/user_man.png'; + if ($user->gender == 'woman') $nophoto = '/public/theme/common/user_woman.png'; $userImage = 'No photo'; $userDropDownImage = 'No photo'; } $dropdownBody = ''; - $dropdownBody.= ' '.$langs->trans("ShowMoreInfos").''; - $dropdownBody.= '
'; + $dropdownBody .= ' '.$langs->trans("ShowMoreInfos").''; + $dropdownBody .= '
'; // login infos - if (! empty($user->admin)) { - $dropdownBody.= '
' . $langs->trans("Administrator").': '.yn($user->admin); + if (!empty($user->admin)) { + $dropdownBody .= '
'.$langs->trans("Administrator").': '.yn($user->admin); } - if (! empty($user->socid)) // Add thirdparty for external users + if (!empty($user->socid)) // Add thirdparty for external users { $thirdpartystatic = new Societe($db); $thirdpartystatic->fetch($user->socid); - $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company - $company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; + $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company + $company = ' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; } - $type=($user->socid?$langs->trans("External").$company:$langs->trans("Internal")); - $dropdownBody.= '
' . $langs->trans("Type") . ': ' . $type; - $dropdownBody.= '
' . $langs->trans("Status").': '.$user->getLibStatut(0); - $dropdownBody.= '
'; + $type = ($user->socid ? $langs->trans("External").$company : $langs->trans("Internal")); + $dropdownBody .= '
'.$langs->trans("Type").': '.$type; + $dropdownBody .= '
'.$langs->trans("Status").': '.$user->getLibStatut(0); + $dropdownBody .= '
'; - $dropdownBody.= '
'.$langs->trans("Session").''; - $dropdownBody.= '
'.$langs->trans("IPAddress").': '.dol_escape_htmltag($_SERVER["REMOTE_ADDR"]); - if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $dropdownBody.= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; - $dropdownBody.= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); - $dropdownBody.= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser'); - $dropdownBody.= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); - $dropdownBody.= '
'.$langs->trans("CurrentTheme").': '.$conf->theme; - $dropdownBody.= '
'.$langs->trans("CurrentMenuManager").': '.$menumanager->name; - $langFlag=picto_from_langcode($langs->getDefaultLang()); - $dropdownBody.= '
'.$langs->trans("CurrentUserLanguage").': '.($langFlag?$langFlag.' ':'').$langs->getDefaultLang(); - $dropdownBody.= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).')'; - $dropdownBody.= '
'.$langs->trans("Layout").': '.$conf->browser->layout; - $dropdownBody.= '
'.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; - if ($conf->browser->layout == 'phone') $dropdownBody.= '
'.$langs->trans("Phone").': '.$langs->trans("Yes"); - if (! empty($_SESSION["disablemodules"])) $dropdownBody.= '
'.$langs->trans("DisabledModules").':
'.join(', ', explode(',', $_SESSION["disablemodules"])); - $dropdownBody.= '
'; + $dropdownBody .= '
'.$langs->trans("Session").''; + $dropdownBody .= '
'.$langs->trans("IPAddress").': '.dol_escape_htmltag($_SERVER["REMOTE_ADDR"]); + if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $dropdownBody .= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; + $dropdownBody .= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)'); + $dropdownBody .= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($user->datelastlogin, "dayhour", 'tzuser'); + $dropdownBody .= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($user->datepreviouslogin, "dayhour", 'tzuser'); + $dropdownBody .= '
'.$langs->trans("CurrentTheme").': '.$conf->theme; + $dropdownBody .= '
'.$langs->trans("CurrentMenuManager").': '.$menumanager->name; + $langFlag = picto_from_langcode($langs->getDefaultLang()); + $dropdownBody .= '
'.$langs->trans("CurrentUserLanguage").': '.($langFlag ? $langFlag.' ' : '').$langs->getDefaultLang(); + $dropdownBody .= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).')'; + $dropdownBody .= '
'.$langs->trans("Layout").': '.$conf->browser->layout; + $dropdownBody .= '
'.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; + if ($conf->browser->layout == 'phone') $dropdownBody .= '
'.$langs->trans("Phone").': '.$langs->trans("Yes"); + if (!empty($_SESSION["disablemodules"])) $dropdownBody .= '
'.$langs->trans("DisabledModules").':
'.join(', ', explode(',', $_SESSION["disablemodules"])); + $dropdownBody .= '
'; // Execute hook - $parameters=array('user'=>$user, 'langs' => $langs); - $result=$hookmanager->executeHooks('printTopRightMenuLoginDropdownBody', $parameters); // Note that $action and $object may have been modified by some hooks + $parameters = array('user'=>$user, 'langs' => $langs); + $result = $hookmanager->executeHooks('printTopRightMenuLoginDropdownBody', $parameters); // Note that $action and $object may have been modified by some hooks if (is_numeric($result)) { - if ($result == 0){ - $dropdownBody.= $hookmanager->resPrint; // add + if ($result == 0) { + $dropdownBody .= $hookmanager->resPrint; // add } - else{ - $dropdownBody = $hookmanager->resPrint; // replace + else { + $dropdownBody = $hookmanager->resPrint; // replace } } - $logoutLink =' '.$langs->trans("Logout").''; - $profilLink =' '.$langs->trans("Card").''; + $logoutLink = ' '.$langs->trans("Logout").''; + $profilLink = ' '.$langs->trans("Card").''; $profilName = $user->getFullName($langs).' ('.$user->login.')'; - if (! empty($user->admin)) { + if (!empty($user->admin)) { $profilName = ' '.$profilName; } // Define version to show - $appli=constant('DOL_APPLICATION_TITLE'); - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) + $appli = constant('DOL_APPLICATION_TITLE'); + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { - $appli=$conf->global->MAIN_APPLICATION_TITLE; + $appli = $conf->global->MAIN_APPLICATION_TITLE; if (preg_match('/\d\.\d/', $appli)) { - if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core } - else $appli.=" ".DOL_VERSION; + else $appli .= " ".DOL_VERSION; } - else $appli.=" ".DOL_VERSION; + else $appli .= " ".DOL_VERSION; $btnUser = ' '; - if (! defined('JS_JQUERY_DISABLE_DROPDOWN')) // This may be set by some pages that use different jquery version to avoid errors + if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) // This may be set by some pages that use different jquery version to avoid errors { $btnUser .= ' @@ -1919,12 +1919,12 @@ function top_menu_bookmark() $html = ''; // Define $bookmarks - if (! empty($conf->bookmark->enabled) && $user->rights->bookmark->lire) + if (!empty($conf->bookmark->enabled) && $user->rights->bookmark->lire) { include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php'; $langs->load("bookmarks"); - $html.= ' + $html .= '