@@ -144,9 +144,9 @@ discard block  | 
                                                    ||
| 144 | 144 | $this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';  | 
                                                        
| 145 | 145 | |
| 146 | 146 | // For dolistore modules  | 
                                                        
| 147 | -		$this->dolistore_api_url = getDolGlobalString('MAIN_MODULE_DOLISTORE_API_SRV', 'https://www.dolistore.com/api/');	// 'https://www.dolistore.com/api/', 'https://admin2.dolibarr.org/api/index.php/marketplace/' | 
                                                        |
| 147 | +		$this->dolistore_api_url = getDolGlobalString('MAIN_MODULE_DOLISTORE_API_SRV', 'https://www.dolistore.com/api/'); // 'https://www.dolistore.com/api/', 'https://admin2.dolibarr.org/api/index.php/marketplace/' | 
                                                        |
| 148 | 148 |  		$this->dolistore_api_key = getDolGlobalString('MAIN_MODULE_DOLISTORE_API_KEY', 'dolistorepublicapi'); | 
                                                        
| 149 | -		$this->shop_url  = getDolGlobalString('MAIN_MODULE_DOLISTORE_SHOP_URL', 'https://www.dolistore.com'); | 
                                                        |
| 149 | +		$this->shop_url = getDolGlobalString('MAIN_MODULE_DOLISTORE_SHOP_URL', 'https://www.dolistore.com'); | 
                                                        |
| 150 | 150 | |
| 151 | 151 | // For community modules  | 
                                                        
| 152 | 152 | $this->file_source_url = "https://raw.githubusercontent.com/Dolibarr/dolibarr-community-modules/refs/heads/main/index.yaml";  | 
                                                        
@@ -210,12 +210,12 @@ discard block  | 
                                                    ||
| 210 | 210 | $httpheader[] = 'Authorization: Basic '.base64_encode($basicAuthLogin.':'.$basicAuthPassword);  | 
                                                        
| 211 | 211 | }  | 
                                                        
| 212 | 212 | |
| 213 | -		$url = $this->dolistore_api_url . (preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/') . $resource; | 
                                                        |
| 213 | +		$url = $this->dolistore_api_url.(preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/').$resource; | 
                                                        |
| 214 | 214 | |
| 215 | 215 | $options['apikey'] = $this->dolistore_api_key;  | 
                                                        
| 216 | 216 | |
| 217 | 217 |  		if ($options) { | 
                                                        
| 218 | - $url .= '?' . http_build_query($options);  | 
                                                        |
| 218 | + $url .= '?'.http_build_query($options);  | 
                                                        |
| 219 | 219 | }  | 
                                                        
| 220 | 220 | |
| 221 | 221 |  		$response = getURLContent($url, 'GET', '', 1, $httpheader, array('https'), 0, -1, 5, 5); | 
                                                        
@@ -257,13 +257,13 @@ discard block  | 
                                                    ||
| 257 | 257 | $modules = array();  | 
                                                        
| 258 | 258 | |
| 259 | 259 |  		if (!empty($this->cache_file) && file_exists($this->cache_file)) { | 
                                                        
| 260 | - dol_syslog(__METHOD__ . " - Loading cache file: " . $this->cache_file, LOG_DEBUG);  | 
                                                        |
| 260 | + dol_syslog(__METHOD__." - Loading cache file: ".$this->cache_file, LOG_DEBUG);  | 
                                                        |
| 261 | 261 | |
| 262 | 262 | $content = file_get_contents($this->cache_file);  | 
                                                        
| 263 | 263 |  			if ($content !== false) { | 
                                                        
| 264 | 264 | $modules = $this->readYaml($content);  | 
                                                        
| 265 | 265 |  			} else { | 
                                                        
| 266 | - dol_syslog(__METHOD__ . " - Error reading cache file", LOG_ERR);  | 
                                                        |
| 266 | + dol_syslog(__METHOD__." - Error reading cache file", LOG_ERR);  | 
                                                        |
| 267 | 267 | }  | 
                                                        
| 268 | 268 | }  | 
                                                        
| 269 | 269 | |
@@ -291,20 +291,20 @@ discard block  | 
                                                    ||
| 291 | 291 |  		if (isset($resCategories['response']) && is_array($resCategories['response'])) { | 
                                                        
| 292 | 292 | $organized_tree = $resCategories['response'];  | 
                                                        
| 293 | 293 |  		} else { | 
                                                        
| 294 | - return $html ;  | 
                                                        |
| 294 | + return $html;  | 
                                                        |
| 295 | 295 | }  | 
                                                        
| 296 | 296 | |
| 297 | 297 | $html = '';  | 
                                                        
| 298 | 298 |  		foreach ($organized_tree as $key => $value) { | 
                                                        
| 299 | 299 |  			if ($value['label'] != "Versions" && $value['label'] != "Specials") { | 
                                                        
| 300 | - $html .= '<li' . ($current == $value['rowid'] ? ' class="active"' : '') . '>';  | 
                                                        |
| 301 | - $html .= '<a href="?mode=marketplace&categorie=' . $value['rowid'] . '">' . $value['label'] . '</a>';  | 
                                                        |
| 300 | + $html .= '<li'.($current == $value['rowid'] ? ' class="active"' : '').'>';  | 
                                                        |
| 301 | + $html .= '<a href="?mode=marketplace&categorie='.$value['rowid'].'">'.$value['label'].'</a>';  | 
                                                        |
| 302 | 302 |  				if (isset($value['children'])) { | 
                                                        
| 303 | 303 | $html .= '<ul>';  | 
                                                        
| 304 | 304 |  					usort($value['children'], $this->buildSorter('position')); | 
                                                        
| 305 | 305 |  					foreach ($value['children'] as $key_children => $value_children) { | 
                                                        
| 306 | - $html .= '<li' . ($current == $value_children['rowid'] ? ' class="active"' : '') . '>';  | 
                                                        |
| 307 | - $html .= '<a href="?mode=marketplace&categorie=' . $value_children['rowid'] . '" title="' . dol_escape_htmltag(strip_tags($value_children['description'])) . '">' . $value_children['label'] . '</a>';  | 
                                                        |
| 306 | + $html .= '<li'.($current == $value_children['rowid'] ? ' class="active"' : '').'>';  | 
                                                        |
| 307 | + $html .= '<a href="?mode=marketplace&categorie='.$value_children['rowid'].'" title="'.dol_escape_htmltag(strip_tags($value_children['description'])).'">'.$value_children['label'].'</a>';  | 
                                                        |
| 308 | 308 | $html .= '</li>';  | 
                                                        
| 309 | 309 | }  | 
                                                        
| 310 | 310 | $html .= '</ul>';  | 
                                                        
@@ -329,7 +329,7 @@ discard block  | 
                                                    ||
| 329 | 329 | |
| 330 | 330 | $html = "";  | 
                                                        
| 331 | 331 | $last_month = dol_now() - (30 * 24 * 60 * 60);  | 
                                                        
| 332 | - $dolibarrversiontouse = DOL_VERSION; // full string with version  | 
                                                        |
| 332 | + $dolibarrversiontouse = DOL_VERSION; // full string with version  | 
                                                        |
| 333 | 333 | |
| 334 | 334 | $this->products = array();  | 
                                                        
| 335 | 335 | |
@@ -338,7 +338,7 @@ discard block  | 
                                                    ||
| 338 | 338 | $this->no_page = $options['no_page'] ?? 1;  | 
                                                        
| 339 | 339 | $this->search = $options['search'] ?? '';  | 
                                                        
| 340 | 340 | |
| 341 | - $this->per_page = 11; // We fix number of products per page to 11  | 
                                                        |
| 341 | + $this->per_page = 11; // We fix number of products per page to 11  | 
                                                        |
| 342 | 342 | |
| 343 | 343 | // Length of $search must be at least 2 characters  | 
                                                        
| 344 | 344 |  		if (!empty($this->search) && strlen(str_replace(' ', '', (string) $this->search)) < 2) { | 
                                                        
@@ -383,7 +383,7 @@ discard block  | 
                                                    ||
| 383 | 383 | $fileProducts = array();  | 
                                                        
| 384 | 384 | $fileProductsTotal = 0;  | 
                                                        
| 385 | 385 |  		if (!empty($this->githubFileStatus) && getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY')) { | 
                                                        
| 386 | - $fileProducts = $this->fetchModulesFromFile($data); // Return an array with all modules from the cache filecontent in $data  | 
                                                        |
| 386 | + $fileProducts = $this->fetchModulesFromFile($data); // Return an array with all modules from the cache filecontent in $data  | 
                                                        |
| 387 | 387 | |
| 388 | 388 | $fileProducts = $this->adaptData($fileProducts, 'githubcommunity');  | 
                                                        
| 389 | 389 | |
@@ -470,7 +470,7 @@ discard block  | 
                                                    ||
| 470 | 470 |  					$download_link .= img_picto('', 'file-code', 'class="size2x paddingright colorgrey"'); | 
                                                        
| 471 | 471 | $download_link .= '</a>';  | 
                                                        
| 472 | 472 | |
| 473 | - $urlview = $product["dolistore-download"]; // In a future, we will have the download to the zip file  | 
                                                        |
| 473 | + $urlview = $product["dolistore-download"]; // In a future, we will have the download to the zip file  | 
                                                        |
| 474 | 474 |  					if ($urlview) { | 
                                                        
| 475 | 475 |  						$download_link .= '<a class="paddingleft paddingright" target="_blank" title="'.$langs->trans("View").'" href="'.$urlview.'" rel="noopener noreferrer">'; | 
                                                        
| 476 | 476 |  						$download_link .= img_picto('', 'url', 'class="size2x"'); | 
                                                        
@@ -489,7 +489,7 @@ discard block  | 
                                                    ||
| 489 | 489 | }  | 
                                                        
| 490 | 490 |  				} elseif ($product['source'] === 'dolistore') { | 
                                                        
| 491 | 491 | $urlview = $this->shop_url.'/product.php?id='.((int) $product["id"]);  | 
                                                        
| 492 | - $urldownload = 'https://www.dolistore.com/_service_download.php?t=free&p=' . $product['id'];  | 
                                                        |
| 492 | + $urldownload = 'https://www.dolistore.com/_service_download.php?t=free&p='.$product['id'];  | 
                                                        |
| 493 | 493 |  					$download_link = '<a class="paddingleft paddingright" target="_blank" title="'.$langs->trans("View").'" href="'.$urlview.'">'; | 
                                                        
| 494 | 494 |  					$download_link .= img_picto('', 'url', 'class="size2x"'); | 
                                                        
| 495 | 495 | $download_link .= '</a>';  | 
                                                        
@@ -553,7 +553,7 @@ discard block  | 
                                                    ||
| 553 | 553 | |
| 554 | 554 | // Logo  | 
                                                        
| 555 | 555 | $html .= '<td class="center width150"><div class="newAppParent">';  | 
                                                        
| 556 | - $html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html  | 
                                                        |
| 556 | + $html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html  | 
                                                        |
| 557 | 557 | $html .= '</div></td>';  | 
                                                        
| 558 | 558 | |
| 559 | 559 | // Description  | 
                                                        
@@ -569,7 +569,7 @@ discard block  | 
                                                    ||
| 569 | 569 | $html .= '</small>';  | 
                                                        
| 570 | 570 | }  | 
                                                        
| 571 | 571 | $html .= '<br><small>';  | 
                                                        
| 572 | - $html .= $version; // Version Dolibarr. No dol_escape_htmltag, it is already escape html  | 
                                                        |
| 572 | + $html .= $version; // Version Dolibarr. No dol_escape_htmltag, it is already escape html  | 
                                                        |
| 573 | 573 | $html .= '</small>';  | 
                                                        
| 574 | 574 | $html .= '</h2>';  | 
                                                        
| 575 | 575 | |
@@ -629,7 +629,7 @@ discard block  | 
                                                    ||
| 629 | 629 | |
| 630 | 630 | $this->numberOfProducts = count($this->products);  | 
                                                        
| 631 | 631 | |
| 632 | - return $html ;  | 
                                                        |
| 632 | + return $html;  | 
                                                        |
| 633 | 633 | }  | 
                                                        
| 634 | 634 | |
| 635 | 635 | /**  | 
                                                        
@@ -646,7 +646,7 @@ discard block  | 
                                                    ||
| 646 | 646 | * @param array<string, mixed> $b  | 
                                                        
| 647 | 647 | * @return int  | 
                                                        
| 648 | 648 | */  | 
                                                        
| 649 | -		function (array $a, array $b) use ($key) { | 
                                                        |
| 649 | +		function(array $a, array $b) use ($key) { | 
                                                        |
| 650 | 650 | $valA = isset($a[$key]) && is_scalar($a[$key]) ? (string) $a[$key] : '';  | 
                                                        
| 651 | 651 | $valB = isset($b[$key]) && is_scalar($b[$key]) ? (string) $b[$key] : '';  | 
                                                        
| 652 | 652 | |
@@ -807,7 +807,7 @@ discard block  | 
                                                    ||
| 807 | 807 | $pagelist .= '<li class="pagination">';  | 
                                                        
| 808 | 808 | $pagelist .= '<label for="page_input">Page </label>';  | 
                                                        
| 809 | 809 |  				if ($this->categorie != 0) { | 
                                                        
| 810 | - $pagelist .= '<input type="hidden" name="categorie" value="' . $this->categorie . '">';  | 
                                                        |
| 810 | + $pagelist .= '<input type="hidden" name="categorie" value="'.$this->categorie.'">';  | 
                                                        |
| 811 | 811 | }  | 
                                                        
| 812 | 812 | $pagelist .= '<input type="text" id="page_input" name="no_page" value="'.($page).'" min="1" max="'.$nbpages.'" class="width40 page_input right" oninput="if(this.value > '.$nbpages.') this.value='.$nbpages.'">';  | 
                                                        
| 813 | 813 | $pagelist .= ' / '.$nbpages;  | 
                                                        
@@ -857,17 +857,17 @@ discard block  | 
                                                    ||
| 857 | 857 | }  | 
                                                        
| 858 | 858 | |
| 859 | 859 | // Get the predefined error message or use a default one  | 
                                                        
| 860 | - $error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: ' . $request['status_code'];  | 
                                                        |
| 860 | + $error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: '.$request['status_code'];  | 
                                                        |
| 861 | 861 | |
| 862 | 862 | // Append error details if available  | 
                                                        
| 863 | 863 |  		if (!empty($request['response']) && isset($request['response']['errors']) && is_array($request['response']['errors'])) { | 
                                                        
| 864 | 864 |  			foreach ($request['response']['errors'] as $error) { | 
                                                        
| 865 | - $error_message .= ' - (Code ' . $error['code'] . '): ' . $error['message'];  | 
                                                        |
| 865 | + $error_message .= ' - (Code '.$error['code'].'): '.$error['message'];  | 
                                                        |
| 866 | 866 | }  | 
                                                        
| 867 | 867 | }  | 
                                                        
| 868 | 868 | |
| 869 | 869 |  		if (!empty($request['curl_error_msg'])) { | 
                                                        
| 870 | - $error_message .= ' - ' . $request['curl_error_msg'];  | 
                                                        |
| 870 | + $error_message .= ' - '.$request['curl_error_msg'];  | 
                                                        |
| 871 | 871 | }  | 
                                                        
| 872 | 872 | |
| 873 | 873 | // Return the formatted error message  | 
                                                        
@@ -895,12 +895,12 @@ discard block  | 
                                                    ||
| 895 | 895 |  		if (!file_exists($cache_file) || filemtime($cache_file) < (dol_now() - $cache_time)) { | 
                                                        
| 896 | 896 | // We get remote url  | 
                                                        
| 897 | 897 | $addheaders = array();  | 
                                                        
| 898 | - $result = getURLContent($file_source_url, 'GET', '', 1, $addheaders); // TODO Force timeout to 5 s on both connect and response.  | 
                                                        |
| 898 | + $result = getURLContent($file_source_url, 'GET', '', 1, $addheaders); // TODO Force timeout to 5 s on both connect and response.  | 
                                                        |
| 899 | 899 |  			if (!empty($result) && $result['http_code'] == 200) { | 
                                                        
| 900 | 900 | $yaml = $result['content'];  | 
                                                        
| 901 | 901 | $result = file_put_contents($cache_file, $yaml);  | 
                                                        
| 902 | 902 |  				if ($result === false) { | 
                                                        
| 903 | - $this->error = 'Failed to create cache file: ' . $cache_file;  | 
                                                        |
| 903 | + $this->error = 'Failed to create cache file: '.$cache_file;  | 
                                                        |
| 904 | 904 | }  | 
                                                        
| 905 | 905 | }  | 
                                                        
| 906 | 906 |  		} else { | 
                                                        
@@ -1012,7 +1012,7 @@ discard block  | 
                                                    ||
| 1012 | 1012 | |
| 1013 | 1013 | $adaptedPackage = [  | 
                                                        
| 1014 | 1014 | 'id' => $id,  | 
                                                        
| 1015 | -					'ref' => str_replace(' ', '', $package['modulename'] . '-' . $package['current_version'] . '@' . | 
                                                        |
| 1015 | +					'ref' => str_replace(' ', '', $package['modulename'].'-'.$package['current_version'].'@'. | 
                                                        |
| 1016 | 1016 |  						(array_key_exists('author', $package) ? $package['author'] : 'unkownauthor')), | 
                                                        
| 1017 | 1017 | 'label' => !empty($package['label'][substr($this->lang, 0, 2)])  | 
                                                        
| 1018 | 1018 | ? $package['label'][substr($this->lang, 0, 2)]  | 
                                                        
@@ -1128,7 +1128,7 @@ discard block  | 
                                                    ||
| 1128 | 1128 | *  | 
                                                        
| 1129 | 1129 | * @return int  | 
                                                        
| 1130 | 1130 | */  | 
                                                        
| 1131 | -			static function ($a, $b) { | 
                                                        |
| 1131 | +			static function($a, $b) { | 
                                                        |
| 1132 | 1132 | return strtotime($b['datec'] ?? '0') - strtotime($a['datec'] ?? '0');  | 
                                                        
| 1133 | 1133 | }  | 
                                                        
| 1134 | 1134 | );  | 
                                                        
@@ -1143,7 +1143,7 @@ discard block  | 
                                                    ||
| 1143 | 1143 | *  | 
                                                        
| 1144 | 1144 | * @return bool  | 
                                                        
| 1145 | 1145 | */  | 
                                                        
| 1146 | -				static function ($package) use ($options) { | 
                                                        |
| 1146 | +				static function($package) use ($options) { | 
                                                        |
| 1147 | 1147 | return stripos($package['label'], $options['search']) !== false || stripos($package['description'], $options['search']) !== false;  | 
                                                        
| 1148 | 1148 | }  | 
                                                        
| 1149 | 1149 | );  | 
                                                        
@@ -1159,7 +1159,7 @@ discard block  | 
                                                    ||
| 1159 | 1159 | *  | 
                                                        
| 1160 | 1160 | * @return bool  | 
                                                        
| 1161 | 1161 | */  | 
                                                        
| 1162 | -				static function ($package) use ($options) { | 
                                                        |
| 1162 | +				static function($package) use ($options) { | 
                                                        |
| 1163 | 1163 | return in_array($options['categorieid'], $package['category']);  | 
                                                        
| 1164 | 1164 | }  | 
                                                        
| 1165 | 1165 | );  | 
                                                        
@@ -34,11 +34,11 @@ discard block  | 
                                                    ||
| 34 | 34 | * @var Translate $langs  | 
                                                        
| 35 | 35 | * @var User $user  | 
                                                        
| 36 | 36 | */  | 
                                                        
| 37 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';  | 
                                                        |
| 38 | -require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';  | 
                                                        |
| 39 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/expedition.lib.php';  | 
                                                        |
| 40 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 41 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/sendings.lib.php';  | 
                                                        |
| 37 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';  | 
                                                        |
| 38 | +require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';  | 
                                                        |
| 39 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php';  | 
                                                        |
| 40 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 41 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';  | 
                                                        |
| 42 | 42 | |
| 43 | 43 | // Load translation files required by the page  | 
                                                        
| 44 | 44 |  $langs->load("sendings"); | 
                                                        
@@ -121,11 +121,11 @@ discard block  | 
                                                    ||
| 121 | 121 | */  | 
                                                        
| 122 | 122 | |
| 123 | 123 | $form = new Form($db);  | 
                                                        
| 124 | -$agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/' . $langs->trans("Agenda") : ''; | 
                                                        |
| 125 | -$title = $langs->trans('Events') . $agenda . ' - ' . $object->ref; // Shipping uses ref primarily | 
                                                        |
| 124 | +$agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; | 
                                                        |
| 125 | +$title = $langs->trans('Events').$agenda.' - '.$object->ref; // Shipping uses ref primarily | 
                                                        |
| 126 | 126 | |
| 127 | 127 |  if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/shippingrefonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->ref) { // New constant or fallback | 
                                                        
| 128 | -	$title = $object->ref . ' - ' . $langs->trans("Info"); | 
                                                        |
| 128 | +	$title = $object->ref.' - '.$langs->trans("Info"); | 
                                                        |
| 129 | 129 | }  | 
                                                        
| 130 | 130 | $help_url = "EN:Module_Shippings|FR:Module_Expeditions|ES:Módulo_Expediciones";  | 
                                                        
| 131 | 131 |  llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-shipping page-card_messaging'); | 
                                                        
@@ -140,9 +140,9 @@ discard block  | 
                                                    ||
| 140 | 140 |  if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['expedition'])) { | 
                                                        
| 141 | 141 | $tmpurl = $_SESSION['pageforbacktolist']['expedition'];  | 
                                                        
| 142 | 142 |  	$tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); | 
                                                        
| 143 | -	$linkback = '<a href="' . $tmpurl . (preg_match('/\?/', $tmpurl) ? '&' : '?') . 'restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; | 
                                                        |
| 143 | +	$linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; | 
                                                        |
| 144 | 144 |  } else { | 
                                                        
| 145 | -	$linkback = '<a href="' . DOL_URL_ROOT . '/expedition/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; | 
                                                        |
| 145 | +	$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; | 
                                                        |
| 146 | 146 | }  | 
                                                        
| 147 | 147 | |
| 148 | 148 | $morehtmlref = '<div class="refidno">';  | 
                                                        
@@ -150,7 +150,7 @@ discard block  | 
                                                    ||
| 150 | 150 | $morehtmlref .= $object->ref;  | 
                                                        
| 151 | 151 | // Thirdparty  | 
                                                        
| 152 | 152 |  if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { | 
                                                        
| 153 | - $morehtmlref .= '<br>' . $object->thirdparty->getNomUrl(1, 'shipping');  | 
                                                        |
| 153 | + $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'shipping');  | 
                                                        |
| 154 | 154 | }  | 
                                                        
| 155 | 155 | $morehtmlref .= '</div>';  | 
                                                        
| 156 | 156 | |
@@ -177,7 +177,7 @@ discard block  | 
                                                    ||
| 177 | 177 | $out = '';  | 
                                                        
| 178 | 178 |  $permok = $user->hasRight('agenda', 'myactions', 'create'); | 
                                                        
| 179 | 179 |  if ($permok) { | 
                                                        
| 180 | - $out .= '&shippingid=' . $object->id;  | 
                                                        |
| 180 | + $out .= '&shippingid='.$object->id;  | 
                                                        |
| 181 | 181 | }  | 
                                                        
| 182 | 182 | |
| 183 | 183 | |
@@ -188,35 +188,35 @@ discard block  | 
                                                    ||
| 188 | 188 | $morehtmlright = '';  | 
                                                        
| 189 | 189 | |
| 190 | 190 | // Show link to change view in message  | 
                                                        
| 191 | - $messagingUrl = DOL_URL_ROOT . '/expedition/messaging.php?id=' . $object->id;  | 
                                                        |
| 191 | + $messagingUrl = DOL_URL_ROOT.'/expedition/messaging.php?id='.$object->id;  | 
                                                        |
| 192 | 192 |  	$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2); // Status 2 for "current page" | 
                                                        
| 193 | 193 | |
| 194 | 194 | // Show link to change view in agenda  | 
                                                        
| 195 | - $messagingUrl = DOL_URL_ROOT . '/expedition/agenda.php?id=' . $object->id;  | 
                                                        |
| 195 | + $messagingUrl = DOL_URL_ROOT.'/expedition/agenda.php?id='.$object->id;  | 
                                                        |
| 196 | 196 |  	$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); // Status 1 for "not current page" | 
                                                        
| 197 | 197 | |
| 198 | 198 | |
| 199 | 199 | // Show link to add event  | 
                                                        
| 200 | 200 |  	if (isModEnabled('agenda')) { | 
                                                        
| 201 | 201 |  		$addActionBtnRight = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); | 
                                                        
| 202 | -		$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT . '/comm/action/card.php?action=create' . $out . '&socid=' . $object->socid . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id), '', (int) $addActionBtnRight); | 
                                                        |
| 202 | +		$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', (int) $addActionBtnRight); | 
                                                        |
| 203 | 203 | }  | 
                                                        
| 204 | 204 | |
| 205 | - $param = '&id=' . $object->id;  | 
                                                        |
| 205 | + $param = '&id='.$object->id;  | 
                                                        |
| 206 | 206 |  	if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { | 
                                                        
| 207 | - $param .= '&contextpage=' . urlencode($contextpage);  | 
                                                        |
| 207 | + $param .= '&contextpage='.urlencode($contextpage);  | 
                                                        |
| 208 | 208 | }  | 
                                                        
| 209 | 209 |  	if ($limit > 0 && $limit != $conf->liste_limit) { | 
                                                        
| 210 | - $param .= '&limit=' . ((int) $limit);  | 
                                                        |
| 210 | + $param .= '&limit='.((int) $limit);  | 
                                                        |
| 211 | 211 | }  | 
                                                        
| 212 | 212 | |
| 213 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';  | 
                                                        |
| 214 | - $cachekey = 'count_events_expedition_' . $object->id;  | 
                                                        |
| 213 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';  | 
                                                        |
| 214 | + $cachekey = 'count_events_expedition_'.$object->id;  | 
                                                        |
| 215 | 215 | $nbEvent = dol_getcache($cachekey);  | 
                                                        
| 216 | 216 | |
| 217 | -	$titlelist = $langs->trans("ActionsOnShipping") . (is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">(' . $nbEvent . ')</span>' : ''); | 
                                                        |
| 217 | +	$titlelist = $langs->trans("ActionsOnShipping").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : ''); | 
                                                        |
| 218 | 218 |  	if (!empty($conf->dol_optimize_smallscreen)) { | 
                                                        
| 219 | -		$titlelist = $langs->trans("Actions") . (is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">(' . $nbEvent . ')</span>' : ''); | 
                                                        |
| 219 | +		$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : ''); | 
                                                        |
| 220 | 220 | }  | 
                                                        
| 221 | 221 | |
| 222 | 222 | print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);  | 
                                                        
@@ -34,16 +34,16 @@ discard block  | 
                                                    ||
| 34 | 34 | * @var Translate $langs  | 
                                                        
| 35 | 35 | * @var User $user  | 
                                                        
| 36 | 36 | */  | 
                                                        
| 37 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';  | 
                                                        |
| 38 | -require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 39 | -require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';  | 
                                                        |
| 40 | -require_once DOL_DOCUMENT_ROOT . '/core/modules/expedition/modules_expedition.php';  | 
                                                        |
| 41 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/sendings.lib.php';  | 
                                                        |
| 37 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';  | 
                                                        |
| 38 | +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 39 | +require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';  | 
                                                        |
| 40 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';  | 
                                                        |
| 41 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';  | 
                                                        |
| 42 | 42 | |
| 43 | -require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 44 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 45 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/expedition.lib.php';  | 
                                                        |
| 46 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';  | 
                                                        |
| 43 | +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 44 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 45 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php';  | 
                                                        |
| 46 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';  | 
                                                        |
| 47 | 47 | |
| 48 | 48 | // Load translation files required by the page  | 
                                                        
| 49 | 49 |  $langs->loadLangs(array("sendings", "other")); | 
                                                        
@@ -124,11 +124,11 @@ discard block  | 
                                                    ||
| 124 | 124 | */  | 
                                                        
| 125 | 125 | |
| 126 | 126 | $form = new Form($db);  | 
                                                        
| 127 | -$agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/' . $langs->trans("Agenda") : ''; | 
                                                        |
| 128 | -$title = $langs->trans('Events') . $agenda . ' - ' . $object->ref; // Shipping uses ref primarily | 
                                                        |
| 127 | +$agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; | 
                                                        |
| 128 | +$title = $langs->trans('Events').$agenda.' - '.$object->ref; // Shipping uses ref primarily | 
                                                        |
| 129 | 129 | |
| 130 | 130 |  if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/shippingrefonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->ref) { // New constant or fallback | 
                                                        
| 131 | -	$title = $object->ref . ' - ' . $langs->trans("Info"); | 
                                                        |
| 131 | +	$title = $object->ref.' - '.$langs->trans("Info"); | 
                                                        |
| 132 | 132 | }  | 
                                                        
| 133 | 133 | $help_url = "EN:Module_Shippings|FR:Module_Expeditions|ES:Módulo_Expediciones";  | 
                                                        
| 134 | 134 |  llxHeader("", $title, $help_url, '', 0, 0, '', '', '', 'mod-shipping page-card_agenda'); | 
                                                        
@@ -142,9 +142,9 @@ discard block  | 
                                                    ||
| 142 | 142 |  if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['expedition'])) { | 
                                                        
| 143 | 143 | $tmpurl = $_SESSION['pageforbacktolist']['expedition'];  | 
                                                        
| 144 | 144 |  	$tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); | 
                                                        
| 145 | -	$linkback = '<a href="' . $tmpurl . (preg_match('/\?/', $tmpurl) ? '&' : '?') . 'restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; | 
                                                        |
| 145 | +	$linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; | 
                                                        |
| 146 | 146 |  } else { | 
                                                        
| 147 | -	$linkback = '<a href="' . DOL_URL_ROOT . '/expedition/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>'; // Changed from commande | 
                                                        |
| 147 | +	$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; // Changed from commande | 
                                                        |
| 148 | 148 | }  | 
                                                        
| 149 | 149 | |
| 150 | 150 | $morehtmlref = '<div class="refidno">';  | 
                                                        
@@ -152,7 +152,7 @@ discard block  | 
                                                    ||
| 152 | 152 | $morehtmlref .= $object->ref;  | 
                                                        
| 153 | 153 | // Thirdparty  | 
                                                        
| 154 | 154 |  if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { | 
                                                        
| 155 | - $morehtmlref .= '<br>' . $object->thirdparty->getNomUrl(1, 'shipping');  | 
                                                        |
| 155 | + $morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'shipping');  | 
                                                        |
| 156 | 156 | }  | 
                                                        
| 157 | 157 | // Project - Keep as is if shipping can be linked to projects  | 
                                                        
| 158 | 158 |  if (isModEnabled('project')) { | 
                                                        
@@ -163,7 +163,7 @@ discard block  | 
                                                    ||
| 163 | 163 | $proj->fetch($object->fk_project);  | 
                                                        
| 164 | 164 | $morehtmlref .= $proj->getNomUrl(1);  | 
                                                        
| 165 | 165 |  		if ($proj->title) { | 
                                                        
| 166 | - $morehtmlref .= '<span class="opacitymedium"> - ' . dol_escape_htmltag($proj->title) . '</span>';  | 
                                                        |
| 166 | + $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';  | 
                                                        |
| 167 | 167 | }  | 
                                                        
| 168 | 168 | }  | 
                                                        
| 169 | 169 | }  | 
                                                        
@@ -191,7 +191,7 @@ discard block  | 
                                                    ||
| 191 | 191 | $out = '';  | 
                                                        
| 192 | 192 |  $permok = $user->hasRight('agenda', 'myactions', 'create'); | 
                                                        
| 193 | 193 |  if ($permok) { | 
                                                        
| 194 | - $out .= '&shippingid=' . $object->id;  | 
                                                        |
| 194 | + $out .= '&shippingid='.$object->id;  | 
                                                        |
| 195 | 195 | }  | 
                                                        
| 196 | 196 | |
| 197 | 197 | |
@@ -201,35 +201,35 @@ discard block  | 
                                                    ||
| 201 | 201 | $morehtmlright = '';  | 
                                                        
| 202 | 202 | |
| 203 | 203 | // Show link to change view in message  | 
                                                        
| 204 | - $messagingUrl = DOL_URL_ROOT . '/expedition/messaging.php?id=' . $object->id;  | 
                                                        |
| 204 | + $messagingUrl = DOL_URL_ROOT.'/expedition/messaging.php?id='.$object->id;  | 
                                                        |
| 205 | 205 |  	$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); | 
                                                        
| 206 | 206 | |
| 207 | 207 | // Show link to change view in agenda  | 
                                                        
| 208 | - $messagingUrl = DOL_URL_ROOT . '/expedition/agenda.php?id=' . $object->id;  | 
                                                        |
| 208 | + $messagingUrl = DOL_URL_ROOT.'/expedition/agenda.php?id='.$object->id;  | 
                                                        |
| 209 | 209 |  	$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); | 
                                                        
| 210 | 210 | |
| 211 | 211 | |
| 212 | 212 | // Show link to add event  | 
                                                        
| 213 | 213 |  	if (isModEnabled('agenda')) { | 
                                                        
| 214 | 214 |  		$addActionBtnRight = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); | 
                                                        
| 215 | -		$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT . '/comm/action/card.php?action=create' . $out . '&socid=' . $object->socid . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id), '', (int) $addActionBtnRight); | 
                                                        |
| 215 | +		$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', (int) $addActionBtnRight); | 
                                                        |
| 216 | 216 | }  | 
                                                        
| 217 | 217 | |
| 218 | - $param = '&id=' . $object->id;  | 
                                                        |
| 218 | + $param = '&id='.$object->id;  | 
                                                        |
| 219 | 219 |  	if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { | 
                                                        
| 220 | - $param .= '&contextpage=' . urlencode($contextpage);  | 
                                                        |
| 220 | + $param .= '&contextpage='.urlencode($contextpage);  | 
                                                        |
| 221 | 221 | }  | 
                                                        
| 222 | 222 |  	if ($limit > 0 && $limit != $conf->liste_limit) { | 
                                                        
| 223 | - $param .= '&limit=' . ((int) $limit);  | 
                                                        |
| 223 | + $param .= '&limit='.((int) $limit);  | 
                                                        |
| 224 | 224 | }  | 
                                                        
| 225 | 225 | |
| 226 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';  | 
                                                        |
| 227 | - $cachekey = 'count_events_expedition_' . $object->id;  | 
                                                        |
| 226 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';  | 
                                                        |
| 227 | + $cachekey = 'count_events_expedition_'.$object->id;  | 
                                                        |
| 228 | 228 | $nbEvent = dol_getcache($cachekey);  | 
                                                        
| 229 | 229 | |
| 230 | -	$titlelist = $langs->trans("ActionsOnShipping") . (is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">(' . $nbEvent . ')</span>' : ''); | 
                                                        |
| 230 | +	$titlelist = $langs->trans("ActionsOnShipping").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : ''); | 
                                                        |
| 231 | 231 |  	if (!empty($conf->dol_optimize_smallscreen)) { | 
                                                        
| 232 | -		$titlelist = $langs->trans("Actions") . (is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">(' . $nbEvent . ')</span>' : ''); | 
                                                        |
| 232 | +		$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : ''); | 
                                                        |
| 233 | 233 | }  | 
                                                        
| 234 | 234 | |
| 235 | 235 | print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);  |