@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | define('GITHUB_API_VERSION', '2022-11-28'); |
| 85 | 85 | |
| 86 | 86 | |
| 87 | -$config = @require_once __DIR__ . '/github_pr_reviewers_webhook.config.php'; |
|
| 87 | +$config = @require_once __DIR__.'/github_pr_reviewers_webhook.config.php'; |
|
| 88 | 88 | |
| 89 | 89 | if (false === $config) { |
| 90 | 90 | _error('Could not load config'); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | _error('Empty secret configuration'); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | -$reviewers = $config['reviewers'] ?? [ ]; |
|
| 99 | +$reviewers = $config['reviewers'] ?? []; |
|
| 100 | 100 | |
| 101 | 101 | if (empty($reviewers)) { |
| 102 | 102 | _error('Empty reviewers configuration'); |
@@ -122,20 +122,20 @@ discard block |
||
| 122 | 122 | _error('Message signature not found', 400); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -$expectedSignature = 'sha256=' . hash_hmac('sha256', file_get_contents('php://input'), $secret); |
|
| 125 | +$expectedSignature = 'sha256='.hash_hmac('sha256', file_get_contents('php://input'), $secret); |
|
| 126 | 126 | |
| 127 | -_debug('expectedSignature = ' . var_export($expectedSignature, true)); |
|
| 128 | -_debug('signature = ' . var_export($signature, true)); |
|
| 127 | +_debug('expectedSignature = '.var_export($expectedSignature, true)); |
|
| 128 | +_debug('signature = '.var_export($signature, true)); |
|
| 129 | 129 | |
| 130 | 130 | // Use `hash_equals()` instead of direct comparison to avoir timing attacks (@see https://www.php.net/manual/en/function.hash-equals.php) |
| 131 | -if (! hash_equals($signature, $expectedSignature)) { |
|
| 131 | +if (!hash_equals($signature, $expectedSignature)) { |
|
| 132 | 132 | _error('Invalid webhook signature', 401); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | -_debug('event = ' . var_export($event, true)); |
|
| 135 | +_debug('event = '.var_export($event, true)); |
|
| 136 | 136 | |
| 137 | 137 | if ('pull_request' !== $event) { |
| 138 | - _out('Event ' . var_export($event, true) . ' not qualified'); |
|
| 138 | + _out('Event '.var_export($event, true).' not qualified'); |
|
| 139 | 139 | exit; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $payload = json_decode($rawPayload, /* associative: */ true); |
| 151 | 151 | |
| 152 | 152 | if (null === $payload) { |
| 153 | - _error('Could not decode payload, got ' . var_export($rawPayload, true) . ' in input'); |
|
| 153 | + _error('Could not decode payload, got '.var_export($rawPayload, true).' in input'); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // _debug('payload = ' . var_export($payload, true)); |
@@ -162,26 +162,26 @@ discard block |
||
| 162 | 162 | _error('Target branch not in payload'); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | -_debug('targetBranch = ' . var_export($targetBranch, true)); |
|
| 165 | +_debug('targetBranch = '.var_export($targetBranch, true)); |
|
| 166 | 166 | |
| 167 | 167 | |
| 168 | -if (! array_key_exists($targetBranch, $reviewers)) { |
|
| 169 | - _out('Target branch ' . var_export($targetBranch, true) . ' not qualified'); |
|
| 168 | +if (!array_key_exists($targetBranch, $reviewers)) { |
|
| 169 | + _out('Target branch '.var_export($targetBranch, true).' not qualified'); |
|
| 170 | 170 | exit; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $wantedReviewers = $reviewers[$targetBranch]; |
| 174 | 174 | |
| 175 | -if (! is_array($wantedReviewers) && ! is_string($wantedReviewers)) { |
|
| 176 | - _error('Wanted reviewers incorrectly set in config for branch ' . var_export($targetBranch, true)); |
|
| 175 | +if (!is_array($wantedReviewers) && !is_string($wantedReviewers)) { |
|
| 176 | + _error('Wanted reviewers incorrectly set in config for branch '.var_export($targetBranch, true)); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | -if (! is_array($wantedReviewers) && ! empty($wantedReviewers)) { |
|
| 180 | - $wantedReviewers = [ $wantedReviewers ]; |
|
| 179 | +if (!is_array($wantedReviewers) && !empty($wantedReviewers)) { |
|
| 180 | + $wantedReviewers = [$wantedReviewers]; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | if (empty($wantedReviewers)) { |
| 184 | - _out('Branch ' . var_export($targetBranch, true) . ' configured with no reviewers, not qualified'); |
|
| 184 | + _out('Branch '.var_export($targetBranch, true).' configured with no reviewers, not qualified'); |
|
| 185 | 185 | exit; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | |
| 195 | 195 | if ('opened' !== $action && 'edited' !== $action && 'ready_for_review' !== $action) { |
| 196 | - _out('Action ' . var_export($action, true) . ' not qualified'); |
|
| 196 | + _out('Action '.var_export($action, true).' not qualified'); |
|
| 197 | 197 | exit; |
| 198 | 198 | } |
| 199 | 199 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | // GitHub API returns an error 422 if we try to add the author as a reviewer, we have to filter them out |
| 226 | -$reviewersToBeAdded = array_diff($wantedReviewers, $currentReviewers, empty($author) ? [ ] : [ $author ]); |
|
| 226 | +$reviewersToBeAdded = array_diff($wantedReviewers, $currentReviewers, empty($author) ? [] : [$author]); |
|
| 227 | 227 | |
| 228 | 228 | if (empty($reviewersToBeAdded)) { |
| 229 | 229 | _out('Reviewers already requested or author of the pull request : not qualified'); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | |
| 234 | 234 | _out('Webhook qualified'); |
| 235 | -_debug('Adding reviewers: ' . implode(', ', $reviewersToBeAdded)); |
|
| 235 | +_debug('Adding reviewers: '.implode(', ', $reviewersToBeAdded)); |
|
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | $pullRequestUrl = $payload['pull_request']['url'] ?? null; |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | _error('Pull request API URL not in payload'); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | -$c = curl_init($pullRequestUrl . '/requested_reviewers'); |
|
| 244 | +$c = curl_init($pullRequestUrl.'/requested_reviewers'); |
|
| 245 | 245 | |
| 246 | 246 | if (false === $c) { |
| 247 | 247 | _error('Could not init cURL'); |
@@ -251,24 +251,24 @@ discard block |
||
| 251 | 251 | $setMethodReturn = curl_setopt($c, CURLOPT_CUSTOMREQUEST, 'POST'); |
| 252 | 252 | |
| 253 | 253 | if (false === $setMethodReturn) { |
| 254 | - _error('Could not set request method: ' . curl_error($c)); |
|
| 254 | + _error('Could not set request method: '.curl_error($c)); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | $setHeadersReturn = curl_setopt($c, CURLOPT_HTTPHEADER, [ |
| 258 | 258 | 'Accept: application/vnd.github+json', |
| 259 | - 'Authorization: Bearer ' . $token, |
|
| 260 | - 'X-GitHub-Api-Version: ' . GITHUB_API_VERSION, |
|
| 259 | + 'Authorization: Bearer '.$token, |
|
| 260 | + 'X-GitHub-Api-Version: '.GITHUB_API_VERSION, |
|
| 261 | 261 | 'User-Agent: dolibarr-github-webhook-handler/1.0 dolibarr/20250616', // PHP cURL implementation has no default User-Agent yet, and GitHub REST API requires one |
| 262 | 262 | 'Content-Type: application/json', |
| 263 | 263 | ]); |
| 264 | 264 | |
| 265 | 265 | if (false === $setHeadersReturn) { |
| 266 | - _error('Could not set request headers: ' . curl_error($c)); |
|
| 266 | + _error('Could not set request headers: '.curl_error($c)); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $setBodyReturn = curl_setopt($c, CURLOPT_POSTFIELDS, json_encode([ |
| 270 | 270 | 'reviewers' => $reviewersToBeAdded, |
| 271 | - 'team_reviewers' => [ ], // TODO |
|
| 271 | + 'team_reviewers' => [], // TODO |
|
| 272 | 272 | ])); |
| 273 | 273 | |
| 274 | 274 | |
@@ -283,28 +283,28 @@ discard block |
||
| 283 | 283 | $setReturnTransferReturn = curl_setopt($c, CURLOPT_RETURNTRANSFER, true); |
| 284 | 284 | |
| 285 | 285 | if (false === $setReturnTransferReturn) { |
| 286 | - _error('Could not set return transfer: ' . curl_error($c)); |
|
| 286 | + _error('Could not set return transfer: '.curl_error($c)); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | $response = curl_exec($c); |
| 290 | 290 | |
| 291 | 291 | if (false === $response) { |
| 292 | - _error('Error handling cURL request: ' . curl_error($c)); |
|
| 292 | + _error('Error handling cURL request: '.curl_error($c)); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | $responseCode = curl_getinfo($c, CURLINFO_RESPONSE_CODE); |
| 296 | 296 | |
| 297 | 297 | if (false === $responseCode) { |
| 298 | - _error('Error getting response code: ' . curl_error($c)); |
|
| 298 | + _error('Error getting response code: '.curl_error($c)); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | -_debug('responseCode = ' . $responseCode); |
|
| 301 | +_debug('responseCode = '.$responseCode); |
|
| 302 | 302 | |
| 303 | 303 | if ($responseCode < 200 || $responseCode > 399) { |
| 304 | - _error('Error from GitHub API, code ' . $responseCode . ': ' . $response); |
|
| 304 | + _error('Error from GitHub API, code '.$responseCode.': '.$response); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | -_out('Added the following reviewers: ' . implode(', ', $reviewersToBeAdded)); |
|
| 307 | +_out('Added the following reviewers: '.implode(', ', $reviewersToBeAdded)); |
|
| 308 | 308 | |
| 309 | 309 | curl_close($c); |
| 310 | 310 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | function _out(string $message): void |
| 319 | 319 | { |
| 320 | - echo $message . PHP_EOL; |
|
| 320 | + echo $message.PHP_EOL; |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -343,6 +343,6 @@ discard block |
||
| 343 | 343 | function _error(string $message, int $status = 500): void |
| 344 | 344 | { |
| 345 | 345 | http_response_code($status); |
| 346 | - _out('Error: ' . $message); |
|
| 346 | + _out('Error: '.$message); |
|
| 347 | 347 | exit; |
| 348 | 348 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $permissiontoadd = $user->hasRight('projet', 'creer'); |
| 122 | 122 | $permissiontodelete = $user->hasRight('projet', 'supprimer'); |
| 123 | -$permissiondellink = $user->hasRight('projet', 'creer'); // Used by the include of actions_dellink.inc.php |
|
| 123 | +$permissiondellink = $user->hasRight('projet', 'creer'); // Used by the include of actions_dellink.inc.php |
|
| 124 | 124 | $permissiontoeditextra = $permissiontoadd; |
| 125 | 125 | if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) { |
| 126 | 126 | // For action 'update_extras', is there a specific permission set for the attribute to update |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $action = ''; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
| 179 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
| 180 | 180 | |
| 181 | 181 | // Action setdraft object |
| 182 | 182 | if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $action = ''; |
| 191 | 191 | |
| 192 | 192 | // For backward compatibility |
| 193 | - $object->statut = $object::STATUS_DRAFT; // this already set for $object->status by $object->setStatut() |
|
| 193 | + $object->statut = $object::STATUS_DRAFT; // this already set for $object->status by $object->setStatut() |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // Action add |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $db->begin(); |
| 321 | 321 | $old_start_date = 0; |
| 322 | 322 | if (!$error) { |
| 323 | - $object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 323 | + $object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 324 | 324 | |
| 325 | 325 | $old_start_date = $object->date_start; |
| 326 | 326 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $object->date_end_event = (!GETPOST('date_end_event')) ? '' : $date_end_event; |
| 338 | 338 | $object->location = $location; |
| 339 | 339 | if (GETPOSTISSET('opp_amount')) { |
| 340 | - $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha')); |
|
| 340 | + $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha')); |
|
| 341 | 341 | } |
| 342 | 342 | if (GETPOSTISSET('budget_amount')) { |
| 343 | 343 | $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha')); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { |
| 525 | 525 | $tmpurl = $_SESSION['pageforbacktolist']['project']; |
| 526 | 526 | $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); |
| 527 | - $urlback = $tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1'; |
|
| 527 | + $urlback = $tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1'; |
|
| 528 | 528 | } else { |
| 529 | 529 | $urlback = DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1'; |
| 530 | 530 | } |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | // Quick edit for extrafields |
| 565 | 565 | if ($action == 'update_extras' && $permissiontoeditextra) { |
| 566 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 566 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
| 567 | 567 | |
| 568 | 568 | $attribute_name = GETPOST('attribute', 'aZ09'); |
| 569 | 569 | |
@@ -995,7 +995,7 @@ discard block |
||
| 995 | 995 | $userDelete = $object->restrictedProjectArea($user, 'delete'); |
| 996 | 996 | //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; |
| 997 | 997 | |
| 998 | - $formconfirm = "" ; |
|
| 998 | + $formconfirm = ""; |
|
| 999 | 999 | |
| 1000 | 1000 | // Confirmation validation |
| 1001 | 1001 | if ($action == 'validate') { |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | print '<br>'; |
| 1134 | 1134 | } |
| 1135 | 1135 | if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { |
| 1136 | - print '<input type="checkbox" id="usage_task" name="usage_task"' . (GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')) . '> '; |
|
| 1136 | + print '<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'> '; |
|
| 1137 | 1137 | $htmltext = $langs->trans("ProjectFollowTasks"); |
| 1138 | 1138 | print '<label for="usage_task">'.$form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext).'</label>'; |
| 1139 | 1139 | print '<script>'; |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | print '<br>'; |
| 1160 | 1160 | } |
| 1161 | 1161 | if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { |
| 1162 | - print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"' . (GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')) . '> '; |
|
| 1162 | + print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'> '; |
|
| 1163 | 1163 | $htmltext = $langs->trans("ProjectBillTimeDescription"); |
| 1164 | 1164 | print '<label for="usage_bill_time">'.$form->textwithpicto($langs->trans("BillTime"), $htmltext).'</label>'; |
| 1165 | 1165 | print '<script>'; |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | print '<br>'; |
| 1186 | 1186 | } |
| 1187 | 1187 | if (isModEnabled('eventorganization')) { |
| 1188 | - print '<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'. (GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')) . '> '; |
|
| 1188 | + print '<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')).'> '; |
|
| 1189 | 1189 | $htmltext = $langs->trans("EventOrganizationDescriptionLong"); |
| 1190 | 1190 | print '<label for="usage_organize_event">'.$form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext).'</label>'; |
| 1191 | 1191 | print '<script>'; |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { |
| 1358 | 1358 | $tmpurl = $_SESSION['pageforbacktolist']['project']; |
| 1359 | 1359 | $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); |
| 1360 | - $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1360 | + $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1361 | 1361 | } else { |
| 1362 | 1362 | $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
| 1363 | 1363 | } |
@@ -1434,8 +1434,8 @@ discard block |
||
| 1434 | 1434 | print '<a class="editfielda paddingtop" href="'.$_SERVER["PHP_SELF"].'?action=edit_opp_status&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>'; |
| 1435 | 1435 | } |
| 1436 | 1436 | print '</td><td>'; |
| 1437 | - $html_name_status = ($action == 'edit_opp_status') ? 'opp_status' : 'none'; |
|
| 1438 | - $html_name_percent = ($action == 'edit_opp_status') ? 'opp_percent' : 'none'; |
|
| 1437 | + $html_name_status = ($action == 'edit_opp_status') ? 'opp_status' : 'none'; |
|
| 1438 | + $html_name_percent = ($action == 'edit_opp_status') ? 'opp_percent' : 'none'; |
|
| 1439 | 1439 | $percent_value = (GETPOSTISSET('opp_percent') ? GETPOSTINT('opp_percent') : (strcmp($object->opp_percent, '') ? vatrate($object->opp_percent) : '')); |
| 1440 | 1440 | $formproject->formOpportunityStatus($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->opp_status, $percent_value, $html_name_status, $html_name_percent); |
| 1441 | 1441 | print '</td></tr>'; |
@@ -1662,7 +1662,7 @@ discard block |
||
| 1662 | 1662 | if ($userWrite > 0) { |
| 1663 | 1663 | print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?action=confirm_setdraft&confirm=yes&token='.newToken().'&id='.$object->id, ''); |
| 1664 | 1664 | } else { |
| 1665 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('SetToDraft'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1665 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('SetToDraft'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1666 | 1666 | } |
| 1667 | 1667 | } |
| 1668 | 1668 | } |
@@ -1672,7 +1672,7 @@ discard block |
||
| 1672 | 1672 | if ($userWrite > 0) { |
| 1673 | 1673 | print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, ''); |
| 1674 | 1674 | } else { |
| 1675 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Modify'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1675 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Modify'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1676 | 1676 | } |
| 1677 | 1677 | } |
| 1678 | 1678 | |
@@ -1682,7 +1682,7 @@ discard block |
||
| 1682 | 1682 | //print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, ''); |
| 1683 | 1683 | print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=confirm_validate&confirm=yes&token='.newToken().'&id='.$object->id, ''); |
| 1684 | 1684 | } else { |
| 1685 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1685 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1686 | 1686 | } |
| 1687 | 1687 | } |
| 1688 | 1688 | |
@@ -1692,7 +1692,7 @@ discard block |
||
| 1692 | 1692 | //print dolGetButtonAction('', $langs->trans('Close'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&id='.$object->id, ''); |
| 1693 | 1693 | print dolGetButtonAction('', $langs->trans('Close'), 'default', $_SERVER["PHP_SELF"].'?action=confirm_close&confirm=yes&token='.newToken().'&id='.$object->id, ''); |
| 1694 | 1694 | } else { |
| 1695 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Close'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1695 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Close'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1696 | 1696 | } |
| 1697 | 1697 | } |
| 1698 | 1698 | |
@@ -1701,7 +1701,7 @@ discard block |
||
| 1701 | 1701 | if ($userWrite > 0) { |
| 1702 | 1702 | print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); |
| 1703 | 1703 | } else { |
| 1704 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ReOpen'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1704 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ReOpen'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1705 | 1705 | } |
| 1706 | 1706 | } |
| 1707 | 1707 | |
@@ -1710,7 +1710,7 @@ discard block |
||
| 1710 | 1710 | if (!getDolGlobalString('PROJECT_HIDE_CREATE_OBJECT_BUTTON')) { |
| 1711 | 1711 | // We check the type of thirdparty |
| 1712 | 1712 | $is_customer_or_prospect = (!empty($object->thirdparty->prospect) || !empty($object->thirdparty->client)); |
| 1713 | - $is_supplier_only= (!empty($object->thirdparty->fournisseur) && !$is_customer_or_prospect); |
|
| 1713 | + $is_supplier_only = (!empty($object->thirdparty->fournisseur) && !$is_customer_or_prospect); |
|
| 1714 | 1714 | |
| 1715 | 1715 | $arrayforbutaction = array( |
| 1716 | 1716 | 10 => array('lang'=>'propal', 'enabled' => (isModEnabled("propal") && !$is_customer_or_prospect), 'perm' => $user->hasRight('propal', 'creer') ? true : false, 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), |
@@ -1736,7 +1736,7 @@ discard block |
||
| 1736 | 1736 | if ($userWrite > 0) { |
| 1737 | 1737 | print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.((int) $object->id), ''); |
| 1738 | 1738 | } else { |
| 1739 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1739 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1740 | 1740 | } |
| 1741 | 1741 | } |
| 1742 | 1742 | |
@@ -1745,7 +1745,7 @@ discard block |
||
| 1745 | 1745 | if ($userDelete > 0 || ($object->status == Project::STATUS_DRAFT && $user->hasRight('projet', 'creer'))) { |
| 1746 | 1746 | print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); |
| 1747 | 1747 | } else { |
| 1748 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1748 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1749 | 1749 | } |
| 1750 | 1750 | } |
| 1751 | 1751 | } |