diff --git a/dev/iso-normes/address_format.txt b/dev/iso-normes/address_format.txt
new file mode 100755
index 00000000000..cc3b23285c8
--- /dev/null
+++ b/dev/iso-normes/address_format.txt
@@ -0,0 +1 @@
+http://bitboost.com/ref/international-address-formats.html#Formats
\ No newline at end of file
diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php
index b7a69dddd26..a2b4ae4d909 100644
--- a/htdocs/admin/const.php
+++ b/htdocs/admin/const.php
@@ -30,10 +30,16 @@ $langs->load("admin");
if (! $user->admin) accessforbidden();
-$action = GETPOST('action');
-$debug = GETPOST('debug');
+$rowid=GETPOST('rowid','int');
+$entity=GETPOST('entity','int');
+$action=GETPOST('action');
+$update=GETPOST('update');
+$delete=GETPOST('delete');
+$debug=GETPOST('debug');
+$consts=GETPOST('const');
$typeconst=array('yesno','texte','chaine');
+$mesg='';
/*
@@ -64,11 +70,11 @@ if ($action == 'add')
}
}
-if (($_POST["const"] && isset($_POST["update"]) && $_POST["update"] == $langs->trans("Modify")))
+if (! empty($consts) && $update == $langs->trans("Modify"))
{
- foreach($_POST["const"] as $const)
+ foreach($consts as $const)
{
- if ($const["check"])
+ if (! empty($const["check"]))
{
if (dolibarr_set_const($db, $const["name"],$const["value"],$const["type"],1,$const["note"],$const["entity"]) < 0)
{
@@ -79,11 +85,11 @@ if (($_POST["const"] && isset($_POST["update"]) && $_POST["update"] == $langs->t
}
// Delete several lines at once
-if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("Delete"))
+if (! empty($consts) && $delete == $langs->trans("Delete"))
{
- foreach($_POST["const"] as $const)
+ foreach($consts as $const)
{
- if ($const["check"]) // Is checkbox checked
+ if (! empty($const["check"])) // Is checkbox checked
{
if (dolibarr_del_const($db, $const["rowid"], -1) < 0)
{
@@ -96,7 +102,7 @@ if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("De
// Delete line from delete picto
if ($action == 'delete')
{
- if (dolibarr_del_const($db, $_GET["rowid"], $_GET["entity"]) < 0)
+ if (dolibarr_del_const($db, $rowid, $entity) < 0)
{
dol_print_error($db);
}
@@ -136,7 +142,7 @@ print_fiche_titre($langs->trans("OtherSetup"),'','setup');
print $langs->trans("ConstDesc")." \n";
print " \n";
-if ($mesg) print $mesg;
+dol_htmloutput_mesg($mesg);
print '
';
print '
';
diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php
index 1150949c7c6..0acfed506b2 100644
--- a/htdocs/admin/delais.php
+++ b/htdocs/admin/delais.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville
* Copyright (C) 2004-2010 Laurent Destailleur
* Copyright (C) 2005 Simon Tosser
- * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2005-2012 Regis Houssin
*
* 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
@@ -27,31 +27,93 @@ require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
$langs->load("admin");
-$langs->load("orders");
-$langs->load("propal");
-$langs->load("contracts");
-$langs->load("bills");
-$langs->load("banks");
if (! $user->admin) accessforbidden();
$action=GETPOST('action','alpha');
+$modules=array(
+ 'agenda' => array(
+ array(
+ 'code' => 'MAIN_DELAY_ACTIONS_TODO',
+ 'img' => 'action'
+ )
+ ),
+ 'propal' => array(
+ array(
+ 'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE',
+ 'img' => 'propal'
+ ),
+ array(
+ 'code' => 'MAIN_DELAY_PROPALS_TO_BILL',
+ 'img' => 'propal'
+ )
+ ),
+ 'commande' => array(
+ array(
+ 'code' => 'MAIN_DELAY_ORDERS_TO_PROCESS',
+ 'img' => 'order'
+ )
+ ),
+ 'facture' => array(
+ array(
+ 'code' => 'MAIN_DELAY_CUSTOMER_BILLS_UNPAYED',
+ 'img' => 'bill'
+ )
+ ),
+ 'fournisseur' => array(
+ array(
+ 'code' => 'MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS',
+ 'img' => 'order'
+ ),
+ array(
+ 'code' => 'MAIN_DELAY_SUPPLIER_BILLS_TO_PAY',
+ 'img' => 'bill'
+ )
+ ),
+ 'service' => array(
+ array(
+ 'code' => 'MAIN_DELAY_NOT_ACTIVATED_SERVICES',
+ 'img' => 'service'
+ ),
+ array(
+ 'code' => 'MAIN_DELAY_RUNNING_SERVICES',
+ 'img' => 'service'
+ )
+ ),
+ 'banque' => array(
+ array(
+ 'code' => 'MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE',
+ 'img' => 'account'
+ ),
+ array(
+ 'code' => 'MAIN_DELAY_CHEQUES_TO_DEPOSIT',
+ 'img' => 'account'
+ )
+ ),
+ 'adherent' => array(
+ array(
+ 'code' => 'MAIN_DELAY_MEMBERS',
+ 'img' => 'user'
+ )
+ ),
+);
+
if ($action == 'update')
{
- //Conversion des jours en secondes
- if ($_POST["ActionsToDo"]) dolibarr_set_const($db, "MAIN_DELAY_ACTIONS_TODO",$_POST["ActionsToDo"],'chaine',0,'',$conf->entity);
- if ($_POST["OrdersToProcess"]) dolibarr_set_const($db, "MAIN_DELAY_ORDERS_TO_PROCESS",$_POST["OrdersToProcess"],'chaine',0,'',$conf->entity);
- if ($_POST["SuppliersOrdersToProcess"]) dolibarr_set_const($db, "MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS",$_POST["SuppliersOrdersToProcess"],'chaine',0,'',$conf->entity);
- if ($_POST["PropalsToClose"]) dolibarr_set_const($db, "MAIN_DELAY_PROPALS_TO_CLOSE",$_POST["PropalsToClose"],'chaine',0,'',$conf->entity);
- if ($_POST["PropalsToBill"]) dolibarr_set_const($db, "MAIN_DELAY_PROPALS_TO_BILL",$_POST["PropalsToBill"],'chaine',0,'',$conf->entity);
- if ($_POST["BoardNotActivatedServices"]) dolibarr_set_const($db, "MAIN_DELAY_NOT_ACTIVATED_SERVICES",$_POST["BoardNotActivatedServices"],'chaine',0,'',$conf->entity);
- if ($_POST["BoardRunningServices"]) dolibarr_set_const($db, "MAIN_DELAY_RUNNING_SERVICES",$_POST["BoardRunningServices"],'chaine',0,'',$conf->entity);
- if ($_POST["CustomerBillsUnpaid"]) dolibarr_set_const($db, "MAIN_DELAY_CUSTOMER_BILLS_UNPAYED",$_POST["CustomerBillsUnpaid"],'chaine',0,'',$conf->entity);
- if ($_POST["SupplierBillsToPay"]) dolibarr_set_const($db, "MAIN_DELAY_SUPPLIER_BILLS_TO_PAY",$_POST["SupplierBillsToPay"],'chaine',0,'',$conf->entity);
- if ($_POST["TransactionsToConciliate"]) dolibarr_set_const($db, "MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE",$_POST["TransactionsToConciliate"],'chaine',0,'',$conf->entity);
- if ($_POST["ChequesToDeposit"]) dolibarr_set_const($db, "MAIN_DELAY_CHEQUES_TO_DEPOSIT",$_POST["ChequesToDeposit"],'chaine',0,'',$conf->entity);
- if ($_POST["Members"]) dolibarr_set_const($db, "MAIN_DELAY_MEMBERS",$_POST["Members"],'chaine',0,'',$conf->entity);
+ foreach($modules as $module => $delays)
+ {
+ if (! empty($conf->$module->enabled))
+ {
+ foreach($delays as $delay)
+ {
+ if (GETPOST($delay['code']))
+ {
+ dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
+ }
+ }
+ }
+ }
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
}
@@ -72,10 +134,9 @@ print " \n";
$form = new Form($db);
$countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
-
if ($action == 'edit')
{
- print '
';
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 71ec16150b6..13864a37183 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville
* Copyright (C) 2004-2012 Laurent Destailleur
* Copyright (C) 2004 Benoit Mortier
- * Copyright (C) 2005-2010 Regis Houssin
+ * Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2010-2011 Juanjo Menent
* Copyright (C) 2011 Philippe Grand
* Copyright (C) 2011 Remy Younes
@@ -279,24 +279,24 @@ $tabcond[1] = true;
$tabcond[2] = true;
$tabcond[3] = true;
$tabcond[4] = true;
-$tabcond[5] = $conf->societe->enabled||$conf->adherent->enabled;
-$tabcond[6] = $conf->agenda->enabled;
-$tabcond[7] = $conf->tax->enabled;
-$tabcond[8] = $conf->societe->enabled;
+$tabcond[5] = (! empty($conf->societe->enabled) || ! empty($conf->adherent->enabled));
+$tabcond[6] = ! empty($conf->agenda->enabled);
+$tabcond[7] = ! empty($conf->tax->enabled);
+$tabcond[8] = ! empty($conf->societe->enabled);
$tabcond[9] = true;
$tabcond[10]= true;
$tabcond[11]= true;
-$tabcond[12]= $conf->commande->enabled||$conf->propal->enabled||$conf->facture->enabled||$conf->fournisseur->enabled;
-$tabcond[13]= $conf->commande->enabled||$conf->propal->enabled||$conf->facture->enabled||$conf->fournisseur->enabled;
-$tabcond[14]= $conf->product->enabled&&$conf->ecotax->enabled;
+$tabcond[12]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
+$tabcond[13]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
+$tabcond[14]= (! empty($conf->product->enabled) && ! empty($conf->ecotax->enabled));
$tabcond[15]= true;
-$tabcond[16]= $conf->societe->enabled && empty($conf->global->SOCIETE_DISABLE_PROSPECTS);
-$tabcond[17]= $conf->deplacement->enabled;
-$tabcond[18]= $conf->expedition->enabled;
-$tabcond[19]= $conf->societe->enabled;
-$tabcond[20]= $conf->fournisseur->enabled;
-$tabcond[21]= $conf->propal->enabled;
-$tabcond[22]= $conf->commande->enabled||$conf->propal->enabled;
+$tabcond[16]= (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
+$tabcond[17]= ! empty($conf->deplacement->enabled);
+$tabcond[18]= ! empty($conf->expedition->enabled);
+$tabcond[19]= ! empty($conf->societe->enabled);
+$tabcond[20]= ! empty($conf->fournisseur->enabled);
+$tabcond[21]= ! empty($conf->propal->enabled);
+$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
// List of help for fields
$tabhelp=array();
@@ -347,7 +347,7 @@ if ($id == 11)
"facture"=>$langs->trans("Bill"),
"facture_fourn"=>$langs->trans("SupplierBill"),
"fichinter"=>$langs->trans("InterventionCard"));
- if ($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES) $elementList["societe"]=$langs->trans("ThirdParty");
+ if (! empty($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES)) $elementList["societe"]=$langs->trans("ThirdParty");
$sourceList = array("internal"=>$langs->trans("Internal"),
"external"=>$langs->trans("External"));
}
@@ -356,7 +356,7 @@ $msg='';
// Actions ajout ou modification d'une entree dans un dictionnaire de donnee
-if ($_POST["actionadd"] || $_POST["actionmodify"])
+if (GETPOST('actionadd') || GETPOST('actionmodify'))
{
$listfield=explode(',',$tabfield[$id]);
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
@@ -401,7 +401,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
}
// Si verif ok et action add, on ajoute la ligne
- if ($ok && $_POST["actionadd"])
+ if ($ok && GETPOST('actionadd'))
{
if ($tabrowid[$id])
{
@@ -466,7 +466,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
}
// Si verif ok et action modify, on modifie la ligne
- if ($ok && $_POST["actionmodify"])
+ if ($ok && GETPOST('actionmodify'))
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
@@ -509,7 +509,7 @@ if ($_POST["actionadd"] || $_POST["actionmodify"])
$_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition
}
-if ($_POST["actioncancel"])
+if (GETPOST('actioncancel'))
{
$_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition
}
@@ -619,7 +619,7 @@ if ($id)
// Complete requete recherche valeurs avec critere de tri
$sql=$tabsql[$id];
- if ($_GET["sortfield"])
+ if (GETPOST('sortfield'))
{
// If sort order is "pays", we use pays_code instead
if ($_GET["sortfield"] == 'pays') $_GET["sortfield"]='pays_code';
@@ -687,7 +687,7 @@ if ($id)
if ($valuetoshow != '')
{
print '
';
- if (preg_match('/http:/i',$tabhelp[$id][$value])) print ''.$valuetoshow.'';
+ if (! empty($tabhelp[$id][$value]) && preg_match('/http:/i',$tabhelp[$id][$value])) print ''.$valuetoshow.'';
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
else print $valuetoshow;
print '
';
@@ -704,7 +704,7 @@ if ($id)
$obj='';
// If data was already input, we define them in obj to populate input fields.
- if ($_POST["actionadd"])
+ if (GETPOST('actionadd'))
{
foreach ($fieldlist as $key=>$val)
{
@@ -795,7 +795,7 @@ if ($id)
//print_r($obj);
print "
';
@@ -3017,7 +3020,7 @@ else if ($id > 0 || ! empty($ref))
}
}
- if ($conf->global->FACTURE_SHOW_SEND_REMINDER) // For backward compatibility
+ if (! empty($conf->global->FACTURE_SHOW_SEND_REMINDER)) // For backward compatibility
{
if (($object->statut == 1 || $object->statut == 2) && $resteapayer > 0)
{
diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php
index dafb75b4e04..fb8711d7c12 100644
--- a/htdocs/contact/canvas/actions_contactcard_common.class.php
+++ b/htdocs/contact/canvas/actions_contactcard_common.class.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2010-2012 Regis Houssin
*
* 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
@@ -227,9 +227,10 @@ abstract class ActionsContactCardCommon
* Set content of ->tpl array, to use into template
*
* @param string &$action Type of action
+ * @param int $id Id
* @return string HTML output
*/
- function assign_values(&$action)
+ function assign_values(&$action, $id)
{
global $conf, $langs, $user, $canvas;
global $form, $formcompany, $objsoc;
@@ -273,7 +274,7 @@ abstract class ActionsContactCardCommon
$this->tpl['select_civility'] = $formcompany->select_civility($this->object->civilite_id);
// 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->zip)) == 0) $this->object->zip = $objsoc->zip;
diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php
index ed186b92348..1cb87732ddc 100644
--- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php
+++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2011 Laurent Destailleur
+/* Copyright (C) 2010-2012 Regis Houssin
+ * Copyright (C) 2011 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
@@ -38,15 +38,15 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
/**
* 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 $targetmodule Name of directory of module where canvas is stored
* @param string $canvas Name of 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->targetmodule = $targetmodule;
$this->canvas = $canvas;
@@ -86,7 +86,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
$ret = $this->getObject($id);
- parent::assign_values($action);
+ parent::assign_values($action, $id);
$this->tpl['title'] = $this->getTitle($action);
$this->tpl['error'] = $this->error;
@@ -102,7 +102,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon
$this->tpl['showend']=dol_get_fiche_end();
$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);
diff --git a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php
index c4b48767f2f..34b077eac9b 100644
--- a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php
+++ b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php
@@ -40,7 +40,7 @@ echo $this->control->tpl['ajax_selectcountry'];
-control->tpl['company_id']) { ?>
+control->tpl['company_id'])) { ?>
diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
index fe878bf95f0..53f29e5397e 100644
--- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
+++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2010-2012 Regis Houssin
*
* 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
@@ -26,8 +26,8 @@ $contact = $GLOBALS['objcanvas']->control->object;
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
?>
-control->tpl['action_create_user']) echo $this->control->tpl['action_create_user']; ?>
-control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
+control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?>
+control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 58356a5f386..d9b69e35fcf 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2002-2004 Rodolphe Quiedeville
* Copyright (C) 2004 Benoit Mortier
* Copyright (C) 2004-2010 Laurent Destailleur
- * Copyright (C) 2005-2008 Regis Houssin
+ * Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2007 Franky Van Liedekerke
* Copyright (C) 2008 Raphael Bertrand (Resultic)
*
@@ -534,7 +534,6 @@ class Contact extends CommonObject
$this->mail = $obj->email;
$this->birthday = $this->db->jdate($obj->birthday);
- $this->birthday_alert = $obj->birthday_alert;
$this->note = $obj->note;
$this->default_lang = $obj->default_lang;
$this->user_id = $obj->user_id;
diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php
index 7487bf6d06f..b13f960e9de 100644
--- a/htdocs/contact/fiche.php
+++ b/htdocs/contact/fiche.php
@@ -50,7 +50,8 @@ $object = new Contact($db);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($id);
-$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
+$objcanvas=null;
+$canvas = (! empty($object->canvas)?$object->canvas:GETPOST("canvas"));
if (! empty($canvas))
{
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index b6723bb6623..d71dcc44225 100755
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -31,7 +31,7 @@ $langs->load("companies");
$langs->load("suppliers");
// Security check
-$contactid = isset($_GET["id"])?$_GET["id"]:'';
+$contactid = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid,'');
@@ -54,6 +54,8 @@ $sall=GETPOST("contactname");
$sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder");
$page = GETPOST("page");
+$userid=GETPOST('userid');
+$begin=GETPOST('begin');
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.name";
@@ -86,9 +88,9 @@ else if ($type == "o")
if ($view == 'phone') { $text=" (Vue Telephones)"; }
if ($view == 'mail') { $text=" (Vue EMail)"; }
if ($view == 'recent') { $text=" (Recents)"; }
-$titre.= " $text";
+if (! empty($text)) $titre.= " $text";
-if ($_POST["button_removefilter"])
+if (GETPOST('button_removefilter'))
{
$search_nom="";
$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)";
}
-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
@@ -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)."%')";
}
-if ($socid)
+if (! empty($socid))
{
$sql .= " AND s.rowid = ".$socid;
}
@@ -235,8 +237,7 @@ if ($result)
{
$contactstatic=new Contact($db);
- $begin=$_GET["begin"];
- $param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($_GET["userid"]).'&contactname='.urlencode($sall);
+ $param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($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);
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
@@ -408,7 +409,7 @@ if ($result)
print '';
- if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '&begin='.$begin.'&view='.$view.'&userid='.$_GET["userid"], $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
+ if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], '&begin='.$begin.'&view='.$view.'&userid='.$userid, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
$db->free($result);
}
@@ -419,7 +420,7 @@ else
print ' ';
-$db->close();
llxFooter();
+$db->close();
?>
diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php
index 8cf299ec133..26a3b90ea59 100644
--- a/htdocs/contact/perso.php
+++ b/htdocs/contact/perso.php
@@ -131,7 +131,7 @@ if ($action == 'edit')
print '';
print '
'.$langs->trans("Alert").': ';
- if ($object->birthday_alert)
+ if (! empty($object->birthday_alert))
{
print '
';
}
@@ -193,7 +193,7 @@ else
// Date To Birth
print '
';
- if ($object->birthday != '')
+ if (! empty($object->birthday))
{
include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
@@ -225,7 +225,6 @@ else
dol_fiche_end();
-
if ($action != 'edit')
{
// Barre d'actions
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index aa0c71dbd45..a41aee430b8 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -772,13 +772,13 @@ abstract class CommonObject
$sql = "SELECT MAX(te.".$fieldid.")";
$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";
$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($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 ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
+ 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 (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
//print $sql." ";
$result = $this->db->query($sql);
@@ -793,13 +793,13 @@ abstract class CommonObject
$sql = "SELECT MIN(te.".$fieldid.")";
$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";
$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($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 ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
+ 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 (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
//print $sql." ";
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 42a6119c611..53ab7a49ddc 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2151,21 +2151,23 @@ class Form
$inputok=array();
$inputko=array();
- if (is_array($formquestion) && count($formquestion) > 0)
+ if (is_array($formquestion) && ! empty($formquestion))
{
$more.='