Fix: strict mode way

This commit is contained in:
Regis Houssin 2012-07-10 22:10:12 +02:00
parent 28ccc43125
commit ff0668e908
13 changed files with 113 additions and 86 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -227,9 +227,10 @@ abstract class ActionsContactCardCommon
* Set content of ->tpl array, to use into template * Set content of ->tpl array, to use into template
* *
* @param string &$action Type of action * @param string &$action Type of action
* @param int $id Id
* @return string HTML output * @return string HTML output
*/ */
function assign_values(&$action) function assign_values(&$action, $id)
{ {
global $conf, $langs, $user, $canvas; global $conf, $langs, $user, $canvas;
global $form, $formcompany, $objsoc; global $form, $formcompany, $objsoc;
@ -273,7 +274,7 @@ abstract class ActionsContactCardCommon
$this->tpl['select_civility'] = $formcompany->select_civility($this->object->civilite_id); $this->tpl['select_civility'] = $formcompany->select_civility($this->object->civilite_id);
// Predefined with third party // Predefined with third party
if ($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE') || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS))
{ {
if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address; if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address;
if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip; if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -38,15 +38,15 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Handler acces base de donnees * @param DoliDB $db Handler acces base de donnees
* @param string $dirmodule Name of directory of module * @param string $dirmodule Name of directory of module
* @param string $targetmodule Name of directory of module where canvas is stored * @param string $targetmodule Name of directory of module where canvas is stored
* @param string $canvas Name of canvas * @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas) * @param string $card Name of tab (sub-canvas)
*/ */
function __construct($DB, $dirmodule, $targetmodule, $canvas, $card) function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{ {
$this->db = $DB; $this->db = $db;
$this->dirmodule = $dirmodule; $this->dirmodule = $dirmodule;
$this->targetmodule = $targetmodule; $this->targetmodule = $targetmodule;
$this->canvas = $canvas; $this->canvas = $canvas;
@ -86,7 +86,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
$ret = $this->getObject($id); $ret = $this->getObject($id);
parent::assign_values($action); parent::assign_values($action, $id);
$this->tpl['title'] = $this->getTitle($action); $this->tpl['title'] = $this->getTitle($action);
$this->tpl['error'] = $this->error; $this->tpl['error'] = $this->error;
@ -102,7 +102,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
$this->tpl['showend']=dol_get_fiche_end(); $this->tpl['showend']=dol_get_fiche_end();
$objsoc = new Societe($db); $objsoc = new Societe($db);
$objsoc->fetch($this->object->fk_soc); $objsoc->fetch($this->object->socid);
$this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1); $this->tpl['actionstodo']=show_actions_todo($conf,$langs,$db,$objsoc,$this->object,1);

View File

@ -40,7 +40,7 @@ echo $this->control->tpl['ajax_selectcountry'];
<input type="hidden" name="contactid" value="<?php echo $this->control->tpl['id']; ?>"> <input type="hidden" name="contactid" value="<?php echo $this->control->tpl['id']; ?>">
<input type="hidden" name="old_name" value="<?php echo $this->control->tpl['name']; ?>"> <input type="hidden" name="old_name" value="<?php echo $this->control->tpl['name']; ?>">
<input type="hidden" name="old_firstname" value="<?php echo $this->control->tpl['firstname']; ?>"> <input type="hidden" name="old_firstname" value="<?php echo $this->control->tpl['firstname']; ?>">
<?php if ($this->control->tpl['company_id']) { ?> <?php if (! empty($this->control->tpl['company_id'])) { ?>
<input type="hidden" name="socid" value="<?php echo $this->control->tpl['company_id']; ?>"> <input type="hidden" name="socid" value="<?php echo $this->control->tpl['company_id']; ?>">
<?php } ?> <?php } ?>

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,8 +26,8 @@ $contact = $GLOBALS['objcanvas']->control->object;
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
?> ?>
<?php if ($this->control->tpl['action_create_user']) echo $this->control->tpl['action_create_user']; ?> <?php if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?>
<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?> <?php if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
<table class="border allwidth"> <table class="border allwidth">

View File

@ -50,7 +50,8 @@ $object = new Contact($db);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr) // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($id); $object->getCanvas($id);
$canvas = $object->canvas?$object->canvas:GETPOST("canvas"); $objcanvas=null;
$canvas = (! empty($object->canvas)?$object->canvas:GETPOST("canvas"));
if (! empty($canvas)) if (! empty($canvas))
{ {
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");

View File

@ -31,7 +31,7 @@ $langs->load("companies");
$langs->load("suppliers"); $langs->load("suppliers");
// Security check // Security check
$contactid = isset($_GET["id"])?$_GET["id"]:''; $contactid = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid,''); $result = restrictedArea($user, 'contact', $contactid,'');
@ -54,6 +54,8 @@ $sall=GETPOST("contactname");
$sortfield = GETPOST("sortfield"); $sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder"); $sortorder = GETPOST("sortorder");
$page = GETPOST("page"); $page = GETPOST("page");
$userid=GETPOST('userid');
$begin=GETPOST('begin');
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.name"; if (! $sortfield) $sortfield="p.name";
@ -86,9 +88,9 @@ else if ($type == "o")
if ($view == 'phone') { $text=" (Vue Telephones)"; } if ($view == 'phone') { $text=" (Vue Telephones)"; }
if ($view == 'mail') { $text=" (Vue EMail)"; } if ($view == 'mail') { $text=" (Vue EMail)"; }
if ($view == 'recent') { $text=" (Recents)"; } if ($view == 'recent') { $text=" (Recents)"; }
$titre.= " $text"; if (! empty($text)) $titre.= " $text";
if ($_POST["button_removefilter"]) if (GETPOST('button_removefilter'))
{ {
$search_nom=""; $search_nom="";
$search_prenom=""; $search_prenom="";
@ -129,9 +131,9 @@ if (!$user->rights->societe->client->voir && !$socid) //restriction
{ {
$sql .= " AND (sc.fk_user = " .$user->id." OR p.fk_soc IS NULL)"; $sql .= " AND (sc.fk_user = " .$user->id." OR p.fk_soc IS NULL)";
} }
if ($_GET["userid"]) // propre au commercial if ($userid) // propre au commercial
{ {
$sql .= " AND p.fk_user_creat=".$_GET["userid"]; $sql .= " AND p.fk_user_creat=".$userid;
} }
// Filter to exclude not owned private contacts // Filter to exclude not owned private contacts
@ -205,7 +207,7 @@ if ($sall)
{ {
$sql .= " AND (p.name LIKE '%".$db->escape($sall)."%' OR p.firstname LIKE '%".$db->escape($sall)."%' OR p.email LIKE '%".$db->escape($sall)."%')"; $sql .= " AND (p.name LIKE '%".$db->escape($sall)."%' OR p.firstname LIKE '%".$db->escape($sall)."%' OR p.email LIKE '%".$db->escape($sall)."%')";
} }
if ($socid) if (! empty($socid))
{ {
$sql .= " AND s.rowid = ".$socid; $sql .= " AND s.rowid = ".$socid;
} }
@ -235,8 +237,7 @@ if ($result)
{ {
$contactstatic=new Contact($db); $contactstatic=new Contact($db);
$begin=$_GET["begin"]; $param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
$param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($_GET["userid"]).'&contactname='.urlencode($sall);
$param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_nom='.urlencode($search_nom).'&search_prenom='.urlencode($search_prenom).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email); $param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_nom='.urlencode($search_nom).'&search_prenom='.urlencode($search_prenom).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email);
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
@ -408,7 +409,7 @@ if ($result)
print '</form>'; print '</form>';
if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '&amp;begin='.$begin.'&amp;view='.$view.'&amp;userid='.$_GET["userid"], $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '&amp;begin='.$begin.'&amp;view='.$view.'&amp;userid='.$userid, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
$db->free($result); $db->free($result);
} }
@ -419,7 +420,7 @@ else
print '<br>'; print '<br>';
$db->close();
llxFooter(); llxFooter();
$db->close();
?> ?>

View File

@ -131,7 +131,7 @@ if ($action == 'edit')
print '</td>'; print '</td>';
print '<td colspan="2">'.$langs->trans("Alert").': '; print '<td colspan="2">'.$langs->trans("Alert").': ';
if ($object->birthday_alert) if (! empty($object->birthday_alert))
{ {
print '<input type="checkbox" name="birthday_alert" checked="checked"></td>'; print '<input type="checkbox" name="birthday_alert" checked="checked"></td>';
} }
@ -193,7 +193,7 @@ else
// Date To Birth // Date To Birth
print '<tr>'; print '<tr>';
if ($object->birthday != '') if (! empty($object->birthday))
{ {
include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
@ -225,7 +225,6 @@ else
dol_fiche_end(); dol_fiche_end();
if ($action != 'edit') if ($action != 'edit')
{ {
// Barre d'actions // Barre d'actions

View File

@ -772,13 +772,13 @@ abstract class CommonObject
$sql = "SELECT MAX(te.".$fieldid.")"; $sql = "SELECT MAX(te.".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'";
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
if (! empty($filter)) $sql.=" AND ".$filter; if (! empty($filter)) $sql.=" AND ".$filter;
if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
if ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')'; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
//print $sql."<br>"; //print $sql."<br>";
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -793,13 +793,13 @@ abstract class CommonObject
$sql = "SELECT MIN(te.".$fieldid.")"; $sql = "SELECT MIN(te.".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as te";
if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
$sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'";
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
if (! empty($filter)) $sql.=" AND ".$filter; if (! empty($filter)) $sql.=" AND ".$filter;
if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
if ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')'; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null // Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
//print $sql."<br>"; //print $sql."<br>";

View File

@ -2151,21 +2151,23 @@ class Form
$inputok=array(); $inputok=array();
$inputko=array(); $inputko=array();
if (is_array($formquestion) && count($formquestion) > 0) if (is_array($formquestion) && ! empty($formquestion))
{ {
$more.='<table class="paddingrightonly" width="100%">'."\n"; $more.='<table class="paddingrightonly" width="100%">'."\n";
$more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>'."\n"; $more.='<tr><td colspan="3" valign="top">'.(! empty($formquestion['text'])?$formquestion['text']:'').'</td></tr>'."\n";
foreach ($formquestion as $key => $input) foreach ($formquestion as $key => $input)
{ {
if (is_array($input)) if (is_array($input) && ! empty($input))
{ {
$size=(! empty($input['size'])?' size="'.$input['size'].'"':'');
if ($input['type'] == 'text') if ($input['type'] == 'text')
{ {
$more.='<tr><td valign="top">'.$input['label'].'</td><td valign="top" colspan="2" align="left"><input type="text" class="flat" id="'.$input['name'].'" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'" /></td></tr>'."\n"; $more.='<tr><td valign="top">'.$input['label'].'</td><td valign="top" colspan="2" align="left"><input type="text" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n";
} }
else if ($input['type'] == 'password') else if ($input['type'] == 'password')
{ {
$more.='<tr><td valign="top">'.$input['label'].'</td><td valign="top" colspan="2" align="left"><input type="password" class="flat" id="'.$input['name'].'" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'" /></td></tr>'."\n"; $more.='<tr><td valign="top">'.$input['label'].'</td><td valign="top" colspan="2" align="left"><input type="password" class="flat" id="'.$input['name'].'" name="'.$input['name'].'"'.$size.' value="'.$input['value'].'" /></td></tr>'."\n";
} }
else if ($input['type'] == 'select') else if ($input['type'] == 'select')
{ {
@ -3087,8 +3089,9 @@ class Form
if ($d) if ($d)
{ {
// Show date with popup // Show date with popup
if ($conf->use_javascript_ajax && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none"))
{ {
$formated_date='';
//print "e".$set_time." t ".$conf->format_date_short; //print "e".$set_time." t ".$conf->format_date_short;
if (strval($set_time) != '' && $set_time != -1) if (strval($set_time) != '' && $set_time != -1)
{ {

View File

@ -207,7 +207,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
*/ */
function ajax_combobox($htmlname, $event=array()) function ajax_combobox($htmlname, $event=array())
{ {
$msg.= '<script type="text/javascript"> $msg = '<script type="text/javascript">
$(function() { $(function() {
$("#'.$htmlname.'").combobox({ $("#'.$htmlname.'").combobox({
selected : function(event,ui) { selected : function(event,ui) {

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -909,11 +909,23 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$histo[$numaction]=array('type'=>'action','id'=>$obj->id,'datestart'=>$db->jdate($obj->dp),'date'=>$db->jdate($obj->dp2),'note'=>$obj->label,'percent'=>$obj->percent, $histo[$numaction]=array(
'acode'=>$obj->acode,'libelle'=>$obj->libelle, 'type'=>'action',
'userid'=>$obj->user_id,'login'=>$obj->login, 'id'=>$obj->id,
'contact_id'=>$obj->fk_contact,'name'=>$obj->name,'firstname'=>$obj->firstname, 'datestart'=>$db->jdate($obj->dp),
'fk_element'=>$obj->fk_element,'elementtype'=>$obj->elementtype); 'date'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'percent'=>$obj->percent,
'acode'=>$obj->acode,
'libelle'=>$obj->libelle,
'userid'=>$obj->user_id,
'login'=>$obj->login,
'contact_id'=>$obj->fk_contact,
'name'=>$obj->name,
'firstname'=>$obj->firstname,
'fk_element'=>$obj->fk_element,
'elementtype'=>$obj->elementtype
);
$numaction++; $numaction++;
$i++; $i++;
} }
@ -924,7 +936,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
} }
} }
if ($conf->mailing->enabled && ! empty($objcon->email)) if (! empty($conf->mailing->enabled) && ! empty($objcon->email))
{ {
$langs->load("mails"); $langs->load("mails");
@ -949,10 +961,16 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$histo[$numaction]=array('type'=>'mailing','id'=>$obj->id,'date'=>$db->jdate($obj->da),'note'=>$obj->note,'percent'=>$obj->percentage, $histo[$numaction]=array(
'acode'=>$obj->acode,'libelle'=>$obj->libelle, 'type'=>'mailing',
'userid'=>$obj->user_id,'login'=>$obj->login, 'id'=>$obj->id,
'contact_id'=>$obj->contact_id); 'date'=>$db->jdate($obj->da),
'note'=>$obj->note,
'percent'=>$obj->percentage,
'acode'=>$obj->acode,
'userid'=>$obj->user_id,
'login'=>$obj->login
);
$numaction++; $numaction++;
$i++; $i++;
} }
@ -1018,7 +1036,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
// Action // Action
$out.='<td>'; $out.='<td>';
if ($histo[$key]['type']=='action') if (isset($histo[$key]['type']) && $histo[$key]['type']=='action')
{ {
$actionstatic->type_code=$histo[$key]['acode']; $actionstatic->type_code=$histo[$key]['acode'];
$transcode=$langs->trans("Action".$histo[$key]['acode']); $transcode=$langs->trans("Action".$histo[$key]['acode']);
@ -1028,7 +1046,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
$actionstatic->id=$histo[$key]['id']; $actionstatic->id=$histo[$key]['id'];
$out.=$actionstatic->getNomUrl(1,40); $out.=$actionstatic->getNomUrl(1,40);
} }
if ($histo[$key]['type']=='mailing') if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing')
{ {
$out.='<a href="'.DOL_URL_ROOT.'/comm/mailing/fiche.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"),"email").' '; $out.='<a href="'.DOL_URL_ROOT.'/comm/mailing/fiche.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"),"email").' ';
$transcode=$langs->trans("Action".$histo[$key]['acode']); $transcode=$langs->trans("Action".$histo[$key]['acode']);
@ -1043,30 +1061,34 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
// Objet lie // Objet lie
// TODO uniformize // TODO uniformize
$out.='<td>'; $out.='<td>';
if ($histo[$key]['elementtype'] == 'propal' && $conf->propal->enabled) if (isset($histo[$key]['elementtype']))
{ {
$propalstatic->ref=$langs->trans("ProposalShort"); if ($histo[$key]['elementtype'] == 'propal' && ! empty($conf->propal->enabled))
$propalstatic->id=$histo[$key]['fk_element']; {
$out.=$propalstatic->getNomUrl(1); $propalstatic->ref=$langs->trans("ProposalShort");
} $propalstatic->id=$histo[$key]['fk_element'];
elseif ($histo[$key]['elementtype'] == 'commande' && $conf->commande->enabled) $out.=$propalstatic->getNomUrl(1);
{ }
$orderstatic->ref=$langs->trans("Order"); elseif ($histo[$key]['elementtype'] == 'commande' && ! empty($conf->commande->enabled))
$orderstatic->id=$histo[$key]['fk_element']; {
$out.=$orderstatic->getNomUrl(1); $orderstatic->ref=$langs->trans("Order");
} $orderstatic->id=$histo[$key]['fk_element'];
elseif ($histo[$key]['elementtype'] == 'facture' && $conf->facture->enabled) $out.=$orderstatic->getNomUrl(1);
{ }
$facturestatic->ref=$langs->trans("Invoice"); elseif ($histo[$key]['elementtype'] == 'facture' && ! empty($conf->facture->enabled))
$facturestatic->id=$histo[$key]['fk_element']; {
$facturestatic->type=$histo[$key]['ftype']; $facturestatic->ref=$langs->trans("Invoice");
$out.=$facturestatic->getNomUrl(1,'compta'); $facturestatic->id=$histo[$key]['fk_element'];
$facturestatic->type=$histo[$key]['ftype'];
$out.=$facturestatic->getNomUrl(1,'compta');
}
else $out.='&nbsp;';
} }
else $out.='&nbsp;'; else $out.='&nbsp;';
$out.='</td>'; $out.='</td>';
// Contact pour cette action // Contact pour cette action
if (! $objcon->id && $histo[$key]['contact_id'] > 0) if (! empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0)
{ {
$contactstatic->name=$histo[$key]['name']; $contactstatic->name=$histo[$key]['name'];
$contactstatic->firstname=$histo[$key]['firstname']; $contactstatic->firstname=$histo[$key]['firstname'];

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -40,7 +40,7 @@ function contact_prepare_head($object)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
if ($conf->ldap->enabled && $conf->global->LDAP_CONTACT_ACTIVE) if (! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_CONTACT_ACTIVE))
{ {
$langs->load("ldap"); $langs->load("ldap");

View File

@ -1295,12 +1295,12 @@ function dol_print_address($address, $htmlid, $mode, $id)
{ {
print nl2br($address); print nl2br($address);
$showgmap=$showomap=0; $showgmap=$showomap=0;
if ($mode=='thirdparty' && $conf->google->enabled && $conf->global->GOOGLE_ENABLE_GMAPS) $showgmap=1; if ($mode=='thirdparty' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS)) $showgmap=1;
if ($mode=='contact' && $conf->google->enabled && $conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS) $showgmap=1; if ($mode=='contact' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) $showgmap=1;
if ($mode=='member' && $conf->google->enabled && $conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS) $showgmap=1; if ($mode=='member' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) $showgmap=1;
if ($mode=='thirdparty' && $conf->openstreetmap->enabled && $conf->global->OPENSTREETMAP_ENABLE_MAPS) $showomap=1; if ($mode=='thirdparty' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) $showomap=1;
if ($mode=='contact' && $conf->openstreetmap->enabled && $conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS) $showomap=1; if ($mode=='contact' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) $showomap=1;
if ($mode=='member' && $conf->openstreetmap->enabled && $conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS) $showomap=1; if ($mode=='member' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) $showomap=1;
// TODO Add a hook here // TODO Add a hook here
if ($showgmap) if ($showgmap)