@@ -141,16 +141,20 @@ |
||
141 | 141 | $pu_ht_remise = price2num($pu_ht_remise, 'MU'); |
142 | 142 | |
143 | 143 | // calcul marge |
144 | - if ($pu_ht_remise < 0) |
|
145 | - $marge = -1 * (abs($pu_ht_remise) - $paht_ret); |
|
146 | - else $marge = $pu_ht_remise - $paht_ret; |
|
144 | + if ($pu_ht_remise < 0) { |
|
145 | + $marge = -1 * (abs($pu_ht_remise) - $paht_ret); |
|
146 | + } else { |
|
147 | + $marge = $pu_ht_remise - $paht_ret; |
|
148 | + } |
|
147 | 149 | |
148 | 150 | // calcul taux marge |
149 | - if ($paht_ret != 0) |
|
150 | - $marge_tx_ret = (100 * $marge) / $paht_ret; |
|
151 | + if ($paht_ret != 0) { |
|
152 | + $marge_tx_ret = (100 * $marge) / $paht_ret; |
|
153 | + } |
|
151 | 154 | // calcul taux marque |
152 | - if ($pu_ht_remise != 0) |
|
153 | - $marque_tx_ret = (100 * $marge) / $pu_ht_remise; |
|
155 | + if ($pu_ht_remise != 0) { |
|
156 | + $marque_tx_ret = (100 * $marge) / $pu_ht_remise; |
|
157 | + } |
|
154 | 158 | |
155 | 159 | return array($paht_ret, $marge_tx_ret, $marque_tx_ret); |
156 | 160 | } |
@@ -33,13 +33,15 @@ |
||
33 | 33 | global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; |
34 | 34 | $theme_bordercolor = array(235, 235, 224); |
35 | 35 | $theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(80, 166, 90), array(190, 190, 100), array(91, 115, 247), array(140, 140, 220), array(190, 120, 120), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); |
36 | -if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined. |
|
36 | +if (!defined('ISLOADEDBYSTEELSHEET')) { |
|
37 | + // File is run after an include of a php page, not by the style sheet, if the constant is not defined. |
|
37 | 38 | { |
38 | 39 | if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php |
39 | 40 | { |
40 | 41 | if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy') |
41 | 42 | { |
42 | 43 | $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); |
44 | +} |
|
43 | 45 | } else { |
44 | 46 | // for now we use the same configuration for all types of color blind |
45 | 47 | $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); |
@@ -29,13 +29,15 @@ |
||
29 | 29 | global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; |
30 | 30 | $theme_bordercolor = array(235, 235, 224); |
31 | 31 | $theme_datacolor = array(array(137, 86, 161), array(60, 147, 183), array(250, 190, 80), array(191, 75, 57), array(80, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); |
32 | -if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php page, not by the style sheet, if the constant is not defined. |
|
32 | +if (!defined('ISLOADEDBYSTEELSHEET')) { |
|
33 | + // File is run after an include of a php page, not by the style sheet, if the constant is not defined. |
|
33 | 34 | { |
34 | 35 | if (!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php |
35 | 36 | { |
36 | 37 | if ($conf->global->MAIN_OPTIMIZEFORCOLORBLIND == 'flashy') |
37 | 38 | { |
38 | 39 | $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); |
40 | +} |
|
39 | 41 | } else { |
40 | 42 | // for now we use the same configuration for all types of color blind |
41 | 43 | $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); |
@@ -28,21 +28,36 @@ discard block |
||
28 | 28 | |
29 | 29 | //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language |
30 | 30 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. |
31 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
31 | +if (!defined('NOREQUIRESOC')) { |
|
32 | + define('NOREQUIRESOC', '1'); |
|
33 | +} |
|
32 | 34 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations |
33 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
34 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
35 | -if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login |
|
35 | +if (!defined('NOCSRFCHECK')) { |
|
36 | + define('NOCSRFCHECK', 1); |
|
37 | +} |
|
38 | +if (!defined('NOTOKENRENEWAL')) { |
|
39 | + define('NOTOKENRENEWAL', 1); |
|
40 | +} |
|
41 | +if (!defined('NOLOGIN')) { |
|
42 | + define('NOLOGIN', 1); |
|
43 | +} |
|
44 | +// File must be accessed by logon page so without login |
|
36 | 45 | //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content |
37 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
38 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
46 | +if (!defined('NOREQUIREHTML')) { |
|
47 | + define('NOREQUIREHTML', 1); |
|
48 | +} |
|
49 | +if (!defined('NOREQUIREAJAX')) { |
|
50 | + define('NOREQUIREAJAX', '1'); |
|
51 | +} |
|
39 | 52 | |
40 | 53 | |
41 | 54 | define('ISLOADEDBYSTEELSHEET', '1'); |
42 | 55 | |
43 | 56 | |
44 | 57 | require __DIR__.'/theme_vars.inc.php'; |
45 | -if (defined('THEME_ONLY_CONSTANT')) return; |
|
58 | +if (defined('THEME_ONLY_CONSTANT')) { |
|
59 | + return; |
|
60 | +} |
|
46 | 61 | |
47 | 62 | session_cache_limiter('public'); |
48 | 63 | |
@@ -62,11 +77,20 @@ discard block |
||
62 | 77 | // Define css type |
63 | 78 | top_httphead('text/css'); |
64 | 79 | // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. |
65 | -if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
66 | -else header('Cache-Control: no-cache'); |
|
80 | +if (empty($dolibarr_nocache)) { |
|
81 | + header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
82 | +} else { |
|
83 | + header('Cache-Control: no-cache'); |
|
84 | +} |
|
67 | 85 | |
68 | -if (GETPOST('theme', 'alpha')) $conf->theme = GETPOST('theme', 'alpha'); // If theme was forced on URL |
|
69 | -if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL |
|
86 | +if (GETPOST('theme', 'alpha')) { |
|
87 | + $conf->theme = GETPOST('theme', 'alpha'); |
|
88 | +} |
|
89 | +// If theme was forced on URL |
|
90 | +if (GETPOST('lang', 'aZ09')) { |
|
91 | + $langs->setDefaultLang(GETPOST('lang', 'aZ09')); |
|
92 | +} |
|
93 | +// If language was forced on URL |
|
70 | 94 | |
71 | 95 | $langs->load("main", 0, 1); |
72 | 96 | $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); |
@@ -94,15 +118,33 @@ discard block |
||
94 | 118 | $borderwidth = 2; |
95 | 119 | |
96 | 120 | // Case of option always editable |
97 | -if (!isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY = $colorbackbody; |
|
98 | -if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; |
|
99 | -if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1; |
|
100 | -if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1; |
|
101 | -if (!isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover; |
|
102 | -if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked; |
|
103 | -if (!isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak; |
|
104 | -if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab; |
|
105 | -if (!isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK = $colortextlink; |
|
121 | +if (!isset($conf->global->THEME_ELDY_BACKBODY)) { |
|
122 | + $conf->global->THEME_ELDY_BACKBODY = $colorbackbody; |
|
123 | +} |
|
124 | +if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) { |
|
125 | + $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; |
|
126 | +} |
|
127 | +if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) { |
|
128 | + $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1; |
|
129 | +} |
|
130 | +if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) { |
|
131 | + $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1; |
|
132 | +} |
|
133 | +if (!isset($conf->global->THEME_ELDY_USE_HOVER)) { |
|
134 | + $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover; |
|
135 | +} |
|
136 | +if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) { |
|
137 | + $conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked; |
|
138 | +} |
|
139 | +if (!isset($conf->global->THEME_ELDY_LINEBREAK)) { |
|
140 | + $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak; |
|
141 | +} |
|
142 | +if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) { |
|
143 | + $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab; |
|
144 | +} |
|
145 | +if (!isset($conf->global->THEME_ELDY_TEXTLINK)) { |
|
146 | + $conf->global->THEME_ELDY_TEXTLINK = $colortextlink; |
|
147 | +} |
|
106 | 148 | |
107 | 149 | // Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on |
108 | 150 | if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) |
@@ -145,14 +187,19 @@ discard block |
||
145 | 187 | $colorbacklinepairchecked = ((!isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : ($user->conf->THEME_ELDY_USE_CHECKED === '1' ? 'edf4fb' : $user->conf->THEME_ELDY_USE_CHECKED)); |
146 | 188 | } |
147 | 189 | |
148 | -if (empty($colortopbordertitle1)) $colortopbordertitle1 = $colorbackhmenu1; |
|
190 | +if (empty($colortopbordertitle1)) { |
|
191 | + $colortopbordertitle1 = $colorbackhmenu1; |
|
192 | +} |
|
149 | 193 | |
150 | 194 | // Set text color to black or white |
151 | 195 | $colorbackhmenu1 = join(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' |
152 | 196 | $tmppart = explode(',', $colorbackhmenu1); |
153 | 197 | $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
154 | -if ($tmpval <= 460) $colortextbackhmenu = 'FFFFFF'; |
|
155 | -else $colortextbackhmenu = '000000'; |
|
198 | +if ($tmpval <= 460) { |
|
199 | + $colortextbackhmenu = 'FFFFFF'; |
|
200 | +} else { |
|
201 | + $colortextbackhmenu = '000000'; |
|
202 | +} |
|
156 | 203 | |
157 | 204 | $colorbackvmenu1 = join(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z' |
158 | 205 | $tmppart = explode(',', $colorbackvmenu1); |
@@ -165,7 +212,9 @@ discard block |
||
165 | 212 | { |
166 | 213 | $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); |
167 | 214 | if ($tmpval <= 460) { $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888'; } else { $colortexttitle = '101010'; $colorshadowtitle = 'FFFFFF'; } |
168 | -} else $colorshadowtitle = '888888'; |
|
215 | +} else { |
|
216 | + $colorshadowtitle = '888888'; |
|
217 | +} |
|
169 | 218 | |
170 | 219 | $colorbacktabcard1 = join(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z' |
171 | 220 | $tmppart = explode(',', $colorbacktabcard1); |
@@ -182,8 +231,12 @@ discard block |
||
182 | 231 | $colorbacklineimpair2 = join(',', colorStringToArray($colorbacklineimpair2)); |
183 | 232 | $colorbacklinepair1 = join(',', colorStringToArray($colorbacklinepair1)); |
184 | 233 | $colorbacklinepair2 = join(',', colorStringToArray($colorbacklinepair2)); |
185 | -if ($colorbacklinepairhover != '') $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover)); |
|
186 | -if ($colorbacklinepairchecked != '') $colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked)); |
|
234 | +if ($colorbacklinepairhover != '') { |
|
235 | + $colorbacklinepairhover = join(',', colorStringToArray($colorbacklinepairhover)); |
|
236 | +} |
|
237 | +if ($colorbacklinepairchecked != '') { |
|
238 | + $colorbacklinepairchecked = join(',', colorStringToArray($colorbacklinepairchecked)); |
|
239 | +} |
|
187 | 240 | $colorbackbody = join(',', colorStringToArray($colorbackbody)); |
188 | 241 | $colortexttitlenotab = join(',', colorStringToArray($colortexttitlenotab)); |
189 | 242 | $colortexttitle = join(',', colorStringToArray($colortexttitle)); |
@@ -191,7 +244,9 @@ discard block |
||
191 | 244 | $colortextlink = join(',', colorStringToArray($colortextlink)); |
192 | 245 | |
193 | 246 | $nbtopmenuentries = $menumanager->showmenu('topnb'); |
194 | -if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries, 10); |
|
247 | +if ($conf->browser->layout == 'phone') { |
|
248 | + $nbtopmenuentries = max($nbtopmenuentries, 10); |
|
249 | +} |
|
195 | 250 | |
196 | 251 | print '/*'."\n"; |
197 | 252 | print 'colorbackbody='.$colorbackbody."\n"; |
@@ -1068,7 +1123,8 @@ discard block |
||
1068 | 1123 | } |
1069 | 1124 | |
1070 | 1125 | .flexcontainer { |
1071 | - <?php if (in_array($conf->browser->name, array('chrome', 'firefox'))) echo 'display: inline-flex;' ?> |
|
1126 | + <?php if (in_array($conf->browser->name, array('chrome', 'firefox'))) { |
|
1127 | + echo 'display: inline-flex;' ?> |
|
1072 | 1128 | flex-flow: row wrap; |
1073 | 1129 | justify-content: flex-start; |
1074 | 1130 | } |
@@ -1118,7 +1174,9 @@ discard block |
||
1118 | 1174 | .minwidth50 { min-width: 50px; } |
1119 | 1175 | .minwidth75 { min-width: 75px; } |
1120 | 1176 | /* rule for not too small screen only */ |
1121 | -@media only screen and (min-width: <?php echo round($nbtopmenuentries * $fontsize * 3.4, 0) + 7; ?>px) |
|
1177 | +@media only screen and (min-width: <?php echo round($nbtopmenuentries * $fontsize * 3.4, 0) + 7; |
|
1178 | +} |
|
1179 | +?>px) |
|
1122 | 1180 | { |
1123 | 1181 | .width20 { width: 20px; } |
1124 | 1182 | .width25 { width: 25px; } |
@@ -1573,7 +1631,10 @@ discard block |
||
1573 | 1631 | div.fiche { |
1574 | 1632 | margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '24' : '6')); ?>px; |
1575 | 1633 | margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : (empty($conf->dol_optimize_smallscreen) ? '22' : '6')); ?>px; |
1576 | - <?php if (!empty($dol_hide_leftmenu) && !empty($dol_hide_topmenu)) print 'margin-top: 12px;'; ?> |
|
1634 | + <?php if (!empty($dol_hide_leftmenu) && !empty($dol_hide_topmenu)) { |
|
1635 | + print 'margin-top: 12px;'; |
|
1636 | +} |
|
1637 | +?> |
|
1577 | 1638 | margin-bottom: 15px; |
1578 | 1639 | } |
1579 | 1640 | body.onlinepaymentbody div.fiche { /* For online payment page */ |
@@ -1625,7 +1686,10 @@ discard block |
||
1625 | 1686 | div.fiche { |
1626 | 1687 | margin-<?php print $left; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 6 : ($dol_hide_leftmenu ? '4' : '20')); ?>px; |
1627 | 1688 | margin-<?php print $right; ?>: <?php print (GETPOST('optioncss', 'aZ09') == 'print' ? 8 : 16); ?>px; |
1628 | - <?php if (!empty($conf->dol_hide_leftmenu) && !empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?> |
|
1689 | + <?php if (!empty($conf->dol_hide_leftmenu) && !empty($conf->dol_hide_topmenu)) { |
|
1690 | + print 'margin-top: 4px;'; |
|
1691 | +} |
|
1692 | +?> |
|
1629 | 1693 | margin-bottom: 15px; |
1630 | 1694 | } |
1631 | 1695 | div.fichecenter { |
@@ -2120,8 +2184,12 @@ discard block |
||
2120 | 2184 | $divnotrequired = array('multicurrency', 'salaries', 'ticket', 'margin', 'opensurvey', 'paybox', 'expensereport', 'incoterm', 'prelevement', 'propal', 'workflow', 'notification', 'supplier_proposal', 'cron', 'product', 'productbatch', 'expedition'); |
2121 | 2185 | foreach ($mainmenuusedarray as $val) |
2122 | 2186 | { |
2123 | - if (empty($val) || in_array($val, $divalreadydefined)) continue; |
|
2124 | - if (in_array($val, $divnotrequired)) continue; |
|
2187 | + if (empty($val) || in_array($val, $divalreadydefined)) { |
|
2188 | + continue; |
|
2189 | + } |
|
2190 | + if (in_array($val, $divnotrequired)) { |
|
2191 | + continue; |
|
2192 | + } |
|
2125 | 2193 | //print "XXX".$val; |
2126 | 2194 | |
2127 | 2195 | // Search img file in module dir |
@@ -6303,9 +6371,13 @@ discard block |
||
6303 | 6371 | include dol_buildpath($path.'/theme/'.$theme.'/progress.inc.php', 0); |
6304 | 6372 | include dol_buildpath($path.'/theme/eldy/timeline.inc.php', 0); // actually md use same style as eldy theme |
6305 | 6373 | |
6306 | -if (!empty($conf->global->THEME_CUSTOM_CSS)) print $conf->global->THEME_CUSTOM_CSS; |
|
6374 | +if (!empty($conf->global->THEME_CUSTOM_CSS)) { |
|
6375 | + print $conf->global->THEME_CUSTOM_CSS; |
|
6376 | +} |
|
6307 | 6377 | |
6308 | -if (is_object($db)) $db->close(); |
|
6378 | +if (is_object($db)) { |
|
6379 | + $db->close(); |
|
6380 | +} |
|
6309 | 6381 | ?> |
6310 | 6382 | |
6311 | 6383 | /* This must be at end */ |
@@ -25,11 +25,13 @@ discard block |
||
25 | 25 | if (session_id() == "") |
26 | 26 | { |
27 | 27 | session_start(); |
28 | - if (ini_get('register_globals')) // To solve bug in using $_SESSION |
|
28 | + if (ini_get('register_globals')) { |
|
29 | + // To solve bug in using $_SESSION |
|
29 | 30 | { |
30 | 31 | foreach ($_SESSION as $key=>$value) |
31 | 32 | { |
32 | 33 | if (isset($GLOBALS[$key])) unset($GLOBALS[$key]); |
34 | + } |
|
33 | 35 | } |
34 | 36 | } |
35 | 37 | } |
@@ -48,9 +50,11 @@ discard block |
||
48 | 50 | ' For the sandbox, the URL is https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token= |
49 | 51 | ' For the live site, the URL is https://www.paypal.com/webscr&cmd=_express-checkout&token= |
50 | 52 | */ |
51 | -if (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha')) // We can force sand box with param 'forcesandbox' |
|
53 | +if (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha')) { |
|
54 | + // We can force sand box with param 'forcesandbox' |
|
52 | 55 | { |
53 | 56 | $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; |
57 | +} |
|
54 | 58 | $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; |
55 | 59 | } else { |
56 | 60 | $API_Endpoint = "https://api-3t.paypal.com/nvp"; |
@@ -59,13 +63,21 @@ discard block |
||
59 | 63 | |
60 | 64 | // Clean parameters |
61 | 65 | $PAYPAL_API_USER = ""; |
62 | -if (!empty($conf->global->PAYPAL_API_USER)) $PAYPAL_API_USER = $conf->global->PAYPAL_API_USER; |
|
66 | +if (!empty($conf->global->PAYPAL_API_USER)) { |
|
67 | + $PAYPAL_API_USER = $conf->global->PAYPAL_API_USER; |
|
68 | +} |
|
63 | 69 | $PAYPAL_API_PASSWORD = ""; |
64 | -if (!empty($conf->global->PAYPAL_API_PASSWORD)) $PAYPAL_API_PASSWORD = $conf->global->PAYPAL_API_PASSWORD; |
|
70 | +if (!empty($conf->global->PAYPAL_API_PASSWORD)) { |
|
71 | + $PAYPAL_API_PASSWORD = $conf->global->PAYPAL_API_PASSWORD; |
|
72 | +} |
|
65 | 73 | $PAYPAL_API_SIGNATURE = ""; |
66 | -if (!empty($conf->global->PAYPAL_API_SIGNATURE)) $PAYPAL_API_SIGNATURE = $conf->global->PAYPAL_API_SIGNATURE; |
|
74 | +if (!empty($conf->global->PAYPAL_API_SIGNATURE)) { |
|
75 | + $PAYPAL_API_SIGNATURE = $conf->global->PAYPAL_API_SIGNATURE; |
|
76 | +} |
|
67 | 77 | $PAYPAL_API_SANDBOX = ""; |
68 | -if (!empty($conf->global->PAYPAL_API_SANDBOX)) $PAYPAL_API_SANDBOX = $conf->global->PAYPAL_API_SANDBOX; |
|
78 | +if (!empty($conf->global->PAYPAL_API_SANDBOX)) { |
|
79 | + $PAYPAL_API_SANDBOX = $conf->global->PAYPAL_API_SANDBOX; |
|
80 | +} |
|
69 | 81 | |
70 | 82 | // Proxy |
71 | 83 | $PROXY_HOST = $conf->global->MAIN_PROXY_HOST; |
@@ -70,7 +70,9 @@ discard block |
||
70 | 70 | $hookmanager->initHooks(array('resource', 'resource_card', 'globalcard')); |
71 | 71 | $parameters = array('resource_id'=>$id); |
72 | 72 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
73 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
73 | +if ($reshook < 0) { |
|
74 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
75 | +} |
|
74 | 76 | |
75 | 77 | if (empty($reshook)) |
76 | 78 | { |
@@ -107,7 +109,9 @@ discard block |
||
107 | 109 | |
108 | 110 | // Fill array 'array_options' with data from add form |
109 | 111 | $ret = $extrafields->setOptionalsFromPost(null, $object); |
110 | - if ($ret < 0) $error++; |
|
112 | + if ($ret < 0) { |
|
113 | + $error++; |
|
114 | + } |
|
111 | 115 | |
112 | 116 | $result = $object->create($user); |
113 | 117 | if ($result > 0) |
@@ -220,7 +224,9 @@ discard block |
||
220 | 224 | |
221 | 225 | if ($action == 'create' || $action == 'edit') |
222 | 226 | { |
223 | - if (!$user->rights->resource->write) accessforbidden('', 0, 1); |
|
227 | + if (!$user->rights->resource->write) { |
|
228 | + accessforbidden('', 0, 1); |
|
229 | + } |
|
224 | 230 | |
225 | 231 | // Create/Edit object |
226 | 232 | |
@@ -251,7 +257,9 @@ discard block |
||
251 | 257 | // Origin country |
252 | 258 | print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td>'; |
253 | 259 | print $form->select_country($object->country_id, 'country_id'); |
254 | - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
260 | + if ($user->admin) { |
|
261 | + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); |
|
262 | + } |
|
255 | 263 | print '</td></tr>'; |
256 | 264 | |
257 | 265 | // Other attributes |
@@ -44,7 +44,9 @@ discard block |
||
44 | 44 | $confirm = GETPOST('confirm', 'alpha'); |
45 | 45 | |
46 | 46 | // Security check |
47 | -if ($user->socid) $socid = $user->socid; |
|
47 | +if ($user->socid) { |
|
48 | + $socid = $user->socid; |
|
49 | +} |
|
48 | 50 | $result = restrictedArea($user, 'resource', $id, 'resource'); |
49 | 51 | |
50 | 52 | |
@@ -57,8 +59,12 @@ discard block |
||
57 | 59 | $offset = $limit * $page; |
58 | 60 | $pageprev = $page - 1; |
59 | 61 | $pagenext = $page + 1; |
60 | -if (!$sortorder) $sortorder = "ASC"; |
|
61 | -if (!$sortfield) $sortfield = "name"; |
|
62 | +if (!$sortorder) { |
|
63 | + $sortorder = "ASC"; |
|
64 | +} |
|
65 | +if (!$sortfield) { |
|
66 | + $sortfield = "name"; |
|
67 | +} |
|
62 | 68 | |
63 | 69 | |
64 | 70 | $object = new DolResource($db); |
@@ -43,7 +43,9 @@ discard block |
||
43 | 43 | $confirm = GETPOST('confirm', 'alpha'); |
44 | 44 | |
45 | 45 | // Security check |
46 | -if ($user->socid) $socid = $user->socid; |
|
46 | +if ($user->socid) { |
|
47 | + $socid = $user->socid; |
|
48 | +} |
|
47 | 49 | $result = restrictedArea($user, 'deplacement', $id, ''); |
48 | 50 | |
49 | 51 | |
@@ -56,8 +58,12 @@ discard block |
||
56 | 58 | $offset = $limit * $page; |
57 | 59 | $pageprev = $page - 1; |
58 | 60 | $pagenext = $page + 1; |
59 | -if (!$sortorder) $sortorder = "ASC"; |
|
60 | -if (!$sortfield) $sortfield = "name"; |
|
61 | +if (!$sortorder) { |
|
62 | + $sortorder = "ASC"; |
|
63 | +} |
|
64 | +if (!$sortfield) { |
|
65 | + $sortfield = "name"; |
|
66 | +} |
|
61 | 67 | |
62 | 68 | |
63 | 69 | $object = new Deplacement($db); |
@@ -32,7 +32,9 @@ |
||
32 | 32 | $langs->loadLangs(array('banks', 'categories', 'compta', 'bills')); |
33 | 33 | |
34 | 34 | // Security check |
35 | -if ($user->socid) $socid = $user->socid; |
|
35 | +if ($user->socid) { |
|
36 | + $socid = $user->socid; |
|
37 | +} |
|
36 | 38 | $result = restrictedArea($user, 'banque', '', ''); |
37 | 39 | |
38 | 40 |