New: Now webservice module must be activated to enable call of webservice server.php page.

This commit is contained in:
Laurent Destailleur 2009-05-08 12:08:54 +00:00
parent 852e8703f6
commit 44c223450a
10 changed files with 224 additions and 54 deletions

View File

@ -17,9 +17,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/** \file htdocs/admin/aybox.php
* \ingroup bookmark
* \brief Page to setup bookmark module
/** \file htdocs/admin/paybox.php
* \ingroup paybox
* \brief Page to setup paybox module
* \version $Id$
*/

View File

@ -30,7 +30,7 @@ $langs->load("install");
$langs->load("other");
if (!$user->admin)
accessforbidden();
accessforbidden();
/*
@ -53,21 +53,21 @@ $modules_names = array();
$modules_files = array();
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, strlen($file) - 10);
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, strlen($file) - 10);
if ($modName)
{
include_once(DOL_DOCUMENT_ROOT."/includes/modules/".$file);
$objMod = new $modName($db);
if ($modName)
{
include_once(DOL_DOCUMENT_ROOT."/includes/modules/".$file);
$objMod = new $modName($db);
$modules[$objMod->numero]=$objMod;
$modules_names[$objMod->numero]=$objMod->name;
$modules[$objMod->numero]=$objMod;
$modules_names[$objMod->numero]=$objMod->name;
$modules_files[$objMod->numero]=$file;
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
}
}
$picto[$objMod->numero]=(isset($objMod->picto) && $objMod->picto)?$objMod->picto:'generic';
}
}
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -82,37 +82,46 @@ ksort($sortorder);
$rights_ids = array();
foreach($sortorder as $numero=>$name)
{
$idperms="";
$var=!$var;
// Module
print "<tr $bc[$var]><td width=\"300\" nowrap=\"nowrap\">";
$idperms="";
$var=!$var;
// Module
print "<tr $bc[$var]><td width=\"300\" nowrap=\"nowrap\">";
$alt=$name.' - '.$modules_files[$numero];
print img_object($alt,$picto[$numero]).' '.$modules[$numero]->getName();
print "</td>";
// Version
print '<td>'.$modules[$numero]->getVersion().'</td>';
// Id
print '<td align="center">'.$numero.'</td>';
// Permissions
if ($modules[$numero]->rights)
if (! empty($picto[$numero]))
{
foreach($modules[$numero]->rights as $rights)
{
$idperms.=($idperms?", ":"").$rights[0];
array_push($rights_ids, $rights[0]);
}
if (eregi('^/',$picto[$numero])) print img_picto($alt,$picto[$numero],'',1);
else print img_object($alt,$picto[$numero]);
}
print '<td>'.($idperms?$idperms:"&nbsp;").'</td>';
print "</tr>\n";
else
{
print img_object($alt,$picto[$numero]);
}
print ' '.$modules[$numero]->getName();
print "</td>";
// Version
print '<td>'.$modules[$numero]->getVersion().'</td>';
// Id
print '<td align="center">'.$numero.'</td>';
// Permissions
if ($modules[$numero]->rights)
{
foreach($modules[$numero]->rights as $rights)
{
$idperms.=($idperms?", ":"").$rights[0];
array_push($rights_ids, $rights[0]);
}
}
print '<td>'.($idperms?$idperms:"&nbsp;").'</td>';
print "</tr>\n";
}
print '</table>';
print '<br>';
sort($rights_ids);
foreach($rights_ids as $right_id)
{
if ($old == $right_id)
print "Attention doublon sur la permission : $right_id<br>";
$old = $right_id;
if ($old == $right_id)
print "Warning duplicate id on permission : ".$right_id."<br>";
$old = $right_id;
}
llxFooter('$Date$ - $Revision$');

View File

@ -0,0 +1,138 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.org>
*
* 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.
*/
/** \file htdocs/admin/webservices.php
* \ingroup webservices
* \brief Page to setup webservices module
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
$langs->load("admin");
if (!$user->admin)
accessforbidden();
if ($_POST["action"] == 'setvalue' && $user->admin)
{
//$result=dolibarr_set_const($db, "PAYBOX_IBS_DEVISE",$_POST["PAYBOX_IBS_DEVISE"],'chaine',0,'',$conf->entity);
if ($result >= 0)
{
$mesg='<div class="ok">'.$langs->trans("SetupSaved").'</div>';
}
else
{
dol_print_error($db);
}
}
/*
* View
*/
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("WebServicesSetup"),$linkback,'setup');
print $langs->trans("WebServicesDesc")."<br>\n";
if ($mesg) print '<br>'.$mesg;
/*
print '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="action" value="setvalue">';
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("PAYBOX_IBS_DEVISE").'</td><td>';
print '<input size="32" type="text" name="PAYBOX_IBS_DEVISE" value="'.$conf->global->PAYBOX_IBS_DEVISE.'">';
print '<br>'.$langs->trans("Example").': 978 (EUR)';
print '</td></tr>';
print '</table>';
print '</form>';
*/
print '<br><br>';
// Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr'
$firstpart=$dolibarr_main_url_root;
$regex=DOL_URL_ROOT.'$';
$firstpart=eregi_replace($regex,'',$firstpart);
print '<u>'.$langs->trans("WSDLCanBeDownloadedHere").':</u><br>';
$url=$firstpart.DOL_URL_ROOT.'/webservices/server.php?wsdl';
print img_picto('','puce.png').' '.'<a href="'.$url.'">'.$url."</a><br>\n";
print '<br>';
print '<u>'.$langs->trans("EndPointIs").':</u><br>';
$url=$firstpart.DOL_URL_ROOT.'/webservices/server.php';
print img_picto('','puce.png').' '.'<a href="'.$url.'">'.$url."</a><br>\n";
print '<br>';
/*
if ($conf->commande->enabled)
{
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>';
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=order&ref=<i>order_ref</i></b>'."<br>\n";
print '<br>';
}
if ($conf->facture->enabled)
{
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>';
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=invoice&ref=<i>invoice_ref</i></b>'."<br>\n";
// print $langs->trans("SetupPayBoxToHavePaymentCreatedAutomatically",$langs->transnoentitiesnoconv("FeatureNotYetAvailable"))."<br>\n";
print '<br>';
}
if ($conf->contrat->enabled)
{
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>';
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=contractline&ref=<i>contractline_ref</i></b>'."<br>\n";
print '<br>';
}
if ($conf->adherent->enabled)
{
print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':<br>';
print '<b>'.$firstpart.DOL_URL_ROOT.'/public/paybox/newpayment.php?amount=membersubscription&ref=<i>member_ref</i></b>'."<br>\n";
print '<br>';
}
*/
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -53,6 +53,7 @@ class modLdap extends DolibarrModules
$this->description = "Synchronisation Ldap";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
$this->special = 1;
// Data directories to create when module is enabled

View File

@ -64,6 +64,7 @@ class modSociete extends DolibarrModules
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0;
$this->config_page_url = array("societe.php");
// Name of image file used for this module.
$this->picto='company';
// Data directories to create when module is enabled

View File

@ -62,7 +62,8 @@ class modSyslog extends DolibarrModules
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
$this->special = 2;
//$this->picto='phoning';
// Name of image file used for this module.
$this->picto='generic';
// Data directories to create when module is enabled
$this->dirs = array();

View File

@ -17,16 +17,16 @@
*/
/**
\defgroup webservices Module WebServices
\brief Module to enable the Dolibarr server of web services
\brief $Id$
* \defgroup webservices Module WebServices
* \brief Module to enable the Dolibarr server of web services
* \brief $Id$
*/
/**
\file htdocs/includes/modules/modWebServices.class.php
\ingroup webservices
\brief File to describe webservices module
*/
* \file htdocs/includes/modules/modWebServices.class.php
* \ingroup webservices
* \brief File to describe webservices module
*/
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
@ -47,15 +47,17 @@ class modWebServices extends DolibarrModules
$this->db = $DB;
$this->numero = 2600;
$this->family = "projects";
$this->family = "technic";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = eregi_replace('^mod','',get_class($this));
$this->description = "Enable the Dolibarr web services server";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0;
$this->picto='generic';
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
$this->special = 1;
// Name of image file used for this module.
$this->picto='generic';
// Data directories to create when module is enabled
$this->dirs = array();

View File

@ -13,7 +13,7 @@ HTMLCharset=Charset for generated HTML pages
DBStoringCharset=Database charset to store data
DBSortingCharset=Database charset to sort data
WarningModuleNotActive=Module <b>%s</b> must be enabled
WarningOnlyPermissionOfActivatedModules=Only permissions related to activated modules are shown here. You can activate other modules in the Setup - Module page.
WarningOnlyPermissionOfActivatedModules=Only permissions related to activated modules are shown here. You can activate other modules in the Home->Setup->Modules page.
DolibarrSetup=Dolibarr setup
DolibarrUser=Dolibarr user
InternalUser=Internal user
@ -646,7 +646,7 @@ SystemAreaForAdminOnly=This area is available for administrator users only. None
CompanyFundationDesc=Edit on this page all known information of the company or fundation you need to manage
DisplayDesc=You can choose each parameter related to the Dolibarr look and feel here
AvailableModules=Available modules
ToActivateModule=To activate modules, go on setup Area.
ToActivateModule=To activate modules, go on setup Area (Home->Setup->Modules).
SessionTimeOut=Time out for session
SessionExplanation=This number guarantee that session will never expire before this delay. But PHP sessoin management does not guaranty that session always expire after this delay: This occurs if a system to clean cache session is running.<br>Note: with no particular system, internal PHP process will clean session every about <b>%s/%s</b> access but only during access made by other sessions.
TriggersAvailable=Available triggers
@ -1042,4 +1042,9 @@ CashDeskIdWareHouse=Datawarehous to user for sells
##### Bookmark #####
BookmarkSetup=Bookmark module setup
BookmarkDesc=This module allows you to manage bookmarks. You can also add shortcuts to any Dolibarr pages or externale web sites on your left menu.
NbOfBoomarkToShow=Maximum number of bookmarks to show in left menu
NbOfBoomarkToShow=Maximum number of bookmarks to show in left menu
##### WebServices #####
WebServicesSetup=Webservices module setup
WebServicesDesc=By enabling this module, Dolibarr become a web service server to provide miscellaneous web services.
WSDLCanBeDownloadedHere=WSDL descriptor file of provided serviceses can be download here
EndPointIs=SOAP clients must send their requests to the Dolibarr endpoint available at Url

View File

@ -645,7 +645,7 @@ SystemAreaForAdminOnly = Cet espace n'est accessible qu'aux utilisateurs de type
CompanyFundationDesc = Éditer sur cette page toutes les informations connues sur la société ou association que vous devez gérer
DisplayDesc = Vous pouvez choisir ici tous les paramètres liés à l'apparence de Dolibarr
AvailableModules = Modules disponibles
ToActivateModule = Pour activer des modules, aller dans l'espace Configuration.
ToActivateModule = Pour activer des modules, aller dans l'espace Configuration (Accueil->Configuration->Modules).
SessionTimeOut = Time out des sessions
SessionExplanation = Ce nombre garantie que la session n'expire pas avant ce délai. Mais la gestion de session PHP ne garantie pas que la session expire après ce délai: Ce sera le cas si un systeme de nettoyage des caches sessions est en place.<br>Note: Sans mécanisme special, le mécanisme interne à PHP nettoie la session tous les <b>%s/%s</b> accès environ mais uniquement lors d'accès fait par d'autres sessions.
TriggersAvailable = Triggers disponibles
@ -1042,3 +1042,8 @@ CashDeskIdWareHouse = Entrepot à utiliser pour les ventes
BookmarkSetup = Configuration du module Bookmark
BookmarkDesc = Ce module vous permet de gérer des liens et raccourcis. Il permet aussi d'ajouter n'importe quelle page de Dolibarr ou lien web dans le menu d'accès rapide sur la gauche.
NbOfBoomarkToShow = Nombre maximum de marques-pages à afficher dans le menu
##### WebServices #####
WebServicesSetup=Configuration du module Webservices
WebServicesDesc=En activant ce module, Dolibarr devient aussi serveur de web services offrant des web services divers.
WSDLCanBeDownloadedHere=Le descripteur WSDL des services fournis peut etre récupéré ici
EndPointIs=Les clients SOAP doivent envoyer leur requetes vers l'endpoint Dolibarr à l'URL

View File

@ -32,7 +32,15 @@ require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP
dol_syslog("Call Dolibarr webservices interfaces");
// TODO Enable and test if module web services is enabled
// Enable and test if module web services is enabled
if (empty($conf->global->MAIN_MODULE_WEBSERVICES))
{
$langs->load("admin");
dol_syslog("Call Dolibarr webservices interfaces with module webservices disabled");
print $langs->trans("WarningModuleNotActive",'WebServices').'.<br><br>';
print $langs->trans("ToActivateModule");
exit;
}
// Create the soap Object
$server = new soap_server();