diff --git a/.gitignore b/.gitignore index 6daf64aa0ec..279cf733140 100755 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ default.properties .settings/ .buildpath .gitmodules +dolibarr_install.log diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index e5db721dead..ec0d6286858 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -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."
"; - } + + dol_htmloutput_mesg($mesg); - if (empty($mysoc->pays_id) && empty($mysoc->pays_code)) + if (empty($mysoc->country_id) && empty($mysoc->country_code)) { print '
'; $langs->load("errors"); diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 9e8d17fa718..e7794e1fce4 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -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 } -?> \ No newline at end of file +?> diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 4f66bbdfc92..745d0c3d6e7 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -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 diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index e2a9672428a..282832d471d 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -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.'
'; //print ' => template_dir='.$this->template_dir.'
'; - //print ' => control_file='.$this->control_file.' is_object(this->control)='.is_object($this->control).'
'; - - 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 */ diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index f657fd8c0c3..bf522ab6680 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -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) { diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 8efd161e25e..f34716bfc03 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -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 { diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 8951011775b..d0bd737f374 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -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 '
'; - print ''; - print ''; + /* + * Commande + */ + print ''; + print ''; + print ''; - print ''; + print '
'; - // Ref - print ''; - print ''; - print ''; + // Ref + print ''; + print ''; + print ''; - // Fournisseur - print '"; - print ''; - print ''; + // Fournisseur + print '"; + print ''; + print ''; - // Statut - print ''; - print ''; - print '"; + // Statut + print ''; + print ''; + print '"; - // Date - if ($commande->methode_commande_id > 0) - { - print '"; + // Date + if ($commande->methode_commande_id > 0) + { + print '"; - if ($commande->methode_commande) - { - print ''; - } - } + if ($commande->methode_commande) + { + print ''; + } + } - // Auteur - print ''; - print ''; - print ''; + // Auteur + print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - if (! $user->societe_id) - { - print ''; - print ''; - } + if (! $user->societe_id) + { + print ''; + print ''; + } - if ($user->rights->fournisseur->commande->creer) - { - print ''; - } + print "
'.$langs->trans("Ref").''; - print $html->showrefnav($commande,'ref','',1,'ref','ref'); - print '
'.$langs->trans("Ref").''; + print $html->showrefnav($commande,'ref','',1,'ref','ref'); + print '
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
'.$langs->trans("Supplier")."'.$soc->getNomUrl(1,'supplier').'
'.$langs->trans("Status").''; - print $commande->getLibStatut(4); - print "
'.$langs->trans("Status").''; + print $commande->getLibStatut(4); + print "
'.$langs->trans("Date").''; - if ($commande->date_commande) - { - print dol_print_date($commande->date_commande,"dayhourtext")."\n"; - } - print "
'.$langs->trans("Date").''; + if ($commande->date_commande) + { + print dol_print_date($commande->date_commande,"dayhourtext")."\n"; + } + print "
'.$langs->trans("Method").''.$commande->methode_commande.'
'.$langs->trans("Method").''.$commande->methode_commande.'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
'.$langs->trans("AuthorRequest").''.$author->getNomUrl(1).'
'.$langs->trans("NotePublic").''; - if ($user->rights->fournisseur->commande->creer) print ''; - print '
'.$langs->trans("NotePublic").''; + if ($user->rights->fournisseur->commande->creer) print ''; + print '
'.$langs->trans("NotePrivate").''; - if ($user->rights->fournisseur->commande->creer) print ''; - print '
'.$langs->trans("NotePrivate").''; + if ($user->rights->fournisseur->commande->creer) print ''; + print '
"; - print "
"; + if ($user->rights->fournisseur->commande->creer) + { + print '

'; + } - print "
\n"; - } - else - { - /* Order not found */ - $langs->load("errors"); - print $langs->trans("ErrorRecordNotFound"); - } + print ""; + + dol_fiche_end(); + } + else + { + /* Order not found */ + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); + } } diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 724edb40c91..e8af8fe7fc1 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -130,7 +130,7 @@ if ($_GET["facid"]) } print ""; - // Note priv�e + // Note private if (! $user->societe_id) { print ''.$langs->trans("NotePrivate").' :'; @@ -153,11 +153,11 @@ if ($_GET["facid"]) print ""; + dol_fiche_end(); /* * Actions */ - print ''; print '
'; if ($user->rights->fournisseur->facture->creer && $_GET["action"] <> 'edit') diff --git a/htdocs/includes/modules/modMantis.class.php b/htdocs/includes/modules/modMantis.class.php deleted file mode 100644 index 239dab8abb7..00000000000 --- a/htdocs/includes/modules/modMantis.class.php +++ /dev/null @@ -1,132 +0,0 @@ - - * Copyright (C) 2004-2007 Laurent Destailleur - * - * 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 . - */ - -/** - * \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); - } - -} - -?> diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0e2f6ee691f..59ca0510c23 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -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; diff --git a/htdocs/mantis/admin/mantis.php b/htdocs/mantis/admin/mantis.php deleted file mode 100644 index c26cc6ba146..00000000000 --- a/htdocs/mantis/admin/mantis.php +++ /dev/null @@ -1,206 +0,0 @@ - - * Copyright (C) 2003 �ric Seigne - * Copyright (C) 2004-2008 Laurent Destailleur - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * - * 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 . - * - */ - -/** - * \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 = "".$langs->trans("MantisSetupSaved").""; - } - 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().">
\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."
\n"; - //print "W ".$mantis->localdb." - ".$mantis->localdb->db."
\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 ="
"; - $mesg.=$langs->trans("MantisTestOk",$_POST["phpmantis_host"],$_POST["phpmantis_dbname"],$_POST["phpmantis_user"]); - $mesg.="
"; - } - else { - $mesg ="
"; - $mesg.=$langs->trans("MantisErrorConnectOkButWrongDatabase"); - $mesg.="
"; - } - - //$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 ="
".$langs->trans("MantisTestKo1",$_POST["phpmantis_host"],$_POST["phpmantis_dbname"]); - $mesg.="
".$mantis->localdb->error(); - $mesg.="
"; - //$mantis->localdb->close(); Ne pas fermer car la conn de mantis est la meme que dolibarr si parametre host/user/pass identique - } - else - { - $mesg ="
".$langs->trans("MantisTestKo2",$_POST["phpmantis_host"],$_POST["phpmantis_user"]); - $mesg.="
".$mantis->localdb->error(); - $mesg.="
"; - } - - //$resql=$db->query("select count(*) from llx_const"); - //print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error().">
\n"; -} - - -/** - * Affichage du formulaire de saisie - */ - -llxHeader(); - -$linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans("MantisSetup"),$linkback,'setup'); -print '
'; - - -print '
'; -print ''; -print ""; - -print ""; -print ""; -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ""; -print ""; - -print ""; -print ""; -print ""; -print ''; -print ""; - -print "
".$langs->trans("Parameter")."".$langs->trans("Value")."".$langs->trans("Examples")."
".$langs->trans("MantisURL")."global->PHPMANTIS_URL) . "\" size=\"40\">http://localhost/mantis/"; -print "
https://mantisserver/"; -print "
".$langs->trans("MantisServer")."global->PHPMANTIS_HOST) . "\" size=\"30\">localhost"; -//print "
__dolibarr_main_db_host__ (".$dolibarr_main_db_host.")" -print "
".$langs->trans("MantisDatabaseName")."global->PHPMANTIS_DBNAME) . "\" size=\"30\">bugtracker"; -//print "
__dolibarr_main_db_name__ (".$dolibarr_main_db_name.")"; -print "
".$langs->trans("MantisUser")."global->PHPMANTIS_USER) . "\" size=\"30\">mantis"; -//print "
__dolibarr_main_db_user__ (".$dolibarr_main_db_user.")"; -print "
".$langs->trans("Password")."global->PHPMANTIS_PASS) . "\" size=\"30\">'; -//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ ('.preg_replace('/./i','*',$dolibarr_main_db_pass).')'; -print ' 
"; - - -print '
'; -print "trans("TestConnection")."\">"; -print "   "; -print "trans("Save")."\">"; -print "
"; - -print "
\n"; - - -clearstatcache(); - -if ($mesg) print "
$mesg
"; -print "
"; - -$db->close(); - -llxFooter(); -?> diff --git a/htdocs/mantis/class/mantis.class.php b/htdocs/mantis/class/mantis.class.php deleted file mode 100644 index 53c2c715852..00000000000 --- a/htdocs/mantis/class/mantis.class.php +++ /dev/null @@ -1,68 +0,0 @@ - - * Copyright (C) 2004-2008 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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); - } - -} -?> diff --git a/htdocs/mantis/index.php b/htdocs/mantis/index.php deleted file mode 100644 index 7db0dd9ebf9..00000000000 --- a/htdocs/mantis/index.php +++ /dev/null @@ -1 +0,0 @@ -Url not available \ No newline at end of file diff --git a/htdocs/mantis/mantis.php b/htdocs/mantis/mantis.php deleted file mode 100644 index 707517133a1..00000000000 --- a/htdocs/mantis/mantis.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * 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 . - * - */ - -/** - * \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 '
Module Mantis was not configured properly.
'; - llxFooter(); -} - -$mainmenu=isset($_GET["mainmenu"])?$_GET["mainmenu"]:""; -$leftmenu=isset($_GET["leftmenu"])?$_GET["leftmenu"]:""; -$idmenu=isset($_GET["idmenu"])?$_GET["idmenu"]:""; - -print " - - -Dolibarr frame for Mantis - - - - - global->PHPMANTIS_URL."\"> - - <body> - - </body> - - - - -<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> - - - -"; - - -?> diff --git a/htdocs/mantis/mantistop.php b/htdocs/mantis/mantistop.php deleted file mode 100644 index 7020b1b93d0..00000000000 --- a/htdocs/mantis/mantistop.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * 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 . - */ - -/** - * \file htdocs/mantis/mantistop.php - * \ingroup mantis - * \brief Top frame to show mantis application - */ - -require ("../main.inc.php"); - -top_htmlhead("",""); -top_menu("","","_top"); - -?> - - - - - - - - - - diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a8d7823341a..36b8bf3a7d0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -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); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index b289e334c60..42ea9fb8465 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -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(); -?> \ No newline at end of file +?>