diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 2f2b1bcd89d..a591465cb23 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -1180,14 +1180,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
document.formsoc.private.value=1;
});
- var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '0' : '1') . ';
+ var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT) ? '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 || !canHaveCategoryIfNotCustomerProspectSupplier))
+ if (jQuery("#customerprospect").val() == 0 && !canHaveCategoryIfNotCustomerProspectSupplier)
{
jQuery(".visibleifcustomer").hide();
}
@@ -1206,16 +1207,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
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();
- }
}
}
@@ -1646,12 +1641,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$langs->load('categories');
// Customer
- //if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) {
print '
| '.$form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0).' | ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1);
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print " |
";
- //}
if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
print '| '.$form->editfieldkey('ContactCategoriesShort', 'contcats', '', $object, 0).' | ';
@@ -1921,14 +1914,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
});
- var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '0' : '1') . ';
+ var canHaveCategoryIfNotCustomerProspectSupplier = ' . (empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT) ? '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 || !canHaveCategoryIfNotCustomerProspectSupplier))
+ if (jQuery("#customerprospect").val() == 0 && !canHaveCategoryIfNotCustomerProspectSupplier)
{
jQuery(".visibleifcustomer").hide();
}
@@ -1947,16 +1941,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
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();
- }
}
};
@@ -2748,7 +2736,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Tags / categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
// Customer
- if ($object->prospect || $object->client || (!$object->fournisseur && !empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) {
+ if ($object->prospect || $object->client || !empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT)) {
print ' |
| '.$langs->trans("CustomersCategoriesShort").' | ';
print '';
print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1);
|