Try to fix a strange logic.
This commit is contained in:
parent
f2f2ce7d7c
commit
bc7ad806e7
@ -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 '<tr class="visibleifcustomer"><td class="toptd">'.$form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0).'</td><td colspan="3">';
|
||||
$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 "</td></tr>";
|
||||
//}
|
||||
|
||||
if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
|
||||
print '<tr class="individualline"><td class="toptd">'.$form->editfieldkey('ContactCategoriesShort', 'contcats', '', $object, 0).'</td><td colspan="3">';
|
||||
@ -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 '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>';
|
||||
print '<td>';
|
||||
print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user