From 6bdfa99fc2f2c0dbec14b06035bf4a8f32be741e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Sep 2017 20:07:01 +0200 Subject: [PATCH] FIX The backtopage --- htdocs/contact/card.php | 9 +++++++++ htdocs/core/lib/company.lib.php | 11 +++++++++++ htdocs/ecm/docfile.php | 6 +++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 43b9b7e4760..ac3c52ae8f5 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -396,6 +396,15 @@ if (empty($reshook)) $action = 'edit'; } } + + if (! $error && empty($errors)) + { + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + } } } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 54c5abfda93..f22da301ec4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -52,6 +52,17 @@ function societe_prepare_head(Societe $object) { //$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); $nbContact = 0; // TODO + + $sql = "SELECT COUNT(p.rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; + $sql .= " WHERE p.fk_soc = ".$object->id; + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) $nbContact = $obj->nb; + } + $head[$h][0] = DOL_URL_ROOT.'/societe/contact.php?socid='.$object->id; $head[$h][1] = $langs->trans('ContactsAddresses'); if ($nbContact > 0) $head[$h][1].= ' '.$nbContact.''; diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php index a856ab22c36..f6719d08604 100644 --- a/htdocs/ecm/docfile.php +++ b/htdocs/ecm/docfile.php @@ -117,9 +117,9 @@ if (! ($result >= 0)) if ($cancel) { $action =''; - if ($backtourl) + if ($backtopage) { - header("Location: ".$backtourl); + header("Location: ".$backtopage); exit; } else @@ -387,7 +387,7 @@ if ($action != 'edit') { print ''.$langs->trans('Edit').''; - //print ''.$langs->trans('Cancel').''; + //print ''.$langs->trans('Cancel').''; } /* if ($user->rights->ecm->setup)