From d85f7be1f513bda1e59e375183074af2f49c45e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Feb 2016 02:06:12 +0100 Subject: [PATCH] FIX #4423 --- ChangeLog | 1 + htdocs/contact/card.php | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 439ae83b35d..a17879fcbdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -115,6 +115,7 @@ NEW: Use new select2 component for juridical status, country and state selection NEW: When creating order, proposal or invoice from thirdparty card, the project is asked during creation. A link to create project if it does not exists is also available. NEW: Uniformize form creation of proposal to add public and private notes during creation like for order and invoice. NEW: More robust antiXSS engine. +NEW: Compatibility with Mysql 5.7+ For developers: NEW: The search box and the bookmarks are now rendered by the menu manager. diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index d762b134b1c..bd9a4b781f5 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -512,10 +512,12 @@ else $(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).'"); $(\'input[name="zipcode"]\').val("'.dol_escape_js($objsoc->zip).'"); $(\'input[name="town"]\').val("'.dol_escape_js($objsoc->town).'"); - $(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'"); - $(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'"); - $(\'input[name="email"]\').val("'.dol_escape_js($objsoc->email).'"); - }); + console.log("Set state_id to '.dol_escape_js($objsoc->state_id).'"); + $(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'").trigger("change"); + /* set country at end because it will trigger page refresh */ + console.log("Set country id to '.dol_escape_js($objsoc->country_id).'"); + $(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'").trigger("change"); /* trigger required to update select2 components */ + }); })'."\n"; print ''."\n"; } @@ -750,11 +752,14 @@ else }); $("#copyaddressfromsoc").click(function() { - $(\'textarea[name="address"]\').text("'.dol_escape_js($objsoc->address).'"); + $(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).'"); $(\'input[name="zipcode"]\').val("'.dol_escape_js($objsoc->zip).'"); $(\'input[name="town"]\').val("'.dol_escape_js($objsoc->town).'"); - $(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'"); - $(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'"); + console.log("Set state_id to '.dol_escape_js($objsoc->state_id).'"); + $(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'").trigger("change"); + /* set country at end because it will trigger page refresh */ + console.log("Set country id to '.dol_escape_js($objsoc->country_id).'"); + $(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'").trigger("change"); /* trigger required to update select2 components */ }); })'."\n"; print ''."\n";