From 2a579b707a83a5566020f4eeb5b572e8eedebaa4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 May 2018 19:43:28 +0200 Subject: [PATCH] FIX javascript showempty error FIX Contact tab not visible when using canvas --- htdocs/core/class/html.formcompany.class.php | 3 +- htdocs/societe/contact.php | 67 ++++++++------------ 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index fbf77080de2..63babef655e 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -599,7 +599,8 @@ class FormCompany var method = obj.method; var url = obj.url; var htmlname = obj.htmlname; - console.log("Run runJsCodeForEvent-'.$htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname); + var showempty = obj.showempty; + console.log("Run runJsCodeForEvent-'.$htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname); $.getJSON(url, { action: method, diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index d57f61045c0..fb56c8b3dcb 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -102,7 +102,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - if ($cancel) + if ($cancel) { $action=''; if (! empty($backtopage)) @@ -139,51 +139,40 @@ llxHeader('',$title,$help_url); $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) + +if (!empty($object->id)) $res=$object->fetch_optionals($object->id,$extralabels); +//if ($res < 0) { dol_print_error($db); exit; } + + +$head = societe_prepare_head($object); + +dol_fiche_head($head, 'contact', $langs->trans("ThirdParty"), 0, 'company'); + +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); + +dol_fiche_end(); + +print '
'; + +if ($action != 'presend') { - // ----------------------------------------- - // When used with CANVAS - // ----------------------------------------- - $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates - $objcanvas->display_canvas($action); // Show template -} -else -{ - - if (!empty($object->id)) $res=$object->fetch_optionals($object->id,$extralabels); - //if ($res < 0) { dol_print_error($db); exit; } - - - $head = societe_prepare_head($object); - - dol_fiche_head($head, 'contact', $langs->trans("ThirdParty"), 0, 'company'); - - $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom'); - - dol_fiche_end(); - - print '
'; - - if ($action != 'presend') + // Contacts list + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - // Contacts list - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) - { - $result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); - } - - // Addresses list - if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) - { - $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); - } + $result=show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } + // Addresses list + if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) + { + $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); + } } + // End of page llxFooter(); $db->close();