@@ -243,10 +243,11 @@ |
||
| 243 | 243 | $this->assertEquals($result, 2); |
| 244 | 244 | |
| 245 | 245 | |
| 246 | - foreach ($localobject->html_images as $i => $val) |
|
| 247 | - if ($localobject->html_images[$i]) { |
|
| 246 | + foreach ($localobject->html_images as $i => $val) { |
|
| 247 | + if ($localobject->html_images[$i]) { |
|
| 248 | 248 | if (preg_match('/img250x20\.png/i', $localobject->html_images[$i]['fullpath'])) { |
| 249 | 249 | print __METHOD__ . " content type must be image png =" . $localobject->html_images[$i]['content_type'] . "\n"; |
| 250 | + } |
|
| 250 | 251 | $this->assertEquals($localobject->html_images[$i]['content_type'], 'image/png'); |
| 251 | 252 | |
| 252 | 253 | print __METHOD__ . " type must be cidfromurl =" . $localobject->html_images[$i]['type'] . "\n"; |
@@ -52,9 +52,11 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public static function addPath($path) |
| 54 | 54 | { |
| 55 | - if (false === $path = stream_resolve_include_path($path)) |
|
| 56 | - return false; |
|
| 57 | - else set_include_path($path.PATH_SEPARATOR.get_include_path()); |
|
| 55 | + if (false === $path = stream_resolve_include_path($path)) { |
|
| 56 | + return false; |
|
| 57 | + } else { |
|
| 58 | + set_include_path($path.PATH_SEPARATOR.get_include_path()); |
|
| 59 | + } |
|
| 58 | 60 | return $path; |
| 59 | 61 | } |
| 60 | 62 | |
@@ -67,16 +69,19 @@ discard block |
||
| 67 | 69 | */ |
| 68 | 70 | public static function thereCanBeOnlyOne() |
| 69 | 71 | { |
| 70 | - if (static::$perfectLoaders === spl_autoload_functions()) |
|
| 71 | - return static::$instance; |
|
| 72 | + if (static::$perfectLoaders === spl_autoload_functions()) { |
|
| 73 | + return static::$instance; |
|
| 74 | + } |
|
| 72 | 75 | |
| 73 | - if (false !== $loaders = spl_autoload_functions()) |
|
| 74 | - if (0 < $count = count($loaders)) |
|
| 76 | + if (false !== $loaders = spl_autoload_functions()) { |
|
| 77 | + if (0 < $count = count($loaders)) |
|
| 75 | 78 | for ($i = 0, static::$rogueLoaders += $loaders; |
| 79 | + } |
|
| 76 | 80 | $i < $count && false != ($loader = $loaders[$i]); |
| 77 | - $i++) |
|
| 78 | - if ($loader !== static::$perfectLoaders[0]) |
|
| 81 | + $i++) { |
|
| 82 | + if ($loader !== static::$perfectLoaders[0]) |
|
| 79 | 83 | spl_autoload_unregister($loader); |
| 84 | + } |
|
| 80 | 85 | |
| 81 | 86 | return static::$instance; |
| 82 | 87 | } |
@@ -105,12 +110,14 @@ discard block |
||
| 105 | 110 | return false; |
| 106 | 111 | } |
| 107 | 112 | |
| 108 | - if (empty(static::$classMap[$key])) |
|
| 109 | - static::$classMap[$key] = $value; |
|
| 113 | + if (empty(static::$classMap[$key])) { |
|
| 114 | + static::$classMap[$key] = $value; |
|
| 115 | + } |
|
| 110 | 116 | |
| 111 | - if (is_string($alias = static::$classMap[$key])) |
|
| 112 | - if (isset(static::$classMap[$alias])) |
|
| 117 | + if (is_string($alias = static::$classMap[$key])) { |
|
| 118 | + if (isset(static::$classMap[$alias])) |
|
| 113 | 119 | return static::$classMap[$alias]; |
| 120 | + } |
|
| 114 | 121 | |
| 115 | 122 | return static::$classMap[$key]; |
| 116 | 123 | } |
@@ -138,8 +145,8 @@ discard block |
||
| 138 | 145 | array($dir, 'vendor', 'composer'), |
| 139 | 146 | array($dir, '..', '..', '..', 'php'), |
| 140 | 147 | array($dir, 'vendor', 'php')) |
| 141 | - as $includePath) |
|
| 142 | - if (false !== $path = stream_resolve_include_path( |
|
| 148 | + as $includePath) { |
|
| 149 | + if (false !== $path = stream_resolve_include_path( |
|
| 143 | 150 | implode($slash, $includePath) |
| 144 | 151 | )) |
| 145 | 152 | if ('composer' == end($includePath) && |
@@ -150,18 +157,22 @@ discard block |
||
| 150 | 157 | static::seen(static::loadFile( |
| 151 | 158 | $classmapPath |
| 152 | 159 | )); |
| 160 | + } |
|
| 153 | 161 | $paths = array_merge( |
| 154 | 162 | $paths, |
| 155 | 163 | array_values(static::loadFile( |
| 156 | 164 | "$path{$slash}autoload_namespaces.php" |
| 157 | 165 | )) |
| 158 | 166 | ); |
| 159 | - } else $paths[] = $path; |
|
| 167 | + } else { |
|
| 168 | + $paths[] = $path; |
|
| 169 | + } |
|
| 160 | 170 | |
| 161 | 171 | $paths = array_filter(array_map( |
| 162 | 172 | function ($path) { |
| 163 | - if (false == $realPath = @realpath($path)) |
|
| 164 | - return null; |
|
| 173 | + if (false == $realPath = @realpath($path)) { |
|
| 174 | + return null; |
|
| 175 | + } |
|
| 165 | 176 | return $realPath . DIRECTORY_SEPARATOR; |
| 166 | 177 | }, |
| 167 | 178 | $paths |
@@ -200,9 +211,11 @@ discard block |
||
| 200 | 211 | private function loadPrefixes($className) |
| 201 | 212 | { |
| 202 | 213 | $currentClass = $className; |
| 203 | - if (false !== $pos = strrpos($className, '\\')) |
|
| 204 | - $className = substr($className, $pos); |
|
| 205 | - else $className = "\\$className"; |
|
| 214 | + if (false !== $pos = strrpos($className, '\\')) { |
|
| 215 | + $className = substr($className, $pos); |
|
| 216 | + } else { |
|
| 217 | + $className = "\\$className"; |
|
| 218 | + } |
|
| 206 | 219 | |
| 207 | 220 | for ( |
| 208 | 221 | $i = 0, |
@@ -231,12 +244,13 @@ discard block |
||
| 231 | 244 | private function loadAliases($className) |
| 232 | 245 | { |
| 233 | 246 | $file = false; |
| 234 | - if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) |
|
| 235 | - for ( |
|
| 247 | + if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) { |
|
| 248 | + for ( |
|
| 236 | 249 | $i = 0, |
| 237 | 250 | $aliases = isset(static::$aliases[$parts[1]]) |
| 238 | 251 | ? static::$aliases[$parts[1]] : array(), |
| 239 | 252 | $count = count($aliases); |
| 253 | + } |
|
| 240 | 254 | $i < $count && false === $file; |
| 241 | 255 | $file = $this->discover( |
| 242 | 256 | "{$aliases[$i++]}$parts[2]", |
@@ -263,13 +277,15 @@ discard block |
||
| 263 | 277 | { |
| 264 | 278 | $loaders = array_unique(static::$rogueLoaders, SORT_REGULAR); |
| 265 | 279 | if (isset($loader)) { |
| 266 | - if (false === array_search($loader, $loaders)) |
|
| 267 | - static::$rogueLoaders[] = $loader; |
|
| 280 | + if (false === array_search($loader, $loaders)) { |
|
| 281 | + static::$rogueLoaders[] = $loader; |
|
| 282 | + } |
|
| 268 | 283 | return $this->loadThisLoader($className, $loader); |
| 269 | 284 | } |
| 270 | - foreach ($loaders as $loader) |
|
| 271 | - if (false !== $file = $this->loadThisLoader($className, $loader)) |
|
| 285 | + foreach ($loaders as $loader) { |
|
| 286 | + if (false !== $file = $this->loadThisLoader($className, $loader)) |
|
| 272 | 287 | return $file; |
| 288 | + } |
|
| 273 | 289 | |
| 274 | 290 | return false; |
| 275 | 291 | } |
@@ -313,13 +329,18 @@ discard block |
||
| 313 | 329 | */ |
| 314 | 330 | private function alias($className, $currentClass) |
| 315 | 331 | { |
| 316 | - if ($className == 'Luracast\Restler\string') return; |
|
| 317 | - if ($className == 'Luracast\Restler\mixed') return; |
|
| 332 | + if ($className == 'Luracast\Restler\string') { |
|
| 333 | + return; |
|
| 334 | + } |
|
| 335 | + if ($className == 'Luracast\Restler\mixed') { |
|
| 336 | + return; |
|
| 337 | + } |
|
| 318 | 338 | if ($className != $currentClass |
| 319 | - && false !== strpos($className, $currentClass)) |
|
| 320 | - if (!class_exists($currentClass, false) |
|
| 339 | + && false !== strpos($className, $currentClass)) { |
|
| 340 | + if (!class_exists($currentClass, false) |
|
| 321 | 341 | && class_alias($className, $currentClass)) |
| 322 | 342 | static::seen($currentClass, $className); |
| 343 | + } |
|
| 323 | 344 | } |
| 324 | 345 | |
| 325 | 346 | /** |
@@ -337,11 +358,12 @@ discard block |
||
| 337 | 358 | |
| 338 | 359 | /** The short version we've done this before and found it in cache */ |
| 339 | 360 | if (false !== $file = static::seen($className)) { |
| 340 | - if (!$this->exists($className)) |
|
| 341 | - if (is_callable($file)) |
|
| 361 | + if (!$this->exists($className)) { |
|
| 362 | + if (is_callable($file)) |
|
| 342 | 363 | $file = $this->loadLastResort($className, $file); |
| 343 | - elseif ($file = stream_resolve_include_path($file)) |
|
| 344 | - $file = static::loadFile($file); |
|
| 364 | + } elseif ($file = stream_resolve_include_path($file)) { |
|
| 365 | + $file = static::loadFile($file); |
|
| 366 | + } |
|
| 345 | 367 | |
| 346 | 368 | $this->alias($className, $currentClass); |
| 347 | 369 | return $file; |
@@ -351,15 +373,17 @@ discard block |
||
| 351 | 373 | |
| 352 | 374 | /** replace \ with / and _ in CLASS NAME with / = PSR-0 in 3 lines */ |
| 353 | 375 | $file = preg_replace("/\\\|_(?=\w+$)/", DIRECTORY_SEPARATOR, $className); |
| 354 | - if (false === $file = stream_resolve_include_path("$file.php")) |
|
| 355 | - return false; |
|
| 376 | + if (false === $file = stream_resolve_include_path("$file.php")) { |
|
| 377 | + return false; |
|
| 378 | + } |
|
| 356 | 379 | |
| 357 | 380 | /** have we loaded this file before could this be an alias */ |
| 358 | 381 | if (in_array($file, get_included_files())) { |
| 359 | - if (false !== $sameFile = array_search($file, static::$classMap)) |
|
| 360 | - if (!$this->exists($className, $file)) |
|
| 382 | + if (false !== $sameFile = array_search($file, static::$classMap)) { |
|
| 383 | + if (!$this->exists($className, $file)) |
|
| 361 | 384 | if (false !== strpos($sameFile, $className)) |
| 362 | 385 | $this->alias($sameFile, $className); |
| 386 | + } |
|
| 363 | 387 | |
| 364 | 388 | return $file; |
| 365 | 389 | } |
@@ -367,17 +391,19 @@ discard block |
||
| 367 | 391 | $state = array_merge(get_declared_classes(), get_declared_interfaces()); |
| 368 | 392 | |
| 369 | 393 | if (false !== $result = static::loadFile($file)) { |
| 370 | - if ($this->exists($className, $file)) |
|
| 371 | - $this->alias($className, $currentClass); |
|
| 372 | - elseif (false != $diff = array_diff( |
|
| 373 | - array_merge(get_declared_classes(), get_declared_interfaces()), $state)) |
|
| 374 | - foreach ($diff as $autoLoaded) |
|
| 394 | + if ($this->exists($className, $file)) { |
|
| 395 | + $this->alias($className, $currentClass); |
|
| 396 | + } elseif (false != $diff = array_diff( |
|
| 397 | + array_merge(get_declared_classes(), get_declared_interfaces()), $state)) { |
|
| 398 | + foreach ($diff as $autoLoaded) |
|
| 375 | 399 | if ($this->exists($autoLoaded, $file)) |
| 376 | 400 | if (false !== strpos($autoLoaded, $className)) |
| 377 | 401 | $this->alias($autoLoaded, $className); |
| 402 | + } |
|
| 378 | 403 | |
| 379 | - if (!$this->exists($currentClass)) |
|
| 380 | - $result = false; |
|
| 404 | + if (!$this->exists($currentClass)) { |
|
| 405 | + $result = false; |
|
| 406 | + } |
|
| 381 | 407 | } |
| 382 | 408 | |
| 383 | 409 | return $result; |
@@ -395,10 +421,12 @@ discard block |
||
| 395 | 421 | private function exists($className, $mapping = null) |
| 396 | 422 | { |
| 397 | 423 | if (class_exists($className, false) |
| 398 | - || interface_exists($className, false)) |
|
| 399 | - if (isset($mapping)) |
|
| 424 | + || interface_exists($className, false)) { |
|
| 425 | + if (isset($mapping)) |
|
| 400 | 426 | return static::seen($className, $mapping); |
| 401 | - else return true; |
|
| 427 | + } else { |
|
| 428 | + return true; |
|
| 429 | + } |
|
| 402 | 430 | return false; |
| 403 | 431 | } |
| 404 | 432 | |
@@ -411,22 +439,27 @@ discard block |
||
| 411 | 439 | */ |
| 412 | 440 | public function __invoke($className) |
| 413 | 441 | { |
| 414 | - if (empty($className)) |
|
| 415 | - return false; |
|
| 442 | + if (empty($className)) { |
|
| 443 | + return false; |
|
| 444 | + } |
|
| 416 | 445 | |
| 417 | - if (false !== $includeReference = $this->discover($className)) |
|
| 418 | - return $includeReference; |
|
| 446 | + if (false !== $includeReference = $this->discover($className)) { |
|
| 447 | + return $includeReference; |
|
| 448 | + } |
|
| 419 | 449 | |
| 420 | 450 | static::thereCanBeOnlyOne(); |
| 421 | 451 | |
| 422 | - if (false !== $includeReference = $this->loadAliases($className)) |
|
| 423 | - return $includeReference; |
|
| 452 | + if (false !== $includeReference = $this->loadAliases($className)) { |
|
| 453 | + return $includeReference; |
|
| 454 | + } |
|
| 424 | 455 | |
| 425 | - if (false !== $includeReference = $this->loadPrefixes($className)) |
|
| 426 | - return $includeReference; |
|
| 456 | + if (false !== $includeReference = $this->loadPrefixes($className)) { |
|
| 457 | + return $includeReference; |
|
| 458 | + } |
|
| 427 | 459 | |
| 428 | - if (false !== $includeReference = $this->loadLastResort($className)) |
|
| 429 | - return $includeReference; |
|
| 460 | + if (false !== $includeReference = $this->loadLastResort($className)) { |
|
| 461 | + return $includeReference; |
|
| 462 | + } |
|
| 430 | 463 | |
| 431 | 464 | static::seen($className, true); |
| 432 | 465 | return null; |
@@ -327,10 +327,16 @@ |
||
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if (empty($idorcode)) $idorcode = 'all'; |
|
| 330 | + if (empty($idorcode)) { |
|
| 331 | + $idorcode = 'all'; |
|
| 332 | + } |
|
| 331 | 333 | $TType = $TSystem[$idorcode]; |
| 332 | - if (! empty($TSystemAuto[$idorcode])) $TType = array_merge($TSystem[$idorcode], $TSystemAuto[$idorcode]); |
|
| 333 | - if (! empty($TModule[$idorcode])) $TType = array_merge($TSystem[$idorcode], $TModule[$idorcode]); |
|
| 334 | + if (! empty($TSystemAuto[$idorcode])) { |
|
| 335 | + $TType = array_merge($TSystem[$idorcode], $TSystemAuto[$idorcode]); |
|
| 336 | + } |
|
| 337 | + if (! empty($TModule[$idorcode])) { |
|
| 338 | + $TType = array_merge($TSystem[$idorcode], $TModule[$idorcode]); |
|
| 339 | + } |
|
| 334 | 340 | $this->liste_array = $TType; |
| 335 | 341 | |
| 336 | 342 | |
@@ -321,7 +321,9 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | // if $moreParams is an array |
| 323 | 323 | if (!empty($moreParams) && is_array($moreParams)) { |
| 324 | - if (isset($moreParams['controller'])) unset($moreParams['controller']); |
|
| 324 | + if (isset($moreParams['controller'])) { |
|
| 325 | + unset($moreParams['controller']); |
|
| 326 | + } |
|
| 325 | 327 | if (!empty($moreParams)) { |
| 326 | 328 | foreach ($moreParams as $paramKey => $paramVal) { |
| 327 | 329 | $Tparams[$paramKey] = $paramVal; |
@@ -340,8 +342,12 @@ discard block |
||
| 340 | 342 | // if $moreParams is a string |
| 341 | 343 | if (!empty($moreParams) && !is_array($moreParams)) { |
| 342 | 344 | if (empty($Tparams)) { |
| 343 | - if ($moreParams[0] !== '?') $url .= '?'; |
|
| 344 | - if ($moreParams[0] === '&') $moreParams = substr($moreParams, 1); |
|
| 345 | + if ($moreParams[0] !== '?') { |
|
| 346 | + $url .= '?'; |
|
| 347 | + } |
|
| 348 | + if ($moreParams[0] === '&') { |
|
| 349 | + $moreParams = substr($moreParams, 1); |
|
| 350 | + } |
|
| 345 | 351 | } |
| 346 | 352 | $url .= $moreParams; |
| 347 | 353 | } |
@@ -410,10 +416,16 @@ discard block |
||
| 410 | 416 | */ |
| 411 | 417 | public function setError($errors) |
| 412 | 418 | { |
| 413 | - if (!is_array($errors)) $errors = array($errors); |
|
| 414 | - if (!isset($_SESSION['webportal_errors'])) $_SESSION['webportal_errors'] = array(); |
|
| 419 | + if (!is_array($errors)) { |
|
| 420 | + $errors = array($errors); |
|
| 421 | + } |
|
| 422 | + if (!isset($_SESSION['webportal_errors'])) { |
|
| 423 | + $_SESSION['webportal_errors'] = array(); |
|
| 424 | + } |
|
| 415 | 425 | foreach ($errors as $msg) { |
| 416 | - if (!in_array($msg, $_SESSION['webportal_errors'])) $_SESSION['webportal_errors'][] = $msg; |
|
| 426 | + if (!in_array($msg, $_SESSION['webportal_errors'])) { |
|
| 427 | + $_SESSION['webportal_errors'][] = $msg; |
|
| 428 | + } |
|
| 417 | 429 | } |
| 418 | 430 | } |
| 419 | 431 | |
@@ -40,12 +40,29 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | // Change this following line to use the correct relative path (../, ../../, etc) |
| 42 | 42 | $res = 0; |
| 43 | -if (!$res && file_exists('../../main.inc.php')) $res = @include '../../main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory |
|
| 44 | -if (!$res && file_exists('../../../main.inc.php')) $res = @include '../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory |
|
| 45 | -if (!$res && file_exists('../../../../main.inc.php')) $res = @include '../../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory |
|
| 46 | -if (!$res && file_exists('../../../../../main.inc.php')) $res = @include '../../../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory |
|
| 47 | -if (!$res && file_exists('../../../../../../main.inc.php')) $res = @include '../../../../../../main.inc.php'; // to work if your module directory is into a subdir of root htdocs directory |
|
| 48 | -if (!$res) die('Include of main fails'); |
|
| 43 | +if (!$res && file_exists('../../main.inc.php')) { |
|
| 44 | + $res = @include '../../main.inc.php'; |
|
| 45 | +} |
|
| 46 | +// to work if your module directory is into dolibarr root htdocs directory |
|
| 47 | +if (!$res && file_exists('../../../main.inc.php')) { |
|
| 48 | + $res = @include '../../../main.inc.php'; |
|
| 49 | +} |
|
| 50 | +// to work if your module directory is into a subdir of root htdocs directory |
|
| 51 | +if (!$res && file_exists('../../../../main.inc.php')) { |
|
| 52 | + $res = @include '../../../../main.inc.php'; |
|
| 53 | +} |
|
| 54 | +// to work if your module directory is into a subdir of root htdocs directory |
|
| 55 | +if (!$res && file_exists('../../../../../main.inc.php')) { |
|
| 56 | + $res = @include '../../../../../main.inc.php'; |
|
| 57 | +} |
|
| 58 | +// to work if your module directory is into a subdir of root htdocs directory |
|
| 59 | +if (!$res && file_exists('../../../../../../main.inc.php')) { |
|
| 60 | + $res = @include '../../../../../../main.inc.php'; |
|
| 61 | +} |
|
| 62 | +// to work if your module directory is into a subdir of root htdocs directory |
|
| 63 | +if (!$res) { |
|
| 64 | + die('Include of main fails'); |
|
| 65 | +} |
|
| 49 | 66 | require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
| 50 | 67 | require_once DOL_DOCUMENT_ROOT . '/societe/class/societeaccount.class.php'; |
| 51 | 68 | dol_include_once('/public/webportal/lib/webportal.lib.php'); |
@@ -113,7 +130,9 @@ discard block |
||
| 113 | 130 | } |
| 114 | 131 | if (empty($password)) { |
| 115 | 132 | $context->setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Password")), 'errors'); |
| 116 | - if (empty($focus_element)) $focus_element = 'password'; |
|
| 133 | + if (empty($focus_element)) { |
|
| 134 | + $focus_element = 'password'; |
|
| 135 | + } |
|
| 117 | 136 | $error++; |
| 118 | 137 | } |
| 119 | 138 | // check security graphic code |
@@ -112,7 +112,9 @@ |
||
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | 114 | $reshook = $hookmanager->executeHooks('PrintTopMenu', $parameters, $context, $context->action); // Note that $action and $object may have been modified by hook |
| 115 | -if ($reshook < 0) $context->setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 115 | +if ($reshook < 0) { |
|
| 116 | + $context->setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 117 | +} |
|
| 116 | 118 | |
| 117 | 119 | if (empty($reshook)) { |
| 118 | 120 | if (!empty($hookmanager->resArray)) { |
@@ -35,8 +35,13 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | // Change this following line to use the correct relative path (../, ../../, etc) |
| 37 | 37 | $res = 0; |
| 38 | -if (!$res && file_exists('./webportal.main.inc.php')) $res = @include './webportal.main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory |
|
| 39 | -if (!$res) die('Include of WebPortal main fails'); |
|
| 38 | +if (!$res && file_exists('./webportal.main.inc.php')) { |
|
| 39 | + $res = @include './webportal.main.inc.php'; |
|
| 40 | +} |
|
| 41 | +// to work if your module directory is into dolibarr root htdocs directory |
|
| 42 | +if (!$res) { |
|
| 43 | + die('Include of WebPortal main fails'); |
|
| 44 | +} |
|
| 40 | 45 | |
| 41 | 46 | global $db; |
| 42 | 47 | |
@@ -50,7 +55,9 @@ discard block |
||
| 50 | 55 | } |
| 51 | 56 | |
| 52 | 57 | // Not sure this is required |
| 53 | -if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 58 | +if (isset($_SESSION['webportal_logged_thirdparty_account_id'])) { |
|
| 59 | + unset($_SESSION['webportal_logged_thirdparty_account_id']); |
|
| 60 | +} |
|
| 54 | 61 | |
| 55 | 62 | if (GETPOST('noredirect')) { |
| 56 | 63 | return; |
@@ -2,8 +2,13 @@ |
||
| 2 | 2 | |
| 3 | 3 | // Change this following line to use the correct relative path (../, ../../, etc) |
| 4 | 4 | $res = 0; |
| 5 | -if (!$res && file_exists('./webportal.main.inc.php')) $res = @include './webportal.main.inc.php'; // to work if your module directory is into dolibarr root htdocs directory |
|
| 6 | -if (!$res) die('Include of WebPortal main fails'); |
|
| 5 | +if (!$res && file_exists('./webportal.main.inc.php')) { |
|
| 6 | + $res = @include './webportal.main.inc.php'; |
|
| 7 | +} |
|
| 8 | +// to work if your module directory is into dolibarr root htdocs directory |
|
| 9 | +if (!$res) { |
|
| 10 | + die('Include of WebPortal main fails'); |
|
| 11 | +} |
|
| 7 | 12 | |
| 8 | 13 | /** @var Context $context */ |
| 9 | 14 | |
@@ -2313,10 +2313,16 @@ |
||
| 2313 | 2313 | $type = $prod->type; |
| 2314 | 2314 | $fk_unit = $prod->fk_unit; |
| 2315 | 2315 | } else { |
| 2316 | - if (!empty($price_ht)) $pu_ht = price2num($price_ht, 'MU'); |
|
| 2317 | - else $pu_ht = ''; |
|
| 2318 | - if (!empty($price_ttc)) $pu_ttc = price2num($price_ttc, 'MU'); |
|
| 2319 | - else $pu_ttc = ''; |
|
| 2316 | + if (!empty($price_ht)) { |
|
| 2317 | + $pu_ht = price2num($price_ht, 'MU'); |
|
| 2318 | + } else { |
|
| 2319 | + $pu_ht = ''; |
|
| 2320 | + } |
|
| 2321 | + if (!empty($price_ttc)) { |
|
| 2322 | + $pu_ttc = price2num($price_ttc, 'MU'); |
|
| 2323 | + } else { |
|
| 2324 | + $pu_ttc = ''; |
|
| 2325 | + } |
|
| 2320 | 2326 | $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); |
| 2321 | 2327 | $tva_tx = str_replace('*', '', $tva_tx); |
| 2322 | 2328 | if (empty($tva_tx)) { |