Merge pull request #15240 from frederic34/patch-6

Update card.php
This commit is contained in:
Laurent Destailleur 2020-10-31 18:58:24 +01:00 committed by GitHub
commit 64aef2a73f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 28 deletions

View File

@ -5,6 +5,7 @@
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,26 +36,24 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->load("categories");
// Security check
$socid = GETPOST('socid', 'int');
$socid = (int) GETPOST('socid', 'int');
if (!$user->rights->categorie->lire) accessforbidden();
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$origin = GETPOST('origin', 'alpha');
$catorigin = GETPOST('catorigin', 'int');
$catorigin = (int) GETPOST('catorigin', 'int');
$type = GETPOST('type', 'aZ09');
$urlfrom = GETPOST('urlfrom', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int');
$label = GETPOST('label');
$description = GETPOST('description');
$color = GETPOST('color');
$visible = GETPOST('visible');
$parent = GETPOST('parent');
$label = (string) GETPOST('label', 'alphanohtml');
$description = (string) GETPOST('description', 'restricthtml');
$color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('color', 'alphanohtml'));
$visible = (int) GETPOST('visible', 'int');
$parent = (int) GETPOST('parent', 'int');
if ($origin)
{
if ($origin) {
if ($type == Categorie::TYPE_PRODUCT) $idProdOrigin = $origin;
if ($type == Categorie::TYPE_SUPPLIER) $idSupplierOrigin = $origin;
if ($type == Categorie::TYPE_CUSTOMER) $idCompanyOrigin = $origin;
@ -90,32 +89,25 @@ if ($action == 'add' && $user->rights->categorie->creer)
{
header("Location: ".$urlfrom);
exit;
} elseif ($backtopage)
{
} elseif ($backtopage) {
header("Location: ".$backtopage);
exit;
} elseif ($idProdOrigin)
{
} elseif ($idProdOrigin) {
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type);
exit;
} elseif ($idCompanyOrigin)
{
} elseif ($idCompanyOrigin) {
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type);
exit;
} elseif ($idSupplierOrigin)
{
} elseif ($idSupplierOrigin) {
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type);
exit;
} elseif ($idMemberOrigin)
{
} elseif ($idMemberOrigin) {
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type);
exit;
} elseif ($idContactOrigin)
{
} elseif ($idContactOrigin) {
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type);
exit;
} elseif ($idProjectOrigin)
{
} elseif ($idProjectOrigin) {
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type);
exit;
} else {

View File

@ -3,6 +3,7 @@
* Copyright (C) 2006-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -39,10 +40,10 @@ $action = (GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'edit');
$confirm = GETPOST('confirm');
$cancel = GETPOST('cancel', 'alpha');
$socid = GETPOST('socid', 'int');
$label = GETPOST('label', 'alphanohtml');
$description = GETPOST('description', 'restricthtml');
$color = preg_replace('/[^0-9a-f#]/i', '', GETPOST('color', 'alphanohtml'));
$socid = (int) GETPOST('socid', 'int');
$label = (string) GETPOST('label', 'alphanohtml');
$description = (string) GETPOST('description', 'restricthtml');
$color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('color', 'alphanohtml'));
$visible = (int) GETPOST('visible', 'int');
$parent = (int) GETPOST('parent', 'int');