Update contact.php
This commit is contained in:
parent
e5937ef742
commit
8be2bd60a2
@ -1,10 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||||
|
|
||||||
*
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
@ -22,7 +25,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/resource/contact.php
|
* \file htdocs/resource/contact.php
|
||||||
* \ingroup resource
|
* \ingroup resource
|
||||||
* \brief Onglet de gestion des contacts des resources
|
* \brief Contacts management tab for resources
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
@ -32,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array('resource', 'sendings', 'companies'));
|
$langs->loadLangs(array('companies', 'resource', 'sendings'));
|
||||||
|
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$ref = GETPOST('ref', 'alpha');
|
$ref = GETPOST('ref', 'alpha');
|
||||||
@ -41,7 +44,7 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
$object = new DolResource($db);
|
$object = new DolResource($db);
|
||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->socid) {
|
if ($user->socid) {
|
||||||
@ -55,10 +58,12 @@ if (!$user->rights->resource->read) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a new contact
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Add a new contact
|
||||||
if ($action == 'addcontact' && $user->rights->resource->write) {
|
if ($action == 'addcontact' && $user->rights->resource->write) {
|
||||||
if ($result > 0 && $id > 0) {
|
if ($result > 0 && $id > 0) {
|
||||||
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
|
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
|
||||||
@ -80,10 +85,12 @@ if ($action == 'addcontact' && $user->rights->resource->write) {
|
|||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'swapstatut' && $user->rights->resource->write) {
|
} elseif ($action == 'swapstatut' && $user->rights->resource->write) {
|
||||||
// Toggle the status of a contact
|
|
||||||
|
// Toggle the status of a contact
|
||||||
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
|
||||||
} elseif ($action == 'deletecontact' && $user->rights->resource->write) {
|
} elseif ($action == 'deletecontact' && $user->rights->resource->write) {
|
||||||
// Erase a contact
|
|
||||||
|
// Erase a contact
|
||||||
$result = $object->delete_contact(GETPOST('lineid', 'int'));
|
$result = $object->delete_contact(GETPOST('lineid', 'int'));
|
||||||
|
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
@ -106,7 +113,7 @@ $userstatic = new User($db);
|
|||||||
|
|
||||||
llxHeader('', $langs->trans("Resource"));
|
llxHeader('', $langs->trans("Resource"));
|
||||||
|
|
||||||
// Mode vue et edition
|
// View and edit mode
|
||||||
|
|
||||||
if ($id > 0 || !empty($ref)) {
|
if ($id > 0 || !empty($ref)) {
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user