FIX The backtopage

This commit is contained in:
Laurent Destailleur 2017-09-27 20:07:01 +02:00
parent fdc1aa2a03
commit 6bdfa99fc2
3 changed files with 23 additions and 3 deletions

View File

@ -396,6 +396,15 @@ if (empty($reshook))
$action = 'edit';
}
}
if (! $error && empty($errors))
{
if (! empty($backtopage))
{
header("Location: ".$backtopage);
exit;
}
}
}
}

View File

@ -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].= ' <span class="badge">'.$nbContact.'</span>';

View File

@ -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 '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&section='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
//print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel&section='.$section.'&urlfile='.urlencode($urlfile).'&backtourl='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>';
//print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel&section='.$section.'&urlfile='.urlencode($urlfile).'&backtopage='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>';
}
/*
if ($user->rights->ecm->setup)