@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | |
| 120 | 120 | $parameters = array(); |
| 121 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 121 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 122 | 122 | // Delete Link |
| 123 | 123 | $permissiondellink = $user->hasRight('expedition', 'delivery', 'supprimer'); // Used by the include of actions_dellink.inc.php |
| 124 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
| 124 | +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
| 125 | 125 | |
| 126 | 126 | if ($action == 'add' && $permissiontoadd) { |
| 127 | 127 | $array_options = array(); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $object->date_delivery = dol_now(); |
| 131 | 131 | $object->note_private = GETPOST("note", 'restricthtml'); |
| 132 | - $object->note = $object->note_private; // deprecated |
|
| 132 | + $object->note = $object->note_private; // deprecated |
|
| 133 | 133 | $object->commande_id = GETPOSTINT("commande_id"); |
| 134 | 134 | $object->fk_incoterms = GETPOSTINT('incoterm_id'); |
| 135 | 135 | // $object->entrepot_id = GETPOST('entrepot_id', 'int'); entrepot_id does not exists on delivery note, only on shipment document |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | // Update extrafields |
| 220 | 220 | if ($action == 'update_extras' && $permissiontoeditextra) { |
| 221 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 221 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 222 | 222 | |
| 223 | 223 | $attribute_name = GETPOST('attribute', 'aZ09'); |
| 224 | 224 | |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | $paramname = 'id'; |
| 286 | 286 | $autocopy = 'MAIN_MAIL_AUTOCOPY_DELIVERY_TO'; |
| 287 | 287 | $mode = 'emailfromdelivery'; |
| 288 | -$trackid = 'del' . $object->id; |
|
| 289 | -include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; |
|
| 288 | +$trackid = 'del'.$object->id; |
|
| 289 | +include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; |
|
| 290 | 290 | |
| 291 | 291 | |
| 292 | 292 | /* |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | $morehtmlref = '<div class="refidno">'; |
| 367 | 367 | // Ref customer shipment |
| 368 | 368 | $morehtmlref .= $form->editfieldkey("RefCustomer", '', $expedition->ref_customer, $expedition, $user->hasRight('expedition', 'creer'), 'string', '', 0, 1); |
| 369 | - $morehtmlref .= $form->editfieldval("RefCustomer", '', $expedition->ref_customer, $expedition, $user->hasRight('expedition', 'creer'), 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
| 369 | + $morehtmlref .= $form->editfieldval("RefCustomer", '', $expedition->ref_customer, $expedition, $user->hasRight('expedition', 'creer'), 'string'.(getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
| 370 | 370 | $morehtmlref .= '<br>'.$langs->trans("RefDeliveryReceipt").' : '.$object->ref; |
| 371 | 371 | // Thirdparty |
| 372 | 372 | $morehtmlref .= '<br>'.$expedition->thirdparty->getNomUrl(1); |
@@ -758,8 +758,8 @@ discard block |
||
| 758 | 758 | // Presend form |
| 759 | 759 | $modelmail = 'delivery_send'; |
| 760 | 760 | $defaulttopic = 'SendDeliveryRef'; |
| 761 | - $diroutput = $conf->expedition->dir_output . '/receipt'; |
|
| 762 | - $trackid = 'del' . $object->id; |
|
| 761 | + $diroutput = $conf->expedition->dir_output.'/receipt'; |
|
| 762 | + $trackid = 'del'.$object->id; |
|
| 763 | 763 | |
| 764 | 764 | include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; |
| 765 | 765 | } |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | $this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace'; |
| 150 | 150 | |
| 151 | 151 | // For dolistore modules |
| 152 | - $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/' |
|
| 152 | + $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/' |
|
| 153 | 153 | $this->dolistore_api_key = getDolGlobalString('MAIN_MODULE_DOLISTORE_API_KEY', 'dolistorepublicapi'); |
| 154 | - $this->shop_url = getDolGlobalString('MAIN_MODULE_DOLISTORE_SHOP_URL', 'https://www.dolistore.com'); |
|
| 154 | + $this->shop_url = getDolGlobalString('MAIN_MODULE_DOLISTORE_SHOP_URL', 'https://www.dolistore.com'); |
|
| 155 | 155 | |
| 156 | 156 | // For community modules |
| 157 | 157 | $this->file_source_url = "https://raw.githubusercontent.com/Dolibarr/dolibarr-community-modules/refs/heads/main/index.yaml"; |
@@ -215,12 +215,12 @@ discard block |
||
| 215 | 215 | $httpheader[] = 'Authorization: Basic '.base64_encode($basicAuthLogin.':'.$basicAuthPassword); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $url = $this->dolistore_api_url . (preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/') . $resource; |
|
| 218 | + $url = $this->dolistore_api_url.(preg_match('/\/$/', $this->dolistore_api_url) ? '' : '/').$resource; |
|
| 219 | 219 | |
| 220 | 220 | $options['apikey'] = $this->dolistore_api_key; |
| 221 | 221 | |
| 222 | 222 | if ($options) { |
| 223 | - $url .= '?' . http_build_query($options); |
|
| 223 | + $url .= '?'.http_build_query($options); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $response = getURLContent($url, 'GET', '', 1, $httpheader, array('https'), 0, -1, 5, 5); |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | $modules = array(); |
| 263 | 263 | |
| 264 | 264 | if (!empty($this->cache_file) && file_exists($this->cache_file)) { |
| 265 | - dol_syslog(__METHOD__ . " - Loading cache file: " . $this->cache_file, LOG_DEBUG); |
|
| 265 | + dol_syslog(__METHOD__." - Loading cache file: ".$this->cache_file, LOG_DEBUG); |
|
| 266 | 266 | |
| 267 | 267 | $content = file_get_contents($this->cache_file); |
| 268 | 268 | if ($content !== false) { |
| 269 | 269 | $modules = $this->readYaml($content); |
| 270 | 270 | } else { |
| 271 | - dol_syslog(__METHOD__ . " - Error reading cache file", LOG_ERR); |
|
| 271 | + dol_syslog(__METHOD__." - Error reading cache file", LOG_ERR); |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
@@ -296,20 +296,20 @@ discard block |
||
| 296 | 296 | if (isset($resCategories['response']) && is_array($resCategories['response'])) { |
| 297 | 297 | $organized_tree = $resCategories['response']; |
| 298 | 298 | } else { |
| 299 | - return $html ; |
|
| 299 | + return $html; |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | $html = ''; |
| 303 | 303 | foreach ($organized_tree as $key => $value) { |
| 304 | 304 | if ($value['label'] != "Versions" && $value['label'] != "Specials") { |
| 305 | - $html .= '<li' . ($current == $value['rowid'] ? ' class="active"' : '') . '>'; |
|
| 306 | - $html .= '<a href="?mode=marketplace&categorie=' . $value['rowid'] . '">' . $value['label'] . '</a>'; |
|
| 305 | + $html .= '<li'.($current == $value['rowid'] ? ' class="active"' : '').'>'; |
|
| 306 | + $html .= '<a href="?mode=marketplace&categorie='.$value['rowid'].'">'.$value['label'].'</a>'; |
|
| 307 | 307 | if (isset($value['children'])) { |
| 308 | 308 | $html .= '<ul>'; |
| 309 | 309 | usort($value['children'], $this->buildSorter('position')); |
| 310 | 310 | foreach ($value['children'] as $key_children => $value_children) { |
| 311 | - $html .= '<li' . ($current == $value_children['rowid'] ? ' class="active"' : '') . '>'; |
|
| 312 | - $html .= '<a href="?mode=marketplace&categorie=' . $value_children['rowid'] . '" title="' . dol_escape_htmltag(strip_tags($value_children['description'])) . '">' . $value_children['label'] . '</a>'; |
|
| 311 | + $html .= '<li'.($current == $value_children['rowid'] ? ' class="active"' : '').'>'; |
|
| 312 | + $html .= '<a href="?mode=marketplace&categorie='.$value_children['rowid'].'" title="'.dol_escape_htmltag(strip_tags($value_children['description'])).'">'.$value_children['label'].'</a>'; |
|
| 313 | 313 | $html .= '</li>'; |
| 314 | 314 | } |
| 315 | 315 | $html .= '</ul>'; |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | $html = ""; |
| 336 | 336 | $last_month = dol_now() - (30 * 24 * 60 * 60); |
| 337 | - $dolibarrversiontouse = DOL_VERSION; // full string with version |
|
| 337 | + $dolibarrversiontouse = DOL_VERSION; // full string with version |
|
| 338 | 338 | |
| 339 | 339 | $this->products = array(); |
| 340 | 340 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | $this->no_page = $options['no_page'] ?? 1; |
| 344 | 344 | $this->search = $options['search'] ?? ''; |
| 345 | 345 | |
| 346 | - $this->per_page = 11; // We fix number of products per page to 11 |
|
| 346 | + $this->per_page = 11; // We fix number of products per page to 11 |
|
| 347 | 347 | |
| 348 | 348 | // Length of $search must be at least 2 characters |
| 349 | 349 | if (!empty($this->search) && strlen(str_replace(' ', '', (string) $this->search)) < 2) { |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | $fileProducts = array(); |
| 405 | 405 | $fileProductsTotal = 0; |
| 406 | 406 | if (!empty($this->githubFileStatus) && getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY')) { |
| 407 | - $fileProducts = $this->fetchModulesFromFile($data); // Return an array with all modules from the cache filecontent in $data |
|
| 407 | + $fileProducts = $this->fetchModulesFromFile($data); // Return an array with all modules from the cache filecontent in $data |
|
| 408 | 408 | |
| 409 | 409 | $fileProducts = $this->adaptData($fileProducts, 'githubcommunity'); |
| 410 | 410 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $download_link .= img_picto('', 'file-code', 'class="size2x paddingright colorgrey"'); |
| 496 | 496 | $download_link .= '</a>'; |
| 497 | 497 | |
| 498 | - $urlview = $product["dolistore-download"]; // In a future, we will have the download to the zip file |
|
| 498 | + $urlview = $product["dolistore-download"]; // In a future, we will have the download to the zip file |
|
| 499 | 499 | if ($urlview) { |
| 500 | 500 | $download_link .= '<a class="paddingleft paddingright" target="_blank" title="'.$langs->trans("View").'" href="'.$urlview.'" rel="noopener noreferrer">'; |
| 501 | 501 | $download_link .= img_picto('', 'url', 'class="size2x"'); |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | } |
| 515 | 515 | } elseif ($product['source'] === 'dolistore') { |
| 516 | 516 | $urlview = $this->shop_url.'/product.php?id='.((int) $product["id"]); |
| 517 | - $urldownload = 'https://www.dolistore.com/_service_download.php?t=free&p=' . $product['id']; |
|
| 517 | + $urldownload = 'https://www.dolistore.com/_service_download.php?t=free&p='.$product['id']; |
|
| 518 | 518 | $download_link = '<a class="paddingleft paddingright" target="_blank" title="'.$langs->trans("View").'" href="'.$urlview.'">'; |
| 519 | 519 | $download_link .= img_picto('', 'url', 'class="size2x"'); |
| 520 | 520 | $download_link .= '</a>'; |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | // Logo |
| 580 | 580 | $html .= '<td class="center width150"><div class="newAppParent">'; |
| 581 | - $html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html |
|
| 581 | + $html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html |
|
| 582 | 582 | $html .= '</div></td>'; |
| 583 | 583 | |
| 584 | 584 | // Description |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | $html .= '</small>'; |
| 595 | 595 | } |
| 596 | 596 | $html .= '<br><small>'; |
| 597 | - $html .= $version; // Version Dolibarr. No dol_escape_htmltag, it is already escape html |
|
| 597 | + $html .= $version; // Version Dolibarr. No dol_escape_htmltag, it is already escape html |
|
| 598 | 598 | $html .= '</small>'; |
| 599 | 599 | $html .= '</h2>'; |
| 600 | 600 | |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | * @param array<string, mixed> $b |
| 672 | 672 | * @return int |
| 673 | 673 | */ |
| 674 | - function (array $a, array $b) use ($key) { |
|
| 674 | + function(array $a, array $b) use ($key) { |
|
| 675 | 675 | $valA = isset($a[$key]) && is_scalar($a[$key]) ? (string) $a[$key] : ''; |
| 676 | 676 | $valB = isset($b[$key]) && is_scalar($b[$key]) ? (string) $b[$key] : ''; |
| 677 | 677 | |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | $pagelist .= '<li class="pagination">'; |
| 833 | 833 | $pagelist .= '<label for="page_input">Page </label>'; |
| 834 | 834 | if ($this->categorie != 0) { |
| 835 | - $pagelist .= '<input type="hidden" name="categorie" value="' . $this->categorie . '">'; |
|
| 835 | + $pagelist .= '<input type="hidden" name="categorie" value="'.$this->categorie.'">'; |
|
| 836 | 836 | } |
| 837 | 837 | $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.'">'; |
| 838 | 838 | $pagelist .= ' / '.$nbpages; |
@@ -882,17 +882,17 @@ discard block |
||
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | // Get the predefined error message or use a default one |
| 885 | - $error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: ' . $request['status_code']; |
|
| 885 | + $error_message = $error_messages[$request['status_code']] ?? 'Unexpected HTTP status: '.$request['status_code']; |
|
| 886 | 886 | |
| 887 | 887 | // Append error details if available |
| 888 | 888 | if (!empty($request['response']) && isset($request['response']['errors']) && is_array($request['response']['errors'])) { |
| 889 | 889 | foreach ($request['response']['errors'] as $error) { |
| 890 | - $error_message .= ' - (Code ' . $error['code'] . '): ' . $error['message']; |
|
| 890 | + $error_message .= ' - (Code '.$error['code'].'): '.$error['message']; |
|
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | if (!empty($request['curl_error_msg'])) { |
| 895 | - $error_message .= ' - ' . $request['curl_error_msg']; |
|
| 895 | + $error_message .= ' - '.$request['curl_error_msg']; |
|
| 896 | 896 | } |
| 897 | 897 | |
| 898 | 898 | // Return the formatted error message |
@@ -920,12 +920,12 @@ discard block |
||
| 920 | 920 | if (!file_exists($cache_file) || filemtime($cache_file) < (dol_now() - $cache_time)) { |
| 921 | 921 | // We get remote url |
| 922 | 922 | $addheaders = array(); |
| 923 | - $result = getURLContent($file_source_url, 'GET', '', 1, $addheaders); // TODO Force timeout to 5 s on both connect and response. |
|
| 923 | + $result = getURLContent($file_source_url, 'GET', '', 1, $addheaders); // TODO Force timeout to 5 s on both connect and response. |
|
| 924 | 924 | if (!empty($result) && $result['http_code'] == 200) { |
| 925 | 925 | $yaml = $result['content']; |
| 926 | 926 | $result = file_put_contents($cache_file, $yaml); |
| 927 | 927 | if ($result === false) { |
| 928 | - $this->error = 'Failed to create cache file: ' . $cache_file; |
|
| 928 | + $this->error = 'Failed to create cache file: '.$cache_file; |
|
| 929 | 929 | } else { |
| 930 | 930 | dolChmod($cache_file); |
| 931 | 931 | } |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | |
| 1040 | 1040 | $adaptedPackage = [ |
| 1041 | 1041 | 'id' => $id, |
| 1042 | - 'ref' => str_replace(' ', '', $package['modulename'] . '-' . $package['current_version'] . '@' . |
|
| 1042 | + 'ref' => str_replace(' ', '', $package['modulename'].'-'.$package['current_version'].'@'. |
|
| 1043 | 1043 | (array_key_exists('author', $package) ? $package['author'] : 'unkownauthor')), |
| 1044 | 1044 | 'label' => !empty($package['label'][substr($this->lang, 0, 2)]) |
| 1045 | 1045 | ? $package['label'][substr($this->lang, 0, 2)] |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | * |
| 1156 | 1156 | * @return int |
| 1157 | 1157 | */ |
| 1158 | - static function ($a, $b) { |
|
| 1158 | + static function($a, $b) { |
|
| 1159 | 1159 | return strtotime($b['datec'] ?? '0') - strtotime($a['datec'] ?? '0'); |
| 1160 | 1160 | } |
| 1161 | 1161 | ); |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | * |
| 1171 | 1171 | * @return bool |
| 1172 | 1172 | */ |
| 1173 | - static function ($package) use ($options) { |
|
| 1173 | + static function($package) use ($options) { |
|
| 1174 | 1174 | return stripos($package['label'], $options['search']) !== false || stripos($package['description'], $options['search']) !== false; |
| 1175 | 1175 | } |
| 1176 | 1176 | ); |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | * |
| 1187 | 1187 | * @return bool |
| 1188 | 1188 | */ |
| 1189 | - static function ($package) use ($options) { |
|
| 1189 | + static function($package) use ($options) { |
|
| 1190 | 1190 | return in_array($options['categorieid'], $package['category']); |
| 1191 | 1191 | } |
| 1192 | 1192 | ); |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | // MAIN_ENABLE_EXTERNALMODULES_DOLISTORE is 1 if we enabled the dolistore modules |
| 91 | -$options['search_source_dolistore'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_DOLISTORE'); |
|
| 91 | +$options['search_source_dolistore'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_DOLISTORE'); |
|
| 92 | 92 | // MAIN_ENABLE_EXTERNALMODULES_COMMUNITY is 1 if we enabled the community modules |
| 93 | -$options['search_source_github'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY'); |
|
| 93 | +$options['search_source_github'] = getDolGlobalInt('MAIN_ENABLE_EXTERNALMODULES_COMMUNITY'); |
|
| 94 | 94 | |
| 95 | 95 | if (!$user->admin) { |
| 96 | 96 | accessforbidden(); |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | //var_dump($modulenamearrays);exit; |
| 341 | 341 | |
| 342 | 342 | // Lop on each packages (can have several if package is a metapackage) |
| 343 | - if (! $error) { |
|
| 343 | + if (!$error) { |
|
| 344 | 344 | foreach ($modulenamearrays as $modulenameval) { |
| 345 | 345 | if (strpos($modulenameval, '#') === 0) { |
| 346 | 346 | continue; // Discard comments |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | 'search_version' => '-1' |
| 400 | 400 | ); |
| 401 | 401 | $queryString = http_build_query($searchParams); |
| 402 | - $redirectUrl = DOL_URL_ROOT . '/admin/modules.php?' . $queryString; |
|
| 402 | + $redirectUrl = DOL_URL_ROOT.'/admin/modules.php?'.$queryString; |
|
| 403 | 403 | |
| 404 | 404 | $message = $langs->trans("SetupIsReadyForUse", $redirectUrl, $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")); |
| 405 | 405 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); |
| 453 | 453 | exit; |
| 454 | 454 | } elseif (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1 && $action == 'reload' && $user->admin && GETPOST('confirm') == 'yes') { |
| 455 | - $result = unActivateModule($value, 0, 'newboxdefonly'); // unactivate all module features but for widget, we reload only definition and we do not change position or setup |
|
| 455 | + $result = unActivateModule($value, 0, 'newboxdefonly'); // unactivate all module features but for widget, we reload only definition and we do not change position or setup |
|
| 456 | 456 | dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity); |
| 457 | 457 | if ($result) { |
| 458 | 458 | setEventMessages($result, null, 'errors'); |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | } else { |
| 603 | 603 | $familykey = $objMod->family; |
| 604 | 604 | } |
| 605 | - '@phan-var-force string $familykey'; // if not, phan considers $familykey may be null |
|
| 605 | + '@phan-var-force string $familykey'; // if not, phan considers $familykey may be null |
|
| 606 | 606 | |
| 607 | 607 | $moduleposition = ($objMod->module_position ? $objMod->module_position : '50'); |
| 608 | 608 | if ($objMod->isCoreOrExternalModule() == 'external' && $moduleposition < 100000) { |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup'); |
| 709 | 709 | |
| 710 | 710 | // Start to show page |
| 711 | -$deschelp = ''; |
|
| 711 | +$deschelp = ''; |
|
| 712 | 712 | if ($mode == 'common' || $mode == 'commonkanban') { |
| 713 | 713 | $desc = $langs->trans("ModulesDesc", '{picto}'); |
| 714 | 714 | $desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}'); |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | if ($objMod->isCoreOrExternalModule() == 'external' && $action == 'checklastversion' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) { |
| 995 | - $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law |
|
| 995 | + $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law |
|
| 996 | 996 | if (!is_numeric($checkRes) && $checkRes != '') { |
| 997 | 997 | $langs->load("errors"); |
| 998 | 998 | setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors'); |
@@ -1372,9 +1372,9 @@ discard block |
||
| 1372 | 1372 | |
| 1373 | 1373 | //print '<span class="opacitymedium hideonsmartphone">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>'; |
| 1374 | 1374 | |
| 1375 | - $categories_tree = $remotestore->getCategories($options['categorie']); // Call API to get the categories |
|
| 1375 | + $categories_tree = $remotestore->getCategories($options['categorie']); // Call API to get the categories |
|
| 1376 | 1376 | |
| 1377 | - $products_list = $remotestore->getProducts($options); // Get list of product from all sources |
|
| 1377 | + $products_list = $remotestore->getProducts($options); // Get list of product from all sources |
|
| 1378 | 1378 | |
| 1379 | 1379 | $previouslink = $remotestore->get_previous_link(); |
| 1380 | 1380 | |
@@ -283,22 +283,22 @@ discard block |
||
| 283 | 283 | // Edit .sql file |
| 284 | 284 | if ($moduletype == 'internal') { |
| 285 | 285 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
| 286 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 286 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 287 | 287 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql'; |
| 288 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 288 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 289 | 289 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql'; |
| 290 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 290 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 291 | 291 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'.sql'; |
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | } else { |
| 296 | 296 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
| 297 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 297 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 298 | 298 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql'; |
| 299 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 299 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 300 | 300 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'-'.strtolower($module).'.sql'; |
| 301 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 301 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
| 302 | 302 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'.sql'; |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | { |
| 742 | 742 | |
| 743 | 743 | // stock all properties in array |
| 744 | - $attributesUnique = array('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' ); |
|
| 744 | + $attributesUnique = array('type', 'label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default', 'foreignkey', 'arrayofkeyval', 'alwayseditable', 'validate', 'searchall', 'comment', 'isameasure', 'css', 'cssview', 'csslist', 'help', 'showoncombobox', 'picto'); |
|
| 745 | 745 | |
| 746 | 746 | $start = "public \$fields = array("; |
| 747 | 747 | $end = ");"; |
@@ -811,8 +811,8 @@ discard block |
||
| 811 | 811 | $valuesModif[$attUnique] = $values[$attUnique]; |
| 812 | 812 | } |
| 813 | 813 | } |
| 814 | - $table .= "|*" . $field[0] . "*|"; |
|
| 815 | - $table .= implode("|", $valuesModif) . "\n"; |
|
| 814 | + $table .= "|*".$field[0]."*|"; |
|
| 815 | + $table .= implode("|", $valuesModif)."\n"; |
|
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | // end table |
@@ -843,14 +843,14 @@ discard block |
||
| 843 | 843 | |
| 844 | 844 | $str = file_get_contents($file); |
| 845 | 845 | |
| 846 | - $search = '/' . preg_quote($start, '/') . '(.*?)' . preg_quote($end, '/') . '/s'; |
|
| 846 | + $search = '/'.preg_quote($start, '/').'(.*?)'.preg_quote($end, '/').'/s'; |
|
| 847 | 847 | $new_contents = preg_replace($search, '', $str); |
| 848 | 848 | file_put_contents($file, $new_contents); |
| 849 | 849 | dolChmod($file); |
| 850 | 850 | |
| 851 | 851 | //perms If Exist |
| 852 | 852 | $perms = "|*".strtolower($objectname)."*|"; |
| 853 | - $search_pattern_perms = '/' . preg_quote($perms, '/') . '.*?\n/'; |
|
| 853 | + $search_pattern_perms = '/'.preg_quote($perms, '/').'.*?\n/'; |
|
| 854 | 854 | $new_contents = preg_replace($search_pattern_perms, '', $new_contents); |
| 855 | 855 | file_put_contents($file, $new_contents); |
| 856 | 856 | dolChmod($file); |
@@ -923,7 +923,7 @@ discard block |
||
| 923 | 923 | $string = "[options='header',grid=rows,width=60%,caption=Organisation]\n"; |
| 924 | 924 | $string .= "|===\n"; |
| 925 | 925 | // header for table |
| 926 | - $header = array($langs->trans('Objects'),$langs->trans('Permission')); |
|
| 926 | + $header = array($langs->trans('Objects'), $langs->trans('Permission')); |
|
| 927 | 927 | foreach ($header as $h) { |
| 928 | 928 | $string .= "|".$h; |
| 929 | 929 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | $now = dol_now(); |
| 1008 | - $content = file($file); // $content is an array |
|
| 1008 | + $content = file($file); // $content is an array |
|
| 1009 | 1009 | |
| 1010 | 1010 | $includeClass = "dol_include_once\(\'\/\w+\/class\/\w+\.class\.php\'\);"; |
| 1011 | 1011 | $props = 'public\s+\$\w+;'; |
@@ -1017,23 +1017,23 @@ discard block |
||
| 1017 | 1017 | if (preg_match('/'.$varcommented.'/', $lineContent)) { |
| 1018 | 1018 | $lineContent = ''; |
| 1019 | 1019 | foreach ($objects as $objectname) { |
| 1020 | - $lineContent .= "\t * @var ".$objectname." \$".strtolower($objectname)." {@type ".$objectname."}". PHP_EOL; |
|
| 1020 | + $lineContent .= "\t * @var ".$objectname." \$".strtolower($objectname)." {@type ".$objectname."}".PHP_EOL; |
|
| 1021 | 1021 | } |
| 1022 | 1022 | //var_dump($lineContent);exit; |
| 1023 | 1023 | } elseif (preg_match('/'.$props.'/', $lineContent)) { |
| 1024 | 1024 | $lineContent = ''; |
| 1025 | 1025 | foreach ($objects as $objectname) { |
| 1026 | - $lineContent .= "\t/*".PHP_EOL."\t * @var mixed TODO: set type".PHP_EOL."\t */".PHP_EOL."\tpublic \$".strtolower($objectname).";". PHP_EOL; |
|
| 1026 | + $lineContent .= "\t/*".PHP_EOL."\t * @var mixed TODO: set type".PHP_EOL."\t */".PHP_EOL."\tpublic \$".strtolower($objectname).";".PHP_EOL; |
|
| 1027 | 1027 | } |
| 1028 | 1028 | } elseif (preg_match('/'.$constructObj.'/', $lineContent)) { |
| 1029 | 1029 | $lineContent = ''; |
| 1030 | 1030 | foreach ($objects as $objectname) { |
| 1031 | - $lineContent .= "\t\t\$this->".strtolower($objectname)." = new ".$objectname."(\$this->db);". PHP_EOL; |
|
| 1031 | + $lineContent .= "\t\t\$this->".strtolower($objectname)." = new ".$objectname."(\$this->db);".PHP_EOL; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | } elseif (preg_match('/'.$includeClass.'/', $lineContent)) { |
| 1034 | 1034 | $lineContent = ''; |
| 1035 | 1035 | foreach ($objects as $objectname) { |
| 1036 | - $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($objectname).".class.php');". PHP_EOL; |
|
| 1036 | + $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($objectname).".class.php');".PHP_EOL; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | } |
| 1039 | 1039 | } |
@@ -1088,7 +1088,7 @@ discard block |
||
| 1088 | 1088 | return -1; |
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | - $content = file($file); // $content is an array |
|
| 1091 | + $content = file($file); // $content is an array |
|
| 1092 | 1092 | |
| 1093 | 1093 | $includeClass = "dol_include_once\(\'\/\w+\/class\/".strtolower($objectname)."\.class\.php\'\);"; |
| 1094 | 1094 | $props = 'public\s+\$'.strtolower($objectname); |
@@ -1258,33 +1258,33 @@ discard block |
||
| 1258 | 1258 | * @param bool|string|int $val |
| 1259 | 1259 | * @return string|int |
| 1260 | 1260 | */ |
| 1261 | - static function ($val) use ($module) { |
|
| 1261 | + static function($val) use ($module) { |
|
| 1262 | 1262 | return is_bool($val) ? "isModEnabled('$module')" : $val; |
| 1263 | 1263 | }, |
| 1264 | 1264 | $value |
| 1265 | 1265 | ); |
| 1266 | - $dicData .= "array(" . implode(", ", $conditions) . ")"; |
|
| 1266 | + $dicData .= "array(".implode(", ", $conditions).")"; |
|
| 1267 | 1267 | } elseif ($key === 'tabhelp') { |
| 1268 | 1268 | $helpItems = array(); |
| 1269 | 1269 | foreach ($value as $helpValue) { |
| 1270 | 1270 | $helpItems[] = "array('code' => \$langs->trans('".$helpValue['code']."'), 'field2' => 'field2tooltip')"; |
| 1271 | 1271 | } |
| 1272 | - $dicData .= "array(" . implode(",", $helpItems) . ")"; |
|
| 1272 | + $dicData .= "array(".implode(",", $helpItems).")"; |
|
| 1273 | 1273 | } else { |
| 1274 | 1274 | if (is_array($value)) { |
| 1275 | - $dicData .= "array(" . implode( |
|
| 1275 | + $dicData .= "array(".implode( |
|
| 1276 | 1276 | ",", |
| 1277 | 1277 | array_map( |
| 1278 | 1278 | /** |
| 1279 | 1279 | * @param string $val |
| 1280 | 1280 | * @return string |
| 1281 | 1281 | */ |
| 1282 | - static function ($val) { |
|
| 1282 | + static function($val) { |
|
| 1283 | 1283 | return "'$val'"; |
| 1284 | 1284 | }, |
| 1285 | 1285 | $value |
| 1286 | 1286 | ) |
| 1287 | - ) . ")"; |
|
| 1287 | + ).")"; |
|
| 1288 | 1288 | } else { |
| 1289 | 1289 | $dicData .= "'$value'"; |
| 1290 | 1290 | } |
@@ -1373,7 +1373,7 @@ discard block |
||
| 1373 | 1373 | $dictionnaires['tabfieldvalue'][] = (array_key_exists('code', $columns) && array_key_exists('label', $columns) ? 'code,label' : ''); |
| 1374 | 1374 | $dictionnaires['tabfieldinsert'][] = (array_key_exists('code', $columns) && array_key_exists('label', $columns) ? 'code,label' : ''); |
| 1375 | 1375 | $dictionnaires['tabrowid'][] = $primaryKey; |
| 1376 | - $dictionnaires['tabcond'][] = isModEnabled('$modulename'); // @phan-suppress-current-line UnknownModuleName |
|
| 1376 | + $dictionnaires['tabcond'][] = isModEnabled('$modulename'); // @phan-suppress-current-line UnknownModuleName |
|
| 1377 | 1377 | $dictionnaires['tabhelp'][] = (array_key_exists('code', $columns) ? array('code' => $langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip') : ''); |
| 1378 | 1378 | |
| 1379 | 1379 | // Build the dictionary string |
@@ -1427,7 +1427,7 @@ discard block |
||
| 1427 | 1427 | |
| 1428 | 1428 | // build format asciidoc for urls in table |
| 1429 | 1429 | if (!$error) { |
| 1430 | - $asciiDocTable = "[options=\"header\"]\n|===\n|Object | URLs\n"; // phpcs:ignore |
|
| 1430 | + $asciiDocTable = "[options=\"header\"]\n|===\n|Object | URLs\n"; // phpcs:ignore |
|
| 1431 | 1431 | foreach ($groupedUrls as $objectName => $urls) { |
| 1432 | 1432 | $urlsList = implode(" +\n*", $urls); |
| 1433 | 1433 | $asciiDocTable .= "|$objectName | \n*$urlsList +\n"; |
@@ -1460,9 +1460,9 @@ discard block |
||
| 1460 | 1460 | |
| 1461 | 1461 | foreach ($allFilesAndDirs as $item) { |
| 1462 | 1462 | if ($item != '.' && $item != '..') { |
| 1463 | - if ($type == 1 && is_file($path . DIRECTORY_SEPARATOR . $item) && strpos($item, '.back') === false) { |
|
| 1463 | + if ($type == 1 && is_file($path.DIRECTORY_SEPARATOR.$item) && strpos($item, '.back') === false) { |
|
| 1464 | 1464 | $count++; |
| 1465 | - } elseif ($type == 2 && is_dir($path . DIRECTORY_SEPARATOR . $item)) { |
|
| 1465 | + } elseif ($type == 2 && is_dir($path.DIRECTORY_SEPARATOR.$item)) { |
|
| 1466 | 1466 | $count++; |
| 1467 | 1467 | } |
| 1468 | 1468 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | if (dol_is_file($filetpl)) { |
| 155 | 155 | if ($backupold) { |
| 156 | 156 | $result = archiveOrBackupFile($filetpl); |
| 157 | - if (! $result) { |
|
| 157 | + if (!$result) { |
|
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | } else { |
@@ -354,48 +354,48 @@ discard block |
||
| 354 | 354 | if ($objectpage->type_container == 'setup') { |
| 355 | 355 | $content = '<div id="websitetemplateconfigpage">'."\n"; |
| 356 | 356 | $content .= '<?php'."\n"; |
| 357 | - $content .= '/*' . "\n"; |
|
| 358 | - $content .= ' * Actions' . "\n"; |
|
| 359 | - $content .= ' */' . "\n"; |
|
| 360 | - $content .= '$websitetemplateconf = GETPOSTINT(\'websitetemplateconf\');' . "\n"; |
|
| 361 | - $content .= 'include DOL_DOCUMENT_ROOT.\'/core/actions_setmoduleoptions.inc.php\';' . "\n"; |
|
| 362 | - $content .= '' . "\n"; |
|
| 363 | - $content .= '/*' . "\n"; |
|
| 364 | - $content .= ' * View' . "\n"; |
|
| 365 | - $content .= ' */' . "\n"; |
|
| 366 | - $content .= 'print load_fiche_titre($langs->trans(\'SetupAndProperties\'), \'\', \'title_setup\');' . "\n"; |
|
| 367 | - $content .= '' . "\n"; |
|
| 368 | - $content .= 'if (!empty($message)) {' . "\n"; |
|
| 369 | - $content .= ' print $message;' . "\n"; |
|
| 370 | - $content .= '}' . "\n"; |
|
| 371 | - $content .= '' . "\n"; |
|
| 372 | - $content .= 'if (!empty($formSetup->items)) {' . "\n"; |
|
| 373 | - $content .= ' $html = \'\';' . "\n"; |
|
| 374 | - $content .= '' . "\n"; |
|
| 375 | - $content .= ' $html .= \'<form action="config.php" method="POST">\';' . "\n"; |
|
| 376 | - $content .= ' // Generate hidden values from $formSetup->formHiddenInputs' . "\n"; |
|
| 377 | - $content .= ' if (!empty($formSetup->formHiddenInputs) && is_array($formSetup->formHiddenInputs)) {' . "\n"; |
|
| 378 | - $content .= ' foreach ($formSetup->formHiddenInputs as $hiddenKey => $hiddenValue) {' . "\n"; |
|
| 379 | - $content .= ' $html .= \'<input type="hidden" name="\' . dol_escape_htmltag($hiddenKey) . \'" value="\' . dol_escape_htmltag($hiddenValue) . \'">\';' . "\n"; |
|
| 380 | - $content .= ' }' . "\n"; |
|
| 381 | - $content .= ' }' . "\n"; |
|
| 382 | - $content .= '' . "\n"; |
|
| 383 | - $content .= ' // Generate output table' . "\n"; |
|
| 384 | - $content .= ' $html .= $formSetup->generateTableOutput(true);' . "\n"; |
|
| 385 | - $content .= '' . "\n"; |
|
| 386 | - $content .= ' // Submit button' . "\n"; |
|
| 387 | - $content .= ' $html .= \'<input type="hidden" name="action" value="preview">\';' . "\n"; |
|
| 388 | - $content .= ' $html .= \'<input type="hidden" name="websitetemplateconf" value="1">\';' . "\n"; |
|
| 389 | - $content .= ' $html .= \'<br>\';' . "\n"; |
|
| 390 | - $content .= ' $html .= \'<div class="form-setup-button-container center">\';' . "\n"; |
|
| 391 | - $content .= ' $html .= \'<input class="button button-submit" type="submit" value="\' . $langs->trans("Save") . \'">\';' . "\n"; |
|
| 392 | - $content .= ' $html .= \'</div>\';' . "\n"; |
|
| 393 | - $content .= ' $html .= \'</form>\';' . "\n"; |
|
| 394 | - $content .= '' . "\n"; |
|
| 395 | - $content .= ' print $html;' . "\n"; |
|
| 396 | - $content .= '}' . "\n"; |
|
| 397 | - $content .= '?>' . "\n"; |
|
| 398 | - $content .= '</div>' . "\n"; |
|
| 357 | + $content .= '/*'."\n"; |
|
| 358 | + $content .= ' * Actions'."\n"; |
|
| 359 | + $content .= ' */'."\n"; |
|
| 360 | + $content .= '$websitetemplateconf = GETPOSTINT(\'websitetemplateconf\');'."\n"; |
|
| 361 | + $content .= 'include DOL_DOCUMENT_ROOT.\'/core/actions_setmoduleoptions.inc.php\';'."\n"; |
|
| 362 | + $content .= ''."\n"; |
|
| 363 | + $content .= '/*'."\n"; |
|
| 364 | + $content .= ' * View'."\n"; |
|
| 365 | + $content .= ' */'."\n"; |
|
| 366 | + $content .= 'print load_fiche_titre($langs->trans(\'SetupAndProperties\'), \'\', \'title_setup\');'."\n"; |
|
| 367 | + $content .= ''."\n"; |
|
| 368 | + $content .= 'if (!empty($message)) {'."\n"; |
|
| 369 | + $content .= ' print $message;'."\n"; |
|
| 370 | + $content .= '}'."\n"; |
|
| 371 | + $content .= ''."\n"; |
|
| 372 | + $content .= 'if (!empty($formSetup->items)) {'."\n"; |
|
| 373 | + $content .= ' $html = \'\';'."\n"; |
|
| 374 | + $content .= ''."\n"; |
|
| 375 | + $content .= ' $html .= \'<form action="config.php" method="POST">\';'."\n"; |
|
| 376 | + $content .= ' // Generate hidden values from $formSetup->formHiddenInputs'."\n"; |
|
| 377 | + $content .= ' if (!empty($formSetup->formHiddenInputs) && is_array($formSetup->formHiddenInputs)) {'."\n"; |
|
| 378 | + $content .= ' foreach ($formSetup->formHiddenInputs as $hiddenKey => $hiddenValue) {'."\n"; |
|
| 379 | + $content .= ' $html .= \'<input type="hidden" name="\' . dol_escape_htmltag($hiddenKey) . \'" value="\' . dol_escape_htmltag($hiddenValue) . \'">\';'."\n"; |
|
| 380 | + $content .= ' }'."\n"; |
|
| 381 | + $content .= ' }'."\n"; |
|
| 382 | + $content .= ''."\n"; |
|
| 383 | + $content .= ' // Generate output table'."\n"; |
|
| 384 | + $content .= ' $html .= $formSetup->generateTableOutput(true);'."\n"; |
|
| 385 | + $content .= ''."\n"; |
|
| 386 | + $content .= ' // Submit button'."\n"; |
|
| 387 | + $content .= ' $html .= \'<input type="hidden" name="action" value="preview">\';'."\n"; |
|
| 388 | + $content .= ' $html .= \'<input type="hidden" name="websitetemplateconf" value="1">\';'."\n"; |
|
| 389 | + $content .= ' $html .= \'<br>\';'."\n"; |
|
| 390 | + $content .= ' $html .= \'<div class="form-setup-button-container center">\';'."\n"; |
|
| 391 | + $content .= ' $html .= \'<input class="button button-submit" type="submit" value="\' . $langs->trans("Save") . \'">\';'."\n"; |
|
| 392 | + $content .= ' $html .= \'</div>\';'."\n"; |
|
| 393 | + $content .= ' $html .= \'</form>\';'."\n"; |
|
| 394 | + $content .= ''."\n"; |
|
| 395 | + $content .= ' print $html;'."\n"; |
|
| 396 | + $content .= '}'."\n"; |
|
| 397 | + $content .= '?>'."\n"; |
|
| 398 | + $content .= '</div>'."\n"; |
|
| 399 | 399 | $tplcontent .= $content."\n"; |
| 400 | 400 | } |
| 401 | 401 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | |
| 406 | 406 | $tplcontent .= '<?php // BEGIN PHP'."\n"; |
| 407 | 407 | $tplcontent .= '} catch(Exception $e) { print $e->getMessage(); }'."\n"; |
| 408 | - $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean();'."\n"; // replace with ob_get_clean ? |
|
| 408 | + $tplcontent .= '$tmp = ob_get_contents(); ob_end_clean();'."\n"; // replace with ob_get_clean ? |
|
| 409 | 409 | |
| 410 | 410 | $tplcontent .= "// Now fix the content for SEO or multilanguage\n"; |
| 411 | 411 | // Old method for custom SEO |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | $indexcontent .= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; |
| 546 | 546 | $indexcontent .= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n"; |
| 547 | 547 | $indexcontent .= "}\n"; |
| 548 | - $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
| 548 | + $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
| 549 | 549 | $indexcontent .= '// END PHP ?>'."\n"; |
| 550 | 550 | $result = file_put_contents($fileindexsub, $indexcontent); |
| 551 | 551 | if ($result === false) { |
@@ -804,7 +804,7 @@ discard block |
||
| 804 | 804 | dol_delete_file($dest.'.zip'); |
| 805 | 805 | |
| 806 | 806 | // Compress it |
| 807 | - global $errormsg; // Used by dol_compress_dir |
|
| 807 | + global $errormsg; // Used by dol_compress_dir |
|
| 808 | 808 | $errormsg = ''; |
| 809 | 809 | $result = dol_compress_dir($src, $dest.'.zip', 'zip'); |
| 810 | 810 | if ($result < 0) { |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | //$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once")); |
| 986 | 986 | if (!getDolGlobalString('WEBSITE_PHP_ALLOW_EXEC')) { // If option is not on, we disallow functions to execute commands |
| 987 | 987 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen")); |
| 988 | - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions |
|
| 988 | + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "executeCLI", "verifCond")); // native dolibarr functions |
|
| 989 | 989 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities |
| 990 | 990 | } |
| 991 | 991 | if (!getDolGlobalString('WEBSITE_PHP_ALLOW_WRITE')) { // If option is not on, we disallow functions to write files |
@@ -999,7 +999,7 @@ discard block |
||
| 999 | 999 | |
| 1000 | 1000 | //$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include")); |
| 1001 | 1001 | |
| 1002 | - $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
| 1002 | + $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
| 1003 | 1003 | |
| 1004 | 1004 | foreach ($forbiddenphpstrings as $forbiddenphpstring) { |
| 1005 | 1005 | if (preg_match('/'.preg_quote($forbiddenphpstring, '/').'/ims', $phpfullcodestring)) { |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | ]; |
| 106 | 106 | |
| 107 | 107 | $headers = [ |
| 108 | - 'Authorization: Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret), |
|
| 108 | + 'Authorization: Basic '.base64_encode($this->clientId.':'.$this->clientSecret), |
|
| 109 | 109 | 'Content-Type: application/x-www-form-urlencoded', |
| 110 | - 'User-Agent: ' . $this->userAgent |
|
| 110 | + 'User-Agent: '.$this->userAgent |
|
| 111 | 111 | ]; |
| 112 | 112 | |
| 113 | 113 | $result = getURLContent($this->getAuthUrl(), 'POST', http_build_query($authData), 1, $headers, ['http', 'https'], 0); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | return false; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $cacheFile = $cacheDir . '/' . dol_hash($urlAPI, '3'); |
|
| 146 | + $cacheFile = $cacheDir.'/'.dol_hash($urlAPI, '3'); |
|
| 147 | 147 | $foundInCache = false; |
| 148 | 148 | $data = null; |
| 149 | 149 | |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | if (!$foundInCache) { |
| 160 | 160 | $headers = [ |
| 161 | - 'Authorization: Bearer ' . $this->accessToken, |
|
| 162 | - 'User-Agent: ' . $this->userAgent, |
|
| 161 | + 'Authorization: Bearer '.$this->accessToken, |
|
| 162 | + 'User-Agent: '.$this->userAgent, |
|
| 163 | 163 | ]; |
| 164 | 164 | |
| 165 | 165 | $result = getURLContent($urlAPI, 'GET', '', 1, $headers, ['http', 'https'], 0); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | dolChmod($cacheFile); |
| 174 | 174 | } |
| 175 | 175 | } else { |
| 176 | - $this->error = 'Error retrieving URL ' . $urlAPI; |
|
| 176 | + $this->error = 'Error retrieving URL '.$urlAPI; |
|
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | 'id' => $postData['id'] ?? '', |
| 220 | 220 | 'content' => $postData['title'] ?? '', |
| 221 | 221 | 'created_at' => $this->formatDate($postData['created'] ?? ''), |
| 222 | - 'url' => 'https://www.reddit.com' . ($postData['permalink'] ?? ''), |
|
| 222 | + 'url' => 'https://www.reddit.com'.($postData['permalink'] ?? ''), |
|
| 223 | 223 | 'media_url' => $postData['thumbnail'] ?? '', |
| 224 | 224 | ]; |
| 225 | 225 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | if (!$foundInCache) { |
| 105 | 105 | $headers = [ |
| 106 | - 'Cookie: ' . $this->getCookieFromParams(), |
|
| 106 | + 'Cookie: '.$this->getCookieFromParams(), |
|
| 107 | 107 | 'Accept: application/json' |
| 108 | 108 | ]; |
| 109 | 109 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | dolChmod($cacheFile); |
| 117 | 117 | } |
| 118 | 118 | } else { |
| 119 | - $this->error = 'Error retrieving URL ' . $urlAPI; |
|
| 119 | + $this->error = 'Error retrieving URL '.$urlAPI; |
|
| 120 | 120 | return false; |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | 'id' => $postData['guid'] ?? '', |
| 162 | 162 | 'content' => strip_tags($postData['text'] ?? $postData['title'] ?? ''), |
| 163 | 163 | 'created_at' => $this->formatDate($postData['created_at'] ?? ''), |
| 164 | - 'url' => 'https://diaspora-fr.org/posts/' . ($postData['guid'] ?? ''), 'media_url' => !empty($postData['photos']) && isset($postData['photos'][0]['url']) ? $postData['photos'][0]['url'] : '', |
|
| 164 | + 'url' => 'https://diaspora-fr.org/posts/'.($postData['guid'] ?? ''), 'media_url' => !empty($postData['photos']) && isset($postData['photos'][0]['url']) ? $postData['photos'][0]['url'] : '', |
|
| 165 | 165 | 'author_name' => $postData['author']['name'] ?? '', |
| 166 | 166 | 'author_avatar' => $postData['author']['avatar']['small'] ?? '' |
| 167 | 167 | ]; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | if (!$foundInCache) { |
| 111 | 111 | $headers = [ |
| 112 | - 'Authorization: Bearer ' . $this->accessToken, |
|
| 112 | + 'Authorization: Bearer '.$this->accessToken, |
|
| 113 | 113 | 'Content-Type: application/json' |
| 114 | 114 | ]; |
| 115 | 115 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | dolChmod($cacheFile); |
| 125 | 125 | } |
| 126 | 126 | } else { |
| 127 | - $this->error = 'Error retrieving URL ' . $urlAPI; |
|
| 127 | + $this->error = 'Error retrieving URL '.$urlAPI; |
|
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | } |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | if (!defined('NOBROWSERNOTIF')) { |
| 50 | 50 | define('NOBROWSERNOTIF', '1'); |
| 51 | 51 | } |
| 52 | -$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); // Keep $_GET and $_POST here. GETPOST not yet defined. |
|
| 52 | +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); // Keep $_GET and $_POST here. GETPOST not yet defined. |
|
| 53 | 53 | if (is_numeric($entity)) { |
| 54 | 54 | define("DOLENTITY", $entity); |
| 55 | 55 | } |
| 56 | 56 | include '../../main.inc.php'; |
| 57 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 57 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 58 | 58 | /** |
| 59 | 59 | * @var Conf $conf |
| 60 | 60 | * @var DoliDB $db |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $signature = GETPOST('signaturebase64'); |
| 69 | 69 | $ref = GETPOST('ref', 'aZ09'); |
| 70 | -$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 70 | +$mode = GETPOST('mode', 'aZ09'); // 'proposal', ... |
|
| 71 | 71 | $SECUREKEY = GETPOST("securekey"); // Secure key |
| 72 | 72 | $online_sign_name = GETPOST("onlinesignname"); |
| 73 | 73 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | $securekeyseed = getDolGlobalString(strtoupper($type).'_ONLINE_SIGNATURE_SECURITY_TOKEN'); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | -if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed . $type . $ref . (!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 92 | - httponly_accessforbidden('Bad value for securitykey. Value provided ' . dol_escape_htmltag($SECUREKEY) . ' does not match expected value for ref=' . dol_escape_htmltag($ref), 403); |
|
| 91 | +if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { |
|
| 92 | + httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context |
@@ -116,23 +116,23 @@ discard block |
||
| 116 | 116 | $data = base64_decode($signature); |
| 117 | 117 | |
| 118 | 118 | if ($mode == "propale" || $mode == 'proposal') { |
| 119 | - require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; |
|
| 120 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 119 | + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 120 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 121 | 121 | $object = new Propal($db); |
| 122 | 122 | $object->fetch(0, $ref); |
| 123 | 123 | |
| 124 | 124 | $upload_dir = !empty($conf->propal->multidir_output[$object->entity ?? $conf->entity]) ? $conf->propal->multidir_output[$object->entity ?? $conf->entity] : $conf->propal->dir_output; |
| 125 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 125 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 126 | 126 | |
| 127 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 128 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 127 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 128 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 129 | 129 | $langs->loadLangs(array("main", "companies")); |
| 130 | 130 | |
| 131 | 131 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 132 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 133 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 134 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 135 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 132 | + $filename = "signatures/".$date."_signature.png"; |
|
| 133 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 134 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 135 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 136 | 136 | $error++; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | if (!$error) { |
| 151 | 151 | // Defined modele of doc |
| 152 | 152 | $last_main_doc_file = $object->last_main_doc; |
| 153 | - $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 153 | + $directdownloadlink = $object->getLastMainDocLink('proposal'); // url to download the $object->last_main_doc |
|
| 154 | 154 | |
| 155 | 155 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 156 | 156 | $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF |
| 157 | 157 | $ref_pdf = preg_replace('/_signed-(\d+)/', '', $ref_pdf); |
| 158 | 158 | |
| 159 | - $newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf"; |
|
| 160 | - $sourcefile = $upload_dir . $ref_pdf . ".pdf"; |
|
| 159 | + $newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf"; |
|
| 160 | + $sourcefile = $upload_dir.$ref_pdf.".pdf"; |
|
| 161 | 161 | |
| 162 | 162 | if (dol_is_file($sourcefile)) { |
| 163 | 163 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -180,15 +180,15 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | //$pdf->Open(); |
| 183 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 183 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 184 | 184 | |
| 185 | 185 | $param = array(); |
| 186 | 186 | $param['online_sign_name'] = $online_sign_name; |
| 187 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 187 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 188 | 188 | |
| 189 | 189 | $propalsignonspecificpage = getDolGlobalInt("PROPAL_SIGNATURE_ON_SPECIFIC_PAGE"); |
| 190 | 190 | |
| 191 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 191 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 192 | 192 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 193 | 193 | try { |
| 194 | 194 | $tppl = $pdf->importPage($i); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | dolPrintSignatureImage($pdf, $langs, $param); |
| 233 | 233 | } |
| 234 | 234 | } catch (Exception $e) { |
| 235 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 235 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 236 | 236 | $response = $e->getMessage(); |
| 237 | 237 | $error++; |
| 238 | 238 | } |
@@ -281,14 +281,14 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | $online_sign_ip = getUserRemoteIP(); |
| 283 | 283 | |
| 284 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
|
| 285 | - $sql .= " SET fk_statut = " . ((int) $object::STATUS_SIGNED) . ", note_private = '" . $db->escape($object->note_private) . "',"; |
|
| 286 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 287 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 284 | + $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; |
|
| 285 | + $sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$db->escape($object->note_private)."',"; |
|
| 286 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 287 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 288 | 288 | if ($online_sign_name) { |
| 289 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 289 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 290 | 290 | } |
| 291 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 291 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 292 | 292 | |
| 293 | 293 | dol_syslog(__FILE__, LOG_DEBUG); |
| 294 | 294 | $resql = $db->query($sql); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); |
| 308 | 308 | if ($result < 0) { |
| 309 | 309 | $error++; |
| 310 | - $response = "error in trigger " . $object->error; |
|
| 310 | + $response = "error in trigger ".$object->error; |
|
| 311 | 311 | } else { |
| 312 | 312 | $soc = new Societe($db); |
| 313 | 313 | $soc->id = $object->socid; |
@@ -336,25 +336,25 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | } elseif ($mode == 'contract') { |
| 339 | - require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 340 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 339 | + require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 340 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 341 | 341 | $object = new Contrat($db); |
| 342 | 342 | $object->fetch(0, $ref); |
| 343 | 343 | |
| 344 | 344 | $upload_dir = !empty($conf->contrat->multidir_output[$object->entity ?? $conf->entity]) ? $conf->contrat->multidir_output[$object->entity ?? $conf->entity] : $conf->contrat->dir_output; |
| 345 | - $upload_dir .= '/' . dol_sanitizeFileName($object->ref) . '/'; |
|
| 345 | + $upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/'; |
|
| 346 | 346 | |
| 347 | 347 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 348 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 349 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 350 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 351 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 348 | + $filename = "signatures/".$date."_signature.png"; |
|
| 349 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 350 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 351 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 352 | 352 | $error++; |
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | if (!$error) { |
| 357 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 357 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 358 | 358 | if ($return === false) { |
| 359 | 359 | $error++; |
| 360 | 360 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -366,13 +366,13 @@ discard block |
||
| 366 | 366 | if (!$error) { |
| 367 | 367 | // Defined modele of doc |
| 368 | 368 | $last_main_doc_file = $object->last_main_doc; |
| 369 | - $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 369 | + $directdownloadlink = $object->getLastMainDocLink('contrat'); // url to download the $object->last_main_doc |
|
| 370 | 370 | |
| 371 | 371 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 372 | 372 | $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF |
| 373 | 373 | |
| 374 | - $newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf"; |
|
| 375 | - $sourcefile = $upload_dir . $ref_pdf . ".pdf"; |
|
| 374 | + $newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf"; |
|
| 375 | + $sourcefile = $upload_dir.$ref_pdf.".pdf"; |
|
| 376 | 376 | |
| 377 | 377 | if (dol_is_file($sourcefile)) { |
| 378 | 378 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -395,13 +395,13 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | //$pdf->Open(); |
| 398 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 398 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 399 | 399 | |
| 400 | 400 | $param = array(); |
| 401 | 401 | $param['online_sign_name'] = $online_sign_name; |
| 402 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 402 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 403 | 403 | |
| 404 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 404 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 405 | 405 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 406 | 406 | try { |
| 407 | 407 | $tppl = $pdf->importPage($i); |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | dolPrintSignatureImage($pdf, $langs, $param); |
| 433 | 433 | } |
| 434 | 434 | } catch (Exception $e) { |
| 435 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 435 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 436 | 436 | $response = $e->getMessage(); |
| 437 | 437 | $error++; |
| 438 | 438 | } |
@@ -470,8 +470,8 @@ discard block |
||
| 470 | 470 | $object->setSignedStatus($user, Contrat::$SIGNED_STATUSES['STATUS_SIGNED_RECEIVER_ONLINE'], 0, 'CONTRACT_MODIFY'); |
| 471 | 471 | } |
| 472 | 472 | } elseif ($mode == 'fichinter') { |
| 473 | - require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; |
|
| 474 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 473 | + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; |
|
| 474 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 475 | 475 | $object = new Fichinter($db); |
| 476 | 476 | $object->fetch(0, $ref); |
| 477 | 477 | |
@@ -480,20 +480,20 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | $langs->loadLangs(array("main", "companies")); |
| 482 | 482 | |
| 483 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 484 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 483 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 484 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 485 | 485 | |
| 486 | 486 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 487 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 488 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 489 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 490 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 487 | + $filename = "signatures/".$date."_signature.png"; |
|
| 488 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 489 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 490 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 491 | 491 | $error++; |
| 492 | 492 | } |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | if (!$error) { |
| 496 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 496 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 497 | 497 | if ($return === false) { |
| 498 | 498 | $error++; |
| 499 | 499 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -505,13 +505,13 @@ discard block |
||
| 505 | 505 | if (!$error) { |
| 506 | 506 | // Defined modele of doc |
| 507 | 507 | $last_main_doc_file = $object->last_main_doc; |
| 508 | - $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 508 | + $directdownloadlink = $object->getLastMainDocLink('fichinter'); // url to download the $object->last_main_doc |
|
| 509 | 509 | |
| 510 | 510 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 511 | 511 | $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF |
| 512 | 512 | |
| 513 | - $newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf"; |
|
| 514 | - $sourcefile = $upload_dir . $ref_pdf . ".pdf"; |
|
| 513 | + $newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf"; |
|
| 514 | + $sourcefile = $upload_dir.$ref_pdf.".pdf"; |
|
| 515 | 515 | |
| 516 | 516 | if (dol_is_file($sourcefile)) { |
| 517 | 517 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -534,13 +534,13 @@ discard block |
||
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | //$pdf->Open(); |
| 537 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 537 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 538 | 538 | |
| 539 | 539 | $param = array(); |
| 540 | 540 | $param['online_sign_name'] = $online_sign_name; |
| 541 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 541 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 542 | 542 | |
| 543 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 543 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 544 | 544 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 545 | 545 | try { |
| 546 | 546 | $tppl = $pdf->importPage($i); |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | dolPrintSignatureImage($pdf, $langs, $param); |
| 572 | 572 | } |
| 573 | 573 | } catch (Exception $e) { |
| 574 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 574 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 575 | 575 | $response = $e->getMessage(); |
| 576 | 576 | $error++; |
| 577 | 577 | } |
@@ -610,39 +610,39 @@ discard block |
||
| 610 | 610 | } |
| 611 | 611 | } elseif ($mode == "societe_rib") { |
| 612 | 612 | $langs->load('withdrawals'); |
| 613 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; |
|
| 614 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 613 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
|
| 614 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 615 | 615 | $modelpath = "core/modules/bank/doc/"; |
| 616 | 616 | $object = new CompanyBankAccount($db); |
| 617 | 617 | $object->fetch(0, $ref); |
| 618 | 618 | if (!empty($object->id)) { |
| 619 | 619 | $object->fetch_thirdparty(); |
| 620 | 620 | |
| 621 | - $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity] . '/' . dol_sanitizeFileName((string) $object->thirdparty->id) . '/'; |
|
| 621 | + $upload_dir = $conf->societe->multidir_output[$object->thirdparty->entity].'/'.dol_sanitizeFileName((string) $object->thirdparty->id).'/'; |
|
| 622 | 622 | |
| 623 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 624 | - $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 623 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 624 | + $default_font = pdf_getPDFFont($langs); // Must be after pdf_getInstance |
|
| 625 | 625 | $langs->loadLangs(array("main", "companies")); |
| 626 | 626 | |
| 627 | 627 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 628 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 629 | - if (!dol_is_dir($upload_dir . "signatures/")) { |
|
| 630 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 631 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 628 | + $filename = "signatures/".$date."_signature.png"; |
|
| 629 | + if (!dol_is_dir($upload_dir."signatures/")) { |
|
| 630 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 631 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 632 | 632 | $error++; |
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | - if (!dol_is_writable($upload_dir . "signatures/")) { |
|
| 636 | - $response = "Error directory " . $upload_dir . "signatures/ is not writable"; |
|
| 635 | + if (!dol_is_writable($upload_dir."signatures/")) { |
|
| 636 | + $response = "Error directory ".$upload_dir."signatures/ is not writable"; |
|
| 637 | 637 | $error++; |
| 638 | 638 | } |
| 639 | 639 | if (!dol_is_writable(DOL_DATA_ROOT.'/admin/temp/')) { // This is used by TCPDF as working directory |
| 640 | - $response = "Error directory " . DOL_DATA_ROOT."/admin/temp/ is not writable"; |
|
| 640 | + $response = "Error directory ".DOL_DATA_ROOT."/admin/temp/ is not writable"; |
|
| 641 | 641 | $error++; |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | if (!$error) { |
| 645 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 645 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 646 | 646 | if ($return === false) { |
| 647 | 647 | $error++; |
| 648 | 648 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -655,14 +655,14 @@ discard block |
||
| 655 | 655 | // Defined modele of doc |
| 656 | 656 | $last_main_doc_file = $object->last_main_doc; |
| 657 | 657 | $last_modelpdf = $object->model_pdf; |
| 658 | - $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 658 | + $directdownloadlink = $object->getLastMainDocLink('company'); // url to download the $object->last_main_doc |
|
| 659 | 659 | |
| 660 | 660 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 661 | 661 | $sourcefile = ''; |
| 662 | 662 | $newpdffilename = ''; |
| 663 | 663 | if ($last_modelpdf == 'sepamandate') { |
| 664 | - $newpdffilename = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . "_signed-" . $date . ".pdf"; |
|
| 665 | - $sourcefile = $upload_dir . $langs->transnoentitiesnoconv("SepaMandateShort") . ' ' . dol_sanitizeFileName($object->ref) . "-" . dol_sanitizeFileName($object->rum) . ".pdf"; |
|
| 664 | + $newpdffilename = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum)."_signed-".$date.".pdf"; |
|
| 665 | + $sourcefile = $upload_dir.$langs->transnoentitiesnoconv("SepaMandateShort").' '.dol_sanitizeFileName($object->ref)."-".dol_sanitizeFileName($object->rum).".pdf"; |
|
| 666 | 666 | } |
| 667 | 667 | if (dol_is_file($sourcefile)) { |
| 668 | 668 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -685,9 +685,9 @@ discard block |
||
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | //$pdf->Open(); |
| 688 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 688 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 689 | 689 | |
| 690 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 690 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 691 | 691 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 692 | 692 | try { |
| 693 | 693 | $tppl = $pdf->importPage($i); |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); |
| 696 | 696 | $pdf->useTemplate($tppl); |
| 697 | 697 | } catch (Exception $e) { |
| 698 | - dol_syslog("Error when manipulating the PDF " . $sourcefile . " by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 698 | + dol_syslog("Error when manipulating the PDF ".$sourcefile." by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 699 | 699 | $response = $e->getMessage(); |
| 700 | 700 | $error++; |
| 701 | 701 | } |
@@ -711,18 +711,18 @@ discard block |
||
| 711 | 711 | $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
| 712 | 712 | } |
| 713 | 713 | foreach ($dirmodels as $reldir) { |
| 714 | - $file = "pdf_" . $last_modelpdf . ".modules.php"; |
|
| 714 | + $file = "pdf_".$last_modelpdf.".modules.php"; |
|
| 715 | 715 | // On vérifie l'emplacement du modele |
| 716 | - $file = dol_buildpath($reldir . $modelpath . $file, 0); |
|
| 716 | + $file = dol_buildpath($reldir.$modelpath.$file, 0); |
|
| 717 | 717 | if (file_exists($file)) { |
| 718 | 718 | $filefound = $file; |
| 719 | - $classname = 'pdf_' . $last_modelpdf; |
|
| 719 | + $classname = 'pdf_'.$last_modelpdf; |
|
| 720 | 720 | break; |
| 721 | 721 | } |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | if ($filefound === '') { |
| 725 | - $response = $langs->trans("Error") . ' Failed to load doc generator with modelpaths=' . $modelpath . ' - modele=' . $last_modelpdf; |
|
| 725 | + $response = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelpath.' - modele='.$last_modelpdf; |
|
| 726 | 726 | dol_syslog($response, LOG_ERR); |
| 727 | 727 | $error++; |
| 728 | 728 | } |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | $param = array(); |
| 748 | 748 | $param['online_sign_name'] = $online_sign_name; |
| 749 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 749 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 750 | 750 | |
| 751 | 751 | // A signature image file is 720 x 180 (ratio 1/4) but we use only the size into PDF |
| 752 | 752 | // TODO Get position of box from PDF template |
@@ -782,16 +782,16 @@ discard block |
||
| 782 | 782 | |
| 783 | 783 | $online_sign_ip = getUserRemoteIP(); |
| 784 | 784 | |
| 785 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $object->table_element; |
|
| 785 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$object->table_element; |
|
| 786 | 786 | $sql .= " SET "; |
| 787 | - $sql .= " date_signature = '" . $db->idate(dol_now()) . "',"; |
|
| 788 | - $sql .= " online_sign_ip = '" . $db->escape($online_sign_ip) . "'"; |
|
| 787 | + $sql .= " date_signature = '".$db->idate(dol_now())."',"; |
|
| 788 | + $sql .= " online_sign_ip = '".$db->escape($online_sign_ip)."'"; |
|
| 789 | 789 | if ($online_sign_name) { |
| 790 | - $sql .= ", online_sign_name = '" . $db->escape($online_sign_name) . "'"; |
|
| 790 | + $sql .= ", online_sign_name = '".$db->escape($online_sign_name)."'"; |
|
| 791 | 791 | } |
| 792 | 792 | //$sql .= ", last_main_doc = '" . $db->escape($object->element'..') . "'"; |
| 793 | 793 | |
| 794 | - $sql .= " WHERE rowid = " . ((int) $object->id); |
|
| 794 | + $sql .= " WHERE rowid = ".((int) $object->id); |
|
| 795 | 795 | |
| 796 | 796 | dol_syslog(__FILE__, LOG_DEBUG); |
| 797 | 797 | $resql = $db->query($sql); |
@@ -817,8 +817,8 @@ discard block |
||
| 817 | 817 | } |
| 818 | 818 | } |
| 819 | 819 | } elseif ($mode == 'expedition') { |
| 820 | - require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php'; |
|
| 821 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/pdf.lib.php'; |
|
| 820 | + require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; |
|
| 821 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; |
|
| 822 | 822 | |
| 823 | 823 | $object = new Expedition($db); |
| 824 | 824 | $object->fetch(0, $ref); |
@@ -828,20 +828,20 @@ discard block |
||
| 828 | 828 | |
| 829 | 829 | $langs->loadLangs(array("main", "companies")); |
| 830 | 830 | |
| 831 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 832 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 831 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 832 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 833 | 833 | |
| 834 | 834 | $date = dol_print_date(dol_now(), "%Y%m%d%H%M%S"); |
| 835 | - $filename = "signatures/" . $date . "_signature.png"; |
|
| 836 | - if (!is_dir($upload_dir . "signatures/")) { |
|
| 837 | - if (!dol_mkdir($upload_dir . "signatures/")) { |
|
| 838 | - $response = "Error mkdir. Failed to create dir " . $upload_dir . "signatures/"; |
|
| 835 | + $filename = "signatures/".$date."_signature.png"; |
|
| 836 | + if (!is_dir($upload_dir."signatures/")) { |
|
| 837 | + if (!dol_mkdir($upload_dir."signatures/")) { |
|
| 838 | + $response = "Error mkdir. Failed to create dir ".$upload_dir."signatures/"; |
|
| 839 | 839 | $error++; |
| 840 | 840 | } |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | if (!$error) { |
| 844 | - $return = file_put_contents($upload_dir . $filename, $data); |
|
| 844 | + $return = file_put_contents($upload_dir.$filename, $data); |
|
| 845 | 845 | if ($return === false) { |
| 846 | 846 | $error++; |
| 847 | 847 | $response = 'Error file_put_content: failed to create signature file.'; |
@@ -856,17 +856,17 @@ discard block |
||
| 856 | 856 | if (empty($last_main_doc_file) || !dol_is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { |
| 857 | 857 | // It seems document has never been generated, or was generated and then deleted. |
| 858 | 858 | // So we try to regenerate it with its default template. |
| 859 | - $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 859 | + $defaulttemplate = ''; // We force the use an empty string instead of $object->model_pdf to be sure to use a "main" default template and not the last one used. |
|
| 860 | 860 | $object->generateDocument($defaulttemplate, $langs); |
| 861 | 861 | } |
| 862 | 862 | $last_main_doc_file = $object->last_main_doc; |
| 863 | - $directdownloadlink = $object->getLastMainDocLink('expedition'); // url to download the $object->last_main_doc |
|
| 863 | + $directdownloadlink = $object->getLastMainDocLink('expedition'); // url to download the $object->last_main_doc |
|
| 864 | 864 | |
| 865 | 865 | if (preg_match('/\.pdf/i', $last_main_doc_file)) { |
| 866 | 866 | $ref_pdf = pathinfo($last_main_doc_file, PATHINFO_FILENAME); // Retrieves the name of external or internal PDF |
| 867 | 867 | |
| 868 | - $newpdffilename = $upload_dir . $ref_pdf . "_signed-" . $date . ".pdf"; |
|
| 869 | - $sourcefile = $upload_dir . $ref_pdf . ".pdf"; |
|
| 868 | + $newpdffilename = $upload_dir.$ref_pdf."_signed-".$date.".pdf"; |
|
| 869 | + $sourcefile = $upload_dir.$ref_pdf.".pdf"; |
|
| 870 | 870 | |
| 871 | 871 | if (dol_is_file($sourcefile)) { |
| 872 | 872 | $parameters = array('sourcefile' => $sourcefile, 'newpdffilename' => $newpdffilename); |
@@ -889,13 +889,13 @@ discard block |
||
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | //$pdf->Open(); |
| 892 | - $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 892 | + $pagecount = $pdf->setSourceFile($sourcefile); // original PDF |
|
| 893 | 893 | |
| 894 | 894 | $param = array(); |
| 895 | 895 | $param['online_sign_name'] = $online_sign_name; |
| 896 | - $param['pathtoimage'] = $upload_dir . $filename; |
|
| 896 | + $param['pathtoimage'] = $upload_dir.$filename; |
|
| 897 | 897 | |
| 898 | - $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 898 | + $s = array(); // Array with size of each page. Example array(w'=>210, 'h'=>297); |
|
| 899 | 899 | for ($i = 1; $i < ($pagecount + 1); $i++) { |
| 900 | 900 | try { |
| 901 | 901 | $tppl = $pdf->importPage($i); |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | dolPrintSignatureImage($pdf, $langs, $param); |
| 915 | 915 | } |
| 916 | 916 | } catch (Exception $e) { |
| 917 | - dol_syslog("Error when manipulating some PDF by onlineSign: " . $e->getMessage(), LOG_ERR); |
|
| 917 | + dol_syslog("Error when manipulating some PDF by onlineSign: ".$e->getMessage(), LOG_ERR); |
|
| 918 | 918 | $response = $e->getMessage(); |
| 919 | 919 | $error++; |
| 920 | 920 | } |
@@ -975,8 +975,8 @@ discard block |
||
| 975 | 975 | */ |
| 976 | 976 | function dolPrintSignatureImage(TCPDF $pdf, $langs, $params) |
| 977 | 977 | { |
| 978 | - $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 979 | - $default_font = pdf_getPDFFont($langs); // Must be |
|
| 978 | + $default_font_size = pdf_getPDFFontSize($langs); // Must be after pdf_getInstance |
|
| 979 | + $default_font = pdf_getPDFFont($langs); // Must be |
|
| 980 | 980 | $xforimgstart = $params['xforimgstart']; |
| 981 | 981 | $yforimgstart = $params['yforimgstart']; |
| 982 | 982 | $wforimg = $params['wforimg']; |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | $pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4) - 4); |
| 985 | 985 | $pdf->SetFont($default_font, '', $default_font_size - 1); |
| 986 | 986 | $pdf->SetTextColor(80, 80, 80); |
| 987 | - $pdf->MultiCell($wforimg, 4, $langs->trans("Signature") . ': ' . dol_print_date(dol_now(), "day", false, $langs, true). ' - '.$params['online_sign_name'], 0, 'L'); |
|
| 987 | + $pdf->MultiCell($wforimg, 4, $langs->trans("Signature").': '.dol_print_date(dol_now(), "day", false, $langs, true).' - '.$params['online_sign_name'], 0, 'L'); |
|
| 988 | 988 | //$pdf->SetXY($xforimgstart, $yforimgstart + round($wforimg / 4)); |
| 989 | 989 | //$pdf->MultiCell($wforimg, 4, $langs->trans("Lastname") . ': ' . $online_sign_name, 0, 'L'); |
| 990 | 990 | |