Code of Conduct
Is there an existing issue for this?
GLPI Version
11.0.7
Plugin version
2.10.2
Bug description
Description
When opening a ticket (ticket.form.php), the browser console throws:
Uncaught ReferenceError: __s is not defined
at cloneandlink_ticket.js.php?v=...:13
Root cause
In public/js/cloneandlink_ticket.js.php, the PHP function __s() is called
inside the JavaScript heredoc as if it were a JavaScript function:
// Line ~40 — correct: PHP context
$locale_cloneandlink = __s("Clone and link", "escalade");
// Line ~58 — bug: inside <<<JAVASCRIPT heredoc, output as raw JS
var duplicate_html = "..." + __s("Clone") + "...";
// ^^^^^^^^^^^^
// PHP function called as JS → ReferenceError
__s() is a PHP-only function. It is not interpolated by PHP because it is
a bare function call inside a heredoc (not a {$variable} expression), so it
is emitted verbatim into the JavaScript output where it fails at runtime.
Steps to reproduce
1. Install the Escalade plugin on GLPI 11.x.
2. Open any existing ticket (/glpi/front/ticket.form.php?id=X).
3. Open the browser developer console.
4. Observe: Uncaught ReferenceError: __s is not defined.
Fix
Pre-compute the translation in PHP before the heredoc, then interpolate the
variable (which PHP does expand inside heredocs):
$locale_cloneandlink = __s("Clone and link", "escalade");
$locale_clone = __s("Clone", "escalade"); // ← add this
$JS = <<<JAVASCRIPT
...
var duplicate_html = "..." + '{$locale_clone}' + "...";
// ^^^^^^^^^^^^^^^^
// PHP interpolates → JS receives plain string
JAVASCRIPT;
Expected behavior
No JavaScript errors. The "Clone" button label renders correctly.
Actual behavior
ReferenceError: __s is not defined thrown on every ticket form page load,
breaking the clone-and-link button functionality.
### Relevant log output
```shell
Page URL
No response
Steps To reproduce
No response
Your GLPI setup information
No response
Anything else?
No response
Code of Conduct
Is there an existing issue for this?
GLPI Version
11.0.7
Plugin version
2.10.2
Bug description
Description
When opening a ticket (
ticket.form.php), the browser console throws:Uncaught ReferenceError: __s is not defined
at cloneandlink_ticket.js.php?v=...:13
Root cause
In
public/js/cloneandlink_ticket.js.php, the PHP function__s()is calledinside the JavaScript heredoc as if it were a JavaScript function:
Page URL
No response
Steps To reproduce
No response
Your GLPI setup information
No response
Anything else?
No response