cvsimport

Conflicts:
	htdocs/contact/canvas/actions_contactcard_common.class.php
	htdocs/contact/fiche.php
	htdocs/core/class/canvas.class.php
	htdocs/societe/class/societe.class.php
	htdocs/societe/soc.php
This commit is contained in:
Regis Houssin 2011-09-25 09:46:32 +02:00
commit f08e9ae5c6
18 changed files with 205 additions and 683 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ default.properties
.settings/
.buildpath
.gitmodules
dolibarr_install.log

View File

@ -121,13 +121,11 @@ if ($resql)
print_barre_liste($langs->trans("SocialContributions"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines);
}
if ($mesg)
{
print $mesg."<br>";
}
dol_htmloutput_mesg($mesg);
if (empty($mysoc->pays_id) && empty($mysoc->pays_code))
if (empty($mysoc->country_id) && empty($mysoc->country_code))
{
print '<div class="error">';
$langs->load("errors");

View File

@ -54,7 +54,7 @@ abstract class ActionsContactCardCommon
function __construct($DB, $dirmodule, $targetmodule, $canvas, $card)
{
$this->db = $DB;
$this->dirmodule = $targetmodule;
$this->dirmodule = $dirmodule;
$this->targetmodule = $targetmodule;
$this->canvas = $canvas;
$this->card = $card;
@ -482,4 +482,4 @@ abstract class ActionsContactCardCommon
}
?>
?>

View File

@ -277,7 +277,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
// -----------------------------------------
// When used with CANVAS
// -----------------------------------------
if (! $objcanvas->hasActions() && $id)
{
$object = new Societe($db);
$object->fetch($id); // For use with "pure canvas" (canvas that contains templates only)
}
$objcanvas->assign_values($action, $id); // Set value for templates
$objcanvas->display_canvas(); // Show template
}
@ -324,6 +328,8 @@ else
/*
* Fiche en mode creation
*/
$object->canvas=$canvas;
$object->fk_departement = $_POST["departement_id"];
// We set pays_id, pays_code and label for the selected country

View File

@ -37,24 +37,22 @@ class Canvas
var $dirmodule; // Module directory
var $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...)
var $canvas; // Name of canvas
var $canvas; // Name of canvas (ex: company, individual, product, service, ...)
var $card; // Tab (sub-canvas)
var $template_dir; // Initialized by getCanvas with templates directory
var $control_file; // Initialized by getCanvas with controller file name
var $control; // Initialized by getCanvas with controller instance
var $object; // Initialized by getCanvas with dao instance, filled by getObject
var $template_dir; // Initialized by getCanvas with templates directory
var $control; // Initialized by getCanvas with controller instance
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @param DoliDB $DB Database handler
* @param string $actiontype Action type ('create', 'view', 'edit', 'list')
*/
function __construct($DB, $actiontype='view')
{
$this->db = $DB;
$this->actiontype = $actiontype;
if ($this->actiontype == 'add') $this->actiontype='create';
if ($this->actiontype == 'update') $this->actiontype='edit';
@ -62,19 +60,17 @@ class Canvas
}
/**
* Initialize properties: ->targetmodule, ->canvas, ->card
* and MVC properties: ->control (Controller), ->control->object (Model), ->template_dir (View)
* Initialize properties: ->targetmodule, ->canvas, ->card, ->dirmodule, ->template_dir
*
* @param module Name of target module (thirdparty, contact, ...)
* @param card Type of card (ex: 'card', 'info', 'contactcard', ...) or '' for a list page
* @param canvas Name of canvas (ex: mycanvas, default, or mycanvas@myexternalmodule)
* @param string $module Name of target module (thirdparty, contact, ...)
* @param string $card Tab name of card (ex: 'card', 'info', 'contactcard', ...) or '' for a list page
* @param string $canvas Name of canvas (ex: mycanvas, default, or mycanvas@myexternalmodule)
* @return void
*/
function getCanvas($module, $card, $canvas)
{
global $conf, $langs;
$error='';
// Set properties with value specific to dolibarr core: this->targetmodule, this->card, this->canvas
$this->targetmodule = $module;
$this->canvas = $canvas;
@ -89,6 +85,7 @@ class Canvas
// For compatibility
if ($this->dirmodule == 'thirdparty') { $this->dirmodule = 'societe'; }
// Control file
$controlclassfile = dol_buildpath('/'.$this->dirmodule.'/canvas/'.$this->canvas.'/actions_'.$this->card.'_'.$this->canvas.'.class.php');
if (file_exists($controlclassfile))
{
@ -110,21 +107,28 @@ class Canvas
//print 'dimodule='.$dirmodule.' canvas='.$this->canvas.'<br>';
//print ' => template_dir='.$this->template_dir.'<br>';
//print ' => control_file='.$this->control_file.' is_object(this->control)='.is_object($this->control).'<br>';
return 1;
}
/**
* Return if a canvas contains an action controller
*
* @return boolean Return if canvas contains actions (old feature. now actions should be inside hooks)
*/
function hasActions()
{
return (! is_object($this->control));
}
/**
* Shared method for canvas to execute actions
*
* @param string $action Action string
*
* @param string &$action Action string
* @param int $id Object id
* @return void
* @return mixed Return return code of doActions of canvas
*/
function doActions(&$action='view', $id=0)
{
if (method_exists($this->control,'doActions'))
if (method_exists($this->control,'doActions'))
{
$ret = $this->control->doActions($action, $id);
return $ret;
@ -133,8 +137,8 @@ class Canvas
/**
* Shared method for canvas to assign values for templates
*
* @param string $action Action string
*
* @param string &$action Action string
* @param int $id Object id
* @return void
*/
@ -146,7 +150,7 @@ class Canvas
/**
* Return the template to display canvas (if it exists)
*
* @return string Path to display canvas file if it exists, '' otherwise.
* @return int 0=Canvas template file does not exist, 1=Canvas template file exists
*/
function displayCanvasExists()
{
@ -158,8 +162,7 @@ class Canvas
/**
* Display a canvas page. This will include the template for output.
* Variables used by templates may have been defined, loaded before
* into the assign_values function.
* Variables used by templates may have been defined or loaded before into the assign_values function.
*
* @return void
*/

View File

@ -459,8 +459,8 @@ class ProductFournisseur extends Product
/**
* List all supplier prices of a product
*
* @param rowid id du produit
* @return table table de ProductFournisseur
* @param int $rowid id du produit
* @return array Array of ProductFournisseur
*/
function fetch_product_fournisseur($prodid)
{

View File

@ -986,7 +986,7 @@ if ($id > 0 || ! empty($ref))
//print "$object->id, $object->socid, $object->fk_project";
if ($action == 'classify')
{
$html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid');
$html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:'-1', $object->fk_project, 'projectid');
}
else
{

View File

@ -44,15 +44,15 @@ $result = restrictedArea($user, 'commande_fournisseur', $id,'');
if ($_POST["action"] == 'updatenote' && $user->rights->fournisseur->commande->creer)
{
$commande = new CommandeFournisseur($db);
$commande->fetch($_GET["id"]);
$commande = new CommandeFournisseur($db);
$commande->fetch($_GET["id"]);
$result = $commande->UpdateNote($user, $_POST["note"], $_POST["note_public"]);
if ($result >= 0)
{
Header("Location: note.php?id=".$_GET["id"]);
exit;
}
$result = $commande->UpdateNote($user, $_POST["note"], $_POST["note_public"]);
if ($result >= 0)
{
Header("Location: note.php?id=".$_GET["id"]);
exit;
}
}
@ -76,103 +76,105 @@ $id = $_GET['id'];
$ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
$commande = new CommandeFournisseur($db);
$result=$commande->fetch($_GET["id"],$_GET['ref']);
if ($result >= 0)
{
$soc = new Societe($db);
$soc->fetch($commande->socid);
$commande = new CommandeFournisseur($db);
$result=$commande->fetch($_GET["id"],$_GET['ref']);
if ($result >= 0)
{
$soc = new Societe($db);
$soc->fetch($commande->socid);
$author = new User($db);
$author->fetch($commande->user_author_id);
$author = new User($db);
$author->fetch($commande->user_author_id);
$head = ordersupplier_prepare_head($commande);
$head = ordersupplier_prepare_head($commande);
$title=$langs->trans("SupplierOrder");
dol_fiche_head($head, 'note', $title, 0, 'order');
$title=$langs->trans("SupplierOrder");
dol_fiche_head($head, 'note', $title, 0, 'order');
/*
* Commande
*/
print '<form action="note.php?id='.$commande->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updatenote">';
/*
* Commande
*/
print '<form action="note.php?id='.$commande->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updatenote">';
print '<table class="border" width="100%">';
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $html->showrefnav($commande,'ref','',1,'ref','ref');
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>';
// Fournisseur
print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>';
// Statut
print '<tr>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">';
print $commande->getLibStatut(4);
print "</td></tr>";
// Statut
print '<tr>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">';
print $commande->getLibStatut(4);
print "</td></tr>";
// Date
if ($commande->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($commande->date_commande)
{
print dol_print_date($commande->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
// Date
if ($commande->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($commande->date_commande)
{
print dol_print_date($commande->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
if ($commande->methode_commande)
{
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
}
}
if ($commande->methode_commande)
{
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
}
}
// Auteur
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '</tr>';
// Auteur
print '<tr><td>'.$langs->trans("AuthorRequest").'</td>';
print '<td colspan="2">'.$author->getNomUrl(1).'</td>';
print '</tr>';
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
print '<td colspan="2">';
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_4.'" name="note_public">';
print $commande->note_public;
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
print '<td colspan="2">';
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_4.'" name="note_public">';
print $commande->note_public;
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
print '</td></tr>';
if (! $user->societe_id)
{
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="2">';
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_8.'" name="note">';
print $commande->note;
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
print '</td></tr>';
}
if (! $user->societe_id)
{
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
print '<td colspan="2">';
if ($user->rights->fournisseur->commande->creer) print '<textarea cols="90" rows="'.ROWS_8.'" name="note">';
print $commande->note;
if ($user->rights->fournisseur->commande->creer) print '</textarea>';
print '</td></tr>';
}
if ($user->rights->fournisseur->commande->creer)
{
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
}
print "</table>";
print "</table></form>";
if ($user->rights->fournisseur->commande->creer)
{
print '<center><br><input type="submit" class="button" value="'.$langs->trans("Save").'"></center>';
}
print "</div>\n";
}
else
{
/* Order not found */
$langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
}
print "</form>";
dol_fiche_end();
}
else
{
/* Order not found */
$langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
}
}

View File

@ -130,7 +130,7 @@ if ($_GET["facid"])
}
print "</td></tr>";
// Note priv<EFBFBD>e
// Note private
if (! $user->societe_id)
{
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
@ -153,11 +153,11 @@ if ($_GET["facid"])
print "</table>";
dol_fiche_end();
/*
* Actions
*/
print '</div>';
print '<div class="tabsAction">';
if ($user->rights->fournisseur->facture->creer && $_GET["action"] <> 'edit')

View File

@ -1,132 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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, see <http://www.gnu.org/licenses/>.
*/
/**
* \defgroup mantis Module mantis
* \brief Module to include Mantis into Dolibarr
* \file htdocs/includes/modules/modMantis.class.php
* \ingroup mantis
* \brief Description and activation file for module Mantis
*/
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
/**
* \class modMantis
* \brief Description and activation class for module Mantis
*/
class modMantis extends DolibarrModules
{
/**
* \brief Constructor. Define names, constants, directories, boxes, permissions
* \param DB Database handler
*/
function modMantis($DB)
{
$this->db = $DB;
// Id for module (must be unique).
// Use here a free id.
$this->numero = 50300;
// Family can be 'crm','financial','hr','projects','product','technic','other'
// It is used to sort modules in module setup page
$this->family = "projects";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description used translation string 'ModuleXXXDesc' not found (XXX is id value)
$this->description = "Interfacage avec le bug tracking Mantis";
// Possible values for version are: 'experimental' or 'dolibarr' or version
$this->version = 'development';
// Id used in llx_const table to manage module status (enabled/disabled)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=other)
$this->special = 1;
// Name of png file (without png) used for this module
$this->picto='calendar';
// Data directories to create when module is enabled
$this->dirs = array();
// Config pages
$this->config_page_url = array("mantis.php@mantis");
// Dependencies
$this->depends = array(); // List of modules id that must be enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
// Constants
$this->const = array(); // List of parameters
// Boxes
$this->boxes = array(); // List of boxes
// Permissions
$this->rights_class = 'mantis'; // Permission key
$this->rights = array(); // Permission array used by this module
// Menus
//------
$r=0;
$this->menu[$r]=array('fk_menu'=>0,
'type'=>'top',
'titre'=>'BugTracker',
'mainmenu'=>'mantis',
'leftmenu'=>'1',
'url'=>'/mantis/mantis.php',
'langs'=>'other',
'position'=>100,
'enabled'=>'$conf->mantis->enabled',
'perms'=>'',
'target'=>'',
'user'=>0);
$r++;
}
/**
* \brief Function called when module is enabled.
* Add constants, boxes and permissions into Dolibarr database.
* It also creates data directories.
*/
function init()
{
$sql = array();
return $this->_init($sql);
}
/**
* \brief Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
*/
function remove()
{
$sql = array();
return $this->_remove($sql);
}
}
?>

View File

@ -676,7 +676,7 @@ if (! defined('NOLOGIN'))
{
// If not active, we refuse the user
$langs->load("other");
dol_syslog ("Authentification ko as login is disabled");
dol_syslog("Authentification ko as login is disabled");
accessforbidden($langs->trans("ErrorLoginDisabled"));
exit;
}
@ -763,11 +763,13 @@ if (! function_exists("llxHeader"))
* @param string $help_url Url links to help page
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
* For other external page: http://server/url
* @param string $target Target to use on links
* @param int $disablejs More content into html header
* @param int $disablehead More content into html header
* @param array $arrayofjs Array of complementary js files
* @param array $arrayofcss Array of complementary css files
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
* @return void
*/
function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='')
{
@ -781,6 +783,8 @@ if (! function_exists("llxHeader"))
/**
* Show HTTP header
*
* @return void
*/
function top_httphead()
{
@ -1047,6 +1051,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
* @param array $arrayofjs Array of js files to add in header
* @param array $arrayofcss Array of css files to add in header
* @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails)
* @return void
*/
function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='')
{
@ -1275,14 +1280,16 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
/**
* Show left menu bar
* @param menu_array_before Table of menu entries to show before entries of menu handler
* @param helppagename Name of wiki page for help ('' by default).
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
* For other external page: http://server/url
* @param moresearchform Search Form Permanent Supplemental
* @param menu_array_after Table of menu entries to show after entries of menu handler
* @param leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules.
* @param title Title of web page
*
* @param array $menu_array_before Table of menu entries to show before entries of menu handler
* @param string $helppagename Name of wiki page for help ('' by default).
* Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage
* For other external page: http://server/url
* @param string $moresearchform Search Form Permanent Supplemental
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
* @param int $leftmenuwithoutmainarea Must be set to 1. 0 by default for backward compatibility with old modules.
* @param string $title Title of web page
* @return void
*/
function left_menu($menu_array_before, $helppagename='', $moresearchform='', $menu_array_after='', $leftmenuwithoutmainarea=0, $title='')
{
@ -1305,30 +1312,26 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_SOCIETE && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php',
img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname');
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname');
}
if ($conf->societe->enabled && $conf->global->MAIN_SEARCHFORM_CONTACT && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php',
img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname');
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname');
}
if ((($conf->product->enabled && $user->rights->produit->lire) || ($conf->service->enabled && $user->rights->service->lire))
&& $conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)
{
$langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php',
img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall');
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/liste.php', DOL_URL_ROOT.'/product/liste.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall');
}
if ($conf->adherent->enabled && $conf->global->MAIN_SEARCHFORM_ADHERENT && $user->rights->adherent->lire)
{
$langs->load("members");
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php',
img_object('','user').' '.$langs->trans("Members"), 'member', 'sall');
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/liste.php', DOL_URL_ROOT.'/adherents/liste.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall');
}
// Execute hook printSearchForm
@ -1460,8 +1463,12 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
if (empty($leftmenuwithoutmainarea)) main_area($title);
}
/**
* Begin main area
*
* @param string $title Title
* @return void
*/
function main_area($title='')
{
@ -1499,8 +1506,10 @@ function main_area($title='')
/**
* Return helpbaseurl, helppage and mode
* @param helppagename Page name (EN:xxx,ES:eee,FR:fff...)
* @param langs Language
*
* @param string $helppagename Page name (EN:xxx,ES:eee,FR:fff...)
* @param Translate $langs Language
* @return array Array of help urls
*/
function getHelpParamFor($helppagename,$langs)
{
@ -1538,13 +1547,14 @@ function getHelpParamFor($helppagename,$langs)
/**
* Show a search area
*
* @param urlaction Url post
* @param urlobject Url of the link under the search box
* @param title Title search area
* @param htmlmodesearch 'search'
* @param htmlinputname Field Name input form
* @param string $urlaction Url post
* @param string $urlobject Url of the link under the search box
* @param string $title Title search area
* @param string $htmlmodesearch Value to set into parameter "mode_search" ('soc','contact','products','member',...)
* @param string $htmlinputname Field Name input form
* @return void
*/
function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$htmlinputname)
function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname)
{
global $conf,$langs;
@ -1567,14 +1577,16 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch='search',$
}
/**
* Show HTML footer
* Close div /DIV data-role=page + /DIV class=fiche + /DIV /DIV main layout + /BODY + /HTML
* @param foot A text to add in HTML generated page
*/
if (! function_exists("llxFooter"))
{
function llxFooter($foot='')
/**
* Show HTML footer
* Close div /DIV data-role=page + /DIV class=fiche + /DIV /DIV main layout + /BODY + /HTML
*
* @param string $foot A text to add in HTML generated page
* @return void
*/
function llxFooter($foot='')
{
global $conf, $langs, $dolibarr_auto_user, $micro_start_time;

View File

@ -1,206 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 <EFBFBD>ric Seigne <erics@rycks.com>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/mantis/admin/mantis.php
* \ingroup mantis
* \brief Page de configuration du module mantis
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/mantis/class/mantis.class.php');
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("other");
$def = array();
$actiontest=$_POST["test"];
$actionsave=$_POST["save"];
// Sauvegardes parametres
if ($actionsave)
{
$i=0;
$db->begin();
$i+=dolibarr_set_const($db,'PHPMANTIS_URL',trim($_POST["phpmantis_url"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'PHPMANTIS_HOST',trim($_POST["phpmantis_host"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'PHPMANTIS_DBNAME',trim($_POST["phpmantis_dbname"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'PHPMANTIS_USER',trim($_POST["phpmantis_user"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'PHPMANTIS_PASS',trim($_POST["phpmantis_pass"]),'chaine',0,'',$conf->entity);
if ($i >= 5)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("MantisSetupSaved")."</font>";
}
else
{
$db->rollback();
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
}
elseif ($actiontest)
{
//$resql=$db->query("select count(*) from llx_const");
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
// Test de la connexion a la database mantis
$conf->mantis->db->type=$dolibarr_main_db_type;
$conf->mantis->db->host=$_POST["phpmantis_host"];
$conf->mantis->db->port=$_POST["phpmantis_port"];
$conf->mantis->db->user=$_POST["phpmantis_user"];
$conf->mantis->db->pass=$_POST["phpmantis_pass"];
$conf->mantis->db->name=$_POST["phpmantis_dbname"];
$mantis=new Mantis();
//print "D ".$db." - ".$db->db."<br>\n";
//print "W ".$mantis->localdb." - ".$mantis->localdb->db."<br>\n";
if ($mantis->localdb->connected == 1 && $mantis->localdb->database_selected == 1)
{
// V<>rifie si bonne base
$sql="SELECT value FROM mantis_config_table WHERE config_id='database_version'";
$resql=$mantis->localdb->query($sql);
if ($resql) {
$mesg ="<div class=\"ok\">";
$mesg.=$langs->trans("MantisTestOk",$_POST["phpmantis_host"],$_POST["phpmantis_dbname"],$_POST["phpmantis_user"]);
$mesg.="</div>";
}
else {
$mesg ="<div class=\"error\">";
$mesg.=$langs->trans("MantisErrorConnectOkButWrongDatabase");
$mesg.="</div>";
}
//$mantis->localdb->close(); Ne pas fermer car la conn de mantis est la meme que dolibarr si parametre host/user/pass identique
}
elseif ($mantis->connected == 1 && $mantis->database_selected != 1)
{
$mesg ="<div class=\"error\">".$langs->trans("MantisTestKo1",$_POST["phpmantis_host"],$_POST["phpmantis_dbname"]);
$mesg.="<br>".$mantis->localdb->error();
$mesg.="</div>";
//$mantis->localdb->close(); Ne pas fermer car la conn de mantis est la meme que dolibarr si parametre host/user/pass identique
}
else
{
$mesg ="<div class=\"error\">".$langs->trans("MantisTestKo2",$_POST["phpmantis_host"],$_POST["phpmantis_user"]);
$mesg.="<br>".$mantis->localdb->error();
$mesg.="</div>";
}
//$resql=$db->query("select count(*) from llx_const");
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
}
/**
* Affichage du formulaire de saisie
*/
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("MantisSetup"),$linkback,'setup');
print '<br>';
print '<form name="phpmantisconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td width=\"30%\">".$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>";
print "<td>".$langs->trans("Examples")."</td>";
print "</tr>";
print "<tr class=\"impair\">";
print "<td>".$langs->trans("MantisURL")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"phpmantis_url\" value=\"". ($_POST["phpmantis_url"]?$_POST["phpmantis_url"]:$conf->global->PHPMANTIS_URL) . "\" size=\"40\"></td>";
print "<td>http://localhost/mantis/";
print "<br>https://mantisserver/";
print "</td>";
print "</tr>";
print "<tr class=\"pair\">";
print "<td>".$langs->trans("MantisServer")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"phpmantis_host\" value=\"". ($_POST["phpmantis_host"]?$_POST["phpmantis_host"]:$conf->global->PHPMANTIS_HOST) . "\" size=\"30\"></td>";
print "<td>localhost";
//print "<br>__dolibarr_main_db_host__ <i>(".$dolibarr_main_db_host.")</i>"
print "</td>";
print "</tr>";
print "<tr class=\"impair\">";
print "<td>".$langs->trans("MantisDatabaseName")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"phpmantis_dbname\" value=\"". ($_POST["phpmantis_dbname"]?$_POST["phpmantis_dbname"]:$conf->global->PHPMANTIS_DBNAME) . "\" size=\"30\"></td>";
print "<td>bugtracker";
//print "<br>__dolibarr_main_db_name__ <i>(".$dolibarr_main_db_name.")</i>";
print "</td>";
print "</tr>";
print "<tr class=\"pair\">";
print "<td>".$langs->trans("MantisUser")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"phpmantis_user\" value=\"". ($_POST["phpmantis_user"]?$_POST["phpmantis_user"]:$conf->global->PHPMANTIS_USER) . "\" size=\"30\"></td>";
print "<td>mantis";
//print "<br>__dolibarr_main_db_user__ <i>(".$dolibarr_main_db_user.")</i>";
print "</td>";
print "</tr>";
print "<tr class=\"impair\">";
print "<td>".$langs->trans("Password")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"phpmantis_pass\" value=\"" . ($_POST["phpmantis_pass"]?$_POST["phpmantis_pass"]:$conf->global->PHPMANTIS_PASS) . "\" size=\"30\"></td>";
print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>';
print "</tr>";
print "</table>";
print '<br><center>';
print "<input type=\"submit\" name=\"test\" class=\"button\" value=\"".$langs->trans("TestConnection")."\">";
print "&nbsp; &nbsp;";
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
print "</center>";
print "</form>\n";
clearstatcache();
if ($mesg) print "<br>$mesg<br>";
print "<br>";
$db->close();
llxFooter();
?>

View File

@ -1,68 +0,0 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/mantis/class/mantis.class.php
* \ingroup mantis
* \brief Ensemble des fonctions permettant d'acceder a la database mantis.
* \author Laurent Destailleur.
*/
/**
* \class Mantis
* \brief Classe permettant d'acceder a la database mantis
*/
class Mantis {
var $localdb;
var $date;
var $duree = 0; // Secondes
var $texte;
var $desc;
var $error;
/**
\brief Constructeur de la classe d'interface a mantisendar
*/
function Mantis()
{
global $conf;
global $dolibarr_main_db_type,$dolibarr_main_db_host,$dolibarr_main_db_user;
global $dolibarr_main_db_pass,$dolibarr_main_db_name;
// Defini parametres mantis (avec substitution eventuelle)
$mantistype=preg_replace('/__dolibarr_main_db_type__/i',$dolibarr_main_db_type,$conf->mantis->db->type);
$mantishost=preg_replace('/__dolibarr_main_db_host__/i',$dolibarr_main_db_host,$conf->mantis->db->host);
$mantisport=preg_replace('/__dolibarr_main_db_port__/i',$dolibarr_main_db_port,$conf->mantis->db->port);
$mantisuser=preg_replace('/__dolibarr_main_db_user__/i',$dolibarr_main_db_user,$conf->mantis->db->user);
$mantispass=preg_replace('/__dolibarr_main_db_pass__/i',$dolibarr_main_db_pass,$conf->mantis->db->pass);
$mantisname=preg_replace('/__dolibarr_main_db_name__/i',$dolibarr_main_db_name,$conf->mantis->db->name);
// On initie la connexion a la base mantisendar
require_once (DOL_DOCUMENT_ROOT ."/lib/databases/".$mantistype.".lib.php");
$this->localdb = new DoliDb($mantistype,$mantishost,$mantisuser,$mantispass,$mantisname,$mantisport);
}
}
?>

View File

@ -1 +0,0 @@
Url not available

View File

@ -1,68 +0,0 @@
<?php
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/mantis/mantis.php
* \ingroup mantis
* \brief Page generant 2 frames, une pour le menu Dolibarr, l'autre pour l'affichage de Mantis
* \author Laurent Destailleur
*/
require("../main.inc.php");
if (empty($conf->global->PHPMANTIS_URL))
{
llxHeader();
print '<div class="error">Module Mantis was not configured properly.</div>';
llxFooter();
}
$mainmenu=isset($_GET["mainmenu"])?$_GET["mainmenu"]:"";
$leftmenu=isset($_GET["leftmenu"])?$_GET["leftmenu"]:"";
$idmenu=isset($_GET["idmenu"])?$_GET["idmenu"]:"";
print "
<html>
<head>
<title>Dolibarr frame for Mantis</title>
</head>
<frameset rows=\"".$heightforframes.",*\" border=0 framespacing=0 frameborder=0>
<frame name=\"barre\" src=\"mantistop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu."&nobackground=1\" noresize scrolling=\"NO\" noborder>
<frame name=\"main\" src=\"".$conf->global->PHPMANTIS_URL."\">
<noframes>
<body>
</body>
</noframes>
</frameset>
<noframes>
<body>
<br><center>
Sorry, your browser is too old or not correctly configured to view this area.<br>
Your browser must support frames.<br>
</center>
</body>
</noframes>
</html>
";
?>

View File

@ -1,39 +0,0 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.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, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/mantis/mantistop.php
* \ingroup mantis
* \brief Top frame to show mantis application
*/
require ("../main.inc.php");
top_htmlhead("","");
top_menu("","","_top");
?>

View File

@ -298,7 +298,8 @@ class Societe extends CommonObject
$result = 0;
$this->name = trim($this->name);
$this->nom=$this->name; // For backward compatibility
if (! $this->name)
{
$this->errors[] = 'ErrorBadThirdPartyName';
@ -393,11 +394,16 @@ class Societe extends CommonObject
// Clean parameters
$this->id = $id;
$this->name = trim($this->name);
$this->address = trim($this->address);
$this->zip = trim($this->zip);
$this->town = trim($this->town);
$this->state_id = trim($this->state_id);
$this->name=$this->name?trim($this->name):trim($this->nom);
$this->nom=trim($this->nom); // TODO obsolete
$this->address=$this->address?trim($this->address):trim($this->adresse);
$this->adresse=$this->address; // TODO obsolete
$this->zip=$this->zip?trim($this->zip):trim($this->cp);
$this->cp=$this->zip; // TODO obsolete
$this->town=$this->town?trim($this->town):trim($this->ville);
$this->ville=$this->town; // TODO obsolete
$this->state_id=trim($this->state_id);
$this->pays_id=trim($this->pays_id);
$this->country_id = trim($this->country_id);
$this->tel = trim($this->tel);
$this->fax = trim($this->fax);
@ -407,6 +413,9 @@ class Societe extends CommonObject
$this->fax = preg_replace("/\./","",$this->fax);
$this->email = trim($this->email);
$this->url = $this->url?clean_url($this->url,0):'';
$this->siren=trim($this->siren); // TODO obsolete
$this->siret=trim($this->siret); // TODO obsolete
$this->ape=trim($this->ape); // TODO obsolete
$this->idprof1 = trim($this->idprof1);
$this->idprof2 = trim($this->idprof2);
$this->idprof3 = trim($this->idprof3);

View File

@ -104,6 +104,7 @@ if (empty($reshook))
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
if ($action == 'update') $object->fetch($socid);
else $object->canvas=$canvas;
if (GETPOST("private") == 1)
{
@ -474,9 +475,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists())
// -----------------------------------------
// When used with CANVAS
// -----------------------------------------
$objcanvas->assign_values($action, $socid); // Set value for templates
$objcanvas->display_canvas(); // Show template
if (! $objcanvas->hasActions() && $socid)
{
$object = new Societe($db);
$object->fetch($socid); // For use with "pure canvas" (canvas that contains templates only)
}
$objcanvas->assign_values($action, $socid); // Set value for templates
$objcanvas->display_canvas(); // Show template
}
else
{
@ -1898,4 +1903,4 @@ else
$db->close();
llxFooter();
?>
?>