dolibarr/htdocs/core/class/jsonResponse.class.php
John BOTELLA 3ab77d673e
NEW : Quick memo module (#37422)
* Add quick memo module

* remove backport

* remove under v24 code

* fix css

* remove dirt

* Fix icon and z index

* Fix option coherance

* Missing trad

* css

* Move sql files

* Mv langs files

* missing langs files

* PHP stan add lang trans from Dolibarr JS context

* missing langs

* remove duplicate lang

* Fix lang load after lang move

* remove useless try to include main

* mv jsonResponce.class.php

* rm comment

* rm useless files

* Fix lang load and remove module backport

* Fix lang duplicate

* fix php stan errors

* fix php stan errors

* fix query

* Update memo.class.php

* Update properties to allow null values

* Remove old img

* Fix sql filter

* fields def change for php stan

* PHP doc update

* Comment

* Fix php doc

* Fix php doc

* Fix php doc

* Fix php doc

* Fix php doc

* Fix php stan feedback

* Fix php stan feedback

* Fix php stan feedback

* Fix php stan feedback

* Fix php stan feedback

* Fix php stan feedback

* Use new native css tooltips

* php doc

* php doc

* php doc

* Fix sql

* remove static method

* travis

* travis

* travis

* Move modQuickMemo.class.php

* Update llx_quickmemo_memo-quickmemo.sql

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-04-15 17:47:50 +02:00

90 lines
1.8 KiB
PHP

<?php
/* Copyright (C) 2024 John BOTELLA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Class JsonResponse
* used for ajax responses in Dolibarr
*/
class JsonResponse
{
/**
* the call status to determine if success or fail
*
* @var int $result 0|1
*/
public $result = 0;
/**
* data to return to call can be all type you want
*
* @var mixed
*/
public $data;
/**
* debug data
*
* @var mixed
*/
public $debug;
/**
* returned message used usually as set event message
*
* @var string $msg
*/
public $msg = '';
/**
* the current newToken
*
* @var mixed|string
*/
public $newToken = '';
/**
* JsonResponse constructor.
*/
public function __construct()
{
$this->newToken = newToken();
}
/**
* return json encoded of object
*
* @return string JSON
*/
public function getResponse()
{
if (!$this->result && !headers_sent()) {
http_response_code(400);
}
$jsonResponse = new stdClass();
$jsonResponse->result = $this->result;
$jsonResponse->msg = $this->msg;
$jsonResponse->newToken = $this->newToken;
$jsonResponse->data = $this->data;
$jsonResponse->debug = $this->debug;
return json_encode($jsonResponse, JSON_PRETTY_PRINT);
}
}