Skip to content

Commit

Permalink
Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git …
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
eldy committed Apr 5, 2012
2 parents 00a1e99 + a222599 commit 66b0016
Show file tree
Hide file tree
Showing 16 changed files with 318 additions and 280 deletions.
368 changes: 178 additions & 190 deletions htdocs/admin/project.php

Large diffs are not rendered by default.

45 changes: 23 additions & 22 deletions htdocs/boutique/admin/boutique.php
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
*
* 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
Expand Down Expand Up @@ -39,17 +40,17 @@
* Actions
*/

if ($_POST["save"])
if (GETPOST('save','alpha'))
{
$db->begin();

$i=0;

$i+=dolibarr_set_const($db,'OSC_DB_HOST',trim($_POST["oscommerce_dbhost"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_NAME',trim($_POST["oscommerce_dbname"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_USER',trim($_POST["oscommerce_dbuser"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_PASS',trim($_POST["oscommerce_dbpass"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_TABLE_PREFIX',trim($_POST["oscommerce_db_table_prefix"]),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_HOST',trim(GETPOST('oscommerce_dbhost','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_NAME',trim(GETPOST('oscommerce_dbname','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_USER',trim(GETPOST('oscommerce_dbuser','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_PASS',trim(GETPOST('oscommerce_dbpass','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_TABLE_PREFIX',trim(GETPOST('oscommerce_db_table_prefix','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_LANGUAGE_ID',1,'chaine',0,'',$conf->entity);

if ($i >= 4)
Expand All @@ -64,18 +65,18 @@
exit;
}
}
elseif ($_POST["test"])
elseif (GETPOST('test','alpha'))
{
//$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const");
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";

// Test de la connexion a la database webcalendar
$conf->oscommerce->db->type=$dolibarr_main_db_type;
$conf->oscommerce->db->host=$_POST["oscommerce_dbhost"];
$conf->oscommerce->db->port=$_POST["oscommerce_dbport"];
$conf->oscommerce->db->name=$_POST["oscommerce_dbname"];
$conf->oscommerce->db->user=$_POST["oscommerce_dbuser"];
$conf->oscommerce->db->pass=$_POST["oscommerce_dbpass"];
$conf->oscommerce->db->host=GETPOST('oscommerce_dbhost','alpha');
$conf->oscommerce->db->port=GETPOST('oscommerce_dbport','alpha');
$conf->oscommerce->db->name=GETPOST('oscommerce_dbname','alpha');
$conf->oscommerce->db->user=GETPOST('oscommerce_dbuser','alpha');
$conf->oscommerce->db->pass=GETPOST('oscommerce_dbpass','alpha');

$oscommercedb=getDoliDBInstance($conf->oscommerce->db->type,$conf->oscommerce->db->host,$conf->oscommerce->db->user,$conf->oscommerce->db->pass,$conf->oscommerce->db->name,$conf->oscommerce->db->port);

Expand All @@ -87,26 +88,26 @@
$sql.=" WHERE configuration_key='STORE_NAME'";
$resql=$oscommercedb->query($sql);
if ($resql) {
$mesg ="<div class=\"ok\">".$langs->trans("OSCommerceTestOk",$_POST["oscommerce_dbhost"],$_POST["oscommerce_dbname"],$_POST["oscommerce_dbuser"]);
$mesg ="<div class=\"ok\">".$langs->trans("OSCommerceTestOk",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'),GETPOST('oscommerce_dbuser','alpha'));
$mesg.="</div>";
}
else {
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',$_POST["oscommerce_db_table_prefix"]."configuration");
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',GETPOST('oscommerce_db_table_prefix','alpha')."configuration");
$mesg.="</div>";
}

//$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
}
elseif ($oscommercedb->connected == 1 && $oscommercedb->database_selected != 1)
{
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo1",$_POST["oscommerce_dbhost"],$_POST["oscommerce_dbname"]);
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo1",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'));
$mesg.="<br>".$oscommercedb->error();
$mesg.="</div>";
//$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
}
else
{
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo2",$_POST["oscommerce_dbhost"],$_POST["oscommerce_dbuser"]);
$mesg ="<div class=\"error\">".$langs->trans("OSCommerceTestKo2",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbuser','alpha'));
$mesg.="<br>".$oscommercedb->error();
$mesg.="</div>";
}
Expand Down Expand Up @@ -142,46 +143,46 @@
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommerceServer")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbhost\" value=\"". ($_POST["oscommerce_dbhost"]?$_POST["oscommerce_dbhost"]:$conf->global->OSC_DB_HOST) . "\" size=\"30\"></td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbhost\" value=\"". (GETPOST('oscommerce_dbhost','alpha')?GETPOST('oscommerce_dbhost','alpha'):$conf->global->OSC_DB_HOST) . "\" size=\"30\"></td>";
print "<td>localhost";
//print "<br>__dolibarr_main_db_host__ <i>(".$dolibarr_main_db_host.")</i>"
print "</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommerceDatabaseName")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbname\" value=\"". ($_POST["oscommerce_dbname"]?$_POST["oscommerce_dbname"]:$conf->global->OSC_DB_NAME) . "\" size=\"30\"></td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbname\" value=\"". (GETPOST('oscommerce_dbname','alpha')?GETPOST('oscommerce_dbname','alpha'):$conf->global->OSC_DB_NAME) . "\" size=\"30\"></td>";
print "<td>oscommerce";
//print "<br>__dolibarr_main_db_name__ <i>(".$dolibarr_main_db_name.")</i>";
print "</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommercePrefix")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_db_table_prefix\" value=\"". ($_POST["oscommerce_db_table_prefix"]?$_POST["oscommerce_db_table_prefix"]:$conf->global->DB_TABLE_PREFIX) . "\" size=\"30\"></td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_db_table_prefix\" value=\"". (GETPOST('oscommerce_db_table_prefix','alpha')?GETPOST('oscommerce_db_table_prefix','alpha'):$conf->global->DB_TABLE_PREFIX) . "\" size=\"30\"></td>";
print "<td>osc_";
print "</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommerceUser")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbuser\" value=\"". ($_POST["oscommerce_dbuser"]?$_POST["oscommerce_dbuser"]:$conf->global->OSC_DB_USER) . "\" size=\"30\"></td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbuser\" value=\"". (GETPOST('oscommerce_dbuser','alpha')?GETPOST('oscommerce_dbuser','alpha'):$conf->global->OSC_DB_USER) . "\" size=\"30\"></td>";
print "<td>oscommerceuser";
//print "<br>__dolibarr_main_db_user__ <i>(".$dolibarr_main_db_user.")</i>";
print "</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("Password")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass\" value=\"" . ($_POST["oscommerce_dbpass"]?$_POST["oscommerce_dbpass"]:$conf->global->OSC_DB_PASS) . "\" size=\"30\"></td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass\" value=\"" . (GETPOST('oscommerce_dbpass','alpha')?GETPOST('oscommerce_dbpass','alpha'):$conf->global->OSC_DB_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>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("PasswordRetype")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass2\" value=\"" . ($_POST["oscommerce_dbpass2"]?$_POST["oscommerce_dbpass2"]:$conf->global->OSC_DB_PASS) ."\" size=\"30\"></td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass2\" value=\"" . (GETPOST('oscommerce_dbpass2','alpha')?GETPOST('oscommerce_dbpass2','alpha'):$conf->global->OSC_DB_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>';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/comm/mailing/fiche.php
Expand Up @@ -191,9 +191,9 @@
$tmpfield=explode('=',$other[4],2); $other5=(isset($tmpfield[1])?$tmpfield[1]:$tmpfield[0]);
$substitutionarray=array(
'__ID__' => $obj->source_id,
'__EMAIL__' => $obj->email,
'__EMAIL__' => '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>',
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" width="0" height="0" style="width:0px;height:0px" border="0"/>',
'__UNSUSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-usubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank"/>'.$langs->trans("MailUnsubcribe").'</a>',
'__UNSUSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-usubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
'__LASTNAME__' => $obj->nom,
'__FIRSTNAME__' => $obj->prenom,
'__OTHER1__' => $other1,
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions.lib.php
Expand Up @@ -1705,7 +1705,7 @@ function img_picto_common($alt, $picto, $options='', $pictoisfullpath=0)
global $conf;
if (! preg_match('/(\.png|\.gif)$/i',$picto)) $picto.='.png';
if ($pictoisfullpath) return '<img src="'.$picto.'" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'"'.($options?' '.$options:'').'>';
if (! empty($conf->global->MAIN_MODULE_CAN_OVERWRITE_COMMONICONS) && file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/'.$picto)) return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/'.$picto.'" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'"'.($options?' '.$options:'').'>';
if (! empty($conf->global->MAIN_MODULE_CAN_OVERWRITE_COMMONICONS) && file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/'.$picto)) return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/'.$picto.'" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'"'.($options?' '.$options:'').'>';
return '<img src="'.DOL_URL_ROOT.'/theme/common/'.$picto.'" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'"'.($options?' '.$options:'').'>';
}

Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/modSociete.class.php
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2011 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>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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
Expand Down Expand Up @@ -327,7 +327,7 @@ function modSociete($db)
*/
function init($options='')
{
global $conf;
global $conf, $langs;

// We disable this to prevent pb of modules not correctly disabled
//$this->remove($options);
Expand Down
84 changes: 63 additions & 21 deletions htdocs/core/modules/project/modules_project.php
Expand Up @@ -138,70 +138,112 @@ function getVersion()


/**
* Create object on disk
* Create an intervention document on disk using template defined into PROJECT_ADDON_PDF
*
* @param DoliDB $db objet base de donnee
* @param Object $object object project
* @param string $model force le modele a utiliser ('' to not force)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param DoliDB $db objet base de donnee
* @param Object $object Object fichinter
* @param string $modele force le modele a utiliser ('' par defaut)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param HookManager $hookmanager Hook manager instance
* @return int 0 if KO, 1 if OK
*/
function project_pdf_create($db, $object, $model,$outputlangs)
function project_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
{
global $conf,$langs;
$langs->load("projects");

$dir = DOL_DOCUMENT_ROOT."/core/modules/project/pdf/";
$error=0;

$srctemplatepath='';

// Positionne modele sur le nom du modele de projet a utiliser
if (! dol_strlen($model))
if (! dol_strlen($modele))
{
if (! empty($conf->global->PROJECT_ADDON_PDF))
{
$model = $conf->global->PROJECT_ADDON_PDF;
$modele = $conf->global->PROJECT_ADDON_PDF;
}
else
{
$model='baleine';
//print $langs->trans("Error")." ".$langs->trans("Error_PROJECT_ADDON_PDF_NotDefined");
//return 0;
$modele='baleine';
}
}

// If selected modele is a filename template (then $modele="modelname:filename")
$tmp=explode(':',$modele,2);
if (! empty($tmp[1]))
{
$modele=$tmp[0];
$srctemplatepath=$tmp[1];
}

// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array('/');
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
foreach(array('doc','pdf') as $prefix)
{
$file = $prefix."_".$modele.".modules.php";

// On verifie l'emplacement du modele
$file=dol_buildpath($reldir."core/modules/project/pdf/".$file,0);
if (file_exists($file))
{
$filefound=1;
$classname=$prefix.'_'.$modele;
break;
}
}
if ($filefound) break;
}

// Charge le modele
$file = "pdf_".$model.".modules.php";
if (file_exists($dir.$file))
if ($filefound)
{
$classname = "pdf_".$model;
require_once($dir.$file);
require_once($file);

$obj = new $classname($db);

// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($object,$outputlangs) > 0)
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
{
$outputlangs->charset_output=$sav_charset_output;

// we delete preview files
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
dol_delete_preview($object);

// Success in building document. We build meta file.
dol_meta_create($object);

// Appel des triggers
/*include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('PROJECT_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }*/
// Fin appel triggers

return 1;
}
else
{
$outputlangs->charset_output=$sav_charset_output;
dol_syslog("Erreur dans project_pdf_create");
dol_print_error($db,$obj->error);
dol_print_error($db,"project_pdf_create Error: ".$obj->error);
return 0;
}
}
else
{
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file);
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
return 0;
}
}

?>
?>
6 changes: 3 additions & 3 deletions htdocs/main.inc.php
Expand Up @@ -868,8 +868,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<!-- Includes for Dolibarr, modules or specific pages-->'."\n";
// Output style sheets (optioncss='print' or '')
$themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1);
$themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):'');
if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache'];
$themeparam='?lang='.$langs->defaultlang.'&amp;theme='.$conf->theme.(GETPOST('optioncss')?'&amp;optioncss='.GETPOST('optioncss','alpha',1):'');
if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&amp;dol_resetcache='.$_SESSION['dol_resetcache'];
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
print '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.$themeparam.'">'."\n";
// CSS forced by modules (relative url starting with /)
Expand Down Expand Up @@ -1446,7 +1446,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
print '" href="';
print sprintf($helpbaseurl,urlencode(html_entity_decode($helppage)));
print '">';
print img_picto('',DOL_URL_ROOT.'/theme/common/helpdoc.png','',1).' ';
print img_picto('', 'helpdoc').' ';
print $langs->trans($mode == 'wiki' ? 'OnlineHelp': 'Help');
//if ($mode == 'wiki') print ' ('.dol_trunc(strtr($helppage,'_',' '),8).')';
print '</a>';
Expand Down

0 comments on commit 66b0016

Please sign in to comment.