From 4f943c026eeafd4caf6878fc9e5dff9fed3b6550 Mon Sep 17 00:00:00 2001 From: FLIO Date: Wed, 21 Jun 2023 01:45:49 +0200 Subject: [PATCH 1/2] Edit the status icone when we change the status prospect --- htdocs/core/class/html.formcompany.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index c983d503126..6010122b14b 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -1160,11 +1160,13 @@ class FormCompany extends Form console.log("We change a value into a field selectprospectstatus"); var statusid = $(this).val(); var prospectid = $(this).attr("data-socid"); + var image = $(this).prev("img"); $.ajax({ type: "POST", url: \'' . DOL_URL_ROOT . '/core/ajax/ajaxstatusprospect.php\', data: { id: statusid, prospectid: prospectid, token: \''. newToken() .'\', action: \'updatestatusprospect\'}, success: function(response) { + image.attr("src", "../theme/eldy/img/stcomm" + statusid + ".png"); } }); }); From f72693025648b98cfdfce7009fe95d19fd5cc1bd Mon Sep 17 00:00:00 2001 From: FLIO Date: Mon, 26 Jun 2023 23:40:39 +0200 Subject: [PATCH 2/2] [Edit] edit feature to change image directly when updating database --- htdocs/core/ajax/ajaxstatusprospect.php | 3 ++- htdocs/core/class/html.formcompany.class.php | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/core/ajax/ajaxstatusprospect.php b/htdocs/core/ajax/ajaxstatusprospect.php index e5719b98d8b..446a48e2627 100644 --- a/htdocs/core/ajax/ajaxstatusprospect.php +++ b/htdocs/core/ajax/ajaxstatusprospect.php @@ -35,6 +35,7 @@ require '../../main.inc.php'; $idstatus = GETPOST('id', 'int'); $idprospect = GETPOST('prospectid', 'int'); $action = GETPOST('action', 'aZ09'); +$prospectstatic = GETPOST('prospectstatic'); // Security check if ($user->socid > 0) { @@ -68,7 +69,7 @@ if ($action === "updatestatusprospect" && $permisstiontoupdate) { dol_print_error($db); } else { $num = $db->affected_rows($resql); - $response = http_response_code(200); + $response = img_action('', $prospectstatic[$idstatus]['code'], $prospectstatic[$idstatus]['picto'], 'class="inline-block valignmiddle paddingright"'); } $response =json_encode($response); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 7ed89c738e6..b3653040438 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -1159,6 +1159,7 @@ class FormCompany extends Form } elseif ($mode === "js") { print '