From efc0251a66ad35d1bcbd4511aa36ed1791277058 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 6 Dec 2021 11:40:50 +0100 Subject: [PATCH] FIX can modify tag in thirdparty card if const THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER enabled --- htdocs/societe/card.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 052d681b0a0..9a6e0888b8c 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1126,13 +1126,14 @@ else document.formsoc.private.value=1; }); + var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '0' : '1') . '; init_customer_categ(); $("#customerprospect").change(function() { init_customer_categ(); }); function init_customer_categ() { console.log("is customer or prospect = "+jQuery("#customerprospect").val()); - if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() == 0 || ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '1' : '0').')) + if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() != 0 || !canHaveCategoryIfNotCustomerProspectSupplier)) { jQuery(".visibleifcustomer").hide(); } @@ -1151,10 +1152,16 @@ else if (jQuery("#fournisseur").val() == 0) { jQuery(".visibleifsupplier").hide(); + if (jQuery("#customerprospect").val() == 0 && canHaveCategoryIfNotCustomerProspectSupplier && jQuery(".visibleifcustomer").is(":hidden")) { + jQuery(".visibleifcustomer").show(); + } } else { jQuery(".visibleifsupplier").show(); + if (jQuery("#customerprospect").val() == 0 && jQuery(".visibleifcustomer").is(":visible")) { + jQuery(".visibleifcustomer").hide(); + } } } @@ -1769,13 +1776,14 @@ else } }); + var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '0' : '1') . '; init_customer_categ(); $("#customerprospect").change(function() { init_customer_categ(); }); function init_customer_categ() { console.log("is customer or prospect = "+jQuery("#customerprospect").val()); - if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() == 0 || '.(empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '1' : '0').')) + if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() != 0 || !canHaveCategoryIfNotCustomerProspectSupplier)) { jQuery(".visibleifcustomer").hide(); } @@ -1794,10 +1802,16 @@ else if (jQuery("#fournisseur").val() == 0) { jQuery(".visibleifsupplier").hide(); + if (jQuery("#customerprospect").val() == 0 && canHaveCategoryIfNotCustomerProspectSupplier && jQuery(".visibleifcustomer").is(":hidden")) { + jQuery(".visibleifcustomer").show(); + } } else { jQuery(".visibleifsupplier").show(); + if (jQuery("#customerprospect").val() == 0 && jQuery(".visibleifcustomer").is(":visible")) { + jQuery(".visibleifcustomer").hide(); + } } };