diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 7e6c61ca60f..d673588e88f 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -151,9 +151,8 @@ if (isset($mesg)) print $mesg; $id = $_GET["propalid"]; if ($id > 0) { - $langs->trans("PropalCard"); $propal = New Propal($db); - if ( $propal->fetch($_GET['propalid'], $user->societe_id) > 0) + if ( $propal->fetch($_GET['propalid']) > 0) { $soc = new Societe($db, $propal->socid); $soc->fetch($propal->socid); @@ -164,7 +163,7 @@ if ($id > 0) /* - * Facture synthese pour rappel + * Propal synthese pour rappel */ print '
| '.$langs->trans("Source").' | '; @@ -357,8 +356,8 @@ if ($id > 0) } else { - // Contrat non trouv - print "Contrat inexistant ou accés refusé"; + // Propale non trouvée + print "Propale inexistante ou accès refusé"; } } diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 0490af4b989..9087143cb66 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -53,28 +53,23 @@ $pagenext = $page + 1; // Sécurité accés client $user->getrights('facture'); -$user->getrights('propale'); -if (!$user->rights->propale->lire) accessforbidden(); -$socid=''; -if ($_GET["socid"]) { $socid=$_GET["socid"]; } -if ($user->societe_id > 0) + +if (isset($_GET["socid"])) { - $action = ''; - $socid = $user->societe_id; + $objectid=$_GET["socid"]; + $module='societe'; + $dbtable=''; } -if ($_GET['propalid'] > 0) +else if (isset($_GET["propalid"]) && $_GET["propalid"] > 0) { - $propal = new Propal($db); - $result=$propal->fetch($_GET['propalid']); - if (! $result > 0) - { - dolibarr_print_error($db,$propal->error); - exit; - } - if ($user->societe_id > 0 && $propal->socid <> $user->societe_id) - accessforbidden(); + $objectid=$_GET["propalid"]; + $module='propale'; + $dbtable='propal'; } +// Sécurité d'accès client et commerciaux +$socid = restrictedArea($user, $module, $objectid, $dbtable); + /******************************************************************************/ diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php new file mode 100644 index 00000000000..f6c018664e0 --- /dev/null +++ b/htdocs/fichinter/contact.php @@ -0,0 +1,366 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/fichinter/contact.php + \ingroup fichinter + \brief Onglet de gestion des contacts de fiche d'intervention + \version $Revision$ +*/ + +require ("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/fichinter/fichinter.class.php"); +require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/fichinter.lib.php"); + +$langs->load("interventions"); +$langs->load("sendings"); +$langs->load("companies"); + +$fichinterid = isset($_GET["id"])?$_GET["id"]:''; + +// Sécurité d'accès client et commerciaux +$socid = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); + +/* + * Ajout d'un nouveau contact + */ + +if ($_POST["action"] == 'addcontact' && $user->rights->ficheinter->creer) +{ + + $result = 0; + $fichinter = new Fichinter($db); + $result = $fichinter->fetch($_GET["id"]); + + if ($result > 0 && $_GET["id"] > 0) + { + $result = $fichinter->add_contact($_POST["contactid"], $_POST["type"], $_POST["source"]); + } + + if ($result >= 0) + { + Header("Location: contact.php?id=".$fichinter->id); + exit; + } + else + { + $mesg = '||||||||||||||||||||||||||||||||||
| '.$langs->trans("Ref").' | '; + print $fichinter->ref_url; + print " | ||
| ".$langs->trans("Company")." | "; + print ''.$fichinter->client->getNomUrl(1).' | ||
| '.$langs->trans("Source").' | '; + print ''.$langs->trans("Company").' | '; + print ''.$langs->trans("Contacts").' | '; + print ''.$langs->trans("ContactType").' | '; + print ''; + print " | ||
| '.$langs->trans("Source").' | '; + print ''.$langs->trans("Company").' | '; + print ''.$langs->trans("Contacts").' | '; + print ''.$langs->trans("ContactType").' | '; + print ''.$langs->trans("Status").' | '; + print ''; + print " | |
| '; + if ($tab[$i]['source']=='internal') print $langs->trans("Internal"); + if ($tab[$i]['source']=='external') print $langs->trans("External"); + print ' | '; + + // Societe + print ''; + if ($tab[$i]['socid'] > 0) + { + print ''; + print img_object($langs->trans("ShowCompany"),"company").' '.$societe->get_nom($tab[$i]['socid']); + print ''; + } + if ($tab[$i]['socid'] < 0) + { + print $conf->global->MAIN_INFO_SOCIETE_NOM; + } + if (! $tab[$i]['socid']) + { + print ' '; + } + print ' | '; + + // Contact + print ''; + if ($tab[$i]['source']=='internal') + { + print ''; + print img_object($langs->trans("ShowUser"),"user").' '.$tab[$i]['nom'].''; + } + if ($tab[$i]['source']=='external') + { + print ''; + print img_object($langs->trans("ShowContact"),"contact").' '.$tab[$i]['nom'].''; + } + print ' | '; + + // Type de contact + print ''.$tab[$i]['libelle'].' | '; + + // Statut + print ''; + // Activation desativation du contact + if ($fichinter->statut >= 0) print ''; + print $contactstatic->LibStatut($tab[$i]['status'],3); + if ($fichinter->statut >= 0) print ''; + print ' | '; + + // Icon update et delete + print ''; + if ($fichinter->statut < 5 && $user->rights->ficheinter->creer) + { + print ' '; + print ''; + print img_delete(); + print ''; + } + print ' | '; + + print "|